| 216 | } |
| 217 | |
| 218 | void OptionsDialog::setModel(OptionsModel *_model) |
| 219 | { |
| 220 | this->model = _model; |
| 221 | |
| 222 | if(_model) |
| 223 | { |
| 224 | /* check if client restart is needed and show persistent message */ |
| 225 | if (_model->isRestartRequired()) |
| 226 | showRestartWarning(true); |
| 227 | |
| 228 | // Prune values are in GB to be consistent with intro.cpp |
| 229 | static constexpr uint64_t nMinDiskSpace = (MIN_DISK_SPACE_FOR_BLOCK_FILES / GB_BYTES) + (MIN_DISK_SPACE_FOR_BLOCK_FILES % GB_BYTES) ? 1 : 0; |
| 230 | ui->pruneSize->setRange(nMinDiskSpace, std::numeric_limits<int>::max()); |
| 231 | |
| 232 | QString strLabel = _model->getOverriddenByCommandLine(); |
| 233 | if (strLabel.isEmpty()) |
| 234 | strLabel = tr("none"); |
| 235 | ui->overriddenByCommandLineLabel->setText(strLabel); |
| 236 | |
| 237 | mapper->setModel(_model); |
| 238 | setMapper(); |
| 239 | mapper->toFirst(); |
| 240 | |
| 241 | const auto& font_for_money = _model->data(_model->index(OptionsModel::FontForMoney, 0), Qt::EditRole).value<OptionsModel::FontChoice>(); |
| 242 | setFontChoice(ui->moneyFont, font_for_money); |
| 243 | |
| 244 | updateDefaultProxyNets(); |
| 245 | } |
| 246 | |
| 247 | /* warn when one of the following settings changes by user action (placed here so init via mapper doesn't trigger them) */ |
| 248 | |
| 249 | /* Main */ |
| 250 | connect(ui->prune, &QCheckBox::clicked, this, &OptionsDialog::showRestartWarning); |
| 251 | connect(ui->prune, &QCheckBox::clicked, this, &OptionsDialog::togglePruneWarning); |
| 252 | connect(ui->pruneSize, qOverload<int>(&QSpinBox::valueChanged), this, &OptionsDialog::showRestartWarning); |
| 253 | connect(ui->databaseCache, qOverload<int>(&QSpinBox::valueChanged), this, &OptionsDialog::showRestartWarning); |
| 254 | connect(ui->externalSignerPath, &QLineEdit::textChanged, [this]{ showRestartWarning(); }); |
| 255 | connect(ui->threadsScriptVerif, qOverload<int>(&QSpinBox::valueChanged), this, &OptionsDialog::showRestartWarning); |
| 256 | /* Wallet */ |
| 257 | connect(ui->spendZeroConfChange, &QCheckBox::clicked, this, &OptionsDialog::showRestartWarning); |
| 258 | /* Network */ |
| 259 | connect(ui->allowIncoming, &QCheckBox::clicked, this, &OptionsDialog::showRestartWarning); |
| 260 | connect(ui->enableServer, &QCheckBox::clicked, this, &OptionsDialog::showRestartWarning); |
| 261 | connect(ui->connectSocks, &QCheckBox::clicked, this, &OptionsDialog::showRestartWarning); |
| 262 | connect(ui->connectSocksTor, &QCheckBox::clicked, this, &OptionsDialog::showRestartWarning); |
| 263 | /* Display */ |
| 264 | connect(ui->lang, qOverload<>(&QValueComboBox::valueChanged), [this]{ showRestartWarning(); }); |
| 265 | connect(ui->thirdPartyTxUrls, &QLineEdit::textChanged, [this]{ showRestartWarning(); }); |
| 266 | } |
| 267 | |
| 268 | void OptionsDialog::setCurrentTab(OptionsDialog::Tab tab) |
| 269 | { |