| 31 | #include <QTimer> |
| 32 | |
| 33 | OptionsDialog::OptionsDialog(QWidget *parent, bool enableWallet) : |
| 34 | QDialog(parent, GUIUtil::dialog_flags), |
| 35 | ui(new Ui::OptionsDialog), |
| 36 | model(nullptr), |
| 37 | mapper(nullptr) |
| 38 | { |
| 39 | ui->setupUi(this); |
| 40 | |
| 41 | ui->coinControlFeatures->setEnabled(false); |
| 42 | |
| 43 | /* Main elements init */ |
| 44 | ui->databaseCache->setMinimum(nMinDbCache); |
| 45 | ui->databaseCache->setMaximum(nMaxDbCache); |
| 46 | ui->threadsScriptVerif->setMinimum(-GetNumCores()); |
| 47 | ui->threadsScriptVerif->setMaximum(MAX_SCRIPTCHECK_THREADS); |
| 48 | ui->pruneWarning->setVisible(false); |
| 49 | ui->pruneWarning->setStyleSheet("QLabel { color: red; }"); |
| 50 | |
| 51 | ui->pruneSize->setEnabled(false); |
| 52 | connect(ui->prune, &QPushButton::toggled, ui->pruneSize, &QWidget::setEnabled); |
| 53 | |
| 54 | /* Network elements init */ |
| 55 | #ifndef USE_UPNP |
| 56 | ui->mapPortUpnp->setEnabled(false); |
| 57 | #endif |
| 58 | #ifndef USE_NATPMP |
| 59 | ui->mapPortNatpmp->setEnabled(false); |
| 60 | #endif |
| 61 | connect(this, &QDialog::accepted, [this](){ |
| 62 | QSettings settings; |
| 63 | model->node().mapPort(settings.value("fUseUPnP").toBool(), settings.value("fUseNatpmp").toBool()); |
| 64 | }); |
| 65 | |
| 66 | ui->proxyIp->setEnabled(false); |
| 67 | ui->proxyPort->setEnabled(false); |
| 68 | ui->proxyPort->setValidator(new QIntValidator(1, 65535, this)); |
| 69 | |
| 70 | ui->proxyIpTor->setEnabled(false); |
| 71 | ui->proxyPortTor->setEnabled(false); |
| 72 | ui->proxyPortTor->setValidator(new QIntValidator(1, 65535, this)); |
| 73 | |
| 74 | connect(ui->connectSocks, &QPushButton::toggled, ui->proxyIp, &QWidget::setEnabled); |
| 75 | connect(ui->connectSocks, &QPushButton::toggled, ui->proxyPort, &QWidget::setEnabled); |
| 76 | connect(ui->connectSocks, &QPushButton::toggled, this, &OptionsDialog::updateProxyValidationState); |
| 77 | |
| 78 | connect(ui->connectSocksTor, &QPushButton::toggled, ui->proxyIpTor, &QWidget::setEnabled); |
| 79 | connect(ui->connectSocksTor, &QPushButton::toggled, ui->proxyPortTor, &QWidget::setEnabled); |
| 80 | connect(ui->connectSocksTor, &QPushButton::toggled, this, &OptionsDialog::updateProxyValidationState); |
| 81 | |
| 82 | /* Window elements init */ |
| 83 | #ifdef Q_OS_MAC |
| 84 | /* remove Window tab on Mac */ |
| 85 | ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tabWindow)); |
| 86 | /* hide launch at startup option on macOS */ |
| 87 | ui->bitcoinAtStartup->setVisible(false); |
| 88 | ui->verticalLayout_Main->removeWidget(ui->bitcoinAtStartup); |
| 89 | ui->verticalLayout_Main->removeItem(ui->horizontalSpacer_0_Main); |
| 90 | #endif |
nothing calls this directly
no test coverage detected