Skip to content

Commit

Permalink
Merge pull request #289 from plc-user/master
Browse files Browse the repository at this point in the history
correct more indentations / whitespace
  • Loading branch information
scorpio810 authored Apr 24, 2024
2 parents 171f2ea + f33ea64 commit 206a48a
Show file tree
Hide file tree
Showing 63 changed files with 1,104 additions and 1,104 deletions.
78 changes: 39 additions & 39 deletions sources/ElementsCollection/elementscollectionmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@ QStringList ElementsCollectionModel::mimeTypes() const
@return
*/
bool ElementsCollectionModel::canDropMimeData(const QMimeData *data,
Qt::DropAction action,
int row,
int column,
const QModelIndex &parent) const
Qt::DropAction action,
int row,
int column,
const QModelIndex &parent) const
{
if (!(QStandardItemModel::canDropMimeData(data,
action,
Expand Down Expand Up @@ -258,9 +258,9 @@ bool ElementsCollectionModel::dropMimeData(const QMimeData *data,
@param projects : list of projects to load
*/
void ElementsCollectionModel::loadCollections(bool common_collection,
bool company_collection,
bool custom_collection,
QList<QETProject *> projects)
bool company_collection,
bool custom_collection,
QList<QETProject *> projects)
{
m_items_list_to_setUp.clear();

Expand Down Expand Up @@ -313,8 +313,8 @@ void ElementsCollectionModel::addCommonCollection(bool set_data)
{
FileElementCollectionItem *feci = new FileElementCollectionItem();
if (feci->setRootPath(QETApp::commonElementsDirN(),
set_data,
m_hide_element)) {
set_data,
m_hide_element)) {
invisibleRootItem()->appendRow(feci);
if (set_data)
feci->setUpData();
Expand All @@ -324,41 +324,41 @@ void ElementsCollectionModel::addCommonCollection(bool set_data)
}

/**
@brief ElementsCollectionModel::addCompanyCollection
Add the company elements collection to this model
@param set_data
@brief ElementsCollectionModel::addCompanyCollection
Add the company elements collection to this model
@param set_data
*/
void ElementsCollectionModel::addCompanyCollection(bool set_data)
{
FileElementCollectionItem *feci = new FileElementCollectionItem();
if (feci->setRootPath(QETApp::companyElementsDirN(),
set_data,
m_hide_element)) {
invisibleRootItem()->appendRow(feci);
if (set_data)
feci->setUpData();
}
else
delete feci;
FileElementCollectionItem *feci = new FileElementCollectionItem();
if (feci->setRootPath(QETApp::companyElementsDirN(),
set_data,
m_hide_element)) {
invisibleRootItem()->appendRow(feci);
if (set_data)
feci->setUpData();
}
else
delete feci;
}

/**
@brief ElementsCollectionModel::addCustomCollection
Add the custom elements collection to this model
@param set_data
@brief ElementsCollectionModel::addCustomCollection
Add the custom elements collection to this model
@param set_data
*/
void ElementsCollectionModel::addCustomCollection(bool set_data)
{
FileElementCollectionItem *feci = new FileElementCollectionItem();
if (feci->setRootPath(QETApp::customElementsDirN(),
set_data,
m_hide_element)) {
invisibleRootItem()->appendRow(feci);
if (set_data)
feci->setUpData();
}
else
delete feci;
FileElementCollectionItem *feci = new FileElementCollectionItem();
if (feci->setRootPath(QETApp::customElementsDirN(),
set_data,
m_hide_element)) {
invisibleRootItem()->appendRow(feci);
if (set_data)
feci->setUpData();
}
else
delete feci;
}

/**
Expand Down Expand Up @@ -579,9 +579,9 @@ QModelIndex ElementsCollectionModel::indexFromLocation(
{
QList <ElementCollectionItem *> child_list;

for (int i=0 ; i<rowCount() ; i++){
for (int i=0 ; i<rowCount() ; i++){
child_list.append(static_cast<ElementCollectionItem *>(item(i)));
}
}

foreach(ElementCollectionItem *eci, child_list) {

Expand All @@ -590,8 +590,8 @@ QModelIndex ElementsCollectionModel::indexFromLocation(
if (eci->type() == FileElementCollectionItem::Type) {
if (FileElementCollectionItem *feci = static_cast<FileElementCollectionItem *>(eci)) {
if ( (location.isCommonCollection() && feci->isCommonCollection()) ||
(location.isCompanyCollection() && feci->isCompanyCollection()) ||
(location.isCustomCollection() && !feci->isCommonCollection()) ) {
(location.isCompanyCollection() && feci->isCompanyCollection()) ||
(location.isCustomCollection() && !feci->isCommonCollection()) ) {
match_eci = feci->itemAtPath(location.collectionPath(false));
}
}
Expand Down
8 changes: 4 additions & 4 deletions sources/ElementsCollection/elementscollectionmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ class ElementsCollectionModel : public QStandardItemModel
bool canDropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const override;
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override;

void loadCollections(bool common_collection, bool company_collection, bool custom_collection, QList<QETProject *> projects);
void loadCollections(bool common_collection, bool company_collection, bool custom_collection, QList<QETProject *> projects);

void addCommonCollection(bool set_data = true);
void addCompanyCollection(bool set_data = true);
void addCustomCollection(bool set_data = true);
void addCommonCollection(bool set_data = true);
void addCompanyCollection(bool set_data = true);
void addCustomCollection(bool set_data = true);
void addLocation(const ElementsLocation& location);

void addProject(QETProject *project, bool set_data = true);
Expand Down
60 changes: 30 additions & 30 deletions sources/ElementsCollection/elementscollectionwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void ElementsCollectionWidget::addProject(QETProject *project)
m_progress_bar->show();
m_tree_view->setDisabled(true);
QList <QETProject *> prj; prj.append(project);
m_model->loadCollections(false, false, false, prj);
m_model->loadCollections(false, false, false, prj);
}
else {
m_waiting_project.append(project);
Expand Down Expand Up @@ -148,26 +148,26 @@ void ElementsCollectionWidget::setUpAction()
m_open_dir = new QAction(QET::Icons::FolderOpen,
tr("Ouvrir le dossier correspondant"), this);
m_edit_element = new QAction(QET::Icons::ElementEdit,
tr("Éditer l'élément"), this);
tr("Éditer l'élément"), this);
m_delete_element = new QAction(QET::Icons::ElementDelete,
tr("Supprimer l'élément"), this);
tr("Supprimer l'élément"), this);
m_delete_dir = new QAction(QET::Icons::FolderDelete,
tr("Supprimer le dossier"), this);
m_reload = new QAction(QET::Icons::ViewRefresh,
tr("Recharger les collections"), this);
tr("Recharger les collections"), this);
m_edit_dir = new QAction(QET::Icons::FolderEdit,
tr("Éditer le dossier"), this);
m_new_directory = new QAction(QET::Icons::FolderNew,
tr("Nouveau dossier"), this);
tr("Nouveau dossier"), this);
m_new_element = new QAction(QET::Icons::ElementNew,
tr("Nouvel élément"), this);
tr("Nouvel élément"), this);
m_show_this_dir = new QAction(QET::Icons::FolderOnlyThis,
tr("Afficher uniquement ce dossier"),
this);
tr("Afficher uniquement ce dossier"),
this);
m_show_all_dir = new QAction(QET::Icons::FolderShowAll,
tr("Afficher tous les dossiers"), this);
tr("Afficher tous les dossiers"), this);
m_dir_propertie = new QAction(QET::Icons::FolderProperties,
tr("Propriété du dossier"), this);
tr("Propriété du dossier"), this);
}

/**
Expand Down Expand Up @@ -385,10 +385,10 @@ void ElementsCollectionWidget::deleteElement()

ElementsLocation loc(eci->collectionPath());
if (! (loc.isElement()
&& loc.exist()
&& loc.isFileSystem()
&& (loc.collectionPath().startsWith("company://")
|| loc.collectionPath().startsWith("custom://"))) ) return;
&& loc.exist()
&& loc.isFileSystem()
&& (loc.collectionPath().startsWith("company://")
|| loc.collectionPath().startsWith("custom://"))) ) return;

if (QET::QetMessageBox::question(
this,
Expand All @@ -401,8 +401,8 @@ void ElementsCollectionWidget::deleteElement()
if (file.remove())
{
m_model->removeRows(m_index_at_context_menu.row(),
1,
m_index_at_context_menu.parent());
1,
m_index_at_context_menu.parent());
}
else
{
Expand All @@ -429,10 +429,10 @@ void ElementsCollectionWidget::deleteDirectory()

ElementsLocation loc (eci->collectionPath());
if (! (loc.isDirectory()
&& loc.exist()
&& loc.isFileSystem()
&& (loc.collectionPath().startsWith("company://")
|| loc.collectionPath().startsWith("custom://"))) ) return;
&& loc.exist()
&& loc.isFileSystem()
&& (loc.collectionPath().startsWith("company://")
|| loc.collectionPath().startsWith("custom://"))) ) return;

if (QET::QetMessageBox::question(
this,
Expand All @@ -446,8 +446,8 @@ void ElementsCollectionWidget::deleteDirectory()
if (dir.removeRecursively())
{
m_model->removeRows(m_index_at_context_menu.row(),
1,
m_index_at_context_menu.parent());
1,
m_index_at_context_menu.parent());
}
else
{
Expand Down Expand Up @@ -666,7 +666,7 @@ void ElementsCollectionWidget::reload()
this,
&ElementsCollectionWidget::loadingFinished);

m_new_model->loadCollections(true, true, true, project_list);
m_new_model->loadCollections(true, true, true, project_list);
}

/**
Expand Down Expand Up @@ -781,13 +781,13 @@ void ElementsCollectionWidget::search()
QModelIndexList match_index;
for (QString txt : text_list) {
match_index << m_model->match(m_showed_index.isValid()
? m_model->index(0,0,m_showed_index)
: m_model->index(0,0),
Qt::UserRole+1,
QVariant(txt),
-1,
Qt::MatchContains
| Qt::MatchRecursive);
? m_model->index(0,0,m_showed_index)
: m_model->index(0,0),
Qt::UserRole+1,
QVariant(txt),
-1,
Qt::MatchContains
| Qt::MatchRecursive);
}

for(QModelIndex index : match_index)
Expand Down
90 changes: 45 additions & 45 deletions sources/ElementsCollection/elementslocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,17 +293,17 @@ void ElementsLocation::setPath(const QString &path)
else if (path.startsWith("common://") || path.startsWith("company://") || path.startsWith("custom://"))
{
QString p;
if (path.startsWith("common://"))
{
tmp_path.remove("common://");
p = QETApp::commonElementsDirN() + "/" + tmp_path;
}
else if (path.startsWith("company://"))
{
tmp_path.remove("company://");
p = QETApp::companyElementsDirN() + "/" + tmp_path;
}
else
if (path.startsWith("common://"))
{
tmp_path.remove("common://");
p = QETApp::commonElementsDirN() + "/" + tmp_path;
}
else if (path.startsWith("company://"))
{
tmp_path.remove("company://");
p = QETApp::companyElementsDirN() + "/" + tmp_path;
}
else
{
tmp_path.remove("custom://");
p = QETApp::customElementsDirN() + "/" + tmp_path;
Expand All @@ -319,19 +319,19 @@ void ElementsLocation::setPath(const QString &path)
if(path_.endsWith(".elmt"))
{
m_file_system_path = path_;
if (path_.startsWith(QETApp::commonElementsDirN()))
{
path_.remove(QETApp::commonElementsDirN()+="/");
path_.prepend("common://");
m_collection_path = path_;
}
else if (path_.startsWith(QETApp::companyElementsDirN()))
{
path_.remove(QETApp::companyElementsDirN()+="/");
path_.prepend("company://");
m_collection_path = path_;
}
else if (path_.startsWith(QETApp::customElementsDirN()))
if (path_.startsWith(QETApp::commonElementsDirN()))
{
path_.remove(QETApp::commonElementsDirN()+="/");
path_.prepend("common://");
m_collection_path = path_;
}
else if (path_.startsWith(QETApp::companyElementsDirN()))
{
path_.remove(QETApp::companyElementsDirN()+="/");
path_.prepend("company://");
m_collection_path = path_;
}
else if (path_.startsWith(QETApp::customElementsDirN()))
{
path_.remove(QETApp::customElementsDirN()+="/");
path_.prepend("custom://");
Expand All @@ -341,19 +341,19 @@ void ElementsLocation::setPath(const QString &path)
else
{
m_file_system_path = path_;
if (path_.startsWith(QETApp::commonElementsDirN()))
{
path_.remove(QETApp::commonElementsDirN()+="/");
path_.prepend("common://");
m_collection_path = path_;
}
else if (path_.startsWith(QETApp::companyElementsDirN()))
{
path_.remove(QETApp::companyElementsDirN()+="/");
path_.prepend("company://");
m_collection_path = path_;
}
else if (path_.startsWith(QETApp::customElementsDirN()))
if (path_.startsWith(QETApp::commonElementsDirN()))
{
path_.remove(QETApp::commonElementsDirN()+="/");
path_.prepend("common://");
m_collection_path = path_;
}
else if (path_.startsWith(QETApp::companyElementsDirN()))
{
path_.remove(QETApp::companyElementsDirN()+="/");
path_.prepend("company://");
m_collection_path = path_;
}
else if (path_.startsWith(QETApp::customElementsDirN()))
{
path_.remove(QETApp::customElementsDirN()+="/");
path_.prepend("custom://");
Expand Down Expand Up @@ -501,23 +501,23 @@ bool ElementsLocation::isFileSystem() const
}

/**
@brief ElementsLocation::isCommonCollection
@return
True if this location represent an item from the common collection
@brief ElementsLocation::isCommonCollection
@return
True if this location represent an item from the common collection
*/
bool ElementsLocation::isCommonCollection() const
{
return fileSystemPath().startsWith(QETApp::commonElementsDirN());
return fileSystemPath().startsWith(QETApp::commonElementsDirN());
}

/**
@brief ElementsLocation::isCompanyCollection
@return
True if this location represent an item from the company collection
@brief ElementsLocation::isCompanyCollection
@return
True if this location represent an item from the company collection
*/
bool ElementsLocation::isCompanyCollection() const
{
return fileSystemPath().startsWith(QETApp::companyElementsDirN());
return fileSystemPath().startsWith(QETApp::companyElementsDirN());
}

/**
Expand Down
Loading

0 comments on commit 206a48a

Please sign in to comment.