OSDN Git Service

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