Added option to use 64-Bit Avisynth/Avs2YUV.

This commit is contained in:
LoRd_MuldeR 2012-02-05 02:49:08 +01:00
parent ccfe3910ba
commit a4d8e6e8bc
10 changed files with 237 additions and 128 deletions

View File

@ -369,6 +369,9 @@
</item> </item>
<item> <item>
<widget class="QDoubleSpinBox" name="spinQuantizer"> <widget class="QDoubleSpinBox" name="spinQuantizer">
<property name="toolTip">
<string>Select the quantizer or CRF value. Smaller value means better quality, but bigger file. Higher value means smaller file, but lower quality. A value of '0' triggers lossless mode.</string>
</property>
<property name="decimals"> <property name="decimals">
<number>1</number> <number>1</number>
</property> </property>

View File

@ -9,8 +9,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>378</width> <width>379</width>
<height>193</height> <height>226</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -47,6 +47,65 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0" rowspan="6">
<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="6">
<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">
<string>Automatically launch next job when a running job completes</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="checkRunNextJob">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="2" column="5">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="4"> <item row="2" column="4">
<widget class="QSpinBox" name="spinBoxJobCount"> <widget class="QSpinBox" name="spinBoxJobCount">
<property name="enabled"> <property name="enabled">
@ -69,65 +128,17 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="5"> <item row="4" column="1">
<spacer name="horizontalSpacer_4"> <widget class="QCheckBox" name="checkUse64BitAvs2YUV">
<property name="orientation"> <property name="toolTip">
<enum>Qt::Horizontal</enum> <string>If this option is un-checked (default), then 32-Bit Avisynth will be used - even when using 64-Bit x264.
Please be aware that this option does NOT have any effect on 32-Bit systems.</string>
</property> </property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="checkRunNextJob">
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="2" colspan="4">
<widget class="QLabel" name="labelRunNextJob">
<property name="text">
<string>Automatically launch next job when a running job completes</string>
</property>
</widget>
</item>
<item row="1" column="6" rowspan="4">
<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="0" rowspan="4">
<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="3" column="1" colspan="5"> <item row="3" column="1" colspan="5">
<spacer name="verticalSpacer"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">
@ -144,14 +155,14 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="4" column="1"> <item row="6" column="1">
<widget class="QCheckBox" name="checkShutdownComputer"> <widget class="QCheckBox" name="checkShutdownComputer">
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="2" colspan="4"> <item row="6" column="2" colspan="4">
<widget class="QLabel" name="labelShutdownComputer"> <widget class="QLabel" name="labelShutdownComputer">
<property name="text"> <property name="text">
<string>Shutdown computer as soon as the last job has completed</string> <string>Shutdown computer as soon as the last job has completed</string>
@ -174,7 +185,7 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="5" column="1" colspan="5"> <item row="7" column="1" colspan="5">
<spacer name="verticalSpacer_3"> <spacer name="verticalSpacer_3">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
@ -190,6 +201,33 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="4" column="2" colspan="4">
<widget class="QLabel" name="labelUse64BitAvs2YUV">
<property name="toolTip">
<string>If this option is un-checked (default), then 32-Bit Avisynth will be used - even when using 64-Bit x264.
Please be aware that this option does NOT have any effect on 32-Bit systems.</string>
</property>
<property name="text">
<string>Use 64-Bit Avisynth/Avs2YUV, if running on a 64-Bit machine</string>
</property>
</widget>
</item>
<item row="5" column="2" colspan="4">
<spacer name="verticalSpacer_4">
<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>
</layout> </layout>
</item> </item>
</layout> </layout>
@ -219,7 +257,7 @@
</size> </size>
</property> </property>
<property name="text"> <property name="text">
<string>Close</string> <string>Apply</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../res/resources.qrc"> <iconset resource="../res/resources.qrc">

View File

