summaryrefslogtreecommitdiffstats
path: root/konquest/gameenddlg.cc
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitc90c389a8a8d9d8661e9772ec4144c5cf2039f23 (patch)
tree6d8391395bce9eaea4ad78958617edb20c6a7573 /konquest/gameenddlg.cc
downloadtdegames-c90c389a8a8d9d8661e9772ec4144c5cf2039f23.tar.gz
tdegames-c90c389a8a8d9d8661e9772ec4144c5cf2039f23.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegames@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'konquest/gameenddlg.cc')
-rw-r--r--konquest/gameenddlg.cc76
1 files changed, 76 insertions, 0 deletions
diff --git a/konquest/gameenddlg.cc b/konquest/gameenddlg.cc
new file mode 100644
index 00000000..080a8477
--- /dev/null
+++ b/konquest/gameenddlg.cc
@@ -0,0 +1,76 @@
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qslider.h>
+#include <qvbox.h>
+
+#include <kapplication.h>
+#include <kconfig.h>
+#include <klocale.h>
+#include <kstdguiitem.h>
+
+#include "gameenddlg.h"
+#include "gameenddlg.moc"
+
+GameEndDlg::GameEndDlg( QWidget *parent )
+ : KDialogBase( i18n("Out of Turns"),
+ KDialogBase::Yes|KDialogBase::No, KDialogBase::Yes, KDialogBase::No,
+ parent, "end_game_dialog", true, true )
+{
+ QVBox *page = makeVBoxMainWidget();
+
+ // Create controls
+ QLabel *label1 = new QLabel( i18n("This is the last turn.\nDo you wish to add extra turns?")+"\n\n", page );
+ label1->setAlignment( AlignCenter );
+
+ turnCountLbl = new QLabel( page );
+ turnCount = new QSlider( 1, 40, 1, 5, Qt::Horizontal, page );
+
+ KGuiItem addTurns(i18n("&Add Turns"), QString::null, QString::null,
+ i18n("Add the specified number of turns to the game and continue playing."));
+ KGuiItem gameOver(i18n("&Game Over"), QString::null, QString::null,
+ i18n("Terminate the current game."));
+
+ setButtonGuiItem(KDialogBase::Yes, addTurns);
+ setButtonGuiItem(KDialogBase::No, gameOver);
+
+ init();
+
+ connect( turnCount, SIGNAL(valueChanged( int )), this, SLOT(turnCountChange( int )) );
+}
+
+GameEndDlg::~GameEndDlg()
+{
+}
+
+void
+GameEndDlg::init()
+{
+ KConfig *config = kapp->config();
+ config->setGroup("Game");
+ int turns = config->readNumEntry("ExtraTurns", 10);
+ turnCount->setValue(turns);
+ turnCountChange(turns);
+}
+
+void
+GameEndDlg::slotYes()
+{
+ KConfig *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 )
+{
+ QString newLbl = i18n("Extra turns: %1").arg( newTurnCount );
+ turnCountLbl->setText( newLbl);
+}