forked from qt-creator/qt-creator
QmlJsEditor: Merge LS settings files into main settings file
Collecting relevant pieces in preparation of settings aspectification. Change-Id: Ia221de3babf301f4f5d3583d346eeb9f91046aa4 Reviewed-by: Sami Shalayel <sami.shalayel@qt.io> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -4,7 +4,6 @@ add_qtc_plugin(QmlJSEditor
|
|||||||
SOURCES
|
SOURCES
|
||||||
qmlexpressionundercursor.cpp qmlexpressionundercursor.h
|
qmlexpressionundercursor.cpp qmlexpressionundercursor.h
|
||||||
qmllsclient.h qmllsclient.cpp
|
qmllsclient.h qmllsclient.cpp
|
||||||
qmllssettings.h qmllssettings.cpp
|
|
||||||
qmljsautocompleter.cpp qmljsautocompleter.h
|
qmljsautocompleter.cpp qmljsautocompleter.h
|
||||||
qmljscompletionassist.cpp qmljscompletionassist.h
|
qmljscompletionassist.cpp qmljscompletionassist.h
|
||||||
qmljscomponentfromobjectdef.cpp qmljscomponentfromobjectdef.h
|
qmljscomponentfromobjectdef.cpp qmljscomponentfromobjectdef.h
|
||||||
|
|||||||
@@ -21,8 +21,6 @@ QtcPlugin {
|
|||||||
"qmlexpressionundercursor.h",
|
"qmlexpressionundercursor.h",
|
||||||
"qmllsclient.cpp",
|
"qmllsclient.cpp",
|
||||||
"qmllsclient.h",
|
"qmllsclient.h",
|
||||||
"qmllssettings.cpp",
|
|
||||||
"qmllssettings.h",
|
|
||||||
"qmljsautocompleter.cpp",
|
"qmljsautocompleter.cpp",
|
||||||
"qmljsautocompleter.h",
|
"qmljsautocompleter.h",
|
||||||
"qmljscompletionassist.cpp",
|
"qmljscompletionassist.cpp",
|
||||||
|
|||||||
@@ -6,13 +6,13 @@
|
|||||||
#include "qmljseditordocument_p.h"
|
#include "qmljseditordocument_p.h"
|
||||||
#include "qmljseditorplugin.h"
|
#include "qmljseditorplugin.h"
|
||||||
#include "qmljseditortr.h"
|
#include "qmljseditortr.h"
|
||||||
|
#include "qmljseditorsettings.h"
|
||||||
#include "qmljshighlighter.h"
|
#include "qmljshighlighter.h"
|
||||||
#include "qmljsquickfixassist.h"
|
#include "qmljsquickfixassist.h"
|
||||||
#include "qmljssemantichighlighter.h"
|
#include "qmljssemantichighlighter.h"
|
||||||
#include "qmljssemanticinfoupdater.h"
|
#include "qmljssemanticinfoupdater.h"
|
||||||
#include "qmljstextmark.h"
|
#include "qmljstextmark.h"
|
||||||
#include "qmllsclient.h"
|
#include "qmllsclient.h"
|
||||||
#include "qmllssettings.h"
|
|
||||||
#include "qmloutlinemodel.h"
|
#include "qmloutlinemodel.h"
|
||||||
|
|
||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
@@ -477,10 +477,8 @@ QmlJSEditorDocumentPrivate::QmlJSEditorDocumentPrivate(QmlJSEditorDocument *pare
|
|||||||
this, &QmlJSEditorDocumentPrivate::reparseDocument);
|
this, &QmlJSEditorDocumentPrivate::reparseDocument);
|
||||||
connect(modelManager, &ModelManagerInterface::documentUpdated,
|
connect(modelManager, &ModelManagerInterface::documentUpdated,
|
||||||
this, &QmlJSEditorDocumentPrivate::onDocumentUpdated);
|
this, &QmlJSEditorDocumentPrivate::onDocumentUpdated);
|
||||||
connect(QmllsSettingsManager::instance(),
|
connect(QmllsSettingsManager::instance(), &QmllsSettingsManager::settingsChanged,
|
||||||
&QmllsSettingsManager::settingsChanged,
|
this, &QmlJSEditorDocumentPrivate::settingsChanged);
|
||||||
this,
|
|
||||||
&Internal::QmlJSEditorDocumentPrivate::settingsChanged);
|
|
||||||
|
|
||||||
// semantic info
|
// semantic info
|
||||||
m_semanticInfoUpdater = new SemanticInfoUpdater();
|
m_semanticInfoUpdater = new SemanticInfoUpdater();
|
||||||
@@ -746,9 +744,9 @@ static Utils::FilePath qmllsForFile(const Utils::FilePath &file,
|
|||||||
return settingsManager->latestQmlls();
|
return settingsManager->latestQmlls();
|
||||||
QmlJS::ModelManagerInterface::ProjectInfo pInfo = modelManager->projectInfoForPath(file);
|
QmlJS::ModelManagerInterface::ProjectInfo pInfo = modelManager->projectInfoForPath(file);
|
||||||
|
|
||||||
if (!settingsManager->ignoreMinimumQmllsVersion()
|
if (!settings().ignoreMinimumQmllsVersion()
|
||||||
&& QVersionNumber::fromString(pInfo.qtVersionString)
|
&& QVersionNumber::fromString(pInfo.qtVersionString)
|
||||||
< QmllsSettingsManager::mininumQmllsVersion) {
|
< QmlJsEditingSettings::mininumQmllsVersion) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
return pInfo.qmllsPath;
|
return pInfo.qmllsPath;
|
||||||
|
|||||||
@@ -9,10 +9,15 @@
|
|||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
|
|
||||||
#include <qmljs/qmljscheck.h>
|
#include <qmljs/qmljscheck.h>
|
||||||
|
#include <qmljs/qmljsmodelmanagerinterface.h>
|
||||||
#include <qmljs/qmljsstaticanalysismessage.h>
|
#include <qmljs/qmljsstaticanalysismessage.h>
|
||||||
|
|
||||||
#include <qmljstools/qmljstoolsconstants.h>
|
#include <qmljstools/qmljstoolsconstants.h>
|
||||||
|
|
||||||
|
#include <qtsupport/qtversionmanager.h>
|
||||||
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
|
#include <utils/hostosinfo.h>
|
||||||
#include <utils/layoutbuilder.h>
|
#include <utils/layoutbuilder.h>
|
||||||
#include <utils/macroexpander.h>
|
#include <utils/macroexpander.h>
|
||||||
#include <utils/qtcsettings.h>
|
#include <utils/qtcsettings.h>
|
||||||
@@ -24,10 +29,23 @@
|
|||||||
#include <QGroupBox>
|
#include <QGroupBox>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
|
#include <QLoggingCategory>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
#include <QTreeView>
|
#include <QTreeView>
|
||||||
|
|
||||||
|
#include <nanotrace/nanotrace.h>
|
||||||
|
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
|
using namespace QmlJSEditor::Internal;
|
||||||
|
using namespace QtSupport;
|
||||||
|
using namespace Utils;
|
||||||
|
|
||||||
|
namespace QmlJSEditor::Internal {
|
||||||
|
|
||||||
|
static Q_LOGGING_CATEGORY(qmllsLog, "qtc.qmlls.settings", QtWarningMsg)
|
||||||
|
|
||||||
const char AUTO_FORMAT_ON_SAVE[] = "QmlJSEditor.AutoFormatOnSave";
|
const char AUTO_FORMAT_ON_SAVE[] = "QmlJSEditor.AutoFormatOnSave";
|
||||||
const char AUTO_FORMAT_ONLY_CURRENT_PROJECT[] = "QmlJSEditor.AutoFormatOnlyCurrentProject";
|
const char AUTO_FORMAT_ONLY_CURRENT_PROJECT[] = "QmlJSEditor.AutoFormatOnlyCurrentProject";
|
||||||
const char QML_CONTEXTPANE_KEY[] = "QmlJSEditor.ContextPaneEnabled";
|
const char QML_CONTEXTPANE_KEY[] = "QmlJSEditor.ContextPaneEnabled";
|
||||||
@@ -47,17 +65,107 @@ const char DISABLED_MESSAGES[] = "QmlJSEditor.disabledMessages";
|
|||||||
const char DISABLED_MESSAGES_NONQUICKUI[] = "QmlJSEditor.disabledMessagesNonQuickUI";
|
const char DISABLED_MESSAGES_NONQUICKUI[] = "QmlJSEditor.disabledMessagesNonQuickUI";
|
||||||
const char DEFAULT_CUSTOM_FORMAT_COMMAND[] = "%{CurrentDocument:Project:QT_HOST_BINS}/qmlformat";
|
const char DEFAULT_CUSTOM_FORMAT_COMMAND[] = "%{CurrentDocument:Project:QT_HOST_BINS}/qmlformat";
|
||||||
|
|
||||||
using namespace QmlJSEditor::Internal;
|
|
||||||
using namespace Utils;
|
|
||||||
|
|
||||||
namespace QmlJSEditor::Internal {
|
|
||||||
|
|
||||||
QmlJsEditingSettings &settings()
|
QmlJsEditingSettings &settings()
|
||||||
{
|
{
|
||||||
static QmlJsEditingSettings settings;
|
static QmlJsEditingSettings settings;
|
||||||
return settings;
|
return settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static FilePath evaluateLatestQmlls()
|
||||||
|
{
|
||||||
|
// find latest qmlls, i.e. vals
|
||||||
|
if (!QtVersionManager::isLoaded())
|
||||||
|
return {};
|
||||||
|
const QtVersions versions = QtVersionManager::versions();
|
||||||
|
FilePath latestQmlls;
|
||||||
|
QVersionNumber latestVersion;
|
||||||
|
FilePath latestQmakeFilePath;
|
||||||
|
int latestUniqueId = std::numeric_limits<int>::min();
|
||||||
|
for (QtVersion *v : versions) {
|
||||||
|
// check if we find qmlls
|
||||||
|
QVersionNumber vNow = v->qtVersion();
|
||||||
|
FilePath qmllsNow = QmlJS::ModelManagerInterface::qmllsForBinPath(v->hostBinPath(), vNow);
|
||||||
|
if (!qmllsNow.isExecutableFile())
|
||||||
|
continue;
|
||||||
|
if (latestVersion > vNow)
|
||||||
|
continue;
|
||||||
|
FilePath qmakeNow = v->qmakeFilePath();
|
||||||
|
int uniqueIdNow = v->uniqueId();
|
||||||
|
if (latestVersion == vNow) {
|
||||||
|
if (latestQmakeFilePath > qmakeNow)
|
||||||
|
continue;
|
||||||
|
if (latestQmakeFilePath == qmakeNow && latestUniqueId >= v->uniqueId())
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
latestVersion = vNow;
|
||||||
|
latestQmlls = qmllsNow;
|
||||||
|
latestQmakeFilePath = qmakeNow;
|
||||||
|
latestUniqueId = uniqueIdNow;
|
||||||
|
}
|
||||||
|
return latestQmlls;
|
||||||
|
}
|
||||||
|
|
||||||
|
QmllsSettingsManager *QmllsSettingsManager::instance()
|
||||||
|
{
|
||||||
|
static QmllsSettingsManager *manager = new QmllsSettingsManager;
|
||||||
|
return manager;
|
||||||
|
}
|
||||||
|
|
||||||
|
FilePath QmllsSettingsManager::latestQmlls()
|
||||||
|
{
|
||||||
|
QMutexLocker l(&m_mutex);
|
||||||
|
return m_latestQmlls;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QmllsSettingsManager::setupAutoupdate()
|
||||||
|
{
|
||||||
|
QObject::connect(QtVersionManager::instance(),
|
||||||
|
&QtVersionManager::qtVersionsChanged,
|
||||||
|
this,
|
||||||
|
&QmllsSettingsManager::checkForChanges);
|
||||||
|
if (QtVersionManager::isLoaded())
|
||||||
|
checkForChanges();
|
||||||
|
else
|
||||||
|
QObject::connect(QtVersionManager::instance(),
|
||||||
|
&QtVersionManager::qtVersionsLoaded,
|
||||||
|
this,
|
||||||
|
&QmllsSettingsManager::checkForChanges);
|
||||||
|
}
|
||||||
|
|
||||||
|
void QmllsSettingsManager::checkForChanges()
|
||||||
|
{
|
||||||
|
const QmlJsEditingSettings &newSettings = settings();
|
||||||
|
FilePath newLatest = newSettings.useLatestQmlls() && newSettings.useQmlls()
|
||||||
|
? evaluateLatestQmlls() : m_latestQmlls;
|
||||||
|
if (m_useQmlls == newSettings.useQmlls()
|
||||||
|
&& m_useLatestQmlls == newSettings.useLatestQmlls()
|
||||||
|
&& m_disableBuiltinCodemodel == newSettings.disableBuiltinCodemodel()
|
||||||
|
&& m_generateQmllsIniFiles == newSettings.generateQmllsIniFiles()
|
||||||
|
&& newLatest == m_latestQmlls)
|
||||||
|
return;
|
||||||
|
qCDebug(qmllsLog) << "qmlls settings changed:" << newSettings.useQmlls()
|
||||||
|
<< newSettings.useLatestQmlls() << newLatest;
|
||||||
|
{
|
||||||
|
QMutexLocker l(&m_mutex);
|
||||||
|
m_latestQmlls = newLatest;
|
||||||
|
m_useQmlls = newSettings.useQmlls();
|
||||||
|
m_useLatestQmlls = newSettings.useLatestQmlls();
|
||||||
|
m_disableBuiltinCodemodel = newSettings.disableBuiltinCodemodel();
|
||||||
|
m_generateQmllsIniFiles = newSettings.generateQmllsIniFiles();
|
||||||
|
}
|
||||||
|
emit settingsChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QmllsSettingsManager::useLatestQmlls() const
|
||||||
|
{
|
||||||
|
return m_useLatestQmlls;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QmllsSettingsManager::useQmlls() const
|
||||||
|
{
|
||||||
|
return m_useQmlls;
|
||||||
|
}
|
||||||
|
|
||||||
static QList<int> defaultDisabledMessages()
|
static QList<int> defaultDisabledMessages()
|
||||||
{
|
{
|
||||||
static const QList<int> disabledByDefault = Utils::transform(
|
static const QList<int> disabledByDefault = Utils::transform(
|
||||||
@@ -452,7 +560,7 @@ public:
|
|||||||
|
|
||||||
ignoreMinimumQmllsVersion = new QCheckBox(
|
ignoreMinimumQmllsVersion = new QCheckBox(
|
||||||
Tr::tr("Allow versions below Qt %1")
|
Tr::tr("Allow versions below Qt %1")
|
||||||
.arg(QmllsSettingsManager::mininumQmllsVersion.toString()));
|
.arg(QmlJsEditingSettings::mininumQmllsVersion.toString()));
|
||||||
ignoreMinimumQmllsVersion->setChecked(s.ignoreMinimumQmllsVersion());
|
ignoreMinimumQmllsVersion->setChecked(s.ignoreMinimumQmllsVersion());
|
||||||
ignoreMinimumQmllsVersion->setEnabled(s.useQmlls());
|
ignoreMinimumQmllsVersion->setEnabled(s.useQmlls());
|
||||||
|
|
||||||
|
|||||||
@@ -3,18 +3,21 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "qmllssettings.h"
|
|
||||||
|
|
||||||
#include <coreplugin/dialogs/ioptionspage.h>
|
#include <coreplugin/dialogs/ioptionspage.h>
|
||||||
|
|
||||||
#include <QPointer>
|
#include <utils/filepath.h>
|
||||||
#include <QWidget>
|
|
||||||
|
#include <QMutex>
|
||||||
|
#include <QObject>
|
||||||
|
#include <QVersionNumber>
|
||||||
|
|
||||||
namespace QmlJSEditor::Internal {
|
namespace QmlJSEditor::Internal {
|
||||||
|
|
||||||
class QmlJsEditingSettings
|
class QmlJsEditingSettings
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
static const inline QVersionNumber mininumQmllsVersion = QVersionNumber(6, 8);
|
||||||
|
|
||||||
QmlJsEditingSettings();
|
QmlJsEditingSettings();
|
||||||
|
|
||||||
void toSettings(Utils::QtcSettings *) const;
|
void toSettings(Utils::QtcSettings *) const;
|
||||||
@@ -98,6 +101,33 @@ private:
|
|||||||
QSet<int> m_disabledMessagesForNonQuickUi;
|
QSet<int> m_disabledMessagesForNonQuickUi;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class QmllsSettingsManager : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
static QmllsSettingsManager *instance();
|
||||||
|
|
||||||
|
Utils::FilePath latestQmlls();
|
||||||
|
void setupAutoupdate();
|
||||||
|
|
||||||
|
bool useQmlls() const;
|
||||||
|
bool useLatestQmlls() const;
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void checkForChanges();
|
||||||
|
signals:
|
||||||
|
void settingsChanged();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QMutex m_mutex;
|
||||||
|
bool m_useQmlls = true;
|
||||||
|
bool m_useLatestQmlls = false;
|
||||||
|
bool m_disableBuiltinCodemodel = false;
|
||||||
|
bool m_generateQmllsIniFiles = false;
|
||||||
|
Utils::FilePath m_latestQmlls;
|
||||||
|
};
|
||||||
|
|
||||||
QmlJsEditingSettings &settings();
|
QmlJsEditingSettings &settings();
|
||||||
|
|
||||||
class QmlJsEditingSettingsPage : public Core::IOptionsPage
|
class QmlJsEditingSettingsPage : public Core::IOptionsPage
|
||||||
|
|||||||
@@ -1,130 +0,0 @@
|
|||||||
// Copyright (C) 2022 The Qt Company Ltd.
|
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
||||||
|
|
||||||
#include "qmllssettings.h"
|
|
||||||
#include "qmljseditorsettings.h"
|
|
||||||
|
|
||||||
#include <utils/hostosinfo.h>
|
|
||||||
#include <qmljs/qmljsmodelmanagerinterface.h>
|
|
||||||
|
|
||||||
#include <QLoggingCategory>
|
|
||||||
#include <qtsupport/qtversionmanager.h>
|
|
||||||
|
|
||||||
#include <nanotrace/nanotrace.h>
|
|
||||||
|
|
||||||
#include <limits>
|
|
||||||
|
|
||||||
using namespace QtSupport;
|
|
||||||
using namespace Utils;
|
|
||||||
|
|
||||||
namespace QmlJSEditor::Internal {
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
Q_LOGGING_CATEGORY(qmllsLog, "qtc.qmlls.settings", QtWarningMsg);
|
|
||||||
}
|
|
||||||
|
|
||||||
static FilePath evaluateLatestQmlls()
|
|
||||||
{
|
|
||||||
// find latest qmlls, i.e. vals
|
|
||||||
if (!QtVersionManager::isLoaded())
|
|
||||||
return {};
|
|
||||||
const QtVersions versions = QtVersionManager::versions();
|
|
||||||
FilePath latestQmlls;
|
|
||||||
QVersionNumber latestVersion;
|
|
||||||
FilePath latestQmakeFilePath;
|
|
||||||
int latestUniqueId = std::numeric_limits<int>::min();
|
|
||||||
const bool ignoreMinimumQmllsVersion
|
|
||||||
= QmllsSettingsManager::instance()->ignoreMinimumQmllsVersion();
|
|
||||||
for (QtVersion *v : versions) {
|
|
||||||
// check if we find qmlls
|
|
||||||
QVersionNumber vNow = v->qtVersion();
|
|
||||||
if (!ignoreMinimumQmllsVersion && vNow < QmllsSettingsManager::mininumQmllsVersion)
|
|
||||||
continue;
|
|
||||||
FilePath qmllsNow = QmlJS::ModelManagerInterface::qmllsForBinPath(v->hostBinPath(), vNow);
|
|
||||||
if (!qmllsNow.isExecutableFile())
|
|
||||||
continue;
|
|
||||||
if (latestVersion > vNow)
|
|
||||||
continue;
|
|
||||||
FilePath qmakeNow = v->qmakeFilePath();
|
|
||||||
int uniqueIdNow = v->uniqueId();
|
|
||||||
if (latestVersion == vNow) {
|
|
||||||
if (latestQmakeFilePath > qmakeNow)
|
|
||||||
continue;
|
|
||||||
if (latestQmakeFilePath == qmakeNow && latestUniqueId >= v->uniqueId())
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
latestVersion = vNow;
|
|
||||||
latestQmlls = qmllsNow;
|
|
||||||
latestQmakeFilePath = qmakeNow;
|
|
||||||
latestUniqueId = uniqueIdNow;
|
|
||||||
}
|
|
||||||
return latestQmlls;
|
|
||||||
}
|
|
||||||
|
|
||||||
QmllsSettingsManager *QmllsSettingsManager::instance()
|
|
||||||
{
|
|
||||||
static QmllsSettingsManager *manager = new QmllsSettingsManager;
|
|
||||||
return manager;
|
|
||||||
}
|
|
||||||
|
|
||||||
FilePath QmllsSettingsManager::latestQmlls()
|
|
||||||
{
|
|
||||||
QMutexLocker l(&m_mutex);
|
|
||||||
return m_latestQmlls;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QmllsSettingsManager::setupAutoupdate()
|
|
||||||
{
|
|
||||||
QObject::connect(QtVersionManager::instance(),
|
|
||||||
&QtVersionManager::qtVersionsChanged,
|
|
||||||
this,
|
|
||||||
&QmllsSettingsManager::checkForChanges);
|
|
||||||
if (QtVersionManager::isLoaded())
|
|
||||||
checkForChanges();
|
|
||||||
else
|
|
||||||
QObject::connect(QtVersionManager::instance(),
|
|
||||||
&QtVersionManager::qtVersionsLoaded,
|
|
||||||
this,
|
|
||||||
&QmllsSettingsManager::checkForChanges);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QmllsSettingsManager::checkForChanges()
|
|
||||||
{
|
|
||||||
const QmlJsEditingSettings &newSettings = settings();
|
|
||||||
FilePath newLatest = newSettings.useLatestQmlls() && newSettings.useQmlls()
|
|
||||||
? evaluateLatestQmlls() : m_latestQmlls;
|
|
||||||
if (m_useQmlls == newSettings.useQmlls()
|
|
||||||
&& m_useLatestQmlls == newSettings.useLatestQmlls()
|
|
||||||
&& m_disableBuiltinCodemodel == newSettings.disableBuiltinCodemodel()
|
|
||||||
&& m_generateQmllsIniFiles == newSettings.generateQmllsIniFiles()
|
|
||||||
&& newLatest == m_latestQmlls)
|
|
||||||
return;
|
|
||||||
qCDebug(qmllsLog) << "qmlls settings changed:" << newSettings.useQmlls()
|
|
||||||
<< newSettings.useLatestQmlls() << newLatest;
|
|
||||||
{
|
|
||||||
QMutexLocker l(&m_mutex);
|
|
||||||
m_latestQmlls = newLatest;
|
|
||||||
m_useQmlls = newSettings.useQmlls();
|
|
||||||
m_useLatestQmlls = newSettings.useLatestQmlls();
|
|
||||||
m_disableBuiltinCodemodel = newSettings.disableBuiltinCodemodel();
|
|
||||||
m_generateQmllsIniFiles = newSettings.generateQmllsIniFiles();
|
|
||||||
}
|
|
||||||
emit settingsChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool QmllsSettingsManager::useLatestQmlls() const
|
|
||||||
{
|
|
||||||
return m_useLatestQmlls;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool QmllsSettingsManager::ignoreMinimumQmllsVersion() const
|
|
||||||
{
|
|
||||||
return m_ignoreMinimumQmllsVersion;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool QmllsSettingsManager::useQmlls() const
|
|
||||||
{
|
|
||||||
return m_useQmlls;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // QmlJSEditor::Internal
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
// Copyright (C) 2022 The Qt Company Ltd.
|
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <utils/filepath.h>
|
|
||||||
|
|
||||||
#include <QMutex>
|
|
||||||
#include <QObject>
|
|
||||||
#include <QVersionNumber>
|
|
||||||
|
|
||||||
namespace QmlJSEditor::Internal {
|
|
||||||
|
|
||||||
class QmllsSettingsManager : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
static const inline QVersionNumber mininumQmllsVersion = QVersionNumber(6, 8);
|
|
||||||
|
|
||||||
static QmllsSettingsManager *instance();
|
|
||||||
|
|
||||||
Utils::FilePath latestQmlls();
|
|
||||||
void setupAutoupdate();
|
|
||||||
|
|
||||||
bool useQmlls() const;
|
|
||||||
bool useLatestQmlls() const;
|
|
||||||
bool ignoreMinimumQmllsVersion() const;
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
void checkForChanges();
|
|
||||||
signals:
|
|
||||||
void settingsChanged();
|
|
||||||
|
|
||||||
private:
|
|
||||||
QMutex m_mutex;
|
|
||||||
bool m_useQmlls = true;
|
|
||||||
bool m_useLatestQmlls = false;
|
|
||||||
bool m_ignoreMinimumQmllsVersion = false;
|
|
||||||
bool m_disableBuiltinCodemodel = false;
|
|
||||||
bool m_generateQmllsIniFiles = false;
|
|
||||||
Utils::FilePath m_latestQmlls;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // QmlJSEditor::Internal
|
|
||||||
Reference in New Issue
Block a user