1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Merge pull request #362 from krepa098/style

Style
This commit is contained in:
Tux3 / Mlkj / !Lev.uXFMLA 2014-10-01 19:18:00 +02:00
commit 193b4e8bee
29 changed files with 474 additions and 307 deletions

View File

@ -36,19 +36,17 @@ Friend::~Friend()
void Friend::setName(QString name) void Friend::setName(QString name)
{ {
widget->name.setText(name); widget->setName(name);
widget->name.setToolTip(name); // for overlength names
chatForm->setName(name); chatForm->setName(name);
} }
void Friend::setStatusMessage(QString message) void Friend::setStatusMessage(QString message)
{ {
widget->statusMessage.setText(message); widget->setStatusMsg(message);
widget->statusMessage.setToolTip(message); // for overlength messsages
chatForm->setStatusMessage(message); chatForm->setStatusMessage(message);
} }
QString Friend::getName() QString Friend::getName()
{ {
return widget->name.text(); return widget->getName();
} }

View File

@ -19,17 +19,129 @@
#include <QFile> #include <QFile>
#include <QDebug> #include <QDebug>
#include <QMap>
#include <QRegularExpression>
#include <QWidget>
#include <QStyle>
QString Style::get(const QString &filename) // helper functions
QFont appFont(int pixelSize, int weight)
{
QFont font;
font.setPixelSize(pixelSize);
font.setWeight(weight);
return font;
}
QString qssifyWeight(int weight)
{
QString weightStr = "normal";
if (weight == QFont::Bold)
weightStr = "bold";
if (weight == QFont::Light)
weightStr = "light";
return QString("%1").arg(weightStr);
}
QString qssifyFont(QFont font)
{
return QString("%1px %2 \"%3\"")
.arg(font.pixelSize())
.arg(qssifyWeight(font.weight()))
.arg(font.family());
}
QString Style::getStylesheet(const QString &filename)
{ {
if (!Settings::getInstance().getUseNativeStyle()) if (!Settings::getInstance().getUseNativeStyle())
{ {
QFile file(filename); QFile file(filename);
if (file.open(QFile::ReadOnly | QFile::Text)) if (file.open(QFile::ReadOnly | QFile::Text))
return file.readAll(); return resolve(file.readAll());
else else
qWarning() << "Style " << filename << " not found"; qWarning() << "Style: Stylesheet " << filename << " not found";
} }
return QString(); return QString();
} }
QColor Style::getColor(Style::ColorPalette entry)
{
static QColor palette[] = {
QColor("#6bc260"),
QColor("#cebf44"),
QColor("#c84e4e"),
QColor("#000000"),
QColor("#1c1c1c"),
QColor("#414141"),
QColor("#414141").lighter(120),
QColor("#d1d1d1"),
QColor("#ffffff"),
};
return palette[entry];
}
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];
}
QString Style::resolve(QString qss)
{
static QMap<QString, QString> dict = {
// colors
{"@green", getColor(Green).name()},
{"@yellow", getColor(Yellow).name()},
{"@red", getColor(Red).name()},
{"@black", getColor(Black).name()},
{"@darkGrey", getColor(DarkGrey).name()},
{"@mediumGrey", getColor(MediumGrey).name()},
{"@mediumGreyLight", getColor(MediumGreyLight).name()},
{"@lightGrey", getColor(LightGrey).name()},
{"@white", getColor(White).name()},
// fonts
{"@extraBig", qssifyFont(getFont(ExtraBig))},
{"@big", qssifyFont(getFont(Big))},
{"@bigBold", qssifyFont(getFont(BigBold))},
{"@medium", qssifyFont(getFont(Medium))},
{"@mediumBold", qssifyFont(getFont(MediumBold))},
{"@small", qssifyFont(getFont(Small))},
{"@smallLight", qssifyFont(getFont(SmallLight))},
};
for (const QString& key : dict.keys())
{
qss.replace(QRegularExpression(QString("%1\\b").arg(key)), dict[key]);
}
return qss;
}
void Style::repolish(QWidget *w)
{
w->style()->unpolish(w);
w->style()->polish(w);
for (QObject* o : w->children())
{
QWidget* c = qobject_cast<QWidget*>(o);
if (c)
{
c->style()->unpolish(c);
c->style()->polish(c);
}
}
}

View File

@ -17,12 +17,45 @@
#ifndef STYLE_H #ifndef STYLE_H
#define STYLE_H #define STYLE_H
#include <QColor>
#include <QFont>
class QString; class QString;
class QWidget;
class Style class Style
{ {
public: public:
static QString get(const QString& filename); enum ColorPalette
{
Green,
Yellow,
Red,
Black,
DarkGrey,
MediumGrey,
MediumGreyLight,
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);
static QString resolve(QString qss);
static void repolish(QWidget* w);
private: private:
Style(); Style();
}; };

View File

