Allow to reset volume to 100% in GUI

This commit is contained in:
Klaus Basan
2015-02-14 19:12:41 +01:00
parent df1c0c65da
commit 41b7291a21
3 changed files with 36 additions and 1 deletions

View File

@@ -29,6 +29,8 @@ namespace BlackGui
Q_ASSERT(c); Q_ASSERT(c);
c = connect(this->ui->sb_Volume, static_cast<void (QSpinBox::*)(int)> (&QSpinBox::valueChanged), this, &CAudioVolumeComponent::ps_changeOutputVolumeFromSpinBox); c = connect(this->ui->sb_Volume, static_cast<void (QSpinBox::*)(int)> (&QSpinBox::valueChanged), this, &CAudioVolumeComponent::ps_changeOutputVolumeFromSpinBox);
Q_ASSERT(c); Q_ASSERT(c);
c = connect(this->ui->pb_Volume100, &QPushButton::clicked, this, &CAudioVolumeComponent::ps_setVolume100);
Q_ASSERT(c);
Q_UNUSED(c); Q_UNUSED(c);
} }
@@ -38,6 +40,7 @@ namespace BlackGui
void CAudioVolumeComponent::runtimeHasBeenSet() void CAudioVolumeComponent::runtimeHasBeenSet()
{ {
// from audio context // from audio context
Q_ASSERT(this->getIContextAudio());
bool c = connect(this->getIContextAudio(), &IContextAudio::changedMute, this, &CAudioVolumeComponent::ps_onMuteChanged); bool c = connect(this->getIContextAudio(), &IContextAudio::changedMute, this, &CAudioVolumeComponent::ps_onMuteChanged);
Q_ASSERT(c); Q_ASSERT(c);
connect(this->getIContextAudio(), &IContextAudio::changedAudioVolume, this, &CAudioVolumeComponent::ps_onOutputVolumeChanged); connect(this->getIContextAudio(), &IContextAudio::changedAudioVolume, this, &CAudioVolumeComponent::ps_onOutputVolumeChanged);
@@ -56,6 +59,9 @@ namespace BlackGui
{ {
this->ui->lbl_ContextLocation->setText("remote"); this->ui->lbl_ContextLocation->setText("remote");
} }
// init volume
this->ps_changeOutputVolumeFromSlider(this->getIContextAudio()->getVoiceOutputVolume()); // init volume
} }
void CAudioVolumeComponent::ps_onMuteChanged(bool muted) void CAudioVolumeComponent::ps_onMuteChanged(bool muted)
@@ -76,7 +82,6 @@ namespace BlackGui
this->ui->sb_Volume->setToolTip(v); this->ui->sb_Volume->setToolTip(v);
} }
if (volume > 100) if (volume > 100)
{ {
int v = volume - 100; int v = volume - 100;
@@ -90,6 +95,11 @@ namespace BlackGui
} }
} }
void CAudioVolumeComponent::ps_setVolume100()
{
this->ps_onOutputVolumeChanged(100);
}
void CAudioVolumeComponent::ps_changeOutputVolumeFromSlider(int volume) void CAudioVolumeComponent::ps_changeOutputVolumeFromSlider(int volume)
{ {
if (volume > 100) if (volume > 100)

View File

@@ -47,6 +47,9 @@ namespace BlackGui
//! Volumes changed (elsewhere) //! Volumes changed (elsewhere)
void ps_onOutputVolumeChanged(int volume); void ps_onOutputVolumeChanged(int volume);
//! Set volume to 100
void ps_setVolume100();
//! Change values because of volume GUI controls //! Change values because of volume GUI controls
void ps_changeOutputVolumeFromSlider(int volume); void ps_changeOutputVolumeFromSlider(int volume);

View File

@@ -68,6 +68,9 @@
<property name="singleStep"> <property name="singleStep">
<number>5</number> <number>5</number>
</property> </property>
<property name="pageStep">
<number>20</number>
</property>
<property name="value"> <property name="value">
<number>90</number> <number>90</number>
</property> </property>
@@ -156,6 +159,25 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QPushButton" name="pb_Volume100">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>40</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>100%</string>
</property>
</widget>
</item>
<item> <item>
<spacer name="hs_AudioSoundButtons"> <spacer name="hs_AudioSoundButtons">
<property name="orientation"> <property name="orientation">