flag.cpp
author insilmaril
Mon, 08 Mar 2010 12:24:26 +0000
changeset 829 832e96c9abb6
parent 823 0bba81dde1bc
child 837 5ecd0462f76b
permissions -rw-r--r--
Introduce dockwidget to display all search results at once
insilmaril@774
     1
#include "flag.h"
insilmaril@774
     2
insilmaril@823
     3
#include <QDebug>
insilmaril@774
     4
insilmaril@774
     5
/////////////////////////////////////////////////////////////////
insilmaril@774
     6
// Flag
insilmaril@774
     7
/////////////////////////////////////////////////////////////////
insilmaril@774
     8
Flag::Flag()
insilmaril@774
     9
{
insilmaril@774
    10
	//cout << "Const Flag ()\n";
insilmaril@774
    11
    init ();
insilmaril@774
    12
}
insilmaril@774
    13
insilmaril@774
    14
Flag::Flag (Flag* io)
insilmaril@774
    15
{
insilmaril@774
    16
	//cout << "Const Flag (Flag)\n";
insilmaril@774
    17
    copy (io);
insilmaril@774
    18
}
insilmaril@774
    19
insilmaril@774
    20
Flag::~Flag()
insilmaril@774
    21
{
insilmaril@774
    22
   //cout << "Destr Flag  this="<<this <<"  " << qPrintable(name) << "\n";
insilmaril@774
    23
}
insilmaril@774
    24
insilmaril@774
    25
insilmaril@774
    26
void Flag::init ()
insilmaril@774
    27
{
insilmaril@774
    28
	action=NULL;
insilmaril@774
    29
	name="undefined";
insilmaril@774
    30
	visible=true;
insilmaril@774
    31
	unsetGroup();
insilmaril@774
    32
insilmaril@774
    33
	state=false;
insilmaril@774
    34
	used=false;
insilmaril@774
    35
}
insilmaril@774
    36
insilmaril@774
    37
void Flag::copy (Flag* other)
insilmaril@774
    38
{
insilmaril@774
    39
	action=other->action;
insilmaril@774
    40
	name=other->name;
insilmaril@774
    41
	group=other->group;
insilmaril@774
    42
	tooltip=other->tooltip;
insilmaril@774
    43
	state=other->state;
insilmaril@774
    44
	used=other->used;
insilmaril@774
    45
	pixmap=other->pixmap;
insilmaril@774
    46
}
insilmaril@774
    47
insilmaril@774
    48
insilmaril@774
    49
void Flag::load (const QString &fn)
insilmaril@774
    50
{
insilmaril@823
    51
	if (!pixmap.load(fn))
insilmaril@823
    52
		qDebug()<<"Flag::load failed to 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