Added option to delete jobs from the list + also added option to browse the output file.
This commit is contained in:
parent
0d22776128
commit
6121903aa0
@ -951,12 +951,16 @@
|
|||||||
<tabstop>buttonBrowseSource</tabstop>
|
<tabstop>buttonBrowseSource</tabstop>
|
||||||
<tabstop>editOutput</tabstop>
|
<tabstop>editOutput</tabstop>
|
||||||
<tabstop>buttonBrowseOutput</tabstop>
|
<tabstop>buttonBrowseOutput</tabstop>
|
||||||
|
<tabstop>cbxTemplate</tabstop>
|
||||||
|
<tabstop>buttonSaveTemplate</tabstop>
|
||||||
|
<tabstop>buttonDeleteTemplate</tabstop>
|
||||||
<tabstop>cbxRateControlMode</tabstop>
|
<tabstop>cbxRateControlMode</tabstop>
|
||||||
<tabstop>spinQuantizer</tabstop>
|
<tabstop>spinQuantizer</tabstop>
|
||||||
<tabstop>spinBitrate</tabstop>
|
<tabstop>spinBitrate</tabstop>
|
||||||
<tabstop>cbxPreset</tabstop>
|
<tabstop>cbxPreset</tabstop>
|
||||||
<tabstop>cbxTuning</tabstop>
|
<tabstop>cbxTuning</tabstop>
|
||||||
<tabstop>cbxProfile</tabstop>
|
<tabstop>cbxProfile</tabstop>
|
||||||
|
<tabstop>editCustomParams</tabstop>
|
||||||
<tabstop>checkBoxRun</tabstop>
|
<tabstop>checkBoxRun</tabstop>
|
||||||
<tabstop>buttonAccept</tabstop>
|
<tabstop>buttonAccept</tabstop>
|
||||||
<tabstop>buttonCancel</tabstop>
|
<tabstop>buttonCancel</tabstop>
|
||||||
@ -972,8 +976,8 @@
|
|||||||
<slot>accept()</slot>
|
<slot>accept()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>587</x>
|
<x>495</x>
|
||||||
<y>406</y>
|
<y>558</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>397</x>
|
<x>397</x>
|
||||||
@ -988,8 +992,8 @@
|
|||||||
<slot>reject()</slot>
|
<slot>reject()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>721</x>
|
<x>629</x>
|
||||||
<y>406</y>
|
<y>558</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>397</x>
|
<x>397</x>
|
||||||
|
@ -30,6 +30,9 @@
|
|||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QTableView" name="jobsView">
|
<widget class="QTableView" name="jobsView">
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::StrongFocus</enum>
|
||||||
|
</property>
|
||||||
<property name="contextMenuPolicy">
|
<property name="contextMenuPolicy">
|
||||||
<enum>Qt::ActionsContextMenu</enum>
|
<enum>Qt::ActionsContextMenu</enum>
|
||||||
</property>
|
</property>
|
||||||
@ -345,6 +348,8 @@
|
|||||||
<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="actionJob_Browse"/>
|
||||||
|
<addaction name="actionJob_Delete"/>
|
||||||
</widget>
|
</widget>
|
||||||
<addaction name="menuFile"/>
|
<addaction name="menuFile"/>
|
||||||
<addaction name="menuJob"/>
|
<addaction name="menuJob"/>
|
||||||
@ -482,6 +487,30 @@
|
|||||||
<string>Preferences</string>
|
<string>Preferences</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionJob_Delete">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../res/resources.qrc">
|
||||||
|
<normaloff>:/buttons/trash.png</normaloff>:/buttons/trash.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Delete Job</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionJob_Browse">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../res/resources.qrc">
|
||||||
|
<normaloff>:/buttons/folder_magnify.png</normaloff>:/buttons/folder_magnify.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Explore Job</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>buttonAddJob</tabstop>
|
<tabstop>buttonAddJob</tabstop>
|
||||||
|
BIN
res/buttons/folder_magnify.png
Normal file
BIN
res/buttons/folder_magnify.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 686 B |
BIN
res/buttons/trash.png
Normal file
BIN
res/buttons/trash.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 882 B |
@ -16,6 +16,7 @@
|
|||||||
<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/folder_magnify.png</file>
|
||||||
<file>buttons/hourglass.png</file>
|
<file>buttons/hourglass.png</file>
|
||||||
<file>buttons/information.png</file>
|
<file>buttons/information.png</file>
|
||||||
<file>buttons/lightning.png</file>
|
<file>buttons/lightning.png</file>
|
||||||
@ -24,6 +25,7 @@
|
|||||||
<file>buttons/play.png</file>
|
<file>buttons/play.png</file>
|
||||||
<file>buttons/play_big.png</file>
|
<file>buttons/play_big.png</file>
|
||||||
<file>buttons/suspended.png</file>
|
<file>buttons/suspended.png</file>
|
||||||
|
<file>buttons/trash.png</file>
|
||||||
<file>buttons/world_link.png</file>
|
<file>buttons/world_link.png</file>
|
||||||
<file>buttons/wrench.png</file>
|
<file>buttons/wrench.png</file>
|
||||||
<file>images/x264.png</file>
|
<file>images/x264.png</file>
|
||||||
|
@ -264,7 +264,7 @@ void x264_message_handler(QtMsgType type, const char *msg)
|
|||||||
*/
|
*/
|
||||||
void x264_init_console(int argc, char* argv[])
|
void x264_init_console(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
bool enableConsole = true; //x264_version_demo();
|
bool enableConsole = x264_is_prerelease();
|
||||||
|
|
||||||
if(_environ)
|
if(_environ)
|
||||||
{
|
{
|
||||||
@ -407,6 +407,11 @@ const char *x264_version_time(void)
|
|||||||
return g_x264_version.ver_time;
|
return g_x264_version.ver_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool x264_is_prerelease(void)
|
||||||
|
{
|
||||||
|
return (VER_x264_PRE_RELEASE);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Detect CPU features
|
* Detect CPU features
|
||||||
*/
|
*/
|
||||||
|
@ -95,6 +95,7 @@ void x264_message_handler(QtMsgType type, const char *msg);
|
|||||||
unsigned int x264_version_major(void);
|
unsigned int x264_version_major(void);
|
||||||
unsigned int x264_version_minor(void);
|
unsigned int x264_version_minor(void);
|
||||||
const QDate &x264_version_date(void);
|
const QDate &x264_version_date(void);
|
||||||
|
bool x264_is_prerelease(void);
|
||||||
const char *x264_version_time(void);
|
const char *x264_version_time(void);
|
||||||
const char *x264_version_compiler(void);
|
const char *x264_version_compiler(void);
|
||||||
const char *x264_version_arch(void);
|
const char *x264_version_arch(void);
|
||||||
|
@ -337,6 +337,40 @@ bool JobListModel::abortJob(const QModelIndex &index)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool JobListModel::deleteJob(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_Completed || m_status.value(id) == EncodeThread::JobStatus_Failed ||
|
||||||
|
m_status.value(id) == EncodeThread::JobStatus_Aborted || m_status.value(id) == EncodeThread::JobStatus_Enqueued)
|
||||||
|
{
|
||||||
|
int idx = index.row();
|
||||||
|
QUuid id = m_jobs.at(idx);
|
||||||
|
EncodeThread *thread = m_threads.value(id, NULL);
|
||||||
|
LogFileModel *logFile = m_logFile.value(id, NULL);
|
||||||
|
if((thread == NULL) || (!thread->isRunning()))
|
||||||
|
{
|
||||||
|
|
||||||
|
beginRemoveRows(QModelIndex(), idx, idx);
|
||||||
|
m_jobs.removeAt(index.row());
|
||||||
|
m_name.remove(id);
|
||||||
|
m_threads.remove(id);
|
||||||
|
m_status.remove(id);
|
||||||
|
m_progress.remove(id);
|
||||||
|
m_logFile.remove(id);
|
||||||
|
m_details.remove(id);
|
||||||
|
endRemoveRows();
|
||||||
|
X264_DELETE(thread);
|
||||||
|
X264_DELETE(logFile);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
LogFileModel *JobListModel::getLogFile(const QModelIndex &index)
|
LogFileModel *JobListModel::getLogFile(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
if(index.isValid() && index.row() >= 0 && index.row() < m_jobs.count())
|
if(index.isValid() && index.row() >= 0 && index.row() < m_jobs.count())
|
||||||
@ -347,6 +381,19 @@ LogFileModel *JobListModel::getLogFile(const QModelIndex &index)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QString &JobListModel::getJobOutputFile(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->outputFileName() : nullStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullStr;
|
||||||
|
}
|
||||||
|
|
||||||
EncodeThread::JobStatus JobListModel::getJobStatus(const QModelIndex &index)
|
EncodeThread::JobStatus JobListModel::getJobStatus(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
if(index.isValid() && index.row() >= 0 && index.row() < m_jobs.count())
|
if(index.isValid() && index.row() >= 0 && index.row() < m_jobs.count())
|
||||||
|
@ -49,7 +49,9 @@ public:
|
|||||||
bool pauseJob(const QModelIndex &index);
|
bool pauseJob(const QModelIndex &index);
|
||||||
bool resumeJob(const QModelIndex &index);
|
bool resumeJob(const QModelIndex &index);
|
||||||
bool abortJob(const QModelIndex &index);
|
bool abortJob(const QModelIndex &index);
|
||||||
|
bool deleteJob(const QModelIndex &index);
|
||||||
LogFileModel *getLogFile(const QModelIndex &index);
|
LogFileModel *getLogFile(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);
|
||||||
QModelIndex getJobIndexById(const QUuid &id);
|
QModelIndex getJobIndexById(const QUuid &id);
|
||||||
|
@ -32,14 +32,6 @@
|
|||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
#include <QLibrary>
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Win32 API definitions
|
|
||||||
*/
|
|
||||||
typedef HANDLE (WINAPI *CreateJobObjectFun)(__in_opt LPSECURITY_ATTRIBUTES lpJobAttributes, __in_opt LPCSTR lpName);
|
|
||||||
typedef BOOL (WINAPI *SetInformationJobObjectFun)(__in HANDLE hJob, __in JOBOBJECTINFOCLASS JobObjectInformationClass, __in_bcount(cbJobObjectInformationLength) LPVOID lpJobObjectInformation, __in DWORD cbJobObjectInformationLength);
|
|
||||||
typedef BOOL (WINAPI *AssignProcessToJobObjectFun)(__in HANDLE hJob, __in HANDLE hProcess);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Static vars
|
* Static vars
|
||||||
@ -116,7 +108,7 @@ void EncodeThread::run(void)
|
|||||||
|
|
||||||
if(m_handle_jobObject)
|
if(m_handle_jobObject)
|
||||||
{
|
{
|
||||||
CloseHandle(m_handle_jobObject);
|
TerminateJobObject(m_handle_jobObject, 42);
|
||||||
m_handle_jobObject = NULL;
|
m_handle_jobObject = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -898,25 +890,13 @@ void EncodeThread::setDetails(const QString &text)
|
|||||||
|
|
||||||
bool EncodeThread::startProcess(QProcess &process, const QString &program, const QStringList &args, bool mergeChannels)
|
bool EncodeThread::startProcess(QProcess &process, const QString &program, const QStringList &args, bool mergeChannels)
|
||||||
{
|
{
|
||||||
static AssignProcessToJobObjectFun AssignProcessToJobObjectPtr = NULL;
|
|
||||||
static CreateJobObjectFun CreateJobObjectPtr = NULL;
|
|
||||||
static SetInformationJobObjectFun SetInformationJobObjectPtr = NULL;
|
|
||||||
|
|
||||||
QMutexLocker lock(&m_mutex_startProcess);
|
QMutexLocker lock(&m_mutex_startProcess);
|
||||||
log(commandline2string(program, args) + "\n");
|
log(commandline2string(program, args) + "\n");
|
||||||
|
|
||||||
//Create a new job object, if not done yet
|
//Create a new job object, if not done yet
|
||||||
if(!m_handle_jobObject)
|
if(!m_handle_jobObject)
|
||||||
{
|
{
|
||||||
if(!CreateJobObjectPtr || !SetInformationJobObjectPtr)
|
m_handle_jobObject = CreateJobObject(NULL, NULL);
|
||||||
{
|
|
||||||
QLibrary Kernel32Lib("kernel32.dll");
|
|
||||||
CreateJobObjectPtr = (CreateJobObjectFun) Kernel32Lib.resolve("CreateJobObjectA");
|
|
||||||
SetInformationJobObjectPtr = (SetInformationJobObjectFun) Kernel32Lib.resolve("SetInformationJobObject");
|
|
||||||
}
|
|
||||||
if(CreateJobObjectPtr && SetInformationJobObjectPtr)
|
|
||||||
{
|
|
||||||
m_handle_jobObject = CreateJobObjectPtr(NULL, NULL);
|
|
||||||
if(m_handle_jobObject == INVALID_HANDLE_VALUE)
|
if(m_handle_jobObject == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
m_handle_jobObject = NULL;
|
m_handle_jobObject = NULL;
|
||||||
@ -926,17 +906,9 @@ bool EncodeThread::startProcess(QProcess &process, const QString &program, const
|
|||||||
JOBOBJECT_EXTENDED_LIMIT_INFORMATION jobExtendedLimitInfo;
|
JOBOBJECT_EXTENDED_LIMIT_INFORMATION jobExtendedLimitInfo;
|
||||||
memset(&jobExtendedLimitInfo, 0, sizeof(JOBOBJECT_EXTENDED_LIMIT_INFORMATION));
|
memset(&jobExtendedLimitInfo, 0, sizeof(JOBOBJECT_EXTENDED_LIMIT_INFORMATION));
|
||||||
jobExtendedLimitInfo.BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE | JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION;
|
jobExtendedLimitInfo.BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE | JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION;
|
||||||
SetInformationJobObjectPtr(m_handle_jobObject, JobObjectExtendedLimitInformation, &jobExtendedLimitInfo, sizeof(JOBOBJECT_EXTENDED_LIMIT_INFORMATION));
|
SetInformationJobObject(m_handle_jobObject, JobObjectExtendedLimitInformation, &jobExtendedLimitInfo, sizeof(JOBOBJECT_EXTENDED_LIMIT_INFORMATION));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//Initialize AssignProcessToJobObject function
|
|
||||||
if(!AssignProcessToJobObjectPtr)
|
|
||||||
{
|
|
||||||
QLibrary Kernel32Lib("kernel32.dll");
|
|
||||||
AssignProcessToJobObjectPtr = (AssignProcessToJobObjectFun) Kernel32Lib.resolve("AssignProcessToJobObject");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(mergeChannels)
|
if(mergeChannels)
|
||||||
{
|
{
|
||||||
@ -953,14 +925,15 @@ bool EncodeThread::startProcess(QProcess &process, const QString &program, const
|
|||||||
|
|
||||||
if(process.waitForStarted())
|
if(process.waitForStarted())
|
||||||
{
|
{
|
||||||
if(AssignProcessToJobObjectPtr)
|
Q_PID pid = process.pid();
|
||||||
|
AssignProcessToJobObject(m_handle_jobObject, process.pid()->hProcess);
|
||||||
|
if(pid != NULL)
|
||||||
{
|
{
|
||||||
AssignProcessToJobObjectPtr(m_handle_jobObject, process.pid()->hProcess);
|
|
||||||
}
|
|
||||||
if(!SetPriorityClass(process.pid()->hProcess, BELOW_NORMAL_PRIORITY_CLASS))
|
if(!SetPriorityClass(process.pid()->hProcess, BELOW_NORMAL_PRIORITY_CLASS))
|
||||||
{
|
{
|
||||||
SetPriorityClass(process.pid()->hProcess, IDLE_PRIORITY_CLASS);
|
SetPriorityClass(process.pid()->hProcess, IDLE_PRIORITY_CLASS);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
return true;
|
return true;
|
||||||
|
@ -49,7 +49,8 @@ public:
|
|||||||
JobStatus_Paused = 9,
|
JobStatus_Paused = 9,
|
||||||
JobStatus_Resuming = 10,
|
JobStatus_Resuming = 10,
|
||||||
JobStatus_Aborting = 11,
|
JobStatus_Aborting = 11,
|
||||||
JobStatus_Aborted = 12
|
JobStatus_Aborted = 12,
|
||||||
|
JobStatus_Undefined = 666
|
||||||
};
|
};
|
||||||
|
|
||||||
EncodeThread(const QString &sourceFileName, const QString &outputFileName, const OptionsModel *options, const QString &binDir, bool x64);
|
EncodeThread(const QString &sourceFileName, const QString &outputFileName, const OptionsModel *options, const QString &binDir, bool x64);
|
||||||
|
@ -25,3 +25,5 @@
|
|||||||
#define VER_X264_MINIMUM_REV (2146)
|
#define VER_X264_MINIMUM_REV (2146)
|
||||||
#define VER_X264_CURRENT_API (120)
|
#define VER_X264_CURRENT_API (120)
|
||||||
#define VER_x264_AVS2YUV_VER (242)
|
#define VER_x264_AVS2YUV_VER (242)
|
||||||
|
|
||||||
|
#define VER_x264_PRE_RELEASE (0)
|
||||||
|
@ -212,6 +212,7 @@ void AddJobDialog::showEvent(QShowEvent *event)
|
|||||||
if(!editSource->text().isEmpty())
|
if(!editSource->text().isEmpty())
|
||||||
{
|
{
|
||||||
generateOutputFileName(QDir::fromNativeSeparators(editSource->text()));
|
generateOutputFileName(QDir::fromNativeSeparators(editSource->text()));
|
||||||
|
buttonAccept->setFocus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,11 +34,12 @@
|
|||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QLibrary>
|
#include <QLibrary>
|
||||||
|
#include <QProcess>
|
||||||
|
|
||||||
|
//#include <Shellapi.h>
|
||||||
|
|
||||||
const char *home_url = "http://mulder.brhack.net/";
|
const char *home_url = "http://mulder.brhack.net/";
|
||||||
|
|
||||||
#define PRE_RELEASE (0)
|
|
||||||
|
|
||||||
#define SET_FONT_BOLD(WIDGET,BOLD) { QFont _font = WIDGET->font(); _font.setBold(BOLD); WIDGET->setFont(_font); }
|
#define SET_FONT_BOLD(WIDGET,BOLD) { QFont _font = WIDGET->font(); _font.setBold(BOLD); WIDGET->setFont(_font); }
|
||||||
#define SET_TEXT_COLOR(WIDGET,COLOR) { QPalette _palette = WIDGET->palette(); _palette.setColor(QPalette::WindowText, (COLOR)); _palette.setColor(QPalette::Text, (COLOR)); WIDGET->setPalette(_palette); }
|
#define SET_TEXT_COLOR(WIDGET,COLOR) { QPalette _palette = WIDGET->palette(); _palette.setColor(QPalette::WindowText, (COLOR)); _palette.setColor(QPalette::Text, (COLOR)); WIDGET->setPalette(_palette); }
|
||||||
|
|
||||||
@ -68,7 +69,7 @@ MainWindow::MainWindow(bool x64supported)
|
|||||||
labelBuildDate->setText(tr("Built on %1 at %2").arg(x264_version_date().toString(Qt::ISODate), QString::fromLatin1(x264_version_time())));
|
labelBuildDate->setText(tr("Built on %1 at %2").arg(x264_version_date().toString(Qt::ISODate), QString::fromLatin1(x264_version_time())));
|
||||||
labelBuildDate->installEventFilter(this);
|
labelBuildDate->installEventFilter(this);
|
||||||
setWindowTitle(QString("%1 (%2 Mode)").arg(windowTitle(), m_x64supported ? "64-Bit" : "32-Bit"));
|
setWindowTitle(QString("%1 (%2 Mode)").arg(windowTitle(), m_x64supported ? "64-Bit" : "32-Bit"));
|
||||||
if(PRE_RELEASE) setWindowTitle(QString("%1 | PRE-RELEASE VERSION").arg(windowTitle()));
|
if(x264_is_prerelease()) setWindowTitle(QString("%1 | PRE-RELEASE VERSION").arg(windowTitle()));
|
||||||
|
|
||||||
|
|
||||||
//Create model
|
//Create model
|
||||||
@ -88,6 +89,7 @@ MainWindow::MainWindow(bool x64supported)
|
|||||||
|
|
||||||
//Create context menu
|
//Create context menu
|
||||||
QAction *actionClipboard = new QAction(QIcon(":/buttons/page_paste.png"), tr("Copy to Clipboard"), logView);
|
QAction *actionClipboard = new QAction(QIcon(":/buttons/page_paste.png"), tr("Copy to Clipboard"), logView);
|
||||||
|
actionClipboard->setEnabled(false);
|
||||||
logView->addAction(actionClipboard);
|
logView->addAction(actionClipboard);
|
||||||
connect(actionClipboard, SIGNAL(triggered(bool)), this, SLOT(copyLogToClipboard(bool)));
|
connect(actionClipboard, SIGNAL(triggered(bool)), this, SLOT(copyLogToClipboard(bool)));
|
||||||
jobsView->addActions(menuJob->actions());
|
jobsView->addActions(menuJob->actions());
|
||||||
@ -97,6 +99,8 @@ MainWindow::MainWindow(bool x64supported)
|
|||||||
connect(buttonStartJob, SIGNAL(clicked()), this, SLOT(startButtonPressed()));
|
connect(buttonStartJob, SIGNAL(clicked()), this, SLOT(startButtonPressed()));
|
||||||
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_Browse, SIGNAL(triggered()), this, SLOT(browseButtonPressed()));
|
||||||
|
|
||||||
//Enable menu
|
//Enable menu
|
||||||
connect(actionAbout, SIGNAL(triggered()), this, SLOT(showAbout()));
|
connect(actionAbout, SIGNAL(triggered()), this, SLOT(showAbout()));
|
||||||
@ -172,11 +176,11 @@ void MainWindow::addButtonPressed(const QString &filePath, bool *ok)
|
|||||||
m_jobList->startJob(newIndex);
|
m_jobList->startJob(newIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_label->setVisible(false);
|
|
||||||
if(ok) *ok = true;
|
if(ok) *ok = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_label->setVisible(m_jobList->rowCount(QModelIndex()) == 0);
|
||||||
X264_DELETE(addDialog);
|
X264_DELETE(addDialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,6 +194,25 @@ void MainWindow::abortButtonPressed(void)
|
|||||||
m_jobList->abortJob(jobsView->currentIndex());
|
m_jobList->abortJob(jobsView->currentIndex());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::deleteButtonPressed(void)
|
||||||
|
{
|
||||||
|
m_jobList->deleteJob(jobsView->currentIndex());
|
||||||
|
m_label->setVisible(m_jobList->rowCount(QModelIndex()) == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::browseButtonPressed(void)
|
||||||
|
{
|
||||||
|
QString outputFile = m_jobList->getJobOutputFile(jobsView->currentIndex());
|
||||||
|
if((!outputFile.isEmpty()) && QFileInfo(outputFile).exists() && QFileInfo(outputFile).isFile())
|
||||||
|
{
|
||||||
|
QProcess::startDetached(QString::fromLatin1("explorer.exe"), QStringList() << QString::fromLatin1("/select,") << QDir::toNativeSeparators(outputFile), QFileInfo(outputFile).path());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QMessageBox::warning(this, tr("Not Found"), tr("Sorry, the output file could not be found!"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::pauseButtonPressed(bool checked)
|
void MainWindow::pauseButtonPressed(bool checked)
|
||||||
{
|
{
|
||||||
if(checked)
|
if(checked)
|
||||||
@ -211,13 +234,25 @@ void MainWindow::jobSelected(const QModelIndex & current, const QModelIndex & pr
|
|||||||
disconnect(logView->model(), SIGNAL(rowsInserted(QModelIndex, int, int)), this, SLOT(jobLogExtended(QModelIndex, int, int)));
|
disconnect(logView->model(), SIGNAL(rowsInserted(QModelIndex, int, int)), this, SLOT(jobLogExtended(QModelIndex, int, int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(current.isValid())
|
||||||
|
{
|
||||||
logView->setModel(m_jobList->getLogFile(current));
|
logView->setModel(m_jobList->getLogFile(current));
|
||||||
connect(logView->model(), SIGNAL(rowsInserted(QModelIndex, int, int)), this, SLOT(jobLogExtended(QModelIndex, int, int)));
|
connect(logView->model(), SIGNAL(rowsInserted(QModelIndex, int, int)), this, SLOT(jobLogExtended(QModelIndex, int, int)));
|
||||||
|
logView->actions().first()->setEnabled(true);
|
||||||
QTimer::singleShot(0, logView, SLOT(scrollToBottom()));
|
QTimer::singleShot(0, logView, SLOT(scrollToBottom()));
|
||||||
|
|
||||||
progressBar->setValue(m_jobList->getJobProgress(current));
|
progressBar->setValue(m_jobList->getJobProgress(current));
|
||||||
editDetails->setText(m_jobList->data(m_jobList->index(current.row(), 3, QModelIndex()), Qt::DisplayRole).toString());
|
editDetails->setText(m_jobList->data(m_jobList->index(current.row(), 3, QModelIndex()), Qt::DisplayRole).toString());
|
||||||
updateButtons(m_jobList->getJobStatus(current));
|
updateButtons(m_jobList->getJobStatus(current));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
logView->setModel(NULL);
|
||||||
|
logView->actions().first()->setEnabled(false);
|
||||||
|
progressBar->setValue(0);
|
||||||
|
editDetails->clear();
|
||||||
|
updateButtons(EncodeThread::JobStatus_Undefined);
|
||||||
|
}
|
||||||
|
|
||||||
progressBar->repaint();
|
progressBar->repaint();
|
||||||
}
|
}
|
||||||
@ -292,10 +327,10 @@ void MainWindow::showAbout(void)
|
|||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
QString text2;
|
QString text2;
|
||||||
text2 += tr("<nobr><tt>x264, the best H.264/AVC encoder. Copyright (c) 2003-2011 x264 project.<br>");
|
text2 += tr("<nobr><tt>x264 - the best H.264/AVC encoder. Copyright (c) 2003-2012 x264 project.<br>");
|
||||||
text2 += tr("Free software library for encoding video streams into the H.264/MPEG-4 AVC format.<br>");
|
text2 += tr("Free software library for encoding video streams into the H.264/MPEG-4 AVC format.<br>");
|
||||||
text2 += tr("Released under the terms of the GNU General Public License.<br><br>");
|
text2 += tr("Released under the terms of the GNU General Public License.<br><br>");
|
||||||
text2 += tr("Please visit <a href=\"http://x264licensing.com/\">http://x264licensing.com/</a> for obtaining a <u>commercial</u> x264 license!<br></tt></nobr>");
|
text2 += tr("Please visit <a href=\"%1\">%1</a> for obtaining a <u>commercial</u> x264 license!<br></tt></nobr>").arg("http://x264licensing.com/");
|
||||||
QMessageBox::information(this, tr("About x264"), text2.replace("-", "−"), tr("Close"));
|
QMessageBox::information(this, tr("About x264"), text2.replace("-", "−"), tr("Close"));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -384,7 +419,7 @@ void MainWindow::init(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Pre-release popup
|
//Pre-release popup
|
||||||
if(PRE_RELEASE)
|
if(x264_is_prerelease())
|
||||||
{
|
{
|
||||||
qsrand(time(NULL)); int rnd = qrand() % 3;
|
qsrand(time(NULL)); int rnd = qrand() % 3;
|
||||||
int val = QMessageBox::information(this, tr("Pre-Release Version"), tr("Note: This is a pre-release version. Please do NOT use for production!<br>Click the button #%1 in order to continue...<br><br>(There will be no such message box in the final version of this application)").arg(QString::number(rnd + 1)), tr("(1)"), tr("(2)"), tr("(3)"), qrand() % 3);
|
int val = QMessageBox::information(this, tr("Pre-Release Version"), tr("Note: This is a pre-release version. Please do NOT use for production!<br>Click the button #%1 in order to continue...<br><br>(There will be no such message box in the final version of this application)").arg(QString::number(rnd + 1)), tr("(1)"), tr("(2)"), tr("(3)"), qrand() % 3);
|
||||||
@ -456,13 +491,35 @@ void MainWindow::showEvent(QShowEvent *e)
|
|||||||
|
|
||||||
void MainWindow::closeEvent(QCloseEvent *e)
|
void MainWindow::closeEvent(QCloseEvent *e)
|
||||||
{
|
{
|
||||||
if(havePendingJobs())
|
if(haveRunningJobs())
|
||||||
{
|
{
|
||||||
e->ignore();
|
e->ignore();
|
||||||
MessageBeep(MB_ICONWARNING);
|
QMessageBox::warning(this, tr("Jobs Are Running"), tr("Sorry, can not exit while there still are running jobs!"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(havePendingJobs())
|
||||||
|
{
|
||||||
|
int ret = QMessageBox::question(this, tr("Jobs Are Pending"), tr("Do you really want to quit and discard the pending jobs?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
|
||||||
|
if(ret != QMessageBox::Yes)
|
||||||
|
{
|
||||||
|
e->ignore();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
while(m_jobList->rowCount(QModelIndex()) > 0)
|
||||||
|
{
|
||||||
|
qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
|
||||||
|
if(!m_jobList->deleteJob(m_jobList->index(0, 0, QModelIndex())))
|
||||||
|
{
|
||||||
|
e->ignore();
|
||||||
|
QMessageBox::warning(this, tr("Failed To Exit"), tr("Sorry, at least one job could not be deleted!"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
|
||||||
QMainWindow::closeEvent(e);
|
QMainWindow::closeEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -529,6 +586,7 @@ void MainWindow::dropEvent(QDropEvent *event)
|
|||||||
// Private functions
|
// Private functions
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/*Jobs that are not completed (or failed, or aborted) yet*/
|
||||||
bool MainWindow::havePendingJobs(void)
|
bool MainWindow::havePendingJobs(void)
|
||||||
{
|
{
|
||||||
const int rows = m_jobList->rowCount(QModelIndex());
|
const int rows = m_jobList->rowCount(QModelIndex());
|
||||||
@ -545,6 +603,23 @@ bool MainWindow::havePendingJobs(void)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*Jobs that are still active, i.e. not terminated or enqueued*/
|
||||||
|
bool MainWindow::haveRunningJobs(void)
|
||||||
|
{
|
||||||
|
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 && status != EncodeThread::JobStatus_Enqueued)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::updateButtons(EncodeThread::JobStatus status)
|
void MainWindow::updateButtons(EncodeThread::JobStatus status)
|
||||||
{
|
{
|
||||||
qDebug("MainWindow::updateButtons(void)");
|
qDebug("MainWindow::updateButtons(void)");
|
||||||
@ -554,6 +629,9 @@ void MainWindow::updateButtons(EncodeThread::JobStatus status)
|
|||||||
buttonPauseJob->setEnabled(status == EncodeThread::JobStatus_Indexing || status == EncodeThread::JobStatus_Running || status == EncodeThread::JobStatus_Paused || status == EncodeThread::JobStatus_Running_Pass1 || status == EncodeThread::JobStatus_Running_Pass2);
|
buttonPauseJob->setEnabled(status == EncodeThread::JobStatus_Indexing || status == EncodeThread::JobStatus_Running || status == EncodeThread::JobStatus_Paused || status == EncodeThread::JobStatus_Running_Pass1 || status == EncodeThread::JobStatus_Running_Pass2);
|
||||||
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_Browse->setEnabled(status == EncodeThread::JobStatus_Completed);
|
||||||
|
|
||||||
actionJob_Start->setEnabled(buttonStartJob->isEnabled());
|
actionJob_Start->setEnabled(buttonStartJob->isEnabled());
|
||||||
actionJob_Abort->setEnabled(buttonAbortJob->isEnabled());
|
actionJob_Abort->setEnabled(buttonAbortJob->isEnabled());
|
||||||
actionJob_Pause->setEnabled(buttonPauseJob->isEnabled());
|
actionJob_Pause->setEnabled(buttonPauseJob->isEnabled());
|
||||||
|
@ -57,10 +57,13 @@ private:
|
|||||||
|
|
||||||
void updateButtons(EncodeThread::JobStatus status);
|
void updateButtons(EncodeThread::JobStatus status);
|
||||||
bool havePendingJobs(void);
|
bool havePendingJobs(void);
|
||||||
|
bool haveRunningJobs(void);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void addButtonPressed(const QString &filePath = QString(), bool *ok = NULL);
|
void addButtonPressed(const QString &filePath = QString(), bool *ok = NULL);
|
||||||
void abortButtonPressed(void);
|
void abortButtonPressed(void);
|
||||||
|
void browseButtonPressed(void);
|
||||||
|
void deleteButtonPressed(void);
|
||||||
void copyLogToClipboard(bool checked);
|
void copyLogToClipboard(bool checked);
|
||||||
void init(void);
|
void init(void);
|
||||||
void jobSelected(const QModelIndex & current, const QModelIndex & previous);
|
void jobSelected(const QModelIndex & current, const QModelIndex & previous);
|
||||||
|
Loading…
Reference in New Issue
Block a user