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
KPat
Commits
6da929ef
Commit
6da929ef
authored
Jan 05, 2022
by
Laurent Montel
😁
Browse files
Fix compile against qt6
parent
61c893f1
Pipeline
#119121
passed with stage
in 1 minute and 57 seconds
Changes
23
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
6da929ef
cmake_minimum_required
(
VERSION 3.
5
FATAL_ERROR
)
cmake_minimum_required
(
VERSION 3.
16
FATAL_ERROR
)
# KDE Application Version, managed by release script
set
(
RELEASE_SERVICE_VERSION_MAJOR
"22"
)
...
...
@@ -8,8 +8,8 @@ set(RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_
project
(
kpat VERSION
${
RELEASE_SERVICE_VERSION
}
)
set
(
QT_MIN_VERSION
"5.1
2
.0"
)
set
(
KF5_MIN_VERSION
"5.
64
.0"
)
set
(
QT_MIN_VERSION
"5.1
5
.0"
)
set
(
KF5_MIN_VERSION
"5.
90
.0"
)
include
(
FindPkgConfig
)
pkg_check_modules
(
FC_SOLVE REQUIRED libfreecell-solver
)
...
...
@@ -23,8 +23,19 @@ try_compile(fcs_soft_suspend "${CMAKE_CURRENT_BINARY_DIR}" SOURCES "${CMAKE_CURR
find_package
(
ECM
${
KF5_MIN_VERSION
}
REQUIRED CONFIG
)
set
(
CMAKE_MODULE_PATH
${
CMAKE_MODULE_PATH
}
${
ECM_MODULE_PATH
}
)
include
(
KDEInstallDirs
)
include
(
KDECMakeSettings
)
include
(
KDECompilerSettings NO_POLICY_SCOPE
)
include
(
FeatureSummary
)
include
(
ECMAddAppIcon
)
include
(
ECMInstallIcons
)
include
(
ECMQtDeclareLoggingCategory
)
include
(
ECMSetupVersion
)
include
(
ECMGenerateHeaders
)
include
(
GenerateExportHeader
)
find_package
(
Qt
5
${
QT_MIN_VERSION
}
REQUIRED NO_MODULE COMPONENTS Widgets Svg Test
)
find_package
(
Qt
${
QT_MAJOR_VERSION
}
${
QT_MIN_VERSION
}
REQUIRED NO_MODULE COMPONENTS Widgets Svg Test
)
find_package
(
KF5
${
KF5_MIN_VERSION
}
REQUIRED COMPONENTS
Completion
Config
...
...
@@ -43,28 +54,12 @@ find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
find_package
(
KF5KDEGames 7.3.0 REQUIRED
)
include
(
KDEInstallDirs
)
include
(
KDECMakeSettings
)
include
(
KDECompilerSettings NO_POLICY_SCOPE
)
include
(
FeatureSummary
)
include
(
ECMAddAppIcon
)
include
(
ECMInstallIcons
)
include
(
ECMQtDeclareLoggingCategory
)
include
(
ECMSetupVersion
)
include
(
ECMGenerateHeaders
)
include
(
GenerateExportHeader
)
add_definitions
(
-DQT_NO_KEYWORDS
-DQT_NO_URL_CAST_FROM_STRING
-DQT_NO_CAST_FROM_ASCII
-DQT_NO_CAST_TO_ASCII
-DQT_NO_CAST_FROM_BYTEARRAY
-DQT_STRICT_ITERATORS
-DQT_USE_QSTRINGBUILDER
-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT
-DQT_NO_FOREACH
-DQT_DISABLE_DEPRECATED_BEFORE=0x050e00
-DQT_DEPRECATED_WARNINGS_SINCE=0x060000
)
...
...
autotests/CMakeLists.txt
View file @
6da929ef
...
...
@@ -10,25 +10,25 @@ include_directories(
ecm_add_test
(
shuffle_test.cpp
TEST_NAME ShuffleTest
LINK_LIBRARIES Qt
5
::Test
LINK_LIBRARIES Qt
${
QT_MAJOR_VERSION
}
::Test
NAME_PREFIX
"kpat-"
)
ecm_add_test
(
freecell_solver.cpp
TEST_NAME FcSolveTest
LINK_LIBRARIES Qt
5
::Test
LINK_LIBRARIES Qt
${
QT_MAJOR_VERSION
}
::Test
NAME_PREFIX
"kpat-"
)
ecm_add_test
(
golf_solver_wins.cpp
TEST_NAME GolfSolveTest
LINK_LIBRARIES Qt
5
::Test
LINK_LIBRARIES Qt
${
QT_MAJOR_VERSION
}
::Test
NAME_PREFIX
"kpat-"
)
ecm_add_test
(
solve_by_name.cpp
TEST_NAME SolveByVariantName
LINK_LIBRARIES Qt
5
::Test
LINK_LIBRARIES Qt
${
QT_MAJOR_VERSION
}
::Test
NAME_PREFIX
"kpat-"
)
...
...
@@ -53,7 +53,7 @@ ecm_add_test(
"settings_for_tests.cpp"
solver_format.cpp
TEST_NAME SolverFormatTest
LINK_LIBRARIES Qt
5
::Test kcardgame
LINK_LIBRARIES Qt
${
QT_MAJOR_VERSION
}
::Test kcardgame
KF5KDEGames
${
BLACK_HOLE_SOLVER_LDFLAGS
}
NAME_PREFIX
"kpat-"
...
...
src/bakersdozen.cpp
View file @
6da929ef
...
...
@@ -25,7 +25,6 @@
#include "patsolve/bakersdozensolver.h"
// KF
#include <KLocalizedString>
#include <kwidgetsaddons_version.h>
#include <KSelectAction>
...
...
@@ -91,17 +90,10 @@ void BakersDozen::initialize()
m_sequenceBuiltByOption
->
addAction
(
i18n
(
"Matching Suit"
)
);
m_sequenceBuiltByOption
->
addAction
(
i18n
(
"Rank"
)
);
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 78, 0)
connect
(
options
,
&
KSelectAction
::
indexTriggered
,
this
,
&
BakersDozen
::
gameTypeChanged
);
connect
(
m_emptyStackFillOption
,
&
KSelectAction
::
indexTriggered
,
this
,
&
BakersDozen
::
gameTypeChanged
);
connect
(
m_stackFacedownOption
,
&
KSelectAction
::
indexTriggered
,
this
,
&
BakersDozen
::
gameTypeChanged
);
connect
(
m_sequenceBuiltByOption
,
&
KSelectAction
::
indexTriggered
,
this
,
&
BakersDozen
::
gameTypeChanged
);
#else
connect
(
options
,
static_cast
<
void
(
KSelectAction
::*
)(
int
)
>
(
&
KSelectAction
::
triggered
),
this
,
&
BakersDozen
::
gameTypeChanged
);
connect
(
m_emptyStackFillOption
,
static_cast
<
void
(
KSelectAction
::*
)(
int
)
>
(
&
KSelectAction
::
triggered
),
this
,
&
BakersDozen
::
gameTypeChanged
);
connect
(
m_stackFacedownOption
,
static_cast
<
void
(
KSelectAction
::*
)(
int
)
>
(
&
KSelectAction
::
triggered
),
this
,
&
BakersDozen
::
gameTypeChanged
);
connect
(
m_sequenceBuiltByOption
,
static_cast
<
void
(
KSelectAction
::*
)(
int
)
>
(
&
KSelectAction
::
triggered
),
this
,
&
BakersDozen
::
gameTypeChanged
);
#endif
getSavedOptions
();
}
...
...
@@ -273,13 +265,13 @@ static class BakersDozenDealerInfo : public DealerInfo
{
public:
BakersDozenDealerInfo
()
:
DealerInfo
(
I18N_NOOP
(
"Baker's Dozen"
),
BakersDozenGeneralId
)
:
DealerInfo
(
kli18n
(
"Baker's Dozen"
),
BakersDozenGeneralId
)
{
addSubtype
(
BakersDozenId
,
I18N_NOOP
(
"Baker's Dozen"
)
);
addSubtype
(
BakersDozenSpanishId
,
I18N_NOOP
(
"Spanish Patience"
)
);
addSubtype
(
BakersDozenCastlesId
,
I18N_NOOP
(
"Castles in Spain"
)
);
addSubtype
(
BakersDozenPortugueseId
,
I18N_NOOP
(
"Portuguese Solitaire"
)
);
addSubtype
(
BakersDozenCustomId
,
I18N_NOOP
(
"Baker's Dozen (Custom)"
)
);
addSubtype
(
BakersDozenId
,
kli18n
(
"Baker's Dozen"
)
);
addSubtype
(
BakersDozenSpanishId
,
kli18n
(
"Spanish Patience"
)
);
addSubtype
(
BakersDozenCastlesId
,
kli18n
(
"Castles in Spain"
)
);
addSubtype
(
BakersDozenPortugueseId
,
kli18n
(
"Portuguese Solitaire"
)
);
addSubtype
(
BakersDozenCustomId
,
kli18n
(
"Baker's Dozen (Custom)"
)
);
}
...
...
src/castle.cpp
View file @
6da929ef
...
...
@@ -26,7 +26,6 @@
#include "patsolve/castlesolver.h"
// KF
#include <KLocalizedString>
#include <kwidgetsaddons_version.h>
#include <KSelectAction>
...
...
@@ -359,15 +358,15 @@ static class CastleDealerInfo : public DealerInfo
{
public:
CastleDealerInfo
()
:
DealerInfo
(
I18N_NOOP
(
"Castle"
),
CastleGeneralId
)
:
DealerInfo
(
kli18n
(
"Castle"
),
CastleGeneralId
)
{
addSubtype
(
CastleBeleagueredId
,
I18N_NOOP
(
"Beleaguered Castle"
)
);
addSubtype
(
CastleCitadelId
,
I18N_NOOP
(
"Citadel"
)
);
addSubtype
(
CastleExiledKingsId
,
I18N_NOOP
(
"Exiled Kings"
)
);
addSubtype
(
CastleStreetAlleyId
,
I18N_NOOP
(
"Streets and Alleys"
)
);
addSubtype
(
CastleSiegecraftId
,
I18N_NOOP
(
"Siegecraft"
)
);
addSubtype
(
CastleStrongholdId
,
I18N_NOOP
(
"Stronghold"
)
);
addSubtype
(
CastleCustomId
,
I18N_NOOP
(
"Castle (Custom)"
)
);
addSubtype
(
CastleBeleagueredId
,
kli18n
(
"Beleaguered Castle"
)
);
addSubtype
(
CastleCitadelId
,
kli18n
(
"Citadel"
)
);
addSubtype
(
CastleExiledKingsId
,
kli18n
(
"Exiled Kings"
)
);
addSubtype
(
CastleStreetAlleyId
,
kli18n
(
"Streets and Alleys"
)
);
addSubtype
(
CastleSiegecraftId
,
kli18n
(
"Siegecraft"
)
);
addSubtype
(
CastleStrongholdId
,
kli18n
(
"Stronghold"
)
);
addSubtype
(
CastleCustomId
,
kli18n
(
"Castle (Custom)"
)
);
}
DealerScene
*
createGame
()
const
override
...
...
@@ -447,7 +446,6 @@ void Castle::configOptions()
m_layoutOption
->
addAction
(
i18n
(
"Classic"
)
);
m_layoutOption
->
addAction
(
i18n
(
"Modern"
)
);
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 78, 0)
connect
(
options
,
&
KSelectAction
::
indexTriggered
,
this
,
&
Castle
::
gameTypeChanged
);
connect
(
m_emptyStackFillOption
,
&
KSelectAction
::
indexTriggered
,
this
,
&
Castle
::
gameTypeChanged
);
connect
(
m_reservesOption
,
&
KSelectAction
::
indexTriggered
,
this
,
&
Castle
::
gameTypeChanged
);
...
...
@@ -456,16 +454,6 @@ void Castle::configOptions()
connect
(
m_stackFaceupOption
,
&
KSelectAction
::
indexTriggered
,
this
,
&
Castle
::
gameTypeChanged
);
connect
(
m_foundationOption
,
&
KSelectAction
::
indexTriggered
,
this
,
&
Castle
::
gameTypeChanged
);
connect
(
m_layoutOption
,
&
KSelectAction
::
indexTriggered
,
this
,
&
Castle
::
gameTypeChanged
);
#else
connect
(
options
,
static_cast
<
void
(
KSelectAction
::*
)(
int
)
>
(
&
KSelectAction
::
triggered
),
this
,
&
Castle
::
gameTypeChanged
);
connect
(
m_emptyStackFillOption
,
static_cast
<
void
(
KSelectAction
::*
)(
int
)
>
(
&
KSelectAction
::
triggered
),
this
,
&
Castle
::
gameTypeChanged
);
connect
(
m_reservesOption
,
static_cast
<
void
(
KSelectAction
::*
)(
int
)
>
(
&
KSelectAction
::
triggered
),
this
,
&
Castle
::
gameTypeChanged
);
connect
(
m_sequenceBuiltByOption
,
static_cast
<
void
(
KSelectAction
::*
)(
int
)
>
(
&
KSelectAction
::
triggered
),
this
,
&
Castle
::
gameTypeChanged
);
connect
(
m_stacksOption
,
static_cast
<
void
(
KSelectAction
::*
)(
int
)
>
(
&
KSelectAction
::
triggered
),
this
,
&
Castle
::
gameTypeChanged
);
connect
(
m_stackFaceupOption
,
static_cast
<
void
(
KSelectAction
::*
)(
int
)
>
(
&
KSelectAction
::
triggered
),
this
,
&
Castle
::
gameTypeChanged
);
connect
(
m_foundationOption
,
static_cast
<
void
(
KSelectAction
::*
)(
int
)
>
(
&
KSelectAction
::
triggered
),
this
,
&
Castle
::
gameTypeChanged
);
connect
(
m_layoutOption
,
static_cast
<
void
(
KSelectAction
::*
)(
int
)
>
(
&
KSelectAction
::
triggered
),
this
,
&
Castle
::
gameTypeChanged
);
#endif
}
...
...
src/clock.cpp
View file @
6da929ef
...
...
@@ -153,7 +153,7 @@ static class ClockDealerInfo : public DealerInfo
{
public:
ClockDealerInfo
()
:
DealerInfo
(
I18N_NOOP
(
"Grandfather's Clock"
),
GrandfathersClockId
)
:
DealerInfo
(
kli18n
(
"Grandfather's Clock"
),
GrandfathersClockId
)
{}
DealerScene
*
createGame
()
const
override
...
...
src/dealer.cpp
View file @
6da929ef
...
...
@@ -85,7 +85,11 @@ namespace
int
readIntAttribute
(
const
QXmlStreamReader
&
xml
,
const
QString
&
key
,
bool
*
ok
=
nullptr
)
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QStringRef
value
=
xml
.
attributes
().
value
(
key
);
#else
QStringView
value
=
xml
.
attributes
().
value
(
key
);
#endif
return
QString
::
fromRawData
(
value
.
data
(),
value
.
length
()
).
toInt
(
ok
);
}
...
...
@@ -182,7 +186,9 @@ int DealerScene::moveCount() const
void
DealerScene
::
saveLegacyFile
(
QIODevice
*
io
)
{
QXmlStreamWriter
xml
(
io
);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
xml
.
setCodec
(
"UTF-8"
);
#endif
xml
.
setAutoFormatting
(
true
);
xml
.
setAutoFormattingIndent
(
-
1
);
xml
.
writeStartDocument
();
...
...
@@ -332,7 +338,9 @@ bool DealerScene::loadLegacyFile( QIODevice * io )
void
DealerScene
::
saveFile
(
QIODevice
*
io
)
{
QXmlStreamWriter
xml
(
io
);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
xml
.
setCodec
(
"UTF-8"
);
#endif
xml
.
setAutoFormatting
(
true
);
xml
.
setAutoFormattingIndent
(
-
1
);
xml
.
writeStartDocument
();
...
...
src/dealerinfo.cpp
View file @
6da929ef
...
...
@@ -41,13 +41,13 @@
#include <KLocalizedString>
DealerInfo
::
DealerInfo
(
const
QByteArray
&
untranslatedBaseName
,
int
baseId
)
DealerInfo
::
DealerInfo
(
const
KLazyLocalizedString
&
untranslatedBaseName
,
int
baseId
)
:
m_baseName
(
untranslatedBaseName
),
m_baseId
(
baseId
)
{
DealerInfoList
::
self
()
->
add
(
this
);
QString
baseName
=
QString
::
fromUtf8
(
m_baseName
);
QString
baseName
=
QString
::
fromUtf8
(
m_baseName
.
untranslatedText
()
);
for
(
int
i
=
0
;
i
<
baseName
.
size
();
++
i
)
{
QChar
c
=
baseName
.
at
(
i
);
...
...
@@ -64,11 +64,11 @@ DealerInfo::~DealerInfo()
QString
DealerInfo
::
baseName
()
const
{
return
i18n
(
m_baseName
.
constData
()
);
return
m_baseName
.
toString
(
);
}
QByteArray
DealerInfo
::
untranslatedBaseName
()
const
KLazyLocalizedString
DealerInfo
::
untranslatedBaseName
()
const
{
return
m_baseName
;
}
...
...
@@ -86,7 +86,7 @@ int DealerInfo::baseId() const
}
void
DealerInfo
::
addSubtype
(
int
id
,
const
QByteArray
&
untranslatedName
)
void
DealerInfo
::
addSubtype
(
int
id
,
const
KLazyLocalizedString
&
untranslatedName
)
{
m_subtypes
.
insert
(
id
,
untranslatedName
);
}
...
...
@@ -118,9 +118,9 @@ QString DealerInfo::nameForId( int id ) const
if
(
id
==
m_baseId
)
return
baseName
();
QMap
<
int
,
QByteArray
>::
const_iterator
it
=
m_subtypes
.
find
(
id
);
QMap
<
int
,
KLazyLocalizedString
>::
const_iterator
it
=
m_subtypes
.
find
(
id
);
if
(
it
!=
m_subtypes
.
constEnd
()
)
return
i18n
(
it
.
value
().
constData
()
);
return
it
.
value
().
toString
(
);
else
return
QString
();
}
...
...
src/dealerinfo.h
View file @
6da929ef
...
...
@@ -43,7 +43,7 @@
#include <QList>
#include <QMap>
#include <QString>
#include <KLazyLocalizedString>
class
DealerInfoList
;
class
DealerScene
;
...
...
@@ -92,15 +92,15 @@ public:
CastleCustomId
=
49
};
DealerInfo
(
const
QByteArray
&
untranslatedBaseName
,
int
baseId
);
DealerInfo
(
const
KLazyLocalizedString
&
untranslatedBaseName
,
int
baseId
);
virtual
~
DealerInfo
();
QString
baseName
()
const
;
QByteArray
untranslatedBaseName
()
const
;
KLazyLocalizedString
untranslatedBaseName
()
const
;
QString
baseIdString
()
const
;
int
baseId
()
const
;
void
addSubtype
(
int
id
,
const
QByteArray
&
untranslatedName
);
void
addSubtype
(
int
id
,
const
KLazyLocalizedString
&
untranslatedName
);
QList
<
int
>
subtypeIds
()
const
;
QList
<
int
>
distinctIds
()
const
;
...
...
@@ -110,11 +110,11 @@ public:
virtual
DealerScene
*
createGame
()
const
=
0
;
protected:
QByteArray
m_baseName
;
KLazyLocalizedString
m_baseName
;
QString
m_baseIdString
;
int
m_baseId
;
QMap
<
int
,
QByteArray
>
m_subtypes
;
QMap
<
int
,
KLazyLocalizedString
>
m_subtypes
;
};
...
...
src/fortyeight.cpp
View file @
6da929ef
...
...
@@ -250,7 +250,7 @@ static class FortyEightDealerInfo : public DealerInfo
{
public:
FortyEightDealerInfo
()
:
DealerInfo
(
I18N_NOOP
(
"Forty & Eight"
),
FortyAndEightId
)
:
DealerInfo
(
kli18n
(
"Forty & Eight"
),
FortyAndEightId
)
{}
DealerScene
*
createGame
()
const
override
...
...
src/freecell.cpp
View file @
6da929ef
...
...
@@ -46,7 +46,6 @@
#include "patsolve/freecellsolver.h"
// KF
#include <KLocalizedString>
#include <kwidgetsaddons_version.h>
#include <KSelectAction>
Freecell
::
Freecell
(
const
DealerInfo
*
di
)
...
...
@@ -346,14 +345,14 @@ static class FreecellDealerInfo : public DealerInfo
{
public:
FreecellDealerInfo
()
:
DealerInfo
(
I18N_NOOP
(
"Freecell"
),
FreecellGeneralId
)
:
DealerInfo
(
kli18n
(
"Freecell"
),
FreecellGeneralId
)
{
addSubtype
(
FreecellBakersId
,
I18N_NOOP
(
"Baker's Game"
)
);
addSubtype
(
FreecellEightOffId
,
I18N_NOOP
(
"Eight Off"
)
);
addSubtype
(
FreecellForeId
,
I18N_NOOP
(
"Forecell"
)
);
addSubtype
(
FreecellId
,
I18N_NOOP
(
"Freecell"
)
);
addSubtype
(
FreecellSeahavenId
,
I18N_NOOP
(
"Seahaven Towers"
)
);
addSubtype
(
FreecellCustomId
,
I18N_NOOP
(
"Freecell (Custom)"
)
);
addSubtype
(
FreecellBakersId
,
kli18n
(
"Baker's Game"
)
);
addSubtype
(
FreecellEightOffId
,
kli18n
(
"Eight Off"
)
);
addSubtype
(
FreecellForeId
,
kli18n
(
"Forecell"
)
);
addSubtype
(
FreecellId
,
kli18n
(
"Freecell"
)
);
addSubtype
(
FreecellSeahavenId
,
kli18n
(
"Seahaven Towers"
)
);
addSubtype
(
FreecellCustomId
,
kli18n
(
"Freecell (Custom)"
)
);
}
DealerScene
*
createGame
()
const
override
...
...
@@ -427,21 +426,12 @@ void Freecell::configOptions()
m_decksOption
->
addAction
(
i18n
(
"2"
)
);
m_decksOption
->
addAction
(
i18n
(
"3"
)
);
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 78, 0)
connect
(
options
,
&
KSelectAction
::
indexTriggered
,
this
,
&
Freecell
::
gameTypeChanged
);
connect
(
m_emptyStackFillOption
,
&
KSelectAction
::
indexTriggered
,
this
,
&
Freecell
::
gameTypeChanged
);
connect
(
m_reservesOption
,
&
KSelectAction
::
indexTriggered
,
this
,
&
Freecell
::
gameTypeChanged
);
connect
(
m_sequenceBuiltByOption
,
&
KSelectAction
::
indexTriggered
,
this
,
&
Freecell
::
gameTypeChanged
);
connect
(
m_stacksOption
,
&
KSelectAction
::
indexTriggered
,
this
,
&
Freecell
::
gameTypeChanged
);
connect
(
m_decksOption
,
&
KSelectAction
::
indexTriggered
,
this
,
&
Freecell
::
gameTypeChanged
);
#else
connect
(
options
,
static_cast
<
void
(
KSelectAction
::*
)(
int
)
>
(
&
KSelectAction
::
triggered
),
this
,
&
Freecell
::
gameTypeChanged
);
connect
(
m_emptyStackFillOption
,
static_cast
<
void
(
KSelectAction
::*
)(
int
)
>
(
&
KSelectAction
::
triggered
),
this
,
&
Freecell
::
gameTypeChanged
);
connect
(
m_reservesOption
,
static_cast
<
void
(
KSelectAction
::*
)(
int
)
>
(
&
KSelectAction
::
triggered
),
this
,
&
Freecell
::
gameTypeChanged
);
connect
(
m_sequenceBuiltByOption
,
static_cast
<
void
(
KSelectAction
::*
)(
int
)
>
(
&
KSelectAction
::
triggered
),
this
,
&
Freecell
::
gameTypeChanged
);
connect
(
m_stacksOption
,
static_cast
<
void
(
KSelectAction
::*
)(
int
)
>
(
&
KSelectAction
::
triggered
),
this
,
&
Freecell
::
gameTypeChanged
);
connect
(
m_decksOption
,
static_cast
<
void
(
KSelectAction
::*
)(
int
)
>
(
&
KSelectAction
::
triggered
),
this
,
&
Freecell
::
gameTypeChanged
);
#endif
}
...
...
src/golf.cpp
View file @
6da929ef
...
...
@@ -193,7 +193,7 @@ static class GolfDealerInfo : public DealerInfo
{
public:
GolfDealerInfo
()
:
DealerInfo
(
I18N_NOOP
(
"Golf"
),
GolfId
)
:
DealerInfo
(
kli18n
(
"Golf"
),
GolfId
)
{}
DealerScene
*
createGame
()
const
override
...
...
src/grandf.cpp
View file @
6da929ef
...
...
@@ -198,7 +198,7 @@ static class GrandfDealerInfo : public DealerInfo
{
public:
GrandfDealerInfo
()
:
DealerInfo
(
I18N_NOOP
(
"Grandfather"
),
GrandfatherId
)
:
DealerInfo
(
kli18n
(
"Grandfather"
),
GrandfatherId
)
{}
DealerScene
*
createGame
()
const
override
...
...
src/gypsy.cpp
View file @
6da929ef
...
...
@@ -175,7 +175,7 @@ static class GypsyDealerInfo : public DealerInfo
{
public:
GypsyDealerInfo
()
:
DealerInfo
(
I18N_NOOP
(
"Gypsy"
),
GypsyId
)
:
DealerInfo
(
kli18n
(
"Gypsy"
),
GypsyId
)
{}
DealerScene
*
createGame
()
const
override
...
...
src/idiot.cpp
View file @
6da929ef
...
...
@@ -256,7 +256,7 @@ static class IdiotDealerInfo : public DealerInfo
{
public:
IdiotDealerInfo
()
:
DealerInfo
(
I18N_NOOP
(
"Aces Up"
),
AcesUpId
)
:
DealerInfo
(
kli18n
(
"Aces Up"
),
AcesUpId
)
{}
DealerScene
*
createGame
()
const
override
...
...
src/klondike.cpp
View file @
6da929ef
...
...
@@ -44,7 +44,6 @@
#include "speeds.h"
#include "patsolve/klondikesolver.h"
// KF
#include <kwidgetsaddons_version.h>
#include <KLocalizedString>
#include <KSelectAction>
...
...
@@ -145,11 +144,7 @@ void Klondike::initialize()
options
->
addAction
(
i18n
(
"Draw 1"
));
options
->
addAction
(
i18n
(
"Draw 3"
));
options
->
setCurrentItem
(
easyRules
?
0
:
1
);
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 78, 0)
connect
(
options
,
&
KSelectAction
::
indexTriggered
,
this
,
&
Klondike
::
gameTypeChanged
);
#else
connect
(
options
,
static_cast
<
void
(
KSelectAction
::*
)(
int
)
>
(
&
KSelectAction
::
triggered
),
this
,
&
Klondike
::
gameTypeChanged
);
#endif
}
bool
Klondike
::
checkAdd
(
const
PatPile
*
pile
,
const
QList
<
KCard
*>
&
oldCards
,
const
QList
<
KCard
*>
&
newCards
)
const
...
...
@@ -348,10 +343,10 @@ static class KlondikeDealerInfo : public DealerInfo
{
public:
KlondikeDealerInfo
()
:
DealerInfo
(
I18N_NOOP
(
"Klondike"
),
DealerInfo
::
KlondikeGeneralId
)
:
DealerInfo
(
kli18n
(
"Klondike"
),
DealerInfo
::
KlondikeGeneralId
)
{
addSubtype
(
KlondikeDrawOneId
,
I18N_NOOP
(
"Klondike (Draw 1)"
)
);
addSubtype
(
KlondikeDrawThreeId
,
I18N_NOOP
(
"Klondike (Draw 3)"
)
);
addSubtype
(
KlondikeDrawOneId
,
kli18n
(
"Klondike (Draw 1)"
)
);
addSubtype
(
KlondikeDrawThreeId
,
kli18n
(
"Klondike (Draw 3)"
)
);
}
DealerScene
*
createGame
()
const
override
...
...
src/libkcardgame/CMakeLists.txt
View file @
6da929ef
...
...
@@ -31,13 +31,13 @@ target_link_libraries(kcardgame
PUBLIC
KF5::ConfigWidgets
KF5::ConfigGui
Qt
5
::Widgets
Qt
${
QT_MAJOR_VERSION
}
::Widgets
PRIVATE
KF5::Completion
KF5::GuiAddons
KF5::NewStuff
KF5::I18n
Qt
5
::Svg
Qt
${
QT_MAJOR_VERSION
}
::Svg
)
install
(
TARGETS kcardgame
${
KDE_INSTALL_TARGETS_DEFAULT_ARGS
}
)
...
...
src/libkcardgame/common.h
View file @
6da929ef
...
...
@@ -24,7 +24,7 @@
#include <KSharedDataCache>
// Qt
#include <QDataStream>
#include <QIODevice>
class
QString
;
...
...
src/main.cpp
View file @
6da929ef
...
...
@@ -67,7 +67,7 @@ static DealerScene *getDealer( int wanted_game , const QString & name )
{
const
auto
games
=
DealerInfoList
::
self
()
->
games
();
for
(
DealerInfo
*
di
:
games
)
{
if
(
(
wanted_game
<
0
)
?
(
QString
::
fromUtf8
(
di
->
untranslatedBaseName
())
==
name
)
:
di
->
providesId
(
wanted_game
)
)
if
(
(
wanted_game
<
0
)
?
(
di
->
untranslatedBaseName
()
.
toString
(
)
==
name
)
:
di
->
providesId
(
wanted_game
)
)
{
DealerScene
*
d
=
di
->
createGame
();
Q_ASSERT
(
d
);
...
...
@@ -102,8 +102,9 @@ QString lowerAlphaNum( const QString & string )
int
main
(
int
argc
,
char
**
argv
)
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QCoreApplication
::
setAttribute
(
Qt
::
AA_UseHighDpiPixmaps
);
#endif
QApplication
app
(
argc
,
argv
);
KLocalizedString
::
setApplicationDomain
(
"kpat"
);
...
...
@@ -181,7 +182,7 @@ int main( int argc, char **argv )
QStringList
gameList
;
const
auto
games
=
DealerInfoList
::
self
()
->
games
();
for
(
const
DealerInfo
*
di
:
games
)
{
KLocalizedString
localizedKey
=
ki18n
(
di
->
untranslatedBaseName
(
).
constData
()
);
KLocalizedString
localizedKey
=
di
->
untranslatedBaseName
();
//QT5 const QString translatedKey = lowerAlphaNum( localizedKey.toString( tmpLocale ) );
//QT5 gameList << translatedKey;
//QT5 indexMap.insert( translatedKey, di->baseId() );
...
...
src/mainwindow.cpp
View file @
6da929ef
...
...
@@ -80,7 +80,6 @@
#include <QTimer>
#include <QBuffer>
#include <QXmlStreamReader>
#include <QDesktopWidget>
#include <QKeySequence>
#include <QStandardPaths>
#include <QApplication>
...
...
@@ -120,7 +119,7 @@ MainWindow::MainWindow()
m_view
=
new
PatienceView
(
this
);
setCentralWidget
(
m_view
);
const
QRect
screenSize
=
QApplication
::
desktop
()
->
screen
Geometry
(
this
);
const
QRect
screenSize
=
screen
()
->
available
Geometry
();
QSize
defaultSize
=
screenSize
.
size
()
*
0.7
;
setupGUI
(
defaultSize
,
Create
|
Save
|
ToolBar
|
StatusBar
|
Keys
);
...
...
@@ -348,7 +347,7 @@ void MainWindow::helpGame()
if
(
m_dealer
&&
m_dealer_map
.
contains
(
m_dealer
->
gameId
()))
{
const
DealerInfo
*
di
=
m_dealer_map
.
value
(
m_dealer
->
gameId
());
QString
anchor
=
QString
::
fromUtf8
(
di
->
untranslatedBaseName
()
);
QString
anchor
=
di
->
untranslatedBaseName
()
.
toString
(
);
anchor
=
anchor
.
toLower
();
anchor
=
anchor
.
remove
(
QLatin1Char
(
'\''
)).
replace
(
QLatin1Char
(
'&'
),
QLatin1String
(
"and"
)).
replace
(
QLatin1Char
(
' '
),
QLatin1Char
(
'-'
));
KHelpClient
::
invokeHelp
(
QLatin1String
(
"rules-specific.html#"
)
+
anchor
);
...
...
@@ -868,7 +867,11 @@ bool MainWindow::loadGame( const QUrl & url, bool addToRecentFiles )
}
else
if
(
xml
.
name
()
==
QLatin1String
(
"kpat-game"
))
{
isLegacyFile
=
false
;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QStringRef
gameType
=
xml
.
attributes
().
value
(
QStringLiteral
(
"game-type"
));
#else
QStringView
gameType
=
xml
.
attributes
().
value
(
QStringLiteral
(
"game-type"
));
#endif
const
auto
games
=
DealerInfoList
::
self
()
->
games
();
for
(
const
DealerInfo
*
di
:
games
)
{
if
(
di
->
baseIdString
()
==
gameType
)
...
...
src/mod3.cpp
View file @
6da929ef
...
...
@@ -235,7 +235,7 @@ static class Mod3DealerInfo : public DealerInfo
{
public:
Mod3DealerInfo
()
:
DealerInfo
(
I18N_NOOP
(
"Mod3"
),
Mod3Id
)
:
DealerInfo
(
kli18n
(
"Mod3"
),
Mod3Id
)
{}
DealerScene
*
createGame
()
const
override
...
...
Prev
1
2
Next
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