mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-09-13 20:23:04 +02:00
TerminalStripLayoutPattern is now shared
TerminalStripLayoutPattern class is now a shared pointer between all terminal strip item. QETProject have now a new class : ProjectPropertiesHandler the goal of this class is to manage every kind of properties used in the project, this class will be strongly used in future.
This commit is contained in:
parent
c6739b5bec
commit
4da7f6cd13
@ -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) \
|
||||
@ -161,11 +163,13 @@ HEADERS += $$files(sources/*.h) $$files(sources/ui/*.h) \
|
||||
$$files(sources/TerminalStrip/ui/*.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) \
|
||||
@ -200,6 +204,7 @@ SOURCES += $$files(sources/*.cpp) \
|
||||
$$files(sources/TerminalStrip/ui/*.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)
|
||||
|
||||
|
@ -82,6 +82,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,31 @@
|
||||
/*
|
||||
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 = new TerminalStripLayoutPattern;
|
||||
m_default_layout->m_name = QObject("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
|
@ -28,8 +28,10 @@
|
||||
* @param strip
|
||||
* @param pattern
|
||||
*/
|
||||
TerminalStripDrawer::TerminalStripDrawer(QPointer<TerminalStrip> strip) :
|
||||
m_strip(strip)
|
||||
TerminalStripDrawer::TerminalStripDrawer(QPointer<TerminalStrip> strip,
|
||||
QSharedPointer<TerminalStripLayoutPattern> layout) :
|
||||
m_strip(strip),
|
||||
m_pattern(layout)
|
||||
{}
|
||||
|
||||
void TerminalStripDrawer::setStrip(TerminalStrip *strip)
|
||||
@ -43,7 +45,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.
|
||||
@ -61,42 +63,42 @@ void TerminalStripDrawer::paint(QPainter *painter)
|
||||
painter->setBrush(brush_);
|
||||
|
||||
//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;
|
||||
@ -117,7 +119,7 @@ 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);
|
||||
|
||||
@ -148,8 +150,8 @@ void TerminalStripDrawer::paint(QPainter *painter)
|
||||
if (const auto 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),
|
||||
@ -188,45 +190,65 @@ 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<RealTerminal>> real_terminal{physical_t->realTerminals()};
|
||||
const auto real_t_count{real_terminal.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;
|
||||
}
|
||||
|
@ -19,7 +19,7 @@
|
||||
#define TERMINALSTRIPDRAWER_H
|
||||
|
||||
#include <QPointer>
|
||||
#include "terminalstriplayoutpattern.h"
|
||||
#include "properties/terminalstriplayoutpattern.h"
|
||||
|
||||
class QPainter;
|
||||
class TerminalStrip;
|
||||
@ -27,19 +27,23 @@ class TerminalStrip;
|
||||
class TerminalStripDrawer
|
||||
{
|
||||
public:
|
||||
TerminalStripDrawer(QPointer<TerminalStrip> strip = QPointer<TerminalStrip>());
|
||||
TerminalStripDrawer(QPointer<TerminalStrip> strip = QPointer<TerminalStrip>(),
|
||||
QSharedPointer<TerminalStripLayoutPattern> layout = QSharedPointer<TerminalStripLayoutPattern>());
|
||||
|
||||
void setStrip(TerminalStrip *strip);
|
||||
void paint(QPainter *painter);
|
||||
QRectF boundingRect() const;
|
||||
|
||||
void setLayout(QSharedPointer<TerminalStripLayoutPattern> layout);
|
||||
bool haveLayout() const;
|
||||
|
||||
private:
|
||||
int height() const;
|
||||
int width() const;
|
||||
|
||||
private:
|
||||
QPointer<TerminalStrip> m_strip;
|
||||
TerminalStripLayoutPattern m_pattern;
|
||||
QSharedPointer<TerminalStripLayoutPattern> m_pattern;
|
||||
};
|
||||
|
||||
#endif // TERMINALSTRIPDRAWER_H
|
||||
|
@ -18,9 +18,10 @@
|
||||
#include "terminalstripitem.h"
|
||||
|
||||
#include "../diagram.h"
|
||||
#include "../../qetgraphicsitem/qgraphicsitemutility.h"
|
||||
#include "../terminalstrip.h"
|
||||
#include "../ui/terminalstripeditorwindow.h"
|
||||
#include "../../project/projectpropertieshandler.h"
|
||||
#include "../../qetgraphicsitem/qgraphicsitemutility.h"
|
||||
|
||||
TerminalStripItem::TerminalStripItem(QPointer<TerminalStrip> strip, QGraphicsItem *parent) :
|
||||
QetGraphicsItem{parent},
|
||||
@ -29,6 +30,7 @@ TerminalStripItem::TerminalStripItem(QPointer<TerminalStrip> strip, QGraphicsIte
|
||||
{
|
||||
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
|
||||
setAcceptHoverEvents(true);
|
||||
setDefaultLayout();
|
||||
}
|
||||
|
||||
TerminalStripItem::TerminalStripItem(QGraphicsItem *parent) :
|
||||
@ -43,6 +45,10 @@ void TerminalStripItem::setTerminalStrip(TerminalStrip *strip)
|
||||
m_strip = strip;
|
||||
m_drawer.setStrip(strip);
|
||||
m_pending_strip_uuid = QUuid();
|
||||
|
||||
if (!m_drawer.haveLayout()) {
|
||||
setDefaultLayout();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -105,3 +111,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());
|
||||
}
|
||||
}
|
||||
|
@ -50,6 +50,11 @@ class TerminalStripItem : public QetGraphicsItem
|
||||
|
||||
void refreshPending();
|
||||
|
||||
void setLayout(QSharedPointer<TerminalStripLayoutPattern> layout);
|
||||
|
||||
private:
|
||||
void setDefaultLayout();
|
||||
|
||||
private:
|
||||
QPointer<TerminalStrip> m_strip;
|
||||
TerminalStripDrawer m_drawer;
|
||||
|
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
|
@ -51,12 +51,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;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -68,7 +74,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);
|
||||
@ -89,7 +96,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 *)
|
||||
|
Loading…
x
Reference in New Issue
Block a user