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:
cg2121
2024-05-11 18:18:13 -07:00
committed by tt2468
parent 272a5edbaa
commit b82a49e881
3 changed files with 4 additions and 20 deletions
+2 -11
View File
@@ -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();
+2 -4
View File
@@ -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);
-5
View File
@@ -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();