5 * th9x - http://code.google.com/p/th9x
6 * er9x - http://code.google.com/p/er9x
7 * gruvin9x - http://code.google.com/p/gruvin9x
9 * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
21 #ifndef _MAINWINDOW_H_
22 #define _MAINWINDOW_H_
26 #include "downloaddialog.h"
27 #include "eeprominterface.h"
39 class MainWindow
: public QMainWindow
41 friend class FirmwarePreferencesDialog
;
50 void firmwareDownloadCompleted();
51 void firmwareChanged();
55 QString
getCompanionUpdateBaseUrl() const;
56 QString
seekCodeString(const QByteArray
& qba
, const QString
& label
) const;
59 void dowloadLastFirmwareUpdate();
60 void startFirmwareDownload();
61 virtual void closeEvent(QCloseEvent
*event
);
62 virtual void changeEvent(QEvent
*e
);
63 virtual void dragEnterEvent(QDragEnterEvent
*event
);
64 virtual void dropEvent(QDropEvent
*event
);
68 void initWindowOptions();
69 void retranslateUi(bool showMsg
= false);
71 void setLanguage(const QString
& langString
);
72 void onLanguageChanged(QAction
* act
);
73 void setTheme(int index
);
74 void onThemeChanged(QAction
* act
);
75 void setIconThemeSize(int index
);
76 void onIconSizeChanged(QAction
* act
);
77 void setTabbedWindows(bool on
);
78 void onChangeWindowAction(QAction
* act
);
79 void updateWindowActions();
80 void updateWindowActionTitle(const QMdiSubWindow
* win
, QAction
* act
= NULL
);
81 void onSubwindowTitleChanged();
82 void onSubwindowModified();
83 void onCurrentProfileChanged();
85 void checkForUpdates();
86 void checkForFirmwareUpdate();
88 void checkForCompanionUpdateFinished(QNetworkReply
* reply
);
89 void checkForFirmwareUpdateFinished(QNetworkReply
* reply
);
91 void displayWarnings();
94 void updateDownloaded();
95 void firmwareDownloadAccepted();
102 void openRecentFile();
103 bool loadProfileId(const unsigned pid
);
108 void writeFlash(QString fileToFlash
="");
118 void customizeSplash();
124 void createProfile();
126 void deleteProfile(const int pid
);
127 void deleteCurrentProfile();
128 void exportSettings();
129 void importSettings();
132 void openUpdatesWaitDialog();
133 void closeUpdatesWaitDialog();
134 void onUpdatesError(const QString
& err
);
135 void openFile(const QString
& fileName
, bool updateLastUsedDir
= false);
138 QAction
* addAct(const QString
& icon
, const char * slot
= NULL
, const QKeySequence
& shortcut
= 0, QObject
* slotObj
= NULL
, const char * signal
= NULL
);
139 QAction
* addActToGroup(QActionGroup
* aGroup
, const QString
& sName
, const QString
& lName
, const char * propName
= 0,
140 const QVariant
& propValue
= QVariant(), const QVariant
& dfltValue
= QVariant(), const QKeySequence
& shortcut
= 0);
141 void trAct(QAction
* act
, const QString
& text
, const QString
& descript
);
143 QMenu
* createLanguageMenu(QWidget
* parent
= Q_NULLPTR
);
145 void createActions();
147 void createToolBars();
148 void showReadyStatus();
149 void updateRecentFileActions();
150 void updateProfilesActions();
152 int newProfile(bool loadProfile
= true);
153 QString
strippedName(const QString
& fullFileName
);
155 MdiChild
* createMdiChild();
156 MdiChild
* activeMdiChild();
157 QMdiSubWindow
* findMdiChild(const QString
& fileName
);
158 bool anyChildrenDirty();
160 bool readEepromFromRadio(const QString
& filename
);
161 bool readFirmwareFromRadio(const QString
& filename
);
163 bool checkProfileRadioExists(int profId
);
167 QString installer_fileName
;
168 DownloadDialog
* downloadDialog_forWait
;
169 unsigned int checkForUpdatesState
;
170 QString firmwareVersionString
;
172 QNetworkAccessManager
*networkManager
;
174 QVector
<QAction
*> recentFileActs
;
175 QVector
<QAction
*> profileActs
;
176 QList
<QAction
*> fileWindowActions
;
184 QMenu
*iconThemeSizeMenu
;
186 QMenu
*recentFilesMenu
;
188 QActionGroup
* windowsListActions
;
189 QToolBar
*fileToolBar
;
190 QToolBar
*editToolBar
;
191 QToolBar
*burnToolBar
;
192 QToolBar
*helpToolBar
;
198 QAction
*recentFilesAct
;
200 QAction
*appPrefsAct
;
202 QAction
*checkForUpdatesAct
;
203 QAction
*contributorsAct
;
205 QAction
*changelogAct
;
207 QAction
*editSplashAct
;
208 QAction
*writeEepromAct
;
209 QAction
*readEepromAct
;
210 QAction
*burnConfigAct
;
211 QAction
*burnListAct
;
212 QAction
*burnFusesAct
;
213 QAction
*writeFlashAct
;
214 QAction
*readFlashAct
;
215 QAction
*writeBUToRadioAct
;
216 QAction
*readBUToFileAct
;
219 QAction
*profilesMenuAct
;
220 QAction
*createProfileAct
;
221 QAction
*copyProfileAct
;
222 QAction
*deleteProfileAct
;
223 QAction
*exportSettingsAct
;
224 QAction
*importSettingsAct
;
225 QAction
*openDocURLAct
;
226 QAction
*actTabbedWindows
;
227 QAction
*actTileWindows
;
228 QAction
*actCascadeWindows
;
229 QAction
*actCloseAllWindows
;
232 #endif // _MAINWINDOW_H_