From 5f3dce83798ee0de4de8cc60e2a7b9b76d850209 Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Sat, 28 Jul 2018 02:54:11 +0100 Subject: [PATCH] #6372 Make TLS UX more user friendly --- src/gui/src/MainWindow.cpp | 35 ++++++++++++++++++------------- src/gui/src/MainWindow.h | 4 ++-- src/gui/src/SettingsDialogBase.ui | 2 +- 3 files changed, 24 insertions(+), 17 deletions(-) diff --git a/src/gui/src/MainWindow.cpp b/src/gui/src/MainWindow.cpp index 48647208..6fb74948 100644 --- a/src/gui/src/MainWindow.cpp +++ b/src/gui/src/MainWindow.cpp @@ -480,9 +480,8 @@ void MainWindow::updateFromLogLine(const QString &line) void MainWindow::checkConnected(const QString& line) { // TODO: implement ipc connection state messages to replace this hack. - if (line.contains("started server") || - line.contains("connected to server") || - line.contains("watchdog status: ok")) + if (line.contains("connected to server") || + line.contains("accepted client connection")) { setSynergyState(synergyConnected); @@ -497,6 +496,10 @@ void MainWindow::checkConnected(const QString& line) appConfig().saveSettings(); } } + else if (line.contains("started server")) + { + setSynergyState(synergyListening); + } } #ifndef SYNERGY_ENTERPRISE @@ -951,7 +954,7 @@ void MainWindow::setSynergyState(qSynergyState state) if (synergyState() == state) return; - if (state == synergyConnected || state == synergyConnecting) + if ((state == synergyConnected) || (state == synergyConnecting) || (state == synergyListening)) { disconnect (m_pButtonToggleStart, SIGNAL(clicked()), m_pActionStartSynergy, SLOT(trigger())); connect (m_pButtonToggleStart, SIGNAL(clicked()), m_pActionStopSynergy, SLOT(trigger())); @@ -966,24 +969,30 @@ void MainWindow::setSynergyState(qSynergyState state) m_pButtonApply->setEnabled(false); } - bool connected = false; - if (state == synergyConnected || state == synergyTransfering) { - connected = true; + bool running = false; + if (state == synergyConnected || state == synergyListening) { + running = true; } - m_pActionStartSynergy->setEnabled(!connected); - m_pActionStopSynergy->setEnabled(connected); + m_pActionStartSynergy->setEnabled(!running); + m_pActionStopSynergy->setEnabled(running); switch (state) { + case synergyListening: { + if (synergyType() == synergyServer) { + setStatus(tr("Synergy is waiting for clients").arg(tlsVersion)); + } + + break; + } case synergyConnected: { if (m_SecureSocket) { - setStatus(tr("Synergy is running (with %1)").arg(tlsVersion)); + setStatus(tr("Synergy is connected (with %1)").arg(tlsVersion)); } else { setStatus(tr("Synergy is running (without %1)").arg(tlsVersion)); } - break; } case synergyConnecting: @@ -992,8 +1001,6 @@ void MainWindow::setSynergyState(qSynergyState state) case synergyDisconnected: setStatus(tr("Synergy is not running")); break; - case synergyTransfering: - break; } setIcon(state); @@ -1587,7 +1594,7 @@ QString MainWindow::getProfileRootForArg() return QString("\"%1\"").arg(dir); } -bool MainWindow::secureSocket(bool secureSocket) +void MainWindow::secureSocket(bool secureSocket) { m_SecureSocket = secureSocket; if (secureSocket) { diff --git a/src/gui/src/MainWindow.h b/src/gui/src/MainWindow.h index d3d2468b..a42a9663 100644 --- a/src/gui/src/MainWindow.h +++ b/src/gui/src/MainWindow.h @@ -75,7 +75,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase synergyDisconnected, synergyConnecting, synergyConnected, - synergyTransfering + synergyListening }; enum qSynergyType @@ -208,7 +208,7 @@ public slots: void proofreadInfo(); void showEvent (QShowEvent*); - bool secureSocket(bool secureSocket); + void secureSocket(bool secureSocket); private: QSettings& m_Settings; diff --git a/src/gui/src/SettingsDialogBase.ui b/src/gui/src/SettingsDialogBase.ui index 9f7d894c..476600d0 100644 --- a/src/gui/src/SettingsDialogBase.ui +++ b/src/gui/src/SettingsDialogBase.ui @@ -180,7 +180,7 @@ false - Use &SSL encryption + Use &TLS encryption