Allow multiple servers in settings
This commit is contained in:
@@ -408,9 +408,13 @@ void MainWindow::setupSettingsModal() {
|
||||
// Fetch prices
|
||||
settings.chkFetchPrices->setChecked(Settings::getInstance()->getAllowFetchPrices());
|
||||
|
||||
// List of default servers
|
||||
settings.cmbServer->addItem("https://lightd-main.zecwallet.co:443");
|
||||
settings.cmbServer->addItem("https://lightd-main.zcashfr.io:443");
|
||||
|
||||
// Load current values into the dialog
|
||||
auto conf = Settings::getInstance()->getSettings();
|
||||
settings.txtServer->setText(conf.server);
|
||||
settings.cmbServer->setCurrentText(conf.server);
|
||||
|
||||
// Connection tab by default
|
||||
settings.tabWidget->setCurrentIndex(0);
|
||||
@@ -429,11 +433,15 @@ void MainWindow::setupSettingsModal() {
|
||||
Settings::getInstance()->setAllowFetchPrices(settings.chkFetchPrices->isChecked());
|
||||
|
||||
// Save the server
|
||||
Settings::getInstance()->saveSettings(settings.txtServer->text().trimmed());
|
||||
bool reloadConnection = false;
|
||||
if (conf.server != settings.cmbServer->currentText().trimmed()) {
|
||||
reloadConnection = true;
|
||||
}
|
||||
Settings::getInstance()->saveSettings(settings.cmbServer->currentText().trimmed());
|
||||
|
||||
if (false /* connection needs reloading?*/) {
|
||||
if (reloadConnection) {
|
||||
// Save settings
|
||||
Settings::getInstance()->saveSettings(settings.txtServer->text());
|
||||
Settings::getInstance()->saveSettings(settings.cmbServer->currentText());
|
||||
|
||||
auto cl = new ConnectionLoader(this, rpc);
|
||||
cl->loadConnection();
|
||||
|
||||
@@ -10,12 +10,6 @@
|
||||
<height>539</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>540</width>
|
||||
<height>500</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Settings</string>
|
||||
</property>
|
||||
@@ -57,14 +51,15 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="txtServer">
|
||||
<property name="placeholderText">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2"/>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QComboBox" name="cmbServer">
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
|
||||
Reference in New Issue
Block a user