Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Games
KShisen
Commits
83ad8110
Commit
83ad8110
authored
Oct 28, 2015
by
Laurent Montel
😁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use new connect api + QStringLiteral
parent
084d34ef
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
24 deletions
+24
-24
src/app.cpp
src/app.cpp
+9
-9
src/board.cpp
src/board.cpp
+3
-3
src/main.cpp
src/main.cpp
+12
-12
No files found.
src/app.cpp
View file @
83ad8110
...
...
@@ -69,7 +69,7 @@ App::App(QWidget *parent)
m_board
(
nullptr
)
{
m_board
=
new
Board
(
this
);
m_board
->
setObjectName
(
Q
Latin1
String
(
"board"
));
m_board
->
setObjectName
(
QString
Literal
(
"board"
));
setCentralWidget
(
m_board
);
...
...
@@ -111,9 +111,9 @@ void App::setupActions()
KStandardGameAction
::
redo
(
this
,
SLOT
(
redo
()),
actionCollection
());
KStandardGameAction
::
hint
(
this
,
SLOT
(
hint
()),
actionCollection
());
KToggleAction
*
soundAction
=
new
KToggleAction
(
QIcon
::
fromTheme
(
Q
Latin1
String
(
"speaker"
)),
i18n
(
"Play Sounds"
),
this
);
KToggleAction
*
soundAction
=
new
KToggleAction
(
QIcon
::
fromTheme
(
QString
Literal
(
"speaker"
)),
i18n
(
"Play Sounds"
),
this
);
soundAction
->
setChecked
(
Prefs
::
sounds
());
actionCollection
()
->
addAction
(
Q
Latin1
String
(
"sounds"
),
soundAction
);
actionCollection
()
->
addAction
(
QString
Literal
(
"sounds"
),
soundAction
);
connect
(
soundAction
,
&
KToggleAction
::
triggered
,
m_board
,
&
Board
::
setSoundsEnabled
);
// Settings
...
...
@@ -247,14 +247,14 @@ void App::slotEndOfGame()
scoreInfo
[
KScoreDialog
::
Time
]
=
timeString
;
KScoreDialog
scoreDialog
(
KScoreDialog
::
Name
|
KScoreDialog
::
Time
|
KScoreDialog
::
Score
,
this
);
scoreDialog
.
addField
(
KScoreDialog
::
Custom1
,
i18n
(
"Gravity"
),
Q
Lat
in
1
Literal
(
"gravity"
));
scoreDialog
.
addField
(
KScoreDialog
::
Custom1
,
i18n
(
"Gravity"
),
Q
Str
in
g
Literal
(
"gravity"
));
// FIXME: This is bad, because the translated words are stored in the highscores and thus switching the language makes ugly things (schwarzer)
if
(
m_board
->
gravityFlag
())
{
scoreInfo
[
KScoreDialog
::
Custom1
]
=
i18n
(
"Yes"
);
}
else
{
scoreInfo
[
KScoreDialog
::
Custom1
]
=
i18n
(
"No"
);
}
scoreDialog
.
setConfigGroup
(
QString
::
fromLatin1
(
"%1x%2"
).
arg
(
sizeX
[
Prefs
::
size
()]).
arg
(
sizeY
[
Prefs
::
size
()]));
scoreDialog
.
setConfigGroup
(
QString
Literal
(
"%1x%2"
).
arg
(
sizeX
[
Prefs
::
size
()]).
arg
(
sizeY
[
Prefs
::
size
()]));
if
(
m_board
->
hasCheated
())
{
QString
message
=
i18n
(
"
\n
You could have been in the highscores
\n
if you did not use Undo or Hint.
\n
Try without them next time."
);
...
...
@@ -355,7 +355,7 @@ void App::setCheatModeEnabled(bool enabled)
void
App
::
showHighscores
()
{
KScoreDialog
scoreDialog
(
KScoreDialog
::
Name
|
KScoreDialog
::
Time
,
this
);
scoreDialog
.
addField
(
KScoreDialog
::
Custom1
,
i18n
(
"Gravity"
),
Q
Lat
in
1
Literal
(
"gravity"
));
scoreDialog
.
addField
(
KScoreDialog
::
Custom1
,
i18n
(
"Gravity"
),
Q
Str
in
g
Literal
(
"gravity"
));
scoreDialog
.
exec
();
}
...
...
@@ -366,13 +366,13 @@ void App::keyBindings()
void
App
::
showSettingsDialog
()
{
if
(
KConfigDialog
::
showDialog
(
Q
Lat
in
1
Literal
(
"settings"
)))
{
if
(
KConfigDialog
::
showDialog
(
Q
Str
in
g
Literal
(
"settings"
)))
{
return
;
}
//Use the classes exposed by LibKmahjongg for our configuration dialog
KMahjonggConfigDialog
*
dialog
=
new
KMahjonggConfigDialog
(
this
,
Q
Lat
in
1
Literal
(
"settings"
),
Prefs
::
self
());
dialog
->
addPage
(
new
Settings
(
0
),
i18n
(
"General"
),
Q
Lat
in
1
Literal
(
"games-config-options"
));
KMahjonggConfigDialog
*
dialog
=
new
KMahjonggConfigDialog
(
this
,
Q
Str
in
g
Literal
(
"settings"
),
Prefs
::
self
());
dialog
->
addPage
(
new
Settings
(
0
),
i18n
(
"General"
),
Q
Str
in
g
Literal
(
"games-config-options"
));
dialog
->
addTilesetPage
();
dialog
->
addBackgroundPage
();
//dialog->setHelp(QString(), "kshisen");
...
...
src/board.cpp
View file @
83ad8110
...
...
@@ -76,8 +76,8 @@ Board::Board(QWidget *parent)
m_gravityFlag
(
true
),
m_solvableFlag
(
false
),
m_chineseStyleFlag
(
false
),
m_tilesCanSlideFlag
(
false
),
m_highlightedTile
(
-
1
),
m_paintConnection
(
false
),
m_paintPossibleMoves
(
false
),
m_paintInProgress
(
false
),
m_soundPick
(
QStandardPaths
::
locate
(
QStandardPaths
::
GenericDataLocation
,
Q
Latin1
String
(
"sounds/kshisen/tile-touch.ogg"
))),
m_soundFall
(
QStandardPaths
::
locate
(
QStandardPaths
::
GenericDataLocation
,
Q
Latin1
String
(
"sounds/kshisen/tile-fall-tile.ogg"
)))
m_soundPick
(
QStandardPaths
::
locate
(
QStandardPaths
::
GenericDataLocation
,
QString
Literal
(
"sounds/kshisen/tile-touch.ogg"
))),
m_soundFall
(
QStandardPaths
::
locate
(
QStandardPaths
::
GenericDataLocation
,
QString
Literal
(
"sounds/kshisen/tile-fall-tile.ogg"
)))
{
m_tileRemove1
.
first
=
-
1
;
...
...
@@ -706,7 +706,7 @@ void Board::paintEvent(QPaintEvent *e)
++
pt1
;
++
pt2
;
}
QTimer
::
singleShot
(
delay
(),
this
,
SLOT
(
undrawConnection
())
);
QTimer
::
singleShot
(
delay
(),
this
,
&
Board
::
undrawConnection
);
m_paintConnection
=
false
;
}
if
(
m_paintPossibleMoves
)
{
...
...
src/main.cpp
View file @
83ad8110
...
...
@@ -38,21 +38,21 @@ int main(int argc, char **argv)
QApplication
a
(
argc
,
argv
);
// Migrate pre-existing (4.x) configuration
Kdelibs4ConfigMigrator
migrate
(
Q
Latin1
String
(
"kshisen"
));
migrate
.
setConfigFiles
(
QStringList
()
<<
Q
Latin1
String
(
"kshisenrc"
));
migrate
.
setUiFiles
(
QStringList
()
<<
Q
Latin1
String
(
"kshisenui.rc"
));
Kdelibs4ConfigMigrator
migrate
(
QString
Literal
(
"kshisen"
));
migrate
.
setConfigFiles
(
QStringList
()
<<
QString
Literal
(
"kshisenrc"
));
migrate
.
setUiFiles
(
QStringList
()
<<
QString
Literal
(
"kshisenui.rc"
));
migrate
.
migrate
();
KAboutData
aboutData
(
Q
Lat
in
1
Literal
(
"kshisen"
),
i18n
(
"Shisen-Sho"
),
Q
Latin1
String
(
KSHISEN_VERSION
" #"
KSHISEN_COMMIT
),
i18n
(
description
),
KAboutLicense
::
GPL
,
KAboutData
aboutData
(
Q
Str
in
g
Literal
(
"kshisen"
),
i18n
(
"Shisen-Sho"
),
QString
Literal
(
KSHISEN_VERSION
" #"
KSHISEN_COMMIT
),
i18n
(
description
),
KAboutLicense
::
GPL
,
i18n
(
"(c) 1997, Mario Weilguni"
));
aboutData
.
setHomepage
(
Q
Lat
in
1
Literal
(
"http://games.kde.org/kshisen"
));
aboutData
.
addAuthor
(
i18n
(
"Frederik Schwarzer"
),
i18n
(
"Current Maintainer"
),
Q
Lat
in
1
Literal
(
"schwarzer@kde.org"
));
aboutData
.
addAuthor
(
i18n
(
"Dave Corrie"
),
i18n
(
"Former Maintainer"
),
Q
Lat
in
1
Literal
(
"kde@davecorrie.com"
));
aboutData
.
addAuthor
(
i18n
(
"Mario Weilguni"
),
i18n
(
"Original Author"
),
Q
Lat
in
1
Literal
(
"mweilguni@sime.com"
));
aboutData
.
addCredit
(
i18n
(
"Mauricio Piacentini"
),
i18n
(
"KMahjonggLib integration for KDE4"
),
Q
Lat
in
1
Literal
(
"mauricio@tabuleiro.com"
));
aboutData
.
addCredit
(
i18n
(
"Jason Lane"
),
i18n
(
"Added 'tiles removed' counter<br/>Tile smooth-scaling and window resizing"
),
Q
Lat
in
1
Literal
(
"jglane@btopenworld.com"
));
aboutData
.
setHomepage
(
Q
Str
in
g
Literal
(
"http://games.kde.org/kshisen"
));
aboutData
.
addAuthor
(
i18n
(
"Frederik Schwarzer"
),
i18n
(
"Current Maintainer"
),
Q
Str
in
g
Literal
(
"schwarzer@kde.org"
));
aboutData
.
addAuthor
(
i18n
(
"Dave Corrie"
),
i18n
(
"Former Maintainer"
),
Q
Str
in
g
Literal
(
"kde@davecorrie.com"
));
aboutData
.
addAuthor
(
i18n
(
"Mario Weilguni"
),
i18n
(
"Original Author"
),
Q
Str
in
g
Literal
(
"mweilguni@sime.com"
));
aboutData
.
addCredit
(
i18n
(
"Mauricio Piacentini"
),
i18n
(
"KMahjonggLib integration for KDE4"
),
Q
Str
in
g
Literal
(
"mauricio@tabuleiro.com"
));
aboutData
.
addCredit
(
i18n
(
"Jason Lane"
),
i18n
(
"Added 'tiles removed' counter<br/>Tile smooth-scaling and window resizing"
),
Q
Str
in
g
Literal
(
"jglane@btopenworld.com"
));
aboutData
.
addCredit
(
i18n
(
"Thanks also to everyone who should be listed here but is not!"
));
QCommandLineParser
parser
;
KAboutData
::
setApplicationData
(
aboutData
);
...
...
@@ -62,7 +62,7 @@ int main(int argc, char **argv)
parser
.
process
(
a
);
aboutData
.
processCommandLine
(
&
parser
);
a
.
setWindowIcon
(
QIcon
::
fromTheme
(
Q
Latin1
String
(
"kshisen"
)));
a
.
setWindowIcon
(
QIcon
::
fromTheme
(
QString
Literal
(
"kshisen"
)));
KDBusService
service
;
...
...
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