Add volume increment setting
This commit is contained in:
parent
e357ba0125
commit
ef99f0ef36
|
@ -96,6 +96,7 @@ Player::Player(Application *app, QObject *parent)
|
|||
greyout_(true),
|
||||
menu_previousmode_(BehaviourSettingsPage::PreviousBehaviour::DontRestart),
|
||||
seek_step_sec_(10),
|
||||
volume_increment_(5),
|
||||
play_offset_nanosec_(0) {
|
||||
|
||||
Settings s;
|
||||
|
@ -217,6 +218,7 @@ void Player::ReloadSettings() {
|
|||
s.beginGroup(BehaviourSettingsPage::kSettingsGroup);
|
||||
menu_previousmode_ = static_cast<BehaviourSettingsPage::PreviousBehaviour>(s.value("menu_previousmode", static_cast<int>(BehaviourSettingsPage::PreviousBehaviour::DontRestart)).toInt());
|
||||
seek_step_sec_ = s.value("seek_step_sec", 10).toInt();
|
||||
volume_increment_ = s.value("volume_increment", 5).toUInt();
|
||||
s.endGroup();
|
||||
|
||||
engine_->ReloadSettings();
|
||||
|
@ -700,7 +702,7 @@ void Player::SetVolume(const uint volume) {
|
|||
void Player::VolumeUp() {
|
||||
|
||||
uint old_volume = GetVolume();
|
||||
uint new_volume = std::min(old_volume + 5, static_cast<uint>(100));
|
||||
uint new_volume = std::min(old_volume + volume_increment_, static_cast<uint>(100));
|
||||
if (new_volume == old_volume) return;
|
||||
SetVolume(new_volume);
|
||||
|
||||
|
@ -709,7 +711,7 @@ void Player::VolumeUp() {
|
|||
void Player::VolumeDown() {
|
||||
|
||||
uint old_volume = GetVolume();
|
||||
uint new_volume = static_cast<uint>(std::max(static_cast<int>(old_volume) - 5, 0));
|
||||
uint new_volume = static_cast<uint>(std::max(static_cast<int>(old_volume) - static_cast<int>(volume_increment_), 0));
|
||||
if (new_volume == old_volume) return;
|
||||
SetVolume(new_volume);
|
||||
|
||||
|
|
|
@ -244,6 +244,7 @@ class Player : public PlayerInterface {
|
|||
bool greyout_;
|
||||
BehaviourSettingsPage::PreviousBehaviour menu_previousmode_;
|
||||
int seek_step_sec_;
|
||||
uint volume_increment_;
|
||||
|
||||
QDateTime pause_time_;
|
||||
quint64 play_offset_nanosec_;
|
||||
|
|
|
@ -214,6 +214,8 @@ void BehaviourSettingsPage::Load() {
|
|||
|
||||
ui_->spinbox_seekstepsec->setValue(s.value("seek_step_sec", 10).toInt());
|
||||
|
||||
ui_->spinbox_volumeincrement->setValue(s.value("volume_increment", 5).toInt());
|
||||
|
||||
s.endGroup();
|
||||
|
||||
Init(ui_->layout_behavioursettingspage->parentWidget());
|
||||
|
@ -263,6 +265,8 @@ void BehaviourSettingsPage::Save() {
|
|||
|
||||
s.setValue("seek_step_sec", ui_->spinbox_seekstepsec->value());
|
||||
|
||||
s.setValue("volume_increment", ui_->spinbox_volumeincrement->value());
|
||||
|
||||
s.endGroup();
|
||||
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>572</width>
|
||||
<height>915</height>
|
||||
<height>931</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -326,6 +326,51 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupbox_volumeincrement">
|
||||
<property name="title">
|
||||
<string>Volume Increment</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_volumeincrement">
|
||||
<property name="text">
|
||||
<string>Volume Increment</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinbox_volumeincrement">
|
||||
<property name="suffix">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>25</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>5</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="spacer_volumeincrement">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="spacer_bottom">
|
||||
<property name="orientation">
|
||||
|
|
Loading…
Reference in New Issue