Mod doc, Improve code style

This commit is contained in:
Simon De Backer
2020-08-08 23:58:17 +02:00
parent d9ec9bf274
commit 7834d6fb84
5 changed files with 339 additions and 249 deletions

View File

@@ -28,9 +28,9 @@
#include <QtConcurrent> #include <QtConcurrent>
/** /**
* @brief ElementsCollectionModel::ElementsCollectionModel @brief ElementsCollectionModel::ElementsCollectionModel
* Constructor Constructor
* @param parent @param parent
*/ */
ElementsCollectionModel::ElementsCollectionModel(QObject *parent) : ElementsCollectionModel::ElementsCollectionModel(QObject *parent) :
QStandardItemModel(parent) QStandardItemModel(parent)
@@ -38,11 +38,11 @@ ElementsCollectionModel::ElementsCollectionModel(QObject *parent) :
} }
/** /**
* @brief ElementsCollectionModel::data @brief ElementsCollectionModel::data
* Reimplemented from QStandardItemModel Reimplemented from QStandardItemModel
* @param index @param index
* @param role @param role
* @return @return
*/ */
QVariant ElementsCollectionModel::data(const QModelIndex &index, int role) const 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 @brief ElementsCollectionModel::mimeData
* Reimplemented from QStandardItemModel Reimplemented from QStandardItemModel
* @param indexes @param indexes
* @return @return
*/ */
QMimeData *ElementsCollectionModel::mimeData(const QModelIndexList &indexes) const QMimeData *ElementsCollectionModel::mimeData(const QModelIndexList &indexes) const
{ {
@@ -86,14 +86,15 @@ QMimeData *ElementsCollectionModel::mimeData(const QModelIndexList &indexes) con
} }
/** /**
* @brief ElementsCollectionModel::mimeTypes @brief ElementsCollectionModel::mimeTypes
* Reimplemented from QStandardItemModel Reimplemented from QStandardItemModel
* @return @return
*/ */
QStringList ElementsCollectionModel::mimeTypes() const QStringList ElementsCollectionModel::mimeTypes() const
{ {
QStringList mime_list = QAbstractItemModel::mimeTypes(); 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; return mime_list;
} }
@@ -107,12 +108,21 @@ QStringList ElementsCollectionModel::mimeTypes() const
* @param parent * @param parent
* @return * @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; return false;
QStandardItem *qsi = itemFromIndex(parent.QModelIndex::model()->index(row, column)); QStandardItem *qsi = itemFromIndex(parent.QModelIndex::model()->index(
row, column));
if (!qsi) if (!qsi)
qsi = itemFromIndex(parent); qsi = itemFromIndex(parent);
@@ -123,12 +133,14 @@ bool ElementsCollectionModel::canDropMimeData(const QMimeData *data, Qt::DropAct
ElementCollectionItem *eci = static_cast<ElementCollectionItem *>(qsi); 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 //Return false if user try to drop a item from a folder to the same folder
ElementsLocation drop_location(data->text()); ElementsLocation drop_location(data->text());
for (int i=0 ; i<eci->rowCount() ; i++) 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 false;
return true; return true;
@@ -138,19 +150,24 @@ bool ElementsCollectionModel::canDropMimeData(const QMimeData *data, Qt::DropAct
} }
/** /**
* @brief ElementsCollectionModel::dropMimeData @brief ElementsCollectionModel::dropMimeData
* Reimplemented from QStandardItemModel Reimplemented from QStandardItemModel
* @param data @param data
* @param action @param action
* @param row @param row
* @param column @param column
* @param parent @param parent
* @return @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) Q_UNUSED(action)
QStandardItem *qsi = itemFromIndex(parent.QModelIndex::model()->index(row, column)); QStandardItem *qsi = itemFromIndex(
parent.QModelIndex::model()->index(row, column));
if (!qsi) if (!qsi)
qsi = itemFromIndex(parent); qsi = itemFromIndex(parent);
@@ -161,7 +178,8 @@ bool ElementsCollectionModel::dropMimeData(const QMimeData *data, Qt::DropAction
if (feci->isCommonCollection()) if (feci->isCommonCollection())
return false; 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()); feci = static_cast<FileElementCollectionItem *>(feci->parent());
ElementCollectionHandler ech; 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, //If feci have a child with the same path of location,
//we remove the existing child befor insert new child //we remove the existing child befor insert new child
for (int i=0 ; i<feci->rowCount() ; i++) { 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->removeRow(i);
} }
feci->addChildAtPath(location.fileName()); feci->addChildAtPath(location.fileName());
@@ -187,18 +207,26 @@ bool ElementsCollectionModel::dropMimeData(const QMimeData *data, Qt::DropAction
else if (qsi->type() == XmlProjectElementCollectionItem::Type) { else if (qsi->type() == XmlProjectElementCollectionItem::Type) {
XmlProjectElementCollectionItem *xpeci = static_cast<XmlProjectElementCollectionItem*>(qsi); 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()); xpeci = static_cast<XmlProjectElementCollectionItem *>(xpeci->parent());
//before do the copy, we get all collection path of xpeci child, /* 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. * for remove it
//We can't do this after the copy, because at the copy if the xml collection have a DomElement with the same path, * if the copied item have the same path of an existing child.
//he was removed before the new xml DomElement is inserted * We can't do this after the copy,
//So the existing child of this will return a null QString when call collectionPath(), because the item * because at the copy
//doesn't exist anymore in the xml collection. * 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; QList <QString> child_path_list;
for (int i=0 ; i<xpeci->rowCount() ; i++) 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; ElementCollectionHandler ech;
@@ -213,18 +241,23 @@ bool ElementsCollectionModel::dropMimeData(const QMimeData *data, Qt::DropAction
} }
/** /**
* @brief ElementsCollectionModel::loadCollections @brief ElementsCollectionModel::loadCollections
* Load the several collections in this model. Load the several collections in this model.
* Prefer use this method instead of addCommonCollection, addCustomCollection and addProject, Prefer use this method instead of addCommonCollection,
* because it use multithreading to speed up the loading. addCustomCollection and addProject,
* This method emit loadingProgressRangeChanged(int, int) for know the minimu and maximum progress value because it use multithreading to speed up the loading.
* This method emit loadingProgressValueChanged(int) for know the current progress value This method emit loadingProgressRangeChanged(int, int)
* This method emit loadingFinished for know when loading finished. for know the minimu and maximum progress value
* @param common_collection : true for load the common collection This method emit loadingProgressValueChanged(int)
* @param custom_collection : true for load the custom collection for know the current progress value
* @param projects : list of projects to load 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(); 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)); m_items_list_to_setUp.append(projectItems(project));
} }
auto *watcher = new QFutureWatcher<void>(); auto *watcher = new QFutureWatcher<void>();
connect(watcher, &QFutureWatcher<void>::progressValueChanged, this, &ElementsCollectionModel::loadingProgressValueChanged); connect(watcher, &QFutureWatcher<void>::progressValueChanged,
connect(watcher, &QFutureWatcher<void>::progressRangeChanged, this, &ElementsCollectionModel::loadingProgressRangeChanged); this, &ElementsCollectionModel::loadingProgressValueChanged);
connect(watcher, &QFutureWatcher<void>::finished, this, &ElementsCollectionModel::loadingFinished); connect(watcher, &QFutureWatcher<void>::progressRangeChanged,
connect(watcher, &QFutureWatcher<void>::finished, watcher, &QFutureWatcher<void>::deleteLater); 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); m_future = QtConcurrent::map(m_items_list_to_setUp, setUpData);
watcher->setFuture(m_future); watcher->setFuture(m_future);
} }
/** /**
* @brief ElementsCollectionModel::addCommonCollection @brief ElementsCollectionModel::addCommonCollection
* Add the common elements collection to this model Add the common elements collection to this model
@param set_data
*/ */
void ElementsCollectionModel::addCommonCollection(bool set_data) void ElementsCollectionModel::addCommonCollection(bool set_data)
{ {
FileElementCollectionItem *feci = new FileElementCollectionItem(); 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); invisibleRootItem()->appendRow(feci);
if (set_data) if (set_data)
feci->setUpData(); feci->setUpData();
@@ -268,8 +308,9 @@ void ElementsCollectionModel::addCommonCollection(bool set_data)
} }
/** /**
* @brief ElementsCollectionModel::addCustomCollection @brief ElementsCollectionModel::addCustomCollection
* Add the custom elements collection to this model Add the custom elements collection to this model
@param set_data
*/ */
void ElementsCollectionModel::addCustomCollection(bool set_data) void ElementsCollectionModel::addCustomCollection(bool set_data)
{ {
@@ -284,10 +325,10 @@ void ElementsCollectionModel::addCustomCollection(bool set_data)
} }
/** /**
* @brief ElementsCollectionModel::addLocation @brief ElementsCollectionModel::addLocation
* Add the element or directory to this model. Add the element or directory to this model.
* If the location is already managed by this model, do nothing. If the location is already managed by this model, do nothing.
* @param location @param location
*/ */
void ElementsCollectionModel::addLocation(const ElementsLocation& location) void ElementsCollectionModel::addLocation(const ElementsLocation& location)
{ {
@@ -302,9 +343,12 @@ void ElementsCollectionModel::addLocation(const ElementsLocation& location)
QETProject *project = location.project(); QETProject *project = location.project();
if (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()) { else if (location.isCustomCollection()) {
@@ -316,10 +360,13 @@ void ElementsCollectionModel::addLocation(const ElementsLocation& location)
foreach(ElementCollectionItem *eci, child_list) { foreach(ElementCollectionItem *eci, child_list) {
if (eci->type() == FileElementCollectionItem::Type) { if (eci->type() == FileElementCollectionItem::Type) {
FileElementCollectionItem *feci = static_cast<FileElementCollectionItem *>(eci); FileElementCollectionItem *feci =
static_cast<FileElementCollectionItem *>(eci);
if (feci->isCustomCollection()) { if (feci->isCustomCollection()) {
last_item = feci->lastItemForPath(location.collectionPath(false), collection_name); last_item = feci->lastItemForPath(
location.collectionPath(false),
collection_name);
if(last_item) if(last_item)
break; break;
} }
@@ -332,10 +379,11 @@ void ElementsCollectionModel::addLocation(const ElementsLocation& location)
} }
/** /**
* @brief ElementsCollectionModel::addProject @brief ElementsCollectionModel::addProject
* Add project to this model Add project to this model
* @param project : project to add. @param project : project to add.
* @param set_data : if true, setUpData is called for every ElementCollectionItem of project @param set_data :
if true, setUpData is called for every ElementCollectionItem of project
*/ */
void ElementsCollectionModel::addProject(QETProject *project, bool set_data) void ElementsCollectionModel::addProject(QETProject *project, bool set_data)
{ {
@@ -351,16 +399,24 @@ void ElementsCollectionModel::addProject(QETProject *project, bool set_data)
insertRow(row, xpeci); insertRow(row, xpeci);
if (set_data) if (set_data)
xpeci->setUpData(); xpeci->setUpData();
connect(project->embeddedElementCollection(), &XmlElementCollection::elementAdded, this, &ElementsCollectionModel::elementIntegratedToCollection); connect(project->embeddedElementCollection(),
connect(project->embeddedElementCollection(), &XmlElementCollection::elementChanged, this, &ElementsCollectionModel::updateItem); &XmlElementCollection::elementAdded,
connect(project->embeddedElementCollection(), &XmlElementCollection::elementRemoved, this, &ElementsCollectionModel::itemRemovedFromCollection); this, &ElementsCollectionModel::elementIntegratedToCollection);
connect(project->embeddedElementCollection(), &XmlElementCollection::directoryRemoved, this, &ElementsCollectionModel::itemRemovedFromCollection); 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 @brief ElementsCollectionModel::removeProject
* Remove project from this model Remove project from this model
* @param project @param project
*/ */
void ElementsCollectionModel::removeProject(QETProject *project) void ElementsCollectionModel::removeProject(QETProject *project)
{ {
@@ -371,16 +427,27 @@ void ElementsCollectionModel::removeProject(QETProject *project)
if (removeRows(row, 1, QModelIndex())) { if (removeRows(row, 1, QModelIndex())) {
m_project_list.removeOne(project); m_project_list.removeOne(project);
m_project_hash.remove(project); m_project_hash.remove(project);
disconnect(project->embeddedElementCollection(), &XmlElementCollection::elementAdded, this, &ElementsCollectionModel::elementIntegratedToCollection); disconnect(project->embeddedElementCollection(),
disconnect(project->embeddedElementCollection(), &XmlElementCollection::elementChanged, this, &ElementsCollectionModel::updateItem); &XmlElementCollection::elementAdded,
disconnect(project->embeddedElementCollection(), &XmlElementCollection::elementRemoved, this, &ElementsCollectionModel::itemRemovedFromCollection); this,
disconnect(project->embeddedElementCollection(), &XmlElementCollection::directoryRemoved, this, &ElementsCollectionModel::itemRemovedFromCollection); &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 @brief ElementsCollectionModel::project
* @return every project added to this model @return every project added to this model
*/ */
QList<QETProject *> ElementsCollectionModel::project() const QList<QETProject *> ElementsCollectionModel::project() const
{ {
@@ -388,9 +455,9 @@ QList<QETProject *> ElementsCollectionModel::project() const
} }
/** /**
* @brief ElementsCollectionModel::highlightUnusedElement @brief ElementsCollectionModel::highlightUnusedElement
* Highlight every unused element of managed project. Highlight every unused element of managed project.
* @See QETProject::unusedElements() @see QETProject::unusedElements()
*/ */
void ElementsCollectionModel::highlightUnusedElement() void ElementsCollectionModel::highlightUnusedElement()
{ {
@@ -414,8 +481,8 @@ void ElementsCollectionModel::highlightUnusedElement()
} }
/** /**
* @brief ElementsCollectionModel::items @brief ElementsCollectionModel::items
* @return every ElementCollectionItem owned by this model @return every ElementCollectionItem owned by this model
*/ */
QList <ElementCollectionItem *> ElementsCollectionModel::items() const QList <ElementCollectionItem *> ElementsCollectionModel::items() const
{ {
@@ -431,9 +498,9 @@ QList <ElementCollectionItem *> ElementsCollectionModel::items() const
} }
/** /**
* @brief ElementsCollectionModel::projectItems @brief ElementsCollectionModel::projectItems
* @param project @param project
* @return return all items for project @project. the list can be empty @return return all items for project @project. the list can be empty
*/ */
QList<ElementCollectionItem *> ElementsCollectionModel::projectItems(QETProject *project) const QList<ElementCollectionItem *> ElementsCollectionModel::projectItems(QETProject *project) const
{ {
@@ -449,8 +516,8 @@ QList<ElementCollectionItem *> ElementsCollectionModel::projectItems(QETProject
} }
/** /**
* @brief ElementsCollectionModel::hideElement @brief ElementsCollectionModel::hideElement
* Hide element in this model, only directory is managed Hide element in this model, only directory is managed
*/ */
void ElementsCollectionModel::hideElement() void ElementsCollectionModel::hideElement()
{ {
@@ -463,13 +530,14 @@ void ElementsCollectionModel::hideElement()
} }
/** /**
* @brief ElementsCollectionModel::indexFromLocation @brief ElementsCollectionModel::indexFromLocation
* Return the index who represent @location. Return the index who represent @location.
* Index can be non valid Index can be non valid
* @param location @param location
* @return @return
*/ */
QModelIndex ElementsCollectionModel::indexFromLocation(const ElementsLocation &location) QModelIndex ElementsCollectionModel::indexFromLocation(
const ElementsLocation &location)
{ {
QList <ElementCollectionItem *> child_list; QList <ElementCollectionItem *> child_list;
@@ -502,10 +570,11 @@ QModelIndex ElementsCollectionModel::indexFromLocation(const ElementsLocation &l
} }
/** /**
* @brief ElementsCollectionModel::elementIntegratedToCollection @brief ElementsCollectionModel::elementIntegratedToCollection
* When an element is added to embedded collection of a project, When an element is added to embedded collection of a project,
* this method create and display the new element this method create and display the new element
* @param path -The path of the new element in the embedded collection of a project @param path :
-The path of the new element in the embedded collection of a project
*/ */
void ElementsCollectionModel::elementIntegratedToCollection(const QString& path) void ElementsCollectionModel::elementIntegratedToCollection(const QString& path)
{ {
@@ -536,9 +605,9 @@ void ElementsCollectionModel::elementIntegratedToCollection(const QString& path)
} }
/** /**
* @brief ElementsCollectionModel::itemRemovedFromCollection @brief ElementsCollectionModel::itemRemovedFromCollection
* This method must be called by a signal, to get a sender. This method must be called by a signal, to get a sender.
* @param path @param path
*/ */
void ElementsCollectionModel::itemRemovedFromCollection(const QString& path) void ElementsCollectionModel::itemRemovedFromCollection(const QString& path)
{ {
@@ -564,9 +633,9 @@ void ElementsCollectionModel::itemRemovedFromCollection(const QString& path)
} }
/** /**
* @brief ElementsCollectionModel::updateItem @brief ElementsCollectionModel::updateItem
* Update the item at path Update the item at path
* @param path @param path
*/ */
void ElementsCollectionModel::updateItem(const QString& path) void ElementsCollectionModel::updateItem(const QString& path)
{ {

View File

@@ -27,9 +27,13 @@
#include "diagram.h" #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), QWidget(parent),
project_(project) project_(project)
{ {
@@ -46,7 +50,8 @@ AutoNumberingManagementW::AutoNumberingManagementW(QETProject *project, QWidget
} }
/** /**
* Destructor @brief AutoNumberingManagementW::~AutoNumberingManagementW
Destructor
*/ */
AutoNumberingManagementW::~AutoNumberingManagementW() AutoNumberingManagementW::~AutoNumberingManagementW()
{ {
@@ -54,8 +59,8 @@ AutoNumberingManagementW::~AutoNumberingManagementW()
} }
/** /**
* @brief AutoNumberingManagementW::setProjectContext @brief AutoNumberingManagementW::setProjectContext
* Add Default Project Status Add Default Project Status
*/ */
void AutoNumberingManagementW::setProjectContext() { void AutoNumberingManagementW::setProjectContext() {
ui->m_status_cb->addItem(tr("Under Development")); ui->m_status_cb->addItem(tr("Under Development"));
@@ -64,8 +69,9 @@ void AutoNumberingManagementW::setProjectContext() {
} }
/** /**
* @brief AutoNumberingManagementW::on_m_status_cb_currentIndexChanged @brief AutoNumberingManagementW::on_m_status_cb_currentIndexChanged
* Load Default Status Options Load Default Status Options
@param index
*/ */
void AutoNumberingManagementW::on_m_status_cb_currentIndexChanged(int 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 @brief AutoNumberingManagementW::on_m_apply_folios_rb_clicked
* Set From Folios Combobox Set From Folios Combobox
*/ */
void AutoNumberingManagementW::on_m_apply_folios_rb_clicked() { void AutoNumberingManagementW::on_m_apply_folios_rb_clicked() {
if (ui->m_apply_folios_rb->isChecked()) { 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 @brief AutoNumberingManagementW::on_m_from_folios_cb_currentIndexChanged
* Set To Folios Combobox Set To Folios Combobox
@param index
*/ */
void AutoNumberingManagementW::on_m_from_folios_cb_currentIndexChanged(int index) { void AutoNumberingManagementW::on_m_from_folios_cb_currentIndexChanged(int index) {
ui->m_to_folios_cb->clear(); 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(""); ui->m_to_folios_cb->addItem("");
for (int i=index;i<project_->diagrams().size();i++) { for (int i=index;i<project_->diagrams().size();i++) {
if (project_->diagrams().at(i)->title() != "") { 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); applyEnable(true);
ui->m_selected_folios_le->clear(); 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 @brief AutoNumberingManagementW::on_m_to_folios_cb_currentIndexChanged
* Set selected folios Line Edit content Set selected folios Line Edit content
@param index
*/ */
void AutoNumberingManagementW::on_m_to_folios_cb_currentIndexChanged(int index) { void AutoNumberingManagementW::on_m_to_folios_cb_currentIndexChanged(int index) {
if (index > 0) { 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 @brief AutoNumberingManagementW::on_m_apply_project_rb_clicked
* Disable folio widget Disable folio widget
*/ */
void AutoNumberingManagementW::on_m_apply_project_rb_clicked() { void AutoNumberingManagementW::on_m_apply_project_rb_clicked() {
ui->m_selected_folios_widget->setDisabled(true); ui->m_selected_folios_widget->setDisabled(true);
@@ -168,8 +181,9 @@ void AutoNumberingManagementW::on_m_apply_project_rb_clicked() {
} }
/** /**
* @brief AutoNumberingManagementW::on_buttonBox_clicked @brief AutoNumberingManagementW::on_buttonBox_clicked
* Action on @buttonBox clicked Action on @buttonBox clicked
@param button
*/ */
void AutoNumberingManagementW::on_buttonBox_clicked(QAbstractButton *button) { void AutoNumberingManagementW::on_buttonBox_clicked(QAbstractButton *button) {
//transform button to int //transform button to int
@@ -196,8 +210,9 @@ void AutoNumberingManagementW::on_buttonBox_clicked(QAbstractButton *button) {
} }
/** /**
* @brief AutoNumberingManagementW::applyEnable @brief AutoNumberingManagementW::applyEnable
* enable/disable the apply button enable/disable the apply button
@param b
*/ */
void AutoNumberingManagementW::applyEnable(bool b) { void AutoNumberingManagementW::applyEnable(bool b) {
if (b){ if (b){

View File

@@ -823,10 +823,10 @@ QUuid Terminal::uuid() const {
/** /**
@brief Conductor::relatedPotentialTerminal @brief Conductor::relatedPotentialTerminal
Return terminal at the same potential from the same 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 folio report, return the terminal of linked other report.
For Terminal element, return the other terminal of terminal element. 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, @param all_diagram :if true return all related terminal,
false return only terminal in the same diagram of @t false return only terminal in the same diagram of @t
@return the list of terminal at the same potential @return the list of terminal at the same potential

View File

@@ -1466,14 +1466,14 @@ void QETProject::writeProjectPropertiesXml(QDomElement &xml_element) {
} }
/** /**
* @brief QETProject::writeDefaultPropertiesXml @brief QETProject::writeDefaultPropertiesXml
* Export all defaults properties used by a new diagram and his content Export all defaults properties used by a new diagram and his content
* #size of border #size of border
* #content of titleblock #content of titleblock
* #default conductor #default conductor
* #defaut folio report #defaut folio report
* #default Xref #default Xref
* @param xml_element xml element to use for store default propertie. @param xml_element xml element to use for store default propertie.
*/ */
void QETProject::writeDefaultPropertiesXml(QDomElement &xml_element) void QETProject::writeDefaultPropertiesXml(QDomElement &xml_element)
{ {
@@ -1549,10 +1549,10 @@ void QETProject::writeDefaultPropertiesXml(QDomElement &xml_element)
} }
/** /**
* @brief QETProject::addDiagram @brief QETProject::addDiagram
* Add a diagram in this project Add a diagram in this project
* @param diagram added diagram @param diagram added diagram
* @param pos postion of the new diagram, by default at the end @param pos postion of the new diagram, by default at the end
*/ */
void QETProject::addDiagram(Diagram *diagram, int pos) void QETProject::addDiagram(Diagram *diagram, int pos)
{ {
@@ -1560,8 +1560,12 @@ void QETProject::addDiagram(Diagram *diagram, int pos)
return; return;
} }
connect(&diagram->border_and_titleblock, &BorderTitleBlock::needFolioData, this, &QETProject::updateDiagramsFolioData); connect(&diagram->border_and_titleblock,
connect(diagram, &Diagram::usedTitleBlockTemplateChanged, this, &QETProject::usedTitleBlockTemplateChanged); &BorderTitleBlock::needFolioData,
this,
&QETProject::updateDiagramsFolioData);
connect(diagram, &Diagram::usedTitleBlockTemplateChanged,
this, &QETProject::usedTitleBlockTemplateChanged);
if (pos == -1) { if (pos == -1) {
m_diagrams_list << diagram; 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 @return La liste des noms a utiliser pour la categorie dediee aux elements
integres automatiquement dans le projet. integres automatiquement dans le projet.
*/ */
NamesList QETProject::namesListForIntegrationCategory() { NamesList QETProject::namesListForIntegrationCategory() {
NamesList names; NamesList names;
@@ -1602,14 +1605,17 @@ NamesList QETProject::namesListForIntegrationCategory() {
} }
/** /**
* @brief QETProject::writeBackup @brief QETProject::writeBackup
* Write a backup file of this project, in the case that QET crash Write a backup file of this project, in the case that QET crash
*/ */
void QETProject::writeBackup() void QETProject::writeBackup()
{ {
QDomDocument xml_project(toXml()); QDomDocument xml_project(toXml());
QString temp; 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(); bac.waitForFinished();
} }

View File

@@ -34,9 +34,9 @@
#include <QSqlRecord> #include <QSqlRecord>
/** /**
* @brief BOMExportDialog::BOMExportDialog @brief BOMExportDialog::BOMExportDialog
* @param project the project for create the bill of material @param project the project for create the bill of material
* @param parent widget @param parent widget
*/ */
BOMExportDialog::BOMExportDialog(QETProject *project, QWidget *parent) : BOMExportDialog::BOMExportDialog(QETProject *project, QWidget *parent) :
QDialog(parent), QDialog(parent),
@@ -112,7 +112,7 @@ BOMExportDialog::BOMExportDialog(QETProject *project, QWidget *parent) :
} }
/** /**
* @brief BOMExportDialog::~BOMExportDialog @brief BOMExportDialog::~BOMExportDialog
*/ */
BOMExportDialog::~BOMExportDialog() BOMExportDialog::~BOMExportDialog()
{ {
@@ -121,9 +121,9 @@ BOMExportDialog::~BOMExportDialog()
} }
/** /**
* @brief BOMExportDialog::exec @brief BOMExportDialog::exec
* Reimplemented from QDialog Reimplemented from QDialog
* @return @return
*/ */
int BOMExportDialog::exec() int BOMExportDialog::exec()
{ {
@@ -165,8 +165,8 @@ int BOMExportDialog::exec()
} }
/** /**
* @brief BOMExportDialog::selectedKeys @brief BOMExportDialog::selectedKeys
* @return the current keys of selected infos to be exported @return the current keys of selected infos to be exported
*/ */
QStringList BOMExportDialog::selectedKeys() const QStringList BOMExportDialog::selectedKeys() const
{ {
@@ -183,9 +183,9 @@ QStringList BOMExportDialog::selectedKeys() const
} }
/** /**
* @brief BOMExportDialog::translatedKeys @brief BOMExportDialog::translatedKeys
* @param key @param key
* @return @return
*/ */
QString BOMExportDialog::translatedKeys(const QString &key) const QString BOMExportDialog::translatedKeys(const QString &key) const
{ {
@@ -202,8 +202,8 @@ QString BOMExportDialog::translatedKeys(const QString &key) const
} }
/** /**
* @brief BOMExportDialog::setUpItems @brief BOMExportDialog::setUpItems
* Setup all items available for create the column of the bill of material. Setup all items available for create the column of the bill of material.
*/ */
void BOMExportDialog::setUpItems() 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() 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() 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() 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() 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 @brief BOMExportDialog::getBom
* @return the bill of material as string already formated @return the bill of material as string already formated
* for export to csv. for export to csv.
*/ */
QString BOMExportDialog::getBom() QString BOMExportDialog::getBom()
{ {
@@ -333,8 +333,8 @@ QString BOMExportDialog::getBom()
} }
/** /**
* @brief BOMExportDialog::headers @brief BOMExportDialog::headers
* @return the header to be use for the csv file @return the header to be use for the csv file
*/ */
QString BOMExportDialog::headers() const QString BOMExportDialog::headers() const
{ {
@@ -378,8 +378,8 @@ QString BOMExportDialog::headers() const
} }
/** /**
* @brief BOMExportDialog::createDataBase @brief BOMExportDialog::createDataBase
* @return true if database is successfully created @return true if database is successfully created
*/ */
bool BOMExportDialog::createDataBase() bool BOMExportDialog::createDataBase()
{ {
@@ -438,8 +438,8 @@ bool BOMExportDialog::createDataBase()
} }
/** /**
* @brief BOMExportDialog::populateDataBase @brief BOMExportDialog::populateDataBase
* Populate the database Populate the database
*/ */
void BOMExportDialog::populateDataBase() void BOMExportDialog::populateDataBase()
{ {
@@ -470,9 +470,9 @@ void BOMExportDialog::populateDataBase()
} }
/** /**
* @brief BOMExportDialog::elementInfoToString @brief BOMExportDialog::elementInfoToString
* @param elmt @param elmt
* @return a Hash with as key the name of bdd columns and value the value of @elmt for each columns. @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 QHash<QString, QString> BOMExportDialog::elementInfoToString(Element *elmt) const
{ {
@@ -512,8 +512,8 @@ QHash<QString, QString> BOMExportDialog::elementInfoToString(Element *elmt) cons
} }
/** /**
* @brief BOMExportDialog::queryStr @brief BOMExportDialog::queryStr
* @return the query string @return the query string
*/ */
QString BOMExportDialog::queryStr() const QString BOMExportDialog::queryStr() const
{ {
@@ -587,8 +587,8 @@ void BOMExportDialog::updateQueryLine() {
} }
/** /**
* @brief BOMExportDialog::fillSavedQuery @brief BOMExportDialog::fillSavedQuery
* Fill the combo box with the name of the saved query Fill the combo box with the name of the saved query
*/ */
void BOMExportDialog::fillSavedQuery() 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 @brief BOMExportDialog::on_m_edit_sql_query_cb_clicked
* Update widgets Update widgets
*/ */
void BOMExportDialog::on_m_edit_sql_query_cb_clicked() 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 @brief BOMExportDialog::on_m_save_current_conf_pb_clicked
* Save the current query to file Save the current query to file
*/ */
void BOMExportDialog::on_m_save_current_conf_pb_clicked() 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 @brief BOMExportDialog::on_m_load_pb_clicked
* Load the current selected query from file Load the current selected query from file
*/ */
void BOMExportDialog::on_m_load_pb_clicked() void BOMExportDialog::on_m_load_pb_clicked()
{ {