Mainwindow Class Reference

The main application window. More...

#include <mainwindow.h>

Collaboration diagram for Mainwindow:

Collaboration graph
[legend]
List of all members.

Public Types

enum  GameMode { Intro = 0, LSkat = 1, Skat = 2 }
 Game mode type. More...

Public Slots

void menuNewLSkatGame ()
 A new game is started from the menu.
void menuEndGame ()
 A game is stopped in the menu.
void menuStartplayer ()
 The start player is changed in the menu.
void menuPlayer1By ()
void menuPlayer2By ()
void menuCardDeck ()
 A card deck is chosen from the menu.
void menuPlayerNames ()
 The player names shall be changed.
void menuClearStatistics ()
 The all time statistics is cleared from the menu.
void gameOver (int winner)
 A game over signal arrived.
void nextPlayer (Player *player)
 Next players turn.

Public Member Functions

 Mainwindow (QWidget *parent=0)
 Construct the main window.
 ~Mainwindow ()
 Destructor.

Protected Slots

void setInputType (int no, InputDeviceType type)
 Set the input type for a given player number.

Protected Member Functions

AbstractInputcreateInput (InputDevice::InputDeviceType inputType, AbstractDisplay *display, AbstractEngine *engine)
 A new input device is created.
void initGUI ()
 Initialize all GUI elements.
void startGame ()
 Start a new game.
void setStartPlayer (int no)
 Set-up the start player.
virtual void saveProperties ()
 Saves the window properties.
virtual void readProperties ()
 Reads the session config file and restores the application's state.
virtual bool queryExit ()
 Called by KMainWindow when the last window of the application is going to be closed.

Detailed Description

The main application window.

Definition at line 56 of file mainwindow.h.


Member Enumeration Documentation

enum Mainwindow::GameMode
 

Game mode type.

Enumerator:
Intro 
LSkat 
Skat 

Definition at line 62 of file mainwindow.h.


Constructor & Destructor Documentation

Mainwindow::Mainwindow QWidget *  parent = 0  ) 
 

Construct the main window.

Parameters:
parent The parent widget

Definition at line 74 of file mainwindow.cpp.

References ADVANCE_PERDIOD, global_debug, global_demo_mode, global_skip_intro, initGUI(), Intro, menuNewLSkatGame(), readProperties(), ConfigTwo::reset(), setInputType(), SRC_DIR, and AbstractDisplay::start().

Here is the call graph for this function:

Mainwindow::~Mainwindow  ) 
 

Destructor.

Definition at line 153 of file mainwindow.cpp.

References saveProperties().

Here is the call graph for this function:


Member Function Documentation

AbstractInput * Mainwindow::createInput InputDevice::InputDeviceType  inputType,
AbstractDisplay display,
AbstractEngine engine
[protected]
 

A new input device is created.

Parameters:
inputType The type of input
display The display.
engine The game engine.
Returns:
The new input device.

Definition at line 232 of file mainwindow.cpp.

References global_debug, global_demo_mode, InputDevice::TypeAiInput, and InputDevice::TypeMouseInput.

Referenced by menuNewLSkatGame(), and setInputType().

void Mainwindow::gameOver int  winner  )  [slot]
 

A game over signal arrived.

Definition at line 314 of file mainwindow.cpp.

References ACTION, global_demo_mode, and menuNewLSkatGame().

Referenced by menuNewLSkatGame().

void Mainwindow::initGUI  )  [protected]
 

Initialize all GUI elements.

Definition at line 337 of file mainwindow.cpp.

References ACTION, global_demo_mode, menuCardDeck(), menuClearStatistics(), menuEndGame(), menuNewLSkatGame(), menuPlayer1By(), menuPlayer2By(), menuPlayerNames(), and menuStartplayer().

Referenced by Mainwindow().

void Mainwindow::menuCardDeck  )  [slot]
 

A card deck is chosen from the menu.

Definition at line 449 of file mainwindow.cpp.

References global_debug.

Referenced by initGUI().

void Mainwindow::menuClearStatistics  )  [slot]
 

The all time statistics is cleared from the menu.

Definition at line 480 of file mainwindow.cpp.

References Player::clear(), and ConfigTwo::playerIterator().

Referenced by initGUI().

void Mainwindow::menuEndGame  )  [slot]
 

A game is stopped in the menu.

Definition at line 503 of file mainwindow.cpp.

References AbstractEngine::stopGame().

Referenced by initGUI().

void Mainwindow::menuNewLSkatGame  )  [slot]
 

A new game is started from the menu.

Definition at line 514 of file mainwindow.cpp.

References AbstractEngine::addPlayer(), ADVANCE_PERDIOD, createInput(), gameOver(), ConfigTwo::inputType(), LSkat, nextPlayer(), ConfigTwo::player(), Player::setInput(), startGame(), and AbstractEngine::stopGame().

Referenced by gameOver(), initGUI(), and Mainwindow().

void Mainwindow::menuPlayer1By  )  [slot]
 

Definition at line 433 of file mainwindow.cpp.

References ACTION, and ConfigTwo::setInputType().

Referenced by initGUI().

void Mainwindow::menuPlayer2By  )  [slot]
 

Definition at line 441 of file mainwindow.cpp.

References ACTION, and ConfigTwo::setInputType().

Referenced by initGUI().

void Mainwindow::menuPlayerNames  )  [slot]
 

The player names shall be changed.

Definition at line 562 of file mainwindow.cpp.

References ConfigTwo::player(), and NameDialogWidget::setName().

Referenced by initGUI().

void Mainwindow::menuStartplayer  )  [slot]
 

The start player is changed in the menu.

Definition at line 425 of file mainwindow.cpp.

References ACTION, and setStartPlayer().

Referenced by initGUI().

void Mainwindow::nextPlayer Player player  )  [slot]
 

Next players turn.

Definition at line 328 of file mainwindow.cpp.

References Player::id(), and Player::name().

Referenced by menuNewLSkatGame().

bool Mainwindow::queryExit  )  [protected, virtual]
 

Called by KMainWindow when the last window of the application is going to be closed.

See also:
KMainWindow::queryExit

KMainWindow::closeEvent

Definition at line 167 of file mainwindow.cpp.

References saveProperties(), and AbstractEngine::stopGame().

Here is the call graph for this function:

void Mainwindow::readProperties  )  [protected, virtual]
 

Reads the session config file and restores the application's state.

See also:
KMainWindow::readProperties

Definition at line 196 of file mainwindow.cpp.

References global_debug, ConfigTwo::load(), and setStartPlayer().

Referenced by Mainwindow().

Here is the call graph for this function:

void Mainwindow::saveProperties  )  [protected, virtual]
 

Saves the window properties.

See also:
KMainWindow::saveProperties

Definition at line 179 of file mainwindow.cpp.

References ConfigTwo::save().

Referenced by queryExit(), and ~Mainwindow().

Here is the call graph for this function:

void Mainwindow::setInputType int  no,
InputDeviceType  type
[protected, slot]
 

Set the input type for a given player number.

Parameters:
no The player number
type The input type (Ai, Mouse, ...)

Definition at line 593 of file mainwindow.cpp.

References ACTION, createInput(), AbstractEngine::isGameRunning(), ConfigTwo::player(), and Player::setInput().

Referenced by Mainwindow().

void Mainwindow::setStartPlayer int  no  )  [protected]
 

Set-up the start player.

Parameters:
no The start player.

Definition at line 585 of file mainwindow.cpp.

References ACTION.

Referenced by menuStartplayer(), and readProperties().

void Mainwindow::startGame  )  [protected]
 

Start a new game.

Definition at line 276 of file mainwindow.cpp.

References ACTION, Player::deal(), ConfigTwo::playerIterator(), Deck::randomTrump(), Player::setDeck(), Player::setTrump(), and Deck::shuffle().

Referenced by menuNewLSkatGame().

Here is the call graph for this function:


The documentation for this class was generated from the following files:
Generated on Tue May 1 09:34:40 2007 for LSkat by  doxygen 1.4.6