1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

feat: edit reload themes

This commit is contained in:
TriKriSta 2019-02-21 15:53:31 +02:00
parent 5bc27b08bc
commit e146c11f0f
22 changed files with 224 additions and 83 deletions

View File

@ -119,6 +119,13 @@ void ChatLine::fontChanged(const QFont& font)
c->fontChanged(font);
}
void ChatLine::reloadTheme()
{
for (ChatLineContent* c : content) {
c->reloadTheme();
}
}
int ChatLine::getColumnCount()
{
return content.size();

View File

@ -82,6 +82,7 @@ public:
void selectionCleared();
void selectionFocusChanged(bool focusIn);
void fontChanged(const QFont& font);
void reloadTheme();
int getColumnCount();
int getRow() const;

View File

@ -88,6 +88,10 @@ void ChatLineContent::visibilityChanged(bool)
{
}
void ChatLineContent::reloadTheme()
{
}
QString ChatLineContent::getText() const
{
return QString();

View File

@ -59,6 +59,7 @@ public:
virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) = 0;
virtual void visibilityChanged(bool visible);
virtual void reloadTheme();
private:
friend class ChatLine;

View File

@ -660,6 +660,15 @@ void ChatLog::fontChanged(const QFont& font)
}
}
void ChatLog::reloadTheme()
{
setBackgroundBrush(QBrush(Style::getColor(Style::White), Qt::SolidPattern));
for (ChatLine::Ptr l : lines) {
l->reloadTheme();
}
}
void ChatLog::forceRelayout()
{
startResizeWorker();

View File

@ -53,6 +53,7 @@ public:
void scrollToLine(ChatLine::Ptr line);
void selectAll();
void fontChanged(const QFont& font);
void reloadTheme();
QString getSelectedText() const;

View File

@ -50,8 +50,7 @@ ChatMessage::Ptr ChatMessage::createChatMessage(const QString& sender, const QSt
QString text = rawMessage.toHtmlEscaped();
QString senderText = sender;
const QColor actionColor = Style::getColor(Style::Action);
auto textType = Text::NORMAL;
// smileys
if (Settings::getInstance().getUseEmoticons())
text = SmileyPack::getInstance().smileyfied(text);
@ -72,6 +71,7 @@ ChatMessage::Ptr ChatMessage::createChatMessage(const QString& sender, const QSt
text = wrapDiv(text, "msg");
break;
case ACTION:
textType = Text::ACTION;
senderText = "*";
text = wrapDiv(QString("%1 %2").arg(sender.toHtmlEscaped(), text), "action");
msg->setAsAction();
@ -88,23 +88,18 @@ ChatMessage::Ptr ChatMessage::createChatMessage(const QString& sender, const QSt
authorFont.setBold(true);
QColor color = Style::getColor(Style::Black);
QColor authorColor;
if (colorizeName && Settings::getInstance().getEnableGroupChatsColor())
{
if (colorizeName && Settings::getInstance().getEnableGroupChatsColor()) {
QByteArray hash = QCryptographicHash::hash((sender.toUtf8()), QCryptographicHash::Sha256);
quint8 *data = (quint8*)hash.data();
authorColor.setHsv(data[0], 255, 196);
color.setHsv(data[0], 255, 196);
if (!isMe)
{
color = authorColor;
if (!isMe && textType == Text::NORMAL) {
textType = Text::CUSTOM;
}
}
msg->addColumn(new Text(senderText, authorFont, true, sender,
type == ACTION ? actionColor : color),
msg->addColumn(new Text(senderText, authorFont, true, sender, textType, color),
ColumnFormat(NAME_COL_WIDTH, ColumnFormat::FixedSize, ColumnFormat::Right));
msg->addColumn(new Text(text, baseFont, false, ((type == ACTION) && isMe)
? QString("%1 %2").arg(sender, rawMessage)

View File

@ -34,14 +34,15 @@
static const QString COLOR_HIGHLIGHT = QStringLiteral("#ff7626");
Text::Text(const QString& txt, const QFont& font, bool enableElide, const QString& rwText,
const QColor c)
const TextType& type, const QColor& custom)
: rawText(rwText)
, elide(enableElide)
, defFont(font)
, defStyleSheet(Style::getStylesheet(QStringLiteral("chatArea/innerStyle.css"), font))
, color(c)
, textType(type)
, customColor(custom)
{
QString ct = c.name();
color = textColor();
setText(txt);
setAcceptedMouseButtons(Qt::LeftButton);
setAcceptHoverEvents(true);
@ -247,6 +248,15 @@ void Text::visibilityChanged(bool visible)
update();
}
void Text::reloadTheme()
{
defStyleSheet = Style::getStylesheet(QStringLiteral("chatArea/innerStyle.css"), defFont);
color = textColor();
dirty = true;
regenerate();
update();
}
qreal Text::getAscent() const
{
return ascent;
@ -458,3 +468,15 @@ void Text::selectText(QTextCursor& cursor, const std::pair<int, int>& point)
update();
}
}
QColor Text::textColor() const
{
QColor c = Style::getColor(Style::Black);
if (textType == ACTION) {
c = Style::getColor(Style::Action);
} else if (textType == CUSTOM) {
c = customColor;
}
return c;
}

View File

@ -32,8 +32,15 @@ class Text : public ChatLineContent
Q_OBJECT
public:
enum TextType
{
NORMAL,
ACTION,
CUSTOM
};
Text(const QString& txt = "", const QFont& font = QFont(), bool enableElide = false,
const QString& rawText = QString(), const QColor c = Style::getColor(Style::Black));
const QString& rawText = QString(), const TextType& type = NORMAL, const QColor& custom = Style::getColor(Style::Black));
virtual ~Text();
void setText(const QString& txt);
@ -57,11 +64,12 @@ public:
virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) final;
virtual void visibilityChanged(bool keepInMemory) final;
virtual void reloadTheme() final override;
virtual qreal getAscent() const final;
virtual void mousePressEvent(QGraphicsSceneMouseEvent* event) final override;
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent* event) final override;
void hoverMoveEvent(QGraphicsSceneHoverEvent* event) final override;
void hoverMoveEvent(QGraphicsSceneHoverEvent* event) final override;
virtual QString getText() const final;
QString getLinkAt(QPointF scenePos) const;
@ -85,6 +93,7 @@ protected:
private:
void selectText(QTextCursor& cursor, const std::pair<int, int>& point);
QColor textColor() const;
QString text;
QString rawText;
@ -98,7 +107,9 @@ private:
qreal ascent = 0.0;
QFont defFont;
QString defStyleSheet;
TextType textType;
QColor color;
QColor customColor;
};
#endif // TEXT_H

View File

@ -281,6 +281,14 @@ QSize ChatFormHeader::getAvatarSize() const
return QSize{avatar->width(), avatar->height()};
}
void ChatFormHeader::reloadTheme()
{
callButton->setStyleSheet(Style::getStylesheet(STYLE_PATH));
videoButton->setStyleSheet(Style::getStylesheet(STYLE_PATH));
volButton->setStyleSheet(Style::getStylesheet(STYLE_PATH));
micButton->setStyleSheet(Style::getStylesheet(STYLE_PATH));
}
void ChatFormHeader::addWidget(QWidget* widget, int stretch, Qt::Alignment alignment)
{
headTextLayout->addWidget(widget, stretch, alignment);

View File

@ -72,6 +72,8 @@ public:
void setAvatar(const QPixmap& img);
QSize getAvatarSize() const;
void reloadTheme();
// TODO: Remove
void addWidget(QWidget* widget, int stretch = 0, Qt::Alignment alignment = Qt::Alignment());
void addLayout(QLayout* layout);

View File

@ -66,6 +66,14 @@ ContentLayout::~ContentLayout()
mainContent->deleteLater();
}
void ContentLayout::reloadTheme()
{
#ifndef Q_OS_MAC
mainHead->setStyleSheet(Style::getStylesheet("settings/mainHead.css"));
mainContent->setStyleSheet(Style::getStylesheet("settings/mainContent.css"));
#endif
}
void ContentLayout::clear()
{
QLayoutItem* item;
@ -110,10 +118,7 @@ void ContentLayout::init()
mainContent->setStyle(QStyleFactory::create(Settings::getInstance().getStyle()));
}
#ifndef Q_OS_MAC
mainHead->setStyleSheet(Style::getStylesheet("settings/mainHead.css"));
mainContent->setStyleSheet(Style::getStylesheet("settings/mainContent.css"));
#endif
reloadTheme();
mainHLineLayout.addWidget(&mainHLine);
mainHLineLayout.addSpacing(5);

View File

@ -30,6 +30,7 @@ public:
explicit ContentLayout(QWidget* parent);
~ContentLayout();
void reloadTheme();
void clear();
QFrame mainHLine;

View File

@ -170,10 +170,6 @@ GenericChatForm::GenericChatForm(const Contact* contact, QWidget* parent)
fileLayout->setSpacing(0);
fileLayout->setMargin(0);
setStyleSheet(Style::getStylesheet("genericChatForm/genericChatForm.css"));
msgEdit->setStyleSheet(Style::getStylesheet("msgEdit/msgEdit.css")
+ fontToCss(s.getChatMessageFont(), "QTextEdit"));
msgEdit->setFixedHeight(MESSAGE_EDIT_HEIGHT);
msgEdit->setFrameStyle(QFrame::NoFrame);
@ -240,8 +236,7 @@ GenericChatForm::GenericChatForm(const Contact* contact, QWidget* parent)
connect(chatWidget, &ChatLog::workerTimeoutFinished, this, &GenericChatForm::onContinueSearch);
chatWidget->setStyleSheet(Style::getStylesheet("chatArea/chatArea.css"));
headWidget->setStyleSheet(Style::getStylesheet("chatArea/chatHead.css"));
reloadTheme();
fileFlyout->setFixedSize(FILE_FLYOUT_SIZE);
fileFlyout->setParent(this);
@ -295,6 +290,26 @@ QDate GenericChatForm::getFirstDate() const
return getDate(chatWidget->getFirstLine());
}
void GenericChatForm::reloadTheme()
{
const Settings& s = Settings::getInstance();
setStyleSheet(Style::getStylesheet("genericChatForm/genericChatForm.css"));
msgEdit->setStyleSheet(Style::getStylesheet("msgEdit/msgEdit.css")
+ fontToCss(s.getChatMessageFont(), "QTextEdit"));
chatWidget->setStyleSheet(Style::getStylesheet("chatArea/chatArea.css"));
headWidget->setStyleSheet(Style::getStylesheet("chatArea/chatHead.css"));
chatWidget->reloadTheme();
headWidget->reloadTheme();
searchForm->reloadTheme();
emoteButton->setStyleSheet(Style::getStylesheet(STYLE_PATH));
fileButton->setStyleSheet(Style::getStylesheet(STYLE_PATH));
screenshotButton->setStyleSheet(Style::getStylesheet(STYLE_PATH));
sendButton->setStyleSheet(Style::getStylesheet(STYLE_PATH));
}
void GenericChatForm::setName(const QString& newName)
{
headWidget->setName(newName);

View File

@ -83,6 +83,7 @@ public:
static QString resolveToxPk(const ToxPk& pk);
QDate getLatestDate() const;
QDate getFirstDate() const;
void reloadTheme();
signals:
void sendMessage(uint32_t, QString);

View File

@ -15,9 +15,8 @@ SearchSettingsForm::SearchSettingsForm(QWidget *parent) :
ui->choiceDateButton->setAttribute(Qt::WA_LayoutUsesWidgetRect);
ui->choiceDateButton->setObjectName(QStringLiteral("choiceDateButton"));
ui->choiceDateButton->setStyleSheet(Style::getStylesheet(QStringLiteral("chatForm/buttons.css")));
ui->startDateLabel->setStyleSheet(Style::getStylesheet(QStringLiteral("chatForm/labels.css")));
reloadTheme();
connect(ui->startSearchComboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &SearchSettingsForm::onStartSearchSelected);
@ -75,6 +74,12 @@ ParameterSearch SearchSettingsForm::getParameterSearch()
return ps;
}
void SearchSettingsForm::reloadTheme()
{
ui->choiceDateButton->setStyleSheet(Style::getStylesheet(QStringLiteral("chatForm/buttons.css")));
ui->startDateLabel->setStyleSheet(Style::getStylesheet(QStringLiteral("chatForm/labels.css")));
}
void SearchSettingsForm::updateStartDateLabel()
{
ui->startDateLabel->setText(startDate.toString(Settings::getInstance().getDateFormat()));

View File

@ -17,6 +17,7 @@ public:
~SearchSettingsForm();
ParameterSearch getParameterSearch();
void reloadTheme();
private:
Ui::SearchSettingsForm *ui;

View File

@ -118,6 +118,17 @@ void SearchForm::insertEditor(const QString &text)
searchLine->insert(text);
}
void SearchForm::reloadTheme()
{
settingsButton->setStyleSheet(Style::getStylesheet(QStringLiteral("chatForm/buttons.css")));
upButton->setStyleSheet(Style::getStylesheet(QStringLiteral("chatForm/buttons.css")));
downButton->setStyleSheet(Style::getStylesheet(QStringLiteral("chatForm/buttons.css")));
hideButton->setStyleSheet(Style::getStylesheet(QStringLiteral("chatForm/buttons.css")));
startButton->setStyleSheet(Style::getStylesheet(QStringLiteral("chatForm/buttons.css")));
settings->reloadTheme();
}
void SearchForm::showEvent(QShowEvent* event)
{
QWidget::showEvent(event);

View File

@ -45,6 +45,7 @@ public:
ParameterSearch getParameterSearch();
void setFocusEditor();
void insertEditor(const QString &text);
void reloadTheme();
protected:
virtual void showEvent(QShowEvent* event) final override;

View File

@ -65,7 +65,8 @@
namespace {
const QLatin1Literal ThemeSubFolder{"themes/"};
const QLatin1Literal BuiltinThemePath{":themes/dark/"};
const QLatin1Literal BuiltinThemeDefaultPath{":themes/default/"};
const QLatin1Literal BuiltinThemeDarkPath{":themes/dark/"};
}
// helper functions
@ -84,12 +85,15 @@ QString qssifyFont(QFont font)
static QMap<Style::ColorPalette, QColor> palette;
static QMap<QString, QString> dict;
static QMap<QString, QString> dictColor;
static QMap<QString, QString> dictFont;
static QMap<QString, QString> dictTheme;
QStringList Style::getThemeColorNames()
{
return {QObject::tr("Default"), QObject::tr("Blue"), QObject::tr("Olive"), QObject::tr("Red"),
QObject::tr("Violet")};
QObject::tr("Violet"), QObject::tr("Dark"), QObject::tr("Dark blue"), QObject::tr("Dark olive"),
QObject::tr("Dark red"), QObject::tr("Dark violet")};
}
QString Style::getThemeName()
@ -108,14 +112,16 @@ QString Style::getThemeFolder()
// No themes available, fallback to builtin
if(fullPath.isEmpty()) {
return BuiltinThemePath;
return getThemePath();
}
return fullPath % QDir::separator();
}
QList<QColor> Style::themeColorColors = {QColor(), QColor("#004aa4"), QColor("#97ba00"),
QColor("#c23716"), QColor("#4617b5")};
QColor("#c23716"), QColor("#4617b5"),
QColor(), QColor("#00336d"), QColor("#4d5f00"),
QColor("#7a210d"), QColor("#280d6c")};
QMap<Style::ColorPalette, QString> Style::aliasColors = {{Green, "green"},
{Yellow, "yellow"},
@ -170,7 +176,7 @@ const QString Style::getImagePath(const QString& filename)
} else {
qWarning() << "Failed to open file (using defaults):" << fullPath;
fullPath = BuiltinThemePath % filename;
fullPath = getThemePath() % filename;
if (QFileInfo::exists(fullPath)) {
return fullPath;
@ -218,7 +224,7 @@ const QString Style::resolve(const QString& filename, const QFont& baseFont)
} else {
qWarning() << "Failed to open file (using defaults):" << fullPath;
fullPath = BuiltinThemePath;
fullPath = getThemePath();
QFile file{fullPath};
if (file.open(QFile::ReadOnly | QFile::Text)) {
@ -233,38 +239,33 @@ const QString Style::resolve(const QString& filename, const QFont& baseFont)
initPalette();
}
if (dict.isEmpty()) {
dict = {// colors
{"@green", Style::getColor(Style::Green).name()},
{"@yellow", Style::getColor(Style::Yellow).name()},
{"@red", Style::getColor(Style::Red).name()},
{"@black", Style::getColor(Style::Black).name()}, // NOTE: (Dark) rename to textColor
{"@darkGrey", Style::getColor(Style::DarkGrey).name()},
{"@mediumGrey", Style::getColor(Style::MediumGrey).name()},
{"@mediumGreyLight", Style::getColor(Style::MediumGreyLight).name()},
{"@lightGrey", Style::getColor(Style::LightGrey).name()},
{"@white", Style::getColor(Style::White).name()},
{"@orange", Style::getColor(Style::Orange).name()},
{"@themeDark", Style::getColor(Style::ThemeDark).name()},
{"@themeMediumDark", Style::getColor(Style::ThemeMediumDark).name()},
{"@themeMedium", Style::getColor(Style::ThemeMedium).name()},
{"@themeLight", Style::getColor(Style::ThemeLight).name()},
{"@action", Style::getColor(Style::Action).name()},
// fonts
{"@baseFont",
QString::fromUtf8("'%1' %2px").arg(baseFont.family()).arg(QFontInfo(baseFont).pixelSize())},
{"@extraBig", qssifyFont(Style::getFont(Style::ExtraBig))},
{"@big", qssifyFont(Style::getFont(Style::Big))},
{"@bigBold", qssifyFont(Style::getFont(Style::BigBold))},
{"@medium", qssifyFont(Style::getFont(Style::Medium))},
{"@mediumBold", qssifyFont(Style::getFont(Style::MediumBold))},
{"@small", qssifyFont(Style::getFont(Style::Small))},
{"@smallLight", qssifyFont(Style::getFont(Style::SmallLight))}};
if (dictColor.isEmpty()) {
initDictColor();
}
for (const QString& key : dict.keys()) {
qss.replace(QRegularExpression(key % QLatin1Literal{"\\b"}), dict[key]);
if (dictFont.isEmpty()) {
dictFont = {
{"@baseFont",
QString::fromUtf8("'%1' %2px").arg(baseFont.family()).arg(QFontInfo(baseFont).pixelSize())},
{"@extraBig", qssifyFont(Style::getFont(Style::ExtraBig))},
{"@big", qssifyFont(Style::getFont(Style::Big))},
{"@bigBold", qssifyFont(Style::getFont(Style::BigBold))},
{"@medium", qssifyFont(Style::getFont(Style::Medium))},
{"@mediumBold", qssifyFont(Style::getFont(Style::MediumBold))},
{"@small", qssifyFont(Style::getFont(Style::Small))},
{"@smallLight", qssifyFont(Style::getFont(Style::SmallLight))}};
}
for (const QString& key : dictColor.keys()) {
qss.replace(QRegularExpression(key % QLatin1Literal{"\\b"}), dictColor[key]);
}
for (const QString& key : dictFont.keys()) {
qss.replace(QRegularExpression(key % QLatin1Literal{"\\b"}), dictFont[key]);
}
for (const QString& key : dictTheme.keys()) {
qss.replace(QRegularExpression(key % QLatin1Literal{"\\b"}), dictTheme[key]);
}
// @getImagePath() function
@ -286,7 +287,7 @@ const QString Style::resolve(const QString& filename, const QFont& baseFont)
existingImagesCache << fullImagePath;
} else {
qWarning() << "Failed to open file (using defaults):" << fullImagePath;
fullImagePath = BuiltinThemePath % path;
fullImagePath = getThemePath() % path;
}
}
@ -313,6 +314,10 @@ void Style::repolish(QWidget* w)
void Style::setThemeColor(int color)
{
stylesheetsCache.clear(); // clear stylesheet cache which includes color info
palette.clear();
dictColor.clear();
initPalette();
initDictColor();
if (color < 0 || color >= themeColorColors.size())
setThemeColor(QColor());
else
@ -340,10 +345,10 @@ void Style::setThemeColor(const QColor& color)
palette[ThemeLight] = color.lighter(110);
}
dict["@themeDark"] = getColor(ThemeDark).name();
dict["@themeMediumDark"] = getColor(ThemeMediumDark).name();
dict["@themeMedium"] = getColor(ThemeMedium).name();
dict["@themeLight"] = getColor(ThemeLight).name();
dictTheme["@themeDark"] = getColor(ThemeDark).name();
dictTheme["@themeMediumDark"] = getColor(ThemeMediumDark).name();
dictTheme["@themeMedium"] = getColor(ThemeMedium).name();
dictTheme["@themeLight"] = getColor(ThemeLight).name();
}
/**
@ -366,16 +371,42 @@ QPixmap Style::scaleSvgImage(const QString& path, uint32_t width, uint32_t heigh
void Style::initPalette()
{
QSettings settings(BuiltinThemePath % "palette.ini", QSettings::IniFormat);
QSettings settings(getThemePath() % "palette.ini", QSettings::IniFormat);
auto keys = aliasColors.keys();
settings.beginGroup("colors");
QMap<Style::ColorPalette, QString> c;
for (auto k : keys) {
c[k] = settings.value(aliasColors[k], "#000").toString();
palette[k] = QColor(settings.value(aliasColors[k], "#000").toString());
}
auto p = palette;
settings.endGroup();
}
void Style::initDictColor()
{
dictColor = {
{"@green", Style::getColor(Style::Green).name()},
{"@yellow", Style::getColor(Style::Yellow).name()},
{"@red", Style::getColor(Style::Red).name()},
{"@black", Style::getColor(Style::Black).name()}, // NOTE: (Dark) rename to textColor
{"@darkGrey", Style::getColor(Style::DarkGrey).name()},
{"@mediumGrey", Style::getColor(Style::MediumGrey).name()},
{"@mediumGreyLight", Style::getColor(Style::MediumGreyLight).name()},
{"@lightGrey", Style::getColor(Style::LightGrey).name()},
{"@white", Style::getColor(Style::White).name()},
{"@orange", Style::getColor(Style::Orange).name()},
{"@action", Style::getColor(Style::Action).name()}};
}
QString Style::getThemePath()
{
if (Settings::getInstance().getThemeColor() > 4) {
return BuiltinThemeDarkPath;
}
return BuiltinThemeDefaultPath;
}

View File

@ -73,6 +73,8 @@ public:
static void applyTheme();
static QPixmap scaleSvgImage(const QString& path, uint32_t width, uint32_t height);
static void initPalette();
static void initDictColor();
static QString getThemePath();
signals:
void themeChanged();

View File

@ -150,14 +150,11 @@ void Widget::init()
connect(actionQuit, &QAction::triggered, qApp, &QApplication::quit);
layout()->setContentsMargins(0, 0, 0, 0);
ui->centralwidget->setStyleSheet(Style::getStylesheet(QStringLiteral("centralWidget/centralWidget.css")));
ui->friendList->setStyleSheet(Style::getStylesheet("friendList/friendList.css"));
profilePicture = new MaskablePixmapWidget(this, QSize(40, 40), ":/img/avatar_mask.svg");
profilePicture->setPixmap(QPixmap(":/img/contact_dark.svg"));
profilePicture->setClickable(true);
profilePicture->setObjectName("selfAvatar");
profilePicture->setStyleSheet(Style::getStylesheet("window/profile.css"));
ui->myProfile->insertWidget(0, profilePicture);
ui->myProfile->insertSpacing(1, 7);
@ -200,10 +197,6 @@ void Widget::init()
ui->searchContactFilterBox->setMenu(filterMenu);
#ifndef Q_OS_MAC
ui->statusHead->setStyleSheet(Style::getStylesheet("window/statusPanel.css"));
#endif
contactListWidget = new FriendListWidget(this, settings.getGroupchatPosition());
ui->friendList->setWidget(contactListWidget);
ui->friendList->setLayoutDirection(Qt::RightToLeft);
@ -211,8 +204,6 @@ void Widget::init()
ui->statusLabel->setEditable(true);
ui->statusPanel->setStyleSheet(Style::getStylesheet("window/statusPanel.css"));
QMenu* statusButtonMenu = new QMenu(ui->statusButton);
statusButtonMenu->addAction(statusOnline);
statusButtonMenu->addAction(statusAway);
@ -2176,6 +2167,7 @@ void Widget::reloadTheme()
{
this->setStyleSheet(Style::getStylesheet("window/general.css"));
QString statusPanelStyle = Style::getStylesheet("window/statusPanel.css");
ui->centralwidget->setStyleSheet(Style::getStylesheet(QStringLiteral("centralWidget/centralWidget.css")));
ui->tooliconsZone->setStyleSheet(Style::getStylesheet("tooliconsZone/tooliconsZone.css"));
ui->statusPanel->setStyleSheet(statusPanelStyle);
ui->statusHead->setStyleSheet(statusPanelStyle);
@ -2183,6 +2175,12 @@ void Widget::reloadTheme()
ui->statusButton->setStyleSheet(Style::getStylesheet("statusButton/statusButton.css"));
contactListWidget->reDraw();
profilePicture->setStyleSheet(Style::getStylesheet("window/profile.css"));
if (contentLayout != nullptr) {
contentLayout->reloadTheme();
}
for (Friend* f : FriendList::getAllFriends()) {
uint32_t friendId = f->getId();
friendWidgets[friendId]->reloadTheme();
@ -2192,6 +2190,15 @@ void Widget::reloadTheme()
uint32_t groupId = g->getId();
groupWidgets[groupId]->reloadTheme();
}
for (auto f : FriendList::getAllFriends()) {
chatForms[f->getId()]->reloadTheme();
}
for (auto g : GroupList::getAllGroups()) {
groupChatForms[g->getId()]->reloadTheme();
}
}
void Widget::nextContact()