diff --git a/res.qrc b/res.qrc
index d57f705fd..33995781f 100644
--- a/res.qrc
+++ b/res.qrc
@@ -103,5 +103,10 @@
translations/fr.qm
translations/ru.qm
ui/fileTransferWidget/fileTransferWidget.css
+ ui/statusButton/dot_away.png
+ ui/statusButton/dot_busy.png
+ ui/statusButton/dot_idle.png
+ ui/statusButton/dot_online.png
+ ui/statusButton/statusButton.css
diff --git a/ui/statusButton/dot_away.png b/ui/statusButton/dot_away.png
new file mode 100644
index 000000000..0a55cf1fa
Binary files /dev/null and b/ui/statusButton/dot_away.png differ
diff --git a/ui/statusButton/dot_busy.png b/ui/statusButton/dot_busy.png
new file mode 100644
index 000000000..6813c1cc9
Binary files /dev/null and b/ui/statusButton/dot_busy.png differ
diff --git a/ui/statusButton/dot_idle.png b/ui/statusButton/dot_idle.png
new file mode 100644
index 000000000..e8bf794f8
Binary files /dev/null and b/ui/statusButton/dot_idle.png differ
diff --git a/ui/statusButton/dot_online.png b/ui/statusButton/dot_online.png
new file mode 100644
index 000000000..2518ca5f2
Binary files /dev/null and b/ui/statusButton/dot_online.png differ
diff --git a/ui/statusButton/statusButton.css b/ui/statusButton/statusButton.css
new file mode 100644
index 000000000..cf3514c89
--- /dev/null
+++ b/ui/statusButton/statusButton.css
@@ -0,0 +1,20 @@
+QPushButton
+{
+ background: none;
+ background-color: rgb(65,65,65);
+ border: none;
+ border-radius: 6px;
+}
+QPushButton:hover
+{
+ background-color: rgb(75,75,75);
+}
+
+QPushButton:pressed
+{
+ background-color: rgb(55,55,55);
+}
+
+QPushButton:focus {
+ outline: none;
+}
diff --git a/widget.ui b/widget.ui
index 5f0a98b46..9ebb53f84 100644
--- a/widget.ui
+++ b/widget.ui
@@ -2025,32 +2025,30 @@ QSplitter:handle{
-
-
+
- 40
+ 21
40
-
-
- 40
- 40
-
-
-
- Qt::LeftToRight
+
+ true
-
- :/img/status/dot_away_2x.png
+
+
+ :/ui/statusButton/dot_away.png:/ui/statusButton/dot_away.png
-
- Qt::AlignCenter
+
+
+ 10
+ 10
+
-
+
true
@@ -2077,6 +2075,9 @@ QSplitter:handle{
Qt::RightToLeft
+
+ true
+
QFrame::NoFrame
@@ -2091,7 +2092,7 @@ QSplitter:handle{
0
0
- 256
+ 255
199
@@ -3280,11 +3281,6 @@ QSplitter:handle{
QLabel
widget/tool/editablelabelwidget.h
-
- ClickableLabel
- QLabel
- widget/tool/clickablelabel.h
-
diff --git a/widget/widget.cpp b/widget/widget.cpp
index ad656e475..939c8aa4f 100644
--- a/widget/widget.cpp
+++ b/widget/widget.cpp
@@ -125,9 +125,6 @@ Widget::Widget(QWidget *parent) :
isWindowMinimized = 0;
- //centralLayout = new QSplitter(ui->centralWidget);
-
-
ui->mainContent->setLayout(new QVBoxLayout());
ui->mainHead->setLayout(new QVBoxLayout());
ui->mainHead->layout()->setMargin(0);
@@ -145,6 +142,11 @@ Widget::Widget(QWidget *parent) :
ui->statusLabel->label->setStyleSheet("QLabel { color : white; font-size: 8pt;}");
ui->friendList->widget()->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+ QFile f1(":/ui/statusButton/statusButton.css");
+ f1.open(QFile::ReadOnly | QFile::Text);
+ QTextStream statusButtonStylesheetStream(&f1);
+ ui->statusButton->setStyleSheet(statusButtonStylesheetStream.readAll());
+
this->setMouseTracking(true);
QList widgets = this->findChildren();
@@ -210,7 +212,7 @@ Widget::Widget(QWidget *parent) :
connect(ui->settingsButton, SIGNAL(clicked()), this, SLOT(onSettingsClicked()));
connect(ui->nameLabel, SIGNAL(textChanged(QString,QString)), this, SLOT(onUsernameChanged(QString,QString)));
connect(ui->statusLabel, SIGNAL(textChanged(QString,QString)), this, SLOT(onStatusMessageChanged(QString,QString)));
- connect(ui->statImg, SIGNAL(clicked()), this, SLOT(onStatusImgClicked()));
+ connect(ui->statusButton, SIGNAL(clicked()), this, SLOT(statusButtonClicked()));
connect(&settingsForm.name, SIGNAL(textEdited(QString)), this, SLOT(onUsernameChanged(QString)));
connect(&settingsForm.statusText, SIGNAL(textEdited(QString)), this, SLOT(onStatusMessageChanged(QString)));
connect(&friendForm, SIGNAL(friendRequested(QString,QString)), this, SIGNAL(friendRequested(QString,QString)));
@@ -303,13 +305,13 @@ void Widget::onFailedToStartCore()
void Widget::onStatusSet(Status status)
{
if (status == Status::Online)
- ui->statImg->setPixmap(QPixmap(":img/status/dot_online_2x.png"));
+ ui->statusButton->setIcon(QIcon(":ui/statusButton/dot_online.png"));
else if (status == Status::Away)
- ui->statImg->setPixmap(QPixmap(":img/status/dot_idle_2x.png"));
+ ui->statusButton->setIcon(QIcon(":ui/statusButton/dot_idle.png"));
else if (status == Status::Busy)
- ui->statImg->setPixmap(QPixmap(":img/status/dot_busy_2x.png"));
+ ui->statusButton->setIcon(QIcon(":ui/statusButton/dot_busy.png"));
else if (status == Status::Offline)
- ui->statImg->setPixmap(QPixmap(":img/status/dot_away_2x.png"));
+ ui->statusButton->setIcon(QIcon(":ui/statusButton/dot_away.png"));
}
void Widget::onAddClicked()
@@ -1111,15 +1113,19 @@ void Widget::minimizeBtnClicked()
}
}
-void Widget::onStatusImgClicked()
+void Widget::statusButtonClicked()
{
QMenu menu;
QAction* online = menu.addAction(tr("Online","Button to set your status to 'Online'"));
+ online->setIcon(QIcon(":ui/statusButton/dot_online.png"));
QAction* away = menu.addAction(tr("Away","Button to set your status to 'Away'"));
+ away->setIcon(QIcon(":ui/statusButton/dot_idle.png"));
QAction* busy = menu.addAction(tr("Busy","Button to set your status to 'Busy'"));
+ busy->setIcon(QIcon(":ui/statusButton/dot_busy.png"));
- QPoint pos = QCursor::pos();
- QAction* selectedItem = menu.exec(pos);
+ ui->statusButton->setMenu(&menu);
+ //Ugly hack since QMenu wouldn't show up properly on Win32
+ QAction* selectedItem = ui->statusButton->menu()->exec(ui->statusButton->mapToGlobal(QPoint(0,ui->statusButton->height())));
if (selectedItem == online)
core->setStatus(Status::Online);
else if (selectedItem == away)
diff --git a/widget/widget.h b/widget/widget.h
index 24ae6451c..309b1fcaf 100644
--- a/widget/widget.h
+++ b/widget/widget.h
@@ -92,8 +92,8 @@ private slots:
void removeFriend(int friendId);
void copyFriendIdToClipboard(int friendId);
void removeGroup(int groupId);
- void onStatusImgClicked();
void splitterMoved(int pos, int index);
+ void statusButtonClicked();
protected slots:
void moveWindow(QMouseEvent *e);