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

Don't show call buttons in text-only groupchats

I'm not sure why there are text-only groupchats in the first place, but that's fixed.
This commit is contained in:
tux3 2015-04-25 01:50:35 +02:00
parent 9d3d17d05e
commit 0e65d150e3
No known key found for this signature in database
GPG Key ID: 7E086DD661263264
3 changed files with 10 additions and 2 deletions

View File

@ -1147,6 +1147,11 @@ void Core::createGroup(uint8_t type)
}
}
bool Core::isGroupAvEnabled(int groupId)
{
return tox_group_get_type(tox, groupId) == TOX_GROUPCHAT_TYPE_AV;
}
bool Core::hasFriendWithAddress(const QString &addr) const
{
// Valid length check

View File

@ -131,6 +131,8 @@ public slots:
void setNospam(uint32_t nospam);
bool isGroupAvEnabled(int groupId); ///< True for AV groups, false for text-only groups
static void joinGroupCall(int groupId); ///< Starts a call in an existing AV groupchat. Call from the GUI thread.
static void leaveGroupCall(int groupId); ///< Will not leave the group, just stop the call. Call from the GUI thread.
static void disableGroupCallMic(int groupId);

View File

@ -994,13 +994,14 @@ Group *Widget::createGroup(int groupId)
return g;
}
Core* core = Nexus::getCore();
QString groupName = QString("Groupchat #%1").arg(groupId);
Group* newgroup = GroupList::addGroup(groupId, groupName, true);
Group* newgroup = GroupList::addGroup(groupId, groupName, core->isGroupAvEnabled(groupId));
QLayout* layout = contactListWidget->getGroupLayout();
layout->addWidget(newgroup->getGroupWidget());
newgroup->getGroupWidget()->updateStatusLight();
Core* core = Nexus::getCore();
connect(settingsWidget, &SettingsWidget::compactToggled, newgroup->getGroupWidget(), &GenericChatroomWidget::onCompactChanged);
connect(newgroup->getGroupWidget(), SIGNAL(chatroomWidgetClicked(GenericChatroomWidget*)), this, SLOT(onChatroomWidgetClicked(GenericChatroomWidget*)));
connect(newgroup->getGroupWidget(), SIGNAL(removeGroup(int)), this, SLOT(removeGroup(int)));