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

Merge remote-tracking branch 'Impyy/load-user-status'

This commit is contained in:
agilob 2015-09-25 20:57:02 +01:00
commit 42c29c8b8f
No known key found for this signature in database
GPG Key ID: 296F0B764741106C
5 changed files with 12 additions and 6 deletions

View File

@ -838,6 +838,11 @@ QString Core::getStatusMessage() const
return sname;
}
Status Core::getStatus() const
{
return (Status)tox_self_get_status(tox);
}
void Core::setStatusMessage(const QString& message)
{
CString cMessage(message);

View File

@ -77,6 +77,7 @@ public:
QString getIDString() const; ///< Get the 12 first characters of our Tox ID
QString getUsername() const; ///< Returns our username, or an empty string on failure
Status getStatus() const; ///< Returns our user status
QString getStatusMessage() const; ///< Returns our status message, or an empty string on failure
ToxId getSelfId() const; ///< Returns our Tox ID
QPair<QByteArray, QByteArray> getKeypair() const; ///< Returns our public and private keys

View File

@ -360,10 +360,15 @@ void GeneralForm::onUseProxyUpdated()
void GeneralForm::onReconnectClicked()
{
if (Core::getInstance()->anyActiveCalls())
{
QMessageBox::warning(this, tr("Call active", "popup title"),
tr("You can't disconnect while a call is active!", "popup text"));
}
else
{
emit Core::getInstance()->statusSet(Status::Offline);
Nexus::getProfile()->restartCore();
}
}
void GeneralForm::reloadSmiles()

View File

@ -499,15 +499,11 @@ void Widget::onSelfAvatarLoaded(const QPixmap& pic)
void Widget::onConnected()
{
ui->statusButton->setEnabled(true);
if (beforeDisconnect == Status::Offline)
emit statusSet(Status::Online);
else
emit statusSet(beforeDisconnect);
emit statusSet(Nexus::getCore()->getStatus());
}
void Widget::onDisconnected()
{
beforeDisconnect = getStatusFromString(ui->statusButton->property("status").toString());
ui->statusButton->setEnabled(false);
emit statusSet(Status::Offline);
}

View File

@ -253,7 +253,6 @@ private:
MaskablePixmapWidget *profilePicture;
bool notify(QObject *receiver, QEvent *event);
bool autoAwayActive = false;
Status beforeDisconnect = Status::Offline;
QTimer *timer, *offlineMsgTimer;
QRegExp nameMention, sanitizedNameMention;
bool eventFlag;