From d1ca0210029dfdf670989e868a5cc25e15681f5b Mon Sep 17 00:00:00 2001 From: "Jerry (Xinyu Hou)" Date: Mon, 1 Jun 2015 15:59:59 -0700 Subject: [PATCH] Monitoring log to show notification and made icon change while transfering $4745 --- src/gui/src/MainWindow.cpp | 28 ++++++++++++++++++++-------- src/lib/client/ServerProxy.cpp | 1 + src/lib/synergy/DropHelper.cpp | 3 +++ 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/gui/src/MainWindow.cpp b/src/gui/src/MainWindow.cpp index 8ecbb563..7a3bf55e 100644 --- a/src/gui/src/MainWindow.cpp +++ b/src/gui/src/MainWindow.cpp @@ -71,7 +71,8 @@ static const char* synergyIconFiles[] = { ":/res/icons/16x16/synergy-disconnected.png", ":/res/icons/16x16/synergy-disconnected.png", - ":/res/icons/16x16/synergy-connected.png" + ":/res/icons/16x16/synergy-connected.png", + ":/res/icons/16x16/synergy-transfering.png" }; MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig) : @@ -466,13 +467,22 @@ void MainWindow::checkFingerprint(const QString& line) void MainWindow::checkTransmission(const QString& line) { - if (line.contains("receiving file")) - { - int p = line.lastIndexOf(':'); - if (p > 0) { - m_pTrayIcon->showMessage( - "Data Transmission", - "Receiving file: " + line.mid(p + 2)); + if (line.contains("File Transmission")) { + if (line.contains("Started")) { + setSynergyState(synergyTransfering); + } + else if (line.contains("Failed") || + line.contains("Complete")) { + setSynergyState(synergyConnected); + } + + // NOTIFY: Title: Detail + int p1 = line.indexOf(':'); + if (p1 > 0) { + int p2 = line.indexOf(':', p1 + 1); + if (p2 > 0) { + m_pTrayIcon->showMessage(line.mid(p1 + 2, p2 - p1 - 2), line.mid(p2 + 2)); + } } } } @@ -837,6 +847,8 @@ void MainWindow::setSynergyState(qSynergyState state) m_pLabelPadlock->hide(); setStatus(tr("Synergy is not running.")); break; + case synergyTransfering: + break; } setIcon(state); diff --git a/src/lib/client/ServerProxy.cpp b/src/lib/client/ServerProxy.cpp index bf5fd4d8..07ab771b 100644 --- a/src/lib/client/ServerProxy.cpp +++ b/src/lib/client/ServerProxy.cpp @@ -866,6 +866,7 @@ ServerProxy::fileChunkReceived() } else if (result == kStart) { String filename = m_client->getDragFileList().at(0).getFilename(); + LOG((CLOG_NOTIFY "File Transmission Started: Start receiving %s", filename.c_str())); } } diff --git a/src/lib/synergy/DropHelper.cpp b/src/lib/synergy/DropHelper.cpp index c8664a14..45e3471a 100644 --- a/src/lib/synergy/DropHelper.cpp +++ b/src/lib/synergy/DropHelper.cpp @@ -38,15 +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())); } file.write(data.c_str(), data.size()); file.close(); + LOG((CLOG_NOTIFY "File Transmission Complete: %s is saved to %s", fileList.at(0).getFilename(), 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")); } }