aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qtsupport/qtsupportplugin.cpp
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2020-01-08 13:38:08 +0100
committerEike Ziller <eike.ziller@qt.io>2020-01-09 15:04:18 +0000
commitce69a9af83f4fb9e3074175f382c3b1da382d67f (patch)
treeaf550938d144967c8b431a16904e42d383c2f441 /src/plugins/qtsupport/qtsupportplugin.cpp
parente5a9e981ad268cc8deb42f9c819e0a435ba4929f (diff)
Provide option to "link" Qt Creator to a Qt installation
Allows making e.g. a Qt Creator-only offline installation aware of a Qt installation, with auto-registration of Qt versions and kits. Change-Id: Ia92dd9d4dbf34acb3a01713207699ff3f14cea12 Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Diffstat (limited to 'src/plugins/qtsupport/qtsupportplugin.cpp')
-rw-r--r--src/plugins/qtsupport/qtsupportplugin.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/plugins/qtsupport/qtsupportplugin.cpp b/src/plugins/qtsupport/qtsupportplugin.cpp
index 9193a3071b..9059207f8c 100644
--- a/src/plugins/qtsupport/qtsupportplugin.cpp
+++ b/src/plugins/qtsupport/qtsupportplugin.cpp
@@ -40,6 +40,7 @@
#include "uicgenerator.h"
#include <coreplugin/icore.h>
+#include <coreplugin/infobar.h>
#include <coreplugin/jsexpander.h>
#include <projectexplorer/jsonwizard/jsonwizardfactory.h>
@@ -115,6 +116,30 @@ static BaseQtVersion *qtVersion()
return QtKitAspect::qtVersion(project->activeTarget()->kit());
}
+const char kLinkWithQtInstallationSetting[] = "LinkWithQtInstallation";
+
+static void askAboutQtInstallation()
+{
+ // if the install settings exist, the Qt Creator installation is (probably) already linked to
+ // a Qt installation, so don't ask
+ if (QFile::exists(ICore::settings(QSettings::SystemScope)->fileName())
+ || !ICore::infoBar()->canInfoBeAdded(kLinkWithQtInstallationSetting))
+ return;
+
+ InfoBarEntry info(
+ kLinkWithQtInstallationSetting,
+ QtSupportPlugin::tr(
+ "Link with a Qt installation to automatically register Qt versions and kits? To do "
+ "this later, select Options > Kits > Qt Versions > Link with Qt."),
+ InfoBarEntry::GlobalSuppression::Enabled);
+ info.setCustomButtonInfo(QtSupportPlugin::tr("Link with Qt"), [] {
+ ICore::infoBar()->removeInfo(kLinkWithQtInstallationSetting);
+ ICore::infoBar()->globallySuppressInfo(kLinkWithQtInstallationSetting);
+ QTimer::singleShot(0, ICore::mainWindow(), &QtOptionsPageWidget::linkWithQt);
+ });
+ ICore::infoBar()->addInfo(info);
+}
+
void QtSupportPlugin::extensionsInitialized()
{
Utils::MacroExpander *expander = Utils::globalMacroExpander();
@@ -136,6 +161,8 @@ void QtSupportPlugin::extensionsInitialized()
BaseQtVersion *qt = qtVersion();
return qt ? qt->binPath().toUserOutput() : QString();
});
+
+ askAboutQtInstallation();
}
} // Internal