Show progress and progress details in main window!

This commit is contained in:
Git User 2012-01-28 23:24:41 +01:00
parent 072242e14f
commit 8d1c6d82ee
22 changed files with 390 additions and 24 deletions

View File

@ -15,6 +15,26 @@
</property> </property>
<widget class="QWidget" name="centralwidget"> <widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QProgressBar" name="progressBar">
<property name="value">
<number>0</number>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QFrame" name="frame_2">
<property name="frameShape">
<enum>QFrame::HLine</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
</widget>
</item>
<item> <item>
<widget class="QSplitter" name="splitter"> <widget class="QSplitter" name="splitter">
<property name="orientation"> <property name="orientation">
@ -24,6 +44,9 @@
<bool>false</bool> <bool>false</bool>
</property> </property>
<widget class="QTableView" name="jobsView"> <widget class="QTableView" name="jobsView">
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="selectionMode"> <property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum> <enum>QAbstractItemView::SingleSelection</enum>
</property> </property>
@ -46,7 +69,36 @@
<bool>false</bool> <bool>false</bool>
</attribute> </attribute>
</widget> </widget>
<widget class="QListView" name="logView"/> <widget class="QListView" name="logView">
<property name="font">
<font>
<family>Lucida Console</family>
</font>
</property>
</widget>
</widget>
</item>
<item>
<widget class="QLineEdit" name="editDetails">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::HLine</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -81,6 +133,46 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item>
<widget class="QPushButton" name="buttonStartJob">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>104</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Start Job</string>
</property>
<property name="icon">
<iconset resource="../res/resources.qrc">
<normaloff>:/buttons/play_big.png</normaloff>:/buttons/play_big.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="buttonAbortJob">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>104</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Abort Job</string>
</property>
<property name="icon">
<iconset resource="../res/resources.qrc">
<normaloff>:/buttons/cancel.png</normaloff>:/buttons/cancel.png</iconset>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
</layout> </layout>
@ -100,7 +192,14 @@
</property> </property>
<addaction name="actionExit"/> <addaction name="actionExit"/>
</widget> </widget>
<widget class="QMenu" name="menu">
<property name="title">
<string>?</string>
</property>
<addaction name="actionAbout"/>
</widget>
<addaction name="menuFile"/> <addaction name="menuFile"/>
<addaction name="menu"/>
</widget> </widget>
<action name="actionExit"> <action name="actionExit">
<property name="icon"> <property name="icon">
@ -111,6 +210,15 @@
<string>Exit</string> <string>Exit</string>
</property> </property>
</action> </action>
<action name="actionAbout">
<property name="icon">
<iconset resource="../res/resources.qrc">
<normaloff>:/buttons/information.png</normaloff>:/buttons/information.png</iconset>
</property>
<property name="text">
<string>About</string>
</property>
</action>
</widget> </widget>
<resources> <resources>
<include location="../res/resources.qrc"/> <include location="../res/resources.qrc"/>

BIN
res/buttons/accept.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 781 B

BIN
res/buttons/add.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 733 B

BIN
res/buttons/cancel.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 587 B

BIN
res/buttons/clock_pause.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 927 B

BIN
res/buttons/clock_stop.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 922 B

BIN
res/buttons/door_in.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 693 B

BIN
res/buttons/error.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 666 B

BIN
res/buttons/exclamation.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 701 B

BIN
res/buttons/find.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 659 B

BIN
res/buttons/information.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 778 B

BIN
res/buttons/lightning.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 634 B

BIN
res/buttons/play.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 663 B

