Commit b4a730b1 authored by Milian Wolff's avatar Milian Wolff
Browse files

WIP

parent b0f16d56
Pipeline #201497 canceled with stage
in 1 minute and 51 seconds
......@@ -33,6 +33,12 @@ public:
AllProblemsInlineNotesLevel
};
enum class GlobalColorSource {
AutoGenerated,
FromTheme,
};
Q_ENUM(GlobalColorSource)
virtual int minFilesForSimplifiedParsing() const = 0;
virtual CompletionLevel completionLevel() const = 0;
......@@ -41,6 +47,7 @@ public:
virtual int localColorizationLevel() const = 0;
virtual int globalColorizationLevel() const = 0;
virtual GlobalColorSource globalColorSource() const = 0;
virtual bool highlightSemanticProblems() const = 0;
virtual bool highlightProblematicLines() const = 0;
......
......@@ -340,15 +340,24 @@ void ColorCache::updateColorsFromScheme()
void ColorCache::updateColorsFromSettings()
{
int localRatio = ICore::self()->languageController()->completionSettings()->localColorizationLevel();
int globalRatio = ICore::self()->languageController()->completionSettings()->globalColorizationLevel();
bool boldDeclartions = ICore::self()->languageController()->completionSettings()->boldDeclarations();
auto settings = ICore::self()->languageController()->completionSettings();
const auto globalColorSource = settings->globalColorSource();
const auto globalColorSourceChanged = globalColorSource != m_globalColorSource;
if (globalColorSourceChanged) {
delete m_defaultColors;
m_defaultColors = new CodeHighlightingColors(this);
m_globalColorSource = globalColorSource;
}
int localRatio = settings->localColorizationLevel();
int globalRatio = settings->globalColorizationLevel();
bool boldDeclartions = settings->boldDeclarations();
bool globalRatioChanged = globalRatio != m_globalColorRatio;
if (localRatio != m_localColorRatio || globalRatioChanged) {
if (localRatio != m_localColorRatio || globalRatioChanged || globalColorSourceChanged) {
m_localColorRatio = localRatio;
m_globalColorRatio = globalRatio;
if (m_view && globalRatioChanged) {
if (m_view && (globalRatioChanged || globalColorSourceChanged)) {
updateColorsFromTheme(m_view->theme());
}
update();
......
......@@ -11,8 +11,10 @@
#include <QVector>
#include <QColor>
#include <QPointer>
#include <KSyntaxHighlighting/Repository>
#include <interfaces/icompletionsettings.h>
#include <language/languageexport.h>
namespace KSyntaxHighlighting {
......@@ -160,6 +162,8 @@ private:
/// Between 0 and 255, where 255 means only foreground color, and 0 only the chosen color.
uchar m_globalColorRatio;
ICompletionSettings::GlobalColorSource m_globalColorSource;
/// Whether declarations have to be rendered with a bold style or not.
bool m_boldDeclarations;
......
......@@ -7,9 +7,12 @@
#include "completionsettings.h"
#include "languageconfig.h"
#include <KShell>
#include <KSharedConfig>
#include <QMetaEnum>
namespace KDevelop
{
......@@ -70,6 +73,15 @@ int CompletionSettings::globalColorizationLevel() const
return m_languageGroup.readEntry("globalColorization", m_globalColorizationLevel);
}
CompletionSettings::GlobalColorSource CompletionSettings::globalColorSource() const
{
const auto metaEnum = QMetaEnum::fromType<GlobalColorSource>();
const auto globalColorSource = m_languageGroup.readEntry("globalColorSource", QByteArray());
bool ok = false;
auto value = metaEnum.keyToValue(globalColorSource.constData(), &ok);
return ok ? static_cast<GlobalColorSource>(value) : m_globalColorSource;
}
int CompletionSettings::localColorizationLevel() const
{
return m_languageGroup.readEntry("localColorization", m_localColorizationLevel);
......
......@@ -27,6 +27,8 @@ public:
int globalColorizationLevel() const override;
GlobalColorSource globalColorSource() const override;
bool highlightSemanticProblems() const override;
bool highlightProblematicLines() const override;
......@@ -54,6 +56,7 @@ private:
const bool m_boldDeclarations = true;
const int m_localColorizationLevel = 170;
const int m_globalColorizationLevel = 255;
const GlobalColorSource m_globalColorSource = GlobalColorSource::FromTheme;
const int m_minFilesForSimplifiedParsing = 100000;
const QString m_todoMarkerWords;
......
......@@ -24,6 +24,12 @@
<entry name="localColorization" key="localColorization" type="Int">
<default>170</default>
</entry>
<entry name="globalColorSource" key="globalColorSource" type="Enum">
<choices>
<choice name="AutoGenerated" />
<choice name="FromTheme" />
</choices>
</entry>
<entry name="globalColorization" key="globalColorization" type="Int">
<default>255</default>
</entry>
......
......@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>599</width>
<height>592</height>
<height>709</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
......@@ -29,6 +29,19 @@
<string comment="@title:group">Code Completion</string>
</property>
<layout class="QFormLayout" name="formLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label_6">
<property name="toolTip">
<string comment="@info:tooltip">If disabled, the code completion widget will never show automatically.</string>
</property>
<property name="text">
<string comment="@label">Enable automatic invocation:</string>
</property>
<property name="buddy">
<cstring>kcfg_automaticInvocation</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="kcfg_automaticInvocation">
<property name="toolTip">
......@@ -39,6 +52,19 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_7">
<property name="toolTip">
<string comment="@info:tooltip">Choose whether to display additional information for the currently selected codecompletion item.</string>
</property>
<property name="text">
<string comment="@label">Additional information for current item:</string>
</property>
<property name="buddy">
<cstring>kcfg_showMultiLineSelectionInformation</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="kcfg_showMultiLineSelectionInformation">
<property name="toolTip">
......@@ -49,6 +75,19 @@
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label">
<property name="toolTip">
<string>&lt;p&gt;The code completion UI has a minimal mode and a detailed mode.&lt;br&gt;Choose in what cases full code completion will be displayed.&lt;/p&gt;</string>
</property>
<property name="text">
<string comment="@label">Detailed completion:</string>
</property>
<property name="buddy">
<cstring>kcfg_completionDetail</cstring>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="kcfg_completionDetail">
<property name="toolTip">
......@@ -74,36 +113,6 @@
</item>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label">
<property name="toolTip">
<string>&lt;p&gt;The code completion UI has a minimal mode and a detailed mode.&lt;br&gt;Choose in what cases full code completion will be displayed.&lt;/p&gt;</string>
</property>
<property name="text">
<string comment="@label">Detailed completion:</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_6">
<property name="toolTip">
<string comment="@info:tooltip">If disabled, the code completion widget will never show automatically.</string>
</property>
<property name="text">
<string comment="@label">Enable automatic invocation:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_7">
<property name="toolTip">
<string comment="@info:tooltip">Choose whether to display additional information for the currently selected codecompletion item.</string>
</property>
<property name="text">
<string comment="@label">Additional information for current item:</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
......@@ -151,20 +160,37 @@
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="globalColorizationLabel">
<item row="2" column="1">
<widget class="QComboBox" name="kcfg_globalColorSource">
<property name="toolTip">
<string>&lt;p&gt;This settings lets you change the intensity of globally accessible types, for example classes, methods, functions etc.&lt;/p&gt;</string>
<string>&lt;p&gt;By default, the global colors for types, functions, namespaces and so forth are auto-generated and will adapt to the selected editor theme based on the global colorization intensity. If you want to have full control over the colors, you can instead use the editor theme as color source. You can then fine tune the colors in the settings under Editor &amp;gt; Semantic Colors &amp;gt; Highlight Test Styles &amp;gt; KDevelop/Semantic Colors.&lt;/p&gt;</string>
</property>
<item>
<property name="text">
<string>Auto-Generated</string>
</property>
</item>
<item>
<property name="text">
<string>From Editor Theme</string>
</property>
</item>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_9">
<property name="toolTip">
<string>&lt;p&gt;By default, the global colors for types, functions, namespaces and so forth are auto-generated and will adapt to the selected editor theme based on the global colorization intensity. If you want to have full control over the colors, you can instead use the editor theme as color source. You can then fine tune the colors in the settings under Editor &amp;gt; Semantic Colors &amp;gt; Highlight Test Styles &amp;gt; KDevelop/Semantic Colors.&lt;/p&gt;</string>
</property>
<property name="text">
<string comment="@label:slider">Global colorization intensity:</string>
<string>Global colors:</string>
</property>
<property name="buddy">
<cstring>kcfg_localColorization</cstring>
<cstring>kcfg_globalColorSource</cstring>
</property>
</widget>
</item>
<item row="8" column="1">
<item row="3" column="1">
<widget class="QSlider" name="kcfg_globalColorization">
<property name="toolTip">
<string>&lt;p&gt;This settings lets you change the intensity of globally accessible types, for example classes, methods, functions etc.&lt;/p&gt;</string>
......@@ -186,7 +212,20 @@
</property>
</widget>
</item>
<item row="9" column="0">
<item row="3" column="0">
<widget class="QLabel" name="globalColorizationLabel">
<property name="toolTip">
<string>&lt;p&gt;This settings lets you change the intensity of globally accessible types, for example classes, methods, functions etc.&lt;/p&gt;</string>
</property>
<property name="text">
<string comment="@label:slider">Global colorization intensity:</string>
</property>
<property name="buddy">
<cstring>kcfg_globalColorization</cstring>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_4">
<property name="toolTip">
<string>&lt;p&gt;Highlight semantic problems, such as non-existent or inaccessible declarations.&lt;/p&gt;</string>
......@@ -194,9 +233,12 @@
<property name="text">
<string comment="@label">Highlight semantic problems:</string>
</property>
<property name="buddy">
<cstring>kcfg_highlightSemanticProblems</cstring>
</property>
</widget>
</item>
<item row="9" column="1">
<item row="4" column="1">
<widget class="QCheckBox" name="kcfg_highlightSemanticProblems">
<property name="toolTip">
<string>&lt;p&gt;Highlight semantic problems, such as non-existent or inaccessible declarations.&lt;/p&gt;</string>
......@@ -206,7 +248,7 @@
</property>
</widget>
</item>
<item row="11" column="0">
<item row="5" column="0">
<widget class="QLabel" name="label_5">
<property name="toolTip">
<string>&lt;p&gt;When enabled, lines with errors will get additionally highlighted and their positions get marked in the scrollbar.&lt;/p&gt;</string>
......@@ -214,9 +256,12 @@
<property name="text">
<string comment="@label">Highlight problematic lines:</string>
</property>
<property name="buddy">
<cstring>kcfg_highlightProblematicLines</cstring>
</property>
</widget>
</item>
<item row="11" column="1">
<item row="5" column="1">
<widget class="QCheckBox" name="kcfg_highlightProblematicLines">
<property name="toolTip">
<string>&lt;p&gt;When enabled, lines with errors will get additionally highlighted and their positions get marked in the scrollbar.&lt;/p&gt;</string>
......@@ -226,27 +271,7 @@
</property>
</widget>
</item>
<item row="14" column="0">
<widget class="QLabel" name="label_3">
<property name="toolTip">
<string comment="@info:tooltip">Space-separated list of words that make a comment represent a TODO item</string>
</property>
<property name="text">
<string comment="@label:textbox">TODO marker words:</string>
</property>
</widget>
</item>
<item row="14" column="1">
<widget class="QLineEdit" name="kcfg_todoMarkerWords">
<property name="toolTip">
<string comment="@info:tooltip">Space-separated list of words that make a comment represent a TODO item.</string>
</property>
<property name="placeholderText">
<string/>
</property>
</widget>
</item>
<item row="12" column="0">
<item row="6" column="0">
<widget class="QLabel" name="boldDeclarationsLabel">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Use bold font for declarations such as classes, functions, local variables, etc.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
......@@ -254,12 +279,25 @@
<property name="text">
<string comment="@label">Bold font for declarations:</string>
</property>
<property name="buddy">
<cstring>kcfg_boldDeclarations</cstring>
</property>
</widget>
</item>
<item row="12" column="1">
<item row="6" column="1">
<widget class="QCheckBox" name="kcfg_boldDeclarations"/>
</item>
<item row="13" column="1">
<item row="7" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string comment="@label:listbox">Problems shown as inline notes:</string>
</property>
<property name="buddy">
<cstring>kcfg_problemInlineNotesLevel</cstring>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QComboBox" name="kcfg_problemInlineNotesLevel">
<item>
<property name="text">
......@@ -283,10 +321,26 @@
</item>
</widget>
</item>
<item row="13" column="0">
<widget class="QLabel" name="label_8">
<item row="8" column="0">
<widget class="QLabel" name="label_3">
<property name="toolTip">
<string comment="@info:tooltip">Space-separated list of words that make a comment represent a TODO item</string>
</property>
<property name="text">
<string comment="@label:listbox">Problems shown as inline notes:</string>
<string comment="@label:textbox">TODO marker words:</string>
</property>
<property name="buddy">
<cstring>kcfg_todoMarkerWords</cstring>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QLineEdit" name="kcfg_todoMarkerWords">
<property name="toolTip">
<string comment="@info:tooltip">Space-separated list of words that make a comment represent a TODO item.</string>
</property>
<property name="placeholderText">
<string/>
</property>
</widget>
</item>
......@@ -305,6 +359,8 @@
<zorder>boldDeclarationsLabel</zorder>
<zorder>kcfg_boldDeclarations</zorder>
<zorder>label_8</zorder>
<zorder>kcfg_globalColorSource</zorder>
<zorder>label_9</zorder>
</widget>
</item>
<item>
......@@ -325,6 +381,9 @@ parsed in simplified mode, increasing the efficiency by gathering less informati
<property name="text">
<string comment="@label:spinbox">Minimum project size for simplified parsing:</string>
</property>
<property name="buddy">
<cstring>kcfg_minFilesForSimplifiedParsing</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
......@@ -365,6 +424,27 @@ parsed in simplified mode, increasing the efficiency by gathering less informati
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KPluralHandlingSpinBox</class>
<extends>QSpinBox</extends>
<header>kpluralhandlingspinbox.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>kcfg_automaticInvocation</tabstop>
<tabstop>kcfg_showMultiLineSelectionInformation</tabstop>
<tabstop>kcfg_completionDetail</tabstop>
<tabstop>kcfg_localColorization</tabstop>
<tabstop>kcfg_globalColorSource</tabstop>
<tabstop>kcfg_globalColorization</tabstop>
<tabstop>kcfg_highlightSemanticProblems</tabstop>
<tabstop>kcfg_highlightProblematicLines</tabstop>
<tabstop>kcfg_boldDeclarations</tabstop>
<tabstop>kcfg_problemInlineNotesLevel</tabstop>
<tabstop>kcfg_todoMarkerWords</tabstop>
<tabstop>kcfg_minFilesForSimplifiedParsing</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment