1 ///////////////////////////////////////////////////////////////////////////////
2 // LameXP - Audio Encoder Front-End
3 // Copyright (C) 2004-2010 LoRd_MuldeR <MuldeR2@GMX.de>
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License along
16 // with this program; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 // http://www.gnu.org/licenses/gpl-2.0.txt
20 ///////////////////////////////////////////////////////////////////////////////
22 #include "Thread_Process.h"
25 #include "Model_Progress.h"
31 ////////////////////////////////////////////////////////////
33 ////////////////////////////////////////////////////////////
35 ProcessThread::ProcessThread(void)
36 : m_jobId(QUuid::createUuid()), m_aborted(false)
40 ProcessThread::~ProcessThread(void)
44 void ProcessThread::run()
48 qDebug("Process thread %s has started.", m_jobId.toString().toLatin1().constData());
49 emit processStateInitialized(m_jobId, "Slime - Der Tod Ist Ein Meister Aus Deutschland.mp3", "Starting...", ProgressModel::JobRunning);
51 QUuid uuid = QUuid::createUuid();
52 qsrand(uuid.data1 * uuid.data2 * uuid.data3 * uuid.data4[0] * uuid.data4[1] * uuid.data4[2] * uuid.data4[3] * uuid.data4[4] * uuid.data4[5] * uuid.data4[6] * uuid.data4[7]);
53 unsigned long delay = 250 + (qrand() % 500);
56 for(int i = 1; i <= 100; i++)
60 emit processStateChanged(m_jobId, "Aborted.", ProgressModel::JobFailed);
64 QThread::msleep(delay);
65 emit processStateChanged(m_jobId, QString("Encoding (%1%)").arg(i), ProgressModel::JobRunning);
68 emit processStateChanged(m_jobId, "Done (100%)", ProgressModel::JobComplete);
69 qDebug("Process thread is done.");
72 ////////////////////////////////////////////////////////////
74 ////////////////////////////////////////////////////////////