BIN
res/buttons/play_big.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@ -4,12 +4,16 @@
<file>icons/movie.ico</file> <file>icons/movie.ico</file>
<file>buttons/accept.png</file> <file>buttons/accept.png</file>
<file>buttons/add.png</file> <file>buttons/add.png</file>
<file>buttons/cancel.png</file>
<file>buttons/clock_pause.png</file> <file>buttons/clock_pause.png</file>
<file>buttons/clock_stop.png</file>
<file>buttons/door_in.png</file> <file>buttons/door_in.png</file>
<file>buttons/error.png</file> <file>buttons/error.png</file>
<file>buttons/exclamation.png</file> <file>buttons/exclamation.png</file>
<file>buttons/find.png</file> <file>buttons/find.png</file>
<file>buttons/information.png</file>
<file>buttons/lightning.png</file> <file>buttons/lightning.png</file>
<file>buttons/play.png</file> <file>buttons/play.png</file>
<file>buttons/play_big.png</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@ -20,6 +20,7 @@
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#include "model_jobList.h" #include "model_jobList.h"
#include "global.h"
#include "thread_encode.h" #include "thread_encode.h"
#include <QIcon> #include <QIcon>
@ -30,6 +31,11 @@ JobListModel::JobListModel(void)
JobListModel::~JobListModel(void) JobListModel::~JobListModel(void)
{ {
while(!m_jobs.isEmpty())
{
EncodeThread *thrd = m_threads.value(m_jobs.takeFirst(), NULL);
X264_DELETE(thrd);
}
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@ -38,7 +44,7 @@ JobListModel::~JobListModel(void)
int JobListModel::columnCount(const QModelIndex &parent) const int JobListModel::columnCount(const QModelIndex &parent) const
{ {
return 3; return 4;
} }
int JobListModel::rowCount(const QModelIndex &parent) const int JobListModel::rowCount(const QModelIndex &parent) const
@ -61,6 +67,9 @@ QVariant JobListModel::headerData(int section, Qt::Orientation orientation, int
case 2: case 2:
return QVariant::fromValue<QString>(tr("Progress")); return QVariant::fromValue<QString>(tr("Progress"));
break; break;
case 3:
return QVariant::fromValue<QString>(tr("Progress Details"));
break;
default: default:
return QVariant(); return QVariant();
break; break;
@ -112,6 +121,9 @@ QVariant JobListModel::data(const QModelIndex &index, int role) const
case EncodeThread::JobStatus_Failed: case EncodeThread::JobStatus_Failed:
return QVariant::fromValue<QString>(tr("Failed!")); return QVariant::fromValue<QString>(tr("Failed!"));
break; break;
case EncodeThread::JobStatus_Aborting:
return QVariant::fromValue<QString>(tr("Aborting..."));
break;
case EncodeThread::JobStatus_Aborted: case EncodeThread::JobStatus_Aborted:
return QVariant::fromValue<QString>(tr("Aborted!")); return QVariant::fromValue<QString>(tr("Aborted!"));
break; break;
@ -123,6 +135,9 @@ QVariant JobListModel::data(const QModelIndex &index, int role) const
case 2: case 2:
return QString().sprintf("%d%%", m_progress.value(m_jobs.at(index.row()))); return QString().sprintf("%d%%", m_progress.value(m_jobs.at(index.row())));
break; break;
case 3:
return m_details.value(m_jobs.at(index.row()));
break;
default: default:
return QVariant(); return QVariant();
break; break;
@ -153,6 +168,9 @@ QVariant JobListModel::data(const QModelIndex &index, int role) const
case EncodeThread::JobStatus_Failed: case EncodeThread::JobStatus_Failed:
return QIcon(":/buttons/exclamation.png"); return QIcon(":/buttons/exclamation.png");
break; break;
case EncodeThread::JobStatus_Aborting:
return QIcon(":/buttons/clock_stop.png");
break;
case EncodeThread::JobStatus_Aborted: case EncodeThread::JobStatus_Aborted:
return QIcon(":/buttons/error.png"); return QIcon(":/buttons/error.png");
break; break;
@ -170,14 +188,14 @@ QVariant JobListModel::data(const QModelIndex &index, int role) const
// Public interface // Public interface
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
bool JobListModel::insertJob(EncodeThread *thread) QModelIndex JobListModel::insertJob(EncodeThread *thread)
{ {
QUuid id = thread->getId(); QUuid id = thread->getId();
LogFileModel *logFile = NULL; LogFileModel *logFile = NULL;
if(m_jobs.contains(id)) if(m_jobs.contains(id))
{ {
return false; return QModelIndex();
} }
beginInsertRows(QModelIndex(), m_jobs.count(), m_jobs.count()); beginInsertRows(QModelIndex(), m_jobs.count(), m_jobs.count());
@ -186,13 +204,48 @@ bool JobListModel::insertJob(EncodeThread *thread)
m_progress.insert(id, 0); m_progress.insert(id, 0);
m_threads.insert(id, thread); m_threads.insert(id, thread);
m_logFile.insert(id, (logFile = new LogFileModel)); m_logFile.insert(id, (logFile = new LogFileModel));
m_details.insert(id, tr("Not started yet."));
endInsertRows(); endInsertRows();
connect(thread, SIGNAL(statusChanged(QUuid, EncodeThread::JobStatus)), this, SLOT(updateStatus(QUuid, EncodeThread::JobStatus)), Qt::QueuedConnection); connect(thread, SIGNAL(statusChanged(QUuid, EncodeThread::JobStatus)), this, SLOT(updateStatus(QUuid, EncodeThread::JobStatus)), Qt::QueuedConnection);
connect(thread, SIGNAL(progressChanged(QUuid, unsigned int)), this, SLOT(updateProgress(QUuid, unsigned int)), Qt::QueuedConnection); connect(thread, SIGNAL(progressChanged(QUuid, unsigned int)), this, SLOT(updateProgress(QUuid, unsigned int)), Qt::QueuedConnection);
connect(thread, SIGNAL(messageLogged(QUuid, QString)), logFile, SLOT(addLogMessage(QUuid, QString)), Qt::QueuedConnection); connect(thread, SIGNAL(messageLogged(QUuid, QString)), logFile, SLOT(addLogMessage(QUuid, QString)), Qt::QueuedConnection);
connect(thread, SIGNAL(detailsChanged(QUuid, QString)), this, SLOT(updateDetails(QUuid, QString)), Qt::QueuedConnection);
return createIndex(m_jobs.count() - 1, 0, NULL);
}
bool JobListModel::startJob(const QModelIndex &index)
{
if(index.isValid() && index.row() >= 0 && index.row() < m_jobs.count())
{
QUuid id = m_jobs.at(index.row());
if(m_status.value(id) == EncodeThread::JobStatus_Enqueued)
{
updateStatus(id, EncodeThread::JobStatus_Starting);
updateDetails(id, tr("Starting up, please wait..."));
m_threads.value(id)->start();
return true; return true;
}
}
return false;
}
bool JobListModel::abortJob(const QModelIndex &index)
{
if(index.isValid() && index.row() >= 0 && index.row() < m_jobs.count())
{
QUuid id = m_jobs.at(index.row());
if(m_status.value(id) == EncodeThread::JobStatus_Indexing || m_status.value(id) == EncodeThread::JobStatus_Running)
{
updateStatus(id, EncodeThread::JobStatus_Aborting);
m_threads.value(id)->abortJob();
return true;
}
}
return false;
} }
LogFileModel *JobListModel::getLogFile(const QModelIndex &index) LogFileModel *JobListModel::getLogFile(const QModelIndex &index)
@ -201,6 +254,38 @@ LogFileModel *JobListModel::getLogFile(const QModelIndex &index)
{ {
return m_logFile.value(m_jobs.at(index.row())); return m_logFile.value(m_jobs.at(index.row()));
} }
return NULL;
}
EncodeThread::JobStatus JobListModel::getJobStatus(const QModelIndex &index)
{
if(index.isValid() && index.row() >= 0 && index.row() < m_jobs.count())
{
return m_status.value(m_jobs.at(index.row()));
}
return static_cast<EncodeThread::JobStatus>(-1);
}
unsigned int JobListModel::getJobProgress(const QModelIndex &index)
{
if(index.isValid() && index.row() >= 0 && index.row() < m_jobs.count())
{
return m_progress.value(m_jobs.at(index.row()));
}
return 0;
}
QModelIndex JobListModel::getJobIndexById(const QUuid &id)
{
if(m_jobs.contains(id))
{
return createIndex(m_jobs.indexOf(id), 0);
}
return QModelIndex();
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@ -228,3 +313,14 @@ void JobListModel::updateProgress(const QUuid &jobId, unsigned int newProgress)
emit dataChanged(createIndex(index, 2), createIndex(index, 2)); emit dataChanged(createIndex(index, 2), createIndex(index, 2));
} }
} }
void JobListModel::updateDetails(const QUuid &jobId, const QString &details)
{
int index = -1;
if((index = m_jobs.indexOf(jobId)) >= 0)
{
m_details.insert(jobId, details);
emit dataChanged(createIndex(index, 3), createIndex(index, 3));
}
}

