Skip to content

Commit a42a6c4

Browse files
Warchamp7RytoEX
authored andcommitted
frontend: Refactor and update Audio Mixer
1 parent 3e5cd44 commit a42a6c4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+3458
-1738
lines changed

frontend/OBSApp.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ void OBSApp::InitUserConfigDefaults()
371371
config_set_default_bool(userConfig, "BasicWindow", "ShowContextToolbars", true);
372372
config_set_default_bool(userConfig, "BasicWindow", "StudioModeLabels", true);
373373

374-
config_set_default_bool(userConfig, "BasicWindow", "VerticalVolControl", true);
374+
config_set_default_bool(userConfig, "BasicWindow", "VerticalVolumeControl", true);
375375

376376
config_set_default_bool(userConfig, "BasicWindow", "MultiviewMouseSwitch", true);
377377

@@ -381,6 +381,11 @@ void OBSApp::InitUserConfigDefaults()
381381

382382
config_set_default_bool(userConfig, "BasicWindow", "MediaControlsCountdownTimer", true);
383383

384+
config_set_default_bool(App()->GetUserConfig(), "BasicWindow", "MixerShowInactive", false);
385+
config_set_default_bool(App()->GetUserConfig(), "BasicWindow", "MixerKeepInactiveLast", false);
386+
config_set_default_bool(App()->GetUserConfig(), "BasicWindow", "MixerShowHidden", false);
387+
config_set_default_bool(App()->GetUserConfig(), "BasicWindow", "MixerKeepHiddenLast", false);
388+
384389
config_set_default_int(userConfig, "Appearance", "FontScale", 10);
385390
config_set_default_int(userConfig, "Appearance", "Density", 1);
386391
}

