1 ///////////////////////////////////////////////////////////////////////////////
2 // LameXP - Audio Encoder Front-End
3 // Copyright (C) 2004-2023 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; always including the non-optional
9 // LAMEXP GNU GENERAL PUBLIC LICENSE ADDENDUM. See "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 //IPC forward declartion
60 class MainWindow
: public QMainWindow
65 MainWindow(MUtils::IPCChannel
*const ipcChannel
, FileListModel
*const fileListModel
, AudioFileModel_MetaInfo
*const metaInfo
, SettingsModel
*const settingsModel
, QWidget
*const parent
= 0);
68 bool isAccepted() { return m_accepted
; }
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(const 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 disableTrayIconActionTriggered(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 keepOriginalDateTimeChanged(bool checked
);
129 void languageActionActivated(QAction
*action
);
130 void languageFromFileActionActivated(bool checked
);
131 void makeFolderButtonClicked(void);
132 void metaTagsEnabledChanged(void);
133 void neroAAC2PassChanged(bool checked
);
134 void neroAACProfileChanged(int value
);
135 void normalizationCoupledChanged(bool checked
);
136 void normalizationDynamicChanged(bool checked
);
137 void normalizationEnabledChanged(bool checked
);
138 void normalizationFilterSizeChanged(int value
);
139 void normalizationFilterSizeFinished(void);
140 void normalizationMaxVolumeChanged(double volume
);
141 void notifyOtherInstance(void);
142 void openFolderActionActivated(void);
143 void opusSettingsChanged(void);
144 void outputFolderContextMenu(const QPoint
&pos
);
145 void outputFolderDirectoryLoaded(const QString
&path
);
146 void outputFolderEditFinished(void);
147 void outputFolderItemExpanded(const QModelIndex
&item
);
148 void outputFolderMouseEventOccurred(QWidget
*sender
, QEvent
*event
);
149 void outputFolderViewEventOccurred(QWidget
*sender
, QEvent
*event
);
150 void outputFolderRowsInserted(const QModelIndex
&parent
, int start
, int end
);
151 void outputFolderViewClicked(const QModelIndex
&index
);
152 void outputFolderViewMoved(const QModelIndex
&index
);
153 void overwriteModeChanged(int id
);
154 void playlistEnabledChanged(void);
155 void prependRelativePathChanged(void);
156 void previewContextActionTriggered(void);
157 void refreshFolderContextActionTriggered(void);
158 void removeFileButtonClicked(void);
159 void renameButtonClicked(bool checked
);
160 void renameOutputEnabledChanged(const bool &checked
);
161 void renameOutputPatternChanged(void);
162 void renameOutputPatternChanged(const QString
&text
, const bool &silent
= false);
163 void renameRegExpEnabledChanged(const bool &checked
);
164 void renameRegExpValueChanged(void);
165 void renameRegExpSearchChanged (const QString
&text
, const bool &silent
= false);
166 void renameRegExpReplaceChanged(const QString
&text
, const bool &silent
= false);
167 void resetAdvancedOptionsButtonClicked(void);
168 void restoreCursor(void);
169 void samplingRateChanged(int value
);
170 void saveToSourceFolderChanged(void);
171 void showAnnounceBox(void);
172 void showCustomParamsHelpScreen(const QString
&toolName
, const QString
&command
);
173 void showDetailsButtonClicked(void);
174 void showDropBoxWidgetActionTriggered(bool checked
);
175 void showFolderContextActionTriggered(void);
176 void showRenameMacros(const QString
&text
);
177 void sourceFilesContextMenu(const QPoint
&pos
);
178 void sourceFilesScrollbarMoved(int);
179 void sourceModelChanged(void);
180 void styleActionActivated(QAction
*action
);
181 void tabActionActivated(QAction
*action
);
182 void tabPageChanged(int idx
, const bool silent
= false);
183 void toneAdjustBassChanged(double value
);
184 void toneAdjustTrebleChanged(double value
);
185 void toneAdjustTrebleReset(void);
186 void updateBitrate(int value
);
187 void updateEncoder(int id
= 0);
188 void updateLameAlgoQuality(int value
);
189 void updateMaximumInstances(const int value
);
190 void updateRCMode(int id
);
191 void useCustomTempFolderChanged(bool checked
);
192 void visitHomepageActionActivated(void);
193 void windowShown(void);
196 virtual void changeEvent(QEvent
*e
);
197 virtual void closeEvent(QCloseEvent
*event
);
198 virtual void dragEnterEvent(QDragEnterEvent
*event
);
199 virtual void dropEvent(QDropEvent
*event
);
200 virtual bool eventFilter(QObject
*obj
, QEvent
*event
);
201 virtual void resizeEvent(QResizeEvent
*event
);
202 virtual void showEvent(QShowEvent
*event
);
203 virtual void keyPressEvent(QKeyEvent
*e
);
204 virtual bool event(QEvent
*e
);
205 virtual bool winEvent(MSG
*message
, long *result
);
208 Ui::MainWindow
*ui
; //for Qt UIC
210 void addFiles(const QStringList
&files
);
211 void addFolder(const QString
&path
, bool recursive
= false, bool delayed
= false, QString filter
= QString());
212 bool MainWindow::checkForUpdates(bool *const haveNewVersion
= NULL
);
213 void initializeTranslation(void);
214 void refreshFavorites(void);
215 void openDocumentLink(QAction
*const action
);
216 void moveSelectedFiles(const bool &up
);
218 void showBanner(const QString
&text
);
219 void showBanner(const QString
&text
, QThread
*const thread
);
220 void showBanner(const QString
&text
, QEventLoop
*const eventLoop
);
221 void showBanner(const QString
&text
, bool &flag
, const bool &test
);
224 bool m_firstTimeShown
;
225 uint m_outputFolderViewInitCounter
;
226 bool m_outputFolderViewCentering
;
228 FileListModel
*const m_fileListModel
;
229 AudioFileModel_MetaInfo
*const m_metaData
;
230 SettingsModel
*const m_settings
;
232 QScopedPointer
<WorkingBanner
> m_banner
;
233 QScopedPointer
<MetaInfoModel
> m_metaInfoModel
;
234 QScopedPointer
<QFileSystemModelEx
> m_fileSystemModel
;
236 QScopedPointer
<QList
<QUrl
>> m_droppedFileList
;
237 QScopedPointer
<QStringList
> m_delayedFileList
;
238 QScopedPointer
<QTimer
> m_delayedFileTimer
;
239 QScopedPointer
<DropBox
> m_dropBox
;
240 QScopedPointer
<QLabel
> m_dropNoteLabel
;
242 QScopedPointer
<MessageHandlerThread
> m_messageHandler
;
243 QScopedPointer
<QLabel
> m_outputFolderNoteBox
;
245 QScopedPointer
<QMenu
> m_outputFolderContextMenu
;
246 QScopedPointer
<QMenu
> m_sourceFilesContextMenu
;
247 QScopedPointer
<QMenu
> m_outputFolderFavoritesMenu
;
249 QScopedPointer
<QActionGroup
> m_languageActionGroup
;
250 QScopedPointer
<QActionGroup
> m_styleActionGroup
;
251 QScopedPointer
<QActionGroup
> m_tabActionGroup
;
252 QScopedPointer
<QButtonGroup
> m_encoderButtonGroup
;
253 QScopedPointer
<QButtonGroup
> m_modeButtonGroup
;
254 QScopedPointer
<QButtonGroup
> m_overwriteButtonGroup
;
256 QAction
*m_findFileContextAction
;
257 QAction
*m_previewContextAction
;
258 QAction
*m_showDetailsContextAction
;
259 QAction
*m_showFolderContextAction
;
260 QAction
*m_refreshFolderContextAction
;
261 QAction
*m_goUpFolderContextAction
;
262 QAction
*m_addFavoriteFolderAction
;
263 QAction
*m_exportCsvContextAction
;
264 QAction
*m_importCsvContextAction
;
266 QScopedPointer
<CustomEventFilter
> m_evenFilterCornerWidget
;
267 QScopedPointer
<CustomEventFilter
> m_evenFilterCustumParamsHelp
;
268 QScopedPointer
<CustomEventFilter
> m_evenFilterOutputFolderMouse
;
269 QScopedPointer
<CustomEventFilter
> m_evenFilterOutputFolderView
;
270 QScopedPointer
<CustomEventFilter
> m_evenFilterCompressionTab
;