Added a "restart" button and extended JobListModel API as required.
This commit is contained in:
parent
877c06712d
commit
10b495bfa5
@ -774,7 +774,7 @@
|
|||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>All command-line parameters you enter here will be passed to x264 unmodified and unchecked. Some parameters are forbidden, as they are reserved for the GUI.</string>
|
<string><nobr>All command&minus;line parameters you enter here will be passed to x264 unmodified and unchecked. Some parameters are forbidden, as they are reserved for the GUI.<br>The following macros can be used:<tt> $(INPUT)</tt> expands to the current source file path and<tt> $(OUTPUT)</tt> expands to the current output file path.</nobr></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Custom x264 Parameters:</string>
|
<string>Custom x264 Parameters:</string>
|
||||||
@ -954,7 +954,7 @@
|
|||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>All command-line parameters you enter here will be passed to x264 unmodified and unchecked. Some parameters are forbidden, as they are reserved for the GUI.</string>
|
<string><nobr>All command&minus;line parameters you enter here will be passed to x264 unmodified and unchecked. Some parameters are forbidden, as they are reserved for the GUI.<br>The following macros can be used:<tt> $(INPUT)</tt> expands to the current source file path and<tt> $(OUTPUT)</tt> expands to the current output file path.</nobr></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="placeholderText">
|
<property name="placeholderText">
|
||||||
<string>You can enter custom command-line options here...</string>
|
<string>You can enter custom command-line options here...</string>
|
||||||
@ -1007,6 +1007,9 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="iconNotificationAvs2YUV">
|
<widget class="QLabel" name="iconNotificationAvs2YUV">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Your custom parameters will be ignored entirely, if you don't fix them!</string>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
@ -1076,6 +1079,9 @@
|
|||||||
<bold>true</bold>
|
<bold>true</bold>
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Your custom parameters will be ignored entirely, if you don't fix them!</string>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Invalid parameter entered!</string>
|
<string>Invalid parameter entered!</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -364,8 +364,10 @@
|
|||||||
<addaction name="actionJob_Start"/>
|
<addaction name="actionJob_Start"/>
|
||||||
<addaction name="actionJob_Pause"/>
|
<addaction name="actionJob_Pause"/>
|
||||||
<addaction name="actionJob_Abort"/>
|
<addaction name="actionJob_Abort"/>
|
||||||
|
<addaction name="separator"/>
|
||||||
<addaction name="actionJob_Browse"/>
|
<addaction name="actionJob_Browse"/>
|
||||||
<addaction name="actionJob_Delete"/>
|
<addaction name="actionJob_Delete"/>
|
||||||
|
<addaction name="actionJob_Restart"/>
|
||||||
</widget>
|
</widget>
|
||||||
<addaction name="menuFile"/>
|
<addaction name="menuFile"/>
|
||||||
<addaction name="menuJob"/>
|
<addaction name="menuJob"/>
|
||||||
@ -449,7 +451,7 @@
|
|||||||
<normaloff>:/buttons/add.png</normaloff>:/buttons/add.png</iconset>
|
<normaloff>:/buttons/add.png</normaloff>:/buttons/add.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Add New Job</string>
|
<string>Create Job</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionJob_Start">
|
<action name="actionJob_Start">
|
||||||
@ -569,6 +571,18 @@
|
|||||||
<string>Avisynth Usage Wiki</string>
|
<string>Avisynth Usage Wiki</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionJob_Restart">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../res/resources.qrc">
|
||||||
|
<normaloff>:/buttons/restart.png</normaloff>:/buttons/restart.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Restart Job</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>buttonAddJob</tabstop>
|
<tabstop>buttonAddJob</tabstop>
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
<file>buttons/play_big.png</file>
|
<file>buttons/play_big.png</file>
|
||||||
<file>buttons/power_off.png</file>
|
<file>buttons/power_off.png</file>
|
||||||
<file>buttons/power_on.png</file>
|
<file>buttons/power_on.png</file>
|
||||||
|
<file>buttons/restart.png</file>
|
||||||
<file>buttons/setup.png</file>
|
<file>buttons/setup.png</file>
|
||||||
<file>buttons/suspended.png</file>
|
<file>buttons/suspended.png</file>
|
||||||
<file>buttons/trash.png</file>
|
<file>buttons/trash.png</file>
|
||||||
|
@ -400,6 +400,19 @@ LogFileModel *JobListModel::getLogFile(const QModelIndex &index)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QString &JobListModel::getJobSourceFile(const QModelIndex &index)
|
||||||
|
{
|
||||||
|
static QString nullStr;
|
||||||
|
|
||||||
|
if(index.isValid() && index.row() >= 0 && index.row() < m_jobs.count())
|
||||||
|
{
|
||||||
|
EncodeThread *thread = m_threads.value(m_jobs.at(index.row()));
|
||||||
|
return (thread != NULL) ? thread->sourceFileName() : nullStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullStr;
|
||||||
|
}
|
||||||
|
|
||||||
const QString &JobListModel::getJobOutputFile(const QModelIndex &index)
|
const QString &JobListModel::getJobOutputFile(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
static QString nullStr;
|
static QString nullStr;
|
||||||
@ -433,6 +446,19 @@ unsigned int JobListModel::getJobProgress(const QModelIndex &index)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const OptionsModel *JobListModel::getJobOptions(const QModelIndex &index)
|
||||||
|
{
|
||||||
|
static QString nullStr;
|
||||||
|
|
||||||
|
if(index.isValid() && index.row() >= 0 && index.row() < m_jobs.count())
|
||||||
|
{
|
||||||
|
EncodeThread *thread = m_threads.value(m_jobs.at(index.row()));
|
||||||
|
return (thread != NULL) ? thread->options() : NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
QModelIndex JobListModel::getJobIndexById(const QUuid &id)
|
QModelIndex JobListModel::getJobIndexById(const QUuid &id)
|
||||||
{
|
{
|
||||||
if(m_jobs.contains(id))
|
if(m_jobs.contains(id))
|
||||||
|
@ -51,9 +51,11 @@ public:
|
|||||||
bool abortJob(const QModelIndex &index);
|
bool abortJob(const QModelIndex &index);
|
||||||
bool deleteJob(const QModelIndex &index);
|
bool deleteJob(const QModelIndex &index);
|
||||||
LogFileModel *getLogFile(const QModelIndex &index);
|
LogFileModel *getLogFile(const QModelIndex &index);
|
||||||
|
const QString &getJobSourceFile(const QModelIndex &index);
|
||||||
const QString &getJobOutputFile(const QModelIndex &index);
|
const QString &getJobOutputFile(const QModelIndex &index);
|
||||||
EncodeThread::JobStatus getJobStatus(const QModelIndex &index);
|
EncodeThread::JobStatus getJobStatus(const QModelIndex &index);
|
||||||
unsigned int getJobProgress(const QModelIndex &index);
|
unsigned int getJobProgress(const QModelIndex &index);
|
||||||
|
const OptionsModel *getJobOptions(const QModelIndex &index);
|
||||||
QModelIndex getJobIndexById(const QUuid &id);
|
QModelIndex getJobIndexById(const QUuid &id);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#define VER_X264_MAJOR 2
|
#define VER_X264_MAJOR 2
|
||||||
#define VER_X264_MINOR 0
|
#define VER_X264_MINOR 0
|
||||||
#define VER_X264_PATCH 2
|
#define VER_X264_PATCH 2
|
||||||
#define VER_X264_BUILD 185
|
#define VER_X264_BUILD 196
|
||||||
|
|
||||||
#define VER_X264_MINIMUM_REV 2146
|
#define VER_X264_MINIMUM_REV 2146
|
||||||
#define VER_X264_CURRENT_API 120
|
#define VER_X264_CURRENT_API 120
|
||||||
|
@ -44,6 +44,7 @@ public:
|
|||||||
bool runImmediately(void) { return checkBoxRun->isChecked(); }
|
bool runImmediately(void) { return checkBoxRun->isChecked(); }
|
||||||
void setRunImmediately(bool run) { checkBoxRun->setChecked(run); }
|
void setRunImmediately(bool run) { checkBoxRun->setChecked(run); }
|
||||||
void setSourceFile(const QString &path) { editSource->setText(QDir::toNativeSeparators(path)); }
|
void setSourceFile(const QString &path) { editSource->setText(QDir::toNativeSeparators(path)); }
|
||||||
|
void setOutputFile(const QString &path) { editOutput->setText(QDir::toNativeSeparators(path)); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
OptionsModel *m_options;
|
OptionsModel *m_options;
|
||||||
|
@ -142,6 +142,7 @@ MainWindow::MainWindow(const x264_cpu_t *const cpuFeatures)
|
|||||||
connect(buttonAbortJob, SIGNAL(clicked()), this, SLOT(abortButtonPressed()));
|
connect(buttonAbortJob, SIGNAL(clicked()), this, SLOT(abortButtonPressed()));
|
||||||
connect(buttonPauseJob, SIGNAL(toggled(bool)), this, SLOT(pauseButtonPressed(bool)));
|
connect(buttonPauseJob, SIGNAL(toggled(bool)), this, SLOT(pauseButtonPressed(bool)));
|
||||||
connect(actionJob_Delete, SIGNAL(triggered()), this, SLOT(deleteButtonPressed()));
|
connect(actionJob_Delete, SIGNAL(triggered()), this, SLOT(deleteButtonPressed()));
|
||||||
|
connect(actionJob_Restart, SIGNAL(triggered()), this, SLOT(restartButtonPressed()));
|
||||||
connect(actionJob_Browse, SIGNAL(triggered()), this, SLOT(browseButtonPressed()));
|
connect(actionJob_Browse, SIGNAL(triggered()), this, SLOT(browseButtonPressed()));
|
||||||
|
|
||||||
//Enable menu
|
//Enable menu
|
||||||
@ -198,16 +199,28 @@ MainWindow::~MainWindow(void)
|
|||||||
/*
|
/*
|
||||||
* The "add" button was clicked
|
* The "add" button was clicked
|
||||||
*/
|
*/
|
||||||
void MainWindow::addButtonPressed(const QString &filePath, int fileNo, int fileTotal, bool *ok)
|
void MainWindow::addButtonPressed(const QString &filePathIn, const QString &filePathOut, const OptionsModel *options, int fileNo, int fileTotal, bool *ok)
|
||||||
{
|
{
|
||||||
qDebug("MainWindow::addButtonPressed");
|
qDebug("MainWindow::addButtonPressed");
|
||||||
|
|
||||||
if(ok) *ok = false;
|
if(ok) *ok = false;
|
||||||
|
|
||||||
AddJobDialog *addDialog = new AddJobDialog(this, m_options, m_cpuFeatures->x64);
|
OptionsModel *optionsTemp = m_options;
|
||||||
|
bool ownsOptions = false;
|
||||||
|
|
||||||
|
if(options)
|
||||||
|
{
|
||||||
|
optionsTemp = new OptionsModel(*options);
|
||||||
|
ownsOptions = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
AddJobDialog *addDialog = new AddJobDialog(this, optionsTemp, m_cpuFeatures->x64);
|
||||||
addDialog->setRunImmediately(countRunningJobs() < (m_preferences.autoRunNextJob ? m_preferences.maxRunningJobCount : 1));
|
addDialog->setRunImmediately(countRunningJobs() < (m_preferences.autoRunNextJob ? m_preferences.maxRunningJobCount : 1));
|
||||||
|
|
||||||
|
if(ownsOptions) addDialog->setWindowTitle(tr("Restart Job"));
|
||||||
if((fileNo >= 0) && (fileTotal > 1)) addDialog->setWindowTitle(addDialog->windowTitle().append(tr(" (File %1 of %2)").arg(QString::number(fileNo+1), QString::number(fileTotal))));
|
if((fileNo >= 0) && (fileTotal > 1)) addDialog->setWindowTitle(addDialog->windowTitle().append(tr(" (File %1 of %2)").arg(QString::number(fileNo+1), QString::number(fileTotal))));
|
||||||
if(!filePath.isEmpty()) addDialog->setSourceFile(filePath);
|
if(!filePathIn.isEmpty()) addDialog->setSourceFile(filePathIn);
|
||||||
|
if(!filePathOut.isEmpty()) addDialog->setOutputFile(filePathOut);
|
||||||
|
|
||||||
int result = addDialog->exec();
|
int result = addDialog->exec();
|
||||||
if(result == QDialog::Accepted)
|
if(result == QDialog::Accepted)
|
||||||
@ -216,7 +229,7 @@ void MainWindow::addButtonPressed(const QString &filePath, int fileNo, int fileT
|
|||||||
(
|
(
|
||||||
addDialog->sourceFile(),
|
addDialog->sourceFile(),
|
||||||
addDialog->outputFile(),
|
addDialog->outputFile(),
|
||||||
m_options,
|
optionsTemp,
|
||||||
QString("%1/toolset").arg(m_appDir),
|
QString("%1/toolset").arg(m_appDir),
|
||||||
m_cpuFeatures->x64,
|
m_cpuFeatures->x64,
|
||||||
m_cpuFeatures->x64 && m_preferences.useAvisyth64Bit
|
m_cpuFeatures->x64 && m_preferences.useAvisyth64Bit
|
||||||
@ -235,10 +248,16 @@ void MainWindow::addButtonPressed(const QString &filePath, int fileNo, int fileT
|
|||||||
|
|
||||||
if(ok) *ok = true;
|
if(ok) *ok = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
m_label->setVisible(m_jobList->rowCount(QModelIndex()) == 0);
|
m_label->setVisible(m_jobList->rowCount(QModelIndex()) == 0);
|
||||||
|
}
|
||||||
|
|
||||||
X264_DELETE(addDialog);
|
X264_DELETE(addDialog);
|
||||||
|
|
||||||
|
if(ownsOptions)
|
||||||
|
{
|
||||||
|
X264_DELETE(optionsTemp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -297,6 +316,23 @@ void MainWindow::pauseButtonPressed(bool checked)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The "restart" button was clicked
|
||||||
|
*/
|
||||||
|
void MainWindow::restartButtonPressed(void)
|
||||||
|
{
|
||||||
|
const QModelIndex index = jobsView->currentIndex();
|
||||||
|
|
||||||
|
const QString &source = m_jobList->getJobSourceFile(index);
|
||||||
|
const QString &output = m_jobList->getJobOutputFile(index);
|
||||||
|
const OptionsModel *options = m_jobList->getJobOptions(index);
|
||||||
|
|
||||||
|
if((options) && (!source.isEmpty()) && (!output.isEmpty()))
|
||||||
|
{
|
||||||
|
addButtonPressed(source, output, options);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Job item selected by user
|
* Job item selected by user
|
||||||
*/
|
*/
|
||||||
@ -738,7 +774,7 @@ void MainWindow::init(void)
|
|||||||
{
|
{
|
||||||
QString currentFile = files.takeFirst();
|
QString currentFile = files.takeFirst();
|
||||||
qDebug("Adding file: %s", currentFile.toUtf8().constData());
|
qDebug("Adding file: %s", currentFile.toUtf8().constData());
|
||||||
addButtonPressed(currentFile, n++, totalFiles, &ok);
|
addButtonPressed(currentFile, QString(), NULL, n++, totalFiles, &ok);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -782,7 +818,7 @@ void MainWindow::handleDroppedFiles(void)
|
|||||||
{
|
{
|
||||||
QString currentFile = droppedFiles.takeFirst();
|
QString currentFile = droppedFiles.takeFirst();
|
||||||
qDebug("Adding file: %s", currentFile.toUtf8().constData());
|
qDebug("Adding file: %s", currentFile.toUtf8().constData());
|
||||||
addButtonPressed(currentFile, n++, totalFiles, &ok);
|
addButtonPressed(currentFile, QString(), NULL, n++, totalFiles, &ok);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
qDebug("Leave from MainWindow::handleDroppedFiles!");
|
qDebug("Leave from MainWindow::handleDroppedFiles!");
|
||||||
@ -974,6 +1010,7 @@ void MainWindow::updateButtons(EncodeThread::JobStatus status)
|
|||||||
buttonPauseJob->setChecked(status == EncodeThread::JobStatus_Paused || status == EncodeThread::JobStatus_Pausing);
|
buttonPauseJob->setChecked(status == EncodeThread::JobStatus_Paused || status == EncodeThread::JobStatus_Pausing);
|
||||||
|
|
||||||
actionJob_Delete->setEnabled(status == EncodeThread::JobStatus_Completed || status == EncodeThread::JobStatus_Aborted || status == EncodeThread::JobStatus_Failed || status == EncodeThread::JobStatus_Enqueued);
|
actionJob_Delete->setEnabled(status == EncodeThread::JobStatus_Completed || status == EncodeThread::JobStatus_Aborted || status == EncodeThread::JobStatus_Failed || status == EncodeThread::JobStatus_Enqueued);
|
||||||
|
actionJob_Restart->setEnabled(status == EncodeThread::JobStatus_Completed || status == EncodeThread::JobStatus_Aborted || status == EncodeThread::JobStatus_Failed || status == EncodeThread::JobStatus_Enqueued);
|
||||||
actionJob_Browse->setEnabled(status == EncodeThread::JobStatus_Completed);
|
actionJob_Browse->setEnabled(status == EncodeThread::JobStatus_Completed);
|
||||||
|
|
||||||
actionJob_Start->setEnabled(buttonStartJob->isEnabled());
|
actionJob_Start->setEnabled(buttonStartJob->isEnabled());
|
||||||
|
@ -69,7 +69,7 @@ private:
|
|||||||
double detectAvisynthVersion(QLibrary *avsLib);
|
double detectAvisynthVersion(QLibrary *avsLib);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void addButtonPressed(const QString &filePath = QString(), int fileNo = -1, int fileTotal = 0, bool *ok = NULL);
|
void addButtonPressed(const QString &filePathIn = QString(), const QString &filePathOut = QString(), const OptionsModel *options = NULL, int fileNo = -1, int fileTotal = 0, bool *ok = NULL);
|
||||||
void abortButtonPressed(void);
|
void abortButtonPressed(void);
|
||||||
void browseButtonPressed(void);
|
void browseButtonPressed(void);
|
||||||
void deleteButtonPressed(void);
|
void deleteButtonPressed(void);
|
||||||
@ -81,6 +81,7 @@ private slots:
|
|||||||
void jobLogExtended(const QModelIndex & parent, int start, int end);
|
void jobLogExtended(const QModelIndex & parent, int start, int end);
|
||||||
void launchNextJob();
|
void launchNextJob();
|
||||||
void pauseButtonPressed(bool checked);
|
void pauseButtonPressed(bool checked);
|
||||||
|
void restartButtonPressed(void);
|
||||||
void showAbout(void);
|
void showAbout(void);
|
||||||
void showPreferences(void);
|
void showPreferences(void);
|
||||||
void showWebLink(void);
|
void showWebLink(void);
|
||||||
|
Loading…
Reference in New Issue
Block a user