From 98049d1507a6f2ae232782fd79f4f753ad53eead Mon Sep 17 00:00:00 2001 From: Daniel Teichmann Date: Tue, 6 Jul 2021 20:02:31 +0200 Subject: Fix copyright headers --- src/main_qmladaptor.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main_qmladaptor.h') diff --git a/src/main_qmladaptor.h b/src/main_qmladaptor.h index 4619968..3c6e75b 100644 --- a/src/main_qmladaptor.h +++ b/src/main_qmladaptor.h @@ -1,8 +1,8 @@ /* * This file is part of Remote Support Desktop * https://gitlab.das-netzwerkteam.de/RemoteWebApp/rwa.support.desktopapp - * Copyright 2020-2021 Daniel Teichmann - * Copyright 2020-2021 Mike Gabriel + * Copyright 2020, 2021 Daniel Teichmann + * Copyright 2020, 2021 Mike Gabriel * SPDX-License-Identifier: GPL-2.0-or-later * * This program is free software; you can redistribute it and/or modify -- cgit v1.2.3 From 54249d9c37ce3994b03123ee6367c7f5519d3b40 Mon Sep 17 00:00:00 2001 From: Daniel Teichmann Date: Wed, 7 Jul 2021 15:03:13 +0200 Subject: Introduce RWAHostModel. RWAHost's are now loaded on start. Scene_remote_{view, control} are no longer available if no host is selected. --- src/main_qmladaptor.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/main_qmladaptor.h') diff --git a/src/main_qmladaptor.h b/src/main_qmladaptor.h index 3c6e75b..8701fc9 100644 --- a/src/main_qmladaptor.h +++ b/src/main_qmladaptor.h @@ -32,11 +32,18 @@ #include #include #include +#include +#include +#include + +#include "RWAHost.h" class MainQMLAdaptor : public QObject { Q_OBJECT // this makes url available as a QML property + Q_PROPERTY(QList rwaHostModel READ getRWAHostModel WRITE setRWAHostModel NOTIFY rwaHostModelChanged) + // this makes url available as a QML property Q_PROPERTY(QString url READ getURL WRITE setURL NOTIFY urlChanged) // this makes pin available as a QML property Q_PROPERTY(QString pin READ getPin WRITE setPin NOTIFY pinChanged) @@ -67,6 +74,7 @@ public: QString getMessageDialogText(); QMessageBox::Icon getMessageDialogIcon(); bool getShowMessageDialog(); + signals: void showMessageDialogChanged(bool show); void messageDialogTextChanged(QString text); @@ -82,6 +90,8 @@ signals: void urlChanged(QString URL); void sessionIDChanged(QString session_id); + void rwaHostModelChanged(QList); + void onCloseSignal(); void showToastSignal(QString text, QString durationMs); @@ -90,6 +100,8 @@ protected: QString _url; QString _pin; QString _session_id; + QList* _rwaHostModel; + private: QQmlApplicationEngine* _engine; @@ -102,13 +114,19 @@ public slots: void handleCopyToClipboardButtonClick(QString copy_data); void handleConnectButtonClick(bool checked); + void get_web_app_hosts_response(QJsonDocument *doc); + void setPin(QString pin); void setURL(QString URL); void setSessionID(QString session_id); + void setRWAHostModel(QList); + void addRWAHost(RWAHost *rwa_host); QString getURL(); QString getPin(); QString getSessionID(); + QList getRWAHostModel(); + void onRwaHostSelected(QString host_uuid); void onCloseHandler(); void showToast(QString text, uint durationMs = 3000); -- cgit v1.2.3 From 0ed25cd9cd46ba4c3f64eb5e8866becaa07f5344 Mon Sep 17 00:00:00 2001 From: Daniel Teichmann Date: Wed, 7 Jul 2021 15:42:42 +0200 Subject: Various small improvements to readability --- src/main_qmladaptor.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main_qmladaptor.h') diff --git a/src/main_qmladaptor.h b/src/main_qmladaptor.h index 8701fc9..05de1fd 100644 --- a/src/main_qmladaptor.h +++ b/src/main_qmladaptor.h @@ -61,7 +61,7 @@ class MainQMLAdaptor : public QObject public: explicit MainQMLAdaptor(QObject *parent, QQmlApplicationEngine *engine = nullptr); -// void setSession(Session session); +// void setSession(Session session); bool setConnectButtonEnabled(bool enabled); bool setConnectButtonChecked(bool checked); -- cgit v1.2.3 From dc3b77a1e3c8b8ff9a9299fd17c13b0428f1fa14 Mon Sep 17 00:00:00 2001 From: Daniel Teichmann Date: Thu, 8 Jul 2021 15:50:22 +0200 Subject: Add: 'Scene_no_server_available.qml' --- src/main_qmladaptor.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/main_qmladaptor.h') diff --git a/src/main_qmladaptor.h b/src/main_qmladaptor.h index 05de1fd..a289a74 100644 --- a/src/main_qmladaptor.h +++ b/src/main_qmladaptor.h @@ -42,7 +42,7 @@ class MainQMLAdaptor : public QObject { Q_OBJECT // this makes url available as a QML property - Q_PROPERTY(QList rwaHostModel READ getRWAHostModel WRITE setRWAHostModel NOTIFY rwaHostModelChanged) + Q_PROPERTY(QList rwaHostModel READ getRWAHostModel NOTIFY rwaHostModelChanged) // this makes url available as a QML property Q_PROPERTY(QString url READ getURL WRITE setURL NOTIFY urlChanged) // this makes pin available as a QML property @@ -61,11 +61,15 @@ class MainQMLAdaptor : public QObject public: explicit MainQMLAdaptor(QObject *parent, QQmlApplicationEngine *engine = nullptr); -// void setSession(Session session); + void setRWAHostModel(QList *rwa_hosts); bool setConnectButtonEnabled(bool enabled); bool setConnectButtonChecked(bool checked); + void main_content_push(QString); + void main_content_pop(QString); + void main_content_replace(QString); + bool setStatusIndicator(bool active, QColor color = QColor(255,255,255)); bool setStatus(QString status); @@ -100,7 +104,8 @@ protected: QString _url; QString _pin; QString _session_id; - QList* _rwaHostModel; + DBusAPI *_dbus_api; + QList *_rwaHostModel; private: QQmlApplicationEngine* _engine; @@ -119,11 +124,13 @@ public slots: void setPin(QString pin); void setURL(QString URL); void setSessionID(QString session_id); - void setRWAHostModel(QList); void addRWAHost(RWAHost *rwa_host); QString getURL(); QString getPin(); QString getSessionID(); + + // No pointer because QML doesn't + // like this type much with pointer QList getRWAHostModel(); void onRwaHostSelected(QString host_uuid); -- cgit v1.2.3 From 36dcf4b27450f04ac60a05cd2837c1b58fd5b24a Mon Sep 17 00:00:00 2001 From: Daniel Teichmann Date: Thu, 8 Jul 2021 15:55:53 +0200 Subject: Classes share one specific D-Bus object now. --- src/main_qmladaptor.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/main_qmladaptor.h') diff --git a/src/main_qmladaptor.h b/src/main_qmladaptor.h index a289a74..48923d5 100644 --- a/src/main_qmladaptor.h +++ b/src/main_qmladaptor.h @@ -37,6 +37,7 @@ #include #include "RWAHost.h" +#include "DBusAPI.h" class MainQMLAdaptor : public QObject { @@ -59,7 +60,8 @@ class MainQMLAdaptor : public QObject Q_PROPERTY(QMessageBox::Icon _messageDialogIcon READ getMessageDialogIcon NOTIFY messageDialogIconChanged) public: - explicit MainQMLAdaptor(QObject *parent, QQmlApplicationEngine *engine = nullptr); + explicit MainQMLAdaptor(QObject *parent, QQmlApplicationEngine *engine = nullptr, + DBusAPI *dbus_api = nullptr); void setRWAHostModel(QList *rwa_hosts); -- cgit v1.2.3 From 5be60cd11d0d9dbde8ca67f0ec88e10540c490db Mon Sep 17 00:00:00 2001 From: Daniel Teichmann Date: Thu, 8 Jul 2021 15:57:44 +0200 Subject: Refresh hosts every 10 seconds. --- src/main_qmladaptor.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/main_qmladaptor.h') diff --git a/src/main_qmladaptor.h b/src/main_qmladaptor.h index 48923d5..d928acd 100644 --- a/src/main_qmladaptor.h +++ b/src/main_qmladaptor.h @@ -35,6 +35,7 @@ #include #include #include +#include #include "RWAHost.h" #include "DBusAPI.h" -- cgit v1.2.3 From c8dc8bda03b27a76d31c358e4b642a5687611178 Mon Sep 17 00:00:00 2001 From: Daniel Teichmann Date: Mon, 12 Jul 2021 12:54:17 +0200 Subject: MainQMLAdaptor: removeRWAHost() and setRWAHostSelected() --- src/main_qmladaptor.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/main_qmladaptor.h') diff --git a/src/main_qmladaptor.h b/src/main_qmladaptor.h index d928acd..d7f1783 100644 --- a/src/main_qmladaptor.h +++ b/src/main_qmladaptor.h @@ -26,7 +26,6 @@ #pragma once -#include #include #include #include @@ -128,6 +127,8 @@ public slots: void setURL(QString URL); void setSessionID(QString session_id); void addRWAHost(RWAHost *rwa_host); + void removeRWAHost(RWAHost *rwa_host); + void setRWAHostSelected(bool value); QString getURL(); QString getPin(); QString getSessionID(); -- cgit v1.2.3 From 766a90125df68f065495354c20412faf9e1df77a Mon Sep 17 00:00:00 2001 From: Daniel Teichmann Date: Sun, 1 Aug 2021 02:19:15 +0200 Subject: move scenes/Scene_remote_control.qml into scenes/remote_control/Scene_remote_control.qml --- src/main_qmladaptor.h | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'src/main_qmladaptor.h') diff --git a/src/main_qmladaptor.h b/src/main_qmladaptor.h index d7f1783..9a2f7c3 100644 --- a/src/main_qmladaptor.h +++ b/src/main_qmladaptor.h @@ -59,22 +59,17 @@ class MainQMLAdaptor : public QObject // this makes showMessageDialogIcon available as a QML property Q_PROPERTY(QMessageBox::Icon _messageDialogIcon READ getMessageDialogIcon NOTIFY messageDialogIconChanged) + public: explicit MainQMLAdaptor(QObject *parent, QQmlApplicationEngine *engine = nullptr, DBusAPI *dbus_api = nullptr); void setRWAHostModel(QList *rwa_hosts); - bool setConnectButtonEnabled(bool enabled); - bool setConnectButtonChecked(bool checked); - void main_content_push(QString); void main_content_pop(QString); void main_content_replace(QString); - bool setStatusIndicator(bool active, QColor color = QColor(255,255,255)); - bool setStatus(QString status); - bool openMessageDialog(QString title, QString text, QMessageBox::Icon); QString getMessageDialogTitle(); QString getMessageDialogText(); -- cgit v1.2.3 From 35343e5158ca441f8001c0a91685f4e93b53cb03 Mon Sep 17 00:00:00 2001 From: Daniel Teichmann Date: Sun, 1 Aug 2021 02:22:57 +0200 Subject: Toast: Add a variety of new toast colors; Session complete rewrite; A lot of bugfixing; New available toast colors/types: ToastType.Standard, ToastType.Info, ToastType.Warning ToastType.Success, ToastType.Error --- src/main_qmladaptor.h | 63 +++++++++++++++++++++++++++------------------------ 1 file changed, 34 insertions(+), 29 deletions(-) (limited to 'src/main_qmladaptor.h') diff --git a/src/main_qmladaptor.h b/src/main_qmladaptor.h index 9a2f7c3..70c075b 100644 --- a/src/main_qmladaptor.h +++ b/src/main_qmladaptor.h @@ -39,17 +39,34 @@ #include "RWAHost.h" #include "DBusAPI.h" -class MainQMLAdaptor : public QObject +namespace Toast { + Q_NAMESPACE + enum ToastType { + ToastStandard, + ToastInfo, + ToastSuccess, + ToastWarning, + ToastError + }; + Q_ENUM_NS(ToastType) +} + +/*#include +namespace MyNamespace { + Q_NAMESPACE // required for meta object creation + enum EnStyle { + STYLE_RADIAL, + STYLE_ENVELOPE, + STYLE_FILLED + }; + Q_ENUM_NS(EnStyle) // register the enum in meta object data +}*/ + +class MainQMLAdaptor : public QObject { Q_OBJECT - // this makes url available as a QML property + // this makes rwaHostModel available as a QML property Q_PROPERTY(QList rwaHostModel READ getRWAHostModel NOTIFY rwaHostModelChanged) - // this makes url available as a QML property - Q_PROPERTY(QString url READ getURL WRITE setURL NOTIFY urlChanged) - // this makes pin available as a QML property - Q_PROPERTY(QString pin READ getPin WRITE setPin NOTIFY pinChanged) - // this makes session_id available as a QML property - Q_PROPERTY(QString session_id READ getSessionID WRITE setSessionID NOTIFY sessionIDChanged) // this makes showMessageDialog available as a QML property Q_PROPERTY(bool showMessageDialog READ getShowMessageDialog NOTIFY showMessageDialogChanged) // this makes showMessageDialogTitle available as a QML property @@ -85,27 +102,19 @@ signals: void minimizeWindow(); void showWindow(); - void onConnectButtonClick(bool checked); - - void pinChanged(QString pin); - void urlChanged(QString URL); - void sessionIDChanged(QString session_id); - void rwaHostModelChanged(QList); void onCloseSignal(); - void showToastSignal(QString text, QString durationMs); + void showToastSignal(QString text, QString durationMs, int type); protected: - QString _url; - QString _pin; - QString _session_id; DBusAPI *_dbus_api; QList *_rwaHostModel; private: - QQmlApplicationEngine* _engine; + QQmlApplicationEngine *_engine; + RWAHost *_selected_rwa_host; bool _showMessageDialog; QString _messageDialogTitle; @@ -113,27 +122,23 @@ private: QMessageBox::Icon _messageDialogIcon; public slots: - void handleCopyToClipboardButtonClick(QString copy_data); - void handleConnectButtonClick(bool checked); - void get_web_app_hosts_response(QJsonDocument *doc); - void setPin(QString pin); - void setURL(QString URL); - void setSessionID(QString session_id); void addRWAHost(RWAHost *rwa_host); void removeRWAHost(RWAHost *rwa_host); void setRWAHostSelected(bool value); - QString getURL(); - QString getPin(); - QString getSessionID(); // No pointer because QML doesn't // like this type much with pointer QList getRWAHostModel(); + RWAHost *getSelectedRWAHost(); + void onRwaHostSelected(QString host_uuid); void onCloseHandler(); - void showToast(QString text, uint durationMs = 3000); + // arg type is actually Toast::ToastType + void showToast(QString text, + uint durationMs = 3000, + uint type = 0); }; -- cgit v1.2.3