1
#include "flag.h"
2
3
#include <QDebug>
4
5
/////////////////////////////////////////////////////////////////
6
// Flag
7
8
Flag::Flag()
9
{
10
//cout << "Const Flag ()\n";
11
init ();
12
}
13
14
Flag::Flag (Flag* io)
15
16
//cout << "Const Flag (Flag)\n";
17
copy (io);
18
19
20
Flag::~Flag()
21
22
//cout << "Destr Flag this="<<this <<" " << qPrintable(name) << "\n";
23
24
25
26
void Flag::init ()
27
28
action=NULL;
29
name="undefined";
30
visible=true;
31
unsetGroup();
32
33
state=false;
34
used=false;
35
36
37
void Flag::copy (Flag* other)
38
39
action=other->action;
40
name=other->name;
41
group=other->group;
42
tooltip=other->tooltip;
43
state=other->state;
44
used=other->used;
45
pixmap=other->pixmap;
46
47
48
49
void Flag::load (const QString &fn)
50
51
if (!pixmap.load(fn))
52
qDebug()<<"Flag::load failed to load "<<fn;
53
54
55
void Flag::load (const QPixmap &pm)
56
57
pixmap=pm;
58
59
60
void Flag::setName(const QString &n)
61
62
name=n;
63
64
65
const QString Flag::getName()
66
67
return name;
68
69
70
void Flag::setVisible (bool b)
71
72
visible=b;
73
74
75
bool Flag::isVisible ()
76
77
return visible;
78
79
80
void Flag::setGroup (const QString &n)
81
82
group=n;
83
84
85
const QString Flag::getGroup()
86
87
return group;
88
89
90
void Flag::unsetGroup()
91
92
group.clear();
93
94
95
void Flag::setToolTip(const QString &n)
96
97
tooltip=n;
98
99
100
const QString Flag::getToolTip()
101
102
return tooltip;
103
104
105
QPixmap Flag::getPixmap()
106
107
return pixmap;
108
109
110
void Flag::setAction (QAction *a)
111
112
action=a;
113
114
115
QAction* Flag::getAction ()
116
117
return action;
118
119
120
void Flag::setUsed (bool b)
121
122
used=b;
123
124
125
bool Flag::isUsed()
126
127
return used;
128
129
130
void Flag::saveToDir (const QString &tmpdir, const QString &prefix)
131
132
QString fn=tmpdir + prefix + name + ".png";
133
pixmap.save (fn,"PNG");
134
135
136