diff --git a/qt/i2pd_qt/TunnelPane.cpp b/qt/i2pd_qt/TunnelPane.cpp index 0cd7b741..b3cc3bef 100644 --- a/qt/i2pd_qt/TunnelPane.cpp +++ b/qt/i2pd_qt/TunnelPane.cpp @@ -186,6 +186,7 @@ void TunnelPane::appendControlsForI2CPParameters(I2CPParameters& i2cpParameters, void TunnelPane::updated() { std::string oldName=tunnelConfig->getName(); //validate and show red if invalid + hideWrongInputLabel(); if(!mainWindow->applyTunnelsUiToConfigs())return; tunnelsPageUpdateListener->updated(oldName, tunnelConfig); } diff --git a/qt/i2pd_qt/TunnelPane.h b/qt/i2pd_qt/TunnelPane.h index d14ba8d0..a7012810 100644 --- a/qt/i2pd_qt/TunnelPane.h +++ b/qt/i2pd_qt/TunnelPane.h @@ -95,7 +95,6 @@ protected: public: //returns false when invalid data at UI virtual bool applyDataFromUIToTunnelConfig() { - hideWrongInputLabel(); tunnelConfig->setName(nameLineEdit->text().toStdString()); tunnelConfig->setType(readTunnelTypeComboboxData()); I2CPParameters& i2cpParams=tunnelConfig->getI2cpParameters(); diff --git a/qt/i2pd_qt/mainwindow.cpp b/qt/i2pd_qt/mainwindow.cpp index bf26964d..93da099a 100644 --- a/qt/i2pd_qt/mainwindow.cpp +++ b/qt/i2pd_qt/mainwindow.cpp @@ -632,10 +632,6 @@ void MainWindow::loadAllConfigs(){ /** returns false iff not valid items present and save was aborted */ bool MainWindow::saveAllConfigs(){ QString cannotSaveSettings = QApplication::tr("Cannot save settings."); - bool redVisible = ui->wrongInputLabel->isVisible(); - ui->wrongInputLabel->setVisible(false); - if(redVisible)adjustSizesAccordingToWrongLabel(); - programOptionsWriterCurrentSection=""; /*if(!logFileNameOption->lineEdit->text().trimmed().isEmpty())logOption->optionValue=boost::any(std::string("file")); else logOption->optionValue=boost::any(std::string("stdout"));*/ @@ -684,15 +680,22 @@ void FolderChooserItem::pushButtonReleased() { } void BaseStringItem::installListeners(MainWindow *mainWindow) { - QObject::connect(lineEdit, SIGNAL(textChanged(const QString &)), mainWindow, SLOT(saveAllConfigs())); + QObject::connect(lineEdit, SIGNAL(textChanged(const QString &)), mainWindow, SLOT(updated())); } void ComboBoxItem::installListeners(MainWindow *mainWindow) { - QObject::connect(comboBox, SIGNAL(currentIndexChanged(int)), mainWindow, SLOT(saveAllConfigs())); + QObject::connect(comboBox, SIGNAL(currentIndexChanged(int)), mainWindow, SLOT(updated())); } void CheckBoxItem::installListeners(MainWindow *mainWindow) { - QObject::connect(checkBox, SIGNAL(stateChanged(int)), mainWindow, SLOT(saveAllConfigs())); + QObject::connect(checkBox, SIGNAL(stateChanged(int)), mainWindow, SLOT(updated())); } +void MainWindow::updated() { + ui->wrongInputLabel->setVisible(false); + adjustSizesAccordingToWrongLabel(); + + applyTunnelsUiToConfigs(); + saveAllConfigs(); +} void MainWindowItem::installListeners(MainWindow *mainWindow) {} diff --git a/qt/i2pd_qt/mainwindow.h b/qt/i2pd_qt/mainwindow.h index 3b65d3c2..7e55a65f 100644 --- a/qt/i2pd_qt/mainwindow.h +++ b/qt/i2pd_qt/mainwindow.h @@ -390,6 +390,7 @@ private: enum StatusPage {main_page, commands, local_destinations, leasesets, tunnels, transit_tunnels, transports, i2p_tunnels, sam_sessions}; private slots: + void updated(); void handleQuitButton(); void handleGracefulQuitButton();