View File

@ -44,8 +44,13 @@ public:
virtual QModelIndex parent (const QModelIndex &index) const; virtual QModelIndex parent (const QModelIndex &index) const;
virtual QVariant data(const QModelIndex &index, int role) const; virtual QVariant data(const QModelIndex &index, int role) const;
bool JobListModel::insertJob(EncodeThread *thread); QModelIndex insertJob(EncodeThread *thread);
bool startJob(const QModelIndex &index);
bool abortJob(const QModelIndex &index);
LogFileModel *getLogFile(const QModelIndex &index); LogFileModel *getLogFile(const QModelIndex &index);
EncodeThread::JobStatus getJobStatus(const QModelIndex &index);
unsigned int getJobProgress(const QModelIndex &index);
QModelIndex getJobIndexById(const QUuid &id);
protected: protected:
QList<QUuid> m_jobs; QList<QUuid> m_jobs;
@ -53,8 +58,10 @@ protected:
QMap<QUuid, EncodeThread::JobStatus> m_status; QMap<QUuid, EncodeThread::JobStatus> m_status;
QMap<QUuid, unsigned int> m_progress; QMap<QUuid, unsigned int> m_progress;
QMap<QUuid, LogFileModel*> m_logFile; QMap<QUuid, LogFileModel*> m_logFile;
QMap<QUuid, QString> m_details;
public slots: public slots:
void updateStatus(const QUuid &jobId, EncodeThread::JobStatus newStatus); void updateStatus(const QUuid &jobId, EncodeThread::JobStatus newStatus);
void updateProgress(const QUuid &jobId, unsigned int newProgress); void updateProgress(const QUuid &jobId, unsigned int newProgress);
void updateDetails(const QUuid &jobId, const QString &details);
}; };

