Add asynchronous member file storage and desktop browser

This commit is contained in:
evgeny committed 2026-10-05 18:44:58 +02:00
1 parent 27d93ecaf9
commit 78a655bb05
36 files changed
+3056 -2

No files matched your search

+18
View File
@@ -14,6 +14,7 @@
#include "connmonitorwindow.h"
#include "videoplayer_window.h"
#include "imageviewer_window.h"
#include "member_files/browser.h"
#include "creategroupdialog.h"
#include "invite_link.h"
#include "sound_manager.h"
@@ -172,6 +173,9 @@ MainWindow::MainWindow(QWidget *parent, DbManager* db, const QString& cfgPath,
MainWindow::~MainWindow() {
s_mainWindow = nullptr;
if (m_fileBrowser) delete m_fileBrowser.data();
gui_bridge_set_member_files_response_cb(nullptr);
gui_bridge_set_member_files_transfer_cb(nullptr);
m_autoPlayTimer->stop();
gui_bridge_set_network_changed_cb(nullptr);
gui_bridge_set_dm_call_route_cb(nullptr);
@@ -383,6 +387,12 @@ void MainWindow::setupSoundFromConfig() {
void MainWindow::setupBridgeCallbacks() {
s_mainWindow = this;
gui_bridge_set_member_files_response_cb([](const uint8_t* data, int length) {
if (s_mainWindow && s_mainWindow->m_fileBrowser) s_mainWindow->m_fileBrowser->onResponse(data, length);
});
gui_bridge_set_member_files_transfer_cb([](const uint8_t* data, int length) {
if (s_mainWindow && s_mainWindow->m_fileBrowser) s_mainWindow->m_fileBrowser->onTransfer(data, length);
});
gui_bridge_set_msg_received_cb(onMsgReceivedCallback);
gui_bridge_set_channel_updated_cb(onChannelUpdatedCallback);
gui_bridge_set_member_list_cb(onMemberListCallback);
@@ -548,6 +558,8 @@ void MainWindow::setupConnects() {
connect(m_channelList, &ChannelList::channelSettingsRequested, this, &MainWindow::showChannelSettings);
connect(m_accountList, &AccountList::memberRenamed,
m_messageList, &MessageList::reloadLocalNicks);
connect(m_accountList, &AccountList::filesRequested, this, &MainWindow::showMemberFiles);
connect(m_channelList, &ChannelList::filesRequested, this, [this](const QString& channel) { showMemberFiles(channel); });
connect(m_accountList, &AccountList::callRequested, this, &MainWindow::onCallRequested);
connect(m_messageList, &MessageList::callRequested, this, &MainWindow::onCallRequested);
connect(m_accountList, &AccountList::pmRequested, this, &MainWindow::onPmRequested);
@@ -567,6 +579,12 @@ void MainWindow::setupConnects() {
/* ── звонки ── */
void MainWindow::showMemberFiles(const QString& channel, quint64 owner) {
if (channel.startsWith(QStringLiteral("dm:"))) return;
if (!m_fileBrowser) m_fileBrowser = new MemberFileBrowser(m_db, this);
m_fileBrowser->setChannel(channel, owner); m_fileBrowser->show(); m_fileBrowser->raise(); m_fileBrowser->activateWindow();
}
void MainWindow::onCallRequested(const QString& chId, quint64 nodeId, const QString& name) {
if (chId.startsWith(QStringLiteral("dm:")) && !m_activeCalls.isEmpty()) {
auto* w = m_activeCalls.constBegin().value();