diff --git a/ui/statusButton/statusButton.css b/ui/statusButton/statusButton.css index cf3514c89..e96750704 100644 --- a/ui/statusButton/statusButton.css +++ b/ui/statusButton/statusButton.css @@ -5,10 +5,13 @@ QPushButton border: none; border-radius: 6px; } -QPushButton:hover + +/*Disabled due to a bug preventing button status from + resetting to default after menu item pressed +QPushButton:hover { background-color: rgb(75,75,75); -} +}*/ QPushButton:pressed { diff --git a/widget.ui b/widget.ui index 9ebb53f84..34db6ed85 100644 --- a/widget.ui +++ b/widget.ui @@ -2028,13 +2028,10 @@ QSplitter:handle{ - 21 + 20 40 - - true - @@ -2048,6 +2045,15 @@ QSplitter:handle{ 10 + + false + + + false + + + false + true diff --git a/widget/widget.cpp b/widget/widget.cpp index 939c8aa4f..c480548b9 100644 --- a/widget/widget.cpp +++ b/widget/widget.cpp @@ -147,6 +147,15 @@ Widget::Widget(QWidget *parent) : QTextStream statusButtonStylesheetStream(&f1); ui->statusButton->setStyleSheet(statusButtonStylesheetStream.readAll()); + QMenu *statusButtonMenu = new QMenu(ui->statusButton); + QAction* setStatusOnline = statusButtonMenu->addAction(tr("Online","Button to set your status to 'Online'")); + setStatusOnline->setIcon(QIcon(":ui/statusButton/dot_online.png")); + QAction* setStatusAway = statusButtonMenu->addAction(tr("Away","Button to set your status to 'Away'")); + setStatusAway->setIcon(QIcon(":ui/statusButton/dot_idle.png")); + QAction* setStatusBusy = statusButtonMenu->addAction(tr("Busy","Button to set your status to 'Busy'")); + setStatusBusy->setIcon(QIcon(":ui/statusButton/dot_busy.png")); + ui->statusButton->setMenu(statusButtonMenu); + this->setMouseTracking(true); QList widgets = this->findChildren(); @@ -212,7 +221,9 @@ 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->statusButton, SIGNAL(clicked()), this, SLOT(statusButtonClicked())); + connect(setStatusOnline, SIGNAL(triggered()), this, SLOT(setStatusOnline())); + connect(setStatusAway, SIGNAL(triggered()), this, SLOT(setStatusAway())); + connect(setStatusBusy, SIGNAL(triggered()), this, SLOT(setStatusBusy())); 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))); @@ -1113,23 +1124,17 @@ void Widget::minimizeBtnClicked() } } -void Widget::statusButtonClicked() +void Widget::setStatusOnline() { - 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")); - - 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) - core->setStatus(Status::Away); - else if (selectedItem == busy) - core->setStatus(Status::Busy); + core->setStatus(Status::Online); +} + +void Widget::setStatusAway() +{ + core->setStatus(Status::Away); +} + +void Widget::setStatusBusy() +{ + core->setStatus(Status::Busy); } diff --git a/widget/widget.h b/widget/widget.h index 309b1fcaf..4168e2f7a 100644 --- a/widget/widget.h +++ b/widget/widget.h @@ -93,7 +93,9 @@ private slots: void copyFriendIdToClipboard(int friendId); void removeGroup(int groupId); void splitterMoved(int pos, int index); - void statusButtonClicked(); + void setStatusOnline(); + void setStatusAway(); + void setStatusBusy(); protected slots: void moveWindow(QMouseEvent *e);