aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/3rdparty/syntax-highlighting/src/lib/themedata_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/3rdparty/syntax-highlighting/src/lib/themedata_p.h')
-rw-r--r--src/libs/3rdparty/syntax-highlighting/src/lib/themedata_p.h51
1 files changed, 24 insertions, 27 deletions
diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/themedata_p.h b/src/libs/3rdparty/syntax-highlighting/src/lib/themedata_p.h
index 3b5f4637a9..6ee772f172 100644
--- a/src/libs/3rdparty/syntax-highlighting/src/lib/themedata_p.h
+++ b/src/libs/3rdparty/syntax-highlighting/src/lib/themedata_p.h
@@ -1,45 +1,33 @@
/*
- Copyright (C) 2016 Volker Krause <vkrause@kde.org>
- Copyright (C) 2016 Dominik Haumann <dhaumann@kde.org>
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org>
+ SPDX-FileCopyrightText: 2016 Dominik Haumann <dhaumann@kde.org>
+
+ SPDX-License-Identifier: MIT
*/
#ifndef KSYNTAXHIGHLIGHTING_THEMEDATA_P_H
#define KSYNTAXHIGHLIGHTING_THEMEDATA_P_H
-#include "theme.h"
#include "textstyledata_p.h"
+#include "theme.h"
#include <QHash>
#include <QSharedData>
-namespace KSyntaxHighlighting {
+#include <vector>
+namespace KSyntaxHighlighting
+{
/**
* Data container for a Theme.
*/
class ThemeData : public QSharedData
{
public:
- static ThemeData* get(const Theme &theme);
+ static ThemeData *get(const Theme &theme)
+ {
+ return theme.m_data.data();
+ }
/**
* Default constructor, creating an uninitialized ThemeData instance.
@@ -52,6 +40,8 @@ public:
*/
bool load(const QString &filePath);
+ void loadComplete();
+
/**
* Returns the unique name of this Theme.
*/
@@ -141,6 +131,11 @@ public:
*/
TextStyleData textStyleOverride(const QString &definitionName, const QString &attributeName) const;
+ /**
+ * Returns the TextStyle data for the given @p style.
+ */
+ TextStyleData textStyle(Theme::TextStyle style) const;
+
private:
int m_revision = 0;
QString m_name;
@@ -150,12 +145,14 @@ private:
//! on disk (in a read-only or a writeable location).
QString m_filePath;
+ bool m_completelyLoaded = false;
+
//! TextStyles
- TextStyleData m_textStyles[Theme::Others + 1];
+ std::vector<TextStyleData> m_textStyles;
//! style overrides for individual itemData entries
//! definition name -> attribute name -> style
- QHash<QString, QHash<QString, TextStyleData> > m_textStyleOverrides;
+ QHash<QString, QHash<QString, TextStyleData>> m_textStyleOverrides;
//! Editor area colors
QRgb m_editorColors[Theme::TemplateReadOnlyPlaceholder + 1];
@@ -164,7 +161,7 @@ private:
}
QT_BEGIN_NAMESPACE
-Q_DECLARE_TYPEINFO(KSyntaxHighlighting::TextStyleData, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(KSyntaxHighlighting::TextStyleData, Q_RELOCATABLE_TYPE);
QT_END_NAMESPACE
#endif // KSYNTAXHIGHLIGHTING_THEMEDATA_P_H