From 60df144e3592e11c56d38e29d0235266266d6418 Mon Sep 17 00:00:00 2001 From: Paolo Capriotti Date: Sun, 10 Feb 2008 16:57:04 +0100 Subject: [PATCH] Replaced all std::cout with kDebug. --- src/animation.cpp | 18 +++++------ src/board.cpp | 4 +-- src/chesstable.cpp | 14 ++++----- src/common.cpp | 5 +-- src/console.cpp | 26 +++++++-------- src/controllers/editgame.cpp | 23 +++++++------- src/controllers/editposition.cpp | 18 +++++------ src/engine.cpp | 15 +++++---- src/entities/engineentity.cpp | 6 ++-- src/entities/icsentity.cpp | 17 +++++----- src/gnushogiengine.cpp | 5 ++- src/hline.cpp | 8 ++--- src/hlvariant/chess/san.cpp | 2 +- src/hlvariant/shogi/legalitycheck.h | 4 +-- src/hlvariant/shogi/serializer.h | 7 +++-- src/hlvariant/tagua_wrapped.h | 8 ++--- src/hlvariant/tori-shogi/legalitycheck.h | 2 +- src/icsconnection.cpp | 32 +++++++++---------- src/loader/context.cpp | 14 ++------- src/loader/context.h | 7 +---- src/loader/image.cpp | 2 +- src/luaapi/genericwrapper.h | 6 ++-- src/luaapi/luahl.cpp | 16 +++++----- src/luaapi/options.cpp | 2 +- src/mainwindow.cpp | 14 ++++----- src/mastersettings.cpp | 4 +-- src/movelist.cpp | 22 ++++++------- src/movelist_textual.cpp | 24 +++++++------- src/option.cpp | 54 ++++++++++++++++---------------- src/pgnparser.cpp | 7 ++--- src/pref_movelist.cpp | 1 - src/pref_theme.cpp | 6 ++-- src/qconnect.cpp | 2 +- src/settings.cpp | 4 +-- src/sprite.cpp | 3 +- src/tabwidget.cpp | 4 +-- src/ui.cpp | 4 +-- src/weakset.h | 14 ++++----- src/xboardengine.cpp | 4 +-- tests/luaimage/test.cpp | 2 +- tests/options/main.cpp | 2 +- tests/test_weakset.cpp | 2 +- tests/weak_set/test_weakset.cpp | 2 +- 43 files changed, 208 insertions(+), 228 deletions(-) diff --git a/src/animation.cpp b/src/animation.cpp index 2e4d757..bbcb62e 100644 --- a/src/animation.cpp +++ b/src/animation.cpp @@ -45,15 +45,15 @@ MovementAnimation::MovementAnimation(const SpritePtr& piece, , m_state(Inactive) , m_rotate(rotate) { #ifdef ANIMATION_DEBUG - cout << "creating animation " << this << " for piece " << piece.get() << endl; + kDebug() << "creating animation " << this << " for piece " << piece.get() << endl; #endif } MovementAnimation::~MovementAnimation() { #ifdef ANIMATION_DEBUG - cout << "destroying animation " << this << " for piece " << m_piece.get() << endl; + kDebug() << "destroying animation " << this << " for piece " << m_piece.get() << endl; if (m_piece->movementAnimation().lock()) - cout << " *********** BUG **************" << endl; + kDebug() << " *********** BUG **************" << endl; #endif // m_piece->setMovementAnimation(0); } @@ -73,14 +73,14 @@ MovementAnimation::createMovement(const QPoint& from, const QPoint& to) const { void MovementAnimation::start() { #ifdef ANIMATION_DEBUG - cout << "starting movement animation " << this + kDebug() << "starting movement animation " << this << " on piece " << m_piece.get() << endl; #endif { if (shared_ptr animation = m_source->movementAnimation().lock()) { #ifdef ANIMATION_DEBUG - cout << "aborting movement animation " << animation + kDebug() << "aborting movement animation " << animation << " on piece " << m_source.get() << endl; #endif animation->abort(); @@ -119,7 +119,7 @@ Animation::State MovementAnimation::animationAdvance(int msec) { Q_ASSERT(t >= 0); #ifdef ANIMATION_DEBUG - cout << "active: t = " << t << endl; + kDebug() << "active: t = " << t << endl; #endif if (t >= 1) @@ -135,14 +135,14 @@ Animation::State MovementAnimation::animationAdvance(int msec) { } #ifdef ANIMATION_DEBUG - cout << "advance (" << this << ") state = " << m_state << endl; + kDebug() << "advance (" << this << ") state = " << m_state << endl; #endif return m_state; } void MovementAnimation::stop() { #ifdef ANIMATION_DEBUG - cout << "stopping animation " << this + kDebug() << "stopping animation " << this << " on piece " << m_piece.get() << endl; #endif m_piece->moveTo(m_destination); @@ -153,7 +153,7 @@ void MovementAnimation::stop() { void MovementAnimation::abort() { #ifdef ANIMATION_DEBUG - cout << "aborting animation " << this + kDebug() << "aborting animation " << this << " on piece " << m_piece.get() << endl; #endif m_state = Aborted; diff --git a/src/board.cpp b/src/board.cpp index 11bc31c..1ee0afd 100644 --- a/src/board.cpp +++ b/src/board.cpp @@ -356,7 +356,7 @@ bool Board::doMove(const NormalUserMove& m) { } } - std::cout << "invalid move" << std::endl; + kDebug() << "invalid move"; error(InvalidMove); return false; @@ -727,7 +727,7 @@ bool Board::dropOn(int pool, int index, const QPoint& point) { break; } - std::cout << "invalid move" << std::endl; + kDebug() << "invalid move"; error(InvalidMove); return false; } diff --git a/src/chesstable.cpp b/src/chesstable.cpp index c78a1c4..b0a0641 100644 --- a/src/chesstable.cpp +++ b/src/chesstable.cpp @@ -139,12 +139,12 @@ void ChessTable::layout(bool force_reload) { #if 0 for(::LuaApi::LuaValueMap::iterator it = lvals.begin(); it != lvals.end(); ++it) if(double* val = boost::get(&it.value())) - std::cout << "lvals[" << it.key() << "] = " << *val << std::endl; + kDebug() << "lvals[" << it.key() << "] = " << *val; else if(QPointF* val = boost::get(&it.value())) - std::cout << "lvals[" << it.key() << "] = Point(" << val->x() << "," << val->y() << ")" << std::endl; + kDebug() << "lvals[" << it.key() << "] = Point(" << val->x() << "," << val->y() << ")"; else if(QRectF* val = boost::get(&it.value())) - std::cout << "lvals[" << it.key() << "] = Rect(" << val->x() << "," << val->y() - << "," << val->width() << "," << val->height() << ")" << std::endl; + kDebug() << "lvals[" << it.key() << "] = Rect(" << val->x() << "," << val->y() + << "," << val->width() << "," << val->height() << ")"; #endif #define GET_INT(name) \ @@ -183,11 +183,11 @@ void ChessTable::layout(bool force_reload) { m_clocks[x]->resize(clock_size); m_clocks[x]->moveTo(clock0_position.x(), clock0_position.y()); -// std::cout << "moving clock " << x << " to " << clock0_position.y() << std::endl; +// kDebug() << "moving clock " << x << " to " << clock0_position.y(); m_clocks[!x]->resize(clock_size); m_clocks[!x]->moveTo(clock1_position.x(), clock1_position.y()); -// std::cout << "moving clock " << !x << " to " << clock1_position.y() << std::endl; +// kDebug() << "moving clock " << !x << " to " << clock1_position.y(); m_pools[x]->m_flipped = false; m_pools[x]->onResize(pool_piece_size, force_reload); @@ -335,7 +335,7 @@ void ChessTable::run() { } void ChessTable::displayMessage(const QString& msg) { - std::cout << msg << std::endl; + kDebug() << msg; message(msg); } diff --git a/src/common.cpp b/src/common.cpp index 85425e2..65a8f8d 100644 --- a/src/common.cpp +++ b/src/common.cpp @@ -15,12 +15,13 @@ #include #include #include +#include #include "common.h" namespace boost { void throw_exception(std::exception const &) { - std::cout << "[bug] boost exception" << std::endl; + kError() << "[bug] boost exception"; } } @@ -36,7 +37,7 @@ std::ostream &operator <<(std::ostream &os, const QString& s) { void #endif pstr(const QString& s) { - std::cout << "\"" << s << "\"" << std::endl; + kDebug() << "\"" << s << "\""; } QString qPrintf(const char* fmt, ...) { diff --git a/src/console.cpp b/src/console.cpp index 32d1e46..51f7fce 100644 --- a/src/console.cpp +++ b/src/console.cpp @@ -20,10 +20,10 @@ #include #include -#include #include -#include -#include +#include +#include +#include #include "common.h" #include "foreach.h" @@ -72,12 +72,12 @@ LuaConsoleHighlighter::LuaConsoleHighlighter() KStandardDirs* dirs = KGlobal::dirs(); QString luaHighlightingLibrary = dirs->locate("appdata", "scripts/hllib.lua"); - std::cout << "lua lib: " << luaHighlightingLibrary << std::endl; + kDebug() << "lua lib: " << luaHighlightingLibrary; m_api.runFile(qPrintable(luaHighlightingLibrary)); QStringList highlighting = dirs->findAllResources("appdata", "highlighting/*.lua", KStandardDirs::Recursive); foreach (QString f, highlighting) { - std::cout << "lua highlighting file: " << f << std::endl; + kDebug() << "lua highlighting file: " << f; m_api.runFile(qPrintable(f)); } } @@ -156,22 +156,22 @@ void ConsoleHighlighter::operator()(const QString& text, ConsoleOutput& output) if (best >= 0) { // output the portion of the text before the matching // substring -// std::cout << "outputting plain: " << text.mid(offset, best_offset - offset) << std::endl; -// std::cout << "weight = " << m_display->currentCharFormat().fontWeight() << std::endl; +// kDebug() << "outputting plain: " << text.mid(offset, best_offset - offset); +// kDebug() << "weight = " << m_display->currentCharFormat().fontWeight(); output(text.mid(offset, best_offset - offset)); // change format m_display->setCurrentCharFormat(m_patterns[best].format); // output the matching substring -// std::cout << "outputting formatted: " << text.mid(best_offset, best_length) << std::endl; -// std::cout << "weight = " << m_display->currentCharFormat().fontWeight() << std::endl; +// kDebug() << "outputting formatted: " << text.mid(best_offset, best_length); +// kDebug() << "weight = " << m_display->currentCharFormat().fontWeight(); output(text.mid(best_offset, best_length)); // restore basic format m_display->setCurrentCharFormat(m_basic_format); -// std::cout << "restored" << std::endl; -// std::cout << "weight = " << m_display->currentCharFormat().fontWeight() << std::endl; +// kDebug() << "restored"; +// kDebug() << "weight = " << m_display->currentCharFormat().fontWeight(); // update offset offset = best_offset + best_length; @@ -180,9 +180,9 @@ void ConsoleHighlighter::operator()(const QString& text, ConsoleOutput& output) } // output the last portion of the text -// std::cout << "outputting plain: " << text.mid(offset) << std::endl; +// kDebug() << "outputting plain: " << text.mid(offset); output(text.mid(offset)); -// std::cout << "weight = " << m_display->currentCharFormat().fontWeight() << std::endl; +// kDebug() << "weight = " << m_display->currentCharFormat().fontWeight(); } #endif diff --git a/src/controllers/editgame.cpp b/src/controllers/editgame.cpp index 45b4174..cddedcc 100644 --- a/src/controllers/editgame.cpp +++ b/src/controllers/editgame.cpp @@ -9,7 +9,7 @@ */ #include "editgame.h" - +#include #include "graphicalgame.h" #include "graphicalsystem.h" #include "xboardengine.h" @@ -24,7 +24,6 @@ #include "foreach.h" #include "actioncollection.h" #include "ui.h" -#include using namespace boost; @@ -153,7 +152,7 @@ EntityToken EditGameController::addPlayingEngine(int side, const shared_ptr& connection) { @@ -200,7 +199,7 @@ bool EditGameController::addICSPlayer(int side, int game_number, const shared_pt side, game_number, connection, &m_agents)); if (entity->attach()) { - std::cout << "added ICS agent " << entity.get() << std::endl; + kDebug() << "added ICS agent " << entity.get(); m_agents.addAgent(entity); m_players[side] = entity; @@ -212,12 +211,12 @@ bool EditGameController::addICSPlayer(int side, int game_number, const shared_pt m_agents.addAgent(m_clock_agent); } else { - std::cout << "** could not attach ics entity **" << std::endl; + kDebug() << "** could not attach ics entity **"; return false; } } else { - std::cout << "** could not detach entity playing " << side << "**" << std::endl; + kDebug() << "** could not detach entity playing " << side << "**"; return false; } @@ -225,7 +224,7 @@ bool EditGameController::addICSPlayer(int side, int game_number, const shared_pt } bool EditGameController::setExaminationMode(int game_number, const shared_ptr& connection) { - std::cout << "[controller " << this << "] setting examination mode" << std::endl; + kDebug() << "[controller " << this << "] setting examination mode"; if (m_players[0]->canDetach() && m_players[1]->canDetach()) { shared_ptr entity(new ExaminationEntity(m_variant, m_game, @@ -244,10 +243,10 @@ bool EditGameController::setExaminationMode(int game_number, const shared_ptrfen(0, 0) << std::endl; - std::cout << "to" << std::endl; - std::cout << action.m_to->fen(0, 0) << std::endl; + kDebug() << "undo warp from:"; + kDebug() << action.m_from->fen(0, 0); + kDebug() << "to"; + kDebug() << action.m_to->fen(0, 0); m_data.m_graphical->warp(AbstractMove::Ptr(), action.m_from); } }; @@ -319,9 +319,9 @@ bool EditPositionController::clearBoard() { bool EditPositionController::setStartingPosition() { AbstractPosition::Ptr startingPosition = m_variant->createPosition(); startingPosition->setup(); - std::cout << "adding warp to undo history:" << std::endl; - std::cout << m_graphical->position()->fen(0, 0) << std::endl; - std::cout << startingPosition->fen(0, 0) << std::endl; + kDebug() << "adding warp to undo history:"; + kDebug() << m_graphical->position()->fen(0, 0); + kDebug() << startingPosition->fen(0, 0); m_undo_history.add(WarpAction(m_graphical->position()->clone(), startingPosition)); m_graphical->warp(AbstractMove::Ptr(), startingPosition); return true; @@ -334,13 +334,13 @@ QString EditPositionController::fen() { bool EditPositionController::setFEN(const QString& fen) { AbstractPosition::Ptr pos = m_variant->createPositionFromFEN(fen); if (pos) { - std::cout << "warping to fen " << fen << std::endl; + kDebug() << "warping to fen " << fen; m_undo_history.add(WarpAction(m_graphical->position()->clone(), pos)); m_graphical->warp(AbstractMove::Ptr(), pos); return true; } else { - std::cout << "invalid fen" << std::endl; + kDebug() << "invalid fen"; return false; } } diff --git a/src/engine.cpp b/src/engine.cpp index 26096b2..59bdad5 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -14,8 +14,7 @@ #define ENGINE_DEBUG #ifdef ENGINE_DEBUG - #include - #include "common.h" + #include #endif using namespace boost; @@ -59,10 +58,10 @@ void Engine::sendCommand(const QString& command, bool echo) { os << command << "\n"; #ifdef ENGINE_DEBUG if (m_side == -1) - std::cout << "?"; + kDebug() << "?"; else - std::cout << m_side; - std::cout << "> " << command << std::endl; + kDebug() << m_side; + kDebug() << "> " << command; #endif } else { @@ -77,10 +76,10 @@ void Engine::processInput() { line.remove("\n").remove("\r"); #ifdef ENGINE_DEBUG if (m_side == -1) - std::cout << "?"; + kDebug() << "?"; else - std::cout << m_side; - std::cout << "< " << line << std::endl; + kDebug() << m_side; + kDebug() << "< " << line; #endif if (m_console) m_console->displayText(line + "\n", 0); diff --git a/src/entities/engineentity.cpp b/src/entities/engineentity.cpp index 14afe7a..83db000 100644 --- a/src/entities/engineentity.cpp +++ b/src/entities/engineentity.cpp @@ -38,7 +38,7 @@ void EngineEntity::setup() { Index index = m_game->index(); while (index != 0) { m_indexes.push(index); - std::cout << "pushed index " << index << std::endl; + kDebug() << "pushed index " << index; index = index.prev(); } @@ -46,14 +46,14 @@ void EngineEntity::setup() { // in the current variation while (!m_indexes.empty()) { PositionPtr pos = m_game->position(index); - std::cout << "REF:" << std::endl; + kDebug() << "REF:"; pos->dump(); index = m_indexes.top(); m_indexes.pop(); MovePtr move = m_game->move(index); - std::cout << "move = " << move->toString("simple", pos) << std::endl; + kDebug() << "move = " << move->toString("simple", pos); m_engine->sendMove(move, pos); } diff --git a/src/entities/icsentity.cpp b/src/entities/icsentity.cpp index b48d103..4a8582a 100644 --- a/src/entities/icsentity.cpp +++ b/src/entities/icsentity.cpp @@ -9,16 +9,15 @@ */ #include "icsentity.h" +#include #include "game.h" #include "icsconnection.h" #include "positioninfo.h" #include "poolinfo.h" #include "icsapi.h" -#include using namespace boost; - class ICSTurnPolicy : public TurnPolicy::Abstract { const ICSEntity* m_entity; public: @@ -82,10 +81,10 @@ void ICSEntity::updateGame(const Index& index, AbstractMove::Ptr icsMove, icsPos->copyPoolFrom(position); if (!position->equals(icsPos)) - std::cout << "[inconsistency] computed position differs from expected!" << std::endl; + kDebug() << "[inconsistency] computed position differs from expected!"; } else - std::cout << "[inconsistency] invalid move from server!" << std::endl; + kDebug() << "[inconsistency] invalid move from server!"; } } @@ -126,9 +125,9 @@ void ICSEntity::notifyStyle12(const PositionInfo& style12, bool is_starting) { if (position) { AbstractMove::Ptr mv = position->getMove(style12.lastMoveSAN); if (!mv || !mv->equals(last_move)) { - std::cout << + kDebug() << "[server inconsistency] SAN for last move is different from verbose notation" - << std::endl; + ; } } } @@ -157,8 +156,8 @@ void ICSEntity::notifyMoveList(int num, AbstractPosition::Ptr pos, const PGN& pg if (m_game_number != num) return; if(pos->variant() != m_variant->name()) { - std::cout << "Mismatch for move list, this variant is \"" << m_variant->name() << "\",\n" - " got move list for \"" << pos->variant() << "\"" << std::endl; + kDebug() << "Mismatch for move list, this variant is \"" << m_variant->name() << "\",\n" + " got move list for \"" << pos->variant() << "\""; return; } @@ -180,7 +179,7 @@ bool ICSEntity::canDetach() const { bool ICSEntity::attach() { // an ICS player can attach only if no move for that side has been made - //std::cout << "[ICS attach] index = " << m_game->lastMainlineIndex() << std::endl; + //kDebug() << "[ICS attach] index = " << m_game->lastMainlineIndex(); if (m_game->lastMainlineIndex() == 0) return true; if (m_game->lastMainlineIndex() == 1 && m_side == 1) { // white already played, inform black diff --git a/src/gnushogiengine.cpp b/src/gnushogiengine.cpp index 2bc1282..1483195 100644 --- a/src/gnushogiengine.cpp +++ b/src/gnushogiengine.cpp @@ -12,8 +12,7 @@ #include #include -#include - +#include #include "enginenotifier.h" #include "foreach.h" @@ -48,7 +47,7 @@ GNUShogiEngine::GNUShogiEngine(const QString& path, const QStringList& arguments } GNUShogiEngine::~GNUShogiEngine() { - std::cout << "[debug] destroying engine" << std::endl; + kDebug() << "[debug] destroying engine"; stop(); m_engine.kill(); } diff --git a/src/hline.cpp b/src/hline.cpp index 602411d..94565ea 100644 --- a/src/hline.cpp +++ b/src/hline.cpp @@ -9,18 +9,16 @@ */ #include "hline.h" - -#include "common.h" -#include +#include class TrivialExecutor : public HLineExecutor { public: virtual ~TrivialExecutor() { - std::cout << std::endl; + kDebug(); } virtual void writeChunk(const QString& text) { - std::cout << text << "|"; + kDebug() << text << "|"; } virtual void setFormat(const QTextCharFormat&) { } diff --git a/src/hlvariant/chess/san.cpp b/src/hlvariant/chess/san.cpp index 767713e..c88596e 100644 --- a/src/hlvariant/chess/san.cpp +++ b/src/hlvariant/chess/san.cpp @@ -82,7 +82,7 @@ void SAN::load(const QString& str, int& offset, int ysize) { offset += kingCastlingPattern.matchedLength(); } else { - //std::cout << "error!!!! " << str.mid(offset) << std::endl; + //kDebug() << "error!!!! " << str.mid(offset); to = Point::invalid(); } } diff --git a/src/hlvariant/shogi/legalitycheck.h b/src/hlvariant/shogi/legalitycheck.h index a8cdff9..9540eb9 100644 --- a/src/hlvariant/shogi/legalitycheck.h +++ b/src/hlvariant/shogi/legalitycheck.h @@ -173,7 +173,7 @@ bool LegalityCheck::pseudolegal(Move& move) const { return true; } else { - //std::cerr << "CANNOT MOVE: piece type cannot go there" << std::endl; + //std::cerr << "CANNOT MOVE: piece type cannot go there"; return false; } } @@ -188,7 +188,7 @@ template Piece piece = state.board().get(p); LegalityCheck check(state); if (piece.color() == state.turn() && check.getMoveType(piece, Move(p, point))) { - std::cerr << state.board().get(point).name() << " can be captured" << std::endl; + std::cerr << state.board().get(point).name() << " can be captured"; return true; } } diff --git a/src/hlvariant/shogi/serializer.h b/src/hlvariant/shogi/serializer.h index 9b2c7b5..f3f394e 100644 --- a/src/hlvariant/shogi/serializer.h +++ b/src/hlvariant/shogi/serializer.h @@ -13,6 +13,7 @@ #include #include +#include namespace HLVariant { namespace Shogi { @@ -244,7 +245,7 @@ Serializer::parse(const QString& str, int& offset, if (check.legal(mv)) { if (candidate.valid()) { // ambiguous! - std::cerr << "ambiguous !" << std::endl; + std::cerr << "ambiguous !"; return Move(); } else { @@ -258,13 +259,13 @@ Serializer::parse(const QString& str, int& offset, } if (!candidate.valid()) - std::cerr << "error - piece not found" << std::endl; + std::cerr << "error - piece not found"; offset += pattern.matchedLength(); return candidate; } else { - std::cout << "error!!!! " << qPrintable(str.mid(offset)) << std::endl; + kDebug() << "error!!!! " << qPrintable(str.mid(offset)); return Move(Point::invalid(),Point::invalid()); } } diff --git a/src/hlvariant/tagua_wrapped.h b/src/hlvariant/tagua_wrapped.h index 375eabe..3323d84 100644 --- a/src/hlvariant/tagua_wrapped.h +++ b/src/hlvariant/tagua_wrapped.h @@ -23,10 +23,10 @@ #define __FUNC__ __FUNCTION__ #endif -#define MISMATCH(x,y) (std::cout << " --> Error in "<<__FUNC__<<", MISMATCH!" << std::endl \ - << " got type " << prettyTypeName(typeid(x).name()) << std::endl \ - << " instead of " << prettyTypeName(typeid(y).name()) << std::endl \ - << " this is " << prettyTypeName(typeid(*this).name()) << std::endl) +#define MISMATCH(x,y) (kDebug() << " --> Error in "<<__FUNC__<<", MISMATCH!" \ + << " got type " << prettyTypeName(typeid(x).name()) \ + << " instead of " << prettyTypeName(typeid(y).name()) \ + << " this is " << prettyTypeName(typeid(*this).name()) ) #define DEFINE_VARIANT_FACTORY() \ VariantFactory* createFactory() { \ diff --git a/src/hlvariant/tori-shogi/legalitycheck.h b/src/hlvariant/tori-shogi/legalitycheck.h index 21d62ce..79692ab 100644 --- a/src/hlvariant/tori-shogi/legalitycheck.h +++ b/src/hlvariant/tori-shogi/legalitycheck.h @@ -157,7 +157,7 @@ bool LegalityCheck::pseudolegal(Move& move) const { return true; } else { - //std::cerr << "CANNOT MOVE: piece type cannot go there" << std::endl; + //std::cerr << "CANNOT MOVE: piece type cannot go there"; return false; } } diff --git a/src/icsconnection.cpp b/src/icsconnection.cpp index b7be6d6..0db46b2 100644 --- a/src/icsconnection.cpp +++ b/src/icsconnection.cpp @@ -87,9 +87,9 @@ bool ICSConnection::test(const QRegExp& pattern, const QString& str) { } void ICSConnection::processPartialLine(QString str) { -// std::cout << "processing (partial) " << str << std::endl; +// kDebug() << "processing (partial) " << str; if (test(fics, str)) { -// std::cout << "matched prompt" << std::endl; +// kDebug() << "matched prompt"; prompt(); } else if (test(beep, str)) { @@ -127,10 +127,10 @@ void ICSConnection::process(QString str) { int number = observed_game.cap(1).toInt(); incomingGameInfo->setGameNumber(number); m_games[number] = ICSGameData(-1, incomingGameInfo->type()); - //std::cout << "ok, obs " << number << " of type " << incomingGameInfo->type() << std::endl; + //kDebug() << "ok, obs " << number << " of type " << incomingGameInfo->type(); } else if (test(game, str)) { - //std::cout << "matched game. incomingGameInfo = " << incomingGameInfo << std::endl; + //kDebug() << "matched game. incomingGameInfo = " << incomingGameInfo; if(game.cap(4).startsWith("Creating") || game.cap(4).startsWith("Continuing") ) { if (!incomingGameInfo) { //this should really never happen, but anyway... @@ -149,7 +149,7 @@ void ICSConnection::process(QString str) { else { if (!incomingGameInfo) { int number = game.cap(1).toInt(); - //std::cout << "matching game " << number << " end" << std::endl; + //kDebug() << "matching game " << number << " end"; m_games.erase(number); QString what = game.cap(4); QString result = game.cap(5); @@ -158,7 +158,7 @@ void ICSConnection::process(QString str) { } } else if (test(unexamine, str)) { - //std::cout << "matching examined game end" << std::endl; + //kDebug() << "matching examined game end"; int gameNumber = unexamine.cap(1).toInt(); m_games.erase(gameNumber); endingExaminedGame(gameNumber); @@ -169,7 +169,7 @@ void ICSConnection::process(QString str) { endingObservedGame(gameNumber); } else if (test(move_list_start, str)) { - //std::cout << "entering move list state" << std::endl; + //kDebug() << "entering move list state"; m_move_list_game_num = move_list_start.cap(1).toInt(); state = MoveListHeader; } @@ -206,16 +206,16 @@ void ICSConnection::process(QString str) { switch (positionInfo.relation) { case PositionInfo::NotMyMove: case PositionInfo::MyMove: - //std::cout << "creating game" << std::endl; + //kDebug() << "creating game"; creatingGame(incomingGameInfo, positionInfo); break; case PositionInfo::Examining: - //std::cout << "creating examination" << std::endl; + //kDebug() << "creating examination"; creatingExaminedGame(incomingGameInfo, positionInfo); break; case PositionInfo::ObservingPlayed: case PositionInfo::ObservingExamined: - //std::cout << "creating obs " << gameNumber << " " << incomingGameInfo->type() << std::endl; + //kDebug() << "creating obs " << gameNumber << " " << incomingGameInfo->type(); creatingObservedGame(incomingGameInfo, positionInfo); break; default: @@ -249,11 +249,11 @@ void ICSConnection::process(QString str) { case MoveListHeader: if (test(move_list_players, str)){ - //std::cout << "move list players: " << str << std::endl; + //kDebug() << "move list players: " << str; m_move_list_players = move_list_players.capturedTexts(); } else if (test(move_list_game, str)){ - //std::cout << "move list game: " << str << std::endl; + //kDebug() << "move list game: " << str; if (m_move_list_game_info) delete m_move_list_game_info; @@ -275,13 +275,13 @@ void ICSConnection::process(QString str) { m_games[m_move_list_game_num].setType(move_list_game.cap(2)); } else if (test(move_list_terminator, str)) { - //std::cout << "move list ign3: " << str << std::endl; + //kDebug() << "move list ign3: " << str; } else if (test(move_list_ignore1, str)){ - //std::cout << "move list ign1: " << str << std::endl; + //kDebug() << "move list ign1: " << str; } else if (test(move_list_ignore2, str)) { - //std::cout << "move list ign2: " << str << std::endl; + //kDebug() << "move list ign2: " << str; state = MoveListMoves; } else { @@ -322,7 +322,7 @@ void ICSConnection::process(QString str) { PGN pgn(m_move_list); if (!pgn.valid()) - std::cout << "parse error on move list" << std::endl; + kDebug() << "parse error on move list"; else listener->notifyMoveList(m_move_list_game_num, p, pgn); } diff --git a/src/loader/context.cpp b/src/loader/context.cpp index 2e72d29..0d836e3 100644 --- a/src/loader/context.cpp +++ b/src/loader/context.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2006 Paolo Capriotti + Copyright (c) 2006-2008 Paolo Capriotti (c) 2006 Maurizio Monge This program is free software; you can redistribute it and/or modify @@ -8,9 +8,8 @@ (at your option) any later version. */ -#include -#include #include "common.h" +#include #include "loader/context.h" namespace Loader { @@ -39,14 +38,5 @@ Context::~Context() { Q_ASSERT(m_references.empty()); } -void Context::dump() { - for(Cache::iterator c = s_cache.begin(); c != s_cache.end(); ++c) - std::cout << "*"<< std::setiosflags(std::ios::left) - << std::setw(2) << c->second.m_ref_count - << std::setiosflags(std::ios::left) - << std::setw(50) << prettyTypeName(c->first.m_type) - << " \"" << c->first.m_name << "\"" << std::endl; -} - } //end namespace Loader diff --git a/src/loader/context.h b/src/loader/context.h index c1ce00b..9aec748 100644 --- a/src/loader/context.h +++ b/src/loader/context.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2006 Paolo Capriotti + Copyright (c) 2006-2008 Paolo Capriotti (c) 2006 Maurizio Monge This program is free software; you can redistribute it and/or modify @@ -106,11 +106,6 @@ public: s_cache[key] = Resource(data); m_references.insert(key); } - - /** - * For debugging - */ - static void dump(); }; } //end namespace Loader diff --git a/src/loader/image.cpp b/src/loader/image.cpp index a871e67..b696f10 100644 --- a/src/loader/image.cpp +++ b/src/loader/image.cpp @@ -29,7 +29,7 @@ Font::Font(int id, int size) , m_families(QFontDatabase::applicationFontFamilies(id)) , m_font(m_families.empty()?QString():m_families[0], size) { //for(int i=0;i #include "lfunclib.h" } -#include #include +#include #include "common.h" namespace Loader { class Context; } @@ -129,9 +129,9 @@ public: ~StackCheck() { if (lua_gettop(l) != top) { - std::cout << "Wrong lua stack size!\n" + kDebug() << "Wrong lua stack size!\n" " expected = " << top << "\n" - " actual = " << lua_gettop(l) << std::endl; + " actual = " << lua_gettop(l); } } }; diff --git a/src/luaapi/luahl.cpp b/src/luaapi/luahl.cpp index 5b49248..52298a4 100644 --- a/src/luaapi/luahl.cpp +++ b/src/luaapi/luahl.cpp @@ -212,17 +212,17 @@ void Api::runFile(const char* file) { if(luaL_loadfile(m_state, file) == 0) pcall(0, LUA_MULTRET); else { - std::cout << "LOADFILE FOR " << wrap_cptr(file) << " FAILED" << std::endl; - std::cout << wrap_cptr(lua_tostring(m_state, -1)) << std::endl; + kDebug() << "LOADFILE FOR " << wrap_cptr(file) << " FAILED"; + kDebug() << wrap_cptr(lua_tostring(m_state, -1)); } } else - std::cout << "FILE " << wrap_cptr(file) << " DOES NOT EXIST" << std::endl; + kDebug() << "FILE " << wrap_cptr(file) << " DOES NOT EXIST"; } void Api::pcall(int nArgs, int nResults) { if (lua_pcall(m_state, nArgs, nResults, 0) != 0) { - std::cout << "RUNTIME ERROR: " << wrap_cptr(lua_tostring(m_state, -1)) << std::endl; + kDebug() << "RUNTIME ERROR: " << wrap_cptr(lua_tostring(m_state, -1)); } } @@ -234,7 +234,7 @@ int Api::create_line(lua_State* l) { Wrapper::allocate(l, new HLine(line, QTextCharFormat())); if (lua_pcall(l, 1, 1, 0) != 0) - std::cout << "ERROR INSIDE create_line" << std::endl; + kDebug() << "ERROR INSIDE create_line"; return 1; } @@ -292,8 +292,8 @@ std::pair Api::runEvent(const QString& text, int eventIndex, QRegE lua_getglobal(m_state, "__run_event__"); if (!lua_isfunction(m_state, -1)) { - std::cout << "** ERROR: __run_event__ is corrupted (type = " << - lua_typename(m_state, lua_type(m_state, -1)) << ") **" << std::endl; + kDebug() << "** ERROR: __run_event__ is corrupted (type = " << + lua_typename(m_state, lua_type(m_state, -1)) << ") **"; lua_pop(m_state, 1); return std::pair(false, 0); } @@ -301,7 +301,7 @@ std::pair Api::runEvent(const QString& text, int eventIndex, QRegE // event lua_getglobal(m_state, "__patterns__"); if (!lua_istable(m_state, -1)) { - std::cout << "** ERROR: __patterns__ is corrupted **" << std::endl; + kDebug() << "** ERROR: __patterns__ is corrupted **"; lua_pop(m_state, 2); return std::pair(false, 0); } diff --git a/src/luaapi/options.cpp b/src/luaapi/options.cpp index 3dc415e..459412b 100644 --- a/src/luaapi/options.cpp +++ b/src/luaapi/options.cpp @@ -108,7 +108,7 @@ int Wrapper::constructor(lua_State* l) { lua_pop(l, n); // for(int i=0;isecond))) { - std::cout << " --> MainWindow::setupPGN: Error, no such variant " << var->second << std::endl; + kDebug() << " --> MainWindow::setupPGN: Error, no such variant " << var->second; return; } @@ -617,24 +617,24 @@ void MainWindow::testConnect() { void MainWindow::onEstablishConnection() { -// std::cout << "connection established" << std::endl; +// kDebug() << "connection established"; } void MainWindow::onConnectionError(int ) { -// std::cout << "connection error (" << code << ")" << std::endl; +// kDebug() << "connection error (" << code << ")"; } void MainWindow::onHostLookup() { -// std::cout << "hostLookup..." << std::flush; +// kDebug() << "hostLookup..." << std::flush; } void MainWindow::onHostFound() { -// std::cout << "found" << std::endl; +// kDebug() << "found"; } void MainWindow::sendLogin() { -// std::cout << "sending username" << std::endl; +// kDebug() << "sending username"; // connection->sendText(connection->username()); } diff --git a/src/mastersettings.cpp b/src/mastersettings.cpp index 5512cbd..0fa34bd 100644 --- a/src/mastersettings.cpp +++ b/src/mastersettings.cpp @@ -28,7 +28,7 @@ QDomElement MasterSettings::node() const { // { // QFile stub(m_filename); // if (!stub.open(QFile::WriteOnly | QFile::Text)) { -// std::cout << "Unable to write to configuration file." << std::endl; +// kDebug() << "Unable to write to configuration file."; // exit(1); // } // QTextStream stream(&stub); @@ -42,7 +42,7 @@ QDomElement MasterSettings::node() const { // exit(1); m_doc.appendChild(m_doc.createElement("configuration")); -// std::cout << m_doc.toString() << std::endl; +// kDebug() << m_doc.toString(); } diff --git a/src/movelist.cpp b/src/movelist.cpp index bf04722..769a190 100644 --- a/src/movelist.cpp +++ b/src/movelist.cpp @@ -98,8 +98,8 @@ void FancyItem::goTo(QPoint p) { old_pos = pos(); target_pos = p; time_pos = m->layout_time; - /*std::cout << m->layout_time << " start " << this << " " - << prettyTypeName(typeid(*this).name()) << std::endl;*/ + /*kDebug() << m->layout_time << " start " << this << " " + << prettyTypeName(typeid(*this).name());*/ setAnimated(true); } } @@ -125,8 +125,8 @@ void FancyItem::setHighlight(bool h) { void FancyItem::advance(int time) { Widget *m = dynamic_cast(topLevelCanvas()); - /*std::cout << time << " anim " << this << " " - << prettyTypeName(typeid(*this).name()) << std::endl;*/ + /*kDebug() << time << " anim " << this << " " + << prettyTypeName(typeid(*this).name());*/ if(time_highlight != -1) { float fact = (time - time_highlight) / m->m_settings->anim_time; if(fact >= 1.0) { @@ -152,21 +152,21 @@ void FancyItem::advance(int time) { if(time_pos != -1) { float fact = (time - time_pos) / m->m_settings->anim_time; if(fact >= 1.0) { - /*std::cout << time << " done " << this << " " - << prettyTypeName(typeid(*this).name()) << std::endl;*/ + /*kDebug() << time << " done " << this << " " + << prettyTypeName(typeid(*this).name());*/ moveTo(target_pos); time_pos = -1; } else { - /*std::cout << time << " move " << this << " " - << prettyTypeName(typeid(*this).name()) << std::endl;*/ + /*kDebug() << time << " move " << this << " " + << prettyTypeName(typeid(*this).name());*/ moveTo( int(target_pos.x()*fact + old_pos.x()*(1-fact)+0.5), int(target_pos.y()*fact + old_pos.y()*(1-fact)+0.5)); } } if(canStop()) { - /*std::cout << time << " stop " << this << " " - << prettyTypeName(typeid(*this).name()) << std::endl;*/ + /*kDebug() << time << " stop " << this << " " + << prettyTypeName(typeid(*this).name());*/ setAnimated(false); } } @@ -794,7 +794,7 @@ void Widget::doLayout() { layout_time = mSecs(); layout_pending = false; layout_max_width = 0; - //std::cout << "layout_must_relayout = " << layout_must_relayout << std::endl; + //kDebug() << "layout_must_relayout = " << layout_must_relayout; int h = layoutHistory(history, BORDER_LEFT, BORDER_TOP, -1, 0, 0, true); QSize s(std::max(entry_size*7, layout_max_width+BORDER_RIGHT), diff --git a/src/movelist_textual.cpp b/src/movelist_textual.cpp index 7c40c3c..b485769 100644 --- a/src/movelist_textual.cpp +++ b/src/movelist_textual.cpp @@ -43,12 +43,12 @@ Textual::Textual(QWidget *parent) setPluginsEnabled(false); QString fpath = KStandardDirs::locate("appdata", "scripts/movelist_textual.html"); - //std::cout << "HTML file is:"<< fpath < Error in Textual::onURL, what should i do with url \""<< u <<"\"?" << std::endl; + kDebug() << " --> Error in Textual::onURL, what should i do with url \""<< u <<"\"?"; return; } QString p = u.mid(8); Index ix = Index::fromString(p); - std::cout << "Open Link \"" << p << "\" = \"" << ix << "\"" << std::endl; + kDebug() << "Open Link \"" << p << "\" = \"" << ix << "\""; m_notifier->onUserSelectMove(ix); } @@ -93,7 +93,7 @@ void Textual::setComment(const Index& index, const QString& comment) { DOM::HTMLDocument document = htmlDocument(); DOM::Element this_cm = document.getElementById("cm_"+index); if(this_cm.isNull()) { - std::cout << " --> Error in Textual::setComment, invalid index!" << std::endl; + kDebug() << " --> Error in Textual::setComment, invalid index!"; return; } @@ -108,7 +108,7 @@ void Textual::setVComment(const Index& index, int v, const QString& comment) { DOM::HTMLDocument document = htmlDocument(); DOM::Element this_cm = document.getElementById("vk_"+index.next(v)); if(this_cm.isNull()) { - std::cout << " --> Error in Textual::setVComment, invalid index!" << std::endl; + kDebug() << " --> Error in Textual::setVComment, invalid index!"; return; } @@ -178,7 +178,7 @@ void Textual::setMove(const Index& index, int turn, const QString& move, void Textual::setMove(const Index& index, int turn, const DecoratedMove& move, const QString& comment) { - //std::cout << "i= " << index << std::endl; + //kDebug() << "i= " << index; DOM::HTMLDocument document = htmlDocument(); QString istr = (QString)index; @@ -207,7 +207,7 @@ void Textual::setMove(const Index& index, int turn, const DecoratedMove& move, prev_cm = document.getElementById("cm_"+index.prev()); prev_mv = document.getElementById("mv_"+index.prev()); if(prev_cm.isNull() || prev_mv.isNull()) { - std::cout << " --> Error in Textual::setMove, no previous move!" << std::endl; + kDebug() << " --> Error in Textual::setMove, no previous move!"; return; } } @@ -229,7 +229,7 @@ void Textual::setMove(const Index& index, int turn, const DecoratedMove& move, if(!index.nested.size()) { parent = document.body(); if(parent.isNull()) { - std::cout << "QUEEEEEEEEE!!!!!!!" << std::endl; + kDebug() << "QUEEEEEEEEE!!!!!!!"; return; } } @@ -291,7 +291,7 @@ void Textual::setMove(const Index& index, int turn, const DecoratedMove& move, Index pi = index.prev(index.nested.back().num_moves); parent = document.getElementById("vr_"+pi); if(parent.isNull()) { - std::cout << " --> Error in Textual::setMove, no variation?!?!?" << std::endl; + kDebug() << " --> Error in Textual::setMove, no variation?!?!?"; return; } } @@ -329,11 +329,11 @@ void Textual::setMove(const Index& index, int turn, const DecoratedMove& move, ::Loader::Glyph g = m_loader.getValue< ::Loader::Glyph>(move[i].m_string); DOM::Element el = document.createElement("span"); #if 1 - std::cout << "size = " << QString("%1%").arg(g.m_font.pointSize()*100/12) << std::endl; + kDebug() << "size = " << QString("%1%").arg(g.m_font.pointSize()*100/12); el.style().setProperty("font-size", QString("%1%").arg(g.m_font.pointSize()*100/12), "important"); el.style().setProperty("line-height", QString("%1%").arg(g.m_font.pointSize()*100/12), "important"); #endif - std::cout << "familiy = " << g.m_font.family() << std::endl; + kDebug() << "familiy = " << g.m_font.family(); el.style().setProperty("font-weight", "normal", "important"); el.style().setProperty("font-family", g.m_font.family(), "important"); DOM::Text t = document.createTextNode(QString(g.m_char)); diff --git a/src/option.cpp b/src/option.cpp index 80637e4..4e4a8f6 100644 --- a/src/option.cpp +++ b/src/option.cpp @@ -247,70 +247,70 @@ fail: } void dump_options_list(const OptList& options, int indent) { - if(!indent)std::cout << "---- begin dump ----" << std::endl; + if(!indent)kDebug() << "---- begin dump ----"; for(int i=0;i(_o)) { - for(int j=0;jvalue()?"[X]":"[ ]") << " " << o->label() << std::endl; + for(int j=0;jvalue()?"[X]":"[ ]") << " " << o->label(); dump_options_list(o->subOptions(), indent+1); } else if(IntOptPtr o = boost::dynamic_pointer_cast(_o)) { - for(int j=0;jlabel() << " |" << o->value() << "|" << std::endl; + for(int j=0;jlabel() << " |" << o->value() << "|"; } else if(StringOptPtr o = boost::dynamic_pointer_cast(_o)) { - for(int j=0;jlabel() << " [" << o->value() << "]" << std::endl; + for(int j=0;jlabel() << " [" << o->value() << "]"; } else if(UrlOptPtr o = boost::dynamic_pointer_cast(_o)) { - for(int j=0;jlabel() << " {" << o->value() << "}" << std::endl; + for(int j=0;jlabel() << " {" << o->value() << "}"; } else if(ColorOptPtr o = boost::dynamic_pointer_cast(_o)) { - for(int j=0;jlabel() << " {" << o->value().name() << "}" << std::endl; + for(int j=0;jlabel() << " {" << o->value().name() << "}"; } else if(FontOptPtr o = boost::dynamic_pointer_cast(_o)) { - for(int j=0;jlabel() << " {" << o->value().toString() << "}" << std::endl; + for(int j=0;jlabel() << " {" << o->value().toString() << "}"; } else if(ComboOptPtr o = boost::dynamic_pointer_cast(_o)) { - for(int j=0;jlabel() << std::endl; + for(int j=0;jlabel(); for(int k=0;kvalues().size();k++) { - for(int j=0;jselected()) - std::cout << " *<" << o->values()[k] << ">*" << std::endl; + kDebug() << " *<" << o->values()[k] << ">*"; else - std::cout << " <" << o->values()[k] << ">" << std::endl; + kDebug() << " <" << o->values()[k] << ">"; } } else if(SelectOptPtr o = boost::dynamic_pointer_cast(_o)) { - for(int j=0;jlabel() << std::endl; + for(int j=0;jlabel(); for(int j=0;joptions().size();j++) { BoolOptPtr so = o->options()[j]; - for(int j=0;jvalue()?"(*)":"( )") << " " << so->label() << std::endl; + for(int j=0;jvalue()?"(*)":"( )") << " " << so->label(); if(so->subOptions().size()) dump_options_list(so->subOptions(), indent+2); } } else { - std::cout << "dump_options_list: Error, unknown option of type " - << prettyTypeName(typeid(*_o).name()) << std::endl; + kDebug() << "dump_options_list: Error, unknown option of type " + << prettyTypeName(typeid(*_o).name()); } } - if(!indent)std::cout << "---- end dump ----" << std::endl; + if(!indent)kDebug() << "---- end dump ----"; } bool options_list_load_from_settings(OptList& options, const Settings& s) { @@ -373,7 +373,7 @@ bool options_list_load_from_settings(OptList& options, const Settings& s) { o->setSelected( newval ); } else - kError() << "option of type" << prettyTypeName(typeid(*_o).name()) ; + kError() << "option of type" << prettyTypeName(typeid(*_o).name()); } return retv; } @@ -421,6 +421,6 @@ void options_list_save_to_settings(const OptList& options, Settings s) { sel_group["value"] = o->value(); } else - kError() << "option of type" << prettyTypeName(typeid(*_o).name()) ; + kError() << "option of type" << prettyTypeName(typeid(*_o).name()); } } diff --git a/src/pgnparser.cpp b/src/pgnparser.cpp index 5f062c3..d2f3fa9 100644 --- a/src/pgnparser.cpp +++ b/src/pgnparser.cpp @@ -8,10 +8,9 @@ (at your option) any later version. */ -#include -#include #include "pgnparser.h" -#include "common.h" +#include +#include QRegExp PGN::number("^(\\d+)(?:(?:\\.\\s+)?(\\.\\.\\.)|\\.?)?"); QRegExp PGN::begin_var("^\\("); @@ -102,7 +101,7 @@ bool PGN::parse(const QString& pgn) { } // parse error! - std::cout << "pgn parse error! at" << pgn.mid(offset, 100) << std::endl; + kDebug() << "pgn parse error! at" << pgn.mid(offset, 100); return false; } diff --git a/src/pref_movelist.cpp b/src/pref_movelist.cpp index b916418..c805699 100644 --- a/src/pref_movelist.cpp +++ b/src/pref_movelist.cpp @@ -13,7 +13,6 @@ #include "movelist_p.h" #include "pref_movelist.h" - PrefMoveList::PrefMoveList(const QString&, QWidget *parent) : QWidget(parent) { diff --git a/src/pref_theme.cpp b/src/pref_theme.cpp index 832a69c..e824a37 100644 --- a/src/pref_theme.cpp +++ b/src/pref_theme.cpp @@ -24,7 +24,7 @@ PrefTheme::ThemeInfoList PrefTheme::to_theme_info_list(const QStringList& files, const Settings& s) { - //std::cout << "about to examine " << files.size() << " desktop files" << std::endl; + //kDebug() << "about to examine " << files.size() << " desktop files"; std::map cached_info; SettingArray themes = s.group("themes").array("theme"); @@ -76,7 +76,7 @@ PrefTheme::ThemeInfoList PrefTheme::to_theme_info_list(const QStringList& files, OptList PrefTheme::get_file_options(const QString& f, bool reload_defaults) { - //std::cout << "get file options for " << f << std::endl; + //kDebug() << "get file options for " << f; if(!reload_defaults) { std::map::iterator it = m_new_theme_options.find(f); @@ -163,7 +163,7 @@ PrefTheme::PrefTheme(const QString& currentVariant, QWidget *parent) cached_theme_info.group(cit->first) ); - //std::cout << "loaded " << c->m_themes.size() << " themes" << std::endl; + //kDebug() << "loaded " << c->m_themes.size() << " themes"; } QStringList all = Variants::instance().all(); diff --git a/src/qconnect.cpp b/src/qconnect.cpp index 680c025..7ee180b 100644 --- a/src/qconnect.cpp +++ b/src/qconnect.cpp @@ -34,7 +34,7 @@ QConnect::QConnect(QWidget *parent, const char *name) connect(buttonTimesealPath, SIGNAL(clicked()), this, SLOT(setTimesealPath())); chkTimesealCmd->setToolTip(timeseal_cmd_tool_tip); editTimesealCmd->setToolTip(timeseal_cmd_tool_tip); - //std::cout << "initializing dialog" << std::endl; + //kDebug() << "initializing dialog"; Settings s_ics = settings().group("ics"); if (s_ics["username"]) diff --git a/src/settings.cpp b/src/settings.cpp index 5196183..d38f00b 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -103,8 +103,8 @@ void Settings::ensureExistence(QDomElement& node, QDomElement parent, const QStr } bool Settings::flag(const QString& attr, bool def) const { - //std::cout << "get flag " << node().isNull() << " " << attr << " = " - //<< node().attribute(attr, def ? "true" : "false") << std::endl; + //kDebug() << "get flag " << node().isNull() << " " << attr << " = " + //<< node().attribute(attr, def ? "true" : "false"); return node().attribute(attr, def ? "true" : "false") == "true"; } diff --git a/src/sprite.cpp b/src/sprite.cpp index 4e1c41d..fc007eb 100644 --- a/src/sprite.cpp +++ b/src/sprite.cpp @@ -10,6 +10,7 @@ #include #include +#include #include #include #include @@ -64,7 +65,7 @@ Sprite* Sprite::duplicate() const { } void Sprite::setThumb(const QImage& thumb) { - std::cout << "setting thumb" << std::endl; + kDebug() << "setting thumb"; QPixmap pix = m_pixmap; int width = pix.width() / 2; int height = pix.height() / 2; diff --git a/src/tabwidget.cpp b/src/tabwidget.cpp index bf553cf..32b39df 100644 --- a/src/tabwidget.cpp +++ b/src/tabwidget.cpp @@ -33,14 +33,14 @@ TabWidget::TabWidget(QWidget* parent) // void TabWidget::insertTab(int index, QWidget* widget, const QString& caption) { // KTabWidget::insertTab(index, widget, caption); -// std::cout << "showing" << std::endl; +// kDebug() << "showing"; // if (count() > 1) // setTabBarHidden(false); // } // // void TabWidget::removeTab(int index) { // KTabWidget::removeTab(index); -// std::cout << "hiding" << std::endl; +// kDebug() << "hiding"; // if (count() <= 1) // setTabBarHidden(true); // } diff --git a/src/ui.cpp b/src/ui.cpp index e9aa536..9286c6e 100644 --- a/src/ui.cpp +++ b/src/ui.cpp @@ -8,11 +8,11 @@ (at your option) any later version. */ -#include #include #include #include #include +#include #include "ui.h" #include "controllers/abstract.h" #include "graphicalgame.h" @@ -78,7 +78,7 @@ void UI::setController(const shared_ptr& controller) { void UI::removeController(QWidget* w) { controller()->end(); - std::cout << "removing controller " << w << std::endl; + kDebug() << "removing controller " << w; m_controller.erase(w); } diff --git a/src/weakset.h b/src/weakset.h index 34f3faa..70a6b0c 100644 --- a/src/weakset.h +++ b/src/weakset.h @@ -46,7 +46,7 @@ public: void skip_garbage() { #ifdef WEAK_SET_DEBUG - cout << "skipping garbage" << endl; + kDebug() << "skipping garbage" << endl; uint c = 0; #endif // WEAK_SET_DEBUG while (true) { @@ -56,13 +56,13 @@ public: // while (m_it != m_parent.m_set.end() && !(obj = (*m_it).lock())) { #ifdef WEAK_SET_DEBUG - cout << "iteration " << c++ << endl; + kDebug() << "iteration " << c++ << endl; #endif // WEAK_SET_DEBUG // the current reference is dangling: // remove it from the list and get the next one #ifdef WEAK_SET_DEBUG - cout << "dangling reference! removing it" << endl; + kDebug() << "dangling reference! removing it" << endl; #endif // WEAK_SET_DEBUG m_it = m_parent.m_set.erase(m_it); } @@ -72,9 +72,9 @@ public: // m_it == m_parent.m_set.end() #ifdef WEAK_SET_DEBUG if (obj) - cout << "no iteration done: uses = " << obj.use_count() << ", obj = " << *obj << endl; + kDebug() << "no iteration done: uses = " << obj.use_count() << ", obj = " << *obj << endl; else - cout << "we're at the end" << endl; + kDebug() << "we're at the end" << endl; #endif // WEAK_SET_DEBUG } public: @@ -95,13 +95,13 @@ public: */ iterator& operator++() { #ifdef WEAK_SET_DEBUG - cout << "incrementing" << endl; + kDebug() << "incrementing" << endl; #endif // WEAK_SET_DEBUG ++m_it; obj.reset(); skip_garbage(); #ifdef WEAK_SET_DEBUG - cout << "done incrementing" << endl; + kDebug() << "done incrementing" << endl; #endif // WEAK_SET_DEBUG return *this; } diff --git a/src/xboardengine.cpp b/src/xboardengine.cpp index 0319d62..1e415f0 100644 --- a/src/xboardengine.cpp +++ b/src/xboardengine.cpp @@ -10,9 +10,9 @@ #include "xboardengine.h" +#include #include #include -#include #include "enginenotifier.h" #include "foreach.h" @@ -48,7 +48,7 @@ XBoardEngine::XBoardEngine(const QString& path, const QStringList& arguments) } XBoardEngine::~XBoardEngine() { - std::cout << "[debug] destroying engine" << std::endl; + kDebug() << "[debug] destroying engine"; stop(); m_engine.kill(); } diff --git a/tests/luaimage/test.cpp b/tests/luaimage/test.cpp index 1064a1e..04dab03 100644 --- a/tests/luaimage/test.cpp +++ b/tests/luaimage/test.cpp @@ -57,7 +57,7 @@ void mkWidget(QImage img) int main(int argc, char *argv[]) { QApplication app(argc, argv); - //std::cout << "Va a cagare " << QDir::cleanPath("pqr/abc/../xyz") << std::endl; + //kDebug()()() << "Va a cagare " << QDir::cleanPath("pqr/abc/../xyz") << std::endl; #if 0 LoadingContext* x = new LoadingContext; diff --git a/tests/options/main.cpp b/tests/options/main.cpp index 39a70be..7b61910 100644 --- a/tests/options/main.cpp +++ b/tests/options/main.cpp @@ -40,7 +40,7 @@ int main(int argc, char *argv[]) { ja.runFile("test.lua"); OptList opts2 = ja.getOptList("options"); if(ja.error()) - std::cout << ja.errorString() << std::endl; + kDebug()()() << ja.errorString() << std::endl; else { /*sets.qSettings()->beginGroup("o2"); options_list_load_from_settings(opts2, sets); diff --git a/tests/test_weakset.cpp b/tests/test_weakset.cpp index 7a7e632..cc43d11 100644 --- a/tests/test_weakset.cpp +++ b/tests/test_weakset.cpp @@ -25,7 +25,7 @@ void test_insertion() { void test_garbage_collection() { #ifdef WEAK_SET_DEBUG - cout << "\n\ntesting garbage collection\n\n" << endl; + kDebug()() << "\n\ntesting garbage collection\n\n" << endl; #endif // WEAK_SET_DEBUG weak_set s; diff --git a/tests/weak_set/test_weakset.cpp b/tests/weak_set/test_weakset.cpp index dd1b704..7c11dfc 100644 --- a/tests/weak_set/test_weakset.cpp +++ b/tests/weak_set/test_weakset.cpp @@ -24,7 +24,7 @@ void test_insertion() { void test_garbage_collection() { #ifdef WEAK_SET_DEBUG - cout << "\n\ntesting garbage collection\n\n" << endl; + kDebug()() << "\n\ntesting garbage collection\n\n" << endl; #endif // WEAK_SET_DEBUG weak_set s; -- 2.11.4.GIT