@ -67,14 +67,15 @@ static const unsigned int REV_MULT = 10000;
// Constructor & Destructor // Constructor & Destructor
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
EncodeThread::EncodeThread(const QString &sourceFileName, const QString &outputFileName, const OptionsModel *options, const QString &binDir, bool x64) EncodeThread::EncodeThread(const QString &sourceFileName, const QString &outputFileName, const OptionsModel *options, const QString &binDir, bool x264_x64, bool avs2yuv_x64)
: :
m_jobId(QUuid::createUuid()), m_jobId(QUuid::createUuid()),
m_sourceFileName(sourceFileName), m_sourceFileName(sourceFileName),
m_outputFileName(outputFileName), m_outputFileName(outputFileName),
m_options(new OptionsModel(*options)), m_options(new OptionsModel(*options)),
m_binDir(binDir), m_binDir(binDir),
m_x64(x64), m_x264_x64(x264_x64),
m_avs2yuv_x64(avs2yuv_x64),
m_handle_jobObject(NULL), m_handle_jobObject(NULL),
m_semaphorePaused(0) m_semaphorePaused(0)
{ {
@ -186,14 +187,14 @@ void EncodeThread::encode(void)
log(tr("\n--- CHECK VERSION ---\n")); log(tr("\n--- CHECK VERSION ---\n"));
unsigned int revision_x264 = UINT_MAX; unsigned int revision_x264 = UINT_MAX;
bool x264_modified = false; bool x264_modified = false;
ok = ((revision_x264 = checkVersionX264(m_x64, x264_modified)) != UINT_MAX); ok = ((revision_x264 = checkVersionX264(m_x264_x64, x264_modified)) != UINT_MAX);
CHECK_STATUS(m_abort, ok); CHECK_STATUS(m_abort, ok);
//Checking avs2yuv version //Checking avs2yuv version
unsigned int revision_avs2yuv = UINT_MAX; unsigned int revision_avs2yuv = UINT_MAX;
if(usePipe) if(usePipe)
{ {
ok = ((revision_avs2yuv = checkVersionAvs2yuv()) != UINT_MAX); ok = ((revision_avs2yuv = checkVersionAvs2yuv(m_avs2yuv_x64)) != UINT_MAX);
CHECK_STATUS(m_abort, ok); CHECK_STATUS(m_abort, ok);
} }
@ -225,7 +226,7 @@ void EncodeThread::encode(void)
if(usePipe) if(usePipe)
{ {
log(tr("\n--- AVS INFO ---\n")); log(tr("\n--- AVS INFO ---\n"));
ok = checkProperties(frames); ok = checkProperties(m_avs2yuv_x64, frames);
CHECK_STATUS(m_abort, ok); CHECK_STATUS(m_abort, ok);
} }
@ -245,17 +246,17 @@ void EncodeThread::encode(void)
} }
log(tr("\n--- PASS 1 ---\n")); log(tr("\n--- PASS 1 ---\n"));
ok = runEncodingPass(m_x64, usePipe, frames, indexFile, 1, passLogFile); ok = runEncodingPass(m_x264_x64, m_avs2yuv_x64, usePipe, frames, indexFile, 1, passLogFile);
CHECK_STATUS(m_abort, ok); CHECK_STATUS(m_abort, ok);
log(tr("\n--- PASS 2 ---\n")); log(tr("\n--- PASS 2 ---\n"));
ok = runEncodingPass(m_x64, usePipe, frames, indexFile, 2, passLogFile); ok = runEncodingPass(m_x264_x64, m_avs2yuv_x64, usePipe, frames, indexFile, 2, passLogFile);
CHECK_STATUS(m_abort, ok); CHECK_STATUS(m_abort, ok);
} }
else else
{ {
log(tr("\n--- ENCODING ---\n")); log(tr("\n--- ENCODING ---\n"));
ok = runEncodingPass(m_x64, usePipe, frames, indexFile); ok = runEncodingPass(m_x264_x64, m_avs2yuv_x64, usePipe, frames, indexFile);
CHECK_STATUS(m_abort, ok); CHECK_STATUS(m_abort, ok);
} }
@ -266,7 +267,7 @@ void EncodeThread::encode(void)
setStatus(JobStatus_Completed); setStatus(JobStatus_Completed);
} }
bool EncodeThread::runEncodingPass(bool x64, bool usePipe, unsigned int frames, const QString &indexFile, int pass, const QString &passLogFile) bool EncodeThread::runEncodingPass(bool x264_x64, bool avs2yuv_x64, bool usePipe, unsigned int frames, const QString &indexFile, int pass, const QString &passLogFile)
{ {
QProcess processEncode, processAvisynth; QProcess processEncode, processAvisynth;
@ -278,7 +279,7 @@ bool EncodeThread::runEncodingPass(bool x64, bool usePipe, unsigned int frames,
processAvisynth.setStandardOutputProcess(&processEncode); processAvisynth.setStandardOutputProcess(&processEncode);
log("Creating Avisynth process:"); log("Creating Avisynth process:");
if(!startProcess(processAvisynth, QString("%1/avs2yuv.exe").arg(m_binDir), cmdLine_Avisynth, false)) if(!startProcess(processAvisynth, QString("%1/%2.exe").arg(m_binDir, avs2yuv_x64 ? "avs2yuv_x64" : "avs2yuv"), cmdLine_Avisynth, false))
{ {
return false; return false;
} }
@ -287,7 +288,7 @@ bool EncodeThread::runEncodingPass(bool x64, bool usePipe, unsigned int frames,
QStringList cmdLine_Encode = buildCommandLine(usePipe, frames, indexFile, pass, passLogFile); QStringList cmdLine_Encode = buildCommandLine(usePipe, frames, indexFile, pass, passLogFile);
log("Creating x264 process:"); log("Creating x264 process:");
if(!startProcess(processEncode, QString("%1/%2.exe").arg(m_binDir, x64 ? "x264_x64" : "x264"), cmdLine_Encode)) if(!startProcess(processEncode, QString("%1/%2.exe").arg(m_binDir, x264_x64 ? "x264_x64" : "x264"), cmdLine_Encode))
{ {
return false; return false;
} }
@ -624,12 +625,12 @@ unsigned int EncodeThread::checkVersionX264(bool x64, bool &modified)
return (coreVers * REV_MULT) + (revision % REV_MULT); return (coreVers * REV_MULT) + (revision % REV_MULT);
} }
unsigned int EncodeThread::checkVersionAvs2yuv(void) unsigned int EncodeThread::checkVersionAvs2yuv(bool x64)
{ {
QProcess process; QProcess process;
log("\nCreating process:"); log("\nCreating process:");
if(!startProcess(process, QString("%1/avs2yuv.exe").arg(m_binDir), QStringList())) if(!startProcess(process, QString("%1/%2.exe").arg(m_binDir, x64 ? "avs2yuv_x64" : "avs2yuv"), QStringList()))
{ {
return false;; return false;;
} }
@ -724,7 +725,7 @@ unsigned int EncodeThread::checkVersionAvs2yuv(void)
return (ver_maj * REV_MULT) + ((ver_min % REV_MULT) * 10) + (ver_mod % 10); return (ver_maj * REV_MULT) + ((ver_min % REV_MULT) * 10) + (ver_mod % 10);
} }
bool EncodeThread::checkProperties(unsigned int &frames) bool EncodeThread::checkProperties(bool x64, unsigned int &frames)
{ {
QProcess process; QProcess process;
@ -732,7 +733,7 @@ bool EncodeThread::checkProperties(unsigned int &frames)
cmdLine << QDir::toNativeSeparators(m_sourceFileName) << "NUL"; cmdLine << QDir::toNativeSeparators(m_sourceFileName) << "NUL";
log("Creating process:"); log("Creating process:");
if(!startProcess(process, QString("%1/avs2yuv.exe").arg(m_binDir), cmdLine)) if(!startProcess(process, QString("%1/%2.exe").arg(m_binDir, x64 ? "avs2yuv_x64" : "avs2yuv"), cmdLine))
{ {
return false;; return false;;
} }
@ -808,6 +809,10 @@ bool EncodeThread::checkProperties(unsigned int &frames)
{ {
log(text); log(text);
} }
if(text.contains("failed to load avisynth.dll", Qt::CaseInsensitive))
{
log(tr("\nWarning: It seems that %1-Bit Avisynth is not currently installed !!!").arg(x64 ? "64" : "32"));
}
} }
} }
} }