View File

@ -26,6 +26,7 @@ EncodeThread::EncodeThread(void)
: :
m_jobId(QUuid::createUuid()) m_jobId(QUuid::createUuid())
{ {
m_abort = false;
} }
EncodeThread::~EncodeThread(void) EncodeThread::~EncodeThread(void)
@ -60,8 +61,20 @@ void EncodeThread::encode(void)
{ {
emit progressChanged(m_jobId, i); emit progressChanged(m_jobId, i);
emit statusChanged(m_jobId, (i % 2) ? JobStatus_Indexing : JobStatus_Running); emit statusChanged(m_jobId, (i % 2) ? JobStatus_Indexing : JobStatus_Running);
Sleep(200);
emit messageLogged(m_jobId, QUuid::createUuid().toString()); emit messageLogged(m_jobId, QUuid::createUuid().toString());
for(int i = 0; i < 5; i++)
{
emit detailsChanged(m_jobId, QUuid::createUuid().toString());
Sleep(200);
}
if(m_abort)
{
Sleep(1500);
emit statusChanged(m_jobId, JobStatus_Aborted);
return;
}
} }
Sleep(1500); Sleep(1500);

View File

@ -37,16 +37,19 @@ public:
JobStatus_Running = 3, JobStatus_Running = 3,
JobStatus_Completed = 4, JobStatus_Completed = 4,
JobStatus_Failed = 5, JobStatus_Failed = 5,
JobStatus_Aborted = 6 JobStatus_Aborting = 6,
JobStatus_Aborted = 7
}; };
EncodeThread(void); EncodeThread(void);
~EncodeThread(void); ~EncodeThread(void);
QUuid getId(void) { return this->m_jobId; }; QUuid getId(void) { return this->m_jobId; };
void abortJob(void) { m_abort = true; }
protected: protected:
const QUuid m_jobId; const QUuid m_jobId;
volatile bool m_abort;
virtual void run(void); virtual void run(void);
void encode(void); void encode(void);
@ -55,5 +58,6 @@ signals:
void statusChanged(const QUuid &jobId, EncodeThread::JobStatus newStatus); void statusChanged(const QUuid &jobId, EncodeThread::JobStatus newStatus);
void progressChanged(const QUuid &jobId, unsigned int newProgress); void progressChanged(const QUuid &jobId, unsigned int newProgress);
void messageLogged(const QUuid &jobId, const QString &text); void messageLogged(const QUuid &jobId, const QString &text);
void detailsChanged(const QUuid &jobId, const QString &details);
}; };

