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,22 +28,22 @@
#include <QtConcurrent>
/**
* @brief ElementsCollectionModel::ElementsCollectionModel
* Constructor
* @param parent
*/
@brief ElementsCollectionModel::ElementsCollectionModel
Constructor
@param parent
*/
ElementsCollectionModel::ElementsCollectionModel(QObject *parent) :
QStandardItemModel(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
{
if (role == Qt::DecorationRole) {
@@ -59,11 +59,11 @@ 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
{
QModelIndex index = indexes.first();
@@ -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
//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
*/
bool ElementsCollectionModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
@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)
{
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
*/
void ElementsCollectionModel::loadCollections(bool common_collection, bool custom_collection, QList<QETProject *> projects)
@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)
{
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,9 +308,10 @@ 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)
{
FileElementCollectionItem *feci = new FileElementCollectionItem();
@@ -284,11 +325,11 @@ 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)
{
QModelIndex index = indexFromLocation(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,11 +379,12 @@ 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)
{
if (m_project_list.contains(project))
@@ -351,17 +399,25 @@ 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)
{
if (!m_project_list.contains(project))
@@ -371,27 +427,38 @@ 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
{
return m_project_list;
}
/**
* @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()
{
QList <ElementsLocation> unused;
@@ -414,9 +481,9 @@ 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
{
QList <ElementCollectionItem *> list;
@@ -431,10 +498,10 @@ 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
{
QList <ElementCollectionItem *> list;
@@ -449,9 +516,9 @@ 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()
{
m_hide_element = true;
@@ -463,13 +530,14 @@ void ElementsCollectionModel::hideElement()
}
/**
* @brief ElementsCollectionModel::indexFromLocation
* Return the index who represent @location.
* Index can be non valid
* @param location
* @return
*/
QModelIndex ElementsCollectionModel::indexFromLocation(const ElementsLocation &location)
@brief ElementsCollectionModel::indexFromLocation
Return the index who represent @location.
Index can be non valid
@param location
@return
*/
QModelIndex ElementsCollectionModel::indexFromLocation(
const ElementsLocation &location)
{
QList <ElementCollectionItem *> child_list;
@@ -502,11 +570,12 @@ 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)
{
QObject *object = sender();
@@ -536,10 +605,10 @@ 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)
{
QObject *object = sender();
@@ -564,10 +633,10 @@ 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)
{
QObject *object = sender();

View File

@@ -27,9 +27,13 @@
#include "diagram.h"
/**
* Constructor
*/
AutoNumberingManagementW::AutoNumberingManagementW(QETProject *project, QWidget *parent) :
@brief AutoNumberingManagementW::AutoNumberingManagementW
Constructor
@param project
@param parent
*/
AutoNumberingManagementW::AutoNumberingManagementW(QETProject *project,
QWidget *parent) :
QWidget(parent),
project_(project)
{
@@ -46,17 +50,18 @@ AutoNumberingManagementW::AutoNumberingManagementW(QETProject *project, QWidget
}
/**
* Destructor
*/
@brief AutoNumberingManagementW::~AutoNumberingManagementW
Destructor
*/
AutoNumberingManagementW::~AutoNumberingManagementW()
{
delete ui;
}
/**
* @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"));
ui->m_status_cb->addItem(tr("Installing"));
@@ -64,9 +69,10 @@ 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) {
//Under Development
@@ -96,9 +102,9 @@ 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()) {
ui->m_selected_folios_widget->setEnabled(true);
@@ -119,9 +125,10 @@ 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();
ui->m_selected_folios_le->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,9 +155,10 @@ 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) {
QString from = ui->m_from_folios_cb->currentText();
@@ -158,9 +171,9 @@ 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);
ui->m_selected_folios_le->setDisabled(true);
@@ -168,9 +181,10 @@ 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
int answer = ui -> buttonBox -> buttonRole(button);
@@ -196,9 +210,10 @@ 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){
bool valid= true;

View File

@@ -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

View File

@@ -1466,15 +1466,15 @@ 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)
{
QDomDocument xml_document = xml_element.ownerDocument();
@@ -1549,19 +1549,23 @@ 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)
{
if (!diagram) {
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());
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();
}

View File

@@ -34,10 +34,10 @@
#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),
ui(new Ui::BOMExportDialog),
@@ -112,8 +112,8 @@ BOMExportDialog::BOMExportDialog(QETProject *project, QWidget *parent) :
}
/**
* @brief BOMExportDialog::~BOMExportDialog
*/
@brief BOMExportDialog::~BOMExportDialog
*/
BOMExportDialog::~BOMExportDialog()
{
delete ui;
@@ -121,10 +121,10 @@ BOMExportDialog::~BOMExportDialog()
}
/**
* @brief BOMExportDialog::exec
* Reimplemented from QDialog
* @return
*/
@brief BOMExportDialog::exec
Reimplemented from QDialog
@return
*/
int BOMExportDialog::exec()
{
int r = QDialog::exec();
@@ -165,9 +165,9 @@ 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
{
//Made a string list with the colomns (keys) choosen by the user
@@ -183,10 +183,10 @@ QStringList BOMExportDialog::selectedKeys() const
}
/**
* @brief BOMExportDialog::translatedKeys
* @param key
* @return
*/
@brief BOMExportDialog::translatedKeys
@param key
@return
*/
QString BOMExportDialog::translatedKeys(const QString &key) const
{
if (QETApp::elementInfoKeys().contains(key)) {
@@ -202,9 +202,9 @@ 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()
{
for(QString key : QETApp::elementInfoKeys())
@@ -225,8 +225,8 @@ void BOMExportDialog::setUpItems()
}
/**
* @brief BOMExportDialog::on_m_add_pb_clicked
*/
@brief BOMExportDialog::on_m_add_pb_clicked
*/
void BOMExportDialog::on_m_add_pb_clicked()
{
if (auto *item = ui->m_var_list->takeItem(ui->m_var_list->currentRow())) {
@@ -237,8 +237,8 @@ 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()
{
if (auto *item = ui->m_choosen_list->takeItem(ui->m_choosen_list->currentRow())) {
@@ -249,8 +249,8 @@ 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()
{
auto row = ui->m_choosen_list->currentRow();
@@ -266,8 +266,8 @@ 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()
{
auto row = ui->m_choosen_list->currentRow();
@@ -287,10 +287,10 @@ 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()
{
QString data; //The string to be returned
@@ -333,9 +333,9 @@ 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
{
QString header_string;
@@ -378,9 +378,9 @@ 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()
{
//Create a sqlite data base to sort the bom
@@ -438,9 +438,9 @@ bool BOMExportDialog::createDataBase()
}
/**
* @brief BOMExportDialog::populateDataBase
* Populate the database
*/
@brief BOMExportDialog::populateDataBase
Populate the database
*/
void BOMExportDialog::populateDataBase()
{
for (auto *diagram : m_project->diagrams())
@@ -470,10 +470,10 @@ 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
{
QHash<QString, QString> keys_hash; //Use to get the element info according to the database columns name
@@ -512,9 +512,9 @@ 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
{
//User define is own query
@@ -587,9 +587,9 @@ 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()
{
QFile file(QETApp::configDir() + "/bill_of_materials.json");
@@ -610,9 +610,9 @@ 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()
{
ui->m_sql_query->setEnabled(ui->m_edit_sql_query_cb->isChecked());
@@ -632,9 +632,9 @@ 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()
{
QFile file(QETApp::configDir() + "/bill_of_materials.json");
@@ -690,9 +690,9 @@ 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()
{
auto name = ui->m_conf_cb->currentText();