Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Games
KShisen
Commits
899ea9e8
Commit
899ea9e8
authored
May 06, 2016
by
Frederik Schwarzer
Browse files
Surround code by namespace.
parent
3e0d7fd1
Changes
11
Hide whitespace changes
Inline
Side-by-side
src/app.cpp
View file @
899ea9e8
...
...
@@ -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
src/app.h
View file @
899ea9e8
...
...
@@ -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
src/board.cpp
View file @
899ea9e8
...
...
@@ -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
src/board.h
View file @
899ea9e8
...
...
@@ -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
src/debug.h
View file @
899ea9e8
...
...
@@ -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
src/main.cpp
View file @
899ea9e8
...
...
@@ -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
();
}
...
...
src/move.cpp
View file @
899ea9e8
...
...
@@ -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
src/move.h
View file @
899ea9e8
...
...
@@ -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
src/possiblemove.cpp
View file @
899ea9e8
...
...
@@ -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
src/possiblemove.h
View file @
899ea9e8
...
...
@@ -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
src/types.h
View file @
899ea9e8
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment