OSDN Git Service

Added sound effect when a job has completed or failed (optionally, disabled by default).
authorlordmulder <mulder2@gmx.de>
Mon, 1 Jul 2013 01:03:21 +0000 (03:03 +0200)
committerlordmulder <mulder2@gmx.de>
Mon, 1 Jul 2013 01:03:21 +0000 (03:03 +0200)
13 files changed:
gui/win_preferences.ui
res/sounds/failure.wav [new file with mode: 0644]
res/sounds/shattering.wav [new file with mode: 0644]
res/sounds/tada.wav [new file with mode: 0644]
src/global.cpp
src/model_jobList.cpp
src/model_jobList.h
src/resource.h
src/version.h
src/win_main.cpp
src/win_preferences.cpp
src/win_preferences.h
x264_launcher.rc

index fb37b03..8c84a4a 100644 (file)
@@ -10,7 +10,7 @@
     <x>0</x>
     <y>0</y>
     <width>379</width>
-    <height>366</height>
+    <height>399</height>
    </rect>
   </property>
   <property name="windowTitle">
           </property>
          </widget>
         </item>
-        <item row="1" column="0" rowspan="13">
-         <spacer name="horizontalSpacer_2">
-          <property name="orientation">
-           <enum>Qt::Horizontal</enum>
-          </property>
-          <property name="sizeType">
-           <enum>QSizePolicy::Fixed</enum>
-          </property>
-          <property name="sizeHint" stdset="0">
-           <size>
-            <width>8</width>
-            <height>20</height>
-           </size>
-          </property>
-         </spacer>
-        </item>
-        <item row="1" column="6" rowspan="13">
-         <spacer name="horizontalSpacer_3">
-          <property name="orientation">
-           <enum>Qt::Horizontal</enum>
-          </property>
-          <property name="sizeType">
-           <enum>QSizePolicy::Fixed</enum>
-          </property>
-          <property name="sizeHint" stdset="0">
-           <size>
-            <width>12</width>
-            <height>20</height>
-           </size>
-          </property>
-         </spacer>
-        </item>
         <item row="1" column="2" colspan="4">
          <widget class="QLabel" name="labelRunNextJob">
           <property name="text">
@@ -201,7 +169,7 @@ Please be aware that this option does NOT have any effect on 32-Bit systems.</st
           </property>
          </spacer>
         </item>
-        <item row="15" column="1" colspan="5">
+        <item row="17" column="1" colspan="5">
          <spacer name="verticalSpacer_3">
           <property name="orientation">
            <enum>Qt::Vertical</enum>
@@ -379,6 +347,68 @@ Please be aware that this option does NOT have any effect on 32-Bit systems.</st
           </property>
          </widget>
         </item>
+        <item row="16" column="1">
+         <widget class="QCheckBox" name="checkEnableSounds">
+          <property name="text">
+           <string/>
+          </property>
+         </widget>
+        </item>
+        <item row="16" column="2" colspan="4">
+         <widget class="QLabel" name="labelEnableSounds">
+          <property name="text">
+           <string>Enable sound effects when a job has completed or failed</string>
+          </property>
+         </widget>
+        </item>
+        <item row="15" column="1" colspan="5">
+         <spacer name="verticalSpacer_9">
+          <property name="orientation">
+           <enum>Qt::Vertical</enum>
+          </property>
+          <property name="sizeType">
+           <enum>QSizePolicy::Fixed</enum>
+          </property>
+          <property name="sizeHint" stdset="0">
+           <size>
+            <width>20</width>
+            <height>8</height>
+           </size>
+          </property>
+         </spacer>
+        </item>
+        <item row="1" column="0" rowspan="16">
+         <spacer name="horizontalSpacer_2">
+          <property name="orientation">
+           <enum>Qt::Horizontal</enum>
+          </property>
+          <property name="sizeType">
+           <enum>QSizePolicy::Fixed</enum>
+          </property>
+          <property name="sizeHint" stdset="0">
+           <size>
+            <width>8</width>
+            <height>20</height>
+           </size>
+          </property>
+         </spacer>
+        </item>
+        <item row="1" column="6" rowspan="16">
+         <spacer name="horizontalSpacer_3">
+          <property name="orientation">
+           <enum>Qt::Horizontal</enum>
+          </property>
+          <property name="sizeType">
+           <enum>QSizePolicy::Fixed</enum>
+          </property>
+          <property name="sizeHint" stdset="0">
+           <size>
+            <width>12</width>
+            <height>20</height>
+           </size>
+          </property>
+         </spacer>
+        </item>
        </layout>
       </item>
      </layout>
