2007-12-01 10:47:15 +00:00
|
|
|
/*
|
2021-02-20 12:13:46 +01:00
|
|
|
Copyright 2006-2021 The QElectroTech Team
|
2007-12-01 10:47:15 +00:00
|
|
|
This file is part of QElectroTech.
|
|
|
|
|
|
|
|
QElectroTech is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
QElectroTech is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2006-10-27 15:47:22 +00:00
|
|
|
#ifndef PANELAPPAREILS_H
|
2007-04-12 03:13:13 +00:00
|
|
|
#define PANELAPPAREILS_H
|
2016-05-27 12:44:24 +00:00
|
|
|
|
2012-02-06 21:21:43 +00:00
|
|
|
#include "genericpanel.h"
|
2020-12-08 19:57:35 +01:00
|
|
|
#include "titleblock/templatelocation.h"
|
2016-05-27 12:44:24 +00:00
|
|
|
|
2009-04-03 19:30:25 +00:00
|
|
|
class QETProject;
|
|
|
|
class Diagram;
|
2012-01-08 17:04:34 +00:00
|
|
|
class TitleBlockTemplatesFilesCollection;
|
|
|
|
|
2007-04-12 03:13:13 +00:00
|
|
|
/**
|
2012-11-09 21:09:24 +00:00
|
|
|
This class provides a tree widget listing known filesystem-based elements
|
|
|
|
collections and opened project files along with their content (diagrams,
|
|
|
|
embedded collections, ...). It enables users to perform various actions on
|
|
|
|
the displayed content
|
2007-04-12 03:13:13 +00:00
|
|
|
*/
|
2012-02-06 21:21:43 +00:00
|
|
|
class ElementsPanel : public GenericPanel {
|
2007-04-12 03:13:13 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
2012-11-09 21:09:24 +00:00
|
|
|
// constructors, destructor
|
2007-04-12 03:13:13 +00:00
|
|
|
public:
|
2017-08-05 02:06:59 +00:00
|
|
|
ElementsPanel(QWidget * = nullptr);
|
2017-08-05 02:10:01 +00:00
|
|
|
~ElementsPanel() override;
|
2007-04-12 03:13:13 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
ElementsPanel(const ElementsPanel &);
|
|
|
|
|
2012-02-06 21:21:43 +00:00
|
|
|
// methods
|
2007-08-28 21:17:11 +00:00
|
|
|
public:
|
2012-11-09 21:09:24 +00:00
|
|
|
// methods used to determine what is represented by a particular visual item
|
2009-04-03 19:30:25 +00:00
|
|
|
|
2012-11-09 21:09:24 +00:00
|
|
|
// methods used to get what is represented by a particular visual item
|
2013-02-03 19:22:58 +00:00
|
|
|
QString dirPathForItem(QTreeWidgetItem *);
|
|
|
|
QString filePathForItem(QTreeWidgetItem *);
|
2009-04-03 19:30:25 +00:00
|
|
|
|
|
|
|
signals:
|
|
|
|
void requestForProject(QETProject *);
|
2012-01-08 17:04:34 +00:00
|
|
|
void requestForTitleBlockTemplate(const TitleBlockTemplateLocation &);
|
2007-04-12 03:13:13 +00:00
|
|
|
|
|
|
|
public slots:
|
2007-06-30 17:41:07 +00:00
|
|
|
void slot_doubleClick(QTreeWidgetItem *, int);
|
2020-09-04 23:00:32 +02:00
|
|
|
void reload();
|
2012-02-06 21:21:43 +00:00
|
|
|
void filter(const QString &, QET::Filtering = QET::RegularFilter);
|
2009-04-03 19:30:25 +00:00
|
|
|
void projectWasOpened(QETProject *);
|
|
|
|
void projectWasClosed(QETProject *);
|
2014-10-16 20:35:32 +00:00
|
|
|
void buildFilterList();
|
2012-02-12 15:33:04 +00:00
|
|
|
void applyCurrentFilter(const QList<QTreeWidgetItem *> &);
|
|
|
|
void ensureHierarchyIsVisible(const QList<QTreeWidgetItem *> &);
|
2009-04-03 19:30:25 +00:00
|
|
|
|
|
|
|
protected:
|
2017-08-05 02:10:01 +00:00
|
|
|
void startDrag(Qt::DropActions) override;
|
2012-01-22 10:40:37 +00:00
|
|
|
void startTitleBlockTemplateDrag(const TitleBlockTemplateLocation &);
|
2018-07-19 14:14:31 +00:00
|
|
|
bool matchesFilter(const QTreeWidgetItem *, const QString&) const;
|
2012-02-06 21:21:43 +00:00
|
|
|
|
|
|
|
protected slots:
|
2012-02-12 15:33:04 +00:00
|
|
|
void panelContentChange();
|
2009-04-03 19:30:25 +00:00
|
|
|
|
|
|
|
private:
|
2018-04-05 18:49:28 +00:00
|
|
|
QTreeWidgetItem *addProject (QETProject *, QTreeWidgetItem * = nullptr, PanelOptions = AddAllChild) override;
|
|
|
|
QTreeWidgetItem *updateTemplatesCollectionItem(QTreeWidgetItem *, TitleBlockTemplatesCollection *, PanelOptions = AddAllChild, bool = false) override;
|
|
|
|
QTreeWidgetItem *updateTemplateItem (QTreeWidgetItem *, const TitleBlockTemplateLocation &, PanelOptions, bool = false) override;
|
2012-02-06 21:21:43 +00:00
|
|
|
|
|
|
|
// attributes
|
2009-04-03 19:30:25 +00:00
|
|
|
private:
|
2012-02-06 21:21:43 +00:00
|
|
|
QSet<QETProject *> projects_to_display_; ///< list of projects that have been added to this panel
|
|
|
|
QTreeWidgetItem *common_tbt_collection_item_; ///< pointer to the item representing the common templates collection
|
|
|
|
QTreeWidgetItem *custom_tbt_collection_item_; ///< pointer to the item representing the user templates collection
|
|
|
|
bool first_reload_; ///< used to distinguish the first time this panel is reloaded
|
2012-02-12 15:33:04 +00:00
|
|
|
QString filter_; ///< Currently applied filter
|
2014-10-16 20:35:32 +00:00
|
|
|
QStringList filter_list_; ///< Currently applied list of filter
|
2007-04-12 03:13:13 +00:00
|
|
|
};
|
2006-10-27 15:47:22 +00:00
|
|
|
#endif
|