1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/flag.cpp Fri Oct 02 13:24:55 2009 +0000
1.3 @@ -0,0 +1,136 @@
1.4 +#include "flag.h"
1.5 +
1.6 +#include <iostream>
1.7 +using namespace std;
1.8 +
1.9 +/////////////////////////////////////////////////////////////////
1.10 +// Flag
1.11 +/////////////////////////////////////////////////////////////////
1.12 +Flag::Flag()
1.13 +{
1.14 + //cout << "Const Flag ()\n";
1.15 + init ();
1.16 +}
1.17 +
1.18 +Flag::Flag (Flag* io)
1.19 +{
1.20 + //cout << "Const Flag (Flag)\n";
1.21 + copy (io);
1.22 +}
1.23 +
1.24 +Flag::~Flag()
1.25 +{
1.26 + //cout << "Destr Flag this="<<this <<" " << qPrintable(name) << "\n";
1.27 +}
1.28 +
1.29 +
1.30 +void Flag::init ()
1.31 +{
1.32 + action=NULL;
1.33 + name="undefined";
1.34 + visible=true;
1.35 + unsetGroup();
1.36 +
1.37 + state=false;
1.38 + used=false;
1.39 +}
1.40 +
1.41 +void Flag::copy (Flag* other)
1.42 +{
1.43 + action=other->action;
1.44 + name=other->name;
1.45 + group=other->group;
1.46 + tooltip=other->tooltip;
1.47 + state=other->state;
1.48 + used=other->used;
1.49 + pixmap=other->pixmap;
1.50 +}
1.51 +
1.52 +
1.53 +void Flag::load (const QString &fn)
1.54 +{
1.55 + pixmap.load(fn);
1.56 +}
1.57 +
1.58 +void Flag::load (const QPixmap &pm)
1.59 +{
1.60 + pixmap=pm;
1.61 +}
1.62 +
1.63 +void Flag::setName(const QString &n)
1.64 +{
1.65 + name=n;
1.66 +}
1.67 +
1.68 +const QString Flag::getName()
1.69 +{
1.70 + return name;
1.71 +}
1.72 +
1.73 +void Flag::setVisible (bool b)
1.74 +{
1.75 + visible=b;
1.76 +}
1.77 +
1.78 +bool Flag::isVisible ()
1.79 +{
1.80 + return visible;
1.81 +}
1.82 +
1.83 +void Flag::setGroup (const QString &n)
1.84 +{
1.85 + group=n;
1.86 +}
1.87 +
1.88 +const QString Flag::getGroup()
1.89 +{
1.90 + return group;
1.91 +}
1.92 +
1.93 +void Flag::unsetGroup()
1.94 +{
1.95 + group.clear();
1.96 +}
1.97 +
1.98 +void Flag::setToolTip(const QString &n)
1.99 +{
1.100 + tooltip=n;
1.101 +}
1.102 +
1.103 +const QString Flag::getToolTip()
1.104 +{
1.105 + return tooltip;
1.106 +}
1.107 +
1.108 +QPixmap Flag::getPixmap()
1.109 +{
1.110 + return pixmap;
1.111 +}
1.112 +
1.113 +void Flag::setAction (QAction *a)
1.114 +{
1.115 + action=a;
1.116 +}
1.117 +
1.118 +QAction* Flag::getAction ()
1.119 +{
1.120 + return action;
1.121 +}
1.122 +
1.123 +void Flag::setUsed (bool b)
1.124 +{
1.125 + used=b;
1.126 +}
1.127 +
1.128 +bool Flag::isUsed()
1.129 +{
1.130 + return used;
1.131 +}
1.132 +
1.133 +void Flag::saveToDir (const QString &tmpdir, const QString &prefix)
1.134 +{
1.135 + QString fn=tmpdir + prefix + name + ".png";
1.136 + pixmap.save (fn,"PNG");
1.137 +}
1.138 +
1.139 +