From 6d5f997a1e362addc52bcfb0e534b4b69eaafe8b Mon Sep 17 00:00:00 2001 From: Xinyu Hou Date: Tue, 30 Jun 2015 01:42:08 +0100 Subject: [PATCH 1/4] Removed notification but use tray icon #4745 --- src/gui/src/MainWindow.cpp | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/gui/src/MainWindow.cpp b/src/gui/src/MainWindow.cpp index 1ecfde01..b6a9af58 100644 --- a/src/gui/src/MainWindow.cpp +++ b/src/gui/src/MainWindow.cpp @@ -477,17 +477,6 @@ void MainWindow::checkTransmission(const QString& line) line.contains("Interrupted")) { setSynergyState(synergyConnected); } - - // NOTIFY: Title: Detail - int p1 = line.indexOf(':'); - if (p1 > 0) { - int p2 = line.indexOf(':', p1 + 1); - if (p2 > 0) { - QString title = line.mid(p1 + 2, p2 - p1 - 2); - QString detail = line.mid(p2 + 2); - m_pTrayIcon->showMessage(title, detail); - } - } } } } From 85dc7a566eef05d90544e6d8698ea28efb3399b2 Mon Sep 17 00:00:00 2001 From: Xinyu Hou Date: Tue, 30 Jun 2015 03:37:36 +0100 Subject: [PATCH 2/4] Made log consistent #4745 --- src/gui/src/MainWindow.cpp | 33 +++++++++++++++++------------- src/gui/src/MainWindow.h | 3 ++- src/gui/src/ZeroconfService.cpp | 4 ++-- src/lib/client/Client.cpp | 2 +- src/lib/client/ServerProxy.cpp | 6 +++--- src/lib/server/ClientProxy1_5.cpp | 2 +- src/lib/server/ClientProxy1_6.cpp | 4 ++-- src/lib/synergy/ClipboardChunk.cpp | 4 ++-- src/lib/synergy/DropHelper.cpp | 6 +++--- src/lib/synergy/FileChunk.cpp | 2 +- src/lib/synergy/StreamChunker.cpp | 4 ++-- 11 files changed, 38 insertions(+), 32 deletions(-) diff --git a/src/gui/src/MainWindow.cpp b/src/gui/src/MainWindow.cpp index b6a9af58..f526a8e4 100644 --- a/src/gui/src/MainWindow.cpp +++ b/src/gui/src/MainWindow.cpp @@ -368,9 +368,14 @@ void MainWindow::updateFound(const QString &version) .arg(version).arg(DOWNLOAD_URL)); } -void MainWindow::appendLogNote(const QString& text) +void MainWindow::appendLogInfo(const QString& text) { - appendLogRaw("NOTE: " + text); + appendLogRaw("INFO: " + text); +} + +void MainWindow::appendLogNotify(const QString& text) +{ + appendLogRaw("NOTIFY: " + text); } void MainWindow::appendLogDebug(const QString& text) { @@ -468,13 +473,13 @@ void MainWindow::checkFingerprint(const QString& line) void MainWindow::checkTransmission(const QString& line) { if (appConfig().logLevel() >= 2) { - if (line.contains("Transmission")) { - if (line.contains("Started")) { + if (line.contains("transmission")) { + if (line.contains("started")) { setSynergyState(synergyTransfering); } - else if (line.contains("Failed") || - line.contains("Complete") || - line.contains("Interrupted")) { + else if (line.contains("failed") || + line.contains("complete") || + line.contains("interrupted")) { setSynergyState(synergyConnected); } } @@ -576,20 +581,20 @@ void MainWindow::startSynergy() if (!m_pLogOutput->toPlainText().isEmpty()) appendLogRaw(""); - appendLogNote("starting " + QString(synergyType() == synergyServer ? "server" : "client")); + appendLogInfo("starting " + QString(synergyType() == synergyServer ? "server" : "client")); qDebug() << args; // show command if debug log level... if (appConfig().logLevel() >= 2) { - appendLogNote(QString("command: %1 %2").arg(app, args.join(" "))); + appendLogInfo(QString("command: %1 %2").arg(app, args.join(" "))); } - appendLogNote("config file: " + configFilename()); - appendLogNote("log level: " + appConfig().logLevelText()); + appendLogInfo("config file: " + configFilename()); + appendLogInfo("log level: " + appConfig().logLevelText()); if (appConfig().logToFile()) - appendLogNote("log file: " + appConfig().logFilename()); + appendLogInfo("log file: " + appConfig().logFilename()); if (desktopMode) { @@ -770,7 +775,7 @@ void MainWindow::stopDesktop() return; } - appendLogNote("stopping synergy desktop process"); + appendLogInfo("stopping synergy desktop process"); if (synergyProcess()->isOpen()) synergyProcess()->close(); @@ -1321,7 +1326,7 @@ void MainWindow::on_m_pCheckBoxAutoConfig_toggled(bool checked) void MainWindow::bonjourInstallFinished() { - appendLogNote("Bonjour install finished"); + appendLogInfo("Bonjour install finished"); m_pCheckBoxAutoConfig->setChecked(true); } diff --git a/src/gui/src/MainWindow.h b/src/gui/src/MainWindow.h index 80b1dbb4..8b7aa0a3 100644 --- a/src/gui/src/MainWindow.h +++ b/src/gui/src/MainWindow.h @@ -111,7 +111,8 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase public slots: void appendLogRaw(const QString& text); - void appendLogNote(const QString& text); + void appendLogInfo(const QString& text); + void appendLogNotify(const QString& text); void appendLogDebug(const QString& text); void appendLogError(const QString& text); void startSynergy(); diff --git a/src/gui/src/ZeroconfService.cpp b/src/gui/src/ZeroconfService.cpp index 53f91fd2..165912d3 100644 --- a/src/gui/src/ZeroconfService.cpp +++ b/src/gui/src/ZeroconfService.cpp @@ -79,7 +79,7 @@ void ZeroconfService::serverDetected(const QList& list) { foreach (ZeroconfRecord record, list) { registerService(false); - m_pMainWindow->appendLogNote(tr("zeroconf server detected: %1").arg( + m_pMainWindow->appendLogInfo(tr("zeroconf server detected: %1").arg( record.serviceName)); m_pMainWindow->serverDetected(record.serviceName); } @@ -88,7 +88,7 @@ void ZeroconfService::serverDetected(const QList& list) void ZeroconfService::clientDetected(const QList& list) { foreach (ZeroconfRecord record, list) { - m_pMainWindow->appendLogNote(tr("zeroconf client detected: %1").arg( + m_pMainWindow->appendLogInfo(tr("zeroconf client detected: %1").arg( record.serviceName)); m_pMainWindow->autoAddScreen(record.serviceName); } diff --git a/src/lib/client/Client.cpp b/src/lib/client/Client.cpp index ad586809..8deb084a 100644 --- a/src/lib/client/Client.cpp +++ b/src/lib/client/Client.cpp @@ -285,7 +285,7 @@ Client::leave() if (!m_receivedFileData.empty()) { m_receivedFileData.clear(); - LOG((CLOG_NOTIFY "File Transmission Interrupted: The previous file transmission is interrupted.")); + LOG((CLOG_NOTIFY "file transmission interrupted")); } return true; diff --git a/src/lib/client/ServerProxy.cpp b/src/lib/client/ServerProxy.cpp index ea275e55..112ad7b8 100644 --- a/src/lib/client/ServerProxy.cpp +++ b/src/lib/client/ServerProxy.cpp @@ -565,11 +565,11 @@ ServerProxy::setClipboard() clipboard.unmarshall(dataCached, 0); m_client->setClipboard(id, &clipboard); - LOG((CLOG_NOTIFY "Clipboard Transmission Complete: Clipboard is updated.")); + LOG((CLOG_NOTIFY "clipboard transmission complete")); } else if (r == kStart) { size_t size = ClipboardChunk::getExpectedSize(); - LOG((CLOG_NOTIFY "Clipboard Transmission Started: Start receiving %u bytes of clipboard data.", size)); + LOG((CLOG_NOTIFY "clipboard transmission started: start receiving %u bytes of clipboard data", size)); } } @@ -873,7 +873,7 @@ ServerProxy::fileChunkReceived() else if (result == kStart) { if (m_client->getDragFileList().size() > 0) { String filename = m_client->getDragFileList().at(0).getFilename(); - LOG((CLOG_NOTIFY "File Transmission Started: Start receiving %s.", filename.c_str())); + LOG((CLOG_NOTIFY "file transmission started: start receiving %s", filename.c_str())); } } } diff --git a/src/lib/server/ClientProxy1_5.cpp b/src/lib/server/ClientProxy1_5.cpp index 350167d2..2e98d771 100644 --- a/src/lib/server/ClientProxy1_5.cpp +++ b/src/lib/server/ClientProxy1_5.cpp @@ -93,7 +93,7 @@ ClientProxy1_5::fileChunkReceived() else if (result == kStart) { if (server->getFakeDragFileList().size() > 0) { String filename = server->getFakeDragFileList().at(0).getFilename(); - LOG((CLOG_NOTIFY "File Transmission Started: Start receiving %s.", filename.c_str())); + LOG((CLOG_NOTIFY "file transmission started: start receiving %s", filename.c_str())); } } } diff --git a/src/lib/server/ClientProxy1_6.cpp b/src/lib/server/ClientProxy1_6.cpp index 8ca7bb91..76234112 100644 --- a/src/lib/server/ClientProxy1_6.cpp +++ b/src/lib/server/ClientProxy1_6.cpp @@ -91,11 +91,11 @@ ClientProxy1_6::recvClipboard() info->m_sequenceNumber = seq; m_events->addEvent(Event(m_events->forClipboard().clipboardChanged(), getEventTarget(), info)); - LOG((CLOG_NOTIFY "Clipboard Transmission Complete: Clipboard is updated.")); + LOG((CLOG_NOTIFY "clipboard transmission complete")); } else if (r == kStart) { size_t size = ClipboardChunk::getExpectedSize(); - LOG((CLOG_NOTIFY "Clipboard Transmission Started: Start receiving %u bytes of clipboard data.", size)); + LOG((CLOG_NOTIFY "clipboard transmission started: start receiving %u bytes of clipboard data", size)); } return true; diff --git a/src/lib/synergy/ClipboardChunk.cpp b/src/lib/synergy/ClipboardChunk.cpp index 927f645d..ef60954e 100644 --- a/src/lib/synergy/ClipboardChunk.cpp +++ b/src/lib/synergy/ClipboardChunk.cpp @@ -115,13 +115,13 @@ ClipboardChunk::assemble(synergy::IStream* stream, } else if (s_expectedSize != dataCached.size()) { LOG((CLOG_ERR "corrupted clipboard data, expected size=%d actual size=%d", s_expectedSize, dataCached.size())); - LOG((CLOG_NOTIFY "Clipboard Transmission Failed: Corrupted clipboard data.")); + LOG((CLOG_NOTIFY "clipboard transmission failed: corrupted clipboard data")); return kError; } return kFinish; } - LOG((CLOG_NOTIFY "Clipboard Transmission Failed: Unknow error.")); + LOG((CLOG_NOTIFY "clipboard transmission failed: unknow error")); return kError; } diff --git a/src/lib/synergy/DropHelper.cpp b/src/lib/synergy/DropHelper.cpp index 7430c943..63170128 100644 --- a/src/lib/synergy/DropHelper.cpp +++ b/src/lib/synergy/DropHelper.cpp @@ -38,18 +38,18 @@ DropHelper::writeToDir(const String& destination, DragFileList& fileList, String file.open(dropTarget.c_str(), std::ios::out | std::ios::binary); if (!file.is_open()) { LOG((CLOG_ERR "drop file failed: can not open %s", dropTarget.c_str())); - LOG((CLOG_NOTIFY "File Transmission Failed: Can not open %s.", dropTarget.c_str())); + LOG((CLOG_NOTIFY "file transmission failed: can not open %s", dropTarget.c_str())); } file.write(data.c_str(), data.size()); file.close(); - LOG((CLOG_NOTIFY "File Transmission Complete: %s is saved to %s.", fileList.at(0).getFilename().c_str(), destination.c_str())); + LOG((CLOG_NOTIFY "file transmission complete: %s is saved to %s", fileList.at(0).getFilename().c_str(), destination.c_str())); fileList.clear(); } else { LOG((CLOG_ERR "drop file failed: drop target is empty")); - LOG((CLOG_NOTIFY "File Transmission Failed: Drop target is empty.")); + LOG((CLOG_NOTIFY "file transmission failed: drop target is empty")); } } diff --git a/src/lib/synergy/FileChunk.cpp b/src/lib/synergy/FileChunk.cpp index 403b32a4..21c91bca 100644 --- a/src/lib/synergy/FileChunk.cpp +++ b/src/lib/synergy/FileChunk.cpp @@ -116,7 +116,7 @@ FileChunk::assemble(synergy::IStream* stream, String& dataReceived, size_t& expe case kDataEnd: if (expectedSize != dataReceived.size()) { LOG((CLOG_ERR "corrupted clipboard data, expected size=%d actual size=%d", expectedSize, dataReceived.size())); - LOG((CLOG_NOTIFY "File Transmission Failed: Corrupted file data.")); + LOG((CLOG_NOTIFY "file transmission failed: corrupted file data")); return kError; } diff --git a/src/lib/synergy/StreamChunker.cpp b/src/lib/synergy/StreamChunker.cpp index d8474309..b23f4dbb 100644 --- a/src/lib/synergy/StreamChunker.cpp +++ b/src/lib/synergy/StreamChunker.cpp @@ -82,7 +82,7 @@ StreamChunker::sendFile( while (true) { if (s_interruptFile) { s_interruptFile = false; - LOG((CLOG_NOTIFY "File Transmission Interrupted: The previous file transmission is interrupted.")); + LOG((CLOG_NOTIFY "file transmission interrupted")); break; } @@ -154,7 +154,7 @@ StreamChunker::sendClipboard( while (true) { if (s_interruptClipboard) { s_interruptClipboard = false; - LOG((CLOG_NOTIFY "Clipboard Transmission Interrupted: The previous clipboard transmission is interrupted.")); + LOG((CLOG_NOTIFY "clipboard transmission interrupted")); break; } From 00734c15b11094c25819baef4ec3a6a69ce33f03 Mon Sep 17 00:00:00 2001 From: Xinyu Hou Date: Tue, 30 Jun 2015 22:45:48 +0100 Subject: [PATCH 3/4] Removed notify log level in settings #4745 --- src/gui/res/SettingsDialogBase.ui | 7 +------ src/gui/src/AppConfig.cpp | 5 ++--- src/gui/src/MainWindow.cpp | 9 ++------- src/gui/src/MainWindow.h | 1 - 4 files changed, 5 insertions(+), 17 deletions(-) diff --git a/src/gui/res/SettingsDialogBase.ui b/src/gui/res/SettingsDialogBase.ui index 1543a542..666fc787 100644 --- a/src/gui/res/SettingsDialogBase.ui +++ b/src/gui/res/SettingsDialogBase.ui @@ -7,7 +7,7 @@ 0 0 368 - 377 + 439 @@ -208,11 +208,6 @@ - - - Notify - - Info diff --git a/src/gui/src/AppConfig.cpp b/src/gui/src/AppConfig.cpp index f5e727db..a795538e 100644 --- a/src/gui/src/AppConfig.cpp +++ b/src/gui/src/AppConfig.cpp @@ -37,7 +37,6 @@ const char AppConfig::m_SynergyLogDir[] = "/var/log/"; static const char* logLevelNames[] = { - "NOTIFY", "INFO", "DEBUG", "DEBUG1", @@ -117,7 +116,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", 1).toInt(); // level 1: INFO + m_LogLevel = settings().value("logLevel", 0).toInt(); // level 0: INFO m_LogToFile = settings().value("logToFile", false).toBool(); m_LogFilename = settings().value("logFilename", synergyLogDir() + "synergy.log").toString(); m_WizardLastRun = settings().value("wizardLastRun", 0).toInt(); @@ -134,7 +133,7 @@ void AppConfig::loadSettings() m_ResetLogLevel = settings().value("resetLogLevel", true).toBool(); if (m_ResetLogLevel) { - m_LogLevel = 1; + m_LogLevel = 0; m_ResetLogLevel = false; } } diff --git a/src/gui/src/MainWindow.cpp b/src/gui/src/MainWindow.cpp index f526a8e4..292fe00f 100644 --- a/src/gui/src/MainWindow.cpp +++ b/src/gui/src/MainWindow.cpp @@ -373,13 +373,8 @@ void MainWindow::appendLogInfo(const QString& text) appendLogRaw("INFO: " + text); } -void MainWindow::appendLogNotify(const QString& text) -{ - appendLogRaw("NOTIFY: " + text); -} - void MainWindow::appendLogDebug(const QString& text) { - if (appConfig().logLevel() >= 2) { + if (appConfig().logLevel() >= 1) { appendLogRaw("DEBUG: " + text); } } @@ -586,7 +581,7 @@ void MainWindow::startSynergy() qDebug() << args; // show command if debug log level... - if (appConfig().logLevel() >= 2) { + if (appConfig().logLevel() >= 1) { appendLogInfo(QString("command: %1 %2").arg(app, args.join(" "))); } diff --git a/src/gui/src/MainWindow.h b/src/gui/src/MainWindow.h index 8b7aa0a3..c45c3225 100644 --- a/src/gui/src/MainWindow.h +++ b/src/gui/src/MainWindow.h @@ -112,7 +112,6 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase public slots: void appendLogRaw(const QString& text); void appendLogInfo(const QString& text); - void appendLogNotify(const QString& text); void appendLogDebug(const QString& text); void appendLogError(const QString& text); void startSynergy(); From 44fa44fd1b071c9a79f84231649a0f9127248b9f Mon Sep 17 00:00:00 2001 From: "Jerry (Xinyu Hou)" Date: Tue, 30 Jun 2015 15:05:24 -0700 Subject: [PATCH 4/4] Fixed using non existing function #4745 --- src/gui/src/MainWindow.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/src/MainWindow.cpp b/src/gui/src/MainWindow.cpp index 292fe00f..3cc1a109 100644 --- a/src/gui/src/MainWindow.cpp +++ b/src/gui/src/MainWindow.cpp @@ -1111,7 +1111,7 @@ bool MainWindow::isServiceRunning(QString name) SC_HANDLE hSCManager; hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT); if (hSCManager == NULL) { - appendLogNote("failed to open a service controller manager, error: " + + appendLogError("failed to open a service controller manager, error: " + GetLastError()); return false; } @@ -1164,11 +1164,11 @@ void MainWindow::downloadBonjour() int arch = getProcessorArch(); if (arch == kProcessorArchWin32) { url.setUrl(bonjourBaseUrl + bonjourFilename32); - appendLogNote("downloading 32-bit Bonjour"); + appendLogInfo("downloading 32-bit Bonjour"); } else if (arch == kProcessorArchWin64) { url.setUrl(bonjourBaseUrl + bonjourFilename64); - appendLogNote("downloading 64-bit Bonjour"); + appendLogInfo("downloading 64-bit Bonjour"); } else { QMessageBox::critical(