Commit 09f872a0 authored by Laurent Montel's avatar Laurent Montel 😁

kdelibs4support--

parent f2f183bf
......@@ -21,7 +21,7 @@
#include "game.h"
#include "score.h"
#include <KDebug>
#include <QDebug>
#include <KLocale>
#include <QApplication>
......@@ -72,11 +72,11 @@ bool Game::start(const QString &command)
m_process.start(command.toLatin1()); // Start new process with provided command
if (!m_process.waitForStarted()) { // Blocking wait for process start
m_response = "Unable to execute command: " + command;
kDebug() << m_response;
//qDebug() << m_response;
return false;
}
m_engineCommand = command;
//kDebug() << "Game" << command << "started...";
////qDebug() << "Game" << command << "started...";
// Test if we started a GTP-compatible Go game
m_process.write("name\n");
......@@ -84,13 +84,13 @@ bool Game::start(const QString &command)
QString response = m_process.readAllStandardOutput();
if (response.isEmpty() || !response.startsWith(QLatin1String("="))) {
m_response = "Game did not respond to GTP command \"name\"";
kDebug() << m_response;
//qDebug() << m_response;
stop();
return false;
} else {
m_engineName = m_response;
}
//kDebug() << "Game is a GTP-compatible Go game";
////qDebug() << "Game is a GTP-compatible Go game";
m_process.write("version\n");
if (waitResponse()) {
......@@ -113,7 +113,7 @@ bool Game::init()
return false;
}
//kDebug() << "Init game!";
////qDebug() << "Init game!";
m_process.write("clear_board\n");
if (waitResponse()) {
......@@ -160,7 +160,7 @@ bool Game::init(const QString &fileName, int moveNumber)
if (waitResponse()) {
m_fixedHandicap = m_response.toInt();
}
//kDebug() << "Loaded komi is" << m_komi << "and handicap is" << m_fixedHandicap;
////qDebug() << "Loaded komi is" << m_komi << "and handicap is" << m_fixedHandicap;
m_consecutivePassMoveNumber = 0;
m_currentMove = moveNumber;
......@@ -247,7 +247,7 @@ bool Game::setFixedHandicap(int handicap)
return false;
}
} else {
//kWarning() << "Handicap" << handicap << " not set, it is too high!";
//qWarning() << "Handicap" << handicap << " not set, it is too high!";
return false;
}
}
......@@ -285,7 +285,7 @@ bool Game::playMove(const Player &player, const Stone &stone, bool undoable)
const Player *tmp = &player;
if (!tmp->isValid()) {
//kDebug() << "Invalid player argument, using current player!";
////qDebug() << "Invalid player argument, using current player!";
tmp = m_currentPlayer;
}
......@@ -339,7 +339,7 @@ bool Game::playMove(const Player &player, const Stone &stone, bool undoable)
undoStr = i18n("Black passed");
}
}
//kDebug() << "Push new undo command" << undoStr;
////qDebug() << "Push new undo command" << undoStr;
m_undoStack.push(new UndoCommand(player, moveType, undoStr));
}
......@@ -364,7 +364,7 @@ bool Game::generateMove(const Player &player, bool undoable)
bool boardChange = false;
const Player *tmp = &player;
if (!tmp->isValid()) {
//kDebug() << "Invalid player argument, using current player!";
////qDebug() << "Invalid player argument, using current player!";
tmp = m_currentPlayer;
}
......@@ -424,7 +424,7 @@ bool Game::generateMove(const Player &player, bool undoable)
}
if (undoable) {
//kDebug() << "Push new undo command" << undoStr;
////qDebug() << "Push new undo command" << undoStr;
m_undoStack.push(new UndoCommand(player, moveType, undoStr));
}
if (tmp->isWhite()) {
......@@ -489,17 +489,17 @@ bool Game::redoMove()
Player *player = undoCmd->player();
if (undoCmd->moveType() == UndoCommand::Passed) {
kDebug() << "Redo a pass move for" << player << undoCmd->text();
//qDebug() << "Redo a pass move for" << player << undoCmd->text();
playMove(*player, Stone(), false); // E.g. pass move
} else if (undoCmd->moveType() == UndoCommand::Resigned) {
// Note: Altough it is possible to undo after a resign and redo it,
// it is a bit questionable whether this makes sense logically.
kDebug() << "Redo a resign for" << player << undoCmd->text();
//qDebug() << "Redo a resign for" << player << undoCmd->text();
emit resigned(*player);
m_gameFinished = true;
//emit resigned(*m_currentPlayer);
} else {
kDebug() << "Redo a normal move for" << player << undoCmd->text();
//qDebug() << "Redo a normal move for" << player << undoCmd->text();
playMove(*player, Stone(undoCmd->text()), false);
}
m_undoStack.redo();
......@@ -724,7 +724,7 @@ bool Game::waitResponse(bool nonBlocking)
case QProcess::ReadError: m_response = m_process.readAllStandardError(); break;
case QProcess::UnknownError: m_response = "Unknown error!"; break;
}
kWarning() << "Command failed:" << m_response;
qWarning() << "Command failed:" << m_response;
return false;
}
......@@ -781,7 +781,7 @@ void Game::undoIndexChanged(int index)
/*int diff = index - m_lastUndoIndex;
//TODO: Fix this ugly mess!
kDebug() << "Undo stack index changed by " << diff << "...";
//qDebug() << "Undo stack index changed by " << diff << "...";
// Bigger index changed usually mean that some QUndoView got a MouseClickEvent.
// This means we have to replay more undo/redo steps than normally. If the
// difference is greater than 1 we have to replay diff-1 steps.
......@@ -805,4 +805,4 @@ void Game::setCurrentPlayer(Player &player)
} // End of namespace Kigo
#include "moc_game.cpp"
......@@ -71,4 +71,4 @@ QString Score::toString() const
} // End of namespace Kigo
#include "moc_score.cpp"
......@@ -54,4 +54,4 @@ void GeneralConfig::updateEngineCommand()
} // End of namespace Kigo
#include "moc_generalconfig.cpp"
......@@ -389,4 +389,4 @@ void GameScene::drawBackground(QPainter *painter, const QRectF &)
} // End of namespace Kigo
#include "moc_gamescene.cpp"
......@@ -74,4 +74,4 @@ void GameView::resizeEvent(QResizeEvent *event)
} // End of namespace Kigo
#include "moc_gameview.cpp"
......@@ -23,7 +23,7 @@
#include <QSvgRenderer>
#include <KPixmapCache>
#include <KDebug>
#include <QDebug>
#define USE_UNSTABLE_LIBKDEGAMESPRIVATE_API
#include <libkdegamesprivate/kgametheme.h>
......@@ -39,7 +39,7 @@ ThemeRenderer::ThemeRenderer()
{
m_cache->setCacheLimit(3 * 1024);
if (!loadTheme(Preferences::theme())) {
kDebug() << "Failed to load any game theme!";
//qDebug() << "Failed to load any game theme!";
}
}
......@@ -54,7 +54,7 @@ bool ThemeRenderer::loadTheme(const QString &themeName)
bool discardCache = !m_currentTheme.isEmpty();
if (!m_currentTheme.isEmpty() && m_currentTheme == themeName) {
// kDebug() << "Notice: Loading the same theme";
// //qDebug() << "Notice: Loading the same theme";
return true; // We don't have to do anything
}
......@@ -62,8 +62,8 @@ bool ThemeRenderer::loadTheme(const QString &themeName)
KGameTheme theme;
if (themeName.isEmpty() || !theme.load(themeName)) {
// kDebug() << "Failed to load theme" << Preferences::theme();
// kDebug() << "Trying to load default";
// //qDebug() << "Failed to load theme" << Preferences::theme();
// //qDebug() << "Trying to load default";
if (!theme.loadDefault())
return true;
......@@ -71,12 +71,12 @@ bool ThemeRenderer::loadTheme(const QString &themeName)
m_currentTheme = "default";
}
// kDebug() << "Loading" << theme.graphics();
// //qDebug() << "Loading" << theme.graphics();
if (!m_renderer->load(theme.graphics()))
return false;
if (discardCache) {
// kDebug() << "Discarding cache";
// //qDebug() << "Discarding cache";
m_cache->discard();
}
emit themeChanged(m_currentTheme);
......@@ -219,4 +219,4 @@ QSize ThemeRenderer::elementSize(Element element) const
} // End of namespace Kigo
#include "moc_themerenderer.cpp"
......@@ -39,13 +39,14 @@
#include <KStandardGameAction>
#include <KToggleAction>
#include <KUrl>
#include <KIcon>
#include <QIcon>
#define USE_UNSTABLE_LIBKDEGAMESPRIVATE_API
#include <libkdegamesprivate/kgamethemeselector.h>
#include <QDockWidget>
#include <QTimer>
#include <QUndoView>
#include <QDebug>
namespace Kigo {
......@@ -268,7 +269,7 @@ void MainWindow::finishGame()
m_undoView->setEnabled(false);
// kDebug() << "Fetching final score from engine ...";
// //qDebug() << "Fetching final score from engine ...";
Score score = m_game->estimatedScore();
QString name;
if (score.color() == 'W') {
......@@ -332,7 +333,7 @@ void MainWindow::showPreferences()
void MainWindow::applyPreferences()
{
// kDebug() << "Update settings based on changed configuration...";
// //qDebug() << "Update settings based on changed configuration...";
m_gameScene->showLabels(Preferences::showBoardLabels());
ThemeRenderer::self()->loadTheme(Preferences::theme());
......@@ -403,7 +404,7 @@ void MainWindow::setupActions()
// Game menu
m_newGameAction = KStandardGameAction::gameNew(this, SLOT(newGame()), actionCollection());
m_loadGameAction = KStandardGameAction::load(this, SLOT(loadGame()), actionCollection());
m_getMoreGamesAction = new QAction(KIcon( QLatin1String( "get-hot-new-stuff") ), i18nc("@action", "Get More Games..." ), this);
m_getMoreGamesAction = new QAction(QIcon::fromTheme( QLatin1String( "get-hot-new-stuff") ), i18nc("@action", "Get More Games..." ), this);
m_getMoreGamesAction->setShortcut(Qt::CTRL + Qt::Key_G);
m_getMoreGamesAction->setToolTip(i18nc("@action", "Get More Games..."));
connect(m_getMoreGamesAction, SIGNAL(triggered(bool)), this, SLOT(getMoreGames()));
......@@ -411,13 +412,13 @@ void MainWindow::setupActions()
m_saveAction = KStandardGameAction::save(this, SLOT(saveGame()), actionCollection());
KStandardGameAction::quit(this, SLOT(close()), actionCollection());
m_startGameAction = new QAction(KIcon( QLatin1String( "media-playback-start") ), i18nc("@action", "Start Game" ), this);
m_startGameAction = new QAction(QIcon::fromTheme( QLatin1String( "media-playback-start") ), i18nc("@action", "Start Game" ), this);
m_startGameAction->setShortcut(Qt::Key_S);
m_startGameAction->setToolTip(i18nc("@action", "Start Game"));
connect(m_startGameAction, SIGNAL(triggered(bool)), this, SLOT(startGame()));
actionCollection()->addAction( QLatin1String( "game_start" ), m_startGameAction);
m_finishGameAction = new QAction(KIcon( QLatin1String( "media-playback-stop") ), i18nc("@action", "Finish Game" ), this);
m_finishGameAction = new QAction(QIcon::fromTheme( QLatin1String( "media-playback-stop") ), i18nc("@action", "Finish Game" ), this);
m_finishGameAction->setShortcut(Qt::Key_F);
m_finishGameAction->setToolTip(i18nc("@action", "Finish Game"));
connect(m_finishGameAction, SIGNAL(triggered(bool)), this, SLOT(finishGame()));
......@@ -432,7 +433,7 @@ void MainWindow::setupActions()
m_hintAction = KStandardGameAction::hint(this, SLOT(hint()), actionCollection());
// View menu
m_moveNumbersAction = new KToggleAction(KIcon( QLatin1String( "lastmoves") ), i18nc("@action:inmenu View", "Show Move &Numbers" ), this);
m_moveNumbersAction = new KToggleAction(QIcon::fromTheme( QLatin1String( "lastmoves") ), i18nc("@action:inmenu View", "Show Move &Numbers" ), this);
m_moveNumbersAction->setShortcut(Qt::Key_N);
m_moveNumbersAction->setChecked(Preferences::showMoveNumbers());
connect(m_moveNumbersAction, SIGNAL(toggled(bool)), m_gameScene, SLOT(showMoveNumbers(bool)));
......@@ -503,4 +504,4 @@ bool MainWindow::isBackendWorking()
} // End of namespace Kigo
#include "moc_mainwindow.cpp"
......@@ -21,7 +21,7 @@
#include "errorwidget.h"
#include "preferences.h"
#include <KIcon>
#include <QIcon>
namespace Kigo {
......@@ -31,8 +31,8 @@ ErrorWidget::ErrorWidget(QWidget *parent)
{
setupUi(this);
configureButton->setIcon(KIcon( QLatin1String( "configure" )));
//QPixmap errorPixmap = KIcon( QLatin1String( "dialog-error" )).pixmap(errorLabel->height(), errorLabel->height());
configureButton->setIcon(QIcon::fromTheme( QLatin1String( "configure" )));
//QPixmap errorPixmap = QIcon::fromTheme( QLatin1String( "dialog-error" )).pixmap(errorLabel->height(), errorLabel->height());
}
void ErrorWidget::on_configureButton_clicked()
......@@ -42,4 +42,4 @@ void ErrorWidget::on_configureButton_clicked()
} // End of namespace Kigo
#include "moc_errorwidget.cpp"
......@@ -25,8 +25,8 @@
#include "gui/graphicsview/themerenderer.h"
#include <KDebug>
#include <KIcon>
#include <QDebug>
#include <QIcon>
namespace Kigo {
GameWidget::GameWidget(Game *game, QWidget *parent)
......@@ -35,7 +35,7 @@ GameWidget::GameWidget(Game *game, QWidget *parent)
Q_ASSERT(m_game);
setupUi(this);
finishButton->setIcon(KIcon( QLatin1String( "media-playback-stop" )));
finishButton->setIcon(QIcon::fromTheme( QLatin1String( "media-playback-stop" )));
connect(m_game, SIGNAL(boardInitialized()), this, SLOT(init()));
connect(m_game, SIGNAL(boardChanged()), this, SLOT(update()));
......@@ -46,7 +46,7 @@ GameWidget::GameWidget(Game *game, QWidget *parent)
void GameWidget::init()
{
if (!m_game->isRunning()) {
kDebug() << "Game is not running, no information update";
//qDebug() << "Game is not running, no information update";
return;
}
......@@ -115,5 +115,5 @@ void GameWidget::enableFinishButton()
} // End of namespace Kigo
#include "moc_gamewidget.cpp"
......@@ -24,7 +24,7 @@
#include "gui/graphicsview/themerenderer.h"
#include <QFile>
#include <KIcon>
#include <QIcon>
namespace Kigo {
SetupWidget::SetupWidget(Game *game, QWidget *parent)
......@@ -34,7 +34,7 @@ SetupWidget::SetupWidget(Game *game, QWidget *parent)
Q_ASSERT(m_game);
setupUi(this);
startButton->setIcon(KIcon( QLatin1String( "media-playback-start" )));
startButton->setIcon(QIcon::fromTheme( QLatin1String( "media-playback-start" )));
QPixmap whiteStone = ThemeRenderer::self()->renderElement(Kigo::ThemeRenderer::WhiteStone, QSize(48, 48));
whiteStoneImageLabel->setPixmap(whiteStone);
QPixmap blackStone = ThemeRenderer::self()->renderElement(Kigo::ThemeRenderer::BlackStone, QSize(48, 48));
......@@ -332,7 +332,7 @@ void SetupWidget::saveSettings()
} else if (sizeOther->isChecked()) {
Preferences::setBoardSize(sizeOtherSpinBox->value());
}
Preferences::self()->writeConfig();
Preferences::self()->save();
}
void SetupWidget::blackIsComputer(bool computer)
......@@ -347,4 +347,4 @@ void SetupWidget::whiteIsComputer(bool computer)
} // End of namespace Kigo
#include "moc_setupwidget.cpp"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment