Select the 64-Bit encoder by default on 64-Bit systems.

This commit is contained in:
LoRd_MuldeR 2014-02-15 00:40:15 +01:00
parent fce6ac31ff
commit 2bafd5f5f6
5 changed files with 16 additions and 13 deletions

View File

@ -22,6 +22,7 @@
#include "model_options.h" #include "model_options.h"
#include "global.h" #include "global.h"
#include "model_sysinfo.h"
#include <QDesktopServices> #include <QDesktopServices>
#include <QSettings> #include <QSettings>
@ -32,10 +33,10 @@
#define COMPARE_STR(OTHER, NAME) ((this->NAME).compare((model->NAME), Qt::CaseInsensitive) == 0) #define COMPARE_STR(OTHER, NAME) ((this->NAME).compare((model->NAME), Qt::CaseInsensitive) == 0)
#define ASSIGN_FROM(OTHER, NAME) ((this->NAME) = (OTHER.NAME)) #define ASSIGN_FROM(OTHER, NAME) ((this->NAME) = (OTHER.NAME))
OptionsModel::OptionsModel(void) OptionsModel::OptionsModel(const SysinfoModel *sysinfo)
{ {
m_encoderType = EncType_X264; m_encoderType = EncType_X264;
m_encoderArch = EncArch_x32; m_encoderArch = sysinfo->hasX64Support() ? EncArch_x64 : EncArch_x32;
m_encoderVariant = EncVariant_LoBit; m_encoderVariant = EncVariant_LoBit;
m_rcMode = RCMode_CRF; m_rcMode = RCMode_CRF;
m_bitrate = 1200; m_bitrate = 1200;
@ -189,7 +190,7 @@ bool OptionsModel::loadTemplate(OptionsModel *model, const QString &name)
return complete; return complete;
} }
QMap<QString, OptionsModel*> OptionsModel::loadAllTemplates(void) QMap<QString, OptionsModel*> OptionsModel::loadAllTemplates(const SysinfoModel *sysinfo)
{ {
QMap<QString, OptionsModel*> list; QMap<QString, OptionsModel*> list;
const QString appDir = x264_data_path(); const QString appDir = x264_data_path();
@ -201,7 +202,7 @@ QMap<QString, OptionsModel*> OptionsModel::loadAllTemplates(void)
QString name = allTemplates.takeFirst(); QString name = allTemplates.takeFirst();
if(!(name.contains('<') || name.contains('>') || name.contains('\\') || name.contains('/'))) if(!(name.contains('<') || name.contains('>') || name.contains('\\') || name.contains('/')))
{ {
OptionsModel *options = new OptionsModel(); OptionsModel *options = new OptionsModel(sysinfo);
if(loadTemplate(options, name)) if(loadTemplate(options, name))
{ {
list.insert(name, options); list.insert(name, options);

View File

@ -25,10 +25,12 @@
#include <QString> #include <QString>
#include <QMap> #include <QMap>
class SysinfoModel;
class OptionsModel class OptionsModel
{ {
public: public:
OptionsModel(void); OptionsModel(const SysinfoModel *sysinfo);
OptionsModel(const OptionsModel &rhs); OptionsModel(const OptionsModel &rhs);
~OptionsModel(void); ~OptionsModel(void);
@ -91,7 +93,7 @@ public:
static QString rcMode2String(RCMode mode); static QString rcMode2String(RCMode mode);
static bool saveTemplate(OptionsModel *model, const QString &name); static bool saveTemplate(OptionsModel *model, const QString &name);
static bool loadTemplate(OptionsModel *model, const QString &name); static bool loadTemplate(OptionsModel *model, const QString &name);
static QMap<QString, OptionsModel*> loadAllTemplates(void); static QMap<QString, OptionsModel*> loadAllTemplates(const SysinfoModel *sysinfo);
static bool templateExists(const QString &name); static bool templateExists(const QString &name);
static bool deleteTemplate(const QString &name); static bool deleteTemplate(const QString &name);

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 771 #define VER_X264_BUILD 772
#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

@ -229,7 +229,7 @@ AddJobDialog::AddJobDialog(QWidget *parent, OptionsModel *const options, Recentl
m_recentlyUsed(recentlyUsed), m_recentlyUsed(recentlyUsed),
m_sysinfo(sysinfo), m_sysinfo(sysinfo),
m_preferences(preferences), m_preferences(preferences),
m_defaults(new OptionsModel()), m_defaults(new OptionsModel(sysinfo)),
ui(new Ui::AddJobDialog()) ui(new Ui::AddJobDialog())
{ {
//Init the dialog, from the .ui file //Init the dialog, from the .ui file
@ -356,7 +356,7 @@ bool AddJobDialog::eventFilter(QObject *o, QEvent *e)
{ {
if((o == ui->labelHelpScreenX264) && (e->type() == QEvent::MouseButtonPress)) if((o == ui->labelHelpScreenX264) && (e->type() == QEvent::MouseButtonPress))
{ {
OptionsModel options; saveOptions(&options); OptionsModel options(m_sysinfo); saveOptions(&options);
HelpDialog *helpScreen = new HelpDialog(this, false, m_sysinfo, &options, m_preferences); HelpDialog *helpScreen = new HelpDialog(this, false, m_sysinfo, &options, m_preferences);
helpScreen->exec(); helpScreen->exec();
X264_DELETE(helpScreen); X264_DELETE(helpScreen);
@ -612,7 +612,7 @@ void AddJobDialog::saveTemplateButtonClicked(void)
name = tr("New Template (%1)").arg(QString::number(n++)); name = tr("New Template (%1)").arg(QString::number(n++));
} }
OptionsModel *options = new OptionsModel(); OptionsModel *options = new OptionsModel(m_sysinfo);
saveOptions(options); saveOptions(options);
if(options->equals(m_defaults)) if(options->equals(m_defaults))
@ -832,7 +832,7 @@ void AddJobDialog::loadTemplateList(void)
ui->cbxTemplate->addItem(tr("<Default>"), QVariant::fromValue<const void*>(m_defaults)); ui->cbxTemplate->addItem(tr("<Default>"), QVariant::fromValue<const void*>(m_defaults));
ui->cbxTemplate->setCurrentIndex(0); ui->cbxTemplate->setCurrentIndex(0);
QMap<QString, OptionsModel*> templates = OptionsModel::loadAllTemplates(); QMap<QString, OptionsModel*> templates = OptionsModel::loadAllTemplates(m_sysinfo);
QStringList templateNames = templates.keys(); QStringList templateNames = templates.keys();
templateNames.sort(); templateNames.sort();

View File

@ -111,7 +111,7 @@ MainWindow::MainWindow(const x264_cpu_t *const cpuFeatures, IPC *ipc)
RecentlyUsed::loadRecentlyUsed(m_recentlyUsed); RecentlyUsed::loadRecentlyUsed(m_recentlyUsed);
//Create options object //Create options object
m_options = new OptionsModel(); m_options = new OptionsModel(m_sysinfo);
OptionsModel::loadTemplate(m_options, QString::fromLatin1(tpl_last)); OptionsModel::loadTemplate(m_options, QString::fromLatin1(tpl_last));
//Freeze minimum size //Freeze minimum size
@ -1060,7 +1060,7 @@ void MainWindow::handleCommand(const int &command, const QStringList &args, cons
{ {
if(QFileInfo(args[0]).exists() && QFileInfo(args[0]).isFile()) if(QFileInfo(args[0]).exists() && QFileInfo(args[0]).isFile())
{ {
OptionsModel options; OptionsModel options(m_sysinfo);
bool runImmediately = (countRunningJobs() < (m_preferences->getAutoRunNextJob() ? m_preferences->getMaxRunningJobCount() : 1)); bool runImmediately = (countRunningJobs() < (m_preferences->getAutoRunNextJob() ? m_preferences->getMaxRunningJobCount() : 1));
if(!(args[2].isEmpty() || X264_STRCMP(args[2], "-"))) if(!(args[2].isEmpty() || X264_STRCMP(args[2], "-")))
{ {