View File

@ -53,7 +53,7 @@ public:
JobStatus_Undefined = 666 JobStatus_Undefined = 666
}; };
EncodeThread(const QString &sourceFileName, const QString &outputFileName, const OptionsModel *options, const QString &binDir, bool x64); EncodeThread(const QString &sourceFileName, const QString &outputFileName, const OptionsModel *options, const QString &binDir, bool x264_x64, bool avs2yuv_x64);
~EncodeThread(void); ~EncodeThread(void);
QUuid getId(void) { return this->m_jobId; }; QUuid getId(void) { return this->m_jobId; };
@ -87,7 +87,8 @@ protected:
const QString m_outputFileName; const QString m_outputFileName;
const OptionsModel *m_options; const OptionsModel *m_options;
const QString m_binDir; const QString m_binDir;
const bool m_x64; const bool m_x264_x64;
const bool m_avs2yuv_x64;
//Flags //Flags
volatile bool m_abort; volatile bool m_abort;
@ -109,11 +110,11 @@ protected:
//Encode functions //Encode functions
void encode(void); void encode(void);
bool runEncodingPass(bool x64, bool usePipe, unsigned int frames, const QString &indexFile, int pass = 0, const QString &passLogFile = QString()); bool runEncodingPass(bool x264_x64, bool avs2yuv_x64, bool usePipe, unsigned int frames, const QString &indexFile, int pass = 0, const QString &passLogFile = QString());
QStringList buildCommandLine(bool usePipe, unsigned int frames, const QString &indexFile, int pass = 0, const QString &passLogFile = QString()); QStringList buildCommandLine(bool usePipe, unsigned int frames, const QString &indexFile, int pass = 0, const QString &passLogFile = QString());
unsigned int checkVersionX264(bool x64, bool &modified); unsigned int checkVersionX264(bool x64, bool &modified);
unsigned int checkVersionAvs2yuv(void); unsigned int checkVersionAvs2yuv(bool x64);
bool checkProperties(unsigned int &frames); bool checkProperties(bool x64, unsigned int &frames);
//Auxiallary Stuff //Auxiallary Stuff
void log(const QString &text) { emit messageLogged(m_jobId, text); } void log(const QString &text) { emit messageLogged(m_jobId, text); }

