mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
api update
This commit is contained in:
parent
52d18f9f18
commit
be7c39d69a
2
core.cpp
2
core.cpp
|
@ -218,7 +218,7 @@ void Core::start()
|
|||
buffer.open(QIODevice::WriteOnly);
|
||||
pic.save(&buffer, "PNG");
|
||||
buffer.close();
|
||||
if (tox_set_avatar(tox, TOX_AVATARFORMAT_PNG, (uint8_t*)data.constData(), data.size()) != 0)
|
||||
if (tox_set_avatar(tox, TOX_AVATAR_FORMAT_PNG, (uint8_t*)data.constData(), data.size()) != 0)
|
||||
qWarning() << "Core:start: Error setting avatar, size:"<<data.size();
|
||||
emit selfAvatarChanged(pic);
|
||||
}
|
||||
|
|
|
@ -300,7 +300,7 @@ void Widget::onAvatarClicked()
|
|||
pic.save(&buffer, "PNG");
|
||||
buffer.close();
|
||||
|
||||
if (bytes.size() >= TOX_MAX_AVATAR_DATA_LENGTH)
|
||||
if (bytes.size() >= TOX_AVATAR_MAX_DATA_LENGTH)
|
||||
{
|
||||
pic = pic.scaled(64,64, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
bytes.clear();
|
||||
|
@ -309,13 +309,13 @@ void Widget::onAvatarClicked()
|
|||
buffer.close();
|
||||
}
|
||||
|
||||
if (bytes.size() >= TOX_MAX_AVATAR_DATA_LENGTH)
|
||||
if (bytes.size() >= TOX_AVATAR_MAX_DATA_LENGTH)
|
||||
{
|
||||
QMessageBox::critical(this, "Error", "This image is too big");
|
||||
return;
|
||||
}
|
||||
|
||||
core->setAvatar(TOX_AVATARFORMAT_PNG, bytes);
|
||||
core->setAvatar(TOX_AVATAR_FORMAT_PNG, bytes);
|
||||
}
|
||||
|
||||
void Widget::onSelfAvatarLoaded(const QPixmap& pic)
|
||||
|
|
Loading…
Reference in New Issue
Block a user