1 /***************************************************************************
2 answer.cpp - description
4 begin : Thu Mar 28 2002
5 copyright : (C) 2002 by Primoz Anzur
6 email : zerokode@gmx.net
7 ***************************************************************************/
9 /***************************************************************************
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
16 ***************************************************************************/
21 #include <kstandarddirs.h>
22 #include <kpushbutton.h>
23 #include <kstdguiitem.h>
26 * Constructs a Answer which is a child of 'parent', with the
27 * name 'name' and widget flags set to 'f'.
29 * The dialog will by default be modeless, unless you set 'modal' to
30 * TRUE to construct a modal dialog.
32 Answer::Answer( QWidget
* parent
, const char* name
, bool modal
, WFlags
)
33 : QDialog( parent
, name
, modal
, true)
38 setMinimumSize( QSize( 256, 256 ) );
39 setMaximumSize( QSize( 256, 256 ) );
40 setCaption( tr2i18n( "Answer" ) );
41 AnswerLayout
= new QGridLayout( this, 1, 1, 11, 6, "AnswerLayout");
43 Layout2
= new QHBoxLayout( 0, 0, 6, "Layout2");
45 btnReplay
= new QPushButton( this, "btnReplay" );
46 btnReplay
->setText( tr2i18n( "&Play Again" ) );
47 Layout2
->addWidget( btnReplay
);
49 btnQuit
= new KPushButton( this, "btnQuit" );
50 btnQuit
->setText( tr2i18n( "Quit" ) );
51 Layout2
->addWidget( btnQuit
);
53 AnswerLayout
->addLayout( Layout2
, 1, 0 );
54 QSpacerItem
* spacer
= new QSpacerItem( 20, 20, QSizePolicy::Minimum
, QSizePolicy::Expanding
);
55 AnswerLayout
->addItem( spacer
, 0, 0 );
57 // signals and slots connections
58 connect( btnQuit
, SIGNAL( clicked() ), this, SLOT( exitAnswer() ) );
59 connect( btnReplay
, SIGNAL( clicked() ), this, SLOT( replayGame() ) );
63 * Destroys the object and frees any allocated resources
67 // no need to delete child widgets, Qt does it all for us
70 void Answer::exitAnswer()
73 close(); //will show the "OK" button -- Simple close...
80 void Answer::replayGame()
86 void Answer::doAnswer(bool result
){
87 kdDebug() << result
<< endl
;
90 btnReplay
->setEnabled(true);
91 btnQuit
->setGuiItem(KStdGuiItem::quit());
92 setCaption(i18n("Congratulations!"));
93 setBackgroundPixmap(QPixmap(locate("data","kmessedwords/dudeyes.png")));
96 btnReplay
->setEnabled(false);
97 btnQuit
->setGuiItem(KStdGuiItem::ok());
98 setCaption(i18n("You Missed!"));
99 setBackgroundPixmap(QPixmap(locate("data","kmessedwords/dudeoh.png")));
104 #include "answer.moc"