View File

@ -36,21 +36,6 @@
#include <QInputDialog> #include <QInputDialog>
#include <QSettings> #include <QSettings>
static const struct
{
const char *name;
const char *fext;
}
g_filters[] =
{
{"Avisynth Scripts", "avs"},
{"Matroska Files", "mkv"},
{"MPEG-4 Part 14 Container", "mp4"},
{"Audio Video Interleaved", "avi"},
{"Flash Video", "flv"},
{NULL, NULL}
};
#define VALID_DIR(PATH) ((!(PATH).isEmpty()) && QFileInfo(PATH).exists() && QFileInfo(PATH).isDir()) #define VALID_DIR(PATH) ((!(PATH).isEmpty()) && QFileInfo(PATH).exists() && QFileInfo(PATH).isDir())
#define REMOVE_USAFED_ITEM \ #define REMOVE_USAFED_ITEM \
@ -305,7 +290,10 @@ void AddJobDialog::browseButtonClicked(void)
{ {
if(QObject::sender() == buttonBrowseSource) if(QObject::sender() == buttonBrowseSource)
{ {
QString filePath = QFileDialog::getOpenFileName(this, tr("Open Source File"), VALID_DIR(initialDir_src) ? initialDir_src : QDesktopServices::storageLocation(QDesktopServices::MoviesLocation), makeFileFilter(), NULL, QFileDialog::DontUseNativeDialog); QString initDir = VALID_DIR(initialDir_src) ? initialDir_src : QDesktopServices::storageLocation(QDesktopServices::MoviesLocation);
if(!editSource->text().isEmpty()) initDir = QString("%1/%2").arg(initDir, QFileInfo(QDir::fromNativeSeparators(editSource->text())).fileName());
QString filePath = QFileDialog::getOpenFileName(this, tr("Open Source File"), initDir, makeFileFilter(), NULL, QFileDialog::DontUseNativeDialog);
if(!(filePath.isNull() || filePath.isEmpty())) if(!(filePath.isNull() || filePath.isEmpty()))
{ {
editSource->setText(QDir::toNativeSeparators(filePath)); editSource->setText(QDir::toNativeSeparators(filePath));
@ -315,25 +303,54 @@ void AddJobDialog::browseButtonClicked(void)
} }
else if(QObject::sender() == buttonBrowseOutput) else if(QObject::sender() == buttonBrowseOutput)
{ {
QString types, selectedType; QString selectedType; QStringList types;
types += tr("Matroska Files (*.mkv)").append(";;"); types << tr("Matroska Files (*.mkv)");
types += tr("MPEG-4 Part 14 Container (*.mp4)").append(";;"); types << tr("MPEG-4 Part 14 Container (*.mp4)");
types += tr("H.264 Elementary Stream (*.264)"); types << tr("H.264 Elementary Stream (*.264)");
QString filePath = QFileDialog::getSaveFileName(this, tr("Choose Output File"), VALID_DIR(initialDir_out) ? initialDir_out : QDesktopServices::storageLocation(QDesktopServices::MoviesLocation), types, &selectedType, QFileDialog::DontUseNativeDialog | QFileDialog::DontConfirmOverwrite); QString initDir = VALID_DIR(initialDir_out) ? initialDir_out : QDesktopServices::storageLocation(QDesktopServices::MoviesLocation);
if(!editOutput->text().isEmpty()) initDir = QString("%1/%2").arg(initDir, QFileInfo(QDir::fromNativeSeparators(editOutput->text())).completeBaseName());
QRegExp ext("\\(\\*\\.(.+)\\)");
for(int i = 0; i < types.count(); i++)
{
if(ext.lastIndexIn(types.at(i)) >= 0)
{
if(QFileInfo(initDir).suffix().compare(ext.cap(1), Qt::CaseInsensitive) == 0)
{
selectedType = types.at(i);
break;
}
}
}
QString filePath = QFileDialog::getSaveFileName(this, tr("Choose Output File"), initDir, types.join(";;"), &selectedType, QFileDialog::DontUseNativeDialog | QFileDialog::DontConfirmOverwrite);
if(!(filePath.isNull() || filePath.isEmpty())) if(!(filePath.isNull() || filePath.isEmpty()))
{ {
QRegExp ext("\\(\\*\\.(.+)\\)"); QString suffix = QFileInfo(filePath).suffix();
bool hasProperExt = false;
for(int i = 0; i < types.count(); i++)
{
if(ext.lastIndexIn(types.at(i)) >= 0)
{
if(suffix.compare(ext.cap(1), Qt::CaseInsensitive) == 0)
{
hasProperExt = true;
break;
}
}
}
if(!hasProperExt)
{
if(ext.lastIndexIn(selectedType) >= 0) if(ext.lastIndexIn(selectedType) >= 0)
{ {
QString suffix = QFileInfo(filePath).suffix();
if(suffix.compare(ext.cap(1), Qt::CaseInsensitive)) if(suffix.compare(ext.cap(1), Qt::CaseInsensitive))
{ {
filePath = QString("%1.%2").arg(filePath, ext.cap(1)); filePath = QString("%1.%2").arg(filePath, ext.cap(1));
} }
} }
}
editOutput->setText(QDir::toNativeSeparators(filePath)); editOutput->setText(QDir::toNativeSeparators(filePath));
initialDir_out = QFileInfo(filePath).path(); initialDir_out = QFileInfo(filePath).path();
} }
@ -590,18 +607,35 @@ void AddJobDialog::saveOptions(OptionsModel *options)
QString AddJobDialog::makeFileFilter(void) QString AddJobDialog::makeFileFilter(void)
{ {
static const struct
{
const char *name;
const char *fext;
}
s_filters[] =
{
{"Avisynth Scripts", "avs"},
{"Matroska Files", "mkv"},
{"MPEG-4 Part 14 Container", "mp4"},
{"Audio Video Interleaved", "avi"},
{"Flash Video", "flv"},
{"YUV4MPEG2 Stream", "y4m"},
{"Uncompresses YUV Data", "yuv"},
{NULL, NULL}
};
QString filters("All supported files ("); QString filters("All supported files (");
for(size_t index = 0; g_filters[index].name && g_filters[index].fext; index++) for(size_t index = 0; s_filters[index].name && s_filters[index].fext; index++)
{ {
filters += QString((index > 0) ? " *.%1" : "*.%1").arg(QString::fromLatin1(g_filters[index].fext)); filters += QString((index > 0) ? " *.%1" : "*.%1").arg(QString::fromLatin1(s_filters[index].fext));
} }
filters += QString(");;"); filters += QString(");;");
for(size_t index = 0; g_filters[index].name && g_filters[index].fext; index++) for(size_t index = 0; s_filters[index].name && s_filters[index].fext; index++)
{ {
filters += QString("%1 (*.%2);;").arg(QString::fromLatin1(g_filters[index].name), QString::fromLatin1(g_filters[index].fext)); filters += QString("%1 (*.%2);;").arg(QString::fromLatin1(s_filters[index].name), QString::fromLatin1(s_filters[index].fext));
} }
filters += QString("All files (*.*)"); filters += QString("All files (*.*)");

View File

@ -169,7 +169,8 @@ void MainWindow::addButtonPressed(const QString &filePath, int fileNo, int fileT
addDialog->outputFile(), addDialog->outputFile(),
m_options, m_options,
QString("%1/toolset").arg(m_appDir), QString("%1/toolset").arg(m_appDir),
m_x64supported m_x64supported,
m_x64supported && m_preferences.useAvisyth64Bit
); );
QModelIndex newIndex = m_jobList->insertJob(thrd); QModelIndex newIndex = m_jobList->insertJob(thrd);
@ -363,7 +364,7 @@ void MainWindow::showWebLink(void)
void MainWindow::showPreferences(void) void MainWindow::showPreferences(void)
{ {
PreferencesDialog *preferences = new PreferencesDialog(this, &m_preferences); PreferencesDialog *preferences = new PreferencesDialog(this, &m_preferences, m_x64supported);
preferences->exec(); preferences->exec();
X264_DELETE(preferences); X264_DELETE(preferences);
} }
@ -465,7 +466,7 @@ void MainWindow::shutdownComputer(void)
void MainWindow::init(void) void MainWindow::init(void)
{ {
static const char *binFiles = "x264.exe:x264_x64.exe:avs2yuv.exe"; static const char *binFiles = "x264.exe:x264_x64.exe:avs2yuv.exe:avs2yuv_x64.exe";
QStringList binaries = QString::fromLatin1(binFiles).split(":", QString::SkipEmptyParts); QStringList binaries = QString::fromLatin1(binFiles).split(":", QString::SkipEmptyParts);
updateLabel(); updateLabel();

View File

@ -27,15 +27,17 @@
#include <QDesktopServices> #include <QDesktopServices>
#include <QMouseEvent> #include <QMouseEvent>
PreferencesDialog::PreferencesDialog(QWidget *parent, Preferences *preferences) PreferencesDialog::PreferencesDialog(QWidget *parent, Preferences *preferences, bool x64)
: :
QDialog(parent) QDialog(parent),
m_x64(x64)
{ {
setupUi(this); setupUi(this);
setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint)); setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
setFixedSize(minimumSize()); setFixedSize(minimumSize());
labelRunNextJob->installEventFilter(this); labelRunNextJob->installEventFilter(this);
labelUse64BitAvs2YUV->installEventFilter(this);
labelShutdownComputer->installEventFilter(this); labelShutdownComputer->installEventFilter(this);
m_preferences = preferences; m_preferences = preferences;
@ -53,11 +55,19 @@ void PreferencesDialog::showEvent(QShowEvent *event)
{ {
checkRunNextJob->click(); checkRunNextJob->click();
} }
while(checkUse64BitAvs2YUV->isChecked() != m_preferences->useAvisyth64Bit)
{
checkUse64BitAvs2YUV->click();
}
while(checkShutdownComputer->isChecked() != m_preferences->shutdownComputer) while(checkShutdownComputer->isChecked() != m_preferences->shutdownComputer)
{ {
checkShutdownComputer->click(); checkShutdownComputer->click();
} }
spinBoxJobCount->setValue(m_preferences->maxRunningJobCount); spinBoxJobCount->setValue(m_preferences->maxRunningJobCount);
checkUse64BitAvs2YUV->setEnabled(m_x64);
labelUse64BitAvs2YUV->setEnabled(m_x64);
} }
bool PreferencesDialog::eventFilter(QObject *o, QEvent *e) bool PreferencesDialog::eventFilter(QObject *o, QEvent *e)
@ -73,6 +83,17 @@ bool PreferencesDialog::eventFilter(QObject *o, QEvent *e)
} }
} }
} }
if(o == labelUse64BitAvs2YUV && e->type() == QEvent::MouseButtonRelease)
{
QMouseEvent *mouseEvent = dynamic_cast<QMouseEvent*>(e);
if(mouseEvent)
{
if(qApp->widgetAt(mouseEvent->globalPos()) == labelUse64BitAvs2YUV)
{
checkUse64BitAvs2YUV->click();
}
}
}
if(o == labelShutdownComputer && e->type() == QEvent::MouseButtonRelease) if(o == labelShutdownComputer && e->type() == QEvent::MouseButtonRelease)
{ {
QMouseEvent *mouseEvent = dynamic_cast<QMouseEvent*>(e); QMouseEvent *mouseEvent = dynamic_cast<QMouseEvent*>(e);
@ -91,6 +112,7 @@ void PreferencesDialog::accept(void)
{ {
m_preferences->autoRunNextJob = checkRunNextJob->isChecked(); m_preferences->autoRunNextJob = checkRunNextJob->isChecked();
m_preferences->shutdownComputer = checkShutdownComputer->isChecked(); m_preferences->shutdownComputer = checkShutdownComputer->isChecked();
m_preferences->useAvisyth64Bit = checkUse64BitAvs2YUV->isChecked();
m_preferences->maxRunningJobCount = spinBoxJobCount->value(); m_preferences->maxRunningJobCount = spinBoxJobCount->value();
savePreferences(m_preferences); savePreferences(m_preferences);
@ -106,6 +128,7 @@ void PreferencesDialog::loadPreferences(Preferences *preferences)
preferences->autoRunNextJob = settings.value("auto_run_next_job", QVariant(true)).toBool(); preferences->autoRunNextJob = settings.value("auto_run_next_job", QVariant(true)).toBool();
preferences->maxRunningJobCount = qBound(1U, settings.value("max_running_job_count", QVariant(1U)).toUInt(), 16U); preferences->maxRunningJobCount = qBound(1U, settings.value("max_running_job_count", QVariant(1U)).toUInt(), 16U);
preferences->shutdownComputer = settings.value("shutdown_computer_on_completion", QVariant(false)).toBool(); preferences->shutdownComputer = settings.value("shutdown_computer_on_completion", QVariant(false)).toBool();
preferences->useAvisyth64Bit = settings.value("use_64bit_avisynth", QVariant(false)).toBool();
} }
void PreferencesDialog::savePreferences(Preferences *preferences) void PreferencesDialog::savePreferences(Preferences *preferences)
@ -117,6 +140,7 @@ void PreferencesDialog::savePreferences(Preferences *preferences)
settings.setValue("auto_run_next_job", preferences->autoRunNextJob); settings.setValue("auto_run_next_job", preferences->autoRunNextJob);
settings.setValue("shutdown_computer_on_completion", preferences->shutdownComputer); settings.setValue("shutdown_computer_on_completion", preferences->shutdownComputer);
settings.setValue("max_running_job_count", preferences->maxRunningJobCount); settings.setValue("max_running_job_count", preferences->maxRunningJobCount);
settings.setValue("use_64bit_avisynth", preferences->useAvisyth64Bit);
settings.sync(); settings.sync();
} }

View File

@ -33,12 +33,15 @@ public:
bool autoRunNextJob; bool autoRunNextJob;
unsigned int maxRunningJobCount; unsigned int maxRunningJobCount;
bool shutdownComputer; bool shutdownComputer;
bool useAvisyth64Bit;
} }
Preferences; Preferences;
PreferencesDialog(QWidget *parent, Preferences *preferences); PreferencesDialog(QWidget *parent, Preferences *preferences, bool x64);
~PreferencesDialog(void); ~PreferencesDialog(void);
const bool m_x64;
static void loadPreferences(Preferences *preferences); static void loadPreferences(Preferences *preferences);
static void savePreferences(Preferences *preferences); static void savePreferences(Preferences *preferences);

