src/linetypes/errorline.cpp

Sat, 05 Mar 2022 13:18:40 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Sat, 05 Mar 2022 13:18:40 +0200
changeset 161
6fe485a84d06
parent 158
5bd755eaa5a8
child 177
f69d53c053df
permissions
-rw-r--r--

Icons update

6
73e448b2943d language support
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
1 #include <QBrush>
3
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
2 #include "errorline.h"
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
3
35
98906a94732f renamed the linetypes namespace to ldraw namespace and added more structures to it
Teemu Piippo <teemu@hecknology.net>
parents: 14
diff changeset
4 ldraw::ErrorLine::ErrorLine(QStringView text, QStringView message) :
8
44679e468ba9 major update with many things
Teemu Piippo <teemu@hecknology.net>
parents: 6
diff changeset
5 text{text.toString()},
44679e468ba9 major update with many things
Teemu Piippo <teemu@hecknology.net>
parents: 6
diff changeset
6 message{message.toString()}
3
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
7 {
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
8 }
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
9
35
98906a94732f renamed the linetypes namespace to ldraw namespace and added more structures to it
Teemu Piippo <teemu@hecknology.net>
parents: 14
diff changeset
10 QVariant ldraw::ErrorLine::getProperty(Property property) const
3
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
11 {
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
12 switch (property)
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
13 {
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
14 case Property::Text:
8
44679e468ba9 major update with many things
Teemu Piippo <teemu@hecknology.net>
parents: 6
diff changeset
15 return this->text;
44679e468ba9 major update with many things
Teemu Piippo <teemu@hecknology.net>
parents: 6
diff changeset
16 case Property::ErrorMessage:
44679e468ba9 major update with many things
Teemu Piippo <teemu@hecknology.net>
parents: 6
diff changeset
17 return this->message;
3
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
18 default:
13
6e838748867b renamings
Teemu Piippo <teemu@hecknology.net>
parents: 8
diff changeset
19 return Object::getProperty(property);
3
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
20 }
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
21 }
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
22
86
4bec0525ef1b PolygonObjectEditor can now modify the object properly
Teemu Piippo <teemu@hecknology.net>
parents: 35
diff changeset
23 void ldraw::ErrorLine::setProperty(SetPropertyResult* result, const PropertyKeyValue& pair)
3
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
24 {
86
4bec0525ef1b PolygonObjectEditor can now modify the object properly
Teemu Piippo <teemu@hecknology.net>
parents: 35
diff changeset
25 LDRAW_OBJECT_HANDLE_SET_PROPERTY(Text, {this->text = value;});
4bec0525ef1b PolygonObjectEditor can now modify the object properly
Teemu Piippo <teemu@hecknology.net>
parents: 35
diff changeset
26 LDRAW_OBJECT_HANDLE_SET_PROPERTY(ErrorMessage, {this->message = value;});
4bec0525ef1b PolygonObjectEditor can now modify the object properly
Teemu Piippo <teemu@hecknology.net>
parents: 35
diff changeset
27 BaseClass::setProperty(result, pair);
3
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
28 }
6
73e448b2943d language support
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
29
35
98906a94732f renamed the linetypes namespace to ldraw namespace and added more structures to it
Teemu Piippo <teemu@hecknology.net>
parents: 14
diff changeset
30 QString ldraw::ErrorLine::textRepresentation() const
6
73e448b2943d language support
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
31 {
73e448b2943d language support
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
32 return this->text;
73e448b2943d language support
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
33 }
73e448b2943d language support
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
34
35
98906a94732f renamed the linetypes namespace to ldraw namespace and added more structures to it
Teemu Piippo <teemu@hecknology.net>
parents: 14
diff changeset
35 QBrush ldraw::ErrorLine::textRepresentationForeground() const
6
73e448b2943d language support
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
36 {
73e448b2943d language support
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
37 return QBrush{Qt::yellow};
73e448b2943d language support
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
38 }
73e448b2943d language support
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
39
35
98906a94732f renamed the linetypes namespace to ldraw namespace and added more structures to it
Teemu Piippo <teemu@hecknology.net>
parents: 14
diff changeset
40 QBrush ldraw::ErrorLine::textRepresentationBackground() const
6
73e448b2943d language support
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
41 {
73e448b2943d language support
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
42 return QBrush{Qt::red};
73e448b2943d language support
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
43 }
132
488d0ba6070b Begin work with serialization
Teemu Piippo <teemu@hecknology.net>
parents: 86
diff changeset
44
488d0ba6070b Begin work with serialization
Teemu Piippo <teemu@hecknology.net>
parents: 86
diff changeset
45 ldraw::Object::Type ldraw::ErrorLine::typeIdentifier() const
488d0ba6070b Begin work with serialization
Teemu Piippo <teemu@hecknology.net>
parents: 86
diff changeset
46 {
488d0ba6070b Begin work with serialization
Teemu Piippo <teemu@hecknology.net>
parents: 86
diff changeset
47 return Type::ErrorLine;
488d0ba6070b Begin work with serialization
Teemu Piippo <teemu@hecknology.net>
parents: 86
diff changeset
48 }
134
f77d2230e87c Add remaining serialize methods
Teemu Piippo <teemu@hecknology.net>
parents: 132
diff changeset
49
f77d2230e87c Add remaining serialize methods
Teemu Piippo <teemu@hecknology.net>
parents: 132
diff changeset
50 QDataStream &ldraw::ErrorLine::serialize(QDataStream &stream) const
f77d2230e87c Add remaining serialize methods
Teemu Piippo <teemu@hecknology.net>
parents: 132
diff changeset
51 {
f77d2230e87c Add remaining serialize methods
Teemu Piippo <teemu@hecknology.net>
parents: 132
diff changeset
52 return ldraw::Object::serialize(stream) << this->text;
f77d2230e87c Add remaining serialize methods
Teemu Piippo <teemu@hecknology.net>
parents: 132
diff changeset
53 }
f77d2230e87c Add remaining serialize methods
Teemu Piippo <teemu@hecknology.net>
parents: 132
diff changeset
54
f77d2230e87c Add remaining serialize methods
Teemu Piippo <teemu@hecknology.net>
parents: 132
diff changeset
55 QDataStream &ldraw::ErrorLine::deserialize(QDataStream &stream)
f77d2230e87c Add remaining serialize methods
Teemu Piippo <teemu@hecknology.net>
parents: 132
diff changeset
56 {
f77d2230e87c Add remaining serialize methods
Teemu Piippo <teemu@hecknology.net>
parents: 132
diff changeset
57 return ldraw::Object::deserialize(stream) >> this->text;
f77d2230e87c Add remaining serialize methods
Teemu Piippo <teemu@hecknology.net>
parents: 132
diff changeset
58 }
141
185eb297dc1e Saving works now
Teemu Piippo <teemu@hecknology.net>
parents: 134
diff changeset
59
185eb297dc1e Saving works now
Teemu Piippo <teemu@hecknology.net>
parents: 134
diff changeset
60 QString ldraw::ErrorLine::toLDrawCode() const
185eb297dc1e Saving works now
Teemu Piippo <teemu@hecknology.net>
parents: 134
diff changeset
61 {
185eb297dc1e Saving works now
Teemu Piippo <teemu@hecknology.net>
parents: 134
diff changeset
62 return this->text;
185eb297dc1e Saving works now
Teemu Piippo <teemu@hecknology.net>
parents: 134
diff changeset
63 }
158
5bd755eaa5a8 Add icons from ionicons
Teemu Piippo <teemu@hecknology.net>
parents: 141
diff changeset
64
5bd755eaa5a8 Add icons from ionicons
Teemu Piippo <teemu@hecknology.net>
parents: 141
diff changeset
65 QString ldraw::ErrorLine::iconName() const
5bd755eaa5a8 Add icons from ionicons
Teemu Piippo <teemu@hecknology.net>
parents: 141
diff changeset
66 {
5bd755eaa5a8 Add icons from ionicons
Teemu Piippo <teemu@hecknology.net>
parents: 141
diff changeset
67 return ":/icons/linetype-errorline.png";
5bd755eaa5a8 Add icons from ionicons
Teemu Piippo <teemu@hecknology.net>
parents: 141
diff changeset
68 }

mercurial