#6372 Make TLS UX more user friendly

This commit is contained in:
Nick Bolton 2018-07-28 02:54:11 +01:00
parent 555090c7d2
commit 5f3dce8379
3 changed files with 24 additions and 17 deletions

View File

@ -480,9 +480,8 @@ void MainWindow::updateFromLogLine(const QString &line)
void MainWindow::checkConnected(const QString& line) void MainWindow::checkConnected(const QString& line)
{ {
// TODO: implement ipc connection state messages to replace this hack. // TODO: implement ipc connection state messages to replace this hack.
if (line.contains("started server") || if (line.contains("connected to server") ||
line.contains("connected to server") || line.contains("accepted client connection"))
line.contains("watchdog status: ok"))
{ {
setSynergyState(synergyConnected); setSynergyState(synergyConnected);
@ -497,6 +496,10 @@ void MainWindow::checkConnected(const QString& line)
appConfig().saveSettings(); appConfig().saveSettings();
} }
} }
else if (line.contains("started server"))
{
setSynergyState(synergyListening);
}
} }
#ifndef SYNERGY_ENTERPRISE #ifndef SYNERGY_ENTERPRISE
@ -951,7 +954,7 @@ void MainWindow::setSynergyState(qSynergyState state)
if (synergyState() == state) if (synergyState() == state)
return; return;
if (state == synergyConnected || state == synergyConnecting) if ((state == synergyConnected) || (state == synergyConnecting) || (state == synergyListening))
{ {
disconnect (m_pButtonToggleStart, SIGNAL(clicked()), m_pActionStartSynergy, SLOT(trigger())); disconnect (m_pButtonToggleStart, SIGNAL(clicked()), m_pActionStartSynergy, SLOT(trigger()));
connect (m_pButtonToggleStart, SIGNAL(clicked()), m_pActionStopSynergy, SLOT(trigger())); connect (m_pButtonToggleStart, SIGNAL(clicked()), m_pActionStopSynergy, SLOT(trigger()));
@ -966,24 +969,30 @@ void MainWindow::setSynergyState(qSynergyState state)
m_pButtonApply->setEnabled(false); m_pButtonApply->setEnabled(false);
} }
bool connected = false; bool running = false;
if (state == synergyConnected || state == synergyTransfering) { if (state == synergyConnected || state == synergyListening) {
connected = true; running = true;
} }
m_pActionStartSynergy->setEnabled(!connected); m_pActionStartSynergy->setEnabled(!running);
m_pActionStopSynergy->setEnabled(connected); m_pActionStopSynergy->setEnabled(running);
switch (state) switch (state)
{ {
case synergyListening: {
if (synergyType() == synergyServer) {
setStatus(tr("Synergy is waiting for clients").arg(tlsVersion));
}
break;
}
case synergyConnected: { case synergyConnected: {
if (m_SecureSocket) { if (m_SecureSocket) {
setStatus(tr("Synergy is running (with %1)").arg(tlsVersion)); setStatus(tr("Synergy is connected (with %1)").arg(tlsVersion));
} }
else { else {
setStatus(tr("Synergy is running (without %1)").arg(tlsVersion)); setStatus(tr("Synergy is running (without %1)").arg(tlsVersion));
} }
break; break;
} }
case synergyConnecting: case synergyConnecting:
@ -992,8 +1001,6 @@ void MainWindow::setSynergyState(qSynergyState state)
case synergyDisconnected: case synergyDisconnected:
setStatus(tr("Synergy is not running")); setStatus(tr("Synergy is not running"));
break; break;
case synergyTransfering:
break;
} }
setIcon(state); setIcon(state);
@ -1587,7 +1594,7 @@ QString MainWindow::getProfileRootForArg()
return QString("\"%1\"").arg(dir); return QString("\"%1\"").arg(dir);
} }
bool MainWindow::secureSocket(bool secureSocket) void MainWindow::secureSocket(bool secureSocket)
{ {
m_SecureSocket = secureSocket; m_SecureSocket = secureSocket;
if (secureSocket) { if (secureSocket) {

View File

@ -75,7 +75,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
synergyDisconnected, synergyDisconnected,
synergyConnecting, synergyConnecting,
synergyConnected, synergyConnected,
synergyTransfering synergyListening
}; };
enum qSynergyType enum qSynergyType
@ -208,7 +208,7 @@ public slots:
void proofreadInfo(); void proofreadInfo();
void showEvent (QShowEvent*); void showEvent (QShowEvent*);
bool secureSocket(bool secureSocket); void secureSocket(bool secureSocket);
private: private:
QSettings& m_Settings; QSettings& m_Settings;

View File

@ -180,7 +180,7 @@
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="text"> <property name="text">
<string>Use &amp;SSL encryption</string> <string>Use &amp;TLS encryption</string>
</property> </property>
</widget> </widget>
</item> </item>