dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
usagestatsplugin.h
Go to the documentation of this file.
1 
12 /*
13  * This program is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation; either version 3 of the License, or
16  * (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful, but
19  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
20  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  * for more details.
22  *
23  * You should have received a copy of the GNU General Public License along
24  * with this program; if not, see <http://www.gnu.org/licenses/>
25  */
26 
27 #ifndef USAGESTATSPLUGIN_H_
28 #define USAGESTATSPLUGIN_H_
29 
36 #include <QDateTime>
37 #include <QAbstractButton>
38 #include <QNetworkReply>
39 #include <QNetworkAccessManager>
40 #include <QEventLoop>
41 #include <QUuid>
42 
43 using namespace uploader;
44 struct boardLog
45 {
46  QDateTime time;
49 };
51 typedef struct widgetActionInfoType
52 {
54  QDateTime time;
55  QString objectName;
56  QString className;
57  QString parentName;
58  QString data1;
59  QString data2;
61 typedef struct debugMessageStruct
62 {
63  QDateTime time;
64  int level;
65  QString levelString;
66  QString message;
67  QString file;
68  int line;
69  QString function;
70 } DebugMessage;
71 
73 {
74  Q_OBJECT
75  Q_PLUGIN_METADATA(IID "org.dronin.plugins.UsageStats")
76 
77 public:
80  void readConfig(QSettings *qSettings, Core::UAVConfigInfo *configInfo);
81  void saveConfig(QSettings *qSettings, Core::UAVConfigInfo *configInfo);
82  void shutdown();
83  bool initialize(const QStringList &arguments, QString *errorString);
84  void extensionsInitialized();
85  bool coreAboutToClose();
86  bool getSendUsageStats() const;
87  void setSendUsageStats(bool value);
88  bool getSendPrivateData() const;
89  void setSendPrivateData(bool value);
90  int getDebugLogLevel() const;
91  void setDebugLogLevel(int value);
92 
93  QString getInstallationUUID() const;
94 public slots:
95  void updateSettings();
96 
97 private:
98  ExtensionSystem::PluginManager *pluginManager;
99  QList<boardLog> boardLogList;
100  QList<widgetActionInfo> widgetLogList;
101  QList<DebugMessage> debugMessageList;
102  QByteArray processJson();
103  QString externalIP;
104  QNetworkAccessManager netMngr;
105  QEventLoop *loop;
106  bool sendUsageStats;
107  bool sendPrivateData;
108  QUuid installationUUID;
109  int debugLogLevel;
110 private slots:
111  void pluginsLoadEnded();
112  void addNewBoardSeen(deviceInfo, deviceDescriptorStruct);
113  void searchForWidgets(QObject *mw, bool connect);
114  void onButtonClicked();
115  void onSliderValueChanged(int);
116  void onTabCurrentChanged(int);
117  void onDebugMessage(DebugEngine::Level, const QString &, const QString &, const int,
118  const QString &);
119 };
121 {
122  Q_OBJECT
123 public:
125  bool coreAboutToClose();
126 
127 private:
128  UsageStatsPlugin *m_parent;
129 };
130 #endif /* USAGESTATSPLUGIN_H_ */
Core plugin system that manages the plugins, their life cycle and their registered objects...
Definition: pluginmanager.h:53
struct widgetActionInfoType widgetActionInfo
deviceDescriptorStruct device
deviceInfo board
struct debugMessageStruct DebugMessage
Provides a hook for plugins to veto on certain events emitted from the core plugin.
Definition: icorelistener.h:59
widgetType
The Config Info is a helper-class to handle version changes in GCS configuration files.
Definition: uavconfiginfo.h:53
QDateTime time