From b0e6f1168c759781700e020daafaf3f52b611453 Mon Sep 17 00:00:00 2001 From: "Tux3 / Mlkj / !Lev.uXFMLA" Date: Sat, 15 Nov 2014 18:29:41 +0100 Subject: [PATCH] Prepare for theme colors support --- src/mainwindow.ui | 11 +---------- src/misc/style.cpp | 10 ++++++++++ src/misc/style.h | 4 ++++ src/widget/widget.cpp | 5 +++-- ui/chatroomWidgets/genericChatroomWidget.css | 4 ++-- ui/friendList/friendList.css | 12 ++++-------- ui/window/statusPanel.css | 2 +- 7 files changed, 25 insertions(+), 23 deletions(-) diff --git a/src/mainwindow.ui b/src/mainwindow.ui index 9e4f32bd6..f56a52c48 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -1053,16 +1053,7 @@ QSplitter:handle{ - QPushButton{ - background-color:#1c1c1c; - border:none; -} - -QPushButton:hover{ - background-color:#292929; - border:none; -} - + diff --git a/src/misc/style.cpp b/src/misc/style.cpp index e9dec32e3..bb5f3ce39 100644 --- a/src/misc/style.cpp +++ b/src/misc/style.cpp @@ -71,6 +71,12 @@ QColor Style::getColor(Style::ColorPalette entry) QColor("#d1d1d1"), QColor("#ffffff"), QColor("#ff7700"), + + // Theme colors + QColor("#1c1c1c"), + QColor("#2a2a2a"), + QColor("#414141"), + QColor("#4e4e4e"), }; return palette[entry]; @@ -110,6 +116,10 @@ QString Style::resolve(QString qss) {"@lightGrey", getColor(LightGrey).name()}, {"@white", getColor(White).name()}, {"@orange", getColor(Orange).name()}, + {"@themeDark", getColor(ThemeDark).name()}, + {"@themeMediumDark", getColor(ThemeMediumDark).name()}, + {"@themeMedium", getColor(ThemeMedium).name()}, + {"@themeLight", getColor(ThemeLight).name()}, // fonts {"@extraBig", qssifyFont(getFont(ExtraBig))}, diff --git a/src/misc/style.h b/src/misc/style.h index e818b2ddb..33800d9e4 100644 --- a/src/misc/style.h +++ b/src/misc/style.h @@ -38,6 +38,10 @@ public: LightGrey, White, Orange, + ThemeDark, + ThemeMediumDark, + ThemeMedium, + ThemeLight, }; enum Font diff --git a/src/widget/widget.cpp b/src/widget/widget.cpp index 6d61708df..850565953 100644 --- a/src/widget/widget.cpp +++ b/src/widget/widget.cpp @@ -118,7 +118,7 @@ void Widget::init() ui->mainSplitter->restoreState(Settings::getInstance().getSplitterState()); layout()->setContentsMargins(0, 0, 0, 0); - ui->friendList->setStyleSheet(Style::getStylesheet(":ui/friendList/friendList.css")); + ui->friendList->setStyleSheet(Style::resolve(Style::getStylesheet(":ui/friendList/friendList.css"))); profilePicture = new MaskablePixmapWidget(this, QSize(40, 40), ":/img/avatar_mask.png"); profilePicture->setPixmap(QPixmap(":/img/contact_dark.png")); @@ -130,8 +130,9 @@ void Widget::init() ui->mainHead->setLayout(new QVBoxLayout()); ui->mainHead->layout()->setMargin(0); ui->mainHead->layout()->setSpacing(0); - + ui->tooliconsZone->setStyleSheet(Style::resolve("QPushButton{background-color:@themeDark;border:none;}QPushButton:hover{background-color:@themeMediumDark;border:none;}")); + if(QStyleFactory::keys().contains(Settings::getInstance().getStyle()) && Settings::getInstance().getStyle() != "None") { diff --git a/ui/chatroomWidgets/genericChatroomWidget.css b/ui/chatroomWidgets/genericChatroomWidget.css index 4ed573fb0..c83bb9958 100644 --- a/ui/chatroomWidgets/genericChatroomWidget.css +++ b/ui/chatroomWidgets/genericChatroomWidget.css @@ -1,6 +1,6 @@ GenericChatroomWidget { - background-color: @mediumGrey; + background-color: @themeMedium; } GenericChatroomWidget[active="true"] @@ -10,7 +10,7 @@ GenericChatroomWidget[active="true"] GenericChatroomWidget[active="false"]:hover { - background-color: @mediumGreyLight; + background-color: @themeLight; } GenericChatroomWidget[active="true"] > QLabel#status diff --git a/ui/friendList/friendList.css b/ui/friendList/friendList.css index 8358f5a04..57f1a807e 100644 --- a/ui/friendList/friendList.css +++ b/ui/friendList/friendList.css @@ -1,26 +1,22 @@ -QScrollArea { - background: #414141; -} - QScrollBar:vertical { - background: rgb(65,65,65); + background: @themeMedium; width: 16px; padding: 0px 3px 0px 3px; } QScrollBar:handle:vertical { - background: rgba(18, 18, 18, 204); + background: @themeDark; min-height: 20px; border-radius: 5px; margin: 3px 0px 3px 0px; } QScrollBar:handle:vertical:hover { - background: rgba(35, 35, 35, 204); + background: @themeMediumDark; } QScrollBar:handle:vertical:pressed { - background: rgba(13, 13, 13, 204); + background: @themeDark; } QScrollBar:add-line:vertical {height: 0px;subcontrol-position: bottom;subcontrol-origin: margin;} diff --git a/ui/window/statusPanel.css b/ui/window/statusPanel.css index de4dcd043..c9b8249e0 100644 --- a/ui/window/statusPanel.css +++ b/ui/window/statusPanel.css @@ -9,7 +9,7 @@ QLineEdit #statusPanel { - background-color: @darkGrey; + background-color: @themeDark; } #statusPanel > #statusHead > #nameLabel {