Files
edgetx-gx12/companion/src/mainwindow.h
T
Max PapernoandBertrand Songis c1586b72bb [Companion] SD Sync reworked: (#4906)
* Complete re-write of SyncProcess, now more robust, UI-independent, runs in own thread, large speed boost;
    * Use file hash comparisons instead of byte-level compare with string methods (probable fixes for #4837 and #4848);
    * New pre-sync options dialog with selectable folders and other settings (settings are remembered until app exit);
    * Option to choose sync direction(s) (up/down/bi) and the order in which bi-directional sync runs;
    * Option to choose file comparison mode (timestamp/hash/both) or force overwrite (for one-way sync);
    * Option to set a maximum file size to copy;
    * Option to do a test run w/out actually copying any files;
    * Better reporting of progress, total counts (copied/updated/skipped), and errors, with color coding;
    * Much more reliable to cancel long-running/hung copy process;
    * ProgressWidget can now display rich-text in the text browser, added some new functions for usage;
    * Misc. small layout tweaks to ProgressDialog and ProgressWidget to make them behave/look better;
2017-05-08 20:51:26 +02:00

230 lines
6.3 KiB
C++

/*
* Copyright (C) OpenTX
*
* Based on code named
* 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.
*/
#ifndef _MAINWINDOW_H_
#define _MAINWINDOW_H_
#include <QtWidgets>
#include <QDateTime>
#include "downloaddialog.h"
#include "eeprominterface.h"
#define SPLASH_TIME 5
class MdiChild;
QT_BEGIN_NAMESPACE
class QAction;
class QMenu;
class QMdiArea;
class QMdiSubWindow;
class QSignalMapper;
QT_END_NAMESPACE
#define CHECK_COMPANION 1
#define CHECK_FIRMWARE 2
#define SHOW_DIALOG_WAIT 4
#define AUTOMATIC_DOWNLOAD 8
class MainWindow : public QMainWindow
{
friend class FirmwarePreferencesDialog;
Q_OBJECT
public:
MainWindow();
~MainWindow();
signals:
void firmwareChanged();
void startSync();
protected:
QString getCompanionUpdateBaseUrl();
QString seekCodeString(const QByteArray & qba, const QString & label);
protected slots:
void dowloadLastFirmwareUpdate();
void startFirmwareDownload();
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 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 checkForUpdates();
void checkForFirmwareUpdate();
void checkForCompanionUpdateFinished(QNetworkReply * reply);
void checkForFirmwareUpdateFinished(QNetworkReply * reply);
void displayWarnings();
void doAutoUpdates();
void doUpdates();
void updateDownloaded();
void firmwareDownloadAccepted();
void newFile();
void openFile();
void save();
void saveAs();
void closeFile();
void openRecentFile();
void loadProfileId(const unsigned pid);
void loadProfile();
void logFile();
void writeEeprom();
void readEeprom();
void writeFlash(QString fileToFlash="");
void readFlash();
void writeBackup();
void readBackup();
void burnConfig();
void burnList();
void burnFuses();
void contributors();
void sdsync();
void changelog();
void fwchangelog();
void customizeSplash();
void about();
void compare();
void appPrefs();
void fwPrefs();
void updateMenus();
void createProfile();
void copyProfile();
void deleteProfile(const int pid);
void deleteCurrentProfile();
void autoClose();
void closeUpdatesWaitDialog();
void onUpdatesError();
void openFile(const QString & fileName, bool updateLastUsedDir = false);
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 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 readEepromFromRadio(const QString & filename);
bool readFirmwareFromRadio(const QString & filename);
QMdiArea *mdiArea;
QSignalMapper *windowMapper;
QString installer_fileName;
downloadDialog * downloadDialog_forWait;
unsigned int checkForUpdatesState;
QString firmwareVersionString;
QNetworkAccessManager *networkManager;
QVector<QAction *> recentFileActs;
QVector<QAction *> profileActs;
QList<QAction *> fileWindowActions;
QMenu *fileMenu;
QMenu *editMenu;
QMenu *settingsMenu;
QMenu *burnMenu;
QMenu *helpMenu;
QMenu *windowMenu;
QMenu *iconThemeSizeMenu;
QMenu *themeMenu;
QMenu *recentFilesMenu;
QMenu *profilesMenu;
QActionGroup * windowsListActions;
QToolBar *fileToolBar;
QToolBar *editToolBar;
QToolBar *burnToolBar;
QToolBar *helpToolBar;
QAction *newAct;
QAction *openAct;
QAction *saveAct;
QAction *saveAsAct;
QAction *closeAct;
QAction *recentFilesAct;
QAction *exitAct;
QAction *appPrefsAct;
QAction *fwPrefsAct;
QAction *checkForUpdatesAct;
QAction *contributorsAct;
QAction *sdsyncAct;
QAction *changelogAct;
QAction *fwchangelogAct;
QAction *compareAct;
QAction *editSplashAct;
QAction *writeEepromAct;
QAction *readEepromAct;
QAction *burnConfigAct;
QAction *burnListAct;
QAction *burnFusesAct;
QAction *writeFlashAct;
QAction *readFlashAct;
QAction *writeBUToRadioAct;
QAction *readBUToFileAct;
QAction *aboutAct;
QAction *logsAct;
QAction *profilesMenuAct;
QAction *createProfileAct;
QAction *copyProfileAct;
QAction *deleteProfileAct;
QAction *openDocURLAct;
QAction *actTabbedWindows;
QAction *actTileWindows;
QAction *actCascadeWindows;
QAction *actCloseAllWindows;
};
#endif // _MAINWINDOW_H_