@ -145,5 +145,6 @@
<file>translations/uk.qm</file> <file>translations/uk.qm</file>
<file>img/avatar_mask.png</file> <file>img/avatar_mask.png</file>
<file>img/group_2x.png</file> <file>img/group_2x.png</file>
<file>ui/chatroomWidgets/genericChatroomWidget.css</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@ -1,25 +1,31 @@
div.name_me {
color: #646464;
font-weight: bold;
padding-right: 3px;
}
div.name { div.name {
color: #000000; color: @black;
font-weight: bold; font: @big;
padding-right: 3px;
} }
div.message { div.message {
color: #000000; color: @black;
padding-right: 3px; font: @big;
padding-left: 3px;
} }
div.date { div.date {
color: #000000; color: @black;
padding-left: 3px; font: @big;
white-space: nowrap; }
div.name_me {
color: @mediumGrey;
font: @big;
}
div.message_me {
color: @mediumGrey;
font: @big;
}
div.date_me {
color: @mediumGrey;
font: @big;
} }
span.quote { span.quote {
@ -31,9 +37,9 @@ div.green {
margin-bottom: 12px; margin-bottom: 12px;
margin-left: 12px; margin-left: 12px;
margin-right: 12px; margin-right: 12px;
color: #ffffff; color: @white;
background-color: #6bc260; background-color: @green;
font-size: 10px; font: @small;
} }
div.silver { div.silver {
@ -41,9 +47,9 @@ div.silver {
margin-bottom: 12px; margin-bottom: 12px;
margin-left: 12px; margin-left: 12px;
margin-right: 12px; margin-right: 12px;
color: #000000; color: @black;
background-color: #d1d1d1; background-color: @lightGrey;
font-size: 10px; font: @small;
} }
div.red { div.red {
@ -51,14 +57,14 @@ div.red {
margin-bottom: 12px; margin-bottom: 12px;
margin-left: 12px; margin-left: 12px;
margin-right: 12px; margin-right: 12px;
color: #ffffff; color: @white;
background-color: rgb(200,78,78); background-color: @red;
font-size: 10px; font: @small;
} }
div.button { div.button {
margin-top: 0px; margin-top: 0px;
margin-bottom: 0px; margin-bottom: 0px;
margin-left: 0px; margin-left: 0px;
color: #ffffff; color: @white;
} }

View File

@ -0,0 +1,38 @@
GenericChatroomWidget
{
background-color: @mediumGrey;
}
GenericChatroomWidget[active="true"]
{
background-color: @white;
}
GenericChatroomWidget[active="false"]:hover
{
background-color: @mediumGreyLight;
}
GenericChatroomWidget[active="true"] > QLabel#status
{
font: @medium;
color: @mediumGrey;
}
GenericChatroomWidget[active="false"] > QLabel#status
{
font: @medium;
color: @lightGrey;
}
GenericChatroomWidget[active="true"] > QLabel#name
{
font: @big;
color: @darkGrey;
}
GenericChatroomWidget[active="false"] > QLabel#name
{
font: @big;
color: @white;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 233 B

After

Width:  |  Height:  |  Size: 216 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 263 B

After

Width:  |  Height:  |  Size: 234 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 237 B

After

Width:  |  Height:  |  Size: 233 B

View File

@ -35,6 +35,6 @@ QRadioButton::indicator::checked
QMenu QMenu
{ {
background-color: rgb(240,240,240); /* sets background of the menu */ background-color: @mediumGrey; /* sets background of the menu */
border: 1px solid; border: 0px solid;
} }

View File

@ -1,5 +1,5 @@
QTextEdit { QTextEdit {
border-color: #c4c1bd; border-color: @lightGrey;
border-style: solid; border-style: solid;
border-width: 1px 0 1px 1px; border-width: 1px 0 1px 1px;
} }

View File

@ -48,17 +48,3 @@ QSize AdjustingScrollArea::sizeHint() const
return QScrollArea::sizeHint(); return QScrollArea::sizeHint();
} }
bool AdjustingScrollArea::eventFilter(QObject *obj, QEvent *ev)
{
if (ev->type() == QEvent::Paint)
{
// workaround: sometimes a child widget gets drawn on top of the scrollbar
// so we trigger a repaint afterwards
// => Actually, we don't. This triggers an infinite loop of QEvent::UpdateRequest and burns 100% CPU !
//verticalScrollBar()->update();
//horizontalScrollBar()->update();
}
return QObject::eventFilter(obj, ev);
}

View File

@ -27,7 +27,6 @@ public:
virtual void resizeEvent(QResizeEvent *ev) override; virtual void resizeEvent(QResizeEvent *ev) override;
virtual QSize sizeHint() const override; virtual QSize sizeHint() const override;
virtual bool eventFilter(QObject *obj, QEvent *ev) override;
}; };
#endif // ADJUSTINGSCROLLAREA_H #endif // ADJUSTINGSCROLLAREA_H

View File

