Added menu entries for removing all "complete" jobs ((includes failed/aborted jobs) and for removing all "enqueued" jobs.

This commit is contained in:
LoRd_MuldeR 2015-12-20 13:59:42 +01:00
parent fd6486e009
commit 4c93c52b79
6 changed files with 100 additions and 13 deletions

View File

@ -319,9 +319,23 @@
</property>
<widget class="QMenu" name="menuFile">
<property name="title">
<string>File</string>
<string>Application</string>
</property>
<widget class="QMenu" name="menuRemove_Jobs">
<property name="title">
<string>Clean-Up</string>
</property>
<property name="icon">
<iconset resource="../res/resources.qrc">
<normaloff>:/buttons/clean.png</normaloff>:/buttons/clean.png</iconset>
</property>
<addaction name="actionCleanup_Finished"/>
<addaction name="actionCleanup_Enqueued"/>
</widget>
<addaction name="actionOpen"/>
<addaction name="actionCreateJob"/>
<addaction name="separator"/>
<addaction name="menuRemove_Jobs"/>
<addaction name="separator"/>
<addaction name="actionPreferences"/>
<addaction name="separator"/>
@ -395,8 +409,6 @@
<property name="title">
<string>Job</string>
</property>
<addaction name="actionJob_New"/>
<addaction name="separator"/>
<addaction name="actionJob_Start"/>
<addaction name="actionJob_Pause"/>
<addaction name="actionJob_Abort"/>
@ -484,13 +496,13 @@
<string>BluRay Authoring Guide</string>
</property>
</action>
<action name="actionJob_New">
<action name="actionCreateJob">
<property name="icon">
<iconset resource="../res/resources.qrc">
<normaloff>:/buttons/add.png</normaloff>:/buttons/add.png</iconset>
</property>
<property name="text">
<string>Create Job</string>
<string>Create New Job</string>
</property>
</action>
<action name="actionJob_Start">
@ -778,6 +790,29 @@
<string>x265 Online Documentation</string>
</property>
</action>
<action name="actionRemove_Jobs">
<property name="text">
<string>Remove Jobs</string>
</property>
</action>
<action name="actionCleanup_Finished">
<property name="icon">
<iconset resource="../res/resources.qrc">
<normaloff>:/buttons/trash.png</normaloff>:/buttons/trash.png</iconset>
</property>
<property name="text">
<string>Remove Completed/Failed Jobs</string>
</property>
</action>
<action name="actionCleanup_Enqueued">
<property name="icon">
<iconset resource="../res/resources.qrc">
<normaloff>:/buttons/trash.png</normaloff>:/buttons/trash.png</iconset>
</property>
<property name="text">
<string>Remove Enqued Jobs</string>
</property>
</action>
</widget>
<tabstops>
<tabstop>buttonAddJob</tabstop>
@ -808,7 +843,7 @@
</hints>
</connection>
<connection>
<sender>actionJob_New</sender>
<sender>actionCreateJob</sender>
<signal>triggered()</signal>
<receiver>buttonAddJob</receiver>
<slot>click()</slot>

BIN
res/buttons/clean.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 784 B

View File

@ -9,6 +9,7 @@
<file>buttons/bomb.png</file>
<file>buttons/book_open.png</file>
<file>buttons/cancel.png</file>
<file>buttons/clean.png</file>
<file>buttons/clock.png</file>
<file>buttons/clock_pause.png</file>
<file>buttons/clock_play.png</file>

View File

@ -25,8 +25,8 @@
#define VER_X264_MAJOR 2
#define VER_X264_MINOR 6
#define VER_X264_PATCH 4
#define VER_X264_BUILD 1000
#define VER_X264_PATCH 5
#define VER_X264_BUILD 1002
#define VER_X264_PORTABLE_EDITION (0)

View File

@ -215,9 +215,13 @@ MainWindow::MainWindow(const MUtils::CPUFetaures::cpu_info_t &cpuFeatures, MUtil
//Enable menu
connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(openActionTriggered()));
connect(ui->actionCleanup_Finished, SIGNAL(triggered()), this, SLOT(cleanupActionTriggered()));
connect(ui->actionCleanup_Enqueued, SIGNAL(triggered()), this, SLOT(cleanupActionTriggered()));
connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(showAbout()));
connect(ui->actionPreferences, SIGNAL(triggered()), this, SLOT(showPreferences()));
connect(ui->actionCheckForUpdates, SIGNAL(triggered()), this, SLOT(checkUpdates()));
ui->actionCleanup_Finished->setData(QVariant(bool(0)));
ui->actionCleanup_Enqueued->setData(QVariant(bool(1)));
//Setup web-links
SETUP_WEBLINK(ui->actionWebMulder, home_url);
@ -342,6 +346,7 @@ void MainWindow::addButtonPressed()
void MainWindow::openActionTriggered()
{
ENSURE_APP_IS_READY();
qWarning("openActionTriggered()");
QStringList fileList = QFileDialog::getOpenFileNames(this, tr("Open Source File(s)"), m_recentlyUsed->sourceDirectory(), AddJobDialog::getInputFilterLst(), NULL, QFileDialog::DontUseNativeDialog);
if(!fileList.empty())
@ -363,6 +368,51 @@ void MainWindow::openActionTriggered()
}
}
/*
* The "clean-up" action was invoked
*/
void MainWindow::cleanupActionTriggered(void)
{
ENSURE_APP_IS_READY();
QAction *const sender = dynamic_cast<QAction*>(QObject::sender());
if (sender)
{
const QVariant data = sender->data();
if (data.isValid() && (data.type() == QVariant::Bool))
{
const bool mode = data.toBool();
const int rows = m_jobList->rowCount(QModelIndex());
QList<int> jobIndices;
for (int i = 0; i < rows; i++)
{
const JobStatus status = m_jobList->getJobStatus(m_jobList->index(i, 0, QModelIndex()));
if (mode && (status == JobStatus_Enqueued))
{
jobIndices.append(i);
}
else if ((!mode) && ((status == JobStatus_Completed) || (status == JobStatus_Aborted) || (status == JobStatus_Failed)))
{
jobIndices.append(i);
}
}
if (!jobIndices.isEmpty())
{
QListIterator<int> iter(jobIndices);
iter.toBack();
while(iter.hasPrevious())
{
m_jobList->deleteJob(m_jobList->index(iter.previous(), 0, QModelIndex()));
}
}
else
{
MUtils::Sound::beep(MUtils::Sound::BEEP_WRN);
}
}
}
}
/*
* The "start" button was clicked
*/

View File

@ -112,6 +112,7 @@ private:
private slots:
void addButtonPressed();
void openActionTriggered();
void cleanupActionTriggered(void);
void abortButtonPressed(void);
void browseButtonPressed(void);
void deleteButtonPressed(void);