From 561284ef5ad6b2a246676138abef1c0a4db1745f Mon Sep 17 00:00:00 2001 From: Eberhard Graether Date: Tue, 30 May 2017 11:55:01 +0200 Subject: [PATCH] ui: fixes * Fixed send ping after changing plugin ports * Fixed can't close EULA window --- .../controller/IDECommunicationController.cpp | 23 ++++++++----------- .../controller/IDECommunicationController.h | 4 +--- .../network/QtIDECommunicationController.cpp | 3 ++- src/lib_gui/qt/window/QtMainWindow.cpp | 16 ++++++++----- 4 files changed, 22 insertions(+), 24 deletions(-) diff --git a/src/lib/component/controller/IDECommunicationController.cpp b/src/lib/component/controller/IDECommunicationController.cpp index 8cf23b2f..16895146 100644 --- a/src/lib/component/controller/IDECommunicationController.cpp +++ b/src/lib/component/controller/IDECommunicationController.cpp @@ -68,9 +68,16 @@ void IDECommunicationController::setEnabled(const bool enabled) m_enabled = enabled; } -void IDECommunicationController::sendInitialPing() +void IDECommunicationController::sendUpdatePing() { - sendUpdatePing(); + // first reset connection status + MessagePingReceived msg; + msg.ideId = ""; + msg.ideName = ""; + msg.dispatch(); + + // send ping to update connection status + sendMessage(NetworkProtocolHelper::buildPingMessage()); } void IDECommunicationController::handleSetActiveTokenMessage( @@ -220,15 +227,3 @@ void IDECommunicationController::handleMessage(MessagePluginPortChange* message) stopListening(); startListening(); } - -void IDECommunicationController::sendUpdatePing() -{ - // first reset connection status - MessagePingReceived msg; - msg.ideId = ""; - msg.ideName = ""; - msg.dispatch(); - - // send ping to update connection status - sendMessage(NetworkProtocolHelper::buildPingMessage()); -} diff --git a/src/lib/component/controller/IDECommunicationController.h b/src/lib/component/controller/IDECommunicationController.h index 64d60769..4ef29b31 100644 --- a/src/lib/component/controller/IDECommunicationController.h +++ b/src/lib/component/controller/IDECommunicationController.h @@ -37,7 +37,7 @@ public: void setEnabled(const bool enabled); protected: - void sendInitialPing(); + void sendUpdatePing(); private: void handleSetActiveTokenMessage(const NetworkProtocolHelper::SetActiveTokenMessage& message); @@ -51,8 +51,6 @@ private: virtual void handleMessage(MessagePluginPortChange* message); virtual void sendMessage(const std::string& message) const = 0; - void sendUpdatePing(); - StorageAccess* m_storageAccess; bool m_enabled; diff --git a/src/lib_gui/qt/network/QtIDECommunicationController.cpp b/src/lib_gui/qt/network/QtIDECommunicationController.cpp index 7fafe391..3e6977c2 100644 --- a/src/lib_gui/qt/network/QtIDECommunicationController.cpp +++ b/src/lib_gui/qt/network/QtIDECommunicationController.cpp @@ -23,10 +23,11 @@ void QtIDECommunicationController::startListening() m_tcpWrapper.setServerPort(appSettings->getSourcetrailPort()); m_tcpWrapper.setClientPort(appSettings->getPluginPort()); m_tcpWrapper.startListening(); + + sendUpdatePing(); } ); - sendInitialPing(); } void QtIDECommunicationController::stopListening() diff --git a/src/lib_gui/qt/window/QtMainWindow.cpp b/src/lib_gui/qt/window/QtMainWindow.cpp index 3a8bb0ce..9eda1fc0 100644 --- a/src/lib_gui/qt/window/QtMainWindow.cpp +++ b/src/lib_gui/qt/window/QtMainWindow.cpp @@ -336,17 +336,21 @@ void QtMainWindow::showBugtracker() void QtMainWindow::showEula(bool forceAccept) { - QtEulaWindow* eulaWindow = new QtEulaWindow(this, forceAccept); - m_windowStack.pushWindow(eulaWindow); - eulaWindow->setup(); + QtEulaWindow* window = new QtEulaWindow(this, forceAccept); + m_windowStack.pushWindow(window); + window->setup(); if (forceAccept) { setEnabled(false); - eulaWindow->setEnabled(true); + window->setEnabled(true); - connect(eulaWindow, SIGNAL(finished()), this, SLOT(acceptedEula())); - connect(eulaWindow, SIGNAL(canceled()), dynamic_cast(QCoreApplication::instance()), SLOT(quit())); + connect(window, SIGNAL(finished()), this, SLOT(acceptedEula())); + connect(window, SIGNAL(canceled()), dynamic_cast(QCoreApplication::instance()), SLOT(quit())); + } + else + { + connect(window, SIGNAL(canceled()), &m_windowStack, SLOT(popWindow())); } }