You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
77 lines
1.9 KiB
77 lines
1.9 KiB
15 years ago
|
#include <tqlabel.h>
|
||
13 years ago
|
#include <tqlayout.h>
|
||
15 years ago
|
#include <tqslider.h>
|
||
|
#include <tqvbox.h>
|
||
15 years ago
|
|
||
12 years ago
|
#include <tdeapplication.h>
|
||
12 years ago
|
#include <tdeconfig.h>
|
||
12 years ago
|
#include <tdelocale.h>
|
||
15 years ago
|
#include <kstdguiitem.h>
|
||
|
|
||
|
#include "gameenddlg.h"
|
||
|
#include "gameenddlg.moc"
|
||
|
|
||
13 years ago
|
GameEndDlg::GameEndDlg( TQWidget *parent )
|
||
15 years ago
|
: KDialogBase( i18n("Out of Turns"),
|
||
|
KDialogBase::Yes|KDialogBase::No, KDialogBase::Yes, KDialogBase::No,
|
||
13 years ago
|
parent, "end_game_dialog", true, true )
|
||
15 years ago
|
{
|
||
15 years ago
|
TQVBox *page = makeVBoxMainWidget();
|
||
15 years ago
|
|
||
|
// Create controls
|
||
15 years ago
|
TQLabel *label1 = new TQLabel( i18n("This is the last turn.\nDo you wish to add extra turns?")+"\n\n", page );
|
||
13 years ago
|
label1->setAlignment( AlignCenter );
|
||
15 years ago
|
|
||
15 years ago
|
turnCountLbl = new TQLabel( page );
|
||
|
turnCount = new TQSlider( 1, 40, 1, 5, Qt::Horizontal, page );
|
||
15 years ago
|
|
||
14 years ago
|
KGuiItem addTurns(i18n("&Add Turns"), TQString(), TQString(),
|
||
15 years ago
|
i18n("Add the specified number of turns to the game and continue playing."));
|
||
14 years ago
|
KGuiItem gameOver(i18n("&Game Over"), TQString(), TQString(),
|
||
15 years ago
|
i18n("Terminate the current game."));
|
||
|
|
||
|
setButtonGuiItem(KDialogBase::Yes, addTurns);
|
||
|
setButtonGuiItem(KDialogBase::No, gameOver);
|
||
|
|
||
|
init();
|
||
|
|
||
15 years ago
|
connect( turnCount, TQT_SIGNAL(valueChanged( int )), this, TQT_SLOT(turnCountChange( int )) );
|
||
15 years ago
|
}
|
||
|
|
||
|
GameEndDlg::~GameEndDlg()
|
||
|
{
|
||
|
}
|
||
|
|
||
|
void
|
||
|
GameEndDlg::init()
|
||
|
{
|
||
12 years ago
|
TDEConfig *config = kapp->config();
|
||
15 years ago
|
config->setGroup("Game");
|
||
|
int turns = config->readNumEntry("ExtraTurns", 10);
|
||
|
turnCount->setValue(turns);
|
||
|
turnCountChange(turns);
|
||
|
}
|
||
|
|
||
|
void
|
||
|
GameEndDlg::slotYes()
|
||
|
{
|
||
12 years ago
|
TDEConfig *config = kapp->config();
|
||
15 years ago
|
config->setGroup("Game");
|
||
|
config->writeEntry("ExtraTurns", extraTurns());
|
||
|
config->sync();
|
||
|
KDialogBase::slotYes();
|
||
|
}
|
||
|
|
||
|
int
|
||
|
GameEndDlg::extraTurns()
|
||
|
{
|
||
|
return turnCount->value();
|
||
|
}
|
||
|
|
||
|
void
|
||
|
GameEndDlg::turnCountChange( int newTurnCount )
|
||
|
{
|
||
13 years ago
|
TQString newLbl = i18n("Extra turns: %1").arg( newTurnCount );
|
||
15 years ago
|
turnCountLbl->setText( newLbl);
|
||
|
}
|