Tidied structure of all classes within the entire code base
Also some other small bits of tidying
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#include "BodyWidget.hpp"
|
||||
|
||||
#include <QPainter>
|
||||
|
||||
#include "BodyWidget.hpp"
|
||||
#include "src/Logger/Logger.hpp"
|
||||
#include "src/Exceptions/Exception.hpp"
|
||||
|
||||
using namespace Bloom::Widgets::InsightTargetWidgets::Dip;
|
||||
|
||||
@@ -6,18 +6,9 @@ namespace Bloom::Widgets::InsightTargetWidgets::Dip
|
||||
{
|
||||
class BodyWidget: public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QColor bodyColor READ getBodyColor WRITE setBodyColor DESIGNABLE true)
|
||||
Q_PROPERTY(int disableAlphaLevel READ getDisableAlphaLevel WRITE setDisableAlphaLevel DESIGNABLE true)
|
||||
|
||||
private:
|
||||
// These properties can be modified via Qt style sheets (see Stylesheets/DualInlinePackage.qss)
|
||||
QColor bodyColor = QColor("#8E8B83");
|
||||
int disableAlphaLevel = 100;
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent* event) override;
|
||||
void drawWidget(QPainter& painter);
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QColor bodyColor READ getBodyColor WRITE setBodyColor DESIGNABLE true)
|
||||
Q_PROPERTY(int disableAlphaLevel READ getDisableAlphaLevel WRITE setDisableAlphaLevel DESIGNABLE true)
|
||||
|
||||
public:
|
||||
explicit BodyWidget(QWidget* parent): QWidget(parent) {
|
||||
@@ -39,5 +30,14 @@ namespace Bloom::Widgets::InsightTargetWidgets::Dip
|
||||
void setDisableAlphaLevel(int level) {
|
||||
this->disableAlphaLevel = level;
|
||||
}
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent* event) override;
|
||||
void drawWidget(QPainter& painter);
|
||||
|
||||
private:
|
||||
// These properties can be modified via Qt style sheets (see Stylesheets/DualInlinePackage.qss)
|
||||
QColor bodyColor = QColor("#8E8B83");
|
||||
int disableAlphaLevel = 100;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -6,10 +6,7 @@
|
||||
#include <QEvent>
|
||||
#include <QFile>
|
||||
|
||||
#include "../../../InsightWindow.hpp"
|
||||
#include "src/Helpers/Paths.hpp"
|
||||
#include "PinWidget.hpp"
|
||||
#include "BodyWidget.hpp"
|
||||
|
||||
using namespace Bloom::Widgets::InsightTargetWidgets::Dip;
|
||||
using namespace Bloom::Exceptions;
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "../TargetPackageWidget.hpp"
|
||||
|
||||
#include "PinWidget.hpp"
|
||||
#include "BodyWidget.hpp"
|
||||
#include "src/Targets/TargetVariant.hpp"
|
||||
@@ -17,12 +18,7 @@ namespace Bloom::Widgets::InsightTargetWidgets::Dip
|
||||
*/
|
||||
class DualInlinePackageWidget: public TargetPackageWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
QVBoxLayout* layout = nullptr;
|
||||
QHBoxLayout* topPinLayout = nullptr;
|
||||
QHBoxLayout* bottomPinLayout = nullptr;
|
||||
BodyWidget* bodyWidget = nullptr;
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DualInlinePackageWidget(
|
||||
@@ -30,5 +26,11 @@ namespace Bloom::Widgets::InsightTargetWidgets::Dip
|
||||
InsightWorker& insightWorker,
|
||||
QWidget* parent
|
||||
);
|
||||
|
||||
private:
|
||||
QVBoxLayout* layout = nullptr;
|
||||
QHBoxLayout* topPinLayout = nullptr;
|
||||
QHBoxLayout* bottomPinLayout = nullptr;
|
||||
BodyWidget* bodyWidget = nullptr;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
#include <QPainter>
|
||||
#include <QLayout>
|
||||
#include <QEvent>
|
||||
#include <QMenu>
|
||||
#include <QContextMenuEvent>
|
||||
|
||||
#include "PinBodyWidget.hpp"
|
||||
|
||||
#include <QPainter>
|
||||
|
||||
#include "src/Logger/Logger.hpp"
|
||||
|
||||
using namespace Bloom::Widgets::InsightTargetWidgets::Dip;
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include <QMouseEvent>
|
||||
#include <utility>
|
||||
#include <QEvent>
|
||||
|
||||
#include "../TargetPinBodyWidget.hpp"
|
||||
|
||||
#include "src/Targets/TargetPinDescriptor.hpp"
|
||||
|
||||
namespace Bloom::Widgets::InsightTargetWidgets::Dip
|
||||
{
|
||||
class PinBodyWidget: public TargetPinBodyWidget
|
||||
{
|
||||
protected:
|
||||
void paintEvent(QPaintEvent* event) override;
|
||||
void drawWidget(QPainter& painter);
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static const int WIDTH = 30;
|
||||
@@ -26,5 +24,9 @@ namespace Bloom::Widgets::InsightTargetWidgets::Dip
|
||||
this->setFixedSize(PinBodyWidget::WIDTH, PinBodyWidget::HEIGHT);
|
||||
this->setObjectName("target-pin-body");
|
||||
}
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent* event) override;
|
||||
void drawWidget(QPainter& painter);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,12 +1,4 @@
|
||||
#include <QWidget>
|
||||
#include <QPainter>
|
||||
#include <QLayout>
|
||||
#include <cmath>
|
||||
#include <QEvent>
|
||||
|
||||
#include "PinWidget.hpp"
|
||||
#include "PinBodyWidget.hpp"
|
||||
#include "src/Logger/Logger.hpp"
|
||||
|
||||
using namespace Bloom::Widgets::InsightTargetWidgets::Dip;
|
||||
using namespace Bloom::Targets;
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include <QVBoxLayout>
|
||||
#include <QLabel>
|
||||
|
||||
#include "../TargetPinWidget.hpp"
|
||||
|
||||
#include "PinBodyWidget.hpp"
|
||||
#include "src/Targets/TargetVariant.hpp"
|
||||
|
||||
@@ -11,20 +13,7 @@ namespace Bloom::Widgets::InsightTargetWidgets::Dip
|
||||
{
|
||||
class PinWidget: public TargetPinWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
QVBoxLayout* layout = nullptr;
|
||||
QLabel* pinNumberLabel = nullptr;
|
||||
QLabel* pinNameLabel = nullptr;
|
||||
QLabel* pinDirectionLabel = nullptr;
|
||||
PinBodyWidget* bodyWidget = nullptr;
|
||||
|
||||
void setLabelColor(const QString& hexColor) {
|
||||
auto style = QString("QLabel { color: " + hexColor + "; }");
|
||||
if (this->pinNameLabel != nullptr) {
|
||||
this->pinNameLabel->setStyleSheet(style);
|
||||
}
|
||||
}
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static const int MINIMUM_WIDTH = 30;
|
||||
@@ -59,5 +48,19 @@ namespace Bloom::Widgets::InsightTargetWidgets::Dip
|
||||
|
||||
this->setLabelColor(this->pinStateChanged ? "#4d7bba" : "#a6a7aa");
|
||||
}
|
||||
|
||||
private:
|
||||
QVBoxLayout* layout = nullptr;
|
||||
QLabel* pinNumberLabel = nullptr;
|
||||
QLabel* pinNameLabel = nullptr;
|
||||
QLabel* pinDirectionLabel = nullptr;
|
||||
PinBodyWidget* bodyWidget = nullptr;
|
||||
|
||||
void setLabelColor(const QString& hexColor) {
|
||||
auto style = QString("QLabel { color: " + hexColor + "; }");
|
||||
if (this->pinNameLabel != nullptr) {
|
||||
this->pinNameLabel->setStyleSheet(style);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include <QPainter>
|
||||
|
||||
#include "BodyWidget.hpp"
|
||||
#include "src/Logger/Logger.hpp"
|
||||
|
||||
#include <QPainter>
|
||||
|
||||
using namespace Bloom::Widgets::InsightTargetWidgets::Qfp;
|
||||
|
||||
|
||||
@@ -6,18 +6,9 @@ namespace Bloom::Widgets::InsightTargetWidgets::Qfp
|
||||
{
|
||||
class BodyWidget: public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QColor bodyColor READ getBodyColor WRITE setBodyColor DESIGNABLE true)
|
||||
Q_PROPERTY(int disableAlphaLevel READ getDisableAlphaLevel WRITE setDisableAlphaLevel DESIGNABLE true)
|
||||
|
||||
private:
|
||||
// These properties can be modified via Qt style sheets (see Stylesheets/QuadFlatPackage.qss)
|
||||
QColor bodyColor = QColor("#8E8B83");
|
||||
int disableAlphaLevel = 100;
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent* event) override;
|
||||
void drawWidget(QPainter& painter);
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QColor bodyColor READ getBodyColor WRITE setBodyColor DESIGNABLE true)
|
||||
Q_PROPERTY(int disableAlphaLevel READ getDisableAlphaLevel WRITE setDisableAlphaLevel DESIGNABLE true)
|
||||
|
||||
public:
|
||||
explicit BodyWidget(QWidget* parent): QWidget(parent) {
|
||||
@@ -39,5 +30,14 @@ namespace Bloom::Widgets::InsightTargetWidgets::Qfp
|
||||
void setDisableAlphaLevel(int level) {
|
||||
this->disableAlphaLevel = level;
|
||||
}
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent* event) override;
|
||||
void drawWidget(QPainter& painter);
|
||||
|
||||
private:
|
||||
// These properties can be modified via Qt style sheets (see Stylesheets/QuadFlatPackage.qss)
|
||||
QColor bodyColor = QColor("#8E8B83");
|
||||
int disableAlphaLevel = 100;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#include "PinBodyWidget.hpp"
|
||||
|
||||
#include <QPainter>
|
||||
#include <QEvent>
|
||||
|
||||
#include "PinBodyWidget.hpp"
|
||||
|
||||
using namespace Bloom::Widgets::InsightTargetWidgets::Qfp;
|
||||
using namespace Bloom::Targets;
|
||||
|
||||
|
||||
@@ -5,18 +5,14 @@
|
||||
#include <utility>
|
||||
|
||||
#include "../TargetPinBodyWidget.hpp"
|
||||
|
||||
#include "src/Targets/TargetPinDescriptor.hpp"
|
||||
|
||||
namespace Bloom::Widgets::InsightTargetWidgets::Qfp
|
||||
{
|
||||
class PinBodyWidget: public TargetPinBodyWidget
|
||||
{
|
||||
private:
|
||||
bool isVertical = false;
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent* event) override;
|
||||
void drawWidget(QPainter& painter);
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static const int WIDTH = 30;
|
||||
@@ -33,5 +29,12 @@ namespace Bloom::Widgets::InsightTargetWidgets::Qfp
|
||||
this->setFixedSize(PinBodyWidget::HEIGHT, PinBodyWidget::WIDTH);
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent* event) override;
|
||||
void drawWidget(QPainter& painter);
|
||||
|
||||
private:
|
||||
bool isVertical = false;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
#include "PinWidget.hpp"
|
||||
#include "PinBodyWidget.hpp"
|
||||
#include "src/Logger/Logger.hpp"
|
||||
|
||||
using namespace Bloom::Widgets::InsightTargetWidgets::Qfp;
|
||||
using namespace Bloom::Targets;
|
||||
|
||||
@@ -12,20 +12,7 @@ namespace Bloom::Widgets::InsightTargetWidgets::Qfp
|
||||
{
|
||||
class PinWidget: public TargetPinWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
QBoxLayout* layout = nullptr;
|
||||
QLabel* pinNumberLabel = nullptr;
|
||||
QLabel* pinNameLabel = nullptr;
|
||||
QLabel* pinDirectionLabel = nullptr;
|
||||
PinBodyWidget* bodyWidget = nullptr;
|
||||
|
||||
bool isLeftLayout = false;
|
||||
bool isBottomLayout = false;
|
||||
bool isRightLayout = false;
|
||||
bool isTopLayout = false;
|
||||
|
||||
void setLabelColor(const QString& hexColor);
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static const int PIN_WIDGET_LAYOUT_PADDING = 46;
|
||||
@@ -49,5 +36,19 @@ namespace Bloom::Widgets::InsightTargetWidgets::Qfp
|
||||
);
|
||||
|
||||
void updatePinState(const Targets::TargetPinState& pinState) override;
|
||||
|
||||
private:
|
||||
QBoxLayout* layout = nullptr;
|
||||
QLabel* pinNumberLabel = nullptr;
|
||||
QLabel* pinNameLabel = nullptr;
|
||||
QLabel* pinDirectionLabel = nullptr;
|
||||
PinBodyWidget* bodyWidget = nullptr;
|
||||
|
||||
bool isLeftLayout = false;
|
||||
bool isBottomLayout = false;
|
||||
bool isRightLayout = false;
|
||||
bool isTopLayout = false;
|
||||
|
||||
void setLabelColor(const QString& hexColor);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include <QEvent>
|
||||
#include <QFile>
|
||||
|
||||
#include "../../../InsightWindow.hpp"
|
||||
#include "src/Helpers/Paths.hpp"
|
||||
#include "PinWidget.hpp"
|
||||
#include "BodyWidget.hpp"
|
||||
|
||||
@@ -17,7 +17,15 @@ namespace Bloom::Widgets::InsightTargetWidgets::Qfp
|
||||
*/
|
||||
class QuadFlatPackageWidget: public TargetPackageWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QuadFlatPackageWidget(
|
||||
const Targets::TargetVariant& targetVariant,
|
||||
InsightWorker& insightWorker,
|
||||
QWidget* parent
|
||||
);
|
||||
|
||||
private:
|
||||
QVBoxLayout* layout = nullptr;
|
||||
QHBoxLayout* horizontalLayout = nullptr;
|
||||
@@ -26,12 +34,5 @@ namespace Bloom::Widgets::InsightTargetWidgets::Qfp
|
||||
QHBoxLayout* bottomPinLayout = nullptr;
|
||||
QVBoxLayout* leftPinLayout = nullptr;
|
||||
BodyWidget* bodyWidget = nullptr;
|
||||
|
||||
public:
|
||||
QuadFlatPackageWidget(
|
||||
const Targets::TargetVariant& targetVariant,
|
||||
InsightWorker& insightWorker,
|
||||
QWidget* parent
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -18,18 +18,7 @@ namespace Bloom::Widgets::InsightTargetWidgets
|
||||
*/
|
||||
class TargetPackageWidget: public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
protected:
|
||||
Targets::TargetVariant targetVariant;
|
||||
InsightWorker& insightWorker;
|
||||
std::vector<TargetPinWidget*> pinWidgets;
|
||||
|
||||
Targets::TargetState targetState = Targets::TargetState::UNKNOWN;
|
||||
|
||||
protected slots:
|
||||
virtual void updatePinStates(const Targets::TargetPinStateMappingType& pinStatesByNumber);
|
||||
void onTargetStateChanged(Targets::TargetState newState);
|
||||
void onRegistersWritten(Targets::TargetRegisters targetRegisters);
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TargetPackageWidget(Targets::TargetVariant targetVariant, InsightWorker& insightWorker, QWidget* parent);
|
||||
@@ -46,5 +35,17 @@ namespace Bloom::Widgets::InsightTargetWidgets
|
||||
QSize minimumSizeHint() const override {
|
||||
return this->sizeHint();
|
||||
}
|
||||
|
||||
protected:
|
||||
Targets::TargetVariant targetVariant;
|
||||
InsightWorker& insightWorker;
|
||||
std::vector<TargetPinWidget*> pinWidgets;
|
||||
|
||||
Targets::TargetState targetState = Targets::TargetState::UNKNOWN;
|
||||
|
||||
protected slots:
|
||||
virtual void updatePinStates(const Targets::TargetPinStateMappingType& pinStatesByNumber);
|
||||
void onTargetStateChanged(Targets::TargetState newState);
|
||||
void onRegistersWritten(Targets::TargetRegisters targetRegisters);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -7,6 +7,14 @@ using namespace Bloom::Widgets::InsightTargetWidgets;
|
||||
|
||||
TargetPackageWidgetContainer::TargetPackageWidgetContainer(QWidget* parent): QWidget(parent) {}
|
||||
|
||||
void TargetPackageWidgetContainer::setPackageWidget(TargetPackageWidget* packageWidget) {
|
||||
this->packageWidget = packageWidget;
|
||||
|
||||
if (packageWidget != nullptr) {
|
||||
this->layout()->addWidget(packageWidget);
|
||||
}
|
||||
}
|
||||
|
||||
void TargetPackageWidgetContainer::resizeEvent(QResizeEvent* event) {
|
||||
if (this->packageWidget == nullptr) {
|
||||
return;
|
||||
@@ -20,11 +28,3 @@ void TargetPackageWidgetContainer::resizeEvent(QResizeEvent* event) {
|
||||
packageSize.height()
|
||||
);
|
||||
}
|
||||
|
||||
void TargetPackageWidgetContainer::setPackageWidget(TargetPackageWidget* packageWidget) {
|
||||
this->packageWidget = packageWidget;
|
||||
|
||||
if (packageWidget != nullptr) {
|
||||
this->layout()->addWidget(packageWidget);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,16 +9,17 @@ namespace Bloom::Widgets::InsightTargetWidgets
|
||||
{
|
||||
class TargetPackageWidgetContainer: public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
TargetPackageWidget* packageWidget = nullptr;
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent* event) override;
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TargetPackageWidgetContainer(QWidget* parent);
|
||||
|
||||
void setPackageWidget(TargetPackageWidget* packageWidget);
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent* event) override;
|
||||
|
||||
private:
|
||||
TargetPackageWidget* packageWidget = nullptr;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -5,28 +5,6 @@
|
||||
using namespace Bloom::Widgets::InsightTargetWidgets;
|
||||
using namespace Bloom::Targets;
|
||||
|
||||
bool TargetPinBodyWidget::event(QEvent* event) {
|
||||
if (this->pinState.has_value() && this->pinState->ioDirection == TargetPinState::IoDirection::OUTPUT) {
|
||||
switch (event->type()) {
|
||||
case QEvent::Enter: {
|
||||
this->hoverActive = true;
|
||||
this->repaint();
|
||||
break;
|
||||
}
|
||||
case QEvent::Leave: {
|
||||
this->hoverActive = false;
|
||||
this->repaint();
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return QWidget::event(event);
|
||||
}
|
||||
|
||||
QColor TargetPinBodyWidget::getBodyColor() {
|
||||
auto pinColor = this->defaultBodyColor;
|
||||
|
||||
@@ -65,3 +43,25 @@ QColor TargetPinBodyWidget::getBodyColor() {
|
||||
|
||||
return pinColor;
|
||||
}
|
||||
|
||||
bool TargetPinBodyWidget::event(QEvent* event) {
|
||||
if (this->pinState.has_value() && this->pinState->ioDirection == TargetPinState::IoDirection::OUTPUT) {
|
||||
switch (event->type()) {
|
||||
case QEvent::Enter: {
|
||||
this->hoverActive = true;
|
||||
this->repaint();
|
||||
break;
|
||||
}
|
||||
case QEvent::Leave: {
|
||||
this->hoverActive = false;
|
||||
this->repaint();
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return QWidget::event(event);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Bloom::Widgets::InsightTargetWidgets
|
||||
{
|
||||
class TargetPinBodyWidget: public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
/*
|
||||
* Pin body colors can be set in QSS files.
|
||||
*/
|
||||
@@ -23,38 +23,12 @@ namespace Bloom::Widgets::InsightTargetWidgets
|
||||
|
||||
Q_PROPERTY(int disableAlphaLevel READ getDisableAlphaLevel WRITE setDisableAlphaLevel DESIGNABLE true)
|
||||
|
||||
protected:
|
||||
Targets::TargetPinDescriptor pinDescriptor;
|
||||
std::optional<Targets::TargetPinState> pinState;
|
||||
|
||||
bool hoverActive = false;
|
||||
|
||||
QColor defaultBodyColor = QColor("#908D85");
|
||||
QColor vccBodyColor = QColor("#70383A");
|
||||
QColor gndBodyColor = QColor("#484A4B");
|
||||
QColor outputHighBodyColor = QColor("#3C5E62");
|
||||
QColor inputHighBodyColor = QColor("#7B5E38");
|
||||
|
||||
int disableAlphaLevel = 100;
|
||||
|
||||
bool event(QEvent* event) override;
|
||||
|
||||
void mouseReleaseEvent(QMouseEvent* event) override {
|
||||
if (event->button() == Qt::MouseButton::LeftButton) {
|
||||
emit this->clicked();
|
||||
}
|
||||
|
||||
QWidget::mouseReleaseEvent(event);
|
||||
}
|
||||
|
||||
public:
|
||||
TargetPinBodyWidget(QWidget* parent, Targets::TargetPinDescriptor pinDescriptor):
|
||||
QWidget(parent), pinDescriptor(std::move(pinDescriptor)) {
|
||||
this->setObjectName("target-pin-body");
|
||||
}
|
||||
|
||||
QColor getBodyColor();
|
||||
|
||||
void setPinState(const Targets::TargetPinState& pinState) {
|
||||
this->pinState = pinState;
|
||||
}
|
||||
@@ -109,5 +83,31 @@ namespace Bloom::Widgets::InsightTargetWidgets
|
||||
|
||||
signals:
|
||||
void clicked();
|
||||
|
||||
protected:
|
||||
Targets::TargetPinDescriptor pinDescriptor;
|
||||
std::optional<Targets::TargetPinState> pinState;
|
||||
|
||||
bool hoverActive = false;
|
||||
|
||||
QColor defaultBodyColor = QColor("#908D85");
|
||||
QColor vccBodyColor = QColor("#70383A");
|
||||
QColor gndBodyColor = QColor("#484A4B");
|
||||
QColor outputHighBodyColor = QColor("#3C5E62");
|
||||
QColor inputHighBodyColor = QColor("#7B5E38");
|
||||
|
||||
int disableAlphaLevel = 100;
|
||||
|
||||
QColor getBodyColor();
|
||||
|
||||
bool event(QEvent* event) override;
|
||||
|
||||
void mouseReleaseEvent(QMouseEvent* event) override {
|
||||
if (event->button() == Qt::MouseButton::LeftButton) {
|
||||
emit this->clicked();
|
||||
}
|
||||
|
||||
QWidget::mouseReleaseEvent(event);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -11,14 +11,7 @@ namespace Bloom::Widgets::InsightTargetWidgets
|
||||
{
|
||||
class TargetPinWidget: public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
protected:
|
||||
InsightWorker& insightWorker;
|
||||
|
||||
Targets::TargetVariant targetVariant;
|
||||
Targets::TargetPinDescriptor pinDescriptor;
|
||||
std::optional<Targets::TargetPinState> pinState;
|
||||
bool pinStateChanged = false;
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TargetPinWidget(
|
||||
@@ -42,5 +35,13 @@ namespace Bloom::Widgets::InsightTargetWidgets
|
||||
|
||||
public slots:
|
||||
virtual void onWidgetBodyClicked();
|
||||
|
||||
protected:
|
||||
InsightWorker& insightWorker;
|
||||
|
||||
Targets::TargetVariant targetVariant;
|
||||
Targets::TargetPinDescriptor pinDescriptor;
|
||||
std::optional<Targets::TargetPinState> pinState;
|
||||
bool pinStateChanged = false;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user