2017-01-09 16:55:03 +00:00
|
|
|
//
|
|
|
|
// Copyright (C) 2017 James Turner zakalawe@mac.com
|
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License as
|
|
|
|
// published by the Free Software Foundation; either version 2 of the
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful, but
|
|
|
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
2016-12-03 14:14:06 +00:00
|
|
|
#ifndef TEMPORARYWIDGET_H
|
|
|
|
#define TEMPORARYWIDGET_H
|
|
|
|
|
|
|
|
#include <QWidget>
|
|
|
|
#include <QtWebSockets/QWebSocket>
|
|
|
|
#include <QAction>
|
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class TemporaryWidget;
|
|
|
|
}
|
|
|
|
|
|
|
|
class LocalProp;
|
|
|
|
class CanvasTreeModel;
|
2016-12-22 16:59:19 +00:00
|
|
|
class ElementDataModel;
|
2017-01-09 16:55:03 +00:00
|
|
|
class QNetworkAccessManager;
|
2016-12-03 14:14:06 +00:00
|
|
|
|
|
|
|
class TemporaryWidget : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit TemporaryWidget(QWidget *parent = 0);
|
|
|
|
~TemporaryWidget();
|
|
|
|
|
2017-01-09 16:55:03 +00:00
|
|
|
void setNetworkAccess(QNetworkAccessManager* dl);
|
2016-12-03 14:14:06 +00:00
|
|
|
private Q_SLOTS:
|
2017-01-09 16:55:03 +00:00
|
|
|
void onConnect();
|
2016-12-03 14:14:06 +00:00
|
|
|
|
2017-01-09 16:55:03 +00:00
|
|
|
void onWebSocketConnected();
|
2016-12-03 14:14:06 +00:00
|
|
|
void onTextMessageReceived(QString message);
|
|
|
|
|
|
|
|
void onSocketClosed();
|
2016-12-22 16:59:19 +00:00
|
|
|
|
2016-12-22 17:15:50 +00:00
|
|
|
void onTreeCurrentChanged(const QModelIndex &previous, const QModelIndex ¤t);
|
2017-01-09 16:55:03 +00:00
|
|
|
void onCanvasSelected(int index);
|
|
|
|
|
|
|
|
void onFinishedGetCanvasList();
|
2016-12-03 14:14:06 +00:00
|
|
|
private:
|
|
|
|
void saveSettings();
|
|
|
|
void restoreSettings();
|
|
|
|
|
|
|
|
LocalProp* propertyFromPath(QByteArray path) const;
|
|
|
|
|
2017-01-09 16:55:03 +00:00
|
|
|
QNetworkAccessManager* m_netAccess;
|
2016-12-03 14:14:06 +00:00
|
|
|
QWebSocket m_webSocket;
|
|
|
|
Ui::TemporaryWidget *ui;
|
2017-01-09 16:55:03 +00:00
|
|
|
QByteArray m_rootPropertyPath;
|
2016-12-03 14:14:06 +00:00
|
|
|
|
|
|
|
LocalProp* m_localPropertyRoot = nullptr;
|
|
|
|
QHash<int, LocalProp*> idPropertyDict;
|
|
|
|
CanvasTreeModel* m_canvasModel;
|
2016-12-22 16:59:19 +00:00
|
|
|
ElementDataModel* m_elementModel;
|
2016-12-03 14:14:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // TEMPORARYWIDGET_H
|