2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2010-12-17 16:01:08 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2008-12-02 16:19:05 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#include "qtversionmanager.h"
|
2008-12-02 16:19:05 +01:00
|
|
|
|
2013-03-27 08:59:57 +01:00
|
|
|
#include "baseqtversion.h"
|
2019-12-16 14:24:15 +01:00
|
|
|
#include "exampleslistmodel.h"
|
|
|
|
|
#include "qtkitinformation.h"
|
2013-07-10 14:17:20 +02:00
|
|
|
#include "qtsupportconstants.h"
|
2019-12-16 14:24:15 +01:00
|
|
|
#include "qtversionfactory.h"
|
2011-05-04 13:14:46 +02:00
|
|
|
|
2009-01-20 11:52:04 +01:00
|
|
|
#include <coreplugin/icore.h>
|
2010-06-11 13:11:37 +02:00
|
|
|
#include <coreplugin/helpmanager.h>
|
2011-02-28 16:50:14 +01:00
|
|
|
|
2009-01-19 12:39:20 +01:00
|
|
|
#include <extensionsystem/pluginmanager.h>
|
2011-02-28 16:50:14 +01:00
|
|
|
|
2014-03-31 12:20:39 +02:00
|
|
|
#include <projectexplorer/toolchainmanager.h>
|
|
|
|
|
|
2014-06-16 18:25:52 +04:00
|
|
|
#include <utils/algorithm.h>
|
2013-11-27 16:10:14 +01:00
|
|
|
#include <utils/buildablehelperlibrary.h>
|
2020-01-16 17:25:38 +01:00
|
|
|
#include <utils/environment.h>
|
2012-03-23 17:41:45 +01:00
|
|
|
#include <utils/filesystemwatcher.h>
|
2013-03-19 10:07:51 +01:00
|
|
|
#include <utils/hostosinfo.h>
|
2011-08-16 10:45:23 +02:00
|
|
|
#include <utils/persistentsettings.h>
|
2011-05-04 13:14:46 +02:00
|
|
|
#include <utils/qtcassert.h>
|
2021-11-03 16:37:21 +01:00
|
|
|
#include <utils/qtcprocess.h>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2012-04-17 08:01:25 +02:00
|
|
|
#include <QDir>
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QFile>
|
2019-10-21 21:54:57 +03:00
|
|
|
#include <QLoggingCategory>
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QSettings>
|
2014-10-16 13:52:28 +02:00
|
|
|
#include <QStandardPaths>
|
2013-03-27 09:15:01 +01:00
|
|
|
#include <QStringList>
|
2019-10-21 21:54:57 +03:00
|
|
|
#include <QTextStream>
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QTimer>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2013-08-29 14:11:29 +02:00
|
|
|
using namespace Utils;
|
2009-04-28 12:43:04 +02:00
|
|
|
|
2013-08-29 14:11:29 +02:00
|
|
|
namespace QtSupport {
|
|
|
|
|
|
|
|
|
|
using namespace Internal;
|
|
|
|
|
|
|
|
|
|
const char QTVERSION_DATA_KEY[] = "QtVersion.";
|
|
|
|
|
const char QTVERSION_TYPE_KEY[] = "QtVersion.Type";
|
|
|
|
|
const char QTVERSION_FILE_VERSION_KEY[] = "Version";
|
2021-04-22 16:15:26 +02:00
|
|
|
const char QTVERSION_FILENAME[] = "qtversion.xml";
|
2013-08-29 14:11:29 +02:00
|
|
|
|
2022-01-21 16:06:36 +01:00
|
|
|
using VersionMap = QMap<int, QtVersion *>;
|
2019-10-07 14:22:53 +02:00
|
|
|
static VersionMap m_versions;
|
2019-10-07 07:46:48 +02:00
|
|
|
|
|
|
|
|
const char DOCUMENTATION_SETTING_KEY[] = "QtSupport/DocumentationSetting";
|
|
|
|
|
|
2013-08-29 14:11:29 +02:00
|
|
|
static int m_idcount = 0;
|
|
|
|
|
// managed by QtProjectManagerPlugin
|
2017-01-12 10:10:00 +01:00
|
|
|
static QtVersionManager *m_instance = nullptr;
|
|
|
|
|
static FileSystemWatcher *m_configFileWatcher = nullptr;
|
|
|
|
|
static QTimer *m_fileWatcherTimer = nullptr;
|
|
|
|
|
static PersistentSettingsWriter *m_writer = nullptr;
|
2019-12-16 14:24:15 +01:00
|
|
|
static QVector<ExampleSetModel::ExtraExampleSet> m_pluginRegisteredExampleSets;
|
2011-05-04 13:14:46 +02:00
|
|
|
|
2019-10-21 21:54:57 +03:00
|
|
|
static Q_LOGGING_CATEGORY(log, "qtc.qt.versions", QtWarningMsg);
|
2009-08-17 11:49:59 +02:00
|
|
|
|
2019-05-28 13:49:26 +02:00
|
|
|
static FilePath globalSettingsFileName()
|
2012-03-23 17:41:45 +01:00
|
|
|
{
|
2021-04-26 15:46:09 +02:00
|
|
|
return Core::ICore::installerResourcePath(QTVERSION_FILENAME);
|
2012-03-23 17:41:45 +01:00
|
|
|
}
|
|
|
|
|
|
2019-05-28 13:49:26 +02:00
|
|
|
static FilePath settingsFileName(const QString &path)
|
2011-05-04 13:14:46 +02:00
|
|
|
{
|
2021-04-26 15:46:09 +02:00
|
|
|
return Core::ICore::userResourcePath(path);
|
2011-05-04 13:14:46 +02:00
|
|
|
}
|
|
|
|
|
|
2011-02-21 12:16:20 +01:00
|
|
|
|
|
|
|
|
// prefer newer qts otherwise compare on id
|
2022-01-21 16:06:36 +01:00
|
|
|
bool qtVersionNumberCompare(QtVersion *a, QtVersion *b)
|
2011-02-21 12:16:20 +01:00
|
|
|
{
|
|
|
|
|
return a->qtVersion() > b->qtVersion() || (a->qtVersion() == b->qtVersion() && a->uniqueId() < b->uniqueId());
|
|
|
|
|
}
|
2014-02-19 12:23:11 +01:00
|
|
|
static bool restoreQtVersions();
|
|
|
|
|
static void findSystemQt();
|
|
|
|
|
static void saveQtVersions();
|
|
|
|
|
|
2019-12-16 14:24:15 +01:00
|
|
|
QVector<ExampleSetModel::ExtraExampleSet> ExampleSetModel::pluginRegisteredExampleSets()
|
|
|
|
|
{
|
|
|
|
|
return m_pluginRegisteredExampleSets;
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-01 18:36:00 +01:00
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
// QtVersionManager
|
|
|
|
|
// --------------------------------------------------------------------------
|
2009-03-25 15:18:37 +01:00
|
|
|
|
2013-08-29 14:11:29 +02:00
|
|
|
QtVersionManager::QtVersionManager()
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2013-08-29 14:11:29 +02:00
|
|
|
m_instance = this;
|
2017-01-12 10:10:00 +01:00
|
|
|
m_configFileWatcher = nullptr;
|
2013-08-29 14:11:29 +02:00
|
|
|
m_fileWatcherTimer = new QTimer(this);
|
2017-01-12 10:10:00 +01:00
|
|
|
m_writer = nullptr;
|
2008-12-02 12:01:29 +01:00
|
|
|
m_idcount = 1;
|
2011-11-25 13:19:58 +01:00
|
|
|
|
2019-05-28 13:49:26 +02:00
|
|
|
qRegisterMetaType<FilePath>();
|
2012-05-09 10:47:12 +00:00
|
|
|
|
|
|
|
|
// Give the file a bit of time to settle before reading it...
|
|
|
|
|
m_fileWatcherTimer->setInterval(2000);
|
2016-06-05 22:22:11 +03:00
|
|
|
connect(m_fileWatcherTimer, &QTimer::timeout, this, [this] { updateFromInstaller(); });
|
2011-05-04 13:14:46 +02:00
|
|
|
}
|
|
|
|
|
|
2014-03-31 12:20:39 +02:00
|
|
|
void QtVersionManager::triggerQtVersionRestore()
|
2011-05-04 13:14:46 +02:00
|
|
|
{
|
2016-06-05 22:22:11 +03:00
|
|
|
disconnect(ProjectExplorer::ToolChainManager::instance(), &ProjectExplorer::ToolChainManager::toolChainsLoaded,
|
|
|
|
|
this, &QtVersionManager::triggerQtVersionRestore);
|
2014-03-31 12:20:39 +02:00
|
|
|
|
2011-05-04 13:14:46 +02:00
|
|
|
bool success = restoreQtVersions();
|
2013-08-29 14:11:29 +02:00
|
|
|
m_instance->updateFromInstaller(false);
|
2011-05-04 13:14:46 +02:00
|
|
|
if (!success) {
|
|
|
|
|
// We did neither restore our settings or upgraded
|
|
|
|
|
// in that case figure out if there's a qt in path
|
2012-07-26 16:08:41 +02:00
|
|
|
// and add it to the Qt versions
|
2011-05-04 13:14:46 +02:00
|
|
|
findSystemQt();
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-29 14:11:29 +02:00
|
|
|
emit m_instance->qtVersionsLoaded();
|
|
|
|
|
emit m_instance->qtVersionsChanged(m_versions.keys(), QList<int>(), QList<int>());
|
2011-05-04 13:14:46 +02:00
|
|
|
saveQtVersions();
|
2012-03-23 17:41:45 +01:00
|
|
|
|
2019-05-28 13:49:26 +02:00
|
|
|
const FilePath configFileName = globalSettingsFileName();
|
2014-10-24 13:15:54 +02:00
|
|
|
if (configFileName.exists()) {
|
2013-08-29 14:11:29 +02:00
|
|
|
m_configFileWatcher = new FileSystemWatcher(m_instance);
|
2016-06-05 22:22:11 +03:00
|
|
|
connect(m_configFileWatcher, &FileSystemWatcher::fileChanged,
|
2019-02-26 09:40:49 +01:00
|
|
|
m_fileWatcherTimer, QOverload<>::of(&QTimer::start));
|
2012-08-20 18:52:20 +02:00
|
|
|
m_configFileWatcher->addFile(configFileName.toString(),
|
2013-08-29 14:11:29 +02:00
|
|
|
FileSystemWatcher::WatchModifiedDate);
|
2012-04-03 10:05:08 +02:00
|
|
|
} // exists
|
2011-05-04 13:14:46 +02:00
|
|
|
|
2022-01-24 13:25:48 +01:00
|
|
|
const QtVersions vs = versions();
|
2019-10-07 07:46:48 +02:00
|
|
|
updateDocumentation(vs, {}, vs);
|
2012-02-02 10:47:33 +01:00
|
|
|
}
|
|
|
|
|
|
2013-08-29 14:11:29 +02:00
|
|
|
bool QtVersionManager::isLoaded()
|
2013-02-28 14:41:43 +01:00
|
|
|
{
|
|
|
|
|
return m_writer;
|
|
|
|
|
}
|
|
|
|
|
|
2011-05-04 13:14:46 +02:00
|
|
|
QtVersionManager::~QtVersionManager()
|
|
|
|
|
{
|
2012-08-17 13:18:31 +02:00
|
|
|
delete m_writer;
|
2011-05-04 13:14:46 +02:00
|
|
|
qDeleteAll(m_versions);
|
|
|
|
|
m_versions.clear();
|
|
|
|
|
}
|
|
|
|
|
|
2014-03-31 12:20:39 +02:00
|
|
|
void QtVersionManager::initialized()
|
|
|
|
|
{
|
2016-06-05 22:22:11 +03:00
|
|
|
connect(ProjectExplorer::ToolChainManager::instance(), &ProjectExplorer::ToolChainManager::toolChainsLoaded,
|
|
|
|
|
QtVersionManager::instance(), &QtVersionManager::triggerQtVersionRestore);
|
2014-03-31 12:20:39 +02:00
|
|
|
}
|
|
|
|
|
|
2014-04-01 12:38:06 +02:00
|
|
|
QtVersionManager *QtVersionManager::instance()
|
2011-05-04 13:14:46 +02:00
|
|
|
{
|
2013-08-29 14:11:29 +02:00
|
|
|
return m_instance;
|
2011-05-04 13:14:46 +02:00
|
|
|
}
|
|
|
|
|
|
2014-02-19 12:23:11 +01:00
|
|
|
static bool restoreQtVersions()
|
2011-05-04 13:14:46 +02:00
|
|
|
{
|
2012-09-26 17:06:53 +02:00
|
|
|
QTC_ASSERT(!m_writer, return false);
|
2019-10-07 14:22:53 +02:00
|
|
|
m_writer = new PersistentSettingsWriter(settingsFileName(QTVERSION_FILENAME),
|
|
|
|
|
"QtCreatorQtVersions");
|
2012-09-26 17:06:53 +02:00
|
|
|
|
2017-12-08 17:20:48 +01:00
|
|
|
const QList<QtVersionFactory *> factories = QtVersionFactory::allQtVersionFactories();
|
2011-05-04 13:14:46 +02:00
|
|
|
|
2013-08-29 14:11:29 +02:00
|
|
|
PersistentSettingsReader reader;
|
2019-10-07 14:22:53 +02:00
|
|
|
const FilePath filename = settingsFileName(QTVERSION_FILENAME);
|
2012-06-20 15:49:58 +02:00
|
|
|
|
2012-04-24 15:49:09 +02:00
|
|
|
if (!reader.load(filename))
|
2011-05-04 13:14:46 +02:00
|
|
|
return false;
|
|
|
|
|
QVariantMap data = reader.restoreValues();
|
|
|
|
|
|
|
|
|
|
// Check version:
|
2019-10-07 14:22:53 +02:00
|
|
|
const int version = data.value(QTVERSION_FILE_VERSION_KEY, 0).toInt();
|
2011-05-04 13:14:46 +02:00
|
|
|
if (version < 1)
|
|
|
|
|
return false;
|
|
|
|
|
|
2019-10-07 14:22:53 +02:00
|
|
|
const QString keyPrefix(QTVERSION_DATA_KEY);
|
2013-03-14 14:14:48 +01:00
|
|
|
const QVariantMap::ConstIterator dcend = data.constEnd();
|
|
|
|
|
for (QVariantMap::ConstIterator it = data.constBegin(); it != dcend; ++it) {
|
|
|
|
|
const QString &key = it.key();
|
2012-06-20 15:49:58 +02:00
|
|
|
if (!key.startsWith(keyPrefix))
|
|
|
|
|
continue;
|
|
|
|
|
bool ok;
|
2020-09-11 11:32:43 +02:00
|
|
|
int count = key.mid(keyPrefix.count()).toInt(&ok);
|
2012-06-20 15:49:58 +02:00
|
|
|
if (!ok || count < 0)
|
|
|
|
|
continue;
|
2011-05-04 13:14:46 +02:00
|
|
|
|
2013-03-14 14:14:48 +01:00
|
|
|
const QVariantMap qtversionMap = it.value().toMap();
|
2019-10-07 14:22:53 +02:00
|
|
|
const QString type = qtversionMap.value(QTVERSION_TYPE_KEY).toString();
|
2011-05-04 13:14:46 +02:00
|
|
|
|
|
|
|
|
bool restored = false;
|
2017-12-08 17:20:48 +01:00
|
|
|
for (QtVersionFactory *f : factories) {
|
2011-05-04 13:14:46 +02:00
|
|
|
if (f->canRestore(type)) {
|
2022-01-21 16:06:36 +01:00
|
|
|
if (QtVersion *qtv = f->restore(type, qtversionMap)) {
|
2011-05-04 13:14:46 +02:00
|
|
|
if (m_versions.contains(qtv->uniqueId())) {
|
|
|
|
|
// This shouldn't happen, we are restoring the same id multiple times?
|
2011-06-14 17:17:24 +02:00
|
|
|
qWarning() << "A Qt version with id"<<qtv->uniqueId()<<"already exists";
|
2011-05-04 13:14:46 +02:00
|
|
|
delete qtv;
|
|
|
|
|
} else {
|
|
|
|
|
m_versions.insert(qtv->uniqueId(), qtv);
|
|
|
|
|
m_idcount = qtv->uniqueId() > m_idcount ? qtv->uniqueId() : m_idcount;
|
|
|
|
|
restored = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!restored)
|
2011-06-14 17:17:24 +02:00
|
|
|
qWarning("Warning: Unable to restore Qt version '%s' stored in %s.",
|
2011-05-04 13:14:46 +02:00
|
|
|
qPrintable(type),
|
2012-08-20 18:52:20 +02:00
|
|
|
qPrintable(filename.toUserOutput()));
|
2011-05-04 13:14:46 +02:00
|
|
|
}
|
|
|
|
|
++m_idcount;
|
2013-02-28 14:41:43 +01:00
|
|
|
|
2011-05-04 13:14:46 +02:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-28 12:17:10 +02:00
|
|
|
void QtVersionManager::updateFromInstaller(bool emitSignal)
|
2011-05-04 13:14:46 +02:00
|
|
|
{
|
2012-05-09 10:47:12 +00:00
|
|
|
m_fileWatcherTimer->stop();
|
|
|
|
|
|
2019-05-28 13:49:26 +02:00
|
|
|
const FilePath path = globalSettingsFileName();
|
2012-08-17 13:18:31 +02:00
|
|
|
// Handle overwritting of data:
|
2012-03-23 17:41:45 +01:00
|
|
|
if (m_configFileWatcher) {
|
2012-08-20 18:52:20 +02:00
|
|
|
m_configFileWatcher->removeFile(path.toString());
|
2013-08-29 14:11:29 +02:00
|
|
|
m_configFileWatcher->addFile(path.toString(), FileSystemWatcher::WatchModifiedDate);
|
2012-03-23 17:41:45 +01:00
|
|
|
}
|
|
|
|
|
|
2012-05-09 10:48:29 +00:00
|
|
|
QList<int> added;
|
|
|
|
|
QList<int> removed;
|
|
|
|
|
QList<int> changed;
|
|
|
|
|
|
2017-12-08 17:20:48 +01:00
|
|
|
const QList<QtVersionFactory *> factories = QtVersionFactory::allQtVersionFactories();
|
2013-08-29 14:11:29 +02:00
|
|
|
PersistentSettingsReader reader;
|
2012-04-30 13:36:33 +02:00
|
|
|
QVariantMap data;
|
2012-08-20 18:52:20 +02:00
|
|
|
if (reader.load(path))
|
2012-04-30 13:36:33 +02:00
|
|
|
data = reader.restoreValues();
|
2011-05-12 11:53:58 +02:00
|
|
|
|
2019-10-21 21:54:57 +03:00
|
|
|
if (log().isDebugEnabled()) {
|
|
|
|
|
qCDebug(log) << "======= Existing Qt versions =======";
|
2022-01-21 16:06:36 +01:00
|
|
|
for (QtVersion *version : qAsConst(m_versions)) {
|
QtSupport: Add support to register Qt versions via qtpaths
qmake is a "build tool", and it is also a "query tool" when called with
parameter "-query". Qt Creator, so far, assumes that building and
querying with a Qt installation are done with one and the same tool:
qmake. This change adds the ability to register a Qt version vie either
qmake or qtpaths and still build with qmake, if that is installed (which
is not anymore mandatory from Qt 6 on).
1) Distinguish between Qt query tool and qmake build tool:
Add QtVersion::queryToolFilePath() to the existing
QtVersion::qmakeFilePath(), and use queryToolFilePath in most "query"
related code, and qmakeFilePath when building with qmake (e.g. in
QmakeProjectManager).
Also, a couple of functions and variables were renamed from *qmake* to
*queryTool* in order to express that the affected code is about
querying/managing Qt versions rather than about building with qmake.
2) Support manual Qt Version adding by qtpaths via file dialog
This change adds qtpaths to the "Add" Qt Version file picker filter.
After selection, "qtpaths -query" is executed for testing purposes. If
that fails, (e.g. because it is an older Qt version), qmake is instead
chosen, silently.
Task-number: QTCREATORBUG-22175
Task-number: QTCREATORBUG-25546
Change-Id: I4d9c1e7eec7d5ae7c5a8d2e1a1ed95addff69966
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-05-11 13:26:57 +02:00
|
|
|
qCDebug(log) << version->queryToolFilePath().toUserOutput()
|
|
|
|
|
<< "id:" <<version->uniqueId();
|
2021-07-12 16:10:43 +02:00
|
|
|
qCDebug(log) << " autodetection source:" << version->detectionSource();
|
2019-10-21 21:54:57 +03:00
|
|
|
qCDebug(log) << "";
|
2011-05-12 11:53:58 +02:00
|
|
|
}
|
2019-10-21 21:54:57 +03:00
|
|
|
qCDebug(log)<< "======= Adding sdk versions =======";
|
2011-05-12 11:53:58 +02:00
|
|
|
}
|
2012-06-20 15:49:58 +02:00
|
|
|
|
2011-05-12 11:53:58 +02:00
|
|
|
QStringList sdkVersions;
|
2012-06-20 15:49:58 +02:00
|
|
|
|
2019-10-07 14:22:53 +02:00
|
|
|
const QString keyPrefix(QTVERSION_DATA_KEY);
|
2013-03-14 14:14:48 +01:00
|
|
|
const QVariantMap::ConstIterator dcend = data.constEnd();
|
|
|
|
|
for (QVariantMap::ConstIterator it = data.constBegin(); it != dcend; ++it) {
|
|
|
|
|
const QString &key = it.key();
|
2012-06-20 15:49:58 +02:00
|
|
|
if (!key.startsWith(keyPrefix))
|
|
|
|
|
continue;
|
|
|
|
|
bool ok;
|
2020-09-11 11:32:43 +02:00
|
|
|
int count = key.mid(keyPrefix.count()).toInt(&ok);
|
2012-06-20 15:49:58 +02:00
|
|
|
if (!ok || count < 0)
|
|
|
|
|
continue;
|
2011-05-12 11:53:58 +02:00
|
|
|
|
2013-03-14 14:14:48 +01:00
|
|
|
QVariantMap qtversionMap = it.value().toMap();
|
2019-10-07 14:22:53 +02:00
|
|
|
const QString type = qtversionMap.value(QTVERSION_TYPE_KEY).toString();
|
|
|
|
|
const QString autoDetectionSource = qtversionMap.value("autodetectionSource").toString();
|
2011-05-12 11:53:58 +02:00
|
|
|
sdkVersions << autoDetectionSource;
|
2022-01-21 16:06:36 +01:00
|
|
|
int id = -1; // see QtVersion::fromMap()
|
2017-01-12 10:10:00 +01:00
|
|
|
QtVersionFactory *factory = nullptr;
|
2019-10-07 14:22:53 +02:00
|
|
|
for (QtVersionFactory *f : factories) {
|
2012-06-20 15:49:58 +02:00
|
|
|
if (f->canRestore(type))
|
2011-05-12 11:53:58 +02:00
|
|
|
factory = f;
|
|
|
|
|
}
|
|
|
|
|
if (!factory) {
|
2019-10-21 21:54:57 +03:00
|
|
|
qCDebug(log, "Warning: Unable to find factory for type '%s'", qPrintable(type));
|
2011-05-12 11:53:58 +02:00
|
|
|
continue;
|
|
|
|
|
}
|
2012-07-26 16:08:41 +02:00
|
|
|
// First try to find a existing Qt version to update
|
2011-05-12 11:53:58 +02:00
|
|
|
bool restored = false;
|
2019-10-21 16:29:28 +02:00
|
|
|
const VersionMap versionsCopy = m_versions; // m_versions is modified in loop
|
2022-01-21 16:06:36 +01:00
|
|
|
for (QtVersion *v : versionsCopy) {
|
2021-07-12 16:10:43 +02:00
|
|
|
if (v->detectionSource() == autoDetectionSource) {
|
2011-05-12 11:53:58 +02:00
|
|
|
id = v->uniqueId();
|
2019-10-21 21:54:57 +03:00
|
|
|
qCDebug(log) << " Qt version found with same autodetection source" << autoDetectionSource << " => Migrating id:" << id;
|
2012-05-09 10:48:29 +00:00
|
|
|
m_versions.remove(id);
|
2019-10-07 14:22:53 +02:00
|
|
|
qtversionMap[Constants::QTVERSIONID] = id;
|
|
|
|
|
qtversionMap[Constants::QTVERSIONNAME] = v->unexpandedDisplayName();
|
2013-07-10 14:12:30 +02:00
|
|
|
delete v;
|
2011-05-12 11:53:58 +02:00
|
|
|
|
2022-01-21 16:06:36 +01:00
|
|
|
if (QtVersion *qtv = factory->restore(type, qtversionMap)) {
|
2011-05-12 11:53:58 +02:00
|
|
|
Q_ASSERT(qtv->isAutodetected());
|
2012-05-09 10:48:29 +00:00
|
|
|
m_versions.insert(id, qtv);
|
2011-05-12 11:53:58 +02:00
|
|
|
restored = true;
|
|
|
|
|
}
|
2012-05-09 10:48:29 +00:00
|
|
|
if (restored)
|
|
|
|
|
changed << id;
|
|
|
|
|
else
|
|
|
|
|
removed << id;
|
2011-05-12 11:53:58 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// Create a new qtversion
|
|
|
|
|
if (!restored) { // didn't replace any existing versions
|
2019-10-21 21:54:57 +03:00
|
|
|
qCDebug(log) << " No Qt version found matching" << autoDetectionSource << " => Creating new version";
|
2022-01-21 16:06:36 +01:00
|
|
|
if (QtVersion *qtv = factory->restore(type, qtversionMap)) {
|
2011-05-12 11:53:58 +02:00
|
|
|
Q_ASSERT(qtv->isAutodetected());
|
2012-05-09 10:48:29 +00:00
|
|
|
m_versions.insert(qtv->uniqueId(), qtv);
|
|
|
|
|
added << qtv->uniqueId();
|
2011-05-12 11:53:58 +02:00
|
|
|
restored = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-10-21 21:54:57 +03:00
|
|
|
if (!restored) {
|
|
|
|
|
qCDebug(log, "Warning: Unable to update qtversion '%s' from sdk installer.",
|
|
|
|
|
qPrintable(autoDetectionSource));
|
|
|
|
|
}
|
2011-05-12 11:53:58 +02:00
|
|
|
}
|
|
|
|
|
|
2019-10-21 21:54:57 +03:00
|
|
|
if (log().isDebugEnabled()) {
|
|
|
|
|
qCDebug(log) << "======= Before removing outdated sdk versions =======";
|
2022-01-21 16:06:36 +01:00
|
|
|
for (QtVersion *version : qAsConst(m_versions)) {
|
QtSupport: Add support to register Qt versions via qtpaths
qmake is a "build tool", and it is also a "query tool" when called with
parameter "-query". Qt Creator, so far, assumes that building and
querying with a Qt installation are done with one and the same tool:
qmake. This change adds the ability to register a Qt version vie either
qmake or qtpaths and still build with qmake, if that is installed (which
is not anymore mandatory from Qt 6 on).
1) Distinguish between Qt query tool and qmake build tool:
Add QtVersion::queryToolFilePath() to the existing
QtVersion::qmakeFilePath(), and use queryToolFilePath in most "query"
related code, and qmakeFilePath when building with qmake (e.g. in
QmakeProjectManager).
Also, a couple of functions and variables were renamed from *qmake* to
*queryTool* in order to express that the affected code is about
querying/managing Qt versions rather than about building with qmake.
2) Support manual Qt Version adding by qtpaths via file dialog
This change adds qtpaths to the "Add" Qt Version file picker filter.
After selection, "qtpaths -query" is executed for testing purposes. If
that fails, (e.g. because it is an older Qt version), qmake is instead
chosen, silently.
Task-number: QTCREATORBUG-22175
Task-number: QTCREATORBUG-25546
Change-Id: I4d9c1e7eec7d5ae7c5a8d2e1a1ed95addff69966
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-05-11 13:26:57 +02:00
|
|
|
qCDebug(log) << version->queryToolFilePath().toUserOutput()
|
|
|
|
|
<< "id:" << version->uniqueId();
|
2021-07-12 16:10:43 +02:00
|
|
|
qCDebug(log) << " autodetection source:" << version->detectionSource();
|
2019-10-21 21:54:57 +03:00
|
|
|
qCDebug(log) << "";
|
2011-05-12 11:53:58 +02:00
|
|
|
}
|
|
|
|
|
}
|
2019-10-21 16:29:28 +02:00
|
|
|
const VersionMap versionsCopy = m_versions; // m_versions is modified in loop
|
2022-01-21 16:06:36 +01:00
|
|
|
for (QtVersion *qtVersion : versionsCopy) {
|
2021-07-12 16:10:43 +02:00
|
|
|
if (qtVersion->detectionSource().startsWith("SDK.")) {
|
|
|
|
|
if (!sdkVersions.contains(qtVersion->detectionSource())) {
|
|
|
|
|
qCDebug(log) << " removing version" << qtVersion->detectionSource();
|
2012-05-09 10:48:29 +00:00
|
|
|
m_versions.remove(qtVersion->uniqueId());
|
|
|
|
|
removed << qtVersion->uniqueId();
|
2011-05-12 11:53:58 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-21 21:54:57 +03:00
|
|
|
if (log().isDebugEnabled()) {
|
|
|
|
|
qCDebug(log)<< "======= End result =======";
|
2022-01-21 16:06:36 +01:00
|
|
|
for (QtVersion *version : qAsConst(m_versions)) {
|
QtSupport: Add support to register Qt versions via qtpaths
qmake is a "build tool", and it is also a "query tool" when called with
parameter "-query". Qt Creator, so far, assumes that building and
querying with a Qt installation are done with one and the same tool:
qmake. This change adds the ability to register a Qt version vie either
qmake or qtpaths and still build with qmake, if that is installed (which
is not anymore mandatory from Qt 6 on).
1) Distinguish between Qt query tool and qmake build tool:
Add QtVersion::queryToolFilePath() to the existing
QtVersion::qmakeFilePath(), and use queryToolFilePath in most "query"
related code, and qmakeFilePath when building with qmake (e.g. in
QmakeProjectManager).
Also, a couple of functions and variables were renamed from *qmake* to
*queryTool* in order to express that the affected code is about
querying/managing Qt versions rather than about building with qmake.
2) Support manual Qt Version adding by qtpaths via file dialog
This change adds qtpaths to the "Add" Qt Version file picker filter.
After selection, "qtpaths -query" is executed for testing purposes. If
that fails, (e.g. because it is an older Qt version), qmake is instead
chosen, silently.
Task-number: QTCREATORBUG-22175
Task-number: QTCREATORBUG-25546
Change-Id: I4d9c1e7eec7d5ae7c5a8d2e1a1ed95addff69966
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-05-11 13:26:57 +02:00
|
|
|
qCDebug(log) << version->queryToolFilePath().toUserOutput()
|
|
|
|
|
<< "id:" << version->uniqueId();
|
2021-07-12 16:10:43 +02:00
|
|
|
qCDebug(log) << " autodetection source:" << version->detectionSource();
|
2019-10-21 21:54:57 +03:00
|
|
|
qCDebug(log) << "";
|
2011-05-12 11:53:58 +02:00
|
|
|
}
|
|
|
|
|
}
|
2012-08-28 12:17:10 +02:00
|
|
|
if (emitSignal)
|
|
|
|
|
emit qtVersionsChanged(added, removed, changed);
|
2011-05-04 13:14:46 +02:00
|
|
|
}
|
|
|
|
|
|
2014-02-19 12:23:11 +01:00
|
|
|
static void saveQtVersions()
|
2011-05-04 13:14:46 +02:00
|
|
|
{
|
2012-08-17 13:18:31 +02:00
|
|
|
if (!m_writer)
|
2012-09-26 17:06:53 +02:00
|
|
|
return;
|
2012-08-31 17:01:15 +02:00
|
|
|
|
|
|
|
|
QVariantMap data;
|
2019-10-07 14:22:53 +02:00
|
|
|
data.insert(QTVERSION_FILE_VERSION_KEY, 1);
|
2011-05-04 13:14:46 +02:00
|
|
|
|
|
|
|
|
int count = 0;
|
2022-01-21 16:06:36 +01:00
|
|
|
for (QtVersion *qtv : qAsConst(m_versions)) {
|
2011-05-04 13:14:46 +02:00
|
|
|
QVariantMap tmp = qtv->toMap();
|
|
|
|
|
if (tmp.isEmpty())
|
|
|
|
|
continue;
|
2019-10-07 14:22:53 +02:00
|
|
|
tmp.insert(QTVERSION_TYPE_KEY, qtv->type());
|
2012-08-31 17:01:15 +02:00
|
|
|
data.insert(QString::fromLatin1(QTVERSION_DATA_KEY) + QString::number(count), tmp);
|
2011-05-04 13:14:46 +02:00
|
|
|
++count;
|
|
|
|
|
}
|
2020-06-02 09:10:40 +02:00
|
|
|
m_writer->save(data, Core::ICore::dialogParent());
|
2011-05-04 13:14:46 +02:00
|
|
|
}
|
|
|
|
|
|
2014-10-16 13:52:28 +02:00
|
|
|
// Executes qtchooser with arguments in a process and returns its output
|
|
|
|
|
static QList<QByteArray> runQtChooser(const QString &qtchooser, const QStringList &arguments)
|
|
|
|
|
{
|
2021-11-03 16:37:21 +01:00
|
|
|
QtcProcess p;
|
|
|
|
|
p.setCommand({FilePath::fromString(qtchooser), arguments});
|
|
|
|
|
p.start();
|
2014-10-16 13:52:28 +02:00
|
|
|
p.waitForFinished();
|
|
|
|
|
const bool success = p.exitCode() == 0;
|
|
|
|
|
return success ? p.readAllStandardOutput().split('\n') : QList<QByteArray>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Asks qtchooser for the qmake path of a given version
|
QtSupport: Add support to register Qt versions via qtpaths
qmake is a "build tool", and it is also a "query tool" when called with
parameter "-query". Qt Creator, so far, assumes that building and
querying with a Qt installation are done with one and the same tool:
qmake. This change adds the ability to register a Qt version vie either
qmake or qtpaths and still build with qmake, if that is installed (which
is not anymore mandatory from Qt 6 on).
1) Distinguish between Qt query tool and qmake build tool:
Add QtVersion::queryToolFilePath() to the existing
QtVersion::qmakeFilePath(), and use queryToolFilePath in most "query"
related code, and qmakeFilePath when building with qmake (e.g. in
QmakeProjectManager).
Also, a couple of functions and variables were renamed from *qmake* to
*queryTool* in order to express that the affected code is about
querying/managing Qt versions rather than about building with qmake.
2) Support manual Qt Version adding by qtpaths via file dialog
This change adds qtpaths to the "Add" Qt Version file picker filter.
After selection, "qtpaths -query" is executed for testing purposes. If
that fails, (e.g. because it is an older Qt version), qmake is instead
chosen, silently.
Task-number: QTCREATORBUG-22175
Task-number: QTCREATORBUG-25546
Change-Id: I4d9c1e7eec7d5ae7c5a8d2e1a1ed95addff69966
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-05-11 13:26:57 +02:00
|
|
|
// TODO: Extend to qtpaths if qtchooser is also used for Qt 6
|
2014-10-16 13:52:28 +02:00
|
|
|
static QString qmakePath(const QString &qtchooser, const QString &version)
|
|
|
|
|
{
|
2019-10-07 14:22:53 +02:00
|
|
|
const QList<QByteArray> outputs = runQtChooser(qtchooser,
|
|
|
|
|
{QStringLiteral("-qt=%1").arg(version),
|
|
|
|
|
QStringLiteral("-print-env")});
|
QtSupport: Add support to register Qt versions via qtpaths
qmake is a "build tool", and it is also a "query tool" when called with
parameter "-query". Qt Creator, so far, assumes that building and
querying with a Qt installation are done with one and the same tool:
qmake. This change adds the ability to register a Qt version vie either
qmake or qtpaths and still build with qmake, if that is installed (which
is not anymore mandatory from Qt 6 on).
1) Distinguish between Qt query tool and qmake build tool:
Add QtVersion::queryToolFilePath() to the existing
QtVersion::qmakeFilePath(), and use queryToolFilePath in most "query"
related code, and qmakeFilePath when building with qmake (e.g. in
QmakeProjectManager).
Also, a couple of functions and variables were renamed from *qmake* to
*queryTool* in order to express that the affected code is about
querying/managing Qt versions rather than about building with qmake.
2) Support manual Qt Version adding by qtpaths via file dialog
This change adds qtpaths to the "Add" Qt Version file picker filter.
After selection, "qtpaths -query" is executed for testing purposes. If
that fails, (e.g. because it is an older Qt version), qmake is instead
chosen, silently.
Task-number: QTCREATORBUG-22175
Task-number: QTCREATORBUG-25546
Change-Id: I4d9c1e7eec7d5ae7c5a8d2e1a1ed95addff69966
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-05-11 13:26:57 +02:00
|
|
|
// Exemplary output of "qtchooser -qt=qt5-x86_64-linux-gnu -print-env":
|
|
|
|
|
// QT_SELECT="qt5-x86_64-linux-gnu"
|
|
|
|
|
// QTTOOLDIR="/usr/lib/qt5/bin"
|
|
|
|
|
// QTLIBDIR="/usr/lib/x86_64-linux-gnu"
|
|
|
|
|
const QByteArray qtToolDirPrefix("QTTOOLDIR=\"");
|
2019-10-07 14:22:53 +02:00
|
|
|
for (const QByteArray &output : outputs) {
|
QtSupport: Add support to register Qt versions via qtpaths
qmake is a "build tool", and it is also a "query tool" when called with
parameter "-query". Qt Creator, so far, assumes that building and
querying with a Qt installation are done with one and the same tool:
qmake. This change adds the ability to register a Qt version vie either
qmake or qtpaths and still build with qmake, if that is installed (which
is not anymore mandatory from Qt 6 on).
1) Distinguish between Qt query tool and qmake build tool:
Add QtVersion::queryToolFilePath() to the existing
QtVersion::qmakeFilePath(), and use queryToolFilePath in most "query"
related code, and qmakeFilePath when building with qmake (e.g. in
QmakeProjectManager).
Also, a couple of functions and variables were renamed from *qmake* to
*queryTool* in order to express that the affected code is about
querying/managing Qt versions rather than about building with qmake.
2) Support manual Qt Version adding by qtpaths via file dialog
This change adds qtpaths to the "Add" Qt Version file picker filter.
After selection, "qtpaths -query" is executed for testing purposes. If
that fails, (e.g. because it is an older Qt version), qmake is instead
chosen, silently.
Task-number: QTCREATORBUG-22175
Task-number: QTCREATORBUG-25546
Change-Id: I4d9c1e7eec7d5ae7c5a8d2e1a1ed95addff69966
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-05-11 13:26:57 +02:00
|
|
|
if (output.startsWith(qtToolDirPrefix)) {
|
|
|
|
|
QByteArray withoutVarName = output.mid(qtToolDirPrefix.size()); // remove QTTOOLDIR="
|
2014-10-16 13:52:28 +02:00
|
|
|
withoutVarName.chop(1); // remove trailing quote
|
|
|
|
|
return QStandardPaths::findExecutable(QStringLiteral("qmake"), QStringList()
|
|
|
|
|
<< QString::fromLocal8Bit(withoutVarName));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return QString();
|
|
|
|
|
}
|
|
|
|
|
|
2019-12-17 14:07:53 +01:00
|
|
|
static FilePaths gatherQmakePathsFromQtChooser()
|
2014-10-16 13:52:28 +02:00
|
|
|
{
|
|
|
|
|
const QString qtchooser = QStandardPaths::findExecutable(QStringLiteral("qtchooser"));
|
|
|
|
|
if (qtchooser.isEmpty())
|
2019-12-17 14:07:53 +01:00
|
|
|
return FilePaths();
|
2014-10-16 13:52:28 +02:00
|
|
|
|
2019-10-07 14:22:53 +02:00
|
|
|
const QList<QByteArray> versions = runQtChooser(qtchooser, QStringList("-l"));
|
QtSupport: Add support to register Qt versions via qtpaths
qmake is a "build tool", and it is also a "query tool" when called with
parameter "-query". Qt Creator, so far, assumes that building and
querying with a Qt installation are done with one and the same tool:
qmake. This change adds the ability to register a Qt version vie either
qmake or qtpaths and still build with qmake, if that is installed (which
is not anymore mandatory from Qt 6 on).
1) Distinguish between Qt query tool and qmake build tool:
Add QtVersion::queryToolFilePath() to the existing
QtVersion::qmakeFilePath(), and use queryToolFilePath in most "query"
related code, and qmakeFilePath when building with qmake (e.g. in
QmakeProjectManager).
Also, a couple of functions and variables were renamed from *qmake* to
*queryTool* in order to express that the affected code is about
querying/managing Qt versions rather than about building with qmake.
2) Support manual Qt Version adding by qtpaths via file dialog
This change adds qtpaths to the "Add" Qt Version file picker filter.
After selection, "qtpaths -query" is executed for testing purposes. If
that fails, (e.g. because it is an older Qt version), qmake is instead
chosen, silently.
Task-number: QTCREATORBUG-22175
Task-number: QTCREATORBUG-25546
Change-Id: I4d9c1e7eec7d5ae7c5a8d2e1a1ed95addff69966
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-05-11 13:26:57 +02:00
|
|
|
// Exemplary output of "qtchooser -l":
|
|
|
|
|
// 4
|
|
|
|
|
// 5
|
|
|
|
|
// default
|
|
|
|
|
// qt4-x86_64-linux-gnu
|
|
|
|
|
// qt4
|
|
|
|
|
// qt5-x86_64-linux-gnu
|
|
|
|
|
// qt5
|
|
|
|
|
// ""
|
2019-05-28 13:49:26 +02:00
|
|
|
QSet<FilePath> foundQMakes;
|
2019-10-07 14:22:53 +02:00
|
|
|
for (const QByteArray &version : versions) {
|
2019-05-28 13:49:26 +02:00
|
|
|
FilePath possibleQMake = FilePath::fromString(
|
2014-10-16 13:52:28 +02:00
|
|
|
qmakePath(qtchooser, QString::fromLocal8Bit(version)));
|
|
|
|
|
if (!possibleQMake.isEmpty())
|
|
|
|
|
foundQMakes << possibleQMake;
|
|
|
|
|
}
|
2019-07-03 18:34:30 +02:00
|
|
|
return Utils::toList(foundQMakes);
|
2014-10-16 13:52:28 +02:00
|
|
|
}
|
|
|
|
|
|
2014-02-19 12:23:11 +01:00
|
|
|
static void findSystemQt()
|
2011-05-04 13:14:46 +02:00
|
|
|
{
|
QtSupport: Add support to register Qt versions via qtpaths
qmake is a "build tool", and it is also a "query tool" when called with
parameter "-query". Qt Creator, so far, assumes that building and
querying with a Qt installation are done with one and the same tool:
qmake. This change adds the ability to register a Qt version vie either
qmake or qtpaths and still build with qmake, if that is installed (which
is not anymore mandatory from Qt 6 on).
1) Distinguish between Qt query tool and qmake build tool:
Add QtVersion::queryToolFilePath() to the existing
QtVersion::qmakeFilePath(), and use queryToolFilePath in most "query"
related code, and qmakeFilePath when building with qmake (e.g. in
QmakeProjectManager).
Also, a couple of functions and variables were renamed from *qmake* to
*queryTool* in order to express that the affected code is about
querying/managing Qt versions rather than about building with qmake.
2) Support manual Qt Version adding by qtpaths via file dialog
This change adds qtpaths to the "Add" Qt Version file picker filter.
After selection, "qtpaths -query" is executed for testing purposes. If
that fails, (e.g. because it is an older Qt version), qmake is instead
chosen, silently.
Task-number: QTCREATORBUG-22175
Task-number: QTCREATORBUG-25546
Change-Id: I4d9c1e7eec7d5ae7c5a8d2e1a1ed95addff69966
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-05-11 13:26:57 +02:00
|
|
|
FilePaths systemQueryTools
|
2019-03-15 10:43:35 +01:00
|
|
|
= BuildableHelperLibrary::findQtsInEnvironment(Environment::systemEnvironment());
|
QtSupport: Add support to register Qt versions via qtpaths
qmake is a "build tool", and it is also a "query tool" when called with
parameter "-query". Qt Creator, so far, assumes that building and
querying with a Qt installation are done with one and the same tool:
qmake. This change adds the ability to register a Qt version vie either
qmake or qtpaths and still build with qmake, if that is installed (which
is not anymore mandatory from Qt 6 on).
1) Distinguish between Qt query tool and qmake build tool:
Add QtVersion::queryToolFilePath() to the existing
QtVersion::qmakeFilePath(), and use queryToolFilePath in most "query"
related code, and qmakeFilePath when building with qmake (e.g. in
QmakeProjectManager).
Also, a couple of functions and variables were renamed from *qmake* to
*queryTool* in order to express that the affected code is about
querying/managing Qt versions rather than about building with qmake.
2) Support manual Qt Version adding by qtpaths via file dialog
This change adds qtpaths to the "Add" Qt Version file picker filter.
After selection, "qtpaths -query" is executed for testing purposes. If
that fails, (e.g. because it is an older Qt version), qmake is instead
chosen, silently.
Task-number: QTCREATORBUG-22175
Task-number: QTCREATORBUG-25546
Change-Id: I4d9c1e7eec7d5ae7c5a8d2e1a1ed95addff69966
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-05-11 13:26:57 +02:00
|
|
|
systemQueryTools.append(gatherQmakePathsFromQtChooser());
|
|
|
|
|
for (const FilePath &queryToolPath : qAsConst(systemQueryTools)) {
|
|
|
|
|
if (BuildableHelperLibrary::isQtChooser(queryToolPath))
|
2020-01-16 17:25:38 +01:00
|
|
|
continue;
|
QtSupport: Add support to register Qt versions via qtpaths
qmake is a "build tool", and it is also a "query tool" when called with
parameter "-query". Qt Creator, so far, assumes that building and
querying with a Qt installation are done with one and the same tool:
qmake. This change adds the ability to register a Qt version vie either
qmake or qtpaths and still build with qmake, if that is installed (which
is not anymore mandatory from Qt 6 on).
1) Distinguish between Qt query tool and qmake build tool:
Add QtVersion::queryToolFilePath() to the existing
QtVersion::qmakeFilePath(), and use queryToolFilePath in most "query"
related code, and qmakeFilePath when building with qmake (e.g. in
QmakeProjectManager).
Also, a couple of functions and variables were renamed from *qmake* to
*queryTool* in order to express that the affected code is about
querying/managing Qt versions rather than about building with qmake.
2) Support manual Qt Version adding by qtpaths via file dialog
This change adds qtpaths to the "Add" Qt Version file picker filter.
After selection, "qtpaths -query" is executed for testing purposes. If
that fails, (e.g. because it is an older Qt version), qmake is instead
chosen, silently.
Task-number: QTCREATORBUG-22175
Task-number: QTCREATORBUG-25546
Change-Id: I4d9c1e7eec7d5ae7c5a8d2e1a1ed95addff69966
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-05-11 13:26:57 +02:00
|
|
|
const auto isSameQueryTool = [queryToolPath](const QtVersion *version) {
|
2020-01-16 17:25:38 +01:00
|
|
|
return Environment::systemEnvironment().
|
QtSupport: Add support to register Qt versions via qtpaths
qmake is a "build tool", and it is also a "query tool" when called with
parameter "-query". Qt Creator, so far, assumes that building and
querying with a Qt installation are done with one and the same tool:
qmake. This change adds the ability to register a Qt version vie either
qmake or qtpaths and still build with qmake, if that is installed (which
is not anymore mandatory from Qt 6 on).
1) Distinguish between Qt query tool and qmake build tool:
Add QtVersion::queryToolFilePath() to the existing
QtVersion::qmakeFilePath(), and use queryToolFilePath in most "query"
related code, and qmakeFilePath when building with qmake (e.g. in
QmakeProjectManager).
Also, a couple of functions and variables were renamed from *qmake* to
*queryTool* in order to express that the affected code is about
querying/managing Qt versions rather than about building with qmake.
2) Support manual Qt Version adding by qtpaths via file dialog
This change adds qtpaths to the "Add" Qt Version file picker filter.
After selection, "qtpaths -query" is executed for testing purposes. If
that fails, (e.g. because it is an older Qt version), qmake is instead
chosen, silently.
Task-number: QTCREATORBUG-22175
Task-number: QTCREATORBUG-25546
Change-Id: I4d9c1e7eec7d5ae7c5a8d2e1a1ed95addff69966
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-05-11 13:26:57 +02:00
|
|
|
isSameExecutable(queryToolPath.toString(),
|
|
|
|
|
version->queryToolFilePath().toString());
|
2020-01-16 17:25:38 +01:00
|
|
|
};
|
QtSupport: Add support to register Qt versions via qtpaths
qmake is a "build tool", and it is also a "query tool" when called with
parameter "-query". Qt Creator, so far, assumes that building and
querying with a Qt installation are done with one and the same tool:
qmake. This change adds the ability to register a Qt version vie either
qmake or qtpaths and still build with qmake, if that is installed (which
is not anymore mandatory from Qt 6 on).
1) Distinguish between Qt query tool and qmake build tool:
Add QtVersion::queryToolFilePath() to the existing
QtVersion::qmakeFilePath(), and use queryToolFilePath in most "query"
related code, and qmakeFilePath when building with qmake (e.g. in
QmakeProjectManager).
Also, a couple of functions and variables were renamed from *qmake* to
*queryTool* in order to express that the affected code is about
querying/managing Qt versions rather than about building with qmake.
2) Support manual Qt Version adding by qtpaths via file dialog
This change adds qtpaths to the "Add" Qt Version file picker filter.
After selection, "qtpaths -query" is executed for testing purposes. If
that fails, (e.g. because it is an older Qt version), qmake is instead
chosen, silently.
Task-number: QTCREATORBUG-22175
Task-number: QTCREATORBUG-25546
Change-Id: I4d9c1e7eec7d5ae7c5a8d2e1a1ed95addff69966
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-05-11 13:26:57 +02:00
|
|
|
if (contains(m_versions, isSameQueryTool))
|
2020-01-16 17:25:38 +01:00
|
|
|
continue;
|
QtSupport: Add support to register Qt versions via qtpaths
qmake is a "build tool", and it is also a "query tool" when called with
parameter "-query". Qt Creator, so far, assumes that building and
querying with a Qt installation are done with one and the same tool:
qmake. This change adds the ability to register a Qt version vie either
qmake or qtpaths and still build with qmake, if that is installed (which
is not anymore mandatory from Qt 6 on).
1) Distinguish between Qt query tool and qmake build tool:
Add QtVersion::queryToolFilePath() to the existing
QtVersion::qmakeFilePath(), and use queryToolFilePath in most "query"
related code, and qmakeFilePath when building with qmake (e.g. in
QmakeProjectManager).
Also, a couple of functions and variables were renamed from *qmake* to
*queryTool* in order to express that the affected code is about
querying/managing Qt versions rather than about building with qmake.
2) Support manual Qt Version adding by qtpaths via file dialog
This change adds qtpaths to the "Add" Qt Version file picker filter.
After selection, "qtpaths -query" is executed for testing purposes. If
that fails, (e.g. because it is an older Qt version), qmake is instead
chosen, silently.
Task-number: QTCREATORBUG-22175
Task-number: QTCREATORBUG-25546
Change-Id: I4d9c1e7eec7d5ae7c5a8d2e1a1ed95addff69966
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-05-11 13:26:57 +02:00
|
|
|
QtVersion *version = QtVersionFactory::createQtVersionFromQueryToolPath(queryToolPath,
|
2019-10-07 14:22:53 +02:00
|
|
|
false,
|
|
|
|
|
"PATH");
|
2019-10-14 15:44:00 +02:00
|
|
|
if (version)
|
2014-10-16 13:52:28 +02:00
|
|
|
m_versions.insert(version->uniqueId(), version);
|
2012-09-27 20:31:49 +08:00
|
|
|
}
|
2011-05-04 13:14:46 +02:00
|
|
|
}
|
|
|
|
|
|
2022-01-21 16:06:36 +01:00
|
|
|
void QtVersionManager::addVersion(QtVersion *version)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2013-02-28 14:41:43 +01:00
|
|
|
QTC_ASSERT(m_writer, return);
|
2017-01-12 10:10:00 +01:00
|
|
|
QTC_ASSERT(version, return);
|
2011-02-21 12:16:20 +01:00
|
|
|
if (m_versions.contains(version->uniqueId()))
|
2010-03-26 10:37:05 +01:00
|
|
|
return;
|
|
|
|
|
|
2009-12-03 18:37:27 +01:00
|
|
|
int uniqueId = version->uniqueId();
|
2011-02-21 12:16:20 +01:00
|
|
|
m_versions.insert(uniqueId, version);
|
|
|
|
|
|
2013-08-29 14:11:29 +02:00
|
|
|
emit m_instance->qtVersionsChanged(QList<int>() << uniqueId, QList<int>(), QList<int>());
|
2011-05-04 13:14:46 +02:00
|
|
|
saveQtVersions();
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2022-01-21 16:06:36 +01:00
|
|
|
void QtVersionManager::removeVersion(QtVersion *version)
|
2009-05-28 13:22:23 +02:00
|
|
|
{
|
2017-01-12 10:10:00 +01:00
|
|
|
QTC_ASSERT(version, return);
|
2011-02-21 12:16:20 +01:00
|
|
|
m_versions.remove(version->uniqueId());
|
2013-08-29 14:11:29 +02:00
|
|
|
emit m_instance->qtVersionsChanged(QList<int>(), QList<int>() << version->uniqueId(), QList<int>());
|
2011-05-04 13:14:46 +02:00
|
|
|
saveQtVersions();
|
2009-05-28 13:22:23 +02:00
|
|
|
delete version;
|
|
|
|
|
}
|
|
|
|
|
|
2019-12-16 14:24:15 +01:00
|
|
|
void QtVersionManager::registerExampleSet(const QString &displayName,
|
|
|
|
|
const QString &manifestPath,
|
|
|
|
|
const QString &examplesPath)
|
|
|
|
|
{
|
|
|
|
|
m_pluginRegisteredExampleSets.append({displayName, manifestPath, examplesPath});
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-07 07:46:48 +02:00
|
|
|
using Path = QString;
|
|
|
|
|
using FileName = QString;
|
2022-01-21 16:06:36 +01:00
|
|
|
static QList<std::pair<Path, FileName>> documentationFiles(QtVersion *v)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2019-10-07 07:46:48 +02:00
|
|
|
QList<std::pair<Path, FileName>> files;
|
2019-10-04 16:01:36 +02:00
|
|
|
const QStringList docPaths = QStringList(
|
|
|
|
|
{v->docsPath().toString() + QChar('/'), v->docsPath().toString() + "/qch/"});
|
|
|
|
|
for (const QString &docPath : docPaths) {
|
|
|
|
|
const QDir versionHelpDir(docPath);
|
|
|
|
|
for (const QString &helpFile : versionHelpDir.entryList(QStringList("*.qch"), QDir::Files))
|
2019-10-07 07:46:48 +02:00
|
|
|
files.append({docPath, helpFile});
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
2019-10-04 16:01:36 +02:00
|
|
|
return files;
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-24 13:25:48 +01:00
|
|
|
static QStringList documentationFiles(const QtVersions &vs, bool highestOnly = false)
|
2019-10-04 16:01:36 +02:00
|
|
|
{
|
2020-11-19 12:49:29 +01:00
|
|
|
// if highestOnly is true, register each file only once per major Qt version, even if
|
|
|
|
|
// multiple minor or patch releases of that major version are installed
|
|
|
|
|
QHash<int, QSet<QString>> includedFileNames; // major Qt version -> names
|
2019-10-07 07:46:48 +02:00
|
|
|
QSet<QString> filePaths;
|
2022-01-24 13:25:48 +01:00
|
|
|
const QtVersions versions = highestOnly ? QtVersionManager::sortVersions(vs) : vs;
|
2022-01-21 16:06:36 +01:00
|
|
|
for (QtVersion *v : versions) {
|
2020-11-19 12:49:29 +01:00
|
|
|
const int majorVersion = v->qtVersion().majorVersion;
|
|
|
|
|
QSet<QString> &majorVersionFileNames = includedFileNames[majorVersion];
|
2019-10-07 07:46:48 +02:00
|
|
|
for (const std::pair<Path, FileName> &file : documentationFiles(v)) {
|
2020-11-19 12:49:29 +01:00
|
|
|
if (!highestOnly || !majorVersionFileNames.contains(file.second)) {
|
2019-10-07 07:46:48 +02:00
|
|
|
filePaths.insert(file.first + file.second);
|
2020-11-19 12:49:29 +01:00
|
|
|
majorVersionFileNames.insert(file.second);
|
2019-10-07 07:46:48 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return filePaths.values();
|
2019-10-04 16:01:36 +02:00
|
|
|
}
|
2019-10-07 07:46:48 +02:00
|
|
|
|
2022-01-24 13:25:48 +01:00
|
|
|
void QtVersionManager::updateDocumentation(const QtVersions &added,
|
|
|
|
|
const QtVersions &removed,
|
|
|
|
|
const QtVersions &allNew)
|
2019-10-04 16:01:36 +02:00
|
|
|
{
|
2019-10-07 07:46:48 +02:00
|
|
|
const DocumentationSetting setting = documentationSetting();
|
|
|
|
|
const QStringList docsOfAll = setting == DocumentationSetting::None
|
|
|
|
|
? QStringList()
|
|
|
|
|
: documentationFiles(allNew,
|
|
|
|
|
setting
|
|
|
|
|
== DocumentationSetting::HighestOnly);
|
2019-10-04 16:01:36 +02:00
|
|
|
const QStringList docsToRemove = Utils::filtered(documentationFiles(removed),
|
|
|
|
|
[&docsOfAll](const QString &f) {
|
|
|
|
|
return !docsOfAll.contains(f);
|
|
|
|
|
});
|
2019-10-07 07:46:48 +02:00
|
|
|
const QStringList docsToAdd = Utils::filtered(documentationFiles(added),
|
|
|
|
|
[&docsOfAll](const QString &f) {
|
|
|
|
|
return docsOfAll.contains(f);
|
|
|
|
|
});
|
2019-10-04 16:01:36 +02:00
|
|
|
Core::HelpManager::unregisterDocumentation(docsToRemove);
|
2019-10-07 07:46:48 +02:00
|
|
|
Core::HelpManager::registerDocumentation(docsToAdd);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int QtVersionManager::getUniqueId()
|
|
|
|
|
{
|
|
|
|
|
return m_idcount++;
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-24 13:25:48 +01:00
|
|
|
QtVersions QtVersionManager::versions(const QtVersion::Predicate &predicate)
|
2015-07-13 13:09:45 +02:00
|
|
|
{
|
2022-01-24 13:25:48 +01:00
|
|
|
QtVersions versions;
|
2015-07-13 13:09:45 +02:00
|
|
|
QTC_ASSERT(isLoaded(), return versions);
|
2017-01-11 14:43:48 +01:00
|
|
|
if (predicate)
|
|
|
|
|
return Utils::filtered(m_versions.values(), predicate);
|
2019-10-07 14:22:53 +02:00
|
|
|
return m_versions.values();
|
2015-07-13 13:09:45 +02:00
|
|
|
}
|
|
|
|
|
|
2022-01-24 13:25:48 +01:00
|
|
|
QtVersions QtVersionManager::sortVersions(const QtVersions &input)
|
2017-01-12 10:30:47 +01:00
|
|
|
{
|
2022-01-24 13:25:48 +01:00
|
|
|
QtVersions result = input;
|
2017-01-12 10:30:47 +01:00
|
|
|
Utils::sort(result, qtVersionNumberCompare);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-21 16:06:36 +01:00
|
|
|
QtVersion *QtVersionManager::version(int id)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2017-01-12 10:10:00 +01:00
|
|
|
QTC_ASSERT(isLoaded(), return nullptr);
|
2019-10-07 14:22:53 +02:00
|
|
|
VersionMap::const_iterator it = m_versions.constFind(id);
|
2011-02-21 12:16:20 +01:00
|
|
|
if (it == m_versions.constEnd())
|
2017-01-12 10:10:00 +01:00
|
|
|
return nullptr;
|
2011-02-21 12:16:20 +01:00
|
|
|
return it.value();
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2022-01-21 16:06:36 +01:00
|
|
|
QtVersion *QtVersionManager::version(const QtVersion::Predicate &predicate)
|
2017-01-11 14:43:48 +01:00
|
|
|
{
|
|
|
|
|
return Utils::findOrDefault(m_versions.values(), predicate);
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-19 12:23:11 +01:00
|
|
|
// This function is really simplistic...
|
2022-01-21 16:06:36 +01:00
|
|
|
static bool equals(QtVersion *a, QtVersion *b)
|
2009-12-03 18:37:27 +01:00
|
|
|
{
|
2011-05-04 13:14:46 +02:00
|
|
|
return a->equals(b);
|
2009-12-03 18:37:27 +01:00
|
|
|
}
|
|
|
|
|
|
2022-01-24 13:25:48 +01:00
|
|
|
void QtVersionManager::setNewQtVersions(const QtVersions &newVersions)
|
2009-04-22 18:05:55 +02:00
|
|
|
{
|
2009-12-03 18:37:27 +01:00
|
|
|
// We want to preserve the same order as in the settings dialog
|
|
|
|
|
// so we sort a copy
|
2022-01-24 13:25:48 +01:00
|
|
|
QtVersions sortedNewVersions = newVersions;
|
2022-01-21 16:06:36 +01:00
|
|
|
Utils::sort(sortedNewVersions, &QtVersion::uniqueId);
|
2009-12-03 18:37:27 +01:00
|
|
|
|
2022-01-24 13:25:48 +01:00
|
|
|
QtVersions addedVersions;
|
|
|
|
|
QtVersions removedVersions;
|
2022-01-21 16:06:36 +01:00
|
|
|
QList<std::pair<QtVersion *, QtVersion *>> changedVersions;
|
2009-12-03 18:37:27 +01:00
|
|
|
// So we trying to find the minimal set of changed versions,
|
|
|
|
|
// iterate over both sorted list
|
|
|
|
|
|
|
|
|
|
// newVersions and oldVersions iterator
|
2022-01-24 13:25:48 +01:00
|
|
|
QtVersions::const_iterator nit, nend;
|
2019-10-07 14:22:53 +02:00
|
|
|
VersionMap::const_iterator oit, oend;
|
2009-12-03 18:37:27 +01:00
|
|
|
nit = sortedNewVersions.constBegin();
|
|
|
|
|
nend = sortedNewVersions.constEnd();
|
|
|
|
|
oit = m_versions.constBegin();
|
|
|
|
|
oend = m_versions.constEnd();
|
|
|
|
|
|
|
|
|
|
while (nit != nend && oit != oend) {
|
|
|
|
|
int nid = (*nit)->uniqueId();
|
|
|
|
|
int oid = (*oit)->uniqueId();
|
|
|
|
|
if (nid < oid) {
|
2019-10-04 16:01:36 +02:00
|
|
|
addedVersions.push_back(*nit);
|
2009-12-03 18:37:27 +01:00
|
|
|
++nit;
|
|
|
|
|
} else if (oid < nid) {
|
2019-10-04 16:01:36 +02:00
|
|
|
removedVersions.push_back(*oit);
|
2009-12-03 18:37:27 +01:00
|
|
|
++oit;
|
|
|
|
|
} else {
|
|
|
|
|
if (!equals(*oit, *nit))
|
2019-10-04 16:01:36 +02:00
|
|
|
changedVersions.push_back({*oit, *nit});
|
2009-12-03 18:37:27 +01:00
|
|
|
++oit;
|
|
|
|
|
++nit;
|
2009-04-22 18:05:55 +02:00
|
|
|
}
|
|
|
|
|
}
|
2009-12-03 18:37:27 +01:00
|
|
|
|
|
|
|
|
while (nit != nend) {
|
2019-10-04 16:01:36 +02:00
|
|
|
addedVersions.push_back(*nit);
|
2009-12-10 12:08:40 +01:00
|
|
|
++nit;
|
2009-12-03 18:37:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while (oit != oend) {
|
2019-10-04 16:01:36 +02:00
|
|
|
removedVersions.push_back(*oit);
|
2009-12-10 12:08:40 +01:00
|
|
|
++oit;
|
2009-12-03 18:37:27 +01:00
|
|
|
}
|
|
|
|
|
|
2019-10-04 16:01:36 +02:00
|
|
|
if (!changedVersions.isEmpty() || !addedVersions.isEmpty() || !removedVersions.isEmpty()) {
|
2022-01-24 13:25:48 +01:00
|
|
|
const QtVersions changedOldVersions
|
2022-01-21 16:06:36 +01:00
|
|
|
= Utils::transform(changedVersions, &std::pair<QtVersion *, QtVersion *>::first);
|
2022-01-24 13:25:48 +01:00
|
|
|
const QtVersions changedNewVersions
|
2019-10-04 16:01:36 +02:00
|
|
|
= Utils::transform(changedVersions,
|
2022-01-21 16:06:36 +01:00
|
|
|
&std::pair<QtVersion *, QtVersion *>::second);
|
2019-10-04 16:01:36 +02:00
|
|
|
updateDocumentation(addedVersions + changedNewVersions,
|
|
|
|
|
removedVersions + changedOldVersions,
|
|
|
|
|
sortedNewVersions);
|
|
|
|
|
}
|
2022-01-21 16:06:36 +01:00
|
|
|
const QList<int> addedIds = Utils::transform(addedVersions, &QtVersion::uniqueId);
|
|
|
|
|
const QList<int> removedIds = Utils::transform(removedVersions, &QtVersion::uniqueId);
|
2019-10-04 16:01:36 +02:00
|
|
|
const QList<int> changedIds = Utils::transform(changedVersions,
|
2022-01-21 16:06:36 +01:00
|
|
|
[](std::pair<QtVersion *, QtVersion *> v) {
|
2019-10-04 16:01:36 +02:00
|
|
|
return v.first->uniqueId();
|
|
|
|
|
});
|
2009-04-22 18:05:55 +02:00
|
|
|
|
|
|
|
|
qDeleteAll(m_versions);
|
2022-01-21 16:06:36 +01:00
|
|
|
m_versions = Utils::transform<VersionMap>(sortedNewVersions, [](QtVersion *v) {
|
2019-10-07 14:22:53 +02:00
|
|
|
return std::make_pair(v->uniqueId(), v);
|
|
|
|
|
});
|
2011-05-04 13:14:46 +02:00
|
|
|
saveQtVersions();
|
2009-12-03 18:37:27 +01:00
|
|
|
|
2012-02-24 18:57:33 +01:00
|
|
|
if (!changedVersions.isEmpty() || !addedVersions.isEmpty() || !removedVersions.isEmpty())
|
2019-10-04 16:01:36 +02:00
|
|
|
emit m_instance->qtVersionsChanged(addedIds, removedIds, changedIds);
|
2009-04-22 18:05:55 +02:00
|
|
|
}
|
|
|
|
|
|
2019-10-07 07:46:48 +02:00
|
|
|
void QtVersionManager::setDocumentationSetting(const QtVersionManager::DocumentationSetting &setting)
|
|
|
|
|
{
|
|
|
|
|
if (setting == documentationSetting())
|
|
|
|
|
return;
|
2021-01-20 15:10:46 +01:00
|
|
|
Core::ICore::settings()->setValueWithDefault(DOCUMENTATION_SETTING_KEY, int(setting), 0);
|
2019-10-07 07:46:48 +02:00
|
|
|
// force re-evaluating which documentation should be registered
|
|
|
|
|
// by claiming that all are removed and re-added
|
2022-01-24 13:25:48 +01:00
|
|
|
const QtVersions vs = versions();
|
2019-10-07 07:46:48 +02:00
|
|
|
updateDocumentation(vs, vs, vs);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QtVersionManager::DocumentationSetting QtVersionManager::documentationSetting()
|
|
|
|
|
{
|
|
|
|
|
return DocumentationSetting(
|
|
|
|
|
Core::ICore::settings()->value(DOCUMENTATION_SETTING_KEY, 0).toInt());
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-29 14:11:29 +02:00
|
|
|
} // namespace QtVersion
|