dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
notifypluginoptionspage.h
Go to the documentation of this file.
1 
15 /*
16  * This program is free software; you can redistribute it and/or modify
17  * it under the terms of the GNU General Public License as published by
18  * the Free Software Foundation; either version 3 of the License, or
19  * (at your option) any later version.
20  *
21  * This program is distributed in the hope that it will be useful, but
22  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
23  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24  * for more details.
25  *
26  * You should have received a copy of the GNU General Public License along
27  * with this program; if not, see <http://www.gnu.org/licenses/>
28  */
29 
30 #ifndef NOTIFYPLUGINOPTIONSPAGE_H
31 #define NOTIFYPLUGINOPTIONSPAGE_H
32 
35 #include "uavobjects/uavobject.h"
36 
37 #include "QString"
38 #include <QStringList>
39 #include <QItemSelectionModel>
40 #include <QDebug>
41 #include <QtCore/QSettings>
42 #include <QComboBox>
43 #include <QSpinBox>
44 #include <QSoundEffect>
45 #include <QMediaPlayer>
46 
47 class NotifyTableModel;
48 class NotificationItem;
49 class SoundNotifyPlugin;
50 
51 namespace Ui {
53 };
54 
55 using namespace Core;
56 
58 {
59  Q_OBJECT
60 
61 public:
62  enum { equal, bigger, smaller, inrange };
63  explicit NotifyPluginOptionsPage(QObject *parent = nullptr);
65  QString id() const { return QLatin1String("settings"); }
66  QString trName() const { return tr("settings"); }
67  QString category() const { return QLatin1String("Notify Plugin"); }
68  QString trCategory() const { return tr("Notify Plugin"); }
69 
70  QWidget *createPage(QWidget *parent);
71  void apply();
72  void finish();
73  void restoreFromSettings();
74  static QStringList conditionValues;
75 
76 signals:
77  void updateNotifications(QList<NotificationItem *> list);
78  void entryUpdated(int index);
79 
80 private slots:
81  void on_clicked_buttonTestSoundNotification();
82  void on_clicked_buttonAddNotification();
83  void on_clicked_buttonDeleteNotification();
84  void on_clicked_buttonModifyNotification();
85 
90  void on_changedSelection_notifyTable(const QItemSelection &selected,
91  const QItemSelection &deselected);
92 
93  void on_changedIndex_soundLanguage(int index);
94  void on_clicked_buttonSoundFolder(const QString &path);
95  void on_changedIndex_UAVObject(QString val);
96  void on_changedIndex_UAVField(QString val);
97  void on_changed_playButtonText(QMediaPlayer::State newstate);
98 
105  void on_changedIndex_rangeValue(QString);
106 
107  void on_FinishedPlaying(void);
108 
109 private:
110  Q_DISABLE_COPY(NotifyPluginOptionsPage)
111 
112  void initButtons();
113  void initPhononPlayer();
114  void initRulesTable();
115 
116  void setSelectedNotification(NotificationItem *ntf);
117  void resetValueRange();
118  void resetFieldType();
119 
120  void updateConfigView(NotificationItem *notification);
121  void getOptionsPageValues(NotificationItem *notification);
122  UAVObjectField *getObjectFieldFromPage();
123  UAVObjectField *getObjectFieldFromSelected();
124 
125  void addDynamicFieldLayout();
126  void addDynamicField(UAVObjectField *objField);
127  void addDynamicFieldWidget(UAVObjectField *objField);
128  void setDynamicFieldValue(NotificationItem *notification);
129 
130 private:
131  UAVObjectManager &_objManager;
132  SoundNotifyPlugin *_owner;
133 
135  QMediaPlayer *_testSound;
136 
137  QScopedPointer<NotifyTableModel> _notifyRulesModel;
138  QItemSelectionModel *_notifyRulesSelection;
139 
148  QList<NotificationItem *> _privListNotifications;
149 
150  QScopedPointer<Ui::NotifyPluginOptionsPage> _optionsPage;
151 
153  QComboBox *_dynamicFieldCondition;
154 
158  QWidget *_dynamicFieldWidget;
159 
163  int _dynamicFieldType;
164 
167  QComboBox *_sayOrder;
168 
172  QWidget *_form;
173 
176  NotificationItem *_selectedNotification;
177 
180  UAVDataObject *_currUAVObject;
181 
182  QMediaPlaylist *playlist;
183 };
184 
185 #endif // NOTIFYPLUGINOPTIONSPAGE_H
static QStringList conditionValues
void(NAME)
The IOptionsPage is an interface for providing options pages.
Definition: ioptionspage.h:42