author | insilmaril |
Fri, 02 Oct 2009 14:31:03 +0000 | |
changeset 803 | 338ebdc9b947 |
parent 774 | 2f002657dada |
child 823 | 0bba81dde1bc |
permissions | -rw-r--r-- |
1 #include "flag.h"
3 #include <iostream>
4 using namespace std;
6 /////////////////////////////////////////////////////////////////
7 // Flag
8 /////////////////////////////////////////////////////////////////
9 Flag::Flag()
10 {
11 //cout << "Const Flag ()\n";
12 init ();
13 }
15 Flag::Flag (Flag* io)
16 {
17 //cout << "Const Flag (Flag)\n";
18 copy (io);
19 }
21 Flag::~Flag()
22 {
23 //cout << "Destr Flag this="<<this <<" " << qPrintable(name) << "\n";
24 }
27 void Flag::init ()
28 {
29 action=NULL;
30 name="undefined";
31 visible=true;
32 unsetGroup();
34 state=false;
35 used=false;
36 }
38 void Flag::copy (Flag* other)
39 {
40 action=other->action;
41 name=other->name;
42 group=other->group;
43 tooltip=other->tooltip;
44 state=other->state;
45 used=other->used;
46 pixmap=other->pixmap;
47 }
50 void Flag::load (const QString &fn)
51 {
52 pixmap.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 }