auto-connect + GUI per-channel indicators

- chat_core_connect_auto: direct ETCP connect from SQLite (no BGP)
- auto_connect: parallel connect to peers with 3s timeout, retry 10s
- RTT saved to node_addresses on disconnect
- vertical status bar + circle badge with online count per channel
- ChannelListView prevents deselection
This commit is contained in:
Evgeny committed 2026-07-15 06:00:43 +03:00
1 parent 1a0229fd4f
commit dccf54b30b
22 files changed
+909 -10

No files matched your search

@@ -29,6 +29,8 @@ static gui_msg_received_fn g_msg_received_cb = nullptr;
static gui_channel_updated_fn g_channel_updated_cb = nullptr;
static gui_members_changed_fn g_members_changed_cb = nullptr;
static gui_my_node_id_fn g_my_node_id_cb = nullptr;
static gui_auto_connect_status_fn g_auto_connect_status_cb = nullptr;
static gui_channel_peers_online_fn g_channel_peers_online_cb = nullptr;
static struct UASYNC* g_ua = nullptr;
/* ── GuiBridgeReceiver implementation ── */
@@ -98,6 +100,27 @@ void GuiBridgeReceiver::processPost(int eventType, QByteArray data) {
if (g_my_node_id_cb) g_my_node_id_cb(nid);
}
break;
case GUI_EVT_AUTO_CONNECT_STATUS:
if (dlen >= 7) {
uint8_t status = d[0];
uint16_t total_tried; memcpy(&total_tried, d + 1, 2);
uint16_t node_count; memcpy(&node_count, d + 3, 2);
uint16_t connected; memcpy(&connected, d + 5, 2);
const char* st_str = status == 0 ? "in_progress" : status == 1 ? "done" : "stopped";
DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "gui_bridge: AUTO_CONNECT %s tried=%u/%u connected=%u", st_str, total_tried, node_count, connected);
if (g_auto_connect_status_cb) g_auto_connect_status_cb(status, total_tried, node_count, connected);
}
break;
case GUI_EVT_CHANNEL_PEERS_ONLINE:
if (dlen >= 3) {
uint8_t chLen = d[0];
if (dlen >= 3 + chLen) {
uint16_t online; memcpy(&online, d + 1 + chLen, 2);
DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "gui_bridge: CHANNEL_PEERS_ONLINE ch=%.*s online=%u", chLen, (const char*)d + 1, online);
if (g_channel_peers_online_cb) g_channel_peers_online_cb((const char*)d + 1, chLen, online);
}
}
break;
default:
DEBUG_WARN(DEBUG_CATEGORY_DEBUG, "gui_bridge: unknown event type %d", eventType);
break;
@@ -164,6 +187,14 @@ void gui_bridge_set_my_node_id_cb(gui_my_node_id_fn cb) {
g_my_node_id_cb = cb;
}
void gui_bridge_set_auto_connect_status_cb(gui_auto_connect_status_fn cb) {
g_auto_connect_status_cb = cb;
}
void gui_bridge_set_channel_peers_online_cb(gui_channel_peers_online_fn cb) {
g_channel_peers_online_cb = cb;
}
} /* extern "C" */
#include "gui_bridge_impl.moc"