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;
43 class RAMObserverThread;
50 shutdownFlag_None = 0,
51 shutdownFlag_TurnPowerOff = 1,
52 shutdownFlag_Hibernate = 2
55 //UIC forward declartion
57 class ProcessingDialog;
60 //ProcessingDialog class
61 class ProcessingDialog : public QDialog
66 ProcessingDialog(FileListModel *fileListModel, const AudioFileModel_MetaInfo *metaInfo, SettingsModel *settings, QWidget *parent = 0);
67 ~ProcessingDialog(void);
69 int getShutdownFlag(void) { return m_shutdownFlag; }
72 void initEncoding(void);
73 void initNextJob(void);
74 void startNextJob(void);
75 void doneEncoding(void);
76 void abortEncoding(bool force = false);
77 void processFinished(const QUuid &jobId, const QString &outFileName, int success);
78 void progressModelChanged(void);
79 void logViewDoubleClicked(const QModelIndex &index);
80 void logViewSectionSizeChanged(int, int, int);
81 void contextMenuTriggered(const QPoint &pos);
82 void contextMenuDetailsActionTriggered(void);
83 void contextMenuShowFileActionTriggered(void);
84 void contextMenuFilterActionTriggered(void);
85 void systemTrayActivated(QSystemTrayIcon::ActivationReason reason);
86 void cpuUsageHasChanged(const double val);
87 void ramUsageHasChanged(const double val);
88 void diskUsageHasChanged(const quint64 val);
89 void progressViewFilterChanged(void);
92 void abortRunningTasks(void);
95 void showEvent(QShowEvent *event);
96 void closeEvent(QCloseEvent *event);
97 bool eventFilter(QObject *obj, QEvent *event);
98 virtual bool event(QEvent *e);
99 virtual bool winEvent(MSG *message, long *result);
100 virtual void resizeEvent(QResizeEvent *event);
103 Ui::ProcessingDialog *ui; //for Qt UIC
105 AudioFileModel updateMetaInfo(AudioFileModel &audioFile);
106 void writePlayList(void);
107 bool shutdownComputer(void);
108 QString time2text(const double timeVal) const;
110 lamexp_icon_t *m_windowIcon;
111 QThreadPool *m_threadPool;
112 QList<AudioFileModel> m_pendingJobs;
113 SettingsModel *m_settings;
114 const AudioFileModel_MetaInfo *const m_metaInfo;
115 QMovie *m_progressIndicator;
116 ProgressModel *m_progressModel;
117 QMap<QUuid,QString> m_playList;
118 QMenu *m_contextMenu;
119 QActionGroup *m_progressViewFilterGroup;
120 QLabel *m_filterInfoLabel;
121 QLabel *m_filterInfoLabelIcon;
122 unsigned int m_initThreads;
123 unsigned int m_runningThreads;
124 unsigned int m_currentFile;
125 QList<QUuid> m_allJobs;
126 QList<QUuid> m_succeededJobs;
127 QList<QUuid> m_failedJobs;
128 QList<QUuid> m_skippedJobs;
132 QSystemTrayIcon *m_systemTray;
134 CPUObserverThread *m_cpuObserver;
135 RAMObserverThread *m_ramObserver;
136 DiskObserverThread *m_diskObserver;
138 int m_progressViewFilter;
139 QColor *m_defaultColor;