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 TITLEBLOCK_SLASH_TEMPLATE_LOCATION_H
19 #define TITLEBLOCK_SLASH_TEMPLATE_LOCATION_H
20 #include <QtCore>
21 #include <QDomElement>
22 class QETProject;
23 class TitleBlockTemplate;
24 class TitleBlockTemplatesCollection;
25 
26 /**
27 	This class represents the location of a title block template.
28 */
29 class TitleBlockTemplateLocation {
30 	// constructor, destructor
31 	public:
32 	TitleBlockTemplateLocation(const QString & = QString(), TitleBlockTemplatesCollection * = nullptr);
33 	virtual ~TitleBlockTemplateLocation();
34 
35 	// static methods
36 	public:
37 	TitleBlockTemplateLocation locationFromString(const QString &);
38 
39 	// methods
40 	public:
41 	TitleBlockTemplatesCollection *parentCollection() const;
42 	void setParentCollection(TitleBlockTemplatesCollection *);
43 	QString name() const;
44 	void setName(const QString &);
45 	bool isValid() const;
46 	void fromString(const QString &);
47 	QString toString() const;
48 	QETProject *parentProject() const;
49 	QString protocol() const;
50 	QDomElement getTemplateXmlDescription() const;
51 	TitleBlockTemplate *getTemplate() const;
52 	bool isReadOnly() const;
53 	bool operator==(const TitleBlockTemplateLocation &) const;
54 
55 	// attributes
56 	private:
57 	TitleBlockTemplatesCollection *collection_; ///< Collection the template belongs to
58 	QString name_;                              ///< Name of the template
59 
60 	public:
61 	static int MetaTypeId; ///< Id of the corresponding Qt meta type
62 };
63 Q_DECLARE_METATYPE(TitleBlockTemplateLocation)
64 uint qHash(const TitleBlockTemplateLocation &);
65 #endif
66