Add local per-member radio mute controls on desktop and Android
This commit is contained in:
1 parent
a069d11ef9
commit
7e19cbaf3a
33 files changed
+735
-27
No files matched your search
@@ -13,6 +13,7 @@
|
||||
#include <QDateTime>
|
||||
#include <QFont>
|
||||
#include <QSet>
|
||||
#include <QMessageBox>
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include "../../../lib/platform_compat.h"
|
||||
@@ -85,6 +86,11 @@ AccountList::AccountList(DbManager* db, QWidget *parent)
|
||||
m_listView->setModel(m_model);
|
||||
auto* delegate = new AccountDelegate(m_listView);
|
||||
m_listView->setItemDelegate(delegate);
|
||||
connect(delegate, &AccountDelegate::radioMuteRequested, this, [this](const QModelIndex& index) {
|
||||
if (gui_bridge_toggle_member_radio_mute(m_channelId.toUtf8().constData(), m_model->nodeIdAt(index.row())) < 0)
|
||||
QMessageBox::warning(this, QCoreApplication::translate("ChatGui", "Error"),
|
||||
QCoreApplication::translate("ChatGui", "Cannot change radio listening setting"));
|
||||
});
|
||||
connect(delegate, &AccountDelegate::avatarRequested, this, [this](const QModelIndex& index) {
|
||||
showAvatarGallery(m_channelId, m_model->nodeIdAt(index.row()));
|
||||
});
|
||||
@@ -143,6 +149,11 @@ AccountList::AccountList(DbManager* db, QWidget *parent)
|
||||
});
|
||||
|
||||
g_detailTarget = this;
|
||||
gui_bridge_set_radio_mute_result_cb([](const uint8_t* data, int len) {
|
||||
if (len != 17) { DEBUG_ERROR(DEBUG_CATEGORY_RADIO, "radio: invalid GUI mute result bytes=%d", len); return; }
|
||||
if (g_detailTarget && !data[16]) QMessageBox::warning(g_detailTarget, QCoreApplication::translate("ChatGui", "Error"),
|
||||
QCoreApplication::translate("ChatGui", "Cannot change radio listening setting"));
|
||||
});
|
||||
gui_bridge_set_member_detail_cb(memberDetailCb);
|
||||
|
||||
static bool nodeinfoRegistered = false;
|
||||
@@ -160,7 +171,7 @@ AccountList::AccountList(DbManager* db, QWidget *parent)
|
||||
}
|
||||
|
||||
AccountList::~AccountList() {
|
||||
if (g_detailTarget == this) g_detailTarget = nullptr;
|
||||
if (g_detailTarget == this) { g_detailTarget = nullptr; gui_bridge_set_radio_mute_result_cb(nullptr); }
|
||||
}
|
||||
|
||||
void AccountList::setChannel(const QString& channelId) {
|
||||
|
||||
Reference in new issue
Block a user