Use the proper binary for help screen (32- vs. 64-Bit) + added "maximum job cont" option to preferences.

This commit is contained in:
LoRd_MuldeR 2012-02-03 12:31:51 +01:00
parent b28307c997
commit 9f2a6951a4
8 changed files with 122 additions and 14 deletions

View File

@ -9,8 +9,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>393</width>
<height>134</height>
<width>375</width>
<height>171</height>
</rect>
</property>
<property name="windowTitle">
@ -34,14 +34,49 @@
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="QCheckBox" name="checkRunNextJob">
<item row="1" column="1" colspan="2">
<widget class="QLabel" name="labelJobCount">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Automatically launch next job when a running job completes</string>
<string>Maximum number of running jobs:</string>
</property>
</widget>
</item>
<item row="0" column="0">
<item row="1" column="3">
<widget class="QSpinBox" name="spinBoxJobCount">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>16</number>
</property>
</widget>
</item>
<item row="0" column="5" rowspan="2">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>1024</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0" rowspan="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -57,6 +92,26 @@
</property>
</spacer>
</item>
<item row="1" column="4">
<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="0" column="1" colspan="4">
<widget class="QCheckBox" name="checkRunNextJob">
<property name="text">
<string>Automatically launch next job when a running job completes</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
@ -98,6 +153,11 @@
</item>
</layout>
</widget>
<tabstops>
<tabstop>closeButton</tabstop>
<tabstop>checkRunNextJob</tabstop>
<tabstop>spinBoxJobCount</tabstop>
</tabstops>
<resources>
<include location="../res/resources.qrc"/>
</resources>
@ -118,5 +178,37 @@
</hint>
</hints>
</connection>
<connection>
<sender>checkRunNextJob</sender>
<signal>clicked(bool)</signal>
<receiver>spinBoxJobCount</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>188</x>
<y>55</y>
</hint>
<hint type="destinationlabel">
<x>294</x>
<y>93</y>
</hint>
</hints>
</connection>
<connection>
<sender>checkRunNextJob</sender>
<signal>clicked(bool)</signal>
<receiver>labelJobCount</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>188</x>
<y>55</y>
</hint>
<hint type="destinationlabel">
<x>136</x>
<y>93</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -126,11 +126,12 @@ protected:
// Constructor & Destructor
///////////////////////////////////////////////////////////////////////////////
AddJobDialog::AddJobDialog(QWidget *parent, OptionsModel *options)
AddJobDialog::AddJobDialog(QWidget *parent, OptionsModel *options, bool x64supported)
:
QDialog(parent),
m_defaults(new OptionsModel()),
m_options(options),
m_x64supported(x64supported),
initialDir_src(QDesktopServices::storageLocation(QDesktopServices::MoviesLocation)),
initialDir_out(QDesktopServices::storageLocation(QDesktopServices::MoviesLocation))
@ -223,7 +224,7 @@ bool AddJobDialog::eventFilter(QObject *o, QEvent *e)
{
if((o == labelHelpScreen) && (e->type() == QEvent::MouseButtonPress))
{
HelpDialog *helpScreen = new HelpDialog(this);
HelpDialog *helpScreen = new HelpDialog(this, m_x64supported);
helpScreen->exec();
X264_DELETE(helpScreen);
}

View File

@ -32,7 +32,7 @@ class AddJobDialog : public QDialog, private Ui::AddJobDialog
Q_OBJECT
public:
AddJobDialog(QWidget *parent, OptionsModel *options);
AddJobDialog(QWidget *parent, OptionsModel *options, bool x64supported);
~AddJobDialog(void);
QString sourceFile(void);
@ -49,6 +49,8 @@ protected:
OptionsModel *m_options;
OptionsModel *m_defaults;
const bool m_x64supported;
QString initialDir_src;
QString initialDir_out;

View File

@ -30,10 +30,11 @@
// Constructor & Destructor
///////////////////////////////////////////////////////////////////////////////
HelpDialog::HelpDialog(QWidget *parent)
HelpDialog::HelpDialog(QWidget *parent, bool x64supported)
:
QDialog(parent),
m_appDir(QApplication::applicationDirPath()),
m_x64supported(x64supported),
m_process(new QProcess())
{
//Init the dialog, from the .ui file
@ -66,7 +67,7 @@ void HelpDialog::showEvent(QShowEvent *event)
QDialog::showEvent(event);
m_startAgain = true;
m_process->start(QString("%1/toolset/x264.exe").arg(m_appDir), QStringList() << "--version");
m_process->start(QString("%1/toolset/%2.exe").arg(m_appDir, m_x64supported ? "x264_x64" : "x264"), QStringList() << "--version");
if(!m_process->waitForStarted())
{

View File

@ -30,7 +30,7 @@ class HelpDialog : public QDialog, private Ui::HelpDialog
Q_OBJECT
public:
HelpDialog(QWidget *parent);
HelpDialog(QWidget *parent, bool x64supported);
~HelpDialog(void);
private slots:
@ -44,6 +44,8 @@ private:
bool m_startAgain;
protected:
const bool m_x64supported;
virtual void showEvent(QShowEvent *event);
virtual void closeEvent(QCloseEvent *e);
};

View File

@ -153,7 +153,7 @@ void MainWindow::addButtonPressed(const QString &filePath, bool *ok)
{
if(ok) *ok = false;
AddJobDialog *addDialog = new AddJobDialog(this, m_options);
AddJobDialog *addDialog = new AddJobDialog(this, m_options, m_x64supported);
addDialog->setRunImmediately(!havePendingJobs());
if(!filePath.isEmpty()) addDialog->setSourceFile(filePath);
int result = addDialog->exec();

View File

@ -46,12 +46,19 @@ PreferencesDialog::~PreferencesDialog(void)
void PreferencesDialog::showEvent(QShowEvent *event)
{
checkRunNextJob->setChecked(m_preferences->autoRunNextJob);
while(checkRunNextJob->isChecked() != m_preferences->autoRunNextJob)
{
checkRunNextJob->click();
}
spinBoxJobCount->setValue(m_preferences->maxRunningJobCount);
}
void PreferencesDialog::accept(void)
{
m_preferences->autoRunNextJob = checkRunNextJob->isChecked();
m_preferences->maxRunningJobCount = spinBoxJobCount->value();
savePreferences(m_preferences);
QDialog::accept();
}
@ -63,6 +70,7 @@ void PreferencesDialog::loadPreferences(Preferences *preferences)
settings.beginGroup("preferences");
preferences->autoRunNextJob = settings.value("auto_run_next_job", QVariant(true)).toBool();
preferences->maxRunningJobCount = settings.value("max_running_job_count", QVariant(1U)).toUInt();
}
void PreferencesDialog::savePreferences(Preferences *preferences)
@ -72,6 +80,7 @@ void PreferencesDialog::savePreferences(Preferences *preferences)
settings.beginGroup("preferences");
settings.setValue("auto_run_next_job", preferences->autoRunNextJob);
settings.setValue("max_running_job_count", preferences->maxRunningJobCount);
settings.sync();
}

View File

@ -31,6 +31,7 @@ public:
typedef struct
{
bool autoRunNextJob;
unsigned int maxRunningJobCount;
}
Preferences;