ui: Added plugin ports to preferences
bug id = 145
This commit is contained in:
@@ -16,6 +16,7 @@
|
|||||||
#include "component/view/DialogView.h"
|
#include "component/view/DialogView.h"
|
||||||
#include "component/view/GraphViewStyle.h"
|
#include "component/view/GraphViewStyle.h"
|
||||||
#include "component/controller/NetworkFactory.h"
|
#include "component/controller/NetworkFactory.h"
|
||||||
|
#include "component/controller/IDECommunicationController.h"
|
||||||
#include "component/view/MainView.h"
|
#include "component/view/MainView.h"
|
||||||
#include "component/view/ViewFactory.h"
|
#include "component/view/ViewFactory.h"
|
||||||
#include "data/StorageCache.h"
|
#include "data/StorageCache.h"
|
||||||
@@ -55,6 +56,7 @@ void Application::createInstance(
|
|||||||
{
|
{
|
||||||
s_instance->m_ideCommunicationController =
|
s_instance->m_ideCommunicationController =
|
||||||
networkFactory->createIDECommunicationController(s_instance->m_storageCache.get());
|
networkFactory->createIDECommunicationController(s_instance->m_storageCache.get());
|
||||||
|
s_instance->m_ideCommunicationController->startListening();
|
||||||
}
|
}
|
||||||
|
|
||||||
s_instance->startMessagingAndScheduling();
|
s_instance->startMessagingAndScheduling();
|
||||||
|
|||||||
@@ -271,6 +271,7 @@ add_files(
|
|||||||
utility/messaging/type/MessageInterruptTasks.h
|
utility/messaging/type/MessageInterruptTasks.h
|
||||||
utility/messaging/type/MessageLoadProject.h
|
utility/messaging/type/MessageLoadProject.h
|
||||||
utility/messaging/type/MessageMoveIDECursor.h
|
utility/messaging/type/MessageMoveIDECursor.h
|
||||||
|
utility/messaging/type/MessagePluginPortChange.h
|
||||||
utility/messaging/type/MessageProjectEdit.h
|
utility/messaging/type/MessageProjectEdit.h
|
||||||
utility/messaging/type/MessageProjectNew.h
|
utility/messaging/type/MessageProjectNew.h
|
||||||
utility/messaging/type/MessageRedo.h
|
utility/messaging/type/MessageRedo.h
|
||||||
|
|||||||
@@ -152,3 +152,9 @@ void IDECommunicationController::handleMessage(MessageMoveIDECursor* message)
|
|||||||
|
|
||||||
sendMessage(networkMessage);
|
sendMessage(networkMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IDECommunicationController::handleMessage(MessagePluginPortChange* message)
|
||||||
|
{
|
||||||
|
stopListening();
|
||||||
|
startListening();
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,17 +4,18 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "component/controller/Controller.h"
|
#include "component/controller/Controller.h"
|
||||||
|
|
||||||
#include "component/controller/helper/NetworkProtocolHelper.h"
|
#include "component/controller/helper/NetworkProtocolHelper.h"
|
||||||
|
|
||||||
#include "utility/messaging/MessageListener.h"
|
#include "utility/messaging/MessageListener.h"
|
||||||
#include "utility/messaging/type/MessageMoveIDECursor.h"
|
#include "utility/messaging/type/MessageMoveIDECursor.h"
|
||||||
|
#include "utility/messaging/type/MessagePluginPortChange.h"
|
||||||
|
|
||||||
class StorageAccess;
|
class StorageAccess;
|
||||||
|
|
||||||
class IDECommunicationController
|
class IDECommunicationController
|
||||||
: public Controller
|
: public Controller
|
||||||
, public MessageListener<MessageMoveIDECursor>
|
, public MessageListener<MessageMoveIDECursor>
|
||||||
|
, public MessageListener<MessagePluginPortChange>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
IDECommunicationController(StorageAccess* storageAccess);
|
IDECommunicationController(StorageAccess* storageAccess);
|
||||||
@@ -22,18 +23,21 @@ public:
|
|||||||
|
|
||||||
virtual void clear();
|
virtual void clear();
|
||||||
|
|
||||||
|
virtual void startListening() = 0;
|
||||||
|
virtual void stopListening() = 0;
|
||||||
|
virtual bool isListening() const = 0;
|
||||||
|
|
||||||
void handleIncomingMessage(const std::string& message);
|
void handleIncomingMessage(const std::string& message);
|
||||||
|
|
||||||
bool getEnabled() const;
|
bool getEnabled() const;
|
||||||
void setEnabled(const bool enabled);
|
void setEnabled(const bool enabled);
|
||||||
|
|
||||||
virtual bool isListening() const = 0;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void handleSetActiveTokenMessage(const NetworkProtocolHelper::SetActiveTokenMessage& message);
|
void handleSetActiveTokenMessage(const NetworkProtocolHelper::SetActiveTokenMessage& message);
|
||||||
void handleCreateProjectMessage(const NetworkProtocolHelper::CreateProjectMessage& message);
|
void handleCreateProjectMessage(const NetworkProtocolHelper::CreateProjectMessage& message);
|
||||||
|
|
||||||
virtual void handleMessage(MessageMoveIDECursor* message);
|
virtual void handleMessage(MessageMoveIDECursor* message);
|
||||||
|
virtual void handleMessage(MessagePluginPortChange* message);
|
||||||
virtual void sendMessage(const std::string& message) const = 0;
|
virtual void sendMessage(const std::string& message) const = 0;
|
||||||
|
|
||||||
StorageAccess* m_storageAccess;
|
StorageAccess* m_storageAccess;
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
#ifndef MESSAGE_PLUGIN_PORT_CHANGE_H
|
||||||
|
#define MESSAGE_PLUGIN_PORT_CHANGE_H
|
||||||
|
|
||||||
|
#include "utility/messaging/Message.h"
|
||||||
|
|
||||||
|
class MessagePluginPortChange
|
||||||
|
: public Message<MessagePluginPortChange>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MessagePluginPortChange()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static const std::string getStaticType()
|
||||||
|
{
|
||||||
|
return "MessagePluginPortChange";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // MESSAGE_PLUGIN_PORT_CHANGE_H
|
||||||
@@ -6,17 +6,35 @@ QtIDECommunicationController::QtIDECommunicationController(QObject* parent, Stor
|
|||||||
: IDECommunicationController(storageAccess)
|
: IDECommunicationController(storageAccess)
|
||||||
, m_tcpWrapper(parent)
|
, m_tcpWrapper(parent)
|
||||||
{
|
{
|
||||||
ApplicationSettings* appSettings = ApplicationSettings::getInstance().get();
|
|
||||||
|
|
||||||
m_tcpWrapper.setReadCallback(std::bind(&QtIDECommunicationController::handleIncomingMessage, this, std::placeholders::_1));
|
m_tcpWrapper.setReadCallback(std::bind(&QtIDECommunicationController::handleIncomingMessage, this, std::placeholders::_1));
|
||||||
m_tcpWrapper.setServerPort(appSettings->getCoatiPort());
|
|
||||||
m_tcpWrapper.setClientPort(appSettings->getPluginPort());
|
|
||||||
m_tcpWrapper.startListening();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QtIDECommunicationController::~QtIDECommunicationController()
|
QtIDECommunicationController::~QtIDECommunicationController()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
void QtIDECommunicationController::startListening()
|
||||||
|
{
|
||||||
|
m_onQtThread(
|
||||||
|
[=]()
|
||||||
|
{
|
||||||
|
ApplicationSettings* appSettings = ApplicationSettings::getInstance().get();
|
||||||
|
m_tcpWrapper.setServerPort(appSettings->getCoatiPort());
|
||||||
|
m_tcpWrapper.setClientPort(appSettings->getPluginPort());
|
||||||
|
m_tcpWrapper.startListening();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void QtIDECommunicationController::stopListening()
|
||||||
|
{
|
||||||
|
m_onQtThread(
|
||||||
|
[=]()
|
||||||
|
{
|
||||||
|
m_tcpWrapper.stopListening();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
bool QtIDECommunicationController::isListening() const
|
bool QtIDECommunicationController::isListening() const
|
||||||
{
|
{
|
||||||
return m_tcpWrapper.isListening();
|
return m_tcpWrapper.isListening();
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#include "QtTcpWrapper.h"
|
#include "QtTcpWrapper.h"
|
||||||
|
|
||||||
#include "component/controller/IDECommunicationController.h"
|
#include "component/controller/IDECommunicationController.h"
|
||||||
|
#include "qt/utility/QtThreadedFunctor.h"
|
||||||
#include "settings/ApplicationSettings.h"
|
#include "settings/ApplicationSettings.h"
|
||||||
|
|
||||||
class StorageAccess;
|
class StorageAccess;
|
||||||
@@ -17,12 +18,17 @@ public:
|
|||||||
QtIDECommunicationController(QObject* parent, StorageAccess* storageAccess);
|
QtIDECommunicationController(QObject* parent, StorageAccess* storageAccess);
|
||||||
~QtIDECommunicationController();
|
~QtIDECommunicationController();
|
||||||
|
|
||||||
|
virtual void startListening();
|
||||||
|
virtual void stopListening();
|
||||||
|
|
||||||
virtual bool isListening() const;
|
virtual bool isListening() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void sendMessage(const std::string& message) const;
|
virtual void sendMessage(const std::string& message) const;
|
||||||
|
|
||||||
QtTcpWrapper m_tcpWrapper;
|
QtTcpWrapper m_tcpWrapper;
|
||||||
|
|
||||||
|
QtThreadedLambdaFunctor m_onQtThread;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QT_IDE_COMMUNICATION_CONTROLLER
|
#endif // QT_IDE_COMMUNICATION_CONTROLLER
|
||||||
@@ -8,22 +8,29 @@ QtTcpWrapper::QtTcpWrapper(QObject* parent, const std::string& ip, const quint16
|
|||||||
, m_clientPort(clientPort)
|
, m_clientPort(clientPort)
|
||||||
, m_ip(ip)
|
, m_ip(ip)
|
||||||
{
|
{
|
||||||
|
m_tcpServer = new QTcpServer(this);
|
||||||
|
|
||||||
|
connect(m_tcpServer, SIGNAL(newConnection()), this, SLOT(acceptConnection()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtTcpWrapper::startListening()
|
void QtTcpWrapper::startListening()
|
||||||
{
|
{
|
||||||
QHostAddress address(m_ip.c_str());
|
QHostAddress address(m_ip.c_str());
|
||||||
|
|
||||||
m_tcpServer = new QTcpServer(this);
|
|
||||||
|
|
||||||
connect(m_tcpServer, SIGNAL(newConnection()), this, SLOT(acceptConnection()));
|
|
||||||
|
|
||||||
if (!m_tcpServer->listen(QHostAddress::LocalHost, m_serverPort))
|
if (!m_tcpServer->listen(QHostAddress::LocalHost, m_serverPort))
|
||||||
{
|
{
|
||||||
LOG_ERROR_STREAM(<< "TCP server failed to start with error: \"" + m_tcpServer->errorString().toStdString() + "\". Unable to listen for IDE plugin messages.");
|
LOG_ERROR_STREAM(<< "TCP server failed to start with error: \"" + m_tcpServer->errorString().toStdString() + "\". Unable to listen for IDE plugin messages.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QtTcpWrapper::stopListening()
|
||||||
|
{
|
||||||
|
if (isListening())
|
||||||
|
{
|
||||||
|
m_tcpServer->close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QtTcpWrapper::~QtTcpWrapper()
|
QtTcpWrapper::~QtTcpWrapper()
|
||||||
{
|
{
|
||||||
if (m_tcpServer != NULL)
|
if (m_tcpServer != NULL)
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ public:
|
|||||||
~QtTcpWrapper();
|
~QtTcpWrapper();
|
||||||
|
|
||||||
void startListening();
|
void startListening();
|
||||||
|
void stopListening();
|
||||||
|
|
||||||
void sendMessage(const std::string& message) const;
|
void sendMessage(const std::string& message) const;
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
#include "utility/logging/logging.h"
|
#include "utility/logging/logging.h"
|
||||||
#include "utility/messaging/type/MessageDispatchWhenLicenseValid.h"
|
#include "utility/messaging/type/MessageDispatchWhenLicenseValid.h"
|
||||||
#include "utility/messaging/type/MessageLoadProject.h"
|
#include "utility/messaging/type/MessageLoadProject.h"
|
||||||
|
#include "utility/messaging/type/MessagePluginPortChange.h"
|
||||||
#include "utility/messaging/type/MessageRefresh.h"
|
#include "utility/messaging/type/MessageRefresh.h"
|
||||||
#include "utility/messaging/type/MessageScrollSpeedChange.h"
|
#include "utility/messaging/type/MessageScrollSpeedChange.h"
|
||||||
#include "utility/messaging/type/MessageStatus.h"
|
#include "utility/messaging/type/MessageStatus.h"
|
||||||
@@ -42,6 +43,8 @@ QtProjectWizzard::QtProjectWizzard(QWidget* parent)
|
|||||||
m_appSettings.setHeaderSearchPaths(appSettings->getHeaderSearchPaths());
|
m_appSettings.setHeaderSearchPaths(appSettings->getHeaderSearchPaths());
|
||||||
m_appSettings.setFrameworkSearchPaths(appSettings->getFrameworkSearchPaths());
|
m_appSettings.setFrameworkSearchPaths(appSettings->getFrameworkSearchPaths());
|
||||||
m_appSettings.setScrollSpeed(appSettings->getScrollSpeed());
|
m_appSettings.setScrollSpeed(appSettings->getScrollSpeed());
|
||||||
|
m_appSettings.setCoatiPort(appSettings->getCoatiPort());
|
||||||
|
m_appSettings.setPluginPort(appSettings->getPluginPort());
|
||||||
|
|
||||||
m_parserManager = std::make_shared<SolutionParserManager>();
|
m_parserManager = std::make_shared<SolutionParserManager>();
|
||||||
|
|
||||||
@@ -641,6 +644,12 @@ void QtProjectWizzard::savePreferences()
|
|||||||
MessageScrollSpeedChange(ApplicationSettings::getInstance()->getScrollSpeed()).dispatch();
|
MessageScrollSpeedChange(ApplicationSettings::getInstance()->getScrollSpeed()).dispatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_appSettings.getCoatiPort() != ApplicationSettings::getInstance()->getCoatiPort() ||
|
||||||
|
m_appSettings.getPluginPort() != ApplicationSettings::getInstance()->getPluginPort())
|
||||||
|
{
|
||||||
|
MessagePluginPortChange().dispatch();
|
||||||
|
}
|
||||||
|
|
||||||
if (appSettingsChanged)
|
if (appSettingsChanged)
|
||||||
{
|
{
|
||||||
Project* currentProject = Application::getInstance()->getCurrentProject().get();
|
Project* currentProject = Application::getInstance()->getCurrentProject().get();
|
||||||
|
|||||||
@@ -115,6 +115,7 @@ void QtProjectWizzardContentPreferences::populateForm(QGridLayout* layout, int&
|
|||||||
|
|
||||||
layout->setRowMinimumHeight(row++, 20);
|
layout->setRowMinimumHeight(row++, 20);
|
||||||
|
|
||||||
|
|
||||||
// indexing
|
// indexing
|
||||||
layout->addWidget(createFormTitle("INDEXING"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignLeft);
|
layout->addWidget(createFormTitle("INDEXING"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignLeft);
|
||||||
row++;
|
row++;
|
||||||
@@ -151,6 +152,36 @@ void QtProjectWizzardContentPreferences::populateForm(QGridLayout* layout, int&
|
|||||||
|
|
||||||
layout->setRowMinimumHeight(row++, 20);
|
layout->setRowMinimumHeight(row++, 20);
|
||||||
|
|
||||||
|
|
||||||
|
// Plugins
|
||||||
|
layout->addWidget(createFormTitle("PLUGIN"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignLeft);
|
||||||
|
row++;
|
||||||
|
|
||||||
|
// Coati port
|
||||||
|
m_coatiPort = new QLineEdit();
|
||||||
|
m_coatiPort->setObjectName("name");
|
||||||
|
m_coatiPort->setAttribute(Qt::WA_MacShowFocusRect, 0);
|
||||||
|
|
||||||
|
layout->addWidget(createFormLabel("Coati Port"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
|
||||||
|
layout->addWidget(m_coatiPort, row, QtProjectWizzardWindow::BACK_COL);
|
||||||
|
|
||||||
|
addHelpButton("Port number that Coati uses to listen for incoming messages from plugins.", layout, row);
|
||||||
|
row++;
|
||||||
|
|
||||||
|
// Coati port
|
||||||
|
m_pluginPort = new QLineEdit();
|
||||||
|
m_pluginPort->setObjectName("name");
|
||||||
|
m_pluginPort->setAttribute(Qt::WA_MacShowFocusRect, 0);
|
||||||
|
|
||||||
|
layout->addWidget(createFormLabel("Plugin Port"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
|
||||||
|
layout->addWidget(m_pluginPort, row, QtProjectWizzardWindow::BACK_COL);
|
||||||
|
|
||||||
|
addHelpButton("Port number that Coati sends outgoing messages to.", layout, row);
|
||||||
|
row++;
|
||||||
|
|
||||||
|
layout->setRowMinimumHeight(row++, 20);
|
||||||
|
|
||||||
|
|
||||||
// Java
|
// Java
|
||||||
layout->addWidget(createFormTitle("JAVA"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignLeft);
|
layout->addWidget(createFormTitle("JAVA"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignLeft);
|
||||||
row++;
|
row++;
|
||||||
@@ -192,6 +223,7 @@ void QtProjectWizzardContentPreferences::populateForm(QGridLayout* layout, int&
|
|||||||
|
|
||||||
layout->setRowMinimumHeight(row++, 20);
|
layout->setRowMinimumHeight(row++, 20);
|
||||||
|
|
||||||
|
|
||||||
// C/C++
|
// C/C++
|
||||||
layout->addWidget(createFormTitle("C/C++"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignLeft);
|
layout->addWidget(createFormTitle("C/C++"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignLeft);
|
||||||
row++;
|
row++;
|
||||||
@@ -220,6 +252,9 @@ void QtProjectWizzardContentPreferences::load()
|
|||||||
m_scrollSpeed->setText(QString::number(appSettings->getScrollSpeed(), 'f', 1));
|
m_scrollSpeed->setText(QString::number(appSettings->getScrollSpeed(), 'f', 1));
|
||||||
m_loggingEnabled->setChecked(appSettings->getLoggingEnabled());
|
m_loggingEnabled->setChecked(appSettings->getLoggingEnabled());
|
||||||
|
|
||||||
|
m_coatiPort->setText(QString::number(appSettings->getCoatiPort()));
|
||||||
|
m_pluginPort->setText(QString::number(appSettings->getPluginPort()));
|
||||||
|
|
||||||
m_threads->setCurrentIndex(appSettings->getIndexerThreadCount() - 1);
|
m_threads->setCurrentIndex(appSettings->getIndexerThreadCount() - 1);
|
||||||
m_fatalErrors->setChecked(appSettings->getShowExternalNonFatalErrors());
|
m_fatalErrors->setChecked(appSettings->getShowExternalNonFatalErrors());
|
||||||
|
|
||||||
@@ -242,13 +277,16 @@ void QtProjectWizzardContentPreferences::save()
|
|||||||
m_oldColorSchemeIndex = -1;
|
m_oldColorSchemeIndex = -1;
|
||||||
|
|
||||||
float scrollSpeed = m_scrollSpeed->text().toFloat();
|
float scrollSpeed = m_scrollSpeed->text().toFloat();
|
||||||
if (scrollSpeed)
|
if (scrollSpeed) appSettings->setScrollSpeed(scrollSpeed);
|
||||||
{
|
|
||||||
appSettings->setScrollSpeed(scrollSpeed);
|
|
||||||
}
|
|
||||||
|
|
||||||
appSettings->setLoggingEnabled(m_loggingEnabled->isChecked());
|
appSettings->setLoggingEnabled(m_loggingEnabled->isChecked());
|
||||||
|
|
||||||
|
int coatiPort = m_coatiPort->text().toInt();
|
||||||
|
if (coatiPort) appSettings->setCoatiPort(coatiPort);
|
||||||
|
|
||||||
|
int pluginPort = m_pluginPort->text().toInt();
|
||||||
|
if (pluginPort) appSettings->setPluginPort(pluginPort);
|
||||||
|
|
||||||
appSettings->setIndexerThreadCount(m_threads->currentIndex() + 1);
|
appSettings->setIndexerThreadCount(m_threads->currentIndex() + 1);
|
||||||
appSettings->setShowExternalNonFatalErrors(m_fatalErrors->isChecked());
|
appSettings->setShowExternalNonFatalErrors(m_fatalErrors->isChecked());
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,9 @@ private:
|
|||||||
QLineEdit* m_scrollSpeed;
|
QLineEdit* m_scrollSpeed;
|
||||||
QCheckBox* m_loggingEnabled;
|
QCheckBox* m_loggingEnabled;
|
||||||
|
|
||||||
|
QLineEdit* m_coatiPort;
|
||||||
|
QLineEdit* m_pluginPort;
|
||||||
|
|
||||||
QComboBox* m_threads;
|
QComboBox* m_threads;
|
||||||
QCheckBox* m_fatalErrors;
|
QCheckBox* m_fatalErrors;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user