From 756000d8a9577cb9a99bb27056348ecb385a2415 Mon Sep 17 00:00:00 2001 From: "Jerry (Xinyu Hou)" Date: Mon, 8 Jun 2015 14:44:31 -0700 Subject: [PATCH] Removed warning and error logging level in GUI #4745 --- src/gui/res/SettingsDialogBase.ui | 14 ++------------ src/gui/src/AppConfig.cpp | 16 +++++++++++----- src/gui/src/AppConfig.h | 1 + src/gui/src/MainWindow.cpp | 4 ++-- 4 files changed, 16 insertions(+), 19 deletions(-) diff --git a/src/gui/res/SettingsDialogBase.ui b/src/gui/res/SettingsDialogBase.ui index d97f805b..1543a542 100644 --- a/src/gui/res/SettingsDialogBase.ui +++ b/src/gui/res/SettingsDialogBase.ui @@ -1,4 +1,4 @@ - + SettingsDialogBase @@ -210,17 +210,7 @@ - Error - - - - - Warning - - - - - Note + Notify diff --git a/src/gui/src/AppConfig.cpp b/src/gui/src/AppConfig.cpp index f663a859..f5e727db 100644 --- a/src/gui/src/AppConfig.cpp +++ b/src/gui/src/AppConfig.cpp @@ -37,9 +37,7 @@ const char AppConfig::m_SynergyLogDir[] = "/var/log/"; static const char* logLevelNames[] = { - "ERROR", - "WARNING", - "NOTE", + "NOTIFY", "INFO", "DEBUG", "DEBUG1", @@ -58,7 +56,8 @@ AppConfig::AppConfig(QSettings* settings) : m_ElevateMode(false), m_AutoConfigPrompted(false), m_CryptoEnabled(false), - m_AutoHide(false) + m_AutoHide(false), + m_ResetLogLevel(true) { Q_ASSERT(m_pSettings); @@ -118,7 +117,7 @@ void AppConfig::loadSettings() m_ScreenName = settings().value("screenName", QHostInfo::localHostName()).toString(); m_Port = settings().value("port", 24800).toInt(); m_Interface = settings().value("interface").toString(); - m_LogLevel = settings().value("logLevel", 3).toInt(); // level 3: INFO + m_LogLevel = settings().value("logLevel", 1).toInt(); // level 1: INFO m_LogToFile = settings().value("logToFile", false).toBool(); m_LogFilename = settings().value("logFilename", synergyLogDir() + "synergy.log").toString(); m_WizardLastRun = settings().value("wizardLastRun", 0).toInt(); @@ -132,6 +131,12 @@ void AppConfig::loadSettings() m_UserToken = settings().value("userToken", "").toString(); m_CryptoEnabled = settings().value("cryptoEnabled", false).toBool(); m_AutoHide = settings().value("autoHide", false).toBool(); + m_ResetLogLevel = settings().value("resetLogLevel", true).toBool(); + + if (m_ResetLogLevel) { + m_LogLevel = 1; + m_ResetLogLevel = false; + } } void AppConfig::saveSettings() @@ -153,6 +158,7 @@ void AppConfig::saveSettings() settings().setValue("userToken", m_UserToken); settings().setValue("cryptoEnabled", m_CryptoEnabled); settings().setValue("autoHide", m_AutoHide); + settings().setValue("resetLogLevel", m_ResetLogLevel); } void AppConfig::setAutoConfig(bool autoConfig) diff --git a/src/gui/src/AppConfig.h b/src/gui/src/AppConfig.h index 3a304b91..1090bad9 100644 --- a/src/gui/src/AppConfig.h +++ b/src/gui/src/AppConfig.h @@ -128,6 +128,7 @@ class AppConfig QString m_UserToken; bool m_CryptoEnabled; bool m_AutoHide; + bool m_ResetLogLevel; static const char m_SynergysName[]; static const char m_SynergycName[]; diff --git a/src/gui/src/MainWindow.cpp b/src/gui/src/MainWindow.cpp index ca8eec8f..4db1a65f 100644 --- a/src/gui/src/MainWindow.cpp +++ b/src/gui/src/MainWindow.cpp @@ -374,7 +374,7 @@ void MainWindow::appendLogNote(const QString& text) } void MainWindow::appendLogDebug(const QString& text) { - if (appConfig().logLevel() >= 4) { + if (appConfig().logLevel() >= 2) { appendLogRaw("DEBUG: " + text); } } @@ -588,7 +588,7 @@ void MainWindow::startSynergy() qDebug() << args; // show command if debug log level... - if (appConfig().logLevel() >= 4) { + if (appConfig().logLevel() >= 2) { appendLogNote(QString("command: %1 %2").arg(app, args.join(" "))); }