From 08245aade9c77b7084d392d4bd8878a9ed3179d0 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Fri, 21 Feb 2014 07:40:50 +0100 Subject: [PATCH] Simulator updated with last Kjell improvements --- companion/src/CMakeLists.txt | 185 +++--- companion/src/appdata.cpp | 5 +- companion/src/appdata.h | 573 +++++++++--------- companion/src/{main.cpp => companion.cpp} | 3 - .../{simulation/main.cpp => simulator.cpp} | 0 5 files changed, 383 insertions(+), 383 deletions(-) rename companion/src/{main.cpp => companion.cpp} (95%) rename companion/src/{simulation/main.cpp => simulator.cpp} (100%) diff --git a/companion/src/CMakeLists.txt b/companion/src/CMakeLists.txt index de63aa32d..5ac12bd16 100644 --- a/companion/src/CMakeLists.txt +++ b/companion/src/CMakeLists.txt @@ -96,103 +96,103 @@ include_directories( add_subdirectory(modeledit) add_subdirectory(simulation) -SET( companion_SRCS - eeprominterface.cpp - hexinterface.cpp - flashinterface.cpp - file.cpp - xmlinterface.cpp - ${PROJECT_BINARY_DIR}/radio.cxx - firmwares/th9x/th9xeeprom.cpp - firmwares/th9x/th9xinterface.cpp - firmwares/er9x/er9xeeprom.cpp - firmwares/er9x/er9xinterface.cpp - firmwares/gruvin9x/gruvin9xeeprom.cpp - firmwares/gruvin9x/gruvin9xinterface.cpp - firmwares/opentx/opentxeeprom.cpp - firmwares/opentx/open9xStockeeprom.cpp - firmwares/opentx/open9xGruvin9xeeprom.cpp - firmwares/opentx/open9xSky9xeeprom.cpp - firmwares/opentx/opentxinterface.cpp - firmwares/opentx/opentxTaranisSimulator.cpp - firmwares/opentx/opentxSky9xsimulator.cpp - firmwares/opentx/opentxGruvin9xsimulator.cpp - firmwares/opentx/opentxM128simulator.cpp - firmwares/opentx/opentxsimulator.cpp - firmwares/ersky9x/ersky9xeeprom.cpp - firmwares/ersky9x/ersky9xinterface.cpp - ${RADIO_SRC_DIRECTORY}/bitmaps/sticks.lbm - appdata.cpp - helpers.cpp - mdichild.cpp - generaledit.cpp - modelslist.cpp - mountlist.cpp - avroutputdialog.cpp - apppreferencesdialog.cpp - fwpreferencesdialog.cpp - burnconfigdialog.cpp - comparedialog.cpp - contributorsdialog.cpp - customizesplashdialog.cpp - burndialog.cpp - printdialog.cpp - fusesdialog.cpp - logsdialog.cpp - downloaddialog.cpp - splashlibrary.cpp - mainwindow.cpp - main.cpp - modelconfigdialog.cpp - qcustomplot.cpp +set(companion_SRCS + eeprominterface.cpp + hexinterface.cpp + flashinterface.cpp + file.cpp + xmlinterface.cpp + ${PROJECT_BINARY_DIR}/radio.cxx + firmwares/th9x/th9xeeprom.cpp + firmwares/th9x/th9xinterface.cpp + firmwares/er9x/er9xeeprom.cpp + firmwares/er9x/er9xinterface.cpp + firmwares/gruvin9x/gruvin9xeeprom.cpp + firmwares/gruvin9x/gruvin9xinterface.cpp + firmwares/opentx/opentxeeprom.cpp + firmwares/opentx/open9xStockeeprom.cpp + firmwares/opentx/open9xGruvin9xeeprom.cpp + firmwares/opentx/open9xSky9xeeprom.cpp + firmwares/opentx/opentxinterface.cpp + firmwares/opentx/opentxTaranisSimulator.cpp + firmwares/opentx/opentxSky9xsimulator.cpp + firmwares/opentx/opentxGruvin9xsimulator.cpp + firmwares/opentx/opentxM128simulator.cpp + firmwares/opentx/opentxsimulator.cpp + firmwares/ersky9x/ersky9xeeprom.cpp + firmwares/ersky9x/ersky9xinterface.cpp + ${RADIO_SRC_DIRECTORY}/bitmaps/sticks.lbm + appdata.cpp + helpers.cpp + mdichild.cpp + generaledit.cpp + modelslist.cpp + mountlist.cpp + avroutputdialog.cpp + apppreferencesdialog.cpp + fwpreferencesdialog.cpp + burnconfigdialog.cpp + comparedialog.cpp + contributorsdialog.cpp + customizesplashdialog.cpp + burndialog.cpp + printdialog.cpp + fusesdialog.cpp + logsdialog.cpp + downloaddialog.cpp + splashlibrary.cpp + mainwindow.cpp + companion.cpp + modelconfigdialog.cpp + qcustomplot.cpp ) -SET( companion_MOC_HDRS - avroutputdialog.h - apppreferencesdialog.h - fwpreferencesdialog.h - burnconfigdialog.h - comparedialog.h - printdialog.h - fusesdialog.h - logsdialog.h - contributorsdialog.h - customizesplashdialog.h - splashlibrary.h - splashlabel.h - burndialog.h - downloaddialog.h - generaledit.h - modelslist.h - mdichild.h - mainwindow.h - modelconfigdialog.h - qcustomplot.h - helpers.h +set(companion_MOC_HDRS + avroutputdialog.h + apppreferencesdialog.h + fwpreferencesdialog.h + burnconfigdialog.h + comparedialog.h + printdialog.h + fusesdialog.h + logsdialog.h + contributorsdialog.h + customizesplashdialog.h + splashlibrary.h + splashlabel.h + burndialog.h + downloaddialog.h + generaledit.h + modelslist.h + mdichild.h + mainwindow.h + modelconfigdialog.h + qcustomplot.h + helpers.h ) -SET( companion_UIS - mdichild.ui - avroutputdialog.ui - comparedialog.ui - fusesdialog.ui - logsdialog.ui - apppreferencesdialog.ui - fwpreferencesdialog.ui - burnconfigdialog.ui - downloaddialog.ui - generaledit.ui - printdialog.ui - contributorsdialog.ui - customizesplashdialog.ui - splashlibrary.ui - burndialog.ui - modelconfigdialog.ui +set(companion_UIS + mdichild.ui + avroutputdialog.ui + comparedialog.ui + fusesdialog.ui + logsdialog.ui + apppreferencesdialog.ui + fwpreferencesdialog.ui + burnconfigdialog.ui + downloaddialog.ui + generaledit.ui + printdialog.ui + contributorsdialog.ui + customizesplashdialog.ui + splashlibrary.ui + burndialog.ui + modelconfigdialog.ui ) -SET( companion_RCS - companion.qrc - ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc +set(companion_RCS + companion.qrc + ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc ) MACRO (TODAY RESULT) @@ -316,7 +316,8 @@ set(simu_SRCS file.cpp # TODO not needed modeledit/node.cpp modeledit/edge.cpp # TODO not needed - simulation/main.cpp + appdata.cpp + simulator.cpp ) set(simu_HDRS diff --git a/companion/src/appdata.cpp b/companion/src/appdata.cpp index 9cbf38ca4..a0f1fbb1c 100644 --- a/companion/src/appdata.cpp +++ b/companion/src/appdata.cpp @@ -3,6 +3,9 @@ #include "appdata.h" +// Global data and storage object +AppData g; + // ** CompStoreObj class******************** void CompStoreObj::clear (const QString tag1, const QString tag2, const QString tag3) { @@ -637,4 +640,4 @@ AppData::AppData() getset( _id, "profileId" ,0 ); getset( _theme, "theme" ,1 ); getset( _warningId, "warningId" ,0 ); -} \ No newline at end of file +} diff --git a/companion/src/appdata.h b/companion/src/appdata.h index 04a10d417..c8c85a151 100644 --- a/companion/src/appdata.h +++ b/companion/src/appdata.h @@ -21,334 +21,333 @@ class CompStoreObj { -public: - void clear (const QString tag1="", const QString tag2="", const QString tag3=""); - void store(const QByteArray newArray, QByteArray &array, const QString tag, const QString group1="", const QString group2="" ); - void store(const QStringList newSList, QStringList &stringList, const QString tag, const QString group1="", const QString group2="" ); - void store(const QString newString, QString &string, const QString tag, const QString group1="", const QString group2="" ); - void store(const bool newTruth, bool &truth, const QString tag, const QString group1="", const QString group2="" ); - void store(const int newNumber, int &number, const QString tag, const QString group1="", const QString group2="" ); + public: + void clear (const QString tag1="", const QString tag2="", const QString tag3=""); + void store(const QByteArray newArray, QByteArray &array, const QString tag, const QString group1="", const QString group2="" ); + void store(const QStringList newSList, QStringList &stringList, const QString tag, const QString group1="", const QString group2="" ); + void store(const QString newString, QString &string, const QString tag, const QString group1="", const QString group2="" ); + void store(const bool newTruth, bool &truth, const QString tag, const QString group1="", const QString group2="" ); + void store(const int newNumber, int &number, const QString tag, const QString group1="", const QString group2="" ); - // Retrieval functions - void retrieve( QByteArray &array, const QString tag, const QString def, const QString group1="", const QString group2="" ); - void retrieve( QStringList &stringList, const QString tag, const QString def, const QString group1="", const QString group2="" ); - void retrieve( QString &string, const QString tag, const QString def, const QString group1="", const QString group2="" ); - void retrieve( bool &truth, const QString tag, const bool def, const QString group1="", const QString group2="" ); - void retrieve( int &number, const QString tag, const int def, const QString group1="", const QString group2="" ); + // Retrieval functions + void retrieve( QByteArray &array, const QString tag, const QString def, const QString group1="", const QString group2="" ); + void retrieve( QStringList &stringList, const QString tag, const QString def, const QString group1="", const QString group2="" ); + void retrieve( QString &string, const QString tag, const QString def, const QString group1="", const QString group2="" ); + void retrieve( bool &truth, const QString tag, const bool def, const QString group1="", const QString group2="" ); + void retrieve( int &number, const QString tag, const int def, const QString group1="", const QString group2="" ); - // Retrieve and Store functions - void getset( QByteArray &array, const QString tag, const QString def, const QString group1="", const QString group2="" ); - void getset( QStringList &stringList, const QString tag, const QString def, const QString group1="", const QString group2="" ); - void getset( QString &string, const QString tag, const QString def, const QString group1="", const QString group2="" ); - void getset( bool &truth, const QString tag, const bool def, const QString group1="", const QString group2="" ); - void getset( int &number, const QString tag, const int def, const QString group1="", const QString group2="" ); + // Retrieve and Store functions + void getset( QByteArray &array, const QString tag, const QString def, const QString group1="", const QString group2="" ); + void getset( QStringList &stringList, const QString tag, const QString def, const QString group1="", const QString group2="" ); + void getset( QString &string, const QString tag, const QString def, const QString group1="", const QString group2="" ); + void getset( bool &truth, const QString tag, const bool def, const QString group1="", const QString group2="" ); + void getset( int &number, const QString tag, const int def, const QString group1="", const QString group2="" ); }; -class FwRevision:protected CompStoreObj +class FwRevision: protected CompStoreObj { -public: - int get( const QString); - void set( const QString, const int ); - void remove( const QString ); + public: + int get( const QString); + void set( const QString, const int ); + void remove( const QString ); }; -class JStickData:protected CompStoreObj +class JStickData: protected CompStoreObj { -private: - int index; + private: + int index; - int _stickAxe; - int _stickMin; - int _stickMed; - int _stickMax; - int _stickInv; + int _stickAxe; + int _stickMin; + int _stickMed; + int _stickMax; + int _stickInv; -public: - // All the get definitions - int stick_axe(); - int stick_min(); - int stick_med(); - int stick_max(); - int stick_inv(); + public: + // All the get definitions + int stick_axe(); + int stick_min(); + int stick_med(); + int stick_max(); + int stick_inv(); - // All the set definitions - void stick_axe(const int); - void stick_min(const int); - void stick_med(const int); - void stick_max(const int); - void stick_inv(const int); + // All the set definitions + void stick_axe(const int); + void stick_min(const int); + void stick_med(const int); + void stick_max(const int); + void stick_inv(const int); - JStickData(); - void remove(); - bool existsOnDisk(); - void init(int index); - void flush(); + JStickData(); + void remove(); + bool existsOnDisk(); + void init(int index); + void flush(); }; -class Profile:protected CompStoreObj +class Profile: protected CompStoreObj { -private: - // Class Internal Variable - int index; + private: + // Class Internal Variable + int index; - // Application Variables - QString _firmware; - QString _name; - QString _sdPath; - QString _splashFile; - bool _burnFirmware; - bool _renameFwFiles; - bool _patchImage; - int _channelOrder; - int _defaultMode; + // Application Variables + QString _firmware; + QString _name; + QString _sdPath; + QString _splashFile; + bool _burnFirmware; + bool _renameFwFiles; + bool _patchImage; + int _channelOrder; + int _defaultMode; - // Firmware Variables - QString _beeper; - QString _countryCode; - QString _display; - QString _haptic; - QString _speaker; - QString _stickPotCalib; - QString _trainerCalib; - int _currentCalib; - int _gsStickMode; - int _ppmMultiplier; - int _vBatCalib; - int _vBatWarn; + // Firmware Variables + QString _beeper; + QString _countryCode; + QString _display; + QString _haptic; + QString _speaker; + QString _stickPotCalib; + QString _trainerCalib; + int _currentCalib; + int _gsStickMode; + int _ppmMultiplier; + int _vBatCalib; + int _vBatWarn; -public: - // All the get definitions - QString firmware(); - QString name(); - QString sdPath(); - QString splashFile(); - bool burnFirmware(); - bool renameFwFiles(); - bool patchImage(); - int channelOrder(); - int defaultMode(); + public: + // All the get definitions + QString firmware(); + QString name(); + QString sdPath(); + QString splashFile(); + bool burnFirmware(); + bool renameFwFiles(); + bool patchImage(); + int channelOrder(); + int defaultMode(); - QString beeper(); - QString countryCode(); - QString display(); - QString haptic(); - QString speaker(); - QString stickPotCalib(); - QString trainerCalib(); - int currentCalib(); - int gsStickMode(); - int ppmMultiplier(); - int vBatCalib(); - int vBatWarn(); + QString beeper(); + QString countryCode(); + QString display(); + QString haptic(); + QString speaker(); + QString stickPotCalib(); + QString trainerCalib(); + int currentCalib(); + int gsStickMode(); + int ppmMultiplier(); + int vBatCalib(); + int vBatWarn(); - // All the set definitions - void name (const QString); - void firmware (const QString); - void sdPath (const QString); - void splashFile (const QString); - void burnFirmware (const bool); - void renameFwFiles (const bool); - void patchImage (const bool); - void channelOrder (const int); - void defaultMode (const int); + // All the set definitions + void name (const QString); + void firmware (const QString); + void sdPath (const QString); + void splashFile (const QString); + void burnFirmware (const bool); + void renameFwFiles (const bool); + void patchImage (const bool); + void channelOrder (const int); + void defaultMode (const int); - void beeper (const QString); - void countryCode (const QString); - void display (const QString); - void haptic (const QString); - void speaker (const QString); - void stickPotCalib (const QString); - void trainerCalib (const QString); - void currentCalib (const int); - void gsStickMode (const int); - void ppmMultiplier (const int); - void vBatCalib (const int); - void vBatWarn (const int); + void beeper (const QString); + void countryCode (const QString); + void display (const QString); + void haptic (const QString); + void speaker (const QString); + void stickPotCalib (const QString); + void trainerCalib (const QString); + void currentCalib (const int); + void gsStickMode (const int); + void ppmMultiplier (const int); + void vBatCalib (const int); + void vBatWarn (const int); - Profile(); - void remove(); - bool existsOnDisk(); - void init(int newIndex); - void flush(); + Profile(); + void remove(); + bool existsOnDisk(); + void init(int newIndex); + void flush(); }; -class AppData:protected CompStoreObj +class AppData: protected CompStoreObj { - // All the global variables -public: - Profile profile[MAX_PROFILES]; - JStickData joystick[MAX_JOYSTICKS]; - FwRevision fwRev; + // All the global variables + public: + Profile profile[MAX_PROFILES]; + JStickData joystick[MAX_JOYSTICKS]; + FwRevision fwRev; -private: - QStringList _recentFiles; - QByteArray _mainWinGeo; - QByteArray _mainWinState; - QByteArray _modelEditGeo; + private: + QStringList _recentFiles; + QByteArray _mainWinGeo; + QByteArray _mainWinState; + QByteArray _modelEditGeo; - QString _armMcu; - QString _avrArguments; - QString _avrPort; - QString _avrdudeLocation; - QString _compileServer; - QString _cpuId; - QString _dfuArguments; - QString _dfuLocation; - QString _lastFw; - QString _locale; - QString _mcu; - QString _programmer; - QString _sambaLocation; - QString _sambaPort; + QString _armMcu; + QString _avrArguments; + QString _avrPort; + QString _avrdudeLocation; + QString _compileServer; + QString _cpuId; + QString _dfuArguments; + QString _dfuLocation; + QString _lastFw; + QString _locale; + QString _mcu; + QString _programmer; + QString _sambaLocation; + QString _sambaPort; - QString _backupDir; - QString _gePath; - QString _eepromDir; - QString _flashDir; - QString _imagesDir; - QString _logDir; - QString _libDir; - QString _snapshotDir; - QString _updatesDir; + QString _backupDir; + QString _gePath; + QString _eepromDir; + QString _flashDir; + QString _imagesDir; + QString _logDir; + QString _libDir; + QString _snapshotDir; + QString _updatesDir; - bool _enableBackup; - bool _backupOnFlash; - bool _maximized; - bool _jsSupport; - bool _rev4aSupport; - bool _showSplash; - bool _snapToClpbrd; - bool _autoCheckApp; - bool _autoCheckFw; - bool _simuSW; - bool _enableWizard; + bool _enableBackup; + bool _backupOnFlash; + bool _maximized; + bool _jsSupport; + bool _rev4aSupport; + bool _showSplash; + bool _snapToClpbrd; + bool _autoCheckApp; + bool _autoCheckFw; + bool _simuSW; + bool _enableWizard; - int _backLight; - int _embedSplashes; - int _fwServerFails; - int _generalEditTab; - int _iconSize; - int _jsCtrl; - int _historySize; - int _modelEditTab; - int _id; - int _theme; - int _warningId; + int _backLight; + int _embedSplashes; + int _fwServerFails; + int _generalEditTab; + int _iconSize; + int _jsCtrl; + int _historySize; + int _modelEditTab; + int _id; + int _theme; + int _warningId; + public: + // All the get definitions + QStringList recentFiles(); + QByteArray mainWinGeo(); + QByteArray mainWinState(); + QByteArray modelEditGeo(); -public: - // All the get definitions - QStringList recentFiles(); - QByteArray mainWinGeo(); - QByteArray mainWinState(); - QByteArray modelEditGeo(); + QString armMcu(); + QString avrArguments(); + QString avrPort(); + QString avrdudeLocation(); + QString compileServer(); + QString cpuId(); + QString dfuArguments(); + QString dfuLocation(); + QString lastFw(); + QString locale(); + QString mcu(); + QString programmer(); + QString sambaLocation(); + QString sambaPort(); - QString armMcu(); - QString avrArguments(); - QString avrPort(); - QString avrdudeLocation(); - QString compileServer(); - QString cpuId(); - QString dfuArguments(); - QString dfuLocation(); - QString lastFw(); - QString locale(); - QString mcu(); - QString programmer(); - QString sambaLocation(); - QString sambaPort(); + QString backupDir(); + QString gePath(); + QString eepromDir(); + QString flashDir(); + QString imagesDir(); + QString logDir(); + QString libDir(); + QString snapshotDir(); + QString updatesDir(); - QString backupDir(); - QString gePath(); - QString eepromDir(); - QString flashDir(); - QString imagesDir(); - QString logDir(); - QString libDir(); - QString snapshotDir(); - QString updatesDir(); + bool enableBackup(); + bool backupOnFlash(); + bool jsSupport(); + bool rev4aSupport(); + bool maximized(); + bool showSplash(); + bool snapToClpbrd(); + bool autoCheckApp(); + bool autoCheckFw(); + bool simuSW(); + bool enableWizard(); - bool enableBackup(); - bool backupOnFlash(); - bool jsSupport(); - bool rev4aSupport(); - bool maximized(); - bool showSplash(); - bool snapToClpbrd(); - bool autoCheckApp(); - bool autoCheckFw(); - bool simuSW(); - bool enableWizard(); + int backLight(); + int embedSplashes(); + int fwServerFails(); + int generalEditTab(); + int iconSize(); + int historySize(); + int jsCtrl(); + int modelEditTab(); + int id(); + int theme(); + int warningId(); - int backLight(); - int embedSplashes(); - int fwServerFails(); - int generalEditTab(); - int iconSize(); - int historySize(); - int jsCtrl(); - int modelEditTab(); - int id(); - int theme(); - int warningId(); + // All the set definitions + void recentFiles (const QStringList x); + void mainWinGeo (const QByteArray); + void mainWinState (const QByteArray); + void modelEditGeo (const QByteArray); - // All the set definitions - void recentFiles (const QStringList x); - void mainWinGeo (const QByteArray); - void mainWinState (const QByteArray); - void modelEditGeo (const QByteArray); + void armMcu (const QString); + void avrArguments (const QString); + void avrPort (const QString); + void avrdudeLocation (const QString); + void compileServer (const QString); + void cpuId (const QString); + void dfuArguments (const QString); + void dfuLocation (const QString); + void lastFw (const QString); + void locale (const QString); + void mcu (const QString); + void programmer (const QString); + void sambaLocation (const QString); + void sambaPort (const QString); - void armMcu (const QString); - void avrArguments (const QString); - void avrPort (const QString); - void avrdudeLocation (const QString); - void compileServer (const QString); - void cpuId (const QString); - void dfuArguments (const QString); - void dfuLocation (const QString); - void lastFw (const QString); - void locale (const QString); - void mcu (const QString); - void programmer (const QString); - void sambaLocation (const QString); - void sambaPort (const QString); + void backupDir (const QString); + void gePath (const QString); + void eepromDir (const QString); + void flashDir (const QString); + void imagesDir (const QString); + void logDir (const QString); + void libDir (const QString); + void snapshotDir (const QString); + void updatesDir (const QString); - void backupDir (const QString); - void gePath (const QString); - void eepromDir (const QString); - void flashDir (const QString); - void imagesDir (const QString); - void logDir (const QString); - void libDir (const QString); - void snapshotDir (const QString); - void updatesDir (const QString); + void enableBackup (const bool); + void backupOnFlash (const bool); + void maximized (const bool); + void jsSupport (const bool); + void rev4aSupport (const bool); + void showSplash (const bool); + void snapToClpbrd (const bool); + void autoCheckApp (const bool); + void autoCheckFw (const bool); + void simuSW (const bool); + void enableWizard (const bool); - void enableBackup (const bool); - void backupOnFlash (const bool); - void maximized (const bool); - void jsSupport (const bool); - void rev4aSupport (const bool); - void showSplash (const bool); - void snapToClpbrd (const bool); - void autoCheckApp (const bool); - void autoCheckFw (const bool); - void simuSW (const bool); - void enableWizard (const bool); + void backLight (const int); + void embedSplashes (const int); + void fwServerFails (const int); + void generalEditTab (const int); + void iconSize (const int); + void historySize (const int); + void jsCtrl (const int); + void modelEditTab (const int); + void id (const int); + void theme (const int); + void warningId (const int); - void backLight (const int); - void embedSplashes (const int); - void fwServerFails (const int); - void generalEditTab (const int); - void iconSize (const int); - void historySize (const int); - void jsCtrl (const int); - void modelEditTab (const int); - void id (const int); - void theme (const int); - void warningId (const int); - - // Constructor - AppData(); + // Constructor + AppData(); }; extern AppData g; diff --git a/companion/src/main.cpp b/companion/src/companion.cpp similarity index 95% rename from companion/src/main.cpp rename to companion/src/companion.cpp index 88de87ed6..96a6d5597 100644 --- a/companion/src/main.cpp +++ b/companion/src/companion.cpp @@ -74,9 +74,6 @@ class MyProxyStyle : public QProxyStyle }; #endif -// Global data and storge object -AppData g; - int main(int argc, char *argv[]) { Q_INIT_RESOURCE(companion); diff --git a/companion/src/simulation/main.cpp b/companion/src/simulator.cpp similarity index 100% rename from companion/src/simulation/main.cpp rename to companion/src/simulator.cpp