From: APTX Date: Wed, 18 May 2011 16:23:37 +0000 (+0200) Subject: Add setting for OP/ED skip length. X-Git-Url: https://gitweb.aptx.org/?a=commitdiff_plain;h=3e89fe4397b8b964c4037c5bb7fdb071edbd1638;p=aniplayer-old.git Add setting for OP/ED skip length. --- diff --git a/src/anidbconfigdialog.cpp b/src/anidbconfigdialog.cpp index 7a2027a..806c41f 100644 --- a/src/anidbconfigdialog.cpp +++ b/src/anidbconfigdialog.cpp @@ -79,6 +79,16 @@ void AniDBConfigDialog::setPaths(const QStringList &paths) m_ui->paths->setText(QDir::toNativeSeparators(paths.join(";"))); } +int AniDBConfigDialog::opSkip() const +{ + return m_ui->opSkip->value(); +} + +void AniDBConfigDialog::setOpSkip(int seconds) +{ + m_ui->opSkip->setValue(seconds); +} + AniDBConfigDialog::~AniDBConfigDialog() { delete m_ui; diff --git a/src/anidbconfigdialog.h b/src/anidbconfigdialog.h index 078e6b9..4e7d70f 100644 --- a/src/anidbconfigdialog.h +++ b/src/anidbconfigdialog.h @@ -35,6 +35,9 @@ public: QStringList paths() const; void setPaths(const QStringList &paths); + int opSkip() const; + void setOpSkip(int seconds); + protected: virtual void changeEvent(QEvent *e); diff --git a/src/anidbconfigdialog.ui b/src/anidbconfigdialog.ui index fecdc23..9f7a599 100644 --- a/src/anidbconfigdialog.ui +++ b/src/anidbconfigdialog.ui @@ -6,12 +6,12 @@ 0 0 - 400 - 300 + 280 + 348 - AniDB Config + AniPlayer Settings @@ -19,7 +19,7 @@ AniDB Connection Settings - + @@ -109,7 +109,16 @@ - + + + + + + + Automark + + + Automark on: @@ -119,7 +128,7 @@ - + Disabled @@ -127,15 +136,18 @@ % + + 0 + 100 + + 0 + - - - - + Paths: @@ -145,6 +157,47 @@ + + + + + + + + + + OP/ED skip + + + + + + Skip: + + + opSkip + + + + + + + s + + + 1 + + + 1000 + + + 5 + + + 85 + + + @@ -160,6 +213,18 @@ + + host + hostPort + localPort + user + pass + groupBox_2 + automark + paths + opSkip + buttonBox + @@ -169,8 +234,8 @@ accept() - 257 - 290 + 266 + 338 157 @@ -185,11 +250,11 @@ reject() - 325 - 290 + 270 + 338 - 286 + 279 274 diff --git a/src/videowindow.cpp b/src/videowindow.cpp index 473cb8c..a86828d 100644 --- a/src/videowindow.cpp +++ b/src/videowindow.cpp @@ -111,7 +111,7 @@ VideoWindow::VideoWindow(QWidget *parent) : QMainWindow(parent) addAction("volUp", "Volume Up", QKeySequence("+")); addAction("volDown", "Volume Down", QKeySequence("-")); - addAction("skip85sec", "Skip 1:25", QKeySequence("/")); + addAction("opSkip", "OP/ED Skip", QKeySequence("/")); addAction("back1sec", "Back 1 second", QKeySequence("m")); videoPlayer->videoWidget()->addActions(actions()); @@ -137,7 +137,7 @@ VideoWindow::VideoWindow(QWidget *parent) : QMainWindow(parent) connect(m_actions["volUp"], SIGNAL(triggered()), videoPlayer, SLOT(volumeUp())); connect(m_actions["volDown"], SIGNAL(triggered()), videoPlayer, SLOT(volumeDown())); - connect(m_actions["skip85sec"], SIGNAL(triggered()), videoPlayer, SLOT(skip())); + connect(m_actions["opSkip"], SIGNAL(triggered()), this, SLOT(opSkip())); connect(m_actions["back1sec"], SIGNAL(triggered()), this, SLOT(skipback())); connect(videoPlayer->videoWidget(), SIGNAL(menuToggleRequested()), this, SLOT(toggleMenu())); @@ -304,6 +304,11 @@ void VideoWindow::skipback() videoPlayer->skip(-1000); } +void VideoWindow::opSkip() +{ + videoPlayer->skip(m_opSkip * 1000); +} + void VideoWindow::resizeToVideo() { #ifdef GRAPHICS_VIEW_VIDEO @@ -548,6 +553,7 @@ void VideoWindow::markWatched() void VideoWindow::markingStatus(AniDBUdpClient::File::Action action, AniDBUdpClient::File::ActionState actionState, int percent) { AniDBUdpClient::File *file = (AniDBUdpClient::File *) sender(); + switch (action) { case AniDBUdpClient::File::Hashing: @@ -557,7 +563,7 @@ void VideoWindow::markingStatus(AniDBUdpClient::File::Action action, AniDBUdpCli menu->showMessage(tr("Hashing File... %1%").arg(percent)); break; case AniDBUdpClient::File::Success: - menu->showMessage(tr("Hashing File complete!").arg(percent)); + menu->showMessage(tr("Hashing File complete!")); break; default: ; } @@ -574,7 +580,7 @@ void VideoWindow::markingStatus(AniDBUdpClient::File::Action action, AniDBUdpCli case AniDBUdpClient::File::Failure: menu->showMessage(tr("Failed to mark file %1 as watched").arg(file->file().fileName())); break; - default: ; + default: ; } break; default: ; @@ -592,6 +598,7 @@ void VideoWindow::anidbSettings() dialog.setPass(AniDBUdpClient::Client::instance()->pass()); dialog.setAutomark(m_automark); dialog.setPaths(m_automarkPaths); + dialog.setOpSkip(m_opSkip); if (!dialog.exec()) { @@ -607,6 +614,7 @@ void VideoWindow::anidbSettings() AniDBUdpClient::Client::instance()->setPass(dialog.pass()); m_automark = dialog.automark(); m_automarkPaths = dialog.paths(); + m_opSkip = dialog.opSkip(); updateAutomarkable(); } @@ -682,6 +690,7 @@ void VideoWindow::saveSettings() settings.setValue("currentFile", videoPlayer->currentFile()); settings.setValue("volume", videoPlayer->audioOutput()->volume()); settings.setValue("muted", videoPlayer->audioOutput()->isMuted()); + settings.setValue("opSkip", m_opSkip); settings.endGroup(); settings.beginGroup("videoWindow"); settings.setValue("geometry", saveGeometry()); @@ -716,6 +725,7 @@ void VideoWindow::loadSettings() open(settings.value("currentFile", "").toString()); videoPlayer->audioOutput()->setVolume(settings.value("volume", qreal(1.0)).toDouble()); videoPlayer->audioOutput()->setMuted(settings.value("muted", false).toBool()); + m_opSkip = settings.value("opSkip", 85).toInt(); settings.endGroup(); settings.beginGroup("videoWindow"); restoreGeometry(settings.value("geometry", saveGeometry()).toByteArray()); diff --git a/src/videowindow.h b/src/videowindow.h index be9623e..25ca4c1 100644 --- a/src/videowindow.h +++ b/src/videowindow.h @@ -72,6 +72,7 @@ public slots: void play(const QString &file, bool closeOnStop = false); void skipback(); + void opSkip(); void resizeToVideo(); void setPinMenu(bool pinned); @@ -146,6 +147,8 @@ private: bool m_closeOnStop; + int m_opSkip; + #ifndef NO_ANIDBUDPCLIENT int m_automark; QStringList m_automarkPaths;