2010-11-17 19:35:50 +01:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// LameXP - Audio Encoder Front-End
|
2014-01-01 17:05:52 +01:00
|
|
|
// Copyright (C) 2004-2014 LoRd_MuldeR <MuldeR2@GMX.de>
|
2010-11-17 19:35:50 +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
|
2013-10-23 20:56:57 +02:00
|
|
|
// (at your option) any later version, but always including the *additional*
|
|
|
|
// restrictions defined in the "License.txt" file.
|
2010-11-17 19:35:50 +01:00
|
|
|
//
|
|
|
|
// 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
|
|
|
|
|
2012-12-08 00:21:10 +01:00
|
|
|
#include <QDialog>
|
2010-11-20 22:14:10 +01:00
|
|
|
#include <QUuid>
|
2010-12-10 22:17:44 +01:00
|
|
|
#include <QSystemTrayIcon>
|
2012-12-08 00:21:10 +01:00
|
|
|
#include <QMap>
|
2010-11-20 22:14:10 +01:00
|
|
|
|
2012-12-08 00:21:10 +01:00
|
|
|
class AbstractEncoder;
|
2010-11-19 21:11:54 +01:00
|
|
|
class AudioFileModel;
|
2013-10-13 00:21:37 +02:00
|
|
|
class AudioFileModel_MetaInfo;
|
2011-10-29 16:26:09 +02:00
|
|
|
class CPUObserverThread;
|
2011-03-28 04:26:47 +02:00
|
|
|
class DiskObserverThread;
|
2012-12-08 00:21:10 +01:00
|
|
|
class FileListModel;
|
|
|
|
class ProcessThread;
|
|
|
|
class ProgressModel;
|
|
|
|
class QActionGroup;
|
|
|
|
class QLabel;
|
|
|
|
class QMenu;
|
|
|
|
class QModelIndex;
|
|
|
|
class QMovie;
|
2014-12-06 15:54:58 +01:00
|
|
|
class QThreadPool;
|
|
|
|
class QElapsedTimer;
|
2012-12-08 00:21:10 +01:00
|
|
|
class RAMObserverThread;
|
|
|
|
class SettingsModel;
|
2010-11-17 19:35:50 +01:00
|
|
|
|
2014-12-14 19:33:28 +01:00
|
|
|
enum lamexp_shutdownFlag_t
|
2011-10-22 01:13:28 +02:00
|
|
|
{
|
2014-12-14 19:33:28 +01:00
|
|
|
SHUTDOWN_FLAG_NONE = 0,
|
|
|
|
SHUTDOWN_FLAG_POWER_OFF = 1,
|
|
|
|
SHUTDOWN_FLAG_HIBERNATE = 2
|
2011-10-22 01:13:28 +02:00
|
|
|
};
|
|
|
|
|
2012-12-08 00:21:10 +01:00
|
|
|
//UIC forward declartion
|
2014-12-18 22:49:37 +01:00
|
|
|
namespace Ui
|
|
|
|
{
|
2012-12-08 00:21:10 +01:00
|
|
|
class ProcessingDialog;
|
|
|
|
}
|
|
|
|
|
2014-12-18 22:49:37 +01:00
|
|
|
//MUtils forward declartion
|
|
|
|
namespace MUtils
|
|
|
|
{
|
|
|
|
class Taskbar7;
|
|
|
|
}
|
|
|
|
|
2012-12-08 00:21:10 +01:00
|
|
|
//ProcessingDialog class
|
|
|
|
class ProcessingDialog : public QDialog
|
2010-11-17 19:35:50 +01:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2013-10-13 00:21:37 +02:00
|
|
|
ProcessingDialog(FileListModel *fileListModel, const AudioFileModel_MetaInfo *metaInfo, SettingsModel *settings, QWidget *parent = 0);
|
2010-11-17 19:35:50 +01:00
|
|
|
~ProcessingDialog(void);
|
2011-03-18 01:12:17 +01:00
|
|
|
|
2011-10-22 01:13:28 +02:00
|
|
|
int getShutdownFlag(void) { return m_shutdownFlag; }
|
2010-11-17 19:35:50 +01:00
|
|
|
|
2010-11-18 00:32:46 +01:00
|
|
|
private slots:
|
|
|
|
void initEncoding(void);
|
2013-11-25 18:34:59 +01:00
|
|
|
void initNextJob(void);
|
2013-10-12 20:34:59 +02:00
|
|
|
void startNextJob(void);
|
2010-11-18 00:32:46 +01:00
|
|
|
void doneEncoding(void);
|
2011-12-29 14:42:20 +01:00
|
|
|
void abortEncoding(bool force = false);
|
2012-11-11 18:33:55 +01:00
|
|
|
void processFinished(const QUuid &jobId, const QString &outFileName, int success);
|
2010-11-21 21:51:22 +01:00
|
|
|
void progressModelChanged(void);
|
2010-11-22 21:45:00 +01:00
|
|
|
void logViewDoubleClicked(const QModelIndex &index);
|
2011-08-23 17:01:11 +02:00
|
|
|
void logViewSectionSizeChanged(int, int, int);
|
2010-11-24 21:00:59 +01:00
|
|
|
void contextMenuTriggered(const QPoint &pos);
|
2011-02-11 23:16:11 +01:00
|
|
|
void contextMenuDetailsActionTriggered(void);
|
|
|
|
void contextMenuShowFileActionTriggered(void);
|
2012-11-11 18:33:55 +01:00
|
|
|
void contextMenuFilterActionTriggered(void);
|
2010-12-10 22:17:44 +01:00
|
|
|
void systemTrayActivated(QSystemTrayIcon::ActivationReason reason);
|
2011-10-29 16:26:09 +02:00
|
|
|
void cpuUsageHasChanged(const double val);
|
|
|
|
void ramUsageHasChanged(const double val);
|
|
|
|
void diskUsageHasChanged(const quint64 val);
|
2012-11-11 18:33:55 +01:00
|
|
|
void progressViewFilterChanged(void);
|
2010-11-18 00:32:46 +01:00
|
|
|
|
2013-10-09 03:14:38 +02:00
|
|
|
signals:
|
|
|
|
void abortRunningTasks(void);
|
|
|
|
|
2010-11-18 00:32:46 +01:00
|
|
|
protected:
|
|
|
|
void showEvent(QShowEvent *event);
|
|
|
|
void closeEvent(QCloseEvent *event);
|
|
|
|
bool eventFilter(QObject *obj, QEvent *event);
|
2011-12-29 14:42:20 +01:00
|
|
|
virtual bool event(QEvent *e);
|
2012-11-15 18:06:04 +01:00
|
|
|
virtual void resizeEvent(QResizeEvent *event);
|
2010-11-18 00:32:46 +01:00
|
|
|
|
2010-11-17 19:35:50 +01:00
|
|
|
private:
|
2012-12-08 00:21:10 +01:00
|
|
|
Ui::ProcessingDialog *ui; //for Qt UIC
|
|
|
|
|
2013-10-12 22:55:41 +02:00
|
|
|
AudioFileModel updateMetaInfo(AudioFileModel &audioFile);
|
2010-11-20 22:14:10 +01:00
|
|
|
void writePlayList(void);
|
2011-03-18 12:37:18 +01:00
|
|
|
bool shutdownComputer(void);
|
2014-12-06 15:54:58 +01:00
|
|
|
QString time2text(const qint64 &msec) const;
|
2010-11-18 00:32:46 +01:00
|
|
|
|
2013-10-09 03:14:38 +02:00
|
|
|
QThreadPool *m_threadPool;
|
2010-11-19 21:11:54 +01:00
|
|
|
QList<AudioFileModel> m_pendingJobs;
|
2010-11-20 02:14:22 +01:00
|
|
|
SettingsModel *m_settings;
|
2013-10-13 00:21:37 +02:00
|
|
|
const AudioFileModel_MetaInfo *const m_metaInfo;
|
2010-11-17 19:35:50 +01:00
|
|
|
QMovie *m_progressIndicator;
|
2010-11-18 00:32:46 +01:00
|
|
|
ProgressModel *m_progressModel;
|
2010-12-10 21:24:42 +01:00
|
|
|
QMap<QUuid,QString> m_playList;
|
2010-11-24 21:00:59 +01:00
|
|
|
QMenu *m_contextMenu;
|
2012-11-11 18:33:55 +01:00
|
|
|
QActionGroup *m_progressViewFilterGroup;
|
2012-11-15 18:06:04 +01:00
|
|
|
QLabel *m_filterInfoLabel;
|
2012-11-17 19:26:55 +01:00
|
|
|
QLabel *m_filterInfoLabelIcon;
|
2013-11-25 18:34:59 +01:00
|
|
|
unsigned int m_initThreads;
|
2010-11-19 21:11:54 +01:00
|
|
|
unsigned int m_runningThreads;
|
2010-11-20 19:16:04 +01:00
|
|
|
unsigned int m_currentFile;
|
2010-12-10 21:24:42 +01:00
|
|
|
QList<QUuid> m_allJobs;
|
|
|
|
QList<QUuid> m_succeededJobs;
|
|
|
|
QList<QUuid> m_failedJobs;
|
2012-11-11 18:33:55 +01:00
|
|
|
QList<QUuid> m_skippedJobs;
|
2010-11-19 21:11:54 +01:00
|
|
|
bool m_userAborted;
|
2011-12-29 14:42:20 +01:00
|
|
|
bool m_forcedAbort;
|
2012-04-11 00:44:40 +02:00
|
|
|
bool m_firstShow;
|
2010-12-10 22:17:44 +01:00
|
|
|
QSystemTrayIcon *m_systemTray;
|
2011-10-22 01:13:28 +02:00
|
|
|
int m_shutdownFlag;
|
2011-10-29 16:26:09 +02:00
|
|
|
CPUObserverThread *m_cpuObserver;
|
|
|
|
RAMObserverThread *m_ramObserver;
|
2011-03-28 04:26:47 +02:00
|
|
|
DiskObserverThread *m_diskObserver;
|
2014-12-06 15:54:58 +01:00
|
|
|
QScopedPointer<QElapsedTimer> m_totalTime;
|
2012-11-11 18:33:55 +01:00
|
|
|
int m_progressViewFilter;
|
2014-05-04 16:59:06 +02:00
|
|
|
QColor *m_defaultColor;
|
2014-12-18 22:49:37 +01:00
|
|
|
QScopedPointer<MUtils::Taskbar7> m_taskbar;
|
2010-11-17 19:35:50 +01:00
|
|
|
};
|