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"
40 #define CHECK_COMPANION 1
41 #define CHECK_FIRMWARE 2
42 #define SHOW_DIALOG_WAIT 4
43 #define AUTOMATIC_DOWNLOAD 8
45 class MainWindow
: public QMainWindow
47 friend class FirmwarePreferencesDialog
;
56 void firmwareChanged();
60 QString
getCompanionUpdateBaseUrl();
61 QString
seekCodeString(const QByteArray
& qba
, const QString
& label
);
64 void dowloadLastFirmwareUpdate();
65 void startFirmwareDownload();
66 virtual void closeEvent(QCloseEvent
*event
);
67 virtual void changeEvent(QEvent
*e
);
68 virtual void dragEnterEvent(QDragEnterEvent
*event
);
69 virtual void dropEvent(QDropEvent
*event
);
73 void retranslateUi(bool showMsg
= false);
75 void setLanguage(const QString
& langString
);
76 void onLanguageChanged(QAction
* act
);
77 void setTheme(int index
);
78 void onThemeChanged(QAction
* act
);
79 void setIconThemeSize(int index
);
80 void onIconSizeChanged(QAction
* act
);
81 void setTabbedWindows(bool on
);
82 void onChangeWindowAction(QAction
* act
);
83 void updateWindowActions();
84 void updateWindowActionTitle(const QMdiSubWindow
* win
, QAction
* act
= NULL
);
85 void onSubwindowTitleChanged();
86 void onSubwindowModified();
88 void checkForUpdates();
89 void checkForFirmwareUpdate();
91 void checkForCompanionUpdateFinished(QNetworkReply
* reply
);
92 void checkForFirmwareUpdateFinished(QNetworkReply
* reply
);
94 void displayWarnings();
97 void updateDownloaded();
98 void firmwareDownloadAccepted();
105 void openRecentFile();
106 bool loadProfileId(const unsigned pid
);
111 void writeFlash(QString fileToFlash
="");
121 void customizeSplash();
127 void createProfile();
129 void deleteProfile(const int pid
);
130 void deleteCurrentProfile();
133 void closeUpdatesWaitDialog();
134 void onUpdatesError();
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
);
164 QSignalMapper
*windowMapper
;
166 QString installer_fileName
;
167 downloadDialog
* downloadDialog_forWait
;
168 unsigned int checkForUpdatesState
;
169 QString firmwareVersionString
;
171 QNetworkAccessManager
*networkManager
;
173 QVector
<QAction
*> recentFileActs
;
174 QVector
<QAction
*> profileActs
;
175 QList
<QAction
*> fileWindowActions
;
183 QMenu
*iconThemeSizeMenu
;
185 QMenu
*recentFilesMenu
;
187 QActionGroup
* windowsListActions
;
188 QToolBar
*fileToolBar
;
189 QToolBar
*editToolBar
;
190 QToolBar
*burnToolBar
;
191 QToolBar
*helpToolBar
;
197 QAction
*recentFilesAct
;
199 QAction
*appPrefsAct
;
201 QAction
*checkForUpdatesAct
;
202 QAction
*contributorsAct
;
204 QAction
*changelogAct
;
206 QAction
*editSplashAct
;
207 QAction
*writeEepromAct
;
208 QAction
*readEepromAct
;
209 QAction
*burnConfigAct
;
210 QAction
*burnListAct
;
211 QAction
*burnFusesAct
;
212 QAction
*writeFlashAct
;
213 QAction
*readFlashAct
;
214 QAction
*writeBUToRadioAct
;
215 QAction
*readBUToFileAct
;
218 QAction
*profilesMenuAct
;
219 QAction
*createProfileAct
;
220 QAction
*copyProfileAct
;
221 QAction
*deleteProfileAct
;
222 QAction
*openDocURLAct
;
223 QAction
*actTabbedWindows
;
224 QAction
*actTileWindows
;
225 QAction
*actCascadeWindows
;
226 QAction
*actCloseAllWindows
;
229 #endif // _MAINWINDOW_H_