From a486f9aa4d1ce333a1cd4857c56383fbf2cf990e Mon Sep 17 00:00:00 2001 From: krepa098 Date: Sat, 4 Oct 2014 10:24:20 +0200 Subject: [PATCH] statusPanel: css, cleanup --- mainwindow.ui | 1293 +------------------------------------ misc/style.cpp | 2 +- res.qrc | 1 + ui/window/statusPanel.css | 70 ++ widget/widget.cpp | 58 +- 5 files changed, 96 insertions(+), 1328 deletions(-) create mode 100644 ui/window/statusPanel.css diff --git a/mainwindow.ui b/mainwindow.ui index 300cc60c3..f8f1f72f6 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -6,8 +6,8 @@ 0 0 - 712 - 539 + 710 + 537 @@ -548,458 +548,13 @@ QSplitter:handle{ false - + 0 0 - - - - - - - 255 - 255 - 255 - - - - - - - 28 - 28 - 28 - - - - - - - 42 - 42 - 42 - - - - - - - 35 - 35 - 35 - - - - - - - 14 - 14 - 14 - - - - - - - 18 - 18 - 18 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 28 - 28 - 28 - - - - - - - 0 - 0 - 0 - - - - - - - 14 - 14 - 14 - - - - - - - 28 - 28 - 28 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 255 - 255 - 255 - - - - - - - 28 - 28 - 28 - - - - - - - 42 - 42 - 42 - - - - - - - 35 - 35 - 35 - - - - - - - 14 - 14 - 14 - - - - - - - 18 - 18 - 18 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 28 - 28 - 28 - - - - - - - 0 - 0 - 0 - - - - - - - 14 - 14 - 14 - - - - - - - 28 - 28 - 28 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 14 - 14 - 14 - - - - - - - 28 - 28 - 28 - - - - - - - 42 - 42 - 42 - - - - - - - 35 - 35 - 35 - - - - - - - 14 - 14 - 14 - - - - - - - 18 - 18 - 18 - - - - - - - 14 - 14 - 14 - - - - - - - 255 - 255 - 255 - - - - - - - 14 - 14 - 14 - - - - - - - 28 - 28 - 28 - - - - - - - 28 - 28 - 28 - - - - - - - 0 - 0 - 0 - - - - - - - 28 - 28 - 28 - - - - - - - 28 - 28 - 28 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - true - 0 @@ -1027,424 +582,6 @@ QSplitter:handle{ 0 - - - - - - - 255 - 255 - 255 - - - - - - - 28 - 28 - 28 - - - - - - - 42 - 42 - 42 - - - - - - - 35 - 35 - 35 - - - - - - - 14 - 14 - 14 - - - - - - - 18 - 18 - 18 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 28 - 28 - 28 - - - - - - - 0 - 0 - 0 - - - - - - - 14 - 14 - 14 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 255 - 255 - 255 - - - - - - - 28 - 28 - 28 - - - - - - - 42 - 42 - 42 - - - - - - - 35 - 35 - 35 - - - - - - - 14 - 14 - 14 - - - - - - - 18 - 18 - 18 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 28 - 28 - 28 - - - - - - - 0 - 0 - 0 - - - - - - - 14 - 14 - 14 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 14 - 14 - 14 - - - - - - - 28 - 28 - 28 - - - - - - - 42 - 42 - 42 - - - - - - - 35 - 35 - 35 - - - - - - - 14 - 14 - 14 - - - - - - - 18 - 18 - 18 - - - - - - - 14 - 14 - 14 - - - - - - - 255 - 255 - 255 - - - - - - - 14 - 14 - 14 - - - - - - - 28 - 28 - 28 - - - - - - - 28 - 28 - 28 - - - - - - - 0 - 0 - 0 - - - - - - - 28 - 28 - 28 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - true - @@ -2083,8 +1220,8 @@ QSplitter:handle{ 0 0 - 261 - 373 + 288 + 371 @@ -2102,424 +1239,6 @@ QSplitter:handle{ 0 - - - - - - - 255 - 255 - 255 - - - - - - - 28 - 28 - 28 - - - - - - - 42 - 42 - 42 - - - - - - - 35 - 35 - 35 - - - - - - - 14 - 14 - 14 - - - - - - - 18 - 18 - 18 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 28 - 28 - 28 - - - - - - - 0 - 0 - 0 - - - - - - - 14 - 14 - 14 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 255 - 255 - 255 - - - - - - - 28 - 28 - 28 - - - - - - - 42 - 42 - 42 - - - - - - - 35 - 35 - 35 - - - - - - - 14 - 14 - 14 - - - - - - - 18 - 18 - 18 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 28 - 28 - 28 - - - - - - - 0 - 0 - 0 - - - - - - - 14 - 14 - 14 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 14 - 14 - 14 - - - - - - - 28 - 28 - 28 - - - - - - - 42 - 42 - 42 - - - - - - - 35 - 35 - 35 - - - - - - - 14 - 14 - 14 - - - - - - - 18 - 18 - 18 - - - - - - - 14 - 14 - 14 - - - - - - - 255 - 255 - 255 - - - - - - - 14 - 14 - 14 - - - - - - - 28 - 28 - 28 - - - - - - - 28 - 28 - 28 - - - - - - - 0 - 0 - 0 - - - - - - - 28 - 28 - 28 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - true - 0 @@ -3218,7 +1937,7 @@ QSplitter:handle{ 0 0 - 712 + 710 25 diff --git a/misc/style.cpp b/misc/style.cpp index b1c49bebc..120991f65 100644 --- a/misc/style.cpp +++ b/misc/style.cpp @@ -79,7 +79,7 @@ QFont Style::getFont(Style::Font font) // fonts as defined in // https://github.com/ItsDuke/Tox-UI/blob/master/UI%20GUIDELINES.md static QFont fonts[] = { - appFont(15, QFont::Bold), + appFont(16, QFont::Bold), appFont(14, QFont::Normal), appFont(14, QFont::Bold), appFont(13, QFont::Normal), diff --git a/res.qrc b/res.qrc index 17c26eb2c..312ec457a 100644 --- a/res.qrc +++ b/res.qrc @@ -147,5 +147,6 @@ img/group_2x.png ui/chatroomWidgets/genericChatroomWidget.css ui/fileTransferInstance/sliverRTEdge.png + ui/window/statusPanel.css diff --git a/ui/window/statusPanel.css b/ui/window/statusPanel.css new file mode 100644 index 000000000..3a0fc36da --- /dev/null +++ b/ui/window/statusPanel.css @@ -0,0 +1,70 @@ +#statusPanel +{ + background-color: @darkGrey; +} + +#statusPanel > #statusHead > #nameLabel { + font: @extraBig; + color: @white; +} + +#statusPanel > #statusHead > #statusLabel { + font: @smallLight; + color: @lightGrey; +} + +#statusPanel > #statusHead > #statusButton +{ + background: none; + background-color: @mediumGrey; + border: none; + border-radius: 6px; + width: 20px; + height: 40px; +} + +#statusPanel > #statusHead > #statusButton[status="online"] +{ + image: url(":ui/statusButton/dot_online.png") center center; +} + +#statusPanel > #statusHead > #statusButton[status="away"] +{ + image: url(":ui/statusButton/dot_idle.png") center center; +} + +#statusPanel > #statusHead > #statusButton[status="busy"] +{ + image: url(":ui/statusButton/dot_busy.png") center center; +} + +#statusPanel > #statusHead > #statusButton[status="offline"] +{ + image: url(":ui/statusButton/dot_away.png") center center; +} + +/*Bugged in Qt, but it's probably better to leave enabled so that users can tell it's clickable*/ +#statusPanel > #statusHead > #statusButton:hover +{ + background-color: @mediumGreyLight; +} + +#statusPanel > #statusHead > #statusButton:pressed +{ + background-color: @mediumGrey; +} + +#statusPanel > #statusHead > #statusButton:focus { + outline: none; +} + +#statusPanel > #statusHead > #statusButton::menu-indicator {image: none;} + +#statusPanel > #statusHead > #statusButton::menu-indicator:pressed, #statusPanel > #statusHead > #statusButton::menu-indicator:open +{ + image: url(":ui/statusButton/menu_indicator.png"); + subcontrol-origin: padding; + subcontrol-position: bottom center; + position: relative; + bottom: 2px; +} diff --git a/widget/widget.cpp b/widget/widget.cpp index 555042ef8..92c1ed95b 100644 --- a/widget/widget.cpp +++ b/widget/widget.cpp @@ -130,16 +130,7 @@ Widget::Widget(QWidget *parent) ui->nameLabel->setEditable(true); ui->statusLabel->setEditable(true); - ui->statusLabel->setFont(Style::getFont(Style::Medium)); - ui->nameLabel->setFont(Style::getFont(Style::ExtraBig)); - - // delay setting username and message until Core inits - //ui->nameLabel->setText(core->getUsername()); - ui->nameLabel->setStyleSheet("QLabel { color : white; font-size: 11pt; font-weight:bold;}"); - //ui->statusLabel->setText(core->getStatusMessage()); - ui->statusLabel->setStyleSheet("QLabel { color : white; font-size: 8pt;}"); - - ui->statusButton->setStyleSheet(Style::getStylesheet(":/ui/statusButton/statusButton.css")); + ui->statusPanel->setStyleSheet(Style::getStylesheet(":/ui/window/statusPanel.css")); QMenu *statusButtonMenu = new QMenu(ui->statusButton); QAction* setStatusOnline = statusButtonMenu->addAction(Widget::tr("Online","Button to set your status to 'Online'")); @@ -150,22 +141,12 @@ Widget::Widget(QWidget *parent) setStatusBusy->setIcon(QIcon(":ui/statusButton/dot_busy.png")); ui->statusButton->setMenu(statusButtonMenu); - ui->titleBar->setMouseTracking(true); - ui->LTitle->setMouseTracking(true); - ui->tbMenu->setMouseTracking(true); - ui->pbMin->setMouseTracking(true); - ui->pbMax->setMouseTracking(true); - ui->pbClose->setMouseTracking(true); - ui->statusHead->setMouseTracking(true); - - //ui->friendList->viewport()->installEventFilter(this); - // disable proportional scaling ui->mainSplitter->setStretchFactor(0,0); ui->mainSplitter->setStretchFactor(1,1); - ui->statusButton->setObjectName("offline"); - ui->statusButton->style()->polish(ui->statusButton); + ui->statusButton->setProperty("status", "offline"); + Style::repolish(ui->statusButton); camera = new Camera; settingsDialog = new SettingsDialog(this); @@ -359,26 +340,23 @@ void Widget::onStatusSet(Status status) { //We have to use stylesheets here, there's no way to //prevent the button icon from moving when pressed otherwise - if (status == Status::Online) + switch (status) { - ui->statusButton->setObjectName("online"); - ui->statusButton->style()->polish(ui->statusButton); - } - else if (status == Status::Away) - { - ui->statusButton->setObjectName("away"); - ui->statusButton->style()->polish(ui->statusButton); - } - else if (status == Status::Busy) - { - ui->statusButton->setObjectName("busy"); - ui->statusButton->style()->polish(ui->statusButton); - } - else if (status == Status::Offline) - { - ui->statusButton->setObjectName("offline"); - ui->statusButton->style()->polish(ui->statusButton); + case Status::Online: + ui->statusButton->setProperty("status" ,"online"); + break; + case Status::Away: + ui->statusButton->setProperty("status" ,"away"); + break; + case Status::Busy: + ui->statusButton->setProperty("status" ,"busy"); + break; + case Status::Offline: + ui->statusButton->setProperty("status" ,"offline"); + break; } + + Style::repolish(ui->statusButton); } void Widget::onAddClicked()