Major refactoring
This commit is contained in:
@@ -23,12 +23,11 @@
|
||||
|
||||
#include "modeledit.h"
|
||||
#include "eeprominterface.h"
|
||||
#include "rawitemfilteredmodel.h"
|
||||
|
||||
constexpr char MIMETYPE_TELE_SENSOR[] = "application/x-companion-tele-sensor";
|
||||
constexpr char MIMETYPE_TELE_SENSOR[] {"application/x-companion-tele-sensor"};
|
||||
|
||||
class AutoComboBox;
|
||||
class CommonItemModels;
|
||||
class RawItemFilteredModel;
|
||||
class TimerEdit;
|
||||
|
||||
namespace Ui {
|
||||
@@ -42,7 +41,8 @@ class TelemetryCustomScreen: public ModelPanel
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TelemetryCustomScreen(QWidget *parent, ModelData & model, FrSkyScreenData & screen, GeneralSettings & generalSettings, Firmware * firmware, RawItemFilteredModel * rawSourceModel);
|
||||
TelemetryCustomScreen(QWidget *parent, ModelData & model, FrSkyScreenData & screen, GeneralSettings & generalSettings, Firmware * firmware,
|
||||
const bool & parentLock, FilteredItemModelsFactory * localFilteredItemModels);
|
||||
~TelemetryCustomScreen();
|
||||
void update();
|
||||
|
||||
@@ -54,8 +54,8 @@ class TelemetryCustomScreen: public ModelPanel
|
||||
void barMinChanged(double value);
|
||||
void barMaxChanged(double value);
|
||||
void barTimeChanged();
|
||||
void onModelDataAboutToBeUpdated();
|
||||
void onModelDataUpdateComplete();
|
||||
void onItemModelAboutToBeUpdated();
|
||||
void onItemModelUpdateComplete();
|
||||
|
||||
private:
|
||||
void updateBar(int line);
|
||||
@@ -67,6 +67,11 @@ class TelemetryCustomScreen: public ModelPanel
|
||||
QDoubleSpinBox * maxSB[4];
|
||||
TimerEdit * minTime[4];
|
||||
TimerEdit * maxTime[4];
|
||||
int modelsUpdateCnt;
|
||||
const bool &parentLock;
|
||||
|
||||
inline bool isLocked() { return lock | parentLock; }
|
||||
void connectItemModelEvents(const FilteredItemModel * itemModel);
|
||||
};
|
||||
|
||||
class TelemetrySensorPanel: public ModelPanel
|
||||
@@ -74,7 +79,9 @@ class TelemetrySensorPanel: public ModelPanel
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TelemetrySensorPanel(QWidget *parent, SensorData & sensor, int sensorIndex, int sensorCapability, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware);
|
||||
TelemetrySensorPanel(QWidget *parent, SensorData & sensor, int sensorIndex, int sensorCapability, ModelData & model,
|
||||
GeneralSettings & generalSettings, Firmware * firmware, const bool & parentLock,
|
||||
FilteredItemModelsFactory * localFilteredItemModels);
|
||||
~TelemetrySensorPanel();
|
||||
void update();
|
||||
|
||||
@@ -86,7 +93,6 @@ class TelemetrySensorPanel: public ModelPanel
|
||||
void moveUpSensor(int index);
|
||||
void moveDownSensor(int index);
|
||||
|
||||
|
||||
protected slots:
|
||||
void on_name_editingFinished();
|
||||
void on_type_currentIndexChanged(int index);
|
||||
@@ -104,20 +110,24 @@ class TelemetrySensorPanel: public ModelPanel
|
||||
void cmDelete();
|
||||
void cmMoveUp();
|
||||
void cmMoveDown();
|
||||
|
||||
protected:
|
||||
void updateSourcesComboBox(AutoComboBox * cb, bool negative);
|
||||
void onItemModelAboutToBeUpdated();
|
||||
void onItemModelUpdateComplete();
|
||||
|
||||
private:
|
||||
Ui::TelemetrySensor * ui;
|
||||
SensorData & sensor;
|
||||
bool lock = false;
|
||||
//bool lock = false;
|
||||
int sensorIndex = 0;
|
||||
int selectedIndex = 0;
|
||||
int sensorCapability;
|
||||
bool insertAllowed() const;
|
||||
bool moveDownAllowed() const;
|
||||
bool moveUpAllowed() const;
|
||||
int modelsUpdateCnt;
|
||||
const bool &parentLock;
|
||||
|
||||
inline bool isLocked() { return lock | parentLock; }
|
||||
void connectItemModelEvents(const FilteredItemModel * itemModel);
|
||||
};
|
||||
|
||||
class TelemetryPanel : public ModelPanel
|
||||
@@ -125,7 +135,8 @@ class TelemetryPanel : public ModelPanel
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TelemetryPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware, CommonItemModels * commonItemModels);
|
||||
TelemetryPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware,
|
||||
ItemModelsFactory * sharedItemModels);
|
||||
virtual ~TelemetryPanel();
|
||||
virtual void update();
|
||||
|
||||
@@ -152,22 +163,23 @@ class TelemetryPanel : public ModelPanel
|
||||
void on_moveUpSensor(int index);
|
||||
void on_moveDownSensor(int index);
|
||||
void on_dataModifiedSensor();
|
||||
void onItemModelAboutToBeUpdated();
|
||||
void onItemModelUpdateComplete();
|
||||
|
||||
private:
|
||||
Ui::Telemetry *ui;
|
||||
TelemetryCustomScreen * telemetryCustomScreens[4];
|
||||
TelemetrySensorPanel * sensorPanels[CPN_MAX_SENSORS];
|
||||
TelemetryCustomScreen *telemetryCustomScreens[4];
|
||||
TelemetrySensorPanel *sensorPanels[CPN_MAX_SENSORS];
|
||||
int sensorCapability;
|
||||
CommonItemModels * commonItemModels;
|
||||
RawItemFilteredModel * rawSourceFilteredModel;
|
||||
ItemModelsFactory *sharedItemModels;
|
||||
FilteredItemModelsFactory *localFilteredItemModels;
|
||||
int modelsUpdateCnt;
|
||||
|
||||
void setup();
|
||||
void telBarUpdate();
|
||||
void populateVoltsSource();
|
||||
void populateCurrentSource();
|
||||
void populateVarioSource();
|
||||
void swapData(int idx1, int idx2);
|
||||
void updateItemModels();
|
||||
void connectItemModelEvents(const FilteredItemModel * itemModel);
|
||||
inline bool isLocked() { return lock; }
|
||||
};
|
||||
|
||||
#endif // _TELEMETRY_H_
|
||||
|
||||
Reference in New Issue
Block a user