frontend/cmake/ui-components.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,14 @@ target_sources(
8585
components/VisibilityItemDelegate.hpp
8686
components/VisibilityItemWidget.cpp
8787
components/VisibilityItemWidget.hpp
88+
components/VolumeAccessibleInterface.cpp
89+
components/VolumeAccessibleInterface.hpp
90+
components/VolumeControl.cpp
91+
components/VolumeControl.hpp
92+
components/VolumeMeter.cpp
93+
components/VolumeMeter.hpp
94+
components/VolumeName.cpp
95+
components/VolumeName.hpp
8896
components/VolumeSlider.cpp
8997
components/VolumeSlider.hpp
9098
components/WindowCaptureToolbar.cpp

frontend/cmake/ui-utility.cmake

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@ target_sources(
5959
utility/StartMultiTrackVideoStreamingGuard.hpp
6060
utility/SurfaceEventFilter.hpp
6161
utility/VCamConfig.hpp
62-
utility/VolumeMeterTimer.cpp
63-
utility/VolumeMeterTimer.hpp
6462
utility/audio-encoders.cpp
6563
utility/audio-encoders.hpp
6664
utility/display-helpers.hpp

frontend/cmake/ui-widgets.cmake

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ target_link_libraries(obs-studio PRIVATE OBS::qt-vertical-scroll-area)
1010
target_sources(
1111
obs-studio
1212
PRIVATE
13+
widgets/AudioMixer.cpp
14+
widgets/AudioMixer.hpp
1315
widgets/ColorSelect.cpp
1416
widgets/ColorSelect.hpp
1517
widgets/OBSBasic.cpp
@@ -41,7 +43,6 @@ target_sources(
4143
widgets/OBSBasic_Transitions.cpp
4244
widgets/OBSBasic_Updater.cpp
4345
widgets/OBSBasic_VirtualCam.cpp
44-
widgets/OBSBasic_VolControl.cpp
4546
widgets/OBSBasic_YouTube.cpp
4647
widgets/OBSBasicControls.cpp
4748
widgets/OBSBasicControls.hpp
@@ -58,10 +59,4 @@ target_sources(
5859
widgets/OBSQTDisplay.hpp
5960
widgets/StatusBarWidget.cpp
6061
widgets/StatusBarWidget.hpp
61-
widgets/VolControl.cpp
62-
widgets/VolControl.hpp
63-
widgets/VolumeAccessibleInterface.cpp
64-
widgets/VolumeAccessibleInterface.hpp
65-
widgets/VolumeMeter.cpp
66-
widgets/VolumeMeter.hpp
6762
)

frontend/components/MenuCheckBox.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
#include "MenuCheckBox.hpp"
1919

2020
#include <QMenu>
21+
#include <QMouseEvent>
22+
#include <QStyleOptionButton>
23+
#include <QStylePainter>
2124

2225
MenuCheckBox::MenuCheckBox(const QString &text, QWidget *parent) : QCheckBox(text, parent)
2326
{

frontend/components/OBSSourceLabel.cpp

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,28 +18,43 @@
1818
#include "OBSSourceLabel.hpp"
1919
#include "moc_OBSSourceLabel.cpp"
2020

21-
void OBSSourceLabel::SourceRenamed(void *data, calldata_t *params)
21+
OBSSourceLabel::OBSSourceLabel(const obs_source_t *source, QWidget *parent, Qt::WindowFlags f)
22+
: QLabel(obs_source_get_name(source), parent, f),
23+
renamedSignal(obs_source_get_signal_handler(source), "rename", &OBSSourceLabel::obsSourceRenamed, this),
24+
removedSignal(obs_source_get_signal_handler(source), "remove", &OBSSourceLabel::obsSourceRemoved, this),
25+
destroyedSignal(obs_source_get_signal_handler(source), "destroy", &OBSSourceLabel::obsSourceDestroyed, this)
26+
{
27+
}
28+
29+
void OBSSourceLabel::obsSourceRenamed(void *data, calldata_t *params)
2230
{
2331
auto &label = *static_cast<OBSSourceLabel *>(data);
2432

2533
const char *name = calldata_string(params, "new_name");
2634
label.setText(name);
2735

28-
emit label.Renamed(name);
36+
emit label.renamed(name);
2937
}
3038

31-
void OBSSourceLabel::SourceRemoved(void *data, calldata_t *)
39+
void OBSSourceLabel::obsSourceRemoved(void *data, calldata_t *)
3240
{
3341
auto &label = *static_cast<OBSSourceLabel *>(data);
34-
emit label.Removed();
42+
emit label.removed();
3543
}
3644

37-
void OBSSourceLabel::SourceDestroyed(void *data, calldata_t *)
45+
void OBSSourceLabel::obsSourceDestroyed(void *data, calldata_t *)
3846
{
3947
auto &label = *static_cast<OBSSourceLabel *>(data);
40-
emit label.Destroyed();
48+
emit label.destroyed();
4149

4250
label.destroyedSignal.Disconnect();
4351
label.removedSignal.Disconnect();
4452
label.renamedSignal.Disconnect();
4553
}
54+
55+
void OBSSourceLabel::mousePressEvent(QMouseEvent *event)
56+
{
57+
emit clicked();
58+
59+
QLabel::mousePressEvent(event);
60+
}

frontend/components/OBSSourceLabel.hpp

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,17 @@ class OBSSourceLabel : public QLabel {
2929
OBSSignal removedSignal;
3030
OBSSignal destroyedSignal;
3131

32-
OBSSourceLabel(const obs_source_t *source, QWidget *parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags())
33-
: QLabel(obs_source_get_name(source), parent, f),
34-
renamedSignal(obs_source_get_signal_handler(source), "rename", &OBSSourceLabel::SourceRenamed, this),
35-
removedSignal(obs_source_get_signal_handler(source), "remove", &OBSSourceLabel::SourceRemoved, this),
36-
destroyedSignal(obs_source_get_signal_handler(source), "destroy", &OBSSourceLabel::SourceDestroyed,
37-
this)
38-
{
39-
}
32+
OBSSourceLabel(const obs_source_t *source, QWidget *parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
4033

4134
protected:
42-
static void SourceRenamed(void *data, calldata_t *params);
43-
static void SourceRemoved(void *data, calldata_t *params);
44-
static void SourceDestroyed(void *data, calldata_t *params);
35+
static void obsSourceRenamed(void *data, calldata_t *params);
36+
static void obsSourceRemoved(void *data, calldata_t *params);
37+
static void obsSourceDestroyed(void *data, calldata_t *params);
38+
void mousePressEvent(QMouseEvent *event);
4539

4640
signals:
47-
void Renamed(const char *name);
48-
void Removed();
49-
void Destroyed();
41+
void renamed(const char *name);
42+
void removed();
43+
void destroyed();
44+
void clicked();
5045
};
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)