Remove elementLocation and use elementsLocation instead

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4377 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2016-03-15 15:23:11 +00:00
parent 764d50c4ac
commit 1170522d9c
28 changed files with 626 additions and 924 deletions

View File

@@ -17,46 +17,74 @@
*/
#ifndef ELEMENTS_LOCATION_H
#define ELEMENTS_LOCATION_H
#include <QtCore>
#include "nameslist.h"
#include <QString>
#include <QIcon>
class QETProject;
class XmlElementCollection;
/**
Cette classe represente la localisation, l'emplacement d'un element ou
d'une categorie, voire d'une collection... dans une collection. Elle
encapsule un chemin virtuel.
*/
class ElementsLocation {
// constructors, destructor et operateur d'affectation
class ElementsLocation
{
public:
ElementsLocation();
explicit ElementsLocation(const QString &, QETProject * = 0);
ElementsLocation(const ElementsLocation &);
virtual ~ElementsLocation();
ElementsLocation &operator=(const ElementsLocation &);
bool operator==(const ElementsLocation &) const;
bool operator!=(const ElementsLocation &) const;
ElementsLocation();
ElementsLocation(const QString &path, QETProject *project = nullptr);
ElementsLocation(const ElementsLocation &);
ElementsLocation(const QMimeData *data);
virtual ~ElementsLocation();
ElementsLocation &operator=(const ElementsLocation &);
bool operator==(const ElementsLocation &) const;
bool operator!=(const ElementsLocation &) const;
// methods
public:
QString baseName() const;
QString path() const;
void setPath(const QString &);
bool addToPath(const QString &);
ElementsLocation parent() const;
QETProject *project() const;
void setProject(QETProject *);
bool isNull() const;
QString toString() const;
void fromString(const QString &);
static ElementsLocation locationFromString(const QString &);
QString baseName() const;
QString collectionPath(bool protocol = true) const;
QString projectCollectionPath() const;
QString fileSystemPath() const;
QString path() const;
bool setPath(const QString &path);
bool addToPath(const QString &);
ElementsLocation parent() const;
QETProject *project() const;
void setProject(QETProject *);
bool isNull() const;
QString toString() const;
void fromString(const QString &);
static ElementsLocation locationFromString(const QString &);
bool isElement() const;
bool isDirectory() const;
bool isFileSystem() const;
bool isProject() const;
bool exist() const;
XmlElementCollection *projectCollection() const;
NamesList nameList();
QDomElement xml();
QUuid uuid();
QIcon icon();
QString name();
QString fileName() const;
// attributes
private:
QString path_;
QETProject *project_;
QString m_collection_path;
QString m_file_system_path;
QETProject *m_project = nullptr;
QDomElement m_xml;
QUuid m_uuid;
QIcon m_icon;
public:
static int MetaTypeId; ///< Id of the corresponding Qt meta type
static int MetaTypeId; ///< Id of the corresponding Qt meta type
};
Q_DECLARE_METATYPE(ElementsLocation)
uint qHash(const ElementsLocation &);