src/lddocument.h

changeset 1288
d1e45f90654b
parent 1287
f1da43b7f5c6
child 1291
9c570a30c98a
equal deleted inserted replaced
1287:f1da43b7f5c6 1288:d1e45f90654b
28 struct LDGLData; 28 struct LDGLData;
29 class DocumentManager; 29 class DocumentManager;
30 30
31 struct LDHeader 31 struct LDHeader
32 { 32 {
33 struct HistoryEntry
34 {
35 QDate date;
36 QString author;
37 QString description;
38 enum { UserName, RealName } authorType = UserName;
39 };
33 enum FileType 40 enum FileType
34 { 41 {
35 Part, 42 Part,
36 Subpart, 43 Subpart,
37 Shortcut, 44 Shortcut,
46 Physical_Color = 1 << 1, 53 Physical_Color = 1 << 1,
47 Flexible_Section = 1 << 2, 54 Flexible_Section = 1 << 2,
48 }; 55 };
49 QFlags<Qualifier> qualfiers; 56 QFlags<Qualifier> qualfiers;
50 QString description; 57 QString description;
51 QString filename; 58 QString name;
52 struct 59 struct
53 { 60 {
54 QString realName; 61 QString realName;
55 QString userName; 62 QString userName;
56 } author; 63 } author;
57 QString category; 64 QString category;
58 QString cmdline; 65 QString cmdline;
59 QStringList help; 66 QStringList help;
60 QStringList keywords; 67 QStringList keywords;
68 QVector<HistoryEntry> history;
61 enum 69 enum
62 { 70 {
63 NoWinding, 71 NoWinding,
64 CounterClockwise, 72 CounterClockwise,
65 Clockwise, 73 Clockwise,
68 { 76 {
69 CaLicense, 77 CaLicense,
70 NonCaLicense 78 NonCaLicense
71 } license = CaLicense; 79 } license = CaLicense;
72 }; 80 };
81
82 Q_DECLARE_OPERATORS_FOR_FLAGS(QFlags<LDHeader::Qualifier>)
83
84 decltype(LDHeader::winding) operator^(
85 decltype(LDHeader::winding) one,
86 decltype(LDHeader::winding) other
87 );
73 88
74 // 89 //
75 // This class stores a document either as a editable file for the user or for 90 // This class stores a document either as a editable file for the user or for
76 // subfile caching. 91 // subfile caching.
77 // 92 //
112 bool save (QString path = "", qint64* sizeptr = nullptr); 127 bool save (QString path = "", qint64* sizeptr = nullptr);
113 long savePosition() const; 128 long savePosition() const;
114 void setDefaultName (QString value); 129 void setDefaultName (QString value);
115 void setFrozen(bool value); 130 void setFrozen(bool value);
116 void setFullPath (QString value); 131 void setFullPath (QString value);
132 void setHeader(LDHeader&& header);
117 void setName (QString value); 133 void setName (QString value);
118 void setSavePosition (long value); 134 void setSavePosition (long value);
119 void setTabIndex (int value); 135 void setTabIndex (int value);
120 int tabIndex() const; 136 int tabIndex() const;
121 void undo(); 137 void undo();
154 void objectChanged(const LDObjectState &before, const LDObjectState &after); 170 void objectChanged(const LDObjectState &before, const LDObjectState &after);
155 void handleNewObject(const QModelIndex& index); 171 void handleNewObject(const QModelIndex& index);
156 void handleImminentObjectRemoval(const QModelIndex& index); 172 void handleImminentObjectRemoval(const QModelIndex& index);
157 }; 173 };
158 174
159 Q_DECLARE_OPERATORS_FOR_FLAGS(QFlags<LDHeader::Qualifier>)
160
161 // Parses a string line containing an LDraw object and returns the object parsed. 175 // Parses a string line containing an LDraw object and returns the object parsed.
162 LDObject* ParseLine (QString line); 176 LDObject* ParseLine (QString line);

mercurial