diff --git a/res.qrc b/res.qrc
index 0b7a562fb..35da03a5c 100644
--- a/res.qrc
+++ b/res.qrc
@@ -178,5 +178,7 @@
img/caps_lock.svg
themes/default/contentDialog/contentDialog.css
themes/default/tooliconsZone/tooliconsZone.css
+ themes/default/genericChatRoomWidget/genericChatRoomWidget.css
+ themes/dark/genericChatRoomWidget/genericChatRoomWidget.css
diff --git a/src/widget/genericchatroomwidget.cpp b/src/widget/genericchatroomwidget.cpp
index 2e09f02d9..fa0643f40 100644
--- a/src/widget/genericchatroomwidget.cpp
+++ b/src/widget/genericchatroomwidget.cpp
@@ -124,39 +124,11 @@ bool GenericChatroomWidget::isActive()
void GenericChatroomWidget::setActive(bool _active)
{
active = _active;
- if (active) {
- currentColors.baseBackground = Style::getColor(Style::GroundBase); // When active
- currentColors.statusLbl = Style::getColor(Style::StatusActive); // Color when active
- currentColors.nameLbl = Style::getColor(Style::NameActive); // Color when active
- } else {
- currentColors.baseBackground = Style::getColor(Style::ThemeMedium); // Base background color
- currentColors.statusLbl = Style::getColor(Style::GroundExtra); // Base color
- currentColors.nameLbl = Style::getColor(Style::GroundBase); // Base color
- }
-
- changeStyle();
-}
-void GenericChatroomWidget::changeStyle()
-{
- QString wgtStyle = QString("GenericChatroomWidget {"
- " background-color: #%1;" // Base background color
- "}"
- "GenericChatroomWidget:hover {"
- " background-color: #%2;" // On mouse over
- "}"
- "CroppingLabel#statusMessageLabelObj {"
- " color: #%3;"
- "}"
- "CroppingLabel#nameLabelObj {"
- " color: #%4;"
- "}")
- .arg(currentColors.baseBackground.rgba(), 0, 16)
- .arg(currentColors.mouseOver.rgba(), 0, 16)
- .arg(currentColors.statusLbl.rgba(), 0, 16)
- .arg(currentColors.nameLbl.rgba(), 0, 16);
-
- setStyleSheet(wgtStyle);
+ setProperty("active", active);
+ nameLabel->setProperty("active", active);
+ statusMessageLabel->setProperty("active", active);
+ Style::repolish(this);
}
void GenericChatroomWidget::setName(const QString& name)
@@ -186,12 +158,7 @@ QString GenericChatroomWidget::getTitle() const
void GenericChatroomWidget::reloadTheme()
{
- currentColors.baseBackground = Style::getColor(Style::ThemeMedium); // Base background color
- currentColors.mouseOver = Style::getColor(Style::ThemeLight); // On mouse over
- currentColors.statusLbl = Style::getColor(Style::GroundExtra); // statusMessageLabel base color
- currentColors.nameLbl = Style::getColor(Style::GroundBase); // nameLabel base color
-
- changeStyle();
+ setStyleSheet(Style::getStylesheet("genericChatRoomWidget/genericChatRoomWidget.css"));
}
void GenericChatroomWidget::activate()
diff --git a/src/widget/genericchatroomwidget.h b/src/widget/genericchatroomwidget.h
index 5d6a85bf9..b506ad4ff 100644
--- a/src/widget/genericchatroomwidget.h
+++ b/src/widget/genericchatroomwidget.h
@@ -85,16 +85,6 @@ protected:
MaskablePixmapWidget* avatar;
CroppingLabel* statusMessageLabel;
bool active;
-
-private:
- void changeStyle();
- struct Colors{
- QColor baseBackground;
- QColor mouseOver;
- QColor statusLbl;
- QColor nameLbl;
- };
- Colors currentColors;
};
#endif // GENERICCHATROOMWIDGET_H
diff --git a/themes/dark/genericChatRoomWidget/genericChatRoomWidget.css b/themes/dark/genericChatRoomWidget/genericChatRoomWidget.css
new file mode 100644
index 000000000..ea63997f5
--- /dev/null
+++ b/themes/dark/genericChatRoomWidget/genericChatRoomWidget.css
@@ -0,0 +1,21 @@
+GenericChatroomWidget {
+ background-color: @themeMedium; /* Base background color */
+}
+GenericChatroomWidget:hover {
+ background-color: @themeLight; /* On mouse over */
+}
+GenericChatroomWidget[active="true"] {
+ background-color: @groundBase; /* When active */
+}
+CroppingLabel#statusMessageLabelObj {
+ color: @groundExtra; /* Base color */
+}
+CroppingLabel#statusMessageLabelObj[active="true"] {
+ color: @statusActive; /* Color when active */
+}
+CroppingLabel#nameLabelObj {
+ color: @groundExtra; /* Base color */
+}
+CroppingLabel#nameLabelObj[active="true"] {
+ color: @nameActive; /* Color when active */
+}
diff --git a/themes/default/genericChatRoomWidget/genericChatRoomWidget.css b/themes/default/genericChatRoomWidget/genericChatRoomWidget.css
new file mode 100644
index 000000000..1ff6d982a
--- /dev/null
+++ b/themes/default/genericChatRoomWidget/genericChatRoomWidget.css
@@ -0,0 +1,21 @@
+GenericChatroomWidget {
+ background-color: @themeMedium; /* Base background color */
+}
+GenericChatroomWidget:hover {
+ background-color: @themeLight; /* On mouse over */
+}
+GenericChatroomWidget[active="true"] {
+ background-color: @groundBase; /* When active */
+}
+CroppingLabel#statusMessageLabelObj {
+ color: @groundExtra; /* Base color */
+}
+CroppingLabel#statusMessageLabelObj[active="true"] {
+ color: @statusActive; /* Color when active */
+}
+CroppingLabel#nameLabelObj {
+ color: @groundBase; /* Base color */
+}
+CroppingLabel#nameLabelObj[active="true"] {
+ color: @nameActive; /* Color when active */
+}