[Companion] Unix format used everywhere

This commit is contained in:
Bertrand Songis
2016-11-23 16:42:24 +01:00
parent b0f5b646af
commit d5e4f7b6e9
32 changed files with 4331 additions and 4331 deletions
File diff suppressed because it is too large Load Diff
+54 -54
View File
@@ -20,58 +20,58 @@
#ifndef _GENERALEDIT_H_ #ifndef _GENERALEDIT_H_
#define _GENERALEDIT_H_ #define _GENERALEDIT_H_
#include <QtWidgets> #include <QtWidgets>
#include "eeprominterface.h" #include "eeprominterface.h"
#include "genericpanel.h" #include "genericpanel.h"
namespace Ui { namespace Ui {
class GeneralEdit; class GeneralEdit;
} }
class GeneralPanel : public GenericPanel class GeneralPanel : public GenericPanel
{ {
public: public:
GeneralPanel(QWidget *parent, GeneralSettings & generalSettings, Firmware * firmware): GeneralPanel(QWidget *parent, GeneralSettings & generalSettings, Firmware * firmware):
GenericPanel(parent, NULL, generalSettings, firmware) GenericPanel(parent, NULL, generalSettings, firmware)
{ {
} }
}; };
class GeneralEdit : public QDialog class GeneralEdit : public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
GeneralEdit(QWidget * parent, RadioData & radioData, Firmware * firmware); GeneralEdit(QWidget * parent, RadioData & radioData, Firmware * firmware);
~GeneralEdit(); ~GeneralEdit();
private: private:
Ui::GeneralEdit *ui; Ui::GeneralEdit *ui;
GeneralSettings & generalSettings; GeneralSettings & generalSettings;
bool switchDefPosEditLock; bool switchDefPosEditLock;
bool voiceLangEditLock; bool voiceLangEditLock;
bool mavbaudEditLock; bool mavbaudEditLock;
void getGeneralSwitchDefPos(int i, bool val); void getGeneralSwitchDefPos(int i, bool val);
void setSwitchDefPos(); void setSwitchDefPos();
void updateVarioPitchRange(); void updateVarioPitchRange();
signals: signals:
void modified(); void modified();
private slots: private slots:
void onTabModified(); void onTabModified();
void on_tabWidget_currentChanged(int index); void on_tabWidget_currentChanged(int index);
void on_calretrieve_PB_clicked(); void on_calretrieve_PB_clicked();
void on_calstore_PB_clicked(); void on_calstore_PB_clicked();
private: private:
Firmware * firmware; Firmware * firmware;
QVector<GenericPanel *> panels; QVector<GenericPanel *> panels;
void addTab(GenericPanel *panel, QString text); void addTab(GenericPanel *panel, QString text);
void closeEvent(QCloseEvent *event); void closeEvent(QCloseEvent *event);
}; };
#endif // _GENERALEDIT_H_ #endif // _GENERALEDIT_H_
+240 -240
View File
@@ -20,244 +20,244 @@
#ifndef _MAINWINDOW_H_ #ifndef _MAINWINDOW_H_
#define _MAINWINDOW_H_ #define _MAINWINDOW_H_
#include <QtWidgets> #include <QtWidgets>
#include <QDateTime> #include <QDateTime>
#include "downloaddialog.h" #include "downloaddialog.h"
#include "eeprominterface.h" #include "eeprominterface.h"
#define SPLASH_TIME 5 #define SPLASH_TIME 5
#define MAX_RECENT 15 #define MAX_RECENT 15
#define MAX_PROFILES 15 #define MAX_PROFILES 15
class MdiChild; class MdiChild;
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QAction; class QAction;
class QMenu; class QMenu;
class QMdiArea; class QMdiArea;
class QMdiSubWindow; class QMdiSubWindow;
class QSignalMapper; class QSignalMapper;
QT_END_NAMESPACE QT_END_NAMESPACE
#define CHECK_COMPANION 1 #define CHECK_COMPANION 1
#define CHECK_FIRMWARE 2 #define CHECK_FIRMWARE 2
#define SHOW_DIALOG_WAIT 4 #define SHOW_DIALOG_WAIT 4
#define AUTOMATIC_DOWNLOAD 8 #define AUTOMATIC_DOWNLOAD 8
class MainWindow : public QMainWindow class MainWindow : public QMainWindow
{ {
friend class FirmwarePreferencesDialog; friend class FirmwarePreferencesDialog;
Q_OBJECT Q_OBJECT
public: public:
MainWindow(); MainWindow();
protected: protected:
QString getCompanionUpdateBaseUrl(); QString getCompanionUpdateBaseUrl();
void dowloadLastFirmwareUpdate(); void dowloadLastFirmwareUpdate();
void startFirmwareDownload(); void startFirmwareDownload();
void closeEvent(QCloseEvent *event); void closeEvent(QCloseEvent *event);
void dragEnterEvent(QDragEnterEvent *event); void dragEnterEvent(QDragEnterEvent *event);
void dropEvent(QDropEvent *event); void dropEvent(QDropEvent *event);
void setLanguage(const QString & langString); void setLanguage(const QString & langString);
QString seekCodeString(const QByteArray & qba, const QString & label); QString seekCodeString(const QByteArray & qba, const QString & label);
private slots: private slots:
void openDocURL(); void openDocURL();
void setSysLanguage() { setLanguage(""); }; void setSysLanguage() { setLanguage(""); };
void setCZLanguage() { setLanguage("cs_CZ"); }; void setCZLanguage() { setLanguage("cs_CZ"); };
void setDELanguage() { setLanguage("de_DE"); }; void setDELanguage() { setLanguage("de_DE"); };
void setENLanguage() { setLanguage("en"); }; void setENLanguage() { setLanguage("en"); };
void setFILanguage() { setLanguage("fi_FI"); }; void setFILanguage() { setLanguage("fi_FI"); };
void setFRLanguage() { setLanguage("fr_FR"); }; void setFRLanguage() { setLanguage("fr_FR"); };
void setITLanguage() { setLanguage("it_IT"); }; void setITLanguage() { setLanguage("it_IT"); };
void setHELanguage() { setLanguage("he_IL"); }; void setHELanguage() { setLanguage("he_IL"); };
void setPLLanguage() { setLanguage("pl_PL"); }; void setPLLanguage() { setLanguage("pl_PL"); };
void setESLanguage() { setLanguage("es_ES"); }; void setESLanguage() { setLanguage("es_ES"); };
void setPTLanguage() { setLanguage("pt_PT"); }; void setPTLanguage() { setLanguage("pt_PT"); };
void setRULanguage() { setLanguage("ru_RU"); }; void setRULanguage() { setLanguage("ru_RU"); };
void setSELanguage() { setLanguage("sv_SE"); }; void setSELanguage() { setLanguage("sv_SE"); };
void setNLLanguage() { setLanguage("nl_NL"); }; void setNLLanguage() { setLanguage("nl_NL"); };
void setTheme(int index); void setTheme(int index);
void setClassicTheme() {setTheme(0);}; void setClassicTheme() {setTheme(0);};
void setYericoTheme() {setTheme(1);}; void setYericoTheme() {setTheme(1);};
void setMonoWhiteTheme() {setTheme(2);}; void setMonoWhiteTheme() {setTheme(2);};
void setMonochromeTheme(){setTheme(3);}; void setMonochromeTheme(){setTheme(3);};
void setMonoBlueTheme() {setTheme(4);}; void setMonoBlueTheme() {setTheme(4);};
void setIconThemeSize(int index); void setIconThemeSize(int index);
void setSmallIconThemeSize() {setIconThemeSize(0);}; void setSmallIconThemeSize() {setIconThemeSize(0);};
void setNormalIconThemeSize() {setIconThemeSize(1);}; void setNormalIconThemeSize() {setIconThemeSize(1);};
void setBigIconThemeSize() {setIconThemeSize(2);}; void setBigIconThemeSize() {setIconThemeSize(2);};
void setHugeIconThemeSize() {setIconThemeSize(3);}; void setHugeIconThemeSize() {setIconThemeSize(3);};
void checkForUpdates(); void checkForUpdates();
void checkForFirmwareUpdate(); void checkForFirmwareUpdate();
void checkForCompanionUpdateFinished(QNetworkReply * reply); void checkForCompanionUpdateFinished(QNetworkReply * reply);
void checkForFirmwareUpdateFinished(QNetworkReply * reply); void checkForFirmwareUpdateFinished(QNetworkReply * reply);
void displayWarnings(); void displayWarnings();
void doAutoUpdates(); void doAutoUpdates();
void doUpdates(); void doUpdates();
void updateDownloaded(); void updateDownloaded();
void firmwareDownloadAccepted(); void firmwareDownloadAccepted();
void newFile(); void newFile();
void openFile(); void openFile();
void save(); void save();
void saveAs(); void saveAs();
void cut(); void cut();
void openRecentFile(); void openRecentFile();
void loadProfile(); void loadProfile();
void logFile(); void logFile();
void copy(); void copy();
void paste(); void paste();
void writeEeprom(); void writeEeprom();
void readEeprom(); void readEeprom();
void writeFlash(QString fileToFlash=""); void writeFlash(QString fileToFlash="");
void readFlash(); void readFlash();
void writeBackup(); void writeBackup();
void readBackup(); void readBackup();
void burnConfig(); void burnConfig();
void burnList(); void burnList();
void burnFuses(); void burnFuses();
void simulate(); void simulate();
void contributors(); void contributors();
void sdsync(); void sdsync();
void changelog(); void changelog();
void fwchangelog(); void fwchangelog();
void customizeSplash(); void customizeSplash();
void about(); void about();
void compare(); void compare();
void print(); void print();
void loadBackup(); void loadBackup();
void appPrefs(); void appPrefs();
void fwPrefs(); void fwPrefs();
void updateMenus(); void updateMenus();
void createProfile(); void createProfile();
MdiChild *createMdiChild(); MdiChild *createMdiChild();
void setActiveSubWindow(QWidget *window); void setActiveSubWindow(QWidget *window);
QMenu * createRecentFileMenu(); QMenu * createRecentFileMenu();
QMenu * createProfilesMenu(); QMenu * createProfilesMenu();
void autoClose(); void autoClose();
private: private:
void closeUpdatesWaitDialog(); void closeUpdatesWaitDialog();
void onUpdatesError(); void onUpdatesError();
void createActions(); void createActions();
QAction * addAct(const QString &, const QString &, const QString &, enum QKeySequence::StandardKey, const char *, QObject *slotObj=NULL); QAction * addAct(const QString &, const QString &, const QString &, enum QKeySequence::StandardKey, const char *, QObject *slotObj=NULL);
QAction * addAct(const QString &, const QString &, const QString &, const QKeySequence &, const char *, QObject *slotObj=NULL); QAction * addAct(const QString &, const QString &, const QString &, const QKeySequence &, const char *, QObject *slotObj=NULL);
QAction * addAct(QActionGroup *, const QString &, const QString &, const char *); QAction * addAct(QActionGroup *, const QString &, const QString &, const char *);
QAction * addAct(const QString &, const QString &, const QString &, const char *); QAction * addAct(const QString &, const QString &, const QString &, const char *);
void createMenus(); void createMenus();
void createToolBars(); void createToolBars();
void createStatusBar(); void createStatusBar();
void updateRecentFileActions(); void updateRecentFileActions();
void updateProfilesActions(); void updateProfilesActions();
void updateIconSizeActions(); void updateIconSizeActions();
void updateLanguageActions(); void updateLanguageActions();
void updateIconThemeActions(); void updateIconThemeActions();
int getFileType(const QString & fullFileName); int getFileType(const QString & fullFileName);
QString Theme; QString Theme;
QString ISize; QString ISize;
QString strippedName(const QString & fullFileName); QString strippedName(const QString & fullFileName);
MdiChild *activeMdiChild(); MdiChild *activeMdiChild();
QMdiSubWindow *findMdiChild(const QString & fileName); QMdiSubWindow *findMdiChild(const QString & fileName);
int getEpromVersion(QString fileName); int getEpromVersion(QString fileName);
bool readEepromFromRadio(const QString & filename); bool readEepromFromRadio(const QString & filename);
bool writeEepromToRadio(const QString & filename); bool writeEepromToRadio(const QString & filename);
bool readFirmwareFromRadio(const QString & filename); bool readFirmwareFromRadio(const QString & filename);
bool writeFirmwareToRadio(const QString & filename); bool writeFirmwareToRadio(const QString & filename);
QMdiArea *mdiArea; QMdiArea *mdiArea;
QSignalMapper *windowMapper; QSignalMapper *windowMapper;
QString installer_fileName; QString installer_fileName;
downloadDialog * downloadDialog_forWait; downloadDialog * downloadDialog_forWait;
unsigned int checkForUpdatesState; unsigned int checkForUpdatesState;
QString firmwareVersionString; QString firmwareVersionString;
QNetworkAccessManager *networkManager; QNetworkAccessManager *networkManager;
QMenu *fileMenu; QMenu *fileMenu;
QMenu *editMenu; QMenu *editMenu;
QMenu *settingsMenu; QMenu *settingsMenu;
QMenu *burnMenu; QMenu *burnMenu;
QMenu *helpMenu; QMenu *helpMenu;
QToolBar *fileToolBar; QToolBar *fileToolBar;
QToolBar *editToolBar; QToolBar *editToolBar;
QToolBar *burnToolBar; QToolBar *burnToolBar;
QToolBar *helpToolBar; QToolBar *helpToolBar;
QAction *newAct; QAction *newAct;
QAction *openAct; QAction *openAct;
QAction *recentAct; QAction *recentAct;
QAction *saveAct; QAction *saveAct;
QAction *saveAsAct; QAction *saveAsAct;
QAction *exitAct; QAction *exitAct;
QAction *appPrefsAct; QAction *appPrefsAct;
QAction *fwPrefsAct; QAction *fwPrefsAct;
QAction *checkForUpdatesAct; QAction *checkForUpdatesAct;
QAction *contributorsAct; QAction *contributorsAct;
QAction *sdsyncAct; QAction *sdsyncAct;
QAction *changelogAct; QAction *changelogAct;
QAction *fwchangelogAct; QAction *fwchangelogAct;
QAction *compareAct; QAction *compareAct;
QAction *editSplashAct; QAction *editSplashAct;
QAction *cutAct; QAction *cutAct;
QAction *copyAct; QAction *copyAct;
QAction *pasteAct; QAction *pasteAct;
QAction *writeEepromAct; QAction *writeEepromAct;
QAction *readEepromAct; QAction *readEepromAct;
QAction *burnConfigAct; QAction *burnConfigAct;
QAction *burnListAct; QAction *burnListAct;
QAction *burnFusesAct; QAction *burnFusesAct;
QAction *writeFlashAct; QAction *writeFlashAct;
QAction *readFlashAct; QAction *readFlashAct;
QAction *writeBackupToRadioAct; QAction *writeBackupToRadioAct;
QAction *readBackupToFileAct; QAction *readBackupToFileAct;
QAction *simulateAct; QAction *simulateAct;
QAction *separatorAct; QAction *separatorAct;
QAction *aboutAct; QAction *aboutAct;
QAction *printAct; QAction *printAct;
QAction *loadbackupAct; QAction *loadbackupAct;
QAction *logsAct; QAction *logsAct;
QAction *recentFileActs[MAX_RECENT]; QAction *recentFileActs[MAX_RECENT];
QAction *profileActs[MAX_PROFILES]; QAction *profileActs[MAX_PROFILES];
QAction *createProfileAct; QAction *createProfileAct;
QAction *classicThemeAct; QAction *classicThemeAct;
QAction *yericoThemeAct; QAction *yericoThemeAct;
QAction *monoThemeAct; QAction *monoThemeAct;
QAction *monoBlueAct; QAction *monoBlueAct;
QAction *monoWhiteAct; QAction *monoWhiteAct;
QAction *smallIconAct; QAction *smallIconAct;
QAction *normalIconAct; QAction *normalIconAct;
QAction *bigIconAct; QAction *bigIconAct;
QAction *hugeIconAct; QAction *hugeIconAct;
QAction *sysLangAct; QAction *sysLangAct;
QAction *czechLangAct; QAction *czechLangAct;
QAction *germanLangAct; QAction *germanLangAct;
QAction *englishLangAct; QAction *englishLangAct;
QAction *finnishLangAct; QAction *finnishLangAct;
QAction *frenchLangAct; QAction *frenchLangAct;
QAction *italianLangAct; QAction *italianLangAct;
// QAction *hebrewLangAct; // QAction *hebrewLangAct;
QAction *polishLangAct; QAction *polishLangAct;
// QAction *portugueseLangAct; // QAction *portugueseLangAct;
QAction *spanishLangAct; QAction *spanishLangAct;
QAction *swedishLangAct; QAction *swedishLangAct;
// QAction *russianLangAct; // QAction *russianLangAct;
// QAction *dutchLangAct; // QAction *dutchLangAct;
QAction *openDocURLAct; QAction *openDocURLAct;
}; };
#endif // _MAINWINDOW_H_ #endif // _MAINWINDOW_H_
+85 -85
View File
@@ -20,89 +20,89 @@
#ifndef _MDICHILD_H_ #ifndef _MDICHILD_H_
#define _MDICHILD_H_ #define _MDICHILD_H_
#include <QtGui> #include <QtGui>
#include "eeprominterface.h" #include "eeprominterface.h"
namespace Ui { namespace Ui {
class mdiChild; class mdiChild;
} }
#define ER9X_EEPROM_FILE_TYPE "ER9X_EEPROM_FILE" #define ER9X_EEPROM_FILE_TYPE "ER9X_EEPROM_FILE"
#define EEPE_EEPROM_FILE_HEADER "EEPE EEPROM FILE" #define EEPE_EEPROM_FILE_HEADER "EEPE EEPROM FILE"
#define EEPE_MODEL_FILE_HEADER "EEPE MODEL FILE" #define EEPE_MODEL_FILE_HEADER "EEPE MODEL FILE"
class MdiChild : public QWidget class MdiChild : public QWidget
{ {
friend class ModelsListWidget; friend class ModelsListWidget;
Q_OBJECT Q_OBJECT
public: public:
MdiChild(); MdiChild();
~MdiChild(); ~MdiChild();
void newFile(); void newFile();
bool loadFile(const QString &fileName, bool resetCurrentFile=true); bool loadFile(const QString &fileName, bool resetCurrentFile=true);
bool loadBackup(); bool loadBackup();
bool save(); bool save();
bool saveAs(bool isNew=false); bool saveAs(bool isNew=false);
bool saveFile(const QString &fileName, bool setCurrent=true); bool saveFile(const QString &fileName, bool setCurrent=true);
bool hasSelection(); bool hasSelection();
QString userFriendlyCurrentFile(); QString userFriendlyCurrentFile();
QString currentFile() { return curFile; } QString currentFile() { return curFile; }
// void keyPressEvent(QKeyEvent *event); // void keyPressEvent(QKeyEvent *event);
bool hasPasteData(); bool hasPasteData();
void viableModelSelected(bool viable); void viableModelSelected(bool viable);
void eepromInterfaceChanged(); void eepromInterfaceChanged();
void setEEpromAvail(int eavail); void setEEpromAvail(int eavail);
int getCurrentRow() const; int getCurrentRow() const;
signals: signals:
void copyAvailable(bool val); void copyAvailable(bool val);
protected: protected:
void closeEvent(QCloseEvent *event); void closeEvent(QCloseEvent *event);
private slots: private slots:
void documentWasModified(); void documentWasModified();
void on_SimulateTxButton_clicked(); void on_SimulateTxButton_clicked();
void qSleep(int ms); void qSleep(int ms);
public slots: public slots:
void checkAndInitModel(int row); void checkAndInitModel(int row);
void generalEdit(); void generalEdit();
void modelEdit(); void modelEdit();
void wizardEdit(); void wizardEdit();
void openEditWindow(); void openEditWindow();
void cut(); void cut();
void copy(); void copy();
void paste(); void paste();
void writeEeprom(); void writeEeprom();
void simulate(); void simulate();
void print(int model=-1, QString filename=""); void print(int model=-1, QString filename="");
void setModified(); void setModified();
void updateTitle(); void updateTitle();
private: private:
bool maybeSave(); bool maybeSave();
void setCurrentFile(const QString &fileName); void setCurrentFile(const QString &fileName);
QString strippedName(const QString &fullFileName); QString strippedName(const QString &fullFileName);
void saveSelection(); void saveSelection();
void restoreSelection(); void restoreSelection();
bool loadOtxFile(const QString &fileName, bool resetCurrentFile); bool loadOtxFile(const QString &fileName, bool resetCurrentFile);
Ui::mdiChild *ui; Ui::mdiChild *ui;
QString curFile; QString curFile;
Firmware * firmware; Firmware * firmware;
RadioData radioData; RadioData radioData;
bool isUntitled; bool isUntitled;
bool fileChanged; bool fileChanged;
int EEPromAvail; int EEPromAvail;
}; };
#endif // _MDICHILD_H_ #endif // _MDICHILD_H_
+45 -45
View File
@@ -20,49 +20,49 @@
#ifndef _CHANNELS_H_ #ifndef _CHANNELS_H_
#define _CHANNELS_H_ #define _CHANNELS_H_
#include "helpers.h" #include "helpers.h"
#include "modeledit.h" #include "modeledit.h"
class GVarGroup; class GVarGroup;
class LimitsGroup class LimitsGroup
{ {
public: public:
LimitsGroup(Firmware * firmware, TableLayout *tableLayout, int row, int col, int & value, const ModelData & model, int min, int max, int deflt); LimitsGroup(Firmware * firmware, TableLayout *tableLayout, int row, int col, int & value, const ModelData & model, int min, int max, int deflt);
~LimitsGroup(); ~LimitsGroup();
void updateMinMax(int max); void updateMinMax(int max);
protected: protected:
Firmware * firmware; Firmware * firmware;
QDoubleSpinBox * spinbox; QDoubleSpinBox * spinbox;
GVarGroup * gvarGroup; GVarGroup * gvarGroup;
int & value; int & value;
double displayStep; double displayStep;
}; };
class Channels : public ModelPanel class Channels : public ModelPanel
{ {
Q_OBJECT Q_OBJECT
public: public:
Channels(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware); Channels(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware);
~Channels(); ~Channels();
private: private:
QVector<LimitsGroup *> limitsGroups; QVector<LimitsGroup *> limitsGroups;
public slots: public slots:
void refreshExtendedLimits(); void refreshExtendedLimits();
private slots: private slots:
void symlimitsEdited(); void symlimitsEdited();
void nameEdited(); void nameEdited();
void invEdited(); void invEdited();
void curveEdited(); void curveEdited();
void ppmcenterEdited(); void ppmcenterEdited();
}; };
#endif // _CHANNELS_H_ #endif // _CHANNELS_H_
+68 -68
View File
@@ -20,72 +20,72 @@
#ifndef _CURVES_H_ #ifndef _CURVES_H_
#define _CURVES_H_ #define _CURVES_H_
#include "modeledit.h" #include "modeledit.h"
#include "eeprominterface.h" #include "eeprominterface.h"
enum CopyAction { enum CopyAction {
CURVE_COPY, CURVE_COPY,
CURVE_PASTE, CURVE_PASTE,
CURVE_RESET, CURVE_RESET,
CURVE_RESETALL CURVE_RESETALL
}; };
namespace Ui { namespace Ui {
class Curves; class Curves;
} }
typedef float (*curveFunction) (float x, float coeff, float yMin, float yMid, float yMax); typedef float (*curveFunction) (float x, float coeff, float yMin, float yMid, float yMax);
struct CurveCreatorTemplate { struct CurveCreatorTemplate {
QString name; QString name;
unsigned int flags; unsigned int flags;
curveFunction function; curveFunction function;
}; };
class Curves : public ModelPanel class Curves : public ModelPanel
{ {
Q_OBJECT Q_OBJECT
public: public:
Curves(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware); Curves(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware);
virtual ~Curves(); virtual ~Curves();
virtual void update(); virtual void update();
private slots: private slots:
void editCurve(); void editCurve();
void ShowContextMenu(const QPoint& pos); void ShowContextMenu(const QPoint& pos);
void plotCurve(bool checked); void plotCurve(bool checked);
void on_curveName_editingFinished(); void on_curveName_editingFinished();
void on_curvePoints_currentIndexChanged(int index); void on_curvePoints_currentIndexChanged(int index);
void on_curveCustom_currentIndexChanged(int index); void on_curveCustom_currentIndexChanged(int index);
void on_curveSmooth_currentIndexChanged(int index); void on_curveSmooth_currentIndexChanged(int index);
void onPointEdited(); void onPointEdited();
void onNodeMoved(int x, int y); void onNodeMoved(int x, int y);
void onNodeFocus(); void onNodeFocus();
void onNodeUnfocus(); void onNodeUnfocus();
void on_curveType_currentIndexChanged(int index); void on_curveType_currentIndexChanged(int index);
void on_curveApply_clicked(); void on_curveApply_clicked();
protected: protected:
virtual void resizeEvent(QResizeEvent *event); virtual void resizeEvent(QResizeEvent *event);
void addTemplate(QString name, unsigned int flags, curveFunction function); void addTemplate(QString name, unsigned int flags, curveFunction function);
private: private:
Ui::Curves *ui; Ui::Curves *ui;
int currentCurve; int currentCurve;
bool visibleCurves[CPN_MAX_CURVES]; bool visibleCurves[CPN_MAX_CURVES];
QSpinBox * spnx[CPN_MAX_POINTS]; QSpinBox * spnx[CPN_MAX_POINTS];
QSpinBox * spny[CPN_MAX_POINTS]; QSpinBox * spny[CPN_MAX_POINTS];
QVector<CurveCreatorTemplate> templates; QVector<CurveCreatorTemplate> templates;
void setCurrentCurve(int index); void setCurrentCurve(int index);
void updateCurve(); void updateCurve();
void updateCurveType(); void updateCurveType();
void updateCurvePoints(); void updateCurvePoints();
bool allowCurveType(int points, CurveData::CurveType type); bool allowCurveType(int points, CurveData::CurveType type);
void setPointY(int i, int x, int y); void setPointY(int i, int x, int y);
}; };
#endif // _CURVES_H_ #endif // _CURVES_H_
+76 -76
View File
@@ -20,80 +20,80 @@
#ifndef _CUSTOMFUNCTIONS_H_ #ifndef _CUSTOMFUNCTIONS_H_
#define _CUSTOMFUNCTIONS_H_ #define _CUSTOMFUNCTIONS_H_
#include "modeledit.h" #include "modeledit.h"
#include "eeprominterface.h" #include "eeprominterface.h"
#include <QtMultimedia> #include <QtMultimedia>
class RepeatComboBox: public QComboBox class RepeatComboBox: public QComboBox
{ {
Q_OBJECT Q_OBJECT
public: public:
RepeatComboBox(QWidget * parent, int & repeatParam); RepeatComboBox(QWidget * parent, int & repeatParam);
void update(); void update();
signals: signals:
void modified(); void modified();
private slots: private slots:
void onIndexChanged(int); void onIndexChanged(int);
protected: protected:
int & repeatParam; int & repeatParam;
}; };
class CustomFunctionsPanel : public GenericPanel class CustomFunctionsPanel : public GenericPanel
{ {
Q_OBJECT Q_OBJECT
public: public:
CustomFunctionsPanel(QWidget *parent, ModelData * mode, GeneralSettings & generalSettings, Firmware * firmware); CustomFunctionsPanel(QWidget *parent, ModelData * mode, GeneralSettings & generalSettings, Firmware * firmware);
~CustomFunctionsPanel(); ~CustomFunctionsPanel();
virtual void update(); virtual void update();
protected: protected:
CustomFunctionData * functions; CustomFunctionData * functions;
private slots: private slots:
void customFunctionEdited(); void customFunctionEdited();
void functionEdited(); void functionEdited();
void fsw_customContextMenuRequested(QPoint pos); void fsw_customContextMenuRequested(QPoint pos);
void refreshCustomFunction(int index, bool modified=false); void refreshCustomFunction(int index, bool modified=false);
void onChildModified(); void onChildModified();
void playMusic(); void playMusic();
void onMediaPlayerStateChanged(QMediaPlayer::State state); void onMediaPlayerStateChanged(QMediaPlayer::State state);
void onMediaPlayerError(QMediaPlayer::Error error); void onMediaPlayerError(QMediaPlayer::Error error);
void fswDelete(); void fswDelete();
void fswCopy(); void fswCopy();
void fswPaste(); void fswPaste();
void fswCut(); void fswCut();
private: private:
void populateFuncCB(QComboBox *b, unsigned int value); void populateFuncCB(QComboBox *b, unsigned int value);
void populateGVmodeCB(QComboBox *b, unsigned int value); void populateGVmodeCB(QComboBox *b, unsigned int value);
void populateFuncParamCB(QComboBox *b, uint function, unsigned int value, unsigned int adjustmode=0); void populateFuncParamCB(QComboBox *b, uint function, unsigned int value, unsigned int adjustmode=0);
QSet<QString> tracksSet; QSet<QString> tracksSet;
QSet<QString> scriptsSet; QSet<QString> scriptsSet;
int mediaPlayerCurrent; int mediaPlayerCurrent;
QComboBox * fswtchSwtch[CPN_MAX_CUSTOM_FUNCTIONS]; QComboBox * fswtchSwtch[CPN_MAX_CUSTOM_FUNCTIONS];
QComboBox * fswtchFunc[CPN_MAX_CUSTOM_FUNCTIONS]; QComboBox * fswtchFunc[CPN_MAX_CUSTOM_FUNCTIONS];
QCheckBox * fswtchParamGV[CPN_MAX_CUSTOM_FUNCTIONS]; QCheckBox * fswtchParamGV[CPN_MAX_CUSTOM_FUNCTIONS];
QDoubleSpinBox * fswtchParam[CPN_MAX_CUSTOM_FUNCTIONS]; QDoubleSpinBox * fswtchParam[CPN_MAX_CUSTOM_FUNCTIONS];
QTimeEdit * fswtchParamTime[CPN_MAX_CUSTOM_FUNCTIONS]; QTimeEdit * fswtchParamTime[CPN_MAX_CUSTOM_FUNCTIONS];
QPushButton * playBT[CPN_MAX_CUSTOM_FUNCTIONS]; QPushButton * playBT[CPN_MAX_CUSTOM_FUNCTIONS];
QComboBox * fswtchParamT[CPN_MAX_CUSTOM_FUNCTIONS]; QComboBox * fswtchParamT[CPN_MAX_CUSTOM_FUNCTIONS];
QComboBox * fswtchParamArmT[CPN_MAX_CUSTOM_FUNCTIONS]; QComboBox * fswtchParamArmT[CPN_MAX_CUSTOM_FUNCTIONS];
QCheckBox * fswtchEnable[CPN_MAX_CUSTOM_FUNCTIONS]; QCheckBox * fswtchEnable[CPN_MAX_CUSTOM_FUNCTIONS];
RepeatComboBox * fswtchRepeat[CPN_MAX_CUSTOM_FUNCTIONS]; RepeatComboBox * fswtchRepeat[CPN_MAX_CUSTOM_FUNCTIONS];
QComboBox * fswtchGVmode[CPN_MAX_CUSTOM_FUNCTIONS]; QComboBox * fswtchGVmode[CPN_MAX_CUSTOM_FUNCTIONS];
QSlider * fswtchBLcolor[CPN_MAX_CUSTOM_FUNCTIONS]; QSlider * fswtchBLcolor[CPN_MAX_CUSTOM_FUNCTIONS];
QMediaPlayer * mediaPlayer; QMediaPlayer * mediaPlayer;
int selectedFunction; int selectedFunction;
}; };
#endif // _CUSTOMFUNCTIONS_H_ #endif // _CUSTOMFUNCTIONS_H_
+89 -89
View File
@@ -18,92 +18,92 @@
* GNU General Public License for more details. * GNU General Public License for more details.
*/ */
#include <QPainter> #include <QPainter>
#include "edge.h" #include "edge.h"
#include "node.h" #include "node.h"
#include <math.h> #include <math.h>
Edge::Edge(Node *sourceNode, Node *destNode) Edge::Edge(Node *sourceNode, Node *destNode)
: arrowSize(10) : arrowSize(10)
{ {
setAcceptedMouseButtons(0); setAcceptedMouseButtons(0);
source = sourceNode; source = sourceNode;
dest = destNode; dest = destNode;
source->addEdge(this); source->addEdge(this);
dest->addEdge(this); dest->addEdge(this);
adjust(); adjust();
} }
Edge::~Edge() Edge::~Edge()
{ {
} }
Node *Edge::sourceNode() const Node *Edge::sourceNode() const
{ {
return source; return source;
} }
void Edge::setSourceNode(Node *node) void Edge::setSourceNode(Node *node)
{ {
source = node; source = node;
adjust(); adjust();
} }
Node *Edge::destNode() const Node *Edge::destNode() const
{ {
return dest; return dest;
} }
void Edge::setDestNode(Node *node) void Edge::setDestNode(Node *node)
{ {
dest = node; dest = node;
adjust(); adjust();
} }
void Edge::adjust() void Edge::adjust()
{ {
if (!source || !dest) if (!source || !dest)
return; return;
QLineF line(mapFromItem(source, 0, 0), mapFromItem(dest, 0, 0)); QLineF line(mapFromItem(source, 0, 0), mapFromItem(dest, 0, 0));
qreal length = line.length(); qreal length = line.length();
prepareGeometryChange(); prepareGeometryChange();
int ballSize = source->getBallSize(); int ballSize = source->getBallSize();
if (length > qreal(ballSize)) { if (length > qreal(ballSize)) {
QPointF edgeOffset((line.dx() * ballSize / 2) / length, (line.dy() * ballSize / 2) / length); QPointF edgeOffset((line.dx() * ballSize / 2) / length, (line.dy() * ballSize / 2) / length);
sourcePoint = line.p1() + edgeOffset; sourcePoint = line.p1() + edgeOffset;
destPoint = line.p2() - edgeOffset; destPoint = line.p2() - edgeOffset;
} else { } else {
sourcePoint = destPoint = line.p1(); sourcePoint = destPoint = line.p1();
} }
} }
QRectF Edge::boundingRect() const QRectF Edge::boundingRect() const
{ {
if (!source || !dest) if (!source || !dest)
return QRectF(); return QRectF();
qreal penWidth = 1; qreal penWidth = 1;
qreal extra = (penWidth + arrowSize) / 2.0; qreal extra = (penWidth + arrowSize) / 2.0;
return QRectF(sourcePoint, QSizeF(destPoint.x() - sourcePoint.x(), return QRectF(sourcePoint, QSizeF(destPoint.x() - sourcePoint.x(),
destPoint.y() - sourcePoint.y())) destPoint.y() - sourcePoint.y()))
.normalized() .normalized()
.adjusted(-extra, -extra, extra, extra); .adjusted(-extra, -extra, extra, extra);
} }
void Edge::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) void Edge::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
{ {
if (!source || !dest) if (!source || !dest)
return; return;
QLineF line(sourcePoint, destPoint); QLineF line(sourcePoint, destPoint);
if (qFuzzyCompare(line.length(), qreal(0.))) if (qFuzzyCompare(line.length(), qreal(0.)))
return; return;
// Draw the line itself // Draw the line itself
painter->setPen(QPen(Qt::black, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); painter->setPen(QPen(Qt::black, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
painter->drawLine(line); painter->drawLine(line);
} }
+34 -34
View File
@@ -20,38 +20,38 @@
#ifndef _EDGE_H_ #ifndef _EDGE_H_
#define _EDGE_H_ #define _EDGE_H_
#include <QGraphicsItem> #include <QGraphicsItem>
class Node; class Node;
class Edge : public QGraphicsItem class Edge : public QGraphicsItem
{ {
public: public:
Edge(Node *sourceNode, Node *destNode); Edge(Node *sourceNode, Node *destNode);
~Edge(); ~Edge();
Node *sourceNode() const; Node *sourceNode() const;
void setSourceNode(Node *node); void setSourceNode(Node *node);
Node *destNode() const; Node *destNode() const;
void setDestNode(Node *node); void setDestNode(Node *node);
void adjust(); void adjust();
enum { Type = UserType + 2 }; enum { Type = UserType + 2 };
int type() const { return Type; } int type() const { return Type; }
protected: protected:
QRectF boundingRect() const; QRectF boundingRect() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
private: private:
Node *source, *dest; Node *source, *dest;
QPointF sourcePoint; QPointF sourcePoint;
QPointF destPoint; QPointF destPoint;
qreal arrowSize; qreal arrowSize;
}; };
#endif // _EDGE_H_ #endif // _EDGE_H_
+83 -83
View File
@@ -20,87 +20,87 @@
#ifndef _FLIGHTMODES_H_ #ifndef _FLIGHTMODES_H_
#define _FLIGHTMODES_H_ #define _FLIGHTMODES_H_
#include "modeledit.h" #include "modeledit.h"
#include "eeprominterface.h" #include "eeprominterface.h"
namespace Ui { namespace Ui {
class FlightMode; class FlightMode;
} }
class FlightModePanel : public ModelPanel class FlightModePanel : public ModelPanel
{ {
Q_OBJECT Q_OBJECT
public: public:
FlightModePanel(QWidget *parent, ModelData &model, int modeIdx, GeneralSettings & generalSettings, Firmware * firmware); FlightModePanel(QWidget *parent, ModelData &model, int modeIdx, GeneralSettings & generalSettings, Firmware * firmware);
virtual ~FlightModePanel(); virtual ~FlightModePanel();
virtual void update(); virtual void update();
signals: signals:
void nameModified(); void nameModified();
private slots: private slots:
void phaseName_editingFinished(); void phaseName_editingFinished();
void phaseSwitch_currentIndexChanged(int index); void phaseSwitch_currentIndexChanged(int index);
void phaseFadeIn_editingFinished(); void phaseFadeIn_editingFinished();
void phaseFadeOut_editingFinished(); void phaseFadeOut_editingFinished();
void phaseTrimUse_currentIndexChanged(int index); void phaseTrimUse_currentIndexChanged(int index);
void phaseTrim_valueChanged(); void phaseTrim_valueChanged();
void phaseTrimSlider_valueChanged(); void phaseTrimSlider_valueChanged();
void GVName_editingFinished(); void GVName_editingFinished();
void phaseGVValue_editingFinished(); void phaseGVValue_editingFinished();
void phaseGVUse_currentIndexChanged(int index); void phaseGVUse_currentIndexChanged(int index);
void phaseGVPopupToggled(bool checked); void phaseGVPopupToggled(bool checked);
void phaseREValue_editingFinished(); void phaseREValue_editingFinished();
void phaseREUse_currentIndexChanged(int index); void phaseREUse_currentIndexChanged(int index);
void name_customContextMenuRequested(const QPoint & pos); void name_customContextMenuRequested(const QPoint & pos);
void fmClear(); void fmClear();
private: private:
Ui::FlightMode *ui; Ui::FlightMode *ui;
int phaseIdx; int phaseIdx;
FlightModeData & phase; FlightModeData & phase;
int reCount; int reCount;
int gvCount; int gvCount;
QVector<QLabel *> trimsLabel; QVector<QLabel *> trimsLabel;
QLineEdit * gvNames[CPN_MAX_GVARS]; QLineEdit * gvNames[CPN_MAX_GVARS];
QSpinBox * gvValues[CPN_MAX_GVARS]; QSpinBox * gvValues[CPN_MAX_GVARS];
QCheckBox * gvPopups[CPN_MAX_GVARS]; QCheckBox * gvPopups[CPN_MAX_GVARS];
QComboBox * gvUse[CPN_MAX_GVARS]; QComboBox * gvUse[CPN_MAX_GVARS];
QSpinBox * reValues[CPN_MAX_ENCODERS]; QSpinBox * reValues[CPN_MAX_ENCODERS];
QComboBox * reUse[CPN_MAX_ENCODERS]; QComboBox * reUse[CPN_MAX_ENCODERS];
QVector<QComboBox *> trimsUse; QVector<QComboBox *> trimsUse;
QVector<QSpinBox *> trimsValue; QVector<QSpinBox *> trimsValue;
QVector<QSlider *> trimsSlider; QVector<QSlider *> trimsSlider;
void trimUpdate(unsigned int trim); void trimUpdate(unsigned int trim);
}; };
class FlightModesPanel : public ModelPanel class FlightModesPanel : public ModelPanel
{ {
Q_OBJECT Q_OBJECT
public: public:
FlightModesPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware); FlightModesPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware);
virtual ~FlightModesPanel(); virtual ~FlightModesPanel();
virtual void update(); virtual void update();
private slots: private slots:
void onPhaseModified(); void onPhaseModified();
void onPhaseNameChanged(); void onPhaseNameChanged();
void on_tabWidget_currentChanged(int index); void on_tabWidget_currentChanged(int index);
private: private:
int modesCount; int modesCount;
QTabWidget *tabWidget; QTabWidget *tabWidget;
QString getTabName(int index); QString getTabName(int index);
QVector<FlightModePanel *> panels; QVector<FlightModePanel *> panels;
}; };
#endif // _FLIGHTMODES_H_ #endif // _FLIGHTMODES_H_
+23 -23
View File
@@ -20,27 +20,27 @@
#ifndef _HELI_H_ #ifndef _HELI_H_
#define _HELI_H_ #define _HELI_H_
#include "modeledit.h" #include "modeledit.h"
namespace Ui { namespace Ui {
class Heli; class Heli;
} }
class HeliPanel : public ModelPanel class HeliPanel : public ModelPanel
{ {
Q_OBJECT Q_OBJECT
public: public:
HeliPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware); HeliPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware);
~HeliPanel(); ~HeliPanel();
void update(); void update();
private slots: private slots:
void edited(); void edited();
private: private:
Ui::Heli *ui; Ui::Heli *ui;
}; };
#endif // _HELI_H_ #endif // _HELI_H_
+52 -52
View File
@@ -20,56 +20,56 @@
#ifndef _INPUTS_H_ #ifndef _INPUTS_H_
#define _INPUTS_H_ #define _INPUTS_H_
#include "modeledit.h" #include "modeledit.h"
#include "mixerslist.h" #include "mixerslist.h"
#include "modelprinter.h" #include "modelprinter.h"
class InputsPanel : public ModelPanel class InputsPanel : public ModelPanel
{ {
Q_OBJECT Q_OBJECT
public: public:
InputsPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware); InputsPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware);
virtual ~InputsPanel(); virtual ~InputsPanel();
virtual void update(); virtual void update();
private slots: private slots:
void clearExpos(); void clearExpos();
void moveExpoUp(); void moveExpoUp();
void moveExpoDown(); void moveExpoDown();
void mimeExpoDropped(int index, const QMimeData *data, Qt::DropAction action); void mimeExpoDropped(int index, const QMimeData *data, Qt::DropAction action);
void expolistWidget_customContextMenuRequested(QPoint pos); void expolistWidget_customContextMenuRequested(QPoint pos);
void expolistWidget_doubleClicked(QModelIndex index); void expolistWidget_doubleClicked(QModelIndex index);
void expolistWidget_KeyPress(QKeyEvent *event); void expolistWidget_KeyPress(QKeyEvent *event);
void exposDelete(bool ask=true); void exposDelete(bool ask=true);
void exposCut(); void exposCut();
void exposCopy(); void exposCopy();
void exposPaste(); void exposPaste();
void exposDuplicate(); void exposDuplicate();
void expoOpen(QListWidgetItem *item = NULL); void expoOpen(QListWidgetItem *item = NULL);
void expoAdd(); void expoAdd();
private: private:
bool expoInserted; bool expoInserted;
MixersList *ExposlistWidget; MixersList *ExposlistWidget;
bool firstLine; bool firstLine;
int inputsCount; int inputsCount;
ModelPrinter modelPrinter; ModelPrinter modelPrinter;
int getExpoIndex(unsigned int dch); int getExpoIndex(unsigned int dch);
bool gm_insertExpo(int idx); bool gm_insertExpo(int idx);
void gm_deleteExpo(int index); void gm_deleteExpo(int index);
void gm_openExpo(int index); void gm_openExpo(int index);
int gm_moveExpo(int idx, bool dir); int gm_moveExpo(int idx, bool dir);
void exposDeleteList(QList<int> list); void exposDeleteList(QList<int> list);
QList<int> createExpoListFromSelected(); QList<int> createExpoListFromSelected();
void setSelectedByExpoList(QList<int> list); void setSelectedByExpoList(QList<int> list);
void pasteExpoMimeData(const QMimeData * mimeData, int destIdx); void pasteExpoMimeData(const QMimeData * mimeData, int destIdx);
bool AddInputLine(int dest); bool AddInputLine(int dest);
QString getInputText(int dest, bool * new_ch); QString getInputText(int dest, bool * new_ch);
}; };
#endif // _INPUTS_H_ #endif // _INPUTS_H_
+48 -48
View File
@@ -20,52 +20,52 @@
#ifndef _LOGICALSWITCHES_H_ #ifndef _LOGICALSWITCHES_H_
#define _LOGICALSWITCHES_H_ #define _LOGICALSWITCHES_H_
#include "modeledit.h" #include "modeledit.h"
#include "eeprominterface.h" #include "eeprominterface.h"
class LogicalSwitchesPanel : public ModelPanel class LogicalSwitchesPanel : public ModelPanel
{ {
Q_OBJECT Q_OBJECT
public: public:
LogicalSwitchesPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware); LogicalSwitchesPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware);
virtual ~LogicalSwitchesPanel(); virtual ~LogicalSwitchesPanel();
virtual void update(); virtual void update();
private slots: private slots:
void edited(); void edited();
void v1Edited(int value); void v1Edited(int value);
void v2Edited(int value); void v2Edited(int value);
void andEdited(int value); void andEdited(int value);
void durationEdited(double duration); void durationEdited(double duration);
void delayEdited(double delay); void delayEdited(double delay);
void csw_customContextMenuRequested(QPoint pos); void csw_customContextMenuRequested(QPoint pos);
void cswDelete(); void cswDelete();
void cswCopy(); void cswCopy();
void cswPaste(); void cswPaste();
void cswCut(); void cswCut();
private: private:
QComboBox * csw[CPN_MAX_CSW]; QComboBox * csw[CPN_MAX_CSW];
QDoubleSpinBox * cswitchValue[CPN_MAX_CSW]; QDoubleSpinBox * cswitchValue[CPN_MAX_CSW];
QDoubleSpinBox * cswitchOffset[CPN_MAX_CSW]; QDoubleSpinBox * cswitchOffset[CPN_MAX_CSW];
QDoubleSpinBox * cswitchOffset2[CPN_MAX_CSW]; QDoubleSpinBox * cswitchOffset2[CPN_MAX_CSW];
QTimeEdit * cswitchTOffset[CPN_MAX_CSW]; QTimeEdit * cswitchTOffset[CPN_MAX_CSW];
QComboBox * cswitchAnd[CPN_MAX_CSW]; QComboBox * cswitchAnd[CPN_MAX_CSW];
QDoubleSpinBox * cswitchDuration[CPN_MAX_CSW]; QDoubleSpinBox * cswitchDuration[CPN_MAX_CSW];
QDoubleSpinBox * cswitchDelay[CPN_MAX_CSW]; QDoubleSpinBox * cswitchDelay[CPN_MAX_CSW];
QComboBox * cswitchSource1[CPN_MAX_CSW]; QComboBox * cswitchSource1[CPN_MAX_CSW];
QComboBox * cswitchSource2[CPN_MAX_CSW]; QComboBox * cswitchSource2[CPN_MAX_CSW];
void setSwitchWidgetVisibility(int i); void setSwitchWidgetVisibility(int i);
int selectedSwitch; int selectedSwitch;
void populateCSWCB(QComboBox *b, int value); void populateCSWCB(QComboBox *b, int value);
void populateAndSwitchCB(QComboBox *b, const RawSwitch & value); void populateAndSwitchCB(QComboBox *b, const RawSwitch & value);
void updateLine(int index); void updateLine(int index);
void updateTimerParam(QDoubleSpinBox *sb, int timer, double minimum=0); void updateTimerParam(QDoubleSpinBox *sb, int timer, double minimum=0);
}; };
#endif // _LOGICALSWITCHES_H_ #endif // _LOGICALSWITCHES_H_
+139 -139
View File
@@ -18,142 +18,142 @@
* GNU General Public License for more details. * GNU General Public License for more details.
*/ */
#include "mixerslist.h" #include "mixerslist.h"
MixersList::MixersList(QWidget *parent, bool expo) : MixersList::MixersList(QWidget *parent, bool expo) :
QListWidget(parent), QListWidget(parent),
expo(expo) expo(expo)
{ {
setFont(QFont("Courier New",12)); setFont(QFont("Courier New",12));
setContextMenuPolicy(Qt::CustomContextMenu); setContextMenuPolicy(Qt::CustomContextMenu);
setSelectionMode(QAbstractItemView::SingleSelection); setSelectionMode(QAbstractItemView::SingleSelection);
setDragEnabled(true); setDragEnabled(true);
setAcceptDrops(true); setAcceptDrops(true);
setDropIndicatorShown(true); setDropIndicatorShown(true);
setItemDelegate(new MixersDelegate(parent)); //set custom paint handler setItemDelegate(new MixersDelegate(parent)); //set custom paint handler
} }
void MixersList::keyPressEvent(QKeyEvent *event) void MixersList::keyPressEvent(QKeyEvent *event)
{ {
emit keyWasPressed(event); emit keyWasPressed(event);
} }
/** /**
@brief Override to give us different mime type for mixers and inputs @brief Override to give us different mime type for mixers and inputs
*/ */
QStringList MixersList::mimeTypes () const QStringList MixersList::mimeTypes () const
{ {
QStringList types; QStringList types;
if (expo) types << "application/x-companion-expo-item"; if (expo) types << "application/x-companion-expo-item";
else types << "application/x-companion-mix-item"; else types << "application/x-companion-mix-item";
return types; return types;
} }
void MixersList::dropEvent(QDropEvent *event) void MixersList::dropEvent(QDropEvent *event)
{ {
QList<int> list; QList<int> list;
foreach(QListWidgetItem *item, selectedItems()) { foreach(QListWidgetItem *item, selectedItems()) {
int idx= item->data(Qt::UserRole).toByteArray().at(0); int idx= item->data(Qt::UserRole).toByteArray().at(0);
if(idx >= 0) list << idx; if(idx >= 0) list << idx;
} }
if (list.count()<1) return; if (list.count()<1) return;
event->acceptProposedAction(); event->acceptProposedAction();
dropMimeData(indexAt(event->pos()).row(),event->mimeData(),event->dropAction()); dropMimeData(indexAt(event->pos()).row(),event->mimeData(),event->dropAction());
} }
bool MixersList::dropMimeData( int index, const QMimeData * data, Qt::DropAction action ) bool MixersList::dropMimeData( int index, const QMimeData * data, Qt::DropAction action )
{ {
// qDebug() << "MixersList::dropMimeData() index:" << index << "formats" << data->formats(); // qDebug() << "MixersList::dropMimeData() index:" << index << "formats" << data->formats();
QByteArray dropData = data->data(expo ? "application/x-companion-expo-item" : "application/x-companion-mix-item"); QByteArray dropData = data->data(expo ? "application/x-companion-expo-item" : "application/x-companion-mix-item");
if (dropData.isNull() ) return false; if (dropData.isNull() ) return false;
QDataStream stream(&dropData, QIODevice::ReadOnly); QDataStream stream(&dropData, QIODevice::ReadOnly);
QByteArray qba; QByteArray qba;
while (!stream.atEnd()) { while (!stream.atEnd()) {
int r,c; int r,c;
QMap<int, QVariant> v; QMap<int, QVariant> v;
stream >> r >> c >> v; stream >> r >> c >> v;
QList<QVariant> lsVars; QList<QVariant> lsVars;
lsVars = v.values(); lsVars = v.values();
qba.append(lsVars.at(1).toByteArray().mid(1)); qba.append(lsVars.at(1).toByteArray().mid(1));
// qDebug() << "MixersList::dropMimeData() added" << lsVars.count() << "items, data:" << lsVars; // qDebug() << "MixersList::dropMimeData() added" << lsVars.count() << "items, data:" << lsVars;
} }
if(qba.length()>0) { if(qba.length()>0) {
QMimeData *mimeData = new QMimeData; QMimeData *mimeData = new QMimeData;
mimeData->setData(expo ? "application/x-companion-expo" : "application/x-companion-mix", qba); mimeData->setData(expo ? "application/x-companion-expo" : "application/x-companion-mix", qba);
emit mimeDropped(index, mimeData, action); emit mimeDropped(index, mimeData, action);
delete mimeData; //is this correct? is mimeData freed elswere?? delete mimeData; //is this correct? is mimeData freed elswere??
} }
return true; return true;
} }
/** /**
@brief Paints our HTML formated list item text @brief Paints our HTML formated list item text
*/ */
void MixersDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const void MixersDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{ {
QStyleOptionViewItem options = option; QStyleOptionViewItem options = option;
initStyleOption(&options, index); initStyleOption(&options, index);
painter->save(); painter->save();
//setup html document //setup html document
QTextDocument doc; QTextDocument doc;
SetupDocument(doc, options); SetupDocument(doc, options);
options.text = ""; options.text = "";
options.widget->style()->drawControl(QStyle::CE_ItemViewItem, &options, painter); options.widget->style()->drawControl(QStyle::CE_ItemViewItem, &options, painter);
if ( index.model()->data(index, GroupHeaderRole).toInt() > 0 ) { if ( index.model()->data(index, GroupHeaderRole).toInt() > 0 ) {
//paint with added space //paint with added space
painter->translate(options.rect.left(), options.rect.top() + MIX_ROW_HEIGHT_INCREASE); painter->translate(options.rect.left(), options.rect.top() + MIX_ROW_HEIGHT_INCREASE);
QRect clip(0, 0, options.rect.width(), options.rect.height() - MIX_ROW_HEIGHT_INCREASE); QRect clip(0, 0, options.rect.width(), options.rect.height() - MIX_ROW_HEIGHT_INCREASE);
doc.drawContents(painter, clip); doc.drawContents(painter, clip);
} }
else { else {
painter->translate(options.rect.left(), options.rect.top()); painter->translate(options.rect.left(), options.rect.top());
QRect clip(0, 0, options.rect.width(), options.rect.height()); QRect clip(0, 0, options.rect.width(), options.rect.height());
doc.drawContents(painter, clip); doc.drawContents(painter, clip);
} }
painter->restore(); painter->restore();
} }
/** /**
@brief Returns needed size for our HTML formated list item text @brief Returns needed size for our HTML formated list item text
*/ */
QSize MixersDelegate::sizeHint ( const QStyleOptionViewItem & option, const QModelIndex & index ) const QSize MixersDelegate::sizeHint ( const QStyleOptionViewItem & option, const QModelIndex & index ) const
{ {
QStyleOptionViewItem options = option; QStyleOptionViewItem options = option;
initStyleOption(&options, index); initStyleOption(&options, index);
//setup html document //setup html document
QTextDocument doc; QTextDocument doc;
SetupDocument(doc, options); SetupDocument(doc, options);
//qDebug() << "MixersDelegate::sizeHint() UserRole-> " << index.model()->data(index, Qt::UserRole + 2); //qDebug() << "MixersDelegate::sizeHint() UserRole-> " << index.model()->data(index, Qt::UserRole + 2);
int height = doc.size().height(); int height = doc.size().height();
if ( index.model()->data(index, Qt::UserRole + 2).toInt() > 0 ) { if ( index.model()->data(index, Qt::UserRole + 2).toInt() > 0 ) {
//qDebug() << "MixersDelegate::sizeHint() detected channel head"; //qDebug() << "MixersDelegate::sizeHint() detected channel head";
height = doc.size().height() + MIX_ROW_HEIGHT_INCREASE; height = doc.size().height() + MIX_ROW_HEIGHT_INCREASE;
} }
//qDebug() << "MixersDelegate::sizeHint() options.rect " << options.rect; //qDebug() << "MixersDelegate::sizeHint() options.rect " << options.rect;
//qDebug() << "MixersDelegate::sizeHint() result " << QSize(doc.idealWidth(), height) << options.rect.width(); //qDebug() << "MixersDelegate::sizeHint() result " << QSize(doc.idealWidth(), height) << options.rect.width();
return QSize(doc.idealWidth(), height); return QSize(doc.idealWidth(), height);
} }
void MixersDelegate::SetupDocument(QTextDocument & doc, const QStyleOptionViewItem & options) const void MixersDelegate::SetupDocument(QTextDocument & doc, const QStyleOptionViewItem & options) const
{ {
//setup html document //setup html document
doc.setHtml(options.text); doc.setHtml(options.text);
doc.setDefaultFont(options.font); doc.setDefaultFont(options.font);
//minimize margins (default margins look ugly) //minimize margins (default margins look ugly)
QTextFrame *tf = doc.rootFrame(); QTextFrame *tf = doc.rootFrame();
QTextFrameFormat tff = tf->frameFormat(); QTextFrameFormat tff = tf->frameFormat();
tff.setMargin(0); tff.setMargin(0);
tf->setFrameFormat(tff); tf->setFrameFormat(tff);
} }
+50 -50
View File
@@ -20,54 +20,54 @@
#ifndef _MIXERSLIST_H_ #ifndef _MIXERSLIST_H_
#define _MIXERSLIST_H_ #define _MIXERSLIST_H_
#include <QtWidgets> #include <QtWidgets>
#define MIX_ROW_HEIGHT_INCREASE 8 //how much space is added above mixer row (for new channel), if 0 space adding is disabled #define MIX_ROW_HEIGHT_INCREASE 8 //how much space is added above mixer row (for new channel), if 0 space adding is disabled
const int GroupHeaderRole = (Qt::UserRole+2); //defines new user role for list items. If value is > 0, then space is added before that item const int GroupHeaderRole = (Qt::UserRole+2); //defines new user role for list items. If value is > 0, then space is added before that item
class MixersList : public QListWidget class MixersList : public QListWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit MixersList(QWidget *parent, bool expo); explicit MixersList(QWidget *parent, bool expo);
void keyPressEvent(QKeyEvent *event); void keyPressEvent(QKeyEvent *event);
void dropEvent(QDropEvent *event); void dropEvent(QDropEvent *event);
signals: signals:
void mimeDropped(int index, const QMimeData *data, Qt::DropAction action); void mimeDropped(int index, const QMimeData *data, Qt::DropAction action);
void keyWasPressed(QKeyEvent *event); void keyWasPressed(QKeyEvent *event);
public slots: public slots:
bool dropMimeData(int index, const QMimeData *data, Qt::DropAction action); bool dropMimeData(int index, const QMimeData *data, Qt::DropAction action);
protected: protected:
virtual QStringList mimeTypes() const; virtual QStringList mimeTypes() const;
private: private:
QPoint dragStartPosition; QPoint dragStartPosition;
bool expo; bool expo;
}; };
/** /**
@brief Provides sizing and painting of items for our mixes and inputs lists @brief Provides sizing and painting of items for our mixes and inputs lists
This class draws HTML formated strings into QListWidget class This class draws HTML formated strings into QListWidget class
*/ */
class MixersDelegate : public QStyledItemDelegate class MixersDelegate : public QStyledItemDelegate
{ {
Q_OBJECT Q_OBJECT
public: public:
inline MixersDelegate(QObject *parent) : QStyledItemDelegate(parent) {}; inline MixersDelegate(QObject *parent) : QStyledItemDelegate(parent) {};
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
QSize sizeHint ( const QStyleOptionViewItem & option, const QModelIndex & index ) const; QSize sizeHint ( const QStyleOptionViewItem & option, const QModelIndex & index ) const;
private: private:
void SetupDocument(QTextDocument & doc, const QStyleOptionViewItem & options) const; void SetupDocument(QTextDocument & doc, const QStyleOptionViewItem & options) const;
}; };
#endif // _MIXERSLIST_H_ #endif // _MIXERSLIST_H_
+59 -59
View File
@@ -20,63 +20,63 @@
#ifndef _MIXES_H_ #ifndef _MIXES_H_
#define _MIXES_H_ #define _MIXES_H_
#include "modeledit.h" #include "modeledit.h"
#include "mixerslist.h" #include "mixerslist.h"
#include "mixerdialog.h" #include "mixerdialog.h"
#include "modelprinter.h" #include "modelprinter.h"
class MixesPanel : public ModelPanel class MixesPanel : public ModelPanel
{ {
Q_OBJECT Q_OBJECT
public: public:
MixesPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware); MixesPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware);
virtual ~MixesPanel(); virtual ~MixesPanel();
virtual void update(); virtual void update();
private slots: private slots:
// TODO all slots? // TODO all slots?
void clearMixes(); void clearMixes();
void mixersDelete(bool ask=true); void mixersDelete(bool ask=true);
void mixersCut(); void mixersCut();
void mixersCopy(); void mixersCopy();
void mixersPaste(); void mixersPaste();
void mixersDuplicate(); void mixersDuplicate();
void mixerOpen(); void mixerOpen();
void mixerAdd(); void mixerAdd();
void moveMixUp(); void moveMixUp();
void moveMixDown(); void moveMixDown();
void mixerHighlight(); void mixerHighlight();
void mixerlistWidget_customContextMenuRequested(QPoint pos); void mixerlistWidget_customContextMenuRequested(QPoint pos);
void mixerlistWidget_doubleClicked(QModelIndex index); void mixerlistWidget_doubleClicked(QModelIndex index);
void mixerlistWidget_KeyPress(QKeyEvent *event); void mixerlistWidget_KeyPress(QKeyEvent *event);
void mimeMixerDropped(int index, const QMimeData *data, Qt::DropAction action); void mimeMixerDropped(int index, const QMimeData *data, Qt::DropAction action);
void pasteMixerMimeData(const QMimeData * mimeData, int destIdx); void pasteMixerMimeData(const QMimeData * mimeData, int destIdx);
void mixesEdited(); void mixesEdited();
private: private:
MixersList *MixerlistWidget; MixersList *MixerlistWidget;
bool mixInserted; bool mixInserted;
unsigned int highlightedSource; unsigned int highlightedSource;
bool firstLine; bool firstLine;
ModelPrinter modelPrinter; ModelPrinter modelPrinter;
int getMixerIndex(unsigned int dch); int getMixerIndex(unsigned int dch);
bool gm_insertMix(int idx); bool gm_insertMix(int idx);
void gm_deleteMix(int index); void gm_deleteMix(int index);
void gm_openMix(int index); void gm_openMix(int index);
int gm_moveMix(int idx, bool dir); int gm_moveMix(int idx, bool dir);
void mixersDeleteList(QList<int> list); void mixersDeleteList(QList<int> list);
QList<int> createMixListFromSelected(); QList<int> createMixListFromSelected();
void setSelectedByMixList(QList<int> list); void setSelectedByMixList(QList<int> list);
bool AddMixerLine(int dest); bool AddMixerLine(int dest);
QString getMixerText(int dest, bool * new_ch); QString getMixerText(int dest, bool * new_ch);
}; };
#endif // _MIXES_H_ #endif // _MIXES_H_
+51 -51
View File
@@ -20,55 +20,55 @@
#ifndef _MODELEDIT_H_ #ifndef _MODELEDIT_H_
#define _MODELEDIT_H_ #define _MODELEDIT_H_
#include <QtWidgets> #include <QtWidgets>
#include "genericpanel.h" #include "genericpanel.h"
class RadioData; class RadioData;
namespace Ui { namespace Ui {
class ModelEdit; class ModelEdit;
} }
class ModelPanel : public GenericPanel class ModelPanel : public GenericPanel
{ {
public: public:
ModelPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware): ModelPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware):
GenericPanel(parent, &model, generalSettings, firmware) GenericPanel(parent, &model, generalSettings, firmware)
{ {
} }
}; };
class ModelEdit : public QDialog class ModelEdit : public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
ModelEdit(QWidget * parent, RadioData & radioData, int modelId, Firmware * firmware); ModelEdit(QWidget * parent, RadioData & radioData, int modelId, Firmware * firmware);
~ModelEdit(); ~ModelEdit();
protected: protected:
void closeEvent(QCloseEvent *event); void closeEvent(QCloseEvent *event);
signals: signals:
void modified(); void modified();
private slots: private slots:
void onTabModified(); void onTabModified();
void on_pushButton_clicked(); void on_pushButton_clicked();
void on_tabWidget_currentChanged(int index); void on_tabWidget_currentChanged(int index);
private: private:
Ui::ModelEdit *ui; Ui::ModelEdit *ui;
int modelId; int modelId;
ModelData & model; ModelData & model;
GeneralSettings & generalSettings; GeneralSettings & generalSettings;
Firmware * firmware; Firmware * firmware;
QVector<GenericPanel *> panels; QVector<GenericPanel *> panels;
void addTab(GenericPanel *panel, QString text); void addTab(GenericPanel *panel, QString text);
void launchSimulation(); void launchSimulation();
}; };
#endif // _MODELEDIT_H_ #endif // _MODELEDIT_H_
+208 -208
View File
@@ -18,213 +18,213 @@
* GNU General Public License for more details. * GNU General Public License for more details.
*/ */
#include <QGraphicsScene> #include <QGraphicsScene>
#include <QGraphicsSceneMouseEvent> #include <QGraphicsSceneMouseEvent>
#include <QPainter> #include <QPainter>
#include <QStyleOption> #include <QStyleOption>
#include "edge.h" #include "edge.h"
#include "node.h" #include "node.h"
Node::Node(): Node::Node():
minX(-100), minX(-100),
maxX(+100) maxX(+100)
{ {
setFlag(ItemIsMovable); setFlag(ItemIsMovable);
setFlag(ItemSendsGeometryChanges); setFlag(ItemSendsGeometryChanges);
setCacheMode(DeviceCoordinateCache); setCacheMode(DeviceCoordinateCache);
setZValue(-1); setZValue(-1);
nodecolor = QColor(Qt::yellow); nodecolor = QColor(Qt::yellow);
bPressed = false; bPressed = false;
centerX = true; centerX = true;
centerY = true; centerY = true;
fixedX = false; fixedX = false;
fixedY = false; fixedY = false;
ballSize = DEFAULT_BALL_SIZE; ballSize = DEFAULT_BALL_SIZE;
} }
void Node::addEdge(Edge *edge) void Node::addEdge(Edge *edge)
{ {
edgeList << edge; edgeList << edge;
edge->adjust(); edge->adjust();
} }
void Node::stepToCenter(qreal step) void Node::stepToCenter(qreal step)
{ {
if(scene() && !bPressed) if(scene() && !bPressed)
{ {
QRectF qr = scene()->sceneRect(); QRectF qr = scene()->sceneRect();
qreal xStep = qr.width()/step; qreal xStep = qr.width()/step;
qreal yStep = qr.height()/step; qreal yStep = qr.height()/step;
QPointF p = pos(); QPointF p = pos();
if(centerX) if(centerX)
{ {
qreal x = qr.right() - qr.width()/2; qreal x = qr.right() - qr.width()/2;
if(fabs(x-p.x())>xStep) if(fabs(x-p.x())>xStep)
p.rx() += p.x()>x ? -xStep : xStep; p.rx() += p.x()>x ? -xStep : xStep;
else else
p.rx() = x; p.rx() = x;
} }
if(centerY) if(centerY)
{ {
qreal y = qr.bottom() - qr.height()/2; qreal y = qr.bottom() - qr.height()/2;
if(fabs(y-p.y())>yStep) if(fabs(y-p.y())>yStep)
p.ry() += p.y()>y ? -yStep : yStep; p.ry() += p.y()>y ? -yStep : yStep;
else else
p.ry() = y; p.ry() = y;
} }
setPos(p); setPos(p);
} }
} }
void Node::setColor(const QColor & color) void Node::setColor(const QColor & color)
{ {
nodecolor=color; nodecolor=color;
} }
void Node::setBallSize(int size) void Node::setBallSize(int size)
{ {
if(size>2) ballSize = size; if(size>2) ballSize = size;
} }
qreal Node::getX() qreal Node::getX()
{ {
if(scene()) if(scene())
{ {
QRectF rect = scene()->sceneRect(); QRectF rect = scene()->sceneRect();
return 1+((x()-rect.right())*2/rect.width()); return 1+((x()-rect.right())*2/rect.width());
} }
return 0; return 0;
} }
void Node::setX(qreal newX) void Node::setX(qreal newX)
{ {
if(scene()) if(scene())
{ {
QRectF rect = scene()->sceneRect(); QRectF rect = scene()->sceneRect();
QGraphicsObject::setX(rect.left() + (newX+1) * rect.width()/2); QGraphicsObject::setX(rect.left() + (newX+1) * rect.width()/2);
} }
} }
qreal Node::getY() qreal Node::getY()
{ {
if(scene()) if(scene())
{ {
QRectF rect = scene()->sceneRect(); QRectF rect = scene()->sceneRect();
return 1+((y()-rect.bottom())*2/rect.height()); return 1+((y()-rect.bottom())*2/rect.height());
} }
return 0; return 0;
} }
void Node::setY(qreal newY) void Node::setY(qreal newY)
{ {
if(scene()) if(scene())
{ {
QRectF rect = scene()->sceneRect(); QRectF rect = scene()->sceneRect();
QGraphicsObject::setY(rect.top() + (newY+1) * rect.height()/2); QGraphicsObject::setY(rect.top() + (newY+1) * rect.height()/2);
} }
} }
QList<Edge *> Node::edges() const QList<Edge *> Node::edges() const
{ {
return edgeList; return edgeList;
} }
QRectF Node::boundingRect() const QRectF Node::boundingRect() const
{ {
qreal adjust = 2; qreal adjust = 2;
return QRectF(-ballSize/2 - adjust, -ballSize/2 - adjust, return QRectF(-ballSize/2 - adjust, -ballSize/2 - adjust,
ballSize+BALL_HEIGHT + adjust, ballSize+BALL_HEIGHT + adjust); ballSize+BALL_HEIGHT + adjust, ballSize+BALL_HEIGHT + adjust);
} }
QPainterPath Node::shape() const QPainterPath Node::shape() const
{ {
QPainterPath path; QPainterPath path;
path.addEllipse(-ballSize/2, -ballSize/2, ballSize, ballSize); path.addEllipse(-ballSize/2, -ballSize/2, ballSize, ballSize);
return path; return path;
} }
void Node::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *) void Node::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *)
{ {
painter->setPen(Qt::NoPen); painter->setPen(Qt::NoPen);
painter->setBrush(Qt::darkGray); painter->setBrush(Qt::darkGray);
painter->drawEllipse(-ballSize/2 + BALL_HEIGHT, -ballSize/2 + BALL_HEIGHT, ballSize, ballSize); painter->drawEllipse(-ballSize/2 + BALL_HEIGHT, -ballSize/2 + BALL_HEIGHT, ballSize, ballSize);
QRadialGradient gradient(-BALL_HEIGHT, -BALL_HEIGHT, ballSize/2); QRadialGradient gradient(-BALL_HEIGHT, -BALL_HEIGHT, ballSize/2);
if (option->state & QStyle::State_Sunken) { if (option->state & QStyle::State_Sunken) {
gradient.setCenter(BALL_HEIGHT, BALL_HEIGHT); gradient.setCenter(BALL_HEIGHT, BALL_HEIGHT);
gradient.setFocalPoint(BALL_HEIGHT, BALL_HEIGHT); gradient.setFocalPoint(BALL_HEIGHT, BALL_HEIGHT);
gradient.setColorAt(1, nodecolor.light(180)); gradient.setColorAt(1, nodecolor.light(180));
gradient.setColorAt(0, nodecolor.light(120)); gradient.setColorAt(0, nodecolor.light(120));
} else { } else {
gradient.setColorAt(0, nodecolor); gradient.setColorAt(0, nodecolor);
gradient.setColorAt(1, nodecolor.dark(120)); gradient.setColorAt(1, nodecolor.dark(120));
} }
painter->setBrush(gradient); painter->setBrush(gradient);
painter->setPen(QPen(Qt::black, 0)); painter->setPen(QPen(Qt::black, 0));
painter->drawEllipse(-ballSize/2, -ballSize/2, ballSize, ballSize); painter->drawEllipse(-ballSize/2, -ballSize/2, ballSize, ballSize);
} }
QVariant Node::itemChange(GraphicsItemChange change, const QVariant &value) QVariant Node::itemChange(GraphicsItemChange change, const QVariant &value)
{ {
switch (change) { switch (change) {
case ItemPositionChange: case ItemPositionChange:
if (scene()) if (scene())
{ {
// value is the new position. // value is the new position.
QPointF newPos = value.toPointF(); QPointF newPos = value.toPointF();
QRectF rect = scene()->sceneRect(); QRectF rect = scene()->sceneRect();
if(fixedX) newPos.setX(x());//make sure x doesn't change if(fixedX) newPos.setX(x());//make sure x doesn't change
if(fixedY) newPos.setY(y());//make sure x doesn't change if(fixedY) newPos.setY(y());//make sure x doesn't change
newPos.setX(qMin(rect.right(), qMax(newPos.x(), rect.left())));// bound X newPos.setX(qMin(rect.right(), qMax(newPos.x(), rect.left())));// bound X
newPos.setY(qMin(rect.bottom(), qMax(newPos.y(), rect.top())));// bound Y newPos.setY(qMin(rect.bottom(), qMax(newPos.y(), rect.top())));// bound Y
int newX = -100 + ( (newPos.x()-rect.left()) * 200) / rect.width(); int newX = -100 + ( (newPos.x()-rect.left()) * 200) / rect.width();
int newY = 100+(rect.top()-y())*200/rect.height(); int newY = 100+(rect.top()-y())*200/rect.height();
if (newX < minX) newX = minX; if (newX < minX) newX = minX;
if (newX > maxX) newX = maxX; if (newX > maxX) newX = maxX;
if (!getFixedX()) { if (!getFixedX()) {
newPos.setX(((newX+100)*rect.width()/200+rect.left())); newPos.setX(((newX+100)*rect.width()/200+rect.left()));
} }
emit moved(newX, newY); emit moved(newX, newY);
return newPos; return newPos;
} }
break; break;
case ItemPositionHasChanged: case ItemPositionHasChanged:
foreach (Edge *edge, edgeList) foreach (Edge *edge, edgeList)
edge->adjust(); edge->adjust();
break; break;
default: default:
break; break;
}; };
return QGraphicsItem::itemChange(change, value); return QGraphicsItem::itemChange(change, value);
} }
void Node::mousePressEvent(QGraphicsSceneMouseEvent *event) void Node::mousePressEvent(QGraphicsSceneMouseEvent *event)
{ {
update(); update();
bPressed = true; bPressed = true;
QGraphicsItem::mousePressEvent(event); QGraphicsItem::mousePressEvent(event);
emit focus(); emit focus();
} }
void Node::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void Node::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{ {
update(); update();
bPressed = false; bPressed = false;
if (scene()) { if (scene()) {
QGraphicsItem::mouseReleaseEvent(event); QGraphicsItem::mouseReleaseEvent(event);
emit unfocus(); emit unfocus();
} }
else { else {
QGraphicsItem::mouseReleaseEvent(event); QGraphicsItem::mouseReleaseEvent(event);
} }
} }
+68 -68
View File
@@ -20,72 +20,72 @@
#ifndef _NODE_H_ #ifndef _NODE_H_
#define _NODE_H_ #define _NODE_H_
#include <QtWidgets> #include <QtWidgets>
#define DEFAULT_BALL_SIZE 10 #define DEFAULT_BALL_SIZE 10
#define BALL_HEIGHT 2 #define BALL_HEIGHT 2
class Edge; class Edge;
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QGraphicsSceneMouseEvent; class QGraphicsSceneMouseEvent;
QT_END_NAMESPACE QT_END_NAMESPACE
class Node : public QGraphicsObject class Node : public QGraphicsObject
{ {
Q_OBJECT Q_OBJECT
public: public:
Node(); Node();
void addEdge(Edge *edge); void addEdge(Edge *edge);
QList<Edge *> edges() const; QList<Edge *> edges() const;
enum { Type = UserType + 1 }; enum { Type = UserType + 1 };
int type() const { return Type; } int type() const { return Type; }
QRectF boundingRect() const; QRectF boundingRect() const;
QPainterPath shape() const; QPainterPath shape() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
void setBallSize(int size); void setBallSize(int size);
void stepToCenter(qreal step=10); void stepToCenter(qreal step=10);
int getBallSize() {return ballSize;} int getBallSize() {return ballSize;}
qreal getX(); qreal getX();
qreal getY(); qreal getY();
void setX(qreal newX); void setX(qreal newX);
void setY(qreal newX); void setY(qreal newX);
void setCenteringX(bool val) {centerX = val;} void setCenteringX(bool val) {centerX = val;}
void setCenteringY(bool val) {centerY = val;} void setCenteringY(bool val) {centerY = val;}
void setFixedX(bool val) {fixedX = val;} void setFixedX(bool val) {fixedX = val;}
void setFixedY(bool val) {fixedY = val;} void setFixedY(bool val) {fixedY = val;}
bool getFixedX() {return fixedX;} bool getFixedX() {return fixedX;}
bool getFixedY() {return fixedY;} bool getFixedY() {return fixedY;}
void setMinX(int val) {minX = val;}; void setMinX(int val) {minX = val;};
void setMaxX(int val) {maxX = val;}; void setMaxX(int val) {maxX = val;};
void setColor(const QColor & color); void setColor(const QColor & color);
signals: signals:
void moved(int x, int y); void moved(int x, int y);
void focus(); void focus();
void unfocus(); void unfocus();
protected: protected:
QVariant itemChange(GraphicsItemChange change, const QVariant &value); QVariant itemChange(GraphicsItemChange change, const QVariant &value);
void mousePressEvent(QGraphicsSceneMouseEvent *event); void mousePressEvent(QGraphicsSceneMouseEvent *event);
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
private: private:
bool bPressed; bool bPressed;
bool centerX; bool centerX;
bool centerY; bool centerY;
bool fixedX; bool fixedX;
bool fixedY; bool fixedY;
int ballSize; int ballSize;
int minX; int minX;
int maxX; int maxX;
QList<Edge *> edgeList; QList<Edge *> edgeList;
QPointF newPos; QPointF newPos;
QColor nodecolor; QColor nodecolor;
}; };
#endif // _NODE_H_ #endif // _NODE_H_
+123 -123
View File
@@ -20,127 +20,127 @@
#ifndef _SETUP_H_ #ifndef _SETUP_H_
#define _SETUP_H_ #define _SETUP_H_
#include "modeledit.h" #include "modeledit.h"
#include "eeprominterface.h" #include "eeprominterface.h"
namespace Ui { namespace Ui {
class Setup; class Setup;
class Timer; class Timer;
class Module; class Module;
} }
class TimerPanel : public ModelPanel class TimerPanel : public ModelPanel
{ {
Q_OBJECT Q_OBJECT
public: public:
TimerPanel(QWidget *parent, ModelData & model, TimerData & timer, GeneralSettings & generalSettings, Firmware * firmware, QWidget *prevFocus); TimerPanel(QWidget *parent, ModelData & model, TimerData & timer, GeneralSettings & generalSettings, Firmware * firmware, QWidget *prevFocus);
virtual ~TimerPanel(); virtual ~TimerPanel();
virtual void update(); virtual void update();
QWidget * getLastFocus(); QWidget * getLastFocus();
private slots: private slots:
void on_mode_currentIndexChanged(int index); void on_mode_currentIndexChanged(int index);
void on_value_editingFinished(); void on_value_editingFinished();
void on_minuteBeep_toggled(bool checked); void on_minuteBeep_toggled(bool checked);
void on_name_editingFinished(); void on_name_editingFinished();
private: private:
TimerData & timer; TimerData & timer;
Ui::Timer *ui; Ui::Timer *ui;
}; };
class ModulePanel : public ModelPanel class ModulePanel : public ModelPanel
{ {
static const int maxChannels = 16; static const int maxChannels = 16;
struct ChannelFailsafeWidgetsGroup { struct ChannelFailsafeWidgetsGroup {
QComboBox * combo; QComboBox * combo;
QDoubleSpinBox * spinbox; QDoubleSpinBox * spinbox;
QLabel * label; QLabel * label;
}; };
Q_OBJECT Q_OBJECT
public: public:
ModulePanel(QWidget *parent, ModelData & model, ModuleData & module, GeneralSettings & generalSettings, Firmware * firmware, int moduleIdx); ModulePanel(QWidget *parent, ModelData & model, ModuleData & module, GeneralSettings & generalSettings, Firmware * firmware, int moduleIdx);
virtual ~ModulePanel(); virtual ~ModulePanel();
virtual void update(); virtual void update();
protected: protected:
void updateFailsafe(int channel); void updateFailsafe(int channel);
private slots: private slots:
void on_trainerMode_currentIndexChanged(int index); void on_trainerMode_currentIndexChanged(int index);
void on_protocol_currentIndexChanged(int index); void on_protocol_currentIndexChanged(int index);
void on_ppmDelay_editingFinished(); void on_ppmDelay_editingFinished();
void on_channelsCount_editingFinished(); void on_channelsCount_editingFinished();
void on_channelsStart_editingFinished(); void on_channelsStart_editingFinished();
void on_ppmPolarity_currentIndexChanged(int index); void on_ppmPolarity_currentIndexChanged(int index);
void on_ppmOutputType_currentIndexChanged(int index); void on_ppmOutputType_currentIndexChanged(int index);
void on_ppmFrameLength_editingFinished(); void on_ppmFrameLength_editingFinished();
void on_rxNumber_editingFinished(); void on_rxNumber_editingFinished();
void on_failsafeMode_currentIndexChanged(int value); void on_failsafeMode_currentIndexChanged(int value);
void onFailsafeComboIndexChanged(int index); void onFailsafeComboIndexChanged(int index);
void onFailsafeSpinChanged(double value); void onFailsafeSpinChanged(double value);
void on_multiProtocol_currentIndexChanged(int index); void on_multiProtocol_currentIndexChanged(int index);
void on_multiSubType_currentIndexChanged(int index); void on_multiSubType_currentIndexChanged(int index);
void on_autoBind_stateChanged(int state); void on_autoBind_stateChanged(int state);
void on_lowPower_stateChanged(int state); void on_lowPower_stateChanged(int state);
private: private:
ModuleData & module; ModuleData & module;
int moduleIdx; int moduleIdx;
Ui::Module *ui; Ui::Module *ui;
ChannelFailsafeWidgetsGroup failsafeGroups[maxChannels]; ChannelFailsafeWidgetsGroup failsafeGroups[maxChannels];
}; };
class SetupPanel : public ModelPanel class SetupPanel : public ModelPanel
{ {
Q_OBJECT Q_OBJECT
public: public:
SetupPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware); SetupPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware);
virtual ~SetupPanel(); virtual ~SetupPanel();
virtual void update(); virtual void update();
signals: signals:
void extendedLimitsToggled(); void extendedLimitsToggled();
private slots: private slots:
void on_name_editingFinished(); void on_name_editingFinished();
void on_throttleSource_currentIndexChanged(int index); void on_throttleSource_currentIndexChanged(int index);
void on_throttleTrim_toggled(bool checked); void on_throttleTrim_toggled(bool checked);
void on_extendedLimits_toggled(bool checked); void on_extendedLimits_toggled(bool checked);
void on_extendedTrims_toggled(bool checked); void on_extendedTrims_toggled(bool checked);
void on_throttleWarning_toggled(bool checked); void on_throttleWarning_toggled(bool checked);
void on_throttleReverse_toggled(bool checked); void on_throttleReverse_toggled(bool checked);
void on_displayText_toggled(bool checked); void on_displayText_toggled(bool checked);
void on_gfEnabled_toggled(bool checked); void on_gfEnabled_toggled(bool checked);
void on_image_currentIndexChanged(int index); void on_image_currentIndexChanged(int index);
void on_trimIncrement_currentIndexChanged(int index); void on_trimIncrement_currentIndexChanged(int index);
void onBeepCenterToggled(bool checked); void onBeepCenterToggled(bool checked);
void startupSwitchEdited(int value); void startupSwitchEdited(int value);
void startupSwitchToggled(bool checked); void startupSwitchToggled(bool checked);
void potWarningToggled(bool checked); void potWarningToggled(bool checked);
void on_potWarningMode_currentIndexChanged(int index); void on_potWarningMode_currentIndexChanged(int index);
void onChildModified(); void onChildModified();
private: private:
Ui::Setup *ui; Ui::Setup *ui;
QVector<QSlider *> startupSwitchesSliders; QVector<QSlider *> startupSwitchesSliders;
QVector<QCheckBox *> startupSwitchesCheckboxes; QVector<QCheckBox *> startupSwitchesCheckboxes;
QVector<QCheckBox *> potWarningCheckboxes; QVector<QCheckBox *> potWarningCheckboxes;
QVector<QCheckBox *> centerBeepCheckboxes; QVector<QCheckBox *> centerBeepCheckboxes;
ModulePanel * modules[CPN_MAX_MODULES+1]; ModulePanel * modules[CPN_MAX_MODULES+1];
TimerPanel * timers[CPN_MAX_TIMERS]; TimerPanel * timers[CPN_MAX_TIMERS];
void updateStartupSwitches(); void updateStartupSwitches();
void updatePotWarnings(); void updatePotWarnings();
void updateBeepCenter(); void updateBeepCenter();
void populateThrottleSourceCB(); void populateThrottleSourceCB();
}; };
#endif // _SETUP_H_ #endif // _SETUP_H_
+143 -143
View File
@@ -20,147 +20,147 @@
#ifndef _TELEMETRY_H_ #ifndef _TELEMETRY_H_
#define _TELEMETRY_H_ #define _TELEMETRY_H_
#include "modeledit.h" #include "modeledit.h"
#include "eeprominterface.h" #include "eeprominterface.h"
class AutoComboBox; class AutoComboBox;
namespace Ui { namespace Ui {
class TelemetryAnalog; class TelemetryAnalog;
class TelemetryCustomScreen; class TelemetryCustomScreen;
class TelemetrySensor; class TelemetrySensor;
class Telemetry; class Telemetry;
} }
class TelemetryAnalog: public ModelPanel class TelemetryAnalog: public ModelPanel
{ {
Q_OBJECT Q_OBJECT
friend class TelemetryPanel; friend class TelemetryPanel;
public: public:
TelemetryAnalog(QWidget *parent, FrSkyChannelData & analog, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware); TelemetryAnalog(QWidget *parent, FrSkyChannelData & analog, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware);
virtual ~TelemetryAnalog(); virtual ~TelemetryAnalog();
signals: signals:
void modified(); void modified();
private slots: private slots:
void on_UnitCB_currentIndexChanged(int index); void on_UnitCB_currentIndexChanged(int index);
void on_RatioSB_editingFinished(); void on_RatioSB_editingFinished();
void on_RatioSB_valueChanged(); void on_RatioSB_valueChanged();
void on_CalibSB_editingFinished(); void on_CalibSB_editingFinished();
void on_alarm1LevelCB_currentIndexChanged(int index); void on_alarm1LevelCB_currentIndexChanged(int index);
void on_alarm1GreaterCB_currentIndexChanged(int index); void on_alarm1GreaterCB_currentIndexChanged(int index);
void on_alarm1ValueSB_editingFinished(); void on_alarm1ValueSB_editingFinished();
void on_alarm2LevelCB_currentIndexChanged(int index); void on_alarm2LevelCB_currentIndexChanged(int index);
void on_alarm2GreaterCB_currentIndexChanged(int index); void on_alarm2GreaterCB_currentIndexChanged(int index);
void on_alarm2ValueSB_editingFinished(); void on_alarm2ValueSB_editingFinished();
private: private:
Ui::TelemetryAnalog *ui; Ui::TelemetryAnalog *ui;
FrSkyChannelData & analog; FrSkyChannelData & analog;
bool lock; bool lock;
void update(); void update();
}; };
class TelemetryCustomScreen: public ModelPanel class TelemetryCustomScreen: public ModelPanel
{ {
Q_OBJECT Q_OBJECT
public: public:
TelemetryCustomScreen(QWidget *parent, ModelData & model, FrSkyScreenData & screen, GeneralSettings & generalSettings, Firmware * firmware); TelemetryCustomScreen(QWidget *parent, ModelData & model, FrSkyScreenData & screen, GeneralSettings & generalSettings, Firmware * firmware);
~TelemetryCustomScreen(); ~TelemetryCustomScreen();
void update(); void update();
private slots: private slots:
void on_screenType_currentIndexChanged(int index); void on_screenType_currentIndexChanged(int index);
void scriptNameEdited(); void scriptNameEdited();
void customFieldChanged(int index); void customFieldChanged(int index);
void barSourceChanged(int index); void barSourceChanged(int index);
void barMinChanged(double value); void barMinChanged(double value);
void barMaxChanged(double value); void barMaxChanged(double value);
protected: protected:
void populateTelemetrySourceCB(QComboBox * b, RawSource & source, bool last=false); void populateTelemetrySourceCB(QComboBox * b, RawSource & source, bool last=false);
private: private:
void updateBar(int line); void updateBar(int line);
Ui::TelemetryCustomScreen * ui; Ui::TelemetryCustomScreen * ui;
FrSkyScreenData & screen; FrSkyScreenData & screen;
QComboBox * fieldsCB[4][3]; QComboBox * fieldsCB[4][3];
QComboBox * barsCB[4]; QComboBox * barsCB[4];
QDoubleSpinBox * minSB[4]; QDoubleSpinBox * minSB[4];
QDoubleSpinBox * maxSB[4]; QDoubleSpinBox * maxSB[4];
}; };
class TelemetrySensorPanel: public ModelPanel class TelemetrySensorPanel: public ModelPanel
{ {
Q_OBJECT Q_OBJECT
public: public:
TelemetrySensorPanel(QWidget *parent, SensorData & sensor, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware); TelemetrySensorPanel(QWidget *parent, SensorData & sensor, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware);
~TelemetrySensorPanel(); ~TelemetrySensorPanel();
void update(); void update();
signals: signals:
void dataModified(); void dataModified();
protected slots: protected slots:
void on_name_editingFinished(); void on_name_editingFinished();
void on_type_currentIndexChanged(int index); void on_type_currentIndexChanged(int index);
void on_formula_currentIndexChanged(int index); void on_formula_currentIndexChanged(int index);
void on_unit_currentIndexChanged(int index); void on_unit_currentIndexChanged(int index);
void on_prec_valueChanged(double value); void on_prec_valueChanged(double value);
protected: protected:
void updateSourcesComboBox(AutoComboBox * cb, bool negative); void updateSourcesComboBox(AutoComboBox * cb, bool negative);
private: private:
Ui::TelemetrySensor * ui; Ui::TelemetrySensor * ui;
SensorData & sensor; SensorData & sensor;
bool lock; bool lock;
}; };
class TelemetryPanel : public ModelPanel class TelemetryPanel : public ModelPanel
{ {
Q_OBJECT Q_OBJECT
public: public:
TelemetryPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware); TelemetryPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware);
virtual ~TelemetryPanel(); virtual ~TelemetryPanel();
virtual void update(); virtual void update();
private slots: private slots:
void on_telemetryProtocol_currentIndexChanged(int index); void on_telemetryProtocol_currentIndexChanged(int index);
void onModified(); void onModified();
void on_frskyProtoCB_currentIndexChanged(int index); void on_frskyProtoCB_currentIndexChanged(int index);
void on_bladesCount_editingFinished(); void on_bladesCount_editingFinished();
void on_rssiAlarm1CB_currentIndexChanged(int index); void on_rssiAlarm1CB_currentIndexChanged(int index);
void on_rssiAlarm2CB_currentIndexChanged(int index); void on_rssiAlarm2CB_currentIndexChanged(int index);
void on_rssiAlarm1SB_editingFinished(); void on_rssiAlarm1SB_editingFinished();
void on_rssiAlarm2SB_editingFinished(); void on_rssiAlarm2SB_editingFinished();
void on_varioLimitMin_DSB_editingFinished(); void on_varioLimitMin_DSB_editingFinished();
void on_varioLimitMax_DSB_editingFinished(); void on_varioLimitMax_DSB_editingFinished();
void on_varioLimitCenterMin_DSB_editingFinished(); void on_varioLimitCenterMin_DSB_editingFinished();
void on_varioLimitCenterMax_DSB_editingFinished(); void on_varioLimitCenterMax_DSB_editingFinished();
void on_fasOffset_DSB_editingFinished(); void on_fasOffset_DSB_editingFinished();
void on_mahCount_SB_editingFinished(); void on_mahCount_SB_editingFinished();
void on_mahCount_ChkB_toggled(bool checked); void on_mahCount_ChkB_toggled(bool checked);
private: private:
Ui::Telemetry *ui; Ui::Telemetry *ui;
TelemetryAnalog * analogs[4]; TelemetryAnalog * analogs[4];
TelemetryCustomScreen * telemetryCustomScreens[4]; TelemetryCustomScreen * telemetryCustomScreens[4];
TelemetrySensorPanel * sensorPanels[CPN_MAX_SENSORS]; TelemetrySensorPanel * sensorPanels[CPN_MAX_SENSORS];
void setup(); void setup();
void telBarUpdate(); void telBarUpdate();
void populateVoltsSource(); void populateVoltsSource();
void populateCurrentSource(); void populateCurrentSource();
void populateVarioSource(); void populateVarioSource();
}; };
#endif // _TELEMETRY_H_ #endif // _TELEMETRY_H_
+20 -20
View File
@@ -20,24 +20,24 @@
#ifndef _TEMPLATES_H_ #ifndef _TEMPLATES_H_
#define _TEMPLATES_H_ #define _TEMPLATES_H_
#include <QtWidgets> #include <QtWidgets>
#include "eeprominterface.h" #include "eeprominterface.h"
class Templates : public QWidget class Templates : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
Templates(QWidget *parent, ModelData & model); Templates(QWidget *parent, ModelData & model);
~Templates(); ~Templates();
private slots: private slots:
void onDoubleClicked(QModelIndex index); void onDoubleClicked(QModelIndex index);
private: private:
void applyNumericTemplate(uint64_t tpl); void applyNumericTemplate(uint64_t tpl);
ModelData & model; ModelData & model;
}; };
#endif // _TEMPLATES_H_ #endif // _TEMPLATES_H_
File diff suppressed because it is too large Load Diff
+66 -66
View File
@@ -20,70 +20,70 @@
#ifndef _MODELSLIST_H_ #ifndef _MODELSLIST_H_
#define _MODELSLIST_H_ #define _MODELSLIST_H_
#include <QtWidgets> #include <QtWidgets>
#include "eeprominterface.h" #include "eeprominterface.h"
struct CurrentSelection struct CurrentSelection
{ {
QListWidgetItem *current_item; QListWidgetItem *current_item;
bool selected[CPN_MAX_MODELS+1]; bool selected[CPN_MAX_MODELS+1];
}; };
class ModelsListWidget : public QListWidget class ModelsListWidget : public QListWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
ModelsListWidget(QWidget *parent = 0); ModelsListWidget(QWidget *parent = 0);
bool hasSelection(); bool hasSelection();
void keyPressEvent(QKeyEvent *event); void keyPressEvent(QKeyEvent *event);
bool hasPasteData(); bool hasPasteData();
protected: protected:
void dropEvent(QDropEvent *event); void dropEvent(QDropEvent *event);
void mousePressEvent(QMouseEvent *event); void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event); void mouseMoveEvent(QMouseEvent *event);
void dragEnterEvent(QDragEnterEvent *event); void dragEnterEvent(QDragEnterEvent *event);
void dragLeaveEvent(QDragLeaveEvent *event); void dragLeaveEvent(QDragLeaveEvent *event);
void dragMoveEvent(QDragMoveEvent *event); void dragMoveEvent(QDragMoveEvent *event);
#ifndef WIN32 #ifndef WIN32
void focusInEvent ( QFocusEvent * event ); void focusInEvent ( QFocusEvent * event );
void focusOutEvent ( QFocusEvent * event ); void focusOutEvent ( QFocusEvent * event );
#endif #endif
public slots: public slots:
void refreshList(); void refreshList();
void ShowContextMenu(const QPoint& pos); void ShowContextMenu(const QPoint& pos);
void cut(); void cut();
void copy(); void copy();
void paste(); void paste();
void print(); void print();
void EditModel(); void EditModel();
void OpenEditWindow(); void OpenEditWindow();
void LoadBackup(); void LoadBackup();
void OpenWizard(); void OpenWizard();
void simulate(); void simulate();
void duplicate(); void duplicate();
void setdefault(); void setdefault();
void deleteSelected(bool ask); void deleteSelected(bool ask);
void confirmDelete(); void confirmDelete();
void viableModelSelected(int idx); void viableModelSelected(int idx);
private: private:
void doCut(QByteArray *gmData); void doCut(QByteArray *gmData);
void doPaste(QByteArray *gmData, int index); void doPaste(QByteArray *gmData, int index);
void doCopy(QByteArray *gmData); void doCopy(QByteArray *gmData);
void saveSelection(); void saveSelection();
void restoreSelection(); void restoreSelection();
RadioData *radioData; RadioData *radioData;
QPoint dragStartPosition; QPoint dragStartPosition;
CurrentSelection currentSelection; CurrentSelection currentSelection;
QColor active_highlight_color; QColor active_highlight_color;
}; };
#endif // _MODELSLIST_H_ #endif // _MODELSLIST_H_
+104 -104
View File
@@ -18,107 +18,107 @@
* GNU General Public License for more details. * GNU General Public License for more details.
*/ */
#include "genericpanel.h" #include "genericpanel.h"
#include <QComboBox> #include <QComboBox>
#include <QEvent> #include <QEvent>
#include <QLabel> #include <QLabel>
#include <QGridLayout> #include <QGridLayout>
#include <QSpacerItem> #include <QSpacerItem>
GenericPanel::GenericPanel(QWidget * parent, ModelData * model, GeneralSettings & generalSettings, Firmware * firmware): GenericPanel::GenericPanel(QWidget * parent, ModelData * model, GeneralSettings & generalSettings, Firmware * firmware):
QWidget(parent), QWidget(parent),
model(model), model(model),
generalSettings(generalSettings), generalSettings(generalSettings),
firmware(firmware), firmware(firmware),
lock(false) lock(false)
{ {
} }
GenericPanel::~GenericPanel() GenericPanel::~GenericPanel()
{ {
} }
void GenericPanel::update() void GenericPanel::update()
{ {
} }
void GenericPanel::addLabel(QGridLayout *gridLayout, const QString &text, int col, bool minimize) void GenericPanel::addLabel(QGridLayout *gridLayout, const QString &text, int col, bool minimize)
{ {
QLabel *label = new QLabel(this); QLabel *label = new QLabel(this);
label->setFrameShape(QFrame::Panel); label->setFrameShape(QFrame::Panel);
label->setFrameShadow(QFrame::Raised); label->setFrameShadow(QFrame::Raised);
label->setMidLineWidth(0); label->setMidLineWidth(0);
label->setAlignment(Qt::AlignCenter); label->setAlignment(Qt::AlignCenter);
label->setMargin(5); label->setMargin(5);
label->setText(text); label->setText(text);
if (!minimize) if (!minimize)
label->setMinimumWidth(100); label->setMinimumWidth(100);
gridLayout->addWidget(label, 0, col, 1, 1); gridLayout->addWidget(label, 0, col, 1, 1);
} }
void GenericPanel::addEmptyLabel(QGridLayout * gridLayout, int col) void GenericPanel::addEmptyLabel(QGridLayout * gridLayout, int col)
{ {
QLabel *label = new QLabel(this); QLabel *label = new QLabel(this);
label->setText(""); label->setText("");
gridLayout->addWidget(label, 0, col, 1, 1); gridLayout->addWidget(label, 0, col, 1, 1);
} }
void GenericPanel::addHSpring(QGridLayout * gridLayout, int col, int row) void GenericPanel::addHSpring(QGridLayout * gridLayout, int col, int row)
{ {
QSpacerItem * spacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ); QSpacerItem * spacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );
gridLayout->addItem(spacer, row, col); gridLayout->addItem(spacer, row, col);
} }
void GenericPanel::addVSpring(QGridLayout * gridLayout, int col, int row) void GenericPanel::addVSpring(QGridLayout * gridLayout, int col, int row)
{ {
QSpacerItem * spacer = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding ); QSpacerItem * spacer = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding );
gridLayout->addItem(spacer, row, col); gridLayout->addItem(spacer, row, col);
} }
void GenericPanel::addDoubleSpring(QGridLayout * gridLayout, int col, int row) void GenericPanel::addDoubleSpring(QGridLayout * gridLayout, int col, int row)
{ {
QSpacerItem * spacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding ); QSpacerItem * spacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding );
gridLayout->addItem(spacer, row, col); gridLayout->addItem(spacer, row, col);
} }
bool GenericPanel::eventFilter(QObject *object, QEvent * event) bool GenericPanel::eventFilter(QObject *object, QEvent * event)
{ {
QWidget * widget = qobject_cast<QWidget*>(object); QWidget * widget = qobject_cast<QWidget*>(object);
if (widget) { if (widget) {
if (event->type() == QEvent::Wheel) { if (event->type() == QEvent::Wheel) {
if (widget->focusPolicy() == Qt::WheelFocus) { if (widget->focusPolicy() == Qt::WheelFocus) {
event->accept(); event->accept();
return false; return false;
} }
else { else {
event->ignore(); event->ignore();
return true; return true;
} }
} }
else if (event->type() == QEvent::FocusIn) { else if (event->type() == QEvent::FocusIn) {
widget->setFocusPolicy(Qt::WheelFocus); widget->setFocusPolicy(Qt::WheelFocus);
} }
else if (event->type() == QEvent::FocusOut) { else if (event->type() == QEvent::FocusOut) {
widget->setFocusPolicy(Qt::StrongFocus); widget->setFocusPolicy(Qt::StrongFocus);
} }
} }
return QWidget::eventFilter(object, event); return QWidget::eventFilter(object, event);
} }
void GenericPanel::disableMouseScrolling() void GenericPanel::disableMouseScrolling()
{ {
Q_FOREACH(QComboBox * cb, findChildren<QComboBox*>()) { Q_FOREACH(QComboBox * cb, findChildren<QComboBox*>()) {
cb->installEventFilter(this); cb->installEventFilter(this);
cb->setFocusPolicy(Qt::StrongFocus); cb->setFocusPolicy(Qt::StrongFocus);
} }
Q_FOREACH(QAbstractSpinBox * sb, findChildren<QAbstractSpinBox*>()) { Q_FOREACH(QAbstractSpinBox * sb, findChildren<QAbstractSpinBox*>()) {
sb->installEventFilter(this); sb->installEventFilter(this);
sb->setFocusPolicy(Qt::StrongFocus); sb->setFocusPolicy(Qt::StrongFocus);
} }
Q_FOREACH(QSlider * slider, findChildren<QSlider*>()) { Q_FOREACH(QSlider * slider, findChildren<QSlider*>()) {
slider->installEventFilter(this); slider->installEventFilter(this);
slider->setFocusPolicy(Qt::StrongFocus); slider->setFocusPolicy(Qt::StrongFocus);
} }
} }
+43 -43
View File
@@ -20,47 +20,47 @@
#ifndef _GENERICPANEL_H_ #ifndef _GENERICPANEL_H_
#define _GENERICPANEL_H_ #define _GENERICPANEL_H_
#include <QWidget> #include <QWidget>
class ModelData; class ModelData;
class GeneralSettings; class GeneralSettings;
class Firmware; class Firmware;
class QGridLayout; class QGridLayout;
class QString; class QString;
class GenericPanel : public QWidget class GenericPanel : public QWidget
{ {
Q_OBJECT Q_OBJECT
friend class AutoComboBox; friend class AutoComboBox;
friend class AutoDoubleSpinBox; friend class AutoDoubleSpinBox;
friend class AutoCheckBox; friend class AutoCheckBox;
friend class AutoHexSpinBox; friend class AutoHexSpinBox;
friend class AutoLineEdit; friend class AutoLineEdit;
public: public:
GenericPanel(QWidget *parent, ModelData * model, GeneralSettings & generalSettings, Firmware * firmware); GenericPanel(QWidget *parent, ModelData * model, GeneralSettings & generalSettings, Firmware * firmware);
virtual ~GenericPanel(); virtual ~GenericPanel();
signals: signals:
void modified(); void modified();
public slots: public slots:
virtual void update(); virtual void update();
protected: protected:
ModelData * model; ModelData * model;
GeneralSettings & generalSettings; GeneralSettings & generalSettings;
Firmware * firmware; Firmware * firmware;
bool lock; bool lock;
void addLabel(QGridLayout * gridLayout, const QString &text, int col, bool mimimize=false); void addLabel(QGridLayout * gridLayout, const QString &text, int col, bool mimimize=false);
void addEmptyLabel(QGridLayout * gridLayout, int col); void addEmptyLabel(QGridLayout * gridLayout, int col);
void addHSpring(QGridLayout *, int col, int row); void addHSpring(QGridLayout *, int col, int row);
void addVSpring(QGridLayout *, int col, int row); void addVSpring(QGridLayout *, int col, int row);
void addDoubleSpring(QGridLayout *, int col, int row); void addDoubleSpring(QGridLayout *, int col, int row);
virtual bool eventFilter(QObject *obj, QEvent *event); virtual bool eventFilter(QObject *obj, QEvent *event);
void disableMouseScrolling(); void disableMouseScrolling();
}; };
#endif // _GENERICPANEL_H_ #endif // _GENERICPANEL_H_
+27 -27
View File
@@ -18,30 +18,30 @@
* GNU General Public License for more details. * GNU General Public License for more details.
*/ */
#include "hexspinbox.h" #include "hexspinbox.h"
HexSpinBox::HexSpinBox(QWidget *parent): HexSpinBox::HexSpinBox(QWidget *parent):
QSpinBox(parent) QSpinBox(parent)
{ {
validator = new QRegExpValidator(QRegExp("[0-9A-Fa-f]{1,8}"), this); validator = new QRegExpValidator(QRegExp("[0-9A-Fa-f]{1,8}"), this);
} }
QValidator::State HexSpinBox::validate(QString &text, int &pos) const QValidator::State HexSpinBox::validate(QString &text, int &pos) const
{ {
return validator->validate(text, pos); return validator->validate(text, pos);
} }
int HexSpinBox::valueFromText(const QString &text) const int HexSpinBox::valueFromText(const QString &text) const
{ {
return text.toInt(0, 16); return text.toInt(0, 16);
} }
QString HexSpinBox::textFromValue(int value) const QString HexSpinBox::textFromValue(int value) const
{ {
QString text; QString text;
text.sprintf("%04X", value); text.sprintf("%04X", value);
return text; return text;
} }
+21 -21
View File
@@ -20,25 +20,25 @@
#ifndef _HEXSPINBOX_H_ #ifndef _HEXSPINBOX_H_
#define _HEXSPINBOX_H_ #define _HEXSPINBOX_H_
#include <QSpinBox> #include <QSpinBox>
class QRegExpValidator; class QRegExpValidator;
class HexSpinBox : public QSpinBox class HexSpinBox : public QSpinBox
{ {
Q_OBJECT Q_OBJECT
public: public:
HexSpinBox(QWidget *parent = 0); HexSpinBox(QWidget *parent = 0);
protected: protected:
QValidator::State validate(QString &text, int &pos) const; QValidator::State validate(QString &text, int &pos) const;
int valueFromText(const QString &text) const; int valueFromText(const QString &text) const;
QString textFromValue(int value) const; QString textFromValue(int value) const;
private: private:
QRegExpValidator *validator; QRegExpValidator *validator;
}; };
#endif // _HEXSPINBOX_H_ #endif // _HEXSPINBOX_H_
+22 -22
View File
@@ -18,25 +18,25 @@
* GNU General Public License for more details. * GNU General Public License for more details.
*/ */
#include "verticalscrollarea.h" #include "verticalscrollarea.h"
#include "genericpanel.h" #include "genericpanel.h"
#include <QEvent> #include <QEvent>
#include <QScrollBar> #include <QScrollBar>
VerticalScrollArea::VerticalScrollArea(QWidget * parent, GenericPanel * panel): VerticalScrollArea::VerticalScrollArea(QWidget * parent, GenericPanel * panel):
QScrollArea(parent), QScrollArea(parent),
panel(panel) panel(panel)
{ {
setWidgetResizable(true); setWidgetResizable(true);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setWidget(panel); setWidget(panel);
panel->installEventFilter(this); panel->installEventFilter(this);
} }
bool VerticalScrollArea::eventFilter(QObject * o, QEvent * e) bool VerticalScrollArea::eventFilter(QObject * o, QEvent * e)
{ {
if (o == panel && e->type() == QEvent::Resize) { if (o == panel && e->type() == QEvent::Resize) {
setMinimumWidth(panel->minimumSizeHint().width() + verticalScrollBar()->width()); setMinimumWidth(panel->minimumSizeHint().width() + verticalScrollBar()->width());
} }
return false; return false;
} }
+18 -18
View File
@@ -20,22 +20,22 @@
#ifndef _VERTICALSCROLLAREA_H_ #ifndef _VERTICALSCROLLAREA_H_
#define _VERTICALSCROLLAREA_H_ #define _VERTICALSCROLLAREA_H_
#include <QScrollArea> #include <QScrollArea>
class GenericPanel; class GenericPanel;
class VerticalScrollArea : public QScrollArea class VerticalScrollArea : public QScrollArea
{ {
public: public:
VerticalScrollArea(QWidget * parent, GenericPanel * panel); VerticalScrollArea(QWidget * parent, GenericPanel * panel);
protected: protected:
virtual bool eventFilter(QObject * o, QEvent * e); virtual bool eventFilter(QObject * o, QEvent * e);
private: private:
GenericPanel * panel; GenericPanel * panel;
}; };
#endif // _VERTICALSCROLLAREA_H_ #endif // _VERTICALSCROLLAREA_H_
File diff suppressed because it is too large Load Diff
+253 -253
View File
@@ -20,257 +20,257 @@
#ifndef _SIMULATORDIALOG_H_ #ifndef _SIMULATORDIALOG_H_
#define _SIMULATORDIALOG_H_ #define _SIMULATORDIALOG_H_
#include "modeledit/node.h" #include "modeledit/node.h"
#include "telemetrysimu.h" #include "telemetrysimu.h"
#include "trainersimu.h" #include "trainersimu.h"
#include "debugoutput.h" #include "debugoutput.h"
#ifdef JOYSTICKS #ifdef JOYSTICKS
#include "joystick.h" #include "joystick.h"
#endif #endif
#define TMR_OFF 0 #define TMR_OFF 0
#define TMR_RUNNING 1 #define TMR_RUNNING 1
#define TMR_BEEPING 2 #define TMR_BEEPING 2
#define TMR_STOPPED 3 #define TMR_STOPPED 3
#define FLASH_DURATION 10 #define FLASH_DURATION 10
namespace Ui { namespace Ui {
class SimulatorDialog9X; class SimulatorDialog9X;
class SimulatorDialogTaranis; class SimulatorDialogTaranis;
class SimulatorDialogFlamenco; class SimulatorDialogFlamenco;
class SimulatorDialogHorus; class SimulatorDialogHorus;
} }
// TODO rename + move? // TODO rename + move?
class LcdWidget; class LcdWidget;
class SliderWidget; class SliderWidget;
#define SIMULATOR_FLAGS_NOTX 1 #define SIMULATOR_FLAGS_NOTX 1
#define SIMULATOR_FLAGS_STICK_MODE_LEFT 2 #define SIMULATOR_FLAGS_STICK_MODE_LEFT 2
#define SIMULATOR_FLAGS_S1 4 #define SIMULATOR_FLAGS_S1 4
#define SIMULATOR_FLAGS_S2 8 #define SIMULATOR_FLAGS_S2 8
#define SIMULATOR_FLAGS_S3 16 #define SIMULATOR_FLAGS_S3 16
#define SIMULATOR_FLAGS_S4 32 // reserved for the future #define SIMULATOR_FLAGS_S4 32 // reserved for the future
#define SIMULATOR_FLAGS_S1_MULTI 64 #define SIMULATOR_FLAGS_S1_MULTI 64
#define SIMULATOR_FLAGS_S2_MULTI 128 #define SIMULATOR_FLAGS_S2_MULTI 128
#define SIMULATOR_FLAGS_S3_MULTI 256 #define SIMULATOR_FLAGS_S3_MULTI 256
#define SIMULATOR_FLAGS_S4_MULTI 512 // reserved for the future #define SIMULATOR_FLAGS_S4_MULTI 512 // reserved for the future
void traceCb(const char * text); void traceCb(const char * text);
class SimulatorDialog : public QDialog class SimulatorDialog : public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit SimulatorDialog(QWidget * parent, SimulatorInterface *simulator, unsigned int flags=0); explicit SimulatorDialog(QWidget * parent, SimulatorInterface *simulator, unsigned int flags=0);
virtual ~SimulatorDialog(); virtual ~SimulatorDialog();
void start(const char * filename); void start(const char * filename);
void start(QByteArray & eeprom); void start(QByteArray & eeprom);
virtual void traceCallback(const char * text); virtual void traceCallback(const char * text);
protected: protected:
template <class T> void initUi(T * ui); template <class T> void initUi(T * ui);
virtual void setLightOn(bool enable) { } virtual void setLightOn(bool enable) { }
virtual void updateBeepButton() { } virtual void updateBeepButton() { }
unsigned int flags; unsigned int flags;
LcdWidget * lcd; LcdWidget * lcd;
QGraphicsView * leftStick, * rightStick; QGraphicsView * leftStick, * rightStick;
QVector<QDial *> pots; QVector<QDial *> pots;
QVector<QLabel *> potLabels; QVector<QLabel *> potLabels;
QVector<QLabel *> potValues; QVector<QLabel *> potValues;
QVector<QSlider *> sliders; QVector<QSlider *> sliders;
SliderWidget * trimHLeft, * trimVLeft, * trimHRight, * trimVRight; SliderWidget * trimHLeft, * trimVLeft, * trimHRight, * trimVRight;
QLabel * leftXPerc, * rightXPerc, * leftYPerc, * rightYPerc; QLabel * leftXPerc, * rightXPerc, * leftYPerc, * rightYPerc;
QTabWidget * tabWidget; QTabWidget * tabWidget;
QVector<QLabel *> logicalSwitchLabels; QVector<QLabel *> logicalSwitchLabels;
QVector<QLabel *> logicalSwitchLabels2; QVector<QLabel *> logicalSwitchLabels2;
QVector<QSlider *> channelSliders; QVector<QSlider *> channelSliders;
QVector<QLabel *> channelValues; QVector<QLabel *> channelValues;
QVector<QLabel *> gvarValues; QVector<QLabel *> gvarValues;
void init(); void init();
Node *nodeLeft; Node *nodeLeft;
Node *nodeRight; Node *nodeRight;
QTimer *timer; QTimer *timer;
QString windowName; QString windowName;
unsigned int backLight; unsigned int backLight;
bool lightOn; bool lightOn;
int switches; int switches;
unsigned int numGvars; unsigned int numGvars;
unsigned int numFlightModes; unsigned int numFlightModes;
#ifdef JOYSTICKS #ifdef JOYSTICKS
Joystick *joystick; Joystick *joystick;
int jscal[8][4]; int jscal[8][4];
int jsmap[8]; int jsmap[8];
#endif #endif
SimulatorInterface *simulator; SimulatorInterface *simulator;
unsigned int lastPhase; unsigned int lastPhase;
void setupSticks(); void setupSticks();
void setupTimer(); void setupTimer();
void resizeEvent(QResizeEvent *event = 0); void resizeEvent(QResizeEvent *event = 0);
virtual void getValues() = 0; virtual void getValues() = 0;
void setValues(); void setValues();
void centerSticks(); void centerSticks();
int getValue(qint8 i); int getValue(qint8 i);
bool getSwitch(int swtch, bool nc, qint8 level=0); bool getSwitch(int swtch, bool nc, qint8 level=0);
void setTrims(); void setTrims();
QFrame * createLogicalSwitch(QWidget * parent, int switchNo, QVector<QLabel *> & labels); QFrame * createLogicalSwitch(QWidget * parent, int switchNo, QVector<QLabel *> & labels);
int beepVal; int beepVal;
int lcdWidth; int lcdWidth;
int lcdHeight; int lcdHeight;
int lcdDepth; int lcdDepth;
TelemetrySimulator * TelemetrySimu; TelemetrySimulator * TelemetrySimu;
TrainerSimulator * TrainerSimu; TrainerSimulator * TrainerSimu;
DebugOutput * DebugOut; DebugOutput * DebugOut;
QString traceBuffer; QString traceBuffer;
QMutex traceMutex; QMutex traceMutex;
QList<QString> traceList; QList<QString> traceList;
void updateDebugOutput(); void updateDebugOutput();
protected: protected:
virtual void closeEvent(QCloseEvent *); virtual void closeEvent(QCloseEvent *);
virtual void mousePressEvent(QMouseEvent *); virtual void mousePressEvent(QMouseEvent *);
virtual void mouseReleaseEvent(QMouseEvent *); virtual void mouseReleaseEvent(QMouseEvent *);
virtual void wheelEvent(QWheelEvent *); virtual void wheelEvent(QWheelEvent *);
virtual void keyPressEvent(QKeyEvent *); virtual void keyPressEvent(QKeyEvent *);
virtual void keyReleaseEvent(QKeyEvent *); virtual void keyReleaseEvent(QKeyEvent *);
static int screenshotIdx; static int screenshotIdx;
int buttonPressed; int buttonPressed;
int trimPressed; int trimPressed;
bool middleButtonPressed; bool middleButtonPressed;
private slots: private slots:
void onButtonPressed(int value); void onButtonPressed(int value);
void on_FixRightY_clicked(bool checked); void on_FixRightY_clicked(bool checked);
void on_FixRightX_clicked(bool checked); void on_FixRightX_clicked(bool checked);
void on_FixLeftY_clicked(bool checked); void on_FixLeftY_clicked(bool checked);
void on_FixLeftX_clicked(bool checked); void on_FixLeftX_clicked(bool checked);
void on_holdRightY_clicked(bool checked); void on_holdRightY_clicked(bool checked);
void on_holdRightX_clicked(bool checked); void on_holdRightX_clicked(bool checked);
void on_holdLeftY_clicked(bool checked); void on_holdLeftY_clicked(bool checked);
void on_holdLeftX_clicked(bool checked); void on_holdLeftX_clicked(bool checked);
void on_trimHLeft_valueChanged(int); void on_trimHLeft_valueChanged(int);
void on_trimVLeft_valueChanged(int); void on_trimVLeft_valueChanged(int);
void on_trimHRight_valueChanged(int); void on_trimHRight_valueChanged(int);
void on_trimVRight_valueChanged(int); void on_trimVRight_valueChanged(int);
void onTimerEvent(); void onTimerEvent();
void onTrimPressed(); void onTrimPressed();
void onTrimReleased(); void onTrimReleased();
void openTelemetrySimulator(); void openTelemetrySimulator();
void openTrainerSimulator(); void openTrainerSimulator();
void openDebugOutput(); void openDebugOutput();
void onDebugOutputClose(); void onDebugOutputClose();
void luaReload(); void luaReload();
#ifdef JOYSTICKS #ifdef JOYSTICKS
void onjoystickAxisValueChanged(int axis, int value); void onjoystickAxisValueChanged(int axis, int value);
#endif #endif
}; };
class SimulatorDialog9X: public SimulatorDialog class SimulatorDialog9X: public SimulatorDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit SimulatorDialog9X(QWidget * parent, SimulatorInterface *simulator, unsigned int flags=0); explicit SimulatorDialog9X(QWidget * parent, SimulatorInterface *simulator, unsigned int flags=0);
virtual ~SimulatorDialog9X(); virtual ~SimulatorDialog9X();
protected: protected:
virtual void getValues(); virtual void getValues();
virtual void setLightOn(bool enable); virtual void setLightOn(bool enable);
virtual void updateBeepButton(); virtual void updateBeepButton();
void saveSwitches(void); void saveSwitches(void);
void restoreSwitches(void); void restoreSwitches(void);
protected slots: protected slots:
void dialChanged(int index); void dialChanged(int index);
private: private:
Ui::SimulatorDialog9X * ui; Ui::SimulatorDialog9X * ui;
static uint32_t switchstatus; static uint32_t switchstatus;
int beepShow; int beepShow;
}; };
class SimulatorDialogTaranis: public SimulatorDialog class SimulatorDialogTaranis: public SimulatorDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit SimulatorDialogTaranis(QWidget * parent, SimulatorInterface *simulator, unsigned int flags=0); explicit SimulatorDialogTaranis(QWidget * parent, SimulatorInterface *simulator, unsigned int flags=0);
virtual ~SimulatorDialogTaranis(); virtual ~SimulatorDialogTaranis();
protected: protected:
virtual void getValues(); virtual void getValues();
void saveSwitches(void); void saveSwitches(void);
void restoreSwitches(void); void restoreSwitches(void);
private: private:
Ui::SimulatorDialogTaranis * ui; Ui::SimulatorDialogTaranis * ui;
static uint32_t switchstatus; static uint32_t switchstatus;
private slots: private slots:
void resetSH(); void resetSH();
void on_switchH_sliderReleased(); void on_switchH_sliderReleased();
}; };
class SimulatorDialogFlamenco: public SimulatorDialog class SimulatorDialogFlamenco: public SimulatorDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit SimulatorDialogFlamenco(QWidget * parent, SimulatorInterface *simulator, unsigned int flags=0); explicit SimulatorDialogFlamenco(QWidget * parent, SimulatorInterface *simulator, unsigned int flags=0);
virtual ~SimulatorDialogFlamenco(); virtual ~SimulatorDialogFlamenco();
protected: protected:
virtual void getValues(); virtual void getValues();
void saveSwitches(void); void saveSwitches(void);
void restoreSwitches(void); void restoreSwitches(void);
private: private:
Ui::SimulatorDialogFlamenco * ui; Ui::SimulatorDialogFlamenco * ui;
static uint32_t switchstatus; static uint32_t switchstatus;
private slots: private slots:
void resetSH(); void resetSH();
void on_switchH_sliderReleased(); void on_switchH_sliderReleased();
}; };
class SimulatorDialogHorus: public SimulatorDialog class SimulatorDialogHorus: public SimulatorDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit SimulatorDialogHorus(QWidget * parent, SimulatorInterface *simulator, unsigned int flags=0); explicit SimulatorDialogHorus(QWidget * parent, SimulatorInterface *simulator, unsigned int flags=0);
virtual ~SimulatorDialogHorus(); virtual ~SimulatorDialogHorus();
protected: protected:
virtual void getValues(); virtual void getValues();
void saveSwitches(void); void saveSwitches(void);
void restoreSwitches(void); void restoreSwitches(void);
private: private:
Ui::SimulatorDialogHorus * ui; Ui::SimulatorDialogHorus * ui;
static uint32_t switchstatus; static uint32_t switchstatus;
private slots: private slots:
void resetSH(); void resetSH();
void on_switchH_sliderReleased(); void on_switchH_sliderReleased();
}; };
#endif // _SIMULATORDIALOG_H_ #endif // _SIMULATORDIALOG_H_