diff options
author | Daniel Teichmann <daniel.teichmann@das-netzwerkteam.de> | 2021-07-07 15:42:42 +0200 |
---|---|---|
committer | Daniel Teichmann <daniel.teichmann@das-netzwerkteam.de> | 2021-07-07 15:42:42 +0200 |
commit | 0ed25cd9cd46ba4c3f64eb5e8866becaa07f5344 (patch) | |
tree | 8eb711e8b6566ff98b73d7dd33aa399d74ecf0e3 /src | |
parent | 9d3405f5e94e21e4401c30808dc3c93f6fbd3283 (diff) | |
download | RWA.Support.DesktopApp-0ed25cd9cd46ba4c3f64eb5e8866becaa07f5344.tar.gz RWA.Support.DesktopApp-0ed25cd9cd46ba4c3f64eb5e8866becaa07f5344.tar.bz2 RWA.Support.DesktopApp-0ed25cd9cd46ba4c3f64eb5e8866becaa07f5344.zip |
Various small improvements to readability
Diffstat (limited to 'src')
-rw-r--r-- | src/main.cpp | 4 | ||||
-rw-r--r-- | src/main.qml | 2 | ||||
-rw-r--r-- | src/main_qmladaptor.cpp | 19 | ||||
-rw-r--r-- | src/main_qmladaptor.h | 2 |
4 files changed, 12 insertions, 15 deletions
diff --git a/src/main.cpp b/src/main.cpp index b85c3fc..a72e42b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -36,6 +36,7 @@ #include <QQuickStyle> #include <signal.h> +#include "DBusAPI.h" #include "RWADBusAdaptor.cpp" #include "session.h" #include "scenes/add_server_wizard/add_server_wizard.h" @@ -82,9 +83,8 @@ int main(int argc, char *argv[]) { QQmlApplicationEngine engine(&app); - QScopedPointer<MainQMLAdaptor> main_gui (new MainQMLAdaptor(&app, &engine)); - // Make mainqmladaptor available to QML + QScopedPointer<MainQMLAdaptor> main_gui (new MainQMLAdaptor(&app, &engine)); engine.rootContext()->setContextProperty("mainqmladaptor", main_gui.data()); QScopedPointer<DBusAPI> _dbus_api (new DBusAPI()); diff --git a/src/main.qml b/src/main.qml index 8a19d54..12c4668 100644 --- a/src/main.qml +++ b/src/main.qml @@ -212,8 +212,8 @@ ApplicationWindow { width: parent.width height: 50 model: mainqmladaptor.rwaHostModel - textRole: "alias" + onCurrentIndexChanged: { var rwa_host = mainqmladaptor.rwaHostModel sidebar_drawer.rwaHostSelected(rwa_host[currentIndex].uuid) diff --git a/src/main_qmladaptor.cpp b/src/main_qmladaptor.cpp index d75b15c..5fcce5f 100644 --- a/src/main_qmladaptor.cpp +++ b/src/main_qmladaptor.cpp @@ -128,7 +128,8 @@ void MainQMLAdaptor::get_web_app_hosts_response(QJsonDocument *doc) { bool MainQMLAdaptor::setConnectButtonEnabled(bool enabled) { // Find item via 'objectName' - QQuickItem *item = _engine->rootObjects().at(0)->findChild<QQuickItem*>("start_support_button"); + QQuickItem *scene_remote_control = _engine->rootObjects().at(0)->findChild<QQuickItem*>("Scene_remote_control"); + QQuickItem *item = scene_remote_control->findChild<QQuickItem*>("start_support_button"); if (item) { item->setProperty("enabled", enabled); if (item->property("checked").toBool()) { @@ -146,7 +147,8 @@ bool MainQMLAdaptor::setConnectButtonEnabled(bool enabled) { bool MainQMLAdaptor::setConnectButtonChecked(bool checked) { // Find item via 'objectName' - QQuickItem *item = _engine->rootObjects().at(0)->findChild<QQuickItem*>("start_support_button"); + QQuickItem *scene_remote_control = _engine->rootObjects().at(0)->findChild<QQuickItem*>("Scene_remote_control"); + QQuickItem *item = scene_remote_control->findChild<QQuickItem*>("start_support_button"); if (item) { item->setProperty("checked", checked); } else { @@ -159,7 +161,8 @@ bool MainQMLAdaptor::setConnectButtonChecked(bool checked) { bool MainQMLAdaptor::setStatus(QString status) { // Find item via 'objectName' - QQuickItem *item = _engine->rootObjects().at(0)->findChild<QQuickItem*>("dbus_api_status_text"); + QQuickItem *scene_remote_control = _engine->rootObjects().at(0)->findChild<QQuickItem*>("Scene_remote_control"); + QQuickItem *item = scene_remote_control->findChild<QQuickItem*>("dbus_api_status_text"); if (item) { item->setProperty("text", status); } else { @@ -203,7 +206,8 @@ bool MainQMLAdaptor::getShowMessageDialog() { bool MainQMLAdaptor::setStatusIndicator(bool active, QColor color) { // Find item via 'objectName' - QQuickItem *item = _engine->rootObjects().at(0)->findChild<QQuickItem*>("dbus_api_status_indicator"); + QQuickItem *scene_remote_control = _engine->rootObjects().at(0)->findChild<QQuickItem*>("Scene_remote_control"); + QQuickItem *item = scene_remote_control->findChild<QQuickItem*>("dbus_api_status_indicator"); if (item) { item->setProperty("active", active); item->setProperty("color", color); @@ -256,10 +260,3 @@ void MainQMLAdaptor::onCloseHandler() { void MainQMLAdaptor::showToast(QString text, uint durationMs) { emit showToastSignal(text, QString::number(durationMs)); } - -//void MainQMLAdaptor::onCloseHandler() { -// qDebug() << "Inside MainQMLAdaptor::onCloseHandler()"; - -// // Sending onClose signal to main and there to Session::onCloseHandler() -// emit MainQMLAdaptor::onCloseSignal(); -//} 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); |