Some more refactoring.
This commit is contained in:
parent
a74f27ab5b
commit
74ac7077a6
@ -113,43 +113,43 @@ QVariant JobListModel::data(const QModelIndex &index, int role) const
|
|||||||
case 1:
|
case 1:
|
||||||
switch(m_status.value(m_jobs.at(index.row())))
|
switch(m_status.value(m_jobs.at(index.row())))
|
||||||
{
|
{
|
||||||
case EncodeThread::JobStatus_Enqueued:
|
case JobStatus_Enqueued:
|
||||||
return QVariant::fromValue<QString>(tr("Enqueued."));
|
return QVariant::fromValue<QString>(tr("Enqueued."));
|
||||||
break;
|
break;
|
||||||
case EncodeThread::JobStatus_Starting:
|
case JobStatus_Starting:
|
||||||
return QVariant::fromValue<QString>(tr("Starting..."));
|
return QVariant::fromValue<QString>(tr("Starting..."));
|
||||||
break;
|
break;
|
||||||
case EncodeThread::JobStatus_Indexing:
|
case JobStatus_Indexing:
|
||||||
return QVariant::fromValue<QString>(tr("Indexing..."));
|
return QVariant::fromValue<QString>(tr("Indexing..."));
|
||||||
break;
|
break;
|
||||||
case EncodeThread::JobStatus_Running:
|
case JobStatus_Running:
|
||||||
return QVariant::fromValue<QString>(tr("Running..."));
|
return QVariant::fromValue<QString>(tr("Running..."));
|
||||||
break;
|
break;
|
||||||
case EncodeThread::JobStatus_Running_Pass1:
|
case JobStatus_Running_Pass1:
|
||||||
return QVariant::fromValue<QString>(tr("Running... (Pass 1)"));
|
return QVariant::fromValue<QString>(tr("Running... (Pass 1)"));
|
||||||
break;
|
break;
|
||||||
case EncodeThread::JobStatus_Running_Pass2:
|
case JobStatus_Running_Pass2:
|
||||||
return QVariant::fromValue<QString>(tr("Running... (Pass 2)"));
|
return QVariant::fromValue<QString>(tr("Running... (Pass 2)"));
|
||||||
break;
|
break;
|
||||||
case EncodeThread::JobStatus_Completed:
|
case JobStatus_Completed:
|
||||||
return QVariant::fromValue<QString>(tr("Completed."));
|
return QVariant::fromValue<QString>(tr("Completed."));
|
||||||
break;
|
break;
|
||||||
case EncodeThread::JobStatus_Failed:
|
case JobStatus_Failed:
|
||||||
return QVariant::fromValue<QString>(tr("Failed!"));
|
return QVariant::fromValue<QString>(tr("Failed!"));
|
||||||
break;
|
break;
|
||||||
case EncodeThread::JobStatus_Pausing:
|
case JobStatus_Pausing:
|
||||||
return QVariant::fromValue<QString>(tr("Pausing..."));
|
return QVariant::fromValue<QString>(tr("Pausing..."));
|
||||||
break;
|
break;
|
||||||
case EncodeThread::JobStatus_Paused:
|
case JobStatus_Paused:
|
||||||
return QVariant::fromValue<QString>(tr("Paused."));
|
return QVariant::fromValue<QString>(tr("Paused."));
|
||||||
break;
|
break;
|
||||||
case EncodeThread::JobStatus_Resuming:
|
case JobStatus_Resuming:
|
||||||
return QVariant::fromValue<QString>(tr("Resuming..."));
|
return QVariant::fromValue<QString>(tr("Resuming..."));
|
||||||
break;
|
break;
|
||||||
case EncodeThread::JobStatus_Aborting:
|
case JobStatus_Aborting:
|
||||||
return QVariant::fromValue<QString>(tr("Aborting..."));
|
return QVariant::fromValue<QString>(tr("Aborting..."));
|
||||||
break;
|
break;
|
||||||
case EncodeThread::JobStatus_Aborted:
|
case JobStatus_Aborted:
|
||||||
return QVariant::fromValue<QString>(tr("Aborted!"));
|
return QVariant::fromValue<QString>(tr("Aborted!"));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -175,39 +175,39 @@ QVariant JobListModel::data(const QModelIndex &index, int role) const
|
|||||||
{
|
{
|
||||||
switch(m_status.value(m_jobs.at(index.row())))
|
switch(m_status.value(m_jobs.at(index.row())))
|
||||||
{
|
{
|
||||||
case EncodeThread::JobStatus_Enqueued:
|
case JobStatus_Enqueued:
|
||||||
return QIcon(":/buttons/hourglass.png");
|
return QIcon(":/buttons/hourglass.png");
|
||||||
break;
|
break;
|
||||||
case EncodeThread::JobStatus_Starting:
|
case JobStatus_Starting:
|
||||||
return QIcon(":/buttons/lightning.png");
|
return QIcon(":/buttons/lightning.png");
|
||||||
break;
|
break;
|
||||||
case EncodeThread::JobStatus_Indexing:
|
case JobStatus_Indexing:
|
||||||
return QIcon(":/buttons/find.png");
|
return QIcon(":/buttons/find.png");
|
||||||
break;
|
break;
|
||||||
case EncodeThread::JobStatus_Running:
|
case JobStatus_Running:
|
||||||
case EncodeThread::JobStatus_Running_Pass1:
|
case JobStatus_Running_Pass1:
|
||||||
case EncodeThread::JobStatus_Running_Pass2:
|
case JobStatus_Running_Pass2:
|
||||||
return QIcon(":/buttons/play.png");
|
return QIcon(":/buttons/play.png");
|
||||||
break;
|
break;
|
||||||
case EncodeThread::JobStatus_Completed:
|
case JobStatus_Completed:
|
||||||
return QIcon(":/buttons/accept.png");
|
return QIcon(":/buttons/accept.png");
|
||||||
break;
|
break;
|
||||||
case EncodeThread::JobStatus_Failed:
|
case JobStatus_Failed:
|
||||||
return QIcon(":/buttons/exclamation.png");
|
return QIcon(":/buttons/exclamation.png");
|
||||||
break;
|
break;
|
||||||
case EncodeThread::JobStatus_Pausing:
|
case JobStatus_Pausing:
|
||||||
return QIcon(":/buttons/clock_pause.png");
|
return QIcon(":/buttons/clock_pause.png");
|
||||||
break;
|
break;
|
||||||
case EncodeThread::JobStatus_Paused:
|
case JobStatus_Paused:
|
||||||
return QIcon(":/buttons/suspended.png");
|
return QIcon(":/buttons/suspended.png");
|
||||||
break;
|
break;
|
||||||
case EncodeThread::JobStatus_Resuming:
|
case JobStatus_Resuming:
|
||||||
return QIcon(":/buttons/clock_play.png");
|
return QIcon(":/buttons/clock_play.png");
|
||||||
break;
|
break;
|
||||||
case EncodeThread::JobStatus_Aborting:
|
case JobStatus_Aborting:
|
||||||
return QIcon(":/buttons/clock_stop.png");
|
return QIcon(":/buttons/clock_stop.png");
|
||||||
break;
|
break;
|
||||||
case EncodeThread::JobStatus_Aborted:
|
case JobStatus_Aborted:
|
||||||
return QIcon(":/buttons/error.png");
|
return QIcon(":/buttons/error.png");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -278,7 +278,7 @@ QModelIndex JobListModel::insertJob(EncodeThread *thread)
|
|||||||
beginInsertRows(QModelIndex(), m_jobs.count(), m_jobs.count());
|
beginInsertRows(QModelIndex(), m_jobs.count(), m_jobs.count());
|
||||||
m_jobs.append(id);
|
m_jobs.append(id);
|
||||||
m_name.insert(id, jobName);
|
m_name.insert(id, jobName);
|
||||||
m_status.insert(id, EncodeThread::JobStatus_Enqueued);
|
m_status.insert(id, JobStatus_Enqueued);
|
||||||
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);
|
m_logFile.insert(id, logFile);
|
||||||
@ -298,9 +298,9 @@ bool JobListModel::startJob(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())
|
||||||
{
|
{
|
||||||
QUuid id = m_jobs.at(index.row());
|
QUuid id = m_jobs.at(index.row());
|
||||||
if(m_status.value(id) == EncodeThread::JobStatus_Enqueued)
|
if(m_status.value(id) == JobStatus_Enqueued)
|
||||||
{
|
{
|
||||||
updateStatus(id, EncodeThread::JobStatus_Starting);
|
updateStatus(id, JobStatus_Starting);
|
||||||
updateDetails(id, tr("Starting up, please wait..."));
|
updateDetails(id, tr("Starting up, please wait..."));
|
||||||
m_threads.value(id)->start();
|
m_threads.value(id)->start();
|
||||||
return true;
|
return true;
|
||||||
@ -315,11 +315,11 @@ bool JobListModel::pauseJob(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())
|
||||||
{
|
{
|
||||||
QUuid id = m_jobs.at(index.row());
|
QUuid id = m_jobs.at(index.row());
|
||||||
EncodeThread::JobStatus status = m_status.value(id);
|
JobStatus status = m_status.value(id);
|
||||||
if((status == EncodeThread::JobStatus_Indexing) || (status == EncodeThread::JobStatus_Running) ||
|
if((status == JobStatus_Indexing) || (status == JobStatus_Running) ||
|
||||||
(status == EncodeThread::JobStatus_Running_Pass1) || (status == EncodeThread::JobStatus_Running_Pass2))
|
(status == JobStatus_Running_Pass1) || (status == JobStatus_Running_Pass2))
|
||||||
{
|
{
|
||||||
updateStatus(id, EncodeThread::JobStatus_Pausing);
|
updateStatus(id, JobStatus_Pausing);
|
||||||
m_threads.value(id)->pauseJob();
|
m_threads.value(id)->pauseJob();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -333,10 +333,10 @@ bool JobListModel::resumeJob(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())
|
||||||
{
|
{
|
||||||
QUuid id = m_jobs.at(index.row());
|
QUuid id = m_jobs.at(index.row());
|
||||||
EncodeThread::JobStatus status = m_status.value(id);
|
JobStatus status = m_status.value(id);
|
||||||
if(status == EncodeThread::JobStatus_Paused)
|
if(status == JobStatus_Paused)
|
||||||
{
|
{
|
||||||
updateStatus(id, EncodeThread::JobStatus_Resuming);
|
updateStatus(id, JobStatus_Resuming);
|
||||||
m_threads.value(id)->resumeJob();
|
m_threads.value(id)->resumeJob();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -350,10 +350,10 @@ bool JobListModel::abortJob(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())
|
||||||
{
|
{
|
||||||
QUuid id = m_jobs.at(index.row());
|
QUuid id = m_jobs.at(index.row());
|
||||||
if(m_status.value(id) == EncodeThread::JobStatus_Indexing || m_status.value(id) == EncodeThread::JobStatus_Running ||
|
if(m_status.value(id) == JobStatus_Indexing || m_status.value(id) == JobStatus_Running ||
|
||||||
m_status.value(id) == EncodeThread::JobStatus_Running_Pass1 || EncodeThread::JobStatus_Running_Pass2)
|
m_status.value(id) == JobStatus_Running_Pass1 || JobStatus_Running_Pass2)
|
||||||
{
|
{
|
||||||
updateStatus(id, EncodeThread::JobStatus_Aborting);
|
updateStatus(id, JobStatus_Aborting);
|
||||||
m_threads.value(id)->abortJob();
|
m_threads.value(id)->abortJob();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -367,8 +367,8 @@ bool JobListModel::deleteJob(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())
|
||||||
{
|
{
|
||||||
QUuid id = m_jobs.at(index.row());
|
QUuid id = m_jobs.at(index.row());
|
||||||
if(m_status.value(id) == EncodeThread::JobStatus_Completed || m_status.value(id) == EncodeThread::JobStatus_Failed ||
|
if(m_status.value(id) == JobStatus_Completed || m_status.value(id) == JobStatus_Failed ||
|
||||||
m_status.value(id) == EncodeThread::JobStatus_Aborted || m_status.value(id) == EncodeThread::JobStatus_Enqueued)
|
m_status.value(id) == JobStatus_Aborted || m_status.value(id) == JobStatus_Enqueued)
|
||||||
{
|
{
|
||||||
int idx = index.row();
|
int idx = index.row();
|
||||||
QUuid id = m_jobs.at(idx);
|
QUuid id = m_jobs.at(idx);
|
||||||
@ -432,14 +432,14 @@ const QString &JobListModel::getJobOutputFile(const QModelIndex &index)
|
|||||||
return nullStr;
|
return nullStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
EncodeThread::JobStatus JobListModel::getJobStatus(const QModelIndex &index)
|
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())
|
||||||
{
|
{
|
||||||
return m_status.value(m_jobs.at(index.row()));
|
return m_status.value(m_jobs.at(index.row()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return static_cast<EncodeThread::JobStatus>(-1);
|
return static_cast<JobStatus>(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int JobListModel::getJobProgress(const QModelIndex &index)
|
unsigned int JobListModel::getJobProgress(const QModelIndex &index)
|
||||||
@ -479,7 +479,7 @@ QModelIndex JobListModel::getJobIndexById(const QUuid &id)
|
|||||||
// Slots
|
// Slots
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void JobListModel::updateStatus(const QUuid &jobId, EncodeThread::JobStatus newStatus)
|
void JobListModel::updateStatus(const QUuid &jobId, JobStatus newStatus)
|
||||||
{
|
{
|
||||||
int index = -1;
|
int index = -1;
|
||||||
|
|
||||||
@ -492,13 +492,13 @@ void JobListModel::updateStatus(const QUuid &jobId, EncodeThread::JobStatus newS
|
|||||||
{
|
{
|
||||||
switch(newStatus)
|
switch(newStatus)
|
||||||
{
|
{
|
||||||
case EncodeThread::JobStatus_Completed:
|
case JobStatus_Completed:
|
||||||
PlaySound(MAKEINTRESOURCE(IDR_WAVE4), GetModuleHandle(NULL), SND_RESOURCE | SND_ASYNC);
|
PlaySound(MAKEINTRESOURCE(IDR_WAVE4), GetModuleHandle(NULL), SND_RESOURCE | SND_ASYNC);
|
||||||
break;
|
break;
|
||||||
case EncodeThread::JobStatus_Aborted:
|
case JobStatus_Aborted:
|
||||||
PlaySound(MAKEINTRESOURCE(IDR_WAVE5), GetModuleHandle(NULL), SND_RESOURCE | SND_ASYNC);
|
PlaySound(MAKEINTRESOURCE(IDR_WAVE5), GetModuleHandle(NULL), SND_RESOURCE | SND_ASYNC);
|
||||||
break;
|
break;
|
||||||
case EncodeThread::JobStatus_Failed:
|
case JobStatus_Failed:
|
||||||
PlaySound(MAKEINTRESOURCE(IDR_WAVE6), GetModuleHandle(NULL), SND_RESOURCE | SND_ASYNC);
|
PlaySound(MAKEINTRESOURCE(IDR_WAVE6), GetModuleHandle(NULL), SND_RESOURCE | SND_ASYNC);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ public:
|
|||||||
LogFileModel *getLogFile(const QModelIndex &index);
|
LogFileModel *getLogFile(const QModelIndex &index);
|
||||||
const QString &getJobSourceFile(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);
|
JobStatus getJobStatus(const QModelIndex &index);
|
||||||
unsigned int getJobProgress(const QModelIndex &index);
|
unsigned int getJobProgress(const QModelIndex &index);
|
||||||
const OptionsModel *getJobOptions(const QModelIndex &index);
|
const OptionsModel *getJobOptions(const QModelIndex &index);
|
||||||
QModelIndex getJobIndexById(const QUuid &id);
|
QModelIndex getJobIndexById(const QUuid &id);
|
||||||
@ -64,14 +64,14 @@ protected:
|
|||||||
QList<QUuid> m_jobs;
|
QList<QUuid> m_jobs;
|
||||||
QMap<QUuid, QString> m_name;
|
QMap<QUuid, QString> m_name;
|
||||||
QMap<QUuid, EncodeThread*> m_threads;
|
QMap<QUuid, EncodeThread*> m_threads;
|
||||||
QMap<QUuid, EncodeThread::JobStatus> m_status;
|
QMap<QUuid, 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;
|
QMap<QUuid, QString> m_details;
|
||||||
PreferencesModel *m_preferences;
|
PreferencesModel *m_preferences;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void updateStatus(const QUuid &jobId, EncodeThread::JobStatus newStatus);
|
void updateStatus(const QUuid &jobId, 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);
|
void updateDetails(const QUuid &jobId, const QString &details);
|
||||||
};
|
};
|
||||||
|
40
src/model_status.h
Normal file
40
src/model_status.h
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Simple x264 Launcher
|
||||||
|
// Copyright (C) 2004-2013 LoRd_MuldeR <MuldeR2@GMX.de>
|
||||||
|
//
|
||||||
|
// This program is free software; you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation; either version 2 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License along
|
||||||
|
// with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
//
|
||||||
|
// http://www.gnu.org/licenses/gpl-2.0.txt
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
enum JobStatus
|
||||||
|
{
|
||||||
|
JobStatus_Enqueued = 0,
|
||||||
|
JobStatus_Starting = 1,
|
||||||
|
JobStatus_Indexing = 2,
|
||||||
|
JobStatus_Running = 3,
|
||||||
|
JobStatus_Running_Pass1 = 4,
|
||||||
|
JobStatus_Running_Pass2 = 5,
|
||||||
|
JobStatus_Completed = 6,
|
||||||
|
JobStatus_Failed = 7,
|
||||||
|
JobStatus_Pausing = 8,
|
||||||
|
JobStatus_Paused = 9,
|
||||||
|
JobStatus_Resuming = 10,
|
||||||
|
JobStatus_Aborting = 11,
|
||||||
|
JobStatus_Aborted = 12,
|
||||||
|
JobStatus_Undefined = 666
|
||||||
|
};
|
@ -21,6 +21,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "model_status.h"
|
||||||
|
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QUuid>
|
#include <QUuid>
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
@ -35,24 +37,6 @@ class EncodeThread : public QThread
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum JobStatus
|
|
||||||
{
|
|
||||||
JobStatus_Enqueued = 0,
|
|
||||||
JobStatus_Starting = 1,
|
|
||||||
JobStatus_Indexing = 2,
|
|
||||||
JobStatus_Running = 3,
|
|
||||||
JobStatus_Running_Pass1 = 4,
|
|
||||||
JobStatus_Running_Pass2 = 5,
|
|
||||||
JobStatus_Completed = 6,
|
|
||||||
JobStatus_Failed = 7,
|
|
||||||
JobStatus_Pausing = 8,
|
|
||||||
JobStatus_Paused = 9,
|
|
||||||
JobStatus_Resuming = 10,
|
|
||||||
JobStatus_Aborting = 11,
|
|
||||||
JobStatus_Aborted = 12,
|
|
||||||
JobStatus_Undefined = 666
|
|
||||||
};
|
|
||||||
|
|
||||||
EncodeThread(const QString &sourceFileName, const QString &outputFileName, const OptionsModel *options, const QString &binDir, bool x264_x64, bool x264_10bit, bool avs2yuv_x64, int processPriroity);
|
EncodeThread(const QString &sourceFileName, const QString &outputFileName, const OptionsModel *options, const QString &binDir, bool x264_x64, bool x264_10bit, bool avs2yuv_x64, int processPriroity);
|
||||||
~EncodeThread(void);
|
~EncodeThread(void);
|
||||||
|
|
||||||
@ -136,7 +120,7 @@ protected:
|
|||||||
static void setPorcessPriority(void *processId, int priroity);
|
static void setPorcessPriority(void *processId, int priroity);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void statusChanged(const QUuid &jobId, EncodeThread::JobStatus newStatus);
|
void statusChanged(const QUuid &jobId, 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);
|
void detailsChanged(const QUuid &jobId, const QString &details);
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#define VER_X264_MAJOR 2
|
#define VER_X264_MAJOR 2
|
||||||
#define VER_X264_MINOR 1
|
#define VER_X264_MINOR 1
|
||||||
#define VER_X264_PATCH 5
|
#define VER_X264_PATCH 5
|
||||||
#define VER_X264_BUILD 494
|
#define VER_X264_BUILD 497
|
||||||
|
|
||||||
#define VER_X264_MINIMUM_REV 2282
|
#define VER_X264_MINIMUM_REV 2282
|
||||||
#define VER_X264_CURRENT_API 133
|
#define VER_X264_CURRENT_API 133
|
||||||
|
@ -26,6 +26,8 @@
|
|||||||
#include "model_preferences.h"
|
#include "model_preferences.h"
|
||||||
#include "model_recently.h"
|
#include "model_recently.h"
|
||||||
#include "thread_avisynth.h"
|
#include "thread_avisynth.h"
|
||||||
|
#include "thread_ipc.h"
|
||||||
|
#include "thread_encode.h"
|
||||||
#include "taskbar7.h"
|
#include "taskbar7.h"
|
||||||
#include "win_addJob.h"
|
#include "win_addJob.h"
|
||||||
#include "win_preferences.h"
|
#include "win_preferences.h"
|
||||||
@ -82,7 +84,7 @@ MainWindow::MainWindow(const x264_cpu_t *const cpuFeatures)
|
|||||||
//Register meta types
|
//Register meta types
|
||||||
qRegisterMetaType<QUuid>("QUuid");
|
qRegisterMetaType<QUuid>("QUuid");
|
||||||
qRegisterMetaType<QUuid>("DWORD");
|
qRegisterMetaType<QUuid>("DWORD");
|
||||||
qRegisterMetaType<EncodeThread::JobStatus>("EncodeThread::JobStatus");
|
qRegisterMetaType<JobStatus>("EncodeThread::JobStatus");
|
||||||
|
|
||||||
//Load preferences
|
//Load preferences
|
||||||
m_preferences = new PreferencesModel();
|
m_preferences = new PreferencesModel();
|
||||||
@ -365,8 +367,8 @@ void MainWindow::jobSelected(const QModelIndex & current, const QModelIndex & pr
|
|||||||
logView->actions().first()->setEnabled(false);
|
logView->actions().first()->setEnabled(false);
|
||||||
progressBar->setValue(0);
|
progressBar->setValue(0);
|
||||||
editDetails->clear();
|
editDetails->clear();
|
||||||
updateButtons(EncodeThread::JobStatus_Undefined);
|
updateButtons(JobStatus_Undefined);
|
||||||
updateTaskbar(EncodeThread::JobStatus_Undefined, QIcon());
|
updateTaskbar(JobStatus_Undefined, QIcon());
|
||||||
}
|
}
|
||||||
|
|
||||||
progressBar->repaint();
|
progressBar->repaint();
|
||||||
@ -383,14 +385,14 @@ void MainWindow::jobChangedData(const QModelIndex &topLeft, const QModelIndex &
|
|||||||
{
|
{
|
||||||
for(int i = topLeft.row(); i <= bottomRight.row(); i++)
|
for(int i = topLeft.row(); i <= bottomRight.row(); i++)
|
||||||
{
|
{
|
||||||
EncodeThread::JobStatus status = m_jobList->getJobStatus(m_jobList->index(i, 0, QModelIndex()));
|
JobStatus status = m_jobList->getJobStatus(m_jobList->index(i, 0, QModelIndex()));
|
||||||
if(i == selected)
|
if(i == selected)
|
||||||
{
|
{
|
||||||
qDebug("Current job changed status!");
|
qDebug("Current job changed status!");
|
||||||
updateButtons(status);
|
updateButtons(status);
|
||||||
updateTaskbar(status, m_jobList->data(m_jobList->index(i, 0, QModelIndex()), Qt::DecorationRole).value<QIcon>());
|
updateTaskbar(status, m_jobList->data(m_jobList->index(i, 0, QModelIndex()), Qt::DecorationRole).value<QIcon>());
|
||||||
}
|
}
|
||||||
if((status == EncodeThread::JobStatus_Completed) || (status == EncodeThread::JobStatus_Failed))
|
if((status == JobStatus_Completed) || (status == JobStatus_Failed))
|
||||||
{
|
{
|
||||||
if(m_preferences->autoRunNextJob()) QTimer::singleShot(0, this, SLOT(launchNextJob()));
|
if(m_preferences->autoRunNextJob()) QTimer::singleShot(0, this, SLOT(launchNextJob()));
|
||||||
if(m_preferences->shutdownComputer()) QTimer::singleShot(0, this, SLOT(shutdownComputer()));
|
if(m_preferences->shutdownComputer()) QTimer::singleShot(0, this, SLOT(shutdownComputer()));
|
||||||
@ -554,8 +556,8 @@ void MainWindow::launchNextJob(void)
|
|||||||
for(int i = 0; i < rows; i++)
|
for(int i = 0; i < rows; i++)
|
||||||
{
|
{
|
||||||
int currentIdx = (i + startIdx) % rows;
|
int currentIdx = (i + startIdx) % rows;
|
||||||
EncodeThread::JobStatus status = m_jobList->getJobStatus(m_jobList->index(currentIdx, 0, QModelIndex()));
|
JobStatus status = m_jobList->getJobStatus(m_jobList->index(currentIdx, 0, QModelIndex()));
|
||||||
if(status == EncodeThread::JobStatus_Enqueued)
|
if(status == JobStatus_Enqueued)
|
||||||
{
|
{
|
||||||
if(m_jobList->startJob(m_jobList->index(currentIdx, 0, QModelIndex())))
|
if(m_jobList->startJob(m_jobList->index(currentIdx, 0, QModelIndex())))
|
||||||
{
|
{
|
||||||
@ -1149,8 +1151,8 @@ unsigned int MainWindow::countPendingJobs(void)
|
|||||||
|
|
||||||
for(int i = 0; i < rows; i++)
|
for(int i = 0; i < rows; i++)
|
||||||
{
|
{
|
||||||
EncodeThread::JobStatus status = m_jobList->getJobStatus(m_jobList->index(i, 0, QModelIndex()));
|
JobStatus status = m_jobList->getJobStatus(m_jobList->index(i, 0, QModelIndex()));
|
||||||
if(status != EncodeThread::JobStatus_Completed && status != EncodeThread::JobStatus_Aborted && status != EncodeThread::JobStatus_Failed)
|
if(status != JobStatus_Completed && status != JobStatus_Aborted && status != JobStatus_Failed)
|
||||||
{
|
{
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
@ -1169,8 +1171,8 @@ unsigned int MainWindow::countRunningJobs(void)
|
|||||||
|
|
||||||
for(int i = 0; i < rows; i++)
|
for(int i = 0; i < rows; i++)
|
||||||
{
|
{
|
||||||
EncodeThread::JobStatus status = m_jobList->getJobStatus(m_jobList->index(i, 0, QModelIndex()));
|
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)
|
if(status != JobStatus_Completed && status != JobStatus_Aborted && status != JobStatus_Failed && status != JobStatus_Enqueued)
|
||||||
{
|
{
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
@ -1182,50 +1184,50 @@ unsigned int MainWindow::countRunningJobs(void)
|
|||||||
/*
|
/*
|
||||||
* Update all buttons with respect to current job status
|
* Update all buttons with respect to current job status
|
||||||
*/
|
*/
|
||||||
void MainWindow::updateButtons(EncodeThread::JobStatus status)
|
void MainWindow::updateButtons(JobStatus status)
|
||||||
{
|
{
|
||||||
qDebug("MainWindow::updateButtons(void)");
|
qDebug("MainWindow::updateButtons(void)");
|
||||||
|
|
||||||
buttonStartJob->setEnabled(status == EncodeThread::JobStatus_Enqueued);
|
buttonStartJob->setEnabled(status == JobStatus_Enqueued);
|
||||||
buttonAbortJob->setEnabled(status == EncodeThread::JobStatus_Indexing || status == EncodeThread::JobStatus_Running || status == EncodeThread::JobStatus_Running_Pass1 || status == EncodeThread::JobStatus_Running_Pass2 || status == EncodeThread::JobStatus_Paused);
|
buttonAbortJob->setEnabled(status == JobStatus_Indexing || status == JobStatus_Running || status == JobStatus_Running_Pass1 || status == JobStatus_Running_Pass2 || status == JobStatus_Paused);
|
||||||
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 == JobStatus_Indexing || status == JobStatus_Running || status == JobStatus_Paused || status == JobStatus_Running_Pass1 || status == JobStatus_Running_Pass2);
|
||||||
buttonPauseJob->setChecked(status == EncodeThread::JobStatus_Paused || status == EncodeThread::JobStatus_Pausing);
|
buttonPauseJob->setChecked(status == JobStatus_Paused || status == 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 == JobStatus_Completed || status == JobStatus_Aborted || status == JobStatus_Failed || status == JobStatus_Enqueued);
|
||||||
actionJob_Restart->setEnabled(status == EncodeThread::JobStatus_Completed || status == EncodeThread::JobStatus_Aborted || status == EncodeThread::JobStatus_Failed || status == EncodeThread::JobStatus_Enqueued);
|
actionJob_Restart->setEnabled(status == JobStatus_Completed || status == JobStatus_Aborted || status == JobStatus_Failed || status == JobStatus_Enqueued);
|
||||||
actionJob_Browse->setEnabled(status == EncodeThread::JobStatus_Completed);
|
actionJob_Browse->setEnabled(status == 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());
|
||||||
actionJob_Pause->setChecked(buttonPauseJob->isChecked());
|
actionJob_Pause->setChecked(buttonPauseJob->isChecked());
|
||||||
|
|
||||||
editDetails->setEnabled(status != EncodeThread::JobStatus_Paused);
|
editDetails->setEnabled(status != JobStatus_Paused);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Update the taskbar with current job status
|
* Update the taskbar with current job status
|
||||||
*/
|
*/
|
||||||
void MainWindow::updateTaskbar(EncodeThread::JobStatus status, const QIcon &icon)
|
void MainWindow::updateTaskbar(JobStatus status, const QIcon &icon)
|
||||||
{
|
{
|
||||||
qDebug("MainWindow::updateTaskbar(void)");
|
qDebug("MainWindow::updateTaskbar(void)");
|
||||||
|
|
||||||
switch(status)
|
switch(status)
|
||||||
{
|
{
|
||||||
case EncodeThread::JobStatus_Undefined:
|
case JobStatus_Undefined:
|
||||||
WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarNoState);
|
WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarNoState);
|
||||||
break;
|
break;
|
||||||
case EncodeThread::JobStatus_Aborting:
|
case JobStatus_Aborting:
|
||||||
case EncodeThread::JobStatus_Starting:
|
case JobStatus_Starting:
|
||||||
case EncodeThread::JobStatus_Pausing:
|
case JobStatus_Pausing:
|
||||||
case EncodeThread::JobStatus_Resuming:
|
case JobStatus_Resuming:
|
||||||
WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarIndeterminateState);
|
WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarIndeterminateState);
|
||||||
break;
|
break;
|
||||||
case EncodeThread::JobStatus_Aborted:
|
case JobStatus_Aborted:
|
||||||
case EncodeThread::JobStatus_Failed:
|
case JobStatus_Failed:
|
||||||
WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarErrorState);
|
WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarErrorState);
|
||||||
break;
|
break;
|
||||||
case EncodeThread::JobStatus_Paused:
|
case JobStatus_Paused:
|
||||||
WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarPausedState);
|
WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarPausedState);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -1235,10 +1237,10 @@ void MainWindow::updateTaskbar(EncodeThread::JobStatus status, const QIcon &icon
|
|||||||
|
|
||||||
switch(status)
|
switch(status)
|
||||||
{
|
{
|
||||||
case EncodeThread::JobStatus_Aborting:
|
case JobStatus_Aborting:
|
||||||
case EncodeThread::JobStatus_Starting:
|
case JobStatus_Starting:
|
||||||
case EncodeThread::JobStatus_Pausing:
|
case JobStatus_Pausing:
|
||||||
case EncodeThread::JobStatus_Resuming:
|
case JobStatus_Resuming:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
WinSevenTaskbar::setTaskbarProgress(this, progressBar->value(), progressBar->maximum());
|
WinSevenTaskbar::setTaskbarProgress(this, progressBar->value(), progressBar->maximum());
|
||||||
|
@ -22,8 +22,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "uic_win_main.h"
|
#include "uic_win_main.h"
|
||||||
#include "thread_ipc.h"
|
|
||||||
#include "thread_encode.h"
|
#include "global.h"
|
||||||
|
#include "model_status.h"
|
||||||
|
|
||||||
class JobListModel;
|
class JobListModel;
|
||||||
class OptionsModel;
|
class OptionsModel;
|
||||||
@ -31,6 +32,7 @@ class QFile;
|
|||||||
class QLibrary;
|
class QLibrary;
|
||||||
class PreferencesModel;
|
class PreferencesModel;
|
||||||
class RecentlyUsed;
|
class RecentlyUsed;
|
||||||
|
class IPCThread;
|
||||||
|
|
||||||
class MainWindow: public QMainWindow, private Ui::MainWindow
|
class MainWindow: public QMainWindow, private Ui::MainWindow
|
||||||
{
|
{
|
||||||
@ -69,8 +71,8 @@ private:
|
|||||||
bool createJobMultiple(const QStringList &filePathIn);
|
bool createJobMultiple(const QStringList &filePathIn);
|
||||||
|
|
||||||
bool appendJob(const QString &sourceFileName, const QString &outputFileName, OptionsModel *options, const bool runImmediately);
|
bool appendJob(const QString &sourceFileName, const QString &outputFileName, OptionsModel *options, const bool runImmediately);
|
||||||
void updateButtons(EncodeThread::JobStatus status);
|
void updateButtons(JobStatus status);
|
||||||
void updateTaskbar(EncodeThread::JobStatus status, const QIcon &icon);
|
void updateTaskbar(JobStatus status, const QIcon &icon);
|
||||||
unsigned int countPendingJobs(void);
|
unsigned int countPendingJobs(void);
|
||||||
unsigned int countRunningJobs(void);
|
unsigned int countRunningJobs(void);
|
||||||
|
|
||||||
|
@ -285,6 +285,7 @@ copy /Y "$(QTDIR)\plugins\imageformats\qgif4.dll" "$(TargetDir)\imageformats"
|
|||||||
<ClInclude Include="src\model_options.h" />
|
<ClInclude Include="src\model_options.h" />
|
||||||
<ClInclude Include="src\model_preferences.h" />
|
<ClInclude Include="src\model_preferences.h" />
|
||||||
<ClInclude Include="src\model_recently.h" />
|
<ClInclude Include="src\model_recently.h" />
|
||||||
|
<ClInclude Include="src\model_status.h" />
|
||||||
<ClInclude Include="src\targetver.h" />
|
<ClInclude Include="src\targetver.h" />
|
||||||
<ClInclude Include="src\taskbar7.h" />
|
<ClInclude Include="src\taskbar7.h" />
|
||||||
<CustomBuild Include="src\thread_ipc.h">
|
<CustomBuild Include="src\thread_ipc.h">
|
||||||
|
@ -54,6 +54,9 @@
|
|||||||
<ClInclude Include="src\model_recently.h">
|
<ClInclude Include="src\model_recently.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="src\model_status.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="src\main.cpp">
|
<ClCompile Include="src\main.cpp">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user