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);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user