summaryrefslogtreecommitdiffstats
path: root/kmahjongg/HighScore.h
blob: 38df54545664ba4a81b10dd34ba2c92f1e24ee65 (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

#ifndef HighScore_included
#define HighScore_included

#include <tqdialog.h>


class TQLineEdit;
class TQComboBox;
class TQLabel;

const int numScores = 10;

struct HiScoreEntry  {
	TQString name;
	long	board;
	long 	score;
	long elapsed;
	
};

struct TableInstance  {
	TQString name;
	HiScoreEntry entries[numScores];
	TableInstance *next;	
};


class HighScore : public TQDialog
{
    Q_OBJECT
  

public:

    HighScore
    (
        TQWidget* parent = NULL,
        const char* name = NULL
    );

    virtual ~HighScore();

	int exec(TQString &layout);


    void checkHighScore(int score, int elapsed, long game, TQString &board);
public slots:
	void selectionChanged(int);

protected slots:
	void nameChanged(const TQString &s);
	void reset();
private:
	void 		addRow(int num);	// generate one table row 
	void		loadTables();	// initialise from saved
	void		saveTables();	// save to disc.
	void		getBoardName(TQString in, TQString &out);
	void 		selectTable(const TQString &name);
	void		setComboTo(const TQString &to);
	void		copyTableToScreen(const TQString &name);
	TQString		&highScoreFile();
	
	int 		selectedLine;
	TQLineEdit   	*lineEdit;
        TQLabel*		numbersWidgets[numScores];
	TQLabel* 	boardWidgets[numScores];
        TQLabel*     	namesWidgets[numScores];
        TQLabel* 	scoresWidgets[numScores]; 
	TQLabel*       elapsedWidgets[numScores]; 
	TQComboBox*	combo;
	TQString 	filename;

	TableInstance *tables;		
	TableInstance *currTable;		
};

#endif // HighScore_included