aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2018-04-24 15:07:02 +0200
committerhjk <hjk@qt.io>2018-04-24 13:42:30 +0000
commitf8937daf717597f696a5ba3963e02878b01ab4ae (patch)
treef170453c517e495a64a87a1444683380a4cf0231
parentef9c5e47bb98a79a71beb45c9b0ffeda2e86f38c (diff)
ProjectExplorer: Make "Manage..." kits button work again
When configuring a newly opened or created project you are able to press a 'Manage...' button that brings up the options page of the kits. Was broken with the rework done on the global object pool. Change-Id: I87d91351c5769655c1192431a53784de1bca77aa Reviewed-by: Christian Stenger <christian.stenger@qt.io>
-rw-r--r--src/plugins/projectexplorer/kitoptionspage.cpp8
-rw-r--r--src/plugins/projectexplorer/kitoptionspage.h1
-rw-r--r--src/plugins/projectexplorer/projectwindow.cpp6
-rw-r--r--src/plugins/projectexplorer/targetsetupwidget.cpp10
4 files changed, 16 insertions, 9 deletions
diff --git a/src/plugins/projectexplorer/kitoptionspage.cpp b/src/plugins/projectexplorer/kitoptionspage.cpp
index 6155f29c0b..f37687c586 100644
--- a/src/plugins/projectexplorer/kitoptionspage.cpp
+++ b/src/plugins/projectexplorer/kitoptionspage.cpp
@@ -235,8 +235,11 @@ QModelIndex KitOptionsPageWidget::currentIndex() const
// KitOptionsPage:
// --------------------------------------------------------------------------
+static KitOptionsPage *theKitOptionsPage = nullptr;
+
KitOptionsPage::KitOptionsPage()
{
+ theKitOptionsPage = this;
static const Utils::Icon categoryIcon({{":/projectexplorer/images/mode_project_mask.png",
Utils::Theme::PanelTextColorDark}},
Utils::Icon::Tint);
@@ -283,4 +286,9 @@ void KitOptionsPage::showKit(Kit *k)
m_widget->m_kitsView->scrollTo(index);
}
+KitOptionsPage *KitOptionsPage::instance()
+{
+ return theKitOptionsPage;
+}
+
} // namespace ProjectExplorer
diff --git a/src/plugins/projectexplorer/kitoptionspage.h b/src/plugins/projectexplorer/kitoptionspage.h
index b9d484e9d0..7e7f02b363 100644
--- a/src/plugins/projectexplorer/kitoptionspage.h
+++ b/src/plugins/projectexplorer/kitoptionspage.h
@@ -53,6 +53,7 @@ public:
void finish() override;
void showKit(Kit *k);
+ static KitOptionsPage *instance();
private:
QPointer<Internal::KitOptionsPageWidget> m_widget;
diff --git a/src/plugins/projectexplorer/projectwindow.cpp b/src/plugins/projectexplorer/projectwindow.cpp
index 41659d3eeb..51e17e5610 100644
--- a/src/plugins/projectexplorer/projectwindow.cpp
+++ b/src/plugins/projectexplorer/projectwindow.cpp
@@ -42,8 +42,6 @@
#include <coreplugin/icore.h>
#include <coreplugin/idocument.h>
-#include <extensionsystem/pluginmanager.h>
-
#include <utils/algorithm.h>
#include <utils/basetreeview.h>
#include <utils/navigationtreeview.h>
@@ -531,8 +529,8 @@ public:
void handleManageKits()
{
if (ProjectItem *projectItem = m_projectsModel.rootItem()->childAt(0)) {
- if (KitOptionsPage *page = ExtensionSystem::PluginManager::getObject<KitOptionsPage>())
- page->showKit(KitManager::kit(Id::fromSetting(projectItem->data(0, KitIdRole))));
+ if (auto kitPage = KitOptionsPage::instance())
+ kitPage->showKit(KitManager::kit(Id::fromSetting(projectItem->data(0, KitIdRole))));
}
ICore::showOptionsDialog(Constants::KITS_SETTINGS_PAGE_ID, ICore::mainWindow());
}
diff --git a/src/plugins/projectexplorer/targetsetupwidget.cpp b/src/plugins/projectexplorer/targetsetupwidget.cpp
index 258809f712..b59f3dbb56 100644
--- a/src/plugins/projectexplorer/targetsetupwidget.cpp
+++ b/src/plugins/projectexplorer/targetsetupwidget.cpp
@@ -34,7 +34,6 @@
#include "kitoptionspage.h"
#include <coreplugin/icore.h>
-#include <extensionsystem/pluginmanager.h>
#include <utils/algorithm.h>
#include <utils/detailsbutton.h>
@@ -201,12 +200,13 @@ void TargetSetupWidget::targetCheckBoxToggled(bool b)
void TargetSetupWidget::manageKit()
{
- KitOptionsPage *page = ExtensionSystem::PluginManager::getObject<KitOptionsPage>();
- if (!page || !m_kit)
+ if (!m_kit)
return;
- page->showKit(m_kit);
- Core::ICore::showOptionsDialog(Constants::KITS_SETTINGS_PAGE_ID, parentWidget());
+ if (auto kitPage = KitOptionsPage::instance()) {
+ kitPage->showKit(m_kit);
+ Core::ICore::showOptionsDialog(Constants::KITS_SETTINGS_PAGE_ID, parentWidget());
+ }
}
void TargetSetupWidget::setProjectPath(const QString &projectPath)