1 ///////////////////////////////////////////////////////////////////////////////
2 // LameXP - Audio Encoder Front-End
3 // Copyright (C) 2004-2014 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, but always including the *additional*
9 // restrictions defined in the "License.txt" file.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with this program; if not, write to the Free Software Foundation, Inc.,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 // http://www.gnu.org/licenses/gpl-2.0.txt
21 ///////////////////////////////////////////////////////////////////////////////
27 #include <QSystemTrayIcon>
30 class AbstractEncoder;
32 class AudioFileModel_MetaInfo;
33 class CPUObserverThread;
34 class DiskObserverThread;
45 class RAMObserverThread;
48 enum lamexp_shutdownFlag_t
50 SHUTDOWN_FLAG_NONE = 0,
51 SHUTDOWN_FLAG_POWER_OFF = 1,
52 SHUTDOWN_FLAG_HIBERNATE = 2
55 //UIC forward declartion
58 class ProcessingDialog;
61 //MUtils forward declartion
67 //ProcessingDialog class
68 class ProcessingDialog : public QDialog
73 ProcessingDialog(FileListModel *fileListModel, const AudioFileModel_MetaInfo *metaInfo, SettingsModel *settings, QWidget *parent = 0);
74 ~ProcessingDialog(void);
76 int getShutdownFlag(void) { return m_shutdownFlag; }
79 void initEncoding(void);
80 void initNextJob(void);
81 void startNextJob(void);
82 void doneEncoding(void);
83 void abortEncoding(bool force = false);
84 void processFinished(const QUuid &jobId, const QString &outFileName, int success);
85 void progressModelChanged(void);
86 void logViewDoubleClicked(const QModelIndex &index);
87 void logViewSectionSizeChanged(int, int, int);
88 void contextMenuTriggered(const QPoint &pos);
89 void contextMenuDetailsActionTriggered(void);
90 void contextMenuShowFileActionTriggered(void);
91 void contextMenuFilterActionTriggered(void);
92 void systemTrayActivated(QSystemTrayIcon::ActivationReason reason);
93 void cpuUsageHasChanged(const double val);
94 void ramUsageHasChanged(const double val);
95 void diskUsageHasChanged(const quint64 val);
96 void progressViewFilterChanged(void);
99 void abortRunningTasks(void);
102 void showEvent(QShowEvent *event);
103 void closeEvent(QCloseEvent *event);
104 bool eventFilter(QObject *obj, QEvent *event);
105 virtual bool event(QEvent *e);
106 virtual void resizeEvent(QResizeEvent *event);
109 Ui::ProcessingDialog *ui; //for Qt UIC
111 AudioFileModel updateMetaInfo(AudioFileModel &audioFile);
112 void writePlayList(void);
113 bool shutdownComputer(void);
114 QString time2text(const qint64 &msec) const;
116 QThreadPool *m_threadPool;
117 QList<AudioFileModel> m_pendingJobs;
118 SettingsModel *m_settings;
119 const AudioFileModel_MetaInfo *const m_metaInfo;
120 QMovie *m_progressIndicator;
121 ProgressModel *m_progressModel;
122 QMap<QUuid,QString> m_playList;
123 QMenu *m_contextMenu;
124 QActionGroup *m_progressViewFilterGroup;
125 QLabel *m_filterInfoLabel;
126 QLabel *m_filterInfoLabelIcon;
127 unsigned int m_initThreads;
128 unsigned int m_runningThreads;
129 unsigned int m_currentFile;
130 QList<QUuid> m_allJobs;
131 QList<QUuid> m_succeededJobs;
132 QList<QUuid> m_failedJobs;
133 QList<QUuid> m_skippedJobs;
137 QSystemTrayIcon *m_systemTray;
139 CPUObserverThread *m_cpuObserver;
140 RAMObserverThread *m_ramObserver;
141 DiskObserverThread *m_diskObserver;
142 QScopedPointer<QElapsedTimer> m_totalTime;
143 int m_progressViewFilter;
144 QColor *m_defaultColor;
145 QScopedPointer<MUtils::Taskbar7> m_taskbar;