• 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
  • config
generalconfig.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 "generalconfig.h"
22 #include "preferences.h"
23 #include "game/game.h"
24 
25 namespace Kigo {
26 
27 GeneralConfig::GeneralConfig(QWidget *parent)
28  : QWidget(parent)
29 {
30  setupUi(this);
31  kcfg_EngineCommand->hide(); // Only used internally
32 
33  QString engineCommand = Preferences::engineCommand();
34  engineExecutable->setUrl(KUrl::fromLocalFile(engineCommand.section(' ', 0, 0)));
35  connect(engineExecutable, SIGNAL(textChanged(QString)), this, SLOT(updateEngineCommand()));
36  engineParameters->setText(engineCommand.section(' ', 1));
37  connect(engineParameters, SIGNAL(textChanged(QString)), this, SLOT(updateEngineCommand()));
38 
39  updateEngineCommand();
40 }
41 
42 void GeneralConfig::updateEngineCommand()
43 {
44  kcfg_EngineCommand->setText(engineExecutable->url().toLocalFile() + ' ' + engineParameters->text());
45 
46  // Check if the configured Go engine backend actually works and tell the user
47  Game game;
48  if (game.start(kcfg_EngineCommand->text())) {
49  engineLed->setState(KLed::On);
50  } else {
51  engineLed->setState(KLed::Off);
52  }
53 }
54 
55 } // End of namespace Kigo
56 
57 #include "moc_generalconfig.cpp"
QWidget
generalconfig.h
Kigo::GeneralConfig::GeneralConfig
GeneralConfig(QWidget *parent=0)
Standard Constructor.
Definition: generalconfig.cpp:27
QWidget::setupUi
void setupUi(QWidget *widget)
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
game.h
QString
preferences.h
QString::section
QString section(QChar sep, int start, int end, QFlags< QString::SectionFlag > flags) const
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
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
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