comunicwatcher/whoamidialog.cpp
2020-06-14 14:44:32 +02:00

32 lines
594 B
C++

#include <QMessageBox>
#include "accounthelper.h"
#include "whoamidialog.h"
#include "ui_whoamidialog.h"
WhoAmIDialog::WhoAmIDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::WhoAmIDialog)
{
ui->setupUi(this);
AccountHelper::GetUserID([this](int id) {
this->onGotUserId(id);
});
}
WhoAmIDialog::~WhoAmIDialog()
{
delete ui;
}
void WhoAmIDialog::onGotUserId(int userID)
{
if(userID < 1) {
QMessageBox::warning(this, tr("Error"), tr("Could not get your id!"));
return;
}
this->ui->user_id->setText(QString::number(userID));
}