Merge pull request #4938 from eduardosm/esm-branch1
Add option to change the time step when seeking using the keyboard.
This commit is contained in:
commit
bce62a0558
|
@ -53,10 +53,6 @@ using std::shared_ptr;
|
|||
|
||||
const char* Player::kSettingsGroup = "Player";
|
||||
|
||||
namespace {
|
||||
const int kSeekStepSec = 10;
|
||||
}
|
||||
|
||||
Player::Player(Application* app, QObject* parent)
|
||||
: PlayerInterface(parent),
|
||||
app_(app),
|
||||
|
@ -67,7 +63,8 @@ Player::Player(Application* app, QObject* parent)
|
|||
nb_errors_received_(0),
|
||||
volume_before_mute_(50),
|
||||
last_pressed_previous_(QDateTime::currentDateTime()),
|
||||
menu_previousmode_(PreviousBehaviour_DontRestart) {
|
||||
menu_previousmode_(PreviousBehaviour_DontRestart),
|
||||
seek_step_sec_(10) {
|
||||
settings_.beginGroup("Player");
|
||||
|
||||
SetVolume(settings_.value("volume", 50).toInt());
|
||||
|
@ -107,8 +104,12 @@ void Player::ReloadSettings() {
|
|||
|
||||
menu_previousmode_ = PreviousBehaviour(
|
||||
s.value("menu_previousmode", PreviousBehaviour_DontRestart).toInt());
|
||||
|
||||
seek_step_sec_ = s.value("seek_step_sec", 10).toInt();
|
||||
|
||||
s.endGroup();
|
||||
|
||||
|
||||
engine_->ReloadSettings();
|
||||
}
|
||||
|
||||
|
@ -448,11 +449,11 @@ void Player::SeekTo(int seconds) {
|
|||
}
|
||||
|
||||
void Player::SeekForward() {
|
||||
SeekTo(engine()->position_nanosec() / kNsecPerSec + kSeekStepSec);
|
||||
SeekTo(engine()->position_nanosec() / kNsecPerSec + seek_step_sec_);
|
||||
}
|
||||
|
||||
void Player::SeekBackward() {
|
||||
SeekTo(engine()->position_nanosec() / kNsecPerSec - kSeekStepSec);
|
||||
SeekTo(engine()->position_nanosec() / kNsecPerSec - seek_step_sec_);
|
||||
}
|
||||
|
||||
void Player::EngineMetadataReceived(const Engine::SimpleMetaBundle& bundle) {
|
||||
|
|
|
@ -210,6 +210,7 @@ class Player : public PlayerInterface {
|
|||
|
||||
QDateTime last_pressed_previous_;
|
||||
PreviousBehaviour menu_previousmode_;
|
||||
int seek_step_sec_;
|
||||
};
|
||||
|
||||
#endif // CORE_PLAYER_H_
|
||||
|
|
|
@ -129,6 +129,10 @@ void BehaviourSettingsPage::Load() {
|
|||
s.value("resume_playback_after_start", false).toBool());
|
||||
s.endGroup();
|
||||
|
||||
s.beginGroup(Player::kSettingsGroup);
|
||||
ui_->seek_step_sec->setValue(s.value("seek_step_sec", 10).toInt());
|
||||
s.endGroup();
|
||||
|
||||
s.beginGroup("General");
|
||||
QString name = language_map_.key(s.value("language").toString());
|
||||
if (name.isEmpty())
|
||||
|
@ -217,6 +221,7 @@ void BehaviourSettingsPage::Save() {
|
|||
|
||||
s.beginGroup(Player::kSettingsGroup);
|
||||
s.setValue("menu_previousmode", menu_previousmode);
|
||||
s.setValue("seek_step_sec", ui_->seek_step_sec->value());
|
||||
s.endGroup();
|
||||
|
||||
s.beginGroup("General");
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>516</width>
|
||||
<height>753</height>
|
||||
<height>851</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -180,9 +180,9 @@
|
|||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_previous">
|
||||
<property name="title">
|
||||
<string>Pressing "Previous" in player will...</string>
|
||||
<string>Pressing "Previous" in player will...</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_18">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_19">
|
||||
<item>
|
||||
<widget class="QComboBox" name="menu_previousmode">
|
||||
<property name="currentIndex">
|
||||
|
@ -261,6 +261,54 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_seekstep">
|
||||
<property name="title">
|
||||
<string>Seeking using a keyboard shortcut</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_seekstep">
|
||||
<property name="text">
|
||||
<string>Time step</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="seek_step_sec">
|
||||
<property name="suffix">
|
||||
<string> s</string>
|
||||
</property>
|
||||
<property name="prefix">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>10</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_seekstep">
|
||||
<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>
|
||||
<widget class="QGroupBox" name="groupBox_9">
|
||||
<property name="title">
|
||||
|
|
Loading…
Reference in New Issue