/* * Copyright (C) EdgeTX * * Based on code named * opentx - https://github.com/opentx/opentx * th9x - http://code.google.com/p/th9x * er9x - http://code.google.com/p/er9x * gruvin9x - http://code.google.com/p/gruvin9x * * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #pragma once #include #include #include "eeprominterface.h" #define SPLASH_TIME 5 class MdiChild; class UpdateFactories; QT_BEGIN_NAMESPACE class QAction; class QMenu; class QMdiArea; class QMdiSubWindow; QT_END_NAMESPACE class MainWindow : public QMainWindow { friend class FirmwarePreferencesDialog; Q_OBJECT public: MainWindow(); ~MainWindow(); signals: void firmwareChanged(); void startSync(); void onInternalModuleChanged(); protected slots: virtual void closeEvent(QCloseEvent *event); virtual void changeEvent(QEvent *e); virtual void dragEnterEvent(QDragEnterEvent *event); virtual void dropEvent(QDropEvent *event); private slots: void openDocURL(); void initWindowOptions(); void retranslateUi(bool showMsg = false); void setLanguage(const QString & langString); void onLanguageChanged(QAction * act); void setTheme(int index); void onThemeChanged(QAction * act); void setIconThemeSize(int index); void onIconSizeChanged(QAction * act); void setTabbedWindows(bool on); void onChangeWindowAction(QAction * act); void updateWindowActions(); void updateWindowActionTitle(const QMdiSubWindow * win, QAction * act = NULL); void onSubwindowTitleChanged(); void onSubwindowModified(); void onCurrentProfileChanged(); void displayWarnings(); void newFile(); void openFile(); void save(); void saveAs(); void saveAll(); void closeFile(); void openRecentFile(); bool loadProfileId(const unsigned pid); void loadProfile(); void logFile(); void writeSettings(); void readSettings(); void writeFlash(QString fileToFlash=""); void readFlash(); void writeBackup(); void readBackup(); void sdsync(bool postUpdate = false); void changelog(); void customizeSplash(); void about(); void compare(); void updateMenus(); void createProfile(); void copyProfile(); void deleteProfile(const int pid); void deleteCurrentProfile(); void editAppSettings(); void exportAppSettings(); void importAppSettings(); void autoClose(); void chooseProfile(); void autoCheckForUpdates(); void manualCheckForUpdates(); void updates(); void doUpdates(bool check, bool interactive = true); void openFile(const QString & fileName); void readSettingsSDPath(); void writeSettingsSDPath(); void viewFileToolbar(); void viewModelsToolbar(); void viewRadioToolbar(); void viewSettingsToolbar(); void viewToolsToolbar(); void radioGetDevices(); private: QAction * addAct(const QString & icon, const char * slot = NULL, const QKeySequence & shortcut = 0, QObject * slotObj = NULL, const char * signal = NULL); QAction * addActToGroup(QActionGroup * aGroup, const QString & sName, const QString & lName, const char * propName = 0, const QVariant & propValue = QVariant(), const QVariant & dfltValue = QVariant(), const QKeySequence & shortcut = 0); void trAct(QAction * act, const QString & text, const QString & descript); QMenu * createLanguageMenu(QWidget * parent = Q_NULLPTR); void setActCheckability(QAction * act, bool checked); void createActions(); void createMenus(); void createToolBars(); void showReadyStatus(); void updateRecentFileActions(); void updateProfilesActions(); int newProfile(bool loadProfile = true); QString strippedName(const QString & fullFileName); MdiChild * createMdiChild(); MdiChild * activeMdiChild(); QMdiSubWindow * findMdiChild(const QString & fileName); bool anyChildrenDirty(); bool readSettingsFromRadio(const QString & filename); bool readFirmwareFromRadio(const QString & filename); bool readSettingsFromSDPath(const QString & filename); bool checkProfileRadioExists(int profId); bool isSDPathValid(); QMdiArea *mdiArea; QString installer_fileName; UpdateFactories *updateFactories; QVector recentFileActs; QVector profileActs; QList fileWindowActions; // top level menus QMenu *fileMenu; QMenu *modelsMenu; QMenu *viewMenu; QMenu *settingsMenu; QMenu *radioMenu; QMenu *toolsMenu; QMenu *windowMenu; QMenu *helpMenu; // sub menus QMenu *iconThemeSizeMenu; QMenu *themeMenu; QMenu *recentFilesMenu; QMenu *profilesMenu; QActionGroup * windowsListActions; QToolBar *fileToolBar; QToolBar *modelsToolBar; QToolBar *radioToolBar; QToolBar *settingsToolBar; QToolBar *toolsToolBar; QAction *newAct; QAction *openAct; QAction *saveAct; QAction *saveAsAct; QAction *closeAct; QAction *recentFilesAct; QAction *exitAct; QAction *editAppSettingsAct; QAction *updatesAct; QAction *manualChkForUpdAct; QAction *sdsyncAct; QAction *changelogAct; QAction *compareAct; QAction *editSplashAct; QAction *writeSettingsAct; QAction *readSettingsAct; QAction *radioGetDevicesAct; QAction *writeFlashAct; QAction *readFlashAct; QAction *writeBUToRadioAct; QAction *readBUToFileAct; QAction *aboutAct; QAction *logsAct; QAction *profilesMenuAct; QAction *createProfileAct; QAction *copyProfileAct; QAction *deleteProfileAct; QAction *exportAppSettingsAct; QAction *importAppSettingsAct; QAction *tabbedWindowsAct; QAction *tileWindowsAct; QAction *cascadeWindowsAct; QAction *closeAllWindowsAct; QAction *writeSettingsSDPathAct; QAction *readSettingsSDPathAct; QAction *viewFileToolbarAct; QAction *viewModelsToolbarAct; QAction *viewRadioToolbarAct; QAction *viewSettingsToolbarAct; QAction *viewToolsToolbarAct; };