Browse Source

qt: log level ui control now synced with core and log pane ui at runtime

pull/1608/head
user 4 years ago
parent
commit
ae1b1da342
  1. 15
      qt/i2pd_qt/mainwindow.cpp
  2. 3
      qt/i2pd_qt/mainwindow.h

15
qt/i2pd_qt/mainwindow.cpp

@ -196,6 +196,9 @@ MainWindow::MainWindow(std::shared_ptr<std::iostream> logStream_, QWidget *paren
logFileNameOption=initFileChooser( OPTION("","logfile",[]{return "";}), uiSettings->logFileLineEdit, uiSettings->logFileBrowsePushButton, false); logFileNameOption=initFileChooser( OPTION("","logfile",[]{return "";}), uiSettings->logFileLineEdit, uiSettings->logFileBrowsePushButton, false);
initLogLevelCombobox(OPTION("","loglevel",[]{return "";}), uiSettings->logLevelComboBox); initLogLevelCombobox(OPTION("","loglevel",[]{return "";}), uiSettings->logLevelComboBox);
QObject::connect(uiSettings->logLevelComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(syncLogLevel(int)));
initCheckBox( OPTION("","logclftime",[]{return "false";}), uiSettings->logclftimeCheckBox);//"Write full CLF-formatted date and time to log (default: write only time)" initCheckBox( OPTION("","logclftime",[]{return "false";}), uiSettings->logclftimeCheckBox);//"Write full CLF-formatted date and time to log (default: write only time)"
initFolderChooser( OPTION("","datadir",[]{return "";}), uiSettings->dataFolderLineEdit, uiSettings->dataFolderBrowsePushButton); initFolderChooser( OPTION("","datadir",[]{return "";}), uiSettings->dataFolderLineEdit, uiSettings->dataFolderBrowsePushButton);
initIPAddressBox( OPTION("","host",[]{return "";}), uiSettings->routerExternalHostLineEdit, tr("Router external address -> Host")); initIPAddressBox( OPTION("","host",[]{return "";}), uiSettings->routerExternalHostLineEdit, tr("Router external address -> Host"));
@ -1109,3 +1112,15 @@ void MainWindow::highlightWrongInput(QString warningText, WrongInputPageEnum inp
default: assert(false); break; default: assert(false); break;
} }
} }
void MainWindow::syncLogLevel (int /*comboBoxIndex*/) {
std::string level = uiSettings->logLevelComboBox->currentText().toLower().toStdString();
if (level == "none" || level == "error" || level == "warn" || level == "info" || level == "debug")
i2p::log::Logger().SetLogLevel(level);
else {
LogPrint(eLogError, "unknown loglevel set attempted");
return;
}
i2p::log::Logger().Reopen ();
}

3
qt/i2pd_qt/mainwindow.h

@ -453,7 +453,10 @@ private slots:
void runPeerTest(); void runPeerTest();
void enableTransit(); void enableTransit();
void disableTransit(); void disableTransit();
public slots: public slots:
void syncLogLevel (int comboBoxIndex);
void showStatus_local_destinations_Page(); void showStatus_local_destinations_Page();
void showStatus_leasesets_Page(); void showStatus_leasesets_Page();
void showStatus_tunnels_Page(); void showStatus_tunnels_Page();

Loading…
Cancel
Save