1 ///////////////////////////////////////////////////////////////////////////////
2 // LameXP - Audio Encoder Front-End
3 // Copyright (C) 2004-2017 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 QThreadPool
*createThreadPool(void);
113 AudioFileModel
updateMetaInfo(AudioFileModel
&audioFile
);
114 void writePlayList(void);
115 bool shutdownComputer(void);
117 QScopedPointer
<QThreadPool
> m_threadPool
;
118 QList
<AudioFileModel
> m_pendingJobs
;
119 const SettingsModel
*const m_settings
;
120 const AudioFileModel_MetaInfo
*const m_metaInfo
;
121 const QString m_tempFolder
;
122 QScopedPointer
<QMovie
> m_progressIndicator
;
123 QScopedPointer
<ProgressModel
> m_progressModel
;
124 QMap
<QUuid
,QString
> m_playList
;
125 QScopedPointer
<QMenu
> m_contextMenu
;
126 QScopedPointer
<QActionGroup
> m_progressViewFilterGroup
;
127 QScopedPointer
<QLabel
> m_filterInfoLabel
;
128 QScopedPointer
<QLabel
> m_filterInfoLabelIcon
;
129 unsigned int m_initThreads
;
130 unsigned int m_runningThreads
;
131 unsigned int m_currentFile
;
132 QList
<QUuid
> m_allJobs
;
133 QList
<QUuid
> m_succeededJobs
;
134 QList
<QUuid
> m_failedJobs
;
135 QList
<QUuid
> m_skippedJobs
;
139 QScopedPointer
<QSystemTrayIcon
> m_systemTray
;
141 QScopedPointer
<CPUObserverThread
> m_cpuObserver
;
142 QScopedPointer
<RAMObserverThread
> m_ramObserver
;
143 QScopedPointer
<DiskObserverThread
> m_diskObserver
;
144 QScopedPointer
<QElapsedTimer
> m_totalTime
;
145 int m_progressViewFilter
;
146 QScopedPointer
<QColor
> m_defaultColor
;
147 QScopedPointer
<FileExtsModel
> m_fileExts
;
148 QScopedPointer
<MUtils::Taskbar7
> m_taskbar
;
150 static bool isFastSeekingDevice(const QString
&path
);
151 static quint32
cores2instances(const quint32
&cores
);
152 static QString
time2text(const qint64
&msec
);