diff --git a/dic/automaton.cpp b/dic/automaton.cpp index de465b5..ccb8057 100644 --- a/dic/automaton.cpp +++ b/dic/automaton.cpp @@ -39,6 +39,10 @@ using namespace std; + +INIT_LOGGER(dic, Automaton); + + #ifdef DEBUG_AUTOMATON # define DMSG(a) (a) #else diff --git a/dic/automaton.h b/dic/automaton.h index 77ff674..9f8d823 100644 --- a/dic/automaton.h +++ b/dic/automaton.h @@ -21,11 +21,14 @@ #ifndef DIC_AUTOMATON_H_ #define DIC_AUTOMATON_H_ +#include "logging.h" + class AutomatonHelper; struct searchRegExpLists; class Automaton { + DEFINE_LOGGER(); public: /// Constructor /** diff --git a/dic/compdic.cpp b/dic/compdic.cpp index 462d562..d677f27 100644 --- a/dic/compdic.cpp +++ b/dic/compdic.cpp @@ -66,6 +66,7 @@ INIT_LOGGER(dic, CompDic); + CompDic::CompDic() : m_currentRec(0), m_maxRec(0), m_loadTime(0), m_buildTime(0) { diff --git a/dic/compdic.h b/dic/compdic.h index 5f63c5a..5014ed1 100644 --- a/dic/compdic.h +++ b/dic/compdic.h @@ -26,9 +26,9 @@ #include #include -#include "logging.h" #include "header.h" #include "dic_internals.h" +#include "logging.h" class DicEdge; class DictHeaderInfo; diff --git a/dic/dic.cpp b/dic/dic.cpp index 56f540f..2043634 100644 --- a/dic/dic.cpp +++ b/dic/dic.cpp @@ -48,6 +48,9 @@ #include "tile.h" +INIT_LOGGER(dic, Dictionary); + + const Dictionary *Dictionary::m_dic = NULL; diff --git a/dic/dic.h b/dic/dic.h index 0feb081..9d8f52c 100644 --- a/dic/dic.h +++ b/dic/dic.h @@ -28,6 +28,7 @@ #include #include "tile.h" +#include "logging.h" using namespace std; @@ -59,6 +60,7 @@ typedef wstring wistring; class Dictionary { + DEFINE_LOGGER(); public: /** * Dictionary creation and loading from a file diff --git a/dic/header.cpp b/dic/header.cpp index afb4f05..a918f58 100644 --- a/dic/header.cpp +++ b/dic/header.cpp @@ -56,6 +56,9 @@ using boost::format; using boost::wformat; +INIT_LOGGER(dic, Header); + + #if defined(WORDS_BIGENDIAN) // Nothing to do on big-endian machines # define ntohll(x) (x) diff --git a/dic/header.h b/dic/header.h index fd0e61d..751ba20 100644 --- a/dic/header.h +++ b/dic/header.h @@ -27,6 +27,8 @@ #include #include +#include "logging.h" + using namespace std; // XXX: duplicated typedef (also present in dic.h) @@ -76,6 +78,7 @@ struct DictHeaderInfo */ class Header { + DEFINE_LOGGER(); public: /// Dictionary type diff --git a/dic/listdic.cpp b/dic/listdic.cpp index 69465aa..c979d14 100644 --- a/dic/listdic.cpp +++ b/dic/listdic.cpp @@ -35,6 +35,10 @@ using namespace std; + +INIT_LOGGER(dic, ListDic); + + static void printDicRec(ostream &out, const Dictionary &iDic, const wchar_t * const buf, wchar_t *s, DicEdge edge) { if (edge.term) /* edge points at a complete word */ diff --git a/dic/listdic.h b/dic/listdic.h index db60c45..83246b3 100644 --- a/dic/listdic.h +++ b/dic/listdic.h @@ -23,6 +23,8 @@ #include +#include "logging.h" + class Dictionary; @@ -31,7 +33,7 @@ using namespace std; class ListDic { - + DEFINE_LOGGER(); public: ListDic(); diff --git a/dic/stacktrace.cpp b/dic/stacktrace.cpp index dc1c4da..6c95772 100644 --- a/dic/stacktrace.cpp +++ b/dic/stacktrace.cpp @@ -36,6 +36,9 @@ using namespace std; +INIT_LOGGER(dic, StackTrace); + + string StackTrace::GetStack() { #if defined HAVE_EXECINFO_H && defined(DEBUG) diff --git a/dic/stacktrace.h b/dic/stacktrace.h index 3fbb866..3376128 100644 --- a/dic/stacktrace.h +++ b/dic/stacktrace.h @@ -23,11 +23,14 @@ #include +#include "logging.h" + using std::string; class StackTrace { + DEFINE_LOGGER(); public: static string GetStack(); diff --git a/dic/tile.cpp b/dic/tile.cpp index 6e5c821..42088ec 100644 --- a/dic/tile.cpp +++ b/dic/tile.cpp @@ -29,6 +29,9 @@ #include "dic_exception.h" +INIT_LOGGER(dic, Tile); + + const Header * Tile::m_header = NULL; Tile Tile::m_TheJoker; diff --git a/dic/tile.h b/dic/tile.h index bea66c1..093ef70 100644 --- a/dic/tile.h +++ b/dic/tile.h @@ -26,6 +26,8 @@ #include #include +#include "logging.h" + using namespace std; class Header; @@ -37,6 +39,7 @@ class Header; */ class Tile { + DEFINE_LOGGER(); friend class Dictionary; public: diff --git a/game/ai_percent.cpp b/game/ai_percent.cpp index dad3ee0..098152e 100644 --- a/game/ai_percent.cpp +++ b/game/ai_percent.cpp @@ -28,6 +28,9 @@ #include "ai_percent.h" +INIT_LOGGER(game, AIPercent); + + AIPercent::AIPercent(float iPercent) { if (iPercent < 0) diff --git a/game/ai_percent.h b/game/ai_percent.h index ce70dfc..4c5c95c 100644 --- a/game/ai_percent.h +++ b/game/ai_percent.h @@ -23,6 +23,7 @@ #include "ai_player.h" #include "results.h" +#include "logging.h" /** * This kind of AI is parameterized by a percentage p. @@ -37,6 +38,7 @@ */ class AIPercent: public AIPlayer { + DEFINE_LOGGER(); public: /// Constructor, taking the percentage (0.0 <= iPercent <= 1.0) AIPercent(float iPercent); diff --git a/game/bag.cpp b/game/bag.cpp index febe86c..e683cf2 100644 --- a/game/bag.cpp +++ b/game/bag.cpp @@ -31,6 +31,9 @@ #include "encoding.h" +INIT_LOGGER(game, Bag); + + Bag::Bag(const Dictionary &iDic) : m_dic(iDic), m_ntiles(0) { diff --git a/game/bag.h b/game/bag.h index ea4bfbe..093db8b 100644 --- a/game/bag.h +++ b/game/bag.h @@ -24,6 +24,7 @@ #include #include "tile.h" +#include "logging.h" using std::map; @@ -35,6 +36,7 @@ class Dictionary; */ class Bag { + DEFINE_LOGGER(); public: explicit Bag(const Dictionary &iDic); diff --git a/game/board.cpp b/game/board.cpp index 154af38..68e1bd8 100644 --- a/game/board.cpp +++ b/game/board.cpp @@ -42,6 +42,9 @@ #define W3 3 +INIT_LOGGER(game, Board); + + const int Board::m_tileMultipliers[BOARD_REALDIM][BOARD_REALDIM] = { { oo,oo,oo,oo,oo,oo,oo,oo,oo,oo,oo,oo,oo,oo,oo,oo,oo }, diff --git a/game/board.h b/game/board.h index b098f90..2831995 100644 --- a/game/board.h +++ b/game/board.h @@ -27,6 +27,7 @@ #include "matrix.h" #include "tile.h" #include "cross.h" +#include "logging.h" class GameParams; class Dictionary; @@ -50,6 +51,7 @@ using namespace std; */ class Board { + DEFINE_LOGGER(); public: Board(const GameParams &iParams); diff --git a/game/command.cpp b/game/command.cpp index 88901f3..98f0022 100644 --- a/game/command.cpp +++ b/game/command.cpp @@ -22,6 +22,9 @@ #include "debug.h" +INIT_LOGGER(game, Command); + + Command::Command() : m_executed(false), m_autoExecution(true) { diff --git a/game/command.h b/game/command.h index c325248..e478eee 100644 --- a/game/command.h +++ b/game/command.h @@ -23,6 +23,8 @@ #include +#include "logging.h" + using std::wstring; @@ -32,6 +34,8 @@ using std::wstring; */ class Command { + DEFINE_LOGGER(); + public: Command(); virtual ~Command() {} diff --git a/game/coord.cpp b/game/coord.cpp index 3747b82..bc58813 100644 --- a/game/coord.cpp +++ b/game/coord.cpp @@ -28,6 +28,9 @@ #include "encoding.h" +INIT_LOGGER(game, Coord); + + Coord::Coord(int iRow, int iCol, Direction iDir) { m_row = iRow; diff --git a/game/coord.h b/game/coord.h index 0142ba4..650ab6d 100644 --- a/game/coord.h +++ b/game/coord.h @@ -24,6 +24,8 @@ #include +#include "logging.h" + using std::wstring; @@ -33,6 +35,7 @@ using std::wstring; */ class Coord { + DEFINE_LOGGER(); public: enum Direction {VERTICAL, HORIZONTAL}; diff --git a/game/cross.cpp b/game/cross.cpp index 27087d5..138f022 100644 --- a/game/cross.cpp +++ b/game/cross.cpp @@ -26,6 +26,9 @@ #define CROSS_MASK 0xFFFFFFFF +INIT_LOGGER(game, Cross); + + Cross::Cross() { // The default behaviour is to match everything diff --git a/game/cross.h b/game/cross.h index ef7ba7e..b2973db 100644 --- a/game/cross.h +++ b/game/cross.h @@ -24,6 +24,7 @@ #include #include "tile.h" +#include "logging.h" using namespace std; @@ -35,6 +36,7 @@ using namespace std; // TODO: implement using the bitset class class Cross { + DEFINE_LOGGER(); public: Cross(); diff --git a/game/game_move_cmd.cpp b/game/game_move_cmd.cpp index 8ffb581..bb3a76c 100644 --- a/game/game_move_cmd.cpp +++ b/game/game_move_cmd.cpp @@ -28,6 +28,9 @@ #include "turn.h" +INIT_LOGGER(game, GameMoveCmd); + + GameMoveCmd::GameMoveCmd(Game &ioGame, const Move &iMove, unsigned int iPlayerId) : m_game(ioGame), m_move(iMove), diff --git a/game/game_move_cmd.h b/game/game_move_cmd.h index 5383506..ab4c178 100644 --- a/game/game_move_cmd.h +++ b/game/game_move_cmd.h @@ -25,6 +25,7 @@ #include "move.h" #include "pldrack.h" #include "round.h" +#include "logging.h" class Game; @@ -42,6 +43,8 @@ class Game; */ class GameMoveCmd: public Command { + DEFINE_LOGGER(); + public: GameMoveCmd(Game &ioGame, const Move &iMove, unsigned int iPlayerId); diff --git a/game/history.cpp b/game/history.cpp index 36d6baf..9dc3c86 100644 --- a/game/history.cpp +++ b/game/history.cpp @@ -31,6 +31,9 @@ #include "debug.h" +INIT_LOGGER(game, History); + + History::History() { Turn* t = new Turn(); diff --git a/game/history.h b/game/history.h index 75f289a..49a15f2 100644 --- a/game/history.h +++ b/game/history.h @@ -25,6 +25,8 @@ #include #include +#include "logging.h" + using std::wstring; using std::vector; @@ -52,7 +54,8 @@ class PlayedRack; */ class History { - public: + DEFINE_LOGGER(); +public: History(); ~History(); diff --git a/game/mark_played_cmd.cpp b/game/mark_played_cmd.cpp index 018dbb8..f16b53b 100644 --- a/game/mark_played_cmd.cpp +++ b/game/mark_played_cmd.cpp @@ -25,6 +25,9 @@ using namespace std; +INIT_LOGGER(game, MarkPlayedCmd); + + MarkPlayedCmd::MarkPlayedCmd(Duplicate &ioDuplicate, unsigned int iPlayerId, bool iPlayedFlag) diff --git a/game/mark_played_cmd.h b/game/mark_played_cmd.h index d6c8120..dcde6a2 100644 --- a/game/mark_played_cmd.h +++ b/game/mark_played_cmd.h @@ -22,6 +22,7 @@ #define MARK_PLAYED_CMD_H_ #include "command.h" +#include "logging.h" class Duplicate; @@ -32,6 +33,8 @@ class Duplicate; */ class MarkPlayedCmd: public Command { + DEFINE_LOGGER(); + public: MarkPlayedCmd(Duplicate &ioDuplicate, unsigned int iPlayerId, diff --git a/game/master_move_cmd.cpp b/game/master_move_cmd.cpp index ce201b2..69f4c50 100644 --- a/game/master_move_cmd.cpp +++ b/game/master_move_cmd.cpp @@ -25,6 +25,9 @@ using namespace std; +INIT_LOGGER(game, MasterMoveCmd); + + MasterMoveCmd::MasterMoveCmd(Duplicate &ioDuplicate, const Move &iMove) : m_duplicateGame(ioDuplicate), m_newMove(iMove) diff --git a/game/master_move_cmd.h b/game/master_move_cmd.h index 3a3b2ff..a08e825 100644 --- a/game/master_move_cmd.h +++ b/game/master_move_cmd.h @@ -23,6 +23,7 @@ #include "command.h" #include "move.h" +#include "logging.h" class Duplicate; @@ -32,6 +33,8 @@ class Duplicate; */ class MasterMoveCmd: public Command { + DEFINE_LOGGER(); + public: MasterMoveCmd(Duplicate &ioDuplicate, const Move &iMove); diff --git a/game/move.cpp b/game/move.cpp index 52bcd0a..e5bd94d 100644 --- a/game/move.cpp +++ b/game/move.cpp @@ -30,6 +30,9 @@ #include "debug.h" +INIT_LOGGER(game, Move); + + Move::Move() :m_score(0) { diff --git a/game/move.h b/game/move.h index a0b0c78..200c7fd 100644 --- a/game/move.h +++ b/game/move.h @@ -24,6 +24,7 @@ #include #include "round.h" +#include "logging.h" class Rack; class PlayedRack; @@ -44,6 +45,8 @@ using std::wstring; */ class Move { + DEFINE_LOGGER(); + public: /** * Default constructor, corresponding to no move diff --git a/game/player.cpp b/game/player.cpp index be28231..53cac20 100644 --- a/game/player.cpp +++ b/game/player.cpp @@ -33,6 +33,9 @@ #include "debug.h" +INIT_LOGGER(game, Player); + + Player::Player() : m_id(0), m_score(0) { diff --git a/game/player.h b/game/player.h index 39581a4..81caf99 100644 --- a/game/player.h +++ b/game/player.h @@ -26,6 +26,7 @@ #include #include "pldrack.h" #include "history.h" +#include "logging.h" using std::wstring; @@ -39,6 +40,7 @@ class Rack; */ class Player { + DEFINE_LOGGER(); public: explicit Player(); virtual ~Player() {} diff --git a/game/player_move_cmd.cpp b/game/player_move_cmd.cpp index 314d861..cc6ed2c 100644 --- a/game/player_move_cmd.cpp +++ b/game/player_move_cmd.cpp @@ -24,6 +24,9 @@ #include +INIT_LOGGER(game, PlayerMoveCmd); + + PlayerMoveCmd::PlayerMoveCmd(Player &ioPlayer, const Move &iMove) : m_player(ioPlayer), m_move(iMove) { diff --git a/game/player_move_cmd.h b/game/player_move_cmd.h index 0788eba..1e52e99 100644 --- a/game/player_move_cmd.h +++ b/game/player_move_cmd.h @@ -24,6 +24,7 @@ #include "command.h" #include "move.h" #include "pldrack.h" +#include "logging.h" class Player; class Rack; @@ -41,6 +42,8 @@ class Rack; */ class PlayerMoveCmd: public Command { + DEFINE_LOGGER(); + public: PlayerMoveCmd(Player &ioPlayer, const Move &iMove); diff --git a/game/player_points_cmd.cpp b/game/player_points_cmd.cpp index fe0be21..e4fed4d 100644 --- a/game/player_points_cmd.cpp +++ b/game/player_points_cmd.cpp @@ -24,6 +24,9 @@ #include "player.h" +INIT_LOGGER(game, PlayerPointsCmd); + + PlayerPointsCmd::PlayerPointsCmd(Player &ioPlayer, int iPoints) : m_player(ioPlayer), m_points(iPoints) { diff --git a/game/player_points_cmd.h b/game/player_points_cmd.h index d4353d6..1f8dde8 100644 --- a/game/player_points_cmd.h +++ b/game/player_points_cmd.h @@ -22,6 +22,7 @@ #define PLAYER_POINTS_CMD_H_ #include "command.h" +#include "logging.h" class Player; @@ -32,6 +33,8 @@ class Player; */ class PlayerPointsCmd: public Command { + DEFINE_LOGGER(); + public: PlayerPointsCmd(Player &ioPlayer, int iPoints); diff --git a/game/player_rack_cmd.cpp b/game/player_rack_cmd.cpp index d025822..80bb4ac 100644 --- a/game/player_rack_cmd.cpp +++ b/game/player_rack_cmd.cpp @@ -24,6 +24,9 @@ #include "player.h" +INIT_LOGGER(game, PlayerRackCmd); + + PlayerRackCmd::PlayerRackCmd(Player &ioPlayer, const PlayedRack &iNewRack) : m_player(ioPlayer), m_newRack(iNewRack) { diff --git a/game/player_rack_cmd.h b/game/player_rack_cmd.h index 83b2796..8fee3ae 100644 --- a/game/player_rack_cmd.h +++ b/game/player_rack_cmd.h @@ -23,6 +23,7 @@ #include "command.h" #include "pldrack.h" +#include "logging.h" class Player; @@ -33,6 +34,8 @@ class Player; */ class PlayerRackCmd: public Command { + DEFINE_LOGGER(); + public: PlayerRackCmd(Player &ioPlayer, const PlayedRack &iNewRack); diff --git a/game/pldrack.cpp b/game/pldrack.cpp index 87e2d09..88162da 100644 --- a/game/pldrack.cpp +++ b/game/pldrack.cpp @@ -26,6 +26,9 @@ #include "rack.h" +INIT_LOGGER(game, PlayedRack); + + PlayedRack::PlayedRack() : m_reject(false) { diff --git a/game/pldrack.h b/game/pldrack.h index 92b0df7..aa61a67 100644 --- a/game/pldrack.h +++ b/game/pldrack.h @@ -25,6 +25,7 @@ #include #include #include "tile.h" +#include "logging.h" class Rack; @@ -39,6 +40,7 @@ using namespace std; */ class PlayedRack { + DEFINE_LOGGER(); public: PlayedRack(); diff --git a/game/rack.cpp b/game/rack.cpp index 0be36b8..6b6f50e 100644 --- a/game/rack.cpp +++ b/game/rack.cpp @@ -25,6 +25,9 @@ #include "debug.h" +INIT_LOGGER(game, Rack); + + Rack::Rack() : m_tiles(Dictionary::GetDic().getTileNumber() + 1, 0), m_ntiles(0) { diff --git a/game/rack.h b/game/rack.h index cf8509c..51ff7a3 100644 --- a/game/rack.h +++ b/game/rack.h @@ -26,6 +26,7 @@ #include #include "tile.h" +#include "logging.h" using namespace std; @@ -36,6 +37,7 @@ using namespace std; */ class Rack { + DEFINE_LOGGER(); public: Rack(); diff --git a/game/results.cpp b/game/results.cpp index 81fa2aa..ae86c1e 100644 --- a/game/results.cpp +++ b/game/results.cpp @@ -32,6 +32,9 @@ #include "debug.h" +INIT_LOGGER(game, Results); + + bool tileCompare(const Tile &t1, const Tile &t2) { return t1.toCode() < t2.toCode(); diff --git a/game/results.h b/game/results.h index 6436e78..327a533 100644 --- a/game/results.h +++ b/game/results.h @@ -25,6 +25,7 @@ #include #include #include "round.h" +#include "logging.h" using namespace std; @@ -46,6 +47,7 @@ class Rack; */ class Results { + DEFINE_LOGGER(); public: virtual ~Results() {} unsigned int size() const { return m_rounds.size(); } diff --git a/game/round.cpp b/game/round.cpp index 51fb949..c7baaed 100644 --- a/game/round.cpp +++ b/game/round.cpp @@ -28,6 +28,9 @@ #include "encoding.h" +INIT_LOGGER(game, Round); + + #define FROMBOARD 0x1 #define FROMRACK 0x2 #define JOKER 0x4 diff --git a/game/round.h b/game/round.h index b223fe7..1c91ed1 100644 --- a/game/round.h +++ b/game/round.h @@ -25,6 +25,7 @@ #include #include "tile.h" #include "coord.h" +#include "logging.h" using namespace std; @@ -37,6 +38,7 @@ using namespace std; */ class Round { + DEFINE_LOGGER(); public: /************************* diff --git a/game/settings.cpp b/game/settings.cpp index 5a5f989..d018c9c 100644 --- a/game/settings.cpp +++ b/game/settings.cpp @@ -41,6 +41,9 @@ using namespace libconfig; +INIT_LOGGER(game, Settings); + + Settings *Settings::m_instance = NULL; diff --git a/game/settings.h b/game/settings.h index 12928b5..7a67a40 100644 --- a/game/settings.h +++ b/game/settings.h @@ -24,6 +24,8 @@ #include #include +#include "logging.h" + using std::string; using std::map; @@ -44,6 +46,7 @@ namespace libconfig */ class Settings { + DEFINE_LOGGER(); public: /// Access to the singleton static Settings& Instance(); diff --git a/game/turn.cpp b/game/turn.cpp index 49bc133..fcccee9 100644 --- a/game/turn.cpp +++ b/game/turn.cpp @@ -22,6 +22,9 @@ #include "turn.h" +INIT_LOGGER(game, Turn); + + // FIXME: move set to an arbitrary one (no move). It would be better to get rid of this // constructor completely Turn::Turn() diff --git a/game/turn.h b/game/turn.h index 6eebc77..3ba8796 100644 --- a/game/turn.h +++ b/game/turn.h @@ -25,6 +25,7 @@ #include #include "pldrack.h" #include "move.h" +#include "logging.h" using std::wstring; @@ -38,6 +39,7 @@ using std::wstring; */ class Turn { + DEFINE_LOGGER(); public: Turn(); Turn(unsigned int iPlayerId, diff --git a/game/turn_cmd.cpp b/game/turn_cmd.cpp index fb05788..b659487 100644 --- a/game/turn_cmd.cpp +++ b/game/turn_cmd.cpp @@ -25,6 +25,9 @@ #include "player.h" +INIT_LOGGER(game, TurnCmd); + + TurnCmd::TurnCmd() { // Fake execution diff --git a/game/turn_cmd.h b/game/turn_cmd.h index f896572..ceac1ad 100644 --- a/game/turn_cmd.h +++ b/game/turn_cmd.h @@ -24,6 +24,7 @@ #include #include "command.h" +#include "logging.h" using namespace std; @@ -34,6 +35,8 @@ using namespace std; */ class TurnCmd: public Command { + DEFINE_LOGGER(); + public: TurnCmd(); virtual ~TurnCmd(); diff --git a/qt/aux_window.cpp b/qt/aux_window.cpp index b8f71d6..f478d54 100644 --- a/qt/aux_window.cpp +++ b/qt/aux_window.cpp @@ -31,6 +31,9 @@ #include "qtcommon.h" +INIT_LOGGER(qt, AuxWindow); + + AuxWindow::AuxWindow(QWidget &iWidget, QString iWindowTitle, QString iWindowName, QAction *iAction) : m_widget(iWidget), m_windowName(iWindowName), m_action(iAction) diff --git a/qt/aux_window.h b/qt/aux_window.h index 9d58803..2e03c2c 100644 --- a/qt/aux_window.h +++ b/qt/aux_window.h @@ -23,6 +23,8 @@ #include +#include "logging.h" + class QAction; @@ -34,6 +36,7 @@ class QAction; class AuxWindow: public QWidget { Q_OBJECT; + DEFINE_LOGGER(); public: /** diff --git a/qt/bag_widget.cpp b/qt/bag_widget.cpp index b8e27aa..cbfc1f1 100644 --- a/qt/bag_widget.cpp +++ b/qt/bag_widget.cpp @@ -34,6 +34,9 @@ using namespace std; +INIT_LOGGER(qt, BagWidget); + + BagWidget::BagWidget(QWidget *parent) : QWidget(parent), m_game(NULL) { diff --git a/qt/bag_widget.h b/qt/bag_widget.h index 53f1393..a67d029 100644 --- a/qt/bag_widget.h +++ b/qt/bag_widget.h @@ -24,6 +24,7 @@ #include #include +#include "logging.h" class PublicGame; //class QTreeView; @@ -32,6 +33,7 @@ class QStandardItemModel; class BagWidget: public QWidget, private Ui::BagWidget { Q_OBJECT; + DEFINE_LOGGER(); public: explicit BagWidget(QWidget *parent = 0); diff --git a/qt/bag_widget2.cpp b/qt/bag_widget2.cpp index 3bbc0e4..7749fbb 100644 --- a/qt/bag_widget2.cpp +++ b/qt/bag_widget2.cpp @@ -38,6 +38,9 @@ using namespace std; +INIT_LOGGER(qt, BagWidget2); + + BagWidget2::BagWidget2(QWidget *parent) : QWidget(parent), m_game(NULL), m_totalNbTiles(0), m_showPlayedTiles(true), m_showTilesInRack(true) diff --git a/qt/bag_widget2.h b/qt/bag_widget2.h index 2b5897f..7d7b538 100644 --- a/qt/bag_widget2.h +++ b/qt/bag_widget2.h @@ -24,6 +24,8 @@ #include #include +#include "logging.h" + using std::vector; class PublicGame; @@ -33,6 +35,7 @@ class TileWidget; class BagWidget2: public QWidget { Q_OBJECT; + DEFINE_LOGGER(); public: explicit BagWidget2(QWidget *parent = 0); diff --git a/qt/board_widget.cpp b/qt/board_widget.cpp index 2c58a60..642b4f6 100644 --- a/qt/board_widget.cpp +++ b/qt/board_widget.cpp @@ -34,6 +34,9 @@ using namespace std; +INIT_LOGGER(qt, BoardWidget); + + BoardWidget::BoardWidget(CoordModel &iCoordModel, QWidget *parent) : QFrame(parent), m_game(NULL), m_coordModel(iCoordModel), m_showTemporarySigns(true), diff --git a/qt/board_widget.h b/qt/board_widget.h index 44e4056..7455289 100644 --- a/qt/board_widget.h +++ b/qt/board_widget.h @@ -22,7 +22,9 @@ #define BOARD_WIDGET_H_ #include + #include "matrix.h" +#include "logging.h" class PublicGame; @@ -33,6 +35,7 @@ class Coord; class BoardWidget: public QFrame { Q_OBJECT; + DEFINE_LOGGER(); public: explicit BoardWidget(CoordModel &iCoordModel, QWidget *parent = 0); diff --git a/qt/coord_model.cpp b/qt/coord_model.cpp index 152e1e7..d6852c4 100644 --- a/qt/coord_model.cpp +++ b/qt/coord_model.cpp @@ -21,6 +21,9 @@ #include "coord_model.h" +INIT_LOGGER(qt, CoordModel); + + void CoordModel::setCoord(const Coord &iCoord) { m_prevCoord = m_currCoord; diff --git a/qt/coord_model.h b/qt/coord_model.h index 4db2cf1..7a0da1c 100644 --- a/qt/coord_model.h +++ b/qt/coord_model.h @@ -22,12 +22,15 @@ #define COORD_MODEL_H_ #include + #include "coord.h" +#include "logging.h" class CoordModel: public QObject { Q_OBJECT; + DEFINE_LOGGER(); public: void setCoord(const Coord &iCoord); diff --git a/qt/custom_popup.cpp b/qt/custom_popup.cpp index 30b1a3f..359d06b 100644 --- a/qt/custom_popup.cpp +++ b/qt/custom_popup.cpp @@ -24,6 +24,9 @@ #include "qtcommon.h" +INIT_LOGGER(qt, CustomPopup); + + CustomPopup::CustomPopup(QWidget *iWidget) : QObject(iWidget), m_widget(iWidget) { diff --git a/qt/custom_popup.h b/qt/custom_popup.h index 2d4fc3a..354ef20 100644 --- a/qt/custom_popup.h +++ b/qt/custom_popup.h @@ -24,6 +24,8 @@ #include #include +#include "logging.h" + class QWidget; class QPoint; class QMenu; @@ -32,6 +34,7 @@ class QMenu; class CustomPopup: public QObject { Q_OBJECT; + DEFINE_LOGGER(); public: CustomPopup(QWidget *iWidget); diff --git a/qt/dic_tools_widget.cpp b/qt/dic_tools_widget.cpp index a3e6897..7d41786 100644 --- a/qt/dic_tools_widget.cpp +++ b/qt/dic_tools_widget.cpp @@ -43,6 +43,9 @@ using namespace std; +INIT_LOGGER(qt, DicToolsWidget); + + DicToolsWidget::DicToolsWidget(QWidget *parent) : QWidget(parent), m_dic(NULL) { diff --git a/qt/dic_tools_widget.h b/qt/dic_tools_widget.h index 1947d73..cb0c441 100644 --- a/qt/dic_tools_widget.h +++ b/qt/dic_tools_widget.h @@ -24,7 +24,9 @@ #include #include #include + #include "ui/dic_tools_widget.ui.h" +#include "logging.h" class QStandardItemModel; class QString; @@ -34,6 +36,7 @@ class CustomPopup; class DicToolsWidget: public QWidget, private Ui::DicToolsWidget { Q_OBJECT; + DEFINE_LOGGER(); public: explicit DicToolsWidget(QWidget *parent = 0); diff --git a/qt/dic_wizard.cpp b/qt/dic_wizard.cpp index b9d888a..a4af954 100644 --- a/qt/dic_wizard.cpp +++ b/qt/dic_wizard.cpp @@ -39,6 +39,12 @@ using namespace std; +INIT_LOGGER(qt, DicWizard); +INIT_LOGGER(qt, WizardInfoPage); +INIT_LOGGER(qt, WizardLettersDefPage); +INIT_LOGGER(qt, WizardConclusionPage); + + // ---------- WizardInfoPage ---------- WizardInfoPage::WizardInfoPage(QWidget *parent) : QWizardPage(parent) diff --git a/qt/dic_wizard.h b/qt/dic_wizard.h index aade143..18cddc1 100644 --- a/qt/dic_wizard.h +++ b/qt/dic_wizard.h @@ -28,6 +28,7 @@ #include "ui/dic_wizard_info_page.ui.h" #include "ui/dic_wizard_letters_def_page.ui.h" #include "ui/dic_wizard_conclusion_page.ui.h" +#include "logging.h" class QStandardItemModel; class QItemSelection; @@ -37,6 +38,7 @@ class QModelIndex; class DicWizard: public QWizard { Q_OBJECT; + DEFINE_LOGGER(); public: DicWizard(QWidget *parent); @@ -53,7 +55,8 @@ signals: class WizardInfoPage: public QWizardPage, private Ui::WizardInfoPage { - Q_OBJECT + Q_OBJECT; + DEFINE_LOGGER(); public: explicit WizardInfoPage(QWidget *parent = 0); virtual bool isComplete() const; @@ -67,7 +70,8 @@ private slots: class WizardLettersDefPage: public QWizardPage, private Ui::WizardLettersDefPage { - Q_OBJECT + Q_OBJECT; + DEFINE_LOGGER(); public: explicit WizardLettersDefPage(QWidget *parent = 0); const QStandardItemModel * getModel() const { return m_model; } @@ -82,7 +86,8 @@ private slots: class WizardConclusionPage: public QWizardPage, private Ui::WizardConclusionPage { - Q_OBJECT + Q_OBJECT; + DEFINE_LOGGER(); public: explicit WizardConclusionPage(QWidget *parent = 0); virtual void initializePage(); diff --git a/qt/history_widget.cpp b/qt/history_widget.cpp index 7a690b0..5ac729a 100644 --- a/qt/history_widget.cpp +++ b/qt/history_widget.cpp @@ -40,6 +40,9 @@ using namespace std; +INIT_LOGGER(qt, HistoryWidget); + + HistoryWidget::HistoryWidget(QWidget *parent) : QTreeView(parent), m_history(NULL), m_forPlayer(false), m_isFreeGame(false) { diff --git a/qt/history_widget.h b/qt/history_widget.h index e57cfe2..fd826f6 100644 --- a/qt/history_widget.h +++ b/qt/history_widget.h @@ -24,6 +24,8 @@ #include #include +#include "logging.h" + class History; class PublicGame; @@ -34,6 +36,7 @@ class CustomPopup; class HistoryWidget: public QTreeView { Q_OBJECT; + DEFINE_LOGGER(); public: explicit HistoryWidget(QWidget *parent = 0); diff --git a/qt/new_game.h b/qt/new_game.h index 23a4f3c..9515338 100644 --- a/qt/new_game.h +++ b/qt/new_game.h @@ -23,8 +23,7 @@ #include -#include - +#include "ui/new_game.ui.h" #include "logging.h" diff --git a/qt/play_word_mediator.cpp b/qt/play_word_mediator.cpp index d757601..f121cb3 100644 --- a/qt/play_word_mediator.cpp +++ b/qt/play_word_mediator.cpp @@ -32,6 +32,9 @@ #include "debug.h" +INIT_LOGGER(qt, PlayWordMediator); + + PlayWordMediator::PlayWordMediator(QObject *parent, QLineEdit &iEditPlay, QLineEdit &iEditCoord, QLineEdit &iEditPoints, QPushButton &iButtonPlay, diff --git a/qt/play_word_mediator.h b/qt/play_word_mediator.h index d2dcd89..882eff0 100644 --- a/qt/play_word_mediator.h +++ b/qt/play_word_mediator.h @@ -24,6 +24,8 @@ #include #include +#include "logging.h" + using std::wstring; @@ -50,6 +52,7 @@ class Dictionary; class PlayWordMediator: public QObject { Q_OBJECT; + DEFINE_LOGGER(); public: PlayWordMediator(QObject *parent, QLineEdit &iEditWord, diff --git a/qt/player_widget.cpp b/qt/player_widget.cpp index 8f5ddea..4168b8b 100644 --- a/qt/player_widget.cpp +++ b/qt/player_widget.cpp @@ -36,6 +36,9 @@ #include "encoding.h" +INIT_LOGGER(qt, PlayerWidget); + + PlayerWidget::PlayerWidget(QWidget *parent, CoordModel &iCoordModel, unsigned int iPlayerNb, PublicGame *iGame) : QWidget(parent), m_game(iGame), m_player(iPlayerNb) diff --git a/qt/player_widget.h b/qt/player_widget.h index fcf2261..3628863 100644 --- a/qt/player_widget.h +++ b/qt/player_widget.h @@ -23,7 +23,9 @@ #include #include + #include "ui/player_widget.ui.h" +#include "logging.h" class QLineEdit; @@ -35,6 +37,7 @@ class Coord; class PlayerWidget: public QWidget, private Ui::PlayerWidget { Q_OBJECT; + DEFINE_LOGGER(); public: explicit PlayerWidget(QWidget *parent, diff --git a/qt/prefs_dialog.cpp b/qt/prefs_dialog.cpp index d79496d..518ed70 100644 --- a/qt/prefs_dialog.cpp +++ b/qt/prefs_dialog.cpp @@ -32,6 +32,9 @@ #include "settings.h" +INIT_LOGGER(qt, PrefsDialog); + + const QString PrefsDialog::kINTF_ALIGN_HISTORY = "Interface/AlignHistory"; const QString PrefsDialog::kINTF_DIC_PATH = "Interface/DicPath"; const QString PrefsDialog::kINTF_DEFINITIONS_SITE_URL = "Interface/DefinitionsSiteUrl"; diff --git a/qt/prefs_dialog.h b/qt/prefs_dialog.h index e9dcbf0..b956054 100644 --- a/qt/prefs_dialog.h +++ b/qt/prefs_dialog.h @@ -24,7 +24,8 @@ #include #include -#include +#include "ui/prefs_dialog.ui.h" +#include "logging.h" class QStringList; @@ -32,6 +33,7 @@ class QStringList; class PrefsDialog: public QDialog, private Ui::PrefsDialog { Q_OBJECT; + DEFINE_LOGGER(); public: explicit PrefsDialog(QWidget *iParent = 0); diff --git a/qt/score_widget.cpp b/qt/score_widget.cpp index 813cd38..570a65d 100644 --- a/qt/score_widget.cpp +++ b/qt/score_widget.cpp @@ -29,6 +29,9 @@ using namespace std; +INIT_LOGGER(qt, ScoreWidget); + + ScoreWidget::ScoreWidget(QWidget *parent, const PublicGame *iGame) : QTreeView(parent), m_game(iGame) { diff --git a/qt/score_widget.h b/qt/score_widget.h index 01a7649..b9072b8 100644 --- a/qt/score_widget.h +++ b/qt/score_widget.h @@ -23,6 +23,8 @@ #include +#include "logging.h" + class PublicGame; class QStandardItemModel; @@ -30,6 +32,7 @@ class QStandardItemModel; class ScoreWidget: public QTreeView { Q_OBJECT; + DEFINE_LOGGER(); public: explicit ScoreWidget(QWidget *parent = 0, const PublicGame *iGame = NULL); diff --git a/qt/timer_widget.cpp b/qt/timer_widget.cpp index 718809e..7c8d195 100644 --- a/qt/timer_widget.cpp +++ b/qt/timer_widget.cpp @@ -23,6 +23,8 @@ #include "timer_widget.h" + +INIT_LOGGER(qt, TimerModel); INIT_LOGGER(qt, TimerWidget); diff --git a/qt/timer_widget.h b/qt/timer_widget.h index abe0189..3c564fe 100644 --- a/qt/timer_widget.h +++ b/qt/timer_widget.h @@ -33,6 +33,7 @@ class QTimer; class TimerModel : public QObject { Q_OBJECT; + DEFINE_LOGGER(); public: TimerModel(int iTotalDuration, int iAlertDuration); diff --git a/qt/training_widget.cpp b/qt/training_widget.cpp index 4c1bba0..5e15d97 100644 --- a/qt/training_widget.cpp +++ b/qt/training_widget.cpp @@ -37,6 +37,9 @@ using namespace std; +INIT_LOGGER(qt, TrainingWidget); + + static const int HIDDEN_COLUMN = 6; diff --git a/qt/training_widget.h b/qt/training_widget.h index 00560d5..6de16b2 100644 --- a/qt/training_widget.h +++ b/qt/training_widget.h @@ -23,6 +23,7 @@ #include #include "ui/training_widget.ui.h" +#include "logging.h" class QStandardItemModel; @@ -36,6 +37,7 @@ class PublicGame; class TrainingWidget: public QWidget, private Ui::TrainingWidget { Q_OBJECT; + DEFINE_LOGGER(); public: explicit TrainingWidget(QWidget *parent, CoordModel &iCoordModel, PublicGame *iGame); diff --git a/utils/game_io.cpp b/utils/game_io.cpp index 0e6d895..19a1896 100644 --- a/utils/game_io.cpp +++ b/utils/game_io.cpp @@ -45,6 +45,9 @@ using boost::format; using boost::wformat; +INIT_LOGGER(utils, GameIO); + + #define __UNUSED__ __attribute__((unused)) void GameIO::printBoard(ostream &out, const PublicGame &iGame) diff --git a/utils/game_io.h b/utils/game_io.h index 42985a0..a530b21 100644 --- a/utils/game_io.h +++ b/utils/game_io.h @@ -23,6 +23,8 @@ #include +#include "logging.h" + class PublicGame; class Results; @@ -39,6 +41,7 @@ using std::ostream; */ class GameIO { + DEFINE_LOGGER(); public: static void printBoard(ostream &out, const PublicGame &iGame); static void printBoardDebug(ostream &out, const PublicGame &iGame); diff --git a/utils/ncurses.cpp b/utils/ncurses.cpp index e5be79f..66b0f28 100644 --- a/utils/ncurses.cpp +++ b/utils/ncurses.cpp @@ -53,6 +53,10 @@ using namespace std; +INIT_LOGGER(utils, Box); +INIT_LOGGER(utils, CursesIntf); + + Box::Box(WINDOW *win, int y, int x, int h, int w, unsigned int iHeadingLines) : m_win(win), m_x(x), m_y(y), m_w(w), m_h(h), diff --git a/utils/ncurses.h b/utils/ncurses.h index fcc0b0c..1a96264 100644 --- a/utils/ncurses.h +++ b/utils/ncurses.h @@ -23,6 +23,8 @@ #include #include +#include "logging.h" + class PublicGame; using std::string; @@ -31,6 +33,8 @@ using std::wstring; class Box { + DEFINE_LOGGER(); + public: // Create a titled box with the specified position and size, // containing iHeadingLines non-scrolling lines. @@ -97,6 +101,7 @@ class Box */ class CursesIntf { + DEFINE_LOGGER(); public: // Pre-requisite: the given Game object MUST have been allocated with new // (in particular: not on the stack)