@ -23,8 +23,9 @@
#include <QCoreApplication> #include <QCoreApplication>
#include <QDebug> #include <QDebug>
ChatAreaWidget::ChatAreaWidget(QWidget *parent) : ChatAreaWidget::ChatAreaWidget(QWidget *parent)
QTextBrowser(parent) : QTextBrowser(parent)
, nameWidth(75)
{ {
setReadOnly(true); setReadOnly(true);
viewport()->setCursor(Qt::ArrowCursor); viewport()->setCursor(Qt::ArrowCursor);
@ -36,19 +37,19 @@ ChatAreaWidget::ChatAreaWidget(QWidget *parent) :
setAcceptRichText(false); setAcceptRichText(false);
setFrameStyle(QFrame::NoFrame); setFrameStyle(QFrame::NoFrame);
chatTextTable = textCursor().insertTable(1,3);
QTextTableFormat tableFormat; QTextTableFormat tableFormat;
tableFormat.setCellSpacing(15);
tableFormat.setBorderStyle(QTextFrameFormat::BorderStyle_None); tableFormat.setBorderStyle(QTextFrameFormat::BorderStyle_None);
tableFormat.setCellSpacing(2); tableFormat.setColumnWidthConstraints({QTextLength(QTextLength::FixedLength,nameWidth),
tableFormat.setWidth(QTextLength(QTextLength::PercentageLength,100)); QTextLength(QTextLength::PercentageLength,100),
chatTextTable->setFormat(tableFormat); QTextLength(QTextLength::VariableLength,0)});
setNameColWidth(100);
// nameFormat.setAlignment(Qt::AlignRight); chatTextTable = textCursor().insertTable(1,3,tableFormat);
// nameFormat.setNonBreakableLines(true);
// dateFormat.setAlignment(Qt::AlignLeft); nameFormat.setAlignment(Qt::AlignRight);
// dateFormat.setNonBreakableLines(true); nameFormat.setNonBreakableLines(true);
dateFormat.setAlignment(Qt::AlignLeft);
dateFormat.setNonBreakableLines(true);
connect(this, &ChatAreaWidget::anchorClicked, this, &ChatAreaWidget::onAnchorClicked); connect(this, &ChatAreaWidget::anchorClicked, this, &ChatAreaWidget::onAnchorClicked);
connect(verticalScrollBar(), SIGNAL(rangeChanged(int,int)), this, SLOT(onSliderRangeChanged())); connect(verticalScrollBar(), SIGNAL(rangeChanged(int,int)), this, SLOT(onSliderRangeChanged()));
@ -112,9 +113,11 @@ void ChatAreaWidget::insertMessage(ChatAction *msgAction)
cur.clearSelection(); cur.clearSelection();
cur.setKeepPositionOnInsert(true); cur.setKeepPositionOnInsert(true);
chatTextTable->appendRows(1); chatTextTable->appendRows(1);
chatTextTable->cellAt(row,0).firstCursorPosition().setBlockFormat(nameFormat);
chatTextTable->cellAt(row,0).firstCursorPosition().insertHtml(msgAction->getName()); chatTextTable->cellAt(row,0).firstCursorPosition().insertHtml(msgAction->getName());
chatTextTable->cellAt(row,1).firstCursorPosition().insertHtml(msgAction->getMessage()); chatTextTable->cellAt(row,1).firstCursorPosition().insertHtml(msgAction->getMessage());
chatTextTable->cellAt(row,2).firstCursorPosition().insertText(msgAction->getDate()); chatTextTable->cellAt(row,2).firstCursorPosition().setBlockFormat(dateFormat);
chatTextTable->cellAt(row,2).firstCursorPosition().insertHtml(msgAction->getDate());
msgAction->setup(cur, this); msgAction->setup(cur, this);

View File

@ -27,7 +27,7 @@
EmoticonsWidget::EmoticonsWidget(QWidget *parent) : EmoticonsWidget::EmoticonsWidget(QWidget *parent) :
QMenu(parent) QMenu(parent)
{ {
setStyleSheet(Style::get(":/ui/emoticonWidget/emoticonWidget.css")); setStyleSheet(Style::getStylesheet(":/ui/emoticonWidget/emoticonWidget.css"));
setLayout(&layout); setLayout(&layout);
layout.addWidget(&stack); layout.addWidget(&stack);

View File

@ -34,18 +34,26 @@
#include "core.h" #include "core.h"
#include "widget/widget.h" #include "widget/widget.h"
#include "widget/maskablepixmapwidget.h" #include "widget/maskablepixmapwidget.h"
#include "widget/croppinglabel.h"
#include "misc/style.h"
ChatForm::ChatForm(Friend* chatFriend) ChatForm::ChatForm(Friend* chatFriend)
: f(chatFriend) : f(chatFriend)
{ {
nameLabel->setText(f->getName()); nameLabel->setText(f->getName());
avatar->setPixmap(QPixmap(":/img/contact_dark.png"));
avatar->setPixmap(QPixmap(":/img/contact_dark.png"), Qt::transparent);
statusMessageLabel = new CroppingLabel(); 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(); netcam = new NetCamView();
headTextLayout->addWidget(statusMessageLabel); headTextLayout->addWidget(statusMessageLabel);
headTextLayout->addStretch(); headTextLayout->addStretch();
headTextLayout->setSpacing(0);
connect(Core::getInstance(), &Core::fileSendStarted, this, &ChatForm::startFileSend); connect(Core::getInstance(), &Core::fileSendStarted, this, &ChatForm::startFileSend);
connect(Core::getInstance(), &Core::videoFrameReceived, netcam, &NetCamView::updateDisplay); connect(Core::getInstance(), &Core::videoFrameReceived, netcam, &NetCamView::updateDisplay);
@ -507,5 +515,5 @@ void ChatForm::onAvatarRemoved(int FriendId)
if (FriendId != f->friendId) if (FriendId != f->friendId)
return; return;
avatar->setPixmap(QPixmap(":/img/contact_dark.png")); avatar->setPixmap(QPixmap(":/img/contact_dark.png"), Qt::transparent);
} }

View File

@ -36,6 +36,10 @@ GenericChatForm::GenericChatForm(QWidget *parent) :
headWidget = new QWidget(); headWidget = new QWidget();
nameLabel = new CroppingLabel(); 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"); avatar = new MaskablePixmapWidget(this, QSize(40,40), ":/img/avatar_mask.png");
QHBoxLayout *headLayout = new QHBoxLayout(), *mainFootLayout = new QHBoxLayout(); QHBoxLayout *headLayout = new QHBoxLayout(), *mainFootLayout = new QHBoxLayout();
headTextLayout = new QVBoxLayout(); headTextLayout = new QVBoxLayout();
@ -43,8 +47,8 @@ GenericChatForm::GenericChatForm(QWidget *parent) :
QVBoxLayout *footButtonsSmall = new QVBoxLayout(), *volMicLayout = new QVBoxLayout(); QVBoxLayout *footButtonsSmall = new QVBoxLayout(), *volMicLayout = new QVBoxLayout();
chatWidget = new ChatAreaWidget(); chatWidget = new ChatAreaWidget();
chatWidget->document()->setDefaultStyleSheet(Style::get(":ui/chatArea/innerStyle.css")); chatWidget->document()->setDefaultStyleSheet(Style::getStylesheet(":ui/chatArea/innerStyle.css"));
chatWidget->setStyleSheet(Style::get(":/ui/chatArea/chatArea.css")); chatWidget->setStyleSheet(Style::getStylesheet(":/ui/chatArea/chatArea.css"));
msgEdit = new ChatTextEdit(); msgEdit = new ChatTextEdit();
@ -63,25 +67,25 @@ GenericChatForm::GenericChatForm(QWidget *parent) :
footButtonsSmall->setSpacing(2); footButtonsSmall->setSpacing(2);
msgEdit->setStyleSheet(Style::get(":/ui/msgEdit/msgEdit.css")); msgEdit->setStyleSheet(Style::getStylesheet(":/ui/msgEdit/msgEdit.css"));
msgEdit->setFixedHeight(50); msgEdit->setFixedHeight(50);
msgEdit->setFrameStyle(QFrame::NoFrame); msgEdit->setFrameStyle(QFrame::NoFrame);
sendButton->setStyleSheet(Style::get(":/ui/sendButton/sendButton.css")); sendButton->setStyleSheet(Style::getStylesheet(":/ui/sendButton/sendButton.css"));
fileButton->setStyleSheet(Style::get(":/ui/fileButton/fileButton.css")); fileButton->setStyleSheet(Style::getStylesheet(":/ui/fileButton/fileButton.css"));
emoteButton->setStyleSheet(Style::get(":/ui/emoteButton/emoteButton.css")); emoteButton->setStyleSheet(Style::getStylesheet(":/ui/emoteButton/emoteButton.css"));
callButton->setObjectName("green"); callButton->setObjectName("green");
callButton->setStyleSheet(Style::get(":/ui/callButton/callButton.css")); callButton->setStyleSheet(Style::getStylesheet(":/ui/callButton/callButton.css"));
videoButton->setObjectName("green"); 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->setObjectName("green");
volButton->setStyleSheet(volButtonStylesheet); volButton->setStyleSheet(volButtonStylesheet);
QString micButtonStylesheet = Style::get(":/ui/micButton/micButton.css"); QString micButtonStylesheet = Style::getStylesheet(":/ui/micButton/micButton.css");
micButton->setObjectName("green"); micButton->setObjectName("green");
micButton->setStyleSheet(micButtonStylesheet); micButton->setStyleSheet(micButtonStylesheet);
@ -169,7 +173,9 @@ void GenericChatForm::addMessage(QString author, QString message, QDateTime date
if (previousName == author) if (previousName == author)
chatWidget->insertMessage(new MessageAction("", message, date, isMe)); chatWidget->insertMessage(new MessageAction("", message, date, isMe));
else chatWidget->insertMessage(new MessageAction(getElidedName(author) , message, date, isMe)); else
chatWidget->insertMessage(new MessageAction(getElidedName(author) , message, date, isMe));
previousName = author; previousName = author;
} }

View File

@ -21,6 +21,7 @@
#include "widget/croppinglabel.h" #include "widget/croppinglabel.h"
#include "widget/maskablepixmapwidget.h" #include "widget/maskablepixmapwidget.h"
#include "core.h" #include "core.h"
#include "misc/style.h"
#include <QPushButton> #include <QPushButton>
#include <QMimeData> #include <QMimeData>
#include <QDragEnterEvent> #include <QDragEnterEvent>
@ -40,10 +41,14 @@ GroupChatForm::GroupChatForm(Group* chatGroup)
QFont small; QFont small;
small.setPixelSize(10); small.setPixelSize(10);
nameLabel->setText(group->widget->name.text()); nameLabel->setText(group->widget->getName());
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())); 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; QString names;
for (QString& s : group->peers) for (QString& s : group->peers)

View File

@ -23,6 +23,8 @@
#include "core.h" #include "core.h"
#include "widget/form/chatform.h" #include "widget/form/chatform.h"
#include "widget/maskablepixmapwidget.h" #include "widget/maskablepixmapwidget.h"
#include "widget/croppinglabel.h"
#include "misc/style.h"
#include <QContextMenuEvent> #include <QContextMenuEvent>
#include <QMenu> #include <QMenu>
#include <QDrag> #include <QDrag>
@ -31,56 +33,12 @@
#include <QBitmap> #include <QBitmap>
FriendWidget::FriendWidget(int FriendId, QString id) FriendWidget::FriendWidget(int FriendId, QString id)
: friendId(FriendId), isDefaultAvatar{true} : friendId(FriendId)
, isDefaultAvatar{true}
{ {
setMouseTracking(true); avatar->setPixmap(QPixmap(":img/contact.png"), Qt::transparent);
setAutoFillBackground(true);
setFixedHeight(55);
setLayout(&layout);
layout.setSpacing(0);
layout.setMargin(0);
layout.setStretchFactor(this, 100);
textLayout.setSpacing(0);
textLayout.setMargin(0);
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"));
name.setText(id);
//statusPic.setAlignment(Qt::AlignHCenter);
statusPic.setPixmap(QPixmap(":img/status/dot_away.png")); statusPic.setPixmap(QPixmap(":img/status/dot_away.png"));
QFont small; nameLabel->setText(id);
small.setPixelSize(10);
statusMessage.setFont(small);
QPalette pal;
pal.setColor(QPalette::WindowText,Qt::gray);
statusMessage.setPalette(pal);
QPalette pal2;
pal2.setColor(QPalette::WindowText,Qt::white);
name.setPalette(pal2);
QPalette pal3;
pal3.setColor(QPalette::Background, QColor(65,65,65,255));
this->setPalette(pal3);
textLayout.addStretch();
textLayout.addWidget(&name);
textLayout.addWidget(&statusMessage);
textLayout.addStretch();
layout.addSpacing(20);
layout.addWidget(avatar);
layout.addSpacing(5);
layout.addLayout(&textLayout);
layout.addSpacing(5);
layout.addWidget(&statusPic);
layout.addSpacing(5);
isActiveWidget = 0;
layout.invalidate();
layout.update();
layout.activate();
updateGeometry();
} }
void FriendWidget::contextMenuEvent(QContextMenuEvent * event) void FriendWidget::contextMenuEvent(QContextMenuEvent * event)
@ -92,7 +50,7 @@ void FriendWidget::contextMenuEvent(QContextMenuEvent * event)
QMap<QAction*, Group*> groupActions; QMap<QAction*, Group*> groupActions;
for (Group* group : GroupList::groupList) for (Group* group : GroupList::groupList)
{ {
QAction* groupAction = inviteMenu->addAction(group->widget->name.text()); QAction* groupAction = inviteMenu->addAction(group->widget->getName());
groupActions[groupAction] = group; groupActions[groupAction] = group;
} }
if (groupActions.isEmpty()) if (groupActions.isEmpty())
@ -126,38 +84,18 @@ void FriendWidget::contextMenuEvent(QContextMenuEvent * event)
void FriendWidget::setAsActiveChatroom() void FriendWidget::setAsActiveChatroom()
{ {
isActiveWidget = 1; setActive(true);
QFont small; if (isDefaultAvatar)
small.setPixelSize(10); avatar->setPixmap(QPixmap(":img/contact_dark.png"), Qt::transparent);
statusMessage.setFont(small);
QPalette pal;
pal.setColor(QPalette::WindowText,Qt::darkGray);
statusMessage.setPalette(pal);
QPalette pal2;
pal2.setColor(QPalette::WindowText,Qt::black);
name.setPalette(pal2);
QPalette pal3;
pal3.setColor(QPalette::Background, Qt::white);
this->setPalette(pal3);
} }
void FriendWidget::setAsInactiveChatroom() void FriendWidget::setAsInactiveChatroom()
{ {
isActiveWidget = 0; setActive(false);
QFont small; if (isDefaultAvatar)
small.setPixelSize(10); avatar->setPixmap(QPixmap(":img/contact.png"), Qt::transparent);
statusMessage.setFont(small);
QPalette pal;
pal.setColor(QPalette::WindowText,Qt::gray);
statusMessage.setPalette(pal);
QPalette pal2;
pal2.setColor(QPalette::WindowText,Qt::white);
name.setPalette(pal2);
QPalette pal3;
pal3.setColor(QPalette::Background, QColor(65,65,65,255));
this->setPalette(pal3);
} }
void FriendWidget::updateStatusLight() void FriendWidget::updateStatusLight()
@ -202,6 +140,7 @@ void FriendWidget::onAvatarChange(int FriendId, const QPixmap& pic)
isDefaultAvatar = false; isDefaultAvatar = false;
avatar->setPixmap(pic); avatar->setPixmap(pic);
avatar->autopickBackground();
} }
void FriendWidget::onAvatarRemoved(int FriendId) void FriendWidget::onAvatarRemoved(int FriendId)
@ -210,7 +149,7 @@ void FriendWidget::onAvatarRemoved(int FriendId)
return; return;
isDefaultAvatar = true; isDefaultAvatar = true;
avatar->setPixmap(QPixmap(":img/contact_dark.png")); avatar->setPixmap(QPixmap(":img/contact.png"), Qt::transparent);
} }
void FriendWidget::mousePressEvent(QMouseEvent *ev) void FriendWidget::mousePressEvent(QMouseEvent *ev)

