mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-09-24 23:31:36 +08:00
UI: Use OBSSourceLabel for VolControl
The OBSSourceLabel handles renaming of a source, so we don't have to use the rename signals for volume controls.
This commit is contained in:
+2
-11
@@ -5,6 +5,7 @@
|
||||
#include "mute-checkbox.hpp"
|
||||
#include "slider-ignorewheel.hpp"
|
||||
#include "slider-absoluteset-style.hpp"
|
||||
#include "source-label.hpp"
|
||||
#include <QFontDatabase>
|
||||
#include <QHBoxLayout>
|
||||
#include <QPushButton>
|
||||
@@ -219,16 +220,6 @@ void VolControl::updateText()
|
||||
slider->setAccessibleName(accText);
|
||||
}
|
||||
|
||||
QString VolControl::GetName() const
|
||||
{
|
||||
return nameLabel->text();
|
||||
}
|
||||
|
||||
void VolControl::SetName(const QString &newName)
|
||||
{
|
||||
nameLabel->setText(newName);
|
||||
}
|
||||
|
||||
void VolControl::EmitConfigClicked()
|
||||
{
|
||||
emit ConfigClicked();
|
||||
@@ -253,7 +244,7 @@ VolControl::VolControl(OBSSource source_, bool showConfig, bool vertical)
|
||||
vertical(vertical),
|
||||
contextMenu(nullptr)
|
||||
{
|
||||
nameLabel = new QLabel();
|
||||
nameLabel = new OBSSourceLabel(source);
|
||||
volLabel = new QLabel();
|
||||
mute = new MuteCheckBox();
|
||||
|
||||
|
||||
@@ -272,6 +272,7 @@ protected:
|
||||
class QLabel;
|
||||
class QSlider;
|
||||
class MuteCheckBox;
|
||||
class OBSSourceLabel;
|
||||
|
||||
class VolControl : public QWidget {
|
||||
Q_OBJECT
|
||||
@@ -279,7 +280,7 @@ class VolControl : public QWidget {
|
||||
private:
|
||||
OBSSource source;
|
||||
std::vector<OBSSignal> sigs;
|
||||
QLabel *nameLabel;
|
||||
OBSSourceLabel *nameLabel;
|
||||
QLabel *volLabel;
|
||||
VolumeMeter *volMeter;
|
||||
QSlider *slider;
|
||||
@@ -321,9 +322,6 @@ public:
|
||||
|
||||
inline obs_source_t *GetSource() const { return source; }
|
||||
|
||||
QString GetName() const;
|
||||
void SetName(const QString &newName);
|
||||
|
||||
void SetMeterDecayRate(qreal q);
|
||||
void setPeakMeterType(enum obs_peak_meter_type peakMeterType);
|
||||
|
||||
|
||||
@@ -3339,11 +3339,6 @@ void OBSBasic::RenameSources(OBSSource source, QString newName,
|
||||
{
|
||||
RenameListValues(ui->scenes, newName, prevName);
|
||||
|
||||
for (size_t i = 0; i < volumes.size(); i++) {
|
||||
if (volumes[i]->GetName().compare(prevName) == 0)
|
||||
volumes[i]->SetName(newName);
|
||||
}
|
||||
|
||||
if (vcamConfig.type == VCamOutputType::SourceOutput &&
|
||||
prevName == QString::fromStdString(vcamConfig.source))
|
||||
vcamConfig.source = newName.toStdString();
|
||||
|
||||
Reference in New Issue
Block a user