forked from qt-creator/qt-creator
Android: Hide plugin class definition in .cpp
It's not meant to be used from the outside. Change-Id: I94e46f95f896fa4b44e77e0196523beb8afdf8c3 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -1563,7 +1563,7 @@ void AndroidConfigurations::updateAndroidDevice()
|
||||
}
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
void AndroidPlugin::testAndroidConfigAvailableNdkPlatforms_data()
|
||||
void AndroidTests::testAndroidConfigAvailableNdkPlatforms_data()
|
||||
{
|
||||
QTest::addColumn<FilePath>("ndkPath");
|
||||
QTest::addColumn<Abis>("abis");
|
||||
@@ -1608,7 +1608,7 @@ void AndroidPlugin::testAndroidConfigAvailableNdkPlatforms_data()
|
||||
<< abis64Bit;
|
||||
}
|
||||
|
||||
void AndroidPlugin::testAndroidConfigAvailableNdkPlatforms()
|
||||
void AndroidTests::testAndroidConfigAvailableNdkPlatforms()
|
||||
{
|
||||
QFETCH(FilePath, ndkPath);
|
||||
QFETCH(Abis, abis);
|
||||
|
||||
@@ -34,7 +34,8 @@
|
||||
#endif
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <utils/infobar.h>
|
||||
|
||||
#include <extensionsystem/iplugin.h>
|
||||
|
||||
#include <languageclient/languageclientsettings.h>
|
||||
|
||||
@@ -52,6 +53,8 @@
|
||||
|
||||
#include <nanotrace/nanotrace.h>
|
||||
|
||||
#include <utils/infobar.h>
|
||||
|
||||
#include <QTimer>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
@@ -78,89 +81,98 @@ void setupAndroidDeployConfiguration()
|
||||
static AndroidDeployConfigurationFactory theAndroidDeployConfigurationFactory;
|
||||
}
|
||||
|
||||
void AndroidPlugin::initialize()
|
||||
class AndroidPlugin final : public ExtensionSystem::IPlugin
|
||||
{
|
||||
setupAndroidConfigurations();
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Android.json")
|
||||
|
||||
setupAndroidPotentialKit();
|
||||
setupAndroidDevice();
|
||||
setupAndroidQtVersion();
|
||||
setupAndroidToolchain();
|
||||
void initialize() final
|
||||
{
|
||||
setupAndroidConfigurations();
|
||||
|
||||
setupAndroidDeviceManager(this);
|
||||
setupAndroidPotentialKit();
|
||||
setupAndroidDevice();
|
||||
setupAndroidQtVersion();
|
||||
setupAndroidToolchain();
|
||||
|
||||
setupAndroidSettingsPage();
|
||||
setupAndroidDeviceManager(this);
|
||||
|
||||
setupAndroidPackageInstallationStep();
|
||||
setupAndroidBuildApkStep();
|
||||
setupAndroidSettingsPage();
|
||||
|
||||
setupAndroidDeployConfiguration();
|
||||
setupAndroidDeployQtStep();
|
||||
setupAndroidPackageInstallationStep();
|
||||
setupAndroidBuildApkStep();
|
||||
|
||||
setupAndroidRunConfiguration();
|
||||
setupAndroidRunWorker();
|
||||
setupAndroidDebugWorker();
|
||||
setupAndroidQmlToolingSupport();
|
||||
setupAndroidQmlPreviewWorker();
|
||||
setupAndroidDeployConfiguration();
|
||||
setupAndroidDeployQtStep();
|
||||
|
||||
setupJavaEditor();
|
||||
setupAndroidManifestEditor();
|
||||
setupAndroidRunConfiguration();
|
||||
setupAndroidRunWorker();
|
||||
setupAndroidDebugWorker();
|
||||
setupAndroidQmlToolingSupport();
|
||||
setupAndroidQmlPreviewWorker();
|
||||
|
||||
connect(KitManager::instance(), &KitManager::kitsLoaded,
|
||||
this, &AndroidPlugin::kitsRestored);
|
||||
setupJavaEditor();
|
||||
setupAndroidManifestEditor();
|
||||
|
||||
LanguageClient::LanguageClientSettings::registerClientType(
|
||||
{Android::Constants::JLS_SETTINGS_ID,
|
||||
Tr::tr("Java Language Server"),
|
||||
[] { return new JLSSettings; }});
|
||||
connect(KitManager::instance(), &KitManager::kitsLoaded,
|
||||
this, &AndroidPlugin::kitsRestored);
|
||||
|
||||
LanguageClient::LanguageClientSettings::registerClientType(
|
||||
{Android::Constants::JLS_SETTINGS_ID,
|
||||
Tr::tr("Java Language Server"),
|
||||
[] { return new JLSSettings; }});
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
addTest<AndroidSdkManagerTest>();
|
||||
addTest<SdkManagerOutputParserTest>();
|
||||
addTest<AndroidSdkManagerTest>();
|
||||
addTest<SdkManagerOutputParserTest>();
|
||||
addTest<AndroidTests>();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void AndroidPlugin::kitsRestored()
|
||||
{
|
||||
const bool qtForAndroidInstalled
|
||||
= !QtSupport::QtVersionManager::versions([](const QtSupport::QtVersion *v) {
|
||||
return v->targetDeviceTypes().contains(Android::Constants::ANDROID_DEVICE_TYPE);
|
||||
}).isEmpty();
|
||||
void kitsRestored()
|
||||
{
|
||||
const bool qtForAndroidInstalled
|
||||
= !QtSupport::QtVersionManager::versions([](const QtSupport::QtVersion *v) {
|
||||
return v->targetDeviceTypes().contains(Android::Constants::ANDROID_DEVICE_TYPE);
|
||||
}).isEmpty();
|
||||
|
||||
if (!AndroidConfigurations::currentConfig().sdkFullyConfigured() && qtForAndroidInstalled)
|
||||
askUserAboutAndroidSetup();
|
||||
if (!AndroidConfigurations::currentConfig().sdkFullyConfigured() && qtForAndroidInstalled)
|
||||
askUserAboutAndroidSetup();
|
||||
|
||||
AndroidConfigurations::registerNewToolchains();
|
||||
AndroidConfigurations::updateAutomaticKitList();
|
||||
connect(QtSupport::QtVersionManager::instance(), &QtSupport::QtVersionManager::qtVersionsChanged,
|
||||
AndroidConfigurations::instance(), [] {
|
||||
AndroidConfigurations::registerNewToolchains();
|
||||
AndroidConfigurations::updateAutomaticKitList();
|
||||
});
|
||||
disconnect(KitManager::instance(), &KitManager::kitsLoaded,
|
||||
this, &AndroidPlugin::kitsRestored);
|
||||
}
|
||||
connect(QtSupport::QtVersionManager::instance(), &QtSupport::QtVersionManager::qtVersionsChanged,
|
||||
AndroidConfigurations::instance(), [] {
|
||||
AndroidConfigurations::registerNewToolchains();
|
||||
AndroidConfigurations::updateAutomaticKitList();
|
||||
});
|
||||
disconnect(KitManager::instance(), &KitManager::kitsLoaded,
|
||||
this, &AndroidPlugin::kitsRestored);
|
||||
}
|
||||
|
||||
void AndroidPlugin::askUserAboutAndroidSetup()
|
||||
{
|
||||
NANOTRACE_SCOPE("Android", "AndroidPlugin::askUserAboutAndroidSetup");
|
||||
if (!Core::ICore::infoBar()->canInfoBeAdded(kSetupAndroidSetting))
|
||||
return;
|
||||
void askUserAboutAndroidSetup()
|
||||
{
|
||||
NANOTRACE_SCOPE("Android", "AndroidPlugin::askUserAboutAndroidSetup");
|
||||
if (!Core::ICore::infoBar()->canInfoBeAdded(kSetupAndroidSetting))
|
||||
return;
|
||||
|
||||
Utils::InfoBarEntry
|
||||
Utils::InfoBarEntry
|
||||
info(kSetupAndroidSetting,
|
||||
Tr::tr("Would you like to configure Android options? This will ensure "
|
||||
"Android kits can be usable and all essential packages are installed. "
|
||||
"To do it later, select Edit > Preferences > Devices > Android."),
|
||||
Utils::InfoBarEntry::GlobalSuppression::Enabled);
|
||||
info.addCustomButton(Tr::tr("Configure Android"), [this] {
|
||||
Core::ICore::infoBar()->removeInfo(kSetupAndroidSetting);
|
||||
Core::ICore::infoBar()->globallySuppressInfo(kSetupAndroidSetting);
|
||||
QTimer::singleShot(0, this, [] {
|
||||
Core::ICore::showOptionsDialog(Constants::ANDROID_SETTINGS_ID);
|
||||
info.addCustomButton(Tr::tr("Configure Android"), [this] {
|
||||
Core::ICore::infoBar()->removeInfo(kSetupAndroidSetting);
|
||||
Core::ICore::infoBar()->globallySuppressInfo(kSetupAndroidSetting);
|
||||
QTimer::singleShot(0, this, [] {
|
||||
Core::ICore::showOptionsDialog(Constants::ANDROID_SETTINGS_ID);
|
||||
});
|
||||
});
|
||||
});
|
||||
Core::ICore::infoBar()->addInfo(info);
|
||||
}
|
||||
Core::ICore::infoBar()->addInfo(info);
|
||||
}
|
||||
};
|
||||
|
||||
} // Android::Internal
|
||||
|
||||
#include "androidplugin.moc"
|
||||
|
||||
@@ -3,21 +3,16 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <extensionsystem/iplugin.h>
|
||||
#include <QObject>
|
||||
|
||||
namespace Android::Internal {
|
||||
|
||||
class AndroidPlugin final : public ExtensionSystem::IPlugin
|
||||
class AndroidTests final : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Android.json")
|
||||
|
||||
void initialize() final;
|
||||
|
||||
void kitsRestored();
|
||||
void askUserAboutAndroidSetup();
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
void testAndroidConfigAvailableNdkPlatforms_data();
|
||||
void testAndroidConfigAvailableNdkPlatforms();
|
||||
|
||||
@@ -286,7 +286,7 @@ void setupAndroidQtVersion()
|
||||
}
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
void AndroidPlugin::testAndroidQtVersionParseBuiltWith_data()
|
||||
void AndroidTests::testAndroidQtVersionParseBuiltWith_data()
|
||||
{
|
||||
QTest::addColumn<QString>("modulesCoreJson");
|
||||
QTest::addColumn<bool>("hasInfo");
|
||||
@@ -332,7 +332,7 @@ void AndroidPlugin::testAndroidQtVersionParseBuiltWith_data()
|
||||
<< 31;
|
||||
}
|
||||
|
||||
void AndroidPlugin::testAndroidQtVersionParseBuiltWith()
|
||||
void AndroidTests::testAndroidQtVersionParseBuiltWith()
|
||||
{
|
||||
QFETCH(QString, modulesCoreJson);
|
||||
QFETCH(bool, hasInfo);
|
||||
|
||||
Reference in New Issue
Block a user