From c873bf852712c2154bdd3eeb626334657df14cf7 Mon Sep 17 00:00:00 2001 From: lordmulder Date: Wed, 12 Feb 2014 21:36:10 +0100 Subject: [PATCH] Refactored calculation of the binary path to a separate class. Also more code refactoring. --- src/binaries.cpp | 78 ++++++++++++++++++++++++++++++++++ src/binaries.h | 29 +++++++++++++ src/model_options.cpp | 2 +- src/model_options.h | 2 +- src/model_preferences.h | 38 ++++++++--------- src/model_sysinfo.h | 2 +- src/version.h | 2 +- src/win_addJob.cpp | 62 +++++++++++++++++---------- src/win_addJob.h | 17 +++++--- src/win_help.cpp | 39 +++-------------- src/win_help.h | 15 ++++--- src/win_main.cpp | 8 ++-- x264_launcher_MSVC2013.vcxproj | 2 + x264_launcher_MSVC2013.vcxproj.filters | 6 +++ 14 files changed, 207 insertions(+), 95 deletions(-) create mode 100644 src/binaries.cpp create mode 100644 src/binaries.h diff --git a/src/binaries.cpp b/src/binaries.cpp new file mode 100644 index 0000000..10916d7 --- /dev/null +++ b/src/binaries.cpp @@ -0,0 +1,78 @@ +/////////////////////////////////////////////////////////////////////////////// +// Simple x264 Launcher +// Copyright (C) 2004-2014 LoRd_MuldeR +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +// +// http://www.gnu.org/licenses/gpl-2.0.txt +/////////////////////////////////////////////////////////////////////////////// + +#include "binaries.h" + +#include "model_sysinfo.h" +#include "model_preferences.h" +#include "model_options.h" + +QString ENC_BINARY(const SysinfoModel *sysinfo, const OptionsModel *options) +{ + QString baseName, arch, variant; + + //Encoder Type + switch(options->encType()) + { + case OptionsModel::EncType_X264: baseName = "x264"; break; + case OptionsModel::EncType_X265: baseName = "x265"; break; + } + + //Architecture + switch(options->encArch()) + { + case OptionsModel::EncArch_x32: arch = "x86"; break; + case OptionsModel::EncArch_x64: arch = "x64"; break; + } + + //Encoder Variant + switch(options->encVariant()) + { + case OptionsModel::EncVariant_LoBit: + switch(options->encType()) + { + case OptionsModel::EncType_X264: + case OptionsModel::EncType_X265: variant = "8bit"; break; + } + break; + case OptionsModel::EncVariant_HiBit: + switch(options->encType()) + { + case OptionsModel::EncType_X264: variant = "10bit"; break; + case OptionsModel::EncType_X265: variant = "16bit"; break; + } + break; + } + + //Sanity check + if(baseName.isEmpty() || arch.isEmpty() || variant.isEmpty()) + { + throw "Failed to determine the encoder binarty path!"; + } + + //Return path + return QString("%1/toolset/%2/%3_%4_%2.exe").arg(sysinfo->getAppPath(), arch, baseName, variant); +} + +QString AVS_BINARY(const SysinfoModel *sysinfo, const PreferencesModel *preferences) +{ + return QString("%1/toolset/%2/avs2yuv_%2.exe").arg(sysinfo->getAppPath(), preferences->useAvisyth64Bit() ? "x64": "x86"); +} diff --git a/src/binaries.h b/src/binaries.h new file mode 100644 index 0000000..94558a6 --- /dev/null +++ b/src/binaries.h @@ -0,0 +1,29 @@ +/////////////////////////////////////////////////////////////////////////////// +// Simple x264 Launcher +// Copyright (C) 2004-2014 LoRd_MuldeR +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +// +// http://www.gnu.org/licenses/gpl-2.0.txt +/////////////////////////////////////////////////////////////////////////////// + +#include + +class SysinfoModel; +class PreferencesModel; +class OptionsModel; + +QString ENC_BINARY(const SysinfoModel *sysinfo, const OptionsModel *options); +QString AVS_BINARY(const SysinfoModel *sysinfo, const PreferencesModel *preferences); diff --git a/src/model_options.cpp b/src/model_options.cpp index 9888ca6..49d4067 100644 --- a/src/model_options.cpp +++ b/src/model_options.cpp @@ -88,7 +88,7 @@ QString OptionsModel::rcMode2String(RCMode mode) } } -bool OptionsModel::equals(OptionsModel *model) +bool OptionsModel::equals(const OptionsModel *model) { bool equal = true; diff --git a/src/model_options.h b/src/model_options.h index 06f9204..72583c5 100644 --- a/src/model_options.h +++ b/src/model_options.h @@ -85,7 +85,7 @@ public: void setCustomAvs2YUV(const QString &custom) { m_custom_avs2yuv = custom.trimmed(); } //Stuff - bool equals(OptionsModel *model); + bool equals(const OptionsModel *model); //Static functions static QString rcMode2String(RCMode mode); diff --git a/src/model_preferences.h b/src/model_preferences.h index fd90fef..a871bd8 100644 --- a/src/model_preferences.h +++ b/src/model_preferences.h @@ -27,28 +27,28 @@ public: PreferencesModel(void); //Getter - bool autoRunNextJob(void) { return m_autoRunNextJob; } - unsigned int maxRunningJobCount(void) { return m_maxRunningJobCount; } - bool shutdownComputer(void) { return m_shutdownComputer; } - bool useAvisyth64Bit(void) { return m_useAvisyth64Bit; } - bool saveLogFiles(void) { return m_saveLogFiles; } - bool saveToSourcePath(void) { return m_saveToSourcePath; } - int processPriority(void) { return m_processPriority; } - bool enableSounds(void) { return m_enableSounds; } - bool disableWarnings(void) { return m_disableWarnings; } - bool noUpdateReminder(void) { return m_noUpdateReminder; } + bool autoRunNextJob(void) const { return m_autoRunNextJob; } + unsigned int maxRunningJobCount(void) const { return m_maxRunningJobCount; } + bool shutdownComputer(void) const { return m_shutdownComputer; } + bool useAvisyth64Bit(void) const { return m_useAvisyth64Bit; } + bool saveLogFiles(void) const { return m_saveLogFiles; } + bool saveToSourcePath(void) const { return m_saveToSourcePath; } + int processPriority(void) const { return m_processPriority; } + bool enableSounds(void) const { return m_enableSounds; } + bool disableWarnings(void) const { return m_disableWarnings; } + bool noUpdateReminder(void) const { return m_noUpdateReminder; } //Setter - void setAutoRunNextJob(const bool autoRunNextJob) { m_autoRunNextJob = autoRunNextJob; } + void setAutoRunNextJob(const bool autoRunNextJob) { m_autoRunNextJob = autoRunNextJob; } void setMaxRunningJobCount(const unsigned int maxRunningJobCount) { m_maxRunningJobCount = maxRunningJobCount; } - void setShutdownComputer(const bool shutdownComputer) { m_shutdownComputer = shutdownComputer; } - void setUseAvisyth64Bit(const bool useAvisyth64Bit) { m_useAvisyth64Bit = useAvisyth64Bit; } - void setSaveLogFiles(const bool saveLogFiles) { m_saveLogFiles = saveLogFiles; } - void setSaveToSourcePath(const bool saveToSourcePath) { m_saveToSourcePath = saveToSourcePath; } - void setProcessPriority(const int processPriority) { m_processPriority = processPriority; } - void setEnableSounds(const bool enableSounds) { m_enableSounds = enableSounds; } - void setDisableWarnings(const bool disableWarnings) { m_disableWarnings = disableWarnings; } - void setNoUpdateReminder(const bool noUpdateReminder) { m_noUpdateReminder = noUpdateReminder; } + void setShutdownComputer(const bool shutdownComputer) { m_shutdownComputer = shutdownComputer; } + void setUseAvisyth64Bit(const bool useAvisyth64Bit) { m_useAvisyth64Bit = useAvisyth64Bit; } + void setSaveLogFiles(const bool saveLogFiles) { m_saveLogFiles = saveLogFiles; } + void setSaveToSourcePath(const bool saveToSourcePath) { m_saveToSourcePath = saveToSourcePath; } + void setProcessPriority(const int processPriority) { m_processPriority = processPriority; } + void setEnableSounds(const bool enableSounds) { m_enableSounds = enableSounds; } + void setDisableWarnings(const bool disableWarnings) { m_disableWarnings = disableWarnings; } + void setNoUpdateReminder(const bool noUpdateReminder) { m_noUpdateReminder = noUpdateReminder; } //Static static void initPreferences(PreferencesModel *preferences); diff --git a/src/model_sysinfo.h b/src/model_sysinfo.h index a1edb12..4165cc4 100644 --- a/src/model_sysinfo.h +++ b/src/model_sysinfo.h @@ -57,7 +57,7 @@ public: protected: static const unsigned int FLAG_HAS_X64 = 0x00000001; - static const unsigned int FLAG_HAS_MMX = 0x00000001; + static const unsigned int FLAG_HAS_MMX = 0x00000002; static const unsigned int FLAG_HAS_SSE = 0x00000004; static const unsigned int FLAG_HAS_AVS = 0x00000008; static const unsigned int FLAG_HAS_VPS = 0x00000010; diff --git a/src/version.h b/src/version.h index 60dd482..edace97 100644 --- a/src/version.h +++ b/src/version.h @@ -26,7 +26,7 @@ #define VER_X264_MAJOR 2 #define VER_X264_MINOR 3 #define VER_X264_PATCH 1 -#define VER_X264_BUILD 763 +#define VER_X264_BUILD 766 #define VER_X264_MINIMUM_REV 2380 #define VER_X264_CURRENT_API 142 diff --git a/src/win_addJob.cpp b/src/win_addJob.cpp index 8cee77d..559bf5e 100644 --- a/src/win_addJob.cpp +++ b/src/win_addJob.cpp @@ -24,6 +24,8 @@ #include "global.h" #include "model_options.h" +#include "model_preferences.h" +#include "model_sysinfo.h" #include "model_recently.h" #include "win_help.h" #include "win_editor.h" @@ -50,7 +52,7 @@ { \ for(int i = 0; i < ui->cbxTemplate->count(); i++) \ { \ - OptionsModel* temp = reinterpret_cast(ui->cbxTemplate->itemData(i).value()); \ + const OptionsModel* temp = reinterpret_cast(ui->cbxTemplate->itemData(i).value()); \ if(temp == NULL) \ { \ ui->cbxTemplate->blockSignals(true); \ @@ -92,6 +94,8 @@ } \ while(0) +Q_DECLARE_METATYPE(const void*) + /////////////////////////////////////////////////////////////////////////////// // Validator /////////////////////////////////////////////////////////////////////////////// @@ -218,14 +222,14 @@ public: // Constructor & Destructor /////////////////////////////////////////////////////////////////////////////// -AddJobDialog::AddJobDialog(QWidget *parent, OptionsModel *options, RecentlyUsed *recentlyUsed, bool x64supported, bool saveToSourceFolder) +AddJobDialog::AddJobDialog(QWidget *parent, OptionsModel *const options, RecentlyUsed *const recentlyUsed, const SysinfoModel *const sysinfo, const PreferencesModel *const preferences) : QDialog(parent), - m_defaults(new OptionsModel()), m_options(options), - m_x64supported(x64supported), - m_saveToSourceFolder(saveToSourceFolder), m_recentlyUsed(recentlyUsed), + m_sysinfo(sysinfo), + m_preferences(preferences), + m_defaults(new OptionsModel()), ui(new Ui::AddJobDialog()) { //Init the dialog, from the .ui file @@ -243,8 +247,9 @@ AddJobDialog::AddJobDialog(QWidget *parent, OptionsModel *options, RecentlyUsed ui->checkBoxApplyToAll->setVisible(false); //Monitor combobox changes - connect(ui->cbxRateControlMode, SIGNAL(currentIndexChanged(int)), this, SLOT(modeIndexChanged(int))); connect(ui->cbxEncoderType, SIGNAL(currentIndexChanged(int)), this, SLOT(encoderIndexChanged(int))); + connect(ui->cbxEncoderVariant, SIGNAL(currentIndexChanged(int)), this, SLOT(variantIndexChanged(int))); + connect(ui->cbxRateControlMode, SIGNAL(currentIndexChanged(int)), this, SLOT(modeIndexChanged(int))); //Activate buttons connect(ui->buttonBrowseSource, SIGNAL(clicked()), this, SLOT(browseButtonClicked())); @@ -333,7 +338,7 @@ void AddJobDialog::showEvent(QShowEvent *event) if((!ui->editSource->text().isEmpty()) && ui->editOutput->text().isEmpty()) { - QString outPath = generateOutputFileName(QDir::fromNativeSeparators(ui->editSource->text()), m_recentlyUsed->outputDirectory(), m_recentlyUsed->filterIndex(), m_saveToSourceFolder); + QString outPath = generateOutputFileName(QDir::fromNativeSeparators(ui->editSource->text()), m_recentlyUsed->outputDirectory(), m_recentlyUsed->filterIndex(), m_preferences->saveToSourcePath()); ui->editOutput->setText(QDir::toNativeSeparators(outPath)); ui->buttonAccept->setFocus(); } @@ -352,13 +357,13 @@ bool AddJobDialog::eventFilter(QObject *o, QEvent *e) if((o == ui->labelHelpScreenX264) && (e->type() == QEvent::MouseButtonPress)) { OptionsModel options; saveOptions(&options); - HelpDialog *helpScreen = new HelpDialog(this, false, &options); + HelpDialog *helpScreen = new HelpDialog(this, false, m_sysinfo, &options, m_preferences); helpScreen->exec(); X264_DELETE(helpScreen); } else if((o == ui->labelHelpScreenAvs2YUV) && (e->type() == QEvent::MouseButtonPress)) { - HelpDialog *helpScreen = new HelpDialog(this, true, NULL); + HelpDialog *helpScreen = new HelpDialog(this, false, m_sysinfo, m_defaults, m_preferences); helpScreen->exec(); X264_DELETE(helpScreen); } @@ -417,7 +422,7 @@ void AddJobDialog::dropEvent(QDropEvent *event) if(!droppedFile.isEmpty()) { - const QString outFileName = generateOutputFileName(droppedFile, currentOutputPath(), currentOutputIndx(), m_saveToSourceFolder); + const QString outFileName = generateOutputFileName(droppedFile, currentOutputPath(), currentOutputIndx(), m_preferences->saveToSourcePath()); ui->editSource->setText(QDir::toNativeSeparators(droppedFile)); ui->editOutput->setText(QDir::toNativeSeparators(outFileName)); } @@ -429,11 +434,22 @@ void AddJobDialog::dropEvent(QDropEvent *event) void AddJobDialog::encoderIndexChanged(int index) { - const bool isX265 = (index >= 1); + const bool isX265 = (index > 0); + const bool noProf = isX265 || (ui->cbxEncoderVariant->currentIndex() > 0); + ui->cbxEncoderVariant->setItemText(1, isX265 ? tr("16-Bit") : tr("10-Bit")); - ui->cbxProfile->setEnabled(!isX265); - ui->labelProfile->setEnabled(!isX265); - if(isX265) ui->cbxProfile->setCurrentIndex(0); + ui->labelProfile->setEnabled(!noProf); + ui->cbxProfile->setEnabled(!noProf); + if(noProf) ui->cbxProfile->setCurrentIndex(0); +} + +void AddJobDialog::variantIndexChanged(int index) +{ + const bool noProf = (index > 0) || (ui->cbxEncoderType->currentIndex() > 0); + + ui->labelProfile->setEnabled(!noProf); + ui->cbxProfile->setEnabled(!noProf); + if(noProf) ui->cbxProfile->setCurrentIndex(0); } void AddJobDialog::modeIndexChanged(int index) @@ -445,7 +461,7 @@ void AddJobDialog::modeIndexChanged(int index) void AddJobDialog::accept(void) { //Check 64-Bit support - if((ui->cbxEncoderArch->currentIndex() == OptionsModel::EncArch_x64) && (!m_x64supported)) + if((ui->cbxEncoderArch->currentIndex() == OptionsModel::EncArch_x64) && (!m_sysinfo->hasX64Support())) { QMessageBox::warning(this, tr("64-Bit unsupported!"), tr("Sorry, this computer does not support 64-Bit encoders!")); ui->cbxEncoderArch->setCurrentIndex(OptionsModel::EncArch_x32); @@ -518,7 +534,7 @@ void AddJobDialog::browseButtonClicked(void) QString filePath = QFileDialog::getOpenFileName(this, tr("Open Source File"), currentSourcePath(true), getInputFilterLst(), NULL, QFileDialog::DontUseNativeDialog); if(!(filePath.isNull() || filePath.isEmpty())) { - QString destFile = generateOutputFileName(filePath, currentOutputPath(), currentOutputIndx(), m_saveToSourceFolder); + QString destFile = generateOutputFileName(filePath, currentOutputPath(), currentOutputIndx(), m_preferences->saveToSourcePath()); ui->editSource->setText(QDir::toNativeSeparators(filePath)); ui->editOutput->setText(QDir::toNativeSeparators(destFile)); } @@ -551,11 +567,11 @@ void AddJobDialog::browseButtonClicked(void) void AddJobDialog::configurationChanged(void) { - OptionsModel* options = reinterpret_cast(ui->cbxTemplate->itemData(ui->cbxTemplate->currentIndex()).value()); + const OptionsModel* options = reinterpret_cast(ui->cbxTemplate->itemData(ui->cbxTemplate->currentIndex()).value()); if(options) { ui->cbxTemplate->blockSignals(true); - ui->cbxTemplate->insertItem(0, tr(""), QVariant::fromValue(NULL)); + ui->cbxTemplate->insertItem(0, tr(""), QVariant::fromValue(NULL)); ui->cbxTemplate->setCurrentIndex(0); ui->cbxTemplate->blockSignals(false); } @@ -563,7 +579,7 @@ void AddJobDialog::configurationChanged(void) void AddJobDialog::templateSelected(void) { - OptionsModel* options = reinterpret_cast(ui->cbxTemplate->itemData(ui->cbxTemplate->currentIndex()).value()); + const OptionsModel* options = reinterpret_cast(ui->cbxTemplate->itemData(ui->cbxTemplate->currentIndex()).value()); if(options) { qDebug("Loading options!"); @@ -803,7 +819,7 @@ void AddJobDialog::setApplyToAllVisible(const bool visible) void AddJobDialog::loadTemplateList(void) { - ui->cbxTemplate->addItem(tr(""), QVariant::fromValue(m_defaults)); + ui->cbxTemplate->addItem(tr(""), QVariant::fromValue(m_defaults)); ui->cbxTemplate->setCurrentIndex(0); QMap templates = OptionsModel::loadAllTemplates(); @@ -813,7 +829,7 @@ void AddJobDialog::loadTemplateList(void) for(QStringList::ConstIterator current = templateNames.constBegin(); current != templateNames.constEnd(); current++) { OptionsModel *currentTemplate = templates.take(*current); - ui->cbxTemplate->addItem(*current, QVariant::fromValue(currentTemplate)); + ui->cbxTemplate->addItem(*current, QVariant::fromValue(currentTemplate)); if(currentTemplate->equals(m_options)) { ui->cbxTemplate->setCurrentIndex(ui->cbxTemplate->count() - 1); @@ -823,7 +839,7 @@ void AddJobDialog::loadTemplateList(void) if((ui->cbxTemplate->currentIndex() == 0) && (!m_options->equals(m_defaults))) { qWarning("Not the default -> recently used!"); - ui->cbxTemplate->insertItem(1, tr(""), QVariant::fromValue(m_options)); + ui->cbxTemplate->insertItem(1, tr(""), QVariant::fromValue(m_options)); ui->cbxTemplate->setCurrentIndex(1); } } @@ -845,7 +861,7 @@ void AddJobDialog::updateComboBox(QComboBox *cbox, const QString &text) cbox->setCurrentIndex(index); } -void AddJobDialog::restoreOptions(OptionsModel *options) +void AddJobDialog::restoreOptions(const OptionsModel *options) { BLOCK_SIGNALS(true); diff --git a/src/win_addJob.h b/src/win_addJob.h index a64b25c..3a78e23 100644 --- a/src/win_addJob.h +++ b/src/win_addJob.h @@ -25,6 +25,8 @@ class OptionsModel; class RecentlyUsed; +class SysinfoModel; +class PreferencesModel; class QComboBox; namespace Ui @@ -37,7 +39,7 @@ class AddJobDialog : public QDialog Q_OBJECT public: - AddJobDialog(QWidget *parent, OptionsModel *options, RecentlyUsed *recentlyUsed, bool x64supported, bool saveToSourceFolder); + AddJobDialog(QWidget *parent, OptionsModel *const options, RecentlyUsed *const recentlyUsed, const SysinfoModel *const sysinfo, const PreferencesModel *const preferences); ~AddJobDialog(void); QString sourceFile(void); @@ -59,12 +61,12 @@ public: static QString getInputFilterLst(void); protected: - OptionsModel *m_options; - OptionsModel *m_defaults; - RecentlyUsed *m_recentlyUsed; + OptionsModel *const m_options; + RecentlyUsed *const m_recentlyUsed; - const bool m_x64supported; - const bool m_saveToSourceFolder; + const SysinfoModel *const m_sysinfo; + const PreferencesModel *const m_preferences; + const OptionsModel *m_defaults; virtual void showEvent(QShowEvent *event); virtual bool eventFilter(QObject *o, QEvent *e); @@ -73,6 +75,7 @@ protected: private slots: void encoderIndexChanged(int index); + void variantIndexChanged(int index); void modeIndexChanged(int index); void browseButtonClicked(void); void configurationChanged(void); @@ -89,7 +92,7 @@ private: Ui::AddJobDialog *const ui; void loadTemplateList(void); - void restoreOptions(OptionsModel *options); + void restoreOptions(const OptionsModel *options); void saveOptions(OptionsModel *options); void updateComboBox(QComboBox *cbox, const QString &text); diff --git a/src/win_help.cpp b/src/win_help.cpp index 04cab12..da7238f 100644 --- a/src/win_help.cpp +++ b/src/win_help.cpp @@ -24,47 +24,22 @@ #include "global.h" #include "model_options.h" +#include "binaries.h" #include #include #include -#define AVS2_BINARY(BIN_DIR) QString("%1/%2/avs2yuv_%2.exe").arg((BIN_DIR), "x86") - -static QString X264_BINARY(const QString &binDir, const OptionsModel *options) -{ - QString baseName, arch, variant; - - switch(options->encType()) - { - case OptionsModel::EncType_X264: baseName = "x264"; break; - case OptionsModel::EncType_X265: baseName = "x265"; break; - } - - switch(options->encArch()) - { - case OptionsModel::EncArch_x32: arch = "x86"; break; - case OptionsModel::EncArch_x64: arch = "x64"; break; - } - - switch(options->encVariant()) - { - case OptionsModel::EncVariant_LoBit: variant = "8bit"; break; - case OptionsModel::EncVariant_HiBit: variant = (options->encType() == OptionsModel::EncType_X265) ? "16bit" : "10bit"; break; - } - - return QString("%1/%2/x264_%3_%2.exe").arg((binDir), arch, variant); -} - /////////////////////////////////////////////////////////////////////////////// // Constructor & Destructor /////////////////////////////////////////////////////////////////////////////// -HelpDialog::HelpDialog(QWidget *parent, bool avs2yuv, const OptionsModel *options) +HelpDialog::HelpDialog(QWidget *parent, bool avs2yuv, const SysinfoModel *const sysinfo, const OptionsModel *const options, const PreferencesModel *const preferences) : QDialog(parent), - m_appDir(QApplication::applicationDirPath() + "/toolset"), m_avs2yuv(avs2yuv), + m_sysinfo(sysinfo), + m_preferences(preferences), m_options(options), m_process(new QProcess()), ui(new Ui::HelpDialog()) @@ -106,11 +81,11 @@ void HelpDialog::showEvent(QShowEvent *event) if(!m_avs2yuv) { - m_process->start(X264_BINARY(m_appDir, m_options), QStringList() << "--version"); + m_process->start(ENC_BINARY(m_sysinfo, m_options), QStringList() << "--version"); } else { - m_process->start(AVS2_BINARY(m_appDir), QStringList()); + m_process->start(AVS_BINARY(m_sysinfo, m_preferences), QStringList()); } if(!m_process->waitForStarted()) @@ -155,7 +130,7 @@ void HelpDialog::finished(void) m_startAgain = false; if(!m_avs2yuv) { - m_process->start(X264_BINARY(m_appDir, m_options), QStringList() << "--fullhelp"); + m_process->start(ENC_BINARY(m_sysinfo, m_options), QStringList() << "--fullhelp"); ui->plainTextEdit->appendPlainText("\n--------\n"); if(!m_process->waitForStarted()) diff --git a/src/win_help.h b/src/win_help.h index aaf0abc..b1676ad 100644 --- a/src/win_help.h +++ b/src/win_help.h @@ -24,6 +24,8 @@ #include class QProcess; +class SysinfoModel; +class PreferencesModel; class OptionsModel; namespace Ui @@ -36,7 +38,7 @@ class HelpDialog : public QDialog Q_OBJECT public: - HelpDialog(QWidget *parent, bool avs2yuv, const OptionsModel *options); + HelpDialog(QWidget *parent, bool avs2yuv, const SysinfoModel *const sysinfo, const OptionsModel *const options, const PreferencesModel *const preferences); ~HelpDialog(void); private slots: @@ -46,15 +48,16 @@ private slots: private: Ui::HelpDialog *const ui; - const QString m_appDir; - QProcess *const m_process; + const bool m_avs2yuv; + + const SysinfoModel *const m_sysinfo; + const PreferencesModel *const m_preferences; + const OptionsModel *const m_options; + QProcess *const m_process; bool m_startAgain; protected: - const bool m_avs2yuv; - const OptionsModel *m_options; - virtual void showEvent(QShowEvent *event); virtual void closeEvent(QCloseEvent *e); }; diff --git a/src/win_main.cpp b/src/win_main.cpp index 3ca4ed2..7e360bd 100644 --- a/src/win_main.cpp +++ b/src/win_main.cpp @@ -1292,7 +1292,7 @@ void MainWindow::dropEvent(QDropEvent *event) bool MainWindow::createJob(QString &sourceFileName, QString &outputFileName, OptionsModel *options, bool &runImmediately, const bool restart, int fileNo, int fileTotal, bool *applyToAll) { bool okay = false; - AddJobDialog *addDialog = new AddJobDialog(this, options, m_recentlyUsed, m_sysinfo, m_preferences->saveToSourcePath()); + AddJobDialog *addDialog = new AddJobDialog(this, options, m_recentlyUsed, m_sysinfo, m_preferences); addDialog->setRunImmediately(runImmediately); if(!sourceFileName.isEmpty()) addDialog->setSourceFile(sourceFileName); @@ -1371,7 +1371,7 @@ bool MainWindow::appendJob(const QString &sourceFileName, const QString &outputF { bool okay = false; - EncodeThread *thrd = new EncodeThread + EncodeThread *thrd = NULL/*new EncodeThread ( sourceFileName, outputFileName, @@ -1381,8 +1381,8 @@ bool MainWindow::appendJob(const QString &sourceFileName, const QString &outputF m_skipVersionTest, m_preferences->processPriority(), m_abortOnTimeout - ); - + )*/; + QModelIndex newIndex = m_jobList->insertJob(thrd); if(newIndex.isValid()) diff --git a/x264_launcher_MSVC2013.vcxproj b/x264_launcher_MSVC2013.vcxproj index 0f3a75f..ce71610 100644 --- a/x264_launcher_MSVC2013.vcxproj +++ b/x264_launcher_MSVC2013.vcxproj @@ -293,6 +293,7 @@ copy /Y "$(QTDIR)\plugins\imageformats\qgif4.dll" "$(TargetDir)\imageformats" + @@ -365,6 +366,7 @@ copy /Y "$(QTDIR)\plugins\imageformats\qgif4.dll" "$(TargetDir)\imageformats" + diff --git a/x264_launcher_MSVC2013.vcxproj.filters b/x264_launcher_MSVC2013.vcxproj.filters index b5b02e5..c0da28f 100644 --- a/x264_launcher_MSVC2013.vcxproj.filters +++ b/x264_launcher_MSVC2013.vcxproj.filters @@ -81,6 +81,9 @@ Header Files + + Header Files + @@ -197,6 +200,9 @@ Source Files + + Source Files + -- 2.11.0