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/mainwin.cpp | |
parent | 5f8a7a3105f27c7b45d98a7a6063ef561a45dd29 (diff) | |
download | tdegames-5a413fcfb0c67a3f8173216352c5c87dbe3097e5.tar.gz tdegames-5a413fcfb0c67a3f8173216352c5c87dbe3097e5.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/mainwin.cpp')
-rw-r--r-- | konquest/mainwin.cpp | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/konquest/mainwin.cpp b/konquest/mainwin.cpp new file mode 100644 index 00000000..8982974a --- /dev/null +++ b/konquest/mainwin.cpp @@ -0,0 +1,77 @@ +#include <config.h> + +#include <tqpushbutton.h> + +#include <tdeapplication.h> +#include <tdelocale.h> +#include <tdeglobal.h> +#include <tdemenubar.h> +#include <tdetoolbar.h> +#include <kiconloader.h> +#include <tdeaction.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(); + setupTDEAction(); + setupGUI(); +} + +MainWindow::~MainWindow() +{ +} + +void +MainWindow::setupTDEAction() +{ + KStdGameAction::gameNew( TQT_TQOBJECT(gameBoard), TQT_SLOT( startNewGame() ), actionCollection() ); + KStdGameAction::quit( TQT_TQOBJECT(this), TQT_SLOT( close() ), actionCollection() ); + endAction = KStdGameAction::end( TQT_TQOBJECT(gameBoard), TQT_SLOT( shutdownGame() ), actionCollection() ); + endAction->setEnabled(false); + + //AB: there is no icon for disabled - TDEToolBar::insertButton shows the + //different state - TDEAction not :-( + measureAction = new TDEAction( i18n("&Measure Distance"), "ruler", 0, TQT_TQOBJECT(gameBoard), TQT_SLOT( measureDistance() ), actionCollection(), "game_measure" ); + measureAction->setEnabled(false); + standingAction = new TDEAction( i18n("&Show Standings"), "help", 0, TQT_TQOBJECT(gameBoard), TQT_SLOT( showScores() ), actionCollection(), "game_scores" ); + standingAction->setEnabled(false); + fleetAction = new TDEAction( i18n("&Fleet Overview"), "launch", 0, TQT_TQOBJECT(gameBoard), TQT_SLOT( showFleets() ), actionCollection(), "game_fleets" ); + fleetAction->setEnabled(false); + toolBar()->setBarPos( TDEToolBar::Left ); + toolBar()->setMovingEnabled( false ); +} + +void +MainWindow::setupGameBoard() +{ + gameBoard = new GameBoard( this ); + setCentralWidget(gameBoard); + + connect( gameBoard, TQT_SIGNAL( newGameState( GameState )), TQT_TQOBJECT(this), TQT_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 ); +} + + + |