Fix remaining model editor sync issues with RawSource changes. (#5936)
[opentx.git] / companion / src / modeledit / customfunctions.h
blob8c4c5cd99b556d82b33c35e49cc88a2055f9adeb
1 /*
2 * Copyright (C) OpenTX
4 * Based on code named
5 * th9x - http://code.google.com/p/th9x
6 * er9x - http://code.google.com/p/er9x
7 * gruvin9x - http://code.google.com/p/gruvin9x
9 * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
21 #ifndef _CUSTOMFUNCTIONS_H_
22 #define _CUSTOMFUNCTIONS_H_
24 #include <QMediaPlayer>
25 #include "modeledit.h"
26 #include "eeprominterface.h"
28 class RawSwitchFilterItemModel;
29 class TimerEdit;
31 class RepeatComboBox: public QComboBox
33 Q_OBJECT
35 public:
36 RepeatComboBox(QWidget * parent, int & repeatParam);
37 void update();
39 signals:
40 void modified();
42 private slots:
43 void onIndexChanged(int);
45 protected:
46 int & repeatParam;
49 class CustomFunctionsPanel : public GenericPanel
51 Q_OBJECT
53 public:
54 CustomFunctionsPanel(QWidget *parent, ModelData * mode, GeneralSettings & generalSettings, Firmware * firmware);
55 ~CustomFunctionsPanel();
57 virtual void update();
59 protected:
60 CustomFunctionData * functions;
62 private slots:
63 void setDataModels();
64 void customFunctionEdited();
65 void functionEdited();
66 void fsw_customContextMenuRequested(QPoint pos);
67 void refreshCustomFunction(int index, bool modified=false);
68 void onChildModified();
69 void playMusic();
70 void onMediaPlayerStateChanged(QMediaPlayer::State state);
71 void onMediaPlayerError(QMediaPlayer::Error error);
72 void fswDelete();
73 void fswCopy();
74 void fswPaste();
75 void fswCut();
77 private:
78 void populateFuncCB(QComboBox *b, unsigned int value);
79 void populateGVmodeCB(QComboBox *b, unsigned int value);
80 void populateFuncParamCB(QComboBox *b, uint function, unsigned int value, unsigned int adjustmode=0);
81 RawSwitchFilterItemModel * rawSwitchItemModel;
82 QStandardItemModel * rawSrcInputsItemModel;
83 QStandardItemModel * rawSrcAllItemModel;
85 QSet<QString> tracksSet;
86 QSet<QString> scriptsSet;
87 int mediaPlayerCurrent;
88 QComboBox * fswtchSwtch[CPN_MAX_SPECIAL_FUNCTIONS];
89 QComboBox * fswtchFunc[CPN_MAX_SPECIAL_FUNCTIONS];
90 QCheckBox * fswtchParamGV[CPN_MAX_SPECIAL_FUNCTIONS];
91 QDoubleSpinBox * fswtchParam[CPN_MAX_SPECIAL_FUNCTIONS];
92 TimerEdit * fswtchParamTime[CPN_MAX_SPECIAL_FUNCTIONS];
93 QPushButton * playBT[CPN_MAX_SPECIAL_FUNCTIONS];
94 QComboBox * fswtchParamT[CPN_MAX_SPECIAL_FUNCTIONS];
95 QComboBox * fswtchParamArmT[CPN_MAX_SPECIAL_FUNCTIONS];
96 QCheckBox * fswtchEnable[CPN_MAX_SPECIAL_FUNCTIONS];
97 RepeatComboBox * fswtchRepeat[CPN_MAX_SPECIAL_FUNCTIONS];
98 QComboBox * fswtchGVmode[CPN_MAX_SPECIAL_FUNCTIONS];
99 QSlider * fswtchBLcolor[CPN_MAX_SPECIAL_FUNCTIONS];
100 QMediaPlayer * mediaPlayer;
102 int selectedFunction;
106 #endif // _CUSTOMFUNCTIONS_H_