connection: логировать только connect/reconnect/disconnect; фиксы конфига чатгуи
- категория connection теперь только жизненный цикл соединения; INIT/PING/keepalive переклассифицированы в ETCP/SOCKET/KEEPALIVE/REALITY/ROUTING, удалены дубли - settingsdialog: устранён дубль my_node_name в конфиге (двухпроходная запись + только при изменении) - storagesettingspage: канонические ключи storage_total_size/storage_unit_size с суффиксом M/G - audiodevicesettingspage: compressor_max_gain_db min 0→1 - etcp_connections: %s-баг в логе TCP link (addr → sockaddr_storage_to_str) - docs/sample: [chatserver], актуализированы ключи хранилища
This commit is contained in:
1 parent
b7669eea36
commit
b7da6547c1
12 files changed
+185
-173
No files matched your search
@@ -345,7 +345,7 @@ void AudioDeviceSettingsPage::buildCompressorUI(QVBoxLayout* layout) {
|
||||
};
|
||||
|
||||
makeSliderRow("Max gain:", m_compressorMaxGainSlider, m_compressorMaxGainLabel,
|
||||
0, 50, 1);
|
||||
1, 50, 1);
|
||||
makeSliderRow("Rise rate (x/sec):", m_compressorRiseRateSlider, m_compressorRiseRateLabel,
|
||||
2, 10, 1);
|
||||
|
||||
|
||||
@@ -214,39 +214,50 @@ void SettingsDialog::onCategoryChanged(int row) {
|
||||
|
||||
void SettingsDialog::onSave() {
|
||||
QString newName = m_nicknameEdit->text().trimmed();
|
||||
bool nameChanged = (newName != m_oldNickname);
|
||||
|
||||
/* update name in uTun if changed */
|
||||
if (newName != m_oldNickname) {
|
||||
if (nameChanged) {
|
||||
char* name_copy = u_strdup(newName.toUtf8().constData());
|
||||
if (name_copy) gui_bridge_post_uasync_fn(chat_core_update_my_name_trampoline, name_copy);
|
||||
m_oldNickname = newName;
|
||||
}
|
||||
|
||||
// Save nickname to config
|
||||
QFile f(m_configPath);
|
||||
if (!f.open(QIODevice::ReadOnly | QIODevice::Text)) { accept(); return; }
|
||||
QString content = f.readAll();
|
||||
f.close();
|
||||
/* Save nickname to config — только при изменении имени, иначе перезапись плодит дубли */
|
||||
if (nameChanged) {
|
||||
QFile f(m_configPath);
|
||||
if (f.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
QString content = f.readAll();
|
||||
f.close();
|
||||
|
||||
QTextStream ts(&content);
|
||||
QStringList lines;
|
||||
while (!ts.atEnd()) lines << ts.readLine();
|
||||
QTextStream ts(&content);
|
||||
QStringList lines;
|
||||
while (!ts.atEnd()) lines << ts.readLine();
|
||||
|
||||
bool found = false;
|
||||
for (int i = 0; i < lines.size(); i++) {
|
||||
if (lines[i].trimmed().startsWith("my_node_name=")) {
|
||||
lines[i] = "my_node_name=" + newName;
|
||||
found = true;
|
||||
} else if (!found && lines[i].trimmed() == "[global]") {
|
||||
lines.insert(i + 1, "my_node_name=" + newName);
|
||||
found = true;
|
||||
bool found = false;
|
||||
for (int i = 0; i < lines.size(); i++) {
|
||||
if (lines[i].trimmed().startsWith("my_node_name=")) {
|
||||
if (!found) { lines[i] = "my_node_name=" + newName; found = true; }
|
||||
else lines.removeAt(i--); /* дубль — удалить */
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
for (int i = 0; i < lines.size(); i++) {
|
||||
if (lines[i].trimmed() == "[global]") {
|
||||
lines.insert(i + 1, "my_node_name=" + newName);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) lines << "my_node_name=" + newName;
|
||||
}
|
||||
|
||||
if (f.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text)) {
|
||||
f.write(lines.join('\n').toUtf8());
|
||||
f.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!found) lines << "my_node_name=" + newName;
|
||||
|
||||
f.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text);
|
||||
f.write(lines.join('\n').toUtf8());
|
||||
f.close();
|
||||
|
||||
m_networkPage->saveToConfig(m_configPath);
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ void StorageSettingsPage::applyAndSave() {
|
||||
|
||||
if (!m_configPath.isEmpty()) {
|
||||
postChatSetting(m_configPath, "storage_autoload", autoload);
|
||||
postChatSetting(m_configPath, "storage_autoload_maxsize_mb", autoloadMaxSize);
|
||||
postChatSetting(m_configPath, "storage_maxsize_gb", maxGb);
|
||||
config_update_option(m_configPath, "chatserver", "storage_unit_size", QString::number(autoloadMaxSize) + "M", CONFIG_UPDATE_REPLACE);
|
||||
config_update_option(m_configPath, "chatserver", "storage_total_size", QString::number(maxGb) + "G", CONFIG_UPDATE_REPLACE);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user