From ce69a9af83f4fb9e3074175f382c3b1da382d67f Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 8 Jan 2020 13:38:08 +0100 Subject: 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 Reviewed-by: hjk Reviewed-by: Leena Miettinen --- src/plugins/qtsupport/qtsupportplugin.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/plugins/qtsupport/qtsupportplugin.cpp') 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 +#include #include #include @@ -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 -- cgit v1.2.3