View File

@ -20,7 +20,6 @@
#include <QLabel> #include <QLabel>
#include "genericchatroomwidget.h" #include "genericchatroomwidget.h"
#include "croppinglabel.h"
class QPixmap; class QPixmap;
class MaskablePixmapWidget; class MaskablePixmapWidget;
@ -52,9 +51,6 @@ protected:
public: public:
int friendId; int friendId;
MaskablePixmapWidget* avatar;
QLabel statusPic;
CroppingLabel name, statusMessage;
bool isDefaultAvatar; bool isDefaultAvatar;
QPoint dragStartPos; QPoint dragStartPos;
}; };

View File

@ -15,56 +15,82 @@
*/ */
#include "genericchatroomwidget.h" #include "genericchatroomwidget.h"
#include "misc/style.h"
#include "widget/maskablepixmapwidget.h"
#include "croppinglabel.h"
#include <QMouseEvent> #include <QMouseEvent>
#include <QStyle>
GenericChatroomWidget::GenericChatroomWidget(QWidget *parent) : GenericChatroomWidget::GenericChatroomWidget(QWidget *parent)
QWidget(parent) : QFrame(parent)
{ {
setFixedHeight(55);
setLayout(&layout);
layout.setSpacing(0);
layout.setMargin(0);
textLayout.setSpacing(0);
textLayout.setMargin(0);
setLayoutDirection(Qt::LeftToRight); // parent might have set Qt::RightToLeft
// avatar
avatar = new MaskablePixmapWidget(this, QSize(40,40), ":/img/avatar_mask.png");
// status text
statusMessageLabel = new CroppingLabel(this);
statusMessageLabel->setObjectName("status");
// name text
nameLabel = new CroppingLabel(this);
nameLabel->setObjectName("name");
textLayout.addStretch();
textLayout.addWidget(nameLabel);
textLayout.addWidget(statusMessageLabel);
textLayout.addStretch();
layout.addSpacing(20);
layout.addWidget(avatar);
layout.addSpacing(10);
layout.addLayout(&textLayout);
layout.addSpacing(10);
layout.addWidget(&statusPic);
layout.addSpacing(10);
layout.activate();
setProperty("active", false);
setStyleSheet(Style::getStylesheet(":/ui/chatroomWidgets/genericChatroomWidget.css"));
} }
int GenericChatroomWidget::isActive() bool GenericChatroomWidget::isActive()
{ {
return isActiveWidget; return property("active").toBool();
} }
void GenericChatroomWidget::mousePressEvent(QMouseEvent *event) void GenericChatroomWidget::setActive(bool active)
{ {
if ((event->buttons() & Qt::LeftButton) == Qt::LeftButton) setProperty("active", active);
{ Style::repolish(this);
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);
}
}
} }
void GenericChatroomWidget::leaveEvent(QEvent *) void GenericChatroomWidget::setName(const QString &name)
{ {
if (isActive() != 1) nameLabel->setText(name);
{
QPalette pal;
pal.setColor(QPalette::Background, lastColor);
this->setPalette(pal);
}
} }
void GenericChatroomWidget::enterEvent(QEvent *) void GenericChatroomWidget::setStatusMsg(const QString &status)
{ {
if (isActive() != 1) statusMessageLabel->setText(status);
{ }
QPalette pal;
pal.setColor(QPalette::Background, QColor(75,75,75,255)); QString GenericChatroomWidget::getName() const
lastColor = this->palette().background().color(); {
this->setPalette(pal); return nameLabel->text();
} }
QString GenericChatroomWidget::getStatusMsg() const
{
return statusMessageLabel->text();
} }
void GenericChatroomWidget::mouseReleaseEvent(QMouseEvent*) void GenericChatroomWidget::mouseReleaseEvent(QMouseEvent*)

