1 ///////////////////////////////////////////////////////////////////////////////
2 // LameXP - Audio Encoder Front-End
3 // Copyright (C) 2004-2016 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
;
49 enum lamexp_shutdownFlag_t
51 SHUTDOWN_FLAG_NONE
= 0,
52 SHUTDOWN_FLAG_POWER_OFF
= 1,
53 SHUTDOWN_FLAG_HIBERNATE
= 2
56 //UIC forward declartion
59 class ProcessingDialog
;
62 //MUtils forward declartion
68 //ProcessingDialog class
69 class ProcessingDialog
: public QDialog
74 ProcessingDialog(FileListModel
*const fileListModel
, const AudioFileModel_MetaInfo
*const metaInfo
, const SettingsModel
*const settings
, QWidget
*const parent
= 0);
75 ~ProcessingDialog(void);
77 int getShutdownFlag(void) { return m_shutdownFlag
; }
80 void initEncoding(void);
81 void initNextJob(void);
82 void startNextJob(void);
83 void doneEncoding(void);
84 void abortEncoding(bool force
= false);
85 void processFinished(const QUuid
&jobId
, const QString
&outFileName
, int success
);
86 void progressModelChanged(void);
87 void logViewDoubleClicked(const QModelIndex
&index
);
88 void logViewSectionSizeChanged(int, int, int);
89 void contextMenuTriggered(const QPoint
&pos
);
90 void contextMenuDetailsActionTriggered(void);
91 void contextMenuShowFileActionTriggered(void);
92 void contextMenuFilterActionTriggered(void);
93 void systemTrayActivated(QSystemTrayIcon::ActivationReason reason
);
94 void cpuUsageHasChanged(const double val
);
95 void ramUsageHasChanged(const double val
);
96 void diskUsageHasChanged(const quint64 val
);
97 void progressViewFilterChanged(void);
100 void abortRunningTasks(void);
103 void showEvent(QShowEvent
*event
);
104 void closeEvent(QCloseEvent
*event
);
105 bool eventFilter(QObject
*obj
, QEvent
*event
);
106 virtual bool event(QEvent
*e
);
107 virtual void resizeEvent(QResizeEvent
*event
);
110 Ui::ProcessingDialog
*ui
; //for Qt UIC
112 AudioFileModel
updateMetaInfo(AudioFileModel
&audioFile
);
113 void writePlayList(void);
114 bool shutdownComputer(void);
115 QString
time2text(const qint64
&msec
) const;
117 QScopedPointer
<QThreadPool
> m_threadPool
;
118 QList
<AudioFileModel
> m_pendingJobs
;
119 const SettingsModel
*const m_settings
;
120 const AudioFileModel_MetaInfo
*const m_metaInfo
;
121 QScopedPointer
<QMovie
> m_progressIndicator
;
122 QScopedPointer
<ProgressModel
> m_progressModel
;
123 QMap
<QUuid
,QString
> m_playList
;
124 QScopedPointer
<QMenu
> m_contextMenu
;
125 QScopedPointer
<QActionGroup
> m_progressViewFilterGroup
;
126 QScopedPointer
<QLabel
> m_filterInfoLabel
;
127 QScopedPointer
<QLabel
> m_filterInfoLabelIcon
;
128 unsigned int m_initThreads
;
129 unsigned int m_runningThreads
;
130 unsigned int m_currentFile
;
131 QList
<QUuid
> m_allJobs
;
132 QList
<QUuid
> m_succeededJobs
;
133 QList
<QUuid
> m_failedJobs
;
134 QList
<QUuid
> m_skippedJobs
;
138 QScopedPointer
<QSystemTrayIcon
> m_systemTray
;
140 QScopedPointer
<CPUObserverThread
> m_cpuObserver
;
141 QScopedPointer
<RAMObserverThread
> m_ramObserver
;
142 QScopedPointer
<DiskObserverThread
> m_diskObserver
;
143 QScopedPointer
<QElapsedTimer
> m_totalTime
;
144 int m_progressViewFilter
;
145 QScopedPointer
<QColor
> m_defaultColor
;
146 QScopedPointer
<FileExtsModel
> m_fileExts
;
147 QScopedPointer
<MUtils::Taskbar7
> m_taskbar
;