Added progress model and processing thread classes.
This commit is contained in:
parent
b83d33f7b3
commit
3007977f0b
119
gui/win_main.ui
119
gui/win_main.ui
@ -6,26 +6,131 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>800</width>
|
<width>640</width>
|
||||||
<height>600</height>
|
<height>512</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Simple x264 Launcher</string>
|
<string>Simple x264 Launcher</string>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="centralwidget"/>
|
<widget class="QWidget" name="centralwidget">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QSplitter" name="splitter">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="childrenCollapsible">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<widget class="QTableView" name="jobsView">
|
||||||
|
<property name="selectionMode">
|
||||||
|
<enum>QAbstractItemView::SingleSelection</enum>
|
||||||
|
</property>
|
||||||
|
<property name="selectionBehavior">
|
||||||
|
<enum>QAbstractItemView::SelectRows</enum>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="cornerButtonEnabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<attribute name="horizontalHeaderVisible">
|
||||||
|
<bool>true</bool>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="horizontalHeaderHighlightSections">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="verticalHeaderVisible">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
<widget class="QListView" name="logView"/>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="buttonAddJob">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>128</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Add New Job</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../res/resources.qrc">
|
||||||
|
<normaloff>:/buttons/add.png</normaloff>:/buttons/add.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
<widget class="QMenuBar" name="menubar">
|
<widget class="QMenuBar" name="menubar">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>800</width>
|
<width>640</width>
|
||||||
<height>21</height>
|
<height>21</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
<widget class="QMenu" name="menuFile">
|
||||||
|
<property name="title">
|
||||||
|
<string>File</string>
|
||||||
|
</property>
|
||||||
|
<addaction name="actionExit"/>
|
||||||
|
</widget>
|
||||||
|
<addaction name="menuFile"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QStatusBar" name="statusbar"/>
|
<action name="actionExit">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../res/resources.qrc">
|
||||||
|
<normaloff>:/buttons/door_in.png</normaloff>:/buttons/door_in.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Exit</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources>
|
||||||
<connections/>
|
<include location="../res/resources.qrc"/>
|
||||||
|
</resources>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>actionExit</sender>
|
||||||
|
<signal>activated()</signal>
|
||||||
|
<receiver>MainWindow</receiver>
|
||||||
|
<slot>close()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>-1</x>
|
||||||
|
<y>-1</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>399</x>
|
||||||
|
<y>299</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
</ui>
|
</ui>
|
||||||
|
@ -2,5 +2,7 @@
|
|||||||
<RCC version="1.0">
|
<RCC version="1.0">
|
||||||
<qresource>
|
<qresource>
|
||||||
<file>icons/movie.ico</file>
|
<file>icons/movie.ico</file>
|
||||||
|
<file>buttons/add.png</file>
|
||||||
|
<file>buttons/door_in.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
//Qt includes
|
//Qt includes
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QDate>
|
#include <QDate>
|
||||||
|
#include <QPlastiqueStyle>
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Main function
|
// Main function
|
||||||
@ -67,10 +68,16 @@ static int x264_main(int argc, char* argv[])
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Run application
|
//Set style
|
||||||
|
qApp->setStyle(new QPlastiqueStyle());
|
||||||
|
|
||||||
|
//Create Main Window
|
||||||
MainWindow *mainWin = new MainWindow;
|
MainWindow *mainWin = new MainWindow;
|
||||||
mainWin->show();
|
mainWin->show();
|
||||||
|
|
||||||
|
//Run application
|
||||||
int ret = qApp->exec();
|
int ret = qApp->exec();
|
||||||
|
|
||||||
X264_DELETE(mainWin);
|
X264_DELETE(mainWin);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
185
src/model_jobList.cpp
Normal file
185
src/model_jobList.cpp
Normal file
@ -0,0 +1,185 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Simple x264 Launcher
|
||||||
|
// Copyright (C) 2004-2012 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
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "model_jobList.h"
|
||||||
|
#include "thread_encode.h"
|
||||||
|
|
||||||
|
JobListModel::JobListModel(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
JobListModel::~JobListModel(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Model interface
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
int JobListModel::columnCount(const QModelIndex &parent) const
|
||||||
|
{
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
int JobListModel::rowCount(const QModelIndex &parent) const
|
||||||
|
{
|
||||||
|
return m_jobs.count();
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariant JobListModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||||
|
{
|
||||||
|
if((orientation == Qt::Horizontal) && (role == Qt::DisplayRole))
|
||||||
|
{
|
||||||
|
switch(section)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
return QVariant::fromValue<QString>(tr("Job"));
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
return QVariant::fromValue<QString>(tr("Status"));
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
return QVariant::fromValue<QString>(tr("Progress"));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return QVariant();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return QVariant();
|
||||||
|
}
|
||||||
|
|
||||||
|
QModelIndex JobListModel::index(int row, int column, const QModelIndex &parent) const
|
||||||
|
{
|
||||||
|
return createIndex(row, column, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
QModelIndex JobListModel::parent(const QModelIndex &index) const
|
||||||
|
{
|
||||||
|
return QModelIndex();
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariant JobListModel::data(const QModelIndex &index, int role) const
|
||||||
|
{
|
||||||
|
if(role == Qt::DisplayRole)
|
||||||
|
{
|
||||||
|
if(index.row() >= 0 && index.row() < m_jobs.count())
|
||||||
|
{
|
||||||
|
switch(index.column())
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
return m_jobs.at(index.row()).toString();
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
switch(m_status.value(m_jobs.at(index.row())))
|
||||||
|
{
|
||||||
|
case EncodeThread::JobStatus_Starting:
|
||||||
|
return QVariant::fromValue<QString>(tr("Starting..."));
|
||||||
|
break;
|
||||||
|
case EncodeThread::JobStatus_Indexing:
|
||||||
|
return QVariant::fromValue<QString>(tr("Indexing..."));
|
||||||
|
break;
|
||||||
|
case EncodeThread::JobStatus_Running:
|
||||||
|
return QVariant::fromValue<QString>(tr("Running..."));
|
||||||
|
break;
|
||||||
|
case EncodeThread::JobStatus_Completed:
|
||||||
|
return QVariant::fromValue<QString>(tr("Completed."));
|
||||||
|
break;
|
||||||
|
case EncodeThread::JobStatus_Failed:
|
||||||
|
return QVariant::fromValue<QString>(tr("Failed!"));
|
||||||
|
break;
|
||||||
|
case EncodeThread::JobStatus_Aborted:
|
||||||
|
return QVariant::fromValue<QString>(tr("Aborted!"));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return QVariant::fromValue<QString>(tr("(Unknown)"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
return QString().sprintf("%d%%", m_progress.value(m_jobs.at(index.row())));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return QVariant();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return QVariant();
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Public interface
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
bool JobListModel::insertJob(EncodeThread *thread)
|
||||||
|
{
|
||||||
|
QUuid id = thread->getId();
|
||||||
|
|
||||||
|
if(m_jobs.contains(id))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
beginInsertRows(QModelIndex(), m_jobs.count(), m_jobs.count());
|
||||||
|
m_jobs.append(id);
|
||||||
|
m_status.insert(id, EncodeThread::JobStatus_Starting);
|
||||||
|
m_progress.insert(id, 0);
|
||||||
|
m_threads.insert(id, thread);
|
||||||
|
endInsertRows();
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Slots
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void JobListModel::updateStatus(const QUuid &jobId, EncodeThread::JobStatus newStatus)
|
||||||
|
{
|
||||||
|
int index = -1;
|
||||||
|
|
||||||
|
if((index = m_jobs.indexOf(jobId)) >= 0)
|
||||||
|
{
|
||||||
|
m_status.insert(jobId, newStatus);
|
||||||
|
emit dataChanged(createIndex(index, 1), createIndex(index, 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void JobListModel::updateProgress(const QUuid &jobId, unsigned int newProgress)
|
||||||
|
{
|
||||||
|
int index = -1;
|
||||||
|
|
||||||
|
if((index = m_jobs.indexOf(jobId)) >= 0)
|
||||||
|
{
|
||||||
|
m_progress.insert(jobId, newProgress);
|
||||||
|
emit dataChanged(createIndex(index, 2), createIndex(index, 2));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void JobListModel::addLogMessage(const QUuid &jobId, const QString &text)
|
||||||
|
{
|
||||||
|
}
|
58
src/model_jobList.h
Normal file
58
src/model_jobList.h
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Simple x264 Launcher
|
||||||
|
// Copyright (C) 2004-2012 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
|
||||||
|
|
||||||
|
#include "thread_encode.h"
|
||||||
|
|
||||||
|
#include "QAbstractItemModel"
|
||||||
|
#include <QUuid>
|
||||||
|
#include <QList>
|
||||||
|
#include <QMap>
|
||||||
|
|
||||||
|
class JobListModel : public QAbstractItemModel
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
JobListModel(void);
|
||||||
|
~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;
|
||||||
|
|
||||||
|
bool JobListModel::insertJob(EncodeThread *thread);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
QList<QUuid> m_jobs;
|
||||||
|
QMap<QUuid, EncodeThread*> m_threads;
|
||||||
|
QMap<QUuid, EncodeThread::JobStatus> m_status;
|
||||||
|
QMap<QUuid, unsigned int> m_progress;
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void updateStatus(const QUuid &jobId, EncodeThread::JobStatus newStatus);
|
||||||
|
void updateProgress(const QUuid &jobId, unsigned int newProgress);
|
||||||
|
void addLogMessage(const QUuid &jobId, const QString &text);
|
||||||
|
};
|
40
src/thread_encode.cpp
Normal file
40
src/thread_encode.cpp
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Simple x264 Launcher
|
||||||
|
// Copyright (C) 2004-2012 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
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "thread_encode.h"
|
||||||
|
|
||||||
|
EncodeThread::EncodeThread(void)
|
||||||
|
:
|
||||||
|
m_jobId(QUuid::createUuid())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
EncodeThread::~EncodeThread(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Thread entry point
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void EncodeThread::run(void)
|
||||||
|
{
|
||||||
|
}
|
57
src/thread_encode.h
Normal file
57
src/thread_encode.h
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Simple x264 Launcher
|
||||||
|
// Copyright (C) 2004-2012 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
|
||||||
|
|
||||||
|
#include <QThread>
|
||||||
|
#include <QUuid>
|
||||||
|
|
||||||
|
class EncodeThread : public QThread
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
enum JobStatus
|
||||||
|
{
|
||||||
|
JobStatus_Starting = 0,
|
||||||
|
JobStatus_Indexing = 1,
|
||||||
|
JobStatus_Running = 2,
|
||||||
|
JobStatus_Completed = 3,
|
||||||
|
JobStatus_Failed = 4,
|
||||||
|
JobStatus_Aborted = 5
|
||||||
|
};
|
||||||
|
|
||||||
|
EncodeThread(void);
|
||||||
|
~EncodeThread(void);
|
||||||
|
|
||||||
|
QUuid getId(void) { return this->m_jobId; };
|
||||||
|
|
||||||
|
protected:
|
||||||
|
const QUuid m_jobId;
|
||||||
|
|
||||||
|
virtual void run(void);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void statusChanged(const QUuid &jobId, EncodeThread::JobStatus newStatus);
|
||||||
|
void progressChanged(const QUuid &jobId, unsigned int newProgress);
|
||||||
|
void messageLogged(const QUuid &jobId, const QString &text);
|
||||||
|
};
|
||||||
|
|
@ -20,7 +20,11 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "win_main.h"
|
#include "win_main.h"
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
#include "model_jobList.h"
|
||||||
|
|
||||||
|
#include <QDate>
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Constructor & Destructor
|
// Constructor & Destructor
|
||||||
@ -31,8 +35,45 @@ MainWindow::MainWindow(void)
|
|||||||
//Init the dialog, from the .ui file
|
//Init the dialog, from the .ui file
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
setWindowFlags(windowFlags() ^ Qt::WindowMaximizeButtonHint);
|
setWindowFlags(windowFlags() ^ Qt::WindowMaximizeButtonHint);
|
||||||
|
|
||||||
|
//Register meta types
|
||||||
|
qRegisterMetaType<QUuid>("QUuid");
|
||||||
|
qRegisterMetaType<EncodeThread::JobStatus>("EncodeThread::JobStatus");
|
||||||
|
|
||||||
|
//Freeze minimum size
|
||||||
|
setMinimumSize(size());
|
||||||
|
|
||||||
|
//Show version
|
||||||
|
setWindowTitle(QString("%1 [%2]").arg(windowTitle(), x264_version_date().toString(Qt::ISODate)));
|
||||||
|
|
||||||
|
//Create model
|
||||||
|
m_jobList = new JobListModel();
|
||||||
|
jobsView->setModel(m_jobList);
|
||||||
|
|
||||||
|
//Setup view
|
||||||
|
jobsView->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);
|
||||||
|
jobsView->horizontalHeader()->setResizeMode(1, QHeaderView::Fixed);
|
||||||
|
jobsView->horizontalHeader()->setResizeMode(2, QHeaderView::Fixed);
|
||||||
|
jobsView->horizontalHeader()->resizeSection(1, 150);
|
||||||
|
jobsView->horizontalHeader()->resizeSection(2, 90);
|
||||||
|
jobsView->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
|
||||||
|
|
||||||
|
//Enable buttons
|
||||||
|
connect(buttonAddJob, SIGNAL(clicked()), this, SLOT(addButtonPressed()));
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow(void)
|
MainWindow::~MainWindow(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Slots
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void MainWindow::addButtonPressed(void)
|
||||||
|
{
|
||||||
|
qWarning("Yeah!");
|
||||||
|
|
||||||
|
EncodeThread *thrd = new EncodeThread();
|
||||||
|
m_jobList->insertJob(thrd);
|
||||||
|
}
|
||||||
|
@ -23,6 +23,8 @@
|
|||||||
|
|
||||||
#include "uic_win_main.h"
|
#include "uic_win_main.h"
|
||||||
|
|
||||||
|
class JobListModel;
|
||||||
|
|
||||||
class MainWindow: public QMainWindow, private Ui::MainWindow
|
class MainWindow: public QMainWindow, private Ui::MainWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -30,4 +32,10 @@ class MainWindow: public QMainWindow, private Ui::MainWindow
|
|||||||
public:
|
public:
|
||||||
MainWindow();
|
MainWindow();
|
||||||
~MainWindow(void);
|
~MainWindow(void);
|
||||||
|
|
||||||
|
private:
|
||||||
|
JobListModel *m_jobList;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void addButtonPressed(void);
|
||||||
};
|
};
|
||||||
|
@ -112,7 +112,23 @@
|
|||||||
</CustomBuild>
|
</CustomBuild>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<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)'=='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)'=='Release|Win32'">MOC "$(SolutionDir)tmp\MOC_%(Filename).cpp"</Message>
|
||||||
|
<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>
|
||||||
|
</CustomBuild>
|
||||||
<ClInclude Include="src\global.h" />
|
<ClInclude Include="src\global.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)'=='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)'=='Release|Win32'">MOC "$(SolutionDir)tmp\MOC_%(Filename).cpp"</Message>
|
||||||
|
<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>
|
||||||
|
</CustomBuild>
|
||||||
<ClInclude Include="src\targetver.h" />
|
<ClInclude Include="src\targetver.h" />
|
||||||
<ClInclude Include="src\version.h" />
|
<ClInclude Include="src\version.h" />
|
||||||
<CustomBuild Include="src\win_main.h">
|
<CustomBuild Include="src\win_main.h">
|
||||||
@ -125,9 +141,13 @@
|
|||||||
</CustomBuild>
|
</CustomBuild>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClCompile Include="src\model_jobList.cpp" />
|
||||||
|
<ClCompile Include="src\thread_encode.cpp" />
|
||||||
<ClCompile Include="src\global.cpp" />
|
<ClCompile Include="src\global.cpp" />
|
||||||
<ClCompile Include="src\main.cpp" />
|
<ClCompile Include="src\main.cpp" />
|
||||||
<ClCompile Include="src\win_main.cpp" />
|
<ClCompile Include="src\win_main.cpp" />
|
||||||
|
<ClCompile Include="tmp\moc\moc_model_jobList.cpp" />
|
||||||
|
<ClCompile Include="tmp\moc\moc_thread_encode.cpp" />
|
||||||
<ClCompile Include="tmp\moc\moc_win_main.cpp" />
|
<ClCompile Include="tmp\moc\moc_win_main.cpp" />
|
||||||
<ClCompile Include="tmp\qrc\qrc_resources.cpp" />
|
<ClCompile Include="tmp\qrc\qrc_resources.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -50,6 +50,18 @@
|
|||||||
<ClCompile Include="tmp\qrc\qrc_resources.cpp">
|
<ClCompile Include="tmp\qrc\qrc_resources.cpp">
|
||||||
<Filter>Generated Files</Filter>
|
<Filter>Generated Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="src\thread_encode.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="tmp\moc\moc_thread_encode.cpp">
|
||||||
|
<Filter>Generated Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="src\model_jobList.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="tmp\moc\moc_model_jobList.cpp">
|
||||||
|
<Filter>Generated Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<CustomBuild Include="gui\win_main.ui">
|
<CustomBuild Include="gui\win_main.ui">
|
||||||
@ -61,5 +73,11 @@
|
|||||||
<CustomBuild Include="res\resources.qrc">
|
<CustomBuild Include="res\resources.qrc">
|
||||||
<Filter>Resource Files</Filter>
|
<Filter>Resource Files</Filter>
|
||||||
</CustomBuild>
|
</CustomBuild>
|
||||||
|
<CustomBuild Include="src\thread_encode.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</CustomBuild>
|
||||||
|
<CustomBuild Include="src\model_jobList.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</CustomBuild>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
Loading…
Reference in New Issue
Block a user