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

Merge branch 'v1.17-dev'

This commit is contained in:
Anthony Bilinski 2019-09-16 13:22:15 -07:00
commit 7cd20f0e28
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C
4 changed files with 14 additions and 3 deletions

View File

@ -78,6 +78,7 @@ QWidget* ChatLineContentProxy::getWidget() const
void ChatLineContentProxy::setWidth(qreal width)
{
prepareGeometryChange();
proxy->widget()->setFixedWidth(qMax(static_cast<int>(width * widthPercent), widthMin));
}

View File

@ -488,6 +488,7 @@ void Core::onFriendMessage(Tox*, uint32_t friendId, Tox_Message_Type type, const
void Core::onFriendNameChange(Tox*, uint32_t friendId, const uint8_t* cName, size_t cNameSize, void* core)
{
QString newName = ToxString(cName, cNameSize).getQString();
// no saveRequest, this callback is called on every connection, not just on name change
emit static_cast<Core*>(core)->friendUsernameChanged(friendId, newName);
}
@ -500,6 +501,7 @@ void Core::onStatusMessageChanged(Tox*, uint32_t friendId, const uint8_t* cMessa
size_t cMessageSize, void* core)
{
QString message = ToxString(cMessage, cMessageSize).getQString();
// no saveRequest, this callback is called on every connection, not just on name change
emit static_cast<Core*>(core)->friendStatusMessageChanged(friendId, message);
}
@ -520,6 +522,7 @@ void Core::onUserStatusChanged(Tox*, uint32_t friendId, Tox_User_Status userstat
break;
}
// no saveRequest, this callback is called on every connection, not just on name change
emit static_cast<Core*>(core)->friendStatusChanged(friendId, status);
}
@ -571,6 +574,7 @@ void Core::onGroupPeerListChange(Tox*, uint32_t groupId, void* vCore)
{
const auto core = static_cast<Core*>(vCore);
qDebug() << QString("Group %1 peerlist changed").arg(groupId);
// no saveRequest, this callback is called on every connection to group peer, not just on brand new peers
emit core->groupPeerlistChanged(groupId);
}
@ -589,6 +593,7 @@ void Core::onGroupTitleChange(Tox*, uint32_t groupId, uint32_t peerId, const uin
{
Core* core = static_cast<Core*>(vCore);
QString author = core->getGroupPeerName(groupId, peerId);
emit core->saveRequest();
emit core->groupTitleChanged(groupId, author, ToxString(cTitle, length).getQString());
}
@ -752,6 +757,7 @@ void Core::changeGroupTitle(int groupId, const QString& title)
Tox_Err_Conference_Title error;
bool success = tox_conference_set_title(tox.get(), groupId, cTitle.data(), cTitle.size(), &error);
if (success && error == TOX_ERR_CONFERENCE_TITLE_OK) {
emit saveRequest();
emit groupTitleChanged(groupId, getUsername(), title);
return;
}
@ -795,6 +801,7 @@ void Core::removeGroup(int groupId)
Tox_Err_Conference_Delete error;
bool success = tox_conference_delete(tox.get(), groupId, &error);
if (success && error == TOX_ERR_CONFERENCE_DELETE_OK) {
emit saveRequest();
av->leaveGroupCall(groupId);
return;
}
@ -1323,6 +1330,7 @@ uint32_t Core::joinGroupchat(const GroupInvite& inviteInfo)
qWarning() << "joinGroupchat: Unknown groupchat type " << confType;
}
if (groupNum != std::numeric_limits<uint32_t>::max()) {
emit saveRequest();
emit groupJoined(groupNum, getGroupPersistentId(groupNum));
}
return groupNum;
@ -1362,6 +1370,7 @@ int Core::createGroup(uint8_t type)
switch (error) {
case TOX_ERR_CONFERENCE_NEW_OK:
emit saveRequest();
emit emptyGroupCreated(groupId, getGroupPersistentId(groupId));
return groupId;
@ -1374,6 +1383,7 @@ int Core::createGroup(uint8_t type)
}
} else if (type == TOX_CONFERENCE_TYPE_AV) {
uint32_t groupId = toxav_add_av_groupchat(tox.get(), CoreAV::groupCallCallback, this);
emit saveRequest();
emit emptyGroupCreated(groupId, getGroupPersistentId(groupId));
return groupId;
} else {

View File

@ -1199,7 +1199,7 @@ void GenericChatForm::updateShowDateInfo(const ChatLine::Ptr& line)
{
const auto date = getTime(line);
if (date.isValid() && date != QDateTime::currentDateTime()) {
if (date.isValid() && date.date() != QDate::currentDate()) {
const auto dateText = QStringLiteral("<b>%1<\b>").arg(date.toString(Settings::getInstance().getDateFormat()));
dateInfo->setText(dateText);
dateInfo->setVisible(true);

View File

@ -691,6 +691,7 @@ void Widget::onCoreChanged(Core& core)
connect(this, &Widget::statusSet, &core, &Core::setStatus);
connect(this, &Widget::friendRequested, &core, &Core::requestFriendship);
connect(this, &Widget::friendRequestAccepted, &core, &Core::acceptFriendRequest);
connect(this, &Widget::changeGroupTitle, &core, &Core::changeGroupTitle);
sharedMessageProcessorParams.setPublicKey(core.getSelfPublicKey().toString());
}
@ -698,7 +699,7 @@ void Widget::onCoreChanged(Core& core)
void Widget::onConnected()
{
ui->statusButton->setEnabled(true);
emit statusSet(core->getStatus());
emit core->statusSet(core->getStatus());
}
void Widget::onDisconnected()
@ -2141,7 +2142,6 @@ Group* Widget::createGroup(uint32_t groupnumber, const GroupId& groupId)
connect(widget, &GroupWidget::middleMouseClicked, this, [=]() { removeGroup(groupId); });
connect(widget, &GroupWidget::chatroomWidgetClicked, form, &ChatForm::focusInput);
connect(newgroup, &Group::titleChangedByUser, this, &Widget::titleChangedByUser);
connect(this, &Widget::changeGroupTitle, core, &Core::changeGroupTitle);
connect(core, &Core::usernameSet, newgroup, &Group::setSelfName);
FilterCriteria filter = getFilterCriteria();