Diffstat (limited to 'noncore/games/zlines/mwidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/games/zlines/mwidget.cpp | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/noncore/games/zlines/mwidget.cpp b/noncore/games/zlines/mwidget.cpp new file mode 100644 index 0000000..6641fa2 --- a/dev/null +++ b/noncore/games/zlines/mwidget.cpp | |||
@@ -0,0 +1,84 @@ | |||
1 | /*************************************************************************** | ||
2 | mwidget.cpp - description | ||
3 | ------------------- | ||
4 | begin : Fri May 19 2000 | ||
5 | copyright : (C) 2000 by Roman Merzlyakov | ||
6 | email : roman@sbrf.barrt.ru | ||
7 | copyright : (C) 2000 by Roman Razilov | ||
8 | email : Roman.Razilov@gmx.de | ||
9 | ***************************************************************************/ | ||
10 | |||
11 | /*************************************************************************** | ||
12 | * * | ||
13 | * This program is free software; you can redistribute it and/or modify * | ||
14 | * it under the terms of the GNU General Public License as published by * | ||
15 | * the Free Software Foundation; either version 2 of the License, or * | ||
16 | * (at your option) any later version. * | ||
17 | * * | ||
18 | ***************************************************************************/ | ||
19 | #include "mwidget.h" | ||
20 | #include <qlayout.h> | ||
21 | #include "ballpainter.h" | ||
22 | #include <qhbox.h> | ||
23 | #include <qlabel.h> | ||
24 | |||
25 | MainWidget::MainWidget( QWidget* parent, const char* name ) | ||
26 | : QFrame( parent, name ) | ||
27 | { | ||
28 | BallPainter *bPainter = new BallPainter(); | ||
29 | |||
30 | QGridLayout *Form1Layout = new QGridLayout( this ); | ||
31 | Form1Layout->setSpacing( 4 ); | ||
32 | Form1Layout->setMargin( 4 ); | ||
33 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); | ||
34 | Form1Layout->addItem( spacer, 0, 0 ); | ||
35 | |||
36 | lsb = new LinesBoard(bPainter, this); | ||
37 | |||
38 | Form1Layout->addWidget( lsb, 0, 1 ); | ||
39 | QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); | ||
40 | Form1Layout->addItem( spacer_2, 0, 2 ); | ||
41 | |||
42 | QHBox *bottom=new QHBox(this); | ||
43 | |||
44 | mPoints=new QLabel(bottom); | ||
45 | bottom->setStretchFactor(mPoints, 2); | ||
46 | |||
47 | lPrompt = new LinesPrompt(bPainter, bottom); | ||
48 | |||
49 | Form1Layout->addWidget( bottom, 1, 1 ); | ||
50 | QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); | ||
51 | Form1Layout->addItem( spacer_3, 2, 1 ); | ||
52 | |||
53 | |||
54 | connect(lsb, SIGNAL(endTurn()), parent, SLOT(makeTurn())); | ||
55 | connect(lsb, SIGNAL(eraseLine(int)), parent, SLOT(addScore(int))); | ||
56 | connect(lsb, SIGNAL(endGame()), parent, SLOT(stopGame())); | ||
57 | |||
58 | connect(lPrompt, SIGNAL(PromptPressed()), parent, SLOT(switchPrompt())); | ||
59 | |||
60 | } | ||
61 | |||
62 | void MainWidget::setMessage(const QString &message) | ||
63 | { | ||
64 | mPoints->setText(message); | ||
65 | } | ||
66 | |||
67 | |||
68 | /* | ||
69 | Destructor: deallocates memory for contents | ||
70 | */ | ||
71 | |||
72 | MainWidget::~MainWidget() | ||
73 | { | ||
74 | } | ||
75 | |||
76 | LinesBoard * MainWidget::GetLsb() | ||
77 | { | ||
78 | return lsb; | ||
79 | } | ||
80 | |||
81 | LinesPrompt * MainWidget::GetPrompt() | ||
82 | { | ||
83 | return lPrompt; | ||
84 | } | ||