Refactored calculation of the binary path to a separate class. Also more code refactoring.
This commit is contained in:
parent
2c97c709fc
commit
c873bf8527
78
src/binaries.cpp
Normal file
78
src/binaries.cpp
Normal file
@ -0,0 +1,78 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Simple x264 Launcher
|
||||
// Copyright (C) 2004-2014 LoRd_MuldeR <MuldeR2@GMX.de>
|
||||
//
|
||||
// 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");
|
||||
}
|
29
src/binaries.h
Normal file
29
src/binaries.h
Normal file
@ -0,0 +1,29 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Simple x264 Launcher
|
||||
// Copyright (C) 2004-2014 LoRd_MuldeR <MuldeR2@GMX.de>
|
||||
//
|
||||
// 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 <QString>
|
||||
|
||||
class SysinfoModel;
|
||||
class PreferencesModel;
|
||||
class OptionsModel;
|
||||
|
||||
QString ENC_BINARY(const SysinfoModel *sysinfo, const OptionsModel *options);
|
||||
QString AVS_BINARY(const SysinfoModel *sysinfo, const PreferencesModel *preferences);
|
@ -88,7 +88,7 @@ QString OptionsModel::rcMode2String(RCMode mode)
|
||||
}
|
||||
}
|
||||
|
||||
bool OptionsModel::equals(OptionsModel *model)
|
||||
bool OptionsModel::equals(const OptionsModel *model)
|
||||
{
|
||||
bool equal = true;
|
||||
|
||||
|
@ -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);
|
||||
|
@ -27,16 +27,16 @@ 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; }
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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<OptionsModel*>(ui->cbxTemplate->itemData(i).value<void*>()); \
|
||||
const OptionsModel* temp = reinterpret_cast<const OptionsModel*>(ui->cbxTemplate->itemData(i).value<const void*>()); \
|
||||
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 <b>not</b> 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<OptionsModel*>(ui->cbxTemplate->itemData(ui->cbxTemplate->currentIndex()).value<void*>());
|
||||
const OptionsModel* options = reinterpret_cast<const OptionsModel*>(ui->cbxTemplate->itemData(ui->cbxTemplate->currentIndex()).value<const void*>());
|
||||
if(options)
|
||||
{
|
||||
ui->cbxTemplate->blockSignals(true);
|
||||
ui->cbxTemplate->insertItem(0, tr("<Unsaved Configuration>"), QVariant::fromValue<void*>(NULL));
|
||||
ui->cbxTemplate->insertItem(0, tr("<Unsaved Configuration>"), QVariant::fromValue<const void*>(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<OptionsModel*>(ui->cbxTemplate->itemData(ui->cbxTemplate->currentIndex()).value<void*>());
|
||||
const OptionsModel* options = reinterpret_cast<const OptionsModel*>(ui->cbxTemplate->itemData(ui->cbxTemplate->currentIndex()).value<const void*>());
|
||||
if(options)
|
||||
{
|
||||
qDebug("Loading options!");
|
||||
@ -803,7 +819,7 @@ void AddJobDialog::setApplyToAllVisible(const bool visible)
|
||||
|
||||
void AddJobDialog::loadTemplateList(void)
|
||||
{
|
||||
ui->cbxTemplate->addItem(tr("<Default>"), QVariant::fromValue<void*>(m_defaults));
|
||||
ui->cbxTemplate->addItem(tr("<Default>"), QVariant::fromValue<const void*>(m_defaults));
|
||||
ui->cbxTemplate->setCurrentIndex(0);
|
||||
|
||||
QMap<QString, OptionsModel*> 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<void*>(currentTemplate));
|
||||
ui->cbxTemplate->addItem(*current, QVariant::fromValue<const void*>(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("<Recently Used>"), QVariant::fromValue<void*>(m_options));
|
||||
ui->cbxTemplate->insertItem(1, tr("<Recently Used>"), QVariant::fromValue<const void*>(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);
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -24,47 +24,22 @@
|
||||
|
||||
#include "global.h"
|
||||
#include "model_options.h"
|
||||
#include "binaries.h"
|
||||
|
||||
#include <QProcess>
|
||||
#include <QScrollBar>
|
||||
#include <QTimer>
|
||||
|
||||
#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())
|
||||
|
@ -24,6 +24,8 @@
|
||||
#include <QDialog>
|
||||
|
||||
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);
|
||||
};
|
||||
|
@ -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,7 +1381,7 @@ bool MainWindow::appendJob(const QString &sourceFileName, const QString &outputF
|
||||
m_skipVersionTest,
|
||||
m_preferences->processPriority(),
|
||||
m_abortOnTimeout
|
||||
);
|
||||
)*/;
|
||||
|
||||
QModelIndex newIndex = m_jobList->insertJob(thrd);
|
||||
|
||||
|
@ -293,6 +293,7 @@ copy /Y "$(QTDIR)\plugins\imageformats\qgif4.dll" "$(TargetDir)\imageformats"
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="src\3rd_party\avisynth_c.h" />
|
||||
<ClInclude Include="src\3rd_party\blake2.h" />
|
||||
<ClInclude Include="src\binaries.h" />
|
||||
<ClInclude Include="src\checksum.h" />
|
||||
<ClInclude Include="src\cli.h" />
|
||||
<ClInclude Include="src\global.h" />
|
||||
@ -365,6 +366,7 @@ copy /Y "$(QTDIR)\plugins\imageformats\qgif4.dll" "$(TargetDir)\imageformats"
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\3rd_party\blake2.c" />
|
||||
<ClCompile Include="src\3rd_party\qtmain_win.cpp" />
|
||||
<ClCompile Include="src\binaries.cpp" />
|
||||
<ClCompile Include="src\checksum.cpp" />
|
||||
<ClCompile Include="src\cli.cpp" />
|
||||
<ClCompile Include="src\ipc.cpp" />
|
||||
|
@ -81,6 +81,9 @@
|
||||
<ClInclude Include="src\model_sysinfo.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\binaries.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\main.cpp">
|
||||
@ -197,6 +200,9 @@
|
||||
<ClCompile Include="src\cli.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\binaries.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="src\win_main.h">
|
||||
|
Loading…
Reference in New Issue
Block a user