forked from qt-creator/qt-creator
QmlJsEditor: Start aspectification of settings
Rename qmljseditingsettingspage.* to qmljseditorsettings.*, re-arrange some includes, use settings() for the singleton access etc. Change-Id: Iff36a99baf0afd238a935386e9111818be5d7987 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -9,7 +9,7 @@ add_qtc_plugin(QmlJSEditor
|
|||||||
qmljscompletionassist.cpp qmljscompletionassist.h
|
qmljscompletionassist.cpp qmljscompletionassist.h
|
||||||
qmljscomponentfromobjectdef.cpp qmljscomponentfromobjectdef.h
|
qmljscomponentfromobjectdef.cpp qmljscomponentfromobjectdef.h
|
||||||
qmljscomponentnamedialog.cpp qmljscomponentnamedialog.h
|
qmljscomponentnamedialog.cpp qmljscomponentnamedialog.h
|
||||||
qmljseditingsettingspage.cpp qmljseditingsettingspage.h
|
qmljseditorsettings.cpp qmljseditorsettings.h
|
||||||
qmljseditor.cpp qmljseditor.h
|
qmljseditor.cpp qmljseditor.h
|
||||||
qmljseditor_global.h
|
qmljseditor_global.h
|
||||||
qmljseditortr.h
|
qmljseditortr.h
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
#include "qmljsautocompleter.h"
|
#include "qmljsautocompleter.h"
|
||||||
#include "qmljscompletionassist.h"
|
#include "qmljscompletionassist.h"
|
||||||
#include "qmljseditingsettingspage.h"
|
#include "qmljseditorsettings.h"
|
||||||
#include "qmljseditorconstants.h"
|
#include "qmljseditorconstants.h"
|
||||||
#include "qmljseditordocument.h"
|
#include "qmljseditordocument.h"
|
||||||
#include "qmljseditorplugin.h"
|
#include "qmljseditorplugin.h"
|
||||||
@@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include <qmljstools/qmljsindenter.h>
|
#include <qmljstools/qmljsindenter.h>
|
||||||
#include <qmljstools/qmljstoolsconstants.h>
|
#include <qmljstools/qmljstoolsconstants.h>
|
||||||
|
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
#include <projectexplorer/projectnodes.h>
|
#include <projectexplorer/projectnodes.h>
|
||||||
@@ -88,6 +89,7 @@ const char QT_QUICK_TOOLBAR_MARKER_ID[] = "QtQuickToolbarMarkerId";
|
|||||||
using namespace Core;
|
using namespace Core;
|
||||||
using namespace QmlJS;
|
using namespace QmlJS;
|
||||||
using namespace QmlJS::AST;
|
using namespace QmlJS::AST;
|
||||||
|
using namespace QmlJSEditor::Internal;
|
||||||
using namespace QmlJSTools;
|
using namespace QmlJSTools;
|
||||||
using namespace TextEditor;
|
using namespace TextEditor;
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
@@ -97,8 +99,7 @@ namespace QmlJSEditor {
|
|||||||
static LanguageClient::Client *getQmllsClient(const Utils::FilePath &fileName)
|
static LanguageClient::Client *getQmllsClient(const Utils::FilePath &fileName)
|
||||||
{
|
{
|
||||||
// the value in disableBuiltinCodemodel is only valid when useQmlls is enabled
|
// the value in disableBuiltinCodemodel is only valid when useQmlls is enabled
|
||||||
if (QmlJsEditingSettings::get().useQmlls()
|
if (settings().useQmlls() && !settings().disableBuiltinCodemodel())
|
||||||
&& !QmlJsEditingSettings::get().disableBuiltinCodemodel())
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
auto client = LanguageClient::LanguageClientManager::clientForFilePath(fileName);
|
auto client = LanguageClient::LanguageClientManager::clientForFilePath(fileName);
|
||||||
@@ -163,7 +164,7 @@ void QmlJSEditorWidget::restoreState(const QByteArray &state)
|
|||||||
using namespace Utils::Constants;
|
using namespace Utils::Constants;
|
||||||
QStringList qmlTypes = {QML_MIMETYPE, QBS_MIMETYPE, QMLTYPES_MIMETYPE, QMLUI_MIMETYPE};
|
QStringList qmlTypes = {QML_MIMETYPE, QBS_MIMETYPE, QMLTYPES_MIMETYPE, QMLUI_MIMETYPE};
|
||||||
|
|
||||||
if (QmlJsEditingSettings::get().foldAuxData() && qmlTypes.contains(textDocument()->mimeType())) {
|
if (settings().foldAuxData() && qmlTypes.contains(textDocument()->mimeType())) {
|
||||||
int version = 0;
|
int version = 0;
|
||||||
QDataStream stream(state);
|
QDataStream stream(state);
|
||||||
stream >> version;
|
stream >> version;
|
||||||
|
@@ -31,8 +31,8 @@ QtcPlugin {
|
|||||||
"qmljscomponentfromobjectdef.h",
|
"qmljscomponentfromobjectdef.h",
|
||||||
"qmljscomponentnamedialog.cpp",
|
"qmljscomponentnamedialog.cpp",
|
||||||
"qmljscomponentnamedialog.h",
|
"qmljscomponentnamedialog.h",
|
||||||
"qmljseditingsettingspage.cpp",
|
"qmljseditorsettings.cpp",
|
||||||
"qmljseditingsettingspage.h",
|
"qmljseditorsettings.h",
|
||||||
"qmljseditor.cpp",
|
"qmljseditor.cpp",
|
||||||
"qmljseditor.h",
|
"qmljseditor.h",
|
||||||
"qmljseditor_global.h", "qmljseditortr.h",
|
"qmljseditor_global.h", "qmljseditortr.h",
|
||||||
|
@@ -3,9 +3,9 @@
|
|||||||
|
|
||||||
#include "qmljseditorplugin.h"
|
#include "qmljseditorplugin.h"
|
||||||
|
|
||||||
#include "qmljseditingsettingspage.h"
|
|
||||||
#include "qmljseditorconstants.h"
|
#include "qmljseditorconstants.h"
|
||||||
#include "qmljseditordocument.h"
|
#include "qmljseditordocument.h"
|
||||||
|
#include "qmljseditorsettings.h"
|
||||||
#include "qmljseditortr.h"
|
#include "qmljseditortr.h"
|
||||||
#include "qmljsoutline.h"
|
#include "qmljsoutline.h"
|
||||||
#include "qmljsquickfixassist.h"
|
#include "qmljsquickfixassist.h"
|
||||||
@@ -183,13 +183,13 @@ QmlJS::JsonSchemaManager *jsonManager()
|
|||||||
void QmlJSEditorPluginPrivate::reformatFile()
|
void QmlJSEditorPluginPrivate::reformatFile()
|
||||||
{
|
{
|
||||||
if (m_currentDocument) {
|
if (m_currentDocument) {
|
||||||
if (QmlJsEditingSettings::get().useCustomFormatCommand()) {
|
if (settings().useCustomFormatCommand()) {
|
||||||
QString formatCommand = QmlJsEditingSettings::get().formatCommand();
|
QString formatCommand = settings().formatCommand();
|
||||||
if (formatCommand.isEmpty())
|
if (formatCommand.isEmpty())
|
||||||
formatCommand = QmlJsEditingSettings::get().defaultFormatCommand();
|
formatCommand = settings().defaultFormatCommand();
|
||||||
const auto exe = FilePath::fromUserInput(globalMacroExpander()->expand(formatCommand));
|
const auto exe = FilePath::fromUserInput(globalMacroExpander()->expand(formatCommand));
|
||||||
const QString args = globalMacroExpander()->expand(
|
const QString args = globalMacroExpander()->expand(
|
||||||
QmlJsEditingSettings::get().formatCommandOptions());
|
settings().formatCommandOptions());
|
||||||
const CommandLine commandLine(exe, args, CommandLine::Raw);
|
const CommandLine commandLine(exe, args, CommandLine::Raw);
|
||||||
TextEditor::Command command;
|
TextEditor::Command command;
|
||||||
command.setExecutable(commandLine.executable());
|
command.setExecutable(commandLine.executable());
|
||||||
@@ -296,7 +296,7 @@ void QmlJSEditorPluginPrivate::checkCurrentEditorSemanticInfoUpToDate()
|
|||||||
|
|
||||||
void QmlJSEditorPluginPrivate::autoFormatOnSave(IDocument *document)
|
void QmlJSEditorPluginPrivate::autoFormatOnSave(IDocument *document)
|
||||||
{
|
{
|
||||||
if (!QmlJsEditingSettings::get().autoFormatOnSave())
|
if (!settings().autoFormatOnSave())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Check that we are dealing with a QML/JS editor
|
// Check that we are dealing with a QML/JS editor
|
||||||
@@ -305,7 +305,7 @@ void QmlJSEditorPluginPrivate::autoFormatOnSave(IDocument *document)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Check if file is contained in the current project (if wished)
|
// Check if file is contained in the current project (if wished)
|
||||||
if (QmlJsEditingSettings::get().autoFormatOnlyCurrentProject()) {
|
if (settings().autoFormatOnlyCurrentProject()) {
|
||||||
const Project *pro = ProjectTree::currentProject();
|
const Project *pro = ProjectTree::currentProject();
|
||||||
if (!pro || !pro->files(Project::SourceFiles).contains(document->filePath()))
|
if (!pro || !pro->files(Project::SourceFiles).contains(document->filePath()))
|
||||||
return;
|
return;
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Copyright (C) 2016 The Qt Company Ltd.
|
// Copyright (C) 2016 The Qt Company Ltd.
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||||
|
|
||||||
#include "qmljseditingsettingspage.h"
|
#include "qmljseditorsettings.h"
|
||||||
#include "qmljseditorconstants.h"
|
#include "qmljseditorconstants.h"
|
||||||
#include "qmljseditortr.h"
|
#include "qmljseditortr.h"
|
||||||
|
|
||||||
@@ -50,7 +50,13 @@ const char DEFAULT_CUSTOM_FORMAT_COMMAND[] = "%{CurrentDocument:Project:QT_HOST_
|
|||||||
using namespace QmlJSEditor::Internal;
|
using namespace QmlJSEditor::Internal;
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
|
||||||
namespace QmlJSEditor {
|
namespace QmlJSEditor::Internal {
|
||||||
|
|
||||||
|
QmlJsEditingSettings &settings()
|
||||||
|
{
|
||||||
|
static QmlJsEditingSettings settings;
|
||||||
|
return settings;
|
||||||
|
}
|
||||||
|
|
||||||
static QList<int> defaultDisabledMessages()
|
static QList<int> defaultDisabledMessages()
|
||||||
{
|
{
|
||||||
@@ -68,18 +74,12 @@ static QList<int> defaultDisabledMessagesNonQuickUi()
|
|||||||
return disabledForNonQuickUi;
|
return disabledForNonQuickUi;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlJsEditingSettings::set()
|
|
||||||
{
|
|
||||||
if (get() != *this)
|
|
||||||
toSettings(Core::ICore::settings());
|
|
||||||
}
|
|
||||||
|
|
||||||
static QStringList intListToStringList(const QList<int> &list)
|
static QStringList intListToStringList(const QList<int> &list)
|
||||||
{
|
{
|
||||||
return Utils::transform(list, [](int v) { return QString::number(v); });
|
return Utils::transform(list, [](int v) { return QString::number(v); });
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<int> intListFromStringList(const QStringList &list)
|
static QList<int> intListFromStringList(const QStringList &list)
|
||||||
{
|
{
|
||||||
return Utils::transform<QList<int> >(list, [](const QString &v) { return v.toInt(); });
|
return Utils::transform<QList<int> >(list, [](const QString &v) { return v.toInt(); });
|
||||||
}
|
}
|
||||||
@@ -96,8 +96,10 @@ static QStringList defaultDisabledNonQuickUiAsString()
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlJsEditingSettings::fromSettings(QtcSettings *settings)
|
QmlJsEditingSettings::QmlJsEditingSettings()
|
||||||
{
|
{
|
||||||
|
QtcSettings *settings = Core::ICore::settings();
|
||||||
|
|
||||||
settings->beginGroup(QmlJSEditor::Constants::SETTINGS_CATEGORY_QML);
|
settings->beginGroup(QmlJSEditor::Constants::SETTINGS_CATEGORY_QML);
|
||||||
m_enableContextPane = settings->value(QML_CONTEXTPANE_KEY, QVariant(false)).toBool();
|
m_enableContextPane = settings->value(QML_CONTEXTPANE_KEY, QVariant(false)).toBool();
|
||||||
m_pinContextPane = settings->value(QML_CONTEXTPANEPIN_KEY, QVariant(false)).toBool();
|
m_pinContextPane = settings->value(QML_CONTEXTPANEPIN_KEY, QVariant(false)).toBool();
|
||||||
@@ -413,7 +415,7 @@ class QmlJsEditingSettingsPageWidget final : public Core::IOptionsPageWidget
|
|||||||
public:
|
public:
|
||||||
QmlJsEditingSettingsPageWidget()
|
QmlJsEditingSettingsPageWidget()
|
||||||
{
|
{
|
||||||
auto s = QmlJsEditingSettings::get();
|
const QmlJsEditingSettings &s = settings();
|
||||||
autoFormatOnSave = new QCheckBox(Tr::tr("Enable auto format on file save"));
|
autoFormatOnSave = new QCheckBox(Tr::tr("Enable auto format on file save"));
|
||||||
autoFormatOnSave->setChecked(s.autoFormatOnSave());
|
autoFormatOnSave->setChecked(s.autoFormatOnSave());
|
||||||
autoFormatOnlyCurrentProject =
|
autoFormatOnlyCurrentProject =
|
||||||
@@ -557,7 +559,7 @@ public:
|
|||||||
|
|
||||||
void apply() final
|
void apply() final
|
||||||
{
|
{
|
||||||
QmlJsEditingSettings s;
|
QmlJsEditingSettings &s = settings();
|
||||||
s.setEnableContextPane(enableContextPane->isChecked());
|
s.setEnableContextPane(enableContextPane->isChecked());
|
||||||
s.setPinContextPane(pinContextPane->isChecked());
|
s.setPinContextPane(pinContextPane->isChecked());
|
||||||
s.setAutoFormatOnSave(autoFormatOnSave->isChecked());
|
s.setAutoFormatOnSave(autoFormatOnSave->isChecked());
|
||||||
@@ -584,7 +586,7 @@ public:
|
|||||||
});
|
});
|
||||||
s.setDisabledMessages(disabled);
|
s.setDisabledMessages(disabled);
|
||||||
s.setDisabledMessagesForNonQuickUi(disabledForNonQuickUi);
|
s.setDisabledMessagesForNonQuickUi(disabledForNonQuickUi);
|
||||||
s.set();
|
s.toSettings(Core::ICore::settings());
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -638,14 +640,6 @@ private:
|
|||||||
Utils::TreeModel<AnalyzerMessageItem> *analyzerMessageModel;
|
Utils::TreeModel<AnalyzerMessageItem> *analyzerMessageModel;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
QmlJsEditingSettings QmlJsEditingSettings::get()
|
|
||||||
{
|
|
||||||
QmlJsEditingSettings settings;
|
|
||||||
settings.fromSettings(Core::ICore::settings());
|
|
||||||
return settings;
|
|
||||||
}
|
|
||||||
|
|
||||||
QmlJsEditingSettingsPage::QmlJsEditingSettingsPage()
|
QmlJsEditingSettingsPage::QmlJsEditingSettingsPage()
|
||||||
{
|
{
|
||||||
setId("C.QmlJsEditing");
|
setId("C.QmlJsEditing");
|
||||||
@@ -654,4 +648,4 @@ QmlJsEditingSettingsPage::QmlJsEditingSettingsPage()
|
|||||||
setWidgetCreator([] { return new QmlJsEditingSettingsPageWidget; });
|
setWidgetCreator([] { return new QmlJsEditingSettingsPageWidget; });
|
||||||
}
|
}
|
||||||
|
|
||||||
} // QmlJsEditor
|
} // QmlJsEditor::Internal
|
@@ -10,17 +10,13 @@
|
|||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
namespace QmlJSEditor {
|
namespace QmlJSEditor::Internal {
|
||||||
|
|
||||||
class QmlJsEditingSettings
|
class QmlJsEditingSettings
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QmlJsEditingSettings() = default;
|
QmlJsEditingSettings();
|
||||||
|
|
||||||
static QmlJsEditingSettings get();
|
|
||||||
void set();
|
|
||||||
|
|
||||||
void fromSettings(Utils::QtcSettings *);
|
|
||||||
void toSettings(Utils::QtcSettings *) const;
|
void toSettings(Utils::QtcSettings *) const;
|
||||||
|
|
||||||
bool equals(const QmlJsEditingSettings &other) const;
|
bool equals(const QmlJsEditingSettings &other) const;
|
||||||
@@ -102,7 +98,7 @@ private:
|
|||||||
QSet<int> m_disabledMessagesForNonQuickUi;
|
QSet<int> m_disabledMessagesForNonQuickUi;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace Internal {
|
QmlJsEditingSettings &settings();
|
||||||
|
|
||||||
class QmlJsEditingSettingsPage : public Core::IOptionsPage
|
class QmlJsEditingSettingsPage : public Core::IOptionsPage
|
||||||
{
|
{
|
||||||
@@ -110,5 +106,4 @@ public:
|
|||||||
QmlJsEditingSettingsPage();
|
QmlJsEditingSettingsPage();
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // QmlJSEditor::Internal
|
||||||
} // namespace QmlDesigner
|
|
@@ -1,21 +1,21 @@
|
|||||||
// Copyright (C) 2016 The Qt Company Ltd.
|
// Copyright (C) 2016 The Qt Company Ltd.
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||||
|
|
||||||
#include "qmlexpressionundercursor.h"
|
|
||||||
#include "qmljseditor.h"
|
|
||||||
#include "qmljseditorconstants.h"
|
|
||||||
#include "qmljseditordocument.h"
|
|
||||||
#include "qmljseditortr.h"
|
|
||||||
#include "qmljshoverhandler.h"
|
#include "qmljshoverhandler.h"
|
||||||
#include "qmljseditingsettingspage.h"
|
|
||||||
|
#include "qmljseditor.h"
|
||||||
|
#include "qmljseditordocument.h"
|
||||||
|
#include "qmljseditorsettings.h"
|
||||||
|
#include "qmljseditortr.h"
|
||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/editormanager/ieditor.h>
|
#include <coreplugin/editormanager/ieditor.h>
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <coreplugin/helpitem.h>
|
#include <coreplugin/helpitem.h>
|
||||||
#include <coreplugin/helpmanager.h>
|
#include <coreplugin/helpmanager.h>
|
||||||
#include <utils/qtcassert.h>
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
|
|
||||||
#include <qmljs/qmljscontext.h>
|
#include <qmljs/qmljscontext.h>
|
||||||
#include <qmljs/qmljsscopechain.h>
|
#include <qmljs/qmljsscopechain.h>
|
||||||
#include <qmljs/qmljsinterpreter.h>
|
#include <qmljs/qmljsinterpreter.h>
|
||||||
@@ -23,7 +23,10 @@
|
|||||||
#include <qmljs/parser/qmljsast_p.h>
|
#include <qmljs/parser/qmljsast_p.h>
|
||||||
#include <qmljs/parser/qmljsastfwd_p.h>
|
#include <qmljs/parser/qmljsastfwd_p.h>
|
||||||
#include <qmljs/qmljsutils.h>
|
#include <qmljs/qmljsutils.h>
|
||||||
|
|
||||||
#include <texteditor/texteditor.h>
|
#include <texteditor/texteditor.h>
|
||||||
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/qrcparser.h>
|
#include <utils/qrcparser.h>
|
||||||
#include <utils/tooltip/tooltip.h>
|
#include <utils/tooltip/tooltip.h>
|
||||||
|
|
||||||
@@ -35,6 +38,7 @@
|
|||||||
|
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
using namespace QmlJS;
|
using namespace QmlJS;
|
||||||
|
using namespace QmlJSEditor::Internal;
|
||||||
using namespace TextEditor;
|
using namespace TextEditor;
|
||||||
|
|
||||||
namespace QmlJSEditor {
|
namespace QmlJSEditor {
|
||||||
@@ -375,7 +379,7 @@ void QmlJSHoverHandler::reset()
|
|||||||
void QmlJSHoverHandler::operateTooltip(TextEditorWidget *editorWidget, const QPoint &point)
|
void QmlJSHoverHandler::operateTooltip(TextEditorWidget *editorWidget, const QPoint &point)
|
||||||
{
|
{
|
||||||
// disable hoverhandling in case qmlls is enabled
|
// disable hoverhandling in case qmlls is enabled
|
||||||
if (QmlJsEditingSettings::get().useQmlls()) {
|
if (settings().useQmlls()) {
|
||||||
BaseHoverHandler::operateTooltip(editorWidget, point);
|
BaseHoverHandler::operateTooltip(editorWidget, point);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||||
|
|
||||||
#include "qmllssettings.h"
|
#include "qmllssettings.h"
|
||||||
#include "qmljseditingsettingspage.h"
|
#include "qmljseditorsettings.h"
|
||||||
|
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
#include <qmljs/qmljsmodelmanagerinterface.h>
|
#include <qmljs/qmljsmodelmanagerinterface.h>
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
using namespace QtSupport;
|
using namespace QtSupport;
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
|
||||||
namespace QmlJSEditor {
|
namespace QmlJSEditor::Internal {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
Q_LOGGING_CATEGORY(qmllsLog, "qtc.qmlls.settings", QtWarningMsg);
|
Q_LOGGING_CATEGORY(qmllsLog, "qtc.qmlls.settings", QtWarningMsg);
|
||||||
@@ -90,7 +90,7 @@ void QmllsSettingsManager::setupAutoupdate()
|
|||||||
|
|
||||||
void QmllsSettingsManager::checkForChanges()
|
void QmllsSettingsManager::checkForChanges()
|
||||||
{
|
{
|
||||||
const QmlJsEditingSettings &newSettings = QmlJsEditingSettings::get();
|
const QmlJsEditingSettings &newSettings = settings();
|
||||||
FilePath newLatest = newSettings.useLatestQmlls() && newSettings.useQmlls()
|
FilePath newLatest = newSettings.useLatestQmlls() && newSettings.useQmlls()
|
||||||
? evaluateLatestQmlls() : m_latestQmlls;
|
? evaluateLatestQmlls() : m_latestQmlls;
|
||||||
if (m_useQmlls == newSettings.useQmlls()
|
if (m_useQmlls == newSettings.useQmlls()
|
||||||
@@ -127,4 +127,4 @@ bool QmllsSettingsManager::useQmlls() const
|
|||||||
return m_useQmlls;
|
return m_useQmlls;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace QmlJSEditor
|
} // QmlJSEditor::Internal
|
||||||
|
@@ -3,17 +3,15 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "qmljseditor_global.h"
|
|
||||||
|
|
||||||
#include <utils/filepath.h>
|
#include <utils/filepath.h>
|
||||||
|
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QVersionNumber>
|
#include <QVersionNumber>
|
||||||
|
|
||||||
namespace QmlJSEditor {
|
namespace QmlJSEditor::Internal {
|
||||||
|
|
||||||
class QMLJSEDITOR_EXPORT QmllsSettingsManager : public QObject
|
class QmllsSettingsManager : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@@ -44,4 +42,4 @@ private:
|
|||||||
Utils::FilePath m_latestQmlls;
|
Utils::FilePath m_latestQmlls;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace QmlJSEditor
|
} // QmlJSEditor::Internal
|
||||||
|
@@ -2,7 +2,8 @@
|
|||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||||
|
|
||||||
#include "quicktoolbar.h"
|
#include "quicktoolbar.h"
|
||||||
#include "qmljseditingsettingspage.h"
|
|
||||||
|
#include "qmljseditorsettings.h"
|
||||||
|
|
||||||
#include <utils/changeset.h>
|
#include <utils/changeset.h>
|
||||||
#include <qmleditorwidgets/contextpanewidget.h>
|
#include <qmleditorwidgets/contextpanewidget.h>
|
||||||
@@ -27,6 +28,7 @@
|
|||||||
using namespace QmlJS;
|
using namespace QmlJS;
|
||||||
using namespace AST;
|
using namespace AST;
|
||||||
using namespace QmlEditorWidgets;
|
using namespace QmlEditorWidgets;
|
||||||
|
using namespace QmlJSEditor::Internal;
|
||||||
|
|
||||||
namespace QmlJSEditor {
|
namespace QmlJSEditor {
|
||||||
|
|
||||||
@@ -94,7 +96,7 @@ QuickToolBar *QuickToolBar::instance()
|
|||||||
|
|
||||||
void QuickToolBar::apply(TextEditor::TextEditorWidget *editorWidget, Document::Ptr document, const ScopeChain *scopeChain, Node *node, bool update, bool force)
|
void QuickToolBar::apply(TextEditor::TextEditorWidget *editorWidget, Document::Ptr document, const ScopeChain *scopeChain, Node *node, bool update, bool force)
|
||||||
{
|
{
|
||||||
if (!QmlJsEditingSettings::get().enableContextPane() && !force && !update) {
|
if (!settings().enableContextPane() && !force && !update) {
|
||||||
contextWidget()->hide();
|
contextWidget()->hide();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -199,10 +201,10 @@ void QuickToolBar::apply(TextEditor::TextEditorWidget *editorWidget, Document::P
|
|||||||
if (!update)
|
if (!update)
|
||||||
contextWidget()->setType(m_prototypes);
|
contextWidget()->setType(m_prototypes);
|
||||||
if (!update)
|
if (!update)
|
||||||
contextWidget()->activate(p3 , p1, p2, QmlJsEditingSettings::get().pinContextPane());
|
contextWidget()->activate(p3 , p1, p2, settings().pinContextPane());
|
||||||
else
|
else
|
||||||
contextWidget()->rePosition(p3 , p1, p2, QmlJsEditingSettings::get().pinContextPane());
|
contextWidget()->rePosition(p3 , p1, p2, settings().pinContextPane());
|
||||||
contextWidget()->setOptions(QmlJsEditingSettings::get().enableContextPane(), QmlJsEditingSettings::get().pinContextPane());
|
contextWidget()->setOptions(settings().enableContextPane(), settings().pinContextPane());
|
||||||
contextWidget()->setPath(document->path().toString());
|
contextWidget()->setPath(document->path().toString());
|
||||||
contextWidget()->setProperties(&propertyReader);
|
contextWidget()->setProperties(&propertyReader);
|
||||||
m_doc = document;
|
m_doc = document;
|
||||||
@@ -381,17 +383,13 @@ void QuickToolBar::onPropertyRemovedAndChange(const QString &remove, const QStri
|
|||||||
|
|
||||||
void QuickToolBar::onPinnedChanged(bool b)
|
void QuickToolBar::onPinnedChanged(bool b)
|
||||||
{
|
{
|
||||||
QmlJsEditingSettings settings = QmlJsEditingSettings::get();
|
settings().setPinContextPane(b);
|
||||||
settings.setPinContextPane(b);
|
|
||||||
settings.set();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuickToolBar::onEnabledChanged(bool b)
|
void QuickToolBar::onEnabledChanged(bool b)
|
||||||
{
|
{
|
||||||
QmlJsEditingSettings settings = QmlJsEditingSettings::get();
|
settings().setPinContextPane(b);
|
||||||
settings.setPinContextPane(b);
|
settings().setEnableContextPane(b);
|
||||||
settings.setEnableContextPane(b);
|
|
||||||
settings.set();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuickToolBar::indentLines(int startLine, int endLine)
|
void QuickToolBar::indentLines(int startLine, int endLine)
|
||||||
|
Reference in New Issue
Block a user