diff --git a/res.qrc b/res.qrc index 9f1bcbd3b..2a6a8bc5c 100644 --- a/res.qrc +++ b/res.qrc @@ -79,6 +79,7 @@ themes/dark/emoticonWidget/dot_page_hover.svg themes/dark/emoticonWidget/emoticonWidget.css themes/dark/friendList/friendList.css + themes/dark/genericChatRoomWidget/genericChatRoomWidget.css themes/dark/msgEdit/msgEdit.css themes/dark/settings/mainHead.css themes/dark/settings/checkboxChecked.svg @@ -144,6 +145,7 @@ themes/default/emoticonWidget/dot_page_hover.svg themes/default/emoticonWidget/emoticonWidget.css themes/default/friendList/friendList.css + themes/default/genericChatRoomWidget/genericChatRoomWidget.css themes/default/msgEdit/msgEdit.css themes/default/settings/mainHead.css themes/default/statusButton/statusButton.css diff --git a/src/widget/genericchatroomwidget.cpp b/src/widget/genericchatroomwidget.cpp index 18804caa1..fa0643f40 100644 --- a/src/widget/genericchatroomwidget.cpp +++ b/src/widget/genericchatroomwidget.cpp @@ -42,8 +42,10 @@ GenericChatroomWidget::GenericChatroomWidget(bool compact, QWidget* parent) statusMessageLabel = new CroppingLabel(this); statusMessageLabel->setTextFormat(Qt::PlainText); statusMessageLabel->setForegroundRole(QPalette::WindowText); + statusMessageLabel->setObjectName("statusMessageLabelObj"); nameLabel->setForegroundRole(QPalette::WindowText); + nameLabel->setObjectName("nameLabelObj"); Settings& s = Settings::getInstance(); connect(&s, &Settings::compactLayoutChanged, this, &GenericChatroomWidget::compactChange); @@ -122,15 +124,11 @@ bool GenericChatroomWidget::isActive() void GenericChatroomWidget::setActive(bool _active) { active = _active; - if (active) { - setBackgroundRole(QPalette::Light); - statusMessageLabel->setForegroundRole(QPalette::HighlightedText); - nameLabel->setForegroundRole(QPalette::HighlightedText); - } else { - setBackgroundRole(QPalette::Window); - statusMessageLabel->setForegroundRole(QPalette::WindowText); - nameLabel->setForegroundRole(QPalette::WindowText); - } + + setProperty("active", active); + nameLabel->setProperty("active", active); + statusMessageLabel->setProperty("active", active); + Style::repolish(this); } void GenericChatroomWidget::setName(const QString& name) @@ -160,23 +158,7 @@ QString GenericChatroomWidget::getTitle() const void GenericChatroomWidget::reloadTheme() { - QPalette p; - - p = statusMessageLabel->palette(); - p.setColor(QPalette::WindowText, Style::getColor(Style::GroundExtra)); // Base color - p.setColor(QPalette::HighlightedText, Style::getColor(Style::StatusActive)); // Color when active - statusMessageLabel->setPalette(p); - - p = nameLabel->palette(); - p.setColor(QPalette::WindowText, Style::getColor(Style::GroundBase)); // Base color - p.setColor(QPalette::HighlightedText, Style::getColor(Style::NameActive)); // Color when active - nameLabel->setPalette(p); - - p = palette(); - p.setColor(QPalette::Window, Style::getColor(Style::ThemeMedium)); // Base background color - p.setColor(QPalette::Highlight, Style::getColor(Style::ThemeLight)); // On mouse over - p.setColor(QPalette::Light, Style::getColor(Style::GroundBase)); // When active - setPalette(p); + setStyleSheet(Style::getStylesheet("genericChatRoomWidget/genericChatRoomWidget.css")); } void GenericChatroomWidget::activate() 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 */ +}