forked from qt-creator/qt-creator
ProjectExplorer: Remove IPotentialKit machinery
This was only used once, by Android, to create an entry in the target setup page acting as short cut to the android settings page. We have a notification for that nowadays. Change-Id: I5580432a74c0b4da7a3914ecfcddd96543a83b5d Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -23,7 +23,6 @@ add_qtc_plugin(Android
|
||||
androidmanifesteditoriconcontainerwidget.cpp androidmanifesteditoriconcontainerwidget.h
|
||||
androidpackageinstallationstep.cpp androidpackageinstallationstep.h
|
||||
androidplugin.cpp
|
||||
androidpotentialkit.cpp androidpotentialkit.h
|
||||
androidqmltoolingsupport.cpp androidqmltoolingsupport.h
|
||||
androidqtversion.cpp androidqtversion.h
|
||||
androidrunconfiguration.cpp androidrunconfiguration.h
|
||||
|
@@ -48,8 +48,6 @@ QtcPlugin {
|
||||
"androidpackageinstallationstep.cpp",
|
||||
"androidpackageinstallationstep.h",
|
||||
"androidplugin.cpp",
|
||||
"androidpotentialkit.cpp",
|
||||
"androidpotentialkit.h",
|
||||
"androidqmltoolingsupport.cpp",
|
||||
"androidqmltoolingsupport.h",
|
||||
"androidqtversion.cpp",
|
||||
|
@@ -9,7 +9,6 @@
|
||||
#include "androiddevice.h"
|
||||
#include "androidmanifesteditor.h"
|
||||
#include "androidpackageinstallationstep.h"
|
||||
#include "androidpotentialkit.h"
|
||||
#include "androidqmltoolingsupport.h"
|
||||
#include "androidqtversion.h"
|
||||
#include "androidrunconfiguration.h"
|
||||
@@ -87,7 +86,6 @@ class AndroidPlugin final : public ExtensionSystem::IPlugin
|
||||
{
|
||||
setupAndroidConfigurations();
|
||||
|
||||
setupAndroidPotentialKit();
|
||||
setupAndroidDevice();
|
||||
setupAndroidQtVersion();
|
||||
setupAndroidToolchain();
|
||||
|
@@ -1,128 +0,0 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "androidconfigurations.h"
|
||||
#include "androidconstants.h"
|
||||
#include "androidpotentialkit.h"
|
||||
#include "androidtr.h"
|
||||
|
||||
#include <coreplugin/coreicons.h>
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <projectexplorer/ipotentialkit.h>
|
||||
#include <projectexplorer/kit.h>
|
||||
#include <projectexplorer/kitaspects.h>
|
||||
#include <projectexplorer/kitmanager.h>
|
||||
|
||||
#include <qtsupport/qtversionmanager.h>
|
||||
#include <qtsupport/baseqtversion.h>
|
||||
|
||||
#include <utils/detailswidget.h>
|
||||
#include <utils/utilsicons.h>
|
||||
|
||||
#include <QGridLayout>
|
||||
#include <QGuiApplication>
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
namespace Android::Internal {
|
||||
|
||||
class AndroidPotentialKitWidget : public Utils::DetailsWidget
|
||||
{
|
||||
public:
|
||||
AndroidPotentialKitWidget(QWidget *parent);
|
||||
|
||||
private:
|
||||
void openOptions();
|
||||
void recheck();
|
||||
};
|
||||
|
||||
AndroidPotentialKitWidget::AndroidPotentialKitWidget(QWidget *parent)
|
||||
: Utils::DetailsWidget(parent)
|
||||
{
|
||||
setSummaryText(QLatin1String("<b>Android has not been configured. Create Android kits.</b>"));
|
||||
setIcon(Utils::Icons::WARNING.icon());
|
||||
//detailsWidget->setState(Utils::DetailsWidget::NoSummary);
|
||||
auto mainWidget = new QWidget(this);
|
||||
setWidget(mainWidget);
|
||||
|
||||
auto layout = new QGridLayout(mainWidget);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
auto label = new QLabel;
|
||||
label->setText(Tr::tr("%1 needs additional settings to enable Android support."
|
||||
" You can configure those settings in the Options dialog.")
|
||||
.arg(QGuiApplication::applicationDisplayName()));
|
||||
label->setWordWrap(true);
|
||||
layout->addWidget(label, 0, 0, 1, 2);
|
||||
|
||||
auto openOptions = new QPushButton;
|
||||
openOptions->setText(Core::ICore::msgShowOptionsDialog());
|
||||
openOptions->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
layout->addWidget(openOptions, 1, 1);
|
||||
|
||||
connect(openOptions, &QAbstractButton::clicked,
|
||||
this, &AndroidPotentialKitWidget::openOptions);
|
||||
|
||||
connect(AndroidConfigurations::instance(), &AndroidConfigurations::updated,
|
||||
this, &AndroidPotentialKitWidget::recheck);
|
||||
}
|
||||
|
||||
void AndroidPotentialKitWidget::openOptions()
|
||||
{
|
||||
Core::ICore::showOptionsDialog(Constants::ANDROID_SETTINGS_ID, this);
|
||||
}
|
||||
|
||||
void AndroidPotentialKitWidget::recheck()
|
||||
{
|
||||
const QList<Kit *> kits = KitManager::kits();
|
||||
for (const Kit *kit : kits) {
|
||||
if (kit->isAutoDetected() && !kit->isSdkProvided()) {
|
||||
setVisible(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class AndroidPotentialKit final : public IPotentialKit
|
||||
{
|
||||
public:
|
||||
QString displayName() const final
|
||||
{
|
||||
return Tr::tr("Configure Android...");
|
||||
}
|
||||
|
||||
void executeFromMenu() final
|
||||
{
|
||||
Core::ICore::showOptionsDialog(Constants::ANDROID_SETTINGS_ID);
|
||||
}
|
||||
|
||||
QWidget *createWidget(QWidget *parent) const final
|
||||
{
|
||||
if (!isEnabled())
|
||||
return nullptr;
|
||||
return new AndroidPotentialKitWidget(parent);
|
||||
}
|
||||
|
||||
bool isEnabled() const final
|
||||
{
|
||||
const QList<Kit *> kits = KitManager::kits();
|
||||
for (const Kit *kit : kits) {
|
||||
if (kit->isAutoDetected() && !kit->isSdkProvided()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return QtSupport::QtVersionManager::version([](const QtSupport::QtVersion *v) {
|
||||
return v->type() == QString::fromLatin1(Constants::ANDROID_QT_TYPE);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
void setupAndroidPotentialKit()
|
||||
{
|
||||
static AndroidPotentialKit theAndroidPotentialKit;
|
||||
}
|
||||
|
||||
} // Android::Internal
|
@@ -1,10 +0,0 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace Android::Internal {
|
||||
|
||||
void setupAndroidPotentialKit();
|
||||
|
||||
} // Android::Internal
|
@@ -87,7 +87,6 @@ add_qtc_plugin(ProjectExplorer
|
||||
headerpath.h
|
||||
importwidget.cpp importwidget.h
|
||||
ioutputparser.cpp ioutputparser.h
|
||||
ipotentialkit.h
|
||||
itaskhandler.h
|
||||
jsonwizard/jsonfieldpage.cpp jsonwizard/jsonfieldpage.h jsonwizard/jsonfieldpage_p.h
|
||||
jsonwizard/jsonfilepage.cpp jsonwizard/jsonfilepage.h
|
||||
|
@@ -1,24 +0,0 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include "projectexplorer_export.h"
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
class PROJECTEXPLORER_EXPORT IPotentialKit
|
||||
{
|
||||
public:
|
||||
IPotentialKit();
|
||||
virtual ~IPotentialKit();
|
||||
|
||||
virtual QString displayName() const = 0;
|
||||
virtual void executeFromMenu() = 0;
|
||||
virtual QWidget *createWidget(QWidget *parent) const = 0;
|
||||
virtual bool isEnabled() const = 0;
|
||||
};
|
||||
|
||||
} // ProjectExplorer
|
@@ -74,7 +74,6 @@ QtcPlugin {
|
||||
"headerpath.h",
|
||||
"importwidget.cpp", "importwidget.h",
|
||||
"ioutputparser.cpp", "ioutputparser.h",
|
||||
"ipotentialkit.h",
|
||||
"itaskhandler.h",
|
||||
"kit.cpp", "kit.h",
|
||||
"kitaspect.cpp", "kitaspect.h",
|
||||
|
@@ -5,7 +5,6 @@
|
||||
|
||||
#include "buildmanager.h"
|
||||
#include "buildsettingspropertiespage.h"
|
||||
#include "ipotentialkit.h"
|
||||
#include "kit.h"
|
||||
#include "kitmanager.h"
|
||||
#include "panelswidget.h"
|
||||
@@ -669,55 +668,6 @@ public:
|
||||
//
|
||||
// Also third level:
|
||||
//
|
||||
class PotentialKitItem : public TypedTreeItem<TreeItem, TargetGroupItem>
|
||||
{
|
||||
public:
|
||||
PotentialKitItem(Project *project, IPotentialKit *potentialKit)
|
||||
: m_project(project), m_potentialKit(potentialKit)
|
||||
{}
|
||||
|
||||
QVariant data(int column, int role) const override
|
||||
{
|
||||
if (role == Qt::DisplayRole)
|
||||
return m_potentialKit->displayName();
|
||||
|
||||
if (role == Qt::FontRole) {
|
||||
QFont font = parent()->data(column, role).value<QFont>();
|
||||
font.setItalic(true);
|
||||
return font;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
bool setData(int column, const QVariant &data, int role) override
|
||||
{
|
||||
Q_UNUSED(column)
|
||||
if (role == ContextMenuItemAdderRole) {
|
||||
auto *menu = data.value<QMenu *>();
|
||||
auto enableAction = menu->addAction(Tr::tr("Enable Kit"));
|
||||
enableAction->setEnabled(!isEnabled());
|
||||
QObject::connect(enableAction, &QAction::triggered, [this] {
|
||||
m_potentialKit->executeFromMenu();
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Qt::ItemFlags flags(int column) const override
|
||||
{
|
||||
Q_UNUSED(column)
|
||||
if (isEnabled())
|
||||
return Qt::ItemFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||
return Qt::ItemIsSelectable;
|
||||
}
|
||||
|
||||
bool isEnabled() const { return m_potentialKit->isEnabled(); }
|
||||
|
||||
Project *m_project;
|
||||
IPotentialKit *m_potentialKit;
|
||||
};
|
||||
|
||||
TargetGroupItem::TargetGroupItem(const QString &displayName, Project *project)
|
||||
: d(std::make_unique<TargetGroupItemPrivate>(this, project))
|
||||
|
@@ -5,7 +5,6 @@
|
||||
|
||||
#include "buildinfo.h"
|
||||
#include "importwidget.h"
|
||||
#include "ipotentialkit.h"
|
||||
#include "kit.h"
|
||||
#include "kitmanager.h"
|
||||
#include "project.h"
|
||||
@@ -34,20 +33,8 @@
|
||||
using namespace Utils;
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
static QList<IPotentialKit *> g_potentialKits;
|
||||
|
||||
IPotentialKit::IPotentialKit()
|
||||
{
|
||||
g_potentialKits.append(this);
|
||||
}
|
||||
|
||||
IPotentialKit::~IPotentialKit()
|
||||
{
|
||||
g_potentialKits.removeOne(this);
|
||||
}
|
||||
|
||||
namespace Internal {
|
||||
|
||||
static FilePath importDirectory(const FilePath &projectPath)
|
||||
{
|
||||
// Setup import widget:
|
||||
@@ -158,11 +145,6 @@ public:
|
||||
QObject::connect(kitFilterLineEdit, &FancyLineEdit::filterChanged,
|
||||
this, &TargetSetupPagePrivate::kitFilterChanged);
|
||||
|
||||
for (IPotentialKit *pk : std::as_const(g_potentialKits)) {
|
||||
if (pk->isEnabled())
|
||||
m_potentialWidgets.append(pk->createWidget(q));
|
||||
}
|
||||
|
||||
setUseScrollArea(true);
|
||||
|
||||
KitManager *km = KitManager::instance();
|
||||
@@ -234,7 +216,6 @@ public:
|
||||
|
||||
Internal::ImportWidget *m_importWidget = nullptr;
|
||||
QSpacerItem *m_spacer;
|
||||
QList<QWidget *> m_potentialWidgets;
|
||||
|
||||
bool m_widgetsWereSetUp = false;
|
||||
};
|
||||
@@ -662,16 +643,12 @@ TargetSetupWidget *TargetSetupPagePrivate::addWidget(Kit *k)
|
||||
void TargetSetupPagePrivate::addAdditionalWidgets()
|
||||
{
|
||||
m_baseLayout->addWidget(m_importWidget);
|
||||
for (QWidget * const widget : std::as_const(m_potentialWidgets))
|
||||
m_baseLayout->addWidget(widget);
|
||||
m_baseLayout->addItem(m_spacer);
|
||||
}
|
||||
|
||||
void TargetSetupPagePrivate::removeAdditionalWidgets(QLayout *layout)
|
||||
{
|
||||
layout->removeWidget(m_importWidget);
|
||||
for (QWidget * const potentialWidget : std::as_const(m_potentialWidgets))
|
||||
layout->removeWidget(potentialWidget);
|
||||
layout->removeItem(m_spacer);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user