Skip to content

Commit

Permalink
UI: Use OBSSourceLabel for VolControl
Browse files Browse the repository at this point in the history
The OBSSourceLabel handles renaming of a source, so we don't have
to use the rename signals for volume controls.
  • Loading branch information
cg2121 authored and tt2468 committed May 12, 2024
1 parent 272a5ed commit b82a49e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 20 deletions.
13 changes: 2 additions & 11 deletions UI/volume-control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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();
Expand All @@ -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();

Expand Down
6 changes: 2 additions & 4 deletions UI/volume-control.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,14 +272,15 @@ class VolumeMeterTimer : public QTimer {
class QLabel;
class QSlider;
class MuteCheckBox;
class OBSSourceLabel;

class VolControl : public QWidget {
Q_OBJECT

private:
OBSSource source;
std::vector<OBSSignal> sigs;
QLabel *nameLabel;
OBSSourceLabel *nameLabel;
QLabel *volLabel;
VolumeMeter *volMeter;
QSlider *slider;
Expand Down Expand Up @@ -321,9 +322,6 @@ private slots:

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);

Expand Down
5 changes: 0 additions & 5 deletions UI/window-basic-main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit b82a49e

Please sign in to comment.