mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 12:40:35 +01:00
Merge pull request #289 from plc-user/master
correct more indentations / whitespace
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class RenameDialog;
|
||||
class RenameDialog;
|
||||
}
|
||||
|
||||
class RenameDialog : public QDialog
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -252,7 +252,7 @@ void ReplaceConductorDialog::setColorButton2(const QColor &color)
|
||||
|
||||
void ReplaceConductorDialog::on_m_erase_formula_cb_clicked()
|
||||
{
|
||||
ui->m_formula_le->setText(ui->m_erase_formula_cb->isChecked()
|
||||
ui->m_formula_le->setText(ui->m_erase_formula_cb->isChecked()
|
||||
? SearchAndReplaceWorker::eraseText()
|
||||
: QString());
|
||||
ui->m_formula_le->setDisabled(ui->m_erase_formula_cb->isChecked());
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ EllipseEditor::EllipseEditor(QETElementEditor *editor, PartEllipse *part, QWidge
|
||||
ui(new Ui::EllipseEditor),
|
||||
m_part(part)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->setupUi(this);
|
||||
m_style = new StyleEditor(editor);
|
||||
ui->m_main_layout->insertWidget(0, m_style);
|
||||
updateForm();
|
||||
|
||||
@@ -33,7 +33,7 @@ class StyleEditor;
|
||||
*/
|
||||
class EllipseEditor : public ElementItemEditor
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit EllipseEditor (QETElementEditor *editor, PartEllipse *part = nullptr, QWidget *parent = nullptr);
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "../elementitemeditor.h"
|
||||
|
||||
namespace Ui {
|
||||
class LineEditor;
|
||||
class LineEditor;
|
||||
}
|
||||
|
||||
class PartLine;
|
||||
@@ -33,11 +33,11 @@ class StyleEditor;
|
||||
*/
|
||||
class LineEditor : public ElementItemEditor
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit LineEditor(QETElementEditor *editor, PartLine *part = nullptr, QWidget *parent = nullptr);
|
||||
~LineEditor() override;
|
||||
public:
|
||||
explicit LineEditor(QETElementEditor *editor, PartLine *part = nullptr, QWidget *parent = nullptr);
|
||||
~LineEditor() override;
|
||||
|
||||
bool setPart(CustomElementPart *part) override;
|
||||
bool setParts(QList <CustomElementPart *> parts) override;
|
||||
|
||||
@@ -106,7 +106,7 @@ void QETElementEditor::contextMenu(QPoint p, QList<QAction *> actions)
|
||||
menu.addAction(ui->m_delete_action);
|
||||
menu.addAction(ui->m_cut_action);
|
||||
menu.addAction(ui->m_copy_action);
|
||||
menu.addAction((ui->m_rotate_action));
|
||||
menu.addAction((ui->m_rotate_action));
|
||||
menu.addSeparator();
|
||||
menu.addAction(ui->m_paste_action);
|
||||
menu.addAction(ui->m_paste_in_area_action);
|
||||
@@ -1026,10 +1026,10 @@ void QETElementEditor::setupActions()
|
||||
depth_toolbar -> addActions(m_depth_action_group -> actions());
|
||||
addToolBar(Qt::TopToolBarArea, depth_toolbar);
|
||||
|
||||
//Rotate action
|
||||
//Rotate action
|
||||
connect(ui->m_rotate_action, &QAction::triggered, [this]() {this -> elementScene() -> undoStack().push(new RotateElementsCommand(this->elementScene()));});
|
||||
|
||||
//Zoom action
|
||||
//Zoom action
|
||||
ui->m_zoom_in_action -> setShortcut(QKeySequence::ZoomIn);
|
||||
ui->m_zoom_out_action -> setShortcut(QKeySequence::ZoomOut);
|
||||
ui->m_zoom_fit_best_action -> setShortcut(QKeySequence(tr("Ctrl+9")));
|
||||
|
||||
@@ -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 "terminaleditor.h"
|
||||
#include "ui_terminaleditor.h"
|
||||
@@ -114,9 +114,9 @@ CustomElementPart *TerminalEditor::currentPart() const
|
||||
*/
|
||||
void TerminalEditor::init()
|
||||
{
|
||||
ui->m_orientation_cb->addItem(QET::Icons::North, tr("Nord"), Qet::North);
|
||||
ui->m_orientation_cb->addItem(QET::Icons::East, tr("Est"), Qet::East);
|
||||
ui->m_orientation_cb->addItem(QET::Icons::South, tr("Sud"), Qet::South);
|
||||
ui->m_orientation_cb->addItem(QET::Icons::North, tr("Nord"), Qet::North);
|
||||
ui->m_orientation_cb->addItem(QET::Icons::East, tr("Est"), Qet::East);
|
||||
ui->m_orientation_cb->addItem(QET::Icons::South, tr("Sud"), Qet::South);
|
||||
ui->m_orientation_cb->addItem(QET::Icons::West, tr("Ouest"), Qet::West);
|
||||
|
||||
ui->m_type_cb->addItem(tr("Générique"), TerminalData::Generic);
|
||||
|
||||
@@ -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 TERMINALEDITOR_H
|
||||
#define TERMINALEDITOR_H
|
||||
@@ -33,18 +33,18 @@ class PartTerminal;
|
||||
*/
|
||||
class TerminalEditor : public ElementItemEditor
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
public:
|
||||
TerminalEditor(QETElementEditor *editor, QWidget *parent = nullptr);
|
||||
~TerminalEditor() override;
|
||||
|
||||
void updateForm() override;
|
||||
void updateForm() override;
|
||||
bool setPart(CustomElementPart *new_part) override;
|
||||
CustomElementPart *currentPart() const override;
|
||||
QList<CustomElementPart *> currentParts() const override {return QList<CustomElementPart *>();}
|
||||
|
||||
private:
|
||||
private:
|
||||
void init();
|
||||
void posEdited();
|
||||
void orientationEdited();
|
||||
@@ -53,8 +53,8 @@ class TerminalEditor : public ElementItemEditor
|
||||
void activeConnections(bool active);
|
||||
void activeChangeConnections(bool active);
|
||||
|
||||
private:
|
||||
Ui::TerminalEditor *ui;
|
||||
private:
|
||||
Ui::TerminalEditor *ui;
|
||||
QVector<QMetaObject::Connection> m_editor_connections,
|
||||
m_change_connections;
|
||||
PartTerminal *m_part = nullptr;
|
||||
|
||||
@@ -295,83 +295,83 @@ void TextEditor::setUpWidget(QWidget *parent)
|
||||
setWindowTitle(tr("Form"));
|
||||
resize(378, 133);
|
||||
QGridLayout *gridLayout = new QGridLayout(parent);
|
||||
gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
|
||||
m_y_sb = new QSpinBox(parent);
|
||||
m_y_sb->setObjectName(QString::fromUtf8("m_y_sb"));
|
||||
m_y_sb->setMinimum(-10000);
|
||||
m_y_sb->setMaximum(10000);
|
||||
gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
|
||||
m_y_sb = new QSpinBox(parent);
|
||||
m_y_sb->setObjectName(QString::fromUtf8("m_y_sb"));
|
||||
m_y_sb->setMinimum(-10000);
|
||||
m_y_sb->setMaximum(10000);
|
||||
|
||||
gridLayout->addWidget(m_y_sb, 1, 3, 1, 1);
|
||||
gridLayout->addWidget(m_y_sb, 1, 3, 1, 1);
|
||||
|
||||
QLabel*label_2 = new QLabel(tr("Y :"),parent);
|
||||
QLabel*label_2 = new QLabel(tr("Y :"),parent);
|
||||
|
||||
gridLayout->addWidget(label_2, 1, 2, 1, 1);
|
||||
gridLayout->addWidget(label_2, 1, 2, 1, 1);
|
||||
|
||||
QLabel*label_4 = new QLabel(tr("Police :"),parent);
|
||||
QLabel*label_4 = new QLabel(tr("Police :"),parent);
|
||||
|
||||
gridLayout->addWidget(label_4, 2, 0, 1, 1);
|
||||
gridLayout->addWidget(label_4, 2, 0, 1, 1);
|
||||
|
||||
m_rotation_sb = new QSpinBox(parent);
|
||||
m_rotation_sb->setSuffix(tr("\302\260"));
|
||||
m_rotation_sb->setWrapping(true);
|
||||
m_rotation_sb->setMaximum(360);
|
||||
m_rotation_sb = new QSpinBox(parent);
|
||||
m_rotation_sb->setSuffix(tr("\302\260"));
|
||||
m_rotation_sb->setWrapping(true);
|
||||
m_rotation_sb->setMaximum(360);
|
||||
|
||||
gridLayout->addWidget(m_rotation_sb, 1, 5, 1, 1);
|
||||
gridLayout->addWidget(m_rotation_sb, 1, 5, 1, 1);
|
||||
|
||||
QLabel *label_3 = new QLabel(tr("Rotation :"),parent);
|
||||
QLabel *label_3 = new QLabel(tr("Rotation :"),parent);
|
||||
|
||||
gridLayout->addWidget(label_3, 1, 4, 1, 1);
|
||||
gridLayout->addWidget(label_3, 1, 4, 1, 1);
|
||||
|
||||
m_x_sb = new QSpinBox(parent);
|
||||
m_x_sb->setObjectName(QString::fromUtf8("m_x_sb"));
|
||||
m_x_sb->setMinimum(-10000);
|
||||
m_x_sb->setMaximum(10000);
|
||||
m_x_sb = new QSpinBox(parent);
|
||||
m_x_sb->setObjectName(QString::fromUtf8("m_x_sb"));
|
||||
m_x_sb->setMinimum(-10000);
|
||||
m_x_sb->setMaximum(10000);
|
||||
|
||||
gridLayout->addWidget(m_x_sb, 1, 1, 1, 1);
|
||||
gridLayout->addWidget(m_x_sb, 1, 1, 1, 1);
|
||||
|
||||
QLabel *label = new QLabel(tr("X :"),parent);
|
||||
QLabel *label = new QLabel(tr("X :"),parent);
|
||||
|
||||
gridLayout->addWidget(label, 1, 0, 1, 1);
|
||||
gridLayout->addWidget(label, 1, 0, 1, 1);
|
||||
|
||||
m_size_sb = new QSpinBox(parent);
|
||||
m_size_sb->setObjectName(QString::fromUtf8("m_size_sb"));
|
||||
m_size_sb = new QSpinBox(parent);
|
||||
m_size_sb->setObjectName(QString::fromUtf8("m_size_sb"));
|
||||
|
||||
gridLayout->addWidget(m_size_sb, 2, 1, 1, 1);
|
||||
gridLayout->addWidget(m_size_sb, 2, 1, 1, 1);
|
||||
|
||||
m_line_edit = new QLineEdit(parent);
|
||||
m_line_edit->setObjectName(QString::fromUtf8("m_line_edit"));
|
||||
m_line_edit->setClearButtonEnabled(true);
|
||||
m_line_edit->setPlaceholderText(tr("Entrer votre texte ici"));
|
||||
m_line_edit = new QLineEdit(parent);
|
||||
m_line_edit->setObjectName(QString::fromUtf8("m_line_edit"));
|
||||
m_line_edit->setClearButtonEnabled(true);
|
||||
m_line_edit->setPlaceholderText(tr("Entrer votre texte ici"));
|
||||
|
||||
gridLayout->addWidget(m_line_edit, 0, 0, 1, 6);
|
||||
gridLayout->addWidget(m_line_edit, 0, 0, 1, 6);
|
||||
#ifdef BUILD_WITHOUT_KF5
|
||||
#else
|
||||
m_color_pb = new KColorButton(parent);
|
||||
m_color_pb->setObjectName(QString::fromUtf8("m_color_pb"));
|
||||
m_color_pb = new KColorButton(parent);
|
||||
m_color_pb->setObjectName(QString::fromUtf8("m_color_pb"));
|
||||
|
||||
connect(
|
||||
m_color_pb,
|
||||
&KColorButton::changed,
|
||||
this,
|
||||
&TextEditor::on_m_color_pb_changed);
|
||||
connect(
|
||||
m_color_pb,
|
||||
&KColorButton::changed,
|
||||
this,
|
||||
&TextEditor::on_m_color_pb_changed);
|
||||
|
||||
gridLayout->addWidget(m_color_pb, 2, 5, 1, 1);
|
||||
#endif
|
||||
QLabel *label_5 = new QLabel(parent);
|
||||
label_5->setObjectName(QString::fromUtf8("label_5"));
|
||||
gridLayout->addWidget(m_color_pb, 2, 5, 1, 1);
|
||||
#endif
|
||||
QLabel *label_5 = new QLabel(parent);
|
||||
label_5->setObjectName(QString::fromUtf8("label_5"));
|
||||
|
||||
gridLayout->addWidget(label_5, 2, 4, 1, 1);
|
||||
gridLayout->addWidget(label_5, 2, 4, 1, 1);
|
||||
|
||||
m_font_pb = new QPushButton(tr("Couleur :"),parent);
|
||||
connect(m_font_pb,
|
||||
&QPushButton::pressed,
|
||||
this,
|
||||
&TextEditor::on_m_font_pb_clicked);
|
||||
m_font_pb = new QPushButton(tr("Couleur :"),parent);
|
||||
connect(m_font_pb,
|
||||
&QPushButton::pressed,
|
||||
this,
|
||||
&TextEditor::on_m_font_pb_clicked);
|
||||
|
||||
gridLayout->addWidget(m_font_pb, 2, 2, 1, 2);
|
||||
gridLayout->addWidget(m_font_pb, 2, 2, 1, 2);
|
||||
|
||||
QSpacerItem *verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||
QSpacerItem *verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||
|
||||
gridLayout->addItem(verticalSpacer, 3, 2, 1, 1);
|
||||
setLayout(gridLayout);
|
||||
gridLayout->addItem(verticalSpacer, 3, 2, 1, 1);
|
||||
setLayout(gridLayout);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -64,13 +64,13 @@ void AboutQETDialog::setAbout()
|
||||
tr(" Les développeurs de QElectroTech", "about tab, developers line") +
|
||||
"<br><br>"
|
||||
"<a href=\"https://qelectrotech.org/\">https://qelectrotech.org/</a>"
|
||||
"<br><br>" +
|
||||
"The program is provided AS IS with NO WARRANTY OF ANY KIND,"
|
||||
"<br>"
|
||||
" INCLUDING THE WARRANTY OF DESIGN, "
|
||||
"<br>"
|
||||
"MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.";
|
||||
"<br>"
|
||||
"<br><br>" +
|
||||
"The program is provided AS IS with NO WARRANTY OF ANY KIND,"
|
||||
"<br>"
|
||||
" INCLUDING THE WARRANTY OF DESIGN, "
|
||||
"<br>"
|
||||
"MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.";
|
||||
"<br>"
|
||||
"<br><br>" +
|
||||
tr("Contact : <a href=\"mailto:qet@lists.tuxfamily.org\">qet@lists.tuxfamily.org</a>", "about tab, contact line");
|
||||
|
||||
@@ -91,7 +91,7 @@ void AboutQETDialog::setAuthors()
|
||||
addAuthor(ui->m_author_label, "Ronny Desmedt", "r.desmedt@live.be", tr("Convertisseur DXF"));
|
||||
addAuthor(ui->m_author_label, "Raul Roda", "raulroda8@gmail.com", tr("Plugin Bornier"));
|
||||
addAuthor(ui->m_author_label, "Abhishek Bansal", "abhishek@qelectrotech.org", tr("Développement"));
|
||||
addAuthor(ui->m_author_label, "Simon De Backer", "debacker@qelectrotech.org", tr("Développement"));
|
||||
addAuthor(ui->m_author_label, "Simon De Backer", "debacker@qelectrotech.org", tr("Développement"));
|
||||
addAuthor(ui->m_author_label, "David Varley", "David.Varley@cborn.com", tr("Développement"));
|
||||
addAuthor(ui->m_author_label, "Damian Caceres", "damiancaceresmoreno@yahoo.es", tr("Développement"));
|
||||
addAuthor(ui->m_author_label, "Martin Marmsoler", "martin.marmsoler@gmail.com", tr("Développement"));
|
||||
@@ -166,7 +166,7 @@ void AboutQETDialog::setContributors()
|
||||
void AboutQETDialog::setVersion()
|
||||
{
|
||||
QString str = "<span style=\"font-weight:bold;font-size:16pt;\">QElectroTech V "
|
||||
+ QetVersion::displayedVersion()
|
||||
+ QetVersion::displayedVersion()
|
||||
+ "</span>";
|
||||
ui->m_version_label->setText(str + MachineInfo::instance()->compilation_info());
|
||||
}
|
||||
|
||||
@@ -122,12 +122,12 @@ GeneralConfigurationPage::GeneralConfigurationPage(QWidget *parent) :
|
||||
|
||||
ui->m_highlight_integrated_elements->setChecked(settings.value("diagrameditor/highlight-integrated-elements", true).toBool());
|
||||
ui->m_default_elements_info->setPlainText(settings.value("elementeditor/default-informations", "").toString());
|
||||
/*
|
||||
Nombre maximum de primitives affichees par la "liste des parties"
|
||||
Au-dela, un petit message est affiche, indiquant que ce nombre a ete depasse
|
||||
et que la liste ne sera donc pas mise a jour.
|
||||
*/
|
||||
ui->MaxPartsElementEditorList_sb->setValue(settings.value("elementeditor/max-parts-element-editor-list", 200).toInt());
|
||||
/*
|
||||
Nombre maximum de primitives affichees par la "liste des parties"
|
||||
Au-dela, un petit message est affiche, indiquant que ce nombre a ete depasse
|
||||
et que la liste ne sera donc pas mise a jour.
|
||||
*/
|
||||
ui->MaxPartsElementEditorList_sb->setValue(settings.value("elementeditor/max-parts-element-editor-list", 200).toInt());
|
||||
|
||||
QString path = settings.value("elements-collections/common-collection-path", "default").toString();
|
||||
if (path != "default")
|
||||
@@ -209,7 +209,7 @@ void GeneralConfigurationPage::applyConf()
|
||||
|
||||
//ELEMENT EDITOR
|
||||
settings.setValue("elementeditor/default-informations", ui->m_default_elements_info->toPlainText());
|
||||
settings.setValue("elementeditor/max-parts-element-editor-list", ui->MaxPartsElementEditorList_sb->value());
|
||||
settings.setValue("elementeditor/max-parts-element-editor-list", ui->MaxPartsElementEditorList_sb->value());
|
||||
|
||||
//DIAGRAM VIEW
|
||||
settings.setValue("diagramview/gestures", ui->m_use_gesture_trackpad->isChecked());
|
||||
@@ -520,11 +520,11 @@ void GeneralConfigurationPage::on_m_indi_text_font_pb_clicked()
|
||||
|
||||
void GeneralConfigurationPage::on_MaxPartsElementEditorList_sb_valueChanged(int value)
|
||||
{
|
||||
if (value > 500) {
|
||||
ui->MaxPartsElementEditorList_sb->setToolTip(tr("To high values might lead to crashes of the application."));
|
||||
ui->MaxPartsElementEditorList_sb->setStyleSheet("background-color: orange");
|
||||
} else {
|
||||
ui->MaxPartsElementEditorList_sb->setToolTip("");
|
||||
ui->MaxPartsElementEditorList_sb->setStyleSheet("");
|
||||
}
|
||||
if (value > 500) {
|
||||
ui->MaxPartsElementEditorList_sb->setToolTip(tr("To high values might lead to crashes of the application."));
|
||||
ui->MaxPartsElementEditorList_sb->setStyleSheet("background-color: orange");
|
||||
} else {
|
||||
ui->MaxPartsElementEditorList_sb->setToolTip("");
|
||||
ui->MaxPartsElementEditorList_sb->setStyleSheet("");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
@@ -47,7 +47,7 @@ class GeneralConfigurationPage : public ConfigPage
|
||||
void on_m_company_tbt_path_cb_currentIndexChanged(int index);
|
||||
void on_m_custom_tbt_path_cb_currentIndexChanged(int index);
|
||||
void on_m_indi_text_font_pb_clicked();
|
||||
void on_MaxPartsElementEditorList_sb_valueChanged(int value);
|
||||
void on_MaxPartsElementEditorList_sb_valueChanged(int value);
|
||||
|
||||
private:
|
||||
void fillLang();
|
||||
|
||||
@@ -296,7 +296,7 @@ void LinkSingleElementWidget::buildTree()
|
||||
QStringList search_list;
|
||||
QStringList str_list;
|
||||
|
||||
if (!elmt->conductors().isEmpty())
|
||||
if (!elmt->conductors().isEmpty())
|
||||
{
|
||||
ConductorProperties cp = elmt->conductors().first()->properties();
|
||||
str_list << cp.text;
|
||||
@@ -316,7 +316,7 @@ void LinkSingleElementWidget::buildTree()
|
||||
search_list << str_list.last();
|
||||
}
|
||||
else
|
||||
str_list << "" << "" << "" << "" << "";
|
||||
str_list << "" << "" << "" << "" << "";
|
||||
|
||||
if (Diagram *diag = elmt->diagram())
|
||||
{
|
||||
|
||||
@@ -36,13 +36,13 @@ ProjectPropertiesDialog::ProjectPropertiesDialog(QETProject *project, QWidget *p
|
||||
m_properties_dialog -> setWindowTitle(QObject::tr("Propriétés du projet", "window title"));
|
||||
m_properties_dialog -> addPage(new ProjectMainConfigPage(project));
|
||||
|
||||
NewDiagramPage *newDiagramPage = new NewDiagramPage(project,parent,this);
|
||||
NewDiagramPage *newDiagramPage = new NewDiagramPage(project,parent,this);
|
||||
m_properties_dialog -> addPage(newDiagramPage);
|
||||
|
||||
ProjectAutoNumConfigPage *projectAutoNumConfigPage = new ProjectAutoNumConfigPage (project);
|
||||
ProjectAutoNumConfigPage *projectAutoNumConfigPage = new ProjectAutoNumConfigPage (project);
|
||||
m_properties_dialog -> addPage(projectAutoNumConfigPage);
|
||||
|
||||
m_properties_dialog->addPage(new TerminalStripProjectConfigPage { project, parent });
|
||||
m_properties_dialog->addPage(new TerminalStripProjectConfigPage { project, parent });
|
||||
|
||||
connect(projectAutoNumConfigPage,SIGNAL(setAutoNum(QString)),newDiagramPage,SLOT(setFolioAutonum(QString)));
|
||||
connect(projectAutoNumConfigPage,SIGNAL(saveCurrentTbp()),newDiagramPage,SLOT(saveCurrentTbp()));
|
||||
|
||||
@@ -32,8 +32,8 @@ class ProjectPropertiesDialog : public QObject {
|
||||
enum Page {
|
||||
Main = 0,
|
||||
Diagram = 1,
|
||||
Autonum = 2,
|
||||
TerminalStrip = 3
|
||||
Autonum = 2,
|
||||
TerminalStrip = 3
|
||||
};
|
||||
|
||||
ProjectPropertiesDialog(QETProject *project, QWidget *parent = nullptr);
|
||||
|
||||
@@ -64,8 +64,8 @@ ShapeGraphicsItemPropertiesWidget::~ShapeGraphicsItemPropertiesWidget()
|
||||
*/
|
||||
void ShapeGraphicsItemPropertiesWidget::setItem(QetShapeItem *shape)
|
||||
{
|
||||
if (m_shape != shape) {
|
||||
clearEditConnection();
|
||||
if (m_shape != shape) {
|
||||
clearEditConnection();
|
||||
}
|
||||
if (!shape) {
|
||||
return;
|
||||
@@ -75,7 +75,7 @@ void ShapeGraphicsItemPropertiesWidget::setItem(QetShapeItem *shape)
|
||||
ui->m_close_polygon->setVisible(m_shape->shapeType() == QetShapeItem::Polygon);
|
||||
ui->m_filling_gb->setHidden(m_shape->shapeType() == QetShapeItem::Line);
|
||||
|
||||
updateUi();
|
||||
updateUi();
|
||||
setUpEditConnection();
|
||||
}
|
||||
|
||||
@@ -86,11 +86,11 @@ void ShapeGraphicsItemPropertiesWidget::setItem(QetShapeItem *shape)
|
||||
*/
|
||||
void ShapeGraphicsItemPropertiesWidget::setItems(QList<QetShapeItem *> shapes_list)
|
||||
{
|
||||
clearEditConnection();
|
||||
clearEditConnection();
|
||||
m_shapes_list.clear();
|
||||
m_shape = nullptr;
|
||||
|
||||
if (shapes_list.isEmpty()) {
|
||||
if (shapes_list.isEmpty()) {
|
||||
updateUi();
|
||||
}
|
||||
else if (shapes_list.size() == 1)
|
||||
@@ -357,7 +357,7 @@ void ShapeGraphicsItemPropertiesWidget::updateUi()
|
||||
|
||||
//Disconnect every connections of editor widgets
|
||||
//to avoid an unwanted edition (QSpinBox emit valueChanged no matter if changer by user or by program)
|
||||
clearEditConnection();
|
||||
clearEditConnection();
|
||||
|
||||
if (m_shape)
|
||||
{
|
||||
@@ -455,8 +455,8 @@ bool ShapeGraphicsItemPropertiesWidget::setLiveEdit(bool live_edit)
|
||||
|
||||
if (m_live_edit) {
|
||||
setUpEditConnection();
|
||||
} else {
|
||||
clearEditConnection();
|
||||
} else {
|
||||
clearEditConnection();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -468,46 +468,46 @@ bool ShapeGraphicsItemPropertiesWidget::setLiveEdit(bool live_edit)
|
||||
*/
|
||||
void ShapeGraphicsItemPropertiesWidget::setUpEditConnection()
|
||||
{
|
||||
clearEditConnection();
|
||||
clearEditConnection();
|
||||
|
||||
if (m_shape || !m_shapes_list.isEmpty())
|
||||
{
|
||||
m_edit_connection << connect (ui->m_style_cb, QOverload<int>::of(&QComboBox::activated),
|
||||
this, &ShapeGraphicsItemPropertiesWidget::apply);
|
||||
m_edit_connection << connect (ui->m_style_cb, QOverload<int>::of(&QComboBox::activated),
|
||||
this, &ShapeGraphicsItemPropertiesWidget::apply);
|
||||
|
||||
m_edit_connection << connect (ui->m_size_dsb, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||
this, &ShapeGraphicsItemPropertiesWidget::apply);
|
||||
m_edit_connection << connect (ui->m_size_dsb, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||
this, &ShapeGraphicsItemPropertiesWidget::apply);
|
||||
|
||||
m_edit_connection << connect (ui->m_color_kpb, &KColorButton::changed,
|
||||
this, &ShapeGraphicsItemPropertiesWidget::apply);
|
||||
m_edit_connection << connect (ui->m_color_kpb, &KColorButton::changed,
|
||||
this, &ShapeGraphicsItemPropertiesWidget::apply);
|
||||
|
||||
m_edit_connection << connect (ui->m_brush_style_cb, QOverload<int>::of(&QComboBox::activated),
|
||||
this, &ShapeGraphicsItemPropertiesWidget::apply);
|
||||
m_edit_connection << connect (ui->m_brush_style_cb, QOverload<int>::of(&QComboBox::activated),
|
||||
this, &ShapeGraphicsItemPropertiesWidget::apply);
|
||||
|
||||
m_edit_connection << connect (ui->m_brush_color_kpb, &KColorButton::changed,
|
||||
this, &ShapeGraphicsItemPropertiesWidget::apply);
|
||||
m_edit_connection << connect (ui->m_brush_color_kpb, &KColorButton::changed,
|
||||
this, &ShapeGraphicsItemPropertiesWidget::apply);
|
||||
|
||||
m_edit_connection << connect (ui->m_close_polygon, &QCheckBox::clicked,
|
||||
this, &ShapeGraphicsItemPropertiesWidget::apply);
|
||||
m_edit_connection << connect (ui->m_close_polygon, &QCheckBox::clicked,
|
||||
this, &ShapeGraphicsItemPropertiesWidget::apply);
|
||||
|
||||
m_edit_connection << connect (m_shape, &QetShapeItem::penChanged,
|
||||
this, &ShapeGraphicsItemPropertiesWidget::updateUi);
|
||||
m_edit_connection << connect (m_shape, &QetShapeItem::penChanged,
|
||||
this, &ShapeGraphicsItemPropertiesWidget::updateUi);
|
||||
|
||||
m_edit_connection << connect (m_shape, &QetShapeItem::closeChanged,
|
||||
this, &ShapeGraphicsItemPropertiesWidget::updateUi);
|
||||
m_edit_connection << connect (m_shape, &QetShapeItem::closeChanged,
|
||||
this, &ShapeGraphicsItemPropertiesWidget::updateUi);
|
||||
|
||||
m_edit_connection << connect (m_shape, &QetShapeItem::brushChanged,
|
||||
this, &ShapeGraphicsItemPropertiesWidget::updateUi);
|
||||
m_edit_connection << connect (m_shape, &QetShapeItem::brushChanged,
|
||||
this, &ShapeGraphicsItemPropertiesWidget::updateUi);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ShapeGraphicsItemPropertiesWidget::clearEditConnection()
|
||||
{
|
||||
for (const auto &c : qAsConst(m_edit_connection)) {
|
||||
disconnect(c);
|
||||
}
|
||||
m_edit_connection.clear();
|
||||
for (const auto &c : qAsConst(m_edit_connection)) {
|
||||
disconnect(c);
|
||||
}
|
||||
m_edit_connection.clear();
|
||||
}
|
||||
|
||||
void ShapeGraphicsItemPropertiesWidget::on_m_lock_pos_cb_clicked()
|
||||
|
||||
@@ -53,12 +53,12 @@ class ShapeGraphicsItemPropertiesWidget : public PropertiesEditorWidget
|
||||
|
||||
private:
|
||||
void setUpEditConnection();
|
||||
void clearEditConnection();
|
||||
void clearEditConnection();
|
||||
|
||||
private slots:
|
||||
void on_m_lock_pos_cb_clicked();
|
||||
|
||||
private:
|
||||
private:
|
||||
Ui::ShapeGraphicsItemPropertiesWidget *ui;
|
||||
QetShapeItem *m_shape;
|
||||
QList <QPointer<QetShapeItem>> m_shapes_list;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user