ui: color schemes
Put all colors into single xml file. Accessing colors is handled via the singleton class ColorScheme. The default scheme "bright.xml" holds the original colors. The scheme "dark.xml" is a start, but still a poor alternative. Color schemes can be switched via the View menu.
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
<application>
|
||||
<font_name><!-- STRING: font name --></font_name>
|
||||
<font_size><!-- INTEGER: font size in pt --></font_size>
|
||||
<color_scheme><!-- STRING: color scheme path --></color_scheme>
|
||||
</application>
|
||||
|
||||
<code>
|
||||
@@ -39,81 +40,4 @@
|
||||
<expand_range><!-- INTEGER: amount of lines that the snippet range (not snapped) will be extended --></expand_range>
|
||||
</snippet>
|
||||
</code>
|
||||
|
||||
<colors>
|
||||
<!-- QueryNodeType -->
|
||||
<command>
|
||||
<normal>#8FBC92</normal>
|
||||
<hover>#5EA071</hover>
|
||||
</command>
|
||||
<operator>
|
||||
<normal>#FCA47E</normal>
|
||||
<hover>#F97A4E</hover>
|
||||
</operator>
|
||||
<!-- NodeType -->
|
||||
<class>
|
||||
<normal>#ededed</normal>
|
||||
<hover>#ededed</hover>
|
||||
</class>
|
||||
<struct>
|
||||
<normal>#ededed</normal>
|
||||
<hover>#ededed</hover>
|
||||
</struct>
|
||||
<enum>
|
||||
<normal>#ededed</normal>
|
||||
<hover>#ededed</hover>
|
||||
</enum>
|
||||
<function>
|
||||
<normal>#F4D07D</normal>
|
||||
<hover>#F4BC3D</hover>
|
||||
</function>
|
||||
<method>
|
||||
<normal>#F4D07D</normal>
|
||||
<hover>#F4BC3D</hover>
|
||||
</method>
|
||||
<field>
|
||||
<normal>#7BB5D4</normal>
|
||||
<hover>#42A1D4</hover>
|
||||
</field>
|
||||
<global>
|
||||
<normal>#7BB5D4</normal>
|
||||
<hover>#42A1D4</hover>
|
||||
</global>
|
||||
<undefined>
|
||||
<normal>#00000000</normal>
|
||||
<hover>#00000000</hover>
|
||||
</undefined>
|
||||
<undefined_variable>
|
||||
<normal>#7BB5D4</normal>
|
||||
<hover>#42A1D4</hover>
|
||||
</undefined_variable>
|
||||
<undefined_function>
|
||||
<normal>#F4D07D</normal>
|
||||
<hover>#F4BC3D</hover>
|
||||
</undefined_function>
|
||||
<undefined_type>
|
||||
<normal>#ededed</normal>
|
||||
<hover>#ededed</hover>
|
||||
</undefined_type>
|
||||
<namespace>
|
||||
<normal>#00000000</normal>
|
||||
<hover>#00000000</hover>
|
||||
</namespace>
|
||||
<typedef>
|
||||
<normal>#ededed</normal>
|
||||
<hover>#ededed</hover>
|
||||
</typedef>
|
||||
<enum_constant>
|
||||
<normal>#7BB5D4</normal>
|
||||
<hover>#42A1D4</hover>
|
||||
</enum_constant>
|
||||
<template_parameter_type>
|
||||
<normal>#ededed</normal>
|
||||
<hover>#ededed</hover>
|
||||
</template_parameter_type>
|
||||
<file>
|
||||
<normal>#88BAB3</normal>
|
||||
<hover>#6AA39B</hover>
|
||||
</file>
|
||||
</colors>
|
||||
</config>
|
||||
|
||||
@@ -0,0 +1,248 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<config>
|
||||
<search>
|
||||
<background>white</background>
|
||||
|
||||
<button>
|
||||
<normal>#E0E0E0</normal>
|
||||
<hover>#B2B2B2</hover>
|
||||
<press>#626262</press>
|
||||
<disabled>#F4F4F4</disabled>
|
||||
</button>
|
||||
|
||||
<field>
|
||||
<text>black</text>
|
||||
<background>#E0E0E0</background>
|
||||
<highlight>#B2B2B2</highlight>
|
||||
</field>
|
||||
|
||||
<popup>
|
||||
<text>black</text>
|
||||
<by_text>#A0A0A0</by_text>
|
||||
<background>white</background>
|
||||
<highlight>#B2B2B2</highlight>
|
||||
</popup>
|
||||
|
||||
<query>
|
||||
<none>
|
||||
<normal>white</normal>
|
||||
<hover>#F5F5F5</hover>
|
||||
</none>
|
||||
<command>
|
||||
<normal>#8FBC92</normal>
|
||||
<hover>#5EA071</hover>
|
||||
</command>
|
||||
<operator>
|
||||
<normal>#FCA47E</normal>
|
||||
<hover>#F97A4E</hover>
|
||||
</operator>
|
||||
</query>
|
||||
</search>
|
||||
|
||||
<code>
|
||||
<background>white</background>
|
||||
|
||||
<file>
|
||||
<background>#E0E0E0</background>
|
||||
|
||||
<title>
|
||||
<text>black</text>
|
||||
<normal>#E0E0E0</normal>
|
||||
<hover>#B2B2B2</hover>
|
||||
<press>#626262</press>
|
||||
</title>
|
||||
</file>
|
||||
|
||||
<snippet>
|
||||
<background>transparent</background>
|
||||
|
||||
<title>
|
||||
<text>#A0A0A0</text>
|
||||
<background>transparent</background>
|
||||
<hover>#F5F5F5</hover>
|
||||
</title>
|
||||
|
||||
<line_number>
|
||||
<text>black</text>
|
||||
<background>transparent</background>
|
||||
</line_number>
|
||||
|
||||
<syntax>
|
||||
<normal>black</normal>
|
||||
<directive>#1B8856</directive>
|
||||
<keyword>#1B8856</keyword>
|
||||
<type>#C1492D</type>
|
||||
<comment>#A0A0A4</comment>
|
||||
<number>#C1315E</number>
|
||||
<quotation>#865F9E</quotation>
|
||||
<function>#CC9533</function>
|
||||
</syntax>
|
||||
|
||||
<highlight>
|
||||
<location>
|
||||
<normal>#90EBEBEB</normal>
|
||||
<hover>#90B6D1DD</hover>
|
||||
</location>
|
||||
<scope>
|
||||
<normal>#60E4EEF2</normal>
|
||||
<hover>#90E4EEF2</hover>
|
||||
</scope>
|
||||
<error>
|
||||
<normal>#80FF0000</normal>
|
||||
<hover>#FFFF0000</hover>
|
||||
</error>
|
||||
</highlight>
|
||||
</snippet>
|
||||
</code>
|
||||
|
||||
<graph>
|
||||
<text>black</text>
|
||||
<background>white</background>
|
||||
<border>#3C3C3C</border>
|
||||
|
||||
<node>
|
||||
<class>
|
||||
<normal>#ededed</normal>
|
||||
<hover>#ededed</hover>
|
||||
</class>
|
||||
<struct>
|
||||
<normal>#ededed</normal>
|
||||
<hover>#ededed</hover>
|
||||
</struct>
|
||||
<enum>
|
||||
<normal>#ededed</normal>
|
||||
<hover>#ededed</hover>
|
||||
</enum>
|
||||
<undefined_type>
|
||||
<normal>#ededed</normal>
|
||||
<hover>#ededed</hover>
|
||||
</undefined_type>
|
||||
<typedef>
|
||||
<normal>#ededed</normal>
|
||||
<hover>#ededed</hover>
|
||||
</typedef>
|
||||
<template_parameter_type>
|
||||
<normal>#ededed</normal>
|
||||
<hover>#ededed</hover>
|
||||
</template_parameter_type>
|
||||
|
||||
<function>
|
||||
<normal>#F4D07D</normal>
|
||||
<hover>#F4BC3D</hover>
|
||||
</function>
|
||||
<method>
|
||||
<normal>#F4D07D</normal>
|
||||
<hover>#F4BC3D</hover>
|
||||
</method>
|
||||
<undefined_function>
|
||||
<normal>#F4D07D</normal>
|
||||
<hover>#F4BC3D</hover>
|
||||
</undefined_function>
|
||||
|
||||
<field>
|
||||
<normal>#7BB5D4</normal>
|
||||
<hover>#42A1D4</hover>
|
||||
</field>
|
||||
<global>
|
||||
<normal>#7BB5D4</normal>
|
||||
<hover>#42A1D4</hover>
|
||||
</global>
|
||||
<undefined_variable>
|
||||
<normal>#7BB5D4</normal>
|
||||
<hover>#42A1D4</hover>
|
||||
</undefined_variable>
|
||||
<enum_constant>
|
||||
<normal>#7BB5D4</normal>
|
||||
<hover>#42A1D4</hover>
|
||||
</enum_constant>
|
||||
|
||||
<undefined>
|
||||
<normal>#CC8D91</normal>
|
||||
<hover>#CC8D91</hover>
|
||||
</undefined>
|
||||
<namespace>
|
||||
<normal>#CC8D91</normal>
|
||||
<hover>#CC8D91</hover>
|
||||
</namespace>
|
||||
|
||||
<file>
|
||||
<normal>#88BAB3</normal>
|
||||
<hover>#6AA39B</hover>
|
||||
</file>
|
||||
</node>
|
||||
<edge>
|
||||
<type_use>
|
||||
<normal>#878787</normal>
|
||||
<hover>#878787</hover>
|
||||
</type_use>
|
||||
<return_type>
|
||||
<normal>#878787</normal>
|
||||
<hover>#878787</hover>
|
||||
</return_type>
|
||||
<parameter_type>
|
||||
<normal>#878787</normal>
|
||||
<hover>#878787</hover>
|
||||
</parameter_type>
|
||||
<type_usage>
|
||||
<normal>#878787</normal>
|
||||
<hover>#878787</hover>
|
||||
</type_usage>
|
||||
<inheritance>
|
||||
<normal>#878787</normal>
|
||||
<hover>#878787</hover>
|
||||
</inheritance>
|
||||
<typedef>
|
||||
<normal>#878787</normal>
|
||||
<hover>#878787</hover>
|
||||
</typedef>
|
||||
|
||||
<override>
|
||||
<normal>#CC5E89</normal>
|
||||
<hover>#CC5E89</hover>
|
||||
</override>
|
||||
|
||||
<call>
|
||||
<normal>#F4BC3D</normal>
|
||||
<hover>#F4BC3D</hover>
|
||||
</call>
|
||||
|
||||
<usage>
|
||||
<normal>#3190BA</normal>
|
||||
<hover>#3190BA</hover>
|
||||
</usage>
|
||||
|
||||
<template_parameter>
|
||||
<normal>#C1305D</normal>
|
||||
<hover>#C1305D</hover>
|
||||
</template_parameter>
|
||||
<template_argument>
|
||||
<normal>#C1305D</normal>
|
||||
<hover>#C1305D</hover>
|
||||
</template_argument>
|
||||
<template_default_argument>
|
||||
<normal>#C1305D</normal>
|
||||
<hover>#C1305D</hover>
|
||||
</template_default_argument>
|
||||
<template_specialization>
|
||||
<normal>#C1305D</normal>
|
||||
<hover>#C1305D</hover>
|
||||
</template_specialization>
|
||||
|
||||
<include>
|
||||
<normal>#5DA399</normal>
|
||||
<hover>#5DA399</hover>
|
||||
</include>
|
||||
|
||||
<aggregation>
|
||||
<normal>#EEE</normal>
|
||||
<hover>#DDD</hover>
|
||||
</aggregation>
|
||||
</edge>
|
||||
</graph>
|
||||
|
||||
<tool_tip>
|
||||
<text>black</text>
|
||||
<background>#E0E0E0</background>
|
||||
</tool_tip>
|
||||
</config>
|
||||
@@ -0,0 +1,248 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<config>
|
||||
<search>
|
||||
<background>#272728</background>
|
||||
|
||||
<button>
|
||||
<normal>#777777</normal>
|
||||
<hover>#555555</hover>
|
||||
<press>#444444</press>
|
||||
<disabled>#333333</disabled>
|
||||
</button>
|
||||
|
||||
<field>
|
||||
<text>#F7F7F7</text>
|
||||
<background>#777777</background>
|
||||
<highlight>#555555</highlight>
|
||||
</field>
|
||||
|
||||
<popup>
|
||||
<text>#F7F7F7</text>
|
||||
<by_text>#A0A0A0</by_text>
|
||||
<background>#272728</background>
|
||||
<highlight>#555555</highlight>
|
||||
</popup>
|
||||
|
||||
<query>
|
||||
<none>
|
||||
<normal>#2F2F2F</normal>
|
||||
<hover>black</hover>
|
||||
</none>
|
||||
<command>
|
||||
<normal>#406D4D</normal>
|
||||
<hover>#4E855E</hover>
|
||||
</command>
|
||||
<operator>
|
||||
<normal>#7D2724</normal>
|
||||
<hover>#8C2B29</hover>
|
||||
</operator>
|
||||
</query>
|
||||
</search>
|
||||
|
||||
<code>
|
||||
<background>#272728</background>
|
||||
|
||||
<file>
|
||||
<background>#777777</background>
|
||||
|
||||
<title>
|
||||
<text>#F7F7F7</text>
|
||||
<normal>#777777</normal>
|
||||
<hover>#555555</hover>
|
||||
<press>#444444</press>
|
||||
</title>
|
||||
</file>
|
||||
|
||||
<snippet>
|
||||
<background>transparent</background>
|
||||
|
||||
<title>
|
||||
<text>#A0A0A0</text>
|
||||
<background>transparent</background>
|
||||
<hover>#2F2F2F</hover>
|
||||
</title>
|
||||
|
||||
<line_number>
|
||||
<text>#F7F7F7</text>
|
||||
<background>transparent</background>
|
||||
</line_number>
|
||||
|
||||
<syntax>
|
||||
<normal>#F7F7F7</normal>
|
||||
<directive>#1F9C62</directive>
|
||||
<keyword>#1F9C62</keyword>
|
||||
<type>#D95233</type>
|
||||
<comment>#A0A0A4</comment>
|
||||
<number>#CC3463</number>
|
||||
<quotation>#9368AD</quotation>
|
||||
<function>#D69C36</function>
|
||||
</syntax>
|
||||
|
||||
<highlight>
|
||||
<location>
|
||||
<normal>#20EBEBEB</normal>
|
||||
<hover>#40B6D1DD</hover>
|
||||
</location>
|
||||
<scope>
|
||||
<normal>#10E4EEF2</normal>
|
||||
<hover>#18E4EEF2</hover>
|
||||
</scope>
|
||||
<error>
|
||||
<normal>#A0FF0000</normal>
|
||||
<hover>#FFFF0000</hover>
|
||||
</error>
|
||||
</highlight>
|
||||
</snippet>
|
||||
</code>
|
||||
|
||||
<graph>
|
||||
<text>#F7F7F7</text>
|
||||
<border>#C3C3C3</border>
|
||||
<background>#272728</background>
|
||||
|
||||
<node>
|
||||
<class>
|
||||
<normal>#4D4D4D</normal>
|
||||
<hover>#4D4D4D</hover>
|
||||
</class>
|
||||
<struct>
|
||||
<normal>#4D4D4D</normal>
|
||||
<hover>#4D4D4D</hover>
|
||||
</struct>
|
||||
<enum>
|
||||
<normal>#4D4D4D</normal>
|
||||
<hover>#4D4D4D</hover>
|
||||
</enum>
|
||||
<undefined_type>
|
||||
<normal>#4D4D4D</normal>
|
||||
<hover>#4D4D4D</hover>
|
||||
</undefined_type>
|
||||
<typedef>
|
||||
<normal>#4D4D4D</normal>
|
||||
<hover>#4D4D4D</hover>
|
||||
</typedef>
|
||||
<template_parameter_type>
|
||||
<normal>#4D4D4D</normal>
|
||||
<hover>#4D4D4D</hover>
|
||||
</template_parameter_type>
|
||||
|
||||
<function>
|
||||
<normal>#7A681F</normal>
|
||||
<hover>#9C8528</hover>
|
||||
</function>
|
||||
<method>
|
||||
<normal>#7A681F</normal>
|
||||
<hover>#9C8528</hover>
|
||||
</method>
|
||||
<undefined_function>
|
||||
<normal>#7A681F</normal>
|
||||
<hover>#9C8528</hover>
|
||||
</undefined_function>
|
||||
|
||||
<field>
|
||||
<normal>#21516B</normal>
|
||||
<hover>#2A6484</hover>
|
||||
</field>
|
||||
<global>
|
||||
<normal>#21516B</normal>
|
||||
<hover>#2A6484</hover>
|
||||
</global>
|
||||
<undefined_variable>
|
||||
<normal>#21516B</normal>
|
||||
<hover>#2A6484</hover>
|
||||
</undefined_variable>
|
||||
<enum_constant>
|
||||
<normal>#21516B</normal>
|
||||
<hover>#2A6484</hover>
|
||||
</enum_constant>
|
||||
|
||||
<undefined>
|
||||
<normal>#78282D</normal>
|
||||
<hover>#78282D</hover>
|
||||
</undefined>
|
||||
<namespace>
|
||||
<normal>#78282D</normal>
|
||||
<hover>#78282D</hover>
|
||||
</namespace>
|
||||
|
||||
<file>
|
||||
<normal>#1B564E</normal>
|
||||
<hover>#247368</hover>
|
||||
</file>
|
||||
</node>
|
||||
<edge>
|
||||
<type_use>
|
||||
<normal>#797979</normal>
|
||||
<hover>#797979</hover>
|
||||
</type_use>
|
||||
<return_type>
|
||||
<normal>#797979</normal>
|
||||
<hover>#797979</hover>
|
||||
</return_type>
|
||||
<parameter_type>
|
||||
<normal>#797979</normal>
|
||||
<hover>#797979</hover>
|
||||
</parameter_type>
|
||||
<type_usage>
|
||||
<normal>#797979</normal>
|
||||
<hover>#797979</hover>
|
||||
</type_usage>
|
||||
<inheritance>
|
||||
<normal>#797979</normal>
|
||||
<hover>#797979</hover>
|
||||
</inheritance>
|
||||
<typedef>
|
||||
<normal>#797979</normal>
|
||||
<hover>#797979</hover>
|
||||
</typedef>
|
||||
|
||||
<override>
|
||||
<normal>#CC5E89</normal>
|
||||
<hover>#CC5E89</hover>
|
||||
</override>
|
||||
|
||||
<call>
|
||||
<normal>#9C8528</normal>
|
||||
<hover>#9C8528</hover>
|
||||
</call>
|
||||
|
||||
<usage>
|
||||
<normal>#2A6484</normal>
|
||||
<hover>#2A6484</hover>
|
||||
</usage>
|
||||
|
||||
<template_parameter>
|
||||
<normal>#C1305D</normal>
|
||||
<hover>#C1305D</hover>
|
||||
</template_parameter>
|
||||
<template_argument>
|
||||
<normal>#C1305D</normal>
|
||||
<hover>#C1305D</hover>
|
||||
</template_argument>
|
||||
<template_default_argument>
|
||||
<normal>#C1305D</normal>
|
||||
<hover>#C1305D</hover>
|
||||
</template_default_argument>
|
||||
<template_specialization>
|
||||
<normal>#C1305D</normal>
|
||||
<hover>#C1305D</hover>
|
||||
</template_specialization>
|
||||
|
||||
<include>
|
||||
<normal>#247368</normal>
|
||||
<hover>#247368</hover>
|
||||
</include>
|
||||
|
||||
<aggregation>
|
||||
<normal>#5D5D5D</normal>
|
||||
<hover>#6D6D6D</hover>
|
||||
</aggregation>
|
||||
</edge>
|
||||
</graph>
|
||||
|
||||
<tool_tip>
|
||||
<text>#F7F7F7</text>
|
||||
<background>#777777</background>
|
||||
</tool_tip>
|
||||
</config>
|
||||
@@ -1,40 +1,48 @@
|
||||
#code_file_list {
|
||||
background-color: white;
|
||||
#code_file_list_base, #code_file_list {
|
||||
background-color: <color:code/background>;
|
||||
}
|
||||
|
||||
* {
|
||||
font-size: <setting:font_size>pt;
|
||||
}
|
||||
|
||||
#code_file {
|
||||
background-color: white;
|
||||
border: 2px solid #E0E0E0;
|
||||
background-color: <color:code/snippet/background>;
|
||||
border: 2px solid <color:code/file/background>;
|
||||
border-radius: 14px;
|
||||
}
|
||||
|
||||
#code_file #title_widget {
|
||||
background-color: #E0E0E0;
|
||||
background-color: <color:code/file/background>;
|
||||
border-top-left-radius: 10px;
|
||||
border-top-right-radius: 10px;
|
||||
margin-bottom: 5px;
|
||||
padding-right: 5px;
|
||||
}
|
||||
|
||||
#code_file #title_label {
|
||||
background: none;
|
||||
background-color: <color:code/file/title/normal>;
|
||||
border: none;
|
||||
border-radius: 3px;
|
||||
color: <color:code/file/title/text>;
|
||||
padding: 2px 4px;
|
||||
margin: 1px 8px 3px;
|
||||
}
|
||||
|
||||
#code_file #title_label:hover {
|
||||
background-color: #D0D0D0;
|
||||
background-color: <color:code/file/title/hover>;
|
||||
}
|
||||
|
||||
#code_file #title_label:disabled {
|
||||
color: black;
|
||||
#code_file #title_label:pressed {
|
||||
background-color: <color:code/file/title/press>;
|
||||
}
|
||||
|
||||
#code_file #code_snippet{
|
||||
border-top: 2px solid #E0E0E0;
|
||||
padding-top: 2px;
|
||||
#code_file #code_snippet {
|
||||
background-color: <color:code/snippet/background>;
|
||||
border-top: 2px solid <color:code/file/background>;
|
||||
}
|
||||
|
||||
#code_file #code_snippet * {
|
||||
font-family: "<setting:font_name>";
|
||||
}
|
||||
|
||||
#code_file #code_snippet[isFirst=true] {
|
||||
@@ -42,23 +50,45 @@
|
||||
padding-top: 0px;
|
||||
}
|
||||
|
||||
#code_file #code_snippet[isLast=true] {
|
||||
border-bottom-left-radius: 12px;
|
||||
border-bottom-right-radius: 12px;
|
||||
}
|
||||
|
||||
#code_file #code_snippet #scope_name, #code_file #code_snippet #dots {
|
||||
background: none;
|
||||
color: gray;
|
||||
background-color: <color:code/snippet/title/background>;
|
||||
color: <color:code/snippet/title/text>;
|
||||
border: none;
|
||||
}
|
||||
|
||||
#code_file #code_snippet #scope_name:hover {
|
||||
background-color: <color:code/snippet/title/hover>;
|
||||
}
|
||||
|
||||
#code_file #code_snippet #dots {
|
||||
background-color: <color:code/snippet/line_number/background>;
|
||||
padding-right: 13px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#code_file #code_snippet #scope_name {
|
||||
padding-left: 4px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
#code_file #code_snippet #line_number_area {
|
||||
background-color: <color:code/snippet/line_number/background>;
|
||||
border: none;
|
||||
color: <color:code/snippet/line_number/text>;
|
||||
}
|
||||
|
||||
#code_file #code_snippet[isLast=true] #line_number_area {
|
||||
border-bottom-left-radius: 12px;
|
||||
}
|
||||
|
||||
#code_area {
|
||||
background-color: transparent;
|
||||
color: <color:code/snippet/syntax/normal>;
|
||||
}
|
||||
|
||||
#code_file #maximize_button, #code_file #snippet_button, #code_file #minimize_button {
|
||||
@@ -92,7 +122,7 @@
|
||||
}
|
||||
|
||||
QToolTip {
|
||||
background-color: rgb(204, 204, 204);
|
||||
border: 1px solid rgb(0, 0, 0);
|
||||
color: rgb(0, 0, 0);
|
||||
background-color: <color:tool_tip/background>;
|
||||
color: <color:tool_tip/text>;
|
||||
font-size: <setting:font_size>pt;
|
||||
}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
#refresh_bar {
|
||||
background: white;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
QPushButton {
|
||||
background: #E0E0E0;
|
||||
background: <color:search/button/normal>;
|
||||
border: none;
|
||||
height: 30px;
|
||||
width: 30px;
|
||||
}
|
||||
|
||||
QPushButton:hover, QPushButton:checked {
|
||||
background: #B2B2B2;
|
||||
background: <color:search/button/hover>;
|
||||
}
|
||||
|
||||
QPushButton:pressed {
|
||||
background: #626262;
|
||||
background: <color:search/button/press>;
|
||||
}
|
||||
|
||||
#refresh_button {
|
||||
@@ -29,7 +29,7 @@ QPushButton:pressed {
|
||||
}
|
||||
|
||||
QToolTip {
|
||||
background-color: rgb(204, 204, 204);
|
||||
border: 1px solid rgb(0, 0, 0);
|
||||
color: rgb(0, 0, 0);
|
||||
background-color: <color:tool_tip/background>;
|
||||
color: <color:tool_tip/text>;
|
||||
font-size: <setting:font_size>pt;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,18 @@
|
||||
* {
|
||||
font-size: <setting:font_size>pt;
|
||||
}
|
||||
|
||||
#search_box, #search_box * {
|
||||
font-family: "<setting:font_name>";
|
||||
font-size: <setting:font_size+2>pt;
|
||||
}
|
||||
|
||||
#search_bar {
|
||||
background: white;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
QWidget#search_box_container {
|
||||
background: #E0E0E0;
|
||||
background: <color:search/field/background>;
|
||||
border: none;
|
||||
border-bottom-left-radius: 12px;
|
||||
border-top-left-radius: 12px;
|
||||
@@ -11,26 +20,29 @@ QWidget#search_box_container {
|
||||
}
|
||||
|
||||
QLineEdit#search_box {
|
||||
background: #E0E0E0;
|
||||
background-color: transparent;
|
||||
border: none;
|
||||
selection-background-color: #B2B2B2;
|
||||
color: <color:search/field/text>;
|
||||
selection-background-color: <color:search/field/highlight>;
|
||||
}
|
||||
|
||||
QWidget#search_box_highlight {
|
||||
background: #B2B2B2;
|
||||
background-color: <color:search/field/highlight>;
|
||||
border: none;
|
||||
}
|
||||
|
||||
QAbstractItemView#search_box_popup {
|
||||
background-color: white;
|
||||
background-color: <color:search/popup/background>;
|
||||
border: none;
|
||||
color: <color:search/popup/text>;
|
||||
font-family: "<setting:font_name>";
|
||||
margin: 8px 0 0;
|
||||
min-height: 26px;
|
||||
selection-background-color: #B2B2B2;
|
||||
selection-background-color: <color:search/popup/highlight>;
|
||||
}
|
||||
|
||||
QPushButton#search_button {
|
||||
background: #E0E0E0;
|
||||
background: <color:search/button/normal>;
|
||||
border: none;
|
||||
border-bottom-right-radius: 12px;
|
||||
border-top-right-radius: 12px;
|
||||
@@ -39,15 +51,15 @@ QPushButton#search_button {
|
||||
}
|
||||
|
||||
#search_button:hover {
|
||||
background: #B2B2B2;
|
||||
background: <color:search/button/hover>;
|
||||
}
|
||||
|
||||
#search_button:pressed {
|
||||
background: #626262;
|
||||
background: <color:search/button/press>;
|
||||
}
|
||||
|
||||
QToolTip {
|
||||
background-color: rgb(204, 204, 204);
|
||||
border: 1px solid rgb(0, 0, 0);
|
||||
color: rgb(0, 0, 0);
|
||||
background-color: <color:tool_tip/background>;
|
||||
color: <color:tool_tip/text>;
|
||||
font-size: <setting:font_size>pt;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#undo_redo_bar {
|
||||
background: white;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
QPushButton {
|
||||
background: #E0E0E0;
|
||||
background: <color:search/button/normal>;
|
||||
border: none;
|
||||
background-position: 15px 5px;
|
||||
height: 30px;
|
||||
@@ -22,19 +22,19 @@ QPushButton {
|
||||
}
|
||||
|
||||
QPushButton:disabled {
|
||||
background: #F4F4F4;
|
||||
background: <color:search/button/disabled>;
|
||||
}
|
||||
|
||||
QPushButton:hover {
|
||||
background: #B2B2B2;
|
||||
background: <color:search/button/hover>;
|
||||
}
|
||||
|
||||
QPushButton:pressed {
|
||||
background: #626262;
|
||||
background: <color:search/button/press>;
|
||||
}
|
||||
|
||||
QToolTip {
|
||||
background-color: rgb(204, 204, 204);
|
||||
border: 1px solid rgb(0, 0, 0);
|
||||
color: rgb(0, 0, 0);
|
||||
background-color: <color:tool_tip/background>;
|
||||
color: <color:tool_tip/text>;
|
||||
font-size: <setting:font_size>pt;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <QScrollBar>
|
||||
|
||||
#include "settings/ApplicationSettings.h"
|
||||
#include "settings/ColorScheme.h"
|
||||
|
||||
QtAutocompletionModel::QtAutocompletionModel(QObject* parent)
|
||||
: QAbstractTableModel(parent)
|
||||
@@ -85,6 +86,8 @@ void QtAutocompletionDelegate::paint(QPainter* painter, const QStyleOptionViewIt
|
||||
{
|
||||
painter->save();
|
||||
|
||||
ColorScheme* scheme = ColorScheme::getInstance().get();
|
||||
|
||||
if (option.state & QStyle::State_Selected)
|
||||
{
|
||||
painter->fillRect(option.rect, option.palette.color(QPalette::Highlight));
|
||||
@@ -101,17 +104,16 @@ void QtAutocompletionDelegate::paint(QPainter* painter, const QStyleOptionViewIt
|
||||
QColor color("#FFFFFF");
|
||||
|
||||
Node::NodeType nodeType = static_cast<Node::NodeType>(index.sibling(index.row(), index.column() + 3).data().toInt());
|
||||
if(type.size() && nodeType)
|
||||
if (type.size() && nodeType)
|
||||
{
|
||||
color = QColor(ApplicationSettings::getInstance()->getNodeTypeColor(nodeType).c_str());
|
||||
color = QColor(scheme->getNodeTypeColor(nodeType).c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
color = QColor(ApplicationSettings::getInstance()->getQueryNodeTypeColor(QueryNode::QUERYNODETYPE_COMMAND).c_str());
|
||||
color = QColor(scheme->getQueryNodeTypeColor(QueryNode::QUERYNODETYPE_COMMAND).c_str());
|
||||
}
|
||||
|
||||
|
||||
|
||||
QList<QVariant> indices = index.sibling(index.row(), index.column() + 2).data().toList();
|
||||
if (indices.size())
|
||||
{
|
||||
@@ -149,15 +151,11 @@ void QtAutocompletionDelegate::paint(QPainter* painter, const QStyleOptionViewIt
|
||||
painter->setFont(typeFont);
|
||||
}
|
||||
|
||||
QPen pen = painter->pen();
|
||||
QPen typePen = pen;
|
||||
typePen.setColor(QColor("#878787"));
|
||||
QPen typePen = painter->pen();
|
||||
typePen.setColor(scheme->getColor("search/popup/by_text").c_str());
|
||||
painter->setPen(typePen);
|
||||
|
||||
painter->drawText(option.rect.adjusted(0, 3, -charWidth, 0), Qt::AlignRight, type);
|
||||
|
||||
painter->setFont(font);
|
||||
painter->setPen(pen);
|
||||
}
|
||||
|
||||
painter->restore();
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "qt/element/QtCodeSnippet.h"
|
||||
#include "qt/utility/QtHighlighter.h"
|
||||
#include "settings/ApplicationSettings.h"
|
||||
#include "settings/ColorScheme.h"
|
||||
|
||||
QtCodeArea::LineNumberArea::LineNumberArea(QtCodeArea *codeArea)
|
||||
: QWidget(codeArea)
|
||||
@@ -115,7 +116,6 @@ void QtCodeArea::lineNumberAreaPaintEvent(QPaintEvent *event)
|
||||
if (block.isVisible() && bottom >= event->rect().top())
|
||||
{
|
||||
QString number = QString::number(blockNumber + m_startLineNumber);
|
||||
painter.setPen(Qt::black);
|
||||
painter.drawText(0, top, m_lineNumberArea->width() - 13, fontMetrics().height(), Qt::AlignRight, number);
|
||||
}
|
||||
|
||||
@@ -187,23 +187,17 @@ void QtCodeArea::paintEvent(QPaintEvent* event)
|
||||
int top = blockBoundingGeometry(block).translated(contentOffset()).top();
|
||||
int blockHeight = blockBoundingRect(block).height();
|
||||
|
||||
QColor qColor;
|
||||
ColorScheme* scheme = ColorScheme::getInstance().get();
|
||||
|
||||
QColor scopeColor(scheme->getColor("code/snippet/highlight/scope/normal").c_str());
|
||||
QColor activeScopeColor(scheme->getColor("code/snippet/highlight/scope/hover").c_str());
|
||||
|
||||
for (const ScopeAnnotation& scope : m_scopeAnnotations)
|
||||
{
|
||||
if (scope.isFocused || scope.startLine == scope.endLine)
|
||||
{
|
||||
qColor = QColor("#90E4EEF2");
|
||||
}
|
||||
else
|
||||
{
|
||||
qColor = QColor("#60E4EEF2");
|
||||
}
|
||||
|
||||
painter.fillRect(
|
||||
0, top + scope.startLine * blockHeight,
|
||||
width(), (scope.endLine - scope.startLine + 1) * blockHeight,
|
||||
qColor
|
||||
(scope.isFocused || scope.startLine == scope.endLine) ? activeScopeColor : scopeColor
|
||||
);
|
||||
}
|
||||
|
||||
@@ -387,7 +381,14 @@ void QtCodeArea::annotateText()
|
||||
|
||||
std::vector<ScopeAnnotation> scopeAnnotations;
|
||||
|
||||
QColor color;
|
||||
ColorScheme* scheme = ColorScheme::getInstance().get();
|
||||
|
||||
QColor locationColor(scheme->getColor("code/snippet/highlight/location/normal").c_str());
|
||||
QColor activeLocationColor(scheme->getColor("code/snippet/highlight/location/hover").c_str());
|
||||
|
||||
QColor errorColor(scheme->getColor("code/snippet/highlight/error/normal").c_str());
|
||||
QColor activeErrorColor(scheme->getColor("code/snippet/highlight/error/hover").c_str());
|
||||
|
||||
QList<QTextEdit::ExtraSelection> extraSelections;
|
||||
|
||||
for (const Annotation& annotation: m_annotations)
|
||||
@@ -395,21 +396,22 @@ void QtCodeArea::annotateText()
|
||||
bool isActive = std::find(ids.begin(), ids.end(), annotation.tokenId) != ids.end();
|
||||
bool isFocused = (annotation.tokenId == focusedTokenId);
|
||||
|
||||
QColor color;
|
||||
if (&annotation == m_hoveredAnnotation && errorMessages.size())
|
||||
{
|
||||
color.setNamedColor("#80FF0000");
|
||||
color = activeErrorColor;
|
||||
}
|
||||
else if (errorMessages.size())
|
||||
{
|
||||
color.setNamedColor("#FFFF0000");
|
||||
color = errorColor;
|
||||
}
|
||||
else if (isActive || isFocused)
|
||||
{
|
||||
color.setNamedColor("#90B6D1DD");
|
||||
color = activeLocationColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
color.setNamedColor("#90EBEBEB");
|
||||
color = locationColor;
|
||||
}
|
||||
|
||||
QTextEdit::ExtraSelection selection;
|
||||
|
||||
@@ -74,6 +74,10 @@ QtCodeFile::QtCodeFile(const FilePath& filePath, QtCodeFileList* parent)
|
||||
connect(m_snippetButton, SIGNAL(clicked()), this, SLOT(clickedSnippetButton()));
|
||||
connect(m_maximizeButton, SIGNAL(clicked()), this, SLOT(clickedMaximizeButton()));
|
||||
|
||||
m_minimizePlaceholder = new QWidget(this);
|
||||
m_minimizePlaceholder->setMinimumHeight(5);
|
||||
layout->addWidget(m_minimizePlaceholder);
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
@@ -120,6 +124,7 @@ void QtCodeFile::addCodeSnippet(
|
||||
if (locationFile->isWholeCopy)
|
||||
{
|
||||
snippet->setProperty("isFirst", true);
|
||||
snippet->setProperty("isLast", true);
|
||||
m_fileSnippet = snippet;
|
||||
clickedMaximizeButton();
|
||||
return;
|
||||
@@ -135,6 +140,7 @@ void QtCodeFile::addCodeSnippet(
|
||||
int maxDigits = 1;
|
||||
for (std::shared_ptr<QtCodeSnippet> snippet : m_snippets)
|
||||
{
|
||||
snippet->setProperty("isLast", false);
|
||||
maxDigits = qMax(maxDigits, snippet->lineNumberDigits());
|
||||
}
|
||||
|
||||
@@ -143,6 +149,8 @@ void QtCodeFile::addCodeSnippet(
|
||||
snippet->updateLineNumberAreaWidthForDigits(maxDigits);
|
||||
}
|
||||
|
||||
snippet->setProperty("isLast", true);
|
||||
|
||||
clickedSnippetButton();
|
||||
}
|
||||
|
||||
@@ -195,6 +203,8 @@ void QtCodeFile::clickedMinimizeButton()
|
||||
m_snippetButton->setEnabled(true);
|
||||
}
|
||||
m_maximizeButton->setEnabled(true);
|
||||
|
||||
m_minimizePlaceholder->show();
|
||||
}
|
||||
|
||||
void QtCodeFile::clickedSnippetButton()
|
||||
@@ -212,6 +222,8 @@ void QtCodeFile::clickedSnippetButton()
|
||||
m_minimizeButton->setEnabled(true);
|
||||
m_snippetButton->setEnabled(false);
|
||||
m_maximizeButton->setEnabled(true);
|
||||
|
||||
m_minimizePlaceholder->hide();
|
||||
}
|
||||
|
||||
void QtCodeFile::clickedMaximizeButton()
|
||||
@@ -236,4 +248,6 @@ void QtCodeFile::clickedMaximizeButton()
|
||||
m_snippetButton->setEnabled(true);
|
||||
}
|
||||
m_maximizeButton->setEnabled(false);
|
||||
|
||||
m_minimizePlaceholder->hide();
|
||||
}
|
||||
|
||||
@@ -59,6 +59,7 @@ private:
|
||||
|
||||
std::vector<std::shared_ptr<QtCodeSnippet>> m_snippets;
|
||||
std::shared_ptr<QtCodeSnippet> m_fileSnippet;
|
||||
QWidget* m_minimizePlaceholder;
|
||||
|
||||
const FilePath m_filePath;
|
||||
};
|
||||
|
||||
@@ -14,6 +14,8 @@ QtCodeFileList::QtCodeFileList(QWidget* parent)
|
||||
: QScrollArea(parent)
|
||||
, m_focusedTokenId(0)
|
||||
{
|
||||
setObjectName("code_file_list_base");
|
||||
|
||||
m_frame = std::make_shared<QFrame>(this);
|
||||
m_frame->setObjectName("code_file_list");
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ QtCodeSnippet::QtCodeSnippet(
|
||||
m_title->setObjectName("scope_name");
|
||||
m_title->minimumSizeHint(); // force font loading
|
||||
m_title->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
m_title->setSizePolicy(sizePolicy().horizontalPolicy(), QSizePolicy::Fixed);
|
||||
m_title->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||
titleLayout->addWidget(m_title);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "utility/messaging/type/MessageRedo.h"
|
||||
#include "utility/messaging/type/MessageRefresh.h"
|
||||
#include "utility/messaging/type/MessageSaveProject.h"
|
||||
#include "utility/messaging/type/MessageSwitchColorScheme.h"
|
||||
#include "utility/messaging/type/MessageUndo.h"
|
||||
#include "utility/messaging/type/MessageWindowFocus.h"
|
||||
#include "utility/messaging/type/MessageZoom.h"
|
||||
@@ -228,6 +229,16 @@ void QtMainWindow::zoomOut()
|
||||
MessageZoom(false).dispatch();
|
||||
}
|
||||
|
||||
void QtMainWindow::switchColorScheme()
|
||||
{
|
||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"), "./data/color_schemes", "XML Files (*.xml)");
|
||||
|
||||
if (!fileName.isEmpty())
|
||||
{
|
||||
MessageSwitchColorScheme(fileName.toStdString()).dispatch();
|
||||
}
|
||||
}
|
||||
|
||||
void QtMainWindow::handleEscapeShortcut()
|
||||
{
|
||||
m_startScreen->hide();
|
||||
@@ -271,6 +282,8 @@ void QtMainWindow::setupViewMenu()
|
||||
|
||||
menu->addAction(tr("Larger font"), this, SLOT(zoomIn()), QKeySequence::ZoomIn);
|
||||
menu->addAction(tr("Smaller font"), this, SLOT(zoomOut()), QKeySequence::ZoomOut);
|
||||
|
||||
menu->addAction(tr("Switch Color Scheme..."), this, SLOT(switchColorScheme()));
|
||||
}
|
||||
|
||||
void QtMainWindow::setupHelpMenu()
|
||||
|
||||
@@ -47,6 +47,7 @@ public slots:
|
||||
void redo();
|
||||
void zoomIn();
|
||||
void zoomOut();
|
||||
void switchColorScheme();
|
||||
|
||||
void handleEscapeShortcut();
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
#include "data/query/QueryTree.h"
|
||||
#include "qt/element/QtAutocompletionList.h"
|
||||
#include "settings/ApplicationSettings.h"
|
||||
#include "settings/ColorScheme.h"
|
||||
|
||||
QtQueryElement::QtQueryElement(const QString& text, QWidget* parent)
|
||||
: QPushButton(text, parent)
|
||||
@@ -573,6 +573,10 @@ void QtSmartSearchBox::updateElements()
|
||||
{
|
||||
m_elements.clear();
|
||||
|
||||
ColorScheme* scheme = ColorScheme::getInstance().get();
|
||||
|
||||
std::string textColor = scheme->getColor("search/field/text");
|
||||
|
||||
for (const SearchMatch& token : m_tokens)
|
||||
{
|
||||
std::string name = token.fullName;
|
||||
@@ -582,28 +586,25 @@ void QtSmartSearchBox::updateElements()
|
||||
std::shared_ptr<QtQueryElement> element = std::make_shared<QtQueryElement>(QString::fromStdString(name), this);
|
||||
m_elements.push_back(element);
|
||||
|
||||
std::string color = "#000000";
|
||||
std::string hoverColor = "#000000";
|
||||
std::string color;
|
||||
std::string hoverColor;
|
||||
|
||||
if (token.queryNodeType == QueryNode::QUERYNODETYPE_TOKEN)
|
||||
{
|
||||
element->setObjectName(QString::fromStdString("search_element_" + token.getNodeTypeAsString()));
|
||||
color = ApplicationSettings::getInstance()->getNodeTypeColor(token.nodeType);
|
||||
hoverColor = ApplicationSettings::getInstance()->getNodeTypeColor(token.nodeType, "hover");
|
||||
color = scheme->getNodeTypeColor(token.nodeType);
|
||||
hoverColor = scheme->getNodeTypeColor(token.nodeType, "hover");
|
||||
}
|
||||
else
|
||||
{
|
||||
element->setObjectName(QString::fromStdString("search_element_" + QueryTree::getTokenTypeName(token.queryNodeType)));
|
||||
color = ApplicationSettings::getInstance()->getQueryNodeTypeColor(token.queryNodeType);
|
||||
hoverColor = ApplicationSettings::getInstance()->getQueryNodeTypeColor(token.queryNodeType, "hover");
|
||||
color = scheme->getQueryNodeTypeColor(token.queryNodeType);
|
||||
hoverColor = scheme->getQueryNodeTypeColor(token.queryNodeType, "hover");
|
||||
}
|
||||
|
||||
std::stringstream css;
|
||||
css << "QPushButton { border: none; padding: 0px 4px; background-color:";
|
||||
css << color;
|
||||
css << ";} QPushButton:hover { background-color:";
|
||||
css << hoverColor;
|
||||
css << ";}";
|
||||
css << "QPushButton {border: none; padding: 0px 4px; background-color:" << color << "; color:" << textColor << ";} ";
|
||||
css << "QPushButton:hover { background-color:" << hoverColor << ";} ";
|
||||
|
||||
element->setStyleSheet(css.str().c_str());
|
||||
|
||||
|
||||
@@ -8,15 +8,18 @@
|
||||
#include "utility/utility.h"
|
||||
|
||||
#include "qt/graphics/QtRoundedRectItem.h"
|
||||
#include "settings/ColorScheme.h"
|
||||
|
||||
QtStraightLineItem::QtStraightLineItem(QGraphicsItem* parent)
|
||||
: QGraphicsLineItem(parent)
|
||||
{
|
||||
this->setAcceptHoverEvents(true);
|
||||
|
||||
ColorScheme* scheme = ColorScheme::getInstance().get();
|
||||
|
||||
m_circle = new QtRoundedRectItem(this);
|
||||
m_circle->setRadius(100);
|
||||
m_circle->setBrush(QBrush(QColor("#FFF")));
|
||||
m_circle->setBrush(QBrush(scheme->getColor("graph/background").c_str()));
|
||||
m_circle->setAcceptHoverEvents(true);
|
||||
|
||||
QFont font;
|
||||
@@ -26,6 +29,7 @@ QtStraightLineItem::QtStraightLineItem(QGraphicsItem* parent)
|
||||
|
||||
m_number = new QGraphicsSimpleTextItem(this);
|
||||
m_number->setFont(font);
|
||||
m_number->setBrush(QBrush(scheme->getColor("graph/text").c_str()));
|
||||
|
||||
m_arrowLeft = new QGraphicsLineItem(this);
|
||||
m_arrowRight = new QGraphicsLineItem(this);
|
||||
@@ -101,9 +105,6 @@ void QtStraightLineItem::updateLine(
|
||||
arrowSide -= nUnit * 14;
|
||||
m_arrowLeft->setLine(arrow.x, arrow.y, arrowSide.x, arrowSide.y);
|
||||
|
||||
m_arrowLeft->setPen(QPen(QBrush(QColor("#E0E0E0")), 2, Qt::SolidLine, Qt::RoundCap));
|
||||
m_arrowRight->setPen(QPen(QBrush(QColor("#E0E0E0")), 2, Qt::SolidLine, Qt::RoundCap));
|
||||
|
||||
m_arrowLeft->show();
|
||||
m_arrowRight->show();
|
||||
}
|
||||
@@ -114,15 +115,23 @@ void QtStraightLineItem::updateLine(
|
||||
}
|
||||
|
||||
m_circle->setRect(mid.x - radius, mid.y - radius, 2 * radius, 2 * radius);
|
||||
m_circle->setPen(QPen(QColor("#E0E0E0"), 2));
|
||||
|
||||
QString numberStr = QString::number(number);
|
||||
m_number->setText(numberStr);
|
||||
m_number->setBrush(QBrush(QColor("#666")));
|
||||
m_number->setPos(
|
||||
mid.x - QFontMetrics(m_number->font()).width(numberStr) / 2,
|
||||
mid.y - QFontMetrics(m_number->font()).height() / 2
|
||||
);
|
||||
|
||||
this->setPen(QPen(QBrush(style.color.c_str()), number + style.width, Qt::SolidLine, Qt::RoundCap));
|
||||
|
||||
QColor color(style.color.c_str());
|
||||
|
||||
this->setPen(QPen(QBrush(color), number + style.width, Qt::SolidLine, Qt::RoundCap));
|
||||
|
||||
color = color.darker(110);
|
||||
|
||||
m_circle->setPen(QPen(color, 2));
|
||||
|
||||
m_arrowLeft->setPen(QPen(QBrush(color), 2, Qt::SolidLine, Qt::RoundCap));
|
||||
m_arrowRight->setPen(QPen(QBrush(color), 2, Qt::SolidLine, Qt::RoundCap));
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
#include <QTextCursor>
|
||||
#include <QTextDocument>
|
||||
|
||||
#include "settings/ColorScheme.h"
|
||||
|
||||
QtHighlighter::QtHighlighter(QTextDocument *parent)
|
||||
: QSyntaxHighlighter(parent)
|
||||
{
|
||||
@@ -29,13 +31,15 @@ QtHighlighter::QtHighlighter(QTextDocument *parent)
|
||||
QRegExp numberRegExp = QRegExp("\\b[0-9]+\\b");
|
||||
QRegExp functionRegExp = QRegExp("\\b[A-Za-z0-9_]+(?=\\()");
|
||||
|
||||
QColor directiveColor = QColor(27,136,86);
|
||||
QColor keywordColor = QColor(27,136,86);
|
||||
QColor typeColor = QColor("#C1492D");
|
||||
QColor commentColor = Qt::gray;
|
||||
QColor numberColor = QColor("#C1315E");
|
||||
QColor quotationColor = QColor("#865F9E");
|
||||
QColor functionColor = QColor("#CC9533");
|
||||
ColorScheme* scheme = ColorScheme::getInstance().get();
|
||||
|
||||
QColor directiveColor(scheme->getSyntaxColor("directive").c_str());
|
||||
QColor keywordColor(scheme->getSyntaxColor("keyword").c_str());
|
||||
QColor typeColor(scheme->getSyntaxColor("type").c_str());
|
||||
QColor commentColor(scheme->getSyntaxColor("comment").c_str());
|
||||
QColor numberColor(scheme->getSyntaxColor("number").c_str());
|
||||
QColor quotationColor(scheme->getSyntaxColor("quotation").c_str());
|
||||
QColor functionColor(scheme->getSyntaxColor("function").c_str());
|
||||
|
||||
foreach (const QString &pattern, keywordPatterns)
|
||||
{
|
||||
|
||||
@@ -7,13 +7,18 @@
|
||||
|
||||
#include "utility/file/FileSystem.h"
|
||||
#include "utility/logging/logging.h"
|
||||
#include "utility/utilityString.h"
|
||||
#include "utility/text/TextAccess.h"
|
||||
|
||||
#include "settings/ApplicationSettings.h"
|
||||
#include "settings/ColorScheme.h"
|
||||
|
||||
namespace utility
|
||||
{
|
||||
void setWidgetBackgroundColor(QWidget* widget, const Colori& color)
|
||||
void setWidgetBackgroundColor(QWidget* widget, const std::string& color)
|
||||
{
|
||||
QPalette palette = widget->palette();
|
||||
palette.setColor(widget->backgroundRole(), QColor(color.r, color.g, color.b, color.a));
|
||||
palette.setColor(widget->backgroundRole(), QColor(color.c_str()));
|
||||
widget->setPalette(palette);
|
||||
widget->setAutoFillBackground(true);
|
||||
}
|
||||
@@ -47,4 +52,67 @@ namespace utility
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::string getStyleSheet(const std::string& path)
|
||||
{
|
||||
std::string css = TextAccess::createFromFile(path)->getText();
|
||||
|
||||
size_t pos = 0;
|
||||
|
||||
while (pos != std::string::npos)
|
||||
{
|
||||
size_t posA = css.find('<', pos);
|
||||
size_t posB = css.find('>', pos);
|
||||
|
||||
if (posA == std::string::npos || posB == std::string::npos)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
std::deque<std::string> seq = utility::split(css.substr(posA + 1, posB - posA - 1), ':');
|
||||
if (seq.size() != 2)
|
||||
{
|
||||
LOG_ERROR("Syntax error in file: " + path);
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string key = seq.front();
|
||||
std::string val = seq.back();
|
||||
|
||||
if (key == "setting")
|
||||
{
|
||||
if (val == "font_size")
|
||||
{
|
||||
val = std::to_string(ApplicationSettings::getInstance()->getFontSize());
|
||||
}
|
||||
else if (val == "font_size+2")
|
||||
{
|
||||
val = std::to_string(ApplicationSettings::getInstance()->getFontSize() + 2);
|
||||
}
|
||||
else if (val == "font_name")
|
||||
{
|
||||
val = ApplicationSettings::getInstance()->getFontName();
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR("Syntax error in file: " + path);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
else if (key == "color")
|
||||
{
|
||||
val = ColorScheme::getInstance()->getColor(val);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR("Syntax error in file: " + path);
|
||||
return "";
|
||||
}
|
||||
|
||||
css.replace(posA, posB - posA + 1, val);
|
||||
pos = posA + val.size();
|
||||
}
|
||||
|
||||
return css;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
#include <memory>
|
||||
#include <qwidget.h>
|
||||
|
||||
#include "utility/math/Color.h"
|
||||
|
||||
namespace utility
|
||||
{
|
||||
void setWidgetBackgroundColor(QWidget* widget, const Colori& color);
|
||||
void setWidgetBackgroundColor(QWidget* widget, const std::string& color);
|
||||
void loadFontsFromDirectory(const std::string& path, const std::string& extension = ".otf");
|
||||
|
||||
std::string getStyleSheet(const std::string& path);
|
||||
}
|
||||
|
||||
# endif // UTILITY_QT_H
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
#include "qt/view/QtCodeView.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "utility/file/FileSystem.h"
|
||||
#include "utility/text/TextAccess.h"
|
||||
#include "qt/utility/utilityQt.h"
|
||||
|
||||
#include "qt/element/QtCodeFileList.h"
|
||||
#include "qt/view/QtViewWidgetWrapper.h"
|
||||
#include "settings/ApplicationSettings.h"
|
||||
#include "settings/ColorScheme.h"
|
||||
|
||||
QtCodeView::QtCodeView(ViewLayout* viewLayout)
|
||||
: CodeView(viewLayout)
|
||||
@@ -19,7 +17,7 @@ QtCodeView::QtCodeView(ViewLayout* viewLayout)
|
||||
, m_defocusTokenFunctor(std::bind(&QtCodeView::doDefocusToken, this))
|
||||
{
|
||||
m_widget = new QtCodeFileList();
|
||||
setStyleSheet(m_widget);
|
||||
setStyleSheet();
|
||||
}
|
||||
|
||||
QtCodeView::~QtCodeView()
|
||||
@@ -77,7 +75,7 @@ void QtCodeView::defocusToken()
|
||||
|
||||
void QtCodeView::doRefreshView()
|
||||
{
|
||||
setStyleSheet(m_widget);
|
||||
setStyleSheet();
|
||||
m_widget->clearCodeSnippets();
|
||||
}
|
||||
|
||||
@@ -92,6 +90,8 @@ void QtCodeView::doShowCodeSnippets(const std::vector<CodeSnippetParams>& snippe
|
||||
{
|
||||
m_widget->addCodeSnippet(params.startLineNumber, params.title, params.code, params.locationFile);
|
||||
}
|
||||
|
||||
setStyleSheet(); // so property "isLast" of QtCodeSnippet is computed correctly
|
||||
}
|
||||
|
||||
void QtCodeView::doShowCodeFile(const CodeSnippetParams& params)
|
||||
@@ -115,12 +115,9 @@ void QtCodeView::doDefocusToken()
|
||||
m_widget->defocusToken();
|
||||
}
|
||||
|
||||
void QtCodeView::setStyleSheet(QWidget* widget) const
|
||||
void QtCodeView::setStyleSheet() const
|
||||
{
|
||||
std::stringstream css;
|
||||
css << TextAccess::createFromFile("data/gui/code_view/code_view.css")->getText();
|
||||
css << "* { font-size: " << ApplicationSettings::getInstance()->getFontSize() << "pt; }";
|
||||
css << "#code_file #code_snippet * { font-family: " << ApplicationSettings::getInstance()->getFontName() << "; }";
|
||||
utility::setWidgetBackgroundColor(m_widget, ColorScheme::getInstance()->getColor("code/background"));
|
||||
|
||||
widget->setStyleSheet(css.str().c_str());
|
||||
m_widget->setStyleSheet(utility::getStyleSheet("data/gui/code_view/code_view.css").c_str());
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ private:
|
||||
void doFocusToken(const Id tokenId);
|
||||
void doDefocusToken();
|
||||
|
||||
void setStyleSheet(QWidget* widget) const;
|
||||
void setStyleSheet() const;
|
||||
|
||||
QtThreadedFunctor<> m_refreshViewFunctor;
|
||||
QtThreadedFunctor<const std::vector<CodeSnippetParams>&> m_showCodeSnippetsFunctor;
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "qt/utility/utilityQt.h"
|
||||
#include "qt/view/QtViewWidgetWrapper.h"
|
||||
#include "settings/ColorScheme.h"
|
||||
|
||||
QtCompositeView::QtCompositeView(ViewLayout* viewLayout, CompositeDirection direction)
|
||||
: CompositeView(viewLayout, direction)
|
||||
@@ -24,7 +25,8 @@ QtCompositeView::QtCompositeView(ViewLayout* viewLayout, CompositeDirection dire
|
||||
|
||||
m_widget = new QWidget();
|
||||
m_widget->setLayout(layout);
|
||||
utility::setWidgetBackgroundColor(m_widget, Colori(255, 255, 255, 255));
|
||||
|
||||
refreshView();
|
||||
}
|
||||
|
||||
QtCompositeView::~QtCompositeView()
|
||||
@@ -43,7 +45,7 @@ void QtCompositeView::initView()
|
||||
|
||||
void QtCompositeView::refreshView()
|
||||
{
|
||||
|
||||
utility::setWidgetBackgroundColor(m_widget, ColorScheme::getInstance()->getColor("search/background"));
|
||||
}
|
||||
|
||||
void QtCompositeView::addViewWidget(View* view)
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "qt/view/graphElements/QtGraphNodeBundle.h"
|
||||
#include "qt/view/graphElements/QtGraphNodeData.h"
|
||||
#include "qt/view/graphElements/QtGraphNodeExpandToggle.h"
|
||||
#include "settings/ColorScheme.h"
|
||||
|
||||
QtGraphView::QtGraphView(ViewLayout* viewLayout)
|
||||
: GraphView(viewLayout)
|
||||
@@ -47,7 +48,6 @@ void QtGraphView::createWidgetWrapper()
|
||||
void QtGraphView::initView()
|
||||
{
|
||||
QWidget* widget = QtViewWidgetWrapper::getWidgetOfView(this);
|
||||
utility::setWidgetBackgroundColor(widget, Colori(255, 255, 255, 255));
|
||||
|
||||
QBoxLayout* layout = new QBoxLayout(QBoxLayout::TopToBottom);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
@@ -61,12 +61,19 @@ void QtGraphView::initView()
|
||||
view->setRenderHints(QPainter::Antialiasing);
|
||||
|
||||
widget->layout()->addWidget(view);
|
||||
|
||||
refreshView();
|
||||
}
|
||||
|
||||
void QtGraphView::refreshView()
|
||||
{
|
||||
clear();
|
||||
resizeView();
|
||||
|
||||
std::string backgroundColor = ColorScheme::getInstance()->getColor("graph/background");
|
||||
|
||||
utility::setWidgetBackgroundColor(QtViewWidgetWrapper::getWidgetOfView(this), backgroundColor);
|
||||
utility::setWidgetBackgroundColor(getView(), backgroundColor);
|
||||
}
|
||||
|
||||
void QtGraphView::rebuildGraph(
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
#include "qt/view/QtRefreshView.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "utility/text/TextAccess.h"
|
||||
#include "qt/utility/utilityQt.h"
|
||||
|
||||
#include "component/controller/RefreshController.h"
|
||||
#include "qt/view/QtViewWidgetWrapper.h"
|
||||
#include "settings/ApplicationSettings.h"
|
||||
|
||||
QtRefreshView::QtRefreshView(ViewLayout* viewLayout)
|
||||
: RefreshView(viewLayout)
|
||||
@@ -42,9 +39,5 @@ void QtRefreshView::doRefreshView()
|
||||
|
||||
void QtRefreshView::setStyleSheet()
|
||||
{
|
||||
std::stringstream css;
|
||||
css << TextAccess::createFromFile("data/gui/refresh_view/refresh_view.css")->getText();
|
||||
css << "* { font-size: " << ApplicationSettings::getInstance()->getFontSize() << "pt; }";
|
||||
|
||||
m_widget->setStyleSheet(css.str().c_str());
|
||||
m_widget->setStyleSheet(utility::getStyleSheet("data/gui/refresh_view/refresh_view.css").c_str());
|
||||
}
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
#include "qt/view/QtSearchView.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "utility/text/TextAccess.h"
|
||||
#include "qt/utility/utilityQt.h"
|
||||
|
||||
#include "component/controller/SearchController.h"
|
||||
#include "qt/view/QtViewWidgetWrapper.h"
|
||||
#include "settings/ApplicationSettings.h"
|
||||
|
||||
QtSearchView::QtSearchView(ViewLayout* viewLayout)
|
||||
: SearchView(viewLayout)
|
||||
@@ -78,16 +75,12 @@ void QtSearchView::doSetAutocompletionList(const std::vector<SearchMatch>& autoc
|
||||
|
||||
void QtSearchView::setStyleSheet()
|
||||
{
|
||||
std::stringstream css;
|
||||
css << TextAccess::createFromFile("data/gui/search_view/search_view.css")->getText();
|
||||
css << "* { font-size: " << ApplicationSettings::getInstance()->getFontSize() << "pt; }";
|
||||
css << "#search_box, #search_box *, #search_box_popup { font-family: " << ApplicationSettings::getInstance()->getFontName() << "; }";
|
||||
css << "#search_box, #search_box * { font-size: " << ApplicationSettings::getInstance()->getFontSize() + 2 << "pt; }";
|
||||
std::string css = utility::getStyleSheet("data/gui/search_view/search_view.css");
|
||||
|
||||
m_widget->setStyleSheet(css.str().c_str());
|
||||
m_widget->setStyleSheet(css.c_str());
|
||||
|
||||
if (m_widget->getCompleterPopup())
|
||||
{
|
||||
m_widget->getCompleterPopup()->setStyleSheet(css.str().c_str());
|
||||
m_widget->getCompleterPopup()->setStyleSheet(css.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
#include "qt/view/QtUndoRedoView.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "utility/text/TextAccess.h"
|
||||
#include "qt/utility/utilityQt.h"
|
||||
|
||||
#include "qt/view/QtMainView.h"
|
||||
#include "qt/view/QtViewWidgetWrapper.h"
|
||||
#include "settings/ApplicationSettings.h"
|
||||
|
||||
QtUndoRedoView::QtUndoRedoView(ViewLayout* viewLayout)
|
||||
: UndoRedoView(viewLayout)
|
||||
@@ -38,11 +35,7 @@ void QtUndoRedoView::refreshView()
|
||||
|
||||
void QtUndoRedoView::setStyleSheet()
|
||||
{
|
||||
std::stringstream css;
|
||||
css << TextAccess::createFromFile("data/gui/undoredo_view/undoredo_view.css")->getText();
|
||||
css << "* { font-size: " << ApplicationSettings::getInstance()->getFontSize() << "pt; }";
|
||||
|
||||
m_widget->setStyleSheet(css.str().c_str());
|
||||
m_widget->setStyleSheet(utility::getStyleSheet("data/gui/undoredo_view/undoredo_view.css").c_str());
|
||||
}
|
||||
|
||||
void QtUndoRedoView::doSetRedoButtonEnabled(bool enabled)
|
||||
|
||||
@@ -392,5 +392,6 @@ void QtGraphNode::setStyle(const GraphViewStyle::NodeStyle& style)
|
||||
}
|
||||
|
||||
m_text->setFont(font);
|
||||
m_text->setBrush(QBrush(style.textColor.c_str()));
|
||||
m_text->setPos(style.textOffset.x, style.textOffset.y);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "component/view/ViewFactory.h"
|
||||
#include "data/StorageCache.h"
|
||||
#include "settings/ApplicationSettings.h"
|
||||
#include "settings/ColorScheme.h"
|
||||
|
||||
std::shared_ptr<Application> Application::create(ViewFactory* viewFactory)
|
||||
{
|
||||
@@ -32,6 +33,8 @@ std::shared_ptr<Application> Application::create(ViewFactory* viewFactory)
|
||||
void Application::loadSettings()
|
||||
{
|
||||
ApplicationSettings::getInstance()->load("data/ApplicationSettings.xml");
|
||||
ColorScheme::getInstance()->load(ApplicationSettings::getInstance()->getColorSchemePath());
|
||||
|
||||
GraphViewStyle::loadStyleSettings();
|
||||
}
|
||||
|
||||
|
||||
@@ -211,6 +211,8 @@ add_files(
|
||||
|
||||
settings/ApplicationSettings.cpp
|
||||
settings/ApplicationSettings.h
|
||||
settings/ColorScheme.cpp
|
||||
settings/ColorScheme.h
|
||||
settings/CommonSettings.cpp
|
||||
settings/CommonSettings.h
|
||||
settings/ProjectSettings.cpp
|
||||
@@ -274,6 +276,7 @@ add_files(
|
||||
utility/messaging/type/MessageSearchAutocomplete.h
|
||||
utility/messaging/type/MessageShowFile.h
|
||||
utility/messaging/type/MessageStatus.h
|
||||
utility/messaging/type/MessageSwitchColorScheme.h
|
||||
utility/messaging/type/MessageUndo.h
|
||||
utility/messaging/type/MessageWindowFocus.h
|
||||
utility/messaging/type/MessageZoom.h
|
||||
|
||||
@@ -60,6 +60,11 @@ void ComponentManager::refreshViews()
|
||||
view->refreshView();
|
||||
}
|
||||
}
|
||||
|
||||
for (std::shared_ptr<CompositeView> view : m_compositeViews)
|
||||
{
|
||||
view->refreshView();
|
||||
}
|
||||
}
|
||||
|
||||
ComponentManager::ComponentManager()
|
||||
|
||||
@@ -88,6 +88,15 @@ void FeatureController::handleMessage(MessageSearch* message)
|
||||
m.dispatchImmediately();
|
||||
}
|
||||
|
||||
void FeatureController::handleMessage(MessageSwitchColorScheme* message)
|
||||
{
|
||||
ApplicationSettings* settings = ApplicationSettings::getInstance().get();
|
||||
settings->setColorSchemePath(message->colorSchemeFilePath);
|
||||
settings->save();
|
||||
|
||||
MessageRefresh(true).dispatch();
|
||||
}
|
||||
|
||||
void FeatureController::handleMessage(MessageZoom* message)
|
||||
{
|
||||
ApplicationSettings* settings = ApplicationSettings::getInstance().get();
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "utility/messaging/type/MessageActivateNode.h"
|
||||
#include "utility/messaging/type/MessageActivateTokenLocation.h"
|
||||
#include "utility/messaging/type/MessageSearch.h"
|
||||
#include "utility/messaging/type/MessageSwitchColorScheme.h"
|
||||
#include "utility/messaging/type/MessageZoom.h"
|
||||
|
||||
#include "component/controller/Controller.h"
|
||||
@@ -20,6 +21,7 @@ class FeatureController
|
||||
, public MessageListener<MessageActivateNode>
|
||||
, public MessageListener<MessageActivateTokenLocation>
|
||||
, public MessageListener<MessageSearch>
|
||||
, public MessageListener<MessageSwitchColorScheme>
|
||||
, public MessageListener<MessageZoom>
|
||||
{
|
||||
public:
|
||||
@@ -32,6 +34,7 @@ private:
|
||||
virtual void handleMessage(MessageActivateNode* message);
|
||||
virtual void handleMessage(MessageActivateTokenLocation* message);
|
||||
virtual void handleMessage(MessageSearch* message);
|
||||
virtual void handleMessage(MessageSwitchColorScheme* message);
|
||||
virtual void handleMessage(MessageZoom* message);
|
||||
|
||||
StorageAccess* m_storageAccess;
|
||||
|
||||
@@ -213,10 +213,13 @@ void UndoRedoController::processNormalCommand(const Command& command)
|
||||
|
||||
void UndoRedoController::processRedoCommand(const Command& command)
|
||||
{
|
||||
m_undo.push_back(m_lastCommand);
|
||||
m_lastCommand = command;
|
||||
if (m_lastCommand.message)
|
||||
{
|
||||
m_undo.push_back(m_lastCommand);
|
||||
getView()->setUndoButtonEnabled(true);
|
||||
}
|
||||
|
||||
getView()->setUndoButtonEnabled(true);
|
||||
m_lastCommand = command;
|
||||
|
||||
if (m_redo.empty())
|
||||
{
|
||||
@@ -226,10 +229,13 @@ void UndoRedoController::processRedoCommand(const Command& command)
|
||||
|
||||
void UndoRedoController::processUndoCommand(const Command& command)
|
||||
{
|
||||
m_redo.push_back(m_lastCommand);
|
||||
m_lastCommand = command;
|
||||
if (m_lastCommand.message)
|
||||
{
|
||||
m_redo.push_back(m_lastCommand);
|
||||
getView()->setRedoButtonEnabled(true);
|
||||
}
|
||||
|
||||
getView()->setRedoButtonEnabled(true);
|
||||
m_lastCommand = command;
|
||||
|
||||
if (m_undo.empty())
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "component/view/GraphViewStyleImpl.h"
|
||||
#include "settings/ApplicationSettings.h"
|
||||
#include "settings/ColorScheme.h"
|
||||
|
||||
GraphViewStyle::NodeMargins::NodeMargins()
|
||||
: left(0)
|
||||
@@ -248,33 +249,31 @@ GraphViewStyle::NodeStyle GraphViewStyle::getStyleForNodeType(
|
||||
){
|
||||
NodeStyle style;
|
||||
|
||||
style.color = "#D3D3D3";
|
||||
style.borderColor = "#00000000";
|
||||
|
||||
style.fontName = getFontNameForNodeType(type);
|
||||
style.fontSize = getFontSizeForNodeType(type);
|
||||
|
||||
if (isActive)
|
||||
{
|
||||
style.borderColor = "#3c3c3c";
|
||||
}
|
||||
ColorScheme* scheme = ColorScheme::getInstance().get();
|
||||
|
||||
if (isActive || isFocused)
|
||||
{
|
||||
style.color = ApplicationSettings::getInstance()->getNodeTypeColor(type, "hover");
|
||||
style.color = scheme->getNodeTypeColor(type, "hover");
|
||||
}
|
||||
else
|
||||
{
|
||||
style.color = ApplicationSettings::getInstance()->getNodeTypeColor(type);
|
||||
style.color = scheme->getNodeTypeColor(type);
|
||||
}
|
||||
|
||||
style.textColor = scheme->getColor("graph/text");
|
||||
style.borderColor = isActive ? scheme->getColor("graph/border") : "#00000000";
|
||||
|
||||
style.fontName = getFontNameForNodeType(type);
|
||||
style.fontSize = getFontSizeForNodeType(type);
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case Node::NODE_UNDEFINED:
|
||||
style.borderDashed = true;
|
||||
|
||||
case Node::NODE_NAMESPACE:
|
||||
style.borderColor = "#cc8d91";
|
||||
style.borderColor = style.color;
|
||||
style.color = "#00000000";
|
||||
style.borderWidth = 1;
|
||||
|
||||
style.cornerRadius = 20;
|
||||
@@ -296,13 +295,14 @@ GraphViewStyle::NodeStyle GraphViewStyle::getStyleForNodeType(
|
||||
style.fontBold = true;
|
||||
}
|
||||
|
||||
style.shadowColor = scheme->getColor("graph/border");
|
||||
if (isFocused)
|
||||
{
|
||||
style.shadowColor = "#FF000000";
|
||||
style.shadowColor.insert(1, "FF");
|
||||
}
|
||||
else
|
||||
{
|
||||
style.shadowColor = "#80000000";
|
||||
style.shadowColor.insert(1, "80");
|
||||
}
|
||||
style.shadowBlurRadius = 5;
|
||||
|
||||
@@ -363,7 +363,10 @@ GraphViewStyle::NodeStyle GraphViewStyle::getStyleOfAccessNode()
|
||||
{
|
||||
NodeStyle style;
|
||||
|
||||
style.color = "#FFFFFF";
|
||||
ColorScheme* scheme = ColorScheme::getInstance().get();
|
||||
|
||||
style.color = scheme->getColor("graph/background");
|
||||
style.textColor = scheme->getColor("graph/text");
|
||||
style.borderColor = "#00000000";
|
||||
|
||||
style.cornerRadius = 12;
|
||||
@@ -382,7 +385,10 @@ GraphViewStyle::NodeStyle GraphViewStyle::getStyleOfExpandToggleNode()
|
||||
{
|
||||
NodeStyle style;
|
||||
|
||||
style.color = "#FFFFFF";
|
||||
ColorScheme* scheme = ColorScheme::getInstance().get();
|
||||
|
||||
style.color = scheme->getColor("graph/background");
|
||||
style.textColor = scheme->getColor("graph/text");
|
||||
style.borderColor = "#00000000";
|
||||
|
||||
style.cornerRadius = 100;
|
||||
@@ -397,8 +403,10 @@ GraphViewStyle::NodeStyle GraphViewStyle::getStyleOfBundleNode(bool isFocused)
|
||||
{
|
||||
NodeStyle style = getStyleForNodeType(Node::NODE_CLASS, false, isFocused, false);
|
||||
|
||||
ColorScheme* scheme = ColorScheme::getInstance().get();
|
||||
|
||||
style.shadowColor = "";
|
||||
style.borderColor = "#3c3c3c";
|
||||
style.borderColor = scheme->getColor("graph/border");
|
||||
style.borderWidth = isFocused ? 2 : 1;
|
||||
|
||||
return style;
|
||||
@@ -423,23 +431,28 @@ GraphViewStyle::EdgeStyle GraphViewStyle::getStyleForEdgeType(Edge::EdgeType typ
|
||||
style.originOffset.y = -1;
|
||||
style.targetOffset.y = 1;
|
||||
|
||||
if (isActive)
|
||||
{
|
||||
style.color = ColorScheme::getInstance()->getEdgeTypeColor(type, "hover");
|
||||
}
|
||||
else
|
||||
{
|
||||
style.color = ColorScheme::getInstance()->getEdgeTypeColor(type);
|
||||
}
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case Edge::EDGE_AGGREGATION:
|
||||
style.isStraight = true;
|
||||
style.color = isActive ? "#DDD" : "#EEE";
|
||||
style.width = 1;
|
||||
style.zValue = isActive ? -2 : -5;
|
||||
break;
|
||||
|
||||
case Edge::EDGE_CALL:
|
||||
style.color = "#F4BC3D";
|
||||
style.originOffset.y = 1;
|
||||
style.targetOffset.y = -1;
|
||||
style.verticalOffset = 4;
|
||||
break;
|
||||
case Edge::EDGE_USAGE:
|
||||
style.color = "#3190BA";
|
||||
style.originOffset.y = 3;
|
||||
style.targetOffset.y = -3;
|
||||
style.verticalOffset = 6;
|
||||
@@ -449,22 +462,8 @@ GraphViewStyle::EdgeStyle GraphViewStyle::getStyleForEdgeType(Edge::EdgeType typ
|
||||
style.arrowWidth = 14;
|
||||
style.arrowClosed = true;
|
||||
style.targetOffset.x = 34;
|
||||
style.color = "#878787";
|
||||
break;
|
||||
case Edge::EDGE_OVERRIDE:
|
||||
style.color = "#CC5E89";
|
||||
break;
|
||||
case Edge::EDGE_INCLUDE:
|
||||
style.color = "#5DA399";
|
||||
break;
|
||||
case Edge::EDGE_TEMPLATE_PARAMETER_OF:
|
||||
case Edge::EDGE_TEMPLATE_ARGUMENT_OF:
|
||||
case Edge::EDGE_TEMPLATE_DEFAULT_ARGUMENT_OF:
|
||||
case Edge::EDGE_TEMPLATE_SPECIALIZATION_OF:
|
||||
style.color = "#C1305D";
|
||||
break;
|
||||
default:
|
||||
style.color = "#878787";
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ public:
|
||||
NodeStyle();
|
||||
|
||||
std::string color;
|
||||
std::string textColor;
|
||||
|
||||
std::string shadowColor;
|
||||
int shadowBlurRadius;
|
||||
|
||||
@@ -154,13 +154,13 @@ std::string Edge::getTypeString(EdgeType type)
|
||||
case EDGE_TYPEDEF_OF:
|
||||
return "typedef";
|
||||
case EDGE_TEMPLATE_PARAMETER_OF:
|
||||
return "template parameter";
|
||||
return "template_parameter";
|
||||
case EDGE_TEMPLATE_ARGUMENT_OF:
|
||||
return "template argument";
|
||||
return "template_argument";
|
||||
case EDGE_TEMPLATE_DEFAULT_ARGUMENT_OF:
|
||||
return "template default argument";
|
||||
return "template_default_argument";
|
||||
case EDGE_TEMPLATE_SPECIALIZATION_OF:
|
||||
return "template specialization";
|
||||
return "template_specialization";
|
||||
case EDGE_INCLUDE:
|
||||
return "include";
|
||||
case EDGE_AGGREGATION:
|
||||
|
||||
@@ -46,6 +46,16 @@ void ApplicationSettings::setFontSize(int fontSize)
|
||||
setValue<int>("application/font_size", fontSize);
|
||||
}
|
||||
|
||||
std::string ApplicationSettings::getColorSchemePath() const
|
||||
{
|
||||
return getValue<std::string>("application/color_scheme", "./data/color_schemes/bright.xml");
|
||||
}
|
||||
|
||||
void ApplicationSettings::setColorSchemePath(const std::string& colorSchemePath)
|
||||
{
|
||||
setValue<std::string>("application/color_scheme", colorSchemePath);
|
||||
}
|
||||
|
||||
int ApplicationSettings::getCodeTabWidth() const
|
||||
{
|
||||
return getValue<int>("code/TabWidth", 4);
|
||||
@@ -76,31 +86,6 @@ void ApplicationSettings::setCodeSnippetExpandRange(int range)
|
||||
setValue<int>("code/snippet/expand_range", range);
|
||||
}
|
||||
|
||||
std::string ApplicationSettings::getNodeTypeColor(Node::NodeType type, const std::string& state) const
|
||||
{
|
||||
std::string path = "colors/" + Node::getTypeString(type) + "/" + state;
|
||||
return getValue<std::string>(path, "#FFFFFF");
|
||||
}
|
||||
|
||||
void ApplicationSettings::setNodeTypeColor(Node::NodeType type, const std::string& color, const std::string& state)
|
||||
{
|
||||
std::string path = "colors/" + Node::getTypeString(type) + "/" + state;
|
||||
setValue<std::string>(path, color);
|
||||
}
|
||||
|
||||
std::string ApplicationSettings::getQueryNodeTypeColor(QueryNode::QueryNodeType type, const std::string& state) const
|
||||
{
|
||||
std::string path = "colors/" + QueryNode::queryNodeTypeToString(type) + "/" + state;
|
||||
return getValue<std::string>(path, "#FFFFFF");
|
||||
}
|
||||
|
||||
void ApplicationSettings::setQueryNodeTypeColor(QueryNode::QueryNodeType type,
|
||||
const std::string& color, const std::string& state)
|
||||
{
|
||||
std::string path = "colors/" + QueryNode::queryNodeTypeToString(type) + "/" + state;
|
||||
setValue<std::string>(path, color);
|
||||
}
|
||||
|
||||
ApplicationSettings::ApplicationSettings()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -3,10 +3,6 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "utility/math/Color.h"
|
||||
|
||||
#include "data/graph/Node.h"
|
||||
#include "data/query/QueryNode.h"
|
||||
#include "settings/CommonSettings.h"
|
||||
|
||||
class ApplicationSettings
|
||||
@@ -26,6 +22,9 @@ public:
|
||||
int getFontSize() const;
|
||||
void setFontSize(int fontSize);
|
||||
|
||||
std::string getColorSchemePath() const;
|
||||
void setColorSchemePath(const std::string& colorSchemePath);
|
||||
|
||||
// code
|
||||
int getCodeTabWidth() const;
|
||||
void setCodeTabWidth(int codeTabWidth);
|
||||
@@ -36,13 +35,6 @@ public:
|
||||
int getCodeSnippetExpandRange() const;
|
||||
void setCodeSnippetExpandRange(int range);
|
||||
|
||||
// colors
|
||||
std::string getNodeTypeColor(Node::NodeType type, const std::string& state = "normal") const;
|
||||
void setNodeTypeColor(Node::NodeType type, const std::string& color, const std::string& state = "normal");
|
||||
|
||||
std::string getQueryNodeTypeColor(QueryNode::QueryNodeType type , const std::string& state = "normal") const;
|
||||
void setQueryNodeTypeColor(QueryNode::QueryNodeType type, const std::string& color, const std::string& state = "normal");
|
||||
|
||||
private:
|
||||
ApplicationSettings();
|
||||
ApplicationSettings(const ApplicationSettings&);
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
#include "settings/ColorScheme.h"
|
||||
|
||||
std::shared_ptr<ColorScheme> ColorScheme::s_instance;
|
||||
|
||||
std::shared_ptr<ColorScheme> ColorScheme::getInstance()
|
||||
{
|
||||
if (!s_instance)
|
||||
{
|
||||
s_instance = std::shared_ptr<ColorScheme>(new ColorScheme());
|
||||
}
|
||||
|
||||
return s_instance;
|
||||
}
|
||||
|
||||
ColorScheme::~ColorScheme()
|
||||
{
|
||||
}
|
||||
|
||||
std::string ColorScheme::getColor(const std::string& key) const
|
||||
{
|
||||
return getValue<std::string>(key, "#FFFFFF");
|
||||
}
|
||||
|
||||
std::string ColorScheme::getNodeTypeColor(Node::NodeType type, const std::string& state) const
|
||||
{
|
||||
std::string path = "graph/node/" + Node::getTypeString(type) + "/" + state;
|
||||
return getValue<std::string>(path, "#FFFFFF");
|
||||
}
|
||||
|
||||
std::string ColorScheme::getEdgeTypeColor(Edge::EdgeType type, const std::string& state) const
|
||||
{
|
||||
std::string path = "graph/edge/" + Edge::getTypeString(type) + "/" + state;
|
||||
return getValue<std::string>(path, "#FFFFFF");
|
||||
}
|
||||
|
||||
std::string ColorScheme::getQueryNodeTypeColor(QueryNode::QueryNodeType type, const std::string& state) const
|
||||
{
|
||||
std::string path = "search/query/" + QueryNode::queryNodeTypeToString(type) + "/" + state;
|
||||
return getValue<std::string>(path, "#FFFFFF");
|
||||
}
|
||||
|
||||
std::string ColorScheme::getSyntaxColor(const std::string& key) const
|
||||
{
|
||||
return getValue<std::string>("code/snippet/syntax/" + key, "#FFFFFF");
|
||||
}
|
||||
|
||||
ColorScheme::ColorScheme()
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
#ifndef COLOR_SCHEME_H
|
||||
#define COLOR_SCHEME_H
|
||||
|
||||
#include "data/graph/Node.h"
|
||||
#include "data/graph/Edge.h"
|
||||
#include "data/query/QueryNode.h"
|
||||
#include "settings/Settings.h"
|
||||
|
||||
class ColorScheme
|
||||
: public Settings
|
||||
{
|
||||
public:
|
||||
static std::shared_ptr<ColorScheme> getInstance();
|
||||
virtual ~ColorScheme();
|
||||
|
||||
std::string getColor(const std::string& key) const;
|
||||
|
||||
std::string getNodeTypeColor(Node::NodeType type, const std::string& state = "normal") const;
|
||||
std::string getEdgeTypeColor(Edge::EdgeType type, const std::string& state = "normal") const;
|
||||
std::string getQueryNodeTypeColor(QueryNode::QueryNodeType type, const std::string& state = "normal") const;
|
||||
std::string getSyntaxColor(const std::string& key) const;
|
||||
|
||||
protected:
|
||||
ColorScheme();
|
||||
ColorScheme(const ColorScheme&);
|
||||
void operator=(const ColorScheme&);
|
||||
|
||||
static std::shared_ptr<ColorScheme> s_instance;
|
||||
};
|
||||
|
||||
#endif // COLOR_SCHEME_H
|
||||
@@ -0,0 +1,23 @@
|
||||
#ifndef MESSAGE_SWITCH_COLOR_SCHEME_H
|
||||
#define MESSAGE_SWITCH_COLOR_SCHEME_H
|
||||
|
||||
#include "utility/messaging/Message.h"
|
||||
|
||||
class MessageSwitchColorScheme
|
||||
: public Message<MessageSwitchColorScheme>
|
||||
{
|
||||
public:
|
||||
MessageSwitchColorScheme(const std::string& filePath)
|
||||
: colorSchemeFilePath(filePath)
|
||||
{
|
||||
}
|
||||
|
||||
static const std::string getStaticType()
|
||||
{
|
||||
return "MessageSwitchColorScheme";
|
||||
}
|
||||
|
||||
const std::string colorSchemeFilePath;
|
||||
};
|
||||
|
||||
#endif // MESSAGE_SWITCH_COLOR_SCHEME_H
|
||||
Reference in New Issue
Block a user