ZIMA CAD Parts
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
metadata.h
Go to the documentation of this file.
1 /*
2  ZIMA-CAD-Parts
3  http://www.zima-construction.cz/software/ZIMA-Parts
4 
5  Copyright (C) 2011-2012 Jakub Skokan <aither@havefun.cz>
6 
7  This program is free software: you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation, either version 3 of the License, or
10  (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 #ifndef METADATA_H
22 #define METADATA_H
23 
24 #include <QObject>
25 #include <QStringList>
26 #include <QSettings>
27 
28 class Item;
29 
30 class Metadata : public QObject
31 {
32  Q_OBJECT
33 public:
34  explicit Metadata(Item *item, QObject *parent = 0);
35  ~Metadata();
36  void init();
37  QString getLabel();
38  QStringList getColumnLabels();
39  QString getPartParam(QString part, int col);
40  void deletePart(QString part);
41  QList<Item*> includedThumbnailItems();
42 
43 public slots:
44  void refresh();
45  void retranslate(QString lang = QString());
46  void provideInclude(Metadata *m, QString path = QString());
47 
48 private:
49  enum Include {
50  IncludeNothing=0,
51  IncludeMetadata=1,
52  IncludeThumbnails=2
53  };
54 
55  Item *m_item;
56  QList<Metadata*> includes;
57  int m_loadedIncludes;
58  QString metadataFile;
59  QSettings *metadata;
60  QString currentAppLang;
61  QString lang;
62  QStringList columnLabels;
63  QString label;
64  QHash<QString, Include> m_includeHash;
65  QList<Item*> m_thumbItems;
66  bool m_includedData;
67 
68  void openMetadata();
69  void probeMetadata();
70  QString buildIncludePath(QString raw);
71  QStringList buildIncludePaths(QStringList raw);
72  void setIncludeMark(QStringList &list, Include mark);
73 
74 signals:
75  void includeRequired(Item *item, QString path);
76  void includeRequireCancelled(Item *item);
77  void ready(Item *item);
78  void retranslated();
79 };
80 
81 #endif // METADATA_H
void init()
Definition: metadata.cpp:50
void retranslated()
void provideInclude(Metadata *m, QString path=QString())
Definition: metadata.cpp:177
void deletePart(QString part)
Definition: metadata.cpp:136
Definition: item.h:130
QList< Item * > includedThumbnailItems()
Definition: metadata.cpp:146
void includeRequireCancelled(Item *item)
QString getLabel()
Definition: metadata.cpp:56
~Metadata()
Definition: metadata.cpp:42
void includeRequired(Item *item, QString path)
Definition: metadata.h:30
void refresh()
Definition: metadata.cpp:151
void ready(Item *item)
void retranslate(QString lang=QString())
Definition: metadata.cpp:165
QString getPartParam(QString part, int col)
Definition: metadata.cpp:96
QStringList getColumnLabels()
Definition: metadata.cpp:64
Metadata(Item *item, QObject *parent=0)
Definition: metadata.cpp:29