Refactor to Model level ui datamodels for sources, switches and curves

This commit is contained in:
elecpower
2020-09-17 14:30:20 +10:00
parent 6ad75996e6
commit 1e0e22955d
34 changed files with 994 additions and 623 deletions
+13 -7
View File
@@ -24,8 +24,9 @@
#include "modeledit.h"
#include "radiodata.h"
class RawSwitchFilterItemModel;
class RawSourceFilterItemModel;
class RawSourceItemModel;
class RawSwitchItemModel;
class RawItemFilteredModel;
class TimerEdit;
constexpr char MIMETYPE_LOGICAL_SWITCH[] = "application/x-companion-logical-switch";
@@ -35,13 +36,13 @@ class LogicalSwitchesPanel : public ModelPanel
Q_OBJECT
public:
LogicalSwitchesPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware);
LogicalSwitchesPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware,
RawSourceItemModel * rawSourceItemModel, RawSwitchItemModel * rawSwitchItemModel);
virtual ~LogicalSwitchesPanel();
virtual void update();
private slots:
void updateDataModels();
void onFunctionChanged();
void onV1Changed(int value);
void onV2Changed(int value);
@@ -61,6 +62,11 @@ class LogicalSwitchesPanel : public ModelPanel
void cmInsert();
void cmClear(bool prompt = true);
void cmClearAll();
void onModelDataAboutToBeUpdated();
void onModelDataUpdateComplete();
signals:
void updateDataModels();
private:
QComboBox * cbFunction[CPN_MAX_LOGICAL_SWITCHES];
@@ -73,11 +79,10 @@ class LogicalSwitchesPanel : public ModelPanel
QDoubleSpinBox * dsbDelay[CPN_MAX_LOGICAL_SWITCHES];
QComboBox * cbSource1[CPN_MAX_LOGICAL_SWITCHES];
QComboBox * cbSource2[CPN_MAX_LOGICAL_SWITCHES];
RawSwitchFilterItemModel * rawSwitchItemModel;
RawSourceFilterItemModel * rawSourceItemModel;
RawItemFilteredModel * rawSwitchModel;
RawItemFilteredModel * rawSourceModel;
int selectedIndex;
void populateFunctionCB(QComboBox *b);
void populateAndSwitchCB(QComboBox *b);
void updateTimerParam(QDoubleSpinBox *sb, int timer, double minimum=0);
int lsCapability;
int lsCapabilityExt;
@@ -86,6 +91,7 @@ class LogicalSwitchesPanel : public ModelPanel
bool insertAllowed() const;
bool moveDownAllowed() const;
bool moveUpAllowed() const;
int modelsUpdateCnt;
};
#endif // _LOGICALSWITCHES_H_