00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "mwidget.h"
00020 #include <qlayout.h>
00021 #include <qhbox.h>
00022 #include <qlabel.h>
00023
00024 MainWidget::MainWidget( QWidget* parent, const char* name )
00025 : QFrame( parent, name )
00026 {
00027 BallPainter *bPainter = new BallPainter();
00028
00029 QGridLayout *Form1Layout = new QGridLayout( this );
00030 Form1Layout->setSpacing( 4 );
00031 Form1Layout->setMargin( 4 );
00032 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
00033 Form1Layout->addItem( spacer, 0, 0 );
00034
00035 lsb = new LinesBoard(bPainter, this);
00036
00037 Form1Layout->addWidget( lsb, 0, 1 );
00038 QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
00039 Form1Layout->addItem( spacer_2, 0, 2 );
00040
00041 QHBox *bottom=new QHBox(this);
00042
00043 mPoints=new QLabel(bottom);
00044 bottom->setStretchFactor(mPoints, 2);
00045
00046 lPrompt = new LinesPrompt(bPainter, bottom);
00047
00048 Form1Layout->addWidget( bottom, 1, 1 );
00049 QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
00050 Form1Layout->addItem( spacer_3, 2, 1 );
00051
00052
00053 connect(lsb, SIGNAL(endTurn()), parent, SLOT(makeTurn()));
00054 connect(lsb, SIGNAL(eraseLine(int)), parent, SLOT(addScore(int)));
00055 connect(lsb, SIGNAL(endGame()), parent, SLOT(stopGame()));
00056
00057 connect(lPrompt, SIGNAL(PromptPressed()), parent, SLOT(switchPrompt()));
00058
00059 }
00060
00061 void MainWidget::setMessage(const QString &message)
00062 {
00063 mPoints->setText(message);
00064 }
00065
00066
00067
00068
00069
00070
00071 MainWidget::~MainWidget()
00072 {
00073 }
00074
00075 LinesBoard * MainWidget::GetLsb()
00076 {
00077 return lsb;
00078 }
00079
00080 LinesPrompt * MainWidget::GetPrompt()
00081 {
00082 return lPrompt;
00083 }