chat: автоподключение к узлам группы (вкл/выкл) + ручной connect к узлу (desktop+android); фикс reinit при QR-join
This commit is contained in:
1 parent
9ef501a2fb
commit
d7bb58c6fb
20 files changed
+241
-5
No files matched your search
@@ -96,6 +96,10 @@ SettingsDialog::SettingsDialog(const QString& configPath, DbManager* db, UtunNod
|
||||
"QComboBox { border: 1px solid palette(mid); border-radius: 4px;"
|
||||
" padding: 6px 10px; font-size: 13px; background: palette(base); }");
|
||||
profLayout->addRow(joinLabel, m_joinPolicyCombo);
|
||||
|
||||
m_autoConnectCheck = new QCheckBox("Auto-connect to group nodes", profilePage);
|
||||
m_autoConnectCheck->setStyleSheet("font-size: 13px;");
|
||||
profLayout->addRow(m_autoConnectCheck);
|
||||
m_pages->addWidget(profilePage);
|
||||
|
||||
// Storage page
|
||||
@@ -181,6 +185,7 @@ SettingsDialog::SettingsDialog(const QString& configPath, DbManager* db, UtunNod
|
||||
m_sortCombo->setCurrentIndex(sortMode == 1 ? 1 : 0);
|
||||
int joinPolicy = db->getUiStateInt("join_policy", 1);
|
||||
m_joinPolicyCombo->setCurrentIndex(joinPolicy >= 0 && joinPolicy <= 2 ? joinPolicy : 1);
|
||||
m_autoConnectCheck->setChecked(db->getUiStateInt("group_autoconnect", 1) != 0);
|
||||
}
|
||||
m_networkPage->loadFromConfig(m_configPath);
|
||||
m_soundPage->loadFromDb();
|
||||
@@ -295,6 +300,23 @@ void SettingsDialog::onSave() {
|
||||
postChatSetting(m_configPath, "join_policy", v);
|
||||
}
|
||||
}
|
||||
|
||||
/* save group_autoconnect */
|
||||
{
|
||||
const char* key = "group_autoconnect";
|
||||
int v = m_autoConnectCheck->isChecked() ? 1 : 0;
|
||||
QByteArray val = QByteArray::number(v);
|
||||
size_t klen = strlen(key), vl = (size_t)val.size(), total = klen + 1 + vl + 1;
|
||||
if (total <= 256) {
|
||||
void* arg = u_malloc(total);
|
||||
memcpy(arg, key, klen + 1);
|
||||
memcpy((char*)arg + klen + 1, val.constData(), vl + 1);
|
||||
gui_bridge_post_uasync_fn(chat_core_save_ui_state_trampoline, arg);
|
||||
}
|
||||
if (!m_configPath.isEmpty()) {
|
||||
postChatSetting(m_configPath, "group_autoconnect", v);
|
||||
}
|
||||
}
|
||||
accept();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user