2012-01-28 18:55:40 +01:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Simple x264 Launcher
|
2015-01-31 19:56:04 +01:00
|
|
|
// Copyright (C) 2004-2015 LoRd_MuldeR <MuldeR2@GMX.de>
|
2012-01-28 18:55:40 +01:00
|
|
|
//
|
|
|
|
// 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
|
|
|
|
|
|
|
|
#include "thread_encode.h"
|
2012-01-28 19:59:04 +01:00
|
|
|
#include "model_logFile.h"
|
2012-01-28 18:55:40 +01:00
|
|
|
|
|
|
|
#include "QAbstractItemModel"
|
|
|
|
#include <QUuid>
|
|
|
|
#include <QList>
|
|
|
|
#include <QMap>
|
|
|
|
|
2013-07-03 21:34:21 +02:00
|
|
|
class PreferencesModel;
|
|
|
|
|
2012-01-28 18:55:40 +01:00
|
|
|
class JobListModel : public QAbstractItemModel
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2013-07-03 21:34:21 +02:00
|
|
|
JobListModel(PreferencesModel *preferences);
|
2012-01-28 18:55:40 +01:00
|
|
|
~JobListModel(void);
|
|
|
|
|
|
|
|
virtual int columnCount(const QModelIndex &parent) const;
|
|
|
|
virtual int rowCount(const QModelIndex &parent) const;
|
|
|
|
virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
|
|
|
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const;
|
|
|
|
virtual QModelIndex parent (const QModelIndex &index) const;
|
|
|
|
virtual QVariant data(const QModelIndex &index, int role) const;
|
|
|
|
|
2012-01-28 23:24:41 +01:00
|
|
|
QModelIndex insertJob(EncodeThread *thread);
|
|
|
|
bool startJob(const QModelIndex &index);
|
2012-02-02 02:13:02 +01:00
|
|
|
bool pauseJob(const QModelIndex &index);
|
|
|
|
bool resumeJob(const QModelIndex &index);
|
2012-01-28 23:24:41 +01:00
|
|
|
bool abortJob(const QModelIndex &index);
|
2012-02-02 22:53:40 +01:00
|
|
|
bool deleteJob(const QModelIndex &index);
|
2014-04-20 17:38:55 +02:00
|
|
|
bool moveJob(const QModelIndex &index, const int &direction);
|
2012-01-28 19:59:04 +01:00
|
|
|
LogFileModel *getLogFile(const QModelIndex &index);
|
2012-02-14 23:36:44 +01:00
|
|
|
const QString &getJobSourceFile(const QModelIndex &index);
|
2012-02-02 22:53:40 +01:00
|
|
|
const QString &getJobOutputFile(const QModelIndex &index);
|
2013-07-03 21:52:19 +02:00
|
|
|
JobStatus getJobStatus(const QModelIndex &index);
|
2012-01-28 23:24:41 +01:00
|
|
|
unsigned int getJobProgress(const QModelIndex &index);
|
2012-02-14 23:36:44 +01:00
|
|
|
const OptionsModel *getJobOptions(const QModelIndex &index);
|
2012-01-28 23:24:41 +01:00
|
|
|
QModelIndex getJobIndexById(const QUuid &id);
|
2012-01-28 18:55:40 +01:00
|
|
|
|
2014-04-18 14:41:20 +02:00
|
|
|
size_t saveQueuedJobs(void);
|
|
|
|
size_t loadQueuedJobs(const SysinfoModel *sysinfo);
|
|
|
|
void clearQueuedJobs(void);
|
|
|
|
|
2014-04-20 17:38:55 +02:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
MOVE_UP = +1,
|
|
|
|
MOVE_DOWN = -1
|
|
|
|
}
|
|
|
|
move_t;
|
|
|
|
|
2012-01-28 18:55:40 +01:00
|
|
|
protected:
|
|
|
|
QList<QUuid> m_jobs;
|
2012-01-29 15:57:23 +01:00
|
|
|
QMap<QUuid, QString> m_name;
|
2012-01-28 18:55:40 +01:00
|
|
|
QMap<QUuid, EncodeThread*> m_threads;
|
2013-07-03 21:52:19 +02:00
|
|
|
QMap<QUuid, JobStatus> m_status;
|
2012-01-28 18:55:40 +01:00
|
|
|
QMap<QUuid, unsigned int> m_progress;
|
2012-01-28 19:59:04 +01:00
|
|
|
QMap<QUuid, LogFileModel*> m_logFile;
|
2012-01-28 23:24:41 +01:00
|
|
|
QMap<QUuid, QString> m_details;
|
2013-07-03 21:34:21 +02:00
|
|
|
PreferencesModel *m_preferences;
|
2012-01-28 18:55:40 +01:00
|
|
|
|
|
|
|
public slots:
|
2013-07-03 21:52:19 +02:00
|
|
|
void updateStatus(const QUuid &jobId, JobStatus newStatus);
|
2012-01-28 18:55:40 +01:00
|
|
|
void updateProgress(const QUuid &jobId, unsigned int newProgress);
|
2012-01-28 23:24:41 +01:00
|
|
|
void updateDetails(const QUuid &jobId, const QString &details);
|
2012-01-28 18:55:40 +01:00
|
|
|
};
|