mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 12:40:35 +01:00
Rapatriement de la branche 0.2 dans le trunk
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@558 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2008 Xavier Guerrin
|
||||
Copyright 2006-2009 Xavier Guerrin
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -18,7 +18,13 @@
|
||||
#ifndef PANELAPPAREILS_H
|
||||
#define PANELAPPAREILS_H
|
||||
#include <QtGui>
|
||||
#include "qetdiagrameditor.h"
|
||||
#include "elementslocation.h"
|
||||
class QETProject;
|
||||
class Diagram;
|
||||
class ElementsCollection;
|
||||
class ElementsCollectionItem;
|
||||
class ElementsCategory;
|
||||
class ElementDefinition;
|
||||
/**
|
||||
Cette classe represente le panel d'appareils (en tant qu'element
|
||||
graphique) dans lequel l'utilisateur choisit les composants de
|
||||
@@ -37,30 +43,83 @@ class ElementsPanel : public QTreeWidget {
|
||||
|
||||
// methodes
|
||||
public:
|
||||
bool selectedItemIsAnElement() const;
|
||||
bool selectedItemIsACategory() const;
|
||||
// methodes pour determiner ce que represente un item donne
|
||||
bool itemIsACollection(QTreeWidgetItem *) const;
|
||||
bool itemIsACategory(QTreeWidgetItem *) const;
|
||||
bool itemIsAnElement(QTreeWidgetItem *) const;
|
||||
bool itemIsAProject(QTreeWidgetItem *) const;
|
||||
bool itemIsADiagram(QTreeWidgetItem *) const;
|
||||
bool itemHasLocation(QTreeWidgetItem *) const;
|
||||
bool itemIsWritable(QTreeWidgetItem *) const;
|
||||
|
||||
private:
|
||||
void addFile(QTreeWidgetItem *, QString);
|
||||
void addDir(QTreeWidgetItem *, QString, QString = QString());
|
||||
QFileInfo selectedFile() const;
|
||||
void launchElementEditor(const QString &);
|
||||
void launchCategoryEditor(const QString &);
|
||||
void saveExpandedCategories();
|
||||
QTreeWidgetItem *findFile(const QString &) const;
|
||||
QStringList expanded_directories;
|
||||
QString last_selected_item;
|
||||
// methodes pour obtenir ce que represente un item donne
|
||||
ElementsCollectionItem *collectionItemForItem(QTreeWidgetItem *) const;
|
||||
QETProject *projectForItem(QTreeWidgetItem *) const;
|
||||
Diagram *diagramForItem(QTreeWidgetItem *) const;
|
||||
ElementsLocation locationForItem(QTreeWidgetItem *) const;
|
||||
ElementsCategory *categoryForItem(QTreeWidgetItem *);
|
||||
ElementsCategory *categoryForPos(const QPoint &);
|
||||
|
||||
// methodes pour determiner ce que represente l'item selectionne
|
||||
bool selectedItemIsACollection() const;
|
||||
bool selectedItemIsACategory() const;
|
||||
bool selectedItemIsAnElement() const;
|
||||
bool selectedItemIsAProject() const;
|
||||
bool selectedItemIsADiagram() const;
|
||||
bool selectedItemHasLocation() const;
|
||||
bool selectedItemIsWritable() const;
|
||||
|
||||
// methodes pour obtenir ce que represente l'item selectionne
|
||||
ElementsCollectionItem *selectedItem() const;
|
||||
QETProject *selectedProject() const;
|
||||
Diagram *selectedDiagram() const;
|
||||
ElementsLocation selectedLocation() const;
|
||||
|
||||
signals:
|
||||
void requestForProject(QETProject *);
|
||||
void requestForDiagram(Diagram *);
|
||||
void requestForCollectionItem(ElementsCollectionItem *);
|
||||
void requestForMoveElements(ElementsCollectionItem *, ElementsCollectionItem *, QPoint);
|
||||
|
||||
public slots:
|
||||
void slot_doubleClick(QTreeWidgetItem *, int);
|
||||
void reload(bool = true);
|
||||
void filter(const QString &);
|
||||
void projectWasOpened(QETProject *);
|
||||
void projectWasClosed(QETProject *);
|
||||
void projectInformationsChanged(QETProject *);
|
||||
void diagramWasAdded(QETProject *, Diagram *);
|
||||
void diagramWasRemoved(QETProject *, Diagram *);
|
||||
void diagramTitleChanged(QETProject *, Diagram *);
|
||||
void diagramOrderChanged(QETProject *, int, int);
|
||||
|
||||
protected:
|
||||
void dragEnterEvent(QDragEnterEvent *);
|
||||
void dragMoveEvent(QDragMoveEvent *);
|
||||
void dropEvent(QDropEvent *);
|
||||
void startDrag(Qt::DropActions);
|
||||
void reload();
|
||||
void editCategory();
|
||||
void editElement();
|
||||
void deleteCategory();
|
||||
void deleteElement();
|
||||
void filter(const QString &);
|
||||
|
||||
private:
|
||||
QTreeWidgetItem *addProject (QTreeWidgetItem *, QETProject *);
|
||||
QTreeWidgetItem *addDiagram (QTreeWidgetItem *, Diagram *);
|
||||
QTreeWidgetItem *addCollection(QTreeWidgetItem *, ElementsCollection *, const QString & = QString(), const QIcon & = QIcon());
|
||||
QTreeWidgetItem *addCategory (QTreeWidgetItem *, ElementsCategory *, const QString & = QString(), const QIcon & = QIcon());
|
||||
QTreeWidgetItem *addElement (QTreeWidgetItem *, ElementDefinition *, const QString & = QString());
|
||||
void saveExpandedCategories();
|
||||
QTreeWidgetItem *findPath(const QString &) const;
|
||||
void deleteItem(QTreeWidgetItem *);
|
||||
void updateProjectItemInformations(QETProject *);
|
||||
QString diagramTitleToDisplay(Diagram *) const;
|
||||
|
||||
// attributs
|
||||
private:
|
||||
QStringList expanded_directories;
|
||||
QString last_selected_item;
|
||||
QHash<QTreeWidgetItem *, ElementsLocation> locations_;
|
||||
QSet<QETProject *> projects_to_display_;
|
||||
QHash<QTreeWidgetItem *, QETProject *> projects_;
|
||||
QHash<QTreeWidgetItem *, Diagram *> diagrams_;
|
||||
QTreeWidgetItem *common_collection_item_;
|
||||
QTreeWidgetItem *custom_collection_item_;
|
||||
};
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user