View File

@ -17,23 +17,24 @@
#ifndef GENERICCHATROOMWIDGET_H #ifndef GENERICCHATROOMWIDGET_H
#define GENERICCHATROOMWIDGET_H #define GENERICCHATROOMWIDGET_H
#include <QWidget> #include <QFrame>
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QLabel>
class CroppingLabel;
class MaskablePixmapWidget;
namespace Ui { namespace Ui {
class MainWindow; class MainWindow;
} }
class GenericChatroomWidget : public QWidget class GenericChatroomWidget : public QFrame
{ {
Q_OBJECT Q_OBJECT
public: public:
GenericChatroomWidget(QWidget *parent = 0); GenericChatroomWidget(QWidget *parent = 0);
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent (QMouseEvent* event); void mouseReleaseEvent (QMouseEvent* event);
void leaveEvent(QEvent *);
void enterEvent(QEvent *);
virtual void setAsActiveChatroom(){;} virtual void setAsActiveChatroom(){;}
virtual void setAsInactiveChatroom(){;} virtual void setAsInactiveChatroom(){;}
@ -41,7 +42,14 @@ public:
virtual void setChatForm(Ui::MainWindow &){;} virtual void setChatForm(Ui::MainWindow &){;}
virtual void resetEventFlags(){;} virtual void resetEventFlags(){;}
int isActive(); bool isActive();
void setActive(bool active);
void setName(const QString& name);
void setStatusMsg(const QString& status);
QString getName() const;
QString getStatusMsg() const;
signals: signals:
void chatroomWidgetClicked(GenericChatroomWidget* widget); void chatroomWidgetClicked(GenericChatroomWidget* widget);
@ -49,10 +57,12 @@ signals:
public slots: public slots:
protected: protected:
int isActiveWidget;
QColor lastColor; QColor lastColor;
QHBoxLayout layout; QHBoxLayout layout;
QVBoxLayout textLayout; QVBoxLayout textLayout;
MaskablePixmapWidget* avatar;
QLabel statusPic;
CroppingLabel *nameLabel, *statusMessageLabel;
}; };
#endif // GENERICCHATROOMWIDGET_H #endif // GENERICCHATROOMWIDGET_H

