summaryrefslogtreecommitdiffstats
path: root/kbattleship/kbattleship/kstatdialog.cpp
blob: 9db2afe4e565034bc4ab43e88113e1249821a8d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/***************************************************************************
                                kstatdlg.cpp
                             -------------------
    Developers: (c) 2000-2001 Nikolas Zimmermann <wildfox@kde.org>
                (c) 2000-2001 Daniel Molkentin <molkentin@kde.org>

 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#include <qlcdnumber.h>
#include <qlabel.h>
#include "kstatdialog.moc"

KStatDialog::KStatDialog(QWidget *parent, const char *name) : statDlg(parent, name)
{
}

void KStatDialog::slotAddOwnWon()
{
	OwnLabel->setText(QString::number(OwnLabel->text().toInt() + 1));
}

void KStatDialog::slotAddEnemyWon()
{
	EnemyLabel->setText(QString::number(EnemyLabel->text().toInt() + 1));
}

void KStatDialog::setShot()
{
	setShot(shot() + 1);
}

void KStatDialog::setShot(int shot)
{
	ShotLCD->display(shot);
}

void KStatDialog::setHit()
{
	setHit(hit() + 1);
}

void KStatDialog::setHit(int hit)
{
	HitLCD->display(hit);
}

void KStatDialog::setWater()
{
	setWater(water() + 1);
}

void KStatDialog::setWater(int water)
{
	WaterLCD->display(water);
}

void KStatDialog::clear()
{
	ShotLCD->display(0);
	HitLCD->display(0);
	WaterLCD->display(0);
}

void KStatDialog::clearWon()
{
	OwnLabel->setText(QString::number(0));
	EnemyLabel->setText(QString::number(0));
}

int KStatDialog::shot()
{
	return ShotLCD->intValue();
}

int KStatDialog::hit()
{
	return HitLCD->intValue();
}

int KStatDialog::water()
{
	return WaterLCD->intValue();
}