|
|
|
|
@ -245,7 +245,7 @@ SettingsDialog::SettingsDialog(const QString& configPath, DbManager* db, UtunNod
|
|
|
|
|
connect(m_categoryList, &QListWidget::currentRowChanged, |
|
|
|
|
this, &SettingsDialog::onCategoryChanged); |
|
|
|
|
|
|
|
|
|
// Load current values
|
|
|
|
|
// Черновик всех редактируемых страниц загружаем один раз на время жизни диалога.
|
|
|
|
|
loadProfileFromConfig(m_configPath); |
|
|
|
|
if (db) { |
|
|
|
|
int sortMode = db->getUiStateInt("channel_sort", 0); |
|
|
|
|
@ -255,7 +255,9 @@ SettingsDialog::SettingsDialog(const QString& configPath, DbManager* db, UtunNod
|
|
|
|
|
m_autoConnectCheck->setChecked(db->getUiStateInt("group_autoconnect", 1) != 0); |
|
|
|
|
} |
|
|
|
|
m_networkPage->loadFromConfig(m_configPath); |
|
|
|
|
m_storagePage->loadFromDb(); |
|
|
|
|
m_soundPage->loadFromDb(); |
|
|
|
|
DEBUG_DEBUG(DEBUG_CATEGORY_CONFIG, "Settings: draft initialized; editable pages retain values until Save or Cancel"); |
|
|
|
|
m_categoryList->setCurrentRow(0); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -276,13 +278,11 @@ void SettingsDialog::loadProfileFromConfig(const QString& path) {
|
|
|
|
|
|
|
|
|
|
void SettingsDialog::onCategoryChanged(int row) { |
|
|
|
|
m_pages->setCurrentIndex(row); |
|
|
|
|
if (row == 1) m_storagePage->loadFromDb(); |
|
|
|
|
DEBUG_DEBUG(DEBUG_CATEGORY_CONFIG, "Settings: selected page=%d; draft retained", row); |
|
|
|
|
// При переключении обновляем только диагностические страницы.
|
|
|
|
|
if (row == 4) m_databasePage->refreshStatus(); |
|
|
|
|
if (row == 5) m_statusPage->refreshStatus(); |
|
|
|
|
if (row == 6) m_nodesPage->refreshNodes(); |
|
|
|
|
if (row == 7) m_soundPage->loadFromDb(); |
|
|
|
|
if (row == 8) m_audioDevicePage->loadFromDb(); |
|
|
|
|
if (row == 9) m_radioPage->loadFromDb(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void SettingsDialog::onSave() { |
|
|
|
|
|