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