Added sound effect when a job has completed or failed (optionally, disabled by default).

This commit is contained in:
LoRd_MuldeR 2013-07-01 03:03:21 +02:00
parent e1e7248b3a
commit 43e1146263
13 changed files with 103 additions and 41 deletions

View 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">
@ -63,38 +63,6 @@
</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>

BIN
res/sounds/failure.wav Normal file

Binary file not shown.

BIN
res/sounds/shattering.wav Normal file

Binary file not shown.

BIN
res/sounds/tada.wav Normal file

Binary file not shown.

View 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

View File

@ -19,16 +19,20 @@
// 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;
}
}
}
}

View 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);

Binary file not shown.

View 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

View 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);

View 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();
}

View File

@ -46,6 +46,7 @@ public:
bool saveLogFiles;
bool saveToSourcePath;
unsigned int processPriority;
bool enableSounds;
}
Preferences;

Binary file not shown.