forked from qt-creator/qt-creator
TextEditor: Move HighlightDefinition constants to where they are used
Change-Id: Ibdd3147cc2a64407802fa237b7943d2e96c90030 Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: David Schulz <david.schulz@digia.com>
This commit is contained in:
@@ -1,43 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
|
||||||
** Contact: http://www.qt-project.org/legal
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** 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
|
|
||||||
** a written agreement between you and Digia. For licensing terms and
|
|
||||||
** conditions see http://qt.digia.com/licensing. For further information
|
|
||||||
** use the contact form at http://qt.digia.com/contact-us.
|
|
||||||
**
|
|
||||||
** GNU Lesser General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
||||||
** General Public License version 2.1 as published by the Free Software
|
|
||||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
||||||
** packaging of this file. Please review the following information to
|
|
||||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
||||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
||||||
**
|
|
||||||
** In addition, as a special exception, Digia gives you certain additional
|
|
||||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
|
||||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "highlightdefinitionmetadata.h"
|
|
||||||
|
|
||||||
using namespace TextEditor;
|
|
||||||
using namespace Internal;
|
|
||||||
|
|
||||||
const QLatin1String HighlightDefinitionMetaData::kPriority("priority");
|
|
||||||
const QLatin1String HighlightDefinitionMetaData::kName("name");
|
|
||||||
const QLatin1String HighlightDefinitionMetaData::kExtensions("extensions");
|
|
||||||
const QLatin1String HighlightDefinitionMetaData::kMimeType("mimetype");
|
|
||||||
const QLatin1String HighlightDefinitionMetaData::kVersion("version");
|
|
||||||
const QLatin1String HighlightDefinitionMetaData::kUrl("url");
|
|
||||||
|
|
||||||
HighlightDefinitionMetaData::HighlightDefinitionMetaData() : priority(0)
|
|
||||||
{}
|
|
@@ -30,7 +30,6 @@
|
|||||||
#ifndef HIGHLIGHTDEFINITIONMETADATA_H
|
#ifndef HIGHLIGHTDEFINITIONMETADATA_H
|
||||||
#define HIGHLIGHTDEFINITIONMETADATA_H
|
#define HIGHLIGHTDEFINITIONMETADATA_H
|
||||||
|
|
||||||
#include <QString>
|
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
|
||||||
@@ -40,14 +39,7 @@ namespace Internal {
|
|||||||
class HighlightDefinitionMetaData
|
class HighlightDefinitionMetaData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
HighlightDefinitionMetaData();
|
HighlightDefinitionMetaData() : priority(0) {}
|
||||||
|
|
||||||
static const QLatin1String kPriority;
|
|
||||||
static const QLatin1String kName;
|
|
||||||
static const QLatin1String kExtensions;
|
|
||||||
static const QLatin1String kMimeType;
|
|
||||||
static const QLatin1String kVersion;
|
|
||||||
static const QLatin1String kUrl;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int priority;
|
int priority;
|
||||||
|
@@ -67,6 +67,13 @@
|
|||||||
using namespace TextEditor;
|
using namespace TextEditor;
|
||||||
using namespace Internal;
|
using namespace Internal;
|
||||||
|
|
||||||
|
const char kPriority[] = "priority";
|
||||||
|
const char kName[] = "name";
|
||||||
|
const char kExtensions[] = "extensions";
|
||||||
|
const char kMimeType[] = "mimetype";
|
||||||
|
const char kVersion[] = "version";
|
||||||
|
const char kUrl[] = "url";
|
||||||
|
|
||||||
Manager::Manager() :
|
Manager::Manager() :
|
||||||
m_isDownloadingDefinitionsSpec(false),
|
m_isDownloadingDefinitionsSpec(false),
|
||||||
m_hasQueuedRegistration(false)
|
m_hasQueuedRegistration(false)
|
||||||
@@ -360,14 +367,13 @@ QSharedPointer<HighlightDefinitionMetaData> Manager::parseMetadata(const QFileIn
|
|||||||
|
|
||||||
metaData->fileName = fileInfo.fileName();
|
metaData->fileName = fileInfo.fileName();
|
||||||
metaData->id = fileInfo.absoluteFilePath();
|
metaData->id = fileInfo.absoluteFilePath();
|
||||||
metaData->name = atts.value(HighlightDefinitionMetaData::kName).toString();
|
metaData->name = atts.value(QLatin1String(kName)).toString();
|
||||||
metaData->version = atts.value(HighlightDefinitionMetaData::kVersion).toString();
|
metaData->version = atts.value(QLatin1String(kVersion)).toString();
|
||||||
metaData->priority = atts.value(HighlightDefinitionMetaData::kPriority).toString()
|
metaData->priority = atts.value(QLatin1String(kPriority)).toString().toInt();
|
||||||
.toInt();
|
metaData->patterns = atts.value(QLatin1String(kExtensions))
|
||||||
metaData->patterns = atts.value(HighlightDefinitionMetaData::kExtensions)
|
|
||||||
.toString().split(kSemiColon, QString::SkipEmptyParts);
|
.toString().split(kSemiColon, QString::SkipEmptyParts);
|
||||||
|
|
||||||
QStringList mimeTypes = atts.value(HighlightDefinitionMetaData::kMimeType).
|
QStringList mimeTypes = atts.value(QLatin1String(kMimeType)).
|
||||||
toString().split(kSemiColon, QString::SkipEmptyParts);
|
toString().split(kSemiColon, QString::SkipEmptyParts);
|
||||||
if (mimeTypes.isEmpty()) {
|
if (mimeTypes.isEmpty()) {
|
||||||
// There are definitions which do not specify a MIME type, but specify file
|
// There are definitions which do not specify a MIME type, but specify file
|
||||||
@@ -400,9 +406,9 @@ QList<HighlightDefinitionMetaData> Manager::parseAvailableDefinitionsList(QIODev
|
|||||||
const QXmlStreamAttributes &atts = reader.attributes();
|
const QXmlStreamAttributes &atts = reader.attributes();
|
||||||
|
|
||||||
HighlightDefinitionMetaData metaData;
|
HighlightDefinitionMetaData metaData;
|
||||||
metaData.name = atts.value(HighlightDefinitionMetaData::kName).toString();
|
metaData.name = atts.value(QLatin1String(kName)).toString();
|
||||||
metaData.version = atts.value(HighlightDefinitionMetaData::kVersion).toString();
|
metaData.version = atts.value(QLatin1String(kVersion)).toString();
|
||||||
QString url(atts.value(HighlightDefinitionMetaData::kUrl).toString());
|
QString url = atts.value(QLatin1String(kUrl)).toString();
|
||||||
metaData.url = QUrl(url);
|
metaData.url = QUrl(url);
|
||||||
const int slash = url.lastIndexOf(kSlash);
|
const int slash = url.lastIndexOf(kSlash);
|
||||||
if (slash != -1)
|
if (slash != -1)
|
||||||
|
@@ -56,7 +56,6 @@ SOURCES += texteditorplugin.cpp \
|
|||||||
generichighlighter/highlightersettingspage.cpp \
|
generichighlighter/highlightersettingspage.cpp \
|
||||||
generichighlighter/highlightersettings.cpp \
|
generichighlighter/highlightersettings.cpp \
|
||||||
generichighlighter/managedefinitionsdialog.cpp \
|
generichighlighter/managedefinitionsdialog.cpp \
|
||||||
generichighlighter/highlightdefinitionmetadata.cpp \
|
|
||||||
generichighlighter/definitiondownloader.cpp \
|
generichighlighter/definitiondownloader.cpp \
|
||||||
refactoringchanges.cpp \
|
refactoringchanges.cpp \
|
||||||
refactoroverlay.cpp \
|
refactoroverlay.cpp \
|
||||||
|
@@ -212,7 +212,6 @@ QtcPlugin {
|
|||||||
"highlightdefinition.h",
|
"highlightdefinition.h",
|
||||||
"highlightdefinitionhandler.cpp",
|
"highlightdefinitionhandler.cpp",
|
||||||
"highlightdefinitionhandler.h",
|
"highlightdefinitionhandler.h",
|
||||||
"highlightdefinitionmetadata.cpp",
|
|
||||||
"highlightdefinitionmetadata.h",
|
"highlightdefinitionmetadata.h",
|
||||||
"highlighter.cpp",
|
"highlighter.cpp",
|
||||||
"highlighter.h",
|
"highlighter.h",
|
||||||
|
Reference in New Issue
Block a user