mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
refactor: edit styles
edit typing color and image, move colors for background selected text and background searched text in palette files
This commit is contained in:
parent
d6d433c617
commit
f64bb48a92
|
@ -663,6 +663,9 @@ void ChatLog::fontChanged(const QFont& font)
|
|||
void ChatLog::reloadTheme()
|
||||
{
|
||||
setBackgroundBrush(QBrush(Style::getColor(Style::GroundBase), Qt::SolidPattern));
|
||||
selectionRectColor = Style::getColor(Style::SelectText);
|
||||
selGraphItem->setBrush(QBrush(selectionRectColor));
|
||||
selGraphItem->setPen(QPen(selectionRectColor.darker(120)));
|
||||
|
||||
for (ChatLine::Ptr l : lines) {
|
||||
l->reloadTheme();
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include "chatline.h"
|
||||
#include "chatmessage.h"
|
||||
#include "src/widget/style.h"
|
||||
|
||||
class QGraphicsScene;
|
||||
class QGraphicsRectItem;
|
||||
|
@ -147,7 +148,7 @@ private:
|
|||
int selClickedCol = -1;
|
||||
int selFirstRow = -1;
|
||||
int selLastRow = -1;
|
||||
QColor selectionRectColor = QColor::fromRgbF(0.23, 0.68, 0.91).lighter(150);
|
||||
QColor selectionRectColor = Style::getColor(Style::SelectText);
|
||||
SelectionMode selectionMode = None;
|
||||
QPointF clickPos;
|
||||
QGraphicsRectItem* selGraphItem = nullptr;
|
||||
|
|
|
@ -31,8 +31,6 @@
|
|||
#include <QTextBlock>
|
||||
#include <QTextFragment>
|
||||
|
||||
static const QString COLOR_HIGHLIGHT = QStringLiteral("#ff7626");
|
||||
|
||||
Text::Text(const QString& txt, const QFont& font, bool enableElide, const QString& rwText,
|
||||
const TextType& type, const QColor& custom)
|
||||
: rawText(rwText)
|
||||
|
@ -230,9 +228,10 @@ void Text::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWid
|
|||
sel.cursor.setPosition(getSelectionEnd(), QTextCursor::KeepAnchor);
|
||||
}
|
||||
|
||||
const QColor selectionColor = QColor::fromRgbF(0.23, 0.68, 0.91);
|
||||
const QColor selectionColor = Style::getColor(Style::SelectText);
|
||||
sel.format.setBackground(selectionColor.lighter(selectionHasFocus ? 100 : 160));
|
||||
sel.format.setForeground(selectionHasFocus ? Qt::white : Qt::black);
|
||||
|
||||
ctx.selections.append(sel);
|
||||
ctx.palette.setColor(QPalette::Text, color);
|
||||
|
||||
|
@ -461,7 +460,7 @@ void Text::selectText(QTextCursor& cursor, const std::pair<int, int>& point)
|
|||
cursor.endEditBlock();
|
||||
|
||||
QTextCharFormat format;
|
||||
format.setBackground(QBrush(QColor(COLOR_HIGHLIGHT)));
|
||||
format.setBackground(QBrush(Style::getColor(Style::SearchHighlighted)));
|
||||
cursor.mergeCharFormat(format);
|
||||
|
||||
regenerate();
|
||||
|
|
|
@ -1087,6 +1087,12 @@ void ChatForm::show(ContentLayout* contentLayout)
|
|||
GenericChatForm::show(contentLayout);
|
||||
}
|
||||
|
||||
void ChatForm::reloadTheme()
|
||||
{
|
||||
chatWidget->setTypingNotification(ChatMessage::createTypingNotification());
|
||||
GenericChatForm::reloadTheme();
|
||||
}
|
||||
|
||||
void ChatForm::showEvent(QShowEvent* event)
|
||||
{
|
||||
GenericChatForm::showEvent(event);
|
||||
|
|
|
@ -54,6 +54,7 @@ public:
|
|||
OfflineMsgEngine* getOfflineMsgEngine();
|
||||
|
||||
virtual void show(ContentLayout* contentLayout) final override;
|
||||
virtual void reloadTheme() final override;
|
||||
|
||||
static const QString ACTION_PREFIX;
|
||||
|
||||
|
|
|
@ -73,6 +73,7 @@ public:
|
|||
{
|
||||
}
|
||||
virtual void show(ContentLayout* contentLayout);
|
||||
virtual void reloadTheme();
|
||||
|
||||
void addMessage(const ToxPk& author, const QString& message, const QDateTime& datetime,
|
||||
bool isAction, bool colorizeName = false);
|
||||
|
@ -83,7 +84,6 @@ public:
|
|||
static QString resolveToxPk(const ToxPk& pk);
|
||||
QDate getLatestDate() const;
|
||||
QDate getFirstDate() const;
|
||||
void reloadTheme();
|
||||
|
||||
signals:
|
||||
void sendMessage(uint32_t, QString);
|
||||
|
|
|
@ -150,7 +150,9 @@ QMap<Style::ColorPalette, QString> Style::aliasColors = {{Green, "green"},
|
|||
{ThemeMedium, "themeMedium"},
|
||||
{ThemeLight, "themeLight"},
|
||||
{Action, "action"},
|
||||
{Link, "link"}};
|
||||
{Link, "link"},
|
||||
{SearchHighlighted, "searchHighlighted"},
|
||||
{SelectText, "selectText"}};
|
||||
|
||||
// stylesheet filename, font -> stylesheet
|
||||
// QString implicit sharing deduplicates stylesheets rather than constructing a new one each time
|
||||
|
@ -412,7 +414,9 @@ void Style::initDictColor()
|
|||
{"@groundBase", Style::getColor(Style::GroundBase).name()},
|
||||
{"@orange", Style::getColor(Style::Orange).name()},
|
||||
{"@action", Style::getColor(Style::Action).name()},
|
||||
{"@link", Style::getColor(Style::Link).name()}};
|
||||
{"@link", Style::getColor(Style::Link).name()},
|
||||
{"@searchHighlighted", Style::getColor(Style::SearchHighlighted).name()},
|
||||
{"@selectText", Style::getColor(Style::SelectText).name()}};
|
||||
}
|
||||
|
||||
QString Style::getThemePath()
|
||||
|
|
|
@ -45,7 +45,9 @@ public:
|
|||
ThemeMedium,
|
||||
ThemeLight,
|
||||
Action,
|
||||
Link
|
||||
Link,
|
||||
SearchHighlighted,
|
||||
SelectText
|
||||
};
|
||||
|
||||
enum Font
|
||||
|
|
|
@ -13,7 +13,7 @@ p {
|
|||
}
|
||||
|
||||
.typing {
|
||||
color: #131212;
|
||||
color: #8d8d8d;
|
||||
}
|
||||
|
||||
.quote {
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
height="18"
|
||||
id="svg3815"
|
||||
version="1.1"
|
||||
inkscape:version="0.48.5 r10040"
|
||||
sodipodi:docname="Neues Dokument 5">
|
||||
inkscape:version="0.92.4 5da689c313, 2019-01-14"
|
||||
sodipodi:docname="typing.svg">
|
||||
<defs
|
||||
id="defs3817" />
|
||||
<sodipodi:namedview
|
||||
|
@ -25,16 +25,17 @@
|
|||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="22.4"
|
||||
inkscape:cx="23.994336"
|
||||
inkscape:cy="16.050687"
|
||||
inkscape:cx="16.8738"
|
||||
inkscape:cy="7.1221156"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
inkscape:window-width="2560"
|
||||
inkscape:window-height="1386"
|
||||
inkscape:window-x="-2"
|
||||
inkscape:window-y="-3"
|
||||
inkscape:window-maximized="1" />
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1015"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="36"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:pagecheckerboard="true" />
|
||||
<metadata
|
||||
id="metadata3820">
|
||||
<rdf:RDF>
|
||||
|
@ -56,6 +57,6 @@
|
|||
inkscape:connector-curvature="0"
|
||||
d="m 0,1034.3622 0,18 18,0 0,-18 -18,0 z m 3.9500533,11.7834 a 2.2475413,2.148285 0 0 1 2.1829252,2.1482 2.2475416,2.1482852 0 0 1 -4.4950832,0 2.2475413,2.148285 0 0 1 2.312158,-2.1482 z m 5.1159617,0 a 2.2475413,2.148285 0 0 1 2.18293,2.1482 2.2475417,2.1482853 0 0 1 -4.4950834,0 2.2475413,2.148285 0 0 1 2.3121534,-2.1482 z m 5.11597,0 a 2.2475413,2.148285 0 0 1 2.18012,2.1482 2.2475435,2.1482871 0 0 1 -4.495087,0 2.2475413,2.148285 0 0 1 2.314967,-2.1482 z"
|
||||
id="mask"
|
||||
style="fill:#ffffff;fill-opacity:1;stroke:none" />
|
||||
style="fill:#201f1f;fill-opacity:1;stroke:none" />
|
||||
</g>
|
||||
</svg>
|
||||
|
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.2 KiB |
|
@ -14,3 +14,5 @@ themeMedium="#100f0f"
|
|||
themeLight="#201f1f"
|
||||
action="#546eff"
|
||||
link="#d292ff"
|
||||
searchHighlighted="#7e2a00"
|
||||
selectText = "#515151"
|
|
@ -14,3 +14,5 @@ themeMedium="#414141"
|
|||
themeLight="#4e4e4e"
|
||||
action="#1818FF"
|
||||
link="#0000ff"
|
||||
searchHighlighted="#ff7626"
|
||||
selectText = "#9edeff"
|
Loading…
Reference in New Issue
Block a user