From a4cd2d34db375660399247db4a17b368a56bb9d5 Mon Sep 17 00:00:00 2001 From: krepa098 Date: Tue, 30 Sep 2014 20:10:42 +0200 Subject: [PATCH] cleanup, applied some of the "Tox User Interface Guidelines" --- misc/style.cpp | 43 ++++++++++++++- misc/style.h | 30 ++++++++++- ui/emoticonWidget/dot_page.png | Bin 233 -> 216 bytes ui/emoticonWidget/dot_page_current.png | Bin 263 -> 234 bytes ui/emoticonWidget/dot_page_hover.png | Bin 237 -> 233 bytes ui/emoticonWidget/emoticonWidget.css | 4 +- widget/emoticonswidget.cpp | 2 +- widget/form/chatform.cpp | 11 +++- widget/form/genericchatform.cpp | 24 +++++---- widget/form/groupchatform.cpp | 9 +++- widget/friendwidget.cpp | 71 +++++++++++++----------- widget/genericchatroomwidget.cpp | 48 ++++++++--------- widget/genericchatroomwidget.h | 8 +-- widget/groupwidget.cpp | 72 +++++++++++++------------ widget/maskablepixmapwidget.cpp | 37 ++++++++----- widget/maskablepixmapwidget.h | 4 +- widget/widget.cpp | 12 +++-- 17 files changed, 241 insertions(+), 134 deletions(-) diff --git a/misc/style.cpp b/misc/style.cpp index 609dcc277..0801cf154 100644 --- a/misc/style.cpp +++ b/misc/style.cpp @@ -19,8 +19,9 @@ #include #include +#include -QString Style::get(const QString &filename) +QString Style::getStylesheet(const QString &filename) { if (!Settings::getInstance().getUseNativeStyle()) { @@ -28,8 +29,46 @@ QString Style::get(const QString &filename) if (file.open(QFile::ReadOnly | QFile::Text)) return file.readAll(); else - qWarning() << "Style " << filename << " not found"; + qWarning() << "Stylesheet " << filename << " not found"; } return QString(); } + +QColor Style::getColor(Style::ColorPalette entry) +{ + static QColor palette[] = { + QColor("#6bc260"), + QColor("#cebf44"), + QColor("#c84e4e"), + QColor("#000000"), + QColor("#1c1c1c"), + QColor("#414141"), + QColor("#d1d1d1"), + QColor("#ffffff"), + }; + + return palette[entry]; +} + +QFont appFont(int pixelSize, int weight) { + auto font = QFont(); + font.setPixelSize(pixelSize); + font.setWeight(weight); + return font; +} + +QFont Style::getFont(Style::Font font) +{ + static QFont fonts[] = { + appFont(14, QFont::Bold), + appFont(12, QFont::Normal), + appFont(12, QFont::Bold), + appFont(11, QFont::Normal), + appFont(11, QFont::Bold), + appFont(10, QFont::Normal), + appFont(10, QFont::Light), + }; + + return fonts[font]; +} diff --git a/misc/style.h b/misc/style.h index 4bd42d77f..326972d92 100644 --- a/misc/style.h +++ b/misc/style.h @@ -17,12 +17,40 @@ #ifndef STYLE_H #define STYLE_H +#include +#include + class QString; class Style { public: - static QString get(const QString& filename); + enum ColorPalette + { + Green, + Yellow, + Red, + Black, + DarkGrey, + MediumGrey, + LightGrey, + White, + }; + + enum Font + { + ExtraBig, // 14px, bold + Big, // 12px + BigBold, // 12px, bold + Medium, // 11px + MediumBold, // 11px, bold + Small, // 10px + SmallLight // 10px, light + }; + + static QString getStylesheet(const QString& filename); + static QColor getColor(ColorPalette entry); + static QFont getFont(Font font); private: Style(); }; diff --git a/ui/emoticonWidget/dot_page.png b/ui/emoticonWidget/dot_page.png index c7c2aa172e2a03a298bf6f7f21c55384fc0617d4..e74d514e21cf6a0a7f3fa6f87fca8d11224d0f55 100644 GIT binary patch delta 142 zcmV;90CE560oVbMQhx~^5(N+@R0bUY003o4L_t&-(~Xcj3V<*WM8~w=Oc4CsN3gc= zND_NJij9Khv)MopjCnBC4!b)e89)!Lz+v)0rx;-7nTMF8EA)8+=$-Z)U%)l5y&iMi)po!=Q%#s!W3uy$dlo=%5ESjF| z(|ODtksN3%#FJBr1K$eo<3L{__AY4y9y`)q(#r~mpCft$lNh8G;17Dj9C>iHTcZE~ N002ovPDHLkV1lUoKeYe= diff --git a/ui/emoticonWidget/dot_page_current.png b/ui/emoticonWidget/dot_page_current.png index aa101903afbe49b8301478ab8d62053662ad07a4..7b18c42c216e4043588c1dd827246efc81f62347 100644 GIT binary patch delta 160 zcmV;R0AK%y0_p*fQhx~^5(YRp%>5()004JML_t&-(~XcZ3WHD(MBm@@xJ^P1BA#P0 z&DMdmUogRIh!%kyA`lxdWV5B{f93F)fk_0znj4@6s)$zLZR!(13aJO~?9-XLr)U~E zrk0pHqZQy%AYO$+1Xv2ZzW}*F%wp;v;CUcDO#Pd74!=e80~ubXJ_BqW7#z+n{nqaQ O0000c%>pFBCD7h`NBweCLZ(_PZ8>$($w0P4El zy8E2ZHfFX|jIjZZ{5A`cTK;Q;yN@%*Ngz{@bj$dz0a#~@>oy{#^sK5X0Mjqi%FGT0 rKuYOcmgPgz5EuY2-~uenY!C1TL+vY1V!_+~00000NkvXXu0mjf17=jA diff --git a/ui/emoticonWidget/dot_page_hover.png b/ui/emoticonWidget/dot_page_hover.png index 1c23931b921ef2be1841c3404062acc16234ebcc..822dbb6c62fa37a722652a85770df1f574d56373 100644 GIT binary patch delta 159 zcmV;Q0AT;^0qFsdQhx~^5(hW2Xwmcl004GLL_t&-(~XcZ3c^4XMBo3XnIe_qK|&6) zHr9e|0w(teNfF2)1Z`~gI5xjr;=Xct%)l5y&bb2;&_whFCP@o`h4cijlo=%5EShGH zX+7rtksLTxh-aq~2R;?v+kw79>|N3ZJPxG0q}>XKUm|(|qZp(W;0MEY95-u3c#Qx6 N002ovPDHLkV1i`1K#2eV delta 163 zcmV;U09^m+0qp^hQhx{v4FWi+!8H{C004SPL_t&-(~XcZ3Iah81gqyU7a1u&3aM{}mo1z<9B;EeE0R~`^(F9z>bq7#NXJAX2Q@D1@ zrWsetText(f->getName()); - avatar->setPixmap(QPixmap(":/img/contact_dark.png")); + + avatar->setPixmap(QPixmap(":/img/contact_dark.png"), Qt::transparent); statusMessageLabel = new CroppingLabel(); + statusMessageLabel->setFont(Style::getFont(Style::Medium)); + QPalette pal; pal.setColor(QPalette::WindowText, Style::getColor(Style::MediumGrey)); + statusMessageLabel->setPalette(pal); + netcam = new NetCamView(); headTextLayout->addWidget(statusMessageLabel); headTextLayout->addStretch(); + headTextLayout->setSpacing(0); connect(Core::getInstance(), &Core::fileSendStarted, this, &ChatForm::startFileSend); connect(Core::getInstance(), &Core::videoFrameReceived, netcam, &NetCamView::updateDisplay); @@ -507,5 +514,5 @@ void ChatForm::onAvatarRemoved(int FriendId) if (FriendId != f->friendId) return; - avatar->setPixmap(QPixmap(":/img/contact_dark.png")); + avatar->setPixmap(QPixmap(":/img/contact_dark.png"), Qt::transparent); } diff --git a/widget/form/genericchatform.cpp b/widget/form/genericchatform.cpp index 26bd958ba..2abdd0def 100644 --- a/widget/form/genericchatform.cpp +++ b/widget/form/genericchatform.cpp @@ -36,6 +36,10 @@ GenericChatForm::GenericChatForm(QWidget *parent) : headWidget = new QWidget(); nameLabel = new CroppingLabel(); + nameLabel->setFont(Style::getFont(Style::MediumBold)); + QPalette pal; pal.setColor(QPalette::WindowText, Style::getColor(Style::DarkGrey)); + nameLabel->setPalette(pal); + avatar = new MaskablePixmapWidget(this, QSize(40,40), ":/img/avatar_mask.png"); QHBoxLayout *headLayout = new QHBoxLayout(), *mainFootLayout = new QHBoxLayout(); headTextLayout = new QVBoxLayout(); @@ -43,8 +47,8 @@ GenericChatForm::GenericChatForm(QWidget *parent) : QVBoxLayout *footButtonsSmall = new QVBoxLayout(), *volMicLayout = new QVBoxLayout(); chatWidget = new ChatAreaWidget(); - chatWidget->document()->setDefaultStyleSheet(Style::get(":ui/chatArea/innerStyle.css")); - chatWidget->setStyleSheet(Style::get(":/ui/chatArea/chatArea.css")); + chatWidget->document()->setDefaultStyleSheet(Style::getStylesheet(":ui/chatArea/innerStyle.css")); + chatWidget->setStyleSheet(Style::getStylesheet(":/ui/chatArea/chatArea.css")); msgEdit = new ChatTextEdit(); @@ -63,25 +67,25 @@ GenericChatForm::GenericChatForm(QWidget *parent) : footButtonsSmall->setSpacing(2); - msgEdit->setStyleSheet(Style::get(":/ui/msgEdit/msgEdit.css")); + msgEdit->setStyleSheet(Style::getStylesheet(":/ui/msgEdit/msgEdit.css")); msgEdit->setFixedHeight(50); msgEdit->setFrameStyle(QFrame::NoFrame); - sendButton->setStyleSheet(Style::get(":/ui/sendButton/sendButton.css")); - fileButton->setStyleSheet(Style::get(":/ui/fileButton/fileButton.css")); - emoteButton->setStyleSheet(Style::get(":/ui/emoteButton/emoteButton.css")); + sendButton->setStyleSheet(Style::getStylesheet(":/ui/sendButton/sendButton.css")); + fileButton->setStyleSheet(Style::getStylesheet(":/ui/fileButton/fileButton.css")); + emoteButton->setStyleSheet(Style::getStylesheet(":/ui/emoteButton/emoteButton.css")); callButton->setObjectName("green"); - callButton->setStyleSheet(Style::get(":/ui/callButton/callButton.css")); + callButton->setStyleSheet(Style::getStylesheet(":/ui/callButton/callButton.css")); videoButton->setObjectName("green"); - videoButton->setStyleSheet(Style::get(":/ui/videoButton/videoButton.css")); + videoButton->setStyleSheet(Style::getStylesheet(":/ui/videoButton/videoButton.css")); - QString volButtonStylesheet = Style::get(":/ui/volButton/volButton.css"); + QString volButtonStylesheet = Style::getStylesheet(":/ui/volButton/volButton.css"); volButton->setObjectName("green"); volButton->setStyleSheet(volButtonStylesheet); - QString micButtonStylesheet = Style::get(":/ui/micButton/micButton.css"); + QString micButtonStylesheet = Style::getStylesheet(":/ui/micButton/micButton.css"); micButton->setObjectName("green"); micButton->setStyleSheet(micButtonStylesheet); diff --git a/widget/form/groupchatform.cpp b/widget/form/groupchatform.cpp index 7622f2cf0..5c3253afe 100644 --- a/widget/form/groupchatform.cpp +++ b/widget/form/groupchatform.cpp @@ -21,6 +21,7 @@ #include "widget/croppinglabel.h" #include "widget/maskablepixmapwidget.h" #include "core.h" +#include "style.h" #include #include #include @@ -41,9 +42,13 @@ GroupChatForm::GroupChatForm(Group* chatGroup) small.setPixelSize(10); nameLabel->setText(group->widget->name.text()); - nusersLabel->setFont(small); + + nusersLabel->setFont(Style::getFont(Style::Medium)); nusersLabel->setText(GroupChatForm::tr("%1 users in chat","Number of users in chat").arg(group->peers.size())); - avatar->setPixmap(QPixmap(":/img/group_dark.png")); + QPalette pal; pal.setColor(QPalette::WindowText, Style::getColor(Style::MediumGrey)); + nusersLabel->setPalette(pal); + + avatar->setPixmap(QPixmap(":/img/group_dark.png"), Qt::transparent); QString names; for (QString& s : group->peers) diff --git a/widget/friendwidget.cpp b/widget/friendwidget.cpp index 32971b098..be83930ec 100644 --- a/widget/friendwidget.cpp +++ b/widget/friendwidget.cpp @@ -23,6 +23,7 @@ #include "core.h" #include "widget/form/chatform.h" #include "widget/maskablepixmapwidget.h" +#include "style.h" #include #include #include @@ -31,7 +32,8 @@ #include FriendWidget::FriendWidget(int FriendId, QString id) - : friendId(FriendId), isDefaultAvatar{true} + : friendId(FriendId) + , isDefaultAvatar{true} { setMouseTracking(true); setAutoFillBackground(true); @@ -45,22 +47,28 @@ FriendWidget::FriendWidget(int FriendId, QString id) setLayoutDirection(Qt::LeftToRight); // parent might have set Qt::RightToLeft avatar = new MaskablePixmapWidget(this, QSize(40,40), ":/img/avatar_mask.png"); - avatar->setPixmap(QPixmap(":img/contact_dark.png")); + avatar->setPixmap(QPixmap(":img/contact.png"), Qt::transparent); + name.setText(id); //statusPic.setAlignment(Qt::AlignHCenter); statusPic.setPixmap(QPixmap(":img/status/dot_away.png")); - QFont small; - small.setPixelSize(10); - statusMessage.setFont(small); + + // status text QPalette pal; - pal.setColor(QPalette::WindowText,Qt::gray); + pal.setColor(QPalette::WindowText, Style::getColor(Style::LightGrey)); statusMessage.setPalette(pal); + statusMessage.setFont(Style::getFont(Style::Medium)); + + // name text QPalette pal2; - pal2.setColor(QPalette::WindowText,Qt::white); + pal2.setColor(QPalette::WindowText, Style::getColor(Style::White)); name.setPalette(pal2); + name.setFont(Style::getFont(Style::Big)); + + // background QPalette pal3; - pal3.setColor(QPalette::Background, QColor(65,65,65,255)); - this->setPalette(pal3); + pal3.setColor(QPalette::Background, Style::getColor(Style::MediumGrey)); + setPalette(pal3); textLayout.addStretch(); textLayout.addWidget(&name); @@ -69,13 +77,11 @@ FriendWidget::FriendWidget(int FriendId, QString id) layout.addSpacing(20); layout.addWidget(avatar); - layout.addSpacing(5); + layout.addSpacing(10); layout.addLayout(&textLayout); - layout.addSpacing(5); + layout.addSpacing(10); layout.addWidget(&statusPic); - layout.addSpacing(5); - - isActiveWidget = 0; + layout.addSpacing(10); layout.invalidate(); layout.update(); @@ -126,38 +132,39 @@ void FriendWidget::contextMenuEvent(QContextMenuEvent * event) void FriendWidget::setAsActiveChatroom() { - isActiveWidget = 1; + setActive(true); - QFont small; - small.setPixelSize(10); - statusMessage.setFont(small); + // status QPalette pal; - pal.setColor(QPalette::WindowText,Qt::darkGray); + pal.setColor(QPalette::WindowText, Style::getColor(Style::MediumGrey)); statusMessage.setPalette(pal); + + // name QPalette pal2; - pal2.setColor(QPalette::WindowText,Qt::black); + pal2.setColor(QPalette::WindowText, Style::getColor(Style::DarkGrey)); name.setPalette(pal2); - QPalette pal3; - pal3.setColor(QPalette::Background, Qt::white); - this->setPalette(pal3); + + if (isDefaultAvatar) + avatar->setPixmap(QPixmap(":img/contact_dark.png"), Qt::transparent); } void FriendWidget::setAsInactiveChatroom() { - isActiveWidget = 0; + setActive(false); - QFont small; - small.setPixelSize(10); - statusMessage.setFont(small); + // status QPalette pal; - pal.setColor(QPalette::WindowText,Qt::gray); + pal.setColor(QPalette::WindowText, Style::getColor(Style::LightGrey)); statusMessage.setPalette(pal); + + // name QPalette pal2; - pal2.setColor(QPalette::WindowText,Qt::white); + pal2.setColor(QPalette::WindowText, Style::getColor(Style::White)); name.setPalette(pal2); QPalette pal3; - pal3.setColor(QPalette::Background, QColor(65,65,65,255)); - this->setPalette(pal3); + + if (isDefaultAvatar) + avatar->setPixmap(QPixmap(":img/contact.png"), Qt::transparent); } void FriendWidget::updateStatusLight() @@ -211,7 +218,7 @@ void FriendWidget::onAvatarRemoved(int FriendId) return; isDefaultAvatar = true; - avatar->setPixmap(QPixmap(":img/contact_dark.png")); + avatar->setPixmap(QPixmap(":img/contact.png"), Qt::transparent); } void FriendWidget::mousePressEvent(QMouseEvent *ev) diff --git a/widget/genericchatroomwidget.cpp b/widget/genericchatroomwidget.cpp index 234da1222..224c8f463 100644 --- a/widget/genericchatroomwidget.cpp +++ b/widget/genericchatroomwidget.cpp @@ -15,55 +15,55 @@ */ #include "genericchatroomwidget.h" +#include "style.h" #include -GenericChatroomWidget::GenericChatroomWidget(QWidget *parent) : - QWidget(parent) +GenericChatroomWidget::GenericChatroomWidget(QWidget *parent) + : QWidget(parent) + , isActiveWidget(false) { } -int GenericChatroomWidget::isActive() +bool GenericChatroomWidget::isActive() { return isActiveWidget; } -void GenericChatroomWidget::mousePressEvent(QMouseEvent *event) +void GenericChatroomWidget::setActive(bool active) { - if ((event->buttons() & Qt::LeftButton) == Qt::LeftButton) + isActiveWidget = active; + + if (active) { - if (isActive()) - { - QPalette pal; - pal.setColor(QPalette::Background, QColor(250,250,250,255)); - this->setPalette(pal); - } - else - { - QPalette pal; - pal.setColor(QPalette::Background, QColor(85,85,85,255)); - this->setPalette(pal); - } + QPalette pal; + pal.setColor(QPalette::Background, Style::getColor(Style::White)); + setPalette(pal); + } + else + { + QPalette pal; + pal.setColor(QPalette::Background, Style::getColor(Style::MediumGrey)); + setPalette(pal); } } void GenericChatroomWidget::leaveEvent(QEvent *) { - if (isActive() != 1) + if (!isActive()) { QPalette pal; - pal.setColor(QPalette::Background, lastColor); - this->setPalette(pal); + pal.setColor(QPalette::Background, Style::getColor(Style::MediumGrey)); + setPalette(pal); } } void GenericChatroomWidget::enterEvent(QEvent *) { - if (isActive() != 1) + if (!isActive()) { QPalette pal; - pal.setColor(QPalette::Background, QColor(75,75,75,255)); - lastColor = this->palette().background().color(); - this->setPalette(pal); + pal.setColor(QPalette::Background, Style::getColor(Style::MediumGrey).lighter(120)); + setPalette(pal); } } diff --git a/widget/genericchatroomwidget.h b/widget/genericchatroomwidget.h index 14e46c16e..84b1f2669 100644 --- a/widget/genericchatroomwidget.h +++ b/widget/genericchatroomwidget.h @@ -30,7 +30,6 @@ class GenericChatroomWidget : public QWidget Q_OBJECT public: GenericChatroomWidget(QWidget *parent = 0); - void mousePressEvent(QMouseEvent *event); void mouseReleaseEvent (QMouseEvent* event); void leaveEvent(QEvent *); void enterEvent(QEvent *); @@ -41,15 +40,18 @@ public: virtual void setChatForm(Ui::MainWindow &){;} virtual void resetEventFlags(){;} - int isActive(); + bool isActive(); + void setActive(bool active); signals: void chatroomWidgetClicked(GenericChatroomWidget* widget); public slots: +private: + bool isActiveWidget; + protected: - int isActiveWidget; QColor lastColor; QHBoxLayout layout; QVBoxLayout textLayout; diff --git a/widget/groupwidget.cpp b/widget/groupwidget.cpp index 949fefbdc..d2af2ba4c 100644 --- a/widget/groupwidget.cpp +++ b/widget/groupwidget.cpp @@ -20,6 +20,7 @@ #include "misc/settings.h" #include "widget/form/groupchatform.h" #include "widget/maskablepixmapwidget.h" +#include "style.h" #include #include #include @@ -40,21 +41,28 @@ GroupWidget::GroupWidget(int GroupId, QString Name) setLayoutDirection(Qt::LeftToRight); // parent might have set Qt::RightToLeft avatar = new MaskablePixmapWidget(this, QSize(40,40), ":/img/avatar_mask.png"); - avatar->setPixmap(QPixmap(":img/group_dark.png")); + avatar->setPixmap(QPixmap(":img/group.png"), Qt::transparent); + statusPic.setPixmap(QPixmap(":img/status/dot_online.png")); - name.setText(Name); - QFont small; - small.setPixelSize(10); - nusers.setFont(small); - QPalette pal; - pal.setColor(QPalette::WindowText,Qt::gray); - nusers.setPalette(pal); + + // name QPalette pal2; - pal2.setColor(QPalette::WindowText,Qt::white); + pal2.setColor(QPalette::WindowText, Style::getColor(Style::White)); name.setPalette(pal2); + name.setText(Name); + name.setFont(Style::getFont(Style::Big)); + + // status + QPalette pal; + pal.setColor(QPalette::WindowText, Style::getColor(Style::LightGrey)); + nusers.setPalette(pal); + nusers.setFont(Style::getFont(Style::Medium)); + + // background QPalette pal3; - pal3.setColor(QPalette::Background, QColor(65,65,65,255)); + pal3.setColor(QPalette::Background, Style::getColor(Style::MediumGrey)); this->setPalette(pal3); + Group* g = GroupList::findGroup(groupId); if (g) nusers.setText(GroupWidget::tr("%1 users in chat").arg(g->peers.size())); @@ -68,14 +76,12 @@ GroupWidget::GroupWidget(int GroupId, QString Name) layout.addSpacing(20); layout.addWidget(avatar); - layout.addSpacing(5); + layout.addSpacing(10); layout.addLayout(&textLayout); layout.addStretch(); - layout.addSpacing(5); + layout.addSpacing(10); layout.addWidget(&statusPic); - layout.addSpacing(5); - - isActiveWidget = 0; + layout.addSpacing(10); } void GroupWidget::contextMenuEvent(QContextMenuEvent * event) @@ -106,40 +112,36 @@ void GroupWidget::onUserListChanged() void GroupWidget::setAsActiveChatroom() { - isActiveWidget = 1; + setActive(true); - QFont small; - small.setPixelSize(10); - nusers.setFont(small); + // status QPalette pal; - pal.setColor(QPalette::WindowText,Qt::darkGray); + pal.setColor(QPalette::WindowText, Style::getColor(Style::MediumGrey)); nusers.setPalette(pal); + + // name QPalette pal2; - pal2.setColor(QPalette::WindowText,Qt::black); + pal2.setColor(QPalette::WindowText, Style::getColor(Style::DarkGrey)); name.setPalette(pal2); - QPalette pal3; - pal3.setColor(QPalette::Background, Qt::white); - this->setPalette(pal3); - avatar->setPixmap(QPixmap(":img/group_dark.png")); + + avatar->setPixmap(QPixmap(":img/group_dark.png"), Qt::transparent); } void GroupWidget::setAsInactiveChatroom() { - isActiveWidget = 0; + setActive(false); - QFont small; - small.setPixelSize(10); - nusers.setFont(small); + // status QPalette pal; - pal.setColor(QPalette::WindowText,Qt::gray); + pal.setColor(QPalette::WindowText, Style::getColor(Style::LightGrey)); nusers.setPalette(pal); + + // name QPalette pal2; - pal2.setColor(QPalette::WindowText,Qt::white); + pal2.setColor(QPalette::WindowText, Style::getColor(Style::White)); name.setPalette(pal2); - QPalette pal3; - pal3.setColor(QPalette::Background, QColor(65,65,65,255)); - this->setPalette(pal3); - avatar->setPixmap(QPixmap(":img/group_dark.png")); + + avatar->setPixmap(QPixmap(":img/group.png"), Qt::transparent); } void GroupWidget::updateStatusLight() diff --git a/widget/maskablepixmapwidget.cpp b/widget/maskablepixmapwidget.cpp index 8cdf5d21b..185494147 100644 --- a/widget/maskablepixmapwidget.cpp +++ b/widget/maskablepixmapwidget.cpp @@ -17,11 +17,10 @@ #include "maskablepixmapwidget.h" #include -MaskablePixmapWidget::MaskablePixmapWidget(QWidget *parent, QSize size, QString maskName, bool autopickBackground) +MaskablePixmapWidget::MaskablePixmapWidget(QWidget *parent, QSize size, QString maskName) : QWidget(parent) , backgroundColor(Qt::white) , clickable(false) - , autoBackground(autopickBackground) { setFixedSize(size); @@ -38,29 +37,30 @@ void MaskablePixmapWidget::autopickBackground() if (pic.isNull()) return; - qreal r = 0.0f; - qreal g = 0.0f; - qreal b = 0.0f; - float weight = 1.0f; + int r = 0; + int g = 0; + int b = 0; + int weight = 0; for (int x=0;xlayout()->setContentsMargins(0, 0, 0, 0); ui->friendList->setObjectName("friendList"); - ui->friendList->setStyleSheet(Style::get(":ui/friendList/friendList.css")); + ui->friendList->setStyleSheet(Style::getStylesheet(":ui/friendList/friendList.css")); } else { this->setObjectName("activeWindow"); - this->setStyleSheet(Style::get(":ui/window/window.css")); + this->setStyleSheet(Style::getStylesheet(":ui/window/window.css")); ui->statusPanel->setStyleSheet(QString("")); ui->friendList->setStyleSheet(QString("")); ui->friendList->setObjectName("friendList"); - ui->friendList->setStyleSheet(Style::get(":ui/friendList/friendList.css")); + ui->friendList->setStyleSheet(Style::getStylesheet(":ui/friendList/friendList.css")); ui->tbMenu->setIcon(QIcon(":ui/window/applicationIcon.png")); ui->pbMin->setObjectName("minimizeButton"); @@ -116,6 +116,7 @@ Widget::Widget(QWidget *parent) profilePicture->setPixmap(QPixmap(":/img/contact_dark.png")); profilePicture->setClickable(true); ui->horizontalLayout_3->insertWidget(0,profilePicture); + ui->horizontalLayout_3->insertSpacing(1, 7); ui->mainContent->setLayout(new QVBoxLayout()); ui->mainHead->setLayout(new QVBoxLayout()); @@ -129,13 +130,16 @@ 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::get(":/ui/statusButton/statusButton.css")); + ui->statusButton->setStyleSheet(Style::getStylesheet(":/ui/statusButton/statusButton.css")); QMenu *statusButtonMenu = new QMenu(ui->statusButton); QAction* setStatusOnline = statusButtonMenu->addAction(Widget::tr("Online","Button to set your status to 'Online'"));