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