]> Some of my projects - aniplayer-old.git/commitdiff
Add setting for OP/ED skip length.
authorAPTX <marek321@gmail.com>
Wed, 18 May 2011 16:23:37 +0000 (18:23 +0200)
committerAPTX <marek321@gmail.com>
Wed, 18 May 2011 16:23:37 +0000 (18:23 +0200)
src/anidbconfigdialog.cpp
src/anidbconfigdialog.h
src/anidbconfigdialog.ui
src/videowindow.cpp
src/videowindow.h

index 7a2027affbbd5f3da7e95a4cd5c5bac19b11af2c..806c41f035896b0cca4e102b26a35506be742ee2 100644 (file)
@@ -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;
index 078e6b9a7bf0b237ea2cae066a5c5451f5c46ea6..4e7d70f602d6899d59e4336a4142b38b3d282d5f 100644 (file)
@@ -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);
 
index fecdc235950bdd3fa757bd74e6824de2f244a87c..9f7a599116c071ef7bb52d94cf909f5658d9f2ff 100644 (file)
@@ -6,12 +6,12 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>400</width>
-    <height>300</height>
+    <width>280</width>
+    <height>348</height>
    </rect>
   </property>
   <property name="windowTitle">
-   <string>AniDB Config</string>
+   <string>AniPlayer Settings</string>
   </property>
   <layout class="QVBoxLayout" name="verticalLayout">
    <item>
@@ -19,7 +19,7 @@
      <property name="title">
       <string>AniDB Connection Settings</string>
      </property>
-     <layout class="QFormLayout" name="formLayout">
+     <layout class="QFormLayout" name="formLayout_2">
       <item row="0" column="0">
        <widget class="QLabel" name="lHost">
         <property name="text">
         </property>
        </widget>
       </item>
-      <item row="5" column="0">
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <widget class="QGroupBox" name="groupBox_2">
+     <property name="title">
+      <string>Automark</string>
+     </property>
+     <layout class="QFormLayout" name="formLayout">
+      <item row="0" column="0">
        <widget class="QLabel" name="lAutomark">
         <property name="text">
          <string>Automark on:</string>
         </property>
        </widget>
       </item>
-      <item row="5" column="1">
+      <item row="0" column="1">
        <widget class="QSpinBox" name="automark">
         <property name="specialValueText">
          <string>Disabled</string>
         <property name="suffix">
          <string>%</string>
         </property>
+        <property name="minimum">
+         <number>0</number>
+        </property>
         <property name="maximum">
          <number>100</number>
         </property>
+        <property name="value">
+         <number>0</number>
+        </property>
        </widget>
       </item>
-      <item row="6" column="1">
-       <widget class="QLineEdit" name="paths"/>
-      </item>
-      <item row="6" column="0">
+      <item row="1" column="0">
        <widget class="QLabel" name="lPaths">
         <property name="text">
          <string>Paths:</string>
         </property>
        </widget>
       </item>
+      <item row="1" column="1">
+       <widget class="QLineEdit" name="paths"/>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <widget class="QGroupBox" name="groupBox_3">
+     <property name="title">
+      <string>OP/ED skip</string>
+     </property>
+     <layout class="QFormLayout" name="formLayout_3">
+      <item row="0" column="0">
+       <widget class="QLabel" name="lOpSkip">
+        <property name="text">
+         <string>Skip:</string>
+        </property>
+        <property name="buddy">
+         <cstring>opSkip</cstring>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="1">
+       <widget class="QSpinBox" name="opSkip">
+        <property name="suffix">
+         <string>s</string>
+        </property>
+        <property name="minimum">
+         <number>1</number>
+        </property>
+        <property name="maximum">
+         <number>1000</number>
+        </property>
+        <property name="singleStep">
+         <number>5</number>
+        </property>
+        <property name="value">
+         <number>85</number>
+        </property>
+       </widget>
+      </item>
      </layout>
     </widget>
    </item>
    </item>
   </layout>
  </widget>
+ <tabstops>
+  <tabstop>host</tabstop>
+  <tabstop>hostPort</tabstop>
+  <tabstop>localPort</tabstop>
+  <tabstop>user</tabstop>
+  <tabstop>pass</tabstop>
+  <tabstop>groupBox_2</tabstop>
+  <tabstop>automark</tabstop>
+  <tabstop>paths</tabstop>
+  <tabstop>opSkip</tabstop>
+  <tabstop>buttonBox</tabstop>
+ </tabstops>
  <resources/>
  <connections>
   <connection>
    <slot>accept()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>257</x>
-     <y>290</y>
+     <x>266</x>
+     <y>338</y>
     </hint>
     <hint type="destinationlabel">
      <x>157</x>
    <slot>reject()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>325</x>
-     <y>290</y>
+     <x>270</x>
+     <y>338</y>
     </hint>
     <hint type="destinationlabel">
-     <x>286</x>
+     <x>279</x>
      <y>274</y>
     </hint>
    </hints>
index 473cb8ca52c410bffec75e8b5dfb958e17d346a9..a86828d2f2c16b641b1d1eb5b0a2f3c3f4014c1b 100644 (file)
@@ -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());
index be9623e1878aabac8f39d5c3a44ce4840d89a274..25ca4c14a1f50c9a0b54fbcae0a40a578ffa5195 100644 (file)
@@ -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;