mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
Mod doc, Improve code style
This commit is contained in:
@@ -28,9 +28,9 @@
|
||||
#include <QtConcurrent>
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionModel::ElementsCollectionModel
|
||||
* Constructor
|
||||
* @param parent
|
||||
@brief ElementsCollectionModel::ElementsCollectionModel
|
||||
Constructor
|
||||
@param parent
|
||||
*/
|
||||
ElementsCollectionModel::ElementsCollectionModel(QObject *parent) :
|
||||
QStandardItemModel(parent)
|
||||
@@ -38,11 +38,11 @@ ElementsCollectionModel::ElementsCollectionModel(QObject *parent) :
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionModel::data
|
||||
* Reimplemented from QStandardItemModel
|
||||
* @param index
|
||||
* @param role
|
||||
* @return
|
||||
@brief ElementsCollectionModel::data
|
||||
Reimplemented from QStandardItemModel
|
||||
@param index
|
||||
@param role
|
||||
@return
|
||||
*/
|
||||
QVariant ElementsCollectionModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
@@ -59,10 +59,10 @@ QVariant ElementsCollectionModel::data(const QModelIndex &index, int role) const
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionModel::mimeData
|
||||
* Reimplemented from QStandardItemModel
|
||||
* @param indexes
|
||||
* @return
|
||||
@brief ElementsCollectionModel::mimeData
|
||||
Reimplemented from QStandardItemModel
|
||||
@param indexes
|
||||
@return
|
||||
*/
|
||||
QMimeData *ElementsCollectionModel::mimeData(const QModelIndexList &indexes) const
|
||||
{
|
||||
@@ -86,14 +86,15 @@ QMimeData *ElementsCollectionModel::mimeData(const QModelIndexList &indexes) con
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionModel::mimeTypes
|
||||
* Reimplemented from QStandardItemModel
|
||||
* @return
|
||||
@brief ElementsCollectionModel::mimeTypes
|
||||
Reimplemented from QStandardItemModel
|
||||
@return
|
||||
*/
|
||||
QStringList ElementsCollectionModel::mimeTypes() const
|
||||
{
|
||||
QStringList mime_list = QAbstractItemModel::mimeTypes();
|
||||
mime_list << "application/x-qet-element-uri" << "application/x-qet-category-uri";
|
||||
mime_list << "application/x-qet-element-uri"
|
||||
<< "application/x-qet-category-uri";
|
||||
return mime_list;
|
||||
}
|
||||
|
||||
@@ -107,12 +108,21 @@ QStringList ElementsCollectionModel::mimeTypes() const
|
||||
* @param parent
|
||||
* @return
|
||||
*/
|
||||
bool ElementsCollectionModel::canDropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const
|
||||
bool ElementsCollectionModel::canDropMimeData(const QMimeData *data,
|
||||
Qt::DropAction action,
|
||||
int row,
|
||||
int column,
|
||||
const QModelIndex &parent) const
|
||||
{
|
||||
if (!(QStandardItemModel::canDropMimeData(data, action, row, column, parent) && parent.isValid()))
|
||||
if (!(QStandardItemModel::canDropMimeData(data,
|
||||
action,
|
||||
row,
|
||||
column,
|
||||
parent) && parent.isValid()))
|
||||
return false;
|
||||
|
||||
QStandardItem *qsi = itemFromIndex(parent.QModelIndex::model()->index(row, column));
|
||||
QStandardItem *qsi = itemFromIndex(parent.QModelIndex::model()->index(
|
||||
row, column));
|
||||
if (!qsi)
|
||||
qsi = itemFromIndex(parent);
|
||||
|
||||
@@ -123,12 +133,14 @@ bool ElementsCollectionModel::canDropMimeData(const QMimeData *data, Qt::DropAct
|
||||
|
||||
ElementCollectionItem *eci = static_cast<ElementCollectionItem *>(qsi);
|
||||
|
||||
if (data->hasFormat("application/x-qet-element-uri") || data->hasFormat("application/x-qet-category-uri"))
|
||||
if (data->hasFormat("application/x-qet-element-uri")
|
||||
|| data->hasFormat("application/x-qet-category-uri"))
|
||||
{
|
||||
//Return false if user try to drop a item from a folder to the same folder
|
||||
ElementsLocation drop_location(data->text());
|
||||
for (int i=0 ; i<eci->rowCount() ; i++)
|
||||
if (static_cast<ElementCollectionItem *>(eci->child(i))->collectionPath() == drop_location.collectionPath())
|
||||
if (static_cast<ElementCollectionItem *>(eci->child(i))->collectionPath()
|
||||
== drop_location.collectionPath())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@@ -138,19 +150,24 @@ bool ElementsCollectionModel::canDropMimeData(const QMimeData *data, Qt::DropAct
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionModel::dropMimeData
|
||||
* Reimplemented from QStandardItemModel
|
||||
* @param data
|
||||
* @param action
|
||||
* @param row
|
||||
* @param column
|
||||
* @param parent
|
||||
* @return
|
||||
@brief ElementsCollectionModel::dropMimeData
|
||||
Reimplemented from QStandardItemModel
|
||||
@param data
|
||||
@param action
|
||||
@param row
|
||||
@param column
|
||||
@param parent
|
||||
@return
|
||||
*/
|
||||
bool ElementsCollectionModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
|
||||
bool ElementsCollectionModel::dropMimeData(const QMimeData *data,
|
||||
Qt::DropAction action,
|
||||
int row,
|
||||
int column,
|
||||
const QModelIndex &parent)
|
||||
{
|
||||
Q_UNUSED(action)
|
||||
QStandardItem *qsi = itemFromIndex(parent.QModelIndex::model()->index(row, column));
|
||||
QStandardItem *qsi = itemFromIndex(
|
||||
parent.QModelIndex::model()->index(row, column));
|
||||
if (!qsi)
|
||||
qsi = itemFromIndex(parent);
|
||||
|
||||
@@ -161,7 +178,8 @@ bool ElementsCollectionModel::dropMimeData(const QMimeData *data, Qt::DropAction
|
||||
if (feci->isCommonCollection())
|
||||
return false;
|
||||
|
||||
if (feci->isElement() && feci->parent() && feci->parent()->type() == FileElementCollectionItem::Type)
|
||||
if (feci->isElement() && feci->parent() && feci->parent()->type()
|
||||
== FileElementCollectionItem::Type)
|
||||
feci = static_cast<FileElementCollectionItem *>(feci->parent());
|
||||
|
||||
ElementCollectionHandler ech;
|
||||
@@ -175,7 +193,9 @@ bool ElementsCollectionModel::dropMimeData(const QMimeData *data, Qt::DropAction
|
||||
//If feci have a child with the same path of location,
|
||||
//we remove the existing child befor insert new child
|
||||
for (int i=0 ; i<feci->rowCount() ; i++) {
|
||||
if (static_cast<FileElementCollectionItem *>(feci->child(i))->collectionPath() == location.collectionPath())
|
||||
if (static_cast<FileElementCollectionItem *>(
|
||||
feci->child(i))->collectionPath()
|
||||
== location.collectionPath())
|
||||
feci->removeRow(i);
|
||||
}
|
||||
feci->addChildAtPath(location.fileName());
|
||||
@@ -187,18 +207,26 @@ bool ElementsCollectionModel::dropMimeData(const QMimeData *data, Qt::DropAction
|
||||
else if (qsi->type() == XmlProjectElementCollectionItem::Type) {
|
||||
XmlProjectElementCollectionItem *xpeci = static_cast<XmlProjectElementCollectionItem*>(qsi);
|
||||
|
||||
if (xpeci->isElement() && xpeci->parent() && xpeci->parent()->type() == XmlProjectElementCollectionItem::Type)
|
||||
if (xpeci->isElement() && xpeci->parent() && xpeci->parent()->type()
|
||||
== XmlProjectElementCollectionItem::Type)
|
||||
xpeci = static_cast<XmlProjectElementCollectionItem *>(xpeci->parent());
|
||||
|
||||
//before do the copy, we get all collection path of xpeci child,
|
||||
//for remove it if the copied item have the same path of an existing child.
|
||||
//We can't do this after the copy, because at the copy if the xml collection have a DomElement with the same path,
|
||||
//he was removed before the new xml DomElement is inserted
|
||||
//So the existing child of this will return a null QString when call collectionPath(), because the item
|
||||
//doesn't exist anymore in the xml collection.
|
||||
/* before do the copy, we get all collection path of xpeci child,
|
||||
* for remove it
|
||||
* if the copied item have the same path of an existing child.
|
||||
* We can't do this after the copy,
|
||||
* because at the copy
|
||||
* if the xml collection have a DomElement with the same path,
|
||||
* he was removed before the new xml DomElement is inserted
|
||||
* So the existing child of this will return a null QString
|
||||
* when call collectionPath(), because the item
|
||||
* doesn't exist anymore in the xml collection.
|
||||
*/
|
||||
QList <QString> child_path_list;
|
||||
for (int i=0 ; i<xpeci->rowCount() ; i++)
|
||||
child_path_list.append(static_cast<XmlProjectElementCollectionItem *>(xpeci->child(i, 0))->collectionPath());
|
||||
child_path_list.append(
|
||||
static_cast<XmlProjectElementCollectionItem *>(
|
||||
xpeci->child(i, 0))->collectionPath());
|
||||
|
||||
ElementCollectionHandler ech;
|
||||
|
||||
@@ -213,18 +241,23 @@ bool ElementsCollectionModel::dropMimeData(const QMimeData *data, Qt::DropAction
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionModel::loadCollections
|
||||
* Load the several collections in this model.
|
||||
* Prefer use this method instead of addCommonCollection, addCustomCollection and addProject,
|
||||
* because it use multithreading to speed up the loading.
|
||||
* This method emit loadingProgressRangeChanged(int, int) for know the minimu and maximum progress value
|
||||
* This method emit loadingProgressValueChanged(int) for know the current progress value
|
||||
* This method emit loadingFinished for know when loading finished.
|
||||
* @param common_collection : true for load the common collection
|
||||
* @param custom_collection : true for load the custom collection
|
||||
* @param projects : list of projects to load
|
||||
@brief ElementsCollectionModel::loadCollections
|
||||
Load the several collections in this model.
|
||||
Prefer use this method instead of addCommonCollection,
|
||||
addCustomCollection and addProject,
|
||||
because it use multithreading to speed up the loading.
|
||||
This method emit loadingProgressRangeChanged(int, int)
|
||||
for know the minimu and maximum progress value
|
||||
This method emit loadingProgressValueChanged(int)
|
||||
for know the current progress value
|
||||
This method emit loadingFinished for know when loading finished.
|
||||
@param common_collection : true for load the common collection
|
||||
@param custom_collection : true for load the custom collection
|
||||
@param projects : list of projects to load
|
||||
*/
|
||||
void ElementsCollectionModel::loadCollections(bool common_collection, bool custom_collection, QList<QETProject *> projects)
|
||||
void ElementsCollectionModel::loadCollections(bool common_collection,
|
||||
bool custom_collection,
|
||||
QList<QETProject *> projects)
|
||||
{
|
||||
m_items_list_to_setUp.clear();
|
||||
|
||||
@@ -243,22 +276,29 @@ void ElementsCollectionModel::loadCollections(bool common_collection, bool custo
|
||||
m_items_list_to_setUp.append(projectItems(project));
|
||||
}
|
||||
auto *watcher = new QFutureWatcher<void>();
|
||||
connect(watcher, &QFutureWatcher<void>::progressValueChanged, this, &ElementsCollectionModel::loadingProgressValueChanged);
|
||||
connect(watcher, &QFutureWatcher<void>::progressRangeChanged, this, &ElementsCollectionModel::loadingProgressRangeChanged);
|
||||
connect(watcher, &QFutureWatcher<void>::finished, this, &ElementsCollectionModel::loadingFinished);
|
||||
connect(watcher, &QFutureWatcher<void>::finished, watcher, &QFutureWatcher<void>::deleteLater);
|
||||
connect(watcher, &QFutureWatcher<void>::progressValueChanged,
|
||||
this, &ElementsCollectionModel::loadingProgressValueChanged);
|
||||
connect(watcher, &QFutureWatcher<void>::progressRangeChanged,
|
||||
this, &ElementsCollectionModel::loadingProgressRangeChanged);
|
||||
connect(watcher, &QFutureWatcher<void>::finished,
|
||||
this, &ElementsCollectionModel::loadingFinished);
|
||||
connect(watcher, &QFutureWatcher<void>::finished,
|
||||
watcher, &QFutureWatcher<void>::deleteLater);
|
||||
m_future = QtConcurrent::map(m_items_list_to_setUp, setUpData);
|
||||
watcher->setFuture(m_future);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionModel::addCommonCollection
|
||||
* Add the common elements collection to this model
|
||||
@brief ElementsCollectionModel::addCommonCollection
|
||||
Add the common elements collection to this model
|
||||
@param set_data
|
||||
*/
|
||||
void ElementsCollectionModel::addCommonCollection(bool set_data)
|
||||
{
|
||||
FileElementCollectionItem *feci = new FileElementCollectionItem();
|
||||
if (feci->setRootPath(QETApp::commonElementsDirN(), set_data, m_hide_element)) {
|
||||
if (feci->setRootPath(QETApp::commonElementsDirN(),
|
||||
set_data,
|
||||
m_hide_element)) {
|
||||
invisibleRootItem()->appendRow(feci);
|
||||
if (set_data)
|
||||
feci->setUpData();
|
||||
@@ -268,8 +308,9 @@ void ElementsCollectionModel::addCommonCollection(bool set_data)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionModel::addCustomCollection
|
||||
* Add the custom elements collection to this model
|
||||
@brief ElementsCollectionModel::addCustomCollection
|
||||
Add the custom elements collection to this model
|
||||
@param set_data
|
||||
*/
|
||||
void ElementsCollectionModel::addCustomCollection(bool set_data)
|
||||
{
|
||||
@@ -284,10 +325,10 @@ void ElementsCollectionModel::addCustomCollection(bool set_data)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionModel::addLocation
|
||||
* Add the element or directory to this model.
|
||||
* If the location is already managed by this model, do nothing.
|
||||
* @param location
|
||||
@brief ElementsCollectionModel::addLocation
|
||||
Add the element or directory to this model.
|
||||
If the location is already managed by this model, do nothing.
|
||||
@param location
|
||||
*/
|
||||
void ElementsCollectionModel::addLocation(const ElementsLocation& location)
|
||||
{
|
||||
@@ -302,9 +343,12 @@ void ElementsCollectionModel::addLocation(const ElementsLocation& location)
|
||||
QETProject *project = location.project();
|
||||
|
||||
if (project) {
|
||||
XmlProjectElementCollectionItem *xpeci = m_project_hash.value(project);
|
||||
XmlProjectElementCollectionItem *xpeci =
|
||||
m_project_hash.value(project);
|
||||
|
||||
last_item = xpeci->lastItemForPath(location.collectionPath(false), collection_name);
|
||||
last_item = xpeci->lastItemForPath(
|
||||
location.collectionPath(false),
|
||||
collection_name);
|
||||
}
|
||||
}
|
||||
else if (location.isCustomCollection()) {
|
||||
@@ -316,10 +360,13 @@ void ElementsCollectionModel::addLocation(const ElementsLocation& location)
|
||||
foreach(ElementCollectionItem *eci, child_list) {
|
||||
|
||||
if (eci->type() == FileElementCollectionItem::Type) {
|
||||
FileElementCollectionItem *feci = static_cast<FileElementCollectionItem *>(eci);
|
||||
FileElementCollectionItem *feci =
|
||||
static_cast<FileElementCollectionItem *>(eci);
|
||||
|
||||
if (feci->isCustomCollection()) {
|
||||
last_item = feci->lastItemForPath(location.collectionPath(false), collection_name);
|
||||
last_item = feci->lastItemForPath(
|
||||
location.collectionPath(false),
|
||||
collection_name);
|
||||
if(last_item)
|
||||
break;
|
||||
}
|
||||
@@ -332,10 +379,11 @@ void ElementsCollectionModel::addLocation(const ElementsLocation& location)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionModel::addProject
|
||||
* Add project to this model
|
||||
* @param project : project to add.
|
||||
* @param set_data : if true, setUpData is called for every ElementCollectionItem of project
|
||||
@brief ElementsCollectionModel::addProject
|
||||
Add project to this model
|
||||
@param project : project to add.
|
||||
@param set_data :
|
||||
if true, setUpData is called for every ElementCollectionItem of project
|
||||
*/
|
||||
void ElementsCollectionModel::addProject(QETProject *project, bool set_data)
|
||||
{
|
||||
@@ -351,16 +399,24 @@ void ElementsCollectionModel::addProject(QETProject *project, bool set_data)
|
||||
insertRow(row, xpeci);
|
||||
if (set_data)
|
||||
xpeci->setUpData();
|
||||
connect(project->embeddedElementCollection(), &XmlElementCollection::elementAdded, this, &ElementsCollectionModel::elementIntegratedToCollection);
|
||||
connect(project->embeddedElementCollection(), &XmlElementCollection::elementChanged, this, &ElementsCollectionModel::updateItem);
|
||||
connect(project->embeddedElementCollection(), &XmlElementCollection::elementRemoved, this, &ElementsCollectionModel::itemRemovedFromCollection);
|
||||
connect(project->embeddedElementCollection(), &XmlElementCollection::directoryRemoved, this, &ElementsCollectionModel::itemRemovedFromCollection);
|
||||
connect(project->embeddedElementCollection(),
|
||||
&XmlElementCollection::elementAdded,
|
||||
this, &ElementsCollectionModel::elementIntegratedToCollection);
|
||||
connect(project->embeddedElementCollection(),
|
||||
&XmlElementCollection::elementChanged,
|
||||
this, &ElementsCollectionModel::updateItem);
|
||||
connect(project->embeddedElementCollection(),
|
||||
&XmlElementCollection::elementRemoved,
|
||||
this, &ElementsCollectionModel::itemRemovedFromCollection);
|
||||
connect(project->embeddedElementCollection(),
|
||||
&XmlElementCollection::directoryRemoved,
|
||||
this, &ElementsCollectionModel::itemRemovedFromCollection);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionModel::removeProject
|
||||
* Remove project from this model
|
||||
* @param project
|
||||
@brief ElementsCollectionModel::removeProject
|
||||
Remove project from this model
|
||||
@param project
|
||||
*/
|
||||
void ElementsCollectionModel::removeProject(QETProject *project)
|
||||
{
|
||||
@@ -371,16 +427,27 @@ void ElementsCollectionModel::removeProject(QETProject *project)
|
||||
if (removeRows(row, 1, QModelIndex())) {
|
||||
m_project_list.removeOne(project);
|
||||
m_project_hash.remove(project);
|
||||
disconnect(project->embeddedElementCollection(), &XmlElementCollection::elementAdded, this, &ElementsCollectionModel::elementIntegratedToCollection);
|
||||
disconnect(project->embeddedElementCollection(), &XmlElementCollection::elementChanged, this, &ElementsCollectionModel::updateItem);
|
||||
disconnect(project->embeddedElementCollection(), &XmlElementCollection::elementRemoved, this, &ElementsCollectionModel::itemRemovedFromCollection);
|
||||
disconnect(project->embeddedElementCollection(), &XmlElementCollection::directoryRemoved, this, &ElementsCollectionModel::itemRemovedFromCollection);
|
||||
disconnect(project->embeddedElementCollection(),
|
||||
&XmlElementCollection::elementAdded,
|
||||
this,
|
||||
&ElementsCollectionModel::elementIntegratedToCollection);
|
||||
disconnect(project->embeddedElementCollection(),
|
||||
&XmlElementCollection::elementChanged,
|
||||
this, &ElementsCollectionModel::updateItem);
|
||||
disconnect(project->embeddedElementCollection(),
|
||||
&XmlElementCollection::elementRemoved,
|
||||
this,
|
||||
&ElementsCollectionModel::itemRemovedFromCollection);
|
||||
disconnect(project->embeddedElementCollection(),
|
||||
&XmlElementCollection::directoryRemoved,
|
||||
this,
|
||||
&ElementsCollectionModel::itemRemovedFromCollection);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionModel::project
|
||||
* @return every project added to this model
|
||||
@brief ElementsCollectionModel::project
|
||||
@return every project added to this model
|
||||
*/
|
||||
QList<QETProject *> ElementsCollectionModel::project() const
|
||||
{
|
||||
@@ -388,9 +455,9 @@ QList<QETProject *> ElementsCollectionModel::project() const
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionModel::highlightUnusedElement
|
||||
* Highlight every unused element of managed project.
|
||||
* @See QETProject::unusedElements()
|
||||
@brief ElementsCollectionModel::highlightUnusedElement
|
||||
Highlight every unused element of managed project.
|
||||
@see QETProject::unusedElements()
|
||||
*/
|
||||
void ElementsCollectionModel::highlightUnusedElement()
|
||||
{
|
||||
@@ -414,8 +481,8 @@ void ElementsCollectionModel::highlightUnusedElement()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionModel::items
|
||||
* @return every ElementCollectionItem owned by this model
|
||||
@brief ElementsCollectionModel::items
|
||||
@return every ElementCollectionItem owned by this model
|
||||
*/
|
||||
QList <ElementCollectionItem *> ElementsCollectionModel::items() const
|
||||
{
|
||||
@@ -431,9 +498,9 @@ QList <ElementCollectionItem *> ElementsCollectionModel::items() const
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionModel::projectItems
|
||||
* @param project
|
||||
* @return return all items for project @project. the list can be empty
|
||||
@brief ElementsCollectionModel::projectItems
|
||||
@param project
|
||||
@return return all items for project @project. the list can be empty
|
||||
*/
|
||||
QList<ElementCollectionItem *> ElementsCollectionModel::projectItems(QETProject *project) const
|
||||
{
|
||||
@@ -449,8 +516,8 @@ QList<ElementCollectionItem *> ElementsCollectionModel::projectItems(QETProject
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionModel::hideElement
|
||||
* Hide element in this model, only directory is managed
|
||||
@brief ElementsCollectionModel::hideElement
|
||||
Hide element in this model, only directory is managed
|
||||
*/
|
||||
void ElementsCollectionModel::hideElement()
|
||||
{
|
||||
@@ -463,13 +530,14 @@ void ElementsCollectionModel::hideElement()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionModel::indexFromLocation
|
||||
* Return the index who represent @location.
|
||||
* Index can be non valid
|
||||
* @param location
|
||||
* @return
|
||||
@brief ElementsCollectionModel::indexFromLocation
|
||||
Return the index who represent @location.
|
||||
Index can be non valid
|
||||
@param location
|
||||
@return
|
||||
*/
|
||||
QModelIndex ElementsCollectionModel::indexFromLocation(const ElementsLocation &location)
|
||||
QModelIndex ElementsCollectionModel::indexFromLocation(
|
||||
const ElementsLocation &location)
|
||||
{
|
||||
QList <ElementCollectionItem *> child_list;
|
||||
|
||||
@@ -502,10 +570,11 @@ QModelIndex ElementsCollectionModel::indexFromLocation(const ElementsLocation &l
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionModel::elementIntegratedToCollection
|
||||
* When an element is added to embedded collection of a project,
|
||||
* this method create and display the new element
|
||||
* @param path -The path of the new element in the embedded collection of a project
|
||||
@brief ElementsCollectionModel::elementIntegratedToCollection
|
||||
When an element is added to embedded collection of a project,
|
||||
this method create and display the new element
|
||||
@param path :
|
||||
-The path of the new element in the embedded collection of a project
|
||||
*/
|
||||
void ElementsCollectionModel::elementIntegratedToCollection(const QString& path)
|
||||
{
|
||||
@@ -536,9 +605,9 @@ void ElementsCollectionModel::elementIntegratedToCollection(const QString& path)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionModel::itemRemovedFromCollection
|
||||
* This method must be called by a signal, to get a sender.
|
||||
* @param path
|
||||
@brief ElementsCollectionModel::itemRemovedFromCollection
|
||||
This method must be called by a signal, to get a sender.
|
||||
@param path
|
||||
*/
|
||||
void ElementsCollectionModel::itemRemovedFromCollection(const QString& path)
|
||||
{
|
||||
@@ -564,9 +633,9 @@ void ElementsCollectionModel::itemRemovedFromCollection(const QString& path)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionModel::updateItem
|
||||
* Update the item at path
|
||||
* @param path
|
||||
@brief ElementsCollectionModel::updateItem
|
||||
Update the item at path
|
||||
@param path
|
||||
*/
|
||||
void ElementsCollectionModel::updateItem(const QString& path)
|
||||
{
|
||||
|
||||
@@ -27,9 +27,13 @@
|
||||
#include "diagram.h"
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@brief AutoNumberingManagementW::AutoNumberingManagementW
|
||||
Constructor
|
||||
@param project
|
||||
@param parent
|
||||
*/
|
||||
AutoNumberingManagementW::AutoNumberingManagementW(QETProject *project, QWidget *parent) :
|
||||
AutoNumberingManagementW::AutoNumberingManagementW(QETProject *project,
|
||||
QWidget *parent) :
|
||||
QWidget(parent),
|
||||
project_(project)
|
||||
{
|
||||
@@ -46,7 +50,8 @@ AutoNumberingManagementW::AutoNumberingManagementW(QETProject *project, QWidget
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
@brief AutoNumberingManagementW::~AutoNumberingManagementW
|
||||
Destructor
|
||||
*/
|
||||
AutoNumberingManagementW::~AutoNumberingManagementW()
|
||||
{
|
||||
@@ -54,8 +59,8 @@ AutoNumberingManagementW::~AutoNumberingManagementW()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief AutoNumberingManagementW::setProjectContext
|
||||
* Add Default Project Status
|
||||
@brief AutoNumberingManagementW::setProjectContext
|
||||
Add Default Project Status
|
||||
*/
|
||||
void AutoNumberingManagementW::setProjectContext() {
|
||||
ui->m_status_cb->addItem(tr("Under Development"));
|
||||
@@ -64,8 +69,9 @@ void AutoNumberingManagementW::setProjectContext() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief AutoNumberingManagementW::on_m_status_cb_currentIndexChanged
|
||||
* Load Default Status Options
|
||||
@brief AutoNumberingManagementW::on_m_status_cb_currentIndexChanged
|
||||
Load Default Status Options
|
||||
@param index
|
||||
*/
|
||||
void AutoNumberingManagementW::on_m_status_cb_currentIndexChanged(int index) {
|
||||
|
||||
@@ -96,8 +102,8 @@ void AutoNumberingManagementW::on_m_status_cb_currentIndexChanged(int index) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief AutoNumberingManagementW::on_m_apply_folios_rb_clicked
|
||||
* Set From Folios Combobox
|
||||
@brief AutoNumberingManagementW::on_m_apply_folios_rb_clicked
|
||||
Set From Folios Combobox
|
||||
*/
|
||||
void AutoNumberingManagementW::on_m_apply_folios_rb_clicked() {
|
||||
if (ui->m_apply_folios_rb->isChecked()) {
|
||||
@@ -119,8 +125,9 @@ void AutoNumberingManagementW::on_m_apply_folios_rb_clicked() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief AutoNumberingManagementW::on_m_from_folios_cb_currentIndexChanged
|
||||
* Set To Folios Combobox
|
||||
@brief AutoNumberingManagementW::on_m_from_folios_cb_currentIndexChanged
|
||||
Set To Folios Combobox
|
||||
@param index
|
||||
*/
|
||||
void AutoNumberingManagementW::on_m_from_folios_cb_currentIndexChanged(int index) {
|
||||
ui->m_to_folios_cb->clear();
|
||||
@@ -131,9 +138,14 @@ void AutoNumberingManagementW::on_m_from_folios_cb_currentIndexChanged(int index
|
||||
ui->m_to_folios_cb->addItem("");
|
||||
for (int i=index;i<project_->diagrams().size();i++) {
|
||||
if (project_->diagrams().at(i)->title() != "") {
|
||||
ui->m_to_folios_cb->addItem(project_->diagrams().at(i)->title(),project_->diagrams().at(i)->folioIndex());
|
||||
ui->m_to_folios_cb->addItem(
|
||||
project_->diagrams().at(i)->title(),
|
||||
project_->diagrams().at(i)->folioIndex());
|
||||
}
|
||||
else ui->m_to_folios_cb->addItem(QString::number(project_->diagrams().at(i)->folioIndex()),project_->diagrams().at(i)->folioIndex());
|
||||
else ui->m_to_folios_cb->addItem(
|
||||
QString::number(
|
||||
project_->diagrams().at(i)->folioIndex()),
|
||||
project_->diagrams().at(i)->folioIndex());
|
||||
}
|
||||
applyEnable(true);
|
||||
ui->m_selected_folios_le->clear();
|
||||
@@ -143,8 +155,9 @@ void AutoNumberingManagementW::on_m_from_folios_cb_currentIndexChanged(int index
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief AutoNumberingManagementW::on_m_to_folios_cb_currentIndexChanged
|
||||
* Set selected folios Line Edit content
|
||||
@brief AutoNumberingManagementW::on_m_to_folios_cb_currentIndexChanged
|
||||
Set selected folios Line Edit content
|
||||
@param index
|
||||
*/
|
||||
void AutoNumberingManagementW::on_m_to_folios_cb_currentIndexChanged(int index) {
|
||||
if (index > 0) {
|
||||
@@ -158,8 +171,8 @@ void AutoNumberingManagementW::on_m_to_folios_cb_currentIndexChanged(int index)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief AutoNumberingManagementW::on_m_apply_project_rb_clicked
|
||||
* Disable folio widget
|
||||
@brief AutoNumberingManagementW::on_m_apply_project_rb_clicked
|
||||
Disable folio widget
|
||||
*/
|
||||
void AutoNumberingManagementW::on_m_apply_project_rb_clicked() {
|
||||
ui->m_selected_folios_widget->setDisabled(true);
|
||||
@@ -168,8 +181,9 @@ void AutoNumberingManagementW::on_m_apply_project_rb_clicked() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief AutoNumberingManagementW::on_buttonBox_clicked
|
||||
* Action on @buttonBox clicked
|
||||
@brief AutoNumberingManagementW::on_buttonBox_clicked
|
||||
Action on @buttonBox clicked
|
||||
@param button
|
||||
*/
|
||||
void AutoNumberingManagementW::on_buttonBox_clicked(QAbstractButton *button) {
|
||||
//transform button to int
|
||||
@@ -196,8 +210,9 @@ void AutoNumberingManagementW::on_buttonBox_clicked(QAbstractButton *button) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief AutoNumberingManagementW::applyEnable
|
||||
* enable/disable the apply button
|
||||
@brief AutoNumberingManagementW::applyEnable
|
||||
enable/disable the apply button
|
||||
@param b
|
||||
*/
|
||||
void AutoNumberingManagementW::applyEnable(bool b) {
|
||||
if (b){
|
||||
|
||||
@@ -823,10 +823,10 @@ QUuid Terminal::uuid() const {
|
||||
/**
|
||||
@brief Conductor::relatedPotentialTerminal
|
||||
Return terminal at the same potential from the same
|
||||
parent element of @t.
|
||||
parent element of @terminal.
|
||||
For folio report, return the terminal of linked other report.
|
||||
For Terminal element, return the other terminal of terminal element.
|
||||
@param t terminal to start search
|
||||
@param terminal : to start search
|
||||
@param all_diagram :if true return all related terminal,
|
||||
false return only terminal in the same diagram of @t
|
||||
@return the list of terminal at the same potential
|
||||
|
||||
@@ -1466,14 +1466,14 @@ void QETProject::writeProjectPropertiesXml(QDomElement &xml_element) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QETProject::writeDefaultPropertiesXml
|
||||
* Export all defaults properties used by a new diagram and his content
|
||||
* #size of border
|
||||
* #content of titleblock
|
||||
* #default conductor
|
||||
* #defaut folio report
|
||||
* #default Xref
|
||||
* @param xml_element xml element to use for store default propertie.
|
||||
@brief QETProject::writeDefaultPropertiesXml
|
||||
Export all defaults properties used by a new diagram and his content
|
||||
#size of border
|
||||
#content of titleblock
|
||||
#default conductor
|
||||
#defaut folio report
|
||||
#default Xref
|
||||
@param xml_element xml element to use for store default propertie.
|
||||
*/
|
||||
void QETProject::writeDefaultPropertiesXml(QDomElement &xml_element)
|
||||
{
|
||||
@@ -1549,10 +1549,10 @@ void QETProject::writeDefaultPropertiesXml(QDomElement &xml_element)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QETProject::addDiagram
|
||||
* Add a diagram in this project
|
||||
* @param diagram added diagram
|
||||
* @param pos postion of the new diagram, by default at the end
|
||||
@brief QETProject::addDiagram
|
||||
Add a diagram in this project
|
||||
@param diagram added diagram
|
||||
@param pos postion of the new diagram, by default at the end
|
||||
*/
|
||||
void QETProject::addDiagram(Diagram *diagram, int pos)
|
||||
{
|
||||
@@ -1560,8 +1560,12 @@ void QETProject::addDiagram(Diagram *diagram, int pos)
|
||||
return;
|
||||
}
|
||||
|
||||
connect(&diagram->border_and_titleblock, &BorderTitleBlock::needFolioData, this, &QETProject::updateDiagramsFolioData);
|
||||
connect(diagram, &Diagram::usedTitleBlockTemplateChanged, this, &QETProject::usedTitleBlockTemplateChanged);
|
||||
connect(&diagram->border_and_titleblock,
|
||||
&BorderTitleBlock::needFolioData,
|
||||
this,
|
||||
&QETProject::updateDiagramsFolioData);
|
||||
connect(diagram, &Diagram::usedTitleBlockTemplateChanged,
|
||||
this, &QETProject::usedTitleBlockTemplateChanged);
|
||||
|
||||
if (pos == -1) {
|
||||
m_diagrams_list << diagram;
|
||||
@@ -1575,7 +1579,6 @@ void QETProject::addDiagram(Diagram *diagram, int pos)
|
||||
/**
|
||||
@return La liste des noms a utiliser pour la categorie dediee aux elements
|
||||
integres automatiquement dans le projet.
|
||||
|
||||
*/
|
||||
NamesList QETProject::namesListForIntegrationCategory() {
|
||||
NamesList names;
|
||||
@@ -1602,14 +1605,17 @@ NamesList QETProject::namesListForIntegrationCategory() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QETProject::writeBackup
|
||||
* Write a backup file of this project, in the case that QET crash
|
||||
@brief QETProject::writeBackup
|
||||
Write a backup file of this project, in the case that QET crash
|
||||
*/
|
||||
void QETProject::writeBackup()
|
||||
{
|
||||
QDomDocument xml_project(toXml());
|
||||
QString temp;
|
||||
QFuture<void> bac = QtConcurrent::run(QET::writeToFile,xml_project,&m_backup_file,&temp);
|
||||
QFuture<void> bac = QtConcurrent::run(QET::writeToFile,
|
||||
xml_project,
|
||||
&m_backup_file,
|
||||
&temp);
|
||||
bac.waitForFinished();
|
||||
}
|
||||
|
||||
|
||||
@@ -34,9 +34,9 @@
|
||||
#include <QSqlRecord>
|
||||
|
||||
/**
|
||||
* @brief BOMExportDialog::BOMExportDialog
|
||||
* @param project the project for create the bill of material
|
||||
* @param parent widget
|
||||
@brief BOMExportDialog::BOMExportDialog
|
||||
@param project the project for create the bill of material
|
||||
@param parent widget
|
||||
*/
|
||||
BOMExportDialog::BOMExportDialog(QETProject *project, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
@@ -112,7 +112,7 @@ BOMExportDialog::BOMExportDialog(QETProject *project, QWidget *parent) :
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief BOMExportDialog::~BOMExportDialog
|
||||
@brief BOMExportDialog::~BOMExportDialog
|
||||
*/
|
||||
BOMExportDialog::~BOMExportDialog()
|
||||
{
|
||||
@@ -121,9 +121,9 @@ BOMExportDialog::~BOMExportDialog()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief BOMExportDialog::exec
|
||||
* Reimplemented from QDialog
|
||||
* @return
|
||||
@brief BOMExportDialog::exec
|
||||
Reimplemented from QDialog
|
||||
@return
|
||||
*/
|
||||
int BOMExportDialog::exec()
|
||||
{
|
||||
@@ -165,8 +165,8 @@ int BOMExportDialog::exec()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief BOMExportDialog::selectedKeys
|
||||
* @return the current keys of selected infos to be exported
|
||||
@brief BOMExportDialog::selectedKeys
|
||||
@return the current keys of selected infos to be exported
|
||||
*/
|
||||
QStringList BOMExportDialog::selectedKeys() const
|
||||
{
|
||||
@@ -183,9 +183,9 @@ QStringList BOMExportDialog::selectedKeys() const
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief BOMExportDialog::translatedKeys
|
||||
* @param key
|
||||
* @return
|
||||
@brief BOMExportDialog::translatedKeys
|
||||
@param key
|
||||
@return
|
||||
*/
|
||||
QString BOMExportDialog::translatedKeys(const QString &key) const
|
||||
{
|
||||
@@ -202,8 +202,8 @@ QString BOMExportDialog::translatedKeys(const QString &key) const
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief BOMExportDialog::setUpItems
|
||||
* Setup all items available for create the column of the bill of material.
|
||||
@brief BOMExportDialog::setUpItems
|
||||
Setup all items available for create the column of the bill of material.
|
||||
*/
|
||||
void BOMExportDialog::setUpItems()
|
||||
{
|
||||
@@ -225,7 +225,7 @@ void BOMExportDialog::setUpItems()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief BOMExportDialog::on_m_add_pb_clicked
|
||||
@brief BOMExportDialog::on_m_add_pb_clicked
|
||||
*/
|
||||
void BOMExportDialog::on_m_add_pb_clicked()
|
||||
{
|
||||
@@ -237,7 +237,7 @@ void BOMExportDialog::on_m_add_pb_clicked()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief BOMExportDialog::on_m_remove_pb_clicked
|
||||
@brief BOMExportDialog::on_m_remove_pb_clicked
|
||||
*/
|
||||
void BOMExportDialog::on_m_remove_pb_clicked()
|
||||
{
|
||||
@@ -249,7 +249,7 @@ void BOMExportDialog::on_m_remove_pb_clicked()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief BOMExportDialog::on_m_up_pb_clicked
|
||||
@brief BOMExportDialog::on_m_up_pb_clicked
|
||||
*/
|
||||
void BOMExportDialog::on_m_up_pb_clicked()
|
||||
{
|
||||
@@ -266,7 +266,7 @@ void BOMExportDialog::on_m_up_pb_clicked()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief BOMExportDialog::on_m_down_pb_clicked
|
||||
@brief BOMExportDialog::on_m_down_pb_clicked
|
||||
*/
|
||||
void BOMExportDialog::on_m_down_pb_clicked()
|
||||
{
|
||||
@@ -287,9 +287,9 @@ void BOMExportDialog::on_m_save_name_le_textChanged(const QString &arg1) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief BOMExportDialog::getBom
|
||||
* @return the bill of material as string already formated
|
||||
* for export to csv.
|
||||
@brief BOMExportDialog::getBom
|
||||
@return the bill of material as string already formated
|
||||
for export to csv.
|
||||
*/
|
||||
QString BOMExportDialog::getBom()
|
||||
{
|
||||
@@ -333,8 +333,8 @@ QString BOMExportDialog::getBom()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief BOMExportDialog::headers
|
||||
* @return the header to be use for the csv file
|
||||
@brief BOMExportDialog::headers
|
||||
@return the header to be use for the csv file
|
||||
*/
|
||||
QString BOMExportDialog::headers() const
|
||||
{
|
||||
@@ -378,8 +378,8 @@ QString BOMExportDialog::headers() const
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief BOMExportDialog::createDataBase
|
||||
* @return true if database is successfully created
|
||||
@brief BOMExportDialog::createDataBase
|
||||
@return true if database is successfully created
|
||||
*/
|
||||
bool BOMExportDialog::createDataBase()
|
||||
{
|
||||
@@ -438,8 +438,8 @@ bool BOMExportDialog::createDataBase()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief BOMExportDialog::populateDataBase
|
||||
* Populate the database
|
||||
@brief BOMExportDialog::populateDataBase
|
||||
Populate the database
|
||||
*/
|
||||
void BOMExportDialog::populateDataBase()
|
||||
{
|
||||
@@ -470,9 +470,9 @@ void BOMExportDialog::populateDataBase()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief BOMExportDialog::elementInfoToString
|
||||
* @param elmt
|
||||
* @return a Hash with as key the name of bdd columns and value the value of @elmt for each columns.
|
||||
@brief BOMExportDialog::elementInfoToString
|
||||
@param elmt
|
||||
@return a Hash with as key the name of bdd columns and value the value of @elmt for each columns.
|
||||
*/
|
||||
QHash<QString, QString> BOMExportDialog::elementInfoToString(Element *elmt) const
|
||||
{
|
||||
@@ -512,8 +512,8 @@ QHash<QString, QString> BOMExportDialog::elementInfoToString(Element *elmt) cons
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief BOMExportDialog::queryStr
|
||||
* @return the query string
|
||||
@brief BOMExportDialog::queryStr
|
||||
@return the query string
|
||||
*/
|
||||
QString BOMExportDialog::queryStr() const
|
||||
{
|
||||
@@ -587,8 +587,8 @@ void BOMExportDialog::updateQueryLine() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief BOMExportDialog::fillSavedQuery
|
||||
* Fill the combo box with the name of the saved query
|
||||
@brief BOMExportDialog::fillSavedQuery
|
||||
Fill the combo box with the name of the saved query
|
||||
*/
|
||||
void BOMExportDialog::fillSavedQuery()
|
||||
{
|
||||
@@ -610,8 +610,8 @@ void BOMExportDialog::on_m_format_as_nomenclature_rb_toggled(bool checked) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief BOMExportDialog::on_m_edit_sql_query_cb_clicked
|
||||
* Update widgets
|
||||
@brief BOMExportDialog::on_m_edit_sql_query_cb_clicked
|
||||
Update widgets
|
||||
*/
|
||||
void BOMExportDialog::on_m_edit_sql_query_cb_clicked()
|
||||
{
|
||||
@@ -632,8 +632,8 @@ void BOMExportDialog::on_m_edit_sql_query_cb_clicked()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief BOMExportDialog::on_m_save_current_conf_pb_clicked
|
||||
* Save the current query to file
|
||||
@brief BOMExportDialog::on_m_save_current_conf_pb_clicked
|
||||
Save the current query to file
|
||||
*/
|
||||
void BOMExportDialog::on_m_save_current_conf_pb_clicked()
|
||||
{
|
||||
@@ -690,8 +690,8 @@ void BOMExportDialog::on_m_save_current_conf_pb_clicked()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief BOMExportDialog::on_m_load_pb_clicked
|
||||
* Load the current selected query from file
|
||||
@brief BOMExportDialog::on_m_load_pb_clicked
|
||||
Load the current selected query from file
|
||||
*/
|
||||
void BOMExportDialog::on_m_load_pb_clicked()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user