mirror of
				https://github.com/PurpleI2P/i2pd.git
				synced 2025-11-04 08:30:46 +00:00 
			
		
		
		
	fixed tunnels invalid ui data handling 2
This commit is contained in:
		
							parent
							
								
									1947be4957
								
							
						
					
					
						commit
						cd3f274763
					
				
					 4 changed files with 12 additions and 8 deletions
				
			
		| 
						 | 
				
			
			@ -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);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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) {}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue