[Companion] Sensor switches support added

+ some refactoring to hide irrelevant switches in the combobox

More refactoring to come:
 - have only one SwitchModel per model instead of one per tab
 - only do the update work if something has changed
This commit is contained in:
Bertrand Songis
2017-07-30 12:12:27 +02:00
parent b814f997f8
commit b55070f939
18 changed files with 290 additions and 111 deletions
+6 -2
View File
@@ -250,7 +250,9 @@ enum RawSwitchType {
SWITCH_TYPE_OFF,
SWITCH_TYPE_ONE,
SWITCH_TYPE_FLIGHT_MODE,
SWITCH_TYPE_TIMER_MODE
SWITCH_TYPE_TIMER_MODE,
SWITCH_TYPE_TELEMETRY,
SWITCH_TYPE_SENSOR,
};
class RawSwitch {
@@ -278,7 +280,7 @@ class RawSwitch {
return index >= 0 ? (type * 256 + index) : -(type * 256 - index);
}
QString toString(Board::Type board = Board::BOARD_UNKNOWN, const GeneralSettings * const generalSettings = NULL) const;
QString toString(Board::Type board = Board::BOARD_UNKNOWN, const GeneralSettings * const generalSettings = NULL, const ModelData * const modelData = NULL) const;
bool operator== ( const RawSwitch& other) {
return (this->type == other.type) && (this->index == other.index);
@@ -1110,6 +1112,8 @@ class ModelData {
int getChannelsMax(bool forceExtendedLimits=false) const;
bool isAvailable(const RawSwitch & swtch) const;
protected:
void removeGlobalVar(int & var);
};