diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | c90c389a8a8d9d8661e9772ec4144c5cf2039f23 (patch) | |
tree | 6d8391395bce9eaea4ad78958617edb20c6a7573 /konquest/mainwin.cc | |
download | tdegames-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/mainwin.cc')
-rw-r--r-- | konquest/mainwin.cc | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/konquest/mainwin.cc b/konquest/mainwin.cc new file mode 100644 index 00000000..496d3ac0 --- /dev/null +++ b/konquest/mainwin.cc @@ -0,0 +1,77 @@ +#include <config.h> + +#include <qpushbutton.h> + +#include <kapplication.h> +#include <klocale.h> +#include <kglobal.h> +#include <kmenubar.h> +#include <ktoolbar.h> +#include <kiconloader.h> +#include <kaction.h> +#include <kstdaction.h> +#include <kstdgameaction.h> + +#include "version.h" +#include "gamecore.h" +#include "mainwin.h" +#include "mainwin.moc" +#include "gameboard.h" + +// KonquestMainWindow + + +MainWindow::MainWindow() +{ + setCaption( i18n("Galactic Conquest") ); + + setupGameBoard(); + setupKAction(); + setupGUI(); +} + +MainWindow::~MainWindow() +{ +} + +void +MainWindow::setupKAction() +{ + KStdGameAction::gameNew( gameBoard, SLOT( startNewGame() ), actionCollection() ); + KStdGameAction::quit( this, SLOT( close() ), actionCollection() ); + endAction = KStdGameAction::end( gameBoard, SLOT( shutdownGame() ), actionCollection() ); + endAction->setEnabled(false); + + //AB: there is no icon for disabled - KToolBar::insertButton shows the + //different state - KAction not :-( + measureAction = new KAction( i18n("&Measure Distance"), "ruler", 0, gameBoard, SLOT( measureDistance() ), actionCollection(), "game_measure" ); + measureAction->setEnabled(false); + standingAction = new KAction( i18n("&Show Standings"), "help", 0, gameBoard, SLOT( showScores() ), actionCollection(), "game_scores" ); + standingAction->setEnabled(false); + fleetAction = new KAction( i18n("&Fleet Overview"), "launch", 0, gameBoard, SLOT( showFleets() ), actionCollection(), "game_fleets" ); + fleetAction->setEnabled(false); + toolBar()->setBarPos( KToolBar::Left ); + toolBar()->setMovingEnabled( false ); +} + +void +MainWindow::setupGameBoard() +{ + gameBoard = new GameBoard( this ); + setCentralWidget(gameBoard); + + connect( gameBoard, SIGNAL( newGameState( GameState )), this, SLOT( gameStateChange( GameState ) ) ); +} + + +void +MainWindow::gameStateChange( GameState newState ) +{ + endAction->setEnabled( gameBoard->isGameInProgress() ); + measureAction->setEnabled( newState==SOURCE_PLANET ); + standingAction->setEnabled( newState==SOURCE_PLANET ); + fleetAction->setEnabled( newState==SOURCE_PLANET ); +} + + + |