forked from qt-creator/qt-creator
QmlJSTools: Modernize
modernize-* Change-Id: Ifc270455ab7500d18798ac0130744662ad3303fb Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -47,8 +47,8 @@ class QMLJSTOOLS_EXPORT IBundleProvider : public QObject
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit IBundleProvider(QObject *parent = 0);
|
explicit IBundleProvider(QObject *parent = nullptr);
|
||||||
~IBundleProvider();
|
~IBundleProvider() override;
|
||||||
|
|
||||||
static const QList<IBundleProvider *> allBundleProviders();
|
static const QList<IBundleProvider *> allBundleProviders();
|
||||||
|
|
||||||
@@ -60,10 +60,10 @@ class QMLJSTOOLS_EXPORT BasicBundleProvider : public IBundleProvider
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit BasicBundleProvider(QObject *parent = 0);
|
explicit BasicBundleProvider(QObject *parent = nullptr);
|
||||||
|
|
||||||
virtual void mergeBundlesForKit(ProjectExplorer::Kit *kit, QmlJS::QmlLanguageBundles &bundles
|
void mergeBundlesForKit(ProjectExplorer::Kit *kit, QmlJS::QmlLanguageBundles &bundles,
|
||||||
, const QHash<QString,QString> &replacements);
|
const QHash<QString,QString> &replacements) override;
|
||||||
|
|
||||||
static QmlJS::QmlBundle defaultBundle(const QString &bundleInfoName);
|
static QmlJS::QmlBundle defaultBundle(const QString &bundleInfoName);
|
||||||
static QmlJS::QmlBundle defaultQt5QtQuick2Bundle();
|
static QmlJS::QmlBundle defaultQt5QtQuick2Bundle();
|
||||||
|
@@ -54,9 +54,7 @@ static const char *defaultPreviewText =
|
|||||||
" }\n"
|
" }\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
|
|
||||||
QmlJSCodeStylePreferencesFactory::QmlJSCodeStylePreferencesFactory()
|
QmlJSCodeStylePreferencesFactory::QmlJSCodeStylePreferencesFactory() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
Core::Id QmlJSCodeStylePreferencesFactory::languageId()
|
Core::Id QmlJSCodeStylePreferencesFactory::languageId()
|
||||||
{
|
{
|
||||||
@@ -76,7 +74,7 @@ TextEditor::ICodeStylePreferences *QmlJSCodeStylePreferencesFactory::createCodeS
|
|||||||
QWidget *QmlJSCodeStylePreferencesFactory::createEditor(TextEditor::ICodeStylePreferences *preferences,
|
QWidget *QmlJSCodeStylePreferencesFactory::createEditor(TextEditor::ICodeStylePreferences *preferences,
|
||||||
QWidget *parent) const
|
QWidget *parent) const
|
||||||
{
|
{
|
||||||
Internal::QmlJSCodeStylePreferencesWidget *widget = new Internal::QmlJSCodeStylePreferencesWidget(parent);
|
auto widget = new Internal::QmlJSCodeStylePreferencesWidget(parent);
|
||||||
widget->layout()->setMargin(0);
|
widget->layout()->setMargin(0);
|
||||||
widget->setPreferences(preferences);
|
widget->setPreferences(preferences);
|
||||||
return widget;
|
return widget;
|
||||||
|
@@ -34,14 +34,14 @@ class QmlJSCodeStylePreferencesFactory : public TextEditor::ICodeStylePreference
|
|||||||
public:
|
public:
|
||||||
QmlJSCodeStylePreferencesFactory();
|
QmlJSCodeStylePreferencesFactory();
|
||||||
|
|
||||||
Core::Id languageId();
|
Core::Id languageId() override;
|
||||||
QString displayName();
|
QString displayName() override;
|
||||||
TextEditor::ICodeStylePreferences *createCodeStyle() const;
|
TextEditor::ICodeStylePreferences *createCodeStyle() const override;
|
||||||
QWidget *createEditor(TextEditor::ICodeStylePreferences *settings,
|
QWidget *createEditor(TextEditor::ICodeStylePreferences *settings,
|
||||||
QWidget *parent) const;
|
QWidget *parent) const override;
|
||||||
TextEditor::Indenter *createIndenter() const;
|
TextEditor::Indenter *createIndenter() const override;
|
||||||
QString snippetProviderGroupId() const;
|
QString snippetProviderGroupId() const override;
|
||||||
QString previewText() const;
|
QString previewText() const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace QmlJSTools
|
} // namespace QmlJSTools
|
||||||
|
@@ -51,7 +51,6 @@ namespace Internal {
|
|||||||
|
|
||||||
QmlJSCodeStylePreferencesWidget::QmlJSCodeStylePreferencesWidget(QWidget *parent) :
|
QmlJSCodeStylePreferencesWidget::QmlJSCodeStylePreferencesWidget(QWidget *parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
m_preferences(0),
|
|
||||||
m_ui(new Ui::QmlJSCodeStyleSettingsPage)
|
m_ui(new Ui::QmlJSCodeStyleSettingsPage)
|
||||||
{
|
{
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
@@ -125,8 +124,7 @@ void QmlJSCodeStylePreferencesWidget::updatePreview()
|
|||||||
|
|
||||||
QmlJSCodeStyleSettingsPage::QmlJSCodeStyleSettingsPage(/*QSharedPointer<CppFileSettings> &settings,*/
|
QmlJSCodeStyleSettingsPage::QmlJSCodeStyleSettingsPage(/*QSharedPointer<CppFileSettings> &settings,*/
|
||||||
QWidget *parent) :
|
QWidget *parent) :
|
||||||
Core::IOptionsPage(parent),
|
Core::IOptionsPage(parent)
|
||||||
m_pageTabPreferences(0)
|
|
||||||
{
|
{
|
||||||
setId(Constants::QML_JS_CODE_STYLE_SETTINGS_ID);
|
setId(Constants::QML_JS_CODE_STYLE_SETTINGS_ID);
|
||||||
setDisplayName(QCoreApplication::translate("QmlJSTools", Constants::QML_JS_CODE_STYLE_SETTINGS_NAME));
|
setDisplayName(QCoreApplication::translate("QmlJSTools", Constants::QML_JS_CODE_STYLE_SETTINGS_NAME));
|
||||||
|
@@ -50,8 +50,8 @@ class QmlJSCodeStylePreferencesWidget : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit QmlJSCodeStylePreferencesWidget(QWidget *parent = 0);
|
explicit QmlJSCodeStylePreferencesWidget(QWidget *parent = nullptr);
|
||||||
~QmlJSCodeStylePreferencesWidget();
|
~QmlJSCodeStylePreferencesWidget() override;
|
||||||
|
|
||||||
void setPreferences(TextEditor::ICodeStylePreferences *preferences);
|
void setPreferences(TextEditor::ICodeStylePreferences *preferences);
|
||||||
|
|
||||||
@@ -61,7 +61,7 @@ private:
|
|||||||
void slotSettingsChanged();
|
void slotSettingsChanged();
|
||||||
void updatePreview();
|
void updatePreview();
|
||||||
|
|
||||||
TextEditor::ICodeStylePreferences *m_preferences;
|
TextEditor::ICodeStylePreferences *m_preferences = nullptr;
|
||||||
Ui::QmlJSCodeStyleSettingsPage *m_ui;
|
Ui::QmlJSCodeStyleSettingsPage *m_ui;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -71,14 +71,14 @@ class QmlJSCodeStyleSettingsPage : public Core::IOptionsPage
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit QmlJSCodeStyleSettingsPage(QWidget *parent = 0);
|
explicit QmlJSCodeStyleSettingsPage(QWidget *parent = nullptr);
|
||||||
|
|
||||||
QWidget *widget();
|
QWidget *widget() override;
|
||||||
void apply();
|
void apply() override;
|
||||||
void finish();
|
void finish() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TextEditor::ICodeStylePreferences *m_pageTabPreferences;
|
TextEditor::ICodeStylePreferences *m_pageTabPreferences = nullptr;
|
||||||
QPointer<TextEditor::CodeStyleEditor> m_widget;
|
QPointer<TextEditor::CodeStyleEditor> m_widget;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -46,8 +46,7 @@ FunctionFilter::FunctionFilter(LocatorData *data, QObject *parent)
|
|||||||
setIncludedByDefault(false);
|
setIncludedByDefault(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
FunctionFilter::~FunctionFilter()
|
FunctionFilter::~FunctionFilter() = default;
|
||||||
{ }
|
|
||||||
|
|
||||||
void FunctionFilter::refresh(QFutureInterface<void> &)
|
void FunctionFilter::refresh(QFutureInterface<void> &)
|
||||||
{
|
{
|
||||||
|
@@ -37,8 +37,8 @@ class FunctionFilter : public Core::ILocatorFilter
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit FunctionFilter(LocatorData *data, QObject *parent = 0);
|
explicit FunctionFilter(LocatorData *data, QObject *parent = nullptr);
|
||||||
~FunctionFilter();
|
~FunctionFilter() override;
|
||||||
|
|
||||||
QList<Core::LocatorFilterEntry> matchesFor(QFutureInterface<Core::LocatorFilterEntry> &future,
|
QList<Core::LocatorFilterEntry> matchesFor(QFutureInterface<Core::LocatorFilterEntry> &future,
|
||||||
const QString &entry) override;
|
const QString &entry) override;
|
||||||
|
@@ -35,11 +35,9 @@
|
|||||||
using namespace QmlJSEditor;
|
using namespace QmlJSEditor;
|
||||||
using namespace Internal;
|
using namespace Internal;
|
||||||
|
|
||||||
Indenter::Indenter()
|
Indenter::Indenter() = default;
|
||||||
{}
|
|
||||||
|
|
||||||
Indenter::~Indenter()
|
Indenter::~Indenter() = default;
|
||||||
{}
|
|
||||||
|
|
||||||
bool Indenter::isElectricCharacter(const QChar &ch) const
|
bool Indenter::isElectricCharacter(const QChar &ch) const
|
||||||
{
|
{
|
||||||
|
@@ -64,8 +64,7 @@ LocatorData::LocatorData()
|
|||||||
[this] (ProjectExplorer::Project*) { m_entries.clear(); });
|
[this] (ProjectExplorer::Project*) { m_entries.clear(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
LocatorData::~LocatorData()
|
LocatorData::~LocatorData() = default;
|
||||||
{}
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@@ -77,9 +76,6 @@ class FunctionFinder : protected AST::Visitor
|
|||||||
QString m_documentContext;
|
QString m_documentContext;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FunctionFinder()
|
|
||||||
{}
|
|
||||||
|
|
||||||
QList<LocatorData::Entry> run(const Document::Ptr &doc)
|
QList<LocatorData::Entry> run(const Document::Ptr &doc)
|
||||||
{
|
{
|
||||||
m_doc = doc;
|
m_doc = doc;
|
||||||
@@ -116,12 +112,12 @@ protected:
|
|||||||
m_context = old;
|
m_context = old;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool visit(FunctionDeclaration *ast)
|
bool visit(FunctionDeclaration *ast) override
|
||||||
{
|
{
|
||||||
return visit(static_cast<FunctionExpression *>(ast));
|
return visit(static_cast<FunctionExpression *>(ast));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool visit(FunctionExpression *ast)
|
bool visit(FunctionExpression *ast) override
|
||||||
{
|
{
|
||||||
if (ast->name.isEmpty())
|
if (ast->name.isEmpty())
|
||||||
return true;
|
return true;
|
||||||
@@ -146,7 +142,7 @@ protected:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool visit(UiScriptBinding *ast)
|
bool visit(UiScriptBinding *ast) override
|
||||||
{
|
{
|
||||||
if (!ast->qualifiedId)
|
if (!ast->qualifiedId)
|
||||||
return true;
|
return true;
|
||||||
@@ -163,7 +159,7 @@ protected:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool visit(UiObjectBinding *ast)
|
bool visit(UiObjectBinding *ast) override
|
||||||
{
|
{
|
||||||
if (!ast->qualifiedTypeNameId)
|
if (!ast->qualifiedTypeNameId)
|
||||||
return true;
|
return true;
|
||||||
@@ -176,7 +172,7 @@ protected:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool visit(UiObjectDefinition *ast)
|
bool visit(UiObjectDefinition *ast) override
|
||||||
{
|
{
|
||||||
if (!ast->qualifiedTypeNameId)
|
if (!ast->qualifiedTypeNameId)
|
||||||
return true;
|
return true;
|
||||||
@@ -189,7 +185,7 @@ protected:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool visit(AST::BinaryExpression *ast)
|
bool visit(AST::BinaryExpression *ast) override
|
||||||
{
|
{
|
||||||
auto fieldExpr = AST::cast<AST::FieldMemberExpression *>(ast->left);
|
auto fieldExpr = AST::cast<AST::FieldMemberExpression *>(ast->left);
|
||||||
auto funcExpr = AST::cast<AST::FunctionExpression *>(ast->right);
|
auto funcExpr = AST::cast<AST::FunctionExpression *>(ast->right);
|
||||||
|
@@ -39,7 +39,7 @@ class LocatorData : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
LocatorData();
|
LocatorData();
|
||||||
~LocatorData();
|
~LocatorData() override;
|
||||||
|
|
||||||
enum EntryType
|
enum EntryType
|
||||||
{
|
{
|
||||||
|
@@ -145,7 +145,7 @@ ModelManagerInterface::ProjectInfo ModelManager::defaultProjectInfoForProject(
|
|||||||
|
|
||||||
void setupProjectInfoQmlBundles(ModelManagerInterface::ProjectInfo &projectInfo)
|
void setupProjectInfoQmlBundles(ModelManagerInterface::ProjectInfo &projectInfo)
|
||||||
{
|
{
|
||||||
Target *activeTarget = 0;
|
Target *activeTarget = nullptr;
|
||||||
if (projectInfo.project)
|
if (projectInfo.project)
|
||||||
activeTarget = projectInfo.project->activeTarget();
|
activeTarget = projectInfo.project->activeTarget();
|
||||||
Kit *activeKit = activeTarget ? activeTarget->kit() : KitManager::defaultKit();
|
Kit *activeKit = activeTarget ? activeTarget->kit() : KitManager::defaultKit();
|
||||||
@@ -212,9 +212,7 @@ ModelManager::ModelManager()
|
|||||||
loadDefaultQmlTypeDescriptions();
|
loadDefaultQmlTypeDescriptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
ModelManager::~ModelManager()
|
ModelManager::~ModelManager() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void ModelManager::delayedInitialization()
|
void ModelManager::delayedInitialization()
|
||||||
{
|
{
|
||||||
@@ -257,7 +255,7 @@ ModelManagerInterface::WorkingCopy ModelManager::workingCopyInternal() const
|
|||||||
|
|
||||||
foreach (IDocument *document, DocumentModel::openedDocuments()) {
|
foreach (IDocument *document, DocumentModel::openedDocuments()) {
|
||||||
const QString key = document->filePath().toString();
|
const QString key = document->filePath().toString();
|
||||||
if (TextEditor::TextDocument *textDocument = qobject_cast<TextEditor::TextDocument *>(document)) {
|
if (auto textDocument = qobject_cast<const TextEditor::TextDocument *>(document)) {
|
||||||
// TODO the language should be a property on the document, not the editor
|
// TODO the language should be a property on the document, not the editor
|
||||||
if (DocumentModel::editorsForDocument(document).first()
|
if (DocumentModel::editorsForDocument(document).first()
|
||||||
->context().contains(ProjectExplorer::Constants::QMLJS_LANGUAGE_ID)) {
|
->context().contains(ProjectExplorer::Constants::QMLJS_LANGUAGE_ID)) {
|
||||||
|
@@ -31,9 +31,7 @@ using namespace QmlJS;
|
|||||||
using namespace QmlJSTools;
|
using namespace QmlJSTools;
|
||||||
using namespace TextEditor;
|
using namespace TextEditor;
|
||||||
|
|
||||||
CreatorCodeFormatter::CreatorCodeFormatter()
|
CreatorCodeFormatter::CreatorCodeFormatter() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
CreatorCodeFormatter::CreatorCodeFormatter(const TabSettings &tabSettings)
|
CreatorCodeFormatter::CreatorCodeFormatter(const TabSettings &tabSettings)
|
||||||
{
|
{
|
||||||
@@ -44,7 +42,7 @@ CreatorCodeFormatter::CreatorCodeFormatter(const TabSettings &tabSettings)
|
|||||||
void CreatorCodeFormatter::saveBlockData(QTextBlock *block, const BlockData &data) const
|
void CreatorCodeFormatter::saveBlockData(QTextBlock *block, const BlockData &data) const
|
||||||
{
|
{
|
||||||
TextBlockUserData *userData = TextDocumentLayout::userData(*block);
|
TextBlockUserData *userData = TextDocumentLayout::userData(*block);
|
||||||
QmlJSCodeFormatterData *cppData = static_cast<QmlJSCodeFormatterData *>(userData->codeFormatterData());
|
auto cppData = static_cast<QmlJSCodeFormatterData *>(userData->codeFormatterData());
|
||||||
if (!cppData) {
|
if (!cppData) {
|
||||||
cppData = new QmlJSCodeFormatterData;
|
cppData = new QmlJSCodeFormatterData;
|
||||||
userData->setCodeFormatterData(cppData);
|
userData->setCodeFormatterData(cppData);
|
||||||
@@ -57,7 +55,7 @@ bool CreatorCodeFormatter::loadBlockData(const QTextBlock &block, BlockData *dat
|
|||||||
TextBlockUserData *userData = TextDocumentLayout::testUserData(block);
|
TextBlockUserData *userData = TextDocumentLayout::testUserData(block);
|
||||||
if (!userData)
|
if (!userData)
|
||||||
return false;
|
return false;
|
||||||
QmlJSCodeFormatterData *cppData = static_cast<QmlJSCodeFormatterData *>(userData->codeFormatterData());
|
auto cppData = static_cast<const QmlJSCodeFormatterData *>(userData->codeFormatterData());
|
||||||
if (!cppData)
|
if (!cppData)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@@ -38,7 +38,7 @@ namespace QmlJSTools {
|
|||||||
class QmlJSRefactoringChanges;
|
class QmlJSRefactoringChanges;
|
||||||
class QmlJSRefactoringFile;
|
class QmlJSRefactoringFile;
|
||||||
class QmlJSRefactoringChangesData;
|
class QmlJSRefactoringChangesData;
|
||||||
typedef QSharedPointer<QmlJSRefactoringFile> QmlJSRefactoringFilePtr;
|
using QmlJSRefactoringFilePtr = QSharedPointer<QmlJSRefactoringFile>;
|
||||||
|
|
||||||
class QMLJSTOOLS_EXPORT QmlJSRefactoringFile: public TextEditor::RefactoringFile
|
class QMLJSTOOLS_EXPORT QmlJSRefactoringFile: public TextEditor::RefactoringFile
|
||||||
{
|
{
|
||||||
|
@@ -131,7 +131,7 @@ protected:
|
|||||||
|
|
||||||
AST::Node *SemanticInfo::rangeAt(int cursorPosition) const
|
AST::Node *SemanticInfo::rangeAt(int cursorPosition) const
|
||||||
{
|
{
|
||||||
AST::Node *declaringMember = 0;
|
AST::Node *declaringMember = nullptr;
|
||||||
|
|
||||||
for (int i = ranges.size() - 1; i != -1; --i) {
|
for (int i = ranges.size() - 1; i != -1; --i) {
|
||||||
const Range &range = ranges.at(i);
|
const Range &range = ranges.at(i);
|
||||||
@@ -152,7 +152,7 @@ Node *SemanticInfo::declaringMemberNoProperties(int cursorPosition) const
|
|||||||
{
|
{
|
||||||
AST::Node *node = rangeAt(cursorPosition);
|
AST::Node *node = rangeAt(cursorPosition);
|
||||||
|
|
||||||
if (UiObjectDefinition *objectDefinition = cast<UiObjectDefinition*>(node)) {
|
if (auto objectDefinition = cast<const UiObjectDefinition*>(node)) {
|
||||||
const QStringRef name = objectDefinition->qualifiedTypeNameId->name;
|
const QStringRef name = objectDefinition->qualifiedTypeNameId->name;
|
||||||
if (!name.isEmpty() && name.at(0).isLower()) {
|
if (!name.isEmpty() && name.at(0).isLower()) {
|
||||||
QList<AST::Node *> path = rangePath(cursorPosition);
|
QList<AST::Node *> path = rangePath(cursorPosition);
|
||||||
@@ -163,7 +163,7 @@ Node *SemanticInfo::declaringMemberNoProperties(int cursorPosition) const
|
|||||||
if (path.size() > 2)
|
if (path.size() > 2)
|
||||||
return path.at(path.size() - 3);
|
return path.at(path.size() - 3);
|
||||||
}
|
}
|
||||||
} else if (UiObjectBinding *objectBinding = cast<UiObjectBinding*>(node)) {
|
} else if (auto objectBinding = cast<const UiObjectBinding*>(node)) {
|
||||||
const QStringRef name = objectBinding->qualifiedTypeNameId->name;
|
const QStringRef name = objectBinding->qualifiedTypeNameId->name;
|
||||||
if (name.contains(QLatin1String("Gradient"))) {
|
if (name.contains(QLatin1String("Gradient"))) {
|
||||||
QList<AST::Node *> path = rangePath(cursorPosition);
|
QList<AST::Node *> path = rangePath(cursorPosition);
|
||||||
@@ -222,7 +222,7 @@ AST::Node *SemanticInfo::astNodeAt(int pos) const
|
|||||||
{
|
{
|
||||||
const QList<AST::Node *> path = astPath(pos);
|
const QList<AST::Node *> path = astPath(pos);
|
||||||
if (path.isEmpty())
|
if (path.isEmpty())
|
||||||
return 0;
|
return nullptr;
|
||||||
return path.last();
|
return path.last();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -44,10 +44,8 @@ namespace QmlJSTools {
|
|||||||
class QMLJSTOOLS_EXPORT Range
|
class QMLJSTOOLS_EXPORT Range
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Range(): ast(nullptr) {}
|
// attributes
|
||||||
|
QmlJS::AST::Node *ast = nullptr;
|
||||||
public: // attributes
|
|
||||||
QmlJS::AST::Node *ast;
|
|
||||||
QTextCursor begin;
|
QTextCursor begin;
|
||||||
QTextCursor end;
|
QTextCursor end;
|
||||||
};
|
};
|
||||||
@@ -55,8 +53,8 @@ public: // attributes
|
|||||||
class QMLJSTOOLS_EXPORT SemanticInfo
|
class QMLJSTOOLS_EXPORT SemanticInfo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SemanticInfo() {}
|
SemanticInfo() = default;
|
||||||
SemanticInfo(QmlJS::ScopeChain *rootScopeChain);
|
explicit SemanticInfo(QmlJS::ScopeChain *rootScopeChain);
|
||||||
|
|
||||||
bool isValid() const;
|
bool isValid() const;
|
||||||
int revision() const;
|
int revision() const;
|
||||||
|
@@ -44,7 +44,7 @@ namespace QmlJSTools {
|
|||||||
|
|
||||||
const char idKey[] = "QmlJSGlobal";
|
const char idKey[] = "QmlJSGlobal";
|
||||||
|
|
||||||
static SimpleCodeStylePreferences *m_globalCodeStyle = 0;
|
static SimpleCodeStylePreferences *m_globalCodeStyle = nullptr;
|
||||||
|
|
||||||
QmlJSToolsSettings::QmlJSToolsSettings()
|
QmlJSToolsSettings::QmlJSToolsSettings()
|
||||||
{
|
{
|
||||||
@@ -55,7 +55,7 @@ QmlJSToolsSettings::QmlJSToolsSettings()
|
|||||||
TextEditorSettings::registerCodeStyleFactory(factory);
|
TextEditorSettings::registerCodeStyleFactory(factory);
|
||||||
|
|
||||||
// code style pool
|
// code style pool
|
||||||
CodeStylePool *pool = new CodeStylePool(factory, this);
|
auto pool = new CodeStylePool(factory, this);
|
||||||
TextEditorSettings::registerCodeStylePool(Constants::QML_JS_SETTINGS_ID, pool);
|
TextEditorSettings::registerCodeStylePool(Constants::QML_JS_SETTINGS_ID, pool);
|
||||||
|
|
||||||
// global code style settings
|
// global code style settings
|
||||||
@@ -68,7 +68,7 @@ QmlJSToolsSettings::QmlJSToolsSettings()
|
|||||||
|
|
||||||
// built-in settings
|
// built-in settings
|
||||||
// Qt style
|
// Qt style
|
||||||
SimpleCodeStylePreferences *qtCodeStyle = new SimpleCodeStylePreferences();
|
auto qtCodeStyle = new SimpleCodeStylePreferences;
|
||||||
qtCodeStyle->setId("qt");
|
qtCodeStyle->setId("qt");
|
||||||
qtCodeStyle->setDisplayName(tr("Qt"));
|
qtCodeStyle->setDisplayName(tr("Qt"));
|
||||||
qtCodeStyle->setReadOnly(true);
|
qtCodeStyle->setReadOnly(true);
|
||||||
@@ -145,7 +145,7 @@ QmlJSToolsSettings::~QmlJSToolsSettings()
|
|||||||
TextEditorSettings::unregisterCodeStyleFactory(QmlJSTools::Constants::QML_JS_SETTINGS_ID);
|
TextEditorSettings::unregisterCodeStyleFactory(QmlJSTools::Constants::QML_JS_SETTINGS_ID);
|
||||||
|
|
||||||
delete m_globalCodeStyle;
|
delete m_globalCodeStyle;
|
||||||
m_globalCodeStyle = 0;
|
m_globalCodeStyle = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
SimpleCodeStylePreferences *QmlJSToolsSettings::globalCodeStyle()
|
SimpleCodeStylePreferences *QmlJSToolsSettings::globalCodeStyle()
|
||||||
|
@@ -42,7 +42,7 @@ class QMLJSTOOLS_EXPORT QmlJSToolsSettings : public QObject
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit QmlJSToolsSettings();
|
explicit QmlJSToolsSettings();
|
||||||
~QmlJSToolsSettings();
|
~QmlJSToolsSettings() override;
|
||||||
|
|
||||||
static TextEditor::SimpleCodeStylePreferences *globalCodeStyle();
|
static TextEditor::SimpleCodeStylePreferences *globalCodeStyle();
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user