mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-09-13 20:23:04 +02:00
correct more indentations / whitespace
This commit is contained in:
parent
17030aaa80
commit
fa68d545d0
@ -111,10 +111,10 @@ QStringList ElementsCollectionModel::mimeTypes() const
|
||||
@return
|
||||
*/
|
||||
bool ElementsCollectionModel::canDropMimeData(const QMimeData *data,
|
||||
Qt::DropAction action,
|
||||
int row,
|
||||
int column,
|
||||
const QModelIndex &parent) const
|
||||
Qt::DropAction action,
|
||||
int row,
|
||||
int column,
|
||||
const QModelIndex &parent) const
|
||||
{
|
||||
if (!(QStandardItemModel::canDropMimeData(data,
|
||||
action,
|
||||
@ -258,9 +258,9 @@ bool ElementsCollectionModel::dropMimeData(const QMimeData *data,
|
||||
@param projects : list of projects to load
|
||||
*/
|
||||
void ElementsCollectionModel::loadCollections(bool common_collection,
|
||||
bool company_collection,
|
||||
bool custom_collection,
|
||||
QList<QETProject *> projects)
|
||||
bool company_collection,
|
||||
bool custom_collection,
|
||||
QList<QETProject *> projects)
|
||||
{
|
||||
m_items_list_to_setUp.clear();
|
||||
|
||||
@ -313,8 +313,8 @@ void ElementsCollectionModel::addCommonCollection(bool set_data)
|
||||
{
|
||||
FileElementCollectionItem *feci = new FileElementCollectionItem();
|
||||
if (feci->setRootPath(QETApp::commonElementsDirN(),
|
||||
set_data,
|
||||
m_hide_element)) {
|
||||
set_data,
|
||||
m_hide_element)) {
|
||||
invisibleRootItem()->appendRow(feci);
|
||||
if (set_data)
|
||||
feci->setUpData();
|
||||
@ -324,41 +324,41 @@ void ElementsCollectionModel::addCommonCollection(bool set_data)
|
||||
}
|
||||
|
||||
/**
|
||||
@brief ElementsCollectionModel::addCompanyCollection
|
||||
Add the company elements collection to this model
|
||||
@param set_data
|
||||
@brief ElementsCollectionModel::addCompanyCollection
|
||||
Add the company elements collection to this model
|
||||
@param set_data
|
||||
*/
|
||||
void ElementsCollectionModel::addCompanyCollection(bool set_data)
|
||||
{
|
||||
FileElementCollectionItem *feci = new FileElementCollectionItem();
|
||||
if (feci->setRootPath(QETApp::companyElementsDirN(),
|
||||
set_data,
|
||||
m_hide_element)) {
|
||||
invisibleRootItem()->appendRow(feci);
|
||||
if (set_data)
|
||||
feci->setUpData();
|
||||
}
|
||||
else
|
||||
delete feci;
|
||||
FileElementCollectionItem *feci = new FileElementCollectionItem();
|
||||
if (feci->setRootPath(QETApp::companyElementsDirN(),
|
||||
set_data,
|
||||
m_hide_element)) {
|
||||
invisibleRootItem()->appendRow(feci);
|
||||
if (set_data)
|
||||
feci->setUpData();
|
||||
}
|
||||
else
|
||||
delete feci;
|
||||
}
|
||||
|
||||
/**
|
||||
@brief ElementsCollectionModel::addCustomCollection
|
||||
Add the custom elements collection to this model
|
||||
@param set_data
|
||||
@brief ElementsCollectionModel::addCustomCollection
|
||||
Add the custom elements collection to this model
|
||||
@param set_data
|
||||
*/
|
||||
void ElementsCollectionModel::addCustomCollection(bool set_data)
|
||||
{
|
||||
FileElementCollectionItem *feci = new FileElementCollectionItem();
|
||||
if (feci->setRootPath(QETApp::customElementsDirN(),
|
||||
set_data,
|
||||
m_hide_element)) {
|
||||
invisibleRootItem()->appendRow(feci);
|
||||
if (set_data)
|
||||
feci->setUpData();
|
||||
}
|
||||
else
|
||||
delete feci;
|
||||
FileElementCollectionItem *feci = new FileElementCollectionItem();
|
||||
if (feci->setRootPath(QETApp::customElementsDirN(),
|
||||
set_data,
|
||||
m_hide_element)) {
|
||||
invisibleRootItem()->appendRow(feci);
|
||||
if (set_data)
|
||||
feci->setUpData();
|
||||
}
|
||||
else
|
||||
delete feci;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -579,9 +579,9 @@ QModelIndex ElementsCollectionModel::indexFromLocation(
|
||||
{
|
||||
QList <ElementCollectionItem *> child_list;
|
||||
|
||||
for (int i=0 ; i<rowCount() ; i++){
|
||||
for (int i=0 ; i<rowCount() ; i++){
|
||||
child_list.append(static_cast<ElementCollectionItem *>(item(i)));
|
||||
}
|
||||
}
|
||||
|
||||
foreach(ElementCollectionItem *eci, child_list) {
|
||||
|
||||
@ -590,8 +590,8 @@ QModelIndex ElementsCollectionModel::indexFromLocation(
|
||||
if (eci->type() == FileElementCollectionItem::Type) {
|
||||
if (FileElementCollectionItem *feci = static_cast<FileElementCollectionItem *>(eci)) {
|
||||
if ( (location.isCommonCollection() && feci->isCommonCollection()) ||
|
||||
(location.isCompanyCollection() && feci->isCompanyCollection()) ||
|
||||
(location.isCustomCollection() && !feci->isCommonCollection()) ) {
|
||||
(location.isCompanyCollection() && feci->isCompanyCollection()) ||
|
||||
(location.isCustomCollection() && !feci->isCommonCollection()) ) {
|
||||
match_eci = feci->itemAtPath(location.collectionPath(false));
|
||||
}
|
||||
}
|
||||
|
@ -42,11 +42,11 @@ class ElementsCollectionModel : public QStandardItemModel
|
||||
bool canDropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const override;
|
||||
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override;
|
||||
|
||||
void loadCollections(bool common_collection, bool company_collection, bool custom_collection, QList<QETProject *> projects);
|
||||
void loadCollections(bool common_collection, bool company_collection, bool custom_collection, QList<QETProject *> projects);
|
||||
|
||||
void addCommonCollection(bool set_data = true);
|
||||
void addCompanyCollection(bool set_data = true);
|
||||
void addCustomCollection(bool set_data = true);
|
||||
void addCommonCollection(bool set_data = true);
|
||||
void addCompanyCollection(bool set_data = true);
|
||||
void addCustomCollection(bool set_data = true);
|
||||
void addLocation(const ElementsLocation& location);
|
||||
|
||||
void addProject(QETProject *project, bool set_data = true);
|
||||
|
@ -96,7 +96,7 @@ void ElementsCollectionWidget::addProject(QETProject *project)
|
||||
m_progress_bar->show();
|
||||
m_tree_view->setDisabled(true);
|
||||
QList <QETProject *> prj; prj.append(project);
|
||||
m_model->loadCollections(false, false, false, prj);
|
||||
m_model->loadCollections(false, false, false, prj);
|
||||
}
|
||||
else {
|
||||
m_waiting_project.append(project);
|
||||
@ -148,26 +148,26 @@ void ElementsCollectionWidget::setUpAction()
|
||||
m_open_dir = new QAction(QET::Icons::FolderOpen,
|
||||
tr("Ouvrir le dossier correspondant"), this);
|
||||
m_edit_element = new QAction(QET::Icons::ElementEdit,
|
||||
tr("Éditer l'élément"), this);
|
||||
tr("Éditer l'élément"), this);
|
||||
m_delete_element = new QAction(QET::Icons::ElementDelete,
|
||||
tr("Supprimer l'élément"), this);
|
||||
tr("Supprimer l'élément"), this);
|
||||
m_delete_dir = new QAction(QET::Icons::FolderDelete,
|
||||
tr("Supprimer le dossier"), this);
|
||||
m_reload = new QAction(QET::Icons::ViewRefresh,
|
||||
tr("Recharger les collections"), this);
|
||||
tr("Recharger les collections"), this);
|
||||
m_edit_dir = new QAction(QET::Icons::FolderEdit,
|
||||
tr("Éditer le dossier"), this);
|
||||
m_new_directory = new QAction(QET::Icons::FolderNew,
|
||||
tr("Nouveau dossier"), this);
|
||||
tr("Nouveau dossier"), this);
|
||||
m_new_element = new QAction(QET::Icons::ElementNew,
|
||||
tr("Nouvel élément"), this);
|
||||
tr("Nouvel élément"), this);
|
||||
m_show_this_dir = new QAction(QET::Icons::FolderOnlyThis,
|
||||
tr("Afficher uniquement ce dossier"),
|
||||
this);
|
||||
tr("Afficher uniquement ce dossier"),
|
||||
this);
|
||||
m_show_all_dir = new QAction(QET::Icons::FolderShowAll,
|
||||
tr("Afficher tous les dossiers"), this);
|
||||
tr("Afficher tous les dossiers"), this);
|
||||
m_dir_propertie = new QAction(QET::Icons::FolderProperties,
|
||||
tr("Propriété du dossier"), this);
|
||||
tr("Propriété du dossier"), this);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -385,10 +385,10 @@ void ElementsCollectionWidget::deleteElement()
|
||||
|
||||
ElementsLocation loc(eci->collectionPath());
|
||||
if (! (loc.isElement()
|
||||
&& loc.exist()
|
||||
&& loc.isFileSystem()
|
||||
&& (loc.collectionPath().startsWith("company://")
|
||||
|| loc.collectionPath().startsWith("custom://"))) ) return;
|
||||
&& loc.exist()
|
||||
&& loc.isFileSystem()
|
||||
&& (loc.collectionPath().startsWith("company://")
|
||||
|| loc.collectionPath().startsWith("custom://"))) ) return;
|
||||
|
||||
if (QET::QetMessageBox::question(
|
||||
this,
|
||||
@ -401,8 +401,8 @@ void ElementsCollectionWidget::deleteElement()
|
||||
if (file.remove())
|
||||
{
|
||||
m_model->removeRows(m_index_at_context_menu.row(),
|
||||
1,
|
||||
m_index_at_context_menu.parent());
|
||||
1,
|
||||
m_index_at_context_menu.parent());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -429,10 +429,10 @@ void ElementsCollectionWidget::deleteDirectory()
|
||||
|
||||
ElementsLocation loc (eci->collectionPath());
|
||||
if (! (loc.isDirectory()
|
||||
&& loc.exist()
|
||||
&& loc.isFileSystem()
|
||||
&& (loc.collectionPath().startsWith("company://")
|
||||
|| loc.collectionPath().startsWith("custom://"))) ) return;
|
||||
&& loc.exist()
|
||||
&& loc.isFileSystem()
|
||||
&& (loc.collectionPath().startsWith("company://")
|
||||
|| loc.collectionPath().startsWith("custom://"))) ) return;
|
||||
|
||||
if (QET::QetMessageBox::question(
|
||||
this,
|
||||
@ -446,8 +446,8 @@ void ElementsCollectionWidget::deleteDirectory()
|
||||
if (dir.removeRecursively())
|
||||
{
|
||||
m_model->removeRows(m_index_at_context_menu.row(),
|
||||
1,
|
||||
m_index_at_context_menu.parent());
|
||||
1,
|
||||
m_index_at_context_menu.parent());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -666,7 +666,7 @@ void ElementsCollectionWidget::reload()
|
||||
this,
|
||||
&ElementsCollectionWidget::loadingFinished);
|
||||
|
||||
m_new_model->loadCollections(true, true, true, project_list);
|
||||
m_new_model->loadCollections(true, true, true, project_list);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -781,13 +781,13 @@ void ElementsCollectionWidget::search()
|
||||
QModelIndexList match_index;
|
||||
for (QString txt : text_list) {
|
||||
match_index << m_model->match(m_showed_index.isValid()
|
||||
? m_model->index(0,0,m_showed_index)
|
||||
: m_model->index(0,0),
|
||||
Qt::UserRole+1,
|
||||
QVariant(txt),
|
||||
-1,
|
||||
Qt::MatchContains
|
||||
| Qt::MatchRecursive);
|
||||
? m_model->index(0,0,m_showed_index)
|
||||
: m_model->index(0,0),
|
||||
Qt::UserRole+1,
|
||||
QVariant(txt),
|
||||
-1,
|
||||
Qt::MatchContains
|
||||
| Qt::MatchRecursive);
|
||||
}
|
||||
|
||||
for(QModelIndex index : match_index)
|
||||
|
@ -293,17 +293,17 @@ void ElementsLocation::setPath(const QString &path)
|
||||
else if (path.startsWith("common://") || path.startsWith("company://") || path.startsWith("custom://"))
|
||||
{
|
||||
QString p;
|
||||
if (path.startsWith("common://"))
|
||||
{
|
||||
tmp_path.remove("common://");
|
||||
p = QETApp::commonElementsDirN() + "/" + tmp_path;
|
||||
}
|
||||
else if (path.startsWith("company://"))
|
||||
{
|
||||
tmp_path.remove("company://");
|
||||
p = QETApp::companyElementsDirN() + "/" + tmp_path;
|
||||
}
|
||||
else
|
||||
if (path.startsWith("common://"))
|
||||
{
|
||||
tmp_path.remove("common://");
|
||||
p = QETApp::commonElementsDirN() + "/" + tmp_path;
|
||||
}
|
||||
else if (path.startsWith("company://"))
|
||||
{
|
||||
tmp_path.remove("company://");
|
||||
p = QETApp::companyElementsDirN() + "/" + tmp_path;
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp_path.remove("custom://");
|
||||
p = QETApp::customElementsDirN() + "/" + tmp_path;
|
||||
@ -319,19 +319,19 @@ void ElementsLocation::setPath(const QString &path)
|
||||
if(path_.endsWith(".elmt"))
|
||||
{
|
||||
m_file_system_path = path_;
|
||||
if (path_.startsWith(QETApp::commonElementsDirN()))
|
||||
{
|
||||
path_.remove(QETApp::commonElementsDirN()+="/");
|
||||
path_.prepend("common://");
|
||||
m_collection_path = path_;
|
||||
}
|
||||
else if (path_.startsWith(QETApp::companyElementsDirN()))
|
||||
{
|
||||
path_.remove(QETApp::companyElementsDirN()+="/");
|
||||
path_.prepend("company://");
|
||||
m_collection_path = path_;
|
||||
}
|
||||
else if (path_.startsWith(QETApp::customElementsDirN()))
|
||||
if (path_.startsWith(QETApp::commonElementsDirN()))
|
||||
{
|
||||
path_.remove(QETApp::commonElementsDirN()+="/");
|
||||
path_.prepend("common://");
|
||||
m_collection_path = path_;
|
||||
}
|
||||
else if (path_.startsWith(QETApp::companyElementsDirN()))
|
||||
{
|
||||
path_.remove(QETApp::companyElementsDirN()+="/");
|
||||
path_.prepend("company://");
|
||||
m_collection_path = path_;
|
||||
}
|
||||
else if (path_.startsWith(QETApp::customElementsDirN()))
|
||||
{
|
||||
path_.remove(QETApp::customElementsDirN()+="/");
|
||||
path_.prepend("custom://");
|
||||
@ -341,19 +341,19 @@ void ElementsLocation::setPath(const QString &path)
|
||||
else
|
||||
{
|
||||
m_file_system_path = path_;
|
||||
if (path_.startsWith(QETApp::commonElementsDirN()))
|
||||
{
|
||||
path_.remove(QETApp::commonElementsDirN()+="/");
|
||||
path_.prepend("common://");
|
||||
m_collection_path = path_;
|
||||
}
|
||||
else if (path_.startsWith(QETApp::companyElementsDirN()))
|
||||
{
|
||||
path_.remove(QETApp::companyElementsDirN()+="/");
|
||||
path_.prepend("company://");
|
||||
m_collection_path = path_;
|
||||
}
|
||||
else if (path_.startsWith(QETApp::customElementsDirN()))
|
||||
if (path_.startsWith(QETApp::commonElementsDirN()))
|
||||
{
|
||||
path_.remove(QETApp::commonElementsDirN()+="/");
|
||||
path_.prepend("common://");
|
||||
m_collection_path = path_;
|
||||
}
|
||||
else if (path_.startsWith(QETApp::companyElementsDirN()))
|
||||
{
|
||||
path_.remove(QETApp::companyElementsDirN()+="/");
|
||||
path_.prepend("company://");
|
||||
m_collection_path = path_;
|
||||
}
|
||||
else if (path_.startsWith(QETApp::customElementsDirN()))
|
||||
{
|
||||
path_.remove(QETApp::customElementsDirN()+="/");
|
||||
path_.prepend("custom://");
|
||||
@ -501,23 +501,23 @@ bool ElementsLocation::isFileSystem() const
|
||||
}
|
||||
|
||||
/**
|
||||
@brief ElementsLocation::isCommonCollection
|
||||
@return
|
||||
True if this location represent an item from the common collection
|
||||
@brief ElementsLocation::isCommonCollection
|
||||
@return
|
||||
True if this location represent an item from the common collection
|
||||
*/
|
||||
bool ElementsLocation::isCommonCollection() const
|
||||
{
|
||||
return fileSystemPath().startsWith(QETApp::commonElementsDirN());
|
||||
return fileSystemPath().startsWith(QETApp::commonElementsDirN());
|
||||
}
|
||||
|
||||
/**
|
||||
@brief ElementsLocation::isCompanyCollection
|
||||
@return
|
||||
True if this location represent an item from the company collection
|
||||
@brief ElementsLocation::isCompanyCollection
|
||||
@return
|
||||
True if this location represent an item from the company collection
|
||||
*/
|
||||
bool ElementsLocation::isCompanyCollection() const
|
||||
{
|
||||
return fileSystemPath().startsWith(QETApp::companyElementsDirN());
|
||||
return fileSystemPath().startsWith(QETApp::companyElementsDirN());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -75,9 +75,9 @@ class ElementsLocation
|
||||
bool isElement() const;
|
||||
bool isDirectory() const;
|
||||
bool isFileSystem() const;
|
||||
bool isCommonCollection() const;
|
||||
bool isCompanyCollection() const;
|
||||
bool isCustomCollection() const;
|
||||
bool isCommonCollection() const;
|
||||
bool isCompanyCollection() const;
|
||||
bool isCustomCollection() const;
|
||||
bool isProject() const;
|
||||
bool exist() const;
|
||||
bool isWritable() const;
|
||||
|
@ -41,8 +41,8 @@ FileElementCollectionItem::FileElementCollectionItem()
|
||||
@return true if path exist.
|
||||
*/
|
||||
bool FileElementCollectionItem::setRootPath(const QString& path,
|
||||
bool set_data,
|
||||
bool hide_element)
|
||||
bool set_data,
|
||||
bool hide_element)
|
||||
{
|
||||
QDir dir(path);
|
||||
if (dir.exists())
|
||||
@ -120,11 +120,11 @@ QString FileElementCollectionItem::localName()
|
||||
|
||||
else if (isDir()) {
|
||||
if (isCollectionRoot()) {
|
||||
if (m_path == QETApp::commonElementsDirN())
|
||||
setText(QObject::tr("Collection QET"));
|
||||
else if (m_path == QETApp::companyElementsDirN())
|
||||
setText(QObject::tr("Collection Company"));
|
||||
else if (m_path == QETApp::customElementsDirN())
|
||||
if (m_path == QETApp::commonElementsDirN())
|
||||
setText(QObject::tr("Collection QET"));
|
||||
else if (m_path == QETApp::companyElementsDirN())
|
||||
setText(QObject::tr("Collection Company"));
|
||||
else if (m_path == QETApp::customElementsDirN())
|
||||
setText(QObject::tr("Collection utilisateur"));
|
||||
else
|
||||
setText(QObject::tr("Collection inconnue"));
|
||||
@ -221,29 +221,29 @@ QString FileElementCollectionItem::collectionPath() const
|
||||
bool FileElementCollectionItem::isCollectionRoot() const
|
||||
{
|
||||
if (m_path == QETApp::commonElementsDirN()
|
||||
|| m_path == QETApp::companyElementsDirN()
|
||||
|| m_path == QETApp::customElementsDirN())
|
||||
return true;
|
||||
|| m_path == QETApp::companyElementsDirN()
|
||||
|| m_path == QETApp::customElementsDirN())
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@brief FileElementCollectionItem::isCommonCollection
|
||||
@return True if this item represent the common collection
|
||||
@brief FileElementCollectionItem::isCommonCollection
|
||||
@return True if this item represent the common collection
|
||||
*/
|
||||
bool FileElementCollectionItem::isCommonCollection() const
|
||||
{
|
||||
return fileSystemPath().startsWith(QETApp::commonElementsDirN());
|
||||
return fileSystemPath().startsWith(QETApp::commonElementsDirN());
|
||||
}
|
||||
|
||||
/**
|
||||
@brief FileElementCollectionItem::isCompanyCollection
|
||||
@return True if this item represent the company collection
|
||||
@brief FileElementCollectionItem::isCompanyCollection
|
||||
@return True if this item represent the company collection
|
||||
*/
|
||||
bool FileElementCollectionItem::isCompanyCollection() const
|
||||
{
|
||||
return fileSystemPath().startsWith(QETApp::companyElementsDirN());
|
||||
return fileSystemPath().startsWith(QETApp::companyElementsDirN());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -347,8 +347,8 @@ void FileElementCollectionItem::setUpIcon()
|
||||
@param hide_element
|
||||
*/
|
||||
void FileElementCollectionItem::setPathName(const QString& path_name,
|
||||
bool set_data,
|
||||
bool hide_element)
|
||||
bool set_data,
|
||||
bool hide_element)
|
||||
{
|
||||
m_path = path_name;
|
||||
|
||||
|
@ -47,9 +47,9 @@ class FileElementCollectionItem : public ElementCollectionItem
|
||||
QString name() const override;
|
||||
QString collectionPath() const override;
|
||||
bool isCollectionRoot() const override;
|
||||
bool isCommonCollection() const;
|
||||
bool isCompanyCollection() const;
|
||||
bool isCustomCollection() const;
|
||||
bool isCommonCollection() const;
|
||||
bool isCompanyCollection() const;
|
||||
bool isCustomCollection() const;
|
||||
void addChildAtPath(const QString &collection_name) override;
|
||||
|
||||
void setUpData() override;
|
||||
|
@ -195,10 +195,10 @@ QRectF QetGraphicsHandlerUtility::mirrorRectForPosAtIndex(
|
||||
*/
|
||||
QRectF QetGraphicsHandlerUtility::rectForArc(const QRectF &rect, qreal start_angle, qreal span_angle)
|
||||
{
|
||||
QPainterPath path;
|
||||
path.arcMoveTo(rect, start_angle);
|
||||
path.arcTo(rect, start_angle, span_angle);
|
||||
return path.boundingRect();
|
||||
QPainterPath path;
|
||||
path.arcMoveTo(rect, start_angle);
|
||||
path.arcTo(rect, start_angle, span_angle);
|
||||
return path.boundingRect();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2024 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 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.
|
||||
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/>.
|
||||
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"
|
||||
|
||||
@ -21,132 +21,132 @@ namespace TerminalStripDrawer
|
||||
{
|
||||
|
||||
/*========= DemoBridge =========*/
|
||||
class DemoBridge : public AbstractBridgeInterface
|
||||
{
|
||||
public:
|
||||
DemoBridge(const QUuid &uuid) :
|
||||
m_uuid { uuid } {}
|
||||
class DemoBridge : public AbstractBridgeInterface
|
||||
{
|
||||
public:
|
||||
DemoBridge(const QUuid &uuid) :
|
||||
m_uuid { uuid } {}
|
||||
|
||||
QUuid uuid() const override {
|
||||
return m_uuid;
|
||||
}
|
||||
QUuid uuid() const override {
|
||||
return m_uuid;
|
||||
}
|
||||
|
||||
private:
|
||||
const QUuid 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 }
|
||||
{}
|
||||
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;
|
||||
}
|
||||
QString label() const override {
|
||||
return m_label;
|
||||
}
|
||||
|
||||
bool isBridged() const override {
|
||||
return true;
|
||||
}
|
||||
bool isBridged() const override {
|
||||
return true;
|
||||
}
|
||||
|
||||
DemoBridge *bridge() const override {
|
||||
return new DemoBridge { m_bridge };
|
||||
}
|
||||
DemoBridge *bridge() const override {
|
||||
return new DemoBridge { m_bridge };
|
||||
}
|
||||
|
||||
private:
|
||||
QString m_label;
|
||||
QUuid 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}
|
||||
{}
|
||||
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;
|
||||
}
|
||||
QVector<QSharedPointer<AbstractRealTerminalInterface>> realTerminals() const override {
|
||||
return m_real_terminals;
|
||||
}
|
||||
|
||||
private:
|
||||
QVector<QSharedPointer<AbstractRealTerminalInterface>> m_real_terminals;
|
||||
};
|
||||
private:
|
||||
QVector<QSharedPointer<AbstractRealTerminalInterface>> m_real_terminals;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*========= DemoTerminalStrip =========*/
|
||||
|
||||
/**
|
||||
* @brief DemoTerminalStrip::DemoTerminalStrip
|
||||
*/
|
||||
DemoTerminalStrip::DemoTerminalStrip()
|
||||
{
|
||||
build();
|
||||
}
|
||||
/**
|
||||
* @brief DemoTerminalStrip::DemoTerminalStrip
|
||||
*/
|
||||
DemoTerminalStrip::DemoTerminalStrip()
|
||||
{
|
||||
build();
|
||||
}
|
||||
|
||||
QVector<QSharedPointer<AbstractPhysicalTerminalInterface> > DemoTerminalStrip::physicalTerminal() const
|
||||
{
|
||||
return m_physical_terminal;
|
||||
}
|
||||
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();
|
||||
QUuid lvl_4 = QUuid::createUuid();
|
||||
void DemoTerminalStrip::build()
|
||||
{
|
||||
QUuid lvl_1 = QUuid::createUuid();
|
||||
QUuid lvl_2 = QUuid::createUuid();
|
||||
QUuid lvl_3 = QUuid::createUuid();
|
||||
QUuid lvl_4 = QUuid::createUuid();
|
||||
|
||||
QVector <QSharedPointer<AbstractRealTerminalInterface>> real_terminals_vector;
|
||||
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)};
|
||||
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
|
||||
new DemoRealTerminal( QStringLiteral("teach"),
|
||||
lvl_4)};
|
||||
m_physical_terminal << QSharedPointer<AbstractPhysicalTerminalInterface> {
|
||||
new DemoPhysicalTerminal {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)};
|
||||
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
|
||||
new DemoRealTerminal( QStringLiteral("teach"),
|
||||
lvl_4)};
|
||||
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)};
|
||||
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
|
||||
new DemoRealTerminal( QStringLiteral("teach"),
|
||||
lvl_4)};
|
||||
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)};
|
||||
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
|
||||
new DemoRealTerminal( QStringLiteral("teach"),
|
||||
lvl_4)};
|
||||
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)};
|
||||
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
|
||||
new DemoRealTerminal( QStringLiteral("teach"),
|
||||
lvl_4)};
|
||||
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)};
|
||||
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
|
||||
new DemoRealTerminal( QStringLiteral("teach"),
|
||||
lvl_4)};
|
||||
m_physical_terminal << QSharedPointer<AbstractPhysicalTerminalInterface> {
|
||||
new DemoPhysicalTerminal {real_terminals_vector}};
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2024 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 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.
|
||||
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/>.
|
||||
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
|
||||
@ -24,25 +24,25 @@ namespace TerminalStripDrawer {
|
||||
|
||||
class DemoTerminalStrip : public AbstractTerminalStripInterface
|
||||
{
|
||||
public:
|
||||
DemoTerminalStrip();
|
||||
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;
|
||||
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:
|
||||
void build();
|
||||
|
||||
private:
|
||||
QVector<QSharedPointer<AbstractPhysicalTerminalInterface>> m_physical_terminal;
|
||||
private:
|
||||
QVector<QSharedPointer<AbstractPhysicalTerminalInterface>> m_physical_terminal;
|
||||
};
|
||||
|
||||
} //End namespace TerminalStripDrawer
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2024 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 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.
|
||||
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/>.
|
||||
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"
|
||||
|
||||
@ -22,11 +22,11 @@
|
||||
TerminalStripLayoutsHandler::TerminalStripLayoutsHandler()
|
||||
{
|
||||
|
||||
m_default_layout = QSharedPointer<TerminalStripLayoutPattern>::create();
|
||||
m_default_layout->m_name = QObject::tr("Disposition par défaut");
|
||||
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;
|
||||
return m_default_layout;
|
||||
}
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2024 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 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.
|
||||
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/>.
|
||||
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
|
||||
@ -29,13 +29,13 @@
|
||||
*/
|
||||
class TerminalStripLayoutsHandler
|
||||
{
|
||||
public:
|
||||
TerminalStripLayoutsHandler();
|
||||
QSharedPointer<TerminalStripLayoutPattern> defaultLayout();
|
||||
public:
|
||||
TerminalStripLayoutsHandler();
|
||||
QSharedPointer<TerminalStripLayoutPattern> defaultLayout();
|
||||
|
||||
private:
|
||||
QSet<QSharedPointer<TerminalStripLayoutPattern>> m_layout_set;
|
||||
QSharedPointer<TerminalStripLayoutPattern> m_default_layout;
|
||||
private:
|
||||
QSet<QSharedPointer<TerminalStripLayoutPattern>> m_layout_set;
|
||||
QSharedPointer<TerminalStripLayoutPattern> m_default_layout;
|
||||
};
|
||||
|
||||
#endif // TERMINALSTRIPLAYOUTSHANDLER_H
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2024 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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "terminalstripdrawer.h"
|
||||
#include <QPainter>
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2024 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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef TERMINALSTRIPDRAWER_H
|
||||
#define TERMINALSTRIPDRAWER_H
|
||||
@ -27,67 +27,67 @@ class TerminalStrip;
|
||||
|
||||
namespace TerminalStripDrawer
|
||||
{
|
||||
class AbstractBridgeInterface
|
||||
{
|
||||
public:
|
||||
AbstractBridgeInterface() {}
|
||||
virtual ~AbstractBridgeInterface() {}
|
||||
virtual QUuid uuid() const = 0;
|
||||
};
|
||||
class AbstractBridgeInterface
|
||||
{
|
||||
public:
|
||||
AbstractBridgeInterface() {}
|
||||
virtual ~AbstractBridgeInterface() {}
|
||||
virtual QUuid uuid() const = 0;
|
||||
};
|
||||
|
||||
class AbstractRealTerminalInterface
|
||||
{
|
||||
public:
|
||||
AbstractRealTerminalInterface() {}
|
||||
virtual ~AbstractRealTerminalInterface() {}
|
||||
virtual QString label() const = 0;
|
||||
virtual bool isBridged() const = 0;
|
||||
virtual AbstractBridgeInterface* bridge() const = 0;
|
||||
};
|
||||
class AbstractRealTerminalInterface
|
||||
{
|
||||
public:
|
||||
AbstractRealTerminalInterface() {}
|
||||
virtual ~AbstractRealTerminalInterface() {}
|
||||
virtual QString label() const = 0;
|
||||
virtual bool isBridged() const = 0;
|
||||
virtual AbstractBridgeInterface* bridge() const = 0;
|
||||
};
|
||||
|
||||
class AbstractPhysicalTerminalInterface
|
||||
{
|
||||
public:
|
||||
AbstractPhysicalTerminalInterface() {}
|
||||
virtual ~AbstractPhysicalTerminalInterface() {}
|
||||
virtual QVector<QSharedPointer<AbstractRealTerminalInterface>> realTerminals() const = 0;
|
||||
};
|
||||
class AbstractPhysicalTerminalInterface
|
||||
{
|
||||
public:
|
||||
AbstractPhysicalTerminalInterface() {}
|
||||
virtual ~AbstractPhysicalTerminalInterface() {}
|
||||
virtual QVector<QSharedPointer<AbstractRealTerminalInterface>> realTerminals() const = 0;
|
||||
};
|
||||
|
||||
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 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>());
|
||||
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 setStrip(QSharedPointer<AbstractTerminalStripInterface> strip);
|
||||
void paint(QPainter *painter);
|
||||
QRectF boundingRect() const;
|
||||
|
||||
void setLayout(QSharedPointer<TerminalStripLayoutPattern> layout);
|
||||
bool haveLayout() const;
|
||||
void setLayout(QSharedPointer<TerminalStripLayoutPattern> layout);
|
||||
bool haveLayout() const;
|
||||
|
||||
void setPreviewDraw(bool draw = true);
|
||||
void setPreviewDraw(bool draw = true);
|
||||
|
||||
private:
|
||||
int height() const;
|
||||
int width() const;
|
||||
private:
|
||||
int height() const;
|
||||
int width() const;
|
||||
|
||||
private:
|
||||
QSharedPointer <AbstractTerminalStripInterface> m_strip;
|
||||
QSharedPointer<TerminalStripLayoutPattern> m_pattern;
|
||||
bool m_preview_draw { false };
|
||||
};
|
||||
private:
|
||||
QSharedPointer <AbstractTerminalStripInterface> m_strip;
|
||||
QSharedPointer<TerminalStripLayoutPattern> m_pattern;
|
||||
bool m_preview_draw { false };
|
||||
};
|
||||
}
|
||||
|
||||
#endif // TERMINALSTRIPDRAWER_H
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2024 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 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.
|
||||
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/>.
|
||||
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"
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2024 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 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.
|
||||
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/>.
|
||||
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
|
||||
@ -27,51 +27,51 @@ class TerminalStripBridge;
|
||||
|
||||
namespace TerminalStripDrawer
|
||||
{
|
||||
class TrueTerminalStrip : public AbstractTerminalStripInterface
|
||||
{
|
||||
public:
|
||||
TrueTerminalStrip(TerminalStrip *strip);
|
||||
class TrueTerminalStrip : public AbstractTerminalStripInterface
|
||||
{
|
||||
public:
|
||||
TrueTerminalStrip(TerminalStrip *strip);
|
||||
|
||||
QString installation() const override;
|
||||
QString location() const override;
|
||||
QString name() const override;
|
||||
QString installation() const override;
|
||||
QString location() const override;
|
||||
QString name() const override;
|
||||
QVector<QSharedPointer<AbstractPhysicalTerminalInterface>> physicalTerminal() const override;
|
||||
|
||||
private:
|
||||
QPointer<TerminalStrip> m_strip;
|
||||
};
|
||||
private:
|
||||
QPointer<TerminalStrip> m_strip;
|
||||
};
|
||||
|
||||
class TruePhysicalTerminal : public AbstractPhysicalTerminalInterface
|
||||
{
|
||||
public:
|
||||
TruePhysicalTerminal(QSharedPointer<PhysicalTerminal> physical);
|
||||
QVector<QSharedPointer<AbstractRealTerminalInterface>> realTerminals() const override;
|
||||
class TruePhysicalTerminal : public AbstractPhysicalTerminalInterface
|
||||
{
|
||||
public:
|
||||
TruePhysicalTerminal(QSharedPointer<PhysicalTerminal> physical);
|
||||
QVector<QSharedPointer<AbstractRealTerminalInterface>> realTerminals() const override;
|
||||
|
||||
private:
|
||||
QSharedPointer<PhysicalTerminal> m_physical;
|
||||
};
|
||||
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;
|
||||
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;
|
||||
};
|
||||
private:
|
||||
QSharedPointer<RealTerminal> m_real;
|
||||
};
|
||||
|
||||
class TrueBridge : public AbstractBridgeInterface
|
||||
{
|
||||
public:
|
||||
TrueBridge(QSharedPointer<TerminalStripBridge> bridge);
|
||||
QUuid uuid() const override;
|
||||
class TrueBridge : public AbstractBridgeInterface
|
||||
{
|
||||
public:
|
||||
TrueBridge(QSharedPointer<TerminalStripBridge> bridge);
|
||||
QUuid uuid() const override;
|
||||
|
||||
private:
|
||||
QSharedPointer<TerminalStripBridge> m_bridge;
|
||||
};
|
||||
private:
|
||||
QSharedPointer<TerminalStripBridge> m_bridge;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // TRUETERMINALSTRIP_H
|
||||
|
@ -63,7 +63,7 @@ namespace autonum
|
||||
public:
|
||||
static QString formulaToLabel (QString formula, sequentialNumbers &seqStruct, Diagram *diagram, const Element *elmt = nullptr);
|
||||
static QString replaceVariable (const QString &formula, const DiagramContext &dc);
|
||||
static QString genericXref (const Element *element);
|
||||
static QString genericXref (const Element *element);
|
||||
|
||||
private:
|
||||
AssignVariables(const QString& formula, const sequentialNumbers& seqStruct , Diagram *diagram, const Element *elmt = nullptr);
|
||||
|
@ -23,8 +23,8 @@
|
||||
#include <QKeyEvent>
|
||||
|
||||
DiagramEventInterface::DiagramEventInterface(Diagram *diagram) :
|
||||
QObject{diagram},
|
||||
m_diagram{diagram}
|
||||
QObject{diagram},
|
||||
m_diagram{diagram}
|
||||
{
|
||||
m_diagram -> clearSelection();
|
||||
}
|
||||
|
@ -64,9 +64,9 @@ class DiagramEventInterface : public QObject
|
||||
void finish(); //Emitted when the interface finishes its job.
|
||||
|
||||
protected:
|
||||
QPointer<Diagram> m_diagram;
|
||||
bool m_running{false};
|
||||
bool m_abort{false};
|
||||
QPointer<Diagram> m_diagram;
|
||||
bool m_running{false};
|
||||
bool m_abort{false};
|
||||
};
|
||||
|
||||
#endif // DIAGRAMEVENTINTERFACE_H
|
||||
|
@ -87,16 +87,16 @@ void ArcEditor::setUpChangeConnections()
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO implement position changes!")
|
||||
#endif
|
||||
// TODO: implement position changes!
|
||||
//m_change_connections << connect(part, &PartArc::)
|
||||
// TODO: implement position changes!
|
||||
//m_change_connections << connect(part, &PartArc::)
|
||||
}
|
||||
|
||||
void ArcEditor::disconnectChangeConnections()
|
||||
{
|
||||
for (QMetaObject::Connection c : m_change_connections) {
|
||||
for (QMetaObject::Connection c : m_change_connections) {
|
||||
disconnect(c);
|
||||
}
|
||||
m_change_connections.clear();
|
||||
}
|
||||
m_change_connections.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -247,21 +247,21 @@ class changeElementDataCommand : public ElementEditionCommand
|
||||
};
|
||||
|
||||
/**
|
||||
@brief The RotateSelectionInESCommand class
|
||||
Rotate the selected items in the element editor
|
||||
@brief The RotateSelectionInESCommand class
|
||||
Rotate the selected items in the element editor
|
||||
*/
|
||||
|
||||
class RotateElementsCommand : public ElementEditionCommand
|
||||
{
|
||||
|
||||
public:
|
||||
RotateElementsCommand(ElementScene *scene, QUndoCommand *parent=nullptr);
|
||||
void undo() override;
|
||||
void redo() override;
|
||||
RotateElementsCommand(ElementScene *scene, QUndoCommand *parent=nullptr);
|
||||
void undo() override;
|
||||
void redo() override;
|
||||
|
||||
private:
|
||||
ElementScene *m_scene =nullptr;
|
||||
QList<QGraphicsItem*> m_items;
|
||||
ElementScene *m_scene =nullptr;
|
||||
QList<QGraphicsItem*> m_items;
|
||||
|
||||
};
|
||||
|
||||
|
@ -449,7 +449,7 @@ const QDomDocument ElementScene::toXml(bool all_parts)
|
||||
root.setAttribute("hotspot_y", QString("%1").arg(
|
||||
-(qRound(size.y() - (ymargin/2)))));
|
||||
|
||||
QetVersion::toXmlAttribute(root);
|
||||
QetVersion::toXmlAttribute(root);
|
||||
root.setAttribute("link_type", m_element_data.typeToString(m_element_data.m_type));
|
||||
|
||||
//Uuid used to compare two elements
|
||||
|
@ -125,6 +125,6 @@ class PartLine : public CustomElementGraphicPart
|
||||
int m_vector_index = -1;
|
||||
QPropertyUndoCommand *m_undo_command;
|
||||
QVector<QetGraphicsHandlerItem *> m_handler_vector;
|
||||
qreal m_rot;
|
||||
qreal m_rot;
|
||||
};
|
||||
#endif
|
||||
|
@ -117,6 +117,6 @@ class PartPolygon : public CustomElementGraphicPart
|
||||
QAction *m_insert_point,
|
||||
*m_remove_point;
|
||||
QPointF m_context_menu_pos;
|
||||
qreal m_rot;
|
||||
qreal m_rot;
|
||||
};
|
||||
#endif
|
||||
|
@ -31,7 +31,7 @@
|
||||
PartRectangle::PartRectangle(QETElementEditor *editor, QGraphicsItem *parent) :
|
||||
CustomElementGraphicPart(editor, parent)
|
||||
{
|
||||
m_rot=0;
|
||||
m_rot=0;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -201,7 +201,7 @@ QRectF PartRectangle::sceneGeometricRect() const
|
||||
*/
|
||||
QPointF PartRectangle::sceneTopLeft() const
|
||||
{
|
||||
return(mapToScene(rect().topLeft()));
|
||||
return(mapToScene(rect().topLeft()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -34,7 +34,7 @@ class PartRectangle : public CustomElementGraphicPart
|
||||
Q_PROPERTY(QRectF rect READ rect WRITE setRect)
|
||||
Q_PROPERTY(qreal xRadius READ XRadius WRITE setXRadius NOTIFY XRadiusChanged)
|
||||
Q_PROPERTY(qreal yRadius READ YRadius WRITE setYRadius NOTIFY YRadiusChanged)
|
||||
Q_PROPERTY(qreal rotation READ rotation WRITE setRotation NOTIFY rotationChanged)
|
||||
Q_PROPERTY(qreal rotation READ rotation WRITE setRotation NOTIFY rotationChanged)
|
||||
|
||||
// constructors, destructor
|
||||
public:
|
||||
@ -48,7 +48,7 @@ class PartRectangle : public CustomElementGraphicPart
|
||||
void rectChanged();
|
||||
void XRadiusChanged();
|
||||
void YRadiusChanged();
|
||||
void rotationChanged();
|
||||
void rotationChanged();
|
||||
|
||||
// methods
|
||||
public:
|
||||
@ -112,6 +112,6 @@ class PartRectangle : public CustomElementGraphicPart
|
||||
m_old_xRadius,
|
||||
m_old_yRadius;
|
||||
bool m_modifie_radius_equaly = false;
|
||||
qreal m_rot;
|
||||
qreal m_rot;
|
||||
};
|
||||
#endif
|
||||
|
@ -72,7 +72,7 @@ class PartTerminal : public CustomElementGraphicPart
|
||||
void handleUserTransformation(const QRectF &, const QRectF &) override;
|
||||
|
||||
Qet::Orientation orientation() const {return d -> m_orientation;}
|
||||
void setOrientation(Qet::Orientation ori);
|
||||
void setOrientation(Qet::Orientation ori);
|
||||
|
||||
qreal rotation() const;
|
||||
void setRotation(qreal angle);
|
||||
|
@ -569,7 +569,7 @@ bool StyleEditor::isStyleEditable(QList<CustomElementPart *> cep_list)
|
||||
QStringList str;
|
||||
str << "arc" << "ellipse" << "line" << "polygon" << "rect";
|
||||
|
||||
for (CustomElementPart *cep: cep_list)
|
||||
for (CustomElementPart *cep: cep_list)
|
||||
if (!str.contains(cep -> xmlName()))
|
||||
return false;
|
||||
|
||||
|
@ -154,16 +154,16 @@ bool ElementPictureFactory::build(const ElementsLocation &location,
|
||||
QDomElement dom = location.xml();
|
||||
|
||||
//Check if the current version can read the xml description
|
||||
const auto elmt_version = QetVersion::fromXmlAttribute(dom);
|
||||
if (!elmt_version.isNull()
|
||||
&& QetVersion::currentVersion() < elmt_version)
|
||||
{
|
||||
std::cerr << qPrintable(
|
||||
QObject::tr("Avertissement : l'élément "
|
||||
" a été enregistré avec une version"
|
||||
" ultérieure de QElectroTech.")
|
||||
) << std::endl;
|
||||
}
|
||||
const auto elmt_version = QetVersion::fromXmlAttribute(dom);
|
||||
if (!elmt_version.isNull()
|
||||
&& QetVersion::currentVersion() < elmt_version)
|
||||
{
|
||||
std::cerr << qPrintable(
|
||||
QObject::tr("Avertissement : l'élément "
|
||||
" a été enregistré avec une version"
|
||||
" ultérieure de QElectroTech.")
|
||||
) << std::endl;
|
||||
}
|
||||
|
||||
//This attributes must be present and valid
|
||||
int w, h, hot_x, hot_y;
|
||||
@ -249,7 +249,7 @@ bool ElementPictureFactory::build(const ElementsLocation &location,
|
||||
|
||||
void ElementPictureFactory::parseElement(const QDomElement &dom, QPainter &painter, primitives &prim) const
|
||||
{
|
||||
if (dom.tagName() == "line") (parseLine (dom, painter, prim));
|
||||
if (dom.tagName() == "line") (parseLine (dom, painter, prim));
|
||||
else if (dom.tagName() == "rect") (parseRect (dom, painter, prim));
|
||||
else if (dom.tagName() == "ellipse") (parseEllipse(dom, painter, prim));
|
||||
else if (dom.tagName() == "circle") (parseCircle (dom, painter, prim));
|
||||
|
@ -86,7 +86,7 @@ void ProjectPrintWindow::launchDialog(QETProject *project, QPrinter::OutputForma
|
||||
if (!file_name.endsWith(".pdf")) {
|
||||
file_name.append(".pdf");
|
||||
}
|
||||
printer_->setCreator(QString("QElectroTech %1").arg(QetVersion::displayedVersion()));
|
||||
printer_->setCreator(QString("QElectroTech %1").arg(QetVersion::displayedVersion()));
|
||||
printer_->setOutputFileName(file_name);
|
||||
printer_->setOutputFormat(QPrinter::PdfFormat);
|
||||
}
|
||||
@ -98,11 +98,11 @@ void ProjectPrintWindow::launchDialog(QETProject *project, QPrinter::OutputForma
|
||||
QString ProjectPrintWindow::docName(QETProject *project)
|
||||
{
|
||||
QString doc_name;
|
||||
if (!project->filePath().isEmpty()) {
|
||||
doc_name = QFileInfo(project->filePath()).baseName();
|
||||
} else if (!project->title().isEmpty()) {
|
||||
doc_name = project->title();
|
||||
doc_name = QET::stringToFileName(doc_name);
|
||||
if (!project->filePath().isEmpty()) {
|
||||
doc_name = QFileInfo(project->filePath()).baseName();
|
||||
} else if (!project->title().isEmpty()) {
|
||||
doc_name = project->title();
|
||||
doc_name = QET::stringToFileName(doc_name);
|
||||
}
|
||||
|
||||
if (doc_name.isEmpty()) {
|
||||
@ -669,7 +669,7 @@ QList<Diagram *> ProjectPrintWindow::selectedDiagram() const
|
||||
|
||||
void ProjectPrintWindow::exportToPDF()
|
||||
{
|
||||
auto file_name = QFileDialog::getSaveFileName(this, tr("Exporter sous : "), m_printer->outputFileName(), tr("Fichier (*.pdf)"));
|
||||
auto file_name = QFileDialog::getSaveFileName(this, tr("Exporter sous : "), m_printer->outputFileName(), tr("Fichier (*.pdf)"));
|
||||
if (file_name.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ class QCheckBox;
|
||||
*/
|
||||
class ProjectPrintWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static void launchDialog(QETProject *project, QPrinter::OutputFormat format = QPrinter::NativeFormat, QWidget *parent = nullptr);
|
||||
|
@ -1,30 +1,30 @@
|
||||
/*
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2024 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 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.
|
||||
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/>.
|
||||
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)
|
||||
m_project(project)
|
||||
{
|
||||
}
|
||||
|
||||
TerminalStripLayoutsHandler &ProjectPropertiesHandler::terminalStripLayoutHandler()
|
||||
{
|
||||
return m_terminal_strip_layout_handler;
|
||||
return m_terminal_strip_layout_handler;
|
||||
}
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2024 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 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.
|
||||
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/>.
|
||||
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
|
||||
@ -39,15 +39,15 @@ class QETProject;
|
||||
*/
|
||||
class ProjectPropertiesHandler
|
||||
{
|
||||
public:
|
||||
ProjectPropertiesHandler(QETProject *project);
|
||||
public:
|
||||
ProjectPropertiesHandler(QETProject *project);
|
||||
|
||||
TerminalStripLayoutsHandler& terminalStripLayoutHandler();
|
||||
TerminalStripLayoutsHandler& terminalStripLayoutHandler();
|
||||
|
||||
private:
|
||||
QPointer<QETProject> m_project;
|
||||
private:
|
||||
QPointer<QETProject> m_project;
|
||||
|
||||
TerminalStripLayoutsHandler m_terminal_strip_layout_handler;
|
||||
TerminalStripLayoutsHandler m_terminal_strip_layout_handler;
|
||||
};
|
||||
|
||||
#endif // PROJECTPROPERTIESHANDLER_H
|
||||
|
@ -443,7 +443,7 @@ ElementData::SlaveState ElementData::slaveStateFromString(const QString &string)
|
||||
return ElementData::SW;
|
||||
} else if (string == QLatin1String("Other")){
|
||||
return ElementData::Other;
|
||||
}
|
||||
}
|
||||
|
||||
qDebug() << "ElementData::slaveStateFromString : string : "
|
||||
<< string
|
||||
|
@ -1765,29 +1765,29 @@ void Conductor::setSequenceNum(const autonum::sequentialNumbers& sn)
|
||||
*/
|
||||
void Conductor::setUpConnectionForFormula(QString old_formula, QString new_formula)
|
||||
{
|
||||
Diagram *diagram_ {diagram()};
|
||||
if (!diagram_) {
|
||||
diagram_ = terminal1->diagram();
|
||||
}
|
||||
if (diagram_)
|
||||
Diagram *diagram_ {diagram()};
|
||||
if (!diagram_) {
|
||||
diagram_ = terminal1->diagram();
|
||||
}
|
||||
if (diagram_)
|
||||
{
|
||||
//Because the variable %F is a reference to another text which can contain variables,
|
||||
//we must replace %F by the real text, to check if the real text contains the variable %id
|
||||
if (old_formula.contains("%F"))
|
||||
old_formula.replace("%F", diagram_->border_and_titleblock.folio());
|
||||
old_formula.replace("%F", diagram_->border_and_titleblock.folio());
|
||||
|
||||
if (old_formula.contains("%id"))
|
||||
disconnect(diagram_->project(), &QETProject::projectDiagramsOrderChanged, this, &Conductor::refreshText);
|
||||
disconnect(diagram_->project(), &QETProject::projectDiagramsOrderChanged, this, &Conductor::refreshText);
|
||||
|
||||
//Label is frozen, so we don't update it.
|
||||
if (m_freeze_label == true)
|
||||
return;
|
||||
|
||||
if (new_formula.contains("%F"))
|
||||
new_formula.replace("%F", diagram_->border_and_titleblock.folio());
|
||||
new_formula.replace("%F", diagram_->border_and_titleblock.folio());
|
||||
|
||||
if (new_formula.contains("%id"))
|
||||
connect(diagram_->project(), &QETProject::projectDiagramsOrderChanged, this, &Conductor::refreshText);
|
||||
connect(diagram_->project(), &QETProject::projectDiagramsOrderChanged, this, &Conductor::refreshText);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -137,7 +137,7 @@ class Conductor : public QGraphicsObject
|
||||
{return m_autoNum_seq;}
|
||||
void setSequenceNum(const autonum::sequentialNumbers& sn);
|
||||
|
||||
QList<QPointF> junctions() const;
|
||||
QList<QPointF> junctions() const;
|
||||
|
||||
private:
|
||||
void setUpConnectionForFormula(
|
||||
@ -227,7 +227,7 @@ class Conductor : public QGraphicsObject
|
||||
static int getCoeff(const qreal &, const qreal &);
|
||||
static int getSign(const qreal &);
|
||||
QHash<ConductorSegmentProfile *, qreal> shareOffsetBetweenSegments(const qreal &offset, const QList<ConductorSegmentProfile *> &, const qreal & = 0.01) const;
|
||||
static QPointF extendTerminal(const QPointF &, Qet::Orientation, qreal = 10);
|
||||
static QPointF extendTerminal(const QPointF &, Qet::Orientation, qreal = 10);
|
||||
static Qt::Corner movementType(const QPointF &, const QPointF &);
|
||||
static QPointF movePointIntoPolygon(const QPointF &, const QPainterPath &);
|
||||
};
|
||||
|
@ -427,17 +427,17 @@ bool Element::buildFromXml(const QDomElement &xml_def_elmt, int *state)
|
||||
return(false);
|
||||
}
|
||||
|
||||
//Check if the current version can read the xml description
|
||||
const auto elmt_version = QetVersion::fromXmlAttribute(xml_def_elmt);
|
||||
if (!elmt_version.isNull()
|
||||
&& QetVersion::currentVersion() < elmt_version)
|
||||
{
|
||||
std::cerr << qPrintable(
|
||||
QObject::tr("Avertissement : l'élément "
|
||||
" a été enregistré avec une version"
|
||||
" ultérieure de QElectroTech.")
|
||||
) << std::endl;
|
||||
}
|
||||
//Check if the current version can read the xml description
|
||||
const auto elmt_version = QetVersion::fromXmlAttribute(xml_def_elmt);
|
||||
if (!elmt_version.isNull()
|
||||
&& QetVersion::currentVersion() < elmt_version)
|
||||
{
|
||||
std::cerr << qPrintable(
|
||||
QObject::tr("Avertissement : l'élément "
|
||||
" a été enregistré avec une version"
|
||||
" ultérieure de QElectroTech.")
|
||||
) << std::endl;
|
||||
}
|
||||
|
||||
//This attribute must be present and valid
|
||||
int w = 0, h = 0, hot_x = 0, hot_y = 0;
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2024 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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "addgraphicsobjectcommand.h"
|
||||
#include "../qetgraphicsitem/qetgraphicsitem.h"
|
||||
@ -30,21 +30,21 @@
|
||||
* @param parent : parent undo command of this class.
|
||||
*/
|
||||
AddGraphicsObjectCommand::AddGraphicsObjectCommand(QGraphicsObject *qgo, Diagram *diagram,
|
||||
const QPointF &pos, QUndoCommand *parent) :
|
||||
QUndoCommand(parent),
|
||||
m_item(qgo),
|
||||
m_diagram(diagram),
|
||||
m_pos(pos)
|
||||
const QPointF &pos, QUndoCommand *parent) :
|
||||
QUndoCommand(parent),
|
||||
m_item(qgo),
|
||||
m_diagram(diagram),
|
||||
m_pos(pos)
|
||||
{
|
||||
setText(QObject::tr("Ajouter ") + itemText());
|
||||
m_diagram->qgiManager().manage(m_item);
|
||||
m_diagram->qgiManager().manage(m_item);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief AddGraphicsObjectCommand::~AddGraphicsObjectCommand
|
||||
*/
|
||||
AddGraphicsObjectCommand::~AddGraphicsObjectCommand() {
|
||||
m_diagram->qgiManager().release(m_item);
|
||||
m_diagram->qgiManager().release(m_item);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -53,12 +53,12 @@ AddGraphicsObjectCommand::~AddGraphicsObjectCommand() {
|
||||
*/
|
||||
void AddGraphicsObjectCommand::undo()
|
||||
{
|
||||
if (m_item)
|
||||
{
|
||||
m_diagram->showMe();
|
||||
m_diagram->removeItem(m_item);
|
||||
}
|
||||
QUndoCommand::undo();
|
||||
if (m_item)
|
||||
{
|
||||
m_diagram->showMe();
|
||||
m_diagram->removeItem(m_item);
|
||||
}
|
||||
QUndoCommand::undo();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -67,13 +67,13 @@ void AddGraphicsObjectCommand::undo()
|
||||
*/
|
||||
void AddGraphicsObjectCommand::redo()
|
||||
{
|
||||
if (m_item)
|
||||
{
|
||||
m_diagram->showMe();
|
||||
m_diagram->addItem(m_item);
|
||||
m_item->setPos(m_pos);
|
||||
}
|
||||
QUndoCommand::redo();
|
||||
if (m_item)
|
||||
{
|
||||
m_diagram->showMe();
|
||||
m_diagram->addItem(m_item);
|
||||
m_item->setPos(m_pos);
|
||||
}
|
||||
QUndoCommand::redo();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -83,12 +83,12 @@ void AddGraphicsObjectCommand::redo()
|
||||
QString AddGraphicsObjectCommand::itemText() const
|
||||
{
|
||||
if (auto qgi = dynamic_cast<QetGraphicsItem *>(m_item.data())) {
|
||||
return qgi->name();
|
||||
return qgi->name();
|
||||
} else if (dynamic_cast<IndependentTextItem *>(m_item.data())) {
|
||||
return QObject::tr("un champ texte");
|
||||
} else if (dynamic_cast<Conductor *>(m_item.data())) {
|
||||
return QObject::tr("un conducteur");
|
||||
} else {
|
||||
return QObject::tr("un element graphique");
|
||||
}
|
||||
return QObject::tr("un conducteur");
|
||||
} else {
|
||||
return QObject::tr("un element graphique");
|
||||
}
|
||||
}
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2024 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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef ADDGRAPHICSOBJECTCOMMAND_H
|
||||
#define ADDGRAPHICSOBJECTCOMMAND_H
|
||||
@ -32,21 +32,21 @@ class Diagram;
|
||||
class AddGraphicsObjectCommand : public QUndoCommand
|
||||
{
|
||||
public:
|
||||
AddGraphicsObjectCommand(QGraphicsObject *qgo, Diagram *diagram,
|
||||
const QPointF &pos = QPointF(),
|
||||
QUndoCommand *parent = nullptr);
|
||||
~AddGraphicsObjectCommand() override;
|
||||
AddGraphicsObjectCommand(QGraphicsObject *qgo, Diagram *diagram,
|
||||
const QPointF &pos = QPointF(),
|
||||
QUndoCommand *parent = nullptr);
|
||||
~AddGraphicsObjectCommand() override;
|
||||
|
||||
void undo() override;
|
||||
void redo() override;
|
||||
void undo() override;
|
||||
void redo() override;
|
||||
|
||||
private:
|
||||
QString itemText() const;
|
||||
private:
|
||||
QString itemText() const;
|
||||
|
||||
private:
|
||||
QPointer<QGraphicsObject> m_item;
|
||||
Diagram *m_diagram = nullptr;
|
||||
QPointF m_pos;
|
||||
private:
|
||||
QPointer<QGraphicsObject> m_item;
|
||||
Diagram *m_diagram = nullptr;
|
||||
QPointF m_pos;
|
||||
};
|
||||
|
||||
#endif // ADDGRAPHICSOBJECTCOMMAND_H
|
||||
|
@ -1,40 +1,40 @@
|
||||
/*
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2024 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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "changeelementdatacommand.h"
|
||||
#include "../qetgraphicsitem/element.h"
|
||||
|
||||
ChangeElementDataCommand::ChangeElementDataCommand(Element *element, ElementData new_data, QUndoCommand *parent) :
|
||||
QUndoCommand(parent),
|
||||
m_element(element),
|
||||
m_old_data(element->elementData()),
|
||||
m_new_data(new_data)
|
||||
m_element(element),
|
||||
m_old_data(element->elementData()),
|
||||
m_new_data(new_data)
|
||||
{
|
||||
setText(QObject::tr("Modifier les propriétés d'un élement"));
|
||||
setText(QObject::tr("Modifier les propriétés d'un élement"));
|
||||
}
|
||||
|
||||
void ChangeElementDataCommand::undo() {
|
||||
if (m_element) {
|
||||
if (m_element) {
|
||||
m_element.data()->setElementData(m_old_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ChangeElementDataCommand::redo() {
|
||||
if (m_element) {
|
||||
if (m_element) {
|
||||
m_element.data()->setElementData(m_new_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2024 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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef CHANGEELEMENTDATACOMMAND_H
|
||||
#define CHANGEELEMENTDATACOMMAND_H
|
||||
@ -25,14 +25,14 @@ class Element;
|
||||
|
||||
class ChangeElementDataCommand : public QUndoCommand
|
||||
{
|
||||
public:
|
||||
public:
|
||||
ChangeElementDataCommand(Element *element, ElementData new_data, QUndoCommand *parent = nullptr);
|
||||
void undo() override;
|
||||
void redo() override;
|
||||
void undo() override;
|
||||
void redo() override;
|
||||
|
||||
private:
|
||||
QPointer<Element> m_element;
|
||||
ElementData m_old_data, m_new_data;
|
||||
private:
|
||||
QPointer<Element> m_element;
|
||||
ElementData m_old_data, m_new_data;
|
||||
};
|
||||
|
||||
#endif // CHANGEELEMENTDATACOMMAND_H
|
||||
|
@ -30,15 +30,15 @@ class QAbstractItemModel;
|
||||
*/
|
||||
class ModelIndexCommand : public QUndoCommand
|
||||
{
|
||||
public:
|
||||
public:
|
||||
ModelIndexCommand(QAbstractItemModel *model, const QModelIndex &index, QUndoCommand *parent = nullptr);
|
||||
void setData(const QVariant &value, int role = Qt::DisplayRole);
|
||||
|
||||
virtual void redo() override;
|
||||
virtual void undo() override;
|
||||
|
||||
private:
|
||||
QPointer<QAbstractItemModel> m_model;
|
||||
private:
|
||||
QPointer<QAbstractItemModel> m_model;
|
||||
QModelIndex m_index;
|
||||
QVariant m_old_value,
|
||||
m_new_value;
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2022 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2022 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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <QGraphicsItemGroup>
|
||||
#include <QPropertyAnimation>
|
||||
@ -33,25 +33,25 @@
|
||||
* @param parent : parent undo command
|
||||
*/
|
||||
MoveGraphicsItemCommand::MoveGraphicsItemCommand(Diagram *diagram,
|
||||
const DiagramContent &content,
|
||||
const QPointF &movement,
|
||||
QUndoCommand *parent) :
|
||||
QUndoCommand{parent},
|
||||
m_diagram{diagram},
|
||||
m_content{content},
|
||||
m_movement{movement}
|
||||
const DiagramContent &content,
|
||||
const QPointF &movement,
|
||||
QUndoCommand *parent) :
|
||||
QUndoCommand{parent},
|
||||
m_diagram{diagram},
|
||||
m_content{content},
|
||||
m_movement{movement}
|
||||
{
|
||||
const auto moved_content_sentence = m_content.sentence(DiagramContent::Elements
|
||||
| DiagramContent::TextFields
|
||||
| DiagramContent::ConductorsToUpdate
|
||||
| DiagramContent::ConductorsToMove
|
||||
| DiagramContent::Images
|
||||
| DiagramContent::Shapes
|
||||
| DiagramContent::ElementTextFields
|
||||
| DiagramContent::TerminalStrip);
|
||||
const auto moved_content_sentence = m_content.sentence(DiagramContent::Elements
|
||||
| DiagramContent::TextFields
|
||||
| DiagramContent::ConductorsToUpdate
|
||||
| DiagramContent::ConductorsToMove
|
||||
| DiagramContent::Images
|
||||
| DiagramContent::Shapes
|
||||
| DiagramContent::ElementTextFields
|
||||
| DiagramContent::TerminalStrip);
|
||||
|
||||
setText(QString(QObject::tr("déplacer %1",
|
||||
"undo caption - %1 is a sentence listing the moved content").arg(moved_content_sentence)));
|
||||
setText(QString(QObject::tr("déplacer %1",
|
||||
"undo caption - %1 is a sentence listing the moved content").arg(moved_content_sentence)));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -60,13 +60,13 @@ MoveGraphicsItemCommand::MoveGraphicsItemCommand(Diagram *diagram,
|
||||
*/
|
||||
void MoveGraphicsItemCommand::undo()
|
||||
{
|
||||
if (m_diagram)
|
||||
{
|
||||
m_diagram->showMe();
|
||||
m_anim_group.setDirection(QAnimationGroup::Forward);
|
||||
m_anim_group.start();
|
||||
}
|
||||
QUndoCommand::undo();
|
||||
if (m_diagram)
|
||||
{
|
||||
m_diagram->showMe();
|
||||
m_anim_group.setDirection(QAnimationGroup::Forward);
|
||||
m_anim_group.start();
|
||||
}
|
||||
QUndoCommand::undo();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -75,21 +75,21 @@ void MoveGraphicsItemCommand::undo()
|
||||
*/
|
||||
void MoveGraphicsItemCommand::redo()
|
||||
{
|
||||
if (m_diagram)
|
||||
{
|
||||
m_diagram->showMe();
|
||||
if (m_first_redo)
|
||||
{
|
||||
m_first_redo = false;
|
||||
move(-m_movement);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_anim_group.setDirection(QAnimationGroup::Backward);
|
||||
m_anim_group.start();
|
||||
}
|
||||
}
|
||||
QUndoCommand::redo();
|
||||
if (m_diagram)
|
||||
{
|
||||
m_diagram->showMe();
|
||||
if (m_first_redo)
|
||||
{
|
||||
m_first_redo = false;
|
||||
move(-m_movement);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_anim_group.setDirection(QAnimationGroup::Backward);
|
||||
m_anim_group.start();
|
||||
}
|
||||
}
|
||||
QUndoCommand::redo();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -99,57 +99,57 @@ void MoveGraphicsItemCommand::redo()
|
||||
*/
|
||||
void MoveGraphicsItemCommand::move(const QPointF &movement)
|
||||
{
|
||||
for (auto &&qgi : m_content.items(DiagramContent::Elements
|
||||
| DiagramContent::TextFields
|
||||
| DiagramContent::Images
|
||||
| DiagramContent::Shapes
|
||||
| DiagramContent::TextGroup
|
||||
| DiagramContent::ElementTextFields
|
||||
| DiagramContent::Tables
|
||||
| DiagramContent::TerminalStrip))
|
||||
{
|
||||
//If item have a parent and the parent is in m_content,
|
||||
//we don't apply movement because this item will be moved by his parent
|
||||
if (const auto parent_ = qgi->parentItem()) {
|
||||
if (m_content.items().contains(parent_)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
for (auto &&qgi : m_content.items(DiagramContent::Elements
|
||||
| DiagramContent::TextFields
|
||||
| DiagramContent::Images
|
||||
| DiagramContent::Shapes
|
||||
| DiagramContent::TextGroup
|
||||
| DiagramContent::ElementTextFields
|
||||
| DiagramContent::Tables
|
||||
| DiagramContent::TerminalStrip))
|
||||
{
|
||||
//If item have a parent and the parent is in m_content,
|
||||
//we don't apply movement because this item will be moved by his parent
|
||||
if (const auto parent_ = qgi->parentItem()) {
|
||||
if (m_content.items().contains(parent_)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (const auto graphics_object = qgi->toGraphicsObject()) {
|
||||
setupAnimation(graphics_object,
|
||||
"pos",
|
||||
graphics_object->pos(),
|
||||
graphics_object->pos() + movement);
|
||||
}
|
||||
else if (qgi->type() == QGraphicsItemGroup::Type)
|
||||
{
|
||||
//ElementTextItemGroup is a QObject not a QGraphicsObject
|
||||
if (ElementTextItemGroup *etig = dynamic_cast<ElementTextItemGroup *>(qgi)) {
|
||||
setupAnimation(etig,
|
||||
"pos",
|
||||
etig->pos(),
|
||||
etig->pos() + movement);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
qgi->setPos(qgi->pos() + movement);
|
||||
}
|
||||
}
|
||||
if (const auto graphics_object = qgi->toGraphicsObject()) {
|
||||
setupAnimation(graphics_object,
|
||||
"pos",
|
||||
graphics_object->pos(),
|
||||
graphics_object->pos() + movement);
|
||||
}
|
||||
else if (qgi->type() == QGraphicsItemGroup::Type)
|
||||
{
|
||||
//ElementTextItemGroup is a QObject not a QGraphicsObject
|
||||
if (ElementTextItemGroup *etig = dynamic_cast<ElementTextItemGroup *>(qgi)) {
|
||||
setupAnimation(etig,
|
||||
"pos",
|
||||
etig->pos(),
|
||||
etig->pos() + movement);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
qgi->setPos(qgi->pos() + movement);
|
||||
}
|
||||
}
|
||||
|
||||
//Move some conductors
|
||||
for (const auto &conductor : qAsConst(m_content.m_conductors_to_move)) {
|
||||
setupAnimation(conductor,
|
||||
"pos",
|
||||
conductor->pos(),
|
||||
conductor->pos() + movement);
|
||||
}
|
||||
//Move some conductors
|
||||
for (const auto &conductor : qAsConst(m_content.m_conductors_to_move)) {
|
||||
setupAnimation(conductor,
|
||||
"pos",
|
||||
conductor->pos(),
|
||||
conductor->pos() + movement);
|
||||
}
|
||||
|
||||
//Recalcul the path of other conductors
|
||||
for (const auto &conductor : qAsConst(m_content.m_conductors_to_update)) {
|
||||
setupAnimation(conductor, "animPath", 1, 1);
|
||||
}
|
||||
//Recalcul the path of other conductors
|
||||
for (const auto &conductor : qAsConst(m_content.m_conductors_to_update)) {
|
||||
setupAnimation(conductor, "animPath", 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -162,14 +162,14 @@ void MoveGraphicsItemCommand::move(const QPointF &movement)
|
||||
* @param end
|
||||
*/
|
||||
void MoveGraphicsItemCommand::setupAnimation(QObject *target,
|
||||
const QByteArray &property_name,
|
||||
const QVariant &start,
|
||||
const QVariant &end)
|
||||
const QByteArray &property_name,
|
||||
const QVariant &start,
|
||||
const QVariant &end)
|
||||
{
|
||||
QPropertyAnimation *animation{new QPropertyAnimation(target, property_name)};
|
||||
animation->setDuration(300);
|
||||
animation->setStartValue(start);
|
||||
animation->setEndValue(end);
|
||||
animation->setEasingCurve(QEasingCurve::OutQuad);
|
||||
m_anim_group.addAnimation(animation);
|
||||
QPropertyAnimation *animation{new QPropertyAnimation(target, property_name)};
|
||||
animation->setDuration(300);
|
||||
animation->setStartValue(start);
|
||||
animation->setEndValue(end);
|
||||
animation->setEasingCurve(QEasingCurve::OutQuad);
|
||||
m_anim_group.addAnimation(animation);
|
||||
}
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2022 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2022 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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "terminalstripitemxml.h"
|
||||
|
||||
@ -37,16 +37,16 @@ const QString STRIP_ITEMS_TAG_NAME { QStringLiteral("terminal_strip_items") };
|
||||
*/
|
||||
QDomElement TerminalStripItemXml::toXml(const QVector<TerminalStripItem *> &items, QDomDocument &document)
|
||||
{
|
||||
auto dom_element = document.createElement(STRIP_ITEMS_TAG_NAME);
|
||||
for (const auto &item : items)
|
||||
{
|
||||
const auto child_ = toXml(item, document);
|
||||
if (!child_.isNull()) {
|
||||
dom_element.appendChild(child_);
|
||||
}
|
||||
}
|
||||
auto dom_element = document.createElement(STRIP_ITEMS_TAG_NAME);
|
||||
for (const auto &item : items)
|
||||
{
|
||||
const auto child_ = toXml(item, document);
|
||||
if (!child_.isNull()) {
|
||||
dom_element.appendChild(child_);
|
||||
}
|
||||
}
|
||||
|
||||
return dom_element;
|
||||
return dom_element;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -59,20 +59,20 @@ QDomElement TerminalStripItemXml::toXml(const QVector<TerminalStripItem *> &item
|
||||
*/
|
||||
QVector<TerminalStripItem *> TerminalStripItemXml::fromXml(Diagram *diagram, const QDomElement &xml_elmt)
|
||||
{
|
||||
QVector<TerminalStripItem *> returned_vector;
|
||||
QVector<TerminalStripItem *> returned_vector;
|
||||
|
||||
for (const auto &dom_elmt : QETXML::subChild(xml_elmt,
|
||||
STRIP_ITEMS_TAG_NAME,
|
||||
STRIP_ITEM_TAG_NAME))
|
||||
{
|
||||
auto strip_item = new TerminalStripItem();
|
||||
diagram->addItem(strip_item);
|
||||
returned_vector << strip_item;
|
||||
for (const auto &dom_elmt : QETXML::subChild(xml_elmt,
|
||||
STRIP_ITEMS_TAG_NAME,
|
||||
STRIP_ITEM_TAG_NAME))
|
||||
{
|
||||
auto strip_item = new TerminalStripItem();
|
||||
diagram->addItem(strip_item);
|
||||
returned_vector << strip_item;
|
||||
|
||||
TerminalStripItemXml::fromXml(strip_item, diagram->project(), dom_elmt);
|
||||
}
|
||||
TerminalStripItemXml::fromXml(strip_item, diagram->project(), dom_elmt);
|
||||
}
|
||||
|
||||
return returned_vector;
|
||||
return returned_vector;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -84,21 +84,21 @@ QVector<TerminalStripItem *> TerminalStripItemXml::fromXml(Diagram *diagram, con
|
||||
*/
|
||||
QDomElement TerminalStripItemXml::toXml(TerminalStripItem *item, QDomDocument &document)
|
||||
{
|
||||
if (item->terminalStrip())
|
||||
{
|
||||
//Terminal strip item dom element
|
||||
auto dom_element = document.createElement(STRIP_ITEM_TAG_NAME);
|
||||
if (item->terminalStrip())
|
||||
{
|
||||
//Terminal strip item dom element
|
||||
auto dom_element = document.createElement(STRIP_ITEM_TAG_NAME);
|
||||
|
||||
auto dom_strip = document.createElement(QStringLiteral("terminal_strip"));
|
||||
dom_strip.setAttribute(QStringLiteral("uuid"), item->terminalStrip()->uuid().toString());
|
||||
dom_element.appendChild(dom_strip);
|
||||
auto dom_strip = document.createElement(QStringLiteral("terminal_strip"));
|
||||
dom_strip.setAttribute(QStringLiteral("uuid"), item->terminalStrip()->uuid().toString());
|
||||
dom_element.appendChild(dom_strip);
|
||||
|
||||
dom_element.appendChild(QETXML::qGraphicsItemPosToXml(item, document));
|
||||
dom_element.appendChild(QETXML::qGraphicsItemPosToXml(item, document));
|
||||
|
||||
return dom_element;
|
||||
} else {
|
||||
return QDomElement();
|
||||
}
|
||||
return dom_element;
|
||||
} else {
|
||||
return QDomElement();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -112,29 +112,29 @@ QDomElement TerminalStripItemXml::toXml(TerminalStripItem *item, QDomDocument &d
|
||||
*/
|
||||
bool TerminalStripItemXml::fromXml(TerminalStripItem *item, QETProject *project, const QDomElement &xml_elmt)
|
||||
{
|
||||
if (xml_elmt.tagName() == STRIP_ITEM_TAG_NAME)
|
||||
{
|
||||
bool a{false};
|
||||
if (xml_elmt.tagName() == STRIP_ITEM_TAG_NAME)
|
||||
{
|
||||
bool a{false};
|
||||
|
||||
const auto ts = xml_elmt.firstChildElement(QStringLiteral("terminal_strip"));
|
||||
if (!ts.isNull())
|
||||
{
|
||||
const QUuid uuid_(ts.attribute(QStringLiteral("uuid")));
|
||||
item->m_pending_strip_uuid = uuid_;
|
||||
const auto ts = xml_elmt.firstChildElement(QStringLiteral("terminal_strip"));
|
||||
if (!ts.isNull())
|
||||
{
|
||||
const QUuid uuid_(ts.attribute(QStringLiteral("uuid")));
|
||||
item->m_pending_strip_uuid = uuid_;
|
||||
|
||||
for (const auto &ts : project->terminalStrip()) {
|
||||
if (ts->uuid() == uuid_) {
|
||||
item->setTerminalStrip(ts);
|
||||
a = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const auto &ts : project->terminalStrip()) {
|
||||
if (ts->uuid() == uuid_) {
|
||||
item->setTerminalStrip(ts);
|
||||
a = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool b{QETXML::qGraphicsItemPosFromXml(item,
|
||||
xml_elmt.firstChildElement(QStringLiteral("pos")))};
|
||||
bool b{QETXML::qGraphicsItemPosFromXml(item,
|
||||
xml_elmt.firstChildElement(QStringLiteral("pos")))};
|
||||
|
||||
return (a && b);
|
||||
}
|
||||
return false;
|
||||
return (a && b);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2022 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2022 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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef TERMINALSTRIPITEMXML_H
|
||||
#define TERMINALSTRIPITEMXML_H
|
||||
@ -26,12 +26,12 @@ class Diagram;
|
||||
|
||||
class TerminalStripItemXml
|
||||
{
|
||||
public:
|
||||
static QDomElement toXml(const QVector<TerminalStripItem *> &items, QDomDocument &document);
|
||||
static QVector<TerminalStripItem *> fromXml(Diagram *diagram, const QDomElement &xml_elmt);
|
||||
public:
|
||||
static QDomElement toXml(const QVector<TerminalStripItem *> &items, QDomDocument &document);
|
||||
static QVector<TerminalStripItem *> fromXml(Diagram *diagram, const QDomElement &xml_elmt);
|
||||
|
||||
static QDomElement toXml(TerminalStripItem *item, QDomDocument &document);
|
||||
static bool fromXml(TerminalStripItem *item, QETProject *project, const QDomElement &xml_elmt);
|
||||
static QDomElement toXml(TerminalStripItem *item, QDomDocument &document);
|
||||
static bool fromXml(TerminalStripItem *item, QETProject *project, const QDomElement &xml_elmt);
|
||||
};
|
||||
|
||||
#endif // TERMINALSTRIPITEMXML_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user