Added a new model to store the system capabilities.

This commit is contained in:
LoRd_MuldeR 2014-02-12 19:34:14 +01:00
parent 7ed6499ff2
commit 2c97c709fc
11 changed files with 156 additions and 93 deletions

View File

@ -10,7 +10,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>372</width> <width>372</width>
<height>387</height> <height>359</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -121,37 +121,6 @@
</item> </item>
</layout> </layout>
</item> </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QCheckBox" name="checkUse10BitEncoding">
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelUse10BitEncoding">
<property name="text">
<string>Use 10-Bit version of x264 → implies 'High 10' H.264 Profile</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_6"> <layout class="QHBoxLayout" name="horizontalLayout_6">
<item> <item>

75
src/model_sysinfo.h Normal file
View File

@ -0,0 +1,75 @@
///////////////////////////////////////////////////////////////////////////////
// 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
///////////////////////////////////////////////////////////////////////////////
#pragma once
#include <QString>
#define SYSINFO_MAKE_FLAG(NAME) \
inline void set##NAME##Support(const bool &enable) \
{ \
if(enable) setFlag(FLAG_HAS_##NAME); else clrFlag(FLAG_HAS_##NAME); \
} \
inline bool has##NAME##Support(void) const \
{ \
return ((m_flags & (FLAG_HAS_##NAME)) == FLAG_HAS_##NAME); \
}
#define SYSINFO_MAKE_PATH(NAME) \
inline void set##NAME##Path(const QString &path) \
{ \
m_path##NAME = path; \
} \
inline const QString & get##NAME##Path(void) const \
{ \
return m_path##NAME; \
}
class SysinfoModel
{
public:
SysinfoModel(void) { m_flags = 0; }
SYSINFO_MAKE_FLAG(X64)
SYSINFO_MAKE_FLAG(MMX)
SYSINFO_MAKE_FLAG(SSE)
SYSINFO_MAKE_FLAG(AVS)
SYSINFO_MAKE_FLAG(VPS)
SYSINFO_MAKE_PATH(VPS)
SYSINFO_MAKE_PATH(App)
protected:
static const unsigned int FLAG_HAS_X64 = 0x00000001;
static const unsigned int FLAG_HAS_MMX = 0x00000001;
static const unsigned int FLAG_HAS_SSE = 0x00000004;
static const unsigned int FLAG_HAS_AVS = 0x00000008;
static const unsigned int FLAG_HAS_VPS = 0x00000010;
inline void setFlag(const unsigned int &flag) { m_flags = (m_flags | flag); }
inline void clrFlag(const unsigned int &flag) { m_flags = (m_flags & (~flag)); }
QString m_pathApp;
QString m_pathVPS;
unsigned int m_flags;
};
#undef SYSINFO_MAKE_FLAG
#undef SYSINFO_MAKE_PATH

View File

@ -26,7 +26,7 @@
#define VER_X264_MAJOR 2 #define VER_X264_MAJOR 2
#define VER_X264_MINOR 3 #define VER_X264_MINOR 3
#define VER_X264_PATCH 1 #define VER_X264_PATCH 1
#define VER_X264_BUILD 761 #define VER_X264_BUILD 763
#define VER_X264_MINIMUM_REV 2380 #define VER_X264_MINIMUM_REV 2380
#define VER_X264_CURRENT_API 142 #define VER_X264_CURRENT_API 142

View File

@ -26,6 +26,7 @@
#include "cli.h" #include "cli.h"
#include "ipc.h" #include "ipc.h"
#include "model_status.h" #include "model_status.h"
#include "model_sysinfo.h"
#include "model_jobList.h" #include "model_jobList.h"
#include "model_options.h" #include "model_options.h"
#include "model_preferences.h" #include "model_preferences.h"
@ -75,9 +76,8 @@ const char *tpl_last = "<LAST_USED>";
*/ */
MainWindow::MainWindow(const x264_cpu_t *const cpuFeatures, IPC *ipc) MainWindow::MainWindow(const x264_cpu_t *const cpuFeatures, IPC *ipc)
: :
m_cpuFeatures(cpuFeatures),
m_ipc(ipc), m_ipc(ipc),
m_appDir(QApplication::applicationDirPath()), m_sysinfo(NULL),
m_options(NULL), m_options(NULL),
m_jobList(NULL), m_jobList(NULL),
m_pendingFiles(new QStringList()), m_pendingFiles(new QStringList()),
@ -98,6 +98,13 @@ MainWindow::MainWindow(const x264_cpu_t *const cpuFeatures, IPC *ipc)
qRegisterMetaType<QUuid>("DWORD"); qRegisterMetaType<QUuid>("DWORD");
qRegisterMetaType<JobStatus>("JobStatus"); qRegisterMetaType<JobStatus>("JobStatus");
//Create and initialize the sysinfo object
m_sysinfo = new SysinfoModel();
m_sysinfo->setAppPath(QApplication::applicationDirPath());
m_sysinfo->setMMXSupport(cpuFeatures->mmx && cpuFeatures->mmx2);
m_sysinfo->setSSESupport(cpuFeatures->sse);
m_sysinfo->setX64Support(cpuFeatures->x64);
//Load preferences //Load preferences
m_preferences = new PreferencesModel(); m_preferences = new PreferencesModel();
PreferencesModel::loadPreferences(m_preferences); PreferencesModel::loadPreferences(m_preferences);
@ -117,7 +124,7 @@ MainWindow::MainWindow(const x264_cpu_t *const cpuFeatures, IPC *ipc)
//Update title //Update title
ui->labelBuildDate->setText(tr("Built on %1 at %2").arg(x264_version_date().toString(Qt::ISODate), QString::fromLatin1(x264_version_time()))); ui->labelBuildDate->setText(tr("Built on %1 at %2").arg(x264_version_date().toString(Qt::ISODate), QString::fromLatin1(x264_version_time())));
ui->labelBuildDate->installEventFilter(this); ui->labelBuildDate->installEventFilter(this);
setWindowTitle(QString("%1 (%2 Mode)").arg(windowTitle(), m_cpuFeatures->x64 ? "64-Bit" : "32-Bit")); setWindowTitle(QString("%1 (%2 Mode)").arg(windowTitle(), m_sysinfo->hasX64Support() ? "64-Bit" : "32-Bit"));
if(X264_DEBUG) if(X264_DEBUG)
{ {
setWindowTitle(QString("%1 | !!! DEBUG VERSION !!!").arg(windowTitle())); setWindowTitle(QString("%1 | !!! DEBUG VERSION !!!").arg(windowTitle()));
@ -219,6 +226,8 @@ MainWindow::~MainWindow(void)
X264_DELETE(m_preferences); X264_DELETE(m_preferences);
X264_DELETE(m_recentlyUsed); X264_DELETE(m_recentlyUsed);
X264_DELETE(m_sysinfo);
VapourSynthCheckThread::unload(); VapourSynthCheckThread::unload();
AvisynthCheckThread::unload(); AvisynthCheckThread::unload();
@ -593,7 +602,7 @@ void MainWindow::showPreferences(void)
ENSURE_APP_IS_IDLE(); ENSURE_APP_IS_IDLE();
m_status = STATUS_BLOCKED; m_status = STATUS_BLOCKED;
PreferencesDialog *preferences = new PreferencesDialog(this, m_preferences, m_cpuFeatures->x64); PreferencesDialog *preferences = new PreferencesDialog(this, m_preferences, m_sysinfo);
preferences->exec(); preferences->exec();
X264_DELETE(preferences); X264_DELETE(preferences);
@ -774,13 +783,13 @@ void MainWindow::init(void)
{ {
qApp->processEvents(QEventLoop::ExcludeUserInputEvents); qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
QString current = binaries.takeFirst(); QString current = binaries.takeFirst();
QFile *file = new QFile(QString("%1/toolset/%2").arg(m_appDir, current)); QFile *file = new QFile(QString("%1/toolset/%2").arg(m_sysinfo->getAppPath(), current));
if(file->open(QIODevice::ReadOnly)) if(file->open(QIODevice::ReadOnly))
{ {
if(!x264_is_executable(file->fileName())) if(!x264_is_executable(file->fileName()))
{ {
QMessageBox::critical(this, tr("Invalid File!"), tr("<nobr>At least on required tool is not a valid Win32 or Win64 binary:<br><tt style=\"whitespace:nowrap\">%1</tt><br><br>Please re-install the program in order to fix the problem!</nobr>").arg(QDir::toNativeSeparators(QString("%1/toolset/%2").arg(m_appDir, current))).replace("-", "&minus;")); QMessageBox::critical(this, tr("Invalid File!"), tr("<nobr>At least on required tool is not a valid Win32 or Win64 binary:<br><tt style=\"whitespace:nowrap\">%1</tt><br><br>Please re-install the program in order to fix the problem!</nobr>").arg(QDir::toNativeSeparators(QString("%1/toolset/%2").arg(m_sysinfo->getAppPath(), current))).replace("-", "&minus;"));
qFatal(QString("Binary is invalid: %1/toolset/%2").arg(m_appDir, current).toLatin1().constData()); qFatal(QString("Binary is invalid: %1/toolset/%2").arg(m_sysinfo->getAppPath(), current).toLatin1().constData());
INIT_ERROR_EXIT(); INIT_ERROR_EXIT();
} }
m_toolsList << file; m_toolsList << file;
@ -788,8 +797,8 @@ void MainWindow::init(void)
else else
{ {
X264_DELETE(file); X264_DELETE(file);
QMessageBox::critical(this, tr("File Not Found!"), tr("<nobr>At least on required tool could not be found:<br><tt style=\"whitespace:nowrap\">%1</tt><br><br>Please re-install the program in order to fix the problem!</nobr>").arg(QDir::toNativeSeparators(QString("%1/toolset/%2").arg(m_appDir, current))).replace("-", "&minus;")); QMessageBox::critical(this, tr("File Not Found!"), tr("<nobr>At least on required tool could not be found:<br><tt style=\"whitespace:nowrap\">%1</tt><br><br>Please re-install the program in order to fix the problem!</nobr>").arg(QDir::toNativeSeparators(QString("%1/toolset/%2").arg(m_sysinfo->getAppPath(), current))).replace("-", "&minus;"));
qFatal(QString("Binary not found: %1/toolset/%2").arg(m_appDir, current).toLatin1().constData()); qFatal(QString("Binary not found: %1/toolset/%2").arg(m_sysinfo->getAppPath(), current).toLatin1().constData());
INIT_ERROR_EXIT(); INIT_ERROR_EXIT();
} }
} }
@ -821,13 +830,13 @@ void MainWindow::init(void)
} }
//Make sure this CPU can run x264 (requires MMX + MMXEXT/iSSE to run x264 with ASM enabled, additionally requires SSE1 for most x264 builds) //Make sure this CPU can run x264 (requires MMX + MMXEXT/iSSE to run x264 with ASM enabled, additionally requires SSE1 for most x264 builds)
if(!(m_cpuFeatures->mmx && m_cpuFeatures->mmx2)) if(!m_sysinfo->hasMMXSupport())
{ {
QMessageBox::critical(this, tr("Unsupported CPU"), tr("<nobr>Sorry, but this machine is <b>not</b> physically capable of running x264 (with assembly).<br>Please get a CPU that supports at least the MMX and MMXEXT instruction sets!</nobr>"), tr("Quit")); QMessageBox::critical(this, tr("Unsupported CPU"), tr("<nobr>Sorry, but this machine is <b>not</b> physically capable of running x264 (with assembly).<br>Please get a CPU that supports at least the MMX and MMXEXT instruction sets!</nobr>"), tr("Quit"));
qFatal("System does not support MMX and MMXEXT, x264 will not work !!!"); qFatal("System does not support MMX and MMXEXT, x264 will not work !!!");
INIT_ERROR_EXIT(); INIT_ERROR_EXIT();
} }
else if(!(m_cpuFeatures->mmx && m_cpuFeatures->sse)) else if(!m_sysinfo->hasSSESupport())
{ {
qWarning("WARNING: System does not support SSE1, most x264 builds will not work !!!\n"); qWarning("WARNING: System does not support SSE1, most x264 builds will not work !!!\n");
int val = QMessageBox::warning(this, tr("Unsupported CPU"), tr("<nobr>It appears that this machine does <b>not</b> support the SSE1 instruction set.<br>Thus most builds of x264 will <b>not</b> run on this computer at all.<br><br>Please get a CPU that supports the MMX and SSE1 instruction sets!</nobr>"), tr("Quit"), tr("Ignore")); int val = QMessageBox::warning(this, tr("Unsupported CPU"), tr("<nobr>It appears that this machine does <b>not</b> support the SSE1 instruction set.<br>Thus most builds of x264 will <b>not</b> run on this computer at all.<br><br>Please get a CPU that supports the MMX and SSE1 instruction sets!</nobr>"), tr("Quit"), tr("Ignore"));
@ -862,7 +871,12 @@ void MainWindow::init(void)
int val = QMessageBox::critical(this, tr("Avisynth Error"), QString("<nobr>%1</nobr>").arg(text).replace("-", "&minus;"), tr("Quit"), tr("Ignore")); int val = QMessageBox::critical(this, tr("Avisynth Error"), QString("<nobr>%1</nobr>").arg(text).replace("-", "&minus;"), tr("Quit"), tr("Ignore"));
if(val != 1) INIT_ERROR_EXIT(); if(val != 1) INIT_ERROR_EXIT();
} }
if((!result) || (avisynthVersion < 2.5)) if(result && (avisynthVersion >= 2.5))
{
qDebug("Avisynth support is officially enabled now!");
m_sysinfo->setAVSSupport(true);
}
else
{ {
if(!m_preferences->disableWarnings()) if(!m_preferences->disableWarnings())
{ {
@ -879,8 +893,8 @@ void MainWindow::init(void)
if(!CLIParser::checkFlag(CLI_PARAM_SKIP_VPS_CHECK, arguments)) if(!CLIParser::checkFlag(CLI_PARAM_SKIP_VPS_CHECK, arguments))
{ {
qDebug("[Check for VapourSynth support]"); qDebug("[Check for VapourSynth support]");
volatile double avisynthVersion = 0.0; QString vapoursynthPath;
const int result = VapourSynthCheckThread::detect(m_vapoursynthPath); const int result = VapourSynthCheckThread::detect(vapoursynthPath);
if(result < 0) if(result < 0)
{ {
QString text = tr("A critical error was encountered while checking your VapourSynth installation.").append("<br>"); QString text = tr("A critical error was encountered while checking your VapourSynth installation.").append("<br>");
@ -889,7 +903,13 @@ void MainWindow::init(void)
int val = QMessageBox::critical(this, tr("VapourSynth Error"), QString("<nobr>%1</nobr>").arg(text).replace("-", "&minus;"), tr("Quit"), tr("Ignore")); int val = QMessageBox::critical(this, tr("VapourSynth Error"), QString("<nobr>%1</nobr>").arg(text).replace("-", "&minus;"), tr("Quit"), tr("Ignore"));
if(val != 1) INIT_ERROR_EXIT(); if(val != 1) INIT_ERROR_EXIT();
} }
if((!result) || (m_vapoursynthPath.isEmpty())) if(result && (!vapoursynthPath.isEmpty()))
{
qDebug("VapourSynth support is officially enabled now!");
m_sysinfo->setVPSSupport(true);
m_sysinfo->setVPSPath(vapoursynthPath);
}
else
{ {
if(!m_preferences->disableWarnings()) if(!m_preferences->disableWarnings())
{ {
@ -1079,7 +1099,7 @@ void MainWindow::checkUpdates(void)
return; return;
} }
UpdaterDialog *updater = new UpdaterDialog(this, QString("%1/toolset").arg(m_appDir)); UpdaterDialog *updater = new UpdaterDialog(this, m_sysinfo);
const int ret = updater->exec(); const int ret = updater->exec();
if(updater->getSuccess()) if(updater->getSuccess())
@ -1272,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 MainWindow::createJob(QString &sourceFileName, QString &outputFileName, OptionsModel *options, bool &runImmediately, const bool restart, int fileNo, int fileTotal, bool *applyToAll)
{ {
bool okay = false; bool okay = false;
AddJobDialog *addDialog = new AddJobDialog(this, options, m_recentlyUsed, m_cpuFeatures->x64, m_preferences->saveToSourcePath()); AddJobDialog *addDialog = new AddJobDialog(this, options, m_recentlyUsed, m_sysinfo, m_preferences->saveToSourcePath());
addDialog->setRunImmediately(runImmediately); addDialog->setRunImmediately(runImmediately);
if(!sourceFileName.isEmpty()) addDialog->setSourceFile(sourceFileName); if(!sourceFileName.isEmpty()) addDialog->setSourceFile(sourceFileName);
@ -1356,11 +1376,8 @@ bool MainWindow::appendJob(const QString &sourceFileName, const QString &outputF
sourceFileName, sourceFileName,
outputFileName, outputFileName,
options, options,
QString("%1/toolset").arg(m_appDir), m_sysinfo,
m_vapoursynthPath, m_preferences->useAvisyth64Bit(),
m_cpuFeatures->x64,
false /*m_preferences->use10BitEncoding()*/,
m_cpuFeatures->x64 && m_preferences->useAvisyth64Bit(),
m_skipVersionTest, m_skipVersionTest,
m_preferences->processPriority(), m_preferences->processPriority(),
m_abortOnTimeout m_abortOnTimeout

View File

@ -27,6 +27,7 @@
class IPC; class IPC;
class JobListModel; class JobListModel;
class OptionsModel; class OptionsModel;
class SysinfoModel;
class QFile; class QFile;
class QLibrary; class QLibrary;
class PreferencesModel; class PreferencesModel;
@ -84,14 +85,10 @@ private:
QStringList *m_pendingFiles; QStringList *m_pendingFiles;
QList<QFile*> m_toolsList; QList<QFile*> m_toolsList;
SysinfoModel *m_sysinfo;
PreferencesModel *m_preferences; PreferencesModel *m_preferences;
RecentlyUsed *m_recentlyUsed; RecentlyUsed *m_recentlyUsed;
QString m_vapoursynthPath;
const x264_cpu_t *const m_cpuFeatures;
const QString m_appDir;
bool createJob(QString &sourceFileName, QString &outputFileName, OptionsModel *options, bool &runImmediately, const bool restart = false, int fileNo = -1, int fileTotal = 0, bool *applyToAll = NULL); bool createJob(QString &sourceFileName, QString &outputFileName, OptionsModel *options, bool &runImmediately, const bool restart = false, int fileNo = -1, int fileTotal = 0, bool *applyToAll = NULL);
bool createJobMultiple(const QStringList &filePathIn); bool createJobMultiple(const QStringList &filePathIn);

View File

@ -24,6 +24,7 @@
#include "global.h" #include "global.h"
#include "model_preferences.h" #include "model_preferences.h"
#include "model_sysinfo.h"
#include <QSettings> #include <QSettings>
#include <QDesktopServices> #include <QDesktopServices>
@ -52,10 +53,10 @@ static inline void UPDATE_COMBOBOX(QComboBox *const cobox, const int value, cons
} }
} }
PreferencesDialog::PreferencesDialog(QWidget *parent, PreferencesModel *preferences, bool x64) PreferencesDialog::PreferencesDialog(QWidget *parent, PreferencesModel *preferences, const SysinfoModel *sysinfo)
: :
QDialog(parent), QDialog(parent),
m_x64(x64), m_sysinfo(sysinfo),
ui(new Ui::PreferencesDialog()) ui(new Ui::PreferencesDialog())
{ {
ui->setupUi(this); ui->setupUi(this);
@ -69,7 +70,6 @@ PreferencesDialog::PreferencesDialog(QWidget *parent, PreferencesModel *preferen
ui->comboBoxPriority->setItemData(3, QVariant::fromValue(-2)); //Idle ui->comboBoxPriority->setItemData(3, QVariant::fromValue(-2)); //Idle
ui->labelRunNextJob->installEventFilter(this); ui->labelRunNextJob->installEventFilter(this);
ui->labelUse10BitEncoding->installEventFilter(this);
ui->labelUse64BitAvs2YUV->installEventFilter(this); ui->labelUse64BitAvs2YUV->installEventFilter(this);
ui->labelShutdownComputer->installEventFilter(this); ui->labelShutdownComputer->installEventFilter(this);
ui->labelSaveLogFiles->installEventFilter(this); ui->labelSaveLogFiles->installEventFilter(this);
@ -82,7 +82,6 @@ PreferencesDialog::PreferencesDialog(QWidget *parent, PreferencesModel *preferen
ui->checkBoxDummy2->installEventFilter(this); ui->checkBoxDummy2->installEventFilter(this);
connect(ui->resetButton, SIGNAL(clicked()), this, SLOT(resetButtonPressed())); connect(ui->resetButton, SIGNAL(clicked()), this, SLOT(resetButtonPressed()));
connect(ui->checkUse10BitEncoding, SIGNAL(toggled(bool)), this, SLOT(use10BitEncodingToggled(bool)));
connect(ui->checkDisableWarnings, SIGNAL(toggled(bool)), this, SLOT(disableWarningsToggled(bool))); connect(ui->checkDisableWarnings, SIGNAL(toggled(bool)), this, SLOT(disableWarningsToggled(bool)));
m_preferences = preferences; m_preferences = preferences;
@ -99,19 +98,19 @@ void PreferencesDialog::showEvent(QShowEvent *event)
UPDATE_CHECKBOX(ui->checkRunNextJob, m_preferences->autoRunNextJob()); UPDATE_CHECKBOX(ui->checkRunNextJob, m_preferences->autoRunNextJob());
UPDATE_CHECKBOX(ui->checkShutdownComputer, m_preferences->shutdownComputer()); UPDATE_CHECKBOX(ui->checkShutdownComputer, m_preferences->shutdownComputer());
UPDATE_CHECKBOX(ui->checkUse64BitAvs2YUV, m_preferences->useAvisyth64Bit()); UPDATE_CHECKBOX(ui->checkUse64BitAvs2YUV, m_preferences->useAvisyth64Bit() && m_sysinfo->hasX64Support());
UPDATE_CHECKBOX(ui->checkSaveLogFiles, m_preferences->saveLogFiles()); UPDATE_CHECKBOX(ui->checkSaveLogFiles, m_preferences->saveLogFiles());
UPDATE_CHECKBOX(ui->checkSaveToSourceFolder, m_preferences->saveToSourcePath()); UPDATE_CHECKBOX(ui->checkSaveToSourceFolder, m_preferences->saveToSourcePath());
UPDATE_CHECKBOX(ui->checkEnableSounds, m_preferences->enableSounds()); UPDATE_CHECKBOX(ui->checkEnableSounds, m_preferences->enableSounds());
UPDATE_CHECKBOX(ui->checkNoUpdateReminder, m_preferences->noUpdateReminder()); UPDATE_CHECKBOX(ui->checkNoUpdateReminder, m_preferences->noUpdateReminder());
UPDATE_CHECKBOX(ui->checkDisableWarnings, m_preferences->disableWarnings(), true); UPDATE_CHECKBOX(ui->checkDisableWarnings, m_preferences->disableWarnings(), true);
ui->spinBoxJobCount->setValue(m_preferences->maxRunningJobCount()); ui->spinBoxJobCount->setValue(m_preferences->maxRunningJobCount());
UPDATE_COMBOBOX(ui->comboBoxPriority, qBound(-2, m_preferences->processPriority(), 1), 0); UPDATE_COMBOBOX(ui->comboBoxPriority, qBound(-2, m_preferences->processPriority(), 1), 0);
ui->checkUse64BitAvs2YUV->setEnabled(m_x64); ui->checkUse64BitAvs2YUV->setEnabled(m_sysinfo->hasX64Support());
ui->labelUse64BitAvs2YUV->setEnabled(m_x64); ui->labelUse64BitAvs2YUV->setEnabled(m_sysinfo->hasX64Support());
} }
bool PreferencesDialog::eventFilter(QObject *o, QEvent *e) bool PreferencesDialog::eventFilter(QObject *o, QEvent *e)
@ -125,7 +124,6 @@ bool PreferencesDialog::eventFilter(QObject *o, QEvent *e)
{ {
emulateMouseEvent(o, e, ui->labelRunNextJob, ui->checkRunNextJob); emulateMouseEvent(o, e, ui->labelRunNextJob, ui->checkRunNextJob);
emulateMouseEvent(o, e, ui->labelShutdownComputer, ui->checkShutdownComputer); emulateMouseEvent(o, e, ui->labelShutdownComputer, ui->checkShutdownComputer);
emulateMouseEvent(o, e, ui->labelUse10BitEncoding, ui->checkUse10BitEncoding);
emulateMouseEvent(o, e, ui->labelUse64BitAvs2YUV, ui->checkUse64BitAvs2YUV); emulateMouseEvent(o, e, ui->labelUse64BitAvs2YUV, ui->checkUse64BitAvs2YUV);
emulateMouseEvent(o, e, ui->labelSaveLogFiles, ui->checkSaveLogFiles); emulateMouseEvent(o, e, ui->labelSaveLogFiles, ui->checkSaveLogFiles);
emulateMouseEvent(o, e, ui->labelSaveToSourceFolder, ui->checkSaveToSourceFolder); emulateMouseEvent(o, e, ui->labelSaveToSourceFolder, ui->checkSaveToSourceFolder);
@ -176,21 +174,21 @@ void PreferencesDialog::resetButtonPressed(void)
showEvent(NULL); showEvent(NULL);
} }
void PreferencesDialog::use10BitEncodingToggled(bool checked) //void PreferencesDialog::use10BitEncodingToggled(bool checked)
{ //{
if(checked) // if(checked)
{ // {
QString text; // QString text;
text += QString("<nobr>%1</nobr><br>").arg(tr("Please note that 10&minus;Bit H.264 streams are <b>not</b> currently supported by hardware (standalone) players!")); // text += QString("<nobr>%1</nobr><br>").arg(tr("Please note that 10&minus;Bit H.264 streams are <b>not</b> currently supported by hardware (standalone) players!"));
text += QString("<nobr>%1</nobr><br>").arg(tr("To play such streams, you will need an <i>up&minus;to&minus;date</i> ffdshow&minus;tryouts, CoreAVC 3.x or another supported s/w decoder.")); // text += QString("<nobr>%1</nobr><br>").arg(tr("To play such streams, you will need an <i>up&minus;to&minus;date</i> ffdshow&minus;tryouts, CoreAVC 3.x or another supported s/w decoder."));
text += QString("<nobr>%1</nobr><br>").arg(tr("Also be aware that hardware&minus;acceleration (CUDA, DXVA, etc) usually will <b>not</b> work with 10&minus;Bit H.264 streams.")); // text += QString("<nobr>%1</nobr><br>").arg(tr("Also be aware that hardware&minus;acceleration (CUDA, DXVA, etc) usually will <b>not</b> work with 10&minus;Bit H.264 streams."));
//
if(QMessageBox::warning(this, tr("10-Bit Encoding"), text.replace("-", "&minus;"), tr("Continue"), tr("Revert"), QString(), 1) != 0) // if(QMessageBox::warning(this, tr("10-Bit Encoding"), text.replace("-", "&minus;"), tr("Continue"), tr("Revert"), QString(), 1) != 0)
{ // {
UPDATE_CHECKBOX(ui->checkUse10BitEncoding, false, true); // UPDATE_CHECKBOX(ui->checkUse10BitEncoding, false, true);
} // }
} // }
} //}
void PreferencesDialog::disableWarningsToggled(bool checked) void PreferencesDialog::disableWarningsToggled(bool checked)
{ {

View File

@ -24,6 +24,7 @@
#include <QDialog> #include <QDialog>
class PreferencesModel; class PreferencesModel;
class SysinfoModel;
namespace Ui namespace Ui
{ {
@ -35,11 +36,9 @@ class PreferencesDialog : public QDialog
Q_OBJECT Q_OBJECT
public: public:
PreferencesDialog(QWidget *parent, PreferencesModel *preferences, bool x64); PreferencesDialog(QWidget *parent, PreferencesModel *preferences, const SysinfoModel *sysinfo);
~PreferencesDialog(void); ~PreferencesDialog(void);
const bool m_x64;
protected: protected:
virtual void done(int n); virtual void done(int n);
virtual void showEvent(QShowEvent *event); virtual void showEvent(QShowEvent *event);
@ -49,10 +48,10 @@ protected:
private: private:
Ui::PreferencesDialog *const ui; Ui::PreferencesDialog *const ui;
const SysinfoModel *const m_sysinfo;
PreferencesModel *m_preferences; PreferencesModel *m_preferences;
private slots: private slots:
void resetButtonPressed(void); void resetButtonPressed(void);
void use10BitEncodingToggled(bool checked);
void disableWarningsToggled(bool checked); void disableWarningsToggled(bool checked);
}; };

View File

@ -23,6 +23,7 @@
#include "uic_win_updater.h" #include "uic_win_updater.h"
#include "global.h" #include "global.h"
#include "model_sysinfo.h"
#include "thread_updater.h" #include "thread_updater.h"
#include "checksum.h" #include "checksum.h"
@ -63,11 +64,11 @@ while(0)
// Constructor & Destructor // Constructor & Destructor
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
UpdaterDialog::UpdaterDialog(QWidget *parent, const QString &binDir) UpdaterDialog::UpdaterDialog(QWidget *parent, const SysinfoModel *sysinfo)
: :
QDialog(parent), QDialog(parent),
ui(new Ui::UpdaterDialog()), ui(new Ui::UpdaterDialog()),
m_binDir(binDir), m_sysinfo(sysinfo),
m_status(UpdateCheckThread::UpdateStatus_NotStartedYet), m_status(UpdateCheckThread::UpdateStatus_NotStartedYet),
m_thread(NULL), m_thread(NULL),
m_updaterProcess(NULL), m_updaterProcess(NULL),
@ -473,7 +474,7 @@ bool UpdaterDialog::checkBinaries(QString &wgetBin, QString &gpgvBin)
for(size_t i = 0; FILE_INFO[i].name; i++) for(size_t i = 0; FILE_INFO[i].name; i++)
{ {
const QString binPath = QString("%1/common/%2").arg(m_binDir, QString::fromLatin1(FILE_INFO[i].name)); const QString binPath = QString("%1/common/%2").arg(m_sysinfo->getAppPath(), QString::fromLatin1(FILE_INFO[i].name));
if(okay = okay && checkFileHash(binPath, FILE_INFO[i].hash)) if(okay = okay && checkFileHash(binPath, FILE_INFO[i].hash))
{ {
binaries.insert(FILE_INFO[i].name, binPath); binaries.insert(FILE_INFO[i].name, binPath);

View File

@ -25,6 +25,7 @@
class QMovie; class QMovie;
class UpdateCheckThread; class UpdateCheckThread;
class SysinfoModel;
namespace Ui namespace Ui
{ {
@ -36,7 +37,7 @@ class UpdaterDialog : public QDialog
Q_OBJECT Q_OBJECT
public: public:
UpdaterDialog(QWidget *parent, const QString &binDir); UpdaterDialog(QWidget *parent, const SysinfoModel *sysinfo);
~UpdaterDialog(void); ~UpdaterDialog(void);
static const int READY_TO_INSTALL_UPDATE = 42; static const int READY_TO_INSTALL_UPDATE = 42;
@ -65,9 +66,11 @@ private:
bool checkBinaries(QString &wgetBin, QString &gpgvBin); bool checkBinaries(QString &wgetBin, QString &gpgvBin);
bool checkFileHash(const QString &filePath, const char *expectedHash); bool checkFileHash(const QString &filePath, const char *expectedHash);
const SysinfoModel *const m_sysinfo;
bool m_firstShow; bool m_firstShow;
bool m_success; bool m_success;
const QString m_binDir;
QMovie *m_animator; QMovie *m_animator;
UpdateCheckThread *m_thread; UpdateCheckThread *m_thread;
unsigned long m_updaterProcess; unsigned long m_updaterProcess;

View File

@ -325,6 +325,7 @@ copy /Y "$(QTDIR)\plugins\imageformats\qgif4.dll" "$(TargetDir)\imageformats"
<ClInclude Include="src\model_preferences.h" /> <ClInclude Include="src\model_preferences.h" />
<ClInclude Include="src\model_recently.h" /> <ClInclude Include="src\model_recently.h" />
<ClInclude Include="src\model_status.h" /> <ClInclude Include="src\model_status.h" />
<ClInclude Include="src\model_sysinfo.h" />
<ClInclude Include="src\targetver.h" /> <ClInclude Include="src\targetver.h" />
<ClInclude Include="src\taskbar7.h" /> <ClInclude Include="src\taskbar7.h" />
<CustomBuild Include="src\thread_avisynth.h"> <CustomBuild Include="src\thread_avisynth.h">

View File

@ -78,6 +78,9 @@
<ClInclude Include="src\cli.h"> <ClInclude Include="src\cli.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="src\model_sysinfo.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="src\main.cpp"> <ClCompile Include="src\main.cpp">