Tidying
This commit is contained in:
@@ -62,16 +62,6 @@ void Insight::startup() {
|
||||
qRegisterMetaType<Bloom::Targets::TargetState>();
|
||||
qRegisterMetaType<std::map<int, Bloom::Targets::TargetPinState>>();
|
||||
|
||||
this->mainWindow.setInsightConfig(this->insightConfig);
|
||||
this->mainWindow.setEnvironmentConfig(this->environmentConfig);
|
||||
|
||||
this->mainWindow.init(
|
||||
this->application,
|
||||
targetDescriptor
|
||||
);
|
||||
|
||||
this->mainWindow.show();
|
||||
|
||||
/*
|
||||
* We can't run our own event loop here - we have to use Qt's event loop. But we still need to be able to
|
||||
* process our events. To address this, we use a QTimer to dispatch our events on an interval.
|
||||
@@ -83,22 +73,32 @@ void Insight::startup() {
|
||||
eventDispatchTimer->start(100);
|
||||
|
||||
// Prepare worker thread
|
||||
auto worker = new InsightWorker(this->eventManager);
|
||||
this->workerThread = new QThread();
|
||||
this->workerThread->setObjectName("IW");
|
||||
worker->moveToThread(this->workerThread);
|
||||
connect(this->workerThread, &QThread::started, worker, &InsightWorker::startup);
|
||||
connect(this->workerThread, &QThread::finished, worker, &QObject::deleteLater);
|
||||
this->insightWorker->moveToThread(this->workerThread);
|
||||
connect(this->workerThread, &QThread::started, this->insightWorker, &InsightWorker::startup);
|
||||
connect(this->workerThread, &QThread::finished, this->insightWorker, &QObject::deleteLater);
|
||||
connect(this->workerThread, &QThread::finished, this->workerThread, &QThread::deleteLater);
|
||||
|
||||
connect(worker, &InsightWorker::targetControllerSuspended, &(this->mainWindow), &InsightWindow::onTargetControllerSuspended);
|
||||
connect(worker, &InsightWorker::targetControllerResumed, &(this->mainWindow), &InsightWindow::onTargetControllerResumed);
|
||||
connect(worker, &InsightWorker::targetStateUpdated, &(this->mainWindow), &InsightWindow::onTargetStateUpdate);
|
||||
connect(worker, &InsightWorker::targetProgramCounterUpdated, &(this->mainWindow), &InsightWindow::onTargetProgramCounterUpdate);
|
||||
connect(worker, &InsightWorker::targetPinStatesUpdated, &(this->mainWindow), &InsightWindow::onTargetPinStatesUpdate);
|
||||
connect(worker, &InsightWorker::targetIoPortsUpdated, &(this->mainWindow), &InsightWindow::onTargetIoPortsUpdate);
|
||||
connect(&(this->mainWindow), &InsightWindow::refreshTargetPinStates, worker, &InsightWorker::requestPinStates);
|
||||
connect(&(this->mainWindow), &InsightWindow::setTargetPinState, worker, &InsightWorker::requestPinStateUpdate);
|
||||
connect(this->insightWorker, &InsightWorker::targetControllerSuspended, &(this->mainWindow), &InsightWindow::onTargetControllerSuspended);
|
||||
connect(this->insightWorker, &InsightWorker::targetControllerResumed, &(this->mainWindow), &InsightWindow::onTargetControllerResumed);
|
||||
connect(this->insightWorker, &InsightWorker::targetStateUpdated, &(this->mainWindow), &InsightWindow::onTargetStateUpdate);
|
||||
connect(this->insightWorker, &InsightWorker::targetProgramCounterUpdated, &(this->mainWindow), &InsightWindow::onTargetProgramCounterUpdate);
|
||||
connect(this->insightWorker, &InsightWorker::targetPinStatesUpdated, &(this->mainWindow), &InsightWindow::onTargetPinStatesUpdate);
|
||||
connect(this->insightWorker, &InsightWorker::targetIoPortsUpdated, &(this->mainWindow), &InsightWindow::onTargetIoPortsUpdate);
|
||||
connect(&(this->mainWindow), &InsightWindow::refreshTargetPinStates, this->insightWorker, &InsightWorker::requestPinStates);
|
||||
connect(&(this->mainWindow), &InsightWindow::setTargetPinState, this->insightWorker, &InsightWorker::requestPinStateUpdate);
|
||||
|
||||
this->mainWindow.setInsightConfig(this->insightConfig);
|
||||
this->mainWindow.setEnvironmentConfig(this->environmentConfig);
|
||||
|
||||
this->mainWindow.init(
|
||||
this->application,
|
||||
*(this->insightWorker),
|
||||
targetDescriptor
|
||||
);
|
||||
|
||||
this->mainWindow.show();
|
||||
}
|
||||
|
||||
void Insight::shutdown() {
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
|
||||
#include <QtCore>
|
||||
#include <QApplication>
|
||||
#include "UserInterfaces/InsightWindow/InsightWindow.hpp"
|
||||
|
||||
#include "src/Helpers/Thread.hpp"
|
||||
#include "src/ApplicationConfig.hpp"
|
||||
#include "src/EventManager/EventManager.hpp"
|
||||
#include "src/EventManager/EventListener.hpp"
|
||||
#include "UserInterfaces/InsightWindow/InsightWindow.hpp"
|
||||
#include "src/TargetController/TargetControllerConsole.hpp"
|
||||
|
||||
namespace Bloom
|
||||
@@ -36,6 +36,7 @@ namespace Bloom
|
||||
EventListenerPointer eventListener = std::make_shared<EventListener>("InsightEventListener");
|
||||
|
||||
QApplication application;
|
||||
InsightWorker* insightWorker = new InsightWorker(this->eventManager);
|
||||
InsightWindow mainWindow;
|
||||
|
||||
TargetControllerConsole targetControllerConsole = TargetControllerConsole(
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include <QtCore>
|
||||
#include <QApplication>
|
||||
|
||||
#include "UserInterfaces/InsightWindow/InsightWindow.hpp"
|
||||
#include "src/Helpers/Thread.hpp"
|
||||
#include "src/ApplicationConfig.hpp"
|
||||
#include "src/EventManager/EventManager.hpp"
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
#include <QEvent>
|
||||
#include <QMouseEvent>
|
||||
|
||||
#include "src/Logger/Logger.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
{
|
||||
class Q_WIDGETS_EXPORT ClickableWidget: public QFrame
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
#include <QScrollArea>
|
||||
#include <QSize>
|
||||
|
||||
#include "src/Logger/Logger.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
{
|
||||
class Q_WIDGETS_EXPORT ExpandingHeightScrollAreaWidget: public QScrollArea
|
||||
@@ -37,8 +35,8 @@ namespace Bloom::Widgets
|
||||
return this->scrollAreaSize();
|
||||
};
|
||||
|
||||
|
||||
public:
|
||||
explicit ExpandingHeightScrollAreaWidget(QWidget* parent): QScrollArea(parent) {};
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
#include <QWidget>
|
||||
#include <QSize>
|
||||
|
||||
#include "src/Logger/Logger.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
{
|
||||
class Q_WIDGETS_EXPORT ExpandingWidget: public QWidget
|
||||
@@ -25,8 +23,8 @@ namespace Bloom::Widgets
|
||||
return this->minimumSizeHint();
|
||||
};
|
||||
|
||||
|
||||
public:
|
||||
explicit ExpandingWidget(QWidget* parent): QWidget(parent) {};
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
#include <QPainter>
|
||||
|
||||
#include "src/Logger/Logger.hpp"
|
||||
|
||||
using namespace Bloom::Widgets;
|
||||
|
||||
void RotatableLabel::paintEvent(QPaintEvent* event) {
|
||||
|
||||
@@ -6,8 +6,6 @@
|
||||
#include <QMouseEvent>
|
||||
#include <QEnterEvent>
|
||||
|
||||
#include "src/Logger/Logger.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
{
|
||||
class Q_WIDGETS_EXPORT SlidingHandleWidget: public QFrame
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include <QString>
|
||||
|
||||
#include "SvgWidget.hpp"
|
||||
#include "src/Logger/Logger.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
{
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
#include <QPainter>
|
||||
#include <cmath>
|
||||
#include "src/Logger/Logger.hpp"
|
||||
|
||||
using namespace Bloom::Widgets;
|
||||
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
#include <QString>
|
||||
#include <QSize>
|
||||
|
||||
#include "src/Logger/Logger.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
{
|
||||
class SvgWidget: public QFrame
|
||||
@@ -63,8 +61,5 @@ namespace Bloom::Widgets
|
||||
return this->angle;
|
||||
}
|
||||
|
||||
// [[nodiscard]] QSize sizeHint() const override {
|
||||
// return QSize(this->containerWidth, this->containerHeight);
|
||||
// };
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user