View File

@ -116,15 +116,6 @@ copy "$(SolutionDir)res\toolset\*.exe" "$(SolutionDir)bin\$(Configuration)\tools
</PostBuildEvent> </PostBuildEvent>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<CustomBuild Include="gui\win_main.ui">
<FileType>Document</FileType>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\uic.exe" -o "$(SolutionDir)tmp\uic\uic_%(Filename).h" "%(FullPath)"</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">UIC "$(SolutionDir)tmp\uic\uic_%(Filename).h"</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)tmp\uic\uic_%(Filename).h;%(Outputs)</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\uic.exe" -o "$(SolutionDir)tmp\uic\uic_%(Filename).h" "%(FullPath)"</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">UIC "$(SolutionDir)tmp\uic\uic_%(Filename).h"</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\uic\uic_%(Filename).h;%(Outputs)</Outputs>
</CustomBuild>
<CustomBuild Include="gui\win_addJob.ui"> <CustomBuild Include="gui\win_addJob.ui">
<FileType>Document</FileType> <FileType>Document</FileType>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\uic.exe" -o "$(SolutionDir)tmp\uic\uic_%(Filename).h" "%(FullPath)"</Command> <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\uic.exe" -o "$(SolutionDir)tmp\uic\uic_%(Filename).h" "%(FullPath)"</Command>
@ -152,6 +143,15 @@ copy "$(SolutionDir)res\toolset\*.exe" "$(SolutionDir)bin\$(Configuration)\tools
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)tmp\uic\uic_%(Filename).h;%(Outputs)</Outputs> <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)tmp\uic\uic_%(Filename).h;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\uic\uic_%(Filename).h;%(Outputs)</Outputs> <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\uic\uic_%(Filename).h;%(Outputs)</Outputs>
</CustomBuild> </CustomBuild>
<CustomBuild Include="gui\win_main.ui">
<FileType>Document</FileType>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\uic.exe" -o "$(SolutionDir)tmp\uic\uic_%(Filename).h" "%(FullPath)"</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\uic.exe" -o "$(SolutionDir)tmp\uic\uic_%(Filename).h" "%(FullPath)"</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">UIC "$(SolutionDir)tmp\uic\uic_%(Filename).h"</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">UIC "$(SolutionDir)tmp\uic\uic_%(Filename).h"</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)tmp\uic\uic_%(Filename).h;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\uic\uic_%(Filename).h;%(Outputs)</Outputs>
</CustomBuild>
<None Include="ReadMe.txt" /> <None Include="ReadMe.txt" />
<CustomBuild Include="res\resources.qrc"> <CustomBuild Include="res\resources.qrc">
<FileType>Document</FileType> <FileType>Document</FileType>

View File

@ -100,9 +100,6 @@
</ClCompile> </ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<CustomBuild Include="gui\win_main.ui">
<Filter>Dialogs</Filter>
</CustomBuild>
<CustomBuild Include="src\win_main.h"> <CustomBuild Include="src\win_main.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</CustomBuild> </CustomBuild>
@ -136,6 +133,9 @@
<CustomBuild Include="src\win_preferences.h"> <CustomBuild Include="src\win_preferences.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</CustomBuild> </CustomBuild>
<CustomBuild Include="gui\win_main.ui">
<Filter>Dialogs</Filter>
</CustomBuild>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ResourceCompile Include="x264_launcher.rc"> <ResourceCompile Include="x264_launcher.rc">