Commit 899ea9e8 authored by Frederik Schwarzer's avatar Frederik Schwarzer

Surround code by namespace.

parent 3e0d7fd1
......@@ -57,7 +57,8 @@
#include "prefs.h"
#include "ui_settings.h"
namespace KShisen
{
/**
* @brief Class holding the settings dialog and its functions
*/
......@@ -391,6 +392,7 @@ void App::showSettingsDialog()
connect(dialog, &KMahjonggConfigDialog::settingsChanged, m_board, &Board::loadSettings);
dialog->show();
}
}
// vim: expandtab:tabstop=4:shiftwidth=4
// kate: space-indent on; indent-width 4
......@@ -18,8 +18,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
***************************************************************************/
#ifndef APP_H
#define APP_H
#ifndef KSHISEN_APP_H
#define KSHISEN_APP_H
// KDE
#include <KXmlGuiWindow>
......@@ -28,9 +28,13 @@
class QLabel;
// KShisen
namespace KShisen
{
class Board;
}
namespace KShisen
{
/**
* @brief Class holding the application and its functions
*/
......@@ -138,8 +142,9 @@ private:
QLabel * m_gameCheatLabel; ///< Status bar area for the cheat mode
Board * m_board; ///< Holds the game board
};
}
#endif // APP_H
#endif // KSHISEN_APP_H
// vim: expandtab:tabstop=4:shiftwidth=4
// kate: space-indent on; indent-width 4
......@@ -39,7 +39,8 @@
#include "debug.h"
#include "prefs.h"
namespace KShisen
{
#define EMPTY 0
#define SEASONS_START 28
#define FLOWERS_START 39
......@@ -1972,7 +1973,7 @@ void Board::setSoundsEnabled(bool enabled)
Prefs::setSounds(enabled);
Prefs::self()->save();
}
}
// vim: expandtab:tabstop=4:shiftwidth=4
// kate: space-indent on; indent-width 4
......@@ -21,8 +21,8 @@
// KMahjonggLib integration and SVG support for KDE 4: Mauricio Piacentini <mauricio@tabuleiro.com>
#ifndef BOARD_H
#define BOARD_H
#ifndef KSHISEN_BOARD_H
#define KSHISEN_BOARD_H
// STL
#include <vector>
......@@ -48,6 +48,8 @@
#include "move.h"
#include "possiblemove.h"
namespace KShisen
{
/**
* A list of possible moves the player has to choose between
*/
......@@ -317,8 +319,9 @@ private:
KgSound m_soundPick; ///< Sound object to play when tile is selected
KgSound m_soundFall; ///< Sound object to play when tiles fall down in gravity mode
};
}
#endif // BOARD_H
#endif // KSHISEN_BOARD_H
// vim: expandtab:tabstop=4:shiftwidth=4
// kate: space-indent on; indent-width 4
......@@ -16,16 +16,18 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
***************************************************************************/
#ifndef DEBUG_H
#define DEBUG_H
#ifndef KSHISEN_DEBUG_H
#define KSHISEN_DEBUG_H
// Qt
#include <QLoggingCategory>
namespace KShisen
{
Q_DECLARE_LOGGING_CATEGORY(KSHISEN_LOG)
// Use for debugging game mode.
//#define DEBUGGING
}
#endif // DEBUG_H
#endif // KSHISEN_DEBUG_H
......@@ -32,8 +32,10 @@
// KShisen
#include "app.h"
#include "debug.h"
namespace KShisen
{
Q_LOGGING_CATEGORY(KSHISEN_LOG, "log_kshisen")
}
static const char description[] = I18N_NOOP("A KDE game similar to Mahjongg");
int main(int argc, char ** argv)
......@@ -71,7 +73,7 @@ int main(int argc, char ** argv)
KDBusService service;
auto app = new App();
auto app = new KShisen::App();
app->show();
return a.exec();
}
......
......@@ -19,6 +19,8 @@
// own
#include "move.h"
namespace KShisen
{
Move::Move(TilePos const & tilePos1, TilePos const & tilePos2, int tile)
: m_x1(tilePos1.x())
, m_y1(tilePos1.y())
......@@ -125,6 +127,7 @@ void Move::swapTiles()
std::swap(m_y1, m_y2);
std::swap(m_tile1, m_tile2);
}
}
// vim: expandtab:tabstop=4:shiftwidth=4
// kate: space-indent on; indent-width 4
......@@ -18,9 +18,11 @@
#include "types.h"
#ifndef MOVE_H
#define MOVE_H
#ifndef KSHISEN_MOVE_H
#define KSHISEN_MOVE_H
namespace KShisen
{
/**
* @brief Class holding a move on the board made by the player
*
......@@ -62,8 +64,9 @@ private:
int m_slideX2; ///< final x coordinate of the last slided tile
int m_slideY2; ///< final y coordinate of the last slided tile
};
}
#endif // MOVE_H
#endif // KSHISEN_MOVE_H
// vim: expandtab:tabstop=4:shiftwidth=4
// kate: space-indent on; indent-width 4
......@@ -22,6 +22,8 @@
// KShisen
#include "debug.h"
namespace KShisen
{
PossibleMove::PossibleMove(Path & path)
: m_path(path)
, m_hasSlide(false)
......@@ -94,6 +96,7 @@ Path PossibleMove::slide() const
{
return m_slide;
}
}
// vim: expandtab:tabstop=4:shiftwidth=4
// kate: space-indent on; indent-width 4
......@@ -16,11 +16,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
***************************************************************************/
#ifndef POSSIBLEMOVE_H
#define POSSIBLEMOVE_H
#ifndef KSHISEN_POSSIBLEMOVE_H
#define KSHISEN_POSSIBLEMOVE_H
#include "types.h"
namespace KShisen
{
/**
* @brief Class holding a possible move and its functions
*
......@@ -48,8 +50,9 @@ private:
bool m_hasSlide; ///< flag set if the move requires a slide
Path m_slide; ///< path representing the movement of the last sliding tile
};
}
#endif // POSSIBLEMOVE_H
#endif // KSHISEN_POSSIBLEMOVE_H
// vim: expandtab:tabstop=4:shiftwidth=4
// kate: space-indent on; indent-width 4
......@@ -16,20 +16,23 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
***************************************************************************/
#ifndef TYPES_H
#define TYPES_H
#ifndef KSHISEN_TYPES_H
#define KSHISEN_TYPES_H
#include <QList>
#include <QPoint>
namespace KShisen
{
using TilePos = QPoint;
/**
* A list of positions (at least 2) makes a Path
*/
using Path = QList<TilePos>;
}
#endif // TYPES_H
#endif // KSHISEN_TYPES_H
// vim: expandtab:tabstop=4:shiftwidth=4
// kate: space-indent on; indent-width 4
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