OSDN Git Service

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