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