QElectroTech  0.70
elementslocation.h
Go to the documentation of this file.
1 /*
2  Copyright 2006-2019 The QElectroTech Team
3  This file is part of QElectroTech.
4 
5  QElectroTech is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 2 of the License, or
8  (at your option) any later version.
9 
10  QElectroTech is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef ELEMENTS_LOCATION_H
19 #define ELEMENTS_LOCATION_H
20 
21 #include "nameslist.h"
22 #include "diagramcontext.h"
23 #include <QString>
24 #include <QIcon>
25 
26 class QETProject;
28 
35 {
36  public:
38  ElementsLocation(const QString &path, QETProject *project = nullptr);
40  ElementsLocation(const QMimeData *data);
41  virtual ~ElementsLocation();
43  bool operator==(const ElementsLocation &) const;
44  bool operator!=(const ElementsLocation &) const;
45 
46  public:
47  QString baseName() const;
48  int projectId() const;
49 
50  QString collectionPath(bool protocol = true) const;
51  QString projectCollectionPath() const;
52  QString fileSystemPath() const;
53  QString path() const;
54  void setPath(const QString &path);
55  bool addToPath(const QString &);
56 
57  ElementsLocation parent() const;
58  QETProject *project() const;
59  void setProject(QETProject *);
60  bool isNull() const;
61  QString toString() const;
62 
63  bool isElement() const;
64  bool isDirectory() const;
65  bool isFileSystem() const;
66  bool isCommonCollection() const;
67  bool isCustomCollection() const;
68  bool isProject() const;
69  bool exist() const;
70  bool isWritable() const;
71 
74 
75  QDomElement xml() const;
76  bool setXml(const QDomDocument &xml_document) const;
77  QUuid uuid() const;
78  QIcon icon() const;
79  QString name() const;
80  QString fileName() const;
82 
83  private:
86  QETProject *m_project = nullptr;
87 
88  public:
89  static int MetaTypeId;
90 };
91 
92 QDebug operator<<(QDebug debug, const ElementsLocation &location);
93 
95 uint qHash(const ElementsLocation &);
96 #endif
QString projectCollectionPath() const
ElementsLocation::projectCollectionPath.
int projectId() const
ElementsLocation::projectId This method is used to know if an element belongs to a project or not...
QString baseName() const
ElementsLocation::baseName.
bool isProject() const
ElementsLocation::isProject.
NamesList nameList()
ElementsLocation::nameList.
void setProject(QETProject *)
QString toString() const
bool isFileSystem() const
ElementsLocation::isFileSystem.
QString fileName() const
ElementLocation::fileName.
QIcon icon() const
ElementLocation::icon.
static int MetaTypeId
Id of the corresponding Qt meta type.
ElementsLocation & operator=(const ElementsLocation &)
bool addToPath(const QString &)
ElementsLocation::addToPath Add a string to the actual path of this location.
DiagramContext elementInformations() const
ElementsLocation::elementInformations.
QString m_file_system_path
QUuid uuid() const
ElementsLocation::uuid.
XmlElementCollection * projectCollection() const
ElementsLocation::projectCollection.
bool setXml(const QDomDocument &xml_document) const
ElementsLocation::setXml Replace the current xml description by ; The document element of must have ...
void setPath(const QString &path)
ElementsLocation::setPath Set the path of this item. The path can be relative to a collection (start ...
bool operator!=(const ElementsLocation &) const
bool operator==(const ElementsLocation &) const
QETProject * project() const
QString collectionPath(bool protocol=true) const
QDomElement xml() const
ElementsLocation::xml.
QString name() const
ElementLocation::name.
ElementsLocation()
ElementsLocation::ElementsLocation Constructor.
bool exist() const
ElementsLocation::exist.
QString fileSystemPath() const
ElementsLocation::fileSystemPath.
QDebug operator<<(QDebug debug, const ElementsLocation &location)
bool isDirectory() const
ElementsLocation::isDirectory.
uint qHash(const ElementsLocation &)
virtual ~ElementsLocation()
QETProject * m_project
bool isElement() const
ElementsLocation::isElement.
Q_DECLARE_METATYPE(NamesList)
bool isCommonCollection() const
ElementsLocation::isCommonCollection.
bool isCustomCollection() const
ElementsLocation::isCustomCollection.
QString path() const
ElementsLocation::path.
bool isWritable() const
ElementsLocation::isWritable.
ElementsLocation parent() const
The XmlElementCollection class This class represent a collection of elements stored to xml...