author | insilmaril |
Mon, 08 Mar 2010 12:24:26 +0000 | |
changeset 829 | 832e96c9abb6 |
parent 823 | 0bba81dde1bc |
child 837 | 5ecd0462f76b |
permissions | -rw-r--r-- |
1 #include "flag.h"
3 #include <QDebug>
5 /////////////////////////////////////////////////////////////////
6 // Flag
7 /////////////////////////////////////////////////////////////////
8 Flag::Flag()
9 {
10 //cout << "Const Flag ()\n";
11 init ();
12 }
14 Flag::Flag (Flag* io)
15 {
16 //cout << "Const Flag (Flag)\n";
17 copy (io);
18 }
20 Flag::~Flag()
21 {
22 //cout << "Destr Flag this="<<this <<" " << qPrintable(name) << "\n";
23 }
26 void Flag::init ()
27 {
28 action=NULL;
29 name="undefined";
30 visible=true;
31 unsetGroup();
33 state=false;
34 used=false;
35 }
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 }
49 void Flag::load (const QString &fn)
50 {
51 if (!pixmap.load(fn))
52 qDebug()<<"Flag::load failed to load "<<fn;
53 }
55 void Flag::load (const QPixmap &pm)
56 {
57 pixmap=pm;
58 }
60 void Flag::setName(const QString &n)
61 {
62 name=n;
63 }
65 const QString Flag::getName()
66 {
67 return name;
68 }
70 void Flag::setVisible (bool b)
71 {
72 visible=b;
73 }
75 bool Flag::isVisible ()
76 {
77 return visible;
78 }
80 void Flag::setGroup (const QString &n)
81 {
82 group=n;
83 }
85 const QString Flag::getGroup()
86 {
87 return group;
88 }
90 void Flag::unsetGroup()
91 {
92 group.clear();
93 }
95 void Flag::setToolTip(const QString &n)
96 {
97 tooltip=n;
98 }
100 const QString Flag::getToolTip()
101 {
102 return tooltip;
103 }
105 QPixmap Flag::getPixmap()
106 {
107 return pixmap;
108 }
110 void Flag::setAction (QAction *a)
111 {
112 action=a;
113 }
115 QAction* Flag::getAction ()
116 {
117 return action;
118 }
120 void Flag::setUsed (bool b)
121 {
122 used=b;
123 }
125 bool Flag::isUsed()
126 {
127 return used;
128 }
130 void Flag::saveToDir (const QString &tmpdir, const QString &prefix)
131 {
132 QString fn=tmpdir + prefix + name + ".png";
133 pixmap.save (fn,"PNG");
134 }