diff --git a/res/sounds/failure.wav b/res/sounds/failure.wav
new file mode 100644 (file)
index 0000000..602944d
Binary files /dev/null and b/res/sounds/failure.wav differ
diff --git a/res/sounds/shattering.wav b/res/sounds/shattering.wav
new file mode 100644 (file)
index 0000000..fe74919
Binary files /dev/null and b/res/sounds/shattering.wav differ
diff --git a/res/sounds/tada.wav b/res/sounds/tada.wav
new file mode 100644 (file)
index 0000000..3bb129b
Binary files /dev/null and b/res/sounds/tada.wav differ
index 9a80922..523b565 100644 (file)
@@ -114,8 +114,10 @@ g_x264_version =
                        static const char *g_x264_version_compiler = "MSVC 2012-U1 CTP";
                #elif (_MSC_FULL_VER < 170060315)
                        static const char *g_x264_version_compiler = "MSVC 2012-U1";
-               #elif (_MSC_FULL_VER == 170060315)
+               #elif (_MSC_FULL_VER < 170060610)
                        static const char *g_x264_version_compiler = "MSVC 2012-U2";
+               #elif (_MSC_FULL_VER == 170060610)
+                       static const char *g_x264_version_compiler = "MSVC 2012-U3";
                #else
                        #error Compiler version is not supported yet!
                #endif
index 5b0a19e..40f9129 100644 (file)
 // http://www.gnu.org/licenses/gpl-2.0.txt
 ///////////////////////////////////////////////////////////////////////////////
 
-#include "model_jobList.h"
 #include "global.h"
+#include "model_jobList.h"
 #include "thread_encode.h"
 #include "model_options.h"
+#include "resource.h"
 
 #include <QIcon>
 #include <QFileInfo>
 
-JobListModel::JobListModel(void)
+#include <Mmsystem.h>
+
+JobListModel::JobListModel(PreferencesDialog::Preferences *preferences)
 {
+       m_preferences = preferences;
 }
 
 JobListModel::~JobListModel(void)
@@ -482,6 +486,22 @@ void JobListModel::updateStatus(const QUuid &jobId, EncodeThread::JobStatus newS
        {
                m_status.insert(jobId, newStatus);
                emit dataChanged(createIndex(index, 0), createIndex(index, 1));
+
+               if(m_preferences->enableSounds)
+               {
+                       switch(newStatus)
+                       {
+                       case EncodeThread::JobStatus_Completed:
+                               PlaySound(MAKEINTRESOURCE(IDR_WAVE4), GetModuleHandle(NULL), SND_RESOURCE | SND_ASYNC);
+                               break;
+                       case EncodeThread::JobStatus_Aborted:
+                               PlaySound(MAKEINTRESOURCE(IDR_WAVE5), GetModuleHandle(NULL), SND_RESOURCE | SND_ASYNC);
+                               break;
+                       case EncodeThread::JobStatus_Failed:
+                               PlaySound(MAKEINTRESOURCE(IDR_WAVE6), GetModuleHandle(NULL), SND_RESOURCE | SND_ASYNC);
+                               break;
+                       }
+               }
        }
 }
 
index 145b2cb..4791b7c 100644 (file)
@@ -23,6 +23,7 @@
 
 #include "thread_encode.h"
 #include "model_logFile.h"
+#include "win_preferences.h"
 
 #include "QAbstractItemModel"
 #include <QUuid>
@@ -34,7 +35,7 @@ class JobListModel : public QAbstractItemModel
        Q_OBJECT
                
 public:
-       JobListModel(void);
+       JobListModel(PreferencesDialog::Preferences *preferences);
        ~JobListModel(void);
 
        virtual int columnCount(const QModelIndex &parent) const;
@@ -66,6 +67,7 @@ protected:
        QMap<QUuid, unsigned int> m_progress;
        QMap<QUuid, LogFileModel*> m_logFile;
        QMap<QUuid, QString> m_details;
+       PreferencesDialog::Preferences *m_preferences;
 
 public slots:
        void updateStatus(const QUuid &jobId, EncodeThread::JobStatus newStatus);
index 50c0694..7dac95c 100644 (file)
Binary files a/src/resource.h and b/src/resource.h differ
index 416354d..bcab9dc 100644 (file)
@@ -21,8 +21,8 @@
 
 #define VER_X264_MAJOR 2
 #define VER_X264_MINOR 1
-#define VER_X264_PATCH 4
-#define VER_X264_BUILD 475
+#define VER_X264_PATCH 5
+#define VER_X264_BUILD 480
 
 #define VER_X264_MINIMUM_REV 2282
 #define VER_X264_CURRENT_API 133