View File

@ -20,6 +20,7 @@
#include "misc/settings.h" #include "misc/settings.h"
#include "widget/form/groupchatform.h" #include "widget/form/groupchatform.h"
#include "widget/maskablepixmapwidget.h" #include "widget/maskablepixmapwidget.h"
#include "misc/style.h"
#include <QPalette> #include <QPalette>
#include <QMenu> #include <QMenu>
#include <QContextMenuEvent> #include <QContextMenuEvent>
@ -29,53 +30,15 @@
GroupWidget::GroupWidget(int GroupId, QString Name) GroupWidget::GroupWidget(int GroupId, QString Name)
: groupId{GroupId} : groupId{GroupId}
{ {
setMouseTracking(true); avatar->setPixmap(QPixmap(":img/group.png"), Qt::transparent);
setAutoFillBackground(true);
setLayout(&layout);
setFixedHeight(55);
layout.setSpacing(0);
layout.setMargin(0);
textLayout.setSpacing(0);
textLayout.setMargin(0);
setLayoutDirection(Qt::LeftToRight); // parent might have set Qt::RightToLeft
avatar = new MaskablePixmapWidget(this, QSize(40,40), QString(), Qt::transparent);
avatar->setPixmap(QPixmap(":img/group.png"));
statusPic.setPixmap(QPixmap(":img/status/dot_online.png")); statusPic.setPixmap(QPixmap(":img/status/dot_online.png"));
name.setText(Name); nameLabel->setText(Name);
QFont small;
small.setPixelSize(10);
nusers.setFont(small);
QPalette pal;
pal.setColor(QPalette::WindowText,Qt::gray);
nusers.setPalette(pal);
QPalette pal2;
pal2.setColor(QPalette::WindowText,Qt::white);
name.setPalette(pal2);
QPalette pal3;
pal3.setColor(QPalette::Background, QColor(65,65,65,255));
this->setPalette(pal3);
Group* g = GroupList::findGroup(groupId); Group* g = GroupList::findGroup(groupId);
if (g) if (g)
nusers.setText(GroupWidget::tr("%1 users in chat").arg(g->peers.size())); statusMessageLabel->setText(GroupWidget::tr("%1 users in chat").arg(g->peers.size()));
else else
nusers.setText(GroupWidget::tr("0 users in chat")); statusMessageLabel->setText(GroupWidget::tr("0 users in chat"));
textLayout.addStretch();
textLayout.addWidget(&name);
textLayout.addWidget(&nusers);
textLayout.addStretch();
layout.addSpacing(20);
layout.addWidget(avatar);
layout.addSpacing(5);
layout.addLayout(&textLayout);
layout.addStretch();
layout.addSpacing(5);
layout.addWidget(&statusPic);
layout.addSpacing(5);
isActiveWidget = 0;
} }
void GroupWidget::contextMenuEvent(QContextMenuEvent * event) void GroupWidget::contextMenuEvent(QContextMenuEvent * event)
@ -86,60 +49,28 @@ void GroupWidget::contextMenuEvent(QContextMenuEvent * event)
QAction* selectedItem = menu.exec(pos); QAction* selectedItem = menu.exec(pos);
if (selectedItem == quitGroup) if (selectedItem == quitGroup)
{
hide();
show(); //Toggle visibility to work around bug of repaintEvent() not being fired on parent widget when this is hidden
hide();
emit removeGroup(groupId); emit removeGroup(groupId);
return;
}
} }
void GroupWidget::onUserListChanged() void GroupWidget::onUserListChanged()
{ {
Group* g = GroupList::findGroup(groupId); Group* g = GroupList::findGroup(groupId);
if (g) if (g)
nusers.setText(tr("%1 users in chat").arg(g->nPeers)); statusMessageLabel->setText(tr("%1 users in chat").arg(g->nPeers));
else else
nusers.setText(tr("0 users in chat")); statusMessageLabel->setText(tr("0 users in chat"));
} }
void GroupWidget::setAsActiveChatroom() void GroupWidget::setAsActiveChatroom()
{ {
isActiveWidget = 1; setActive(true);
avatar->setPixmap(QPixmap(":img/group_dark.png"), Qt::transparent);
QFont small;
small.setPixelSize(10);
nusers.setFont(small);
QPalette pal;
pal.setColor(QPalette::WindowText,Qt::darkGray);
nusers.setPalette(pal);
QPalette pal2;
pal2.setColor(QPalette::WindowText,Qt::black);
name.setPalette(pal2);
QPalette pal3;
pal3.setColor(QPalette::Background, Qt::white);
this->setPalette(pal3);
avatar->setPixmap(QPixmap(":img/group_dark.png"));
} }
void GroupWidget::setAsInactiveChatroom() void GroupWidget::setAsInactiveChatroom()
{ {
isActiveWidget = 0; setActive(false);
avatar->setPixmap(QPixmap(":img/group.png"), Qt::transparent);
QFont small;
small.setPixelSize(10);
nusers.setFont(small);
QPalette pal;
pal.setColor(QPalette::WindowText,Qt::gray);
nusers.setPalette(pal);
QPalette pal2;
pal2.setColor(QPalette::WindowText,Qt::white);
name.setPalette(pal2);
QPalette pal3;
pal3.setColor(QPalette::Background, QColor(65,65,65,255));
this->setPalette(pal3);
avatar->setPixmap(QPixmap(":img/group.png"));
} }
void GroupWidget::updateStatusLight() void GroupWidget::updateStatusLight()
@ -152,16 +83,20 @@ void GroupWidget::updateStatusLight()
{ {
statusPic.setPixmap(QPixmap(":img/status/dot_online.png")); statusPic.setPixmap(QPixmap(":img/status/dot_online.png"));
} else { } else {
if (g->userWasMentioned == 0) statusPic.setPixmap(QPixmap(":img/status/dot_online_notification.png")); if (g->userWasMentioned == 0)
else statusPic.setPixmap(QPixmap(":img/status/dot_online_notification.png")); statusPic.setPixmap(QPixmap(":img/status/dot_online_notification.png"));
else
statusPic.setPixmap(QPixmap(":img/status/dot_online_notification.png"));
} }
} else { } else {
if (g->hasNewMessages == 0) if (g->hasNewMessages == 0)
{ {
statusPic.setPixmap(QPixmap(":img/status/dot_groupchat.png")); statusPic.setPixmap(QPixmap(":img/status/dot_groupchat.png"));
} else { } else {
if (g->userWasMentioned == 0) statusPic.setPixmap(QPixmap(":img/status/dot_groupchat_newmessages.png")); if (g->userWasMentioned == 0)
else statusPic.setPixmap(QPixmap(":img/status/dot_groupchat_notification.png")); statusPic.setPixmap(QPixmap(":img/status/dot_groupchat_newmessages.png"));
else
statusPic.setPixmap(QPixmap(":img/status/dot_groupchat_notification.png"));
} }
} }
} }

