ui: Defined colors for fulltext search and fulltext code highlights
This commit is contained in:
@@ -13,7 +13,7 @@
|
|||||||
</button>
|
</button>
|
||||||
|
|
||||||
<field>
|
<field>
|
||||||
<text>#3D3D3D</text>
|
<text>#FFFFFF</text>
|
||||||
<background>#808080</background>
|
<background>#808080</background>
|
||||||
<highlight>#B1B1B1</highlight>
|
<highlight>#B1B1B1</highlight>
|
||||||
</field>
|
</field>
|
||||||
@@ -27,17 +27,45 @@
|
|||||||
|
|
||||||
<query>
|
<query>
|
||||||
<none>
|
<none>
|
||||||
<normal>#B1B1B1</normal>
|
<normal>
|
||||||
<hover>#CCCCCC</hover>
|
<fill>#B1B1B1</fill>
|
||||||
|
<text>#3D3D3D</text>
|
||||||
|
</normal>
|
||||||
|
<hover>
|
||||||
|
<fill>#CCCCCC</fill>
|
||||||
|
<text>#3D3D3D</text>
|
||||||
|
</hover>
|
||||||
</none>
|
</none>
|
||||||
<command>
|
<command>
|
||||||
<normal>#86BD40</normal>
|
<normal>
|
||||||
<hover>#9EC769</hover>
|
<fill>#86BD40</fill>
|
||||||
|
<text>#3D3D3D</text>
|
||||||
|
</normal>
|
||||||
|
<hover>
|
||||||
|
<fill>#9EC769</fill>
|
||||||
|
<text>#3D3D3D</text>
|
||||||
|
</hover>
|
||||||
</command>
|
</command>
|
||||||
<operator>
|
<operator>
|
||||||
<normal>#7D2724</normal>
|
<normal>
|
||||||
<hover>#8C2B29</hover>
|
<fill>#7D2724</fill>
|
||||||
|
<text>#3D3D3D</text>
|
||||||
|
</normal>
|
||||||
|
<hover>
|
||||||
|
<fill>#8C2B29</fill>
|
||||||
|
<text>#3D3D3D</text>
|
||||||
|
</hover>
|
||||||
</operator>
|
</operator>
|
||||||
|
<fulltext>
|
||||||
|
<normal>
|
||||||
|
<fill>#C2AFEF</fill>
|
||||||
|
<text>#3D3D3D</text>
|
||||||
|
</normal>
|
||||||
|
<hover>
|
||||||
|
<fill>#AB96EA</fill>
|
||||||
|
<text>#3D3D3D</text>
|
||||||
|
</hover>
|
||||||
|
</fulltext>
|
||||||
</query>
|
</query>
|
||||||
</search>
|
</search>
|
||||||
|
|
||||||
@@ -123,46 +151,23 @@
|
|||||||
<border>transparent</border>
|
<border>transparent</border>
|
||||||
<fill>transparent</fill>
|
<fill>transparent</fill>
|
||||||
</normal>
|
</normal>
|
||||||
<focus>
|
|
||||||
<border>transparent</border>
|
|
||||||
<fill>transparent</fill>
|
|
||||||
</focus>
|
|
||||||
<active>
|
|
||||||
<border>transparent</border>
|
|
||||||
<fill>transparent</fill>
|
|
||||||
</active>
|
|
||||||
</scope>
|
</scope>
|
||||||
<error>
|
<error>
|
||||||
<normal>
|
<normal>
|
||||||
<border>transparent</border>
|
<border>transparent</border>
|
||||||
<fill>#A0FF0000</fill>
|
<fill>#A0FF0000</fill>
|
||||||
|
<text>#000000</text>
|
||||||
</normal>
|
</normal>
|
||||||
<focus>
|
<focus>
|
||||||
<border>transparent</border>
|
|
||||||
<fill>#FFFF0000</fill>
|
<fill>#FFFF0000</fill>
|
||||||
</focus>
|
</focus>
|
||||||
<active>
|
|
||||||
<border>transparent</border>
|
|
||||||
<fill>#FFFF0000</fill>
|
|
||||||
</active>
|
|
||||||
</error>
|
</error>
|
||||||
<fulltextmatch>
|
<fulltext>
|
||||||
<normal>
|
<normal>
|
||||||
<border>transparent</border>
|
<fill>#C2AFEF</fill>
|
||||||
<fill>#80FFFF00</fill>
|
<text>#3D3D3D</text>
|
||||||
<text>#000000</text>
|
|
||||||
</normal>
|
</normal>
|
||||||
<focus>
|
</fulltext>
|
||||||
<border>transparent</border>
|
|
||||||
<fill>#FFFFFF00</fill>
|
|
||||||
<text>#000000</text>
|
|
||||||
</focus>
|
|
||||||
<active>
|
|
||||||
<border>transparent</border>
|
|
||||||
<fill>#FFFFFF00</fill>
|
|
||||||
<text>#000000</text>
|
|
||||||
</active>
|
|
||||||
</fulltextmatch>
|
|
||||||
</selection>
|
</selection>
|
||||||
</snippet>
|
</snippet>
|
||||||
</code>
|
</code>
|
||||||
@@ -277,6 +282,12 @@
|
|||||||
<normal>#20FFFFFF</normal>
|
<normal>#20FFFFFF</normal>
|
||||||
<focus>#FFFFFF</focus>
|
<focus>#FFFFFF</focus>
|
||||||
</border>
|
</border>
|
||||||
|
<text>
|
||||||
|
<normal>#FFFFFF</normal>
|
||||||
|
</text>
|
||||||
|
<icon>
|
||||||
|
<normal>#FFFFFF</normal>
|
||||||
|
</icon>
|
||||||
</file>
|
</file>
|
||||||
<macro>
|
<macro>
|
||||||
<like>file</like>
|
<like>file</like>
|
||||||
|
|||||||
@@ -27,17 +27,45 @@
|
|||||||
|
|
||||||
<query>
|
<query>
|
||||||
<none>
|
<none>
|
||||||
<normal>white</normal>
|
<normal>
|
||||||
<hover>#F5F5F5</hover>
|
<fill>white</fill>
|
||||||
|
<text>black</text>
|
||||||
|
</normal>
|
||||||
|
<hover>
|
||||||
|
<fill>#F5F5F5</fill>
|
||||||
|
<text>black</text>
|
||||||
|
</hover>
|
||||||
</none>
|
</none>
|
||||||
<command>
|
<command>
|
||||||
<normal>#8FBC92</normal>
|
<normal>
|
||||||
<hover>#5EA071</hover>
|
<fill>#8FBC92</fill>
|
||||||
|
<text>black</text>
|
||||||
|
</normal>
|
||||||
|
<hover>
|
||||||
|
<fill>#5EA071</fill>
|
||||||
|
<text>black</text>
|
||||||
|
</hover>
|
||||||
</command>
|
</command>
|
||||||
<operator>
|
<operator>
|
||||||
<normal>#FCA47E</normal>
|
<normal>
|
||||||
<hover>#F97A4E</hover>
|
<fill>#FCA47E</fill>
|
||||||
|
<text>black</text>
|
||||||
|
</normal>
|
||||||
|
<hover>
|
||||||
|
<fill>#F97A4E</fill>
|
||||||
|
<text>black</text>
|
||||||
|
</hover>
|
||||||
</operator>
|
</operator>
|
||||||
|
<fulltext>
|
||||||
|
<normal>
|
||||||
|
<fill>#C7C7E2</fill>
|
||||||
|
<text>black</text>
|
||||||
|
</normal>
|
||||||
|
<hover>
|
||||||
|
<fill>#ABABDD</fill>
|
||||||
|
<text>black</text>
|
||||||
|
</hover>
|
||||||
|
</fulltext>
|
||||||
</query>
|
</query>
|
||||||
</search>
|
</search>
|
||||||
|
|
||||||
@@ -121,14 +149,6 @@
|
|||||||
<border>transparent</border>
|
<border>transparent</border>
|
||||||
<fill>transparent</fill>
|
<fill>transparent</fill>
|
||||||
</normal>
|
</normal>
|
||||||
<focus>
|
|
||||||
<border>transparent</border>
|
|
||||||
<fill>transparent</fill>
|
|
||||||
</focus>
|
|
||||||
<active>
|
|
||||||
<border>transparent</border>
|
|
||||||
<fill>transparent</fill>
|
|
||||||
</active>
|
|
||||||
</scope>
|
</scope>
|
||||||
<error>
|
<error>
|
||||||
<normal>
|
<normal>
|
||||||
@@ -137,33 +157,15 @@
|
|||||||
<text>#000000</text>
|
<text>#000000</text>
|
||||||
</normal>
|
</normal>
|
||||||
<focus>
|
<focus>
|
||||||
<border>transparent</border>
|
|
||||||
<fill>#FFFF0000</fill>
|
<fill>#FFFF0000</fill>
|
||||||
<text>#000000</text>
|
|
||||||
</focus>
|
</focus>
|
||||||
<active>
|
|
||||||
<border>transparent</border>
|
|
||||||
<fill>#FFFF0000</fill>
|
|
||||||
<text>#000000</text>
|
|
||||||
</active>
|
|
||||||
</error>
|
</error>
|
||||||
<fulltextmatch>
|
<fulltext>
|
||||||
<normal>
|
<normal>
|
||||||
<border>transparent</border>
|
<fill>#C7C7E2</fill>
|
||||||
<fill>#80FFFF00</fill>
|
|
||||||
<text>#000000</text>
|
<text>#000000</text>
|
||||||
</normal>
|
</normal>
|
||||||
<focus>
|
</fulltext>
|
||||||
<border>transparent</border>
|
|
||||||
<fill>#FFFFFF00</fill>
|
|
||||||
<text>#000000</text>
|
|
||||||
</focus>
|
|
||||||
<active>
|
|
||||||
<border>transparent</border>
|
|
||||||
<fill>#FFFFFF00</fill>
|
|
||||||
<text>#000000</text>
|
|
||||||
</active>
|
|
||||||
</fulltextmatch>
|
|
||||||
</selection>
|
</selection>
|
||||||
</snippet>
|
</snippet>
|
||||||
</code>
|
</code>
|
||||||
|
|||||||
@@ -27,17 +27,64 @@
|
|||||||
|
|
||||||
<query>
|
<query>
|
||||||
<none>
|
<none>
|
||||||
<normal>#2F2F2F</normal>
|
<normal></normal>
|
||||||
<hover>black</hover>
|
<hover></hover>
|
||||||
</none>
|
</none>
|
||||||
<command>
|
<command>
|
||||||
<normal>#406D4D</normal>
|
<normal></normal>
|
||||||
<hover>#4E855E</hover>
|
<hover></hover>
|
||||||
</command>
|
</command>
|
||||||
<operator>
|
<operator>
|
||||||
<normal>#7D2724</normal>
|
<normal></normal>
|
||||||
<hover>#8C2B29</hover>
|
<hover></hover>
|
||||||
</operator>
|
</operator>
|
||||||
|
<fulltext>
|
||||||
|
<normal></normal>
|
||||||
|
<hover></hover>
|
||||||
|
</fulltext>
|
||||||
|
</query>
|
||||||
|
|
||||||
|
<query>
|
||||||
|
<none>
|
||||||
|
<normal>
|
||||||
|
<fill>#2F2F2F</fill>
|
||||||
|
<text>#F7F7F7</text>
|
||||||
|
</normal>
|
||||||
|
<hover>
|
||||||
|
<fill>black</fill>
|
||||||
|
<text>#F7F7F7</text>
|
||||||
|
</hover>
|
||||||
|
</none>
|
||||||
|
<command>
|
||||||
|
<normal>
|
||||||
|
<fill>#406D4D</fill>
|
||||||
|
<text>#F7F7F7</text>
|
||||||
|
</normal>
|
||||||
|
<hover>
|
||||||
|
<fill>#4E855E</fill>
|
||||||
|
<text>#F7F7F7</text>
|
||||||
|
</hover>
|
||||||
|
</command>
|
||||||
|
<operator>
|
||||||
|
<normal>
|
||||||
|
<fill>#7D2724</fill>
|
||||||
|
<text>#F7F7F7</text>
|
||||||
|
</normal>
|
||||||
|
<hover>
|
||||||
|
<fill>#8C2B29</fill>
|
||||||
|
<text>#F7F7F7</text>
|
||||||
|
</hover>
|
||||||
|
</operator>
|
||||||
|
<fulltext>
|
||||||
|
<normal>
|
||||||
|
<fill>#207EA8</fill>
|
||||||
|
<text>#F7F7F7</text>
|
||||||
|
</normal>
|
||||||
|
<hover>
|
||||||
|
<fill>#006D93</fill>
|
||||||
|
<text>#F7F7F7</text>
|
||||||
|
</hover>
|
||||||
|
</fulltext>
|
||||||
</query>
|
</query>
|
||||||
</search>
|
</search>
|
||||||
|
|
||||||
@@ -123,46 +170,23 @@
|
|||||||
<border>transparent</border>
|
<border>transparent</border>
|
||||||
<fill>transparent</fill>
|
<fill>transparent</fill>
|
||||||
</normal>
|
</normal>
|
||||||
<focus>
|
|
||||||
<border>transparent</border>
|
|
||||||
<fill>transparent</fill>
|
|
||||||
</focus>
|
|
||||||
<active>
|
|
||||||
<border>transparent</border>
|
|
||||||
<fill>transparent</fill>
|
|
||||||
</active>
|
|
||||||
</scope>
|
</scope>
|
||||||
<error>
|
<error>
|
||||||
<normal>
|
<normal>
|
||||||
<border>transparent</border>
|
<border>transparent</border>
|
||||||
<fill>#A0FF0000</fill>
|
<fill>#A0FF0000</fill>
|
||||||
|
<text>#000000</text>
|
||||||
</normal>
|
</normal>
|
||||||
<focus>
|
<focus>
|
||||||
<border>transparent</border>
|
|
||||||
<fill>#FFFF0000</fill>
|
<fill>#FFFF0000</fill>
|
||||||
</focus>
|
</focus>
|
||||||
<active>
|
|
||||||
<border>transparent</border>
|
|
||||||
<fill>#FFFF0000</fill>
|
|
||||||
</active>
|
|
||||||
</error>
|
</error>
|
||||||
<fulltextmatch>
|
<fulltext>
|
||||||
<normal>
|
<normal>
|
||||||
<border>transparent</border>
|
<fill>#207EA8</fill>
|
||||||
<fill>#80FFFF00</fill>
|
<text>#F7F7F7</text>
|
||||||
<text>#000000</text>
|
|
||||||
</normal>
|
</normal>
|
||||||
<focus>
|
</fulltext>
|
||||||
<border>transparent</border>
|
|
||||||
<fill>#FFFFFF00</fill>
|
|
||||||
<text>#000000</text>
|
|
||||||
</focus>
|
|
||||||
<active>
|
|
||||||
<border>transparent</border>
|
|
||||||
<fill>#FFFFFF00</fill>
|
|
||||||
<text>#000000</text>
|
|
||||||
</active>
|
|
||||||
</fulltextmatch>
|
|
||||||
</selection>
|
</selection>
|
||||||
</snippet>
|
</snippet>
|
||||||
</code>
|
</code>
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ void SearchController::handleMessage(MessageSearchFullText* message)
|
|||||||
prefix += "@";
|
prefix += "@";
|
||||||
}
|
}
|
||||||
SearchMatch match(prefix + message->searchTerm);
|
SearchMatch match(prefix + message->searchTerm);
|
||||||
|
match.searchType = SearchMatch::SEARCH_FULLTEXT;
|
||||||
getView()->setMatches(std::vector<SearchMatch>(1, match));
|
getView()->setMatches(std::vector<SearchMatch>(1, match));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ std::string SearchMatch::getSearchTypeName(SearchType type)
|
|||||||
return "command";
|
return "command";
|
||||||
case SEARCH_OPERATOR:
|
case SEARCH_OPERATOR:
|
||||||
return "operator";
|
return "operator";
|
||||||
|
case SEARCH_FULLTEXT:
|
||||||
|
return "fulltext";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,8 @@ struct SearchMatch
|
|||||||
SEARCH_NONE,
|
SEARCH_NONE,
|
||||||
SEARCH_TOKEN,
|
SEARCH_TOKEN,
|
||||||
SEARCH_COMMAND,
|
SEARCH_COMMAND,
|
||||||
SEARCH_OPERATOR
|
SEARCH_OPERATOR,
|
||||||
|
SEARCH_FULLTEXT
|
||||||
};
|
};
|
||||||
|
|
||||||
enum CommandType
|
enum CommandType
|
||||||
|
|||||||
@@ -21,6 +21,11 @@ std::string ColorScheme::getColor(const std::string& key) const
|
|||||||
return getValue<std::string>(key, "");
|
return getValue<std::string>(key, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string ColorScheme::getColor(const std::string& key, const std::string& defaultColor) const
|
||||||
|
{
|
||||||
|
return getValue<std::string>(key, defaultColor);
|
||||||
|
}
|
||||||
|
|
||||||
std::string ColorScheme::getNodeTypeColor(Node::NodeType type, const std::string& key, ColorState state) const
|
std::string ColorScheme::getNodeTypeColor(Node::NodeType type, const std::string& key, ColorState state) const
|
||||||
{
|
{
|
||||||
return getNodeTypeColor(Node::getTypeString(type), key, state);
|
return getNodeTypeColor(Node::getTypeString(type), key, state);
|
||||||
@@ -85,9 +90,10 @@ std::string ColorScheme::getEdgeTypeColor(const std::string& typeStr, ColorState
|
|||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ColorScheme::getSearchTypeColor(const std::string& searchTypeName, const std::string& state) const
|
std::string ColorScheme::getSearchTypeColor(
|
||||||
|
const std::string& searchTypeName, const std::string& key, const std::string& state) const
|
||||||
{
|
{
|
||||||
std::string path = "search/query/" + searchTypeName + "/" + state;
|
std::string path = "search/query/" + searchTypeName + "/" + state + "/" + key;
|
||||||
return getValue<std::string>(path, "#FFFFFF");
|
return getValue<std::string>(path, "#FFFFFF");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,6 +102,31 @@ std::string ColorScheme::getSyntaxColor(const std::string& key) const
|
|||||||
return getValue<std::string>("code/snippet/syntax/" + key, "#FFFFFF");
|
return getValue<std::string>("code/snippet/syntax/" + key, "#FFFFFF");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string ColorScheme::getCodeSelectionTypeColor(const std::string& typeStr, const std::string& key, ColorState state) const
|
||||||
|
{
|
||||||
|
disableWarnings();
|
||||||
|
std::string color = getValue<std::string>("code/snippet/selection/" + typeStr + "/" + stateToString(state) + "/" + key, "");
|
||||||
|
|
||||||
|
if (!color.size() && state == ACTIVE)
|
||||||
|
{
|
||||||
|
color = getValue<std::string>("code/snippet/selection/" + typeStr + "/" + stateToString(FOCUS) + "/" + key, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!color.size() && state != NORMAL)
|
||||||
|
{
|
||||||
|
color = getValue<std::string>("code/snippet/selection/" + typeStr + "/" + stateToString(NORMAL) + "/" + key, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!color.size())
|
||||||
|
{
|
||||||
|
color = "transparent";
|
||||||
|
}
|
||||||
|
|
||||||
|
enableWarnings();
|
||||||
|
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
ColorScheme::ColorScheme()
|
ColorScheme::ColorScheme()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -106,6 +137,7 @@ std::string ColorScheme::stateToString(ColorState state)
|
|||||||
{
|
{
|
||||||
case NORMAL: return "normal";
|
case NORMAL: return "normal";
|
||||||
case FOCUS: return "focus";
|
case FOCUS: return "focus";
|
||||||
|
case ACTIVE: return "active";
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
@@ -12,13 +12,15 @@ public:
|
|||||||
enum ColorState
|
enum ColorState
|
||||||
{
|
{
|
||||||
NORMAL,
|
NORMAL,
|
||||||
FOCUS
|
FOCUS,
|
||||||
|
ACTIVE
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::shared_ptr<ColorScheme> getInstance();
|
static std::shared_ptr<ColorScheme> getInstance();
|
||||||
virtual ~ColorScheme();
|
virtual ~ColorScheme();
|
||||||
|
|
||||||
std::string getColor(const std::string& key) const;
|
std::string getColor(const std::string& key) const;
|
||||||
|
std::string getColor(const std::string& key, const std::string& defaultColor) const;
|
||||||
|
|
||||||
std::string getNodeTypeColor(Node::NodeType type, const std::string& key, ColorState state) const;
|
std::string getNodeTypeColor(Node::NodeType type, const std::string& key, ColorState state) const;
|
||||||
std::string getNodeTypeColor(const std::string& typeStr, const std::string& key, ColorState state) const;
|
std::string getNodeTypeColor(const std::string& typeStr, const std::string& key, ColorState state) const;
|
||||||
@@ -26,9 +28,11 @@ public:
|
|||||||
std::string getEdgeTypeColor(Edge::EdgeType type, ColorState state) const;
|
std::string getEdgeTypeColor(Edge::EdgeType type, ColorState state) const;
|
||||||
std::string getEdgeTypeColor(const std::string& typeStr, ColorState state) const;
|
std::string getEdgeTypeColor(const std::string& typeStr, ColorState state) const;
|
||||||
|
|
||||||
std::string getSearchTypeColor(const std::string& searchTypeName, const std::string& state = "normal") const;
|
std::string getSearchTypeColor(const std::string& searchTypeName, const std::string& key, const std::string& state = "normal") const;
|
||||||
std::string getSyntaxColor(const std::string& key) const;
|
std::string getSyntaxColor(const std::string& key) const;
|
||||||
|
|
||||||
|
std::string getCodeSelectionTypeColor(const std::string& typeStr, const std::string& key, ColorState state) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ColorScheme();
|
ColorScheme();
|
||||||
ColorScheme(const ColorScheme&) = delete;
|
ColorScheme(const ColorScheme&) = delete;
|
||||||
|
|||||||
@@ -103,28 +103,40 @@ void QtAutocompletionDelegate::paint(QPainter* painter, const QStyleOptionViewIt
|
|||||||
|
|
||||||
QString type = index.sibling(index.row(), index.column() + 1).data().toString();
|
QString type = index.sibling(index.row(), index.column() + 1).data().toString();
|
||||||
QColor color("#FFFFFF");
|
QColor color("#FFFFFF");
|
||||||
|
QColor textColor("#000000");
|
||||||
|
|
||||||
Node::NodeType nodeType = static_cast<Node::NodeType>(index.sibling(index.row(), index.column() + 3).data().toInt());
|
Node::NodeType nodeType = static_cast<Node::NodeType>(index.sibling(index.row(), index.column() + 3).data().toInt());
|
||||||
if (type.size() && type != "command")
|
if (type.size() && type != "command")
|
||||||
{
|
{
|
||||||
color = QColor(GraphViewStyle::getNodeColor(Node::getTypeString(nodeType), false).fill.c_str());
|
const GraphViewStyle::NodeColor& nodeColor = GraphViewStyle::getNodeColor(Node::getTypeString(nodeType), false);
|
||||||
|
color = QColor(nodeColor.fill.c_str());
|
||||||
|
textColor = QColor(nodeColor.text.c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
color = QColor(scheme->getSearchTypeColor(SearchMatch::getSearchTypeName(SearchMatch::SEARCH_COMMAND)).c_str());
|
color = QColor(scheme->getSearchTypeColor(SearchMatch::getSearchTypeName(SearchMatch::SEARCH_COMMAND), "fill").c_str());
|
||||||
|
textColor = QColor(scheme->getSearchTypeColor(SearchMatch::getSearchTypeName(SearchMatch::SEARCH_COMMAND), "text").c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
float charWidth = option.fontMetrics.width(
|
float charWidth = option.fontMetrics.width(
|
||||||
"----------------------------------------------------------------------------------------------------"
|
"----------------------------------------------------------------------------------------------------"
|
||||||
) / 100.0f;
|
) / 100.0f;
|
||||||
|
painter->drawText(option.rect.adjusted(charWidth + 2, -1, 0, 0), Qt::AlignLeft, name);
|
||||||
|
|
||||||
|
QString highlightName(name.size(), ' ');
|
||||||
|
|
||||||
QList<QVariant> indices = index.sibling(index.row(), index.column() + 2).data().toList();
|
QList<QVariant> indices = index.sibling(index.row(), index.column() + 2).data().toList();
|
||||||
if (indices.size())
|
if (indices.size())
|
||||||
{
|
{
|
||||||
for (int i = 0; i < indices.size(); i++)
|
for (int i = 0; i < indices.size(); i++)
|
||||||
{
|
{
|
||||||
QRect rect = option.rect.adjusted(charWidth * (indices[i].toInt() + 1) + 1, 2, 0, -1);
|
int idx = indices[i].toInt();
|
||||||
|
|
||||||
|
QRect rect = option.rect.adjusted(charWidth * (idx + 1) + 1, 2, 0, -1);
|
||||||
rect.setWidth(charWidth + 2);
|
rect.setWidth(charWidth + 2);
|
||||||
painter->fillRect(rect, color);
|
painter->fillRect(rect, color);
|
||||||
|
|
||||||
|
highlightName[idx] = name.at(idx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -134,7 +146,12 @@ void QtAutocompletionDelegate::paint(QPainter* painter, const QStyleOptionViewIt
|
|||||||
painter->fillRect(rect, color);
|
painter->fillRect(rect, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
painter->drawText(option.rect.adjusted(charWidth + 2, -1, 0, 0), Qt::AlignLeft, name);
|
painter->save();
|
||||||
|
QPen highlightPen = painter->pen();
|
||||||
|
highlightPen.setColor(textColor);
|
||||||
|
painter->setPen(highlightPen);
|
||||||
|
painter->drawText(option.rect.adjusted(charWidth + 2, -1, 0, 0), Qt::AlignLeft, highlightName);
|
||||||
|
painter->restore();
|
||||||
|
|
||||||
if (type.size())
|
if (type.size())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -907,18 +907,17 @@ const QtCodeArea::AnnotationColor& QtCodeArea::getAnnotationColorForAnnotation(c
|
|||||||
if (!s_annotationColors.size())
|
if (!s_annotationColors.size())
|
||||||
{
|
{
|
||||||
ColorScheme* scheme = ColorScheme::getInstance().get();
|
ColorScheme* scheme = ColorScheme::getInstance().get();
|
||||||
std::vector<std::string> types = { "token", "local_symbol", "scope", "error", "fulltextmatch"};
|
std::vector<std::string> types = { "token", "local_symbol", "scope", "error", "fulltext" };
|
||||||
|
std::vector<ColorScheme::ColorState> states = { ColorScheme::NORMAL, ColorScheme::FOCUS, ColorScheme::ACTIVE };
|
||||||
std::vector<std::string> states = { "normal", "focus", "active"};
|
|
||||||
|
|
||||||
for (const std::string& type : types)
|
for (const std::string& type : types)
|
||||||
{
|
{
|
||||||
for (const std::string& state : states)
|
for (const ColorScheme::ColorState& state : states)
|
||||||
{
|
{
|
||||||
AnnotationColor color;
|
AnnotationColor color;
|
||||||
color.border = scheme->getColor("code/snippet/selection/" + type + "/" + state + "/border");
|
color.border = scheme->getCodeSelectionTypeColor(type, "border", state);
|
||||||
color.fill = scheme->getColor("code/snippet/selection/" + type + "/" + state + "/fill");
|
color.fill = scheme->getCodeSelectionTypeColor(type, "fill", state);
|
||||||
color.text = scheme->getColor("code/snippet/selection/" + type + "/" + state + "/text");
|
color.text = scheme->getCodeSelectionTypeColor(type, "text", state);
|
||||||
s_annotationColors.push_back(color);
|
s_annotationColors.push_back(color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,10 +31,21 @@ void QtSearchElement::onChecked(bool)
|
|||||||
emit wasChecked(this);
|
emit wasChecked(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QtSmartSearchBox::search()
|
||||||
|
{
|
||||||
|
editTextToElement();
|
||||||
|
|
||||||
|
std::vector<SearchMatch> matches = utility::toVector(m_matches);
|
||||||
|
|
||||||
|
LOG_INFO_STREAM(<< "Search query: " << SearchMatch::searchMatchesToString(matches) << text().toStdString());
|
||||||
|
|
||||||
|
MessageSearch(matches).dispatch();
|
||||||
|
}
|
||||||
|
|
||||||
void QtSmartSearchBox::fullTextSearch()
|
void QtSmartSearchBox::fullTextSearch()
|
||||||
{
|
{
|
||||||
std::string term = text().toStdString().substr(1);
|
std::string term = text().toStdString().substr(1);
|
||||||
if(term.at(0) == '@')
|
if (term.at(0) == '@')
|
||||||
{
|
{
|
||||||
term = term.substr(1);
|
term = term.substr(1);
|
||||||
LOG_INFO_STREAM(<< "FullTextsearch(case sensitive): " << term);
|
LOG_INFO_STREAM(<< "FullTextsearch(case sensitive): " << term);
|
||||||
@@ -47,17 +58,6 @@ void QtSmartSearchBox::fullTextSearch()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtSmartSearchBox::search()
|
|
||||||
{
|
|
||||||
editTextToElement();
|
|
||||||
|
|
||||||
std::vector<SearchMatch> matches = utility::toVector(m_matches);
|
|
||||||
|
|
||||||
LOG_INFO_STREAM(<< "Search query: " << SearchMatch::searchMatchesToString(matches) << text().toStdString());
|
|
||||||
|
|
||||||
MessageSearch(matches).dispatch();
|
|
||||||
}
|
|
||||||
|
|
||||||
QtSmartSearchBox::QtSmartSearchBox(QWidget* parent)
|
QtSmartSearchBox::QtSmartSearchBox(QWidget* parent)
|
||||||
: QLineEdit(parent)
|
: QLineEdit(parent)
|
||||||
, m_allowMultipleElements(false)
|
, m_allowMultipleElements(false)
|
||||||
@@ -165,7 +165,7 @@ void QtSmartSearchBox::keyPressEvent(QKeyEvent* event)
|
|||||||
fullTextSearch();
|
fullTextSearch();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!completer()->popup()->isVisible())
|
else if (!completer()->popup()->isVisible())
|
||||||
{
|
{
|
||||||
search();
|
search();
|
||||||
}
|
}
|
||||||
@@ -653,8 +653,10 @@ void QtSmartSearchBox::updateElements()
|
|||||||
std::string typeName = match.getSearchTypeName();
|
std::string typeName = match.getSearchTypeName();
|
||||||
|
|
||||||
element->setObjectName(QString::fromStdString("search_element_" + typeName));
|
element->setObjectName(QString::fromStdString("search_element_" + typeName));
|
||||||
color = scheme->getSearchTypeColor(typeName);
|
color = scheme->getSearchTypeColor(typeName, "fill");
|
||||||
hoverColor = scheme->getSearchTypeColor(typeName, "hover");
|
hoverColor = scheme->getSearchTypeColor(typeName, "fill", "hover");
|
||||||
|
textColor = scheme->getSearchTypeColor(typeName, "text");
|
||||||
|
textHoverColor = scheme->getSearchTypeColor(typeName, "text", "hover");;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::stringstream css;
|
std::stringstream css;
|
||||||
|
|||||||
Reference in New Issue
Block a user