mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-06 10:15:38 +08:00
Ref T604, remember last audio volume
* adjust setting * save setting
This commit is contained in:
committed by
Mat Sutcliffe
parent
56d72b94c1
commit
d509b1eb09
@@ -104,7 +104,9 @@ namespace BlackGui
|
||||
Q_ASSERT(c);
|
||||
c = connect(ui->pb_SoundDir, &QPushButton::released, this, &CAudioSetupComponent::selectNotificationSoundsDir, Qt::QueuedConnection);
|
||||
Q_ASSERT(c);
|
||||
c = connect(ui->sb_NotificationValueVolume, qOverload<int>(&QSpinBox::valueChanged), this, &CAudioSetupComponent::onVolumeChanged);
|
||||
|
||||
// volumes
|
||||
c = connect(ui->sb_NotificationValueVolume, qOverload<int>(&QSpinBox::valueChanged), this, &CAudioSetupComponent::onNotificationVolumeChanged);
|
||||
Q_ASSERT(c);
|
||||
}
|
||||
Q_UNUSED(c);
|
||||
@@ -152,7 +154,7 @@ namespace BlackGui
|
||||
return sGui && sGui->getIContextAudio() && !sGui->getIContextAudio()->isEmptyObject();
|
||||
}
|
||||
|
||||
void CAudioSetupComponent::onVolumeChanged(int volume)
|
||||
void CAudioSetupComponent::onNotificationVolumeChanged(int volume)
|
||||
{
|
||||
volume = qMax(25, qMin(100, volume));
|
||||
CSettings as(m_audioSettings.getThreadLocal());
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace BlackGui
|
||||
bool hasAudio() const;
|
||||
|
||||
//! Volume has been changed
|
||||
void onVolumeChanged(int volume);
|
||||
void onNotificationVolumeChanged(int volume);
|
||||
|
||||
//! CheckBox to flag
|
||||
BlackMisc::Audio::CNotificationSounds::NotificationFlag checkBoxToFlag(const QCheckBox *cb) const;
|
||||
|
||||
@@ -33,6 +33,12 @@ namespace BlackGui
|
||||
ui(new Ui::CAudioVolumeComponent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
const int volume = sGui && sGui->getIContextAudio() ?
|
||||
sGui->getIContextAudio()->getVoiceOutputVolume() :
|
||||
100;
|
||||
ui->hs_Volume->setValue(volumeToSliderValue(volume));
|
||||
ui->sb_Volume->setValue(volume);
|
||||
|
||||
bool c = connect(ui->pb_ShowWinMixer, &QPushButton::pressed, this, &CAudioVolumeComponent::onWindowsMixerRequested);
|
||||
Q_ASSERT(c);
|
||||
Q_UNUSED(c);
|
||||
@@ -68,7 +74,7 @@ namespace BlackGui
|
||||
}
|
||||
|
||||
// init volume
|
||||
this->changeOutputVolumeFromSlider(sGui->getIContextAudio()->getVoiceOutputVolume()); // init volume
|
||||
this->changeOutputVolumeFromSpinBox(volume); // init volume
|
||||
}
|
||||
|
||||
CAudioVolumeComponent::~CAudioVolumeComponent()
|
||||
@@ -92,19 +98,20 @@ namespace BlackGui
|
||||
ui->sb_Volume->setToolTip(v);
|
||||
}
|
||||
|
||||
if (volume > 100)
|
||||
{
|
||||
int vol = volume - 100;
|
||||
volume = 100 + vol / 5;
|
||||
}
|
||||
|
||||
if (volume != ui->hs_Volume->value())
|
||||
{
|
||||
ui->hs_Volume->setValue(volume);
|
||||
ui->hs_Volume->setValue(volumeToSliderValue(volume));
|
||||
ui->hs_Volume->setToolTip(v);
|
||||
}
|
||||
}
|
||||
|
||||
int CAudioVolumeComponent::volumeToSliderValue(int volume)
|
||||
{
|
||||
if (volume <= 100) { return volume; }
|
||||
const int vol = volume - 100;
|
||||
return 100 + vol / 5;
|
||||
}
|
||||
|
||||
void CAudioVolumeComponent::setVolume100()
|
||||
{
|
||||
this->onOutputVolumeChanged(100);
|
||||
|
||||
@@ -53,6 +53,9 @@ namespace BlackGui
|
||||
//! Requested windows mixer
|
||||
void onWindowsMixerRequested();
|
||||
|
||||
//! slider value
|
||||
static int volumeToSliderValue(int volume);
|
||||
|
||||
QScopedPointer<Ui::CAudioVolumeComponent> ui;
|
||||
};
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user