#6338 Refactor auto restart logic, fixed debug level check, added some debug logging

This commit is contained in:
Nick Bolton 2018-08-08 17:20:16 +01:00
parent 934824433d
commit 4cf1ab8a25
2 changed files with 30 additions and 31 deletions

View File

@ -62,6 +62,8 @@ static const QString synergyConfigFilter(QObject::tr("Synergy Configurations (*.
static const char* tlsVersion = "TLS 1.2"; static const char* tlsVersion = "TLS 1.2";
static const char* tlsCheckString = "network encryption protocol: TLSv1.2"; static const char* tlsCheckString = "network encryption protocol: TLSv1.2";
static const int debugLogLevel = 1;
static const char* synergyIconFiles[] = static const char* synergyIconFiles[] =
{ {
":/res/icons/16x16/synergy-disconnected.png", ":/res/icons/16x16/synergy-disconnected.png",
@ -408,7 +410,7 @@ void MainWindow::appendLogInfo(const QString& text)
} }
void MainWindow::appendLogDebug(const QString& text) { void MainWindow::appendLogDebug(const QString& text) {
if (appConfig().logLevel() >= 4) { if (appConfig().logLevel() >= debugLogLevel) {
appendLogRaw(getTimeStamp() + " DEBUG: " + text); appendLogRaw(getTimeStamp() + " DEBUG: " + text);
} }
} }
@ -1285,7 +1287,11 @@ void MainWindow::on_m_pActionSettings_triggered()
void MainWindow::autoAddScreen(const QString name) void MainWindow::autoAddScreen(const QString name)
{ {
if (!m_ServerConfig.ignoreAutoConfigClient()) { if (m_ServerConfig.ignoreAutoConfigClient()) {
appendLogDebug(QString("ignoring zeroconf screen: %1").arg(name));
return;
}
#ifndef SYNERGY_ENTERPRISE #ifndef SYNERGY_ENTERPRISE
if (m_ActivationDialogRunning) { if (m_ActivationDialogRunning) {
// TODO: refactor this code // TODO: refactor this code
@ -1313,10 +1319,6 @@ void MainWindow::autoAddScreen(const QString name)
break; break;
} }
} }
else {
restartSynergy();
}
}
} }
void MainWindow::showConfigureServer(const QString& message) void MainWindow::showConfigureServer(const QString& message)
@ -1362,9 +1364,6 @@ int MainWindow::raiseActivationDialog()
m_PendingClientNames.clear(); m_PendingClientNames.clear();
} }
if (result == QDialog::Accepted) {
restartSynergy();
}
return result; return result;
} }
#endif #endif

View File

@ -303,7 +303,7 @@ int ServerConfig::autoAddScreen(const QString name)
} }
} }
if (findScreenName(name, targetIndex)) { if (findScreenName(name, targetIndex)) {
// already exists. m_pMainWindow->appendLogDebug(QString("ignoring screen already in config: %1").arg(name));
return kAutoAddScreenIgnore; return kAutoAddScreenIgnore;
} }