Show presence and set custom status messages
This commit is contained in:
parent
e5a55ab1b9
commit
96f4169be9
11 changed files with 191 additions and 1 deletions
|
|
@ -16,7 +16,9 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <QInputDialog>
|
||||
#include <QLabel>
|
||||
#include <QMenu>
|
||||
#include <QPainter>
|
||||
#include <QStyle>
|
||||
#include <QStyleOption>
|
||||
|
|
@ -24,6 +26,7 @@
|
|||
|
||||
#include <iostream>
|
||||
|
||||
#include "ChatPage.h"
|
||||
#include "Config.h"
|
||||
#include "MainWindow.h"
|
||||
#include "Splitter.h"
|
||||
|
|
@ -105,6 +108,27 @@ UserInfoWidget::UserInfoWidget(QWidget *parent)
|
|||
connect(logoutButton_, &QPushButton::clicked, this, []() {
|
||||
MainWindow::instance()->openLogoutDialog();
|
||||
});
|
||||
|
||||
menu = new QMenu(this);
|
||||
|
||||
auto setStatusAction = menu->addAction(tr("Set custom status message"));
|
||||
connect(setStatusAction, &QAction::triggered, this, [this]() {
|
||||
bool ok = false;
|
||||
QString text = QInputDialog::getText(this,
|
||||
tr("Custom status message"),
|
||||
tr("Status:"),
|
||||
QLineEdit::Normal,
|
||||
ChatPage::instance()->status(),
|
||||
&ok);
|
||||
if (ok && !text.isEmpty())
|
||||
ChatPage::instance()->setStatus(text);
|
||||
});
|
||||
}
|
||||
|
||||
void
|
||||
UserInfoWidget::contextMenuEvent(QContextMenuEvent *event)
|
||||
{
|
||||
menu->popup(event->globalPos());
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue