• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdegames API Reference
  • KDE Home
  • Contact Us
 

kigo

  • sources
  • kde-4.14
  • kdegames
  • kigo
  • src
  • gui
mainwindow.cpp
Go to the documentation of this file.
1 /*
2  Copyright 2008 Sascha Peilicke <sasch.pe@gmx.de>
3 
4  This program is free software; you can redistribute it and/or
5  modify it under the terms of the GNU General Public License as
6  published by the Free Software Foundation; either version 2 of
7  the License or (at your option) version 3 or any later version
8  accepted by the membership of KDE e.V. (or its successor approved
9  by the membership of KDE e.V.), which shall act as a proxy
10  defined in Section 14 of version 3 of the license.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 #include "mainwindow.h"
22 #include "game/game.h"
23 #include "game/score.h"
24 #include "gui/config/generalconfig.h"
25 #include "gui/graphicsview/gamescene.h"
26 #include "gui/graphicsview/gameview.h"
27 #include "gui/graphicsview/themerenderer.h"
28 #include "gui/widgets/errorwidget.h"
29 #include "gui/widgets/gamewidget.h"
30 #include "gui/widgets/setupwidget.h"
31 #include "preferences.h"
32 
33 #include <KAction>
34 #include <KActionCollection>
35 #include <KConfigDialog>
36 #include <KFileDialog>
37 #include <KNS3/DownloadDialog>
38 #include <KStandardDirs>
39 #include <KStandardGameAction>
40 #include <KToggleAction>
41 
42 #define USE_UNSTABLE_LIBKDEGAMESPRIVATE_API
43 #include <libkdegamesprivate/kgamethemeselector.h>
44 
45 #include <QDockWidget>
46 #include <QTimer>
47 #include <QUndoView>
48 
49 namespace Kigo {
50 
51 MainWindow::MainWindow(const QString &fileName, QWidget *parent)
52  : KXmlGuiWindow(parent), m_game(new Game(this))
53  , m_gameScene(new GameScene(m_game)), m_gameView(new GameView(m_gameScene))
54 {
55  setCentralWidget(m_gameView);
56 
57  setupActions();
58  setupDockWindows();
59  setupGUI(QSize(800, 700), KXmlGuiWindow::ToolBar | KXmlGuiWindow::Keys |
60  KXmlGuiWindow::Save | KXmlGuiWindow::Create);
61 
62  connect(m_game, SIGNAL(waiting(bool)), this, SLOT(showBusy(bool)));
63  connect(m_game, SIGNAL(consecutivePassMovesPlayed(int)), this, SLOT(showFinishGameAction()));
64  connect(m_game, SIGNAL(resigned(Player)), this, SLOT(finishGame()));
65  connect(m_game, SIGNAL(passMovePlayed(Player)), this, SLOT(passMovePlayed(Player)));
66 
67  if (isBackendWorking()) {
68  if (!loadGame(fileName)) {
69  newGame();
70  }
71  } else {
72  backendError();
73  }
74 }
75 
76 void MainWindow::newGame()
77 {
78  m_game->start(Preferences::engineCommand());
79 
80  m_gameScene->showTerritory(false);
81  m_gameView->setInteractive(false);
82 
83  m_newGameAction->setEnabled(true);
84  m_loadGameAction->setEnabled(true);
85  m_saveAction->setEnabled(false);
86  m_startGameAction->setEnabled(true);
87  m_finishGameAction->setEnabled(false);
88 
89  m_undoMoveAction->setEnabled(false);
90  m_redoMoveAction->setEnabled(false);
91  m_passMoveAction->setEnabled(false);
92  m_hintAction->setEnabled(false);
93 
94  disconnect(m_game, SIGNAL(canRedoChanged(bool)), m_redoMoveAction, SLOT(setEnabled(bool)));
95  disconnect(m_game, SIGNAL(canUndoChanged(bool)), m_undoMoveAction, SLOT(setEnabled(bool)));
96  disconnect(m_game, SIGNAL(currentPlayerChanged(Player)), this, SLOT(playerChanged()));
97 
98  m_gameDock->setVisible(false);
99  m_gameDock->toggleViewAction()->setEnabled(false);
100  m_movesDock->setVisible(false);
101  m_movesDock->toggleViewAction()->setEnabled(false);
102  m_setupDock->setVisible(true);
103  m_errorDock->setVisible(false);
104 
105  m_setupWidget->newGame();
106  m_gameScene->showMessage(i18n("Set up a new game..."));
107 }
108 
109 void MainWindow::loadGame()
110 {
111  QString fileName = KFileDialog::getOpenFileName(KUrl(KStandardDirs::locate("appdata", "games/")), "*.sgf");
112  if (!fileName.isEmpty()) {
113  loadGame(fileName);
114  }
115 }
116 
117 bool MainWindow::loadGame(const QString &fileName)
118 {
119  if (!fileName.isEmpty() && QFile(fileName).exists()) {
120  m_game->start(Preferences::engineCommand());
121 
122  m_gameScene->showTerritory(false);
123  m_gameView->setInteractive(false);
124 
125  m_newGameAction->setEnabled(true);
126  m_loadGameAction->setEnabled(true);
127  m_saveAction->setEnabled(false);
128  m_startGameAction->setEnabled(true);
129  m_finishGameAction->setEnabled(false);
130 
131  m_undoMoveAction->setEnabled(false);
132  m_redoMoveAction->setEnabled(false);
133  m_passMoveAction->setEnabled(false);
134  m_hintAction->setEnabled(false);
135 
136  disconnect(m_game, SIGNAL(canRedoChanged(bool)), m_redoMoveAction, SLOT(setEnabled(bool)));
137  disconnect(m_game, SIGNAL(canUndoChanged(bool)), m_undoMoveAction, SLOT(setEnabled(bool)));
138  disconnect(m_game, SIGNAL(currentPlayerChanged(Player)), this, SLOT(playerChanged()));
139 
140  m_gameDock->setVisible(false);
141  m_gameDock->toggleViewAction()->setEnabled(false);
142  m_movesDock->setVisible(false);
143  m_movesDock->toggleViewAction()->setEnabled(false);
144  m_setupDock->setVisible(true);
145  m_errorDock->setVisible(false);
146 
147  m_setupWidget->loadedGame(fileName);
148  m_gameScene->showMessage(i18n("Set up a loaded game..."));
149  return true;
150  } else {
151  m_gameScene->showMessage(i18n("Unable to load game..."));
152  //Note: New game implied here
153  return false;
154  }
155 }
156 
157 void MainWindow::getMoreGames()
158 {
159  KNS3::DownloadDialog dialog("kigo-games.knsrc", this);
160  dialog.exec();
161 
162  /*KNS3::Entry::List entries = dialog.changedEntries();
163  if (entries.size() > 0) {
164  // do something with the modified entries here if you want
165  // such as rescaning your data folder or whatnot
166  }*/
167 }
168 
169 void MainWindow::backendError()
170 {
171  m_gameView->setInteractive(false);
172 
173  m_newGameAction->setEnabled(false);
174  m_loadGameAction->setEnabled(false);
175  m_saveAction->setEnabled(false);
176  m_startGameAction->setEnabled(false);
177  m_finishGameAction->setEnabled(false);
178 
179  m_undoMoveAction->setEnabled(false);
180  m_redoMoveAction->setEnabled(false);
181  m_passMoveAction->setEnabled(false);
182  m_hintAction->setEnabled(false);
183 
184  disconnect(m_game, SIGNAL(canRedoChanged(bool)), m_redoMoveAction, SLOT(setEnabled(bool)));
185  disconnect(m_game, SIGNAL(canUndoChanged(bool)), m_undoMoveAction, SLOT(setEnabled(bool)));
186  disconnect(m_game, SIGNAL(currentPlayerChanged(Player)), this, SLOT(playerChanged()));
187  m_gameDock->setVisible(false);
188  m_gameDock->toggleViewAction()->setEnabled(false);
189  m_movesDock->setVisible(false);
190  m_movesDock->toggleViewAction()->setEnabled(false);
191  m_setupDock->setVisible(false);
192  m_errorDock->setVisible(true);
193 }
194 
195 void MainWindow::saveGame()
196 {
197  QString fileName = KFileDialog::getSaveFileName(KUrl(QDir::homePath()), "*.sgf");
198 
199  if (!fileName.isEmpty()) {
200  if (m_game->save(fileName))
201  m_gameScene->showMessage(i18n("Game saved..."));
202  else
203  m_gameScene->showMessage(i18n("Unable to save game."));
204  }
205 }
206 
207 void MainWindow::startGame()
208 {
209  m_saveAction->setEnabled(true);
210  m_startGameAction->setEnabled(false);
211  m_finishGameAction->setEnabled(false);
212 
213  m_setupWidget->commit();
214 
215  //Decide on players how to display the UI
216  if (m_game->whitePlayer().isHuman() || m_game->blackPlayer().isHuman()) {
217  connect(m_game, SIGNAL(canRedoChanged(bool)), m_redoMoveAction, SLOT(setEnabled(bool)));
218  connect(m_game, SIGNAL(canUndoChanged(bool)), m_undoMoveAction, SLOT(setEnabled(bool)));
219 
220  m_passMoveAction->setEnabled(true);
221  m_hintAction->setEnabled(true);
222 
223  m_gameView->setInteractive(true);
224  m_undoView->setEnabled(true);
225 
226  m_gameScene->showPlacementMarker(true);
227  } else {
228  m_passMoveAction->setEnabled(false);
229  m_hintAction->setEnabled(false);
230 
231  m_gameView->setInteractive(false);
232  m_undoView->setEnabled(false);
233 
234  m_gameScene->showPlacementMarker(false);
235  }
236 
237  connect(m_game, SIGNAL(currentPlayerChanged(Player)), this, SLOT(playerChanged()));
238  // Trigger the slot once to make a move if the starting player
239  // (black) is a computer player.
240  playerChanged();
241 
242  m_setupDock->setVisible(false);
243  m_errorDock->setVisible(false);
244  m_gameDock->setVisible(true);
245  m_gameDock->toggleViewAction()->setEnabled(true);
246  m_movesDock->setVisible(true);
247  m_movesDock->toggleViewAction()->setEnabled(true);
248 
249  m_gameScene->showMessage(i18n("Game started..."));
250 
251  //TODO: Fix undo view clicking somehow
252  m_undoView->setEnabled(false);
253 }
254 
255 void MainWindow::finishGame()
256 {
257  m_gameView->setInteractive(false);
258  m_gameScene->showHint(false);
259  m_gameScene->showTerritory(true);
260 
261  m_undoMoveAction->setEnabled(false);
262  m_redoMoveAction->setEnabled(false);
263  m_passMoveAction->setEnabled(false);
264  m_hintAction->setEnabled(false);
265  m_startGameAction->setEnabled(false);
266  m_finishGameAction->setEnabled(false);
267 
268  m_undoView->setEnabled(false);
269 
270  // kDebug() << "Fetching final score from engine ...";
271  Score score = m_game->estimatedScore();
272  QString name;
273  if (score.color() == 'W') {
274  name = m_game->whitePlayer().name() + " (White)";
275  } else {
276  name = m_game->blackPlayer().name() + " (Black)";
277  }
278  // Show a score message that stays visible until the next
279  // popup message arrives
280  if (score.upperBound() == score.lowerBound()) {
281  m_gameScene->showMessage(i18n("%1 won with a score of %2.",
282  name, score.score()), 0);
283  } else {
284  m_gameScene->showMessage(i18n("%1 won with a score of %2 (bounds: %3 and %4).",
285  name, score.score(), score.upperBound(), score.lowerBound()), 0);
286  }
287 }
288 
289 void MainWindow::undo()
290 {
291  if (m_game->undoMove()) {
292  m_gameScene->showMessage(i18n("Undone move"));
293  m_gameScene->showHint(false);
294  }
295 }
296 
297 void MainWindow::redo()
298 {
299  if (m_game->redoMove()) {
300  m_gameScene->showMessage(i18n("Redone move"));
301  m_gameScene->showHint(false);
302  }
303 }
304 
305 void MainWindow::pass()
306 {
307  if (m_game->playMove(m_game->currentPlayer())) { // E.g. Pass move
308  //m_gameScene->showMessage(i18n("Passed move"));
309  m_gameScene->showHint(false);
310  }
311 }
312 
313 void MainWindow::hint()
314 {
315  m_gameScene->showHint(true);
316  //m_gameScene->showMessage(i18n("These are the recommended moves..."));
317 }
318 
319 void MainWindow::showPreferences()
320 {
321  if (KConfigDialog::showDialog("settings"))
322  return;
323 
324  KConfigDialog *dialog = new KConfigDialog(this, "settings", Preferences::self());
325  dialog->addPage(new GeneralConfig(), i18n("General"), "preferences-other");
326  dialog->addPage(new KGameThemeSelector(dialog, Preferences::self(), KGameThemeSelector::NewStuffDisableDownload), i18n("Themes"), "games-config-theme");
327  dialog->setHelp(QString(), "Kigo");
328  connect(dialog, SIGNAL(settingsChanged(QString)), this, SLOT(applyPreferences()));
329  dialog->show();
330 }
331 
332 void MainWindow::applyPreferences()
333 {
334  // kDebug() << "Update settings based on changed configuration...";
335  m_gameScene->showLabels(Preferences::showBoardLabels());
336 
337  ThemeRenderer::self()->loadTheme(Preferences::theme());
338 
339  if (!isBackendWorking()) {
340  backendError();
341  } else if (m_game->engineCommand() != Preferences::engineCommand()) {
342  // Restart the Go game if the game command was changed by the user.
343  m_gameScene->showMessage(i18n("Backend was changed, restart necessary..."));
344  newGame();
345  }
346 }
347 
348 void MainWindow::showBusy(bool busy)
349 {
350  //Decide on players how to display the UI
351  if (m_game->whitePlayer().isHuman() || m_game->blackPlayer().isHuman()) {
352  if (busy) {
353  m_undoMoveAction->setDisabled(true);
354  m_redoMoveAction->setDisabled(true);
355  } else {
356  // Only re-enable undo/redo if it actually makes sense
357  if (m_game->canUndo()) {
358  m_undoMoveAction->setDisabled(false);
359  }
360  if (m_game->canRedo()) {
361  m_redoMoveAction->setDisabled(false);
362  }
363  }
364  m_passMoveAction->setDisabled(busy);
365  m_hintAction->setDisabled(busy);
366  m_undoView->setEnabled(false);
367  }
368 
369  m_gameView->setInteractive(!busy);
370 }
371 
372 void MainWindow::showFinishGameAction()
373 {
374  m_finishGameAction->setEnabled(true);
375 }
376 
377 void MainWindow::playerChanged()
378 {
379  if (!m_game->currentPlayer().isHuman() && !m_game->isFinished()) {
380  QTimer::singleShot(200, this, SLOT(generateMove()));
381  }
382 }
383 
384 void MainWindow::generateMove()
385 {
386  m_game->generateMove(m_game->currentPlayer());
387 }
388 
389 void MainWindow::passMovePlayed(const Player &player)
390 {
391  if (player.isComputer()) {
392  if (player.isWhite()) {
393  m_gameScene->showMessage(i18n("White passed"));
394  } else {
395  m_gameScene->showMessage(i18n("Black passed"));
396  }
397  }
398 }
399 
400 void MainWindow::setupActions()
401 {
402  // Game menu
403  m_newGameAction = KStandardGameAction::gameNew(this, SLOT(newGame()), actionCollection());
404  m_loadGameAction = KStandardGameAction::load(this, SLOT(loadGame()), actionCollection());
405  m_getMoreGamesAction = new KAction(KIcon( QLatin1String( "get-hot-new-stuff") ), i18nc("@action", "Get More Games..." ), this);
406  m_getMoreGamesAction->setShortcut(Qt::CTRL + Qt::Key_G);
407  m_getMoreGamesAction->setToolTip(i18nc("@action", "Get More Games..."));
408  connect(m_getMoreGamesAction, SIGNAL(triggered(bool)), this, SLOT(getMoreGames()));
409  actionCollection()->addAction( QLatin1String( "get_more_games" ), m_getMoreGamesAction);
410  m_saveAction = KStandardGameAction::save(this, SLOT(saveGame()), actionCollection());
411  KStandardGameAction::quit(this, SLOT(close()), actionCollection());
412 
413  m_startGameAction = new KAction(KIcon( QLatin1String( "media-playback-start") ), i18nc("@action", "Start Game" ), this);
414  m_startGameAction->setShortcut(Qt::Key_S);
415  m_startGameAction->setToolTip(i18nc("@action", "Start Game"));
416  connect(m_startGameAction, SIGNAL(triggered(bool)), this, SLOT(startGame()));
417  actionCollection()->addAction( QLatin1String( "game_start" ), m_startGameAction);
418 
419  m_finishGameAction = new KAction(KIcon( QLatin1String( "media-playback-stop") ), i18nc("@action", "Finish Game" ), this);
420  m_finishGameAction->setShortcut(Qt::Key_F);
421  m_finishGameAction->setToolTip(i18nc("@action", "Finish Game"));
422  connect(m_finishGameAction, SIGNAL(triggered(bool)), this, SLOT(finishGame()));
423  actionCollection()->addAction( QLatin1String( "game_finish" ), m_finishGameAction);
424 
425  // Move menu
426  m_undoMoveAction = KStandardGameAction::undo(this, SLOT(undo()), actionCollection());
427  m_redoMoveAction = KStandardGameAction::redo(this, SLOT(redo()), actionCollection());
428  m_passMoveAction = KStandardGameAction::endTurn(this, SLOT(pass()), actionCollection());
429  m_passMoveAction->setText(i18nc("@action:inmenu Move", "Pass Move"));
430  m_passMoveAction->setShortcut(Qt::Key_P);
431  m_hintAction = KStandardGameAction::hint(this, SLOT(hint()), actionCollection());
432 
433  // View menu
434  m_moveNumbersAction = new KToggleAction(KIcon( QLatin1String( "lastmoves") ), i18nc("@action:inmenu View", "Show Move &Numbers" ), this);
435  m_moveNumbersAction->setShortcut(Qt::Key_N);
436  m_moveNumbersAction->setChecked(Preferences::showMoveNumbers());
437  connect(m_moveNumbersAction, SIGNAL(toggled(bool)), m_gameScene, SLOT(showMoveNumbers(bool)));
438  actionCollection()->addAction( QLatin1String( "move_numbers" ), m_moveNumbersAction);
439 
440  // Settings menu
441  KStandardAction::preferences(this, SLOT(showPreferences()), actionCollection());
442 }
443 
444 void MainWindow::setupDockWindows()
445 {
446  // Setup dock
447  m_setupDock = new QDockWidget(i18nc("@title:window", "Game Setup"), this);
448  m_setupDock->setObjectName( QLatin1String("setupDock" ));
449  m_setupDock->setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable);
450  m_setupWidget = new SetupWidget(m_game, this);
451  m_setupDock->setWidget(m_setupWidget);
452  connect(m_setupWidget, SIGNAL(startClicked()), this, SLOT(startGame()));
453  //m_setupDock->toggleViewAction()->setText(i18nc("@title:window", "Game setup"));
454  //m_setupDock->toggleViewAction()->setShortcut(Qt::Key_S);
455  //actionCollection()->addAction( QLatin1String( "show_setup_panel" ), m_setupDock->toggleViewAction());
456  addDockWidget(Qt::RightDockWidgetArea, m_setupDock);
457 
458  // Game dock
459  m_gameDock = new QDockWidget(i18nc("@title:window", "Information"), this);
460  m_gameDock->setObjectName( QLatin1String("gameDock" ));
461  m_gameDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
462  GameWidget *gameWidget = new GameWidget(m_game, this);
463  connect(gameWidget, SIGNAL(finishClicked()), this, SLOT(finishGame()));
464  m_gameDock->setWidget(gameWidget);
465  m_gameDock->toggleViewAction()->setText(i18nc("@title:window", "Information"));
466  m_gameDock->toggleViewAction()->setShortcut(Qt::Key_I);
467  actionCollection()->addAction( QLatin1String( "show_game_panel" ), m_gameDock->toggleViewAction());
468  addDockWidget(Qt::RightDockWidgetArea, m_gameDock);
469 
470  // Move history dock
471  m_movesDock = new QDockWidget(i18nc("@title:window", "Moves"), this);
472  m_movesDock->setObjectName( QLatin1String("movesDock" ));
473  m_undoView = new QUndoView(m_game->undoStack());
474  m_undoView->setEmptyLabel(i18n("No move"));
475  m_undoView->setAlternatingRowColors(true);
476  m_undoView->setFocusPolicy(Qt::NoFocus);
477  m_undoView->setEditTriggers(QAbstractItemView::NoEditTriggers);
478  m_undoView->setSelectionMode(QAbstractItemView::NoSelection);
479  m_movesDock->setWidget(m_undoView);
480  m_movesDock->toggleViewAction()->setText(i18nc("@title:window", "Moves"));
481  m_movesDock->toggleViewAction()->setShortcut(Qt::Key_M);
482  actionCollection()->addAction( QLatin1String( "show_moves_panel" ), m_movesDock->toggleViewAction());
483  addDockWidget(Qt::RightDockWidgetArea, m_movesDock);
484 
485  m_errorDock = new QDockWidget(i18nc("@title:window", "Error"), this);
486  m_errorDock->setObjectName( QLatin1String("errorDock" ));
487  m_errorDock->setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable);
488  ErrorWidget *errorWidget = new ErrorWidget(this);
489  connect(errorWidget, SIGNAL(configureClicked()), this, SLOT(showPreferences()));
490  m_errorDock->setWidget(errorWidget);
491  //m_errorDock->toggleViewAction()->setText(i18nc("@title:window", "Error"));
492  //m_errorDock->toggleViewAction()->setShortcut(Qt::Key_E);
493  //actionCollection()->addAction( QLatin1String( "show_error_panel" ), m_errorDock->toggleViewAction());
494  addDockWidget(Qt::BottomDockWidgetArea, m_errorDock);
495 }
496 
497 bool MainWindow::isBackendWorking()
498 {
499  Game game;
500  return game.start(Preferences::engineCommand());
501 }
502 
503 } // End of namespace Kigo
504 
505 #include "moc_mainwindow.cpp"
QAction::setText
void setText(const QString &text)
QWidget
generalconfig.h
Kigo::GameScene
This class provides a graphical representation of the go game using QGraphicsScene.
Definition: gamescene.h:43
QAbstractItemView::setAlternatingRowColors
void setAlternatingRowColors(bool enable)
QAbstractItemView::setSelectionMode
void setSelectionMode(QAbstractItemView::SelectionMode mode)
QDockWidget
Preferences::showBoardLabels
static bool showBoardLabels()
Get Determines whether board labels are shown.
Definition: preferences.h:87
QWidget::setFocusPolicy
void setFocusPolicy(Qt::FocusPolicy policy)
Kigo::Game::estimatedScore
Score estimatedScore()
Returns an estimate of the final score based on the current game situation.
Definition: game.cpp:706
QWidget::setVisible
virtual void setVisible(bool visible)
Kigo::SetupWidget::newGame
void newGame()
Definition: setupwidget.cpp:58
Kigo::Game::start
bool start(const QString &command="gnugo --mode gtp")
Connect to the given Go game game in GTP mode.
Definition: game.cpp:69
Kigo::Game::engineCommand
QString engineCommand() const
Definition: game.h:102
Kigo::SetupWidget::loadedGame
void loadedGame(const QString &fileName)
Definition: setupwidget.cpp:68
QDockWidget::setAllowedAreas
void setAllowedAreas(QFlags< Qt::DockWidgetArea > areas)
QFile::exists
bool exists() const
game.h
Kigo::Game::isFinished
bool isFinished() const
Definition: game.h:251
QDir::homePath
QString homePath()
Kigo::Game::canRedo
bool canRedo() const
Definition: game.h:248
Kigo::Game::canUndo
bool canUndo() const
Definition: game.h:249
QFile
Kigo::Game::whitePlayer
Player & whitePlayer()
Definition: game.h:160
Kigo::GameScene::showTerritory
void showTerritory(bool show)
Definition: gamescene.cpp:112
Kigo::ThemeRenderer::loadTheme
bool loadTheme(const QString &themeName)
Load the game theme specified by 'name'.
Definition: themerenderer.cpp:52
QUndoView::setEmptyLabel
void setEmptyLabel(const QString &label)
QWidget::setEnabled
void setEnabled(bool)
Kigo::GameScene::showHint
void showHint(bool show)
Definition: gamescene.cpp:85
gameview.h
QDockWidget::setFeatures
void setFeatures(QFlags< QDockWidget::DockWidgetFeature > features)
KXmlGuiWindow
Kigo::Game::redoMove
bool redoMove()
Definition: game.cpp:481
QGraphicsView::setInteractive
void setInteractive(bool allowed)
QObject::setObjectName
void setObjectName(const QString &name)
QString::isEmpty
bool isEmpty() const
mainwindow.h
QUndoView
QAbstractItemView::setEditTriggers
void setEditTriggers(QFlags< QAbstractItemView::EditTrigger > triggers)
QString
themerenderer.h
gamescene.h
Kigo::Player
The Player class holds all basic attributes of a Go player.
Definition: player.h:36
QSize
preferences.h
QAction::setShortcut
void setShortcut(const QKeySequence &shortcut)
Kigo::GameScene::showPlacementMarker
void showPlacementMarker(bool show)
Definition: gamescene.cpp:97
Kigo::Player::name
QString name() const
Definition: player.h:60
QDockWidget::setWidget
void setWidget(QWidget *widget)
Kigo::Game::blackPlayer
Player & blackPlayer()
Definition: game.h:162
score.h
Kigo::Player::isHuman
bool isHuman() const
Definition: player.h:74
QDockWidget::toggleViewAction
QAction * toggleViewAction() const
Kigo::MainWindow::MainWindow
MainWindow(const QString &fileName="", QWidget *parent=0)
Definition: mainwindow.cpp:51
Kigo::GameView
This class represents a view on a Go game view.
Definition: gameview.h:37
QLatin1String
Kigo::ThemeRenderer::self
static ThemeRenderer * self()
Only one ThemeRenderer is needed per application, this method returns the singleton self...
Definition: themerenderer.h:78
Preferences::theme
static QString theme()
Get The graphical theme to be used.
Definition: preferences.h:68
setupwidget.h
Kigo::Game::currentPlayer
Player & currentPlayer()
Definition: game.h:158
Preferences::showMoveNumbers
static bool showMoveNumbers()
Get Move numbers are drawn onto stones if enabled.
Definition: preferences.h:106
errorwidget.h
Preferences::self
static Preferences * self()
Definition: preferences.cpp:17
gamewidget.h
Preferences::engineCommand
static QString engineCommand()
Get The current game engine command with (optional) parameters.
Definition: preferences.h:30
Kigo::Game
The Game class implements the Go game and acts as a wrapper around a remote Go Game game implementing...
Definition: game.h:60
Kigo::Game::save
bool save(const QString &fileName)
Save the current game as a SGF file.
Definition: game.cpp:179
Kigo::Game::playMove
bool playMove(const Move &move, bool undoable=true)
Definition: game.cpp:275
Kigo::GameScene::showLabels
void showLabels(bool show)
Definition: gamescene.cpp:79
Kigo::SetupWidget::commit
void commit()
To actually commit the configured values to the Go backend, this method has to be called...
Definition: setupwidget.cpp:199
Kigo::Game::undoStack
QUndoStack * undoStack()
Definition: game.h:103
Kigo::Game::undoMove
bool undoMove()
Definition: game.cpp:444
QAction::setEnabled
void setEnabled(bool)
Kigo::GameScene::showMessage
void showMessage(const QString &message, int msecs=2000)
Definition: gamescene.cpp:102
Kigo::Game::generateMove
bool generateMove(const Player &player, bool undoable=true)
Definition: game.cpp:359
QTimer::singleShot
singleShot
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:18:29 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kigo

Skip menu "kigo"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdegames API Reference

Skip menu "kdegames API Reference"
  • granatier
  • kapman
  • kblackbox
  • kgoldrunner
  • kigo
  • kmahjongg
  • KShisen
  • ksquares
  • libkdegames
  •   highscore
  •   libkdegamesprivate
  •     kgame
  • libkmahjongg
  • palapeli
  •   libpala

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal