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