View File

@ -26,6 +26,8 @@
#include <QDate> #include <QDate>
#include <QTimer> #include <QTimer>
#include <QCloseEvent>
#include <QMessageBox>
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// Constructor & Destructor // Constructor & Destructor
@ -49,9 +51,11 @@ MainWindow::MainWindow(void)
//Create model //Create model
m_jobList = new JobListModel(); m_jobList = new JobListModel();
connect(m_jobList, SIGNAL(dataChanged(QModelIndex, QModelIndex)), this, SLOT(jobChangedData(QModelIndex, QModelIndex)));
jobsView->setModel(m_jobList); jobsView->setModel(m_jobList);
//Setup view //Setup view
jobsView->horizontalHeader()->setSectionHidden(3, true);
jobsView->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch); jobsView->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);
jobsView->horizontalHeader()->setResizeMode(1, QHeaderView::Fixed); jobsView->horizontalHeader()->setResizeMode(1, QHeaderView::Fixed);
jobsView->horizontalHeader()->setResizeMode(2, QHeaderView::Fixed); jobsView->horizontalHeader()->setResizeMode(2, QHeaderView::Fixed);
@ -62,10 +66,16 @@ MainWindow::MainWindow(void)
//Enable buttons //Enable buttons
connect(buttonAddJob, SIGNAL(clicked()), this, SLOT(addButtonPressed())); connect(buttonAddJob, SIGNAL(clicked()), this, SLOT(addButtonPressed()));
connect(buttonStartJob, SIGNAL(clicked()), this, SLOT(startButtonPressed()));
connect(buttonAbortJob, SIGNAL(clicked()), this, SLOT(abortButtonPressed()));
//Enable menu
connect(actionAbout, SIGNAL(triggered()), this, SLOT(showAbout()));
} }
MainWindow::~MainWindow(void) MainWindow::~MainWindow(void)
{ {
X264_DELETE(m_jobList);
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@ -75,14 +85,126 @@ MainWindow::~MainWindow(void)
void MainWindow::addButtonPressed(void) void MainWindow::addButtonPressed(void)
{ {
EncodeThread *thrd = new EncodeThread(); EncodeThread *thrd = new EncodeThread();
m_jobList->insertJob(thrd); QModelIndex newIndex = m_jobList->insertJob(thrd);
jobsView->selectionModel()->setCurrentIndex(newIndex, QItemSelectionModel::ClearAndSelect);
QTimer::singleShot(2500, thrd, SLOT(start()));
} }
void MainWindow::startButtonPressed(void)
{
m_jobList->startJob(jobsView->currentIndex());
}
void MainWindow::abortButtonPressed(void)
{
m_jobList->abortJob(jobsView->currentIndex());
}
void MainWindow::jobSelected(const QModelIndex & current, const QModelIndex & previous) void MainWindow::jobSelected(const QModelIndex & current, const QModelIndex & previous)
{ {
qDebug("Job selected: %d", current.row()); qDebug("Job selected: %d", current.row());
if(logView->model())
{
disconnect(logView->model(), SIGNAL(rowsInserted(QModelIndex, int, int)), this, SLOT(jobLogExtended(QModelIndex, int, int)));
}
logView->setModel(m_jobList->getLogFile(current)); logView->setModel(m_jobList->getLogFile(current));
logView->scrollToBottom(); connect(logView->model(), SIGNAL(rowsInserted(QModelIndex, int, int)), this, SLOT(jobLogExtended(QModelIndex, int, int)));
QTimer::singleShot(0, logView, SLOT(scrollToBottom()));
progressBar->setValue(m_jobList->getJobProgress(current));
editDetails->setText(m_jobList->data(m_jobList->index(current.row(), 3, QModelIndex()), Qt::DisplayRole).toString());
updateButtons(m_jobList->getJobStatus(current));
}
void MainWindow::jobChangedData(const QModelIndex &topLeft, const QModelIndex &bottomRight)
{
int selected = jobsView->currentIndex().row();
if(topLeft.column() <= 1 && bottomRight.column() >= 1)
{
for(int i = topLeft.row(); i <= bottomRight.row(); i++)
{
if(i == selected)
{
qDebug("Current job changed status!");
updateButtons(m_jobList->getJobStatus(m_jobList->index(i, 0, QModelIndex())));
break;
}
}
}
else if(topLeft.column() <= 2 && bottomRight.column() >= 2)
{
for(int i = topLeft.row(); i <= bottomRight.row(); i++)
{
if(i == selected)
{
progressBar->setValue(m_jobList->getJobProgress(m_jobList->index(i, 0, QModelIndex())));
break;
}
}
}
else if(topLeft.column() <= 3 && bottomRight.column() >= 3)
{
for(int i = topLeft.row(); i <= bottomRight.row(); i++)
{
if(i == selected)
{
editDetails->setText(m_jobList->data(m_jobList->index(i, 3, QModelIndex()), Qt::DisplayRole).toString());
break;
}
}
}
}
void MainWindow::jobLogExtended(const QModelIndex & parent, int start, int end)
{
QTimer::singleShot(0, logView, SLOT(scrollToBottom()));
}
void MainWindow::showAbout(void)
{
QString text;
const char *url = "http://mulder.brhack.net/";
text += QString().sprintf("<nobr><tt>Simple x264 Launcher v%u.%02u &minus; use 64&minus;Bit x264 with 32&minus;Bit Avisynth<br>", x264_version_major(), x264_version_minor());
text += QString().sprintf("Copyright (c) 2004&minus;%04d LoRd_MuldeR &lt;mulder2@gmx.de&gt;. Some rights reserved.<br>", qMax(x264_version_date().year(),QDate::currentDate().year()));
text += QString().sprintf("Built on %s at %s with %s for Win&minus;%s.<br><br>", x264_version_date().toString(Qt::ISODate).toLatin1().constData(), x264_version_time(), x264_version_compiler(), x264_version_arch());
text += QString().sprintf("This program is free software: you can redistribute it and/or modify<br>");
text += QString().sprintf("it under the terms of the GNU General Public License &lt;http://www.gnu.org/&gt;.<br>");
text += QString().sprintf("Note that this program is distributed with ABSOLUTELY NO WARRANTY.<br><br>");
text += QString().sprintf("Please check the web&minus;site at <a href=\"%s\">%s</a> for updates !!!<br></tt></nobr>", url, url);
QMessageBox::information(this, tr("About..."), text);
}
///////////////////////////////////////////////////////////////////////////////
// Event functions
///////////////////////////////////////////////////////////////////////////////
void MainWindow::closeEvent(QCloseEvent *e)
{
const int rows = m_jobList->rowCount(QModelIndex());
for(int i = 0; i < rows; i++)
{
EncodeThread::JobStatus status = m_jobList->getJobStatus(m_jobList->index(i, 0, QModelIndex()));
if(status != EncodeThread::JobStatus_Completed && status != EncodeThread::JobStatus_Aborted && status != EncodeThread::JobStatus_Failed)
{
e->ignore();
MessageBeep(MB_ICONWARNING);
break;
}
}
}
///////////////////////////////////////////////////////////////////////////////
// Private functions
///////////////////////////////////////////////////////////////////////////////
void MainWindow::updateButtons(EncodeThread::JobStatus status)
{
qDebug("MainWindow::updateButtons(void)");
buttonStartJob->setEnabled(status == EncodeThread::JobStatus_Enqueued);
buttonAbortJob->setEnabled(status == EncodeThread::JobStatus_Indexing || status == EncodeThread::JobStatus_Running);
} }

View File

@ -22,6 +22,7 @@
#pragma once #pragma once
#include "uic_win_main.h" #include "uic_win_main.h"
#include "thread_encode.h"
class JobListModel; class JobListModel;
@ -33,10 +34,20 @@ public:
MainWindow(); MainWindow();
~MainWindow(void); ~MainWindow(void);
protected:
virtual void closeEvent(QCloseEvent *e);
private: private:
JobListModel *m_jobList; JobListModel *m_jobList;
void updateButtons(EncodeThread::JobStatus status);
private slots: private slots:
void addButtonPressed(void); void addButtonPressed(void);
void startButtonPressed(void);
void abortButtonPressed(void);
void jobSelected(const QModelIndex & current, const QModelIndex & previous); void jobSelected(const QModelIndex & current, const QModelIndex & previous);
void jobChangedData(const QModelIndex &top, const QModelIndex &bottom);
void jobLogExtended(const QModelIndex & parent, int start, int end);
void showAbout(void);
}; };