View File

@ -20,8 +20,6 @@
#include <QLabel> #include <QLabel>
#include "genericchatroomwidget.h" #include "genericchatroomwidget.h"
class MaskablePixmapWidget;
class GroupWidget : public GenericChatroomWidget class GroupWidget : public GenericChatroomWidget
{ {
Q_OBJECT Q_OBJECT
@ -41,8 +39,6 @@ signals:
public: public:
int groupId; int groupId;
QLabel name, nusers, statusPic;
MaskablePixmapWidget* avatar;
}; };
#endif // GROUPWIDGET_H #endif // GROUPWIDGET_H

View File

@ -17,9 +17,9 @@
#include "maskablepixmapwidget.h" #include "maskablepixmapwidget.h"
#include <QPainter> #include <QPainter>
MaskablePixmapWidget::MaskablePixmapWidget(QWidget *parent, QSize size, QString maskName, QColor background) MaskablePixmapWidget::MaskablePixmapWidget(QWidget *parent, QSize size, QString maskName)
: QWidget(parent) : QWidget(parent)
, backgroundColor(background) , backgroundColor(Qt::white)
, clickable(false) , clickable(false)
{ {
setFixedSize(size); setFixedSize(size);
@ -30,6 +30,48 @@ MaskablePixmapWidget::MaskablePixmapWidget(QWidget *parent, QSize size, QString
mask = QPixmap(maskName).scaled(size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); mask = QPixmap(maskName).scaled(size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
} }
void MaskablePixmapWidget::autopickBackground()
{
QImage pic = pixmap.toImage();
if (pic.isNull())
return;
int r = 0;
int g = 0;
int b = 0;
int weight = 0;
for (int x=0;x<pic.width();++x)
{
for (int y=0;y<pic.height();++y)
{
QRgb color = pic.pixel(x,y);
r += qRed(color);
g += qGreen(color);
b += qBlue(color);
weight += qAlpha(color);
}
}
weight = qMax(1, weight / 255);
r /= weight;
g /= weight;
b /= weight;
QColor color = QColor::fromRgb(r,g,b);
backgroundColor = QColor::fromRgb(0xFFFFFF ^ color.rgb());
update();
}
void MaskablePixmapWidget::setBackground(QColor color)
{
backgroundColor = color;
update();
}
void MaskablePixmapWidget::setClickable(bool clickable) void MaskablePixmapWidget::setClickable(bool clickable)
{ {
this->clickable = clickable; this->clickable = clickable;
@ -40,10 +82,26 @@ void MaskablePixmapWidget::setClickable(bool clickable)
unsetCursor(); unsetCursor();
} }
void MaskablePixmapWidget::setPixmap(const QPixmap &pmap, QColor background)
{
if (!pmap.isNull())
{
pixmap = pmap.scaled(width(), height(), Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation);
backgroundColor = background;
update();
}
}
void MaskablePixmapWidget::setPixmap(const QPixmap &pmap) void MaskablePixmapWidget::setPixmap(const QPixmap &pmap)
{ {
pixmap = pmap.scaled(width(), height(), Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation); if (!pmap.isNull())
update(); {
pixmap = pmap.scaled(width(), height(), Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation);
autopickBackground();
update();
}
} }
QPixmap MaskablePixmapWidget::getPixmap() const QPixmap MaskablePixmapWidget::getPixmap() const

View File

@ -23,9 +23,12 @@ class MaskablePixmapWidget : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
MaskablePixmapWidget(QWidget *parent, QSize size, QString maskName, QColor background = Qt::white); MaskablePixmapWidget(QWidget *parent, QSize size, QString maskName = QString());
void autopickBackground();
void setBackground(QColor color);
void setClickable(bool clickable); void setClickable(bool clickable);
void setPixmap(const QPixmap &pmap, QColor background);
void setPixmap(const QPixmap &pmap); void setPixmap(const QPixmap &pmap);
QPixmap getPixmap() const; QPixmap getPixmap() const;

View File

@ -41,13 +41,15 @@ QString ChatAction::QImage2base64(const QImage &img)
QString ChatAction::getName() QString ChatAction::getName()
{ {
if (isMe) if (isMe)
return QString("<div class=name_me>" + toHtmlChars(name) + "</div>"); return QString("<div class=%1>%2</div>").arg("name_me").arg(toHtmlChars(name));
else else
return QString("<div class=name>" + toHtmlChars(name) + "</div>"); return QString("<div class=%1>%2</div>").arg("name").arg(toHtmlChars(name));
} }
QString ChatAction::getDate() QString ChatAction::getDate()
{ {
QString res = date; if (isMe)
return res; return QString("<div class=date_me>" + toHtmlChars(date) + "</div>");
else
return QString("<div class=date>" + toHtmlChars(date) + "</div>");
} }

View File

@ -71,5 +71,8 @@ QString MessageAction::getMessage()
} }
message_ = message_.left(message_.length()-4); message_ = message_.left(message_.length()-4);
return QString("<div class=message>" + message_ + "</div>"); if (isMe)
return QString("<div class=message_me>" + message_ + "</div>");
else
return QString("<div class=message>" + message_ + "</div>");
} }

