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

fix #461, cleanup

This commit is contained in:
dubslow 2014-10-17 20:15:26 -05:00
parent 4e7a183360
commit ee0f94a890
5 changed files with 13 additions and 19 deletions

View File

@ -259,10 +259,6 @@ void Core::start()
toxav_register_audio_recv_callback(toxav, playCallAudio, this);
toxav_register_video_recv_callback(toxav, playCallVideo, this);
uint8_t friendAddress[TOX_FRIEND_ADDRESS_SIZE];
tox_get_address(tox, friendAddress);
emit friendAddressGenerated(CFriendAddress::toString(friendAddress));
QPixmap pic = Settings::getInstance().getSavedAvatar(getSelfId().toString());
if (!pic.isNull() && !pic.size().isEmpty())
{
@ -1116,13 +1112,17 @@ bool Core::loadConfiguration(QString path)
// set GUI with user and statusmsg
QString name = getUsername();
if (name != "")
if (!name.isEmpty())
emit usernameSet(name);
QString msg = getStatusMessage();
if (msg != "")
if (!msg.isEmpty())
emit statusMessageSet(msg);
QString id = getSelfId().toString();
if (!id.isEmpty())
emit idSet(id);
loadFriends();
return true;
}

View File

@ -123,8 +123,6 @@ signals:
void friendAvatarChanged(int friendId, const QPixmap& pic);
void friendAvatarRemoved(int friendId);
void friendAddressGenerated(const QString& friendAddress);
void friendRemoved(int friendId);
void friendLastSeenChanged(int friendId, const QDateTime& dateTime);
@ -137,6 +135,7 @@ signals:
void usernameSet(const QString& username);
void statusMessageSet(const QString& message);
void statusSet(Status status);
void idSet(const QString& id);
void selfAvatarChanged(const QPixmap& pic);
void messageSentResult(int friendId, const QString& message, int messageId);

View File

@ -46,6 +46,7 @@ IdentityForm::IdentityForm() :
connect(bodyUI->toxIdLabel, SIGNAL(clicked()), this, SLOT(copyIdClicked()));
connect(toxId, SIGNAL(clicked()), this, SLOT(copyIdClicked()));
connect(Core::getInstance(), &Core::idSet, this, &IdentityForm::setToxId);
connect(bodyUI->userName, SIGNAL(editingFinished()), this, SLOT(onUserNameEdited()));
connect(bodyUI->statusMessage, SIGNAL(editingFinished()), this, SLOT(onStatusMessageEdited()));
connect(bodyUI->loadButton, &QPushButton::clicked, this, &IdentityForm::onLoadClicked);
@ -96,14 +97,10 @@ void IdentityForm::present()
bodyUI->statusMessage->setText(Core::getInstance()->getStatusMessage());
}
void IdentityForm::setUserName(const QString &name)
void IdentityForm::setToxId(const QString& id)
{
bodyUI->userName->setText(name);
}
void IdentityForm::setStatusMessage(const QString &msg)
{
bodyUI->statusMessage->setText(msg);
toxId->setText(id);
toxId->setCursorPosition(0);
}
void IdentityForm::onLoadClicked()

View File

@ -47,9 +47,6 @@ public:
IdentityForm();
~IdentityForm();
void setUserName(const QString &name);
void setStatusMessage(const QString &msg);
virtual void present();
signals:
@ -57,6 +54,7 @@ signals:
void statusMessageChanged(QString);
private slots:
void setToxId(const QString& id);
void copyIdClicked();
void onUserNameEdited();
void onStatusMessageEdited();