OSDN Git Service

Update MediaInfo binaries to v0.7.53 (2012-01-24), compiled with ICL 12.1.6 and MSVC...
[lamexp/LameXP.git] / src / Dialog_Processing.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // LameXP - Audio Encoder Front-End
3 // Copyright (C) 2004-2012 LoRd_MuldeR <MuldeR2@GMX.de>
4 //
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.
9 //
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.
14 //
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.
18 //
19 // http://www.gnu.org/licenses/gpl-2.0.txt
20 ///////////////////////////////////////////////////////////////////////////////
21
22 #pragma once
23
24 #include "../tmp/UIC_ProcessingDialog.h"
25
26 #include <QUuid>
27 #include <QSystemTrayIcon>
28
29 class QMovie;
30 class QMenu;
31 class ProgressModel;
32 class ProcessThread;
33 class FileListModel;
34 class AudioFileModel;
35 class SettingsModel;
36 class CPUObserverThread;
37 class RAMObserverThread;
38 class DiskObserverThread;
39 class AbstractEncoder;
40
41 enum shutdownFlag_t
42 {
43         shutdownFlag_None = 0,
44         shutdownFlag_TurnPowerOff = 1,
45         shutdownFlag_Hibernate = 2
46 };
47
48 class ProcessingDialog : public QDialog, private Ui::ProcessingDialog
49 {
50         Q_OBJECT
51
52 public:
53         ProcessingDialog(FileListModel *fileListModel, AudioFileModel *metaInfo, SettingsModel *settings, QWidget *parent = 0);
54         ~ProcessingDialog(void);
55         
56         int getShutdownFlag(void) { return m_shutdownFlag; }
57
58 private slots:
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);
73
74 protected:
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);
80
81 private:
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;
89         
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;
97         QMenu *m_contextMenu;
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;
103         bool m_userAborted;
104         bool m_forcedAbort;
105         QSystemTrayIcon *m_systemTray;
106         int m_shutdownFlag;
107         CPUObserverThread *m_cpuObserver;
108         RAMObserverThread *m_ramObserver;
109         DiskObserverThread *m_diskObserver;
110         qint64 m_timerStart;
111 };