Skip to content

Commit f506e3e

Browse files
committed
[WIP] VolumeMeter cleanup + paint optimizations maybe
1 parent aa7198f commit f506e3e

File tree

7 files changed

+202
-433
lines changed

7 files changed

+202
-433
lines changed

frontend/cmake/ui-utility.cmake

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,4 @@ target_sources(
6868
utility/undo_stack.cpp
6969
utility/undo_stack.hpp
7070
utility/VCamConfig.hpp
71-
utility/VolumeMeterTimer.cpp
72-
utility/VolumeMeterTimer.hpp
7371
)

frontend/data/themes/Yami.obt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1692,7 +1692,8 @@ QSlider::handle:disabled {
16921692
border-color: transparent;
16931693
}
16941694

1695-
VolControl {
1695+
VolControl,
1696+
VolumeMeter {
16961697
background: var(--bg_base);
16971698
}
16981699

@@ -1800,7 +1801,6 @@ VolControl #volLabel {
18001801
}
18011802

18021803
VolumeMeter {
1803-
background: transparent;
18041804
color: var(--grey3);
18051805
font-size: 7.5pt;
18061806
font-weight: bold;
@@ -1818,6 +1818,8 @@ VolumeMeter {
18181818

18191819
/* Hidden Volume Controls */
18201820
VolControl.volume-hidden,
1821+
VolControl.volume-hidden VolumeMeter,
1822+
VolControl.volume-inactive VolumeMeter,
18211823
VolControl.volume-inactive {
18221824
background: var(--grey7);
18231825
}

frontend/utility/VolumeMeterTimer.cpp

Lines changed: 0 additions & 28 deletions
This file was deleted.

frontend/utility/VolumeMeterTimer.hpp

Lines changed: 0 additions & 19 deletions
This file was deleted.

frontend/widgets/VolControl.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ VolControl::VolControl(obs_source_t *source, bool vertical, QWidget *parent)
5454
contextMenu(nullptr),
5555
QFrame(parent)
5656
{
57+
setAttribute(Qt::WA_OpaquePaintEvent, true);
58+
5759
utils = new idian::Utils(this);
5860

5961
uuid = obs_source_get_uuid(source);
@@ -98,7 +100,7 @@ VolControl::VolControl(obs_source_t *source, bool vertical, QWidget *parent)
98100
bool muted = obs_source_muted(source);
99101
bool unassigned = isSourceUnassigned(source);
100102

101-
volMeter->muted = muted || unassigned;
103+
volMeter->setMuted(muted || unassigned);
102104

103105
setLayoutVertical(vertical);
104106
setName(sourceName);
@@ -572,6 +574,7 @@ void VolControl::updateCategoryLabel()
572574
categoryLabel->setText(labelText);
573575

574576
utils->polishChildren(this);
577+
volMeter->updateBackgroundCache();
575578
}
576579

577580
void VolControl::updateDecayRate()
@@ -694,7 +697,7 @@ void VolControl::updateMixerState()
694697
bool showAsMonitored = monitoringType != OBS_MONITORING_TYPE_NONE;
695698
bool showAsUnassigned = !muted && unassigned;
696699

697-
volMeter->muted = (showAsMuted || showAsUnassigned) && !showAsMonitored;
700+
volMeter->setMuted((showAsMuted || showAsUnassigned) && !showAsMonitored);
698701

699702
// Qt doesn't support overriding the QPushButton icon using pseudo state selectors like :checked
700703
// in QSS so we set a checked class selector on the button to be used instead.

0 commit comments

Comments
 (0)