diff options
| author | Michele Calgaro <michele.calgaro@yahoo.it> | 2020-12-11 16:15:55 +0900 |
|---|---|---|
| committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2020-12-11 16:19:06 +0900 |
| commit | 5a413fcfb0c67a3f8173216352c5c87dbe3097e5 (patch) | |
| tree | 2c4110256a0faa017d803c802f2e3011c2f095e4 /konquest/gameenddlg.cpp | |
| parent | 5f8a7a3105f27c7b45d98a7a6063ef561a45dd29 (diff) | |
| download | tdegames-5a413fcf.tar.gz tdegames-5a413fcf.zip | |
Renaming of files in preparation for code style tools.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
(cherry picked from commit 931f81f9fe49f3fe339bb3cb23501393bfbb2d0a)
Diffstat (limited to 'konquest/gameenddlg.cpp')
| -rw-r--r-- | konquest/gameenddlg.cpp | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/konquest/gameenddlg.cpp b/konquest/gameenddlg.cpp new file mode 100644 index 00000000..d999c375 --- /dev/null +++ b/konquest/gameenddlg.cpp @@ -0,0 +1,76 @@ +#include <tqlabel.h> +#include <tqlayout.h> +#include <tqslider.h> +#include <tqvbox.h> + +#include <tdeapplication.h> +#include <tdeconfig.h> +#include <tdelocale.h> +#include <kstdguiitem.h> + +#include "gameenddlg.h" +#include "gameenddlg.moc" + +GameEndDlg::GameEndDlg( TQWidget *parent ) + : KDialogBase( i18n("Out of Turns"), + KDialogBase::Yes|KDialogBase::No, KDialogBase::Yes, KDialogBase::No, + parent, "end_game_dialog", true, true ) +{ + TQVBox *page = makeVBoxMainWidget(); + + // Create controls + TQLabel *label1 = new TQLabel( i18n("This is the last turn.\nDo you wish to add extra turns?")+"\n\n", page ); + label1->setAlignment( AlignCenter ); + + turnCountLbl = new TQLabel( page ); + turnCount = new TQSlider( 1, 40, 1, 5, Qt::Horizontal, page ); + + KGuiItem addTurns(i18n("&Add Turns"), TQString(), TQString(), + i18n("Add the specified number of turns to the game and continue playing.")); + KGuiItem gameOver(i18n("&Game Over"), TQString(), TQString(), + i18n("Terminate the current game.")); + + setButtonGuiItem(KDialogBase::Yes, addTurns); + setButtonGuiItem(KDialogBase::No, gameOver); + + init(); + + connect( turnCount, TQT_SIGNAL(valueChanged( int )), this, TQT_SLOT(turnCountChange( int )) ); +} + +GameEndDlg::~GameEndDlg() +{ +} + +void +GameEndDlg::init() +{ + TDEConfig *config = kapp->config(); + config->setGroup("Game"); + int turns = config->readNumEntry("ExtraTurns", 10); + turnCount->setValue(turns); + turnCountChange(turns); +} + +void +GameEndDlg::slotYes() +{ + TDEConfig *config = kapp->config(); + config->setGroup("Game"); + config->writeEntry("ExtraTurns", extraTurns()); + config->sync(); + KDialogBase::slotYes(); +} + +int +GameEndDlg::extraTurns() +{ + return turnCount->value(); +} + +void +GameEndDlg::turnCountChange( int newTurnCount ) +{ + TQString newLbl = i18n("Extra turns: %1").arg( newTurnCount ); + turnCountLbl->setText( newLbl); +} |