View File

@ -68,17 +68,17 @@ Widget::Widget(QWidget *parent)
this->layout()->setContentsMargins(0, 0, 0, 0); this->layout()->setContentsMargins(0, 0, 0, 0);
ui->friendList->setObjectName("friendList"); ui->friendList->setObjectName("friendList");
ui->friendList->setStyleSheet(Style::get(":ui/friendList/friendList.css")); ui->friendList->setStyleSheet(Style::getStylesheet(":ui/friendList/friendList.css"));
} }
else else
{ {
this->setObjectName("activeWindow"); this->setObjectName("activeWindow");
this->setStyleSheet(Style::get(":ui/window/window.css")); this->setStyleSheet(Style::getStylesheet(":ui/window/window.css"));
ui->statusPanel->setStyleSheet(QString("")); ui->statusPanel->setStyleSheet(QString(""));
ui->friendList->setStyleSheet(QString("")); ui->friendList->setStyleSheet(QString(""));
ui->friendList->setObjectName("friendList"); 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->tbMenu->setIcon(QIcon(":ui/window/applicationIcon.png"));
ui->pbMin->setObjectName("minimizeButton"); ui->pbMin->setObjectName("minimizeButton");
@ -116,6 +116,7 @@ Widget::Widget(QWidget *parent)
profilePicture->setPixmap(QPixmap(":/img/contact_dark.png")); profilePicture->setPixmap(QPixmap(":/img/contact_dark.png"));
profilePicture->setClickable(true); profilePicture->setClickable(true);
ui->horizontalLayout_3->insertWidget(0,profilePicture); ui->horizontalLayout_3->insertWidget(0,profilePicture);
ui->horizontalLayout_3->insertSpacing(1, 7);
ui->mainContent->setLayout(new QVBoxLayout()); ui->mainContent->setLayout(new QVBoxLayout());
ui->mainHead->setLayout(new QVBoxLayout()); ui->mainHead->setLayout(new QVBoxLayout());
@ -129,13 +130,16 @@ Widget::Widget(QWidget *parent)
ui->nameLabel->setEditable(true); ui->nameLabel->setEditable(true);
ui->statusLabel->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 // delay setting username and message until Core inits
//ui->nameLabel->setText(core->getUsername()); //ui->nameLabel->setText(core->getUsername());
ui->nameLabel->setStyleSheet("QLabel { color : white; font-size: 11pt; font-weight:bold;}"); ui->nameLabel->setStyleSheet("QLabel { color : white; font-size: 11pt; font-weight:bold;}");
//ui->statusLabel->setText(core->getStatusMessage()); //ui->statusLabel->setText(core->getStatusMessage());
ui->statusLabel->setStyleSheet("QLabel { color : white; font-size: 8pt;}"); 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); QMenu *statusButtonMenu = new QMenu(ui->statusButton);
QAction* setStatusOnline = statusButtonMenu->addAction(Widget::tr("Online","Button to set your status to 'Online'")); QAction* setStatusOnline = statusButtonMenu->addAction(Widget::tr("Online","Button to set your status to 'Online'"));