mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-02-18 09:39:58 +01:00
Merge branch 'master' into dxf
This commit is contained in:
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "elementcollectionhandler.h"
|
||||
#include "renamedialog.h"
|
||||
@@ -25,7 +25,8 @@
|
||||
|
||||
/******************************************************/
|
||||
|
||||
ECHStrategy::ECHStrategy(ElementsLocation &source, ElementsLocation &destination) :
|
||||
ECHStrategy::ECHStrategy(ElementsLocation &source,
|
||||
ElementsLocation &destination) :
|
||||
m_source(source),
|
||||
m_destination (destination)
|
||||
{}
|
||||
@@ -298,9 +299,9 @@ ElementsLocation ECHSToXml::copy()
|
||||
/******************************************************/
|
||||
|
||||
/**
|
||||
* @brief ElementCollectionHandler::ElementCollectionHandler
|
||||
* @param widget
|
||||
*/
|
||||
@brief ElementCollectionHandler::ElementCollectionHandler
|
||||
@param widget
|
||||
*/
|
||||
ElementCollectionHandler::ElementCollectionHandler() {}
|
||||
|
||||
ElementCollectionHandler::~ElementCollectionHandler()
|
||||
@@ -309,14 +310,14 @@ ElementCollectionHandler::~ElementCollectionHandler()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementCollectionHandler::copy
|
||||
* Copy the content of collection represented by source to the collection represented by destination.
|
||||
* Destination must be a directory, else the copy do nothing and return a null ElementLocation
|
||||
* if destination have an item with the same name of source, a dialog ask to user what to do.
|
||||
* @param source
|
||||
* @param destination
|
||||
* @return
|
||||
*/
|
||||
@brief ElementCollectionHandler::copy
|
||||
Copy the content of collection represented by source to the collection represented by destination.
|
||||
Destination must be a directory, else the copy do nothing and return a null ElementLocation
|
||||
if destination have an item with the same name of source, a dialog ask to user what to do.
|
||||
@param source
|
||||
@param destination
|
||||
@return
|
||||
*/
|
||||
ElementsLocation ElementCollectionHandler::copy(ElementsLocation &source, ElementsLocation &destination)
|
||||
{
|
||||
if (!source.exist() || !destination.exist() || destination.isElement()) return ElementsLocation();
|
||||
@@ -332,14 +333,14 @@ ElementsLocation ElementCollectionHandler::copy(ElementsLocation &source, Elemen
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementCollectionHandler::createDir
|
||||
* Create a directorie with name @name as child of @parent.
|
||||
* Parent must be a directory
|
||||
* @param parent : parent of the dir to create
|
||||
* @param name : name of directorie to create
|
||||
* @param name_list : translations of the directorie name
|
||||
* @return : ElementsLocation that represent the new directorie, location can be null if an error was occurred
|
||||
*/
|
||||
@brief ElementCollectionHandler::createDir
|
||||
Create a directorie with name @name as child of @parent.
|
||||
Parent must be a directory
|
||||
@param parent : parent of the dir to create
|
||||
@param name : name of directorie to create
|
||||
@param name_list : translations of the directorie name
|
||||
@return : ElementsLocation that represent the new directorie, location can be null if an error was occurred
|
||||
*/
|
||||
ElementsLocation ElementCollectionHandler::createDir(ElementsLocation &parent, const QString &name, const NamesList &name_list)
|
||||
{
|
||||
//Parent must be a directorie and writable
|
||||
@@ -393,13 +394,13 @@ ElementsLocation ElementCollectionHandler::createDir(ElementsLocation &parent, c
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementCollectionHandler::importFromProject
|
||||
* Import the element represented by @location to the embedded collection of @project at the same path.
|
||||
* @location must represente an element owned by a project embedded collection
|
||||
* @param project : project where copy the element
|
||||
* @param location : location to copy
|
||||
* @return true if import with success
|
||||
*/
|
||||
@brief ElementCollectionHandler::importFromProject
|
||||
Import the element represented by @location to the embedded collection of @project at the same path.
|
||||
@location must represente an element owned by a project embedded collection
|
||||
@param project : project where copy the element
|
||||
@param location : location to copy
|
||||
@return true if import with success
|
||||
*/
|
||||
bool ElementCollectionHandler::importFromProject(QETProject *project, ElementsLocation &location)
|
||||
{
|
||||
if (!(location.isElement() && location.exist() && location.isProject())) return false;
|
||||
@@ -436,12 +437,12 @@ bool ElementCollectionHandler::importFromProject(QETProject *project, ElementsLo
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementCollectionHandler::setNames
|
||||
* Set the names stored in @name_list as the names of the item represented by location
|
||||
* @param location : location to change the names
|
||||
* @param name_list : NamesList to use
|
||||
* @return return true if success
|
||||
*/
|
||||
@brief ElementCollectionHandler::setNames
|
||||
Set the names stored in @name_list as the names of the item represented by location
|
||||
@param location : location to change the names
|
||||
@param name_list : NamesList to use
|
||||
@return return true if success
|
||||
*/
|
||||
bool ElementCollectionHandler::setNames(ElementsLocation &location, const NamesList &name_list)
|
||||
{
|
||||
if ( !(location.exist() && location.isWritable()) ) {
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef ELEMENTCOLLECTIONHANDLER_H
|
||||
#define ELEMENTCOLLECTIONHANDLER_H
|
||||
@@ -24,79 +24,105 @@
|
||||
class QWidget;
|
||||
|
||||
/**
|
||||
* @brief The ECHStrategy class
|
||||
* Abstract class for manage copy of directory or element from a collection to another
|
||||
*/
|
||||
@brief The ECHStrategy class
|
||||
Abstract class for manage copy of directory
|
||||
or element from a collection to another
|
||||
*/
|
||||
class ECHStrategy
|
||||
{
|
||||
public:
|
||||
ECHStrategy(ElementsLocation &source, ElementsLocation &destination);
|
||||
virtual ~ECHStrategy();
|
||||
public:
|
||||
ECHStrategy(ElementsLocation &source,
|
||||
ElementsLocation &destination);
|
||||
virtual ~ECHStrategy();
|
||||
virtual ElementsLocation copy() =0;
|
||||
|
||||
ElementsLocation m_source, m_destination;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief The ECHSFileToFile class
|
||||
* Manage the copy of directory or element from a file system collection to another file system collection
|
||||
*/
|
||||
@brief The ECHSFileToFile class
|
||||
Manage the copy of directory or element from a file system collection
|
||||
to another file system collection
|
||||
*/
|
||||
class ECHSFileToFile : public ECHStrategy
|
||||
{
|
||||
public:
|
||||
ECHSFileToFile (ElementsLocation &source, ElementsLocation &destination);
|
||||
ElementsLocation copy() override;
|
||||
|
||||
private:
|
||||
ElementsLocation copyDirectory(ElementsLocation &source, ElementsLocation &destination, const QString& rename = QString());
|
||||
ElementsLocation copyElement(ElementsLocation &source, ElementsLocation &destination, const QString& rename = QString());
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief The ECHSXmlToFile class
|
||||
* Manage the copy of a directory or element from an xml collection to a file.
|
||||
*/
|
||||
class ECHSXmlToFile : public ECHStrategy
|
||||
{
|
||||
public:
|
||||
ECHSXmlToFile (ElementsLocation &source, ElementsLocation &destination);
|
||||
ECHSFileToFile (ElementsLocation &source,
|
||||
ElementsLocation &destination);
|
||||
ElementsLocation copy() override;
|
||||
|
||||
private:
|
||||
ElementsLocation copyDirectory(ElementsLocation &source, ElementsLocation &destination, const QString& rename = QString());
|
||||
ElementsLocation copyElement(ElementsLocation &source, ElementsLocation &destination, const QString& rename = QString());
|
||||
ElementsLocation copyDirectory(
|
||||
ElementsLocation &source,
|
||||
ElementsLocation &destination,
|
||||
const QString& rename = QString());
|
||||
ElementsLocation copyElement(
|
||||
ElementsLocation &source,
|
||||
ElementsLocation &destination,
|
||||
const QString& rename = QString());
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief The ECHSToXml class
|
||||
* Manage the copy of a directory or element from a collection (no matter if the source is a file system collection or an xml collection)
|
||||
* to an xml collection
|
||||
*/
|
||||
@brief The ECHSXmlToFile class
|
||||
Manage the copy of a directory or element from an xml collection
|
||||
to a file.
|
||||
*/
|
||||
class ECHSXmlToFile : public ECHStrategy
|
||||
{
|
||||
public:
|
||||
ECHSXmlToFile (ElementsLocation &source,
|
||||
ElementsLocation &destination);
|
||||
ElementsLocation copy() override;
|
||||
|
||||
private:
|
||||
ElementsLocation copyDirectory(
|
||||
ElementsLocation &source,
|
||||
ElementsLocation &destination,
|
||||
const QString& rename = QString());
|
||||
ElementsLocation copyElement(
|
||||
ElementsLocation &source,
|
||||
ElementsLocation &destination,
|
||||
const QString& rename = QString());
|
||||
};
|
||||
|
||||
/**
|
||||
@brief The ECHSToXml class
|
||||
Manage the copy of a directory or element from a collection
|
||||
(no matter if the source is a file system collection
|
||||
or an xml collection)
|
||||
to an xml collection
|
||||
*/
|
||||
class ECHSToXml : public ECHStrategy
|
||||
{
|
||||
public:
|
||||
ECHSToXml (ElementsLocation &source, ElementsLocation &destination);
|
||||
ECHSToXml (ElementsLocation &source,
|
||||
ElementsLocation &destination);
|
||||
ElementsLocation copy() override;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief The ElementCollectionHandler class
|
||||
* Provide several method to copy element or directory from a collection
|
||||
* to another collection.
|
||||
*/
|
||||
@brief The ElementCollectionHandler class
|
||||
Provide several method to copy element or directory from a collection
|
||||
to another collection.
|
||||
*/
|
||||
class ElementCollectionHandler
|
||||
{
|
||||
public:
|
||||
ElementCollectionHandler();
|
||||
~ElementCollectionHandler();
|
||||
public:
|
||||
ElementCollectionHandler();
|
||||
~ElementCollectionHandler();
|
||||
|
||||
ElementsLocation copy(ElementsLocation &source, ElementsLocation &destination);
|
||||
ElementsLocation createDir(ElementsLocation &parent, const QString &name, const NamesList &name_list);
|
||||
bool importFromProject (QETProject *project, ElementsLocation &location);
|
||||
bool setNames(ElementsLocation &location, const NamesList &name_list);
|
||||
ElementsLocation copy(ElementsLocation &source,
|
||||
ElementsLocation &destination);
|
||||
ElementsLocation createDir(ElementsLocation &parent,
|
||||
const QString &name,
|
||||
const NamesList &name_list);
|
||||
bool importFromProject (QETProject *project,
|
||||
ElementsLocation &location);
|
||||
bool setNames(ElementsLocation &location,
|
||||
const NamesList &name_list);
|
||||
|
||||
private:
|
||||
ECHStrategy *m_strategy = nullptr;
|
||||
private:
|
||||
ECHStrategy *m_strategy = nullptr;
|
||||
};
|
||||
|
||||
#endif // ELEMENTCOLLECTIONHANDLER_H
|
||||
|
||||
@@ -19,16 +19,16 @@
|
||||
#include "elementcollectionitem.h"
|
||||
|
||||
/**
|
||||
* @brief ElementCollectionItem::ElementCollectionItem
|
||||
* Constructor
|
||||
*/
|
||||
@brief ElementCollectionItem::ElementCollectionItem
|
||||
Constructor
|
||||
*/
|
||||
ElementCollectionItem::ElementCollectionItem()
|
||||
{}
|
||||
|
||||
/**
|
||||
* @brief ElementCollectionItem::clearData
|
||||
* Reset the data
|
||||
*/
|
||||
@brief ElementCollectionItem::clearData
|
||||
Reset the data
|
||||
*/
|
||||
void ElementCollectionItem::clearData()
|
||||
{
|
||||
setText(QString());
|
||||
@@ -38,13 +38,13 @@ void ElementCollectionItem::clearData()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementCollectionItem::lastItemForPath
|
||||
* Return the last existing item in this ElementCollectionItem hierarchy according to the given path.
|
||||
* Next_item is the first non existing item in this hierarchy according to the given path.
|
||||
* @param path : The path to find last item. The path must be in form : path/otherPath/.../.../myElement.elmt.
|
||||
* @param no_found_path : The first item that not exist in this hierarchy
|
||||
* @return : The last item that exist in this hierarchy, or nullptr can't find (an error was occurred, or path already exist)
|
||||
*/
|
||||
@brief ElementCollectionItem::lastItemForPath
|
||||
Return the last existing item in this ElementCollectionItem hierarchy according to the given path.
|
||||
Next_item is the first non existing item in this hierarchy according to the given path.
|
||||
@param path : The path to find last item. The path must be in form : path/otherPath/.../.../myElement.elmt.
|
||||
@param no_found_path : The first item that not exist in this hierarchy
|
||||
@return : The last item that exist in this hierarchy, or nullptr can't find (an error was occurred, or path already exist)
|
||||
*/
|
||||
ElementCollectionItem *ElementCollectionItem::lastItemForPath(const QString &path, QString &no_found_path)
|
||||
{
|
||||
QStringList str_list = path.split("/");
|
||||
@@ -67,11 +67,11 @@ ElementCollectionItem *ElementCollectionItem::lastItemForPath(const QString &pat
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementCollectionItem::childWithCollectionName
|
||||
* Return the child with the collection name @name, else return nullptr
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
@brief ElementCollectionItem::childWithCollectionName
|
||||
Return the child with the collection name @name, else return nullptr
|
||||
@param name
|
||||
@return
|
||||
*/
|
||||
ElementCollectionItem *ElementCollectionItem::childWithCollectionName(const QString& name) const
|
||||
{
|
||||
rowCount();
|
||||
@@ -85,10 +85,10 @@ ElementCollectionItem *ElementCollectionItem::childWithCollectionName(const QStr
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementCollectionItem::directChilds
|
||||
* Return the direct child of this item
|
||||
* @return
|
||||
*/
|
||||
@brief ElementCollectionItem::directChilds
|
||||
Return the direct child of this item
|
||||
@return
|
||||
*/
|
||||
QList<QStandardItem *> ElementCollectionItem::directChilds() const
|
||||
{
|
||||
QList <QStandardItem *> item_list;
|
||||
@@ -100,12 +100,12 @@ QList<QStandardItem *> ElementCollectionItem::directChilds() const
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementCollectionItem::rowForInsertItem
|
||||
* Return the row for insert a new child item to this item with name @collection_name.
|
||||
* If row can't be found (collection_name is null, or already exist) return -1;
|
||||
* @param collection_name
|
||||
* @return
|
||||
*/
|
||||
@brief ElementCollectionItem::rowForInsertItem
|
||||
Return the row for insert a new child item to this item with name @collection_name.
|
||||
If row can't be found (collection_name is null, or already exist) return -1;
|
||||
@param collection_name
|
||||
@return
|
||||
*/
|
||||
int ElementCollectionItem::rowForInsertItem(const QString &name)
|
||||
{
|
||||
if (name.isEmpty())
|
||||
@@ -137,10 +137,10 @@ int ElementCollectionItem::rowForInsertItem(const QString &name)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementCollectionItem::itemAtPath
|
||||
* @param path
|
||||
* @return the item at path or nullptr if doesn't exist
|
||||
*/
|
||||
@brief ElementCollectionItem::itemAtPath
|
||||
@param path
|
||||
@return the item at path or nullptr if doesn't exist
|
||||
*/
|
||||
ElementCollectionItem *ElementCollectionItem::itemAtPath(const QString &path)
|
||||
{
|
||||
QStringList str_list = path.split("/");
|
||||
@@ -160,9 +160,9 @@ ElementCollectionItem *ElementCollectionItem::itemAtPath(const QString &path)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementCollectionItem::elementsDirectChild
|
||||
* @return The direct element child of this item
|
||||
*/
|
||||
@brief ElementCollectionItem::elementsDirectChild
|
||||
@return The direct element child of this item
|
||||
*/
|
||||
QList<ElementCollectionItem *> ElementCollectionItem::elementsDirectChild() const
|
||||
{
|
||||
QList <ElementCollectionItem *> element_child;
|
||||
@@ -177,9 +177,9 @@ QList<ElementCollectionItem *> ElementCollectionItem::elementsDirectChild() cons
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementCollectionItem::directoriesDirectChild
|
||||
* @return the direct directory child of this item
|
||||
*/
|
||||
@brief ElementCollectionItem::directoriesDirectChild
|
||||
@return the direct directory child of this item
|
||||
*/
|
||||
QList<ElementCollectionItem *> ElementCollectionItem::directoriesDirectChild() const
|
||||
{
|
||||
QList <ElementCollectionItem *> dir_child;
|
||||
@@ -194,9 +194,9 @@ QList<ElementCollectionItem *> ElementCollectionItem::directoriesDirectChild() c
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementCollectionItem::elementsChild
|
||||
* @return Every elements child (direct and indirect) of this item
|
||||
*/
|
||||
@brief ElementCollectionItem::elementsChild
|
||||
@return Every elements child (direct and indirect) of this item
|
||||
*/
|
||||
QList<ElementCollectionItem *> ElementCollectionItem::elementsChild() const
|
||||
{
|
||||
QList <ElementCollectionItem *> list = elementsDirectChild();
|
||||
@@ -208,9 +208,9 @@ QList<ElementCollectionItem *> ElementCollectionItem::elementsChild() const
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementCollectionItem::directoriesChild
|
||||
* @return Every directories child (direct and indirect) of this item
|
||||
*/
|
||||
@brief ElementCollectionItem::directoriesChild
|
||||
@return Every directories child (direct and indirect) of this item
|
||||
*/
|
||||
QList<ElementCollectionItem *> ElementCollectionItem::directoriesChild() const
|
||||
{
|
||||
QList<ElementCollectionItem *> list = directoriesDirectChild();
|
||||
@@ -224,9 +224,9 @@ QList<ElementCollectionItem *> ElementCollectionItem::directoriesChild() const
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementCollectionItem::items
|
||||
* @return every childs of this item (direct and indirect childs)
|
||||
*/
|
||||
@brief ElementCollectionItem::items
|
||||
@return every childs of this item (direct and indirect childs)
|
||||
*/
|
||||
QList<ElementCollectionItem *> ElementCollectionItem::items() const
|
||||
{
|
||||
QList <ElementCollectionItem *> list;
|
||||
|
||||
@@ -21,11 +21,11 @@
|
||||
#include <QStandardItem>
|
||||
|
||||
/**
|
||||
* @brief The ElementCollectionItem class
|
||||
* This class represent a item (a directory or an element) in a element collection.
|
||||
* This class must be herited for specialisation.
|
||||
* This item is used by ElementsCollectionModel for manage the elements collection
|
||||
*/
|
||||
@brief The ElementCollectionItem class
|
||||
This class represent a item (a directory or an element) in a element collection.
|
||||
This class must be herited for specialisation.
|
||||
This item is used by ElementsCollectionModel for manage the elements collection
|
||||
*/
|
||||
class ElementCollectionItem : public QStandardItem
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -99,15 +99,15 @@ QStringList ElementsCollectionModel::mimeTypes() const
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionModel::canDropMimeData
|
||||
* Reimplemented from QStandardItemModel
|
||||
* @param data
|
||||
* @param action
|
||||
* @param row
|
||||
* @param column
|
||||
* @param parent
|
||||
* @return
|
||||
*/
|
||||
@brief ElementsCollectionModel::canDropMimeData
|
||||
Reimplemented from QStandardItemModel
|
||||
@param data
|
||||
@param action
|
||||
@param row
|
||||
@param column
|
||||
@param parent
|
||||
@return
|
||||
*/
|
||||
bool ElementsCollectionModel::canDropMimeData(const QMimeData *data,
|
||||
Qt::DropAction action,
|
||||
int row,
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "elementscollectionwidget.h"
|
||||
#include "elementscollectionmodel.h"
|
||||
@@ -38,10 +38,10 @@
|
||||
#include <QTimer>
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionWidget::ElementsCollectionWidget
|
||||
* Default constructor.
|
||||
* @param parent : parent widget of this widget.
|
||||
*/
|
||||
@brief ElementsCollectionWidget::ElementsCollectionWidget
|
||||
Default constructor.
|
||||
@param parent : parent widget of this widget.
|
||||
*/
|
||||
ElementsCollectionWidget::ElementsCollectionWidget(QWidget *parent):
|
||||
QWidget(parent),
|
||||
m_model(nullptr)
|
||||
@@ -66,9 +66,9 @@ ElementsCollectionWidget::ElementsCollectionWidget(QWidget *parent):
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionWidget::expandFirstItems
|
||||
* Expand each first item in the tree view
|
||||
*/
|
||||
@brief ElementsCollectionWidget::expandFirstItems
|
||||
Expand each first item in the tree view
|
||||
*/
|
||||
void ElementsCollectionWidget::expandFirstItems()
|
||||
{
|
||||
if (!m_model)
|
||||
@@ -79,10 +79,10 @@ void ElementsCollectionWidget::expandFirstItems()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionWidget::addProject
|
||||
* Add @project to be displayed
|
||||
* @param project
|
||||
*/
|
||||
@brief ElementsCollectionWidget::addProject
|
||||
Add @project to be displayed
|
||||
@param project
|
||||
*/
|
||||
void ElementsCollectionWidget::addProject(QETProject *project)
|
||||
{
|
||||
if (m_model)
|
||||
@@ -103,10 +103,10 @@ void ElementsCollectionWidget::removeProject(QETProject *project) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionWidget::highlightUnusedElement
|
||||
* highlight the unused element
|
||||
* @See ElementsCollectionModel::highlightUnusedElement()
|
||||
*/
|
||||
@brief ElementsCollectionWidget::highlightUnusedElement
|
||||
highlight the unused element
|
||||
@See ElementsCollectionModel::highlightUnusedElement()
|
||||
*/
|
||||
void ElementsCollectionWidget::highlightUnusedElement()
|
||||
{
|
||||
if (m_model)
|
||||
@@ -114,17 +114,19 @@ void ElementsCollectionWidget::highlightUnusedElement()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionWidget::setCurrentLocation
|
||||
* Set the current item to be the item for @location
|
||||
* @param location
|
||||
*/
|
||||
void ElementsCollectionWidget::setCurrentLocation(const ElementsLocation &location)
|
||||
@brief ElementsCollectionWidget::setCurrentLocation
|
||||
Set the current item to be the item for @location
|
||||
@param location
|
||||
*/
|
||||
void ElementsCollectionWidget::setCurrentLocation(
|
||||
const ElementsLocation &location)
|
||||
{
|
||||
if (!location.exist())
|
||||
return;
|
||||
|
||||
if (m_model)
|
||||
m_tree_view->setCurrentIndex(m_model->indexFromLocation(location));
|
||||
if (m_model)
|
||||
m_tree_view->setCurrentIndex(
|
||||
m_model->indexFromLocation(location));
|
||||
}
|
||||
|
||||
void ElementsCollectionWidget::leaveEvent(QEvent *event)
|
||||
@@ -137,26 +139,38 @@ void ElementsCollectionWidget::leaveEvent(QEvent *event)
|
||||
|
||||
void ElementsCollectionWidget::setUpAction()
|
||||
{
|
||||
m_open_dir = new QAction(QET::Icons::FolderOpen, tr("Ouvrir le dossier correspondant"), this);
|
||||
m_edit_element = new QAction(QET::Icons::ElementEdit, tr("Éditer l'élément"), this);
|
||||
m_delete_element = new QAction(QET::Icons::ElementDelete, tr("Supprimer l'élément"), this);
|
||||
m_delete_dir = new QAction(QET::Icons::FolderDelete, tr("Supprimer le dossier"), this);
|
||||
m_reload = new QAction(QET::Icons::ViewRefresh, tr("Recharger les collections"), this);
|
||||
m_edit_dir = new QAction(QET::Icons::FolderEdit, tr("Éditer le dossier"), this);
|
||||
m_new_directory = new QAction(QET::Icons::FolderNew, tr("Nouveau dossier"), this);
|
||||
m_new_element = new QAction(QET::Icons::ElementNew, tr("Nouvel élément"), this);
|
||||
m_show_this_dir = new QAction(QET::Icons::FolderOnlyThis, tr("Afficher uniquement ce dossier"), this);
|
||||
m_show_all_dir = new QAction(QET::Icons::FolderShowAll, tr("Afficher tous les dossiers"), this);
|
||||
m_dir_propertie = new QAction(QET::Icons::FolderProperties, tr("Propriété du dossier"), this);
|
||||
m_open_dir = new QAction(QET::Icons::FolderOpen,
|
||||
tr("Ouvrir le dossier correspondant"), this);
|
||||
m_edit_element = new QAction(QET::Icons::ElementEdit,
|
||||
tr("Éditer l'élément"), this);
|
||||
m_delete_element = new QAction(QET::Icons::ElementDelete,
|
||||
tr("Supprimer l'élément"), this);
|
||||
m_delete_dir = new QAction(QET::Icons::FolderDelete,
|
||||
tr("Supprimer le dossier"), this);
|
||||
m_reload = new QAction(QET::Icons::ViewRefresh,
|
||||
tr("Recharger les collections"), this);
|
||||
m_edit_dir = new QAction(QET::Icons::FolderEdit,
|
||||
tr("Éditer le dossier"), this);
|
||||
m_new_directory = new QAction(QET::Icons::FolderNew,
|
||||
tr("Nouveau dossier"), this);
|
||||
m_new_element = new QAction(QET::Icons::ElementNew,
|
||||
tr("Nouvel élément"), this);
|
||||
m_show_this_dir = new QAction(QET::Icons::FolderOnlyThis,
|
||||
tr("Afficher uniquement ce dossier"),
|
||||
this);
|
||||
m_show_all_dir = new QAction(QET::Icons::FolderShowAll,
|
||||
tr("Afficher tous les dossiers"), this);
|
||||
m_dir_propertie = new QAction(QET::Icons::FolderProperties,
|
||||
tr("Propriété du dossier"), this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionWidget::setUpWidget
|
||||
* Setup this widget
|
||||
*/
|
||||
@brief ElementsCollectionWidget::setUpWidget
|
||||
Setup this widget
|
||||
*/
|
||||
void ElementsCollectionWidget::setUpWidget()
|
||||
{
|
||||
//Setup the main layout
|
||||
//Setup the main layout
|
||||
m_main_vlayout = new QVBoxLayout(this);
|
||||
this->setLayout(m_main_vlayout);
|
||||
|
||||
@@ -165,7 +179,7 @@ void ElementsCollectionWidget::setUpWidget()
|
||||
m_search_field->setClearButtonEnabled(true);
|
||||
m_main_vlayout->addWidget(m_search_field);
|
||||
|
||||
//Setup the tree view
|
||||
//Setup the tree view
|
||||
m_tree_view = new ElementsTreeView(this);
|
||||
m_tree_view->setHeaderHidden(true);
|
||||
m_tree_view->setIconSize(QSize(50, 50));
|
||||
@@ -177,7 +191,7 @@ void ElementsCollectionWidget::setUpWidget()
|
||||
m_tree_view->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
|
||||
m_main_vlayout->addWidget(m_tree_view);
|
||||
|
||||
//Setup the progress bar
|
||||
//Setup the progress bar
|
||||
m_progress_bar = new QProgressBar(this);
|
||||
m_progress_bar->setFormat(QObject::tr("chargement %p% (%v sur %m)"));
|
||||
|
||||
@@ -188,31 +202,49 @@ void ElementsCollectionWidget::setUpWidget()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionWidget::setUpConnection
|
||||
* Setup the connection used in this widget
|
||||
*/
|
||||
@brief ElementsCollectionWidget::setUpConnection
|
||||
Setup the connection used in this widget
|
||||
*/
|
||||
void ElementsCollectionWidget::setUpConnection()
|
||||
{
|
||||
connect(m_tree_view, &QTreeView::customContextMenuRequested, this, &ElementsCollectionWidget::customContextMenu);
|
||||
connect(m_search_field, &QLineEdit::textEdited, [this]() {m_search_timer.start();});
|
||||
connect(&m_search_timer, &QTimer::timeout, this, &ElementsCollectionWidget::search);
|
||||
connect(m_open_dir, &QAction::triggered, this, &ElementsCollectionWidget::openDir);
|
||||
connect(m_edit_element, &QAction::triggered, this, &ElementsCollectionWidget::editElement);
|
||||
connect(m_delete_element, &QAction::triggered, this, &ElementsCollectionWidget::deleteElement);
|
||||
connect(m_delete_dir, &QAction::triggered, this, &ElementsCollectionWidget::deleteDirectory);
|
||||
connect(m_reload, &QAction::triggered, this, &ElementsCollectionWidget::reload);
|
||||
connect(m_edit_dir, &QAction::triggered, this, &ElementsCollectionWidget::editDirectory);
|
||||
connect(m_new_directory, &QAction::triggered, this, &ElementsCollectionWidget::newDirectory);
|
||||
connect(m_new_element, &QAction::triggered, this, &ElementsCollectionWidget::newElement);
|
||||
connect(m_show_this_dir, &QAction::triggered, this, &ElementsCollectionWidget::showThisDir);
|
||||
connect(m_show_all_dir, &QAction::triggered, this, &ElementsCollectionWidget::resetShowThisDir);
|
||||
connect(m_dir_propertie, &QAction::triggered, this, &ElementsCollectionWidget::dirProperties);
|
||||
connect(m_tree_view, &QTreeView::customContextMenuRequested,
|
||||
this, &ElementsCollectionWidget::customContextMenu);
|
||||
connect(m_search_field, &QLineEdit::textEdited,
|
||||
[this]() {m_search_timer.start();});
|
||||
connect(&m_search_timer, &QTimer::timeout,
|
||||
this, &ElementsCollectionWidget::search);
|
||||
connect(m_open_dir, &QAction::triggered,
|
||||
this, &ElementsCollectionWidget::openDir);
|
||||
connect(m_edit_element, &QAction::triggered,
|
||||
this, &ElementsCollectionWidget::editElement);
|
||||
connect(m_delete_element, &QAction::triggered,
|
||||
this, &ElementsCollectionWidget::deleteElement);
|
||||
connect(m_delete_dir, &QAction::triggered,
|
||||
this, &ElementsCollectionWidget::deleteDirectory);
|
||||
connect(m_reload, &QAction::triggered,
|
||||
this, &ElementsCollectionWidget::reload);
|
||||
connect(m_edit_dir, &QAction::triggered,
|
||||
this, &ElementsCollectionWidget::editDirectory);
|
||||
connect(m_new_directory, &QAction::triggered,
|
||||
this, &ElementsCollectionWidget::newDirectory);
|
||||
connect(m_new_element, &QAction::triggered,
|
||||
this, &ElementsCollectionWidget::newElement);
|
||||
connect(m_show_this_dir, &QAction::triggered,
|
||||
this, &ElementsCollectionWidget::showThisDir);
|
||||
connect(m_show_all_dir, &QAction::triggered,
|
||||
this, &ElementsCollectionWidget::resetShowThisDir);
|
||||
connect(m_dir_propertie, &QAction::triggered,
|
||||
this, &ElementsCollectionWidget::dirProperties);
|
||||
|
||||
connect(m_tree_view, &QTreeView::doubleClicked, [this](const QModelIndex &index) {
|
||||
this->m_index_at_context_menu = index ;
|
||||
this->editElement();});
|
||||
connect(m_tree_view, &QTreeView::doubleClicked,
|
||||
[this](const QModelIndex &index)
|
||||
{
|
||||
this->m_index_at_context_menu = index ;
|
||||
this->editElement();
|
||||
});
|
||||
|
||||
connect(m_tree_view, &QTreeView::entered, [this] (const QModelIndex &index) {
|
||||
connect(m_tree_view, &QTreeView::entered,
|
||||
[this] (const QModelIndex &index) {
|
||||
QETDiagramEditor *qde = QETApp::diagramEditorAncestorOf(this);
|
||||
ElementCollectionItem *eci = elementCollectionItemForIndex(index);
|
||||
if (qde && eci)
|
||||
@@ -221,10 +253,10 @@ void ElementsCollectionWidget::setUpConnection()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionWidget::customContextMenu
|
||||
* Display the context menu of this widget at @point
|
||||
* @param point
|
||||
*/
|
||||
@brief ElementsCollectionWidget::customContextMenu
|
||||
Display the context menu of this widget at point
|
||||
@param point
|
||||
*/
|
||||
void ElementsCollectionWidget::customContextMenu(const QPoint &point)
|
||||
{
|
||||
m_index_at_context_menu = m_tree_view->indexAt(point);
|
||||
@@ -232,7 +264,8 @@ void ElementsCollectionWidget::customContextMenu(const QPoint &point)
|
||||
|
||||
m_context_menu->clear();
|
||||
|
||||
ElementCollectionItem *eci = elementCollectionItemForIndex(m_index_at_context_menu);
|
||||
ElementCollectionItem *eci = elementCollectionItemForIndex(
|
||||
m_index_at_context_menu);
|
||||
bool add_open_dir = false;
|
||||
|
||||
if (eci->isElement())
|
||||
@@ -241,7 +274,8 @@ void ElementsCollectionWidget::customContextMenu(const QPoint &point)
|
||||
if (eci->type() == FileElementCollectionItem::Type)
|
||||
{
|
||||
add_open_dir = true;
|
||||
FileElementCollectionItem *feci = static_cast<FileElementCollectionItem*>(eci);
|
||||
FileElementCollectionItem *feci =
|
||||
static_cast<FileElementCollectionItem*>(eci);
|
||||
if (!feci->isCommonCollection())
|
||||
{
|
||||
if (feci->isDir())
|
||||
@@ -260,7 +294,8 @@ void ElementsCollectionWidget::customContextMenu(const QPoint &point)
|
||||
}
|
||||
if (eci->type() == XmlProjectElementCollectionItem::Type)
|
||||
{
|
||||
XmlProjectElementCollectionItem *xpeci = static_cast<XmlProjectElementCollectionItem *>(eci);
|
||||
XmlProjectElementCollectionItem *xpeci =
|
||||
static_cast<XmlProjectElementCollectionItem *>(eci);
|
||||
if (xpeci->isCollectionRoot())
|
||||
add_open_dir = true;
|
||||
}
|
||||
@@ -269,7 +304,7 @@ void ElementsCollectionWidget::customContextMenu(const QPoint &point)
|
||||
if (eci->isDir())
|
||||
{
|
||||
m_context_menu->addAction(m_show_this_dir);
|
||||
//there is a current filtered dir, add entry to reset it
|
||||
//there is a current filtered dir, add entry to reset it
|
||||
if (m_showed_index.isValid())
|
||||
m_context_menu->addAction(m_show_all_dir);
|
||||
|
||||
@@ -283,12 +318,13 @@ void ElementsCollectionWidget::customContextMenu(const QPoint &point)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionWidget::openDir
|
||||
* Open the directory represented by the current selected item
|
||||
*/
|
||||
@brief ElementsCollectionWidget::openDir
|
||||
Open the directory represented by the current selected item
|
||||
*/
|
||||
void ElementsCollectionWidget::openDir()
|
||||
{
|
||||
ElementCollectionItem *eci = elementCollectionItemForIndex(m_index_at_context_menu);
|
||||
ElementCollectionItem *eci =
|
||||
elementCollectionItemForIndex(m_index_at_context_menu);
|
||||
if (!eci) return;
|
||||
|
||||
if (eci->type() == FileElementCollectionItem::Type)
|
||||
@@ -309,9 +345,9 @@ void ElementsCollectionWidget::openDir()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionWidget::editElement
|
||||
* Edit the element represented by the current selected item
|
||||
*/
|
||||
@brief ElementsCollectionWidget::editElement
|
||||
Edit the element represented by the current selected item
|
||||
*/
|
||||
void ElementsCollectionWidget::editElement()
|
||||
{
|
||||
ElementCollectionItem *eci = elementCollectionItemForIndex(m_index_at_context_menu);
|
||||
@@ -324,86 +360,112 @@ void ElementsCollectionWidget::editElement()
|
||||
app->openElementLocations(QList<ElementsLocation>() << location);
|
||||
|
||||
foreach (QETElementEditor *element_editor, app->elementEditors())
|
||||
connect(element_editor, &QETElementEditor::saveToLocation, this, &ElementsCollectionWidget::locationWasSaved);
|
||||
connect(element_editor,
|
||||
&QETElementEditor::saveToLocation,
|
||||
this,
|
||||
&ElementsCollectionWidget::locationWasSaved);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionWidget::deleteElement
|
||||
* Delete the element represented by the current selected item.
|
||||
*/
|
||||
@brief ElementsCollectionWidget::deleteElement
|
||||
Delete the element represented by the current selected item.
|
||||
*/
|
||||
void ElementsCollectionWidget::deleteElement()
|
||||
{
|
||||
ElementCollectionItem *eci = elementCollectionItemForIndex(m_index_at_context_menu);
|
||||
ElementCollectionItem *eci = elementCollectionItemForIndex(
|
||||
m_index_at_context_menu);
|
||||
|
||||
if (!eci) return;
|
||||
|
||||
ElementsLocation loc(eci->collectionPath());
|
||||
if (! (loc.isElement() && loc.exist() && loc.isFileSystem() && loc.collectionPath().startsWith("custom://")) ) return;
|
||||
if (! (loc.isElement()
|
||||
&& loc.exist()
|
||||
&& loc.isFileSystem()
|
||||
&& loc.collectionPath().startsWith("custom://")) ) return;
|
||||
|
||||
if (QET::QetMessageBox::question(this,
|
||||
tr("Supprimer l'élément ?", "message box title"),
|
||||
tr("Êtes-vous sûr de vouloir supprimer cet élément ?\n", "message box content"),
|
||||
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes)
|
||||
if (QET::QetMessageBox::question(
|
||||
this,
|
||||
tr("Supprimer l'élément ?", "message box title"),
|
||||
tr("Êtes-vous sûr de vouloir supprimer cet élément ?\n",
|
||||
"message box content"),
|
||||
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes)
|
||||
{
|
||||
QFile file(loc.fileSystemPath());
|
||||
if (file.remove())
|
||||
{
|
||||
m_model->removeRows(m_index_at_context_menu.row(), 1, m_index_at_context_menu.parent());
|
||||
m_model->removeRows(m_index_at_context_menu.row(),
|
||||
1,
|
||||
m_index_at_context_menu.parent());
|
||||
}
|
||||
else
|
||||
{
|
||||
QET::QetMessageBox::warning(this,
|
||||
tr("Suppression de l'élément", "message box title"),
|
||||
tr("La suppression de l'élément a échoué.", "message box content"));
|
||||
QET::QetMessageBox::warning(
|
||||
this,
|
||||
tr("Suppression de l'élément",
|
||||
"message box title"),
|
||||
tr("La suppression de l'élément a échoué.",
|
||||
"message box content"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionWidget::deleteDirectory
|
||||
* Delete directory represented by the current selected item
|
||||
*/
|
||||
@brief ElementsCollectionWidget::deleteDirectory
|
||||
Delete directory represented by the current selected item
|
||||
*/
|
||||
void ElementsCollectionWidget::deleteDirectory()
|
||||
{
|
||||
ElementCollectionItem *eci = elementCollectionItemForIndex(m_index_at_context_menu);
|
||||
ElementCollectionItem *eci = elementCollectionItemForIndex(
|
||||
m_index_at_context_menu);
|
||||
|
||||
if (!eci) return;
|
||||
|
||||
ElementsLocation loc (eci->collectionPath());
|
||||
if (! (loc.isDirectory() && loc.exist() && loc.isFileSystem() && loc.collectionPath().startsWith("custom://")) ) return;
|
||||
if (! (loc.isDirectory()
|
||||
&& loc.exist()
|
||||
&& loc.isFileSystem()
|
||||
&& loc.collectionPath().startsWith("custom://")) ) return;
|
||||
|
||||
if (QET::QetMessageBox::question(this,
|
||||
tr("Supprimer le dossier?", "message box title"),
|
||||
tr("Êtes-vous sûr de vouloir supprimer le dossier ?\n"
|
||||
"Tout les éléments et les dossier contenus dans ce dossier seront supprimés.",
|
||||
"message box content"),
|
||||
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes)
|
||||
if (QET::QetMessageBox::question(
|
||||
this,
|
||||
tr("Supprimer le dossier?", "message box title"),
|
||||
tr("Êtes-vous sûr de vouloir supprimer le dossier ?\n"
|
||||
"Tout les éléments et les dossier contenus dans ce dossier seront supprimés.",
|
||||
"message box content"),
|
||||
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes)
|
||||
{
|
||||
QDir dir (loc.fileSystemPath());
|
||||
if (dir.removeRecursively())
|
||||
{
|
||||
m_model->removeRows(m_index_at_context_menu.row(), 1, m_index_at_context_menu.parent());
|
||||
m_model->removeRows(m_index_at_context_menu.row(),
|
||||
1,
|
||||
m_index_at_context_menu.parent());
|
||||
}
|
||||
else
|
||||
{
|
||||
QET::QetMessageBox::warning(this,
|
||||
tr("Suppression du dossier", "message box title"),
|
||||
tr("La suppression du dossier a échoué.", "message box content"));
|
||||
QET::QetMessageBox::warning(
|
||||
this,
|
||||
tr("Suppression du dossier",
|
||||
"message box title"),
|
||||
tr("La suppression du dossier a échoué.",
|
||||
"message box content"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionWidget::editDirectory
|
||||
* Edit the directory represented by the current selected item
|
||||
*/
|
||||
@brief ElementsCollectionWidget::editDirectory
|
||||
Edit the directory represented by the current selected item
|
||||
*/
|
||||
void ElementsCollectionWidget::editDirectory()
|
||||
{
|
||||
ElementCollectionItem *eci = elementCollectionItemForIndex(m_index_at_context_menu);
|
||||
ElementCollectionItem *eci = elementCollectionItemForIndex(
|
||||
m_index_at_context_menu);
|
||||
|
||||
if (eci->type() != FileElementCollectionItem::Type) return;
|
||||
|
||||
FileElementCollectionItem *feci = static_cast<FileElementCollectionItem*>(eci);
|
||||
FileElementCollectionItem *feci =
|
||||
static_cast<FileElementCollectionItem*>(eci);
|
||||
if(feci->isCommonCollection()) return;
|
||||
|
||||
ElementsLocation location(feci->collectionPath());
|
||||
@@ -414,16 +476,18 @@ void ElementsCollectionWidget::editDirectory()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionWidget::newDirectory
|
||||
* Create a new directory
|
||||
*/
|
||||
@brief ElementsCollectionWidget::newDirectory
|
||||
Create a new directory
|
||||
*/
|
||||
void ElementsCollectionWidget::newDirectory()
|
||||
{
|
||||
ElementCollectionItem *eci = elementCollectionItemForIndex(m_index_at_context_menu);
|
||||
ElementCollectionItem *eci = elementCollectionItemForIndex(
|
||||
m_index_at_context_menu);
|
||||
|
||||
if (eci->type() != FileElementCollectionItem::Type) return;
|
||||
|
||||
FileElementCollectionItem *feci = static_cast<FileElementCollectionItem*>(eci);
|
||||
FileElementCollectionItem *feci =
|
||||
static_cast<FileElementCollectionItem*>(eci);
|
||||
if(feci->isCommonCollection()) return;
|
||||
|
||||
ElementsLocation location(feci->collectionPath());
|
||||
@@ -433,18 +497,20 @@ void ElementsCollectionWidget::newDirectory()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionWidget::newElement
|
||||
* Create a new element.
|
||||
*/
|
||||
@brief ElementsCollectionWidget::newElement
|
||||
Create a new element.
|
||||
*/
|
||||
void ElementsCollectionWidget::newElement()
|
||||
{
|
||||
ElementCollectionItem *eci = elementCollectionItemForIndex(m_index_at_context_menu);
|
||||
ElementCollectionItem *eci = elementCollectionItemForIndex(
|
||||
m_index_at_context_menu);
|
||||
|
||||
if (eci->type() != FileElementCollectionItem::Type) {
|
||||
return;
|
||||
}
|
||||
|
||||
FileElementCollectionItem *feci = static_cast<FileElementCollectionItem*>(eci);
|
||||
FileElementCollectionItem *feci =
|
||||
static_cast<FileElementCollectionItem*>(eci);
|
||||
if(feci->isCommonCollection()) {
|
||||
return;
|
||||
}
|
||||
@@ -454,20 +520,25 @@ void ElementsCollectionWidget::newElement()
|
||||
elmt_wizard.preselectedLocation(loc);
|
||||
elmt_wizard.exec();
|
||||
|
||||
foreach (QETElementEditor *element_editor, QETApp::instance()->elementEditors())
|
||||
connect(element_editor, &QETElementEditor::saveToLocation, this, &ElementsCollectionWidget::locationWasSaved);
|
||||
foreach (QETElementEditor *element_editor,
|
||||
QETApp::instance()->elementEditors())
|
||||
connect(element_editor,
|
||||
&QETElementEditor::saveToLocation,
|
||||
this,
|
||||
&ElementsCollectionWidget::locationWasSaved);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionWidget::showThisDir
|
||||
* Hide all directories except the pointed dir;
|
||||
*/
|
||||
@brief ElementsCollectionWidget::showThisDir
|
||||
Hide all directories except the pointed dir;
|
||||
*/
|
||||
void ElementsCollectionWidget::showThisDir()
|
||||
{
|
||||
//Disable the yellow background of the previous index
|
||||
if (m_showed_index.isValid())
|
||||
{
|
||||
ElementCollectionItem *eci = elementCollectionItemForIndex(m_showed_index);
|
||||
ElementCollectionItem *eci =
|
||||
elementCollectionItemForIndex(m_showed_index);
|
||||
if (eci)
|
||||
eci->setBackground(QBrush());
|
||||
}
|
||||
@@ -477,9 +548,10 @@ void ElementsCollectionWidget::showThisDir()
|
||||
{
|
||||
hideCollection(true);
|
||||
showAndExpandItem(m_showed_index, true, true);
|
||||
ElementCollectionItem *eci = elementCollectionItemForIndex(m_showed_index);
|
||||
ElementCollectionItem *eci =
|
||||
elementCollectionItemForIndex(m_showed_index);
|
||||
if (eci)
|
||||
eci->setBackground(QBrush(QColor(255, 204, 0, 255)));
|
||||
eci->setBackground(QBrush(QColor(255, 204, 0, 255)));
|
||||
search();
|
||||
}
|
||||
else
|
||||
@@ -487,15 +559,16 @@ void ElementsCollectionWidget::showThisDir()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionWidget::resetShowThisDir
|
||||
* reset show this dir, all collection are show.
|
||||
* If search field isn't empty, apply the search after show all collection
|
||||
*/
|
||||
@brief ElementsCollectionWidget::resetShowThisDir
|
||||
reset show this dir, all collection are show.
|
||||
If search field isn't empty, apply the search after show all collection
|
||||
*/
|
||||
void ElementsCollectionWidget::resetShowThisDir()
|
||||
{
|
||||
if (m_showed_index.isValid())
|
||||
{
|
||||
ElementCollectionItem *eci = elementCollectionItemForIndex(m_showed_index);
|
||||
ElementCollectionItem *eci = elementCollectionItemForIndex(
|
||||
m_showed_index);
|
||||
if (eci)
|
||||
eci->setBackground(QBrush());
|
||||
}
|
||||
@@ -505,36 +578,49 @@ void ElementsCollectionWidget::resetShowThisDir()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionWidget::dirProperties
|
||||
* Open an informative dialog about the curent index
|
||||
*/
|
||||
@brief ElementsCollectionWidget::dirProperties
|
||||
Open an informative dialog about the curent index
|
||||
*/
|
||||
void ElementsCollectionWidget::dirProperties()
|
||||
{
|
||||
ElementCollectionItem *eci = elementCollectionItemForIndex(m_index_at_context_menu);
|
||||
ElementCollectionItem *eci = elementCollectionItemForIndex(
|
||||
m_index_at_context_menu);
|
||||
if (eci && eci->isDir()) {
|
||||
QString txt1 = tr("Le dossier %1 contient").arg(eci->localName());
|
||||
QString txt2 = tr("%n élément(s), répartie(s)", "", eci->elementsChild().size());
|
||||
QString txt3 = tr("dans %n dossier(s).", "" , eci->directoriesChild().size());
|
||||
QString txt4 = tr("Chemin de la collection : %1").arg(eci->collectionPath());
|
||||
QString txt1 = tr("Le dossier %1 contient").arg(
|
||||
eci->localName());
|
||||
QString txt2 = tr("%n élément(s), répartie(s)",
|
||||
"",
|
||||
eci->elementsChild().size());
|
||||
QString txt3 = tr("dans %n dossier(s).",
|
||||
"" ,
|
||||
eci->directoriesChild().size());
|
||||
QString txt4 = tr("Chemin de la collection : %1").arg(
|
||||
eci->collectionPath());
|
||||
QString txt5;
|
||||
if (eci->type() == FileElementCollectionItem::Type) {
|
||||
txt5 = tr("Chemin dans le système de fichiers : %1").arg(static_cast<FileElementCollectionItem*>(eci)->fileSystemPath());
|
||||
txt5 = tr("Chemin dans le système de fichiers : %1")
|
||||
.arg(static_cast<FileElementCollectionItem*>(eci)->fileSystemPath());
|
||||
}
|
||||
QMessageBox::information(this,
|
||||
tr("Propriété du dossier %1").arg(eci->localName()),
|
||||
txt1 + " " + txt2 + " " + txt3 + "\n\n" + txt4 + "\n" + txt5);
|
||||
QMessageBox::information(
|
||||
this,
|
||||
tr("Propriété du dossier %1").arg(eci->localName()),
|
||||
txt1 + " " + txt2 + " " + txt3 + "\n\n" + txt4 + "\n" + txt5);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionWidget::reload, the displayed collections.
|
||||
*/
|
||||
@brief ElementsCollectionWidget::reload, the displayed collections.
|
||||
*/
|
||||
void ElementsCollectionWidget::reload()
|
||||
{
|
||||
m_progress_bar->show();
|
||||
m_progress_bar->setValue(1); //Force to repaint now, else progress bar will be not displayed immediately
|
||||
// Force to repaint now,
|
||||
// else progress bar will be not displayed immediately
|
||||
m_progress_bar->setValue(1);
|
||||
m_tree_view->setDisabled(true);
|
||||
m_tree_view->repaint(); //Force to repaint now, else tree view will be not disabled immediately
|
||||
// Force to repaint now,
|
||||
// else tree view will be not disabled immediately
|
||||
m_tree_view->repaint();
|
||||
|
||||
QList <QETProject *> project_list;
|
||||
project_list.append(m_waiting_project);
|
||||
@@ -546,17 +632,26 @@ void ElementsCollectionWidget::reload()
|
||||
m_new_model->deleteLater();
|
||||
}
|
||||
m_new_model = new ElementsCollectionModel(m_tree_view);
|
||||
connect(m_new_model, &ElementsCollectionModel::loadingProgressRangeChanged, m_progress_bar, &QProgressBar::setRange);
|
||||
connect(m_new_model, &ElementsCollectionModel::loadingProgressValueChanged, m_progress_bar, &QProgressBar::setValue);
|
||||
connect(m_new_model, &ElementsCollectionModel::loadingFinished, this, &ElementsCollectionWidget::loadingFinished);
|
||||
connect(m_new_model,
|
||||
&ElementsCollectionModel::loadingProgressRangeChanged,
|
||||
m_progress_bar,
|
||||
&QProgressBar::setRange);
|
||||
connect(m_new_model,
|
||||
&ElementsCollectionModel::loadingProgressValueChanged,
|
||||
m_progress_bar,
|
||||
&QProgressBar::setValue);
|
||||
connect(m_new_model,
|
||||
&ElementsCollectionModel::loadingFinished,
|
||||
this,
|
||||
&ElementsCollectionWidget::loadingFinished);
|
||||
|
||||
m_new_model->loadCollections(true, true, project_list);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionWidget::loadingFinished
|
||||
* Process when collection finished to be loaded
|
||||
*/
|
||||
@brief ElementsCollectionWidget::loadingFinished
|
||||
Process when collection finished to be loaded
|
||||
*/
|
||||
void ElementsCollectionWidget::loadingFinished()
|
||||
{
|
||||
if (m_new_model)
|
||||
@@ -579,15 +674,17 @@ void ElementsCollectionWidget::loadingFinished()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionWidget::locationWasSaved
|
||||
* This method is connected with the signal savedToLocation of Element editor (see ElementsCollectionWidget::editElement())
|
||||
* Update or add the item represented by location to m_model
|
||||
* @param location
|
||||
*/
|
||||
void ElementsCollectionWidget::locationWasSaved(const ElementsLocation& location)
|
||||
@brief ElementsCollectionWidget::locationWasSaved
|
||||
This method is connected with the signal savedToLocation
|
||||
of Element editor (see ElementsCollectionWidget::editElement())
|
||||
Update or add the item represented by location to m_model
|
||||
@param location
|
||||
*/
|
||||
void ElementsCollectionWidget::locationWasSaved(
|
||||
const ElementsLocation& location)
|
||||
{
|
||||
//Because this method update an item in the model, location must
|
||||
//represente an existing element (in file system of project)
|
||||
//Because this method update an item in the model, location must
|
||||
//represente an existing element (in file system of project)
|
||||
if (!location.exist())
|
||||
return;
|
||||
|
||||
@@ -606,10 +703,11 @@ void ElementsCollectionWidget::locationWasSaved(const ElementsLocation& location
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionWidget::search
|
||||
* Search every item (directory or element) that match the text of m_search_field
|
||||
* and display it, other item who does not match @text is hidden
|
||||
*/
|
||||
@brief ElementsCollectionWidget::search
|
||||
Search every item (directory or element)
|
||||
that match the text of m_search_field and display it,
|
||||
other item who does not match text is hidden
|
||||
*/
|
||||
void ElementsCollectionWidget::search()
|
||||
{
|
||||
QString text = m_search_field->text();
|
||||
@@ -627,7 +725,7 @@ void ElementsCollectionWidget::search()
|
||||
else
|
||||
expandFirstItems();
|
||||
|
||||
//Expand the tree and scroll to the last selected index
|
||||
//Expand the tree and scroll to the last selected index
|
||||
if (current_index.isValid())
|
||||
{
|
||||
showAndExpandItem(current_index);
|
||||
@@ -646,8 +744,14 @@ void ElementsCollectionWidget::search()
|
||||
#endif
|
||||
QModelIndexList match_index;
|
||||
foreach (QString txt, text_list) {
|
||||
match_index << m_model->match(m_showed_index.isValid() ? m_model->index(0,0,m_showed_index) : m_model->index(0,0),
|
||||
Qt::UserRole+1, QVariant(txt), -1, Qt::MatchContains | Qt::MatchRecursive);
|
||||
match_index << m_model->match(m_showed_index.isValid()
|
||||
? m_model->index(0,0,m_showed_index)
|
||||
: m_model->index(0,0),
|
||||
Qt::UserRole+1,
|
||||
QVariant(txt),
|
||||
-1,
|
||||
Qt::MatchContains
|
||||
| Qt::MatchRecursive);
|
||||
}
|
||||
|
||||
foreach(QModelIndex index, match_index)
|
||||
@@ -655,10 +759,10 @@ void ElementsCollectionWidget::search()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionWidget::hideCollection
|
||||
* Hide all collection displayed in this tree
|
||||
* @param hide- true = hide , false = visible
|
||||
*/
|
||||
@brief ElementsCollectionWidget::hideCollection
|
||||
Hide all collection displayed in this tree
|
||||
@param hide- true = hide , false = visible
|
||||
*/
|
||||
void ElementsCollectionWidget::hideCollection(bool hide)
|
||||
{
|
||||
for (int i=0 ; i <m_model->rowCount() ; i++)
|
||||
@@ -666,13 +770,16 @@ void ElementsCollectionWidget::hideCollection(bool hide)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionWidget::hideItem
|
||||
* Hide the item @index. If @recursive is true, hide all subchilds of @index
|
||||
* @param hide- true = hide , false = visible
|
||||
* @param index- index to hide
|
||||
* @param recursive- true = apply to child , false = only for @index
|
||||
*/
|
||||
void ElementsCollectionWidget::hideItem(bool hide, const QModelIndex &index, bool recursive)
|
||||
@brief ElementsCollectionWidget::hideItem
|
||||
Hide the item index. If @recursive is true,
|
||||
hide all subchilds of index
|
||||
@param hide- true = hide , false = visible
|
||||
@param index- index to hide
|
||||
@param recursive- true = apply to child , false = only for index
|
||||
*/
|
||||
void ElementsCollectionWidget::hideItem(bool hide,
|
||||
const QModelIndex &index,
|
||||
bool recursive)
|
||||
{
|
||||
m_tree_view->setRowHidden(index.row(), index.parent(), hide);
|
||||
|
||||
@@ -682,15 +789,17 @@ void ElementsCollectionWidget::hideItem(bool hide, const QModelIndex &index, boo
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionWidget::showAndExpandItem
|
||||
* Show the item @index and expand it.
|
||||
* If parent is true, ensure parents of @index is show and expanded
|
||||
* If child is true, ensure all childs of @index is show and expended
|
||||
* @param index- index to show
|
||||
* @param parent- Apply to parent
|
||||
* @param child- Apply to all childs
|
||||
*/
|
||||
void ElementsCollectionWidget::showAndExpandItem(const QModelIndex &index, bool parent, bool child)
|
||||
@brief ElementsCollectionWidget::showAndExpandItem
|
||||
Show the item index and expand it.
|
||||
If parent is true, ensure parents of index is show and expanded
|
||||
If child is true, ensure all childs of index is show and expended
|
||||
@param index- index to show
|
||||
@param parent- Apply to parent
|
||||
@param child- Apply to all childs
|
||||
*/
|
||||
void ElementsCollectionWidget::showAndExpandItem(const QModelIndex &index,
|
||||
bool parent,
|
||||
bool child)
|
||||
{
|
||||
if (index.isValid()) {
|
||||
if (parent)
|
||||
@@ -702,13 +811,15 @@ void ElementsCollectionWidget::showAndExpandItem(const QModelIndex &index, bool
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionWidget::elementCollectionItemForIndex
|
||||
* @param index
|
||||
* @return The internal pointer of index casted to ElementCollectionItem;
|
||||
*/
|
||||
ElementCollectionItem *ElementsCollectionWidget::elementCollectionItemForIndex(const QModelIndex &index) {
|
||||
@brief ElementsCollectionWidget::elementCollectionItemForIndex
|
||||
@param index
|
||||
@return The internal pointer of index casted to ElementCollectionItem;
|
||||
*/
|
||||
ElementCollectionItem *ElementsCollectionWidget::elementCollectionItemForIndex(
|
||||
const QModelIndex &index) {
|
||||
if (!index.isValid())
|
||||
return nullptr;
|
||||
|
||||
return static_cast<ElementCollectionItem*>(m_model->itemFromIndex(index));
|
||||
return static_cast<ElementCollectionItem*>(
|
||||
m_model->itemFromIndex(index));
|
||||
}
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef ELEMENTSCOLLECTIONWIDGET_H
|
||||
#define ELEMENTSCOLLECTIONWIDGET_H
|
||||
@@ -34,19 +34,19 @@ class QETProject;
|
||||
class ElementsTreeView;
|
||||
|
||||
/**
|
||||
* @brief The ElementsCollectionWidget class
|
||||
* This widget embedd a tree view that display the element collection (common, custom, embedded)
|
||||
* and all action needed to use this widget.
|
||||
* This is the element collection widget used in the diagram editor.
|
||||
*/
|
||||
@brief The ElementsCollectionWidget class
|
||||
This widget embedd a tree view that display the element collection (common, custom, embedded)
|
||||
and all action needed to use this widget.
|
||||
This is the element collection widget used in the diagram editor.
|
||||
*/
|
||||
class ElementsCollectionWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ElementsCollectionWidget(QWidget *parent = nullptr);
|
||||
public:
|
||||
ElementsCollectionWidget(QWidget *parent = nullptr);
|
||||
|
||||
void expandFirstItems();
|
||||
void expandFirstItems();
|
||||
|
||||
void addProject (QETProject *project);
|
||||
void removeProject (QETProject *project);
|
||||
|
||||
@@ -125,7 +125,7 @@ bool ElementsLocation::operator!=(const ElementsLocation &other) const {
|
||||
this method don't return the extension name.
|
||||
For exemple if this location represent an element they return myElement.
|
||||
@see fileName()
|
||||
*/
|
||||
*/
|
||||
QString ElementsLocation::baseName() const {
|
||||
QRegExp regexp("^.*([^/]+)\\.elmt$");
|
||||
if (regexp.exactMatch(m_collection_path)) {
|
||||
|
||||
@@ -29,18 +29,18 @@ static int MAX_DND_PIXMAP_WIDTH = 500;
|
||||
static int MAX_DND_PIXMAP_HEIGHT = 375;
|
||||
|
||||
/**
|
||||
* @brief ElementsTreeView::ElementsTreeView
|
||||
* @param parent
|
||||
*/
|
||||
@brief ElementsTreeView::ElementsTreeView
|
||||
@param parent
|
||||
*/
|
||||
ElementsTreeView::ElementsTreeView(QWidget *parent) :
|
||||
QTreeView(parent)
|
||||
{}
|
||||
|
||||
/**
|
||||
* @brief ElementsTreeView::startDrag
|
||||
* Reimplemented from QTreeView
|
||||
* @param supportedActions
|
||||
*/
|
||||
@brief ElementsTreeView::startDrag
|
||||
Reimplemented from QTreeView
|
||||
@param supportedActions
|
||||
*/
|
||||
void ElementsTreeView::startDrag(Qt::DropActions supportedActions)
|
||||
{
|
||||
QModelIndex index = currentIndex();
|
||||
@@ -63,10 +63,10 @@ void ElementsTreeView::startDrag(Qt::DropActions supportedActions)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsTreeView::startElementDrag
|
||||
* Build a QDrag according to the content of @location
|
||||
* @param location : location to use for create the content of the QDrag
|
||||
*/
|
||||
@brief ElementsTreeView::startElementDrag
|
||||
Build a QDrag according to the content of @location
|
||||
@param location : location to use for create the content of the QDrag
|
||||
*/
|
||||
void ElementsTreeView::startElementDrag(const ElementsLocation &location)
|
||||
{
|
||||
if (!location.exist())
|
||||
|
||||
@@ -23,11 +23,11 @@
|
||||
class ElementsLocation;
|
||||
|
||||
/**
|
||||
* @brief The ElementsTreeView class
|
||||
* This class just reimplement startDrag from QTreeView, for set a custom pixmap.
|
||||
* This class must be used when the tree view have an ElementsCollectionModel as model.
|
||||
* The pixmap used is the pixmap of the dragged element or a directory pixmap.
|
||||
*/
|
||||
@brief The ElementsTreeView class
|
||||
This class just reimplement startDrag from QTreeView, for set a custom pixmap.
|
||||
This class must be used when the tree view have an ElementsCollectionModel as model.
|
||||
The pixmap used is the pixmap of the dragged element or a directory pixmap.
|
||||
*/
|
||||
class ElementsTreeView : public QTreeView
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -22,10 +22,10 @@
|
||||
#include "elementslocation.h"
|
||||
|
||||
/**
|
||||
* @brief The FileElementCollectionItem class
|
||||
* This class specialise ElementCollectionItem for manage a collection in
|
||||
* a file system. They represente a directory or an element.
|
||||
*/
|
||||
@brief The FileElementCollectionItem class
|
||||
This class specialise ElementCollectionItem for manage a collection in
|
||||
a file system. They represente a directory or an element.
|
||||
*/
|
||||
class FileElementCollectionItem : public ElementCollectionItem
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "renamedialog.h"
|
||||
|
||||
@@ -21,12 +21,12 @@
|
||||
#include "ui_renamedialog.h"
|
||||
|
||||
RenameDialog::RenameDialog(QString path, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::RenameDialog),
|
||||
m_path(std::move(path))
|
||||
QDialog(parent),
|
||||
ui(new Ui::RenameDialog),
|
||||
m_path(std::move(path))
|
||||
{
|
||||
ui->setupUi(this);
|
||||
m_name = m_path.split("/").last();
|
||||
ui->setupUi(this);
|
||||
m_name = m_path.split("/").last();
|
||||
if (m_name.endsWith(".elmt")) m_name.remove(".elmt");
|
||||
ui->m_label->setText(tr("L'élément « %1 » existe déjà. Que souhaitez-vous faire ?").arg(m_path));
|
||||
ui->lineEdit->setText(m_name + QDate::currentDate().toString("dd-MM-yy"));
|
||||
@@ -34,14 +34,14 @@ RenameDialog::RenameDialog(QString path, QWidget *parent) :
|
||||
|
||||
RenameDialog::~RenameDialog()
|
||||
{
|
||||
delete ui;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void RenameDialog::on_lineEdit_textEdited(const QString &arg1)
|
||||
{
|
||||
if (arg1.isEmpty() || (arg1 == m_name))
|
||||
if (arg1.isEmpty() || (arg1 == m_name))
|
||||
ui->m_rename_pb->setDisabled(true);
|
||||
else
|
||||
else
|
||||
ui->m_rename_pb->setEnabled(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef RENAMEDIALOG_H
|
||||
#define RENAMEDIALOG_H
|
||||
@@ -27,25 +27,25 @@ namespace Ui {
|
||||
|
||||
class RenameDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit RenameDialog(QString path, QWidget *parent = nullptr);
|
||||
~RenameDialog() override;
|
||||
public:
|
||||
explicit RenameDialog(QString path, QWidget *parent = nullptr);
|
||||
~RenameDialog() override;
|
||||
|
||||
QString newName() const {return m_new_name;}
|
||||
QET::Action selectedAction() const {return m_action;}
|
||||
|
||||
private slots:
|
||||
void on_lineEdit_textEdited(const QString &arg1);
|
||||
private slots:
|
||||
void on_lineEdit_textEdited(const QString &arg1);
|
||||
void on_m_erase_pb_clicked();
|
||||
void on_m_rename_pb_clicked();
|
||||
void on_m_cancel_pb_clicked();
|
||||
|
||||
private:
|
||||
Ui::RenameDialog *ui;
|
||||
QString m_path;
|
||||
QString m_name;
|
||||
Ui::RenameDialog *ui;
|
||||
QString m_path;
|
||||
QString m_name;
|
||||
QString m_new_name;
|
||||
QET::Action m_action;
|
||||
};
|
||||
|
||||
@@ -22,16 +22,16 @@
|
||||
#include "qetproject.h"
|
||||
|
||||
/**
|
||||
* @brief XmlElementCollection::XmlElementCollection
|
||||
* Build an empty collection.
|
||||
* The collection start by :
|
||||
@brief XmlElementCollection::XmlElementCollection
|
||||
Build an empty collection.
|
||||
The collection start by :
|
||||
* <collection>
|
||||
* <category name="import>
|
||||
* </category>
|
||||
* </collection>
|
||||
* All elements and category are stored as child of <category name="import>
|
||||
* @param project : the project of this collection
|
||||
*/
|
||||
All elements and category are stored as child of <category name="import>
|
||||
@param project : the project of this collection
|
||||
*/
|
||||
XmlElementCollection::XmlElementCollection(QETProject *project) :
|
||||
QObject(project),
|
||||
m_project(project)
|
||||
@@ -71,11 +71,11 @@ XmlElementCollection::XmlElementCollection(QETProject *project) :
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XmlElementCollection::XmlElementCollection
|
||||
* Constructor with an collection. The tagName of @dom_element must be "collection"
|
||||
* @param dom_element -the collection in a dom_element (the dom element in cloned)
|
||||
* @param project : the project of this collection
|
||||
*/
|
||||
@brief XmlElementCollection::XmlElementCollection
|
||||
Constructor with an collection. The tagName of @dom_element must be "collection"
|
||||
@param dom_element -the collection in a dom_element (the dom element in cloned)
|
||||
@param project : the project of this collection
|
||||
*/
|
||||
XmlElementCollection::XmlElementCollection(const QDomElement &dom_element, QETProject *project) :
|
||||
QObject(project),
|
||||
m_project(project)
|
||||
@@ -87,29 +87,29 @@ XmlElementCollection::XmlElementCollection(const QDomElement &dom_element, QETPr
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XmlElementCollection::root
|
||||
* The root is the first DOM-Element the xml collection, the tag name
|
||||
* of the dom element is : collection
|
||||
* @return The root QDomElement of the collection
|
||||
*/
|
||||
@brief XmlElementCollection::root
|
||||
The root is the first DOM-Element the xml collection, the tag name
|
||||
of the dom element is : collection
|
||||
@return The root QDomElement of the collection
|
||||
*/
|
||||
QDomElement XmlElementCollection::root() const {
|
||||
return m_dom_document.documentElement();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XmlElementCollection::importCategory
|
||||
* @return The QDomElement import (the begining of a xml collection) or
|
||||
* a null QDomElement if doesn't exist.
|
||||
*/
|
||||
@brief XmlElementCollection::importCategory
|
||||
@return The QDomElement import (the begining of a xml collection) or
|
||||
a null QDomElement if doesn't exist.
|
||||
*/
|
||||
QDomElement XmlElementCollection::importCategory() const {
|
||||
return root().firstChildElement("category");
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XmlElementCollection::childs
|
||||
* @param parent_element
|
||||
* @return All childs element in the @parent_element tree
|
||||
*/
|
||||
@brief XmlElementCollection::childs
|
||||
@param parent_element
|
||||
@return All childs element in the @parent_element tree
|
||||
*/
|
||||
QDomNodeList XmlElementCollection::childs(const QDomElement &parent_element) const
|
||||
{
|
||||
if (parent_element.ownerDocument() != m_dom_document) return QDomNodeList();
|
||||
@@ -117,14 +117,14 @@ QDomNodeList XmlElementCollection::childs(const QDomElement &parent_element) con
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XmlElementCollection::child
|
||||
* If parent_element have child element with an attribute name = @child_name, return it, else return a null QDomElement.
|
||||
* Only search for element with tag-name "category" and "element" (if child_name end with ".elmt")
|
||||
* @param parent_element : the parent DomElement where we search for child.
|
||||
* @parent_element must be a child node of this XmlElementCollection.
|
||||
* @param child_name : name of child to search.
|
||||
* @return The child QDomElement or a null QDomElement if not found
|
||||
*/
|
||||
@brief XmlElementCollection::child
|
||||
If parent_element have child element with an attribute name = @child_name, return it, else return a null QDomElement.
|
||||
Only search for element with tag-name "category" and "element" (if child_name end with ".elmt")
|
||||
@param parent_element : the parent DomElement where we search for child.
|
||||
@parent_element must be a child node of this XmlElementCollection.
|
||||
@param child_name : name of child to search.
|
||||
@return The child QDomElement or a null QDomElement if not found
|
||||
*/
|
||||
QDomElement XmlElementCollection::child(const QDomElement &parent_element, const QString &child_name) const
|
||||
{
|
||||
if (parent_element.ownerDocument() != m_dom_document) return QDomElement();
|
||||
@@ -149,10 +149,10 @@ QDomElement XmlElementCollection::child(const QDomElement &parent_element, const
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XmlElementCollection::child
|
||||
* @param path
|
||||
* @return the DomElement at path if exist, else return a null QDomElement
|
||||
*/
|
||||
@brief XmlElementCollection::child
|
||||
@param path
|
||||
@return the DomElement at path if exist, else return a null QDomElement
|
||||
*/
|
||||
QDomElement XmlElementCollection::child(const QString &path) const
|
||||
{
|
||||
QStringList path_list = path.split("/");
|
||||
@@ -173,10 +173,10 @@ QDomElement XmlElementCollection::child(const QString &path) const
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XmlElementCollection::directories
|
||||
* @param parent_element
|
||||
* @return A list of directory stored in @parent_element
|
||||
*/
|
||||
@brief XmlElementCollection::directories
|
||||
@param parent_element
|
||||
@return A list of directory stored in @parent_element
|
||||
*/
|
||||
QList<QDomElement> XmlElementCollection::directories(const QDomElement &parent_element) const
|
||||
{
|
||||
QList <QDomElement> directory_list;
|
||||
@@ -194,10 +194,10 @@ QList<QDomElement> XmlElementCollection::directories(const QDomElement &parent_e
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XmlElementCollection::directoriesNames
|
||||
* @param parent_element
|
||||
* @return a list of names for every child directories of @parent_element
|
||||
*/
|
||||
@brief XmlElementCollection::directoriesNames
|
||||
@param parent_element
|
||||
@return a list of names for every child directories of @parent_element
|
||||
*/
|
||||
QStringList XmlElementCollection::directoriesNames(const QDomElement &parent_element) const
|
||||
{
|
||||
QList <QDomElement> childs = directories(parent_element);
|
||||
@@ -214,10 +214,10 @@ QStringList XmlElementCollection::directoriesNames(const QDomElement &parent_ele
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XmlElementCollection::elements
|
||||
* @param parent_element
|
||||
* @return A list of element stored in @parent_element
|
||||
*/
|
||||
@brief XmlElementCollection::elements
|
||||
@param parent_element
|
||||
@return A list of element stored in @parent_element
|
||||
*/
|
||||
QList<QDomElement> XmlElementCollection::elements(const QDomElement &parent_element) const
|
||||
{
|
||||
QList <QDomElement> element_list;
|
||||
@@ -235,10 +235,10 @@ QList<QDomElement> XmlElementCollection::elements(const QDomElement &parent_elem
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XmlElementCollection::elementsNames
|
||||
* @param parent_element
|
||||
* @return A list of names fr every childs element of @parent_element
|
||||
*/
|
||||
@brief XmlElementCollection::elementsNames
|
||||
@param parent_element
|
||||
@return A list of names fr every childs element of @parent_element
|
||||
*/
|
||||
QStringList XmlElementCollection::elementsNames(const QDomElement &parent_element) const
|
||||
{
|
||||
QList <QDomElement> childs = elements(parent_element);
|
||||
@@ -255,11 +255,11 @@ QStringList XmlElementCollection::elementsNames(const QDomElement &parent_elemen
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XmlElementCollection::element
|
||||
* @param path : path of the element in this collection
|
||||
* @return the QDomElement that represent the element at path @path
|
||||
* or a null QDomElement if not found or doesn't represent an element
|
||||
*/
|
||||
@brief XmlElementCollection::element
|
||||
@param path : path of the element in this collection
|
||||
@return the QDomElement that represent the element at path @path
|
||||
or a null QDomElement if not found or doesn't represent an element
|
||||
*/
|
||||
QDomElement XmlElementCollection::element(const QString &path) const
|
||||
{
|
||||
if (!path.endsWith(".elmt")) return QDomElement();
|
||||
@@ -273,11 +273,11 @@ QDomElement XmlElementCollection::element(const QString &path) const
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XmlElementCollection::directory
|
||||
* @param path : path of the directory in this collection
|
||||
* @return the QDomElement that represent the directory at path @path
|
||||
* or a null QDomElement if not found.
|
||||
*/
|
||||
@brief XmlElementCollection::directory
|
||||
@param path : path of the directory in this collection
|
||||
@return the QDomElement that represent the directory at path @path
|
||||
or a null QDomElement if not found.
|
||||
*/
|
||||
QDomElement XmlElementCollection::directory(const QString &path) const
|
||||
{
|
||||
QDomElement directory = child(path);
|
||||
@@ -289,15 +289,15 @@ QDomElement XmlElementCollection::directory(const QString &path) const
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XmlElementCollection::addElement
|
||||
* Add the element at location to this collection.
|
||||
* The element is copied in this collection in "import" dir with the same path, in other word
|
||||
* if the path is dir1/dir2/dir3/myElement.elmt, myElement is copied to this collection at the path : import/dir1/dir2/dir3/myElement.elmt
|
||||
* If the path doesn't exist, he was created.
|
||||
* If the element already exist, do nothing.
|
||||
* @param location, location of the element
|
||||
* @return the collection path of the added item or a null QString if element can't be added.
|
||||
*/
|
||||
@brief XmlElementCollection::addElement
|
||||
Add the element at location to this collection.
|
||||
The element is copied in this collection in "import" dir with the same path, in other word
|
||||
if the path is dir1/dir2/dir3/myElement.elmt, myElement is copied to this collection at the path : import/dir1/dir2/dir3/myElement.elmt
|
||||
If the path doesn't exist, he was created.
|
||||
If the element already exist, do nothing.
|
||||
@param location, location of the element
|
||||
@return the collection path of the added item or a null QString if element can't be added.
|
||||
*/
|
||||
QString XmlElementCollection::addElement(ElementsLocation &location)
|
||||
{
|
||||
//location must be an element and exist
|
||||
@@ -423,15 +423,15 @@ QString XmlElementCollection::addElement(ElementsLocation &location)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XmlElementCollection::addElementDefinition
|
||||
* Add the élément defintion @xml_definition in the directory at path @dir_path with the name @elmt_name.
|
||||
* @param dir_path : the path of the directory where we must add the element.
|
||||
* The path must be an existing directory of this collection.
|
||||
* @param elmt_name : The name used to store the element (the name must end with .elmt, if not, .elmt will be append to @elmt_name)
|
||||
* @param xml_definition : The xml definition of the element.
|
||||
* The tag name of @xml_definition must be "definition".
|
||||
* @return True if the element is added with success.
|
||||
*/
|
||||
@brief XmlElementCollection::addElementDefinition
|
||||
Add the élément defintion @xml_definition in the directory at path @dir_path with the name @elmt_name.
|
||||
@param dir_path : the path of the directory where we must add the element.
|
||||
The path must be an existing directory of this collection.
|
||||
@param elmt_name : The name used to store the element (the name must end with .elmt, if not, .elmt will be append to @elmt_name)
|
||||
@param xml_definition : The xml definition of the element.
|
||||
The tag name of @xml_definition must be "definition".
|
||||
@return True if the element is added with success.
|
||||
*/
|
||||
bool XmlElementCollection::addElementDefinition(const QString &dir_path, const QString &elmt_name, const QDomElement &xml_definition)
|
||||
{
|
||||
QDomElement dom_dir = directory(dir_path);
|
||||
@@ -461,12 +461,12 @@ bool XmlElementCollection::addElementDefinition(const QString &dir_path, const Q
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XmlElementCollection::removeElement
|
||||
* Remove the element at path @path.
|
||||
* @param path
|
||||
* @return True if element is removed and emit the signal elementRemoved.
|
||||
* else false.
|
||||
*/
|
||||
@brief XmlElementCollection::removeElement
|
||||
Remove the element at path @path.
|
||||
@param path
|
||||
@return True if element is removed and emit the signal elementRemoved.
|
||||
else false.
|
||||
*/
|
||||
bool XmlElementCollection::removeElement(const QString& path)
|
||||
{
|
||||
QDomElement elmt = element(path);
|
||||
@@ -481,16 +481,16 @@ bool XmlElementCollection::removeElement(const QString& path)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XmlElementCollection::copy
|
||||
* Copy the content represented by source (an element or a directory) to destination.
|
||||
* Destination must be a directory of this collection.
|
||||
* If the destination already have an item at the same path of source, he will be replaced by source.
|
||||
* @param source : content to copy
|
||||
* @param destination : destination of the copy, must be a directory of this collection
|
||||
* @param rename : rename the copy with @rename else use the name of source
|
||||
* @param deep_copy : if true copy all childs of source (only if source is directory)
|
||||
* @return the ElementLocation that represent the copy, if copy failed return a null ElementLocation
|
||||
*/
|
||||
@brief XmlElementCollection::copy
|
||||
Copy the content represented by source (an element or a directory) to destination.
|
||||
Destination must be a directory of this collection.
|
||||
If the destination already have an item at the same path of source, he will be replaced by source.
|
||||
@param source : content to copy
|
||||
@param destination : destination of the copy, must be a directory of this collection
|
||||
@param rename : rename the copy with @rename else use the name of source
|
||||
@param deep_copy : if true copy all childs of source (only if source is directory)
|
||||
@return the ElementLocation that represent the copy, if copy failed return a null ElementLocation
|
||||
*/
|
||||
ElementsLocation XmlElementCollection::copy(ElementsLocation &source, ElementsLocation &destination, const QString& rename, bool deep_copy)
|
||||
{
|
||||
if (!(source.exist() && destination.isDirectory() && destination.isProject() && destination.projectCollection() == this))
|
||||
@@ -503,11 +503,11 @@ ElementsLocation XmlElementCollection::copy(ElementsLocation &source, ElementsLo
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XmlElementCollection::exist
|
||||
* Return true if the path @path exist in this collection
|
||||
* @param path
|
||||
* @return
|
||||
*/
|
||||
@brief XmlElementCollection::exist
|
||||
Return true if the path @path exist in this collection
|
||||
@param path
|
||||
@return
|
||||
*/
|
||||
bool XmlElementCollection::exist(const QString &path) const
|
||||
{
|
||||
if (child(path).isNull())
|
||||
@@ -517,14 +517,14 @@ bool XmlElementCollection::exist(const QString &path) const
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XmlElementCollection::createDir
|
||||
* Create a child directorie at path @path with the name @name.
|
||||
* Emit directorieAdded if success.
|
||||
* @param path : path of parent diectorie
|
||||
* @param name : name of the directori to create.
|
||||
* @param name_list : translation of the directorie name.
|
||||
* @return true if creation success, if directorie already exist return true.
|
||||
*/
|
||||
@brief XmlElementCollection::createDir
|
||||
Create a child directorie at path @path with the name @name.
|
||||
Emit directorieAdded if success.
|
||||
@param path : path of parent diectorie
|
||||
@param name : name of the directori to create.
|
||||
@param name_list : translation of the directorie name.
|
||||
@return true if creation success, if directorie already exist return true.
|
||||
*/
|
||||
bool XmlElementCollection::createDir(const QString& path, const QString& name, const NamesList &name_list)
|
||||
{
|
||||
QString new_dir_path = path + "/" + name;
|
||||
@@ -551,12 +551,12 @@ bool XmlElementCollection::createDir(const QString& path, const QString& name, c
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XmlElementCollection::removeDir
|
||||
* Remove the directory at path @path.
|
||||
* @param path
|
||||
* @return true if successfuly removed and emit directoryRemoved(QString),
|
||||
* else false.
|
||||
*/
|
||||
@brief XmlElementCollection::removeDir
|
||||
Remove the directory at path @path.
|
||||
@param path
|
||||
@return true if successfuly removed and emit directoryRemoved(QString),
|
||||
else false.
|
||||
*/
|
||||
bool XmlElementCollection::removeDir(const QString& path)
|
||||
{
|
||||
QDomElement dir = directory(path);
|
||||
@@ -569,14 +569,14 @@ bool XmlElementCollection::removeDir(const QString& path)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XmlElementCollection::elementsLocation
|
||||
* Return all locations stored in dom_element (element and directory).
|
||||
* If dom_element is null, return all location owned by this collection
|
||||
* dom_element must be a child of this collection.
|
||||
* @param dom_element : dom_element where we must to search location.
|
||||
* @param childs = if true return all childs location of dom_element, if false, only return the direct childs location of dom_element.
|
||||
* @return
|
||||
*/
|
||||
@brief XmlElementCollection::elementsLocation
|
||||
Return all locations stored in dom_element (element and directory).
|
||||
If dom_element is null, return all location owned by this collection
|
||||
dom_element must be a child of this collection.
|
||||
@param dom_element : dom_element where we must to search location.
|
||||
@param childs = if true return all childs location of dom_element, if false, only return the direct childs location of dom_element.
|
||||
@return
|
||||
*/
|
||||
QList<ElementsLocation> XmlElementCollection::elementsLocation(QDomElement dom_element, bool childs) const
|
||||
{
|
||||
QList <ElementsLocation> location_list;
|
||||
@@ -612,13 +612,13 @@ QList<ElementsLocation> XmlElementCollection::elementsLocation(QDomElement dom_e
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XmlElementCollection::domToLocation
|
||||
* Return the element location who represent the xml element : dom_element
|
||||
* dom_element must be owned by this collection
|
||||
* @param dom_element : the dom_element of this collection that represent an element.
|
||||
* The tag name of dom_element must be "element"
|
||||
* @return the element location, location can be null if fail.
|
||||
*/
|
||||
@brief XmlElementCollection::domToLocation
|
||||
Return the element location who represent the xml element : dom_element
|
||||
dom_element must be owned by this collection
|
||||
@param dom_element : the dom_element of this collection that represent an element.
|
||||
The tag name of dom_element must be "element"
|
||||
@return the element location, location can be null if fail.
|
||||
*/
|
||||
ElementsLocation XmlElementCollection::domToLocation(QDomElement dom_element) const
|
||||
{
|
||||
if (dom_element.ownerDocument() == m_dom_document) {
|
||||
@@ -638,9 +638,9 @@ ElementsLocation XmlElementCollection::domToLocation(QDomElement dom_element) co
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XmlElementCollection::cleanUnusedElement
|
||||
* Remove elements in this collection which is not used in the owner project
|
||||
*/
|
||||
@brief XmlElementCollection::cleanUnusedElement
|
||||
Remove elements in this collection which is not used in the owner project
|
||||
*/
|
||||
void XmlElementCollection::cleanUnusedElement()
|
||||
{
|
||||
foreach (ElementsLocation loc, m_project->unusedElements())
|
||||
@@ -648,9 +648,9 @@ void XmlElementCollection::cleanUnusedElement()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XmlElementCollection::cleanUnusedDirectory
|
||||
* Remove the empty directories of this collection
|
||||
*/
|
||||
@brief XmlElementCollection::cleanUnusedDirectory
|
||||
Remove the empty directories of this collection
|
||||
*/
|
||||
void XmlElementCollection::cleanUnusedDirectory()
|
||||
{
|
||||
QDomNodeList lst = importCategory().elementsByTagName("category");
|
||||
@@ -666,15 +666,15 @@ void XmlElementCollection::cleanUnusedDirectory()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XmlElementCollection::copyDirectory
|
||||
* Copy the directory represented by source to destination.
|
||||
* if destination have a directory with the same name as source, then this directory is removed
|
||||
* @param source : directory to copy
|
||||
* @param destination : destination of the copy
|
||||
* @param rename : rename the copy with @rename else use the name of source
|
||||
* @param deep_copy :if true copy all childs of source
|
||||
* @return the ElementLocation that represent the copy, if copy failed return a null ElementLocation
|
||||
*/
|
||||
@brief XmlElementCollection::copyDirectory
|
||||
Copy the directory represented by source to destination.
|
||||
if destination have a directory with the same name as source, then this directory is removed
|
||||
@param source : directory to copy
|
||||
@param destination : destination of the copy
|
||||
@param rename : rename the copy with @rename else use the name of source
|
||||
@param deep_copy :if true copy all childs of source
|
||||
@return the ElementLocation that represent the copy, if copy failed return a null ElementLocation
|
||||
*/
|
||||
ElementsLocation XmlElementCollection::copyDirectory(ElementsLocation &source, ElementsLocation &destination, const QString& rename, bool deep_copy)
|
||||
{
|
||||
QString new_dir_name = rename.isEmpty() ? source.fileName() : rename;
|
||||
@@ -754,14 +754,14 @@ ElementsLocation XmlElementCollection::copyDirectory(ElementsLocation &source, E
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XmlElementCollection::copyElement
|
||||
* Copy the element represented by source to destination (must be a directory)
|
||||
* If element already exist in destination he will be replaced by the new.
|
||||
* @param source : element to copy
|
||||
* @param destination : destination of the copy
|
||||
* @param rename : rename the copy with @rename else use the name of source
|
||||
* @return The ElementsLocation of the copy
|
||||
*/
|
||||
@brief XmlElementCollection::copyElement
|
||||
Copy the element represented by source to destination (must be a directory)
|
||||
If element already exist in destination he will be replaced by the new.
|
||||
@param source : element to copy
|
||||
@param destination : destination of the copy
|
||||
@param rename : rename the copy with @rename else use the name of source
|
||||
@return The ElementsLocation of the copy
|
||||
*/
|
||||
ElementsLocation XmlElementCollection::copyElement(ElementsLocation &source, ElementsLocation &destination, const QString& rename)
|
||||
{
|
||||
QString new_elmt_name = rename.isEmpty() ? source.fileName() : rename;
|
||||
|
||||
@@ -27,9 +27,9 @@ class QFile;
|
||||
class QETProject;
|
||||
|
||||
/**
|
||||
* @brief The XmlElementCollection class
|
||||
* This class represent a collection of elements stored to xml
|
||||
*/
|
||||
@brief The XmlElementCollection class
|
||||
This class represent a collection of elements stored to xml
|
||||
*/
|
||||
class XmlElementCollection : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -68,34 +68,34 @@ class XmlElementCollection : public QObject
|
||||
|
||||
signals:
|
||||
/**
|
||||
* @brief elementAdded
|
||||
* This signal is emited when a element is added to this collection
|
||||
* @param collection_path, the path of element in this collection
|
||||
*/
|
||||
@brief elementAdded
|
||||
This signal is emited when a element is added to this collection
|
||||
@param collection_path, the path of element in this collection
|
||||
*/
|
||||
void elementAdded(QString collection_path);
|
||||
/**
|
||||
* @brief elementChanged
|
||||
* This signal is emited when the defintion of the element at path was changed
|
||||
* @param collection_path, the path of this element in this collection
|
||||
*/
|
||||
@brief elementChanged
|
||||
This signal is emited when the defintion of the element at path was changed
|
||||
@param collection_path, the path of this element in this collection
|
||||
*/
|
||||
void elementChanged (QString collection_path);
|
||||
/**
|
||||
* @brief elementRemoved
|
||||
* This signal is emited when an element is removed to this collection
|
||||
* @param collection_path, the path of the removed element in this collection
|
||||
*/
|
||||
@brief elementRemoved
|
||||
This signal is emited when an element is removed to this collection
|
||||
@param collection_path, the path of the removed element in this collection
|
||||
*/
|
||||
void elementRemoved(QString collection_path);
|
||||
/**
|
||||
* @brief directorieAdded
|
||||
* This signal is emited when a directorie is added to this collection
|
||||
* @param collection_path, the path of the new directorie
|
||||
*/
|
||||
@brief directorieAdded
|
||||
This signal is emited when a directorie is added to this collection
|
||||
@param collection_path, the path of the new directorie
|
||||
*/
|
||||
void directorieAdded(QString collection_path);
|
||||
/**
|
||||
* @brief directoryRemoved
|
||||
* This signal is emited when a directory is removed to this collection
|
||||
* @param collection_path, the path of the removed directory
|
||||
*/
|
||||
@brief directoryRemoved
|
||||
This signal is emited when a directory is removed to this collection
|
||||
@param collection_path, the path of the removed directory
|
||||
*/
|
||||
void directoryRemoved(QString collection_path);
|
||||
|
||||
private:
|
||||
|
||||
@@ -21,16 +21,16 @@
|
||||
#include "xmlprojectelementcollectionitem.h"
|
||||
|
||||
/**
|
||||
* @brief XmlProjectElementCollectionItem::XmlProjectElementCollectionItem
|
||||
* Constructor
|
||||
*/
|
||||
@brief XmlProjectElementCollectionItem::XmlProjectElementCollectionItem
|
||||
Constructor
|
||||
*/
|
||||
XmlProjectElementCollectionItem::XmlProjectElementCollectionItem()
|
||||
{}
|
||||
|
||||
/**
|
||||
* @brief XmlProjectElementCollectionItem::isDir
|
||||
* @return true if this item represent a directory
|
||||
*/
|
||||
@brief XmlProjectElementCollectionItem::isDir
|
||||
@return true if this item represent a directory
|
||||
*/
|
||||
bool XmlProjectElementCollectionItem::isDir() const
|
||||
{
|
||||
if (m_dom_element.tagName() == "category") return true;
|
||||
@@ -38,9 +38,9 @@ bool XmlProjectElementCollectionItem::isDir() const
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XmlProjectElementCollectionItem::isElement
|
||||
* @return true if this item represent an element
|
||||
*/
|
||||
@brief XmlProjectElementCollectionItem::isElement
|
||||
@return true if this item represent an element
|
||||
*/
|
||||
bool XmlProjectElementCollectionItem::isElement() const
|
||||
{
|
||||
if (m_dom_element.tagName() == "element") return true;
|
||||
@@ -48,9 +48,9 @@ bool XmlProjectElementCollectionItem::isElement() const
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XmlProjectElementCollectionItem::localName
|
||||
* @return the located name of this item
|
||||
*/
|
||||
@brief XmlProjectElementCollectionItem::localName
|
||||
@return the located name of this item
|
||||
*/
|
||||
QString XmlProjectElementCollectionItem::localName()
|
||||
{
|
||||
if (!text().isNull())
|
||||
@@ -71,18 +71,18 @@ QString XmlProjectElementCollectionItem::localName()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XmlProjectElementCollectionItem::name
|
||||
* @return The collection name of this item
|
||||
*/
|
||||
@brief XmlProjectElementCollectionItem::name
|
||||
@return The collection name of this item
|
||||
*/
|
||||
QString XmlProjectElementCollectionItem::name() const
|
||||
{
|
||||
return m_dom_element.attribute("name");
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XmlProjectElementCollectionItem::collectionPath
|
||||
* @return The path of this item relative to the collection.
|
||||
*/
|
||||
@brief XmlProjectElementCollectionItem::collectionPath
|
||||
@return The path of this item relative to the collection.
|
||||
*/
|
||||
QString XmlProjectElementCollectionItem::collectionPath() const
|
||||
{
|
||||
ElementsLocation loc (embeddedPath(), m_project);
|
||||
@@ -93,10 +93,10 @@ QString XmlProjectElementCollectionItem::collectionPath() const
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XmlProjectElementCollectionItem::embeddedPath
|
||||
* @return The embedde path of this item
|
||||
* The path is in form : embed://dir/subdir/myElement.elmt
|
||||
*/
|
||||
@brief XmlProjectElementCollectionItem::embeddedPath
|
||||
@return The embedde path of this item
|
||||
The path is in form : embed://dir/subdir/myElement.elmt
|
||||
*/
|
||||
QString XmlProjectElementCollectionItem::embeddedPath() const
|
||||
{
|
||||
if (isCollectionRoot())
|
||||
@@ -114,9 +114,9 @@ QString XmlProjectElementCollectionItem::embeddedPath() const
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XmlProjectElementCollectionItem::isCollectionRoot
|
||||
* @return true if this item represent the root of collection
|
||||
*/
|
||||
@brief XmlProjectElementCollectionItem::isCollectionRoot
|
||||
@return true if this item represent the root of collection
|
||||
*/
|
||||
bool XmlProjectElementCollectionItem::isCollectionRoot() const
|
||||
{
|
||||
if (!parent())
|
||||
@@ -128,11 +128,11 @@ bool XmlProjectElementCollectionItem::isCollectionRoot() const
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XmlProjectElementCollectionItem::addChildAtPath
|
||||
* Ask to this item item to add a new child with collection name @collection_name
|
||||
* (the child must exist in the xml element collection)
|
||||
* @param collection_name : name of the child item to add.
|
||||
*/
|
||||
@brief XmlProjectElementCollectionItem::addChildAtPath
|
||||
Ask to this item item to add a new child with collection name @collection_name
|
||||
(the child must exist in the xml element collection)
|
||||
@param collection_name : name of the child item to add.
|
||||
*/
|
||||
void XmlProjectElementCollectionItem::addChildAtPath(const QString &collection_name)
|
||||
{
|
||||
if (collection_name.isEmpty())
|
||||
@@ -155,21 +155,21 @@ void XmlProjectElementCollectionItem::addChildAtPath(const QString &collection_n
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XmlProjectElementCollectionItem::project
|
||||
* @return the paretn project of the managed collection
|
||||
*/
|
||||
@brief XmlProjectElementCollectionItem::project
|
||||
@return the paretn project of the managed collection
|
||||
*/
|
||||
QETProject *XmlProjectElementCollectionItem::project() const
|
||||
{
|
||||
return m_project;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XmlProjectElementCollectionItem::setProject
|
||||
* Set the project for this item.
|
||||
* Use this method for set this item the root of the collection
|
||||
* @param project : project to manage the collection
|
||||
* @param set_data : if true, call setUpData for every child of this item
|
||||
*/
|
||||
@brief XmlProjectElementCollectionItem::setProject
|
||||
Set the project for this item.
|
||||
Use this method for set this item the root of the collection
|
||||
@param project : project to manage the collection
|
||||
@param set_data : if true, call setUpData for every child of this item
|
||||
*/
|
||||
void XmlProjectElementCollectionItem::setProject(QETProject *project, bool set_data, bool hide_element)
|
||||
{
|
||||
if (m_project)
|
||||
@@ -181,9 +181,9 @@ void XmlProjectElementCollectionItem::setProject(QETProject *project, bool set_d
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XmlProjectElementCollectionItem::setUpData
|
||||
* SetUp the data of this item
|
||||
*/
|
||||
@brief XmlProjectElementCollectionItem::setUpData
|
||||
SetUp the data of this item
|
||||
*/
|
||||
void XmlProjectElementCollectionItem::setUpData()
|
||||
{
|
||||
//Setup the displayed name
|
||||
@@ -212,10 +212,10 @@ void XmlProjectElementCollectionItem::setUpData()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XmlProjectElementCollectionItem::setUpIcon
|
||||
* SetUp the icon of this item.
|
||||
* Because icon use several memory, we use this method for setup icon instead setUpData.
|
||||
*/
|
||||
@brief XmlProjectElementCollectionItem::setUpIcon
|
||||
SetUp the icon of this item.
|
||||
Because icon use several memory, we use this method for setup icon instead setUpData.
|
||||
*/
|
||||
void XmlProjectElementCollectionItem::setUpIcon()
|
||||
{
|
||||
if (!icon().isNull())
|
||||
@@ -232,10 +232,10 @@ void XmlProjectElementCollectionItem::setUpIcon()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XmlProjectElementCollectionItem::populate
|
||||
* Create the childs of this item
|
||||
* @param set_data : if true, call setUpData for every child of this item
|
||||
*/
|
||||
@brief XmlProjectElementCollectionItem::populate
|
||||
Create the childs of this item
|
||||
@param set_data : if true, call setUpData for every child of this item
|
||||
*/
|
||||
void XmlProjectElementCollectionItem::populate(bool set_data, bool hide_element)
|
||||
{
|
||||
QList <QDomElement> dom_category = m_project->embeddedElementCollection()->directories(m_dom_element);
|
||||
@@ -267,12 +267,12 @@ void XmlProjectElementCollectionItem::populate(bool set_data, bool hide_element)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XmlProjectElementCollectionItem::setXmlElement
|
||||
* Set the managed content of this item
|
||||
* @param element : the dom element (directory or element), to be managed by this item
|
||||
* @param project : the parent project of managed collection
|
||||
* @param set_data : if true, call setUpData for every child of this item
|
||||
*/
|
||||
@brief XmlProjectElementCollectionItem::setXmlElement
|
||||
Set the managed content of this item
|
||||
@param element : the dom element (directory or element), to be managed by this item
|
||||
@param project : the parent project of managed collection
|
||||
@param set_data : if true, call setUpData for every child of this item
|
||||
*/
|
||||
void XmlProjectElementCollectionItem::setXmlElement(const QDomElement& element, QETProject *project, bool set_data, bool hide_element)
|
||||
{
|
||||
m_dom_element = element;
|
||||
|
||||
@@ -24,9 +24,9 @@
|
||||
class QETProject;
|
||||
|
||||
/**
|
||||
* @brief The XmlProjectElementCollectionItem class
|
||||
* This class specialise ElementCollectionItem for manage an xml collection embedded in a project.
|
||||
*/
|
||||
@brief The XmlProjectElementCollectionItem class
|
||||
This class specialise ElementCollectionItem for manage an xml collection embedded in a project.
|
||||
*/
|
||||
class XmlProjectElementCollectionItem : public ElementCollectionItem
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -126,15 +126,15 @@ void NamesList::fromXml(const QDomElement &xml_element, const QHash<QString, QSt
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NamesList::fromXml
|
||||
* Load the list of lang <-> name from an xml description.
|
||||
* @xml_element must be the parent of a child element tagged "names"
|
||||
* If a couple lang <-> name already exist, they will overwrited, else
|
||||
* they will be appened.
|
||||
* @param xml_element : xml element to analyze
|
||||
* @param xml_options : A set of options related to XML parsing.
|
||||
* @see getXmlOptions()
|
||||
*/
|
||||
@brief NamesList::fromXml
|
||||
Load the list of lang <-> name from an xml description.
|
||||
@xml_element must be the parent of a child element tagged "names"
|
||||
If a couple lang <-> name already exist, they will overwrited, else
|
||||
they will be appened.
|
||||
@param xml_element : xml element to analyze
|
||||
@param xml_options : A set of options related to XML parsing.
|
||||
@see getXmlOptions()
|
||||
*/
|
||||
void NamesList::fromXml(const pugi::xml_node &xml_element, const QHash<QString, QString> &xml_options)
|
||||
{
|
||||
QHash<QString, QString> xml_opt = getXmlOptions(xml_options);
|
||||
|
||||
@@ -44,10 +44,10 @@ void NameListDialog::setInformationText(const QString &text) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NameListDialog::namelistWidget
|
||||
* @return the name list widget used by this dialog.
|
||||
* The ownership of the namelistwidget stay to this dialog
|
||||
*/
|
||||
@brief NameListDialog::namelistWidget
|
||||
@return the name list widget used by this dialog.
|
||||
The ownership of the namelistwidget stay to this dialog
|
||||
*/
|
||||
NameListWidget *NameListDialog::namelistWidget() const {
|
||||
return m_namelist_widget;
|
||||
}
|
||||
|
||||
@@ -27,9 +27,9 @@ namespace Ui {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief The NameListDialog class
|
||||
* Provide a dialog for let user define localized string;
|
||||
*/
|
||||
@brief The NameListDialog class
|
||||
Provide a dialog for let user define localized string;
|
||||
*/
|
||||
class NameListDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -36,9 +36,9 @@ NameListWidget::~NameListWidget()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NameListWidget::addLine
|
||||
* Add a new line to the name list widget
|
||||
*/
|
||||
@brief NameListWidget::addLine
|
||||
Add a new line to the name list widget
|
||||
*/
|
||||
void NameListWidget::addLine()
|
||||
{
|
||||
clean();
|
||||
@@ -53,10 +53,10 @@ void NameListWidget::addLine()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NameListWidget::setNames
|
||||
* Set the current names of this dialog from @name_list
|
||||
* @param name_list
|
||||
*/
|
||||
@brief NameListWidget::setNames
|
||||
Set the current names of this dialog from @name_list
|
||||
@param name_list
|
||||
*/
|
||||
void NameListWidget::setNames(const NamesList &name_list)
|
||||
{
|
||||
for (QString lang : name_list.langs())
|
||||
@@ -74,9 +74,9 @@ void NameListWidget::setNames(const NamesList &name_list)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NameListWidget::names
|
||||
* @return the current name list edited by this dialog
|
||||
*/
|
||||
@brief NameListWidget::names
|
||||
@return the current name list edited by this dialog
|
||||
*/
|
||||
NamesList NameListWidget::names() const
|
||||
{
|
||||
NamesList nl_;
|
||||
@@ -95,10 +95,10 @@ NamesList NameListWidget::names() const
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NameListWidget::setReadOnly
|
||||
* Set this dialog to read only or not.
|
||||
* @param ro
|
||||
*/
|
||||
@brief NameListWidget::setReadOnly
|
||||
Set this dialog to read only or not.
|
||||
@param ro
|
||||
*/
|
||||
void NameListWidget::setReadOnly(bool ro)
|
||||
{
|
||||
m_read_only = ro;
|
||||
@@ -116,10 +116,10 @@ void NameListWidget::setReadOnly(bool ro)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NameListWidget::isEmpty
|
||||
* @return true if empty.
|
||||
* An empty dialog, is a dialog without any edited lang.
|
||||
*/
|
||||
@brief NameListWidget::isEmpty
|
||||
@return true if empty.
|
||||
An empty dialog, is a dialog without any edited lang.
|
||||
*/
|
||||
bool NameListWidget::isEmpty() const {
|
||||
return names().isEmpty();
|
||||
}
|
||||
@@ -142,9 +142,9 @@ void NameListWidget::setClipboardValue(QHash<QString, QString> value)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NameListWidget::clean
|
||||
* Clean the lists of names by removing the emtpy lines
|
||||
*/
|
||||
@brief NameListWidget::clean
|
||||
Clean the lists of names by removing the emtpy lines
|
||||
*/
|
||||
void NameListWidget::clean()
|
||||
{
|
||||
int names_count = ui->m_tree->topLevelItemCount() - 1;
|
||||
|
||||
@@ -26,9 +26,9 @@ namespace Ui {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief The NameListWidget class
|
||||
* Provide a widget for let user define localized string;
|
||||
*/
|
||||
@brief The NameListWidget class
|
||||
Provide a widget for let user define localized string;
|
||||
*/
|
||||
class NameListWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -24,16 +24,16 @@
|
||||
#include <QAbstractButton>
|
||||
|
||||
/**
|
||||
* @brief The PropertiesEditorDialog class
|
||||
* Create a dialog to edit some properties of a thing.
|
||||
* Only create a instance of this class and call exec, all is done for you in this class.
|
||||
* The first argument (a template) must be a subclass of QWidget and provide the 3 methods bellow :
|
||||
* QString::title()
|
||||
* void::apply()
|
||||
* void::reset()
|
||||
* You can subclass the interface PropertiesEditorWidget who provide all this methods.
|
||||
* This dialog take ownership of the editor, so the editor will be deleted by this dialog
|
||||
*/
|
||||
@brief The PropertiesEditorDialog class
|
||||
Create a dialog to edit some properties of a thing.
|
||||
Only create a instance of this class and call exec, all is done for you in this class.
|
||||
The first argument (a template) must be a subclass of QWidget and provide the 3 methods bellow :
|
||||
QString::title()
|
||||
void::apply()
|
||||
void::reset()
|
||||
You can subclass the interface PropertiesEditorWidget who provide all this methods.
|
||||
This dialog take ownership of the editor, so the editor will be deleted by this dialog
|
||||
*/
|
||||
class PropertiesEditorDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -20,10 +20,10 @@
|
||||
#include "propertieseditorwidget.h"
|
||||
|
||||
/**
|
||||
* @brief PropertiesEditorDockWidget::PropertiesEditorDockWidget
|
||||
* Constructor
|
||||
* @param parent : parent widget
|
||||
*/
|
||||
@brief PropertiesEditorDockWidget::PropertiesEditorDockWidget
|
||||
Constructor
|
||||
@param parent : parent widget
|
||||
*/
|
||||
PropertiesEditorDockWidget::PropertiesEditorDockWidget(QWidget *parent) :
|
||||
QDockWidget(parent),
|
||||
ui(new Ui::PropertiesEditorDockWidget)
|
||||
@@ -32,9 +32,9 @@ PropertiesEditorDockWidget::PropertiesEditorDockWidget(QWidget *parent) :
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief PropertiesEditorDockWidget::~PropertiesEditorDockWidget
|
||||
* Destructor
|
||||
*/
|
||||
@brief PropertiesEditorDockWidget::~PropertiesEditorDockWidget
|
||||
Destructor
|
||||
*/
|
||||
PropertiesEditorDockWidget::~PropertiesEditorDockWidget()
|
||||
{
|
||||
clear();
|
||||
@@ -42,26 +42,26 @@ PropertiesEditorDockWidget::~PropertiesEditorDockWidget()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief PropertiesEditorDockWidget::clear
|
||||
* Remove all editor present in this dock and delete it.
|
||||
* They also disabled the button box at the bottom of this dock
|
||||
*/
|
||||
@brief PropertiesEditorDockWidget::clear
|
||||
Remove all editor present in this dock and delete it.
|
||||
They also disabled the button box at the bottom of this dock
|
||||
*/
|
||||
void PropertiesEditorDockWidget::clear()
|
||||
{
|
||||
foreach (PropertiesEditorWidget *editor, m_editor_list)
|
||||
{
|
||||
m_editor_list.removeOne(editor);
|
||||
ui->m_main_vlayout->removeWidget(editor);
|
||||
delete editor;
|
||||
delete editor;
|
||||
}
|
||||
|
||||
m_editor_list.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief PropertiesEditorDockWidget::apply
|
||||
* Call the apply method for each editor present in this dock
|
||||
*/
|
||||
@brief PropertiesEditorDockWidget::apply
|
||||
Call the apply method for each editor present in this dock
|
||||
*/
|
||||
void PropertiesEditorDockWidget::apply()
|
||||
{
|
||||
foreach(PropertiesEditorWidget *editor, m_editor_list)
|
||||
@@ -69,9 +69,9 @@ void PropertiesEditorDockWidget::apply()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief PropertiesEditorDockWidget::reset
|
||||
* Call the reset method for each editor present in this widget
|
||||
*/
|
||||
@brief PropertiesEditorDockWidget::reset
|
||||
Call the reset method for each editor present in this widget
|
||||
*/
|
||||
void PropertiesEditorDockWidget::reset()
|
||||
{
|
||||
foreach(PropertiesEditorWidget *editor, m_editor_list)
|
||||
@@ -79,14 +79,14 @@ void PropertiesEditorDockWidget::reset()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief PropertiesEditorDockWidget::addEditor
|
||||
* Add an @editor in this dock at @index in the main vertical layout (note the button box
|
||||
* are displayed at bottom of this layout by default)
|
||||
* When an editor is added, we enable the button box
|
||||
* @param editor : editor to add;
|
||||
* @param index : index of editor in the layout
|
||||
* @return true if was added (or already add) or false if can't be add (editor = nullptr)
|
||||
*/
|
||||
@brief PropertiesEditorDockWidget::addEditor
|
||||
Add an @editor in this dock at @index in the main vertical layout (note the button box
|
||||
are displayed at bottom of this layout by default)
|
||||
When an editor is added, we enable the button box
|
||||
@param editor : editor to add;
|
||||
@param index : index of editor in the layout
|
||||
@return true if was added (or already add) or false if can't be add (editor = nullptr)
|
||||
*/
|
||||
bool PropertiesEditorDockWidget::addEditor(PropertiesEditorWidget *editor, int index)
|
||||
{
|
||||
if (!editor) return false;
|
||||
@@ -98,20 +98,20 @@ bool PropertiesEditorDockWidget::addEditor(PropertiesEditorWidget *editor, int i
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief PropertiesEditorDockWidget::editors
|
||||
* @return all editor used in this dock
|
||||
*/
|
||||
@brief PropertiesEditorDockWidget::editors
|
||||
@return all editor used in this dock
|
||||
*/
|
||||
QList<PropertiesEditorWidget *> PropertiesEditorDockWidget::editors() const {
|
||||
return m_editor_list;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief PropertiesEditorDockWidget::removeEditor
|
||||
* Remove @editor from this dock. The editor wasn't delete a the end of this method
|
||||
* If the editor was the last on this widget, we disabled the button box
|
||||
* @param editor : editor to remove
|
||||
* @return true on success, else false
|
||||
*/
|
||||
@brief PropertiesEditorDockWidget::removeEditor
|
||||
Remove @editor from this dock. The editor wasn't delete a the end of this method
|
||||
If the editor was the last on this widget, we disabled the button box
|
||||
@param editor : editor to remove
|
||||
@return true on success, else false
|
||||
*/
|
||||
bool PropertiesEditorDockWidget::removeEditor(PropertiesEditorWidget *editor)
|
||||
{
|
||||
bool result = m_editor_list.removeOne(editor);
|
||||
|
||||
@@ -19,52 +19,52 @@
|
||||
#include <QUndoCommand>
|
||||
|
||||
/**
|
||||
* @brief PropertiesEditorWidget::PropertiesEditorWidget
|
||||
* Constructor
|
||||
* @param parent : parent widget
|
||||
*/
|
||||
@brief PropertiesEditorWidget::PropertiesEditorWidget
|
||||
Constructor
|
||||
@param parent : parent widget
|
||||
*/
|
||||
PropertiesEditorWidget::PropertiesEditorWidget(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
m_live_edit(false)
|
||||
{}
|
||||
|
||||
/**
|
||||
* @brief PropertiesEditorWidget::associatedUndo
|
||||
* By default, return a nullptr
|
||||
* @return nullptr
|
||||
*/
|
||||
@brief PropertiesEditorWidget::associatedUndo
|
||||
By default, return a nullptr
|
||||
@return nullptr
|
||||
*/
|
||||
QUndoCommand *PropertiesEditorWidget::associatedUndo() const{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief PropertiesEditorWidget::title
|
||||
* @return the title of this editor
|
||||
*/
|
||||
@brief PropertiesEditorWidget::title
|
||||
@return the title of this editor
|
||||
*/
|
||||
QString PropertiesEditorWidget::title() const {
|
||||
return QString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief PropertiesEditorWidget::setLiveEdit
|
||||
* Set the editor in live edit mode.
|
||||
* When an editor is in live edit mode, every change is applied immediately (no need to call apply).
|
||||
* If live edit can be enable, return true, else false.
|
||||
* By default this method do nothing and return false (live edit is disable).
|
||||
* Herited class of PropertiesEditorWidget must reimplemente this methode to manage the live edit mode.
|
||||
* @param live_edit true to enable live edit
|
||||
* @return true if live edit is enable, else false.
|
||||
*/
|
||||
@brief PropertiesEditorWidget::setLiveEdit
|
||||
Set the editor in live edit mode.
|
||||
When an editor is in live edit mode, every change is applied immediately (no need to call apply).
|
||||
If live edit can be enable, return true, else false.
|
||||
By default this method do nothing and return false (live edit is disable).
|
||||
Herited class of PropertiesEditorWidget must reimplemente this methode to manage the live edit mode.
|
||||
@param live_edit true to enable live edit
|
||||
@return true if live edit is enable, else false.
|
||||
*/
|
||||
bool PropertiesEditorWidget::setLiveEdit(bool live_edit) {
|
||||
Q_UNUSED(live_edit);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief PropertiesEditorWidget::isLiveEdit
|
||||
* @return true if this editor is in live edit mode
|
||||
* else return fasle.
|
||||
*/
|
||||
@brief PropertiesEditorWidget::isLiveEdit
|
||||
@return true if this editor is in live edit mode
|
||||
else return fasle.
|
||||
*/
|
||||
bool PropertiesEditorWidget::isLiveEdit() const {
|
||||
return m_live_edit;
|
||||
}
|
||||
|
||||
@@ -23,10 +23,10 @@
|
||||
class QUndoCommand;
|
||||
|
||||
/**
|
||||
* @brief The PropertiesEditorWidget class
|
||||
* This class extend QWidget method for have common way
|
||||
* to edit propertie.
|
||||
*/
|
||||
@brief The PropertiesEditorWidget class
|
||||
This class extend QWidget method for have common way
|
||||
to edit propertie.
|
||||
*/
|
||||
class PropertiesEditorWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -19,13 +19,13 @@
|
||||
#include <QPropertyAnimation>
|
||||
|
||||
/**
|
||||
* @brief QPropertyUndoCommand::QPropertyUndoCommand
|
||||
* Default constructor with old and new value
|
||||
* This command don't take ownership of @object
|
||||
* @param object
|
||||
* @param old_value
|
||||
* @param new_value
|
||||
*/
|
||||
@brief QPropertyUndoCommand::QPropertyUndoCommand
|
||||
Default constructor with old and new value
|
||||
This command don't take ownership of @object
|
||||
@param object
|
||||
@param old_value
|
||||
@param new_value
|
||||
*/
|
||||
QPropertyUndoCommand::QPropertyUndoCommand(QObject *object, const char *property_name, const QVariant &old_value, const QVariant &new_value, QUndoCommand *parent) :
|
||||
QUndoCommand(parent),
|
||||
m_object(object),
|
||||
@@ -35,14 +35,14 @@ QPropertyUndoCommand::QPropertyUndoCommand(QObject *object, const char *property
|
||||
{}
|
||||
|
||||
/**
|
||||
* @brief QPropertyUndoCommand::QPropertyUndoCommand
|
||||
* Default constructor with old value.
|
||||
* Call setNewValue to setup the new value of the edited QObject
|
||||
* This command don't take ownership of @object
|
||||
* @param object
|
||||
* @param old_value
|
||||
* @param parent
|
||||
*/
|
||||
@brief QPropertyUndoCommand::QPropertyUndoCommand
|
||||
Default constructor with old value.
|
||||
Call setNewValue to setup the new value of the edited QObject
|
||||
This command don't take ownership of @object
|
||||
@param object
|
||||
@param old_value
|
||||
@param parent
|
||||
*/
|
||||
QPropertyUndoCommand::QPropertyUndoCommand(QObject *object, const char *property_name, const QVariant &old_value, QUndoCommand *parent) :
|
||||
QUndoCommand(parent),
|
||||
m_object(object),
|
||||
@@ -62,29 +62,29 @@ QPropertyUndoCommand::QPropertyUndoCommand(const QPropertyUndoCommand *other)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QPropertyUndoCommand::setNewValue
|
||||
* Set the new value of the property (set with redo) to @new_value
|
||||
* @param new_value
|
||||
*/
|
||||
@brief QPropertyUndoCommand::setNewValue
|
||||
Set the new value of the property (set with redo) to @new_value
|
||||
@param new_value
|
||||
*/
|
||||
void QPropertyUndoCommand::setNewValue(const QVariant &new_value) {
|
||||
m_new_value = new_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QPropertyUndoCommand::enableAnimation
|
||||
* True to enable animation
|
||||
* @param animate
|
||||
*/
|
||||
@brief QPropertyUndoCommand::enableAnimation
|
||||
True to enable animation
|
||||
@param animate
|
||||
*/
|
||||
void QPropertyUndoCommand::enableAnimation (bool animate) {
|
||||
m_animate = animate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QPropertyUndoCommand::setAnimated
|
||||
* @param animate = true for animate this undo
|
||||
* @param first_time = if true, the first animation is done at the first call of redo
|
||||
* if false, the first animation is done at the second call of redo.
|
||||
*/
|
||||
@brief QPropertyUndoCommand::setAnimated
|
||||
@param animate = true for animate this undo
|
||||
@param first_time = if true, the first animation is done at the first call of redo
|
||||
if false, the first animation is done at the second call of redo.
|
||||
*/
|
||||
void QPropertyUndoCommand::setAnimated(bool animate, bool first_time)
|
||||
{
|
||||
m_animate = animate;
|
||||
@@ -92,11 +92,11 @@ void QPropertyUndoCommand::setAnimated(bool animate, bool first_time)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QPropertyUndoCommand::mergeWith
|
||||
* Try to merge this command with other command
|
||||
* @param other
|
||||
* @return true if was merged, else false
|
||||
*/
|
||||
@brief QPropertyUndoCommand::mergeWith
|
||||
Try to merge this command with other command
|
||||
@param other
|
||||
@return true if was merged, else false
|
||||
*/
|
||||
bool QPropertyUndoCommand::mergeWith(const QUndoCommand *other)
|
||||
{
|
||||
if (id() != other->id() || other->childCount()) return false;
|
||||
@@ -107,9 +107,9 @@ bool QPropertyUndoCommand::mergeWith(const QUndoCommand *other)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QPropertyUndoCommand::redo
|
||||
* Redo this command
|
||||
*/
|
||||
@brief QPropertyUndoCommand::redo
|
||||
Redo this command
|
||||
*/
|
||||
void QPropertyUndoCommand::redo()
|
||||
{
|
||||
if (m_object->property(m_property_name) != m_new_value)
|
||||
@@ -132,9 +132,9 @@ void QPropertyUndoCommand::redo()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QPropertyUndoCommand::undo
|
||||
* Undo this command
|
||||
*/
|
||||
@brief QPropertyUndoCommand::undo
|
||||
Undo this command
|
||||
*/
|
||||
void QPropertyUndoCommand::undo()
|
||||
{
|
||||
if (m_object->property(m_property_name) != m_old_value)
|
||||
|
||||
@@ -24,12 +24,12 @@
|
||||
class QObject;
|
||||
|
||||
/**
|
||||
* @brief The QPropertyUndoCommand class
|
||||
* This undo command manage QProperty of a QObject.
|
||||
* This undo command can use QPropertyAnimation to animate the change when undo/redo is call
|
||||
* To use animation call setAnimated(true). By default animation is disable.
|
||||
* Some QVariant date can't be animated and result this command don't work.
|
||||
*/
|
||||
@brief The QPropertyUndoCommand class
|
||||
This undo command manage QProperty of a QObject.
|
||||
This undo command can use QPropertyAnimation to animate the change when undo/redo is call
|
||||
To use animation call setAnimated(true). By default animation is disable.
|
||||
Some QVariant date can't be animated and result this command don't work.
|
||||
*/
|
||||
class QPropertyUndoCommand : public QUndoCommand
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -19,11 +19,11 @@
|
||||
#include <QWidget>
|
||||
|
||||
/**
|
||||
* @brief QWidgetAnimation::QWidgetAnimation
|
||||
* @param widget : widget to animate
|
||||
* @param orientation : animate widget horizontally or vertically
|
||||
* @param duration : the duration of animation @see void QVariantAnimation::setDuration(int msecs)
|
||||
*/
|
||||
@brief QWidgetAnimation::QWidgetAnimation
|
||||
@param widget : widget to animate
|
||||
@param orientation : animate widget horizontally or vertically
|
||||
@param duration : the duration of animation @see void QVariantAnimation::setDuration(int msecs)
|
||||
*/
|
||||
QWidgetAnimation::QWidgetAnimation(QWidget *widget, Qt::Orientation orientation, QWidgetAnimation::Behavior behavior, int duration) :
|
||||
QPropertyAnimation(widget),
|
||||
m_orientation(orientation),
|
||||
@@ -51,10 +51,10 @@ QWidgetAnimation::QWidgetAnimation(QWidget *widget, Qt::Orientation orientation,
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QWidgetAnimation::widgetToSubtract
|
||||
* Widget to subtract the size when the behavior is availableSpace
|
||||
* @param widgets
|
||||
*/
|
||||
@brief QWidgetAnimation::widgetToSubtract
|
||||
Widget to subtract the size when the behavior is availableSpace
|
||||
@param widgets
|
||||
*/
|
||||
void QWidgetAnimation::widgetToSubtract(QVector<QWidget *> widgets)
|
||||
{
|
||||
m_widget_to_substract.clear();
|
||||
@@ -62,9 +62,9 @@ void QWidgetAnimation::widgetToSubtract(QVector<QWidget *> widgets)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QWidgetAnimation::show
|
||||
* show the widget
|
||||
*/
|
||||
@brief QWidgetAnimation::show
|
||||
show the widget
|
||||
*/
|
||||
void QWidgetAnimation::show()
|
||||
{
|
||||
if (m_state == QWidgetAnimation::Showing)
|
||||
@@ -113,9 +113,9 @@ void QWidgetAnimation::show()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QWidgetAnimation::hide
|
||||
* Hide the widget
|
||||
*/
|
||||
@brief QWidgetAnimation::hide
|
||||
Hide the widget
|
||||
*/
|
||||
void QWidgetAnimation::hide()
|
||||
{
|
||||
if (m_state == QWidgetAnimation::Hidding)
|
||||
@@ -135,10 +135,10 @@ void QWidgetAnimation::hide()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QWidgetAnimation::setHidden
|
||||
* true hide, false show
|
||||
* @param hidden
|
||||
*/
|
||||
@brief QWidgetAnimation::setHidden
|
||||
true hide, false show
|
||||
@param hidden
|
||||
*/
|
||||
void QWidgetAnimation::setHidden(bool hidden)
|
||||
{
|
||||
if (hidden)
|
||||
@@ -148,10 +148,10 @@ void QWidgetAnimation::setHidden(bool hidden)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QWidgetAnimation::setLastShowSize
|
||||
* Force the last show size value to @size
|
||||
* @param size
|
||||
*/
|
||||
@brief QWidgetAnimation::setLastShowSize
|
||||
Force the last show size value to @size
|
||||
@param size
|
||||
*/
|
||||
void QWidgetAnimation::setLastShowSize(int size)
|
||||
{
|
||||
if (m_orientation == Qt::Vertical) {
|
||||
|
||||
@@ -23,18 +23,18 @@
|
||||
#include <QRect>
|
||||
|
||||
/**
|
||||
* @brief The QWidgetAnimation class
|
||||
* This class animate the show and hide function of a QWidget.
|
||||
@brief The QWidgetAnimation class
|
||||
This class animate the show and hide function of a QWidget.
|
||||
*
|
||||
* The role of @behavior is to calcul as best the animation process when widget is show.
|
||||
* Because this class don't change the current and final size of the widget but her maximum size during the animation process,
|
||||
* we must to know in advance the final size of the widget.
|
||||
* Behavior minimumSizeHint : the final size of the widget will be his minimum size hint.
|
||||
* Behavior availableSpace : the final size of widget will be the available size of her parent.
|
||||
* Since parent can have other widgets you can add a QVector of widget to subtract of the final size.
|
||||
* Because we suppose the animated widget will take the maximum available space, we subtract the minimum size hint of widgets in QVector.
|
||||
* Behavior lastSize : The widget will have the same size as the last time he was showed.
|
||||
*/
|
||||
The role of @behavior is to calcul as best the animation process when widget is show.
|
||||
Because this class don't change the current and final size of the widget but her maximum size during the animation process,
|
||||
we must to know in advance the final size of the widget.
|
||||
Behavior minimumSizeHint : the final size of the widget will be his minimum size hint.
|
||||
Behavior availableSpace : the final size of widget will be the available size of her parent.
|
||||
Since parent can have other widgets you can add a QVector of widget to subtract of the final size.
|
||||
Because we suppose the animated widget will take the maximum available space, we subtract the minimum size hint of widgets in QVector.
|
||||
Behavior lastSize : The widget will have the same size as the last time he was showed.
|
||||
*/
|
||||
class QWidgetAnimation : public QPropertyAnimation
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "qetgraphicshandleritem.h"
|
||||
#include <QPainter>
|
||||
@@ -21,9 +21,9 @@
|
||||
#include <utility>
|
||||
|
||||
/**
|
||||
* @brief QetGraphicsHandlerItem::QetGraphicsHandlerItem
|
||||
* @param size, the size of the handler
|
||||
*/
|
||||
@brief QetGraphicsHandlerItem::QetGraphicsHandlerItem
|
||||
@param size, the size of the handler
|
||||
*/
|
||||
QetGraphicsHandlerItem::QetGraphicsHandlerItem(qreal size) :
|
||||
m_size(size)
|
||||
{
|
||||
@@ -34,17 +34,17 @@ QetGraphicsHandlerItem::QetGraphicsHandlerItem(qreal size) :
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QetGraphicsHandlerItem::boundingRect
|
||||
* @return
|
||||
*/
|
||||
@brief QetGraphicsHandlerItem::boundingRect
|
||||
@return
|
||||
*/
|
||||
QRectF QetGraphicsHandlerItem::boundingRect() const {
|
||||
return m_br;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QetGraphicsHandlerItem::setColor
|
||||
* @param color, set the color of the handler
|
||||
*/
|
||||
@brief QetGraphicsHandlerItem::setColor
|
||||
@param color, set the color of the handler
|
||||
*/
|
||||
void QetGraphicsHandlerItem::setColor(QColor color)
|
||||
{
|
||||
m_color = std::move(color);
|
||||
@@ -52,40 +52,48 @@ void QetGraphicsHandlerItem::setColor(QColor color)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QetGraphicsHandlerItem::paint
|
||||
* @param painter
|
||||
* @param option
|
||||
* @param widget
|
||||
*/
|
||||
void QetGraphicsHandlerItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||
@brief QetGraphicsHandlerItem::paint
|
||||
@param painter
|
||||
@param option
|
||||
@param widget
|
||||
*/
|
||||
void QetGraphicsHandlerItem::paint(QPainter *painter,
|
||||
const QStyleOptionGraphicsItem *option,
|
||||
QWidget *widget)
|
||||
{
|
||||
Q_UNUSED(option)
|
||||
Q_UNUSED(widget)
|
||||
|
||||
painter->save();
|
||||
painter->setBrush(QBrush(m_color));
|
||||
QPen pen(QBrush(m_color), 2, Qt::SolidLine, Qt::SquareCap, Qt::MiterJoin);
|
||||
painter->save();
|
||||
painter->setBrush(QBrush(m_color));
|
||||
QPen pen(QBrush(m_color),
|
||||
2,
|
||||
Qt::SolidLine,
|
||||
Qt::SquareCap,
|
||||
Qt::MiterJoin);
|
||||
pen.setCosmetic(true);
|
||||
painter->setPen(pen);
|
||||
painter->setPen(pen);
|
||||
painter->setRenderHint(QPainter::Antialiasing, true);
|
||||
painter->drawEllipse(m_handler_rect);
|
||||
painter->drawEllipse(m_handler_rect);
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QetGraphicsHandlerItem::handlerForPoint
|
||||
* @param points
|
||||
* @return A list of handler with pos at point
|
||||
*/
|
||||
QVector<QetGraphicsHandlerItem *> QetGraphicsHandlerItem::handlerForPoint(const QVector<QPointF> &points, int size)
|
||||
@brief QetGraphicsHandlerItem::handlerForPoint
|
||||
@param points
|
||||
@return A list of handler with pos at point
|
||||
*/
|
||||
QVector<QetGraphicsHandlerItem *> QetGraphicsHandlerItem::handlerForPoint(
|
||||
const QVector<QPointF> &points,
|
||||
int size)
|
||||
{
|
||||
QVector <QetGraphicsHandlerItem *> list_;
|
||||
for (QPointF point : points)
|
||||
{
|
||||
QetGraphicsHandlerItem *qghi = new QetGraphicsHandlerItem(size);
|
||||
qghi->setPos(point);
|
||||
list_ << qghi;
|
||||
}
|
||||
QVector <QetGraphicsHandlerItem *> list_;
|
||||
for (QPointF point : points)
|
||||
{
|
||||
QetGraphicsHandlerItem *qghi = new QetGraphicsHandlerItem(size);
|
||||
qghi->setPos(point);
|
||||
list_ << qghi;
|
||||
}
|
||||
|
||||
return list_;
|
||||
}
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef QETGRAPHICSHANDLERITEM_H
|
||||
#define QETGRAPHICSHANDLERITEM_H
|
||||
@@ -22,35 +22,43 @@
|
||||
#include <QPen>
|
||||
|
||||
/**
|
||||
* @brief The QetGraphicsHandlerItem class
|
||||
* This graphics item represents a point, destined to be used as an handler,
|
||||
* for modifie the geometrie of a another graphics item (like shapes).
|
||||
* The graphics item to be modified, must call "installSceneEventFilter" of this item with itself for argument,.
|
||||
* The ghraphics item to be modified, need to reimplement "sceneEventFilter" for create the modification behavior.
|
||||
*/
|
||||
@brief The QetGraphicsHandlerItem class
|
||||
This graphics item represents a point,
|
||||
destined to be used as an handler,
|
||||
for modifie the geometrie of a another graphics item (like shapes).
|
||||
The graphics item to be modified,
|
||||
must call "installSceneEventFilter"
|
||||
of this item with itself for argument,.
|
||||
The ghraphics item to be modified,
|
||||
need to reimplement "sceneEventFilter"
|
||||
for create the modification behavior.
|
||||
*/
|
||||
class QetGraphicsHandlerItem : public QGraphicsItem
|
||||
{
|
||||
public:
|
||||
QetGraphicsHandlerItem(qreal size = 10);
|
||||
QRectF boundingRect() const override;
|
||||
public:
|
||||
QetGraphicsHandlerItem(qreal size = 10);
|
||||
QRectF boundingRect() const override;
|
||||
|
||||
enum { Type = UserType + 1200};
|
||||
int type() const override {return Type;}
|
||||
|
||||
void setColor(QColor color);
|
||||
|
||||
protected:
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
||||
protected:
|
||||
void paint(QPainter *painter,
|
||||
const QStyleOptionGraphicsItem *option,
|
||||
QWidget *widget) override;
|
||||
|
||||
private:
|
||||
private:
|
||||
QRectF m_handler_rect,
|
||||
m_br;
|
||||
qreal m_size;
|
||||
qreal m_size;
|
||||
QColor m_color;
|
||||
QPen m_pen;
|
||||
|
||||
public:
|
||||
static QVector<QetGraphicsHandlerItem *> handlerForPoint(const QVector<QPointF> &points, int size = 10);
|
||||
static QVector<QetGraphicsHandlerItem *> handlerForPoint(
|
||||
const QVector<QPointF> &points, int size = 10);
|
||||
};
|
||||
|
||||
#endif // QETGRAPHICSHANDLERITEM_H
|
||||
|
||||
@@ -20,19 +20,19 @@
|
||||
|
||||
|
||||
/**
|
||||
* @brief QetGraphicsHandlerUtility::pointsForRect
|
||||
* Return the keys points of the rectangle, stored in a vector.
|
||||
* The points in the vector are stored like this :
|
||||
* **********
|
||||
* 0---1---2
|
||||
* | |
|
||||
* 3 4
|
||||
* | |
|
||||
* 5---6---7
|
||||
* ************
|
||||
* @param rect
|
||||
* @return
|
||||
*/
|
||||
@brief QetGraphicsHandlerUtility::pointsForRect
|
||||
Return the keys points of the rectangle, stored in a vector.
|
||||
The points in the vector are stored like this :
|
||||
**********
|
||||
0---1---2
|
||||
| |
|
||||
3 4
|
||||
| |
|
||||
5---6---7
|
||||
************
|
||||
@param rect
|
||||
@return
|
||||
*/
|
||||
QVector<QPointF> QetGraphicsHandlerUtility::pointsForRect(const QRectF &rect)
|
||||
{
|
||||
QVector<QPointF> vector;
|
||||
@@ -56,25 +56,26 @@ QVector<QPointF> QetGraphicsHandlerUtility::pointsForRect(const QRectF &rect)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QetGraphicsHandlerUtility::pointsForLine
|
||||
* The point that define a line in a QVector.
|
||||
* there is two points.
|
||||
* @param line
|
||||
* @return
|
||||
*/
|
||||
@brief QetGraphicsHandlerUtility::pointsForLine
|
||||
The point that define a line in a QVector.
|
||||
there is two points.
|
||||
@param line
|
||||
@return
|
||||
*/
|
||||
QVector<QPointF> QetGraphicsHandlerUtility::pointsForLine(const QLineF &line) {
|
||||
return (QVector<QPointF> {line.p1(), line.p2()});
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QetGraphicsHandlerUtility::pointsForArc
|
||||
* Return the points for the given arc.
|
||||
* The first value in the vector is the start point, the second the end point.
|
||||
* @param rect
|
||||
* @param start_angle : start angle in degree
|
||||
* @param span_angle : span angle in degree;
|
||||
* @return
|
||||
*/
|
||||
@brief QetGraphicsHandlerUtility::pointsForArc
|
||||
Return the points for the given arc.
|
||||
The first value in the vector is the start point,
|
||||
the second the end point.
|
||||
@param rect
|
||||
@param start_angle : start angle in degree
|
||||
@param span_angle : span angle in degree;
|
||||
@return
|
||||
*/
|
||||
QVector<QPointF> QetGraphicsHandlerUtility::pointsForArc(const QRectF &rect, qreal start_angle, qreal span_angle)
|
||||
{
|
||||
QVector<QPointF> vector;
|
||||
@@ -88,14 +89,18 @@ QVector<QPointF> QetGraphicsHandlerUtility::pointsForArc(const QRectF &rect, qre
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QetGraphicsHandlerUtility::rectForPosAtIndex
|
||||
* Return a rectangle after modification of the point '@pos' at index '@index' of original rectangle '@old_rect'.
|
||||
* @param old_rect - the rectangle befor modification
|
||||
* @param pos - the new position of a key point
|
||||
* @param index - the index of the key point to modifie see QetGraphicsHandlerUtility::pointsForRect to know
|
||||
* the index of each keys points of a rectangle)
|
||||
* @return : the rectangle with modification. If index is lower than 0 or higher than 7, this method return old_rect.
|
||||
*/
|
||||
@brief QetGraphicsHandlerUtility::rectForPosAtIndex
|
||||
Return a rectangle after modification
|
||||
of the point '@pos' at index '@index' of original rectangle '@old_rect'.
|
||||
@param old_rect - the rectangle befor modification
|
||||
@param pos - the new position of a key point
|
||||
@param index - the index of the key point to modifie
|
||||
@see QetGraphicsHandlerUtility::pointsForRect to know
|
||||
the index of each keys points of a rectangle)
|
||||
@return : the rectangle with modification.
|
||||
If index is lower than 0 or higher than 7,
|
||||
this method return old_rect.
|
||||
*/
|
||||
QRectF QetGraphicsHandlerUtility::rectForPosAtIndex(const QRectF &old_rect, const QPointF &pos, int index)
|
||||
{
|
||||
if (index < 0 || index > 7) return old_rect;
|
||||
@@ -114,15 +119,19 @@ QRectF QetGraphicsHandlerUtility::rectForPosAtIndex(const QRectF &old_rect, cons
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QetGraphicsHandlerUtility::mirrorRectForPosAtIndex
|
||||
* Return a rectangle after modification of the point '@pos' at index '@index' of original rectangle '@old_rect'.
|
||||
* the opposite edge is modified inversely (like a mirror)
|
||||
* @param old_rect : the rectangle befor modification
|
||||
* @param pos : the new position of a key point
|
||||
* @param index : the index of the key point to modifie see QetGraphicsHandlerUtility::pointsForRect to know
|
||||
* the index of each keys points of a rectangle)
|
||||
* @return : the rectangle with modification. If index is lower than 0 or higher than 7, this method return old_rect.
|
||||
*/
|
||||
@brief QetGraphicsHandlerUtility::mirrorRectForPosAtIndex
|
||||
Return a rectangle after modification of the point '@pos'
|
||||
at index '@index' of original rectangle '@old_rect'.
|
||||
the opposite edge is modified inversely (like a mirror)
|
||||
@param old_rect : the rectangle befor modification
|
||||
@param pos : the new position of a key point
|
||||
@param index : the index of the key point to modifie
|
||||
@see QetGraphicsHandlerUtility::pointsForRect to know
|
||||
the index of each keys points of a rectangle)
|
||||
@return : the rectangle with modification.
|
||||
If index is lower than 0 or higher than 7,
|
||||
this method return old_rect.
|
||||
*/
|
||||
QRectF QetGraphicsHandlerUtility::mirrorRectForPosAtIndex(const QRectF &old_rect, const QPointF &pos, int index)
|
||||
{
|
||||
if (index < 0 || index > 7) return old_rect;
|
||||
@@ -172,13 +181,13 @@ QRectF QetGraphicsHandlerUtility::mirrorRectForPosAtIndex(const QRectF &old_rect
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QetGraphicsHandlerUtility::lineForPosAtIndex
|
||||
* Return a line after modification of @pos at index @index of @old_line.
|
||||
* @param old_line
|
||||
* @param pos
|
||||
* @param index
|
||||
* @return
|
||||
*/
|
||||
@brief QetGraphicsHandlerUtility::lineForPosAtIndex
|
||||
Return a line after modification of @pos at index @index of @old_line.
|
||||
@param old_line
|
||||
@param pos
|
||||
@param index
|
||||
@return
|
||||
*/
|
||||
QLineF QetGraphicsHandlerUtility::lineForPosAtIndex(const QLineF &old_line, const QPointF &pos, int index) {
|
||||
QLineF line = old_line;
|
||||
index == 0 ? line.setP1(pos) : line.setP2(pos);
|
||||
@@ -186,12 +195,12 @@ QLineF QetGraphicsHandlerUtility::lineForPosAtIndex(const QLineF &old_line, cons
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QetGraphicsHandlerUtility::polygonForInsertPoint
|
||||
* @param old_polygon : the polygon which we insert a new point.
|
||||
* @param closed : polygon is closed or not
|
||||
* @param pos : the pos where the new point must be added
|
||||
* @return the new polygon
|
||||
*/
|
||||
@brief QetGraphicsHandlerUtility::polygonForInsertPoint
|
||||
@param old_polygon : the polygon which we insert a new point.
|
||||
@param closed : polygon is closed or not
|
||||
@param pos : the pos where the new point must be added
|
||||
@return the new polygon
|
||||
*/
|
||||
QPolygonF QetGraphicsHandlerUtility::polygonForInsertPoint(const QPolygonF &old_polygon, bool closed, const QPointF &pos)
|
||||
{
|
||||
qreal max_angle = 0;
|
||||
@@ -241,15 +250,17 @@ QPolygonF QetGraphicsHandlerUtility::polygonForInsertPoint(const QPolygonF &old_
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QetGraphicsHandlerUtility::pointForRadiusRect
|
||||
* @param rect the rectangle.
|
||||
* @param xRadius : x radius
|
||||
* @param yRadius : y radius
|
||||
* @param mode : absolute or relative size: NOTE this argument is not used, this function always compute with relative size.
|
||||
* @return the points of x and y radius of a rounded rect.
|
||||
* The points are always based on the top right corner of the rect.
|
||||
* the first point of vector is X the second Y
|
||||
*/
|
||||
@brief QetGraphicsHandlerUtility::pointForRadiusRect
|
||||
@param rect the rectangle.
|
||||
@param xRadius : x radius
|
||||
@param yRadius : y radius
|
||||
@param mode :
|
||||
absolute or relative size: NOTE this argument is not used,
|
||||
this function always compute with relative size.
|
||||
@return the points of x and y radius of a rounded rect.
|
||||
The points are always based on the top right corner of the rect.
|
||||
the first point of vector is X the second Y
|
||||
*/
|
||||
QVector<QPointF> QetGraphicsHandlerUtility::pointForRadiusRect(const QRectF &rect, qreal xRadius, qreal yRadius, Qt::SizeMode mode)
|
||||
{
|
||||
QVector<QPointF> v;
|
||||
@@ -283,13 +294,13 @@ QVector<QPointF> QetGraphicsHandlerUtility::pointForRadiusRect(const QRectF &rec
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QetGraphicsHandlerUtility::radiusForPosAtIndex
|
||||
* @param rect the rectangle
|
||||
* @param pos : the pos of the new radius
|
||||
* @param index : index of radius 0=X 1=Y
|
||||
* @param mode
|
||||
* @return
|
||||
*/
|
||||
@brief QetGraphicsHandlerUtility::radiusForPosAtIndex
|
||||
@param rect the rectangle
|
||||
@param pos : the pos of the new radius
|
||||
@param index : index of radius 0=X 1=Y
|
||||
@param mode
|
||||
@return
|
||||
*/
|
||||
qreal QetGraphicsHandlerUtility::radiusForPosAtIndex(const QRectF &rect, const QPointF &pos, int index, Qt::SizeMode mode)
|
||||
{
|
||||
if (mode == Qt::AbsoluteSize)
|
||||
|
||||
@@ -26,11 +26,11 @@
|
||||
class QPainter;
|
||||
|
||||
/**
|
||||
* @brief The QetGraphicsHandlerUtility class
|
||||
* This class provide some methods to create and use handler for
|
||||
* modify graphics shape like line rectangle etc...
|
||||
* They also provide some conveniance static method.
|
||||
*/
|
||||
@brief The QetGraphicsHandlerUtility class
|
||||
This class provide some methods to create and use handler for
|
||||
modify graphics shape like line rectangle etc...
|
||||
They also provide some conveniance static method.
|
||||
*/
|
||||
class QetGraphicsHandlerUtility
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -32,11 +32,12 @@ SearchAndReplaceWorker::SearchAndReplaceWorker()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWorker::replaceDiagram
|
||||
* Replace all properties of each diagram in @diagram_list,
|
||||
* by the current titleblock propertie of this worker
|
||||
* @param diagram_list, list of diagram to be changed, all diagrams must belong to the same project;
|
||||
*/
|
||||
@brief SearchAndReplaceWorker::replaceDiagram
|
||||
Replace all properties of each diagram in @diagram_list,
|
||||
by the current titleblock propertie of this worker
|
||||
@param diagram_list, list of diagram to be changed,
|
||||
all diagrams must belong to the same project;
|
||||
*/
|
||||
void SearchAndReplaceWorker::replaceDiagram(QList<Diagram *> diagram_list)
|
||||
{
|
||||
if (diagram_list.isEmpty()) {
|
||||
@@ -91,12 +92,14 @@ void SearchAndReplaceWorker::replaceDiagram(Diagram *diagram)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWorker::replaceElement
|
||||
* Replace all properties of each elements in @list
|
||||
* All element must belong to the same project, if not this function do nothing.
|
||||
* All change are made through a undo command append to undo list of the project.
|
||||
* @param list
|
||||
*/
|
||||
@brief SearchAndReplaceWorker::replaceElement
|
||||
Replace all properties of each elements in @list
|
||||
All element must belong to the same project,
|
||||
if not this function do nothing.
|
||||
All change are made through a undo command append
|
||||
to undo list of the project.
|
||||
@param list
|
||||
*/
|
||||
void SearchAndReplaceWorker::replaceElement(QList<Element *> list)
|
||||
{
|
||||
if (list.isEmpty() || !list.first()->diagram()) {
|
||||
@@ -147,11 +150,11 @@ void SearchAndReplaceWorker::replaceElement(Element *element)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWorker::replaceIndiText
|
||||
* Replace all displayed text of independent text of @list
|
||||
* Each must belong to the same project, if not this function do nothing
|
||||
* @param list
|
||||
*/
|
||||
@brief SearchAndReplaceWorker::replaceIndiText
|
||||
Replace all displayed text of independent text of @list
|
||||
Each must belong to the same project, if not this function do nothing
|
||||
@param list
|
||||
*/
|
||||
void SearchAndReplaceWorker::replaceIndiText(QList<IndependentTextItem *> list)
|
||||
{
|
||||
if (list.isEmpty() || !list.first()->diagram()) {
|
||||
@@ -183,12 +186,14 @@ void SearchAndReplaceWorker::replaceIndiText(IndependentTextItem *text)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWorker::replaceConductor
|
||||
* Replace all properties of each conductor in @list
|
||||
* All conductor must belong to the same project, if not this function do nothing.
|
||||
* All change are made through a undo command append to undo list of the project.
|
||||
* @param list
|
||||
*/
|
||||
@brief SearchAndReplaceWorker::replaceConductor
|
||||
Replace all properties of each conductor in @list
|
||||
All conductor must belong to the same project,
|
||||
if not this function do nothing.
|
||||
All change are made through a undo command append
|
||||
to undo list of the project.
|
||||
@param list
|
||||
*/
|
||||
void SearchAndReplaceWorker::replaceConductor(QList<Conductor *> list)
|
||||
{
|
||||
if (list.isEmpty() || !list.first()->diagram()) {
|
||||
@@ -232,15 +237,15 @@ void SearchAndReplaceWorker::replaceConductor(Conductor *conductor)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWorker::replaceAdvanced
|
||||
* Apply the change of text according to the current advancedStruct
|
||||
* All items in the 4 list must belong to the same QETProject,
|
||||
* if not this function do nothing
|
||||
* @param d
|
||||
* @param e
|
||||
* @param t
|
||||
* @param c
|
||||
*/
|
||||
@brief SearchAndReplaceWorker::replaceAdvanced
|
||||
Apply the change of text according to the current advancedStruct
|
||||
All items in the 4 list must belong to the same QETProject,
|
||||
if not this function do nothing
|
||||
@param d
|
||||
@param e
|
||||
@param t
|
||||
@param c
|
||||
*/
|
||||
void SearchAndReplaceWorker::replaceAdvanced(QList<Diagram *> diagrams, QList<Element *> elements, QList<IndependentTextItem *> texts, QList<Conductor *> conductors)
|
||||
{
|
||||
QETProject *project_ = nullptr;
|
||||
@@ -348,15 +353,17 @@ void SearchAndReplaceWorker::replaceAdvanced(QList<Diagram *> diagrams, QList<El
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWorker::setupLineEdit
|
||||
* With search and replace, when the variable to edit is a text,
|
||||
* the editor is always the same no matter if it is for a folio, element or conductor.
|
||||
* The editor is a QLineEdit to edit the text and checkbox to erase the text if checked.
|
||||
* This function fill the editor, from the current string
|
||||
* @param l
|
||||
* @param cb
|
||||
* @param str
|
||||
*/
|
||||
@brief SearchAndReplaceWorker::setupLineEdit
|
||||
With search and replace, when the variable to edit is a text,
|
||||
the editor is always the same no matter if it is for a folio,
|
||||
element or conductor.
|
||||
The editor is a QLineEdit to edit the text
|
||||
and checkbox to erase the text if checked.
|
||||
This function fill the editor, from the current string
|
||||
@param l
|
||||
@param cb
|
||||
@param str
|
||||
*/
|
||||
void SearchAndReplaceWorker::setupLineEdit(QLineEdit *l, QCheckBox *cb, QString str)
|
||||
{
|
||||
l->setText(str);
|
||||
@@ -385,11 +392,11 @@ ConductorProperties SearchAndReplaceWorker::invalidConductorProperties()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWorker::applyChange
|
||||
* @param original : the original properties
|
||||
* @param change : the change properties, to be merged with @original
|
||||
* @return a new conductor properties with the change applyed.
|
||||
*/
|
||||
@brief SearchAndReplaceWorker::applyChange
|
||||
@param original : the original properties
|
||||
@param change : the change properties, to be merged with @original
|
||||
@return a new conductor properties with the change applyed.
|
||||
*/
|
||||
ConductorProperties SearchAndReplaceWorker::applyChange(const ConductorProperties &original, const ConductorProperties &change)
|
||||
{
|
||||
ConductorProperties new_properties = original;
|
||||
@@ -420,11 +427,11 @@ ConductorProperties SearchAndReplaceWorker::applyChange(const ConductorPropertie
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWorker::applyChange
|
||||
* @param original : the original string
|
||||
* @param change : the changed string:
|
||||
* @return the string to be use in the properties
|
||||
*/
|
||||
@brief SearchAndReplaceWorker::applyChange
|
||||
@param original : the original string
|
||||
@param change : the changed string:
|
||||
@return the string to be use in the properties
|
||||
*/
|
||||
QString SearchAndReplaceWorker::applyChange(const QString &original, const QString &change)
|
||||
{
|
||||
if (change.isEmpty()) {return original;}
|
||||
@@ -433,11 +440,11 @@ QString SearchAndReplaceWorker::applyChange(const QString &original, const QStri
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWorker::replaceAdvanced
|
||||
* @param diagram
|
||||
* @return the titleblock properties with the change applied,
|
||||
* according to the state of @m_advanced_struct
|
||||
*/
|
||||
@brief SearchAndReplaceWorker::replaceAdvanced
|
||||
@param diagram
|
||||
@return the titleblock properties with the change applied,
|
||||
according to the state of @m_advanced_struct
|
||||
*/
|
||||
TitleBlockProperties SearchAndReplaceWorker::replaceAdvanced(Diagram *diagram)
|
||||
{
|
||||
TitleBlockProperties p = diagram->border_and_titleblock.exportTitleBlock();
|
||||
@@ -459,11 +466,11 @@ TitleBlockProperties SearchAndReplaceWorker::replaceAdvanced(Diagram *diagram)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWorker::replaceAdvanced
|
||||
* @param element
|
||||
* @return The diagram context with the change applied,
|
||||
* according to the state of @m_advanced_struct
|
||||
*/
|
||||
@brief SearchAndReplaceWorker::replaceAdvanced
|
||||
@param element
|
||||
@return The diagram context with the change applied,
|
||||
according to the state of @m_advanced_struct
|
||||
*/
|
||||
DiagramContext SearchAndReplaceWorker::replaceAdvanced(Element *element)
|
||||
{
|
||||
DiagramContext context = element->elementInformations();
|
||||
@@ -484,11 +491,11 @@ DiagramContext SearchAndReplaceWorker::replaceAdvanced(Element *element)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWorker::replaceAdvanced
|
||||
* @param conductor
|
||||
* @return the conductor properties with the change applied,
|
||||
* according to the state of @m_advanced_struct
|
||||
*/
|
||||
@brief SearchAndReplaceWorker::replaceAdvanced
|
||||
@param conductor
|
||||
@return the conductor properties with the change applied,
|
||||
according to the state of @m_advanced_struct
|
||||
*/
|
||||
ConductorProperties SearchAndReplaceWorker::replaceAdvanced(Conductor *conductor)
|
||||
{
|
||||
ConductorProperties properties = conductor->properties();
|
||||
|
||||
@@ -44,9 +44,10 @@ struct advancedReplaceStruct
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief The SearchAndReplaceWorker class
|
||||
* This class is the worker use to change properties when use the search and replace function of QET
|
||||
*/
|
||||
@brief The SearchAndReplaceWorker class
|
||||
This class is the worker use to change properties
|
||||
when use the search and replace function of QET
|
||||
*/
|
||||
class SearchAndReplaceWorker
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -22,10 +22,10 @@
|
||||
#include <QAbstractButton>
|
||||
|
||||
/**
|
||||
* @brief replaceAdvancedDialog::replaceAdvancedDialog
|
||||
* @param advanced
|
||||
* @param parent
|
||||
*/
|
||||
@brief replaceAdvancedDialog::replaceAdvancedDialog
|
||||
@param advanced
|
||||
@param parent
|
||||
*/
|
||||
replaceAdvancedDialog::replaceAdvancedDialog(advancedReplaceStruct advanced, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::replaceAdvancedDialog)
|
||||
@@ -47,10 +47,10 @@ replaceAdvancedDialog::~replaceAdvancedDialog()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief replaceAdvancedDialog::setAdvancedStruct
|
||||
* Set the edited advanced struct
|
||||
* @param advanced
|
||||
*/
|
||||
@brief replaceAdvancedDialog::setAdvancedStruct
|
||||
Set the edited advanced struct
|
||||
@param advanced
|
||||
*/
|
||||
void replaceAdvancedDialog::setAdvancedStruct(advancedReplaceStruct advanced)
|
||||
{
|
||||
int index = advanced.who;
|
||||
@@ -73,9 +73,9 @@ void replaceAdvancedDialog::setAdvancedStruct(advancedReplaceStruct advanced)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief replaceAdvancedDialog::advancedStruct
|
||||
* @return the edited advanced struct
|
||||
*/
|
||||
@brief replaceAdvancedDialog::advancedStruct
|
||||
@return the edited advanced struct
|
||||
*/
|
||||
advancedReplaceStruct replaceAdvancedDialog::advancedStruct() const
|
||||
{
|
||||
advancedReplaceStruct a;
|
||||
@@ -110,9 +110,9 @@ void replaceAdvancedDialog::fillWhatComboBox(int index)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief replaceAdvancedDialog::on_m_who_cb_currentIndexChanged
|
||||
* @param index
|
||||
*/
|
||||
@brief replaceAdvancedDialog::on_m_who_cb_currentIndexChanged
|
||||
@param index
|
||||
*/
|
||||
void replaceAdvancedDialog::on_m_who_cb_currentIndexChanged(int index) {
|
||||
fillWhatComboBox(index);
|
||||
}
|
||||
|
||||
@@ -25,9 +25,9 @@
|
||||
typedef SearchAndReplaceWorker sarw;
|
||||
|
||||
/**
|
||||
* @brief ReplaceConductorDialog::ReplaceConductorDialog
|
||||
* @param parent
|
||||
*/
|
||||
@brief ReplaceConductorDialog::ReplaceConductorDialog
|
||||
@param parent
|
||||
*/
|
||||
ReplaceConductorDialog::ReplaceConductorDialog(const ConductorProperties &properties, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::ReplaceConductorDialog)
|
||||
@@ -43,11 +43,12 @@ ReplaceConductorDialog::~ReplaceConductorDialog()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ReplaceConductorDialog::updatePreview
|
||||
* Update the preview for single line
|
||||
* @param b true: update from the value displayed by this widget
|
||||
* false: update from the properties given at the constructor of this widget
|
||||
*/
|
||||
@brief ReplaceConductorDialog::updatePreview
|
||||
Update the preview for single line
|
||||
@param b :
|
||||
true: update from the value displayed by this widget
|
||||
false: update from the properties given at the constructor of this widget
|
||||
*/
|
||||
void ReplaceConductorDialog::updatePreview(bool b)
|
||||
{
|
||||
const QRect pixmap_rect(0, 0, 96, 96);
|
||||
@@ -124,9 +125,9 @@ void ReplaceConductorDialog::setProperties(const ConductorProperties &properties
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ReplaceConductorDialog::properties
|
||||
* @return the properties edited by this widget
|
||||
*/
|
||||
@brief ReplaceConductorDialog::properties
|
||||
@return the properties edited by this widget
|
||||
*/
|
||||
ConductorProperties ReplaceConductorDialog::properties() const
|
||||
{
|
||||
ConductorProperties properties_;
|
||||
@@ -158,37 +159,66 @@ ConductorProperties ReplaceConductorDialog::properties() const
|
||||
}
|
||||
properties_.verti_rotate_text = ui->m_vertical_angle_sb->value();
|
||||
properties_.horiz_rotate_text = ui->m_horizontal_angle_sb->value();
|
||||
properties_.color = ui->m_mod_color_cb->isChecked() ? ui->m_color_pb->palette().color(QPalette::Button) : QColor();
|
||||
properties_.style = ui->m_line_style_cb->itemData(ui->m_line_style_cb->currentIndex()).value<QPen>().style();
|
||||
properties_.color = ui->m_mod_color_cb->isChecked()
|
||||
? ui->m_color_pb->palette().color(QPalette::Button)
|
||||
: QColor();
|
||||
properties_.style = ui->m_line_style_cb->itemData(
|
||||
ui->m_line_style_cb->currentIndex())
|
||||
.value<QPen>()
|
||||
.style();
|
||||
properties_.cond_size = ui->m_cond_size_sb->value();
|
||||
properties_.m_bicolor = ui->m_second_color_gb->isChecked();
|
||||
properties_.m_color_2 = ui->m_mod_color_2_cb->isChecked() ? ui->m_color_2_pb->palette().color(QPalette::Button) : QColor();
|
||||
properties_.m_color_2 = ui->m_mod_color_2_cb->isChecked()
|
||||
? ui->m_color_2_pb->palette().color(QPalette::Button)
|
||||
: QColor();
|
||||
properties_.m_dash_size = ui->m_color_2_dash_size_sb->value();
|
||||
|
||||
properties_.singleLineProperties.hasGround = ui->m_earth_cb->isChecked();
|
||||
properties_.singleLineProperties.hasNeutral = ui->m_neutral_cb->isChecked();
|
||||
properties_.singleLineProperties.is_pen = ui->m_pen_cb->isChecked();
|
||||
properties_.singleLineProperties.setPhasesCount(ui->m_phase_cb->isChecked() ? ui->m_phase_sb->value() : 0);
|
||||
properties_.singleLineProperties.hasGround =
|
||||
ui->m_earth_cb->isChecked();
|
||||
properties_.singleLineProperties.hasNeutral =
|
||||
ui->m_neutral_cb->isChecked();
|
||||
properties_.singleLineProperties.is_pen =
|
||||
ui->m_pen_cb->isChecked();
|
||||
properties_.singleLineProperties.setPhasesCount(
|
||||
ui->m_phase_cb->isChecked()
|
||||
? ui->m_phase_sb->value()
|
||||
: 0);
|
||||
|
||||
return properties_;
|
||||
}
|
||||
|
||||
void ReplaceConductorDialog::initWidget()
|
||||
{
|
||||
connect(ui->m_button_box, &QDialogButtonBox::clicked, [this](QAbstractButton *button_) {
|
||||
connect(ui->m_button_box, &QDialogButtonBox::clicked,
|
||||
[this](QAbstractButton *button_) {
|
||||
this->done(ui->m_button_box->buttonRole(button_));
|
||||
});
|
||||
|
||||
ui->m_update_preview_pb->setHidden(true);
|
||||
|
||||
ui->m_line_style_cb->addItem(tr("Ne pas modifier"), QPen(Qt::NoPen));
|
||||
ui->m_line_style_cb->addItem(tr("Trait plein", "conductor style: solid line"), QPen(Qt::SolidLine));
|
||||
ui->m_line_style_cb->addItem(tr("Trait en pointillés", "conductor style: dashed line"), QPen(Qt::DashLine));
|
||||
ui->m_line_style_cb->addItem(tr("Traits et points", "conductor style: dashed and dotted line"), QPen(Qt::DashDotLine));
|
||||
ui->m_line_style_cb->addItem(tr("Trait plein",
|
||||
"conductor style: solid line"),
|
||||
QPen(Qt::SolidLine));
|
||||
ui->m_line_style_cb->addItem(tr("Trait en pointillés",
|
||||
"conductor style: dashed line"),
|
||||
QPen(Qt::DashLine));
|
||||
ui->m_line_style_cb->addItem(tr("Traits et points",
|
||||
"conductor style: dashed and dotted line"),
|
||||
QPen(Qt::DashDotLine));
|
||||
|
||||
connect(ui->m_multi_gb, &QGroupBox::toggled, [this](bool toggle) {this->ui->m_singlewire_gb->setChecked(!toggle);});
|
||||
connect(ui->m_singlewire_gb, &QGroupBox::toggled, [this](bool toggle) {this->ui->m_multi_gb->setChecked(!toggle);});
|
||||
connect(ui->m_formula_le, &QLineEdit::textChanged, [this](QString text) {this->ui->m_text_le->setEnabled(text.isEmpty());});
|
||||
connect(ui->m_multi_gb,
|
||||
&QGroupBox::toggled,
|
||||
[this](bool toggle)
|
||||
{this->ui->m_singlewire_gb->setChecked(!toggle);});
|
||||
connect(ui->m_singlewire_gb,
|
||||
&QGroupBox::toggled,
|
||||
[this](bool toggle)
|
||||
{this->ui->m_multi_gb->setChecked(!toggle);});
|
||||
connect(ui->m_formula_le,
|
||||
&QLineEdit::textChanged,
|
||||
[this](QString text)
|
||||
{this->ui->m_text_le->setEnabled(text.isEmpty());});
|
||||
ui->m_multi_gb->setChecked(true);
|
||||
ui->m_singlewire_gb->setChecked(true);
|
||||
}
|
||||
@@ -197,50 +227,75 @@ void ReplaceConductorDialog::setColorButton(const QColor &color)
|
||||
{
|
||||
QPalette palette;
|
||||
palette.setColor(QPalette::Button, color);
|
||||
ui->m_color_pb->setStyleSheet(QString("background-color: %1; min-height: 1.5em; border-style: outset; border-width: 2px; border-color: gray; border-radius: 4px;").arg(color.name()));
|
||||
ui->m_color_pb->setStyleSheet(
|
||||
QString("background-color: %1; min-height: 1.5em; border-style:"
|
||||
" outset; border-width: 2px; border-color: gray;"
|
||||
" border-radius: 4px;").arg(color.name()));
|
||||
}
|
||||
|
||||
void ReplaceConductorDialog::setColorButton2(const QColor &color)
|
||||
{
|
||||
QPalette palette;
|
||||
palette.setColor(QPalette::Button, color);
|
||||
ui->m_color_2_pb->setStyleSheet(QString("background-color: %1; min-height: 1.5em; border-style: outset; border-width: 2px; border-color: gray; border-radius: 4px;").arg(color.name()));
|
||||
ui->m_color_2_pb->setStyleSheet(
|
||||
QString("background-color: %1;"
|
||||
" min-height: 1.5em; border-style:"
|
||||
" outset; border-width: 2px;"
|
||||
" border-color: gray;"
|
||||
" border-radius: 4px;").arg(
|
||||
color.name()));
|
||||
}
|
||||
|
||||
void ReplaceConductorDialog::on_m_erase_formula_cb_clicked()
|
||||
{
|
||||
ui->m_formula_le->setText(ui->m_erase_formula_cb->isChecked() ? SearchAndReplaceWorker::eraseText() : QString());
|
||||
ui->m_formula_le->setText(ui->m_erase_formula_cb->isChecked()
|
||||
? SearchAndReplaceWorker::eraseText()
|
||||
: QString());
|
||||
ui->m_formula_le->setDisabled(ui->m_erase_formula_cb->isChecked());
|
||||
}
|
||||
|
||||
void ReplaceConductorDialog::on_m_erase_text_cb_clicked()
|
||||
{
|
||||
ui->m_text_le->setText(ui->m_erase_text_cb->isChecked() ? SearchAndReplaceWorker::eraseText() : QString());
|
||||
ui->m_text_le->setText(ui->m_erase_text_cb->isChecked()
|
||||
? SearchAndReplaceWorker::eraseText()
|
||||
: QString());
|
||||
ui->m_text_le->setDisabled(ui->m_erase_text_cb->isChecked());
|
||||
}
|
||||
|
||||
void ReplaceConductorDialog::on_m_erase_function_cb_clicked()
|
||||
{
|
||||
ui->m_function_le->setText(ui->m_erase_function_cb->isChecked() ? SearchAndReplaceWorker::eraseText() : QString());
|
||||
ui->m_function_le->setText(ui->m_erase_function_cb->isChecked()
|
||||
? SearchAndReplaceWorker::eraseText()
|
||||
: QString());
|
||||
ui->m_function_le->setDisabled(ui->m_erase_function_cb->isChecked());
|
||||
}
|
||||
|
||||
void ReplaceConductorDialog::on_m_erase_tension_protocol_cb_clicked()
|
||||
{
|
||||
ui->m_tension_protocol_le->setText(ui->m_erase_tension_protocol_cb->isChecked() ? SearchAndReplaceWorker::eraseText() : QString());
|
||||
ui->m_tension_protocol_le->setDisabled(ui->m_erase_tension_protocol_cb->isChecked());
|
||||
ui->m_tension_protocol_le->setText(
|
||||
ui->m_erase_tension_protocol_cb->isChecked()
|
||||
? SearchAndReplaceWorker::eraseText()
|
||||
: QString());
|
||||
ui->m_tension_protocol_le->setDisabled(
|
||||
ui->m_erase_tension_protocol_cb->isChecked());
|
||||
}
|
||||
|
||||
void ReplaceConductorDialog::on_m_erase_m_wire_color_cb_clicked()
|
||||
{
|
||||
ui->m_wire_color_le->setText(ui->m_erase_wire_color_cb->isChecked() ? SearchAndReplaceWorker::eraseText() : QString());
|
||||
ui->m_wire_color_le->setDisabled(ui->m_erase_wire_color_cb->isChecked());
|
||||
ui->m_wire_color_le->setText(ui->m_erase_wire_color_cb->isChecked()
|
||||
? SearchAndReplaceWorker::eraseText()
|
||||
: QString());
|
||||
ui->m_wire_color_le->setDisabled(
|
||||
ui->m_erase_wire_color_cb->isChecked());
|
||||
}
|
||||
|
||||
void ReplaceConductorDialog::on_m_erase_m_wire_section_cb_clicked()
|
||||
{
|
||||
ui->m_wire_section_le->setText(ui->m_erase_wire_section_cb->isChecked() ? SearchAndReplaceWorker::eraseText() : QString());
|
||||
ui->m_wire_section_le->setDisabled(ui->m_erase_wire_section_cb->isChecked());
|
||||
ui->m_wire_section_le->setText(ui->m_erase_wire_section_cb->isChecked()
|
||||
? SearchAndReplaceWorker::eraseText()
|
||||
: QString());
|
||||
ui->m_wire_section_le->setDisabled(
|
||||
ui->m_erase_wire_section_cb->isChecked());
|
||||
}
|
||||
|
||||
void ReplaceConductorDialog::on_m_earth_cb_toggled(bool checked)
|
||||
@@ -262,7 +317,7 @@ void ReplaceConductorDialog::on_m_neutral_cb_toggled(bool checked)
|
||||
}
|
||||
|
||||
void ReplaceConductorDialog::on_m_update_preview_pb_clicked() {
|
||||
updatePreview();
|
||||
updatePreview();
|
||||
}
|
||||
|
||||
void ReplaceConductorDialog::on_m_color_pb_clicked()
|
||||
|
||||
@@ -27,9 +27,9 @@ namespace Ui {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief The ReplaceConductorDialog class
|
||||
* A Qdialog to edit a conductor properties, use for the search and replace feature of QElectrotech.
|
||||
*/
|
||||
@brief The ReplaceConductorDialog class
|
||||
A Qdialog to edit a conductor properties, use for the search and replace feature of QElectrotech.
|
||||
*/
|
||||
class ReplaceConductorDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -39,10 +39,10 @@ ReplaceElementDialog::~ReplaceElementDialog()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ReplaceElementDialog::setContext
|
||||
* Set the current diagram context to be edited
|
||||
* @param context
|
||||
*/
|
||||
@brief ReplaceElementDialog::setContext
|
||||
Set the current diagram context to be edited
|
||||
@param context
|
||||
*/
|
||||
void ReplaceElementDialog::setContext(DiagramContext context)
|
||||
{
|
||||
m_context = context;
|
||||
@@ -53,9 +53,9 @@ void ReplaceElementDialog::setContext(DiagramContext context)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ReplaceElementDialog::context
|
||||
* @return The edited diagram context
|
||||
*/
|
||||
@brief ReplaceElementDialog::context
|
||||
@return The edited diagram context
|
||||
*/
|
||||
DiagramContext ReplaceElementDialog::context() const
|
||||
{
|
||||
DiagramContext context;
|
||||
|
||||
@@ -39,9 +39,9 @@ ReplaceFolioWidget::~ReplaceFolioWidget()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ReplaceFolioWidget::titleBlockProperties
|
||||
* @return the title block properties edited by this widget
|
||||
*/
|
||||
@brief ReplaceFolioWidget::titleBlockProperties
|
||||
@return the title block properties edited by this widget
|
||||
*/
|
||||
TitleBlockProperties ReplaceFolioWidget::titleBlockProperties() const
|
||||
{
|
||||
TitleBlockProperties prop;
|
||||
@@ -71,11 +71,12 @@ TitleBlockProperties ReplaceFolioWidget::titleBlockProperties() const
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ReplaceFolioWidget::setTitleBlockProperties
|
||||
* Set the title block properties edited by this widget
|
||||
* @param properties
|
||||
*/
|
||||
void ReplaceFolioWidget::setTitleBlockProperties(const TitleBlockProperties &properties)
|
||||
@brief ReplaceFolioWidget::setTitleBlockProperties
|
||||
Set the title block properties edited by this widget
|
||||
@param properties
|
||||
*/
|
||||
void ReplaceFolioWidget::setTitleBlockProperties(
|
||||
const TitleBlockProperties &properties)
|
||||
{
|
||||
sarw::setupLineEdit(ui->m_title_le, ui->m_title_cb, properties.title);
|
||||
sarw::setupLineEdit(ui->m_author_le, ui->m_author_cb, properties.author);
|
||||
@@ -118,9 +119,15 @@ ReplaceFolioDialog::ReplaceFolioDialog(QWidget *parent) :
|
||||
{
|
||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||
layout->addWidget(m_widget = new ReplaceFolioWidget(this));
|
||||
layout->addWidget(m_button_box = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Reset, this));
|
||||
layout->addWidget(m_button_box = new QDialogButtonBox(
|
||||
QDialogButtonBox::Ok
|
||||
| QDialogButtonBox::Cancel
|
||||
| QDialogButtonBox::Reset,
|
||||
this));
|
||||
|
||||
connect(m_button_box, &QDialogButtonBox::clicked, [this](QAbstractButton *button_)
|
||||
connect(m_button_box,
|
||||
&QDialogButtonBox::clicked,
|
||||
[this](QAbstractButton *button_)
|
||||
{
|
||||
this->done(m_button_box->buttonRole(button_));
|
||||
});
|
||||
@@ -130,51 +137,66 @@ ReplaceFolioDialog::~ReplaceFolioDialog()
|
||||
{}
|
||||
|
||||
/**
|
||||
* @brief ReplaceFolioDialog::titleBlockProperties
|
||||
* @return The title block properties edited by this dialog
|
||||
*/
|
||||
@brief ReplaceFolioDialog::titleBlockProperties
|
||||
@return The title block properties edited by this dialog
|
||||
*/
|
||||
TitleBlockProperties ReplaceFolioDialog::titleBlockProperties() const {
|
||||
return m_widget->titleBlockProperties();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ReplaceFolioDialog::setTitleBlockProperties
|
||||
* @param properties : set the title block properties edited by this dialog
|
||||
*/
|
||||
void ReplaceFolioDialog::setTitleBlockProperties(const TitleBlockProperties &properties) {
|
||||
@brief ReplaceFolioDialog::setTitleBlockProperties
|
||||
@param properties : set the title block properties edited by this dialog
|
||||
*/
|
||||
void ReplaceFolioDialog::setTitleBlockProperties(
|
||||
const TitleBlockProperties &properties) {
|
||||
m_widget->setTitleBlockProperties(properties);
|
||||
}
|
||||
void ReplaceFolioWidget::on_m_title_cb_clicked() {
|
||||
ui->m_title_le->setText(ui->m_title_cb->isChecked() ? SearchAndReplaceWorker::eraseText() : QString());
|
||||
ui->m_title_le->setText(ui->m_title_cb->isChecked()
|
||||
? SearchAndReplaceWorker::eraseText()
|
||||
: QString());
|
||||
ui->m_title_le->setDisabled(ui->m_title_cb->isChecked());
|
||||
}
|
||||
|
||||
void ReplaceFolioWidget::on_m_author_cb_clicked() {
|
||||
ui->m_author_le->setText(ui->m_author_cb->isChecked() ? SearchAndReplaceWorker::eraseText() : QString());
|
||||
ui->m_author_le->setText(ui->m_author_cb->isChecked()
|
||||
? SearchAndReplaceWorker::eraseText()
|
||||
: QString());
|
||||
ui->m_author_le->setDisabled(ui->m_author_cb->isChecked());
|
||||
}
|
||||
|
||||
void ReplaceFolioWidget::on_m_file_cb_clicked() {
|
||||
ui->m_file_le->setText(ui->m_file_cb->isChecked() ? SearchAndReplaceWorker::eraseText() : QString());
|
||||
ui->m_file_le->setText(ui->m_file_cb->isChecked()
|
||||
? SearchAndReplaceWorker::eraseText()
|
||||
: QString());
|
||||
ui->m_file_le->setDisabled(ui->m_file_cb->isChecked());
|
||||
}
|
||||
|
||||
void ReplaceFolioWidget::on_m_folio_cb_clicked() {
|
||||
ui->m_folio_le->setText(ui->m_folio_cb->isChecked() ? SearchAndReplaceWorker::eraseText() : QString());
|
||||
ui->m_folio_le->setText(ui->m_folio_cb->isChecked()
|
||||
? SearchAndReplaceWorker::eraseText()
|
||||
: QString());
|
||||
ui->m_folio_le->setDisabled(ui->m_folio_cb->isChecked());
|
||||
}
|
||||
|
||||
void ReplaceFolioWidget::on_m_plant_cb_clicked() {
|
||||
ui->m_plant->setText(ui->m_plant_cb->isChecked() ? SearchAndReplaceWorker::eraseText() : QString());
|
||||
ui->m_plant->setText(ui->m_plant_cb->isChecked()
|
||||
? SearchAndReplaceWorker::eraseText()
|
||||
: QString());
|
||||
ui->m_plant->setDisabled(ui->m_plant_cb->isChecked());
|
||||
}
|
||||
|
||||
void ReplaceFolioWidget::on_m_loc_cb_clicked() {
|
||||
ui->m_loc->setText(ui->m_loc_cb->isChecked() ? SearchAndReplaceWorker::eraseText() : QString());
|
||||
ui->m_loc->setText(ui->m_loc_cb->isChecked()
|
||||
? SearchAndReplaceWorker::eraseText()
|
||||
: QString());
|
||||
ui->m_loc->setDisabled(ui->m_loc_cb->isChecked());
|
||||
}
|
||||
|
||||
void ReplaceFolioWidget::on_m_indice_cb_clicked() {
|
||||
ui->m_indice->setText(ui->m_indice_cb->isChecked() ? SearchAndReplaceWorker::eraseText() : QString());
|
||||
ui->m_indice->setText(ui->m_indice_cb->isChecked()
|
||||
? SearchAndReplaceWorker::eraseText()
|
||||
: QString());
|
||||
ui->m_indice->setDisabled(ui->m_indice_cb->isChecked());
|
||||
}
|
||||
|
||||
@@ -36,18 +36,25 @@
|
||||
#include <QSettings>
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWidget::SearchAndReplaceWidget
|
||||
* Constructor
|
||||
* @param parent
|
||||
*/
|
||||
@brief SearchAndReplaceWidget::SearchAndReplaceWidget
|
||||
Constructor
|
||||
@param parent
|
||||
*/
|
||||
SearchAndReplaceWidget::SearchAndReplaceWidget(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::SearchAndReplaceWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
m_horizontal_animation = new QWidgetAnimation(ui->m_advanced_button_widget, Qt::Horizontal, QWidgetAnimation::minimumSizeHint, 250);
|
||||
m_vertical_animation = new QWidgetAnimation(ui->m_advanced_widget, Qt::Vertical, QWidgetAnimation::availableSpace, 250);
|
||||
m_horizontal_animation = new QWidgetAnimation(
|
||||
ui->m_advanced_button_widget,
|
||||
Qt::Horizontal,
|
||||
QWidgetAnimation::minimumSizeHint,
|
||||
250);
|
||||
m_vertical_animation = new QWidgetAnimation(
|
||||
ui->m_advanced_widget,
|
||||
Qt::Vertical,
|
||||
QWidgetAnimation::availableSpace, 250);
|
||||
QVector<QWidget *> v;
|
||||
v << ui->m_header_widget;
|
||||
m_vertical_animation->widgetToSubtract(v);
|
||||
@@ -55,24 +62,25 @@ SearchAndReplaceWidget::SearchAndReplaceWidget(QWidget *parent) :
|
||||
setHideAdvanced(true);
|
||||
setUpTreeItems();
|
||||
|
||||
connect(ui->m_search_le, &QLineEdit::textEdited, this, &SearchAndReplaceWidget::search);
|
||||
connect(ui->m_search_le, &QLineEdit::textEdited,
|
||||
this, &SearchAndReplaceWidget::search);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWidget::~SearchAndReplaceWidget
|
||||
* Destructor
|
||||
*/
|
||||
@brief SearchAndReplaceWidget::~SearchAndReplaceWidget
|
||||
Destructor
|
||||
*/
|
||||
SearchAndReplaceWidget::~SearchAndReplaceWidget() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWidget::event
|
||||
* Reimplemented to clear the the lines edit and hide
|
||||
* the advanced widgets, when this widget become hidden
|
||||
* @param event
|
||||
* @return
|
||||
*/
|
||||
@brief SearchAndReplaceWidget::event
|
||||
Reimplemented to clear the the lines edit and hide
|
||||
the advanced widgets, when this widget become hidden
|
||||
@param event
|
||||
@return
|
||||
*/
|
||||
bool SearchAndReplaceWidget::event(QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::Hide)
|
||||
@@ -95,13 +103,14 @@ bool SearchAndReplaceWidget::event(QEvent *event)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWidget::clear
|
||||
* Clear the content of the search and replace line edit
|
||||
* Clear all tree items in the tree widget (except the category items).
|
||||
*/
|
||||
@brief SearchAndReplaceWidget::clear
|
||||
Clear the content of the search and replace line edit
|
||||
Clear all tree items in the tree widget (except the category items).
|
||||
*/
|
||||
void SearchAndReplaceWidget::clear()
|
||||
{
|
||||
disconnect(ui->m_tree_widget, &QTreeWidget::itemChanged, this, &SearchAndReplaceWidget::itemChanged);
|
||||
disconnect(ui->m_tree_widget, &QTreeWidget::itemChanged,
|
||||
this, &SearchAndReplaceWidget::itemChanged);
|
||||
|
||||
qDeleteAll(m_diagram_hash.keys());
|
||||
m_diagram_hash.clear();
|
||||
@@ -128,18 +137,18 @@ void SearchAndReplaceWidget::clear()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWidget::setEditor
|
||||
* Set the diagram editor of this widget
|
||||
* @param editor
|
||||
*/
|
||||
@brief SearchAndReplaceWidget::setEditor
|
||||
Set the diagram editor of this widget
|
||||
@param editor
|
||||
*/
|
||||
void SearchAndReplaceWidget::setEditor(QETDiagramEditor *editor) {
|
||||
m_editor = editor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWidget::setUpTreeItems
|
||||
* Set up the main tree widget items
|
||||
*/
|
||||
@brief SearchAndReplaceWidget::setUpTreeItems
|
||||
Set up the main tree widget items
|
||||
*/
|
||||
void SearchAndReplaceWidget::setUpTreeItems()
|
||||
{
|
||||
m_root_qtwi = new QTreeWidgetItem(ui->m_tree_widget);
|
||||
@@ -207,10 +216,10 @@ void SearchAndReplaceWidget::setUpTreeItems()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWidget::setHideAdvanced
|
||||
* Hide advanced widgets
|
||||
* @param hide
|
||||
*/
|
||||
@brief SearchAndReplaceWidget::setHideAdvanced
|
||||
Hide advanced widgets
|
||||
@param hide
|
||||
*/
|
||||
void SearchAndReplaceWidget::setHideAdvanced(bool hide)
|
||||
{
|
||||
m_vertical_animation->setHidden(hide);
|
||||
@@ -218,12 +227,13 @@ void SearchAndReplaceWidget::setHideAdvanced(bool hide)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWidget::fillItemsList
|
||||
* Fill the tree
|
||||
*/
|
||||
@brief SearchAndReplaceWidget::fillItemsList
|
||||
Fill the tree
|
||||
*/
|
||||
void SearchAndReplaceWidget::fillItemsList()
|
||||
{
|
||||
disconnect(ui->m_tree_widget, &QTreeWidget::itemChanged, this, &SearchAndReplaceWidget::itemChanged);
|
||||
disconnect(ui->m_tree_widget, &QTreeWidget::itemChanged,
|
||||
this, &SearchAndReplaceWidget::itemChanged);
|
||||
|
||||
qDeleteAll(m_element_hash.keys());
|
||||
m_element_hash.clear();
|
||||
@@ -235,7 +245,8 @@ void SearchAndReplaceWidget::fillItemsList()
|
||||
return;
|
||||
}
|
||||
ui->m_replace_all_pb->setEnabled(true);
|
||||
connect(project_, &QETProject::destroyed, this, &SearchAndReplaceWidget::on_m_reload_pb_clicked);
|
||||
connect(project_, &QETProject::destroyed, this,
|
||||
&SearchAndReplaceWidget::on_m_reload_pb_clicked);
|
||||
|
||||
|
||||
DiagramContent dc;
|
||||
@@ -263,8 +274,8 @@ void SearchAndReplaceWidget::fillItemsList()
|
||||
for (Element *elmt : dc.m_elements)
|
||||
addElement(elmt);
|
||||
|
||||
//Sort child of each "element type" tree item.
|
||||
//we hide, "element type" tree item, if they do not have children
|
||||
//Sort child of each "element type" tree item.
|
||||
//we hide, "element type" tree item, if they do not have children
|
||||
for(QTreeWidgetItem *qtwi : m_qtwi_elmts)
|
||||
{
|
||||
qtwi->sortChildren(0, Qt::AscendingOrder);
|
||||
@@ -292,14 +303,15 @@ void SearchAndReplaceWidget::fillItemsList()
|
||||
m_conductor_qtwi->sortChildren(0, Qt::AscendingOrder);
|
||||
|
||||
updateNextPreviousButtons();
|
||||
connect(ui->m_tree_widget, &QTreeWidget::itemChanged, this, &SearchAndReplaceWidget::itemChanged);
|
||||
connect(ui->m_tree_widget, &QTreeWidget::itemChanged,
|
||||
this, &SearchAndReplaceWidget::itemChanged);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWidget::addElement
|
||||
* Add a tree widget item for @element
|
||||
* @param element
|
||||
*/
|
||||
@brief SearchAndReplaceWidget::addElement
|
||||
Add a tree widget item for @element
|
||||
@param element
|
||||
*/
|
||||
void SearchAndReplaceWidget::addElement(Element *element)
|
||||
{
|
||||
QTreeWidgetItem *parent = m_elements_qtwi;
|
||||
@@ -341,9 +353,9 @@ void SearchAndReplaceWidget::addElement(Element *element)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWidget::search
|
||||
* Start the search
|
||||
*/
|
||||
@brief SearchAndReplaceWidget::search
|
||||
Start the search
|
||||
*/
|
||||
void SearchAndReplaceWidget::search()
|
||||
{
|
||||
QString str = ui->m_search_le->text();
|
||||
@@ -378,19 +390,25 @@ void SearchAndReplaceWidget::search()
|
||||
qtwi_list.append(m_conductor_hash.keys());
|
||||
for (QTreeWidgetItem *qtwi : qtwi_list)
|
||||
{
|
||||
QStringList list = qtwi->data(0, Qt::UserRole).toStringList();
|
||||
QStringList list = qtwi->data(0, Qt::UserRole)
|
||||
.toStringList();
|
||||
|
||||
if(ui->m_mode_cb->currentIndex() == 0)
|
||||
{
|
||||
//Contain string
|
||||
list = list.filter(str, ui->m_case_sensitive_cb->isChecked()? Qt::CaseSensitive : Qt::CaseInsensitive);
|
||||
list = list.filter(
|
||||
str,
|
||||
ui->m_case_sensitive_cb->isChecked()
|
||||
? Qt::CaseSensitive
|
||||
: Qt::CaseInsensitive);
|
||||
}
|
||||
else
|
||||
{
|
||||
//entire word
|
||||
QRegularExpression rx("\\b" + str + "\\b");
|
||||
if (!ui->m_case_sensitive_cb->isChecked()) {
|
||||
rx.setPatternOptions(QRegularExpression::CaseInsensitiveOption);
|
||||
rx.setPatternOptions(
|
||||
QRegularExpression::CaseInsensitiveOption);
|
||||
}
|
||||
list = list.filter(rx);
|
||||
}
|
||||
@@ -403,7 +421,9 @@ void SearchAndReplaceWidget::search()
|
||||
}
|
||||
|
||||
QPalette background = ui->m_search_le->palette();
|
||||
background.setColor(QPalette::Base, match ? QColor("#E0FFF0") : QColor("#FFE0EF"));
|
||||
background.setColor(QPalette::Base, match
|
||||
? QColor("#E0FFF0")
|
||||
: QColor("#FFE0EF"));
|
||||
ui->m_search_le->setPalette(background);
|
||||
|
||||
//Go to the first occurence
|
||||
@@ -413,12 +433,13 @@ void SearchAndReplaceWidget::search()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWidget::setVisibleAllParents
|
||||
* Set visible all parents of @item until the invisible root item
|
||||
* @param item
|
||||
* @param expend_parent
|
||||
*/
|
||||
void SearchAndReplaceWidget::setVisibleAllParents(QTreeWidgetItem *item, bool expend_parent)
|
||||
@brief SearchAndReplaceWidget::setVisibleAllParents
|
||||
Set visible all parents of @item until the invisible root item
|
||||
@param item
|
||||
@param expend_parent
|
||||
*/
|
||||
void SearchAndReplaceWidget::setVisibleAllParents(QTreeWidgetItem *item,
|
||||
bool expend_parent)
|
||||
{
|
||||
if (item->parent())
|
||||
{
|
||||
@@ -430,12 +451,16 @@ void SearchAndReplaceWidget::setVisibleAllParents(QTreeWidgetItem *item, bool ex
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWidget::nextItem
|
||||
* @param item : find the next item from @item, if @item is nullptr, start the search for the root of the tree
|
||||
* @param flags
|
||||
* @return the next item according to flag or nullptr if there is not a next item
|
||||
*/
|
||||
QTreeWidgetItem *SearchAndReplaceWidget::nextItem(QTreeWidgetItem *item, QTreeWidgetItemIterator::IteratorFlag flags) const
|
||||
@brief SearchAndReplaceWidget::nextItem
|
||||
@param item : find the next item from @item,
|
||||
if @item is nullptr, start the search for the root of the tree
|
||||
@param flags
|
||||
@return the next item according to flag
|
||||
or nullptr if there is not a next item
|
||||
*/
|
||||
QTreeWidgetItem *SearchAndReplaceWidget::nextItem(
|
||||
QTreeWidgetItem *item,
|
||||
QTreeWidgetItemIterator::IteratorFlag flags) const
|
||||
{
|
||||
QTreeWidgetItem *qtwi = item;
|
||||
if (!item) {
|
||||
@@ -459,12 +484,16 @@ QTreeWidgetItem *SearchAndReplaceWidget::nextItem(QTreeWidgetItem *item, QTreeWi
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWidget::previousItem
|
||||
* @param item : find the previous item from @item, if @item is nullptr, start the search for the root of the tree
|
||||
* @param flags
|
||||
* @return the previous item according to flag or nullptr if there is not a previous item
|
||||
*/
|
||||
QTreeWidgetItem *SearchAndReplaceWidget::previousItem(QTreeWidgetItem *item, QTreeWidgetItemIterator::IteratorFlag flags) const
|
||||
@brief SearchAndReplaceWidget::previousItem
|
||||
@param item : find the previous item from @item,
|
||||
if @item is nullptr, start the search for the root of the tree
|
||||
@param flags
|
||||
@return the previous item according to flag
|
||||
or nullptr if there is not a previous item
|
||||
*/
|
||||
QTreeWidgetItem *SearchAndReplaceWidget::previousItem(
|
||||
QTreeWidgetItem *item,
|
||||
QTreeWidgetItemIterator::IteratorFlag flags) const
|
||||
{
|
||||
QTreeWidgetItem *qtwi = item;
|
||||
if (!item) {
|
||||
@@ -488,10 +517,10 @@ QTreeWidgetItem *SearchAndReplaceWidget::previousItem(QTreeWidgetItem *item, QTr
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWidget::updateNextPreviousButtons
|
||||
* According to the current item, if there is a next or a previous item,
|
||||
* we enable/disable the buttons next/previous item.
|
||||
*/
|
||||
@brief SearchAndReplaceWidget::updateNextPreviousButtons
|
||||
According to the current item, if there is a next or a previous item,
|
||||
we enable/disable the buttons next/previous item.
|
||||
*/
|
||||
void SearchAndReplaceWidget::updateNextPreviousButtons()
|
||||
{
|
||||
QTreeWidgetItem *item_ = ui->m_tree_widget->currentItem();
|
||||
@@ -521,7 +550,8 @@ void SearchAndReplaceWidget::updateNextPreviousButtons()
|
||||
QTreeWidgetItem *previous_ = item_;
|
||||
do
|
||||
{
|
||||
previous_ = previousItem(previous_, QTreeWidgetItemIterator::NotHidden);
|
||||
previous_ = previousItem(previous_,
|
||||
QTreeWidgetItemIterator::NotHidden);
|
||||
if (!previous_)
|
||||
{
|
||||
ui->m_previous_pb->setDisabled(true);
|
||||
@@ -536,12 +566,12 @@ void SearchAndReplaceWidget::updateNextPreviousButtons()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWidget::itemChanged
|
||||
* Reimplemented from QTreeWidget.
|
||||
* Use to update the check state of items.
|
||||
* @param item
|
||||
* @param column
|
||||
*/
|
||||
@brief SearchAndReplaceWidget::itemChanged
|
||||
Reimplemented from QTreeWidget.
|
||||
Use to update the check state of items.
|
||||
@param item
|
||||
@param column
|
||||
*/
|
||||
void SearchAndReplaceWidget::itemChanged(QTreeWidgetItem *item, int column)
|
||||
{
|
||||
Q_UNUSED(column);
|
||||
@@ -554,12 +584,14 @@ void SearchAndReplaceWidget::itemChanged(QTreeWidgetItem *item, int column)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWidget::setChildCheckState
|
||||
* @param item : Parent of the items to be evaluated
|
||||
* @param check : check state
|
||||
* @param deep : if true, we evaluate every subchilds.
|
||||
*/
|
||||
void SearchAndReplaceWidget::setChildCheckState(QTreeWidgetItem *item, Qt::CheckState check, bool deep)
|
||||
@brief SearchAndReplaceWidget::setChildCheckState
|
||||
@param item : Parent of the items to be evaluated
|
||||
@param check : check state
|
||||
@param deep : if true, we evaluate every subchilds.
|
||||
*/
|
||||
void SearchAndReplaceWidget::setChildCheckState(QTreeWidgetItem *item,
|
||||
Qt::CheckState check,
|
||||
bool deep)
|
||||
{
|
||||
for (int i=0 ; i<item->childCount() ; ++i)
|
||||
{
|
||||
@@ -571,11 +603,13 @@ void SearchAndReplaceWidget::setChildCheckState(QTreeWidgetItem *item, Qt::Check
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWidget::updateParentCheckState
|
||||
* @param item : a child item of the parent to be evaluated.
|
||||
* @param all_parents : if true, we evaluate every parents, until the root item.
|
||||
*/
|
||||
void SearchAndReplaceWidget::updateParentCheckState(QTreeWidgetItem *item, bool all_parents)
|
||||
@brief SearchAndReplaceWidget::updateParentCheckState
|
||||
@param item : a child item of the parent to be evaluated.
|
||||
@param all_parents : if true, we evaluate every parents,
|
||||
until the root item.
|
||||
*/
|
||||
void SearchAndReplaceWidget::updateParentCheckState(QTreeWidgetItem *item,
|
||||
bool all_parents)
|
||||
{
|
||||
QTreeWidgetItem *parent = item->parent();
|
||||
|
||||
@@ -616,9 +650,9 @@ void SearchAndReplaceWidget::updateParentCheckState(QTreeWidgetItem *item, bool
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWidget::activateNextChecked
|
||||
* Activate the next checked (and visible) item
|
||||
*/
|
||||
@brief SearchAndReplaceWidget::activateNextChecked
|
||||
Activate the next checked (and visible) item
|
||||
*/
|
||||
void SearchAndReplaceWidget::activateNextChecked()
|
||||
{
|
||||
//Next button is disabled, so there is not a next item.
|
||||
@@ -627,14 +661,15 @@ void SearchAndReplaceWidget::activateNextChecked()
|
||||
|
||||
do {
|
||||
on_m_next_pb_clicked();
|
||||
} while ((ui->m_tree_widget->currentItem()->checkState(0) != Qt::Checked) &&
|
||||
ui->m_next_pb->isEnabled());
|
||||
} while ((ui->m_tree_widget->currentItem()->checkState(0)
|
||||
!= Qt::Checked
|
||||
) && ui->m_next_pb->isEnabled());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWidget::selectedDiagram
|
||||
* @return The list of visible and selected diagram in the tree widget
|
||||
*/
|
||||
@brief SearchAndReplaceWidget::selectedDiagram
|
||||
@return The list of visible and selected diagram in the tree widget
|
||||
*/
|
||||
QList<Diagram *> SearchAndReplaceWidget::selectedDiagram() const
|
||||
{
|
||||
QList <Diagram *> diagram_list;
|
||||
@@ -654,9 +689,9 @@ QList<Diagram *> SearchAndReplaceWidget::selectedDiagram() const
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWidget::selectedElement
|
||||
* @return The list of visible and selected element in the tree widget
|
||||
*/
|
||||
@brief SearchAndReplaceWidget::selectedElement
|
||||
@return The list of visible and selected element in the tree widget
|
||||
*/
|
||||
QList<Element *> SearchAndReplaceWidget::selectedElement() const
|
||||
{
|
||||
QList <Element *> element_list;
|
||||
@@ -676,9 +711,9 @@ QList<Element *> SearchAndReplaceWidget::selectedElement() const
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWidget::selectedConductor
|
||||
* @return The list of visible and selected conductor in the tree widget
|
||||
*/
|
||||
@brief SearchAndReplaceWidget::selectedConductor
|
||||
@return The list of visible and selected conductor in the tree widget
|
||||
*/
|
||||
QList<Conductor *> SearchAndReplaceWidget::selectedConductor() const
|
||||
{
|
||||
QList <Conductor *> conductor_list;
|
||||
@@ -698,9 +733,10 @@ QList<Conductor *> SearchAndReplaceWidget::selectedConductor() const
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWidget::selectedText
|
||||
* @return The list of visible and selected independant text in the tree widget
|
||||
*/
|
||||
@brief SearchAndReplaceWidget::selectedText
|
||||
@return The list of visible and selected independant text
|
||||
in the tree widget
|
||||
*/
|
||||
QList<IndependentTextItem *> SearchAndReplaceWidget::selectedText() const
|
||||
{
|
||||
QList <IndependentTextItem *> text_list;
|
||||
@@ -709,7 +745,8 @@ QList<IndependentTextItem *> SearchAndReplaceWidget::selectedText() const
|
||||
{
|
||||
if (!qtwi->isHidden() && qtwi->checkState(0) == Qt::Checked)
|
||||
{
|
||||
QPointer<IndependentTextItem> t = m_text_hash.value(qtwi);
|
||||
QPointer<IndependentTextItem> t =
|
||||
m_text_hash.value(qtwi);
|
||||
if (t) {
|
||||
text_list.append(t.data());
|
||||
}
|
||||
@@ -720,14 +757,15 @@ QList<IndependentTextItem *> SearchAndReplaceWidget::selectedText() const
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWidget::searchTerms
|
||||
* @param diagram
|
||||
* @return All QStrings use as terms for search.
|
||||
*/
|
||||
@brief SearchAndReplaceWidget::searchTerms
|
||||
@param diagram
|
||||
@return All QStrings use as terms for search.
|
||||
*/
|
||||
QStringList SearchAndReplaceWidget::searchTerms(Diagram *diagram)
|
||||
{
|
||||
QStringList list;
|
||||
TitleBlockProperties prop = diagram->border_and_titleblock.exportTitleBlock();
|
||||
TitleBlockProperties prop =
|
||||
diagram->border_and_titleblock.exportTitleBlock();
|
||||
list.append(prop.title);
|
||||
list.append(prop.author);
|
||||
list.append(prop.filename);
|
||||
@@ -744,10 +782,10 @@ QStringList SearchAndReplaceWidget::searchTerms(Diagram *diagram)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWidget::searchTerms
|
||||
* @param element
|
||||
* @return All QString use as terms for search
|
||||
*/
|
||||
@brief SearchAndReplaceWidget::searchTerms
|
||||
@param element
|
||||
@return All QString use as terms for search
|
||||
*/
|
||||
QStringList SearchAndReplaceWidget::searchTerms(Element *element)
|
||||
{
|
||||
QStringList list;
|
||||
@@ -762,7 +800,10 @@ QStringList SearchAndReplaceWidget::searchTerms(Element *element)
|
||||
|
||||
for (DynamicElementTextItem *deti : element->dynamicTextItems())
|
||||
{
|
||||
if (deti->textFrom() == DynamicElementTextItem::UserText || deti->textFrom() == DynamicElementTextItem::CompositeText) {
|
||||
if (deti->textFrom()
|
||||
== DynamicElementTextItem::UserText
|
||||
|| deti->textFrom()
|
||||
== DynamicElementTextItem::CompositeText) {
|
||||
list.append(deti->toPlainText());
|
||||
}
|
||||
}
|
||||
@@ -771,7 +812,10 @@ QStringList SearchAndReplaceWidget::searchTerms(Element *element)
|
||||
list.append(group->name());
|
||||
|
||||
for (DynamicElementTextItem *deti : group->texts()) {
|
||||
if (deti->textFrom() == DynamicElementTextItem::UserText || deti->textFrom() == DynamicElementTextItem::CompositeText) {
|
||||
if (deti->textFrom()
|
||||
== DynamicElementTextItem::UserText
|
||||
|| deti->textFrom()
|
||||
== DynamicElementTextItem::CompositeText) {
|
||||
list.append(deti->toPlainText());
|
||||
}
|
||||
}
|
||||
@@ -781,10 +825,10 @@ QStringList SearchAndReplaceWidget::searchTerms(Element *element)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWidget::searchTerms
|
||||
* @param conductor
|
||||
* @return all QString use as terms for search.
|
||||
*/
|
||||
@brief SearchAndReplaceWidget::searchTerms
|
||||
@param conductor
|
||||
@return all QString use as terms for search.
|
||||
*/
|
||||
QStringList SearchAndReplaceWidget::searchTerms(Conductor *conductor)
|
||||
{
|
||||
QStringList list;
|
||||
@@ -800,11 +844,13 @@ QStringList SearchAndReplaceWidget::searchTerms(Conductor *conductor)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWidget::on_m_quit_button_clicked
|
||||
*/
|
||||
@brief SearchAndReplaceWidget::on_m_quit_button_clicked
|
||||
*/
|
||||
void SearchAndReplaceWidget::on_m_quit_button_clicked()
|
||||
{
|
||||
if (auto animator = this->findChild<QWidgetAnimation *>("search and replace animator")) {
|
||||
if (auto animator =
|
||||
this->findChild<QWidgetAnimation *>(
|
||||
"search and replace animator")) {
|
||||
animator->setHidden(!this->isHidden());
|
||||
} else {
|
||||
this->setHidden(true);
|
||||
@@ -812,10 +858,12 @@ void SearchAndReplaceWidget::on_m_quit_button_clicked()
|
||||
}
|
||||
|
||||
void SearchAndReplaceWidget::on_m_advanced_pb_toggled(bool checked) {
|
||||
setHideAdvanced(!checked);
|
||||
setHideAdvanced(!checked);
|
||||
}
|
||||
|
||||
void SearchAndReplaceWidget::on_m_tree_widget_itemDoubleClicked(QTreeWidgetItem *item, int column)
|
||||
void SearchAndReplaceWidget::on_m_tree_widget_itemDoubleClicked(
|
||||
QTreeWidgetItem *item,
|
||||
int column)
|
||||
{
|
||||
Q_UNUSED(column)
|
||||
|
||||
@@ -868,7 +916,9 @@ void SearchAndReplaceWidget::on_m_reload_pb_clicked()
|
||||
m_root_qtwi->setExpanded(true);
|
||||
}
|
||||
|
||||
void SearchAndReplaceWidget::on_m_tree_widget_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous)
|
||||
void SearchAndReplaceWidget::on_m_tree_widget_currentItemChanged(
|
||||
QTreeWidgetItem *current,
|
||||
QTreeWidgetItem *previous)
|
||||
{
|
||||
Q_UNUSED(previous);
|
||||
|
||||
@@ -912,7 +962,8 @@ void SearchAndReplaceWidget::on_m_tree_widget_currentItemChanged(QTreeWidgetItem
|
||||
return;
|
||||
}
|
||||
|
||||
if (current->checkState(0) == Qt::Checked && !m_category_qtwi.contains(current)) {
|
||||
if (current->checkState(0) == Qt::Checked
|
||||
&& !m_category_qtwi.contains(current)) {
|
||||
ui->m_replace_pb->setEnabled(true);
|
||||
} else {
|
||||
ui->m_replace_pb->setDisabled(true);
|
||||
@@ -944,15 +995,20 @@ void SearchAndReplaceWidget::on_m_previous_pb_clicked()
|
||||
|
||||
do
|
||||
{
|
||||
item = previousItem(nullptr, QTreeWidgetItemIterator::NotHidden);
|
||||
item = previousItem(nullptr,
|
||||
QTreeWidgetItemIterator::NotHidden);
|
||||
if (item) {
|
||||
ui->m_tree_widget->setCurrentItem(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
//There is not a previous selected item, so the current item is m_root_qtwi but we know he must not be selected
|
||||
//we user click on the button 'next item'.
|
||||
//So we select the first selectable item by calling on_m_next_pb_clicked
|
||||
/* There is not a previous selected item,
|
||||
* so the current item is m_root_qtwi
|
||||
* but we know he must not be selected
|
||||
* we user click on the button 'next item'.
|
||||
* So we select the first selectable item
|
||||
* by calling on_m_next_pb_clicked
|
||||
*/
|
||||
on_m_next_pb_clicked();
|
||||
return;
|
||||
}
|
||||
@@ -976,7 +1032,8 @@ void SearchAndReplaceWidget::on_m_folio_pb_clicked()
|
||||
text.append(tr(" [édité]"));
|
||||
}
|
||||
ui->m_folio_pb->setText(text);
|
||||
m_worker.m_titleblock_properties = dialog->titleBlockProperties();
|
||||
m_worker.m_titleblock_properties =
|
||||
dialog->titleBlockProperties();
|
||||
}
|
||||
else if (result == QDialogButtonBox::ResetRole)
|
||||
{
|
||||
@@ -990,16 +1047,17 @@ void SearchAndReplaceWidget::on_m_folio_pb_clicked()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWidget::on_m_replace_pb_clicked
|
||||
* Replace the current selection
|
||||
*/
|
||||
@brief SearchAndReplaceWidget::on_m_replace_pb_clicked
|
||||
Replace the current selection
|
||||
*/
|
||||
void SearchAndReplaceWidget::on_m_replace_pb_clicked()
|
||||
{
|
||||
QTreeWidgetItem *qtwi = ui->m_tree_widget->currentItem();
|
||||
if(!qtwi) {
|
||||
return;
|
||||
}
|
||||
if (!m_category_qtwi.contains(qtwi) && qtwi->checkState(0) == Qt::Checked)
|
||||
if (!m_category_qtwi.contains(qtwi)
|
||||
&& qtwi->checkState(0) == Qt::Checked)
|
||||
{
|
||||
if (ui->m_folio_pb->text().endsWith(tr(" [édité]")) &&
|
||||
m_diagram_hash.keys().contains(qtwi))
|
||||
@@ -1021,7 +1079,8 @@ void SearchAndReplaceWidget::on_m_replace_pb_clicked()
|
||||
m_text_hash.keys().contains(qtwi))
|
||||
{
|
||||
m_worker.m_indi_text = ui->m_replace_le->text();
|
||||
QPointer<IndependentTextItem> t = m_text_hash.value(qtwi);
|
||||
QPointer<IndependentTextItem> t =
|
||||
m_text_hash.value(qtwi);
|
||||
if (t) {
|
||||
m_worker.replaceIndiText(t.data());
|
||||
}
|
||||
@@ -1046,28 +1105,32 @@ void SearchAndReplaceWidget::on_m_replace_pb_clicked()
|
||||
|
||||
if (m_diagram_hash.keys().contains(qtwi))
|
||||
{
|
||||
QPointer<Diagram> d = m_diagram_hash.value(qtwi);
|
||||
QPointer<Diagram> d =
|
||||
m_diagram_hash.value(qtwi);
|
||||
if (d) {
|
||||
dl.append(d.data());
|
||||
}
|
||||
}
|
||||
else if (m_element_hash.keys().contains(qtwi))
|
||||
{
|
||||
QPointer<Element> e = m_element_hash.value(qtwi);
|
||||
QPointer<Element> e =
|
||||
m_element_hash.value(qtwi);
|
||||
if (e) {
|
||||
el.append(e.data());
|
||||
}
|
||||
}
|
||||
else if (m_text_hash.keys().contains(qtwi))
|
||||
{
|
||||
QPointer<IndependentTextItem> t = m_text_hash.value(qtwi);
|
||||
QPointer<IndependentTextItem> t =
|
||||
m_text_hash.value(qtwi);
|
||||
if (t) {
|
||||
tl.append(t.data());
|
||||
}
|
||||
}
|
||||
else if (m_conductor_hash.keys().contains(qtwi))
|
||||
{
|
||||
QPointer<Conductor> c = m_conductor_hash.value(qtwi);
|
||||
QPointer<Conductor> c =
|
||||
m_conductor_hash.value(qtwi);
|
||||
if (c) {
|
||||
cl.append(c.data());
|
||||
}
|
||||
@@ -1082,9 +1145,9 @@ void SearchAndReplaceWidget::on_m_replace_pb_clicked()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWidget::on_m_replace_all_pb_clicked
|
||||
* Replace all checked item
|
||||
*/
|
||||
@brief SearchAndReplaceWidget::on_m_replace_all_pb_clicked
|
||||
Replace all checked item
|
||||
*/
|
||||
void SearchAndReplaceWidget::on_m_replace_all_pb_clicked()
|
||||
{
|
||||
if (ui->m_folio_pb->text().endsWith(tr(" [édité]"))) {
|
||||
@@ -1102,7 +1165,10 @@ void SearchAndReplaceWidget::on_m_replace_all_pb_clicked()
|
||||
}
|
||||
if (ui->m_advanced_replace_pb->text().endsWith(tr(" [édité]"))) {
|
||||
|
||||
m_worker.replaceAdvanced(selectedDiagram(), selectedElement(), selectedText(), selectedConductor());
|
||||
m_worker.replaceAdvanced(selectedDiagram(),
|
||||
selectedElement(),
|
||||
selectedText(),
|
||||
selectedConductor());
|
||||
}
|
||||
|
||||
//Change was made, we reload the panel
|
||||
@@ -1116,7 +1182,9 @@ void SearchAndReplaceWidget::on_m_replace_all_pb_clicked()
|
||||
|
||||
void SearchAndReplaceWidget::on_m_element_pb_clicked()
|
||||
{
|
||||
ReplaceElementDialog *dialog = new ReplaceElementDialog(m_worker.m_element_context, this);
|
||||
ReplaceElementDialog *dialog = new ReplaceElementDialog(
|
||||
m_worker.m_element_context,
|
||||
this);
|
||||
|
||||
int result = dialog->exec();
|
||||
if (result == QDialogButtonBox::AcceptRole)
|
||||
@@ -1140,10 +1208,10 @@ void SearchAndReplaceWidget::on_m_element_pb_clicked()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWidget::on_m_mode_cb_currentIndexChanged
|
||||
* Update the search when user change mode.
|
||||
* @param index
|
||||
*/
|
||||
@brief SearchAndReplaceWidget::on_m_mode_cb_currentIndexChanged
|
||||
Update the search when user change mode.
|
||||
@param index
|
||||
*/
|
||||
void SearchAndReplaceWidget::on_m_mode_cb_currentIndexChanged(int index)
|
||||
{
|
||||
Q_UNUSED(index);
|
||||
@@ -1151,10 +1219,10 @@ void SearchAndReplaceWidget::on_m_mode_cb_currentIndexChanged(int index)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWidget::on_m_case_sensitive_cb_stateChanged
|
||||
* Update the search when change the case sensitive
|
||||
* @param arg1
|
||||
*/
|
||||
@brief SearchAndReplaceWidget::on_m_case_sensitive_cb_stateChanged
|
||||
Update the search when change the case sensitive
|
||||
@param arg1
|
||||
*/
|
||||
void SearchAndReplaceWidget::on_m_case_sensitive_cb_stateChanged(int arg1)
|
||||
{
|
||||
Q_UNUSED(arg1);
|
||||
@@ -1162,12 +1230,14 @@ void SearchAndReplaceWidget::on_m_case_sensitive_cb_stateChanged(int arg1)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWidget::on_m_conductor_pb_clicked
|
||||
* Open a dialog to edit the condutor properties
|
||||
*/
|
||||
@brief SearchAndReplaceWidget::on_m_conductor_pb_clicked
|
||||
Open a dialog to edit the condutor properties
|
||||
*/
|
||||
void SearchAndReplaceWidget::on_m_conductor_pb_clicked()
|
||||
{
|
||||
ReplaceConductorDialog *dialog = new ReplaceConductorDialog(m_worker.m_conductor_properties, this);
|
||||
ReplaceConductorDialog *dialog = new ReplaceConductorDialog(
|
||||
m_worker.m_conductor_properties,
|
||||
this);
|
||||
int result = dialog->exec();
|
||||
|
||||
if (result == QDialogButtonBox::AcceptRole)
|
||||
@@ -1186,17 +1256,20 @@ void SearchAndReplaceWidget::on_m_conductor_pb_clicked()
|
||||
text.remove(tr(" [édité]"));
|
||||
}
|
||||
ui->m_conductor_pb->setText(text);
|
||||
m_worker.m_conductor_properties = m_worker.invalidConductorProperties();
|
||||
m_worker.m_conductor_properties =
|
||||
m_worker.invalidConductorProperties();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWidget::on_m_advanced_replace_pb_clicked
|
||||
* Open the advanced editor.
|
||||
*/
|
||||
@brief SearchAndReplaceWidget::on_m_advanced_replace_pb_clicked
|
||||
Open the advanced editor.
|
||||
*/
|
||||
void SearchAndReplaceWidget::on_m_advanced_replace_pb_clicked()
|
||||
{
|
||||
replaceAdvancedDialog *dialog = new replaceAdvancedDialog(m_worker.m_advanced_struct, this);
|
||||
replaceAdvancedDialog *dialog = new replaceAdvancedDialog(
|
||||
m_worker.m_advanced_struct,
|
||||
this);
|
||||
int result = dialog->exec();
|
||||
|
||||
if (result == QDialogButtonBox::AcceptRole)
|
||||
|
||||
@@ -53,13 +53,23 @@ class SearchAndReplaceWidget : public QWidget
|
||||
void addElement(Element *element);
|
||||
void search();
|
||||
|
||||
void setVisibleAllParents(QTreeWidgetItem *item, bool expend_parent = true);
|
||||
QTreeWidgetItem *nextItem(QTreeWidgetItem *item=nullptr, QTreeWidgetItemIterator::IteratorFlag flags = QTreeWidgetItemIterator::All) const;
|
||||
QTreeWidgetItem *previousItem(QTreeWidgetItem *item=nullptr, QTreeWidgetItemIterator::IteratorFlag flags = QTreeWidgetItemIterator::All) const;
|
||||
void setVisibleAllParents(QTreeWidgetItem *item,
|
||||
bool expend_parent = true);
|
||||
QTreeWidgetItem *nextItem(
|
||||
QTreeWidgetItem *item=nullptr,
|
||||
QTreeWidgetItemIterator::IteratorFlag flags
|
||||
= QTreeWidgetItemIterator::All) const;
|
||||
QTreeWidgetItem *previousItem(
|
||||
QTreeWidgetItem *item=nullptr,
|
||||
QTreeWidgetItemIterator::IteratorFlag flags
|
||||
= QTreeWidgetItemIterator::All) const;
|
||||
void updateNextPreviousButtons();
|
||||
void itemChanged(QTreeWidgetItem *item, int column);
|
||||
void setChildCheckState(QTreeWidgetItem *item, Qt::CheckState check, bool deep = true);
|
||||
void updateParentCheckState(QTreeWidgetItem *item, bool all_parents = true);
|
||||
void setChildCheckState(QTreeWidgetItem *item,
|
||||
Qt::CheckState check,
|
||||
bool deep = true);
|
||||
void updateParentCheckState(QTreeWidgetItem *item,
|
||||
bool all_parents = true);
|
||||
void activateNextChecked();
|
||||
QList<Diagram *> selectedDiagram() const;
|
||||
QList<Element *> selectedElement() const;
|
||||
@@ -74,9 +84,12 @@ class SearchAndReplaceWidget : public QWidget
|
||||
private slots:
|
||||
void on_m_quit_button_clicked();
|
||||
void on_m_advanced_pb_toggled(bool checked);
|
||||
void on_m_tree_widget_itemDoubleClicked(QTreeWidgetItem *item, int column);
|
||||
void on_m_tree_widget_itemDoubleClicked(QTreeWidgetItem *item,
|
||||
int column);
|
||||
void on_m_reload_pb_clicked();
|
||||
void on_m_tree_widget_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);
|
||||
void on_m_tree_widget_currentItemChanged(
|
||||
QTreeWidgetItem *current,
|
||||
QTreeWidgetItem *previous);
|
||||
void on_m_next_pb_clicked();
|
||||
void on_m_previous_pb_clicked();
|
||||
void on_m_folio_pb_clicked();
|
||||
@@ -104,7 +117,8 @@ class SearchAndReplaceWidget : public QWidget
|
||||
QList<QTreeWidgetItem *> m_qtwi_elmts;
|
||||
QList<QTreeWidgetItem *> m_category_qtwi;
|
||||
QHash<QTreeWidgetItem *, QPointer <Element>> m_element_hash;
|
||||
QHash<QTreeWidgetItem *, QPointer <IndependentTextItem>> m_text_hash;
|
||||
QHash<QTreeWidgetItem *,
|
||||
QPointer <IndependentTextItem>> m_text_hash;
|
||||
QHash<QTreeWidgetItem *, QPointer <Conductor>> m_conductor_hash;
|
||||
QPointer<Element> m_highlighted_element;
|
||||
QPointer<QGraphicsObject> m_last_selected;
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
namespace autonum
|
||||
{
|
||||
/**
|
||||
* @brief sequentialNumbers::sequentialNumbers
|
||||
*/
|
||||
@brief sequentialNumbers::sequentialNumbers
|
||||
*/
|
||||
sequentialNumbers::sequentialNumbers()
|
||||
{}
|
||||
|
||||
@@ -46,7 +46,8 @@ namespace autonum
|
||||
|
||||
sequentialNumbers::~sequentialNumbers() {}
|
||||
|
||||
sequentialNumbers &sequentialNumbers::operator=(const sequentialNumbers &other)
|
||||
sequentialNumbers &sequentialNumbers::operator=(
|
||||
const sequentialNumbers &other)
|
||||
{
|
||||
if (&other == this || other == *this)
|
||||
return (*this);
|
||||
@@ -83,37 +84,57 @@ namespace autonum
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief sequentialNumbers::toXml
|
||||
* export this sequential numbers into a QDomElement.
|
||||
* @param document : QDomDocument used to create the QDomElement
|
||||
* @param tag_name : the tag name used for the QDomElement.
|
||||
* @return A QDomElement, if this sequential have no value, the returned QDomELement is empty
|
||||
*/
|
||||
QDomElement sequentialNumbers::toXml(QDomDocument &document, const QString& tag_name) const
|
||||
@brief sequentialNumbers::toXml
|
||||
export this sequential numbers into a QDomElement.
|
||||
@param document : QDomDocument used to create the QDomElement
|
||||
@param tag_name : the tag name used for the QDomElement.
|
||||
@return A QDomElement, if this sequential have no value,
|
||||
the returned QDomELement is empty
|
||||
*/
|
||||
QDomElement sequentialNumbers::toXml(QDomDocument &document,
|
||||
const QString& tag_name) const
|
||||
{
|
||||
QDomElement element = document.createElement(tag_name);
|
||||
|
||||
if (!unit.isEmpty())
|
||||
element.appendChild(QETXML::textToDomElement(document, "unit", unit.join(";")));
|
||||
element.appendChild(QETXML::textToDomElement(
|
||||
document,
|
||||
"unit",
|
||||
unit.join(";")));
|
||||
if (!unit_folio.isEmpty())
|
||||
element.appendChild(QETXML::textToDomElement(document, "unitFolio", unit_folio.join(";")));
|
||||
element.appendChild(QETXML::textToDomElement(
|
||||
document,
|
||||
"unitFolio",
|
||||
unit_folio.join(";")));
|
||||
if(!ten.isEmpty())
|
||||
element.appendChild(QETXML::textToDomElement(document, "ten", ten.join(";")));
|
||||
element.appendChild(QETXML::textToDomElement(
|
||||
document,
|
||||
"ten",
|
||||
ten.join(";")));
|
||||
if(!ten_folio.isEmpty())
|
||||
element.appendChild(QETXML::textToDomElement(document, "tenFolio", ten_folio.join(";")));
|
||||
element.appendChild(QETXML::textToDomElement(
|
||||
document,
|
||||
"tenFolio",
|
||||
ten_folio.join(";")));
|
||||
if(!hundred.isEmpty())
|
||||
element.appendChild(QETXML::textToDomElement(document, "hundred", hundred.join(";")));
|
||||
element.appendChild(QETXML::textToDomElement(
|
||||
document,
|
||||
"hundred",
|
||||
hundred.join(";")));
|
||||
if(!hundred_folio.isEmpty())
|
||||
element.appendChild(QETXML::textToDomElement(document, "hundredFolio", hundred_folio.join(";")));
|
||||
element.appendChild(QETXML::textToDomElement(
|
||||
document,
|
||||
"hundredFolio",
|
||||
hundred_folio.join(";")));
|
||||
|
||||
return element;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief sequentialNumbers::fromXml
|
||||
* Import sequential values from a QDomElement
|
||||
* @param element
|
||||
*/
|
||||
@brief sequentialNumbers::fromXml
|
||||
Import sequential values from a QDomElement
|
||||
@param element
|
||||
*/
|
||||
void sequentialNumbers::fromXml(const QDomElement &element)
|
||||
{
|
||||
if (!element.hasChildNodes())
|
||||
@@ -152,29 +173,40 @@ namespace autonum
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief AssignVariables::formulaToLabel
|
||||
* Return the @formula with variable assigned (ready to be displayed)
|
||||
* @param formula - the formula to work
|
||||
* @param seqStruct - struct where is stocked int values (struct is passed as a reference and modified by this static method)
|
||||
* @param diagram - the diagram where occure the formula.
|
||||
* @param elmt - parent element (if any) of the formula
|
||||
* @return the string with variable assigned.
|
||||
*/
|
||||
QString AssignVariables::formulaToLabel(QString formula, sequentialNumbers &seqStruct, Diagram *diagram, const Element *elmt)
|
||||
@brief AssignVariables::formulaToLabel
|
||||
Return the @formula with variable assigned
|
||||
(ready to be displayed)
|
||||
@param formula - the formula to work
|
||||
@param seqStruct - struct where is stocked int values
|
||||
(struct is passed as a reference
|
||||
and modified by this static method)
|
||||
@param diagram - the diagram where occure the formula.
|
||||
@param elmt - parent element (if any) of the formula
|
||||
@return the string with variable assigned.
|
||||
*/
|
||||
QString AssignVariables::formulaToLabel(QString formula,
|
||||
sequentialNumbers &seqStruct,
|
||||
Diagram *diagram,
|
||||
const Element *elmt)
|
||||
{
|
||||
AssignVariables av(std::move(formula), seqStruct, diagram, elmt);
|
||||
AssignVariables av(std::move(formula),
|
||||
seqStruct,
|
||||
diagram,
|
||||
elmt);
|
||||
seqStruct = av.m_seq_struct;
|
||||
return av.m_assigned_label;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief AssignVariables::replaceVariable
|
||||
* Replace the variables in @formula in form %{my-var} to the corresponding value stored in @dc
|
||||
* @param formula
|
||||
* @param dc
|
||||
* @return
|
||||
*/
|
||||
QString AssignVariables::replaceVariable(const QString &formula, const DiagramContext &dc)
|
||||
@brief AssignVariables::replaceVariable
|
||||
Replace the variables in @formula in form %{my-var}
|
||||
to the corresponding value stored in dc
|
||||
@param formula
|
||||
@param dc
|
||||
@return
|
||||
*/
|
||||
QString AssignVariables::replaceVariable(const QString &formula,
|
||||
const DiagramContext &dc)
|
||||
{
|
||||
QString str = formula;
|
||||
str.replace("%{label}", dc.value("label").toString());
|
||||
@@ -183,13 +215,15 @@ namespace autonum
|
||||
str.replace("%{description}", dc.value("description").toString());
|
||||
str.replace("%{designation}", dc.value("designation").toString());
|
||||
str.replace("%{manufacturer}", dc.value("manufacturer").toString());
|
||||
str.replace("%{manufacturer_reference}", dc.value("manufacturer_reference").toString());
|
||||
str.replace("%{manufacturer_reference}",
|
||||
dc.value("manufacturer_reference").toString());
|
||||
str.replace("%{supplier}", dc.value("supplier").toString());
|
||||
str.replace("%{quantity}", dc.value("quantity").toString());
|
||||
str.replace("%{unity}", dc.value("unity").toString());
|
||||
str.replace("%{auxiliary1}", dc.value("auxiliary1").toString());
|
||||
str.replace("%{auxiliary2}", dc.value("auxiliary2").toString());
|
||||
str.replace("%{machine_manufacturer_reference}", dc.value("machine_manufacturer_reference").toString());
|
||||
str.replace("%{machine_manufacturer_reference}",
|
||||
dc.value("machine_manufacturer_reference").toString());
|
||||
str.replace("%{location}", dc.value("location").toString());
|
||||
str.replace("%{function}", dc.value("function").toString());
|
||||
str.replace("%{void}", QString());
|
||||
@@ -198,7 +232,10 @@ namespace autonum
|
||||
}
|
||||
|
||||
|
||||
AssignVariables::AssignVariables(const QString& formula, const sequentialNumbers& seqStruct , Diagram *diagram, const Element *elmt):
|
||||
AssignVariables::AssignVariables(const QString& formula,
|
||||
const sequentialNumbers& seqStruct,
|
||||
Diagram *diagram,
|
||||
const Element *elmt):
|
||||
m_diagram(diagram),
|
||||
m_arg_formula(formula),
|
||||
m_assigned_label(formula),
|
||||
@@ -208,14 +245,33 @@ namespace autonum
|
||||
{
|
||||
if (m_diagram)
|
||||
{
|
||||
m_assigned_label.replace("%F", m_diagram -> border_and_titleblock.folio());
|
||||
m_assigned_label.replace("%f", QString::number(m_diagram->folioIndex()+1));
|
||||
m_assigned_label.replace("%id", QString::number(m_diagram->folioIndex()+1));
|
||||
m_assigned_label.replace("%total", QString::number(m_diagram->border_and_titleblock.folioTotal()));
|
||||
m_assigned_label.replace("%M", m_diagram -> border_and_titleblock.plant());
|
||||
m_assigned_label.replace("%LM", m_diagram -> border_and_titleblock.locmach());
|
||||
m_assigned_label.replace("%F",
|
||||
m_diagram
|
||||
-> border_and_titleblock
|
||||
.folio());
|
||||
m_assigned_label.replace("%f",
|
||||
QString::number(
|
||||
m_diagram
|
||||
->folioIndex()+1));
|
||||
m_assigned_label.replace("%id",
|
||||
QString::number(
|
||||
m_diagram
|
||||
->folioIndex()+1));
|
||||
m_assigned_label.replace("%total",
|
||||
QString::number(
|
||||
m_diagram
|
||||
->border_and_titleblock
|
||||
.folioTotal()));
|
||||
m_assigned_label.replace("%M",
|
||||
m_diagram
|
||||
-> border_and_titleblock
|
||||
.plant());
|
||||
m_assigned_label.replace("%LM",
|
||||
m_diagram
|
||||
-> border_and_titleblock
|
||||
.locmach());
|
||||
|
||||
QSettings settings;
|
||||
QSettings settings;
|
||||
if (m_element)
|
||||
{
|
||||
if (settings.value("border-columns_0", true).toBool()){
|
||||
@@ -297,12 +353,13 @@ namespace autonum
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief setSequentialToList
|
||||
* Append all sequential of type @type owned by @context in list
|
||||
* @param list : list to have value inserted
|
||||
* @param context : numerotation context to retrieve value
|
||||
* @param type : type of sequential (unit, unitfolio, ten, tenfolio, hundred, hundredfolio)
|
||||
*/
|
||||
@brief setSequentialToList
|
||||
Append all sequential of type @type owned by @context in list
|
||||
@param list : list to have value inserted
|
||||
@param context : numerotation context to retrieve value
|
||||
@param type : type of sequential
|
||||
(unit, unitfolio, ten, tenfolio, hundred, hundredfolio)
|
||||
*/
|
||||
void setSequentialToList(QStringList &list, NumerotationContext &context, const QString& type)
|
||||
{
|
||||
for (int i = 0; i < context.size(); i++)
|
||||
@@ -321,12 +378,12 @@ namespace autonum
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief setFolioSequentialToHash
|
||||
* Insert all value of @list in @hash with key @autoNumName
|
||||
* @param list : list to get values from
|
||||
* @param hash : hash to have values inserted
|
||||
* @param autoNumName : name to use as key of hash
|
||||
*/
|
||||
@brief setFolioSequentialToHash
|
||||
Insert all value of @list in @hash with key @autoNumName
|
||||
@param list : list to get values from
|
||||
@param hash : hash to have values inserted
|
||||
@param autoNumName : name to use as key of hash
|
||||
*/
|
||||
void setFolioSequentialToHash(QStringList &list, QHash<QString, QStringList> &hash, const QString& autoNumName)
|
||||
{
|
||||
if (hash.isEmpty() || !hash.contains(autoNumName))
|
||||
@@ -355,15 +412,20 @@ namespace autonum
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief setSequential
|
||||
* Fill seqStruct
|
||||
* @param label : label of sequential to fill (%sequ_, %sequf_, %seqt_, ect....)
|
||||
* @param seqStruct : struct to fill
|
||||
* @param context : numerotation context use to know the current sequential num.
|
||||
* @param diagram : diagram where the sequential occur, notably use when label is folio type (%sequf_, %seqtf_, %seqhf_),
|
||||
* to keep up to date the current sequential of folio.
|
||||
* @param hashKey : the hash key used to store the sequential for folio type.
|
||||
*/
|
||||
@brief setSequential
|
||||
Fill seqStruct
|
||||
@param label : label of sequential to fill
|
||||
(%sequ_, %sequf_, %seqt_, ect....)
|
||||
@param seqStruct : struct to fill
|
||||
@param context : numerotation context use
|
||||
to know the current sequential num.
|
||||
@param diagram : diagram where the sequential occur,
|
||||
notably use when label is folio type
|
||||
(%sequf_, %seqtf_, %seqhf_),
|
||||
to keep up to date the current sequential of folio.
|
||||
@param hashKey :
|
||||
the hash key used to store the sequential for folio type.
|
||||
*/
|
||||
void setSequential(const QString& label, sequentialNumbers &seqStruct, NumerotationContext &context, Diagram *diagram, const QString& hashKey)
|
||||
{
|
||||
if (!context.isEmpty())
|
||||
@@ -399,10 +461,10 @@ namespace autonum
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief numerotationContextToFormula
|
||||
* @param nc
|
||||
* @return the numerotation context, converted to formula
|
||||
*/
|
||||
@brief numerotationContextToFormula
|
||||
@param nc
|
||||
@return the numerotation context, converted to formula
|
||||
*/
|
||||
QString numerotationContextToFormula(const NumerotationContext &nc)
|
||||
{
|
||||
QString type;
|
||||
@@ -476,11 +538,13 @@ namespace autonum
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief elementPrefixForLocation
|
||||
* @param location
|
||||
* @return the prefix for an element represented by location, prefix can be null.
|
||||
* Search for a prefix only if @location represent an element embedded in a project
|
||||
*/
|
||||
@brief elementPrefixForLocation
|
||||
@param location
|
||||
@return the prefix for an element represented by location,
|
||||
prefix can be null.
|
||||
Search for a prefix only if @location represent
|
||||
an element embedded in a project
|
||||
*/
|
||||
QString elementPrefixForLocation(const ElementsLocation &location)
|
||||
{
|
||||
if (!location.isProject())
|
||||
|
||||
@@ -55,10 +55,10 @@ namespace autonum
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief The AssignVariables class
|
||||
* This class assign variable of a formula string.
|
||||
* Return the final string used to be displayed from a formula string.
|
||||
*/
|
||||
@brief The AssignVariables class
|
||||
This class assign variable of a formula string.
|
||||
Return the final string used to be displayed from a formula string.
|
||||
*/
|
||||
class AssignVariables
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -21,32 +21,32 @@
|
||||
#include "qet.h"
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Constructor
|
||||
*/
|
||||
NumerotationContext::NumerotationContext(){
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor from xml
|
||||
*/
|
||||
Constructor from xml
|
||||
*/
|
||||
NumerotationContext::NumerotationContext(QDomElement &e) {
|
||||
fromXml(e);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NumerotationContext::clear, clear the content
|
||||
*/
|
||||
@brief NumerotationContext::clear, clear the content
|
||||
*/
|
||||
void NumerotationContext::clear () {
|
||||
content_.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NumerotationContext::addValue, add a new value on the contexte
|
||||
* @param type the type of value
|
||||
* @param value the value itself
|
||||
* @param increase the increase number of value
|
||||
* @return true if value is append
|
||||
*/
|
||||
@brief NumerotationContext::addValue, add a new value on the contexte
|
||||
@param type the type of value
|
||||
@param value the value itself
|
||||
@param increase the increase number of value
|
||||
@return true if value is append
|
||||
*/
|
||||
bool NumerotationContext::addValue(const QString &type, const QVariant &value, const int increase, const int initialvalue) {
|
||||
if (!keyIsAcceptable(type) && !value.canConvert(QVariant::String)) return false;
|
||||
if (keyIsNumber(type) && !value.canConvert(QVariant::Int)) return false;
|
||||
@@ -58,80 +58,80 @@ bool NumerotationContext::addValue(const QString &type, const QVariant &value, c
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NumerotationContext::operator []
|
||||
* @return the string at position @i
|
||||
*/
|
||||
@brief NumerotationContext::operator []
|
||||
@return the string at position @i
|
||||
*/
|
||||
QString NumerotationContext::operator [] (const int &i) const {
|
||||
return (content_.at(i));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NumerotationContext::operator << , append other
|
||||
*/
|
||||
@brief NumerotationContext::operator << , append other
|
||||
*/
|
||||
void NumerotationContext::operator << (const NumerotationContext &other) {
|
||||
for (int i=0; i<other.size(); ++i) content_.append(other[i]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NumerotationContext::size
|
||||
* @return size of context
|
||||
*/
|
||||
@brief NumerotationContext::size
|
||||
@return size of context
|
||||
*/
|
||||
int NumerotationContext::size() const {
|
||||
return (content_.size());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NumerotationContext::isEmpty
|
||||
* @return true if numerotation contet is empty
|
||||
*/
|
||||
@brief NumerotationContext::isEmpty
|
||||
@return true if numerotation contet is empty
|
||||
*/
|
||||
bool NumerotationContext::isEmpty() const {
|
||||
if (content_.size() > 0) return false;
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* @brief NumerotationContext::itemAt
|
||||
* @return the content at position @i 1:type 2:value 3:increase
|
||||
*/
|
||||
@brief NumerotationContext::itemAt
|
||||
@return the content at position @i 1:type 2:value 3:increase
|
||||
*/
|
||||
QStringList NumerotationContext::itemAt(const int i) const {
|
||||
return (content_.at(i).split("|"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief validRegExpNum
|
||||
* @return all type use to numerotation
|
||||
*/
|
||||
@brief validRegExpNum
|
||||
@return all type use to numerotation
|
||||
*/
|
||||
QString NumerotationContext::validRegExpNum () const {
|
||||
return ("unit|unitfolio|ten|tenfolio|hundred|hundredfolio|string|idfolio|folio|plant|locmach|elementline|elementcolumn|elementprefix");
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NumerotationContext::validRegExpNumber
|
||||
* @return all type represents a number
|
||||
*/
|
||||
@brief NumerotationContext::validRegExpNumber
|
||||
@return all type represents a number
|
||||
*/
|
||||
QString NumerotationContext::validRegExpNumber() const {
|
||||
return ("unit|unitfolio|ten|tenfolio|hundred|hundredfolio");
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NumerotationContext::keyIsAcceptable
|
||||
* @return true if @type is acceptable
|
||||
*/
|
||||
@brief NumerotationContext::keyIsAcceptable
|
||||
@return true if @type is acceptable
|
||||
*/
|
||||
bool NumerotationContext::keyIsAcceptable(const QString &type) const {
|
||||
return (type.contains(QRegExp(validRegExpNum())));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NumerotationContext::keyIsNumber
|
||||
* @return true if @type represent a number
|
||||
*/
|
||||
@brief NumerotationContext::keyIsNumber
|
||||
@return true if @type represent a number
|
||||
*/
|
||||
bool NumerotationContext::keyIsNumber(const QString &type) const {
|
||||
return (type.contains(QRegExp(validRegExpNumber())));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NumerotationContext::toXml
|
||||
* Save the numerotation context in a QDomElement under the element name @str
|
||||
*/
|
||||
@brief NumerotationContext::toXml
|
||||
Save the numerotation context in a QDomElement under the element name @str
|
||||
*/
|
||||
QDomElement NumerotationContext::toXml(QDomDocument &d, const QString& str) {
|
||||
QDomElement num_auto = d.createElement(str);
|
||||
for (int i=0; i<content_.size(); ++i) {
|
||||
@@ -151,20 +151,20 @@ QDomElement NumerotationContext::toXml(QDomDocument &d, const QString& str) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NumerotationContext::fromXml
|
||||
* load numerotation context from @e
|
||||
*/
|
||||
@brief NumerotationContext::fromXml
|
||||
load numerotation context from @e
|
||||
*/
|
||||
void NumerotationContext::fromXml(QDomElement &e) {
|
||||
clear();
|
||||
foreach(QDomElement qde, QET::findInDomElement(e, "part")) addValue(qde.attribute("type"), qde.attribute("value"), qde.attribute("increase").toInt(), qde.attribute("initialvalue").toInt());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NumerotationContext::replaceValue
|
||||
* This class replaces the current NC field value with content
|
||||
* @param index of NC Item
|
||||
* @param QString content to replace current value
|
||||
*/
|
||||
@brief NumerotationContext::replaceValue
|
||||
This class replaces the current NC field value with content
|
||||
@param index of NC Item
|
||||
@param QString content to replace current value
|
||||
*/
|
||||
void NumerotationContext::replaceValue(int index, QString content) {
|
||||
QString sep = "|";
|
||||
QString type = content_[index].split("|").at(0);
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
This class represents a numerotation context, i.e. the data (type, value, increase)
|
||||
of a numerotation at a given time. It is notably used by conductor
|
||||
to store the informations they need to do their autonumerotation.
|
||||
*/
|
||||
*/
|
||||
class NumerotationContext
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
#include "diagram.h"
|
||||
|
||||
/**
|
||||
* @brief Constructor
|
||||
*/
|
||||
@brief Constructor
|
||||
*/
|
||||
NumerotationContextCommands::NumerotationContextCommands(const NumerotationContext &nc, Diagram *d):
|
||||
diagram_ (d),
|
||||
context_ (nc),
|
||||
@@ -28,16 +28,16 @@ NumerotationContextCommands::NumerotationContextCommands(const NumerotationConte
|
||||
{}
|
||||
|
||||
/**
|
||||
* @brief Destructor
|
||||
*/
|
||||
@brief Destructor
|
||||
*/
|
||||
NumerotationContextCommands::~NumerotationContextCommands() {
|
||||
if (strategy_) delete strategy_;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NumerotationContextCommands::next
|
||||
* @return the next numerotation context
|
||||
*/
|
||||
@brief NumerotationContextCommands::next
|
||||
@return the next numerotation context
|
||||
*/
|
||||
NumerotationContext NumerotationContextCommands::next() {
|
||||
NumerotationContext contextnum;
|
||||
|
||||
@@ -50,9 +50,9 @@ NumerotationContext NumerotationContextCommands::next() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NumerotationContextCommands::previous
|
||||
* @return the previous numerotation context
|
||||
*/
|
||||
@brief NumerotationContextCommands::previous
|
||||
@return the previous numerotation context
|
||||
*/
|
||||
NumerotationContext NumerotationContextCommands::previous() {
|
||||
NumerotationContext contextnum;
|
||||
|
||||
@@ -65,9 +65,9 @@ NumerotationContext NumerotationContextCommands::previous() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NumerotationContextCommands::toFinalString
|
||||
* @return the string represented by the numerotation context
|
||||
*/
|
||||
@brief NumerotationContextCommands::toFinalString
|
||||
@return the string represented by the numerotation context
|
||||
*/
|
||||
QString NumerotationContextCommands::toRepresentedString() {
|
||||
QString num;
|
||||
if (context_.size()) {
|
||||
@@ -83,9 +83,9 @@ QString NumerotationContextCommands::toRepresentedString() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NumerotationContextCommands::setNumStrategy
|
||||
* apply the good strategy relative to @str
|
||||
*/
|
||||
@brief NumerotationContextCommands::setNumStrategy
|
||||
apply the good strategy relative to @str
|
||||
*/
|
||||
void NumerotationContextCommands::setNumStrategy(const QString &str) {
|
||||
if (strategy_) delete strategy_;
|
||||
if (str == "unit") {
|
||||
@@ -149,8 +149,8 @@ void NumerotationContextCommands::setNumStrategy(const QString &str) {
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Constructor
|
||||
*/
|
||||
NumStrategy::NumStrategy (Diagram *d):
|
||||
diagram_ (d)
|
||||
{}
|
||||
@@ -158,9 +158,9 @@ NumStrategy::NumStrategy (Diagram *d):
|
||||
NumStrategy::~NumStrategy() {}
|
||||
|
||||
/**
|
||||
* @brief NumStrategy::nextString
|
||||
* @return the next value of @nc at position @i
|
||||
*/
|
||||
@brief NumStrategy::nextString
|
||||
@return the next value of @nc at position @i
|
||||
*/
|
||||
NumerotationContext NumStrategy::nextString (const NumerotationContext &nc, const int i) const {
|
||||
QStringList strl = nc.itemAt(i);
|
||||
NumerotationContext newnc;
|
||||
@@ -169,9 +169,9 @@ NumerotationContext NumStrategy::nextString (const NumerotationContext &nc, cons
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NumStrategy::nextNumber
|
||||
* @return the next value of @nc at position @i
|
||||
*/
|
||||
@brief NumStrategy::nextNumber
|
||||
@return the next value of @nc at position @i
|
||||
*/
|
||||
NumerotationContext NumStrategy::nextNumber (const NumerotationContext &nc, const int i) const {
|
||||
QStringList strl = nc.itemAt(i);
|
||||
NumerotationContext newnc;
|
||||
@@ -181,9 +181,9 @@ NumerotationContext NumStrategy::nextNumber (const NumerotationContext &nc, cons
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NumStrategy::previousNumber
|
||||
* @return the previous value of @nc at position @i
|
||||
*/
|
||||
@brief NumStrategy::previousNumber
|
||||
@return the previous value of @nc at position @i
|
||||
*/
|
||||
NumerotationContext NumStrategy::previousNumber(const NumerotationContext &nc, const int i) const {
|
||||
QStringList strl = nc.itemAt(i);
|
||||
NumerotationContext newnc;
|
||||
@@ -193,78 +193,78 @@ NumerotationContext NumStrategy::previousNumber(const NumerotationContext &nc, c
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Constructor
|
||||
*/
|
||||
UnitNum::UnitNum(Diagram *d):
|
||||
NumStrategy(d)
|
||||
{}
|
||||
|
||||
/**
|
||||
* @brief UnitNum::toRepresentedString
|
||||
* @return the represented string of num
|
||||
*/
|
||||
@brief UnitNum::toRepresentedString
|
||||
@return the represented string of num
|
||||
*/
|
||||
QString UnitNum::toRepresentedString(const QString num) const {
|
||||
return (num);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief UnitNum::next
|
||||
* @return the next NumerotationContext nc at position i
|
||||
*/
|
||||
@brief UnitNum::next
|
||||
@return the next NumerotationContext nc at position i
|
||||
*/
|
||||
NumerotationContext UnitNum::next (const NumerotationContext &nc, const int i) const {
|
||||
return (nextNumber(nc, i));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief UnitNum::previous
|
||||
* @return the previous NumerotationContext nc at posiiton i
|
||||
*/
|
||||
@brief UnitNum::previous
|
||||
@return the previous NumerotationContext nc at posiiton i
|
||||
*/
|
||||
NumerotationContext UnitNum::previous(const NumerotationContext &nc, const int i) const {
|
||||
return (previousNumber(nc, i));
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Constructor
|
||||
*/
|
||||
UnitFNum::UnitFNum(Diagram *d):
|
||||
NumStrategy(d)
|
||||
{}
|
||||
|
||||
/**
|
||||
* @brief UnitFNum::toRepresentedString
|
||||
* @return the represented string of num
|
||||
*/
|
||||
@brief UnitFNum::toRepresentedString
|
||||
@return the represented string of num
|
||||
*/
|
||||
QString UnitFNum::toRepresentedString(const QString num) const {
|
||||
return (num);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief UnitFNum::next
|
||||
* @return the next NumerotationContext nc at position i
|
||||
*/
|
||||
@brief UnitFNum::next
|
||||
@return the next NumerotationContext nc at position i
|
||||
*/
|
||||
NumerotationContext UnitFNum::next (const NumerotationContext &nc, const int i) const {
|
||||
return (nextNumber(nc, i));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief UnitFNum::previous
|
||||
* @return the previous NumerotationContext nc at posiiton i
|
||||
*/
|
||||
@brief UnitFNum::previous
|
||||
@return the previous NumerotationContext nc at posiiton i
|
||||
*/
|
||||
NumerotationContext UnitFNum::previous(const NumerotationContext &nc, const int i) const {
|
||||
return (previousNumber(nc, i));
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Constructor
|
||||
*/
|
||||
TenNum::TenNum (Diagram *d):
|
||||
NumStrategy (d)
|
||||
{}
|
||||
|
||||
/**
|
||||
* @brief TenNum::toRepresentedString
|
||||
* @return the represented string of num
|
||||
*/
|
||||
@brief TenNum::toRepresentedString
|
||||
@return the represented string of num
|
||||
*/
|
||||
QString TenNum::toRepresentedString(const QString num) const {
|
||||
int numint = num.toInt();
|
||||
QString numstr = num;
|
||||
@@ -273,32 +273,32 @@ QString TenNum::toRepresentedString(const QString num) const {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief TenNum::next
|
||||
* @return the next NumerotationContext nc at position i
|
||||
*/
|
||||
@brief TenNum::next
|
||||
@return the next NumerotationContext nc at position i
|
||||
*/
|
||||
NumerotationContext TenNum::next (const NumerotationContext &nc, const int i) const {
|
||||
return (nextNumber(nc, i));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief TenNum::previous
|
||||
* @return the previous NumerotationContext nc at posiiton i
|
||||
*/
|
||||
@brief TenNum::previous
|
||||
@return the previous NumerotationContext nc at posiiton i
|
||||
*/
|
||||
NumerotationContext TenNum::previous(const NumerotationContext &nc, const int i) const {
|
||||
return (previousNumber(nc, i));
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Constructor
|
||||
*/
|
||||
TenFNum::TenFNum (Diagram *d):
|
||||
NumStrategy (d)
|
||||
{}
|
||||
|
||||
/**
|
||||
* @brief TenFNum::toRepresentedString
|
||||
* @return the represented string of num
|
||||
*/
|
||||
@brief TenFNum::toRepresentedString
|
||||
@return the represented string of num
|
||||
*/
|
||||
QString TenFNum::toRepresentedString(const QString num) const {
|
||||
int numint = num.toInt();
|
||||
QString numstr = num;
|
||||
@@ -307,33 +307,33 @@ QString TenFNum::toRepresentedString(const QString num) const {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief TenFNum::next
|
||||
* @return the next NumerotationContext nc at position i
|
||||
*/
|
||||
@brief TenFNum::next
|
||||
@return the next NumerotationContext nc at position i
|
||||
*/
|
||||
NumerotationContext TenFNum::next (const NumerotationContext &nc, const int i) const {
|
||||
return (nextNumber(nc, i));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief TenFNum::previous
|
||||
* @return the previous NumerotationContext nc at posiiton i
|
||||
*/
|
||||
@brief TenFNum::previous
|
||||
@return the previous NumerotationContext nc at posiiton i
|
||||
*/
|
||||
NumerotationContext TenFNum::previous(const NumerotationContext &nc, const int i) const {
|
||||
return (previousNumber(nc, i));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Constructor
|
||||
*/
|
||||
HundredNum::HundredNum (Diagram *d):
|
||||
NumStrategy (d)
|
||||
{}
|
||||
|
||||
/**
|
||||
* @brief HundredNum::toRepresentedString
|
||||
* @return the represented string of num
|
||||
*/
|
||||
@brief HundredNum::toRepresentedString
|
||||
@return the represented string of num
|
||||
*/
|
||||
QString HundredNum::toRepresentedString(const QString num) const {
|
||||
int numint = num.toInt();
|
||||
QString numstr = num;
|
||||
@@ -347,32 +347,32 @@ QString HundredNum::toRepresentedString(const QString num) const {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief HundredNum::next
|
||||
* @return the next NumerotationContext nc at position i
|
||||
*/
|
||||
@brief HundredNum::next
|
||||
@return the next NumerotationContext nc at position i
|
||||
*/
|
||||
NumerotationContext HundredNum::next (const NumerotationContext &nc, const int i) const {
|
||||
return (nextNumber(nc, i));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief HundredNum::previous
|
||||
* @return the previous NumerotationContext nc at posiiton i
|
||||
*/
|
||||
@brief HundredNum::previous
|
||||
@return the previous NumerotationContext nc at posiiton i
|
||||
*/
|
||||
NumerotationContext HundredNum::previous(const NumerotationContext &nc, const int i) const {
|
||||
return (previousNumber(nc, i));
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Constructor
|
||||
*/
|
||||
HundredFNum::HundredFNum (Diagram *d):
|
||||
NumStrategy (d)
|
||||
{}
|
||||
|
||||
/**
|
||||
* @brief HundredFNum::toRepresentedString
|
||||
* @return the represented string of num
|
||||
*/
|
||||
@brief HundredFNum::toRepresentedString
|
||||
@return the represented string of num
|
||||
*/
|
||||
QString HundredFNum::toRepresentedString(const QString num) const {
|
||||
int numint = num.toInt();
|
||||
QString numstr = num;
|
||||
@@ -386,274 +386,274 @@ QString HundredFNum::toRepresentedString(const QString num) const {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief HundredFNum::next
|
||||
* @return the next NumerotationContext nc at position i
|
||||
*/
|
||||
@brief HundredFNum::next
|
||||
@return the next NumerotationContext nc at position i
|
||||
*/
|
||||
NumerotationContext HundredFNum::next (const NumerotationContext &nc, const int i) const {
|
||||
return (nextNumber(nc, i));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief HundredFNum::previous
|
||||
* @return the previous NumerotationContext nc at posiiton i
|
||||
*/
|
||||
@brief HundredFNum::previous
|
||||
@return the previous NumerotationContext nc at posiiton i
|
||||
*/
|
||||
NumerotationContext HundredFNum::previous(const NumerotationContext &nc, const int i) const {
|
||||
return (previousNumber(nc, i));
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Constructor
|
||||
*/
|
||||
StringNum::StringNum (Diagram *d):
|
||||
NumStrategy (d)
|
||||
{}
|
||||
|
||||
/**
|
||||
* @brief StringNum::toRepresentedString
|
||||
* @return the represented string of num
|
||||
*/
|
||||
@brief StringNum::toRepresentedString
|
||||
@return the represented string of num
|
||||
*/
|
||||
QString StringNum::toRepresentedString(const QString str) const {
|
||||
return (str);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief StringNum::next
|
||||
* @return the next NumerotationContext nc at position i
|
||||
*/
|
||||
@brief StringNum::next
|
||||
@return the next NumerotationContext nc at position i
|
||||
*/
|
||||
NumerotationContext StringNum::next (const NumerotationContext &nc, const int i) const {
|
||||
return (nextString(nc, i));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief StringNum::previous
|
||||
* @return the previous NumerotationContext nc at posiiton i
|
||||
*/
|
||||
@brief StringNum::previous
|
||||
@return the previous NumerotationContext nc at posiiton i
|
||||
*/
|
||||
NumerotationContext StringNum::previous(const NumerotationContext &nc, const int i) const {
|
||||
return (nextString(nc, i));
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Constructor
|
||||
*/
|
||||
IdFolioNum::IdFolioNum (Diagram *d):
|
||||
NumStrategy (d)
|
||||
{}
|
||||
|
||||
/**
|
||||
* @brief IdFolioNum::toRepresentedString
|
||||
* @return the represented string of num
|
||||
*/
|
||||
@brief IdFolioNum::toRepresentedString
|
||||
@return the represented string of num
|
||||
*/
|
||||
QString IdFolioNum::toRepresentedString(const QString str) const {
|
||||
Q_UNUSED(str);
|
||||
return ("%id");
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief IdFolioNum::next
|
||||
* @return the next NumerotationContext nc at position i
|
||||
*/
|
||||
@brief IdFolioNum::next
|
||||
@return the next NumerotationContext nc at position i
|
||||
*/
|
||||
NumerotationContext IdFolioNum::next (const NumerotationContext &nc, const int i) const {
|
||||
return (nextString(nc, i));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief IdFolioNum::previous
|
||||
* @return the previous NumerotationContext nc at posiiton i
|
||||
*/
|
||||
@brief IdFolioNum::previous
|
||||
@return the previous NumerotationContext nc at posiiton i
|
||||
*/
|
||||
NumerotationContext IdFolioNum::previous(const NumerotationContext &nc, const int i) const {
|
||||
return (nextString(nc, i));
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Constructor
|
||||
*/
|
||||
FolioNum::FolioNum (Diagram *d):
|
||||
NumStrategy (d)
|
||||
{}
|
||||
|
||||
/**
|
||||
* @brief FolioNum::toRepresentedString
|
||||
* @return the represented string of folio
|
||||
*/
|
||||
@brief FolioNum::toRepresentedString
|
||||
@return the represented string of folio
|
||||
*/
|
||||
QString FolioNum::toRepresentedString(const QString str) const {
|
||||
Q_UNUSED(str);
|
||||
return ("%F");
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FolioNum::next
|
||||
* @return the next NumerotationContext nc at position i
|
||||
*/
|
||||
@brief FolioNum::next
|
||||
@return the next NumerotationContext nc at position i
|
||||
*/
|
||||
NumerotationContext FolioNum::next (const NumerotationContext &nc, const int i) const {
|
||||
return (nextString(nc, i));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FolioNum::previous
|
||||
* @return the previous NumerotationContext nc at posiiton i
|
||||
*/
|
||||
@brief FolioNum::previous
|
||||
@return the previous NumerotationContext nc at posiiton i
|
||||
*/
|
||||
NumerotationContext FolioNum::previous(const NumerotationContext &nc, const int i) const {
|
||||
return (nextString(nc, i));
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Constructor
|
||||
*/
|
||||
PlantNum::PlantNum (Diagram *d):
|
||||
NumStrategy (d)
|
||||
{}
|
||||
|
||||
/**
|
||||
* @brief PlantNum::toRepresentedString
|
||||
* @return the represented string of folio
|
||||
*/
|
||||
@brief PlantNum::toRepresentedString
|
||||
@return the represented string of folio
|
||||
*/
|
||||
QString PlantNum::toRepresentedString(const QString str) const {
|
||||
Q_UNUSED(str);
|
||||
return "%M";
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief PlantNum::next
|
||||
* @return the next NumerotationContext nc at position i
|
||||
*/
|
||||
@brief PlantNum::next
|
||||
@return the next NumerotationContext nc at position i
|
||||
*/
|
||||
NumerotationContext PlantNum::next (const NumerotationContext &nc, const int i) const {
|
||||
return (nextString(nc, i));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief PlantNum::previous
|
||||
* @return the previous NumerotationContext nc at posiiton i
|
||||
*/
|
||||
@brief PlantNum::previous
|
||||
@return the previous NumerotationContext nc at posiiton i
|
||||
*/
|
||||
NumerotationContext PlantNum::previous(const NumerotationContext &nc, const int i) const {
|
||||
return (nextString(nc, i));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Constructor
|
||||
*/
|
||||
LocmachNum::LocmachNum (Diagram *d):
|
||||
NumStrategy (d)
|
||||
{}
|
||||
|
||||
/**
|
||||
* @brief LocmachNum::toRepresentedString
|
||||
* @return the represented string of folio
|
||||
*/
|
||||
@brief LocmachNum::toRepresentedString
|
||||
@return the represented string of folio
|
||||
*/
|
||||
QString LocmachNum::toRepresentedString(const QString str) const {
|
||||
Q_UNUSED(str);
|
||||
return "%LM";
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief LocmachNum::next
|
||||
* @return the next NumerotationContext nc at position i
|
||||
*/
|
||||
@brief LocmachNum::next
|
||||
@return the next NumerotationContext nc at position i
|
||||
*/
|
||||
NumerotationContext LocmachNum::next (const NumerotationContext &nc, const int i) const {
|
||||
return (nextString(nc, i));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief LocmachNum::previous
|
||||
* @return the previous NumerotationContext nc at posiiton i
|
||||
*/
|
||||
@brief LocmachNum::previous
|
||||
@return the previous NumerotationContext nc at posiiton i
|
||||
*/
|
||||
NumerotationContext LocmachNum::previous(const NumerotationContext &nc, const int i) const {
|
||||
return (nextString(nc, i));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Constructor
|
||||
*/
|
||||
ElementLineNum::ElementLineNum (Diagram *d):
|
||||
NumStrategy (d)
|
||||
{}
|
||||
|
||||
/**
|
||||
* @brief ElementLineNum::toRepresentedString
|
||||
* @return the represented string of folio
|
||||
*/
|
||||
@brief ElementLineNum::toRepresentedString
|
||||
@return the represented string of folio
|
||||
*/
|
||||
QString ElementLineNum::toRepresentedString(const QString str) const {
|
||||
Q_UNUSED(str);
|
||||
return "%l";
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementLineNum::next
|
||||
* @return the next NumerotationContext nc at position i
|
||||
*/
|
||||
@brief ElementLineNum::next
|
||||
@return the next NumerotationContext nc at position i
|
||||
*/
|
||||
NumerotationContext ElementLineNum::next (const NumerotationContext &nc, const int i) const {
|
||||
return (nextString(nc, i));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementLineNum::previous
|
||||
* @return the previous NumerotationContext nc at posiiton i
|
||||
*/
|
||||
@brief ElementLineNum::previous
|
||||
@return the previous NumerotationContext nc at posiiton i
|
||||
*/
|
||||
NumerotationContext ElementLineNum::previous(const NumerotationContext &nc, const int i) const {
|
||||
return (nextString(nc, i));
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Constructor
|
||||
*/
|
||||
ElementColumnNum::ElementColumnNum (Diagram *d):
|
||||
NumStrategy (d)
|
||||
{}
|
||||
|
||||
/**
|
||||
* @brief ElementColumnNum::toRepresentedString
|
||||
* @return the represented string of folio
|
||||
*/
|
||||
@brief ElementColumnNum::toRepresentedString
|
||||
@return the represented string of folio
|
||||
*/
|
||||
QString ElementColumnNum::toRepresentedString(const QString str) const {
|
||||
Q_UNUSED(str);
|
||||
return "%c";
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementColumnNum::next
|
||||
* @return the next NumerotationContext nc at position i
|
||||
*/
|
||||
@brief ElementColumnNum::next
|
||||
@return the next NumerotationContext nc at position i
|
||||
*/
|
||||
NumerotationContext ElementColumnNum::next (const NumerotationContext &nc, const int i) const {
|
||||
return (nextString(nc, i));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementColumnNum::previous
|
||||
* @return the previous NumerotationContext nc at posiiton i
|
||||
*/
|
||||
@brief ElementColumnNum::previous
|
||||
@return the previous NumerotationContext nc at posiiton i
|
||||
*/
|
||||
NumerotationContext ElementColumnNum::previous(const NumerotationContext &nc, const int i) const {
|
||||
return (nextString(nc, i));
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Constructor
|
||||
*/
|
||||
ElementPrefixNum::ElementPrefixNum (Diagram *d):
|
||||
NumStrategy (d)
|
||||
{}
|
||||
|
||||
/**
|
||||
* @brief ElementPrefixNum::toRepresentedString
|
||||
* @return the represented string of folio
|
||||
*/
|
||||
@brief ElementPrefixNum::toRepresentedString
|
||||
@return the represented string of folio
|
||||
*/
|
||||
QString ElementPrefixNum::toRepresentedString(const QString str) const {
|
||||
Q_UNUSED(str);
|
||||
return "%prefix";
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementPrefixNum::next
|
||||
* @return the next NumerotationContext nc at position i
|
||||
*/
|
||||
@brief ElementPrefixNum::next
|
||||
@return the next NumerotationContext nc at position i
|
||||
*/
|
||||
NumerotationContext ElementPrefixNum::next (const NumerotationContext &nc, const int i) const {
|
||||
return (nextString(nc, i));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementPrefixNum::previous
|
||||
* @return the previous NumerotationContext nc at posiiton i
|
||||
*/
|
||||
@brief ElementPrefixNum::previous
|
||||
@return the previous NumerotationContext nc at posiiton i
|
||||
*/
|
||||
NumerotationContext ElementPrefixNum::previous(const NumerotationContext &nc, const int i) const {
|
||||
return (nextString(nc, i));
|
||||
}
|
||||
|
||||
@@ -24,8 +24,9 @@ class NumStrategy;
|
||||
class Diagram;
|
||||
|
||||
/**
|
||||
* this class provide methods to handle content of NumerotationContext.
|
||||
*/
|
||||
@brief The NumerotationContextCommands class
|
||||
this class provide methods to handle content of NumerotationContext.
|
||||
*/
|
||||
class NumerotationContextCommands
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -25,10 +25,10 @@
|
||||
#include "projectpropertiesdialog.h"
|
||||
|
||||
/**
|
||||
* @brief AutoNumberingDockWidget::AutoNumberingDockWidget
|
||||
* Constructor
|
||||
* @param parent : parent widget
|
||||
*/
|
||||
@brief AutoNumberingDockWidget::AutoNumberingDockWidget
|
||||
Constructor
|
||||
@param parent : parent widget
|
||||
*/
|
||||
AutoNumberingDockWidget::AutoNumberingDockWidget(QWidget *parent) :
|
||||
QDockWidget(parent),
|
||||
ui(new Ui::AutoNumberingDockWidget)
|
||||
@@ -38,9 +38,9 @@ AutoNumberingDockWidget::AutoNumberingDockWidget(QWidget *parent) :
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief AutoNumberingDockWidget::~AutoNumberingDockWidget
|
||||
* Destructor
|
||||
*/
|
||||
@brief AutoNumberingDockWidget::~AutoNumberingDockWidget
|
||||
Destructor
|
||||
*/
|
||||
AutoNumberingDockWidget::~AutoNumberingDockWidget()
|
||||
{
|
||||
this->disconnect();
|
||||
@@ -48,9 +48,9 @@ AutoNumberingDockWidget::~AutoNumberingDockWidget()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief AutoNumberingDockWidget::clear
|
||||
* Remove all combo box values
|
||||
*/
|
||||
@brief AutoNumberingDockWidget::clear
|
||||
Remove all combo box values
|
||||
*/
|
||||
void AutoNumberingDockWidget::clear()
|
||||
{
|
||||
ui->m_conductor_cb->clear();
|
||||
@@ -67,11 +67,11 @@ void AutoNumberingDockWidget::projectClosed()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief AutoNumberingDockWidget::setProject
|
||||
* @param project: project to be setted
|
||||
* @param projectview: projectview to be setted
|
||||
* assign Project and ProjectView, connect all signals and setContext
|
||||
*/
|
||||
@brief AutoNumberingDockWidget::setProject
|
||||
@param project: project to be setted
|
||||
@param projectview: projectview to be setted
|
||||
assign Project and ProjectView, connect all signals and setContext
|
||||
*/
|
||||
void AutoNumberingDockWidget::setProject(QETProject *project, ProjectView *projectview)
|
||||
{
|
||||
//Disconnect previous project
|
||||
@@ -133,9 +133,9 @@ void AutoNumberingDockWidget::setProject(QETProject *project, ProjectView *proje
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief AutoNumberingDockWidget::setContext
|
||||
* Add all itens to comboboxes
|
||||
*/
|
||||
@brief AutoNumberingDockWidget::setContext
|
||||
Add all itens to comboboxes
|
||||
*/
|
||||
void AutoNumberingDockWidget::setContext() {
|
||||
|
||||
this->clear();
|
||||
@@ -165,9 +165,9 @@ void AutoNumberingDockWidget::setContext() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief AutoNumberingDockWidget::setConductorActive
|
||||
* @param dv: activated diagramview
|
||||
*/
|
||||
@brief AutoNumberingDockWidget::setConductorActive
|
||||
@param dv: activated diagramview
|
||||
*/
|
||||
void AutoNumberingDockWidget::setConductorActive(DiagramView* dv) {
|
||||
if (dv!=nullptr) {
|
||||
QString conductor_autonum = dv->diagram()->conductorsAutonumName();
|
||||
@@ -177,9 +177,9 @@ void AutoNumberingDockWidget::setConductorActive(DiagramView* dv) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief AutoNumberingDockWidget::setActive
|
||||
* Set current used autonumberings
|
||||
*/
|
||||
@brief AutoNumberingDockWidget::setActive
|
||||
Set current used autonumberings
|
||||
*/
|
||||
void AutoNumberingDockWidget::setActive() {
|
||||
|
||||
if (m_project_view!=nullptr) {
|
||||
@@ -206,9 +206,9 @@ void AutoNumberingDockWidget::setActive() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief AutoNumberingDockWidget::conductorAutoNumChanged
|
||||
* Add new or remove conductor auto num from combobox
|
||||
*/
|
||||
@brief AutoNumberingDockWidget::conductorAutoNumChanged
|
||||
Add new or remove conductor auto num from combobox
|
||||
*/
|
||||
void AutoNumberingDockWidget::conductorAutoNumChanged() {
|
||||
ui->m_conductor_cb->clear();
|
||||
|
||||
@@ -222,10 +222,10 @@ void AutoNumberingDockWidget::conductorAutoNumChanged() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief AutoNumberingDockWidget::on_m_conductor_cb_activated
|
||||
* @param unused
|
||||
* Set new conductor AutoNum
|
||||
*/
|
||||
@brief AutoNumberingDockWidget::on_m_conductor_cb_activated
|
||||
@param unused
|
||||
Set new conductor AutoNum
|
||||
*/
|
||||
void AutoNumberingDockWidget::on_m_conductor_cb_activated(int)
|
||||
{
|
||||
QString current_autonum = ui->m_conductor_cb->currentText();
|
||||
@@ -236,9 +236,9 @@ void AutoNumberingDockWidget::on_m_conductor_cb_activated(int)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief AutoNumberingDockWidget::elementAutoNumChanged
|
||||
* Add new or remove element auto num from combobox
|
||||
*/
|
||||
@brief AutoNumberingDockWidget::elementAutoNumChanged
|
||||
Add new or remove element auto num from combobox
|
||||
*/
|
||||
void AutoNumberingDockWidget::elementAutoNumChanged() {
|
||||
|
||||
ui->m_element_cb->clear();
|
||||
@@ -253,10 +253,10 @@ void AutoNumberingDockWidget::elementAutoNumChanged() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief AutoNumberingDockWidget::on_m_element_cb_activated
|
||||
* @param unused
|
||||
* Set new element AutoNum
|
||||
*/
|
||||
@brief AutoNumberingDockWidget::on_m_element_cb_activated
|
||||
@param unused
|
||||
Set new element AutoNum
|
||||
*/
|
||||
void AutoNumberingDockWidget::on_m_element_cb_activated(int)
|
||||
{
|
||||
m_project->setCurrrentElementAutonum(ui->m_element_cb->currentText());
|
||||
@@ -264,9 +264,9 @@ void AutoNumberingDockWidget::on_m_element_cb_activated(int)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief AutoNumberingDockWidget::folioAutoNumChanged
|
||||
* Add new or remove folio auto num from combobox
|
||||
*/
|
||||
@brief AutoNumberingDockWidget::folioAutoNumChanged
|
||||
Add new or remove folio auto num from combobox
|
||||
*/
|
||||
void AutoNumberingDockWidget::folioAutoNumChanged() {
|
||||
|
||||
ui->m_folio_cb->clear();
|
||||
@@ -281,10 +281,10 @@ void AutoNumberingDockWidget::folioAutoNumChanged() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief AutoNumberingDockWidget::on_m_folio_cb_activated
|
||||
* @param unused
|
||||
* Set new folio AutoNum
|
||||
*/
|
||||
@brief AutoNumberingDockWidget::on_m_folio_cb_activated
|
||||
@param unused
|
||||
Set new folio AutoNum
|
||||
*/
|
||||
void AutoNumberingDockWidget::on_m_folio_cb_activated(int) {
|
||||
QString current_autonum = ui->m_folio_cb->currentText();
|
||||
TitleBlockProperties ip = m_project -> defaultTitleBlockProperties();
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
#include "qetproject.h"
|
||||
#include "diagram.h"
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Constructor
|
||||
*/
|
||||
FolioAutonumberingW::FolioAutonumberingW(QETProject *project, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
project_(project),
|
||||
@@ -39,56 +39,56 @@ FolioAutonumberingW::FolioAutonumberingW(QETProject *project, QWidget *parent) :
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
Destructor
|
||||
*/
|
||||
FolioAutonumberingW::~FolioAutonumberingW()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FolioAutonumberingW::setContext
|
||||
* construct autonums in the comboBox selected in the @autonum_chooser QcomboBox
|
||||
*/
|
||||
@brief FolioAutonumberingW::setContext
|
||||
construct autonums in the comboBox selected in the @autonum_chooser QcomboBox
|
||||
*/
|
||||
void FolioAutonumberingW::setContext(QList <QString> autonums) {
|
||||
foreach (QString str, autonums) { ui->m_autonums_cb->addItem(str);}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FolioAutonumberingW::autoNumSelected
|
||||
* returns the current autonum selected
|
||||
*/
|
||||
@brief FolioAutonumberingW::autoNumSelected
|
||||
returns the current autonum selected
|
||||
*/
|
||||
QString FolioAutonumberingW::autoNumSelected(){
|
||||
return ui->m_autonums_cb->currentText();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FolioAutonumberingW::fromFolio
|
||||
* returns the current "From Folio" index
|
||||
*/
|
||||
@brief FolioAutonumberingW::fromFolio
|
||||
returns the current "From Folio" index
|
||||
*/
|
||||
int FolioAutonumberingW::fromFolio(){
|
||||
return ui->m_from_cb->currentIndex()-1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FolioAutonumberingW::toFolio
|
||||
* returns the current "To Folio" index
|
||||
*/
|
||||
@brief FolioAutonumberingW::toFolio
|
||||
returns the current "To Folio" index
|
||||
*/
|
||||
int FolioAutonumberingW::toFolio(){
|
||||
return ui->m_to_cb->currentIndex()+this->fromFolio()+1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FolioAutonumberingW::newFoliosNumber
|
||||
* returns the number of folios to create
|
||||
*/
|
||||
@brief FolioAutonumberingW::newFoliosNumber
|
||||
returns the number of folios to create
|
||||
*/
|
||||
int FolioAutonumberingW::newFoliosNumber(){
|
||||
return ui->m_new_tabs_sb->value();
|
||||
}
|
||||
/**
|
||||
* @brief FolioAutonumberingW::updateFolioList
|
||||
* update Folio List in From and To ComboBox
|
||||
*/
|
||||
@brief FolioAutonumberingW::updateFolioList
|
||||
update Folio List in From and To ComboBox
|
||||
*/
|
||||
void FolioAutonumberingW::updateFolioList(){
|
||||
ui -> m_from_cb->clear();
|
||||
ui -> m_to_cb->clear();
|
||||
@@ -100,9 +100,9 @@ void FolioAutonumberingW::updateFolioList(){
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FolioAutonumberingW::on_m_create_new_tabs_rb_clicked
|
||||
@brief FolioAutonumberingW::on_m_create_new_tabs_rb_clicked
|
||||
* Enable New Tabs SpinBox
|
||||
*/
|
||||
*/
|
||||
void FolioAutonumberingW::on_m_create_new_tabs_rb_clicked() {
|
||||
ui->m_from_cb->setEnabled(false);
|
||||
ui->m_to_cb->setEnabled(false);
|
||||
@@ -112,9 +112,9 @@ void FolioAutonumberingW::on_m_create_new_tabs_rb_clicked() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FolioAutonumberingW::on_m_autonumber_tabs_rb_clicked
|
||||
@brief FolioAutonumberingW::on_m_autonumber_tabs_rb_clicked
|
||||
* Enable From ComboBox, fill From ComboBox
|
||||
*/
|
||||
*/
|
||||
void FolioAutonumberingW::on_m_autonumber_tabs_rb_clicked() {
|
||||
ui->m_new_tabs_sb->setEnabled(false);
|
||||
ui->m_from_cb->setEnabled(true);
|
||||
@@ -131,18 +131,18 @@ void FolioAutonumberingW::on_m_autonumber_tabs_rb_clicked() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FolioAutonumberingW::on_m_new_tabs_sb_valueChanged
|
||||
@brief FolioAutonumberingW::on_m_new_tabs_sb_valueChanged
|
||||
* Enable Apply if any new folio is to be created
|
||||
*/
|
||||
*/
|
||||
void FolioAutonumberingW::on_m_new_tabs_sb_valueChanged(int){
|
||||
if (ui->m_new_tabs_sb->value()>0) applyEnable(true);
|
||||
else applyEnable(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FolioAutonumberingW::on_m_from_cb_currentIndexChanged
|
||||
@brief FolioAutonumberingW::on_m_from_cb_currentIndexChanged
|
||||
* Enable To ComboBox
|
||||
*/
|
||||
*/
|
||||
void FolioAutonumberingW::on_m_from_cb_currentIndexChanged(int){
|
||||
int index = ui->m_from_cb->currentIndex();
|
||||
ui->m_to_cb->clear();
|
||||
@@ -159,9 +159,9 @@ void FolioAutonumberingW::on_m_from_cb_currentIndexChanged(int){
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SelectAutonumW::on_buttonBox_clicked
|
||||
* Action on @buttonBox clicked
|
||||
*/
|
||||
@brief SelectAutonumW::on_buttonBox_clicked
|
||||
Action on @buttonBox clicked
|
||||
*/
|
||||
void FolioAutonumberingW::on_buttonBox_clicked(QAbstractButton *button) {
|
||||
//transform button to int
|
||||
int answer = ui -> buttonBox -> buttonRole(button);
|
||||
@@ -194,9 +194,9 @@ void FolioAutonumberingW::on_buttonBox_clicked(QAbstractButton *button) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SelectAutonumW::applyEnable
|
||||
* enable/disable the apply button
|
||||
*/
|
||||
@brief SelectAutonumW::applyEnable
|
||||
enable/disable the apply button
|
||||
*/
|
||||
void FolioAutonumberingW::applyEnable(bool b) {
|
||||
if (b){
|
||||
bool valid = true;
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
#include <utility>
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Constructor
|
||||
*/
|
||||
FormulaAutonumberingW::FormulaAutonumberingW(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::FormulaAutonumberingW)
|
||||
@@ -35,41 +35,41 @@ FormulaAutonumberingW::FormulaAutonumberingW(QWidget *parent) :
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
Destructor
|
||||
*/
|
||||
FormulaAutonumberingW::~FormulaAutonumberingW()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FormulaAutonumberingW::setContext
|
||||
* @param formula to be inserted into context
|
||||
*/
|
||||
@brief FormulaAutonumberingW::setContext
|
||||
@param formula to be inserted into context
|
||||
*/
|
||||
void FormulaAutonumberingW::setContext(const QString& formula) {
|
||||
ui->m_formula_le->insert(formula);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FormulaAutonumberingW::clearContext
|
||||
* @param clear formula line edit text
|
||||
*/
|
||||
@brief FormulaAutonumberingW::clearContext
|
||||
@param clear formula line edit text
|
||||
*/
|
||||
void FormulaAutonumberingW::clearContext() {
|
||||
ui->m_formula_le->clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FormulaAutonumberingW::formula
|
||||
* @return formula to be stored into project
|
||||
*/
|
||||
@brief FormulaAutonumberingW::formula
|
||||
@return formula to be stored into project
|
||||
*/
|
||||
QString FormulaAutonumberingW::formula() {
|
||||
return ui->m_formula_le->text();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FormulaAutonumberingW::on_m_formula_le_textChanged
|
||||
* Update Apply Button
|
||||
*/
|
||||
@brief FormulaAutonumberingW::on_m_formula_le_textChanged
|
||||
Update Apply Button
|
||||
*/
|
||||
void FormulaAutonumberingW::on_m_formula_le_textChanged(QString text) {
|
||||
emit (textChanged(std::move(text)));
|
||||
}
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
#include "ui_numparteditorw.h"
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Constructor
|
||||
*/
|
||||
NumPartEditorW::NumPartEditorW(int type, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::NumPartEditorW),
|
||||
@@ -34,9 +34,9 @@ NumPartEditorW::NumPartEditorW(int type, QWidget *parent) :
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* Build with value of @context at position i
|
||||
*/
|
||||
Constructor
|
||||
Build with value of @context at position i
|
||||
*/
|
||||
NumPartEditorW::NumPartEditorW (NumerotationContext &context, int i, int type, QWidget *parent):
|
||||
QWidget(parent),
|
||||
ui(new Ui::NumPartEditorW),
|
||||
@@ -69,8 +69,8 @@ NumPartEditorW::NumPartEditorW (NumerotationContext &context, int i, int type, Q
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
Destructor
|
||||
*/
|
||||
NumPartEditorW::~NumPartEditorW()
|
||||
{
|
||||
delete intValidator;
|
||||
@@ -102,9 +102,9 @@ void NumPartEditorW::setVisibleItems()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NumPartEditorW::toNumContext
|
||||
* @return the display to NumerotationContext
|
||||
*/
|
||||
@brief NumPartEditorW::toNumContext
|
||||
@return the display to NumerotationContext
|
||||
*/
|
||||
NumerotationContext NumPartEditorW::toNumContext() {
|
||||
NumerotationContext nc;
|
||||
QString type_str;
|
||||
@@ -160,9 +160,9 @@ NumerotationContext NumPartEditorW::toNumContext() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NumPartEditorW::isValid
|
||||
* @return true if value field isn't empty or if type is folio
|
||||
*/
|
||||
@brief NumPartEditorW::isValid
|
||||
@return true if value field isn't empty or if type is folio
|
||||
*/
|
||||
bool NumPartEditorW::isValid() {
|
||||
if (type_ == folio || type_ == idfolio || type_ == elementline || type_ == plant || type_ == locmach ||
|
||||
type_ == elementcolumn || type_ == elementprefix) {return true;}
|
||||
@@ -171,9 +171,9 @@ bool NumPartEditorW::isValid() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NumPartEditorW::on_type_cb_activated
|
||||
* Action when user change the type comboBox
|
||||
*/
|
||||
@brief NumPartEditorW::on_type_cb_activated
|
||||
Action when user change the type comboBox
|
||||
*/
|
||||
void NumPartEditorW::on_type_cb_activated(int) {
|
||||
if (ui->type_cb->currentText() == tr("Chiffre 1"))
|
||||
setType(unit);
|
||||
@@ -207,27 +207,27 @@ void NumPartEditorW::on_type_cb_activated(int) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NumPartEditorW::on_value_field_textChanged
|
||||
* emit changed when @value_field text changed
|
||||
*/
|
||||
@brief NumPartEditorW::on_value_field_textChanged
|
||||
emit changed when @value_field text changed
|
||||
*/
|
||||
void NumPartEditorW::on_value_field_textEdited() {
|
||||
emit changed();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NumPartEditorW::on_increase_spinBox_valueChanged
|
||||
* emit changed when @increase_spinBox value changed
|
||||
*/
|
||||
@brief NumPartEditorW::on_increase_spinBox_valueChanged
|
||||
emit changed when @increase_spinBox value changed
|
||||
*/
|
||||
void NumPartEditorW::on_increase_spinBox_valueChanged(int) {
|
||||
if (!ui -> value_field -> text().isEmpty()) emit changed();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NumPartEditorW::setType
|
||||
* Set good behavior by type @t
|
||||
* @param t, type used
|
||||
* @param fnum, force the behavior of numeric type
|
||||
*/
|
||||
@brief NumPartEditorW::setType
|
||||
Set good behavior by type @t
|
||||
@param t, type used
|
||||
@param fnum, force the behavior of numeric type
|
||||
*/
|
||||
void NumPartEditorW::setType(NumPartEditorW::type t, bool fnum) {
|
||||
setCurrentIndex(t);
|
||||
|
||||
@@ -285,10 +285,10 @@ void NumPartEditorW::setType(NumPartEditorW::type t, bool fnum) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NumPartEditorW::setCurrentIndex
|
||||
* Set Current Index of type_cb
|
||||
* @param t, type used
|
||||
*/
|
||||
@brief NumPartEditorW::setCurrentIndex
|
||||
Set Current Index of type_cb
|
||||
@param t, type used
|
||||
*/
|
||||
void NumPartEditorW::setCurrentIndex(NumPartEditorW::type t) {
|
||||
int i=-1;
|
||||
if (t == unit)
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
*This class represent a single part num widget. By this widget, we can define and edit
|
||||
*how the num auto must work .
|
||||
*This widget is called by selectautonumw.
|
||||
*/
|
||||
*/
|
||||
namespace Ui {
|
||||
class NumPartEditorW;
|
||||
}
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
#include "assignvariables.h"
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Constructor
|
||||
*/
|
||||
SelectAutonumW::SelectAutonumW(int type, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::SelectAutonumW),
|
||||
@@ -72,17 +72,17 @@ SelectAutonumW::SelectAutonumW(const NumerotationContext &context, int type, QWi
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
Destructor
|
||||
*/
|
||||
SelectAutonumW::~SelectAutonumW()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SelectAutonumW::setCurrentContext
|
||||
* build the context of current diagram selected in the @diagram_chooser QcomboBox
|
||||
*/
|
||||
@brief SelectAutonumW::setCurrentContext
|
||||
build the context of current diagram selected in the @diagram_chooser QcomboBox
|
||||
*/
|
||||
void SelectAutonumW::setContext(const NumerotationContext &context) {
|
||||
m_context = context;
|
||||
|
||||
@@ -109,9 +109,9 @@ void SelectAutonumW::setContext(const NumerotationContext &context) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SelectAutonumW::toNumContext
|
||||
* @return the content to @num_part_list to NumerotationContext
|
||||
*/
|
||||
@brief SelectAutonumW::toNumContext
|
||||
@return the content to @num_part_list to NumerotationContext
|
||||
*/
|
||||
NumerotationContext SelectAutonumW::toNumContext() const {
|
||||
NumerotationContext nc;
|
||||
foreach (NumPartEditorW *npew, num_part_list_) nc << npew -> toNumContext();
|
||||
@@ -119,9 +119,9 @@ NumerotationContext SelectAutonumW::toNumContext() const {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SelectAutonumW::on_add_button_clicked
|
||||
@brief SelectAutonumW::on_add_button_clicked
|
||||
* Action on add_button, add a @NumPartEditor
|
||||
*/
|
||||
*/
|
||||
void SelectAutonumW::on_add_button_clicked()
|
||||
{
|
||||
applyEnable(false);
|
||||
@@ -133,9 +133,9 @@ void SelectAutonumW::on_add_button_clicked()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SelectAutonumW::on_remove_button_clicked
|
||||
@brief SelectAutonumW::on_remove_button_clicked
|
||||
* Action on remove button, remove the last @NumPartEditor
|
||||
*/
|
||||
*/
|
||||
void SelectAutonumW::on_remove_button_clicked() {
|
||||
//remove if @num_part_list contains more than one item
|
||||
if (num_part_list_.size() > 1) {
|
||||
@@ -150,9 +150,9 @@ void SelectAutonumW::on_remove_button_clicked() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SelectAutonumW::formula
|
||||
* @return autonumbering widget formula
|
||||
*/
|
||||
@brief SelectAutonumW::formula
|
||||
@return autonumbering widget formula
|
||||
*/
|
||||
QString SelectAutonumW::formula()
|
||||
{
|
||||
if (m_edited_type == 0)
|
||||
@@ -169,9 +169,9 @@ QComboBox *SelectAutonumW::contextComboBox() const
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SelectAutonumW::on_buttonBox_clicked
|
||||
* Action on @buttonBox clicked
|
||||
*/
|
||||
@brief SelectAutonumW::on_buttonBox_clicked
|
||||
Action on @buttonBox clicked
|
||||
*/
|
||||
void SelectAutonumW::on_buttonBox_clicked(QAbstractButton *button) {
|
||||
//transform button to int
|
||||
int answer = ui -> buttonBox -> buttonRole(button);
|
||||
@@ -233,9 +233,9 @@ void SelectAutonumW::on_buttonBox_clicked(QAbstractButton *button) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SelectAutonumW::applyEnable
|
||||
* enable/disable the apply button
|
||||
*/
|
||||
@brief SelectAutonumW::applyEnable
|
||||
enable/disable the apply button
|
||||
*/
|
||||
void SelectAutonumW::applyEnable(bool b) {
|
||||
if (b){
|
||||
bool valid= true;
|
||||
@@ -252,9 +252,9 @@ void SelectAutonumW::applyEnable(bool b) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SelectAutonumW::contextToFormula
|
||||
* Apply formula to ElementAutonumbering Widget
|
||||
*/
|
||||
@brief SelectAutonumW::contextToFormula
|
||||
Apply formula to ElementAutonumbering Widget
|
||||
*/
|
||||
void SelectAutonumW::contextToFormula()
|
||||
{
|
||||
FormulaAutonumberingW* m_faw = nullptr;
|
||||
@@ -271,9 +271,9 @@ void SelectAutonumW::contextToFormula()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SelectAutonumW::on_m_next_pb_clicked
|
||||
* Increase NumerotationContext
|
||||
*/
|
||||
@brief SelectAutonumW::on_m_next_pb_clicked
|
||||
Increase NumerotationContext
|
||||
*/
|
||||
void SelectAutonumW::on_m_next_pb_clicked()
|
||||
{
|
||||
NumerotationContextCommands ncc (toNumContext());
|
||||
@@ -282,9 +282,9 @@ void SelectAutonumW::on_m_next_pb_clicked()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SelectAutonumW::on_m_previous_pb_clicked
|
||||
* Decrease NumerotationContext
|
||||
*/
|
||||
@brief SelectAutonumW::on_m_previous_pb_clicked
|
||||
Decrease NumerotationContext
|
||||
*/
|
||||
void SelectAutonumW::on_m_previous_pb_clicked()
|
||||
{
|
||||
NumerotationContextCommands ncc (toNumContext());
|
||||
|
||||
@@ -605,13 +605,13 @@ void BorderTitleBlock::draw(QPainter *painter)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief BorderTitleBlock::drawDxf
|
||||
* @param width
|
||||
* @param height
|
||||
* @param keep_aspect_ratio
|
||||
* @param file_path
|
||||
* @param color
|
||||
*/
|
||||
@brief BorderTitleBlock::drawDxf
|
||||
@param width
|
||||
@param height
|
||||
@param keep_aspect_ratio
|
||||
@param file_path
|
||||
@param color
|
||||
*/
|
||||
void BorderTitleBlock::drawDxf(
|
||||
int width,
|
||||
int height,
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "conductornumexport.h"
|
||||
#include "diagram.h"
|
||||
@@ -26,10 +26,10 @@
|
||||
#include <QFileDialog>
|
||||
|
||||
/**
|
||||
* @brief ConductorNumExport::ConductorNumExport
|
||||
* @param project : the project to export the conductors num
|
||||
* @param parent : parent widget
|
||||
*/
|
||||
@brief ConductorNumExport::ConductorNumExport
|
||||
@param project : the project to export the conductors num
|
||||
@param parent : parent widget
|
||||
*/
|
||||
ConductorNumExport::ConductorNumExport(QETProject *project, QWidget *parent) :
|
||||
m_project(project),
|
||||
m_parent_widget(parent)
|
||||
@@ -38,10 +38,10 @@ ConductorNumExport::ConductorNumExport(QETProject *project, QWidget *parent) :
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ConductorNumExport::toCsv
|
||||
* Export the num of conductors into a csv file.
|
||||
* @return true if suceesfully exported.
|
||||
*/
|
||||
@brief ConductorNumExport::toCsv
|
||||
Export the num of conductors into a csv file.
|
||||
@return true if suceesfully exported.
|
||||
*/
|
||||
bool ConductorNumExport::toCsv()
|
||||
{
|
||||
QString name = QObject::tr("numero_de_fileries_") + m_project->title() + ".csv";
|
||||
@@ -86,9 +86,9 @@ bool ConductorNumExport::toCsv()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ConductorNumExport::wiresNum
|
||||
* @return the wire num formated in csv
|
||||
*/
|
||||
@brief ConductorNumExport::wiresNum
|
||||
@return the wire num formated in csv
|
||||
*/
|
||||
QString ConductorNumExport::wiresNum() const
|
||||
{
|
||||
QString csv;
|
||||
@@ -106,9 +106,9 @@ QString ConductorNumExport::wiresNum() const
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ConductorNumExport::fillHash
|
||||
* @value m_hash
|
||||
*/
|
||||
@brief ConductorNumExport::fillHash
|
||||
@value m_hash
|
||||
*/
|
||||
void ConductorNumExport::fillHash()
|
||||
{
|
||||
//We used this rx to avoid insert num composed only withe white space.
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef ConductorNumExport_H
|
||||
#define ConductorNumExport_H
|
||||
@@ -24,9 +24,9 @@ class QETProject;
|
||||
class QWidget;
|
||||
|
||||
/**
|
||||
* @brief The ConductorNumExport class
|
||||
* A class to export the num of conductors into a csv file.
|
||||
*/
|
||||
@brief The ConductorNumExport class
|
||||
A class to export the num of conductors into a csv file.
|
||||
*/
|
||||
class ConductorNumExport
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -241,10 +241,10 @@ ConductorProperties::~ConductorProperties() {
|
||||
|
||||
|
||||
/**
|
||||
* @brief ConductorProperties::toXml
|
||||
* Export conductor propertie, in the XML element 'e'
|
||||
* @param e the xml element
|
||||
*/
|
||||
@brief ConductorProperties::toXml
|
||||
Export conductor propertie, in the XML element 'e'
|
||||
@param e the xml element
|
||||
*/
|
||||
void ConductorProperties::toXml(QDomElement &e) const
|
||||
{
|
||||
e.setAttribute("type", typeToString(type));
|
||||
@@ -284,10 +284,10 @@ void ConductorProperties::toXml(QDomElement &e) const
|
||||
|
||||
|
||||
/**
|
||||
* @brief ConductorProperties::fromXml
|
||||
* Import conductor propertie, from the attribute of the xml element 'e'
|
||||
* @param e the xml document
|
||||
*/
|
||||
@brief ConductorProperties::fromXml
|
||||
Import conductor propertie, from the attribute of the xml element 'e'
|
||||
@param e the xml document
|
||||
*/
|
||||
void ConductorProperties::fromXml(QDomElement &e)
|
||||
{
|
||||
// get conductor color
|
||||
@@ -440,11 +440,11 @@ QString ConductorProperties::typeToString(ConductorType t)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ConductorProperties::applyForEqualAttributes
|
||||
* Test each attribute of properties in the list separatly.
|
||||
* For each attributes, if is equal, the attribute is apply to this.
|
||||
* @param list
|
||||
*/
|
||||
@brief ConductorProperties::applyForEqualAttributes
|
||||
Test each attribute of properties in the list separatly.
|
||||
For each attributes, if is equal, the attribute is apply to this.
|
||||
@param list
|
||||
*/
|
||||
void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> list)
|
||||
{
|
||||
const QList<ConductorProperties> clist = std::move(list);
|
||||
@@ -698,9 +698,9 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ConductorProperties::defaultProperties
|
||||
* @return the default properties stored in the setting file
|
||||
*/
|
||||
@brief ConductorProperties::defaultProperties
|
||||
@return the default properties stored in the setting file
|
||||
*/
|
||||
ConductorProperties ConductorProperties::defaultProperties()
|
||||
{
|
||||
QSettings settings;
|
||||
@@ -712,10 +712,10 @@ ConductorProperties ConductorProperties::defaultProperties()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ConductorProperties::operator ==
|
||||
* @param other
|
||||
* @return true if other == this
|
||||
*/
|
||||
@brief ConductorProperties::operator ==
|
||||
@param other
|
||||
@return true if other == this
|
||||
*/
|
||||
bool ConductorProperties::operator==(const ConductorProperties &other) const
|
||||
{
|
||||
return(
|
||||
|
||||
@@ -137,10 +137,10 @@ void ConfigDialog::addPage(ConfigPage *page) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ConfigDialog::setCurrentPage
|
||||
* Set the current index to @index
|
||||
* @param index
|
||||
*/
|
||||
@brief ConfigDialog::setCurrentPage
|
||||
Set the current index to @index
|
||||
@param index
|
||||
*/
|
||||
void ConfigDialog::setCurrentPage(const int index) {
|
||||
pages_list->setCurrentRow(index);
|
||||
}
|
||||
|
||||
@@ -25,37 +25,37 @@ class QStackedWidget;
|
||||
class QDialogButtonBox;
|
||||
/**
|
||||
This class represents the configuration dialog for QElectroTech.
|
||||
It displays "configuration pages", each page having to provide an icon and
|
||||
a title.
|
||||
It displays "configuration pages",
|
||||
each page having to provide an icon and a title.
|
||||
*/
|
||||
class ConfigDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
// constructors, destructor
|
||||
public:
|
||||
ConfigDialog(QWidget * = nullptr);
|
||||
~ConfigDialog() override;
|
||||
ConfigDialog(QWidget * = nullptr);
|
||||
~ConfigDialog() override;
|
||||
private:
|
||||
ConfigDialog(const ConfigDialog &);
|
||||
ConfigDialog(const ConfigDialog &);
|
||||
|
||||
public:
|
||||
QList<ConfigPage *> pages;
|
||||
public:
|
||||
QList<ConfigPage *> pages;
|
||||
|
||||
|
||||
// methods
|
||||
public slots:
|
||||
void applyConf();
|
||||
void addPage(ConfigPage *);
|
||||
void setCurrentPage(const int index);
|
||||
void applyConf();
|
||||
void addPage(ConfigPage *);
|
||||
void setCurrentPage(const int index);
|
||||
|
||||
private:
|
||||
void buildPagesList();
|
||||
void addPageToList(ConfigPage *);
|
||||
void buildPagesList();
|
||||
void addPageToList(ConfigPage *);
|
||||
|
||||
// attributes
|
||||
private:
|
||||
QListWidget *pages_list;
|
||||
QStackedWidget *pages_widget;
|
||||
QDialogButtonBox *buttons;
|
||||
QListWidget *pages_list;
|
||||
QStackedWidget *pages_widget;
|
||||
QDialogButtonBox *buttons;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -33,12 +33,12 @@
|
||||
#include <utility>
|
||||
|
||||
/**
|
||||
* @brief NewDiagramPage::NewDiagramPage
|
||||
* Default constructor
|
||||
* @param project, If project, edit the propertie of Project
|
||||
* else edit the properties by default of QElectroTech
|
||||
* @param parent, parent widget
|
||||
*/
|
||||
@brief NewDiagramPage::NewDiagramPage
|
||||
Default constructor
|
||||
@param project, If project, edit the propertie of Project
|
||||
else edit the properties by default of QElectroTech
|
||||
@param parent, parent widget
|
||||
*/
|
||||
NewDiagramPage::NewDiagramPage(QETProject *project, QWidget *parent, ProjectPropertiesDialog *ppd) :
|
||||
ConfigPage (parent),
|
||||
ppd_ (ppd),
|
||||
@@ -93,18 +93,18 @@ NewDiagramPage::NewDiagramPage(QETProject *project, QWidget *parent, ProjectProp
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NewDiagramPage::~NewDiagramPage
|
||||
*/
|
||||
@brief NewDiagramPage::~NewDiagramPage
|
||||
*/
|
||||
NewDiagramPage::~NewDiagramPage() {
|
||||
disconnect(ipw,SIGNAL(openAutoNumFolioEditor(QString)),this,SLOT(changeToAutoFolioTab()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NewDiagramPage::applyConf
|
||||
* Apply conf for this page.
|
||||
* If there is a project, save in the project,
|
||||
* else save to the default conf of QElectroTech
|
||||
*/
|
||||
@brief NewDiagramPage::applyConf
|
||||
Apply conf for this page.
|
||||
If there is a project, save in the project,
|
||||
else save to the default conf of QElectroTech
|
||||
*/
|
||||
void NewDiagramPage::applyConf() {
|
||||
if (m_project) { //If project we save to the project
|
||||
if (m_project -> isReadOnly()) return;
|
||||
@@ -171,27 +171,27 @@ void NewDiagramPage::applyConf() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NewDiagramPage::icon
|
||||
* @return icon of this page
|
||||
*/
|
||||
@brief NewDiagramPage::icon
|
||||
@return icon of this page
|
||||
*/
|
||||
QIcon NewDiagramPage::icon() const {
|
||||
if (m_project) return(QET::Icons::NewDiagram);
|
||||
return(QET::Icons::Projects);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NewDiagramPage::title
|
||||
* @return title of this page
|
||||
*/
|
||||
@brief NewDiagramPage::title
|
||||
@return title of this page
|
||||
*/
|
||||
QString NewDiagramPage::title() const {
|
||||
if (m_project) return(tr("Nouveau folio", "configuration page title"));
|
||||
return(tr("Nouveau projet", "configuration page title"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NewDiagramPage::changeToAutoFolioTab
|
||||
* Set the current tab to Autonum
|
||||
*/
|
||||
@brief NewDiagramPage::changeToAutoFolioTab
|
||||
Set the current tab to Autonum
|
||||
*/
|
||||
void NewDiagramPage::changeToAutoFolioTab(){
|
||||
if (m_project){
|
||||
ppd_->setCurrentPage(ProjectPropertiesDialog::Autonum);
|
||||
@@ -201,9 +201,9 @@ void NewDiagramPage::changeToAutoFolioTab(){
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NewDiagramPage::setFolioAutonum
|
||||
* Set temporary TBP to use in auto folio num
|
||||
*/
|
||||
@brief NewDiagramPage::setFolioAutonum
|
||||
Set temporary TBP to use in auto folio num
|
||||
*/
|
||||
void NewDiagramPage::setFolioAutonum(QString autoNum){
|
||||
TitleBlockProperties tbptemp = ipw->propertiesAutoNum(std::move(autoNum));
|
||||
ipw->setProperties(tbptemp);
|
||||
@@ -211,17 +211,17 @@ void NewDiagramPage::setFolioAutonum(QString autoNum){
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NewDiagramPage::saveCurrentTbp
|
||||
* Save current TBP to retrieve after auto folio num
|
||||
*/
|
||||
@brief NewDiagramPage::saveCurrentTbp
|
||||
Save current TBP to retrieve after auto folio num
|
||||
*/
|
||||
void NewDiagramPage::saveCurrentTbp(){
|
||||
savedTbp = ipw->properties();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NewDiagramPage::loadSavedTbp
|
||||
* Retrieve saved auto folio num
|
||||
*/
|
||||
@brief NewDiagramPage::loadSavedTbp
|
||||
Retrieve saved auto folio num
|
||||
*/
|
||||
void NewDiagramPage::loadSavedTbp(){
|
||||
ipw->setProperties(savedTbp);
|
||||
applyConf();
|
||||
@@ -304,9 +304,9 @@ PrintConfigPage::~PrintConfigPage() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief PrintConfigPage::applyConf
|
||||
* Apply the config of this page
|
||||
*/
|
||||
@brief PrintConfigPage::applyConf
|
||||
Apply the config of this page
|
||||
*/
|
||||
void PrintConfigPage::applyConf()
|
||||
{
|
||||
QString prefix = "print/default";
|
||||
|
||||
@@ -378,14 +378,14 @@ long Createdxf::RGBcodeTable[255]{
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Createdxf::getcolorCode
|
||||
* This function returns the ACI color which is the "nearest" color to
|
||||
* the color defined by the red, green and blue (RGB) values passed
|
||||
* in argument.
|
||||
* @param red
|
||||
* @param green
|
||||
* @param blue
|
||||
*/
|
||||
@brief Createdxf::getcolorCode
|
||||
This function returns the ACI color which is the "nearest" color to
|
||||
the color defined by the red, green and blue (RGB) values passed
|
||||
in argument.
|
||||
@param red
|
||||
@param green
|
||||
@param blue
|
||||
*/
|
||||
int Createdxf::getcolorCode (const long red, const long green, const long blue)
|
||||
{
|
||||
long acirgb, r,g,b;
|
||||
@@ -409,12 +409,12 @@ int Createdxf::getcolorCode (const long red, const long green, const long blue)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Createdxf::drawLine
|
||||
* Conveniance function to draw line
|
||||
* @param filepath
|
||||
* @param line
|
||||
* @param colorcode
|
||||
*/
|
||||
@brief Createdxf::drawLine
|
||||
Conveniance function to draw line
|
||||
@param filepath
|
||||
@param line
|
||||
@param colorcode
|
||||
*/
|
||||
void Createdxf::drawLine(const QString &filepath, const QLineF &line, const int &colorcode) {
|
||||
drawLine(filepath, line.p1().x() * xScale,
|
||||
sheetHeight - (line.p1().y() * yScale),
|
||||
@@ -547,12 +547,12 @@ void Createdxf::drawArcEllipse(const QString &file_path, qreal x, qreal y, qreal
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Createdxf::drawEllipse
|
||||
* Conveniance function for draw ellipse
|
||||
* @param filepath
|
||||
* @param rect
|
||||
* @param colorcode
|
||||
*/
|
||||
@brief Createdxf::drawEllipse
|
||||
Conveniance function for draw ellipse
|
||||
@param filepath
|
||||
@param rect
|
||||
@param colorcode
|
||||
*/
|
||||
void Createdxf::drawEllipse(const QString &filepath, const QRectF &rect, const int &colorcode) {
|
||||
drawArcEllipse(filepath, rect.topLeft().x() * xScale,
|
||||
sheetHeight - (rect.topLeft().y() * yScale),
|
||||
@@ -653,12 +653,12 @@ void Createdxf::drawRectangle (const QString &fileName, double x1, double y1, do
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Createdxf::drawRectangle
|
||||
* Conveniance function for draw rectangle
|
||||
* @param filepath
|
||||
* @param rect
|
||||
* @param color
|
||||
*/
|
||||
@brief Createdxf::drawRectangle
|
||||
Conveniance function for draw rectangle
|
||||
@param filepath
|
||||
@param rect
|
||||
@param color
|
||||
*/
|
||||
void Createdxf::drawRectangle(const QString &filepath, const QRectF &rect, const int &colorcode) {
|
||||
drawRectangle(filepath, rect.bottomLeft().x() * xScale,
|
||||
sheetHeight - (rect.bottomLeft().y() * yScale),
|
||||
|
||||
@@ -31,25 +31,81 @@ class Createdxf
|
||||
static void dxfBegin (const QString&);
|
||||
static void dxfEnd(const QString&);
|
||||
// you can add more functions to create more drawings.
|
||||
static void drawCircle(const QString&,double,double,double,int);
|
||||
static void drawArc(const QString&,double x,double y,double rad,double startAngle,double endAngle,int color);
|
||||
static void drawCircle(const QString&,
|
||||
double,
|
||||
double,
|
||||
double,
|
||||
int);
|
||||
static void drawArc(const QString&,
|
||||
double x,
|
||||
double y,
|
||||
double rad,
|
||||
double startAngle,
|
||||
double endAngle,
|
||||
int color);
|
||||
static void drawDonut(QString,double,double,double,int);
|
||||
|
||||
static void drawArcEllipse (const QString &file_path, qreal x, qreal y, qreal w, qreal h, qreal startAngle, qreal spanAngle, qreal hotspot_x, qreal hotspot_y, qreal rotation_angle, const int &colorcode);
|
||||
static void drawArcEllipse (const QString &file_path,
|
||||
qreal x,
|
||||
qreal y,
|
||||
qreal w,
|
||||
qreal h,
|
||||
qreal startAngle,
|
||||
qreal spanAngle,
|
||||
qreal hotspot_x,
|
||||
qreal hotspot_y,
|
||||
qreal rotation_angle,
|
||||
const int &colorcode);
|
||||
|
||||
static void drawEllipse (const QString &filepath, const QRectF &rect, const int &colorcode);
|
||||
static void drawEllipse (const QString &filepath,
|
||||
const QRectF &rect,
|
||||
const int &colorcode);
|
||||
|
||||
static void drawRectangle(const QString &filepath,double,double,double,double,const int &colorcode);
|
||||
static void drawRectangle(const QString &filepath, const QRectF &rect, const int &colorcode);
|
||||
static void drawRectangle(const QString &filepath,
|
||||
double,
|
||||
double,
|
||||
double,
|
||||
double,
|
||||
const int &colorcode);
|
||||
static void drawRectangle(const QString &filepath,
|
||||
const QRectF &rect,
|
||||
const int &colorcode);
|
||||
|
||||
static void drawLine(const QString &filapath,double,double,double,double, const int &clorcode);
|
||||
static void drawLine(const QString &filepath, const QLineF &line,const int &colorcode);
|
||||
static void drawLine(const QString &filapath,
|
||||
double,
|
||||
double,
|
||||
double,
|
||||
double,
|
||||
const int &clorcode);
|
||||
static void drawLine(const QString &filepath,
|
||||
const QLineF &line,
|
||||
const int &colorcode);
|
||||
|
||||
static void drawText(const QString&,const QString&,double,double,double,double,int);
|
||||
static void drawTextAligned(const QString& fileName, const QString& text,double x, double y, double height, double rotation, double oblique,int hAlign, int vAlign, double xAlign, double xScale, int colour, bool leftAlign = false, float scale = 0);
|
||||
static void drawText(const QString&,
|
||||
const QString&,
|
||||
double,double,
|
||||
double,
|
||||
double,
|
||||
int);
|
||||
static void drawTextAligned(const QString& fileName,
|
||||
const QString& text,
|
||||
double x,
|
||||
double y,
|
||||
double height,
|
||||
double rotation,
|
||||
double oblique,
|
||||
int hAlign,
|
||||
int vAlign,
|
||||
double xAlign,
|
||||
double xScale,
|
||||
int colour,
|
||||
bool leftAlign = false,
|
||||
float scale = 0);
|
||||
|
||||
|
||||
static int getcolorCode (const long red, const long green, const long blue);
|
||||
static int getcolorCode (const long red,
|
||||
const long green,
|
||||
const long blue);
|
||||
static long RGBcodeTable[];
|
||||
|
||||
static const double sheetWidth;
|
||||
|
||||
@@ -26,11 +26,11 @@
|
||||
#include <QSqlError>
|
||||
|
||||
/**
|
||||
* @brief projectDataBase::projectDataBase
|
||||
* Default constructor
|
||||
* @param project : project from the database work
|
||||
* @param parent : parent QObject
|
||||
*/
|
||||
@brief projectDataBase::projectDataBase
|
||||
Default constructor
|
||||
@param project : project from the database work
|
||||
@param parent : parent QObject
|
||||
*/
|
||||
projectDataBase::projectDataBase(QETProject *project, QObject *parent) :
|
||||
QObject(parent),
|
||||
m_project(project)
|
||||
@@ -46,18 +46,18 @@ projectDataBase::projectDataBase(QETProject *project, const QString &connection_
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief projectDataBase::~projectDataBase
|
||||
* Destructor
|
||||
*/
|
||||
@brief projectDataBase::~projectDataBase
|
||||
Destructor
|
||||
*/
|
||||
projectDataBase::~projectDataBase() {
|
||||
m_data_base.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief projectDataBase::updateDB
|
||||
* Up to date the content of the data base.
|
||||
* Emit the signal dataBaseUpdated
|
||||
*/
|
||||
@brief projectDataBase::updateDB
|
||||
Up to date the content of the data base.
|
||||
Emit the signal dataBaseUpdated
|
||||
*/
|
||||
void projectDataBase::updateDB()
|
||||
{
|
||||
populateDiagramTable();
|
||||
@@ -68,25 +68,25 @@ void projectDataBase::updateDB()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief projectDataBase::project
|
||||
* @return the project of this database
|
||||
*/
|
||||
@brief projectDataBase::project
|
||||
@return the project of this database
|
||||
*/
|
||||
QETProject *projectDataBase::project() const {
|
||||
return m_project;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief projectDataBase::newQuery
|
||||
* @return a QSqlquery with @query as query and the internal database of this class as database to use.
|
||||
*/
|
||||
@brief projectDataBase::newQuery
|
||||
@return a QSqlquery with @query as query and the internal database of this class as database to use.
|
||||
*/
|
||||
QSqlQuery projectDataBase::newQuery(const QString &query) {
|
||||
return QSqlQuery(query, m_data_base);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief projectDataBase::addElement
|
||||
* @param element
|
||||
*/
|
||||
@brief projectDataBase::addElement
|
||||
@param element
|
||||
*/
|
||||
void projectDataBase::addElement(Element *element)
|
||||
{
|
||||
m_insert_elements_query.bindValue(":uuid", element->uuid().toString());
|
||||
@@ -115,9 +115,9 @@ void projectDataBase::addElement(Element *element)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief projectDataBase::removeElement
|
||||
* @param element
|
||||
*/
|
||||
@brief projectDataBase::removeElement
|
||||
@param element
|
||||
*/
|
||||
void projectDataBase::removeElement(Element *element)
|
||||
{
|
||||
m_remove_element_query.bindValue(":uuid", element->uuid().toString());
|
||||
@@ -129,9 +129,9 @@ void projectDataBase::removeElement(Element *element)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief projectDataBase::elementInfoChanged
|
||||
* @param element
|
||||
*/
|
||||
@brief projectDataBase::elementInfoChanged
|
||||
@param element
|
||||
*/
|
||||
void projectDataBase::elementInfoChanged(Element *element)
|
||||
{
|
||||
auto hash = elementInfoToString(element);
|
||||
@@ -186,10 +186,10 @@ void projectDataBase::removeDiagram(Diagram *diagram)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief projectDataBase::createDataBase
|
||||
* Create the data base
|
||||
* @return : true if the data base was successfully created.
|
||||
*/
|
||||
@brief projectDataBase::createDataBase
|
||||
Create the data base
|
||||
@return : true if the data base was successfully created.
|
||||
*/
|
||||
bool projectDataBase::createDataBase(const QString &connection_name, const QString &name)
|
||||
{
|
||||
|
||||
@@ -285,8 +285,8 @@ bool projectDataBase::createDataBase(const QString &connection_name, const QStri
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief projectDataBase::createElementNomenclatureView
|
||||
*/
|
||||
@brief projectDataBase::createElementNomenclatureView
|
||||
*/
|
||||
void projectDataBase::createElementNomenclatureView()
|
||||
{
|
||||
QString create_view ("CREATE VIEW element_nomenclature_view AS SELECT "
|
||||
@@ -322,8 +322,8 @@ void projectDataBase::createElementNomenclatureView()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief projectDataBase::createSummaryView
|
||||
*/
|
||||
@brief projectDataBase::createSummaryView
|
||||
*/
|
||||
void projectDataBase::createSummaryView()
|
||||
{
|
||||
QString create_view ("CREATE VIEW project_summary_view AS SELECT "
|
||||
@@ -360,9 +360,9 @@ void projectDataBase::populateDiagramTable()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief projectDataBase::populateElementTable
|
||||
* Populate the element table
|
||||
*/
|
||||
@brief projectDataBase::populateElementTable
|
||||
Populate the element table
|
||||
*/
|
||||
void projectDataBase::populateElementTable()
|
||||
{
|
||||
QSqlQuery query_(m_data_base);
|
||||
@@ -388,9 +388,9 @@ void projectDataBase::populateElementTable()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief projectDataBase::populateElementsTable
|
||||
* Populate the elements table
|
||||
*/
|
||||
@brief projectDataBase::populateElementsTable
|
||||
Populate the elements table
|
||||
*/
|
||||
void projectDataBase::populateElementInfoTable()
|
||||
{
|
||||
QSqlQuery query(m_data_base);
|
||||
@@ -506,10 +506,10 @@ void projectDataBase::prepareQuery()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief projectDataBase::elementInfoToString
|
||||
* @param elmt
|
||||
* @return the element information in hash as key for the info name and value as the information value.
|
||||
*/
|
||||
@brief projectDataBase::elementInfoToString
|
||||
@param elmt
|
||||
@return the element information in hash as key for the info name and value as the information value.
|
||||
*/
|
||||
QHash<QString, QString> projectDataBase::elementInfoToString(Element *elmt)
|
||||
{
|
||||
QHash<QString, QString> hash; //Store the value for each columns
|
||||
@@ -527,14 +527,14 @@ QHash<QString, QString> projectDataBase::elementInfoToString(Element *elmt)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief projectDataBase::exportDb
|
||||
* @param parent
|
||||
* @param caption
|
||||
* @param dir
|
||||
* @param filter
|
||||
* @param selectedFilter
|
||||
* @param options
|
||||
*/
|
||||
@brief projectDataBase::exportDb
|
||||
@param parent
|
||||
@param caption
|
||||
@param dir
|
||||
@param filter
|
||||
@param selectedFilter
|
||||
@param options
|
||||
*/
|
||||
void projectDataBase::exportDb(projectDataBase *db, QWidget *parent, const QString &caption, const QString &dir)
|
||||
{
|
||||
auto caption_ = caption;
|
||||
|
||||
@@ -29,12 +29,12 @@ class QETProject;
|
||||
class Diagram;
|
||||
|
||||
/**
|
||||
* @brief The projectDataBase class
|
||||
* This class wrap a sqlite data base where you can find several thing about
|
||||
* the content of a project.
|
||||
@brief The projectDataBase class
|
||||
This class wrap a sqlite data base where you can find several thing about
|
||||
the content of a project.
|
||||
*
|
||||
* NOTE this class is still in developement.
|
||||
*/
|
||||
@note this class is still in developement.
|
||||
*/
|
||||
class projectDataBase : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "elementquerywidget.h"
|
||||
#include "ui_elementquerywidget.h"
|
||||
@@ -22,14 +22,14 @@
|
||||
#include <QRegularExpression>
|
||||
|
||||
/**
|
||||
* @brief ElementQueryWidget::ElementQueryWidget
|
||||
* @param parent
|
||||
*/
|
||||
@brief ElementQueryWidget::ElementQueryWidget
|
||||
@param parent
|
||||
*/
|
||||
ElementQueryWidget::ElementQueryWidget(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::ElementQueryWidget)
|
||||
QWidget(parent),
|
||||
ui(new Ui::ElementQueryWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->setupUi(this);
|
||||
|
||||
m_export_info.insert("position", tr("Position"));
|
||||
m_export_info.insert("title", tr("Titre du folio"));
|
||||
@@ -96,18 +96,18 @@ ElementQueryWidget::ElementQueryWidget(QWidget *parent) :
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementQueryWidget::~ElementQueryWidget
|
||||
*/
|
||||
@brief ElementQueryWidget::~ElementQueryWidget
|
||||
*/
|
||||
ElementQueryWidget::~ElementQueryWidget() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementQueryWidget::setQuery
|
||||
* @param query
|
||||
* Set the current query to @query.
|
||||
* If it's possible, rebuild the state of the widget from the query
|
||||
*/
|
||||
@brief ElementQueryWidget::setQuery
|
||||
@param query
|
||||
Set the current query to @query.
|
||||
If it's possible, rebuild the state of the widget from the query
|
||||
*/
|
||||
void ElementQueryWidget::setQuery(const QString &query)
|
||||
{
|
||||
if (query.startsWith("SELECT"))
|
||||
@@ -271,9 +271,9 @@ void ElementQueryWidget::setQuery(const QString &query)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementQueryWidget::queryStr
|
||||
* @return The current query
|
||||
*/
|
||||
@brief ElementQueryWidget::queryStr
|
||||
@return The current query
|
||||
*/
|
||||
QString ElementQueryWidget::queryStr() const
|
||||
{
|
||||
//User define is own query
|
||||
@@ -370,16 +370,16 @@ QString ElementQueryWidget::queryStr() const
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementQueryWidget::updateQueryLine
|
||||
*/
|
||||
@brief ElementQueryWidget::updateQueryLine
|
||||
*/
|
||||
void ElementQueryWidget::updateQueryLine() {
|
||||
ui->m_sql_query->setText(queryStr());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementQueryWidget::selectedKeys
|
||||
* @return the current keys of selected infos to be exported
|
||||
*/
|
||||
@brief ElementQueryWidget::selectedKeys
|
||||
@return the current keys of selected infos to be exported
|
||||
*/
|
||||
QStringList ElementQueryWidget::selectedKeys() const
|
||||
{
|
||||
//Made a string list with the colomns (keys) choosen by the user
|
||||
@@ -395,8 +395,8 @@ QStringList ElementQueryWidget::selectedKeys() const
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementQueryWidget::setUpItems
|
||||
*/
|
||||
@brief ElementQueryWidget::setUpItems
|
||||
*/
|
||||
void ElementQueryWidget::setUpItems()
|
||||
{
|
||||
for(QString key : QETApp::elementInfoKeys())
|
||||
@@ -419,18 +419,18 @@ void ElementQueryWidget::setUpItems()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementQueryWidget::FilterFor
|
||||
* @param key
|
||||
* @return the filter associated to key
|
||||
*/
|
||||
@brief ElementQueryWidget::FilterFor
|
||||
@param key
|
||||
@return the filter associated to key
|
||||
*/
|
||||
QPair<int, QString> ElementQueryWidget::FilterFor(const QString &key) const {
|
||||
return m_filter.value(key, qMakePair(0, QString()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementQueryWidget::fillSavedQuery
|
||||
* Fill the combobox of saved queries
|
||||
*/
|
||||
@brief ElementQueryWidget::fillSavedQuery
|
||||
Fill the combobox of saved queries
|
||||
*/
|
||||
void ElementQueryWidget::fillSavedQuery()
|
||||
{
|
||||
QFile file(QETApp::configDir() + "/nomenclature.json");
|
||||
@@ -446,8 +446,8 @@ void ElementQueryWidget::fillSavedQuery()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementQueryWidget::on_m_up_pb_clicked
|
||||
*/
|
||||
@brief ElementQueryWidget::on_m_up_pb_clicked
|
||||
*/
|
||||
void ElementQueryWidget::on_m_up_pb_clicked()
|
||||
{
|
||||
auto row = ui->m_choosen_list->currentRow();
|
||||
@@ -463,8 +463,8 @@ void ElementQueryWidget::on_m_up_pb_clicked()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementQueryWidget::on_m_add_pb_clicked
|
||||
*/
|
||||
@brief ElementQueryWidget::on_m_add_pb_clicked
|
||||
*/
|
||||
void ElementQueryWidget::on_m_add_pb_clicked()
|
||||
{
|
||||
if (auto *item = ui->m_var_list->takeItem(ui->m_var_list->currentRow())) {
|
||||
@@ -475,8 +475,8 @@ void ElementQueryWidget::on_m_add_pb_clicked()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementQueryWidget::on_m_remove_pb_clicked
|
||||
*/
|
||||
@brief ElementQueryWidget::on_m_remove_pb_clicked
|
||||
*/
|
||||
void ElementQueryWidget::on_m_remove_pb_clicked()
|
||||
{
|
||||
if (auto *item = ui->m_choosen_list->takeItem(ui->m_choosen_list->currentRow())) {
|
||||
@@ -487,8 +487,8 @@ void ElementQueryWidget::on_m_remove_pb_clicked()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementQueryWidget::on_m_down_pb_clicked
|
||||
*/
|
||||
@brief ElementQueryWidget::on_m_down_pb_clicked
|
||||
*/
|
||||
void ElementQueryWidget::on_m_down_pb_clicked()
|
||||
{
|
||||
auto row = ui->m_choosen_list->currentRow();
|
||||
@@ -504,8 +504,8 @@ void ElementQueryWidget::on_m_down_pb_clicked()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementQueryWidget::on_m_edit_sql_query_cb_clicked
|
||||
*/
|
||||
@brief ElementQueryWidget::on_m_edit_sql_query_cb_clicked
|
||||
*/
|
||||
void ElementQueryWidget::on_m_edit_sql_query_cb_clicked()
|
||||
{
|
||||
ui->m_sql_query->setEnabled(ui->m_edit_sql_query_cb->isChecked());
|
||||
@@ -524,9 +524,9 @@ void ElementQueryWidget::on_m_edit_sql_query_cb_clicked()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementQueryWidget::on_m_filter_le_textEdited
|
||||
* @param arg1
|
||||
*/
|
||||
@brief ElementQueryWidget::on_m_filter_le_textEdited
|
||||
@param arg1
|
||||
*/
|
||||
void ElementQueryWidget::on_m_filter_le_textEdited(const QString &arg1)
|
||||
{
|
||||
if (auto item = ui->m_choosen_list->currentItem())
|
||||
@@ -541,9 +541,9 @@ void ElementQueryWidget::on_m_filter_le_textEdited(const QString &arg1)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementQueryWidget::on_m_filter_type_cb_activated
|
||||
* @param index
|
||||
*/
|
||||
@brief ElementQueryWidget::on_m_filter_type_cb_activated
|
||||
@param index
|
||||
*/
|
||||
void ElementQueryWidget::on_m_filter_type_cb_activated(int index)
|
||||
{
|
||||
if (auto item = ui->m_choosen_list->currentItem())
|
||||
@@ -559,9 +559,9 @@ void ElementQueryWidget::on_m_filter_type_cb_activated(int index)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementQueryWidget::on_m_load_pb_clicked
|
||||
* Load a query from nomenclature.json file
|
||||
*/
|
||||
@brief ElementQueryWidget::on_m_load_pb_clicked
|
||||
Load a query from nomenclature.json file
|
||||
*/
|
||||
void ElementQueryWidget::on_m_load_pb_clicked()
|
||||
{
|
||||
auto name = ui->m_conf_cb->currentText();
|
||||
@@ -589,9 +589,9 @@ void ElementQueryWidget::on_m_load_pb_clicked()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementQueryWidget::on_m_save_current_conf_pb_clicked
|
||||
* Save the actual query to nomenclature.json file
|
||||
*/
|
||||
@brief ElementQueryWidget::on_m_save_current_conf_pb_clicked
|
||||
Save the actual query to nomenclature.json file
|
||||
*/
|
||||
void ElementQueryWidget::on_m_save_current_conf_pb_clicked()
|
||||
{
|
||||
QFile file_(QETApp::configDir() + "/nomenclature.json");
|
||||
@@ -648,9 +648,9 @@ void ElementQueryWidget::on_m_choosen_list_itemDoubleClicked(QListWidgetItem *it
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementQueryWidget::reset
|
||||
* Clear this widget aka set to initial state
|
||||
*/
|
||||
@brief ElementQueryWidget::reset
|
||||
Clear this widget aka set to initial state
|
||||
*/
|
||||
void ElementQueryWidget::reset()
|
||||
{
|
||||
//Ugly hack to force to remove all selected infos
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef ELEMENTQUERYWIDGET_H
|
||||
#define ELEMENTQUERYWIDGET_H
|
||||
@@ -28,13 +28,13 @@ class ElementQueryWidget;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief The ElementQueryWidget class
|
||||
* A widget use to edit a sql query for get element information
|
||||
* This widget only work to get information from ProjectDataBase
|
||||
*/
|
||||
@brief The ElementQueryWidget class
|
||||
A widget use to edit a sql query for get element information
|
||||
This widget only work to get information from ProjectDataBase
|
||||
*/
|
||||
class ElementQueryWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ElementQueryWidget(QWidget *parent = nullptr);
|
||||
|
||||
@@ -22,14 +22,14 @@
|
||||
#include <QListWidgetItem>
|
||||
|
||||
/**
|
||||
* @brief SummaryQueryWidget::SummaryQueryWidget
|
||||
* @param parent
|
||||
*/
|
||||
@brief SummaryQueryWidget::SummaryQueryWidget
|
||||
@param parent
|
||||
*/
|
||||
SummaryQueryWidget::SummaryQueryWidget(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
QWidget(parent),
|
||||
ui(new Ui::SummaryQueryWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->setupUi(this);
|
||||
|
||||
setUpItems();
|
||||
fillSavedQuery();
|
||||
@@ -39,17 +39,17 @@ SummaryQueryWidget::SummaryQueryWidget(QWidget *parent) :
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SummaryQueryWidget::~SummaryQueryWidget
|
||||
*/
|
||||
@brief SummaryQueryWidget::~SummaryQueryWidget
|
||||
*/
|
||||
SummaryQueryWidget::~SummaryQueryWidget()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SummaryQueryWidget::queryStr
|
||||
* @return The current query string
|
||||
*/
|
||||
@brief SummaryQueryWidget::queryStr
|
||||
@return The current query string
|
||||
*/
|
||||
QString SummaryQueryWidget::queryStr() const
|
||||
{
|
||||
//User define is own query
|
||||
@@ -80,11 +80,11 @@ QString SummaryQueryWidget::queryStr() const
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SummaryQueryWidget::setQuery
|
||||
* @param query
|
||||
* set the current query to @query.
|
||||
* If it's possible, rebuild the state of the widget from the query
|
||||
*/
|
||||
@brief SummaryQueryWidget::setQuery
|
||||
@param query
|
||||
set the current query to @query.
|
||||
If it's possible, rebuild the state of the widget from the query
|
||||
*/
|
||||
void SummaryQueryWidget::setQuery(const QString &query)
|
||||
{
|
||||
if (query.startsWith("SELECT"))
|
||||
@@ -114,8 +114,8 @@ void SummaryQueryWidget::setQuery(const QString &query)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SummaryQueryWidget::setUpItems
|
||||
*/
|
||||
@brief SummaryQueryWidget::setUpItems
|
||||
*/
|
||||
void SummaryQueryWidget::setUpItems()
|
||||
{
|
||||
for (auto key : QETApp::diagramInfoKeys())
|
||||
@@ -133,9 +133,9 @@ void SummaryQueryWidget::setUpItems()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SummaryQueryWidget::fillSavedQuery
|
||||
* Fill the combo box of the saved query
|
||||
*/
|
||||
@brief SummaryQueryWidget::fillSavedQuery
|
||||
Fill the combo box of the saved query
|
||||
*/
|
||||
void SummaryQueryWidget::fillSavedQuery()
|
||||
{
|
||||
QFile file(QETApp::configDir() + "/summary.json");
|
||||
@@ -151,16 +151,16 @@ void SummaryQueryWidget::fillSavedQuery()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SummaryQueryWidget::updateQueryLine
|
||||
*/
|
||||
@brief SummaryQueryWidget::updateQueryLine
|
||||
*/
|
||||
void SummaryQueryWidget::updateQueryLine() {
|
||||
ui->m_user_query_le->setText(queryStr());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SummaryQueryWidget::selectedKeys
|
||||
* @return
|
||||
*/
|
||||
@brief SummaryQueryWidget::selectedKeys
|
||||
@return
|
||||
*/
|
||||
QStringList SummaryQueryWidget::selectedKeys() const
|
||||
{
|
||||
//Made a string list with the colomns (keys) choosen by the user
|
||||
@@ -176,9 +176,9 @@ QStringList SummaryQueryWidget::selectedKeys() const
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SummaryQueryWidget::on_m_available_list_itemDoubleClicked
|
||||
* @param item
|
||||
*/
|
||||
@brief SummaryQueryWidget::on_m_available_list_itemDoubleClicked
|
||||
@param item
|
||||
*/
|
||||
void SummaryQueryWidget::on_m_available_list_itemDoubleClicked(QListWidgetItem *item)
|
||||
{
|
||||
Q_UNUSED(item)
|
||||
@@ -186,9 +186,9 @@ void SummaryQueryWidget::on_m_available_list_itemDoubleClicked(QListWidgetItem *
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SummaryQueryWidget::on_m_choosen_list_itemDoubleClicked
|
||||
* @param item
|
||||
*/
|
||||
@brief SummaryQueryWidget::on_m_choosen_list_itemDoubleClicked
|
||||
@param item
|
||||
*/
|
||||
void SummaryQueryWidget::on_m_choosen_list_itemDoubleClicked(QListWidgetItem *item)
|
||||
{
|
||||
Q_UNUSED(item)
|
||||
@@ -196,8 +196,8 @@ void SummaryQueryWidget::on_m_choosen_list_itemDoubleClicked(QListWidgetItem *it
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SummaryQueryWidget::on_m_up_pb_clicked
|
||||
*/
|
||||
@brief SummaryQueryWidget::on_m_up_pb_clicked
|
||||
*/
|
||||
void SummaryQueryWidget::on_m_up_pb_clicked()
|
||||
{
|
||||
auto row = ui->m_choosen_list->currentRow();
|
||||
@@ -213,8 +213,8 @@ void SummaryQueryWidget::on_m_up_pb_clicked()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SummaryQueryWidget::on_m_add_pb_clicked
|
||||
*/
|
||||
@brief SummaryQueryWidget::on_m_add_pb_clicked
|
||||
*/
|
||||
void SummaryQueryWidget::on_m_add_pb_clicked()
|
||||
{
|
||||
if (auto *item = ui->m_available_list->takeItem(ui->m_available_list->currentRow())) {
|
||||
@@ -225,8 +225,8 @@ void SummaryQueryWidget::on_m_add_pb_clicked()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SummaryQueryWidget::on_m_remove_pb_clicked
|
||||
*/
|
||||
@brief SummaryQueryWidget::on_m_remove_pb_clicked
|
||||
*/
|
||||
void SummaryQueryWidget::on_m_remove_pb_clicked()
|
||||
{
|
||||
if (auto *item = ui->m_choosen_list->takeItem(ui->m_choosen_list->currentRow())) {
|
||||
@@ -237,8 +237,8 @@ void SummaryQueryWidget::on_m_remove_pb_clicked()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SummaryQueryWidget::on_m_down_pb_clicked
|
||||
*/
|
||||
@brief SummaryQueryWidget::on_m_down_pb_clicked
|
||||
*/
|
||||
void SummaryQueryWidget::on_m_down_pb_clicked()
|
||||
{
|
||||
auto row = ui->m_choosen_list->currentRow();
|
||||
@@ -254,8 +254,8 @@ void SummaryQueryWidget::on_m_down_pb_clicked()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SummaryQueryWidget::on_m_edit_sql_query_cb_clicked
|
||||
*/
|
||||
@brief SummaryQueryWidget::on_m_edit_sql_query_cb_clicked
|
||||
*/
|
||||
void SummaryQueryWidget::on_m_edit_sql_query_cb_clicked()
|
||||
{
|
||||
ui->m_user_query_le->setEnabled(ui->m_edit_sql_query_cb->isChecked());
|
||||
@@ -273,9 +273,9 @@ void SummaryQueryWidget::on_m_edit_sql_query_cb_clicked()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SummaryQueryWidget::reset
|
||||
* Clear this widget aka set to initial state
|
||||
*/
|
||||
@brief SummaryQueryWidget::reset
|
||||
Clear this widget aka set to initial state
|
||||
*/
|
||||
void SummaryQueryWidget::reset()
|
||||
{
|
||||
//Ugly hack to force to remove all selected infos
|
||||
@@ -286,8 +286,8 @@ void SummaryQueryWidget::reset()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SummaryQueryWidget::saveConfig
|
||||
*/
|
||||
@brief SummaryQueryWidget::saveConfig
|
||||
*/
|
||||
void SummaryQueryWidget::saveConfig()
|
||||
{
|
||||
QFile file_(QETApp::configDir() + "/summary.json");
|
||||
@@ -316,8 +316,8 @@ void SummaryQueryWidget::saveConfig()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SummaryQueryWidget::loadConfig
|
||||
*/
|
||||
@brief SummaryQueryWidget::loadConfig
|
||||
*/
|
||||
void SummaryQueryWidget::loadConfig()
|
||||
{
|
||||
auto name = ui->m_config_gb->selectedText();
|
||||
|
||||
@@ -28,7 +28,7 @@ class SummaryQueryWidget;
|
||||
|
||||
class SummaryQueryWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SummaryQueryWidget(QWidget *parent = nullptr);
|
||||
|
||||
@@ -1484,7 +1484,7 @@ bool Diagram::fromXml(QDomElement &document,
|
||||
* @param folioSeq type
|
||||
* @param seq type
|
||||
* @param type of sequential
|
||||
*/
|
||||
*/
|
||||
void Diagram::folioSequentialsFromXml(const QDomElement &root,
|
||||
QHash<QString,
|
||||
QStringList>* hash,
|
||||
@@ -1727,7 +1727,7 @@ void Diagram::updateLabels()
|
||||
* @param sequential to be treated
|
||||
* @param type to be treated
|
||||
* @param Numerotation Context to be manipulated
|
||||
*/
|
||||
*/
|
||||
void Diagram::insertFolioSeqHash(QHash<QString,
|
||||
QStringList> *hash,
|
||||
const QString& title,
|
||||
|
||||
@@ -30,16 +30,16 @@
|
||||
#include "qetgraphicstableitem.h"
|
||||
|
||||
/**
|
||||
* @brief DiagramContent::DiagramContent
|
||||
*/
|
||||
@brief DiagramContent::DiagramContent
|
||||
*/
|
||||
DiagramContent::DiagramContent() {}
|
||||
|
||||
/**
|
||||
* @brief DiagramContent::DiagramContent
|
||||
* Constructor
|
||||
* @param diagram : Construct a diagramContent and fill it with the selected item of @diagram
|
||||
* @param selected : this diagramcontent get only selected items if true.
|
||||
*/
|
||||
@brief DiagramContent::DiagramContent
|
||||
Constructor
|
||||
@param diagram : Construct a diagramContent and fill it with the selected item of @diagram
|
||||
@param selected : this diagramcontent get only selected items if true.
|
||||
*/
|
||||
DiagramContent::DiagramContent(Diagram *diagram, bool selected) :
|
||||
m_selected_items(diagram->selectedItems())
|
||||
{
|
||||
@@ -120,12 +120,12 @@ DiagramContent::~DiagramContent()
|
||||
{}
|
||||
|
||||
/**
|
||||
* @brief DiagramContent::selectedTexts
|
||||
* @return a list of every selected texts (every kind of texts)
|
||||
* Note that the returned list of texts, correspond to the selected texts
|
||||
* at the moment of the creation of this DiagramContent,
|
||||
* with the constructor : DiagramContent::DiagramContent(Diagram *diagram)
|
||||
*/
|
||||
@brief DiagramContent::selectedTexts
|
||||
@return a list of every selected texts (every kind of texts)
|
||||
Note that the returned list of texts, correspond to the selected texts
|
||||
at the moment of the creation of this DiagramContent,
|
||||
with the constructor : DiagramContent::DiagramContent(Diagram *diagram)
|
||||
*/
|
||||
QList<DiagramTextItem *> DiagramContent::selectedTexts() const
|
||||
{
|
||||
QList<DiagramTextItem *> selected_texts;
|
||||
@@ -140,12 +140,12 @@ QList<DiagramTextItem *> DiagramContent::selectedTexts() const
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramContent::selectedTextsGroup
|
||||
* @return a list of selected texts group
|
||||
* Note that the returned list of texts group, correspond to the selected texts group
|
||||
* at the moment of the creation of this DiagramContent,
|
||||
* with the constructor : DiagramContent::DiagramContent(Diagram *diagram)
|
||||
*/
|
||||
@brief DiagramContent::selectedTextsGroup
|
||||
@return a list of selected texts group
|
||||
Note that the returned list of texts group, correspond to the selected texts group
|
||||
at the moment of the creation of this DiagramContent,
|
||||
with the constructor : DiagramContent::DiagramContent(Diagram *diagram)
|
||||
*/
|
||||
QList<ElementTextItemGroup *> DiagramContent::selectedTextsGroup() const
|
||||
{
|
||||
QList<ElementTextItemGroup *> groups;
|
||||
@@ -159,10 +159,10 @@ QList<ElementTextItemGroup *> DiagramContent::selectedTextsGroup() const
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramContent::conductors
|
||||
* @param filter
|
||||
* @return Every conductors according to the filter
|
||||
*/
|
||||
@brief DiagramContent::conductors
|
||||
@param filter
|
||||
@return Every conductors according to the filter
|
||||
*/
|
||||
QList<Conductor *> DiagramContent::conductors(int filter) const
|
||||
{
|
||||
QList<Conductor *> result;
|
||||
@@ -180,12 +180,12 @@ QList<Conductor *> DiagramContent::conductors(int filter) const
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramContent::hasDeletableItems
|
||||
* @return true if this diagram content have deletable item
|
||||
* The deletable items correspond to the selected items of diagram
|
||||
* at the moment of the creation of this DiagramContent,
|
||||
* with the constructor : DiagramContent::DiagramContent(Diagram *diagram)
|
||||
*/
|
||||
@brief DiagramContent::hasDeletableItems
|
||||
@return true if this diagram content have deletable item
|
||||
The deletable items correspond to the selected items of diagram
|
||||
at the moment of the creation of this DiagramContent,
|
||||
with the constructor : DiagramContent::DiagramContent(Diagram *diagram)
|
||||
*/
|
||||
bool DiagramContent::hasDeletableItems() const
|
||||
{
|
||||
for(QGraphicsItem *qgi : m_selected_items)
|
||||
@@ -206,9 +206,9 @@ bool DiagramContent::hasDeletableItems() const
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramContent::hasCopiableItems
|
||||
* @return true if this diagram content have copiable items.
|
||||
*/
|
||||
@brief DiagramContent::hasCopiableItems
|
||||
@return true if this diagram content have copiable items.
|
||||
*/
|
||||
bool DiagramContent::hasCopiableItems() const
|
||||
{
|
||||
if(!m_images.isEmpty()) return true;
|
||||
@@ -220,9 +220,9 @@ bool DiagramContent::hasCopiableItems() const
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramContent::clear
|
||||
* Remove all items from the diagram content
|
||||
*/
|
||||
@brief DiagramContent::clear
|
||||
Remove all items from the diagram content
|
||||
*/
|
||||
void DiagramContent::clear()
|
||||
{
|
||||
m_elements.clear();
|
||||
@@ -239,10 +239,10 @@ void DiagramContent::clear()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramContent::removeNonMovableItems
|
||||
* Remove all non movable item.
|
||||
* @return : return the numbers of removed item
|
||||
*/
|
||||
@brief DiagramContent::removeNonMovableItems
|
||||
Remove all non movable item.
|
||||
@return : return the numbers of removed item
|
||||
*/
|
||||
int DiagramContent::removeNonMovableItems()
|
||||
{
|
||||
int count_ = 0;
|
||||
@@ -333,10 +333,10 @@ DiagramContent &DiagramContent::operator+=(const DiagramContent &other)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramContent::potentialIsManaged
|
||||
* @param conductors a list of conductors at the same potential.
|
||||
* @return true, if m_potential_conductors already have a conductor of this potential.
|
||||
*/
|
||||
@brief DiagramContent::potentialIsManaged
|
||||
@param conductors a list of conductors at the same potential.
|
||||
@return true, if m_potential_conductors already have a conductor of this potential.
|
||||
*/
|
||||
bool DiagramContent::potentialIsManaged(QList<Conductor *> conductors)
|
||||
{
|
||||
bool b = false;
|
||||
@@ -351,9 +351,9 @@ bool DiagramContent::potentialIsManaged(QList<Conductor *> conductors)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramContent::hasTextEditing
|
||||
* @return true if handle a text currently in editing intercation
|
||||
*/
|
||||
@brief DiagramContent::hasTextEditing
|
||||
@return true if handle a text currently in editing intercation
|
||||
*/
|
||||
bool DiagramContent::hasTextEditing()
|
||||
{
|
||||
for (DiagramTextItem *dti : selectedTexts()) {
|
||||
@@ -366,10 +366,10 @@ bool DiagramContent::hasTextEditing()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramContent::items
|
||||
* @param filter
|
||||
* @return The items of this diagram content according to @filter
|
||||
*/
|
||||
@brief DiagramContent::items
|
||||
@param filter
|
||||
@return The items of this diagram content according to @filter
|
||||
*/
|
||||
QList<QGraphicsItem *> DiagramContent::items(int filter) const
|
||||
{
|
||||
QList<QGraphicsItem *> items_list;
|
||||
@@ -393,10 +393,10 @@ QList<QGraphicsItem *> DiagramContent::items(int filter) const
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramContent::count
|
||||
* @param filter
|
||||
* @return The number of items, according to @filter
|
||||
*/
|
||||
@brief DiagramContent::count
|
||||
@param filter
|
||||
@return The number of items, according to @filter
|
||||
*/
|
||||
int DiagramContent::count(int filter) const
|
||||
{
|
||||
int count = 0;
|
||||
@@ -428,11 +428,11 @@ int DiagramContent::count(int filter) const
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramContent::sentence
|
||||
* @param filter
|
||||
* @return A string that describe the items of the diagram content according to @filter.
|
||||
* Exemple : X elements, Y conductors etc....
|
||||
*/
|
||||
@brief DiagramContent::sentence
|
||||
@param filter
|
||||
@return A string that describe the items of the diagram content according to @filter.
|
||||
Exemple : X elements, Y conductors etc....
|
||||
*/
|
||||
QString DiagramContent::sentence(int filter) const
|
||||
{
|
||||
int elements_count = (filter & Elements) ? m_elements.count() : 0;
|
||||
@@ -457,11 +457,11 @@ QString DiagramContent::sentence(int filter) const
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief operator << Use to debug a diagram content
|
||||
* @param d : QDebug to use for display the debug info
|
||||
* @param content : content to debug
|
||||
* @return
|
||||
*/
|
||||
@brief operator << Use to debug a diagram content
|
||||
@param d : QDebug to use for display the debug info
|
||||
@param content : content to debug
|
||||
@return
|
||||
*/
|
||||
QDebug &operator<<(QDebug d, DiagramContent &content) {
|
||||
Q_UNUSED(content)
|
||||
d << "DiagramContent {" << "\n";
|
||||
|
||||
@@ -21,13 +21,13 @@
|
||||
#include <QDebug>
|
||||
|
||||
/**
|
||||
* @brief DiagramContext::add
|
||||
* Add all value of @other to this.
|
||||
* If a key already exist, the value is replaced.
|
||||
* If a key doesn't exist, she will be added.
|
||||
* All other keys of this context, which are not present in @other, stay unchanged.
|
||||
* @param other
|
||||
*/
|
||||
@brief DiagramContext::add
|
||||
Add all value of @other to this.
|
||||
If a key already exist, the value is replaced.
|
||||
If a key doesn't exist, she will be added.
|
||||
All other keys of this context, which are not present in @other, stay unchanged.
|
||||
@param other
|
||||
*/
|
||||
void DiagramContext::add(DiagramContext other)
|
||||
{
|
||||
for (QString key : other.keys()) {
|
||||
@@ -36,9 +36,9 @@ void DiagramContext::add(DiagramContext other)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramContext::remove
|
||||
* @param key
|
||||
*/
|
||||
@brief DiagramContext::remove
|
||||
@param key
|
||||
*/
|
||||
void DiagramContext::remove(const QString &key) {
|
||||
m_content.remove(key);
|
||||
}
|
||||
@@ -117,9 +117,9 @@ int DiagramContext::count() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramContext::keyMustShow
|
||||
* @return the value pairs with key, if key no found, return false
|
||||
*/
|
||||
@brief DiagramContext::keyMustShow
|
||||
@return the value pairs with key, if key no found, return false
|
||||
*/
|
||||
bool DiagramContext::keyMustShow(const QString &key) const {
|
||||
if (m_content_show.contains(key))
|
||||
return m_content_show[key];
|
||||
@@ -163,11 +163,11 @@ void DiagramContext::fromXml(const QDomElement &e, const QString &tag_name) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramContext::fromXml
|
||||
* Read this context properties from the @dom_element, looking for tags named @tag_name
|
||||
* @param dom_element : dom element to parse
|
||||
* @param tag_name : tag name to find, by default "property"
|
||||
*/
|
||||
@brief DiagramContext::fromXml
|
||||
Read this context properties from the @dom_element, looking for tags named @tag_name
|
||||
@param dom_element : dom element to parse
|
||||
@param tag_name : tag name to find, by default "property"
|
||||
*/
|
||||
void DiagramContext::fromXml(const pugi::xml_node &dom_element, const QString &tag_name)
|
||||
{
|
||||
for(auto node = dom_element.child(tag_name.toStdString().c_str()) ; node ; node = node.next_sibling(tag_name.toStdString().c_str()))
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
* location -> the location assigned to the element
|
||||
* frozenLabel -> label locked at a given time
|
||||
*
|
||||
*/
|
||||
*/
|
||||
class DiagramContext
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -24,12 +24,12 @@
|
||||
|
||||
|
||||
/**
|
||||
* @brief DiagramEventAddElement::DiagramEventAddElement
|
||||
* Defaut constructor
|
||||
* @param location :location of diagram
|
||||
* @param diagram : diagram owner of this event
|
||||
* @param pos : first pos of item ( optional, by defaut QPointF(0,0) )
|
||||
*/
|
||||
@brief DiagramEventAddElement::DiagramEventAddElement
|
||||
Defaut constructor
|
||||
@param location :location of diagram
|
||||
@param diagram : diagram owner of this event
|
||||
@param pos : first pos of item ( optional, by defaut QPointF(0,0) )
|
||||
*/
|
||||
DiagramEventAddElement::DiagramEventAddElement(ElementsLocation &location, Diagram *diagram, QPointF pos) :
|
||||
DiagramEventInterface(diagram),
|
||||
m_location(location),
|
||||
@@ -53,10 +53,10 @@ DiagramEventAddElement::DiagramEventAddElement(ElementsLocation &location, Diagr
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramEventAddElement::~DiagramEventAddElement
|
||||
* Destructor
|
||||
* Enable context menu for each view of diagram
|
||||
*/
|
||||
@brief DiagramEventAddElement::~DiagramEventAddElement
|
||||
Destructor
|
||||
Enable context menu for each view of diagram
|
||||
*/
|
||||
DiagramEventAddElement::~DiagramEventAddElement()
|
||||
{
|
||||
if (m_element)
|
||||
@@ -69,11 +69,11 @@ DiagramEventAddElement::~DiagramEventAddElement()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramEventAddElement::mouseMoveEvent
|
||||
* Move the element to new pos of mouse
|
||||
* the event is always accepted
|
||||
* @param event
|
||||
*/
|
||||
@brief DiagramEventAddElement::mouseMoveEvent
|
||||
Move the element to new pos of mouse
|
||||
the event is always accepted
|
||||
@param event
|
||||
*/
|
||||
void DiagramEventAddElement::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
if (m_element) {
|
||||
@@ -83,22 +83,22 @@ void DiagramEventAddElement::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramEventAddElement::mousePressEvent
|
||||
* Do nothing, but return true for not transit the event to other thing in diagram.
|
||||
* the event is always accepted
|
||||
* @param event
|
||||
*/
|
||||
@brief DiagramEventAddElement::mousePressEvent
|
||||
Do nothing, but return true for not transit the event to other thing in diagram.
|
||||
the event is always accepted
|
||||
@param event
|
||||
*/
|
||||
void DiagramEventAddElement::mousePressEvent(QGraphicsSceneMouseEvent *event) {
|
||||
event->setAccepted(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramEventAddElement::mouseReleaseEvent
|
||||
* Right button finish this event (isRunning = false) and emit finish.
|
||||
* Left button add an element to diagram
|
||||
* the event is always accepted
|
||||
* @param event
|
||||
*/
|
||||
@brief DiagramEventAddElement::mouseReleaseEvent
|
||||
Right button finish this event (isRunning = false) and emit finish.
|
||||
Left button add an element to diagram
|
||||
the event is always accepted
|
||||
@param event
|
||||
*/
|
||||
void DiagramEventAddElement::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
if (m_element)
|
||||
@@ -121,11 +121,11 @@ void DiagramEventAddElement::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramEventAddElement::mouseDoubleClickEvent
|
||||
* If mouse left double clic, finish this event (isRunning = false) and emit finish
|
||||
* the event is always accepted
|
||||
* @param event
|
||||
*/
|
||||
@brief DiagramEventAddElement::mouseDoubleClickEvent
|
||||
If mouse left double clic, finish this event (isRunning = false) and emit finish
|
||||
the event is always accepted
|
||||
@param event
|
||||
*/
|
||||
void DiagramEventAddElement::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
if (m_element && (event -> button() == Qt::LeftButton))
|
||||
@@ -141,11 +141,11 @@ void DiagramEventAddElement::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *eve
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramEventAddElement::keyPressEvent
|
||||
* Press space key rotate the element to 90° (return true)
|
||||
* else call DiagramEventInterface::keyPressEvent(event), and return the value.
|
||||
* @param event
|
||||
*/
|
||||
@brief DiagramEventAddElement::keyPressEvent
|
||||
Press space key rotate the element to 90° (return true)
|
||||
else call DiagramEventInterface::keyPressEvent(event), and return the value.
|
||||
@param event
|
||||
*/
|
||||
void DiagramEventAddElement::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
if (m_element && event->key() == Qt::Key_Space)
|
||||
@@ -159,9 +159,9 @@ void DiagramEventAddElement::keyPressEvent(QKeyEvent *event)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramEventAddElement::init
|
||||
* Init this event.
|
||||
*/
|
||||
@brief DiagramEventAddElement::init
|
||||
Init this event.
|
||||
*/
|
||||
void DiagramEventAddElement::init()
|
||||
{
|
||||
foreach(QGraphicsView *view, m_diagram->views())
|
||||
@@ -169,9 +169,9 @@ void DiagramEventAddElement::init()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramEventAddElement::buildElement
|
||||
* Build the element, if the element is build successfully, we return true, otherwise false
|
||||
*/
|
||||
@brief DiagramEventAddElement::buildElement
|
||||
Build the element, if the element is build successfully, we return true, otherwise false
|
||||
*/
|
||||
bool DiagramEventAddElement::buildElement()
|
||||
{
|
||||
ElementsLocation import_loc = m_diagram->project()->importElement(m_location);
|
||||
@@ -196,10 +196,10 @@ bool DiagramEventAddElement::buildElement()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramEventAddElement::addElement
|
||||
* Add an element at the current pos en current rotation,
|
||||
* if project autoconductor option is enable, and the element can be wired, we do it.
|
||||
*/
|
||||
@brief DiagramEventAddElement::addElement
|
||||
Add an element at the current pos en current rotation,
|
||||
if project autoconductor option is enable, and the element can be wired, we do it.
|
||||
*/
|
||||
void DiagramEventAddElement::addElement()
|
||||
{
|
||||
int state;
|
||||
@@ -243,7 +243,7 @@ void DiagramEventAddElement::addElement()
|
||||
if (m_diagram->freezeNewConductors() || m_diagram->project()->isFreezeNewConductors()) {
|
||||
conductor->setFreezeLabel(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_diagram -> undoStack().push(undo_object);
|
||||
element->setUpFormula();
|
||||
|
||||
@@ -24,10 +24,10 @@
|
||||
class Element;
|
||||
|
||||
/**
|
||||
* @brief The DiagramEventAddElement class
|
||||
* This diagram event add a new element, for each left click button at the position of click.
|
||||
* Space key rotate current element by 90°, right click button finish this event.
|
||||
*/
|
||||
@brief The DiagramEventAddElement class
|
||||
This diagram event add a new element, for each left click button at the position of click.
|
||||
Space key rotate current element by 90°, right click button finish this event.
|
||||
*/
|
||||
class DiagramEventAddElement : public DiagramEventInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "diagrameventaddimage.h"
|
||||
@@ -22,38 +22,38 @@
|
||||
#include "diagramcommands.h"
|
||||
|
||||
/**
|
||||
* @brief DiagramEventAddImage::DiagramEventAddImage
|
||||
* Default constructor
|
||||
* @param diagram : diagram where operate this event
|
||||
*/
|
||||
@brief DiagramEventAddImage::DiagramEventAddImage
|
||||
Default constructor
|
||||
@param diagram : diagram where operate this event
|
||||
*/
|
||||
DiagramEventAddImage::DiagramEventAddImage(Diagram *diagram) :
|
||||
DiagramEventInterface(diagram),
|
||||
m_image (nullptr),
|
||||
m_is_added (false)
|
||||
DiagramEventInterface(diagram),
|
||||
m_image (nullptr),
|
||||
m_is_added (false)
|
||||
{
|
||||
openDialog();
|
||||
openDialog();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramEventAddImage::~DiagramEventAddImage
|
||||
*/
|
||||
@brief DiagramEventAddImage::~DiagramEventAddImage
|
||||
*/
|
||||
DiagramEventAddImage::~DiagramEventAddImage()
|
||||
{
|
||||
if (m_running || m_abort)
|
||||
{
|
||||
if (m_is_added) m_diagram->removeItem(m_image);
|
||||
delete m_image;
|
||||
}
|
||||
if (m_running || m_abort)
|
||||
{
|
||||
if (m_is_added) m_diagram->removeItem(m_image);
|
||||
delete m_image;
|
||||
}
|
||||
|
||||
foreach (QGraphicsView *view, m_diagram->views())
|
||||
view->setContextMenuPolicy((Qt::DefaultContextMenu));
|
||||
foreach (QGraphicsView *view, m_diagram->views())
|
||||
view->setContextMenuPolicy((Qt::DefaultContextMenu));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramEventAddImage::mousePressEvent
|
||||
* Action when mouse is pressed
|
||||
* @param event : event of mouse pressed
|
||||
*/
|
||||
@brief DiagramEventAddImage::mousePressEvent
|
||||
Action when mouse is pressed
|
||||
@param event : event of mouse pressed
|
||||
*/
|
||||
void DiagramEventAddImage::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
if (m_image && event -> button() == Qt::LeftButton)
|
||||
@@ -79,10 +79,10 @@ void DiagramEventAddImage::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramEventAddImage::mouseMoveEvent
|
||||
* Action when mouse move
|
||||
* @param event : event of mouse move
|
||||
*/
|
||||
@brief DiagramEventAddImage::mouseMoveEvent
|
||||
Action when mouse move
|
||||
@param event : event of mouse move
|
||||
*/
|
||||
void DiagramEventAddImage::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
if (!m_image || event->buttons() != Qt::NoButton) {
|
||||
@@ -106,20 +106,20 @@ void DiagramEventAddImage::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramEventAddImage::mouseDoubleClickEvent
|
||||
* This method is only use to overwrite double click.
|
||||
* When double click, image propertie dialog isn't open.
|
||||
* @param event : event of mouse double click.
|
||||
*/
|
||||
@brief DiagramEventAddImage::mouseDoubleClickEvent
|
||||
This method is only use to overwrite double click.
|
||||
When double click, image propertie dialog isn't open.
|
||||
@param event : event of mouse double click.
|
||||
*/
|
||||
void DiagramEventAddImage::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) {
|
||||
event->setAccepted(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramEventAddImage::wheelEvent
|
||||
* Action when mouse wheel is rotate
|
||||
* @param event: evet of mouse wheel
|
||||
*/
|
||||
@brief DiagramEventAddImage::wheelEvent
|
||||
Action when mouse wheel is rotate
|
||||
@param event: evet of mouse wheel
|
||||
*/
|
||||
void DiagramEventAddImage::wheelEvent(QGraphicsSceneWheelEvent *event)
|
||||
{
|
||||
if (!m_is_added || !m_image || event -> modifiers() != Qt::CTRL) {
|
||||
@@ -136,9 +136,9 @@ void DiagramEventAddImage::wheelEvent(QGraphicsSceneWheelEvent *event)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramEventAddImage::isNull
|
||||
* @return : true if image can't be loaded, otherwise return false.
|
||||
*/
|
||||
@brief DiagramEventAddImage::isNull
|
||||
@return : true if image can't be loaded, otherwise return false.
|
||||
*/
|
||||
bool DiagramEventAddImage::isNull() const
|
||||
{
|
||||
if (!m_image) return true;
|
||||
@@ -146,9 +146,9 @@ bool DiagramEventAddImage::isNull() const
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramEventAddImage::openDialog
|
||||
* Open dialog for select the image to add.
|
||||
*/
|
||||
@brief DiagramEventAddImage::openDialog
|
||||
Open dialog for select the image to add.
|
||||
*/
|
||||
void DiagramEventAddImage::openDialog()
|
||||
{
|
||||
if (m_diagram -> isReadOnly()) return;
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef DIAGRAMEVENTADDIMAGE_H
|
||||
#define DIAGRAMEVENTADDIMAGE_H
|
||||
@@ -24,28 +24,28 @@ class Diagram;
|
||||
class DiagramImageItem;
|
||||
|
||||
/**
|
||||
* @brief The DiagramEventAddImage class
|
||||
* This diagram event, handle the adding of an image in a diagram.
|
||||
*/
|
||||
@brief The DiagramEventAddImage class
|
||||
This diagram event, handle the adding of an image in a diagram.
|
||||
*/
|
||||
class DiagramEventAddImage : public DiagramEventInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DiagramEventAddImage(Diagram *diagram);
|
||||
~DiagramEventAddImage() override;
|
||||
public:
|
||||
DiagramEventAddImage(Diagram *diagram);
|
||||
~DiagramEventAddImage() override;
|
||||
|
||||
void mousePressEvent (QGraphicsSceneMouseEvent *event) override;
|
||||
void mouseMoveEvent (QGraphicsSceneMouseEvent *event) override;
|
||||
void mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event) override;
|
||||
void wheelEvent (QGraphicsSceneWheelEvent *event) override;
|
||||
void mousePressEvent (QGraphicsSceneMouseEvent *event) override;
|
||||
void mouseMoveEvent (QGraphicsSceneMouseEvent *event) override;
|
||||
void mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event) override;
|
||||
void wheelEvent (QGraphicsSceneWheelEvent *event) override;
|
||||
|
||||
bool isNull () const;
|
||||
private:
|
||||
void openDialog();
|
||||
bool isNull () const;
|
||||
private:
|
||||
void openDialog();
|
||||
|
||||
DiagramImageItem *m_image;
|
||||
bool m_is_added;
|
||||
DiagramImageItem *m_image;
|
||||
bool m_is_added;
|
||||
};
|
||||
|
||||
#endif // DIAGRAMEVENTADDIMAGE_H
|
||||
|
||||
@@ -20,11 +20,11 @@
|
||||
#include "diagramcommands.h"
|
||||
|
||||
/**
|
||||
* @brief DiagramEventAddShape::DiagramEventAddShape
|
||||
* Default constructor
|
||||
* @param diagram : the diagram where this event must operate
|
||||
* @param shape_type : the type of shape to draw
|
||||
*/
|
||||
@brief DiagramEventAddShape::DiagramEventAddShape
|
||||
Default constructor
|
||||
@param diagram : the diagram where this event must operate
|
||||
@param shape_type : the type of shape to draw
|
||||
*/
|
||||
DiagramEventAddShape::DiagramEventAddShape(Diagram *diagram, QetShapeItem::ShapeType shape_type) :
|
||||
DiagramEventInterface(diagram),
|
||||
m_shape_type (shape_type),
|
||||
@@ -37,8 +37,8 @@ DiagramEventAddShape::DiagramEventAddShape(Diagram *diagram, QetShapeItem::Shape
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramEventAddShape::~DiagramEventAddShape
|
||||
*/
|
||||
@brief DiagramEventAddShape::~DiagramEventAddShape
|
||||
*/
|
||||
DiagramEventAddShape::~DiagramEventAddShape()
|
||||
{
|
||||
if ((m_running || m_abort) && m_shape_item)
|
||||
@@ -54,10 +54,10 @@ DiagramEventAddShape::~DiagramEventAddShape()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramEventAddShape::mousePressEvent
|
||||
* Action when mouse is pressed
|
||||
* @param event : event of mouse press
|
||||
*/
|
||||
@brief DiagramEventAddShape::mousePressEvent
|
||||
Action when mouse is pressed
|
||||
@param event : event of mouse press
|
||||
*/
|
||||
void DiagramEventAddShape::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
if (Q_UNLIKELY(m_diagram->isReadOnly())) {
|
||||
@@ -107,10 +107,10 @@ void DiagramEventAddShape::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramEventAddShape::mouseMoveEvent
|
||||
* Action when mouse move
|
||||
* @param event : event of mouse move
|
||||
*/
|
||||
@brief DiagramEventAddShape::mouseMoveEvent
|
||||
Action when mouse move
|
||||
@param event : event of mouse move
|
||||
*/
|
||||
void DiagramEventAddShape::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
updateHelpCross(event->scenePos());
|
||||
@@ -128,10 +128,10 @@ void DiagramEventAddShape::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramEventAddShape::mouseReleaseEvent
|
||||
* Action when mouse button is released
|
||||
* @param event : event of mouse release
|
||||
*/
|
||||
@brief DiagramEventAddShape::mouseReleaseEvent
|
||||
Action when mouse button is released
|
||||
@param event : event of mouse release
|
||||
*/
|
||||
void DiagramEventAddShape::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
if (event->button() == Qt::RightButton)
|
||||
@@ -170,10 +170,10 @@ void DiagramEventAddShape::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramEventAddShape::mouseDoubleClickEvent
|
||||
* Action when mouse button is double clicked
|
||||
* @param event : event of mouse double click
|
||||
*/
|
||||
@brief DiagramEventAddShape::mouseDoubleClickEvent
|
||||
Action when mouse button is double clicked
|
||||
@param event : event of mouse double click
|
||||
*/
|
||||
void DiagramEventAddShape::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
//If current item is a polyline, add it with an undo command
|
||||
@@ -204,10 +204,10 @@ void DiagramEventAddShape::init()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramEventAddShape::updateHelpCross
|
||||
* Create and update the position of the cross to help user for draw new shape
|
||||
* @param p : the center of the cross
|
||||
*/
|
||||
@brief DiagramEventAddShape::updateHelpCross
|
||||
Create and update the position of the cross to help user for draw new shape
|
||||
@param p : the center of the cross
|
||||
*/
|
||||
void DiagramEventAddShape::updateHelpCross(const QPointF &p)
|
||||
{
|
||||
//If line isn't created yet, we create it.
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
#include "qetshapeitem.h"
|
||||
|
||||
/**
|
||||
* @brief The DiagramEventAddShape class
|
||||
* This event manage the creation of a shape.
|
||||
*/
|
||||
@brief The DiagramEventAddShape class
|
||||
This event manage the creation of a shape.
|
||||
*/
|
||||
class DiagramEventAddShape : public DiagramEventInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "diagrameventaddtext.h"
|
||||
@@ -22,33 +22,37 @@
|
||||
#include "diagram.h"
|
||||
|
||||
/**
|
||||
* @brief DiagramEventAddText::DiagramEventAddText
|
||||
* Default constructor
|
||||
* @param diagram : the diagram where this event must operate
|
||||
*/
|
||||
@brief DiagramEventAddText::DiagramEventAddText
|
||||
Default constructor
|
||||
@param diagram : the diagram where this event must operate
|
||||
*/
|
||||
DiagramEventAddText::DiagramEventAddText(Diagram *diagram) :
|
||||
DiagramEventInterface(diagram)
|
||||
DiagramEventInterface(diagram)
|
||||
{}
|
||||
|
||||
/**
|
||||
* @brief DiagramEventAddText::~DiagramEventAddText
|
||||
*/
|
||||
@brief DiagramEventAddText::~DiagramEventAddText
|
||||
*/
|
||||
DiagramEventAddText::~DiagramEventAddText()
|
||||
{}
|
||||
|
||||
/**
|
||||
* @brief DiagramEventAddText::mousePressEvent
|
||||
* @param event : event of mouse press event.
|
||||
*/
|
||||
@brief DiagramEventAddText::mousePressEvent
|
||||
@param event : event of mouse press event.
|
||||
*/
|
||||
void DiagramEventAddText::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton)
|
||||
{
|
||||
IndependentTextItem *text = new IndependentTextItem();
|
||||
m_diagram -> undoStack().push(new AddItemCommand<IndependentTextItem *>(text, m_diagram, event->scenePos()));
|
||||
text->setTextInteractionFlags(Qt::TextEditorInteraction);
|
||||
text->setFocus(Qt::MouseFocusReason);
|
||||
emit finish();
|
||||
if (event->button() == Qt::LeftButton)
|
||||
{
|
||||
IndependentTextItem *text = new IndependentTextItem();
|
||||
m_diagram -> undoStack().push(
|
||||
new AddItemCommand<IndependentTextItem *>(
|
||||
text,
|
||||
m_diagram,
|
||||
event->scenePos()));
|
||||
text->setTextInteractionFlags(Qt::TextEditorInteraction);
|
||||
text->setFocus(Qt::MouseFocusReason);
|
||||
emit finish();
|
||||
event->setAccepted(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef DIAGRAMEVENTADDTEXT_H
|
||||
#define DIAGRAMEVENTADDTEXT_H
|
||||
@@ -23,18 +23,18 @@
|
||||
class Diagram;
|
||||
|
||||
/**
|
||||
* @brief The DiagramEventAddText class
|
||||
* This diagram event handle the creation of a new text in a diagram
|
||||
*/
|
||||
@brief The DiagramEventAddText class
|
||||
This diagram event handle the creation of a new text in a diagram
|
||||
*/
|
||||
class DiagramEventAddText : public DiagramEventInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DiagramEventAddText(Diagram *diagram);
|
||||
~DiagramEventAddText() override;
|
||||
public:
|
||||
DiagramEventAddText(Diagram *diagram);
|
||||
~DiagramEventAddText() override;
|
||||
|
||||
void mousePressEvent (QGraphicsSceneMouseEvent *event) override;
|
||||
void mousePressEvent (QGraphicsSceneMouseEvent *event) override;
|
||||
};
|
||||
|
||||
#endif // DIAGRAMEVENTADDTEXT_H
|
||||
|
||||
@@ -52,10 +52,10 @@ void DiagramEventInterface::wheelEvent(QGraphicsSceneWheelEvent *event) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramEventInterface::keyPressEvent
|
||||
* By default, press escape key abort the curent action
|
||||
* @param event
|
||||
*/
|
||||
@brief DiagramEventInterface::keyPressEvent
|
||||
By default, press escape key abort the curent action
|
||||
@param event
|
||||
*/
|
||||
void DiagramEventInterface::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
if (event->key() == Qt::Key_Escape)
|
||||
|
||||
@@ -26,22 +26,22 @@ class QKeyEvent;
|
||||
class Diagram;
|
||||
|
||||
/**
|
||||
* @brief The DiagramEventInterface class
|
||||
* isRunning() return true if action is running (do something). By default return false.
|
||||
@brief The DiagramEventInterface class
|
||||
isRunning() return true if action is running (do something). By default return false.
|
||||
*
|
||||
* ##USE DiagramEventInterface##
|
||||
* This class is the basic interface for manage event on a diagram.
|
||||
* To create a behavior for event diagram, we need to herite this class.
|
||||
* This interface work like this :
|
||||
* You need to create an interface and call diagram::setEventInterface(pointer_of_your_interface).
|
||||
* When a diagram get an event (mouse or key) if they have an event interface,
|
||||
* they send the event (with the status accepted to false) to the interface (for exemple mousePressEvent).
|
||||
* If the interface do something with this event, you need to set to true the accepted status of the event, then diagram do nothing.
|
||||
* When the interface job is done, we need to emit the signal finish(), the diagram use this signal to delete the interface.
|
||||
* Be carreful with the destructor, diagram can at any time (even if interface is still running) delete the interface,
|
||||
* the bool m_abort is here for that at destruction time.
|
||||
##USE DiagramEventInterface##
|
||||
This class is the basic interface for manage event on a diagram.
|
||||
To create a behavior for event diagram, we need to herite this class.
|
||||
This interface work like this :
|
||||
You need to create an interface and call diagram::setEventInterface(pointer_of_your_interface).
|
||||
When a diagram get an event (mouse or key) if they have an event interface,
|
||||
they send the event (with the status accepted to false) to the interface (for exemple mousePressEvent).
|
||||
If the interface do something with this event, you need to set to true the accepted status of the event, then diagram do nothing.
|
||||
When the interface job is done, we need to emit the signal finish(), the diagram use this signal to delete the interface.
|
||||
Be carreful with the destructor, diagram can at any time (even if interface is still running) delete the interface,
|
||||
the bool m_abort is here for that at destruction time.
|
||||
*
|
||||
*/
|
||||
*/
|
||||
class DiagramEventInterface : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -352,26 +352,28 @@ void DiagramPrintDialog::browseFilePrintTypeDialog() {
|
||||
ou non
|
||||
@param options Options de rendu
|
||||
*/
|
||||
void DiagramPrintDialog::print(const QList<Diagram *> &diagrams, bool fit_page, const ExportProperties& options) {
|
||||
void DiagramPrintDialog::print(const QList<Diagram *> &diagrams,
|
||||
bool fit_page,
|
||||
const ExportProperties& options) {
|
||||
//qDebug() << "Demande d'impression de " << diagrams.count() << "schemas.";
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
|
||||
#ifdef Q_OS_WIN
|
||||
#ifdef QT_DEBUG
|
||||
qDebug() << "--";
|
||||
qDebug() << "DiagramPrintDialog::print printer_->resolution() before " << printer_->resolution();
|
||||
qDebug() << "DiagramPrintDialog::print screennumber " << QApplication::desktop()->screenNumber();
|
||||
#endif
|
||||
#ifdef Q_OS_WIN
|
||||
#ifdef QT_DEBUG
|
||||
qDebug() << "--";
|
||||
qDebug() << "DiagramPrintDialog::print printer_->resolution() before " << printer_->resolution();
|
||||
qDebug() << "DiagramPrintDialog::print screennumber " << QApplication::desktop()->screenNumber();
|
||||
#endif
|
||||
|
||||
QScreen *srn = QApplication::screens().at(QApplication::desktop()->screenNumber());
|
||||
qreal dotsPerInch = (qreal)srn->logicalDotsPerInch();
|
||||
printer_->setResolution(dotsPerInch);
|
||||
QScreen *srn = QApplication::screens().at(QApplication::desktop()->screenNumber());
|
||||
qreal dotsPerInch = (qreal)srn->logicalDotsPerInch();
|
||||
printer_->setResolution(dotsPerInch);
|
||||
|
||||
#ifdef QT_DEBUG
|
||||
qDebug() << "DiagramPrintDialog::print dotsPerInch " << dotsPerInch;
|
||||
qDebug() << "DiagramPrintDialog::print printer_->resolution() after" << printer_->resolution();
|
||||
qDebug() << "--";
|
||||
#endif
|
||||
#endif
|
||||
#ifdef QT_DEBUG
|
||||
qDebug() << "DiagramPrintDialog::print dotsPerInch " << dotsPerInch;
|
||||
qDebug() << "DiagramPrintDialog::print printer_->resolution() after" << printer_->resolution();
|
||||
qDebug() << "--";
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
// QPainter utiliser pour effectuer le rendu
|
||||
QPainter qp(printer_);
|
||||
@@ -399,7 +401,11 @@ void DiagramPrintDialog::print(const QList<Diagram *> &diagrams, bool fit_page,
|
||||
@param qp QPainter a utiliser (deja initialise sur printer)
|
||||
@param printer Imprimante a utiliser
|
||||
*/
|
||||
void DiagramPrintDialog::printDiagram(Diagram *diagram, bool fit_page, const ExportProperties &options, QPainter *qp, QPrinter *printer) {
|
||||
void DiagramPrintDialog::printDiagram(Diagram *diagram,
|
||||
bool fit_page,
|
||||
const ExportProperties &options,
|
||||
QPainter *qp,
|
||||
QPrinter *printer) {
|
||||
//qDebug() << printer -> paperSize() << printer -> paperRect() << diagram -> title();
|
||||
// l'imprimante utilise-t-elle toute la feuille ?
|
||||
bool full_page = printer -> fullPage();
|
||||
|
||||
@@ -162,7 +162,7 @@ void DiagramsChooser::updateList() {
|
||||
foreach(Diagram *diagram, project_ -> diagrams()) {
|
||||
// titre du schema
|
||||
QString diagram_title = diagram -> title();
|
||||
if (diagram_title.isEmpty()) diagram_title = tr("Folio sans titre");
|
||||
if (diagram_title.isEmpty()) diagram_title = tr("Folio sans titre");
|
||||
|
||||
QCheckBox *checkbox = new QCheckBox(diagram_title);
|
||||
checkbox -> setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum));
|
||||
|
||||
@@ -198,10 +198,10 @@ void DiagramView::handleElementDrop(QDropEvent *event)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramView::handleTitleBlockDrop
|
||||
* Handle the dropEvent that contain data of a titleblock
|
||||
* @param e
|
||||
*/
|
||||
@brief DiagramView::handleTitleBlockDrop
|
||||
Handle the dropEvent that contain data of a titleblock
|
||||
@param e
|
||||
*/
|
||||
void DiagramView::handleTitleBlockDrop(QDropEvent *e) {
|
||||
// fetch the title block template location from the drop event
|
||||
TitleBlockTemplateLocation tbt_loc;
|
||||
@@ -247,10 +247,10 @@ void DiagramView::handleTitleBlockDrop(QDropEvent *e) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramView::handleTextDrop
|
||||
@brief DiagramView::handleTextDrop
|
||||
*handle the drop of text
|
||||
* @param e the QDropEvent describing the current drag'n drop
|
||||
*/
|
||||
@param e the QDropEvent describing the current drag'n drop
|
||||
*/
|
||||
void DiagramView::handleTextDrop(QDropEvent *e) {
|
||||
if (m_diagram -> isReadOnly() || (e -> mimeData() -> hasText() == false) ) return;
|
||||
|
||||
@@ -284,12 +284,12 @@ void DiagramView::setSelectionMode() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramView::zoom
|
||||
* Zomm the view.
|
||||
* A zoom_factor > 1 zoom in.
|
||||
* A zoom_factor < 1 zoom out
|
||||
* @param zoom_factor
|
||||
*/
|
||||
@brief DiagramView::zoom
|
||||
Zomm the view.
|
||||
A zoom_factor > 1 zoom in.
|
||||
A zoom_factor < 1 zoom out
|
||||
@param zoom_factor
|
||||
*/
|
||||
void DiagramView::zoom(const qreal zoom_factor)
|
||||
{
|
||||
if (zoom_factor >= 1){
|
||||
@@ -357,11 +357,11 @@ void DiagramView::copy() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramView::paste
|
||||
* Import the element stored in the clipboard to the diagram.
|
||||
* @param pos : top left corner of the bounding rect of imported elements
|
||||
* @param clipboard_mode
|
||||
*/
|
||||
@brief DiagramView::paste
|
||||
Import the element stored in the clipboard to the diagram.
|
||||
@param pos : top left corner of the bounding rect of imported elements
|
||||
@param clipboard_mode
|
||||
*/
|
||||
void DiagramView::paste(const QPointF &pos, QClipboard::Mode clipboard_mode) {
|
||||
if (!isInteractive() || m_diagram -> isReadOnly()) return;
|
||||
|
||||
@@ -448,9 +448,9 @@ void DiagramView::mousePressEvent(QMouseEvent *e)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramView::mouseMoveEvent
|
||||
* Manage the event move mouse
|
||||
*/
|
||||
@brief DiagramView::mouseMoveEvent
|
||||
Manage the event move mouse
|
||||
*/
|
||||
void DiagramView::mouseMoveEvent(QMouseEvent *e)
|
||||
{
|
||||
if (m_event_interface && m_event_interface->mouseMoveEvent(e)) return;
|
||||
@@ -509,9 +509,9 @@ void DiagramView::mouseMoveEvent(QMouseEvent *e)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramView::mouseReleaseEvent
|
||||
* Manage event release click mouse
|
||||
*/
|
||||
@brief DiagramView::mouseReleaseEvent
|
||||
Manage event release click mouse
|
||||
*/
|
||||
void DiagramView::mouseReleaseEvent(QMouseEvent *e)
|
||||
{
|
||||
if (m_event_interface && m_event_interface->mouseReleaseEvent(e)) return;
|
||||
@@ -563,9 +563,9 @@ void DiagramView::mouseReleaseEvent(QMouseEvent *e)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramView::gestures
|
||||
* @return
|
||||
*/
|
||||
@brief DiagramView::gestures
|
||||
@return
|
||||
*/
|
||||
bool DiagramView::gestures() const
|
||||
{
|
||||
QSettings settings;
|
||||
@@ -606,11 +606,11 @@ void DiagramView::wheelEvent(QWheelEvent *event)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramView::gestureEvent
|
||||
* Use the pinch of the trackpad for zoom
|
||||
* @param event
|
||||
* @return
|
||||
*/
|
||||
@brief DiagramView::gestureEvent
|
||||
Use the pinch of the trackpad for zoom
|
||||
@param event
|
||||
@return
|
||||
*/
|
||||
bool DiagramView::gestureEvent(QGestureEvent *event)
|
||||
{
|
||||
if (QGesture *gesture = event->gesture(Qt::PinchGesture))
|
||||
@@ -639,11 +639,11 @@ void DiagramView::focusInEvent(QFocusEvent *e) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramView::keyPressEvent
|
||||
* Handles "key press" events. Reimplemented here to switch to visualisation
|
||||
* mode if needed.
|
||||
* @param e
|
||||
*/
|
||||
@brief DiagramView::keyPressEvent
|
||||
Handles "key press" events. Reimplemented here to switch to visualisation
|
||||
mode if needed.
|
||||
@param e
|
||||
*/
|
||||
void DiagramView::keyPressEvent(QKeyEvent *e)
|
||||
{
|
||||
if (m_event_interface && m_event_interface->keyPressEvent(e))
|
||||
@@ -821,17 +821,17 @@ QString DiagramView::title() const {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramView::editDiagramProperties
|
||||
* Edit the properties of the viewed digram
|
||||
*/
|
||||
@brief DiagramView::editDiagramProperties
|
||||
Edit the properties of the viewed digram
|
||||
*/
|
||||
void DiagramView::editDiagramProperties() {
|
||||
DiagramPropertiesDialog::diagramPropertiesDialog(m_diagram, diagramEditor());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramView::adjustSceneRect
|
||||
* Calcul and set the area of the scene visualized by this view
|
||||
*/
|
||||
@brief DiagramView::adjustSceneRect
|
||||
Calcul and set the area of the scene visualized by this view
|
||||
*/
|
||||
void DiagramView::adjustSceneRect()
|
||||
{
|
||||
QRectF scene_rect = m_diagram->sceneRect();
|
||||
@@ -912,9 +912,9 @@ void DiagramView::applyReadOnly() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramView::editSelectedConductorColor
|
||||
* Edit the color of the selected conductor; does nothing if multiple conductors are selected
|
||||
*/
|
||||
@brief DiagramView::editSelectedConductorColor
|
||||
Edit the color of the selected conductor; does nothing if multiple conductors are selected
|
||||
*/
|
||||
void DiagramView::editSelectedConductorColor()
|
||||
{
|
||||
//retrieve selected content
|
||||
@@ -996,14 +996,14 @@ void DiagramView::resetConductors() {
|
||||
@param e Evenement
|
||||
*/
|
||||
/**
|
||||
* @brief DiagramView::event
|
||||
* Manage the event on this diagram view.
|
||||
* -At first activation (QEvent::WindowActivate or QEvent::Show) we zoomFit.
|
||||
* -Convert event interpreted to mouse event to gesture event if needed.
|
||||
* -send Shortcut to view (by default send to QMenu /QAction)
|
||||
* @param e the event.
|
||||
* @return
|
||||
*/
|
||||
@brief DiagramView::event
|
||||
Manage the event on this diagram view.
|
||||
-At first activation (QEvent::WindowActivate or QEvent::Show) we zoomFit.
|
||||
-Convert event interpreted to mouse event to gesture event if needed.
|
||||
-send Shortcut to view (by default send to QMenu /QAction)
|
||||
@param e the event.
|
||||
@return
|
||||
*/
|
||||
bool DiagramView::event(QEvent *e) {
|
||||
if (Q_UNLIKELY(m_first_activation)) {
|
||||
if (e -> type() == QEvent::Show) {
|
||||
@@ -1031,10 +1031,10 @@ bool DiagramView::event(QEvent *e) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramView::paintEvent
|
||||
* Reimplemented from QGraphicsView
|
||||
* @param event
|
||||
*/
|
||||
@brief DiagramView::paintEvent
|
||||
Reimplemented from QGraphicsView
|
||||
@param event
|
||||
*/
|
||||
void DiagramView::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
QGraphicsView::paintEvent(event);
|
||||
@@ -1113,9 +1113,9 @@ bool DiagramView::selectedItemHasFocus() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramView::editSelection
|
||||
* Edit the selected item if he can be edited and if only one item is selected
|
||||
*/
|
||||
@brief DiagramView::editSelection
|
||||
Edit the selected item if he can be edited and if only one item is selected
|
||||
*/
|
||||
void DiagramView::editSelection() {
|
||||
if (m_diagram -> isReadOnly() || m_diagram -> selectedItems().size() != 1 ) return;
|
||||
|
||||
@@ -1133,11 +1133,11 @@ void DiagramView::editSelection() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramView::setEventInterface
|
||||
* Set an event interface to diagram view.
|
||||
* If diagram view already have an event interface, he delete it before.
|
||||
* Diagram view take ownership of event interface and delete it when event interface is finish
|
||||
*/
|
||||
@brief DiagramView::setEventInterface
|
||||
Set an event interface to diagram view.
|
||||
If diagram view already have an event interface, he delete it before.
|
||||
Diagram view take ownership of event interface and delete it when event interface is finish
|
||||
*/
|
||||
void DiagramView::setEventInterface(DVEventInterface *event_interface)
|
||||
{
|
||||
if (m_event_interface) delete m_event_interface;
|
||||
@@ -1146,10 +1146,10 @@ void DiagramView::setEventInterface(DVEventInterface *event_interface)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramView::contextMenuActions
|
||||
* @return a list of actions currently available for a context menu.
|
||||
*
|
||||
*/
|
||||
@brief DiagramView::contextMenuActions
|
||||
@return a list of actions currently available for a context menu.
|
||||
|
||||
*/
|
||||
QList<QAction *> DiagramView::contextMenuActions() const
|
||||
{
|
||||
QList<QAction *> list;
|
||||
@@ -1189,9 +1189,9 @@ QList<QAction *> DiagramView::contextMenuActions() const
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramView::contextMenuEvent
|
||||
* @param e
|
||||
*/
|
||||
@brief DiagramView::contextMenuEvent
|
||||
@param e
|
||||
*/
|
||||
void DiagramView::contextMenuEvent(QContextMenuEvent *e)
|
||||
{
|
||||
QGraphicsView::contextMenuEvent(e);
|
||||
@@ -1237,9 +1237,9 @@ QETDiagramEditor *DiagramView::diagramEditor() const {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramView::mouseDoubleClickEvent
|
||||
* @param e
|
||||
*/
|
||||
@brief DiagramView::mouseDoubleClickEvent
|
||||
@param e
|
||||
*/
|
||||
void DiagramView::mouseDoubleClickEvent(QMouseEvent *e)
|
||||
{
|
||||
if (m_event_interface && m_event_interface -> mouseDoubleClickEvent(e)) return;
|
||||
|
||||
@@ -57,12 +57,12 @@ bool DVEventInterface::wheelEvent(QWheelEvent *event) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DVEventInterface::keyPressEvent
|
||||
* By default, press escape key abort the curent action.
|
||||
* isFinish return true, and emit finish
|
||||
* @param event
|
||||
* @return
|
||||
*/
|
||||
@brief DVEventInterface::keyPressEvent
|
||||
By default, press escape key abort the curent action.
|
||||
isFinish return true, and emit finish
|
||||
@param event
|
||||
@return
|
||||
*/
|
||||
bool DVEventInterface::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
if (event->key() == Qt::Key_Escape)
|
||||
|
||||
@@ -27,14 +27,18 @@ class DiagramView;
|
||||
class Diagram;
|
||||
|
||||
/**
|
||||
* @brief The DVEventInterface class
|
||||
* This class is the main interface for manage event of a Diagram View.
|
||||
* This do nothing, for create new event behavior, we must to create new class from this.
|
||||
* Each method return a bool: True if the methode do something else return false.
|
||||
* Each method of DVEventInterface return false;
|
||||
* isRunning() return true if action is started but not finish. By default return false.
|
||||
* isFinish() return true when the action is finish, or not started. By default return true.
|
||||
*/
|
||||
@brief The DVEventInterface class
|
||||
This class is the main interface for manage event of a Diagram View.
|
||||
This do nothing, for create new event behavior,
|
||||
we must to create new class from this.
|
||||
Each method return a bool:
|
||||
True if the methode do something else return false.
|
||||
Each method of DVEventInterface return false;
|
||||
isRunning() return true if action is started but not finish.
|
||||
By default return false.
|
||||
isFinish() return true when the action is finish, or not started.
|
||||
By default return true.
|
||||
*/
|
||||
class DVEventInterface : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -54,8 +58,8 @@ class DVEventInterface : public QObject
|
||||
|
||||
signals:
|
||||
/**
|
||||
* @brief finish
|
||||
* emited when the interface finish is work
|
||||
@brief finish
|
||||
emited when the interface finish is work
|
||||
*/
|
||||
void finish();
|
||||
|
||||
|
||||
@@ -20,14 +20,14 @@
|
||||
#include "partterminal.h"
|
||||
|
||||
/**
|
||||
* @brief PastePartsCommand::PastePartsCommand
|
||||
* @param view : view where this command work
|
||||
* @param content_to_paste : content to paste
|
||||
* @param parent : parent undo command
|
||||
@brief PastePartsCommand::PastePartsCommand
|
||||
@param view : view where this command work
|
||||
@param content_to_paste : content to paste
|
||||
@param parent : parent undo command
|
||||
*
|
||||
* Note : all terminal stored in @content_to_paste get a new uuid in the constructor of this class to avoid have
|
||||
* several terminal of an element with the same uuid.
|
||||
*/
|
||||
Note : all terminal stored in @content_to_paste get a new uuid in the constructor of this class to avoid have
|
||||
several terminal of an element with the same uuid.
|
||||
*/
|
||||
PastePartsCommand::PastePartsCommand(ElementView *view, const ElementContent &content_to_paste, QUndoCommand *parent) :
|
||||
ElementEditionCommand(view ? view -> scene() : nullptr, view, parent)
|
||||
{
|
||||
@@ -44,16 +44,16 @@ PastePartsCommand::PastePartsCommand(ElementView *view, const ElementContent &co
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief PastePartsCommand::~PastePartsCommand
|
||||
*/
|
||||
@brief PastePartsCommand::~PastePartsCommand
|
||||
*/
|
||||
PastePartsCommand::~PastePartsCommand()
|
||||
{
|
||||
m_scene->qgiManager().release(m_pasted_content);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief PastePartsCommand::undo
|
||||
*/
|
||||
@brief PastePartsCommand::undo
|
||||
*/
|
||||
void PastePartsCommand::undo()
|
||||
{
|
||||
m_scene->blockSignals(true);
|
||||
@@ -72,8 +72,8 @@ void PastePartsCommand::undo()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief PastePartsCommand::redo
|
||||
*/
|
||||
@brief PastePartsCommand::redo
|
||||
*/
|
||||
void PastePartsCommand::redo()
|
||||
{
|
||||
if (m_first_redo) {
|
||||
@@ -97,13 +97,13 @@ void PastePartsCommand::redo()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief PastePartsCommand::setOffset
|
||||
* Describe the offset to use with this undo command
|
||||
* @param old_offset_paste_count
|
||||
* @param old_start_top_left_corner
|
||||
* @param new_offset_paste_count
|
||||
* @param new_start_top_left_corner
|
||||
*/
|
||||
@brief PastePartsCommand::setOffset
|
||||
Describe the offset to use with this undo command
|
||||
@param old_offset_paste_count
|
||||
@param old_start_top_left_corner
|
||||
@param new_offset_paste_count
|
||||
@param new_start_top_left_corner
|
||||
*/
|
||||
void PastePartsCommand::setOffset(int old_offset_paste_count, const QPointF &old_start_top_left_corner, int new_offset_paste_count, const QPointF &new_start_top_left_corner)
|
||||
{
|
||||
m_old_offset_paste_count = old_offset_paste_count;
|
||||
|
||||
@@ -24,9 +24,9 @@
|
||||
class ElementView;
|
||||
|
||||
/**
|
||||
* @brief The PastePartsCommand class
|
||||
* Undo command for paste element primitive in an element editor
|
||||
*/
|
||||
@brief The PastePartsCommand class
|
||||
Undo command for paste element primitive in an element editor
|
||||
*/
|
||||
class PastePartsCommand : public ElementEditionCommand
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -95,12 +95,12 @@ void ArcEditor::disconnectChangeConnections()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ArcEditor::setPart
|
||||
* Specifie to this editor the part to edit.
|
||||
* Note that an editor can accept or refuse to edit a part. This editor accept only partArc.
|
||||
* @param new_part
|
||||
* @return
|
||||
*/
|
||||
@brief ArcEditor::setPart
|
||||
Specifie to this editor the part to edit.
|
||||
Note that an editor can accept or refuse to edit a part. This editor accept only partArc.
|
||||
@param new_part
|
||||
@return
|
||||
*/
|
||||
bool ArcEditor::setPart(CustomElementPart *new_part)
|
||||
{
|
||||
if (!new_part)
|
||||
@@ -137,9 +137,9 @@ bool ArcEditor::setParts(QList <CustomElementPart *> parts)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ArcEditor::currentPart
|
||||
* @return the curent edited part, or 0 if there is no edited part
|
||||
*/
|
||||
@brief ArcEditor::currentPart
|
||||
@return the curent edited part, or 0 if there is no edited part
|
||||
*/
|
||||
CustomElementPart *ArcEditor::currentPart() const {
|
||||
return(part);
|
||||
}
|
||||
@@ -149,9 +149,9 @@ QList<CustomElementPart*> ArcEditor::currentParts() const {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ArcEditor::updateArcS
|
||||
* Update the start angle of the arc according to the edited value.
|
||||
*/
|
||||
@brief ArcEditor::updateArcS
|
||||
Update the start angle of the arc according to the edited value.
|
||||
*/
|
||||
void ArcEditor::updateArcS()
|
||||
{
|
||||
if (m_locked) return;
|
||||
@@ -175,9 +175,9 @@ void ArcEditor::updateArcS()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ArcEditor::updateArcA
|
||||
* Update the span angle of the arc according to the edited value.
|
||||
*/
|
||||
@brief ArcEditor::updateArcA
|
||||
Update the span angle of the arc according to the edited value.
|
||||
*/
|
||||
void ArcEditor::updateArcA()
|
||||
{
|
||||
if (m_locked) return;
|
||||
@@ -200,9 +200,9 @@ void ArcEditor::updateArcA()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ArcEditor::updateArcRect
|
||||
* Update the geometrie of the rect that define this arc according the the edited values
|
||||
*/
|
||||
@brief ArcEditor::updateArcRect
|
||||
Update the geometrie of the rect that define this arc according the the edited values
|
||||
*/
|
||||
void ArcEditor::updateArcRectX()
|
||||
{
|
||||
if (m_locked) return;
|
||||
@@ -300,9 +300,9 @@ void ArcEditor::updateArcRectV()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ArcEditor::updateForm
|
||||
* Update the value of the widgets
|
||||
*/
|
||||
@brief ArcEditor::updateForm
|
||||
Update the value of the widgets
|
||||
*/
|
||||
void ArcEditor::updateForm()
|
||||
{
|
||||
if (!part) return;
|
||||
@@ -318,11 +318,11 @@ void ArcEditor::updateForm()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ArcEditor::activeConnections
|
||||
* Enable/disable connection between editor widget and slot editingFinished
|
||||
* True == enable | false == disable
|
||||
* @param active
|
||||
*/
|
||||
@brief ArcEditor::activeConnections
|
||||
Enable/disable connection between editor widget and slot editingFinished
|
||||
True == enable | false == disable
|
||||
@param active
|
||||
*/
|
||||
void ArcEditor::activeConnections(bool active)
|
||||
{
|
||||
if (active)
|
||||
|
||||
@@ -67,10 +67,11 @@ class ArcEditor : public ElementItemEditor
|
||||
|
||||
private:
|
||||
void activeConnections(bool);
|
||||
/*!
|
||||
* \brief setUpChangeConnections
|
||||
* Setup the connection from the arc(s) to the widget, to update it when the arc(s) are changed (moved ...)
|
||||
*/
|
||||
/**
|
||||
@brief setUpChangeConnections
|
||||
Setup the connection from the arc(s) to the widget,
|
||||
to update it when the arc(s) are changed (moved ...)
|
||||
*/
|
||||
void setUpChangeConnections();
|
||||
void disconnectChangeConnections();
|
||||
};
|
||||
|
||||
@@ -523,13 +523,13 @@ void ScalePartsCommand::adjustText() {
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @brief ChangePropertiesCommand::ChangePropertiesCommand
|
||||
* Change the properties of the drawed element
|
||||
* @param scene: scene to belong the property
|
||||
* @param type: new type of element.
|
||||
* @param context: new info about type.
|
||||
* @param parent: parent undo
|
||||
*/
|
||||
@brief ChangePropertiesCommand::ChangePropertiesCommand
|
||||
Change the properties of the drawed element
|
||||
@param scene: scene to belong the property
|
||||
@param type: new type of element.
|
||||
@param context: new info about type.
|
||||
@param parent: parent undo
|
||||
*/
|
||||
ChangePropertiesCommand::ChangePropertiesCommand(ElementScene *scene, const QString& type, const DiagramContext& info, const DiagramContext& elmt_info, QUndoCommand *parent) :
|
||||
ElementEditionCommand(scene, nullptr, parent)
|
||||
{
|
||||
|
||||
@@ -24,11 +24,11 @@
|
||||
#include "qgimanager.h"
|
||||
|
||||
/**
|
||||
* @brief The ElementEditionCommand class
|
||||
* ElementEditionCommand is the base class for all commands classes involved in
|
||||
@brief The ElementEditionCommand class
|
||||
ElementEditionCommand is the base class for all commands classes involved in
|
||||
the edition of an electrical element. It provides commonly required methods
|
||||
and attributes, such as accessors to the modified scene and view.
|
||||
*/
|
||||
*/
|
||||
class ElementEditionCommand : public QUndoCommand
|
||||
{
|
||||
// constructors, destructor
|
||||
|
||||
@@ -54,7 +54,7 @@ class ElementItemEditor : public QWidget
|
||||
virtual bool setParts(QList <CustomElementPart *>) {return false;}
|
||||
|
||||
virtual CustomElementPart *currentPart() const = 0;
|
||||
virtual QList<CustomElementPart*> currentParts() const = 0;
|
||||
virtual QList<CustomElementPart*> currentParts() const = 0;
|
||||
virtual void updateForm() = 0;
|
||||
|
||||
// attributes
|
||||
|
||||
@@ -472,8 +472,8 @@ QVector<QPointF> ElementPrimitiveDecorator::getResizingsPoints() const
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementPrimitiveDecorator::adjusteHandlerPos
|
||||
*/
|
||||
@brief ElementPrimitiveDecorator::adjusteHandlerPos
|
||||
*/
|
||||
void ElementPrimitiveDecorator::adjusteHandlerPos()
|
||||
{
|
||||
QVector <QPointF> points_vector = mapToScene(getResizingsPoints());
|
||||
@@ -482,10 +482,10 @@ void ElementPrimitiveDecorator::adjusteHandlerPos()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementPrimitiveDecorator::handlerMousePressEvent
|
||||
* @param qghi
|
||||
* @param event
|
||||
*/
|
||||
@brief ElementPrimitiveDecorator::handlerMousePressEvent
|
||||
@param qghi
|
||||
@param event
|
||||
*/
|
||||
void ElementPrimitiveDecorator::handlerMousePressEvent(QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
@@ -499,10 +499,10 @@ void ElementPrimitiveDecorator::handlerMousePressEvent(QetGraphicsHandlerItem *q
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementPrimitiveDecorator::handlerMouseMoveEvent
|
||||
* @param qghi
|
||||
* @param event
|
||||
*/
|
||||
@brief ElementPrimitiveDecorator::handlerMouseMoveEvent
|
||||
@param qghi
|
||||
@param event
|
||||
*/
|
||||
void ElementPrimitiveDecorator::handlerMouseMoveEvent(QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
Q_UNUSED(qghi);
|
||||
@@ -554,10 +554,10 @@ void ElementPrimitiveDecorator::handlerMouseMoveEvent(QetGraphicsHandlerItem *qg
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementPrimitiveDecorator::handlerMouseReleaseEvent
|
||||
* @param qghi
|
||||
* @param event
|
||||
*/
|
||||
@brief ElementPrimitiveDecorator::handlerMouseReleaseEvent
|
||||
@param qghi
|
||||
@param event
|
||||
*/
|
||||
void ElementPrimitiveDecorator::handlerMouseReleaseEvent(QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
Q_UNUSED(qghi);
|
||||
@@ -585,9 +585,9 @@ void ElementPrimitiveDecorator::handlerMouseReleaseEvent(QetGraphicsHandlerItem
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementPrimitiveDecorator::addHandler
|
||||
* Add handlers for this item
|
||||
*/
|
||||
@brief ElementPrimitiveDecorator::addHandler
|
||||
Add handlers for this item
|
||||
*/
|
||||
void ElementPrimitiveDecorator::addHandler()
|
||||
{
|
||||
if (m_handler_vector.isEmpty() && scene())
|
||||
@@ -605,9 +605,9 @@ void ElementPrimitiveDecorator::addHandler()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementPrimitiveDecorator::removeHandler
|
||||
* Remove the handlers of this item
|
||||
*/
|
||||
@brief ElementPrimitiveDecorator::removeHandler
|
||||
Remove the handlers of this item
|
||||
*/
|
||||
void ElementPrimitiveDecorator::removeHandler()
|
||||
{
|
||||
if (!m_handler_vector.isEmpty())
|
||||
@@ -688,11 +688,11 @@ QET::ScalingMethod ElementPrimitiveDecorator::scalingMethod(QGraphicsSceneMouseE
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementPrimitiveDecorator::itemChange
|
||||
* @param change
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
@brief ElementPrimitiveDecorator::itemChange
|
||||
@param change
|
||||
@param value
|
||||
@return
|
||||
*/
|
||||
QVariant ElementPrimitiveDecorator::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value)
|
||||
{
|
||||
if (change == ItemSceneHasChanged)
|
||||
@@ -718,11 +718,11 @@ QVariant ElementPrimitiveDecorator::itemChange(QGraphicsItem::GraphicsItemChange
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementPrimitiveDecorator::sceneEventFilter
|
||||
* @param watched
|
||||
* @param event
|
||||
* @return
|
||||
*/
|
||||
@brief ElementPrimitiveDecorator::sceneEventFilter
|
||||
@param watched
|
||||
@param event
|
||||
@return
|
||||
*/
|
||||
bool ElementPrimitiveDecorator::sceneEventFilter(QGraphicsItem *watched, QEvent *event)
|
||||
{
|
||||
//Watched must be an handler
|
||||
|
||||
@@ -75,7 +75,7 @@ ElementScene::ElementScene(QETElementEditor *editor, QObject *parent) :
|
||||
|
||||
/**
|
||||
@brief ElementScene::~ElementScene
|
||||
*/
|
||||
*/
|
||||
ElementScene::~ElementScene()
|
||||
{
|
||||
//Disconnect to avoid crash, see bug report N° 122.
|
||||
|
||||
@@ -114,14 +114,14 @@ void ElementView::zoomOut() {
|
||||
Agrandit le schema avec le trackpad
|
||||
*/
|
||||
void ElementView::zoomInSlowly() {
|
||||
scale(1.02, 1.02);
|
||||
scale(1.02, 1.02);
|
||||
}
|
||||
|
||||
/**
|
||||
Retrecit le schema avec le trackpad
|
||||
*/
|
||||
void ElementView::zoomOutSlowly() {
|
||||
scale(0.98, 0.98);
|
||||
scale(0.98, 0.98);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -144,10 +144,10 @@ void ElementView::zoomReset() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementView::adjustSceneRect
|
||||
* Adjust the scenRect, so that he include all primitives of element
|
||||
* plus the viewport of the scene with a margin of 1/3 of herself
|
||||
*/
|
||||
@brief ElementView::adjustSceneRect
|
||||
Adjust the scenRect, so that he include all primitives of element
|
||||
plus the viewport of the scene with a margin of 1/3 of herself
|
||||
*/
|
||||
void ElementView::adjustSceneRect() {
|
||||
QRectF esgr = m_scene -> elementSceneGeometricRect();
|
||||
QRectF vpbr = mapToScene(this -> viewport()->rect()).boundingRect();
|
||||
@@ -156,10 +156,10 @@ void ElementView::adjustSceneRect() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementView::resetSceneRect
|
||||
* reset le sceneRect (zone du schéma visualisée par l'ElementView) afin que
|
||||
* celui-ci inclut uniquement les primitives de l'élément dessiné.
|
||||
*/
|
||||
@brief ElementView::resetSceneRect
|
||||
reset le sceneRect (zone du schéma visualisée par l'ElementView) afin que
|
||||
celui-ci inclut uniquement les primitives de l'élément dessiné.
|
||||
*/
|
||||
void ElementView::resetSceneRect() {
|
||||
setSceneRect(m_scene -> elementSceneGeometricRect());
|
||||
}
|
||||
@@ -366,9 +366,9 @@ void ElementView::mousePressEvent(QMouseEvent *e) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementView::mouseMoveEvent
|
||||
* Manage the event move mouse
|
||||
*/
|
||||
@brief ElementView::mouseMoveEvent
|
||||
Manage the event move mouse
|
||||
*/
|
||||
void ElementView::mouseMoveEvent(QMouseEvent *e) {
|
||||
if (e->buttons() == Qt::MidButton)
|
||||
{
|
||||
@@ -384,9 +384,9 @@ void ElementView::mouseMoveEvent(QMouseEvent *e) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementView::mouseReleaseEvent
|
||||
* Manage event release click mouse
|
||||
*/
|
||||
@brief ElementView::mouseReleaseEvent
|
||||
Manage event release click mouse
|
||||
*/
|
||||
void ElementView::mouseReleaseEvent(QMouseEvent *e) {
|
||||
if (e -> button() == Qt::MidButton) {
|
||||
setCursor(Qt::ArrowCursor);
|
||||
@@ -397,9 +397,9 @@ void ElementView::mouseReleaseEvent(QMouseEvent *e) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementView::gestures
|
||||
* @return
|
||||
*/
|
||||
@brief ElementView::gestures
|
||||
@return
|
||||
*/
|
||||
bool ElementView::gestures() const
|
||||
{
|
||||
QSettings settings;
|
||||
@@ -408,9 +408,9 @@ bool ElementView::gestures() const
|
||||
|
||||
|
||||
/**
|
||||
* @brief ElementView::wheelEvent
|
||||
* @param e
|
||||
*/
|
||||
@brief ElementView::wheelEvent
|
||||
@param e
|
||||
*/
|
||||
void ElementView::wheelEvent(QWheelEvent *e) {
|
||||
//Zoom and scrolling
|
||||
if ( gestures() ) {
|
||||
@@ -439,11 +439,11 @@ bool ElementView::event(QEvent *e) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Utilise le pincement du trackpad pour zoomer
|
||||
* @brief ElementView::gestureEvent
|
||||
* @param event
|
||||
* @return
|
||||
*/
|
||||
Utilise le pincement du trackpad pour zoomer
|
||||
@brief ElementView::gestureEvent
|
||||
@param event
|
||||
@return
|
||||
*/
|
||||
bool ElementView::gestureEvent(QGestureEvent *event){
|
||||
if (QGesture *gesture = event->gesture(Qt::PinchGesture)) {
|
||||
QPinchGesture *pinch = static_cast<QPinchGesture *>(gesture);
|
||||
|
||||
@@ -62,10 +62,10 @@ class EllipseEditor : public ElementItemEditor
|
||||
|
||||
private:
|
||||
void activeConnections(bool);
|
||||
/*!
|
||||
* \brief setUpChangeConnections
|
||||
* Setup the connection from the ellipse(s) to the widget, to update it when the ellipse(s) are changed (moved ...)
|
||||
*/
|
||||
/**
|
||||
@brief setUpChangeConnections
|
||||
Setup the connection from the ellipse(s) to the widget, to update it when the ellipse(s) are changed (moved ...)
|
||||
*/
|
||||
void setUpChangeConnections();
|
||||
void disconnectChangeConnections();
|
||||
};
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user