index 12fa846..05b4958 100644 (file)
@@ -113,7 +113,7 @@ MainWindow::MainWindow(const x264_cpu_t *const cpuFeatures)
        }
        
        //Create model
-       m_jobList = new JobListModel();
+       m_jobList = new JobListModel(&m_preferences);
        connect(m_jobList, SIGNAL(dataChanged(QModelIndex, QModelIndex)), this, SLOT(jobChangedData(QModelIndex, QModelIndex)));
        jobsView->setModel(m_jobList);
        
index 68e5ada..c5912d3 100644 (file)
@@ -49,6 +49,7 @@ PreferencesDialog::PreferencesDialog(QWidget *parent, Preferences *preferences,
        labelShutdownComputer->installEventFilter(this);
        labelSaveLogFiles->installEventFilter(this);
        labelSaveToSourceFolder->installEventFilter(this);
+       labelEnableSounds->installEventFilter(this);
 
        connect(resetButton, SIGNAL(clicked()), this, SLOT(resetButtonPressed()));
        connect(checkUse10BitEncoding, SIGNAL(toggled(bool)), this, SLOT(use10BitEncodingToggled(bool)));
@@ -69,6 +70,7 @@ void PreferencesDialog::showEvent(QShowEvent *event)
        UPDATE_CHECKBOX(checkUse64BitAvs2YUV, m_preferences->useAvisyth64Bit);
        UPDATE_CHECKBOX(checkSaveLogFiles, m_preferences->saveLogFiles);
        UPDATE_CHECKBOX(checkSaveToSourceFolder, m_preferences->saveToSourcePath);
+       UPDATE_CHECKBOX(checkEnableSounds, m_preferences->enableSounds);
 
        checkUse10BitEncoding->blockSignals(true);
        UPDATE_CHECKBOX(checkUse10BitEncoding, m_preferences->use10BitEncoding);
@@ -89,6 +91,7 @@ bool PreferencesDialog::eventFilter(QObject *o, QEvent *e)
        emulateMouseEvent(o, e, labelUse64BitAvs2YUV, checkUse64BitAvs2YUV);
        emulateMouseEvent(o, e, labelSaveLogFiles, checkSaveLogFiles);
        emulateMouseEvent(o, e, labelSaveToSourceFolder, checkSaveToSourceFolder);
+       emulateMouseEvent(o, e, labelEnableSounds, checkEnableSounds);
        return false;
 }
 
@@ -122,6 +125,7 @@ void PreferencesDialog::done(int n)
        m_preferences->saveToSourcePath = checkSaveToSourceFolder->isChecked();
        m_preferences->maxRunningJobCount = spinBoxJobCount->value();
        m_preferences->processPriority = comboBoxPriority->currentIndex();
+       m_preferences->enableSounds = checkEnableSounds->isChecked();
 
        savePreferences(m_preferences);
        QDialog::done(n);
@@ -165,6 +169,7 @@ void PreferencesDialog::initPreferences(Preferences *preferences)
        preferences->saveLogFiles = false;
        preferences->saveToSourcePath = false;
        preferences->processPriority = X264_PRIORITY_BELOWNORMAL;
+       preferences->enableSounds = false;
 }
 
 void PreferencesDialog::loadPreferences(Preferences *preferences)
@@ -184,6 +189,7 @@ void PreferencesDialog::loadPreferences(Preferences *preferences)
        preferences->saveLogFiles = settings.value("save_log_files", QVariant(defaults.saveLogFiles)).toBool();
        preferences->saveToSourcePath = settings.value("save_to_source_path", QVariant(defaults.saveToSourcePath)).toBool();
        preferences->processPriority = settings.value("process_priority", QVariant(defaults.processPriority)).toUInt();
+       preferences->enableSounds = settings.value("enable_sounds", QVariant(defaults.enableSounds)).toBool();
 }
 
 void PreferencesDialog::savePreferences(Preferences *preferences)
@@ -200,5 +206,6 @@ void PreferencesDialog::savePreferences(Preferences *preferences)
        settings.setValue("save_log_files", preferences->saveLogFiles);
        settings.setValue("save_to_source_path", preferences->saveToSourcePath);
        settings.setValue("process_priority", preferences->processPriority);
+       settings.setValue("enable_sounds", preferences->enableSounds);
        settings.sync();
 }
index e91339f..b8cec96 100644 (file)
@@ -46,6 +46,7 @@ public:
                bool saveLogFiles;
                bool saveToSourcePath;
                unsigned int processPriority;
+               bool enableSounds;
        }
        Preferences;
 
index 32845db..6f0b613 100644 (file)
Binary files a/x264_launcher.rc and b/x264_launcher.rc differ