View File

@ -94,29 +94,30 @@
<CustomBuild Include="gui\win_main.ui"> <CustomBuild Include="gui\win_main.ui">
<FileType>Document</FileType> <FileType>Document</FileType>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\uic.exe" -o "$(SolutionDir)tmp\uic\uic_%(Filename).h" "%(FullPath)"</Command> <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\uic.exe" -o "$(SolutionDir)tmp\uic\uic_%(Filename).h" "%(FullPath)"</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">UIC "$(SolutionDir)tmp\UIC_%(Filename).h"</Message> <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">UIC "$(SolutionDir)tmp\uic\uic_%(Filename).h"</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)tmp\uic\uic_%(Filename).h;%(Outputs)</Outputs> <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)tmp\uic\uic_%(Filename).h;%(Outputs)</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\uic.exe" -o "$(SolutionDir)tmp\uic\uic_%(Filename).h" "%(FullPath)"</Command> <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\uic.exe" -o "$(SolutionDir)tmp\uic\uic_%(Filename).h" "%(FullPath)"</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">UIC "$(SolutionDir)tmp\UIC_%(Filename).h"</Message> <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">UIC "$(SolutionDir)tmp\uic\uic_%(Filename).h"</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\uic\uic_%(Filename).h;%(Outputs)</Outputs> <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\uic\uic_%(Filename).h;%(Outputs)</Outputs>
</CustomBuild> </CustomBuild>
<None Include="ReadMe.txt" /> <None Include="ReadMe.txt" />
<CustomBuild Include="res\resources.qrc"> <CustomBuild Include="res\resources.qrc">
<FileType>Document</FileType> <FileType>Document</FileType>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\qrc\qrc_%(Filename).cpp" -name "%(Filename)" "%(FullPath)"</Command> <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\qrc\qrc_%(Filename).cpp" -name "%(Filename)" "%(FullPath)"</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">RCC "$(SolutionDir)tmp\QRC_%(Filename).cpp"</Message> <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">RCC "$(SolutionDir)tmp\qrc\qrc_%(Filename).cpp"</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)tmp\qrc\qrc_%(Filename).cpp;%(Outputs)</Outputs> <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)tmp\qrc\qrc_%(Filename).cpp;%(Outputs)</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\qrc\qrc_%(Filename).cpp" -name "%(Filename)" "%(FullPath)"</Command> <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\qrc\qrc_%(Filename).cpp" -name "%(Filename)" "%(FullPath)"</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">RCC "$(SolutionDir)tmp\QRC_%(Filename).cpp"</Message> <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">RCC "$(SolutionDir)tmp\qrc\qrc_%(Filename).cpp"</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\qrc\qrc_%(Filename).cpp;%(Outputs)</Outputs> <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\qrc\qrc_%(Filename).cpp;%(Outputs)</Outputs>
<SubType>Designer</SubType>
</CustomBuild> </CustomBuild>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<CustomBuild Include="src\thread_encode.h"> <CustomBuild Include="src\thread_encode.h">
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\moc\moc_%(Filename).cpp" "%(FullPath)"</Command> <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\moc\moc_%(Filename).cpp" "%(FullPath)"</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\moc\moc_%(Filename).cpp" "%(FullPath)"</Command> <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\moc\moc_%(Filename).cpp" "%(FullPath)"</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">MOC "$(SolutionDir)tmp\MOC_%(Filename).cpp"</Message> <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">MOC "$(SolutionDir)tmp\moc\moc_%(Filename).cpp"</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MOC "$(SolutionDir)tmp\MOC_%(Filename).cpp"</Message> <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MOC "$(SolutionDir)tmp\moc\moc_%(Filename).cpp"</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)tmp\moc\moc_%(Filename).cpp;%(Outputs)</Outputs> <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)tmp\moc\moc_%(Filename).cpp;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\moc\moc_%(Filename).cpp;%(Outputs)</Outputs> <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\moc\moc_%(Filename).cpp;%(Outputs)</Outputs>
</CustomBuild> </CustomBuild>
@ -124,16 +125,16 @@
<CustomBuild Include="src\model_jobList.h"> <CustomBuild Include="src\model_jobList.h">
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\moc\moc_%(Filename).cpp" "%(FullPath)"</Command> <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\moc\moc_%(Filename).cpp" "%(FullPath)"</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\moc\moc_%(Filename).cpp" "%(FullPath)"</Command> <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\moc\moc_%(Filename).cpp" "%(FullPath)"</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">MOC "$(SolutionDir)tmp\MOC_%(Filename).cpp"</Message> <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">MOC "$(SolutionDir)tmp\moc\moc_%(Filename).cpp"</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MOC "$(SolutionDir)tmp\MOC_%(Filename).cpp"</Message> <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MOC "$(SolutionDir)tmp\moc\moc_%(Filename).cpp"</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)tmp\moc\moc_%(Filename).cpp;%(Outputs)</Outputs> <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)tmp\moc\moc_%(Filename).cpp;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\moc\moc_%(Filename).cpp;%(Outputs)</Outputs> <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\moc\moc_%(Filename).cpp;%(Outputs)</Outputs>
</CustomBuild> </CustomBuild>
<CustomBuild Include="src\model_logFile.h"> <CustomBuild Include="src\model_logFile.h">
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\moc\moc_%(Filename).cpp" "%(FullPath)"</Command> <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\moc\moc_%(Filename).cpp" "%(FullPath)"</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\moc\moc_%(Filename).cpp" "%(FullPath)"</Command> <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\moc\moc_%(Filename).cpp" "%(FullPath)"</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">MOC "$(SolutionDir)tmp\MOC_%(Filename).cpp"</Message> <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">MOC "$(SolutionDir)tmp\moc\moc_%(Filename).cpp"</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MOC "$(SolutionDir)tmp\MOC_%(Filename).cpp"</Message> <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MOC "$(SolutionDir)tmp\moc\moc_%(Filename).cpp"</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)tmp\moc\moc_%(Filename).cpp;%(Outputs)</Outputs> <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)tmp\moc\moc_%(Filename).cpp;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\moc\moc_%(Filename).cpp;%(Outputs)</Outputs> <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\moc\moc_%(Filename).cpp;%(Outputs)</Outputs>
</CustomBuild> </CustomBuild>
@ -141,10 +142,10 @@
<ClInclude Include="src\version.h" /> <ClInclude Include="src\version.h" />
<CustomBuild Include="src\win_main.h"> <CustomBuild Include="src\win_main.h">
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\moc\moc_%(Filename).cpp" "%(FullPath)"</Command> <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\moc\moc_%(Filename).cpp" "%(FullPath)"</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">MOC "$(SolutionDir)tmp\MOC_%(Filename).cpp"</Message> <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">MOC "$(SolutionDir)tmp\moc\moc_%(Filename).cpp"</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)tmp\moc\moc_%(Filename).cpp;%(Outputs)</Outputs> <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)tmp\moc\moc_%(Filename).cpp;%(Outputs)</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\moc\moc_%(Filename).cpp" "%(FullPath)"</Command> <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\moc\moc_%(Filename).cpp" "%(FullPath)"</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MOC "$(SolutionDir)tmp\MOC_%(Filename).cpp"</Message> <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MOC "$(SolutionDir)tmp\moc\moc_%(Filename).cpp"</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\moc\moc_%(Filename).cpp;%(Outputs)</Outputs> <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\moc\moc_%(Filename).cpp;%(Outputs)</Outputs>
</CustomBuild> </CustomBuild>
</ItemGroup> </ItemGroup>