chat_settings: [chat] config section + live sync + fix test segfault

- New chat_setting.c/h: unified chat settings API (int/str getters)
- Config parser supports [chat] section, calls chat_setting_set per key
- chat_core exposes chat_core_set_setting / trampoline for GUI bridge
- chatgui: AudioDevice + Storage pages persist to [chat] config + live apply
- chatgui-android: ConfigProvider, NativeLib, headless handle chat settings
- MessageList: 200 msg limit, fixed saveChannelState via trampoline
- test_media_delivery_full: fix segfault at shutdown (mon() timer vs freed conns)
This commit is contained in:
evgeny committed 2026-07-29 21:18:49 +03:00
1 parent efbb495016
commit b8920cf483
22 files changed
+420 -43

No files matched your search

@@ -9,6 +9,7 @@ extern "C" {
#include "../../lib/debug_config.h"
#include "../db/db_manager.h"
#include "../transport/gui_bridge.h"
#include "../transport/config_updater.h"
#include "../../lib/mem.h"
extern "C" {
#include "chat/chat_core.h"
@@ -211,6 +212,24 @@ void AudioDeviceSettingsPage::applyAndSave() {
saveKey("compressor_max_gain_db", compMaxGain);
saveKey("compressor_rise_rate", compRiseRate);
/* also update [chat] config section + live apply for headless-compat settings */
if (!m_configPath.isEmpty()) {
auto postChat = [](const QString& path, const char* name, int val) {
config_update_option(path, "chat", name, QString::number(val), CONFIG_UPDATE_REPLACE);
QByteArray v = QByteArray::number(val);
size_t nlen = strlen(name), vlen = (size_t)v.size(), total = nlen + 1 + vlen + 1;
if (total > 256) return;
void* arg = u_malloc(total);
memcpy(arg, name, nlen + 1);
memcpy((char*)arg + nlen + 1, v.constData(), vlen + 1);
gui_bridge_post_uasync_fn(chat_core_set_setting_trampoline, arg);
};
postChat(m_configPath, "opus_codec_preset", codecPreset);
postChat(m_configPath, "compressor_enabled", compEnabled);
postChat(m_configPath, "compressor_max_gain_db", compMaxGain);
postChat(m_configPath, "compressor_rise_rate", compRiseRate);
}
m_savedOutputIdx = outIdx;
m_savedInputIdx = inIdx;
m_savedCodecPreset = codecPreset;