Monitoring log to show notification and made icon change while transfering $4745
This commit is contained in:
parent
5cbcd74028
commit
d1ca021002
|
@ -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);
|
||||
|
|
|
@ -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()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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"));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue