mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-09-13 20:23:04 +02:00
Merge pull request #266 from qelectrotech/terminal_strip
Terminal strip
This commit is contained in:
commit
0a7964209a
@ -126,7 +126,9 @@ INCLUDEPATH += sources/ui
|
||||
# sources/print
|
||||
|
||||
# Fichiers sources
|
||||
HEADERS += $$files(sources/*.h) $$files(sources/ui/*.h) \
|
||||
HEADERS += $$files(sources/*.h) \
|
||||
$$files(sources/project/*.h) \
|
||||
$$files(sources/ui/*.h) \
|
||||
$$files(sources/editor/*.h) \
|
||||
$$files(sources/titleblock/*.h) \
|
||||
$$files(sources/richtext/*.h) \
|
||||
@ -159,13 +161,16 @@ HEADERS += $$files(sources/*.h) $$files(sources/ui/*.h) \
|
||||
$$files(sources/print/*.h) \
|
||||
$$files(sources/TerminalStrip/*.h) \
|
||||
$$files(sources/TerminalStrip/ui/*.h) \
|
||||
$$files(sources/TerminalStrip/ui/ConfigPage/*h) \
|
||||
$$files(sources/TerminalStrip/UndoCommand/*.h) \
|
||||
$$files(sources/TerminalStrip/GraphicsItem/*.h) \
|
||||
$$files(sources/TerminalStrip/GraphicsItem/properties/*.h) \
|
||||
$$files(sources/xml/*.h) \
|
||||
$$files(sources/dxf/*.h)
|
||||
|
||||
SOURCES += $$files(sources/*.cpp) \
|
||||
$$files(sources/editor/*.cpp) \
|
||||
$$files(sources/project/*.cpp) \
|
||||
$$files(sources/titleblock/*.cpp) \
|
||||
$$files(sources/richtext/*.cpp) \
|
||||
$$files(sources/ui/*.cpp) \
|
||||
@ -198,8 +203,10 @@ SOURCES += $$files(sources/*.cpp) \
|
||||
$$files(sources/print/*.cpp) \
|
||||
$$files(sources/TerminalStrip/*.cpp) \
|
||||
$$files(sources/TerminalStrip/ui/*.cpp) \
|
||||
$$files(sources/TerminalStrip/ui/ConfigPage/*cpp) \
|
||||
$$files(sources/TerminalStrip/UndoCommand/*.cpp) \
|
||||
$$files(sources/TerminalStrip/GraphicsItem/*.cpp) \
|
||||
$$files(sources/TerminalStrip/GraphicsItem/properties/*.cpp) \
|
||||
$$files(sources/xml/*.cpp) \
|
||||
$$files(sources/dxf/*.cpp)
|
||||
|
||||
@ -231,7 +238,8 @@ FORMS += $$files(sources/richtext/*.ui) \
|
||||
$$files(sources/dataBase/ui/*.ui) \
|
||||
$$files(sources/factory/ui/*.ui) \
|
||||
$$files(sources/print/*.ui) \
|
||||
$$files(sources/TerminalStrip/ui/*.ui)
|
||||
$$files(sources/TerminalStrip/ui/*.ui) \
|
||||
$$files(sources/TerminalStrip/ui/ConfigPage/*.ui)
|
||||
|
||||
UI_SOURCES_DIR = sources/ui/
|
||||
UI_HEADERS_DIR = sources/ui/
|
||||
|
142
sources/TerminalStrip/GraphicsItem/demoterminalstrip.cpp
Normal file
142
sources/TerminalStrip/GraphicsItem/demoterminalstrip.cpp
Normal file
@ -0,0 +1,142 @@
|
||||
/*
|
||||
Copyright 2006-2023 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "demoterminalstrip.h"
|
||||
|
||||
namespace TerminalStripDrawer
|
||||
{
|
||||
|
||||
/*========= DemoBridge =========*/
|
||||
class DemoBridge : public AbstractBridgeInterface
|
||||
{
|
||||
public:
|
||||
DemoBridge(const QUuid &uuid) :
|
||||
m_uuid { uuid } {}
|
||||
|
||||
QUuid uuid() const override {
|
||||
return m_uuid;
|
||||
}
|
||||
|
||||
private:
|
||||
const QUuid m_uuid;
|
||||
};
|
||||
|
||||
class DemoRealTerminal : public AbstractRealTerminalInterface
|
||||
{
|
||||
public:
|
||||
DemoRealTerminal(const QString &label, const QUuid &bridge) :
|
||||
m_label { label },
|
||||
m_bridge { bridge }
|
||||
{}
|
||||
|
||||
QString label() const override {
|
||||
return m_label;
|
||||
}
|
||||
|
||||
bool isBridged() const override {
|
||||
return true;
|
||||
}
|
||||
|
||||
DemoBridge *bridge() const override {
|
||||
return new DemoBridge { m_bridge };
|
||||
}
|
||||
|
||||
private:
|
||||
QString m_label;
|
||||
QUuid m_bridge;
|
||||
};
|
||||
|
||||
class DemoPhysicalTerminal : public AbstractPhysicalTerminalInterface
|
||||
{
|
||||
public:
|
||||
DemoPhysicalTerminal(QVector<QSharedPointer<AbstractRealTerminalInterface>> real_terminals) :
|
||||
m_real_terminals { real_terminals}
|
||||
{}
|
||||
|
||||
QVector<QSharedPointer<AbstractRealTerminalInterface>> realTerminals() const override {
|
||||
return m_real_terminals;
|
||||
}
|
||||
|
||||
private:
|
||||
QVector<QSharedPointer<AbstractRealTerminalInterface>> m_real_terminals;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*========= DemoTerminalStrip =========*/
|
||||
|
||||
/**
|
||||
* @brief DemoTerminalStrip::DemoTerminalStrip
|
||||
*/
|
||||
DemoTerminalStrip::DemoTerminalStrip()
|
||||
{
|
||||
build();
|
||||
}
|
||||
|
||||
QVector<QSharedPointer<AbstractPhysicalTerminalInterface> > DemoTerminalStrip::physicalTerminal() const
|
||||
{
|
||||
return m_physical_terminal;
|
||||
}
|
||||
|
||||
void DemoTerminalStrip::build()
|
||||
{
|
||||
QUuid lvl_1 = QUuid::createUuid();
|
||||
QUuid lvl_2 = QUuid::createUuid();
|
||||
QUuid lvl_3 = QUuid::createUuid();
|
||||
|
||||
QVector <QSharedPointer<AbstractRealTerminalInterface>> real_terminals_vector;
|
||||
|
||||
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
|
||||
new DemoRealTerminal( QStringLiteral("24vdc"),
|
||||
lvl_1)};
|
||||
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
|
||||
new DemoRealTerminal( QStringLiteral("0vdc"),
|
||||
lvl_2)};
|
||||
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
|
||||
new DemoRealTerminal( QStringLiteral("signal"),
|
||||
lvl_3)};
|
||||
m_physical_terminal << QSharedPointer<AbstractPhysicalTerminalInterface> {
|
||||
new DemoPhysicalTerminal {real_terminals_vector}};
|
||||
|
||||
real_terminals_vector.clear();
|
||||
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
|
||||
new DemoRealTerminal( QStringLiteral("24vdc"),
|
||||
lvl_1)};
|
||||
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
|
||||
new DemoRealTerminal( QStringLiteral("0vdc"),
|
||||
lvl_2)};
|
||||
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
|
||||
new DemoRealTerminal( QStringLiteral("signal"),
|
||||
lvl_3)};
|
||||
m_physical_terminal << QSharedPointer<AbstractPhysicalTerminalInterface> {
|
||||
new DemoPhysicalTerminal {real_terminals_vector}};
|
||||
|
||||
real_terminals_vector.clear();
|
||||
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
|
||||
new DemoRealTerminal( QStringLiteral("24vdc"),
|
||||
lvl_1)};
|
||||
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
|
||||
new DemoRealTerminal( QStringLiteral("0vdc"),
|
||||
lvl_2)};
|
||||
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
|
||||
new DemoRealTerminal( QStringLiteral("signal"),
|
||||
lvl_3)};
|
||||
m_physical_terminal << QSharedPointer<AbstractPhysicalTerminalInterface> {
|
||||
new DemoPhysicalTerminal {real_terminals_vector}};
|
||||
}
|
||||
|
||||
}
|
50
sources/TerminalStrip/GraphicsItem/demoterminalstrip.h
Normal file
50
sources/TerminalStrip/GraphicsItem/demoterminalstrip.h
Normal file
@ -0,0 +1,50 @@
|
||||
/*
|
||||
Copyright 2006-2023 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef DEMOTERMINALSTRIP_H
|
||||
#define DEMOTERMINALSTRIP_H
|
||||
|
||||
#include "terminalstripdrawer.h"
|
||||
|
||||
namespace TerminalStripDrawer {
|
||||
|
||||
class DemoTerminalStrip : public AbstractTerminalStripInterface
|
||||
{
|
||||
public:
|
||||
DemoTerminalStrip();
|
||||
|
||||
QString installation() const override {
|
||||
return QStringLiteral("=INST");
|
||||
}
|
||||
QString location() const override {
|
||||
return QStringLiteral("+LOC" );
|
||||
}
|
||||
QString name() const override {
|
||||
return QStringLiteral("X1");
|
||||
}
|
||||
QVector<QSharedPointer<AbstractPhysicalTerminalInterface>> physicalTerminal() const override;
|
||||
|
||||
private:
|
||||
void build();
|
||||
|
||||
private:
|
||||
QVector<QSharedPointer<AbstractPhysicalTerminalInterface>> m_physical_terminal;
|
||||
};
|
||||
|
||||
} //End namespace TerminalStripDrawer
|
||||
|
||||
#endif // DEMOTERMINALSTRIP_H
|
@ -18,10 +18,11 @@
|
||||
#ifndef TERMINALSTRIPLAYOUTPATTERN_H
|
||||
#define TERMINALSTRIPLAYOUTPATTERN_H
|
||||
|
||||
#include <QRect>
|
||||
#include <QSize>
|
||||
#include <QTextOption>
|
||||
#include <QUuid>
|
||||
#include <QVector>
|
||||
#include <QRect>
|
||||
|
||||
/**
|
||||
* @brief The TerminalStripLayoutPattern class
|
||||
@ -82,6 +83,9 @@ class TerminalStripLayoutPattern
|
||||
int m_bridge_point_d{5};
|
||||
QVector<int> m_bridge_point_y_offset{50,70,90,110};
|
||||
|
||||
QUuid m_uuid{QUuid::createUuid()};
|
||||
QString m_name;
|
||||
|
||||
private:
|
||||
void updateHeaderTextOption();
|
||||
void updateTerminalsTextOption();
|
@ -0,0 +1,32 @@
|
||||
/*
|
||||
Copyright 2006-2023 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "terminalstriplayoutshandler.h"
|
||||
|
||||
#include <QObject>
|
||||
|
||||
TerminalStripLayoutsHandler::TerminalStripLayoutsHandler()
|
||||
{
|
||||
|
||||
m_default_layout = QSharedPointer<TerminalStripLayoutPattern>::create();
|
||||
m_default_layout->m_name = QObject::tr("Disposition par défaut");
|
||||
}
|
||||
|
||||
QSharedPointer<TerminalStripLayoutPattern> TerminalStripLayoutsHandler::defaultLayout()
|
||||
{
|
||||
return m_default_layout;
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
Copyright 2006-2023 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef TERMINALSTRIPLAYOUTSHANDLER_H
|
||||
#define TERMINALSTRIPLAYOUTSHANDLER_H
|
||||
|
||||
#include <QSet>
|
||||
#include <QSharedPointer>
|
||||
|
||||
#include "terminalstriplayoutpattern.h"
|
||||
|
||||
/**
|
||||
* @brief The TerminalStripLayoutsHandler class
|
||||
* Manage and provide TerminalStripLayoutPattern
|
||||
*/
|
||||
class TerminalStripLayoutsHandler
|
||||
{
|
||||
public:
|
||||
TerminalStripLayoutsHandler();
|
||||
QSharedPointer<TerminalStripLayoutPattern> defaultLayout();
|
||||
|
||||
private:
|
||||
QSet<QSharedPointer<TerminalStripLayoutPattern>> m_layout_set;
|
||||
QSharedPointer<TerminalStripLayoutPattern> m_default_layout;
|
||||
};
|
||||
|
||||
#endif // TERMINALSTRIPLAYOUTSHANDLER_H
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2022 The QElectroTech Team
|
||||
Copyright 2006-2023 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@ -18,23 +18,22 @@
|
||||
#include "terminalstripdrawer.h"
|
||||
#include <QPainter>
|
||||
|
||||
#include "../physicalterminal.h"
|
||||
#include "../realterminal.h"
|
||||
#include "../terminalstrip.h"
|
||||
#include "../terminalstripbridge.h"
|
||||
namespace TerminalStripDrawer {
|
||||
|
||||
/**
|
||||
* @brief TerminalStripDrawer::TerminalStripDrawer
|
||||
* @param strip
|
||||
* @param pattern
|
||||
*/
|
||||
TerminalStripDrawer::TerminalStripDrawer(QPointer<TerminalStrip> strip) :
|
||||
m_strip(strip)
|
||||
TerminalStripDrawer::TerminalStripDrawer(QSharedPointer<AbstractTerminalStripInterface> strip,
|
||||
QSharedPointer<TerminalStripLayoutPattern> layout) :
|
||||
m_strip { strip },
|
||||
m_pattern { layout }
|
||||
{}
|
||||
|
||||
void TerminalStripDrawer::setStrip(TerminalStrip *strip)
|
||||
void TerminalStripDrawer::setStrip(QSharedPointer<AbstractTerminalStripInterface> strip)
|
||||
{
|
||||
m_strip = strip;
|
||||
m_strip = strip;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -43,7 +42,7 @@ void TerminalStripDrawer::setStrip(TerminalStrip *strip)
|
||||
*/
|
||||
void TerminalStripDrawer::paint(QPainter *painter)
|
||||
{
|
||||
if (m_strip)
|
||||
if (m_strip && m_pattern)
|
||||
{
|
||||
//To draw text, QPainter need a Qrect. Instead of create an instance
|
||||
//for each text, we re-use the same instance of QRect.
|
||||
@ -60,43 +59,51 @@ void TerminalStripDrawer::paint(QPainter *painter)
|
||||
painter->setPen(pen_);
|
||||
painter->setBrush(brush_);
|
||||
|
||||
if (m_debug_draw)
|
||||
{
|
||||
painter->save();
|
||||
painter->setPen(Qt::blue);
|
||||
painter->drawRect(boundingRect());
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
//Draw header
|
||||
painter->drawRect(m_pattern.m_header_rect);
|
||||
painter->drawRect(m_pattern->m_header_rect);
|
||||
|
||||
//Draw the header text
|
||||
painter->save();
|
||||
|
||||
if (m_pattern.m_header_text_orientation == Qt::Horizontal)
|
||||
if (m_pattern->m_header_text_orientation == Qt::Horizontal)
|
||||
{
|
||||
text_rect.setRect(0,m_pattern.m_header_rect.y(),m_pattern.m_header_rect.width(),m_pattern.m_header_rect.height());
|
||||
text_rect.setRect(0,m_pattern->m_header_rect.y(),m_pattern->m_header_rect.width(),m_pattern->m_header_rect.height());
|
||||
}
|
||||
else
|
||||
{
|
||||
painter->translate(m_pattern.m_header_rect.bottomLeft());
|
||||
painter->translate(m_pattern->m_header_rect.bottomLeft());
|
||||
painter->rotate(270);
|
||||
text_rect.setRect(0,0,m_pattern.m_header_rect.height(),m_pattern.m_header_rect.width());
|
||||
text_rect.setRect(0,0,m_pattern->m_header_rect.height(),m_pattern->m_header_rect.width());
|
||||
}
|
||||
|
||||
const auto text_{m_strip->installation() + " " + m_strip->location() + " " + m_strip->name()};
|
||||
painter->drawText(text_rect, text_, m_pattern.headerTextOption());
|
||||
painter->drawText(text_rect, text_, m_pattern->headerTextOption());
|
||||
painter->restore();
|
||||
|
||||
//Move painter pos to next drawing
|
||||
painter->translate(m_pattern.m_header_rect.width(),0);
|
||||
painter->translate(m_pattern->m_header_rect.width(),0);
|
||||
|
||||
int x_offset{m_pattern.m_header_rect.width()};
|
||||
int x_offset{m_pattern->m_header_rect.width()};
|
||||
|
||||
//Draw spacer
|
||||
painter->drawRect(m_pattern.m_spacer_rect);
|
||||
painter->drawRect(m_pattern->m_spacer_rect);
|
||||
//Move painter pos to next drawing
|
||||
painter->translate(m_pattern.m_spacer_rect.width(),0);
|
||||
x_offset += m_pattern.m_spacer_rect.width();
|
||||
painter->translate(m_pattern->m_spacer_rect.width(),0);
|
||||
x_offset += m_pattern->m_spacer_rect.width();
|
||||
|
||||
|
||||
//Draw terminals
|
||||
const auto terminals_text_rect{m_pattern.m_terminals_text_rect};
|
||||
const auto terminals_text_orientation{m_pattern.m_terminals_text_orientation};
|
||||
const auto terminals_text_option{m_pattern.terminalsTextOption()};
|
||||
const auto terminals_text_rect{m_pattern->m_terminals_text_rect};
|
||||
const auto terminals_text_orientation{m_pattern->m_terminals_text_orientation};
|
||||
const auto terminals_text_option{m_pattern->terminalsTextOption()};
|
||||
QRect terminal_rect;
|
||||
|
||||
QHash<QUuid, QVector<QPointF>> bridges_anchor_points;
|
||||
@ -105,8 +112,8 @@ void TerminalStripDrawer::paint(QPainter *painter)
|
||||
for (const auto &physical_t : m_strip->physicalTerminal())
|
||||
{
|
||||
//Get the good offset according to how many level have the current physical terminal
|
||||
const QVector<QSharedPointer<RealTerminal>> real_terminal{physical_t->realTerminals()};
|
||||
const auto real_t_count{real_terminal.size()};
|
||||
const QVector<QSharedPointer<AbstractRealTerminalInterface>> real_terminal_vector{physical_t->realTerminals()};
|
||||
const auto real_t_count{real_terminal_vector.size()};
|
||||
const auto offset_{4 - real_t_count};
|
||||
|
||||
//Loop over real terminals
|
||||
@ -117,9 +124,26 @@ void TerminalStripDrawer::paint(QPainter *painter)
|
||||
break;
|
||||
}
|
||||
|
||||
terminal_rect = m_pattern.m_terminal_rect[index_];
|
||||
terminal_rect = m_pattern->m_terminal_rect[index_];
|
||||
//Draw terminal rect
|
||||
painter->drawRect(terminal_rect);
|
||||
//Draw a stronger line if the current terminal have level
|
||||
//and the current level is the first
|
||||
if (real_t_count > 1 && i == 0)
|
||||
{
|
||||
painter->save();
|
||||
pen_ = painter->pen();
|
||||
pen_.setWidth(4);
|
||||
pen_.setCapStyle(Qt::FlatCap);
|
||||
painter->setPen(pen_);
|
||||
const auto p1 { terminal_rect.topLeft() };
|
||||
//We can't use terminal_rect.bottomLeft for p2 because
|
||||
//the returned value deviate from the true value
|
||||
//(see Qt documentation about QRect)
|
||||
const QPoint p2 { p1.x(), p1.y() + terminal_rect.height() };
|
||||
painter->drawLine(p1, p2);
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
//Draw text
|
||||
painter->save();
|
||||
@ -135,21 +159,29 @@ void TerminalStripDrawer::paint(QPainter *painter)
|
||||
text_rect.setRect(0, 0, rect_.height(), rect_.width());
|
||||
}
|
||||
|
||||
const auto shared_real_terminal{real_terminal[i]};
|
||||
const auto shared_real_terminal{real_terminal_vector[i]};
|
||||
painter->drawText(text_rect,
|
||||
shared_real_terminal ? shared_real_terminal->label() : QLatin1String(),
|
||||
terminals_text_option[index_]);
|
||||
|
||||
if (m_debug_draw)
|
||||
{
|
||||
painter->setPen(Qt::blue);
|
||||
painter->drawRect(text_rect);
|
||||
}
|
||||
|
||||
painter->restore();
|
||||
|
||||
//Add bridge anchor
|
||||
if (shared_real_terminal->isBridged())
|
||||
{
|
||||
painter->save();
|
||||
if (const auto bridge_ = shared_real_terminal->bridge())
|
||||
if (QScopedPointer<AbstractBridgeInterface> bridge_ {
|
||||
shared_real_terminal->bridge() })
|
||||
{
|
||||
const auto x_anchor{terminal_rect.width()/2};
|
||||
const auto y_anchor {m_pattern.m_bridge_point_y_offset[index_]};
|
||||
const auto radius_anchor{m_pattern.m_bridge_point_d/2};
|
||||
const auto y_anchor {m_pattern->m_bridge_point_y_offset[index_]};
|
||||
const auto radius_anchor{m_pattern->m_bridge_point_d/2};
|
||||
|
||||
painter->setBrush(Qt::SolidPattern);
|
||||
painter->drawEllipse(QPointF(x_anchor, y_anchor),
|
||||
@ -167,7 +199,6 @@ void TerminalStripDrawer::paint(QPainter *painter)
|
||||
x_offset += terminal_rect.width();
|
||||
}
|
||||
}
|
||||
|
||||
painter->restore();
|
||||
|
||||
//Draw the bridges
|
||||
@ -188,45 +219,67 @@ QRectF TerminalStripDrawer::boundingRect() const
|
||||
return QRect{0, 0, width(), height()};;
|
||||
}
|
||||
|
||||
void TerminalStripDrawer::setLayout(QSharedPointer<TerminalStripLayoutPattern> layout)
|
||||
{
|
||||
m_pattern = layout;
|
||||
}
|
||||
|
||||
bool TerminalStripDrawer::haveLayout() const
|
||||
{
|
||||
return !m_pattern.isNull();
|
||||
}
|
||||
|
||||
int TerminalStripDrawer::height() const
|
||||
{
|
||||
auto height_{m_pattern.m_header_rect.y() + m_pattern.m_header_rect.height()};
|
||||
if (m_pattern)
|
||||
{
|
||||
auto height_{m_pattern->m_header_rect.y() + m_pattern->m_header_rect.height()};
|
||||
|
||||
height_ = std::max(height_, m_pattern.m_spacer_rect.y() + m_pattern.m_spacer_rect.height());
|
||||
height_ = std::max(height_, m_pattern->m_spacer_rect.y() + m_pattern->m_spacer_rect.height());
|
||||
|
||||
for (const auto &rect : m_pattern.m_terminal_rect) {
|
||||
height_ = std::max(height_, rect.y() + rect.height());
|
||||
for (const auto &rect : m_pattern->m_terminal_rect) {
|
||||
height_ = std::max(height_, rect.y() + rect.height());
|
||||
}
|
||||
|
||||
return height_;
|
||||
}
|
||||
|
||||
return height_;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int TerminalStripDrawer::width() const
|
||||
{
|
||||
int width_{m_pattern.m_header_rect.width() + m_pattern.m_spacer_rect.width()};
|
||||
|
||||
if (m_strip)
|
||||
if (m_pattern)
|
||||
{
|
||||
//Loop over physical terminals
|
||||
for (const auto &physical_t : m_strip->physicalTerminal())
|
||||
int width_{m_pattern->m_header_rect.width() + m_pattern->m_spacer_rect.width()};
|
||||
|
||||
if (m_strip)
|
||||
{
|
||||
//Get the good offset according to how many level have the current physical terminal
|
||||
const QVector<QSharedPointer<RealTerminal>> real_terminal{physical_t->realTerminals()};
|
||||
const auto real_t_count{real_terminal.size()};
|
||||
const auto offset_{4 - real_t_count};
|
||||
|
||||
//Loop over real terminals
|
||||
for (auto i=0 ; i<real_t_count ; ++i)
|
||||
//Loop over physical terminals
|
||||
for (const auto &physical_t : m_strip->physicalTerminal())
|
||||
{
|
||||
const auto index_ = offset_ + i;
|
||||
if (index_ >= 4) {
|
||||
break;
|
||||
}
|
||||
//Get the good offset according to how many level have the current physical terminal
|
||||
const QVector<QSharedPointer<AbstractRealTerminalInterface>> real_terminal_vector{physical_t->realTerminals()};
|
||||
const auto real_t_count{real_terminal_vector.size()};
|
||||
const auto offset_{4 - real_t_count};
|
||||
|
||||
width_ += m_pattern.m_terminal_rect[index_].width();
|
||||
//Loop over real terminals
|
||||
for (auto i=0 ; i<real_t_count ; ++i)
|
||||
{
|
||||
const auto index_ = offset_ + i;
|
||||
if (index_ >= 4) {
|
||||
break;
|
||||
}
|
||||
|
||||
width_ += m_pattern->m_terminal_rect[index_].width();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return width_;
|
||||
}
|
||||
|
||||
return width_;
|
||||
return 0;
|
||||
}
|
||||
|
||||
} //End namespace TerminalStripDrawer
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2022 The QElectroTech Team
|
||||
Copyright 2006-2023 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@ -19,27 +19,73 @@
|
||||
#define TERMINALSTRIPDRAWER_H
|
||||
|
||||
#include <QPointer>
|
||||
#include "terminalstriplayoutpattern.h"
|
||||
|
||||
#include "properties/terminalstriplayoutpattern.h"
|
||||
|
||||
class QPainter;
|
||||
class TerminalStrip;
|
||||
|
||||
class TerminalStripDrawer
|
||||
namespace TerminalStripDrawer
|
||||
{
|
||||
public:
|
||||
TerminalStripDrawer(QPointer<TerminalStrip> strip = QPointer<TerminalStrip>());
|
||||
class AbstractBridgeInterface
|
||||
{
|
||||
public:
|
||||
AbstractBridgeInterface() {}
|
||||
virtual ~AbstractBridgeInterface() {}
|
||||
virtual QUuid uuid() const = 0;
|
||||
};
|
||||
|
||||
void setStrip(TerminalStrip *strip);
|
||||
void paint(QPainter *painter);
|
||||
QRectF boundingRect() const;
|
||||
class AbstractRealTerminalInterface
|
||||
{
|
||||
public:
|
||||
AbstractRealTerminalInterface() {}
|
||||
virtual ~AbstractRealTerminalInterface() {}
|
||||
virtual QString label() const = 0;
|
||||
virtual bool isBridged() const = 0;
|
||||
virtual AbstractBridgeInterface* bridge() const = 0;
|
||||
};
|
||||
|
||||
private:
|
||||
int height() const;
|
||||
int width() const;
|
||||
class AbstractPhysicalTerminalInterface
|
||||
{
|
||||
public:
|
||||
AbstractPhysicalTerminalInterface() {}
|
||||
virtual ~AbstractPhysicalTerminalInterface() {}
|
||||
virtual QVector<QSharedPointer<AbstractRealTerminalInterface>> realTerminals() const = 0;
|
||||
};
|
||||
|
||||
private:
|
||||
QPointer<TerminalStrip> m_strip;
|
||||
TerminalStripLayoutPattern m_pattern;
|
||||
};
|
||||
class AbstractTerminalStripInterface
|
||||
{
|
||||
public:
|
||||
AbstractTerminalStripInterface() {}
|
||||
virtual ~AbstractTerminalStripInterface() {}
|
||||
virtual QString installation() const = 0;
|
||||
virtual QString location() const = 0;
|
||||
virtual QString name() const = 0;
|
||||
virtual QVector<QSharedPointer<AbstractPhysicalTerminalInterface>> physicalTerminal() const = 0;
|
||||
};
|
||||
|
||||
class TerminalStripDrawer
|
||||
{
|
||||
public:
|
||||
TerminalStripDrawer(QSharedPointer<AbstractTerminalStripInterface> strip = QSharedPointer<AbstractTerminalStripInterface> { nullptr },
|
||||
QSharedPointer<TerminalStripLayoutPattern> layout = QSharedPointer<TerminalStripLayoutPattern>());
|
||||
|
||||
void setStrip(QSharedPointer<AbstractTerminalStripInterface> strip);
|
||||
void paint(QPainter *painter);
|
||||
QRectF boundingRect() const;
|
||||
|
||||
void setLayout(QSharedPointer<TerminalStripLayoutPattern> layout);
|
||||
bool haveLayout() const;
|
||||
|
||||
private:
|
||||
int height() const;
|
||||
int width() const;
|
||||
|
||||
private:
|
||||
QSharedPointer <AbstractTerminalStripInterface> m_strip;
|
||||
QSharedPointer<TerminalStripLayoutPattern> m_pattern;
|
||||
bool m_debug_draw { false };
|
||||
};
|
||||
}
|
||||
|
||||
#endif // TERMINALSTRIPDRAWER_H
|
||||
|
@ -17,18 +17,25 @@
|
||||
*/
|
||||
#include "terminalstripitem.h"
|
||||
|
||||
|
||||
#include "../diagram.h"
|
||||
#include "../../project/projectpropertieshandler.h"
|
||||
#include "../../qetgraphicsitem/qgraphicsitemutility.h"
|
||||
#include "../terminalstrip.h"
|
||||
#include "../ui/terminalstripeditorwindow.h"
|
||||
#include "trueterminalstrip.h"
|
||||
|
||||
TerminalStripItem::TerminalStripItem(QPointer<TerminalStrip> strip, QGraphicsItem *parent) :
|
||||
QetGraphicsItem{parent},
|
||||
m_strip{strip},
|
||||
m_drawer{strip}
|
||||
TerminalStripItem::TerminalStripItem(QPointer<TerminalStrip> strip,
|
||||
QGraphicsItem *parent) :
|
||||
QetGraphicsItem { parent },
|
||||
m_strip { strip },
|
||||
m_drawer { QSharedPointer<TerminalStripDrawer::TrueTerminalStrip> {
|
||||
new TerminalStripDrawer::TrueTerminalStrip { strip }}
|
||||
}
|
||||
{
|
||||
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
|
||||
setAcceptHoverEvents(true);
|
||||
setDefaultLayout();
|
||||
}
|
||||
|
||||
TerminalStripItem::TerminalStripItem(QGraphicsItem *parent) :
|
||||
@ -41,8 +48,13 @@ TerminalStripItem::TerminalStripItem(QGraphicsItem *parent) :
|
||||
void TerminalStripItem::setTerminalStrip(TerminalStrip *strip)
|
||||
{
|
||||
m_strip = strip;
|
||||
m_drawer.setStrip(strip);
|
||||
m_drawer.setStrip(QSharedPointer<TerminalStripDrawer::TrueTerminalStrip> {
|
||||
new TerminalStripDrawer::TrueTerminalStrip { strip }});
|
||||
m_pending_strip_uuid = QUuid();
|
||||
|
||||
if (!m_drawer.haveLayout()) {
|
||||
setDefaultLayout();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -106,3 +118,15 @@ void TerminalStripItem::refreshPending()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TerminalStripItem::setLayout(QSharedPointer<TerminalStripLayoutPattern> layout)
|
||||
{
|
||||
m_drawer.setLayout(layout);
|
||||
}
|
||||
|
||||
void TerminalStripItem::setDefaultLayout()
|
||||
{
|
||||
if (m_strip && m_strip->project()) {
|
||||
m_drawer.setLayout(m_strip->project()->projectPropertiesHandler().terminalStripLayoutHandler().defaultLayout());
|
||||
}
|
||||
}
|
||||
|
@ -47,12 +47,15 @@ class TerminalStripItem : public QetGraphicsItem
|
||||
QString name() const override;
|
||||
|
||||
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override;
|
||||
|
||||
void refreshPending();
|
||||
void setLayout(QSharedPointer<TerminalStripLayoutPattern> layout);
|
||||
|
||||
private:
|
||||
void setDefaultLayout();
|
||||
|
||||
private:
|
||||
QPointer<TerminalStrip> m_strip;
|
||||
TerminalStripDrawer m_drawer;
|
||||
TerminalStripDrawer::TerminalStripDrawer m_drawer;
|
||||
QUuid m_pending_strip_uuid;
|
||||
|
||||
};
|
||||
|
133
sources/TerminalStrip/GraphicsItem/trueterminalstrip.cpp
Normal file
133
sources/TerminalStrip/GraphicsItem/trueterminalstrip.cpp
Normal file
@ -0,0 +1,133 @@
|
||||
/*
|
||||
Copyright 2006-2023 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "trueterminalstrip.h"
|
||||
#include "../physicalterminal.h"
|
||||
#include "../realterminal.h"
|
||||
#include "../terminalstrip.h"
|
||||
#include "../terminalstripbridge.h"
|
||||
|
||||
#include "terminalstripdrawer.h"
|
||||
|
||||
namespace TerminalStripDrawer
|
||||
{
|
||||
/**
|
||||
* @brief TrueTerminalStrip::TrueTerminalStrip
|
||||
* Constructor, this class don't take ownership of @a strip
|
||||
* @param strip
|
||||
*/
|
||||
TrueTerminalStrip::TrueTerminalStrip(TerminalStrip *strip) :
|
||||
m_strip { strip }
|
||||
{}
|
||||
|
||||
|
||||
QString TrueTerminalStrip::installation() const
|
||||
{
|
||||
if (m_strip) {
|
||||
return m_strip->installation();
|
||||
} else {
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
|
||||
QString TrueTerminalStrip::location() const
|
||||
{
|
||||
if (m_strip) {
|
||||
return m_strip->location();
|
||||
} else {
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
|
||||
QString TrueTerminalStrip::name() const
|
||||
{
|
||||
if (m_strip) {
|
||||
return m_strip->name();
|
||||
} else {
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
|
||||
QVector<QSharedPointer<AbstractPhysicalTerminalInterface>> TrueTerminalStrip::physicalTerminal() const
|
||||
{
|
||||
QVector<QSharedPointer<AbstractPhysicalTerminalInterface>> vector_;
|
||||
if (m_strip) {
|
||||
for (const auto &phy : m_strip->physicalTerminal()) {
|
||||
vector_.append(QSharedPointer<AbstractPhysicalTerminalInterface>{ new TruePhysicalTerminal(phy) });
|
||||
}
|
||||
}
|
||||
|
||||
return vector_;
|
||||
}
|
||||
|
||||
TruePhysicalTerminal::TruePhysicalTerminal(QSharedPointer<PhysicalTerminal> physical) :
|
||||
m_physical { physical }
|
||||
{}
|
||||
|
||||
QVector<QSharedPointer<AbstractRealTerminalInterface>> TruePhysicalTerminal::realTerminals() const
|
||||
{
|
||||
QVector<QSharedPointer<AbstractRealTerminalInterface>> vector_;
|
||||
if (m_physical) {
|
||||
for (const auto &real_ : m_physical->realTerminals()) {
|
||||
vector_.append(QSharedPointer<AbstractRealTerminalInterface> { new TrueRealTerminal{ real_ }});
|
||||
}
|
||||
}
|
||||
|
||||
return vector_;
|
||||
}
|
||||
|
||||
TrueRealTerminal::TrueRealTerminal(QSharedPointer<RealTerminal> real) :
|
||||
m_real { real }
|
||||
{}
|
||||
|
||||
QString TrueRealTerminal::label() const
|
||||
{
|
||||
if (m_real) {
|
||||
return m_real->label();
|
||||
} else {
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
|
||||
bool TrueRealTerminal::isBridged() const
|
||||
{
|
||||
if (m_real) {
|
||||
return m_real->isBridged();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//Return a raw pointer, the pointer is not managed by this class
|
||||
AbstractBridgeInterface* TrueRealTerminal::bridge() const
|
||||
{
|
||||
return new TrueBridge(m_real->bridge());
|
||||
}
|
||||
|
||||
TrueBridge::TrueBridge(QSharedPointer<TerminalStripBridge> bridge) :
|
||||
m_bridge { bridge }
|
||||
{}
|
||||
|
||||
QUuid TrueBridge::uuid() const
|
||||
{
|
||||
if (m_bridge) {
|
||||
return m_bridge->uuid();
|
||||
} else {
|
||||
return QUuid();
|
||||
}
|
||||
}
|
||||
}
|
77
sources/TerminalStrip/GraphicsItem/trueterminalstrip.h
Normal file
77
sources/TerminalStrip/GraphicsItem/trueterminalstrip.h
Normal file
@ -0,0 +1,77 @@
|
||||
/*
|
||||
Copyright 2006-2023 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef TRUETERMINALSTRIP_H
|
||||
#define TRUETERMINALSTRIP_H
|
||||
|
||||
#include "terminalstripdrawer.h"
|
||||
|
||||
class TerminalStrip;
|
||||
class PhysicalTerminal;
|
||||
class RealTerminal;
|
||||
class TerminalStripBridge;
|
||||
|
||||
namespace TerminalStripDrawer
|
||||
{
|
||||
class TrueTerminalStrip : public AbstractTerminalStripInterface
|
||||
{
|
||||
public:
|
||||
TrueTerminalStrip(TerminalStrip *strip);
|
||||
|
||||
QString installation() const override;
|
||||
QString location() const override;
|
||||
QString name() const override;
|
||||
QVector<QSharedPointer<AbstractPhysicalTerminalInterface>> physicalTerminal() const override;
|
||||
|
||||
private:
|
||||
QPointer<TerminalStrip> m_strip;
|
||||
};
|
||||
|
||||
class TruePhysicalTerminal : public AbstractPhysicalTerminalInterface
|
||||
{
|
||||
public:
|
||||
TruePhysicalTerminal(QSharedPointer<PhysicalTerminal> physical);
|
||||
QVector<QSharedPointer<AbstractRealTerminalInterface>> realTerminals() const override;
|
||||
|
||||
private:
|
||||
QSharedPointer<PhysicalTerminal> m_physical;
|
||||
};
|
||||
|
||||
class TrueRealTerminal : public AbstractRealTerminalInterface
|
||||
{
|
||||
public:
|
||||
TrueRealTerminal(QSharedPointer<RealTerminal> real);
|
||||
QString label() const override;
|
||||
bool isBridged() const override;
|
||||
AbstractBridgeInterface* bridge() const override;
|
||||
|
||||
private:
|
||||
QSharedPointer<RealTerminal> m_real;
|
||||
};
|
||||
|
||||
class TrueBridge : public AbstractBridgeInterface
|
||||
{
|
||||
public:
|
||||
TrueBridge(QSharedPointer<TerminalStripBridge> bridge);
|
||||
QUuid uuid() const override;
|
||||
|
||||
private:
|
||||
QSharedPointer<TerminalStripBridge> m_bridge;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // TRUETERMINALSTRIP_H
|
@ -0,0 +1,48 @@
|
||||
/*
|
||||
Copyright 2006-2023 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "terminalstripprojectconfigpage.h"
|
||||
#include "../../../qeticons.h"
|
||||
#include "../terminalstriplayouteditor.h"
|
||||
#include "../../../qetproject.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
|
||||
TerminalStripProjectConfigPage::TerminalStripProjectConfigPage(QETProject *project,
|
||||
QWidget *parent) :
|
||||
ProjectConfigPage { project, parent }
|
||||
{
|
||||
initWidgets();
|
||||
}
|
||||
|
||||
QString TerminalStripProjectConfigPage::title() const {
|
||||
return tr("Plan de bornes");
|
||||
}
|
||||
|
||||
QIcon TerminalStripProjectConfigPage::icon() const {
|
||||
return QET::Icons::TerminalStrip;
|
||||
}
|
||||
|
||||
void TerminalStripProjectConfigPage::initWidgets()
|
||||
{
|
||||
m_layout_editor = new TerminalStripLayoutEditor{ project()->projectPropertiesHandler().terminalStripLayoutHandler().defaultLayout(),
|
||||
this };
|
||||
|
||||
auto v_layout = new QVBoxLayout { this };
|
||||
v_layout->addWidget(m_layout_editor);
|
||||
setLayout(v_layout);
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
/*
|
||||
Copyright 2006-2023 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef TERMINALSTRIPPROJECTCONFIGPAGE_H
|
||||
#define TERMINALSTRIPPROJECTCONFIGPAGE_H
|
||||
|
||||
#include "../../../ui/configpage/projectconfigpages.h"
|
||||
|
||||
class TerminalStripLayoutEditor;
|
||||
|
||||
class TerminalStripProjectConfigPage : public ProjectConfigPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
TerminalStripProjectConfigPage(QETProject *project, QWidget *parent = nullptr);
|
||||
|
||||
QString title() const override;
|
||||
QIcon icon() const override;
|
||||
|
||||
void applyProjectConf() override {}
|
||||
|
||||
protected:
|
||||
void initWidgets() override;
|
||||
void initLayout() override{}
|
||||
void readValuesFromProject() override {}
|
||||
void adjustReadOnly() override {}
|
||||
|
||||
private:
|
||||
TerminalStripLayoutEditor *m_layout_editor { nullptr };
|
||||
};
|
||||
|
||||
#endif // TERMINALSTRIPPROJECTCONFIGPAGE_H
|
@ -180,6 +180,7 @@ void TerminalStripEditor::reload()
|
||||
if (m_model)
|
||||
{
|
||||
m_model->reload();
|
||||
spanMultiLevelTerminals();
|
||||
}
|
||||
}
|
||||
|
||||
|
221
sources/TerminalStrip/ui/terminalstriplayouteditor.cpp
Normal file
221
sources/TerminalStrip/ui/terminalstriplayouteditor.cpp
Normal file
@ -0,0 +1,221 @@
|
||||
/*
|
||||
Copyright 2006-2023 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "terminalstriplayouteditor.h"
|
||||
#include "ui_terminalstriplayouteditor.h"
|
||||
#include "../GraphicsItem/properties/terminalstriplayoutpattern.h"
|
||||
|
||||
TerminalStripLayoutEditor::TerminalStripLayoutEditor(QSharedPointer<TerminalStripLayoutPattern> layout,
|
||||
QWidget *parent) :
|
||||
QWidget{ parent },
|
||||
ui{ new Ui::TerminalStripLayoutEditor },
|
||||
m_layout{ layout }
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->m_graphics_view->setScene(new QGraphicsScene{ this });
|
||||
ui->m_graphics_view->scene()->addItem(&m_preview_strip_item);
|
||||
updateUi();
|
||||
}
|
||||
|
||||
TerminalStripLayoutEditor::~TerminalStripLayoutEditor()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void TerminalStripLayoutEditor::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
QWidget::resizeEvent(event);
|
||||
updatePreview();
|
||||
}
|
||||
|
||||
void TerminalStripLayoutEditor::showEvent(QShowEvent *event)
|
||||
{
|
||||
QWidget::showEvent(event);
|
||||
updatePreview();
|
||||
}
|
||||
|
||||
void TerminalStripLayoutEditor::valueEdited()
|
||||
{
|
||||
if (!m_layout || m_ui_updating) {
|
||||
return;
|
||||
}
|
||||
|
||||
//auto *data_ = m_layout.data();
|
||||
|
||||
m_layout.data()->m_header_rect.setRect(0,
|
||||
ui->m_y_header_sb->value(),
|
||||
ui->m_width_header_sb->value(),
|
||||
ui->m_height_header_sb->value());
|
||||
|
||||
m_layout.data()->m_spacer_rect.setRect(0,
|
||||
ui->m_y_spacer_sb->value(),
|
||||
ui->m_width_spacer_sb->value(),
|
||||
ui->m_height_spacer_sb->value());
|
||||
|
||||
m_layout.data()->m_terminal_rect[0].setRect(0,
|
||||
ui->m_y_terminal_0_sb->value(),
|
||||
ui->m_width_terminal_0_sb->value(),
|
||||
ui->m_height_terminal_0_sb->value());
|
||||
|
||||
m_layout.data()->m_terminal_rect[1].setRect(0,
|
||||
ui->m_y_terminal_1_sb->value(),
|
||||
ui->m_width_terminal_1_sb->value(),
|
||||
ui->m_height_terminal_1_sb->value());
|
||||
|
||||
m_layout.data()->m_terminal_rect[2].setRect(0,
|
||||
ui->m_y_terminal_2_sb->value(),
|
||||
ui->m_width_terminal_2_sb->value(),
|
||||
ui->m_height_terminal_2_sb->value());
|
||||
|
||||
m_layout.data()->m_terminal_rect[3].setRect(0,
|
||||
ui->m_y_terminal_3_sb->value(),
|
||||
ui->m_width_terminal_3_sb->value(),
|
||||
ui->m_height_terminal_3_sb->value());
|
||||
|
||||
m_layout.data()->m_bridge_point_y_offset[0] = ui->m_bridge_point_0_sb->value();
|
||||
m_layout.data()->m_bridge_point_y_offset[1] = ui->m_bridge_point_1_sb->value();
|
||||
m_layout.data()->m_bridge_point_y_offset[2] = ui->m_bridge_point_2_sb->value();
|
||||
m_layout.data()->m_bridge_point_y_offset[3] = ui->m_bridge_point_3_sb->value();
|
||||
|
||||
m_layout.data()->m_header_text_orientation = ui->m_header_text_orientation_cb->currentIndex() == 0 ?
|
||||
Qt::Horizontal :
|
||||
Qt::Vertical;
|
||||
|
||||
switch (ui->m_header_text_alignment_cb->currentIndex()) {
|
||||
case 0:
|
||||
m_layout.data()->setHeaderTextAlignment(Qt::AlignLeft | Qt::AlignVCenter); break;
|
||||
case 1:
|
||||
m_layout.data()->setHeaderTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); break;
|
||||
default:
|
||||
m_layout.data()->setHeaderTextAlignment(Qt::AlignRight | Qt::AlignVCenter); break;
|
||||
}
|
||||
|
||||
m_layout.data()->m_terminals_text_orientation[0] = ui->m_terminal_text_orientation_cb->currentIndex() == 0 ?
|
||||
Qt::Horizontal :
|
||||
Qt::Vertical;
|
||||
|
||||
switch (ui->m_terminal_text_alignment_cb->currentIndex()) {
|
||||
case 0:
|
||||
m_layout.data()->setTerminalsTextAlignment(
|
||||
QVector<Qt::Alignment> { Qt::AlignLeft | Qt::AlignVCenter,
|
||||
Qt::AlignLeft | Qt::AlignVCenter,
|
||||
Qt::AlignLeft | Qt::AlignVCenter,
|
||||
Qt::AlignLeft | Qt::AlignVCenter });
|
||||
break;
|
||||
case 1:
|
||||
m_layout.data()->setTerminalsTextAlignment(
|
||||
QVector<Qt::Alignment> { Qt::AlignHCenter | Qt::AlignVCenter,
|
||||
Qt::AlignHCenter | Qt::AlignVCenter,
|
||||
Qt::AlignHCenter | Qt::AlignVCenter,
|
||||
Qt::AlignHCenter | Qt::AlignVCenter });
|
||||
break;
|
||||
default:
|
||||
m_layout.data()->setTerminalsTextAlignment(
|
||||
QVector<Qt::Alignment> { Qt::AlignRight | Qt::AlignVCenter,
|
||||
Qt::AlignRight | Qt::AlignVCenter,
|
||||
Qt::AlignRight | Qt::AlignVCenter,
|
||||
Qt::AlignRight | Qt::AlignVCenter });
|
||||
break;
|
||||
}
|
||||
|
||||
updateUi();
|
||||
m_preview_strip_item.update();
|
||||
}
|
||||
|
||||
void TerminalStripLayoutEditor::updateUi()
|
||||
{
|
||||
if (!m_layout) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto data = m_layout.data();
|
||||
|
||||
m_ui_updating = true;
|
||||
|
||||
ui->m_y_header_sb->setValue(data->m_header_rect.y());
|
||||
ui->m_width_header_sb->setValue(data->m_header_rect.width());
|
||||
ui->m_height_header_sb->setValue(data->m_header_rect.height());
|
||||
|
||||
ui->m_y_spacer_sb->setValue(data->m_spacer_rect.y());
|
||||
ui->m_width_spacer_sb->setValue(data->m_spacer_rect.width());
|
||||
ui->m_height_spacer_sb->setValue(data->m_spacer_rect.height());
|
||||
|
||||
const auto terminal_0 = data->m_terminal_rect[0];
|
||||
ui->m_y_terminal_0_sb->setValue(terminal_0.y());
|
||||
ui->m_height_terminal_0_sb->setValue(terminal_0.height());
|
||||
ui->m_width_terminal_0_sb->setValue(terminal_0.width());
|
||||
|
||||
const auto terminal_1 = data->m_terminal_rect[1];
|
||||
ui->m_y_terminal_1_sb->setValue(terminal_1.y());
|
||||
ui->m_height_terminal_1_sb->setValue(terminal_1.height());
|
||||
ui->m_width_terminal_1_sb->setValue(terminal_1.width());
|
||||
|
||||
const auto terminal_2 = data->m_terminal_rect[2];
|
||||
ui->m_y_terminal_2_sb->setValue(terminal_2.y());
|
||||
ui->m_height_terminal_2_sb->setValue(terminal_2.height());
|
||||
ui->m_width_terminal_2_sb->setValue(terminal_2.width());
|
||||
|
||||
const auto terminal_3 = data->m_terminal_rect[3];
|
||||
ui->m_y_terminal_3_sb->setValue(terminal_3.y());
|
||||
ui->m_height_terminal_3_sb->setValue(terminal_3.height());
|
||||
ui->m_width_terminal_3_sb->setValue(terminal_3.width());
|
||||
|
||||
const auto bridge_point = data->m_bridge_point_y_offset;
|
||||
ui->m_bridge_point_0_sb->setValue(bridge_point[0]);
|
||||
ui->m_bridge_point_1_sb->setValue(bridge_point[1]);
|
||||
ui->m_bridge_point_2_sb->setValue(bridge_point[2]);
|
||||
ui->m_bridge_point_3_sb->setValue(bridge_point[3]);
|
||||
|
||||
if (data->m_header_text_orientation == Qt::Horizontal) {
|
||||
ui->m_header_text_orientation_cb->setCurrentIndex(0);
|
||||
} else {
|
||||
ui->m_header_text_orientation_cb->setCurrentIndex(1);
|
||||
}
|
||||
|
||||
if (data->m_terminals_text_orientation[0] == Qt::Horizontal) {
|
||||
ui->m_terminal_text_orientation_cb->setCurrentIndex(0);
|
||||
} else {
|
||||
ui->m_terminal_text_orientation_cb->setCurrentIndex(1);
|
||||
}
|
||||
|
||||
const auto header_alignment = data->headerTextAlignment();
|
||||
if (header_alignment &Qt::AlignLeft) {
|
||||
ui->m_header_text_alignment_cb->setCurrentIndex(0);
|
||||
} else if (header_alignment &Qt::AlignHCenter) {
|
||||
ui->m_header_text_alignment_cb->setCurrentIndex(1);
|
||||
} else if (header_alignment &Qt::AlignRight) {
|
||||
ui->m_header_text_alignment_cb->setCurrentIndex(2);
|
||||
}
|
||||
|
||||
const auto terminal_alignment = data->terminalsTextAlignment().at(0);
|
||||
if (terminal_alignment &Qt::AlignLeft) {
|
||||
ui->m_terminal_text_alignment_cb->setCurrentIndex(0);
|
||||
} else if (terminal_alignment &Qt::AlignHCenter) {
|
||||
ui->m_terminal_text_alignment_cb->setCurrentIndex(1);
|
||||
} else if (terminal_alignment &Qt::AlignRight) {
|
||||
ui->m_terminal_text_alignment_cb->setCurrentIndex(2);
|
||||
}
|
||||
|
||||
m_ui_updating = false;
|
||||
updatePreview();
|
||||
}
|
||||
|
||||
void TerminalStripLayoutEditor::updatePreview()
|
||||
{
|
||||
ui->m_graphics_view->fitInView(m_preview_strip_item.boundingRect().adjusted(-5,-5,5,5),
|
||||
Qt::KeepAspectRatio);
|
||||
}
|
90
sources/TerminalStrip/ui/terminalstriplayouteditor.h
Normal file
90
sources/TerminalStrip/ui/terminalstriplayouteditor.h
Normal file
@ -0,0 +1,90 @@
|
||||
/*
|
||||
Copyright 2006-2023 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef TERMINALSTRIPLAYOUTEDITOR_H
|
||||
#define TERMINALSTRIPLAYOUTEDITOR_H
|
||||
|
||||
#include <QGraphicsItem>
|
||||
#include <QWidget>
|
||||
|
||||
#include "../GraphicsItem/demoterminalstrip.h"
|
||||
#include "../GraphicsItem/terminalstripdrawer.h"
|
||||
|
||||
class TerminalStripLayoutPattern;
|
||||
|
||||
namespace Ui {
|
||||
class TerminalStripLayoutEditor;
|
||||
}
|
||||
|
||||
class PreviewStripItem : public QGraphicsItem
|
||||
{
|
||||
public:
|
||||
PreviewStripItem (QSharedPointer<TerminalStripLayoutPattern> layout) :
|
||||
m_drawer {QSharedPointer<TerminalStripDrawer::DemoTerminalStrip>{new TerminalStripDrawer::DemoTerminalStrip},
|
||||
layout}
|
||||
{}
|
||||
|
||||
QRectF boundingRect() const override {
|
||||
return m_drawer.boundingRect();
|
||||
}
|
||||
|
||||
protected:
|
||||
void paint(QPainter *painter,
|
||||
const QStyleOptionGraphicsItem *option,
|
||||
QWidget *widget = nullptr) override
|
||||
{
|
||||
Q_UNUSED (option); Q_UNUSED (widget);
|
||||
m_drawer.paint(painter);
|
||||
}
|
||||
|
||||
private:
|
||||
TerminalStripDrawer::TerminalStripDrawer m_drawer;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief The TerminalStripLayoutEditor class
|
||||
* Widget used to edit the layout of a terminal strip item
|
||||
*/
|
||||
class TerminalStripLayoutEditor : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit TerminalStripLayoutEditor(QSharedPointer<TerminalStripLayoutPattern> layout,
|
||||
QWidget *parent = nullptr);
|
||||
~TerminalStripLayoutEditor();
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
void showEvent(QShowEvent *event) override;
|
||||
|
||||
private slots:
|
||||
void valueEdited();
|
||||
|
||||
private:
|
||||
void updateUi();
|
||||
void updatePreview();
|
||||
|
||||
private:
|
||||
Ui::TerminalStripLayoutEditor *ui;
|
||||
QSharedPointer<TerminalStripLayoutPattern> m_layout;
|
||||
bool m_ui_updating { false } ;
|
||||
PreviewStripItem m_preview_strip_item {m_layout};
|
||||
};
|
||||
|
||||
#endif // TERMINALSTRIPLAYOUTEDITOR_H
|
797
sources/TerminalStrip/ui/terminalstriplayouteditor.ui
Normal file
797
sources/TerminalStrip/ui/terminalstriplayouteditor.ui
Normal file
@ -0,0 +1,797 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>TerminalStripLayoutEditor</class>
|
||||
<widget class="QWidget" name="TerminalStripLayoutEditor">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>553</width>
|
||||
<height>387</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMaximumSize</enum>
|
||||
</property>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Espace :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="m_y_header_sb">
|
||||
<property name="maximum">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QSpinBox" name="m_width_terminal_0_sb">
|
||||
<property name="maximum">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QSpinBox" name="m_y_terminal_3_sb">
|
||||
<property name="maximum">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Borne niveau 1 :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<widget class="QSpinBox" name="m_height_spacer_sb">
|
||||
<property name="maximum">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>En tête :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QSpinBox" name="m_y_terminal_2_sb">
|
||||
<property name="maximum">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Borne niveau 0 :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Hauteur</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="4">
|
||||
<widget class="QLabel" name="label_18">
|
||||
<property name="text">
|
||||
<string>Point de pont</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="3">
|
||||
<widget class="QSpinBox" name="m_height_terminal_2_sb">
|
||||
<property name="maximum">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="3">
|
||||
<widget class="QSpinBox" name="m_height_terminal_0_sb">
|
||||
<property name="maximum">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QSpinBox" name="m_y_terminal_0_sb">
|
||||
<property name="maximum">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="4">
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0" colspan="5">
|
||||
<widget class="Line" name="line_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Largeur</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="3">
|
||||
<widget class="QSpinBox" name="m_height_terminal_3_sb">
|
||||
<property name="maximum">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0" colspan="5">
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="m_header_text_orientation_cb">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Horizontal</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Vertical</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="label_15">
|
||||
<property name="text">
|
||||
<string>Alignement du texte d'en tête :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_14">
|
||||
<property name="text">
|
||||
<string>Orientation du texte d'en tête :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QComboBox" name="m_header_text_alignment_cb">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Gauche</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Centre</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Droite</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_16">
|
||||
<property name="text">
|
||||
<string>Orientation du texte de borne :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="m_terminal_text_orientation_cb">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Horizontal</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Vertical</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="label_17">
|
||||
<property name="text">
|
||||
<string>Alignement du texte de borne :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QComboBox" name="m_terminal_text_alignment_cb">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Gauche</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Centre</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Droite</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Décalage vertical</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<widget class="QSpinBox" name="m_width_terminal_1_sb">
|
||||
<property name="maximum">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QSpinBox" name="m_y_terminal_1_sb">
|
||||
<property name="maximum">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Borne niveau 2 :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="4">
|
||||
<widget class="QSpinBox" name="m_bridge_point_1_sb">
|
||||
<property name="maximum">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QSpinBox" name="m_height_header_sb">
|
||||
<property name="maximum">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="4">
|
||||
<widget class="QSpinBox" name="m_bridge_point_0_sb">
|
||||
<property name="maximum">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="2">
|
||||
<widget class="QSpinBox" name="m_width_terminal_2_sb">
|
||||
<property name="maximum">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QSpinBox" name="m_y_spacer_sb">
|
||||
<property name="maximum">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QSpinBox" name="m_width_spacer_sb">
|
||||
<property name="maximum">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QSpinBox" name="m_width_header_sb">
|
||||
<property name="maximum">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="4">
|
||||
<widget class="QSpinBox" name="m_bridge_point_3_sb">
|
||||
<property name="maximum">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>Borne niveau 3 :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="3">
|
||||
<widget class="QSpinBox" name="m_height_terminal_1_sb">
|
||||
<property name="maximum">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="2">
|
||||
<widget class="QSpinBox" name="m_width_terminal_3_sb">
|
||||
<property name="maximum">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="4">
|
||||
<widget class="QSpinBox" name="m_bridge_point_2_sb">
|
||||
<property name="maximum">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0" colspan="5">
|
||||
<widget class="QGraphicsView" name="m_graphics_view"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>m_y_header_sb</sender>
|
||||
<signal>valueChanged(int)</signal>
|
||||
<receiver>TerminalStripLayoutEditor</receiver>
|
||||
<slot>valueEdited()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>167</x>
|
||||
<y>43</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>276</x>
|
||||
<y>155</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>m_y_terminal_1_sb</sender>
|
||||
<signal>valueChanged(int)</signal>
|
||||
<receiver>TerminalStripLayoutEditor</receiver>
|
||||
<slot>valueEdited()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>167</x>
|
||||
<y>158</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>276</x>
|
||||
<y>155</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>m_bridge_point_0_sb</sender>
|
||||
<signal>valueChanged(int)</signal>
|
||||
<receiver>TerminalStripLayoutEditor</receiver>
|
||||
<slot>valueEdited()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>492</x>
|
||||
<y>127</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>276</x>
|
||||
<y>155</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>m_height_terminal_0_sb</sender>
|
||||
<signal>valueChanged(int)</signal>
|
||||
<receiver>TerminalStripLayoutEditor</receiver>
|
||||
<slot>valueEdited()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>384</x>
|
||||
<y>127</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>276</x>
|
||||
<y>155</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>m_width_terminal_0_sb</sender>
|
||||
<signal>valueChanged(int)</signal>
|
||||
<receiver>TerminalStripLayoutEditor</receiver>
|
||||
<slot>valueEdited()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>276</x>
|
||||
<y>127</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>276</x>
|
||||
<y>155</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>m_y_terminal_0_sb</sender>
|
||||
<signal>valueChanged(int)</signal>
|
||||
<receiver>TerminalStripLayoutEditor</receiver>
|
||||
<slot>valueEdited()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>167</x>
|
||||
<y>127</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>276</x>
|
||||
<y>155</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>m_height_spacer_sb</sender>
|
||||
<signal>valueChanged(int)</signal>
|
||||
<receiver>TerminalStripLayoutEditor</receiver>
|
||||
<slot>valueEdited()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>384</x>
|
||||
<y>74</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>276</x>
|
||||
<y>155</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>m_height_header_sb</sender>
|
||||
<signal>valueChanged(int)</signal>
|
||||
<receiver>TerminalStripLayoutEditor</receiver>
|
||||
<slot>valueEdited()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>384</x>
|
||||
<y>43</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>276</x>
|
||||
<y>155</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>m_y_spacer_sb</sender>
|
||||
<signal>valueChanged(int)</signal>
|
||||
<receiver>TerminalStripLayoutEditor</receiver>
|
||||
<slot>valueEdited()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>167</x>
|
||||
<y>74</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>276</x>
|
||||
<y>155</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>m_width_spacer_sb</sender>
|
||||
<signal>valueChanged(int)</signal>
|
||||
<receiver>TerminalStripLayoutEditor</receiver>
|
||||
<slot>valueEdited()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>276</x>
|
||||
<y>74</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>276</x>
|
||||
<y>155</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>m_width_header_sb</sender>
|
||||
<signal>valueChanged(int)</signal>
|
||||
<receiver>TerminalStripLayoutEditor</receiver>
|
||||
<slot>valueEdited()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>276</x>
|
||||
<y>43</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>276</x>
|
||||
<y>155</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>m_y_terminal_2_sb</sender>
|
||||
<signal>valueChanged(int)</signal>
|
||||
<receiver>TerminalStripLayoutEditor</receiver>
|
||||
<slot>valueEdited()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>167</x>
|
||||
<y>189</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>276</x>
|
||||
<y>155</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>m_y_terminal_3_sb</sender>
|
||||
<signal>valueChanged(int)</signal>
|
||||
<receiver>TerminalStripLayoutEditor</receiver>
|
||||
<slot>valueEdited()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>167</x>
|
||||
<y>220</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>276</x>
|
||||
<y>155</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>m_width_terminal_1_sb</sender>
|
||||
<signal>valueChanged(int)</signal>
|
||||
<receiver>TerminalStripLayoutEditor</receiver>
|
||||
<slot>valueEdited()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>276</x>
|
||||
<y>158</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>276</x>
|
||||
<y>155</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>m_width_terminal_2_sb</sender>
|
||||
<signal>valueChanged(int)</signal>
|
||||
<receiver>TerminalStripLayoutEditor</receiver>
|
||||
<slot>valueEdited()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>276</x>
|
||||
<y>189</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>276</x>
|
||||
<y>155</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>m_width_terminal_3_sb</sender>
|
||||
<signal>valueChanged(int)</signal>
|
||||
<receiver>TerminalStripLayoutEditor</receiver>
|
||||
<slot>valueEdited()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>276</x>
|
||||
<y>220</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>276</x>
|
||||
<y>155</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>m_height_terminal_1_sb</sender>
|
||||
<signal>valueChanged(int)</signal>
|
||||
<receiver>TerminalStripLayoutEditor</receiver>
|
||||
<slot>valueEdited()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>384</x>
|
||||
<y>158</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>276</x>
|
||||
<y>155</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>m_height_terminal_2_sb</sender>
|
||||
<signal>valueChanged(int)</signal>
|
||||
<receiver>TerminalStripLayoutEditor</receiver>
|
||||
<slot>valueEdited()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>384</x>
|
||||
<y>189</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>276</x>
|
||||
<y>155</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>m_height_terminal_3_sb</sender>
|
||||
<signal>valueChanged(int)</signal>
|
||||
<receiver>TerminalStripLayoutEditor</receiver>
|
||||
<slot>valueEdited()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>384</x>
|
||||
<y>220</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>276</x>
|
||||
<y>155</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>m_bridge_point_1_sb</sender>
|
||||
<signal>valueChanged(int)</signal>
|
||||
<receiver>TerminalStripLayoutEditor</receiver>
|
||||
<slot>valueEdited()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>492</x>
|
||||
<y>158</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>276</x>
|
||||
<y>155</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>m_bridge_point_3_sb</sender>
|
||||
<signal>valueChanged(int)</signal>
|
||||
<receiver>TerminalStripLayoutEditor</receiver>
|
||||
<slot>valueEdited()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>492</x>
|
||||
<y>220</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>276</x>
|
||||
<y>155</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>m_bridge_point_2_sb</sender>
|
||||
<signal>valueChanged(int)</signal>
|
||||
<receiver>TerminalStripLayoutEditor</receiver>
|
||||
<slot>valueEdited()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>492</x>
|
||||
<y>189</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>276</x>
|
||||
<y>155</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>m_header_text_alignment_cb</sender>
|
||||
<signal>currentIndexChanged(int)</signal>
|
||||
<receiver>TerminalStripLayoutEditor</receiver>
|
||||
<slot>valueEdited()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>506</x>
|
||||
<y>259</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>276</x>
|
||||
<y>155</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>m_header_text_orientation_cb</sender>
|
||||
<signal>currentIndexChanged(int)</signal>
|
||||
<receiver>TerminalStripLayoutEditor</receiver>
|
||||
<slot>valueEdited()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>235</x>
|
||||
<y>259</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>276</x>
|
||||
<y>155</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>m_terminal_text_alignment_cb</sender>
|
||||
<signal>currentIndexChanged(int)</signal>
|
||||
<receiver>TerminalStripLayoutEditor</receiver>
|
||||
<slot>valueEdited()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>506</x>
|
||||
<y>289</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>276</x>
|
||||
<y>155</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>m_terminal_text_orientation_cb</sender>
|
||||
<signal>currentIndexChanged(int)</signal>
|
||||
<receiver>TerminalStripLayoutEditor</receiver>
|
||||
<slot>valueEdited()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>235</x>
|
||||
<y>289</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>276</x>
|
||||
<y>155</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
<slots>
|
||||
<slot>valueEdited()</slot>
|
||||
</slots>
|
||||
</ui>
|
@ -186,7 +186,7 @@ QVariant TerminalStripModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
return mrtd.led_ ? Qt::Checked : Qt::Unchecked;
|
||||
}
|
||||
else if (role == Qt::BackgroundRole && index.column() <= CONDUCTOR_CELL )
|
||||
else if (role == Qt::BackgroundRole && index.column() < COLUMN_COUNT )
|
||||
{
|
||||
if (m_modified_cell.contains(mrtd.element_) &&
|
||||
m_modified_cell.value(mrtd.element_).at(index.column()))
|
||||
|
30
sources/project/projectpropertieshandler.cpp
Normal file
30
sources/project/projectpropertieshandler.cpp
Normal file
@ -0,0 +1,30 @@
|
||||
/*
|
||||
Copyright 2006-2023 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "projectpropertieshandler.h"
|
||||
|
||||
#include "../qetproject.h"
|
||||
|
||||
ProjectPropertiesHandler::ProjectPropertiesHandler(QETProject *project) :
|
||||
m_project(project)
|
||||
{
|
||||
}
|
||||
|
||||
TerminalStripLayoutsHandler &ProjectPropertiesHandler::terminalStripLayoutHandler()
|
||||
{
|
||||
return m_terminal_strip_layout_handler;
|
||||
}
|
53
sources/project/projectpropertieshandler.h
Normal file
53
sources/project/projectpropertieshandler.h
Normal file
@ -0,0 +1,53 @@
|
||||
/*
|
||||
Copyright 2006-2023 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef PROJECTPROPERTIESHANDLER_H
|
||||
#define PROJECTPROPERTIESHANDLER_H
|
||||
|
||||
#include <QPointer>
|
||||
|
||||
#include "../TerminalStrip/GraphicsItem/properties/terminalstriplayoutshandler.h"
|
||||
|
||||
class QETProject;
|
||||
|
||||
/**
|
||||
* @brief The ProjectPropertiesHandler class
|
||||
* A central class who handle, keep and provide all utilities
|
||||
* to easily manage all kind of properties used in a project.
|
||||
*
|
||||
* This is a new class since QElectroTech 0.9
|
||||
* by consequent she is small and you can found a lot of properties (made before qet 0.9)
|
||||
* everywhere in the code.
|
||||
* All new properties should be managed by this class
|
||||
* (of course if it make sense to be managed by this class).
|
||||
* Older properties who are not managed by this class but should be,
|
||||
* will be managed in future.
|
||||
*/
|
||||
class ProjectPropertiesHandler
|
||||
{
|
||||
public:
|
||||
ProjectPropertiesHandler(QETProject *project);
|
||||
|
||||
TerminalStripLayoutsHandler& terminalStripLayoutHandler();
|
||||
|
||||
private:
|
||||
QPointer<QETProject> m_project;
|
||||
|
||||
TerminalStripLayoutsHandler m_terminal_strip_layout_handler;
|
||||
};
|
||||
|
||||
#endif // PROJECTPROPERTIESHANDLER_H
|
@ -52,12 +52,18 @@ static int BACKUP_INTERVAL = 120000; //interval in ms of backup = 2min
|
||||
QETProject::QETProject(QObject *parent) :
|
||||
QObject (parent),
|
||||
m_titleblocks_collection(this),
|
||||
m_data_base(this, this)
|
||||
m_data_base(this, this),
|
||||
m_project_properties_handler{this}
|
||||
{
|
||||
setDefaultTitleBlockProperties(TitleBlockProperties::defaultProperties());
|
||||
|
||||
m_elements_collection = new XmlElementCollection(this);
|
||||
init();
|
||||
init();
|
||||
}
|
||||
|
||||
ProjectPropertiesHandler &QETProject::projectPropertiesHandler()
|
||||
{
|
||||
return m_project_properties_handler;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -69,7 +75,8 @@ QETProject::QETProject(QObject *parent) :
|
||||
QETProject::QETProject(const QString &path, QObject *parent) :
|
||||
QObject (parent),
|
||||
m_titleblocks_collection(this),
|
||||
m_data_base(this, this)
|
||||
m_data_base(this, this),
|
||||
m_project_properties_handler{this}
|
||||
{
|
||||
QFile file(path);
|
||||
m_state = openFile(&file);
|
||||
@ -90,7 +97,8 @@ QETProject::QETProject(const QString &path, QObject *parent) :
|
||||
QETProject::QETProject(KAutoSaveFile *backup, QObject *parent) :
|
||||
QObject (parent),
|
||||
m_titleblocks_collection(this),
|
||||
m_data_base(this, this)
|
||||
m_data_base(this, this),
|
||||
m_project_properties_handler{this}
|
||||
{
|
||||
m_state = openFile(backup);
|
||||
//Failed to open from the backup, try to open the crashed
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include "ElementsCollection/elementslocation.h"
|
||||
#include "NameList/nameslist.h"
|
||||
#include "project/projectpropertieshandler.h"
|
||||
#include "borderproperties.h"
|
||||
#include "conductorproperties.h"
|
||||
#include "dataBase/projectdatabase.h"
|
||||
@ -27,10 +28,12 @@
|
||||
#include "properties/xrefproperties.h"
|
||||
#include "titleblock/templatescollection.h"
|
||||
#include "titleblockproperties.h"
|
||||
|
||||
#ifdef BUILD_WITHOUT_KF5
|
||||
#else
|
||||
# include <KAutoSaveFile>
|
||||
#endif
|
||||
|
||||
#include <QHash>
|
||||
|
||||
class Diagram;
|
||||
@ -86,6 +89,7 @@ class QETProject : public QObject
|
||||
|
||||
// methods
|
||||
public:
|
||||
ProjectPropertiesHandler& projectPropertiesHandler();
|
||||
projectDataBase *dataBase();
|
||||
QUuid uuid() const;
|
||||
ProjectState state() const;
|
||||
@ -291,6 +295,8 @@ class QETProject : public QObject
|
||||
QUuid m_uuid = QUuid::createUuid();
|
||||
projectDataBase m_data_base;
|
||||
QVector<TerminalStrip *> m_terminal_strip_vector;
|
||||
|
||||
ProjectPropertiesHandler m_project_properties_handler;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(QETProject *)
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "../configdialog.h"
|
||||
#include "configpage/configpages.h"
|
||||
#include "configpage/projectconfigpages.h"
|
||||
#include "../TerminalStrip/ui/ConfigPage/terminalstripprojectconfigpage.h"
|
||||
|
||||
#include <QObject>
|
||||
|
||||
@ -29,14 +30,20 @@
|
||||
@param project : project to edit properties
|
||||
@param parent : parent widget of this dialog
|
||||
*/
|
||||
ProjectPropertiesDialog::ProjectPropertiesDialog(QETProject *project, QWidget *parent) {
|
||||
NewDiagramPage *newDiagramPage = new NewDiagramPage(project,parent,this);
|
||||
ProjectAutoNumConfigPage *projectAutoNumConfigPage = new ProjectAutoNumConfigPage (project);
|
||||
ProjectPropertiesDialog::ProjectPropertiesDialog(QETProject *project, QWidget *parent)
|
||||
{
|
||||
m_properties_dialog = new ConfigDialog (parent);
|
||||
m_properties_dialog -> setWindowTitle(QObject::tr("Propriétés du projet", "window title"));
|
||||
m_properties_dialog -> addPage(new ProjectMainConfigPage(project));
|
||||
|
||||
NewDiagramPage *newDiagramPage = new NewDiagramPage(project,parent,this);
|
||||
m_properties_dialog -> addPage(newDiagramPage);
|
||||
|
||||
ProjectAutoNumConfigPage *projectAutoNumConfigPage = new ProjectAutoNumConfigPage (project);
|
||||
m_properties_dialog -> addPage(projectAutoNumConfigPage);
|
||||
|
||||
m_properties_dialog->addPage(new TerminalStripProjectConfigPage { project, parent });
|
||||
|
||||
connect(projectAutoNumConfigPage,SIGNAL(setAutoNum(QString)),newDiagramPage,SLOT(setFolioAutonum(QString)));
|
||||
connect(projectAutoNumConfigPage,SIGNAL(saveCurrentTbp()),newDiagramPage,SLOT(saveCurrentTbp()));
|
||||
connect(projectAutoNumConfigPage,SIGNAL(loadSavedTbp()),newDiagramPage,SLOT(loadSavedTbp()));
|
||||
|
@ -32,7 +32,8 @@ class ProjectPropertiesDialog : public QObject {
|
||||
enum Page {
|
||||
Main = 0,
|
||||
Diagram = 1,
|
||||
Autonum = 2
|
||||
Autonum = 2,
|
||||
TerminalStrip = 3
|
||||
};
|
||||
|
||||
ProjectPropertiesDialog(QETProject *project, QWidget *parent = nullptr);
|
||||
|
Loading…
x
Reference in New Issue
Block a user