OSDN Git Service

Some code clean-up.
[lamexp/LameXP.git] / src / Dialog_MainWindow.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // LameXP - Audio Encoder Front-End
3 // Copyright (C) 2004-2015 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, but always including the *additional*
9 // restrictions defined in the "License.txt" file.
10 //
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.
15 //
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.
19 //
20 // http://www.gnu.org/licenses/gpl-2.0.txt
21 ///////////////////////////////////////////////////////////////////////////////
22
23 #pragma once
24
25 #include <QMainWindow>
26
27 //Class declarations
28 class AbstractEncoder;
29 class AudioFileModel;
30 class AudioFileModel_MetaInfo;
31 class CustomEventFilter;
32 class DropBox;
33 class FileListModel;
34 class MessageHandlerThread;
35 class MetaInfoModel;
36 class QActionGroup;
37 class QButtonGroup;
38 class QFileSystemModelEx;
39 class QLabel;
40 class QMenu;
41 class QUrl;
42 class QModelIndex;
43 class SettingsModel;
44 class WorkingBanner;
45 class lamexp_icon_t;
46
47 //UIC forward declartion
48 namespace Ui
49 {
50         class MainWindow;
51 }
52
53 //IPC forward declartion
54 namespace MUtils
55 {
56         class IPCChannel;
57 }
58
59 //MainWindow class
60 class MainWindow: public QMainWindow
61 {
62         Q_OBJECT
63
64 public:
65         MainWindow(MUtils::IPCChannel *const ipcChannel, FileListModel *const fileListModel, AudioFileModel_MetaInfo *const metaInfo, SettingsModel *const settingsModel, QWidget *const parent = 0);
66         ~MainWindow(void);
67
68         bool isAccepted() { return m_accepted; }
69
70 private slots:
71         void aboutButtonClicked(void);
72         void addFileDelayed(const QString &filePath, bool tryASAP = false);
73         void addFilesButtonClicked(void);
74         void addFilesDelayed(const QStringList &filePaths, bool tryASAP = false);
75         void addFavoriteFolderActionTriggered(void);
76         void addFolderDelayed(const QString &folderPath, bool recursive);
77         void aftenCodingModeChanged(int value);
78         void aftenDRCModeChanged(int value);
79         void aftenFastAllocationChanged(bool checked);
80         void aftenSearchSizeChanged(int value);
81         void autoDetectInstancesChanged(bool checked);
82         void bitrateManagementEnabledChanged(bool checked);
83         void bitrateManagementMaxChanged(int value);
84         void bitrateManagementMinChanged(int value);
85         void browseCustomTempFolderButtonClicked(void);
86         void centerOutputFolderModel(void);
87         void centerOutputFolderModel_doAsync(void);
88         void channelModeChanged(int value);
89         void checkForBetaUpdatesActionTriggered(bool checked);
90         void checkUpdatesActionActivated(void);
91         void clearFilesButtonClicked(void);
92         void clearMetaButtonClicked(void);
93         void closeButtonClicked(void);
94         void compressionTabEventOccurred(QWidget*, QEvent*);
95         void cornerWidgetEventOccurred(QWidget *sender, QEvent *event);
96         void customParamsChanged(void);
97         void customParamsHelpRequested(QWidget *obj, QEvent *event);
98         void customTempFolderChanged(const QString &text);
99         void disableNeroAacNotificationsActionTriggered(bool checked);
100         void disableShellIntegrationActionTriggered(bool);
101         void disableSlowStartupNotificationsActionTriggered(bool checked);
102         void disableSoundsActionTriggered(bool checked);
103         void disableUpdateReminderActionTriggered(bool checked);
104         void documentActionActivated(void);
105         void editMetaButtonClicked(void);
106         void encodeButtonClicked(void);
107         void exportCsvContextActionTriggered(void);
108         void fileDownButtonClicked(void);
109         void fileExtAddButtonClicked();
110         void fileExtModelChanged();
111         void fileExtRemoveButtonClicked();
112         void fileUpButtonClicked(void);
113         void findFileContextActionTriggered(void);
114         void forceStereoDownmixEnabledChanged(bool checked);
115         void gotoDesktopButtonClicked(void);
116         void gotoFavoriteFolder(void);
117         void gotoHomeFolderButtonClicked(void);
118         void gotoMusicFolderButtonClicked(void);
119         void goUpFolderContextActionTriggered(void);
120         void handleDelayedFiles(void);
121         void handleDroppedFiles(void);
122         void hibernateComputerActionTriggered(bool checked);
123         void importCueSheetActionTriggered(bool checked);
124         void importCsvContextActionTriggered(void);
125         void initOutputFolderModel(void);
126         void initOutputFolderModel_doAsync(void);
127         void languageActionActivated(QAction *action);
128         void languageFromFileActionActivated(bool checked);
129         void makeFolderButtonClicked(void);
130         void metaTagsEnabledChanged(void);
131         void neroAAC2PassChanged(bool checked);
132         void neroAACProfileChanged(int value);
133         void normalizationCoupledChanged(bool checked);
134         void normalizationDynamicChanged(bool checked);
135         void normalizationEnabledChanged(bool checked);
136         void normalizationFilterSizeChanged(int value);
137         void normalizationFilterSizeFinished(void);
138         void normalizationMaxVolumeChanged(double volume);
139         void notifyOtherInstance(void);
140         void openFolderActionActivated(void);
141         void opusSettingsChanged(void);
142         void outputFolderContextMenu(const QPoint &pos);
143         void outputFolderDirectoryLoaded(const QString &path);
144         void outputFolderEditFinished(void);
145         void outputFolderItemExpanded(const QModelIndex &item);
146         void outputFolderMouseEventOccurred(QWidget *sender, QEvent *event);
147         void outputFolderViewEventOccurred(QWidget *sender, QEvent *event);
148         void outputFolderRowsInserted(const QModelIndex &parent, int start, int end);
149         void outputFolderViewClicked(const QModelIndex &index);
150         void outputFolderViewMoved(const QModelIndex &index);
151         void overwriteModeChanged(int id);
152         void playlistEnabledChanged(void);
153         void prependRelativePathChanged(void);
154         void previewContextActionTriggered(void);
155         void refreshFolderContextActionTriggered(void);
156         void removeFileButtonClicked(void);
157         void renameButtonClicked(bool checked);
158         void renameOutputEnabledChanged(const bool &checked);
159         void renameOutputPatternChanged(void);
160         void renameOutputPatternChanged(const QString &text, const bool &silent = false);
161         void renameRegExpEnabledChanged(const bool &checked);
162         void renameRegExpValueChanged(void);
163         void renameRegExpSearchChanged (const QString &text, const bool &silent = false);
164         void renameRegExpReplaceChanged(const QString &text, const bool &silent = false);
165         void resetAdvancedOptionsButtonClicked(void);
166         void restoreCursor(void);
167         void samplingRateChanged(int value);
168         void saveToSourceFolderChanged(void);
169         void showAnnounceBox(void);
170         void showCustomParamsHelpScreen(const QString &toolName, const QString &command);
171         void showDetailsButtonClicked(void);
172         void showDropBoxWidgetActionTriggered(bool checked);
173         void showFolderContextActionTriggered(void);
174         void showRenameMacros(const QString &text);
175         void sourceFilesContextMenu(const QPoint &pos);
176         void sourceFilesScrollbarMoved(int);
177         void sourceModelChanged(void);
178         void styleActionActivated(QAction *action);
179         void tabActionActivated(QAction *action);
180         void tabPageChanged(int idx, const bool silent = false);
181         void toneAdjustBassChanged(double value);
182         void toneAdjustTrebleChanged(double value);
183         void toneAdjustTrebleReset(void);
184         void updateBitrate(int value);
185         void updateEncoder(int id = 0);
186         void updateLameAlgoQuality(int value);
187         void updateMaximumInstances(int value);
188         void updateRCMode(int id);
189         void useCustomTempFolderChanged(bool checked);
190         void visitHomepageActionActivated(void);
191         void windowShown(void);
192
193 protected:
194         virtual void changeEvent(QEvent *e);
195         virtual void closeEvent(QCloseEvent *event);
196         virtual void dragEnterEvent(QDragEnterEvent *event);
197         virtual void dropEvent(QDropEvent *event);
198         virtual bool eventFilter(QObject *obj, QEvent *event);
199         virtual void resizeEvent(QResizeEvent *event);
200         virtual void showEvent(QShowEvent *event);
201         virtual void keyPressEvent(QKeyEvent *e);
202         virtual bool event(QEvent *e);
203         virtual bool winEvent(MSG *message, long *result);
204
205 private:
206         Ui::MainWindow *ui; //for Qt UIC
207
208         void addFiles(const QStringList &files);
209         void addFolder(const QString &path, bool recursive = false, bool delayed = false, QString filter = QString());
210         bool checkForUpdates(void);
211         void initializeTranslation(void);
212         void refreshFavorites(void);
213         void openDocumentLink(QAction *const action);
214         
215         bool m_accepted;
216         bool m_firstTimeShown;
217         uint m_outputFolderViewInitCounter;
218         bool m_outputFolderViewCentering;
219
220         FileListModel           *const m_fileListModel;
221         AudioFileModel_MetaInfo *const m_metaData;
222         SettingsModel           *const m_settings;
223
224         QScopedPointer<WorkingBanner>      m_banner;
225         QScopedPointer<MetaInfoModel>      m_metaInfoModel;
226         QScopedPointer<QFileSystemModelEx> m_fileSystemModel;
227         
228         QList<QUrl> *m_droppedFileList;
229         QStringList *m_delayedFileList;
230         QTimer *m_delayedFileTimer;
231         DropBox *m_dropBox;
232         QLabel *m_dropNoteLabel;
233         MessageHandlerThread *m_messageHandler;
234         QMenu *m_outputFolderContextMenu;
235         QMenu *m_sourceFilesContextMenu;
236         QMenu *m_outputFolderFavoritesMenu;
237         QLabel *m_outputFolderNoteBox;
238
239         QScopedPointer<QActionGroup> m_languageActionGroup;
240         QScopedPointer<QActionGroup> m_styleActionGroup;
241         QScopedPointer<QActionGroup> m_tabActionGroup;
242         QScopedPointer<QButtonGroup> m_encoderButtonGroup;
243         QScopedPointer<QButtonGroup> m_modeButtonGroup;
244         QScopedPointer<QButtonGroup> m_overwriteButtonGroup;
245
246         QAction *m_findFileContextAction;
247         QAction *m_previewContextAction;
248         QAction *m_showDetailsContextAction;
249         QAction *m_showFolderContextAction;
250         QAction *m_refreshFolderContextAction;
251         QAction *m_goUpFolderContextAction;
252         QAction *m_addFavoriteFolderAction;
253         QAction *m_exportCsvContextAction;
254         QAction *m_importCsvContextAction;
255
256         QScopedPointer<CustomEventFilter> m_evenFilterCornerWidget;
257         QScopedPointer<CustomEventFilter> m_evenFilterCustumParamsHelp;
258         QScopedPointer<CustomEventFilter> m_evenFilterOutputFolderMouse;
259         QScopedPointer<CustomEventFilter> m_evenFilterOutputFolderView;
260         QScopedPointer<CustomEventFilter> m_evenFilterCompressionTab;
261 };