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.
78 lines
2.2 KiB
78 lines
2.2 KiB
15 years ago
|
#include <config.h>
|
||
|
|
||
14 years ago
|
#include <tqpushbutton.h>
|
||
15 years ago
|
|
||
12 years ago
|
#include <tdeapplication.h>
|
||
12 years ago
|
#include <tdelocale.h>
|
||
|
#include <tdeglobal.h>
|
||
|
#include <tdemenubar.h>
|
||
12 years ago
|
#include <tdetoolbar.h>
|
||
15 years ago
|
#include <kiconloader.h>
|
||
12 years ago
|
#include <tdeaction.h>
|
||
15 years ago
|
#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();
|
||
12 years ago
|
setupTDEAction();
|
||
15 years ago
|
setupGUI();
|
||
|
}
|
||
|
|
||
|
MainWindow::~MainWindow()
|
||
|
{
|
||
|
}
|
||
|
|
||
|
void
|
||
12 years ago
|
MainWindow::setupTDEAction()
|
||
15 years ago
|
{
|
||
14 years ago
|
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() );
|
||
15 years ago
|
endAction->setEnabled(false);
|
||
|
|
||
12 years ago
|
//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" );
|
||
15 years ago
|
measureAction->setEnabled(false);
|
||
12 years ago
|
standingAction = new TDEAction( i18n("&Show Standings"), "help", 0, TQT_TQOBJECT(gameBoard), TQT_SLOT( showScores() ), actionCollection(), "game_scores" );
|
||
15 years ago
|
standingAction->setEnabled(false);
|
||
12 years ago
|
fleetAction = new TDEAction( i18n("&Fleet Overview"), "launch", 0, TQT_TQOBJECT(gameBoard), TQT_SLOT( showFleets() ), actionCollection(), "game_fleets" );
|
||
15 years ago
|
fleetAction->setEnabled(false);
|
||
12 years ago
|
toolBar()->setBarPos( TDEToolBar::Left );
|
||
15 years ago
|
toolBar()->setMovingEnabled( false );
|
||
|
}
|
||
|
|
||
|
void
|
||
|
MainWindow::setupGameBoard()
|
||
|
{
|
||
|
gameBoard = new GameBoard( this );
|
||
|
setCentralWidget(gameBoard);
|
||
|
|
||
14 years ago
|
connect( gameBoard, TQT_SIGNAL( newGameState( GameState )), TQT_TQOBJECT(this), TQT_SLOT( gameStateChange( GameState ) ) );
|
||
15 years ago
|
}
|
||
|
|
||
|
|
||
|
void
|
||
|
MainWindow::gameStateChange( GameState newState )
|
||
|
{
|
||
|
endAction->setEnabled( gameBoard->isGameInProgress() );
|
||
|
measureAction->setEnabled( newState==SOURCE_PLANET );
|
||
|
standingAction->setEnabled( newState==SOURCE_PLANET );
|
||
|
fleetAction->setEnabled( newState==SOURCE_PLANET );
|
||
|
}
|
||
|
|
||
|
|
||
|
|