From ab78e1aca3774abeaa7c6951677d19e3c6ba2ff2 Mon Sep 17 00:00:00 2001 From: PT_Dreamer Date: Wed, 30 May 2012 16:46:45 +0100 Subject: [PATCH] GCS - Make the welcome plugin use the workspace names instead of the mode names. --- .../src/plugins/coreplugin/modemanager.cpp | 11 +++++++++++ .../src/plugins/coreplugin/modemanager.h | 1 + .../openpilotgcs/src/plugins/welcome/qml/main.qml | 14 +++++++------- .../src/plugins/welcome/welcomemode.cpp | 2 +- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/coreplugin/modemanager.cpp b/ground/openpilotgcs/src/plugins/coreplugin/modemanager.cpp index ac3c4c224..a4479bae2 100644 --- a/ground/openpilotgcs/src/plugins/coreplugin/modemanager.cpp +++ b/ground/openpilotgcs/src/plugins/coreplugin/modemanager.cpp @@ -124,6 +124,17 @@ void ModeManager::activateMode(const QString &id) m_modeStack->setCurrentIndex(index); } +void ModeManager::activateModeByWorkspaceName(const QString &id) +{ + for (int i = 0; i < m_modes.count(); ++i) { + if (m_modes.at(i)->name() == id) + { + m_modeStack->setCurrentIndex(i); + return; + } + } +} + void ModeManager::objectAdded(QObject *obj) { IMode *mode = Aggregation::query(obj); diff --git a/ground/openpilotgcs/src/plugins/coreplugin/modemanager.h b/ground/openpilotgcs/src/plugins/coreplugin/modemanager.h index 687ec0a51..ccaf50607 100644 --- a/ground/openpilotgcs/src/plugins/coreplugin/modemanager.h +++ b/ground/openpilotgcs/src/plugins/coreplugin/modemanager.h @@ -80,6 +80,7 @@ signals: public slots: void activateMode(const QString &id); + void activateModeByWorkspaceName(const QString &id); void setFocusToCurrentMode(); private slots: diff --git a/ground/openpilotgcs/src/plugins/welcome/qml/main.qml b/ground/openpilotgcs/src/plugins/welcome/qml/main.qml index 764ce36a5..a2362d3e2 100644 --- a/ground/openpilotgcs/src/plugins/welcome/qml/main.qml +++ b/ground/openpilotgcs/src/plugins/welcome/qml/main.qml @@ -51,37 +51,37 @@ Rectangle { WelcomePageButton { baseIconName: "flightdata" label: "Flight Data" - onClicked: welcomePlugin.openPage("Mode1") + onClicked: welcomePlugin.openPage("Flight data") } WelcomePageButton { baseIconName: "config" label: "Configuration" - onClicked: welcomePlugin.openPage("Mode2") + onClicked: welcomePlugin.openPage("Configuration") } WelcomePageButton { baseIconName: "planner" label: "Flight Planner" - onClicked: welcomePlugin.openPage("Mode3") + onClicked: welcomePlugin.openPage("Flight Planner") } WelcomePageButton { baseIconName: "scopes" label: "Scopes" - onClicked: welcomePlugin.openPage("Mode4") + onClicked: welcomePlugin.openPage("Scopes") } WelcomePageButton { baseIconName: "hitl" - label: "HIL" - onClicked: welcomePlugin.openPage("Mode5") + label: "HITL" + onClicked: welcomePlugin.openPage("HITL") } WelcomePageButton { baseIconName: "firmware" label: "Firmware" - onClicked: welcomePlugin.openPage("Mode6") + onClicked: welcomePlugin.openPage("Firmware") } } //icons grid } // images row diff --git a/ground/openpilotgcs/src/plugins/welcome/welcomemode.cpp b/ground/openpilotgcs/src/plugins/welcome/welcomemode.cpp index f08a58420..cf36b3036 100644 --- a/ground/openpilotgcs/src/plugins/welcome/welcomemode.cpp +++ b/ground/openpilotgcs/src/plugins/welcome/welcomemode.cpp @@ -124,7 +124,7 @@ void WelcomeMode::openUrl(const QString &url) void WelcomeMode::openPage(const QString &page) { - Core::ModeManager::instance()->activateMode(page); + Core::ModeManager::instance()->activateModeByWorkspaceName(page); } } // namespace Welcome