1 ///////////////////////////////////////////////////////////////////////////////
2 // LameXP - Audio Encoder Front-End
3 // Copyright (C) 2004-2012 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.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License along
16 // with this program; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 // http://www.gnu.org/licenses/gpl-2.0.txt
20 ///////////////////////////////////////////////////////////////////////////////
24 #include "../tmp/UIC_ProcessingDialog.h"
27 #include <QSystemTrayIcon>
36 class CPUObserverThread
;
37 class RAMObserverThread
;
38 class DiskObserverThread
;
39 class AbstractEncoder
;
43 shutdownFlag_None
= 0,
44 shutdownFlag_TurnPowerOff
= 1,
45 shutdownFlag_Hibernate
= 2
48 class ProcessingDialog
: public QDialog
, private Ui::ProcessingDialog
53 ProcessingDialog(FileListModel
*fileListModel
, AudioFileModel
*metaInfo
, SettingsModel
*settings
, QWidget
*parent
= 0);
54 ~ProcessingDialog(void);
56 int getShutdownFlag(void) { return m_shutdownFlag
; }
59 void initEncoding(void);
60 void doneEncoding(void);
61 void abortEncoding(bool force
= false);
62 void processFinished(const QUuid
&jobId
, const QString
&outFileName
, bool success
);
63 void progressModelChanged(void);
64 void logViewDoubleClicked(const QModelIndex
&index
);
65 void logViewSectionSizeChanged(int, int, int);
66 void contextMenuTriggered(const QPoint
&pos
);
67 void contextMenuDetailsActionTriggered(void);
68 void contextMenuShowFileActionTriggered(void);
69 void systemTrayActivated(QSystemTrayIcon::ActivationReason reason
);
70 void cpuUsageHasChanged(const double val
);
71 void ramUsageHasChanged(const double val
);
72 void diskUsageHasChanged(const quint64 val
);
75 void showEvent(QShowEvent
*event
);
76 void closeEvent(QCloseEvent
*event
);
77 bool eventFilter(QObject
*obj
, QEvent
*event
);
78 virtual bool event(QEvent
*e
);
79 virtual bool winEvent(MSG
*message
, long *result
);
82 void setCloseButtonEnabled(bool enabled
);
83 void startNextJob(void);
84 AbstractEncoder
*makeEncoder(bool *nativeResampling
);
85 AudioFileModel
updateMetaInfo(const AudioFileModel
&audioFile
);
86 void writePlayList(void);
87 bool shutdownComputer(void);
88 QString
time2text(const double timeVal
) const;
90 QList
<AudioFileModel
> m_pendingJobs
;
91 SettingsModel
*m_settings
;
92 AudioFileModel
*m_metaInfo
;
93 QList
<ProcessThread
*> m_threadList
;
94 QMovie
*m_progressIndicator
;
95 ProgressModel
*m_progressModel
;
96 QMap
<QUuid
,QString
> m_playList
;
98 unsigned int m_runningThreads
;
99 unsigned int m_currentFile
;
100 QList
<QUuid
> m_allJobs
;
101 QList
<QUuid
> m_succeededJobs
;
102 QList
<QUuid
> m_failedJobs
;
106 QSystemTrayIcon
*m_systemTray
;
108 CPUObserverThread
*m_cpuObserver
;
109 RAMObserverThread
*m_ramObserver
;
110 DiskObserverThread
*m_diskObserver
;