OSDN Git Service

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