mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 12:40:35 +01:00
Mod doc, Improve code style
This commit is contained in:
@@ -28,22 +28,22 @@
|
|||||||
#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)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @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
|
||||||
{
|
{
|
||||||
if (role == Qt::DecorationRole) {
|
if (role == Qt::DecorationRole) {
|
||||||
@@ -59,11 +59,11 @@ 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
|
||||||
{
|
{
|
||||||
QModelIndex index = indexes.first();
|
QModelIndex index = indexes.first();
|
||||||
@@ -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
|
||||||
void ElementsCollectionModel::loadCollections(bool common_collection, bool custom_collection, QList<QETProject *> projects)
|
@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();
|
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,9 +308,10 @@ 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)
|
||||||
{
|
{
|
||||||
FileElementCollectionItem *feci = new FileElementCollectionItem();
|
FileElementCollectionItem *feci = new FileElementCollectionItem();
|
||||||
@@ -284,11 +325,11 @@ 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)
|
||||||
{
|
{
|
||||||
QModelIndex index = indexFromLocation(location);
|
QModelIndex index = indexFromLocation(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,11 +379,12 @@ 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)
|
||||||
{
|
{
|
||||||
if (m_project_list.contains(project))
|
if (m_project_list.contains(project))
|
||||||
@@ -351,17 +399,25 @@ 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)
|
||||||
{
|
{
|
||||||
if (!m_project_list.contains(project))
|
if (!m_project_list.contains(project))
|
||||||
@@ -371,27 +427,38 @@ 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
|
||||||
{
|
{
|
||||||
return m_project_list;
|
return m_project_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @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()
|
||||||
{
|
{
|
||||||
QList <ElementsLocation> unused;
|
QList <ElementsLocation> unused;
|
||||||
@@ -414,9 +481,9 @@ 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
|
||||||
{
|
{
|
||||||
QList <ElementCollectionItem *> list;
|
QList <ElementCollectionItem *> list;
|
||||||
@@ -431,10 +498,10 @@ 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
|
||||||
{
|
{
|
||||||
QList <ElementCollectionItem *> list;
|
QList <ElementCollectionItem *> list;
|
||||||
@@ -449,9 +516,9 @@ 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()
|
||||||
{
|
{
|
||||||
m_hide_element = true;
|
m_hide_element = true;
|
||||||
@@ -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,11 +570,12 @@ 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)
|
||||||
{
|
{
|
||||||
QObject *object = sender();
|
QObject *object = sender();
|
||||||
@@ -536,10 +605,10 @@ 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)
|
||||||
{
|
{
|
||||||
QObject *object = sender();
|
QObject *object = sender();
|
||||||
@@ -564,10 +633,10 @@ 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)
|
||||||
{
|
{
|
||||||
QObject *object = sender();
|
QObject *object = sender();
|
||||||
|
|||||||
@@ -27,9 +27,13 @@
|
|||||||
#include "diagram.h"
|
#include "diagram.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
@brief AutoNumberingManagementW::AutoNumberingManagementW
|
||||||
*/
|
Constructor
|
||||||
AutoNumberingManagementW::AutoNumberingManagementW(QETProject *project, QWidget *parent) :
|
@param project
|
||||||
|
@param parent
|
||||||
|
*/
|
||||||
|
AutoNumberingManagementW::AutoNumberingManagementW(QETProject *project,
|
||||||
|
QWidget *parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
project_(project)
|
project_(project)
|
||||||
{
|
{
|
||||||
@@ -46,17 +50,18 @@ AutoNumberingManagementW::AutoNumberingManagementW(QETProject *project, QWidget
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destructor
|
@brief AutoNumberingManagementW::~AutoNumberingManagementW
|
||||||
*/
|
Destructor
|
||||||
|
*/
|
||||||
AutoNumberingManagementW::~AutoNumberingManagementW()
|
AutoNumberingManagementW::~AutoNumberingManagementW()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @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"));
|
||||||
ui->m_status_cb->addItem(tr("Installing"));
|
ui->m_status_cb->addItem(tr("Installing"));
|
||||||
@@ -64,9 +69,10 @@ 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) {
|
||||||
|
|
||||||
//Under Development
|
//Under Development
|
||||||
@@ -96,9 +102,9 @@ 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()) {
|
||||||
ui->m_selected_folios_widget->setEnabled(true);
|
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
|
@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();
|
||||||
ui->m_selected_folios_le->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("");
|
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,9 +155,10 @@ 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) {
|
||||||
QString from = ui->m_from_folios_cb->currentText();
|
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
|
@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);
|
||||||
ui->m_selected_folios_le->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
|
@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
|
||||||
int answer = ui -> buttonBox -> buttonRole(button);
|
int answer = ui -> buttonBox -> buttonRole(button);
|
||||||
@@ -196,9 +210,10 @@ 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){
|
||||||
bool valid= true;
|
bool valid= true;
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -1466,15 +1466,15 @@ 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)
|
||||||
{
|
{
|
||||||
QDomDocument xml_document = xml_element.ownerDocument();
|
QDomDocument xml_document = xml_element.ownerDocument();
|
||||||
@@ -1549,19 +1549,23 @@ 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)
|
||||||
{
|
{
|
||||||
if (!diagram) {
|
if (!diagram) {
|
||||||
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,10 +34,10 @@
|
|||||||
#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),
|
||||||
ui(new Ui::BOMExportDialog),
|
ui(new Ui::BOMExportDialog),
|
||||||
@@ -112,8 +112,8 @@ BOMExportDialog::BOMExportDialog(QETProject *project, QWidget *parent) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief BOMExportDialog::~BOMExportDialog
|
@brief BOMExportDialog::~BOMExportDialog
|
||||||
*/
|
*/
|
||||||
BOMExportDialog::~BOMExportDialog()
|
BOMExportDialog::~BOMExportDialog()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
@@ -121,10 +121,10 @@ BOMExportDialog::~BOMExportDialog()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief BOMExportDialog::exec
|
@brief BOMExportDialog::exec
|
||||||
* Reimplemented from QDialog
|
Reimplemented from QDialog
|
||||||
* @return
|
@return
|
||||||
*/
|
*/
|
||||||
int BOMExportDialog::exec()
|
int BOMExportDialog::exec()
|
||||||
{
|
{
|
||||||
int r = QDialog::exec();
|
int r = QDialog::exec();
|
||||||
@@ -165,9 +165,9 @@ 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
|
||||||
{
|
{
|
||||||
//Made a string list with the colomns (keys) choosen by the user
|
//Made a string list with the colomns (keys) choosen by the user
|
||||||
@@ -183,10 +183,10 @@ 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
|
||||||
{
|
{
|
||||||
if (QETApp::elementInfoKeys().contains(key)) {
|
if (QETApp::elementInfoKeys().contains(key)) {
|
||||||
@@ -202,9 +202,9 @@ 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()
|
||||||
{
|
{
|
||||||
for(QString key : QETApp::elementInfoKeys())
|
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()
|
void BOMExportDialog::on_m_add_pb_clicked()
|
||||||
{
|
{
|
||||||
if (auto *item = ui->m_var_list->takeItem(ui->m_var_list->currentRow())) {
|
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()
|
void BOMExportDialog::on_m_remove_pb_clicked()
|
||||||
{
|
{
|
||||||
if (auto *item = ui->m_choosen_list->takeItem(ui->m_choosen_list->currentRow())) {
|
if (auto *item = ui->m_choosen_list->takeItem(ui->m_choosen_list->currentRow())) {
|
||||||
@@ -249,10 +249,10 @@ 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()
|
||||||
{
|
{
|
||||||
auto row = ui->m_choosen_list->currentRow();
|
auto row = ui->m_choosen_list->currentRow();
|
||||||
if(row <= 0) {
|
if(row <= 0) {
|
||||||
return;
|
return;
|
||||||
@@ -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()
|
void BOMExportDialog::on_m_down_pb_clicked()
|
||||||
{
|
{
|
||||||
auto row = ui->m_choosen_list->currentRow();
|
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
|
@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()
|
||||||
{
|
{
|
||||||
QString data; //The string to be returned
|
QString data; //The string to be returned
|
||||||
@@ -333,9 +333,9 @@ 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
|
||||||
{
|
{
|
||||||
QString header_string;
|
QString header_string;
|
||||||
@@ -378,9 +378,9 @@ 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()
|
||||||
{
|
{
|
||||||
//Create a sqlite data base to sort the bom
|
//Create a sqlite data base to sort the bom
|
||||||
@@ -438,9 +438,9 @@ bool BOMExportDialog::createDataBase()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief BOMExportDialog::populateDataBase
|
@brief BOMExportDialog::populateDataBase
|
||||||
* Populate the database
|
Populate the database
|
||||||
*/
|
*/
|
||||||
void BOMExportDialog::populateDataBase()
|
void BOMExportDialog::populateDataBase()
|
||||||
{
|
{
|
||||||
for (auto *diagram : m_project->diagrams())
|
for (auto *diagram : m_project->diagrams())
|
||||||
@@ -470,10 +470,10 @@ 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
|
||||||
{
|
{
|
||||||
QHash<QString, QString> keys_hash; //Use to get the element info according to the database columns name
|
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
|
@brief BOMExportDialog::queryStr
|
||||||
* @return the query string
|
@return the query string
|
||||||
*/
|
*/
|
||||||
QString BOMExportDialog::queryStr() const
|
QString BOMExportDialog::queryStr() const
|
||||||
{
|
{
|
||||||
//User define is own query
|
//User define is own query
|
||||||
@@ -587,9 +587,9 @@ 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()
|
||||||
{
|
{
|
||||||
QFile file(QETApp::configDir() + "/bill_of_materials.json");
|
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
|
@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()
|
||||||
{
|
{
|
||||||
ui->m_sql_query->setEnabled(ui->m_edit_sql_query_cb->isChecked());
|
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
|
@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()
|
||||||
{
|
{
|
||||||
QFile file(QETApp::configDir() + "/bill_of_materials.json");
|
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
|
@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()
|
||||||
{
|
{
|
||||||
auto name = ui->m_conf_cb->currentText();
|
auto name = ui->m_conf_cb->currentText();
|
||||||
|
|||||||
Reference in New Issue
Block a user