[kde-doc-english] [konquest] /: Add action for "end turn".

Alexander Schuch aschuch247 at gmail.com
Wed Oct 30 00:22:49 UTC 2013


Git commit 2587940e583982c0550e834c6d2891ead29e570a by Alexander Schuch.
Committed on 30/10/2013 at 00:16.
Pushed by aschuch into branch 'master'.

Add action for "end turn".

The action to end a turn now is a "real" action. It is available in the menu
bar and as such can get any shortcut assigned by the user. It can also be added
to the toolbar.

BUG: 272817
REVIEW: 113477
GUI:

M  +14   -8    mainwin.cc
M  +2    -1    mainwin.h

http://commits.kde.org/konquest/2587940e583982c0550e834c6d2891ead29e570a

diff --git a/mainwin.cc b/mainwin.cc
index b9dfdff..929c61d 100644
--- a/mainwin.cc
+++ b/mainwin.cc
@@ -69,8 +69,11 @@ MainWindow::setupActions()
     KStandardGameAction::gameNew( this, SLOT( startNewGame() ), actionCollection() );
     KStandardGameAction::quit( this, SLOT( close() ), actionCollection() );
 
-    m_endAction = KStandardGameAction::end( this, NULL, actionCollection() );
-    m_endAction->setEnabled(false);
+    m_endTurnAction = KStandardGameAction::endTurn(this, NULL, actionCollection());
+    m_endTurnAction->setEnabled(false);
+
+    m_endGameAction = KStandardGameAction::end( this, NULL, actionCollection() );
+    m_endGameAction->setEnabled(false);
 
     //AB: there is no icon for disabled - KToolBar::insertButton shows the
     //different state - KAction not :-(
@@ -112,11 +115,12 @@ MainWindow::setupGameView()
 					 Player * ) ) );
     connect (m_gameView, SIGNAL( newGUIState( GUIState )),
 	     this,       SLOT( guiStateChange( GUIState ) ) );
-    
-    connect(m_measureAction,  SIGNAL(triggered(bool)), m_gameView, SLOT( measureDistance() ));   
-    connect(m_standingAction, SIGNAL(triggered(bool)), m_gameView, SLOT( showScores() ));   
-    connect(m_fleetAction,    SIGNAL(triggered(bool)), m_gameView, SLOT( showFleets() ));   
-    connect(m_endAction,      SIGNAL(triggered()),     m_gameView, SLOT(shutdownGame()));
+
+    connect(m_measureAction,  SIGNAL(triggered(bool)), m_gameView, SLOT( measureDistance() ));
+    connect(m_standingAction, SIGNAL(triggered(bool)), m_gameView, SLOT( showScores() ));
+    connect(m_fleetAction,    SIGNAL(triggered(bool)), m_gameView, SLOT( showFleets() ));
+    connect(m_endTurnAction,  SIGNAL(triggered()),     m_gameView, SLOT(nextPlayer()));
+    connect(m_endGameAction,  SIGNAL(triggered()),     m_gameView, SLOT(shutdownGame()));
 }
 
 void
@@ -140,7 +144,9 @@ MainWindow::guiStateChange( GUIState newState )
         m_game->deleteLater();
         this->setupGameView();
     }
-    m_endAction     ->setEnabled( m_game->isRunning() );
+
+    m_endTurnAction ->setEnabled( m_game->isRunning() );
+    m_endGameAction ->setEnabled( m_game->isRunning() );
     m_measureAction ->setEnabled( newState == SOURCE_PLANET );
     m_standingAction->setEnabled( newState == SOURCE_PLANET );
     m_fleetAction   ->setEnabled( newState == SOURCE_PLANET );
diff --git a/mainwin.h b/mainwin.h
index 81d0ab4..d72fd46 100644
--- a/mainwin.h
+++ b/mainwin.h
@@ -53,7 +53,8 @@ private:
     QLabel     *m_statusBarText;
 
     // Actions
-    QAction  *m_endAction;
+    QAction  *m_endTurnAction;
+    QAction  *m_endGameAction;
     QAction  *m_measureAction;
     QAction  *m_standingAction;
     QAction  *m_fleetAction;


More information about the kde-doc-english mailing list