Commit 90ff8bab authored by Friedrich W. H. Kossebau's avatar Friedrich W. H. Kossebau
Browse files

Use ECMGenerateExportHeader to be able to deprecate API version-based

parent 0d59819b
cmake_minimum_required (VERSION 3.5 FATAL_ERROR)
set(KDEGAMES_VERSION 7.2.0)
set(KDEGAMES_SOVERSION 7)
project(libkdegames)
set (QT_MIN_VERSION "5.9.0")
set (KF5_MIN_VERSION "5.57.0")
set (QT_MIN_VERSION "5.11.0")
set (KF5_MIN_VERSION "5.64.0")
find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
......@@ -25,6 +28,9 @@ include(CMakePackageConfigHelpers)
include(ECMSetupVersion)
include(ECMGenerateHeaders)
include(ECMMarkNonGuiExecutable)
include(ECMGenerateExportHeader)
set(EXCLUDE_DEPRECATED_BEFORE_AND_AT 0 CACHE STRING "Control the range of deprecated API excluded from the build [default=0].")
add_definitions(-DMAKE_KDEGAMESPRIVATE_LIB)
add_definitions(-DTRANSLATION_DOMAIN="libkdegames5")
......@@ -128,7 +134,14 @@ set(kdegames_LIB_SRCS
add_library(KF5KDEGames SHARED ${kdegames_LIB_SRCS})
generate_export_header(KF5KDEGames BASE_NAME libkdegames EXPORT_MACRO_NAME KDEGAMES_EXPORT DEPRECATED_MACRO_NAME KDE_DEPRECATED)
ecm_generate_export_header(KF5KDEGames
EXPORT_FILE_NAME libkdegames_export.h
BASE_NAME KDEGAMES
VERSION ${KDEGAMES_VERSION}
DEPRECATED_BASE_VERSION 0
DEPRECATION_VERSIONS 4.1
EXCLUDE_DEPRECATED_BEFORE_AND_AT ${EXCLUDE_DEPRECATED_BEFORE_AND_AT}
)
target_link_libraries(KF5KDEGames
PRIVATE
......@@ -153,9 +166,6 @@ target_link_libraries(KF5KDEGames
target_include_directories(KF5KDEGames INTERFACE "$<INSTALL_INTERFACE:${KF5_INCLUDE_INSTALL_DIR}/KF5KDEGames;${KF5_INCLUDE_INSTALL_DIR}/KF5KDEGames/KDE;${KF5_INCLUDE_INSTALL_DIR}>")
set(KDEGAMES_VERSION 7.2.0)
set(KDEGAMES_SOVERSION 7)
set_target_properties(KF5KDEGames PROPERTIES VERSION ${KDEGAMES_VERSION}
SOVERSION ${KDEGAMES_SOVERSION}
EXPORT_NAME KF5KDEGames
......@@ -208,7 +218,14 @@ ki18n_wrap_ui(kdegamesprivate_LIB_SRCS
)
add_library(KF5KDEGamesPrivate SHARED ${kdegamesprivate_LIB_SRCS})
generate_export_header(KF5KDEGamesPrivate BASE_NAME libkdegamesprivate EXPORT_MACRO_NAME KDEGAMESPRIVATE_EXPORT DEPRECATED_MACRO_NAME KDE_DEPRECATED)
ecm_generate_export_header(KF5KDEGamesPrivate
EXPORT_FILE_NAME libkdegamesprivate_export.h
BASE_NAME KDEGAMESPRIVATE
VERSION ${KDEGAMES_VERSION}
DEPRECATED_BASE_VERSION 0
DEPRECATION_VERSIONS 3.2 4.9
EXCLUDE_DEPRECATED_BEFORE_AND_AT ${EXCLUDE_DEPRECATED_BEFORE_AND_AT}
)
target_link_libraries(KF5KDEGamesPrivate
PRIVATE
......
......@@ -153,11 +153,13 @@ KScoreDialog::~KScoreDialog()
delete d;
}
#if KDEGAMES_BUILD_DEPRECATED_SINCE(4, 1)
void KScoreDialog::setConfigGroup(const QString &group) //DEPRECATED!
{
d->configGroup = group.toUtf8();
d->loaded = false;
}
#endif
void KScoreDialog::setConfigGroup(const QPair<QByteArray, QString>& group)
{
......
......@@ -133,6 +133,7 @@ class KDEGAMES_EXPORT KScoreDialog : public QDialog
~KScoreDialog();
#if KDEGAMES_ENABLE_DEPRECATED_SINCE(4, 1)
/**
* The group name must be passed though I18N_NOOP() in order for the
* group name to be translated. i.e.
......@@ -141,11 +142,12 @@ class KDEGAMES_EXPORT KScoreDialog : public QDialog
* 'KHighscore_' otherwise the group will simply be 'KHighscore'.
*
* @param group to use for reading/writing highscores from/to.
* @deprecated since 4.1
* @deprecated Since 4.1, use setConfigGroup(const QPair<QByteArray, QString>&).
*/
void KDE_DEPRECATED setConfigGroup(const QString& group = QString());
KDEGAMES_DEPRECATED_VERSION(4, 1, "Use setConfigGroup(const QPair<QByteArray, QString>&)")
void setConfigGroup(const QString& group = QString());
//void setConfigGroup(const QString& group, const QString& i18nName);
#endif
/**
* The group name must be passed though i18n() in order for the
* group name to be translated. i.e.
......
......@@ -775,9 +775,12 @@ KPlayer * KGame::playerInputFinished(KPlayer *player)
{
gameSequence()->setCurrentPlayer(player);
}
// do not call gameSequence()->checkGameOver() to keep backward compatibility!
#if KDEGAMESPRIVATE_BUILD_DEPRECATED_SINCE(3, 2)
gameOver = checkGameOver(player);
if (gameOver!=0)
#else
gameOver = gameSequence()->checkGameOver(player);
#endif
if (gameOver!=0)
{
player->setTurn(false);
setGameStatus(End);
......@@ -788,12 +791,20 @@ KPlayer * KGame::playerInputFinished(KPlayer *player)
player->setTurn(false); // in turn based games we have to switch off input now
if (gameSequence())
{
#if KDEGAMESPRIVATE_BUILD_DEPRECATED_SINCE(3, 2)
QTimer::singleShot(0,this,&KGame::prepareNext);
#else
KGameSequence* gameSequence = this->gameSequence();
QTimer::singleShot(0, gameSequence, [gameSequence]() {
gameSequence->nextPlayer(gameSequence->currentPlayer());
});
#endif
}
}
return player;
}
#if KDEGAMESPRIVATE_BUILD_DEPRECATED_SINCE(3, 2)
// Per default we do not do anything
int KGame::checkGameOver(KPlayer *player)
{
......@@ -803,6 +814,7 @@ int KGame::checkGameOver(KPlayer *player)
}
return 0;
}
#endif
void KGame::setGameSequence(KGameSequence* sequence)
{
......@@ -819,6 +831,7 @@ KGameSequence* KGame::gameSequence() const
return d->mGameSequence;
}
#if KDEGAMESPRIVATE_BUILD_DEPRECATED_SINCE(3, 2)
void KGame::prepareNext()
{
if (gameSequence())
......@@ -827,7 +840,9 @@ void KGame::prepareNext()
nextPlayer(gameSequence()->currentPlayer());
}
}
#endif
#if KDEGAMESPRIVATE_BUILD_DEPRECATED_SINCE(3, 2)
KPlayer *KGame::nextPlayer(KPlayer *last,bool exclusive)
{
if (gameSequence())
......@@ -836,6 +851,7 @@ KPlayer *KGame::nextPlayer(KPlayer *last,bool exclusive)
}
return nullptr;
}
#endif
void KGame::setGameStatus(int status)
{
......
......@@ -273,11 +273,13 @@ public:
*/
uint playerCount() const;
#if KDEGAMESPRIVATE_BUILD_DEPRECATED_SINCE(3, 2)
/**
* @deprecated
* Use @ref KGameSequence::nextPlayer instead
**/
* @deprecated Since 3.2, use KGameSequence::nextPlayer() instead
*/
KDEGAMESPRIVATE_DEPRECATED_VERSION(3, 2, "Use KGameSequence::nextPlayer()")
virtual KPlayer * nextPlayer(KPlayer *last,bool exclusive=true);
#endif
// Input events
/**
......@@ -478,12 +480,13 @@ protected Q_SLOTS:
**/
void emitSignal(KGamePropertyBase *me);
#if KDEGAMESPRIVATE_BUILD_DEPRECATED_SINCE(3, 2)
/**
* @deprecated
* Use KGameSequence::prepareNext() instead
**/
* @deprecated Since 3.2, use KGameSequence::nextPlayer() & KGameSequence::currentPlayer() instead
*/
KDEGAMESPRIVATE_DEPRECATED_VERSION(3, 2, "Use KGameSequence::nextPlayer() & KGameSequence::currentPlayer()")
virtual void prepareNext();
#endif
/**
* Calls negotiateNetworkGame()
......@@ -851,14 +854,16 @@ protected:
void deletePlayers();
void deleteInactivePlayers();
#if KDEGAMESPRIVATE_BUILD_DEPRECATED_SINCE(3, 2)
/**
* @deprecated
* Use @ref KGameSequence instead.
*
* @param player the player who made the last move
* @return anything else but 0 is considered as game over
*
* @deprecated Since 3.2, use KGameSequence instead.
*/
KDEGAMESPRIVATE_DEPRECATED_VERSION(3, 2, "Use KGameSequence")
virtual int checkGameOver(KPlayer *player);
#endif
/**
* Load a saved game, from file OR network. Internal.
......
......@@ -30,6 +30,8 @@
Q_LOGGING_CATEGORY(GAMES_LIB, "org.kde.games.lib", QtWarningMsg)
#if KDEGAMESPRIVATE_BUILD_DEPRECATED_SINCE(4, 9)
class KGameThemePrivate
{
public:
......@@ -192,3 +194,5 @@ QString KGameTheme::themeProperty(const QString &key) const {
}
return d->themeproperties[key];
}
#endif
......@@ -30,6 +30,8 @@ Q_DECLARE_LOGGING_CATEGORY(GAMES_LIB)
class KGameThemePrivate;
class QPixmap;
#if KDEGAMESPRIVATE_ENABLE_DEPRECATED_SINCE(4, 9)
/**
* \class KGameTheme kgametheme.h <KGameTheme>
*
......@@ -42,11 +44,12 @@ class QPixmap;
* will likely be necessary to derive from this class
*
* @author Mauricio Piacentini
* @deprecated Use KgTheme instead.
* @deprecated Since 4.9, use KgTheme instead.
**/
class KDEGAMESPRIVATE_EXPORT KGameTheme
{
public:
KDEGAMESPRIVATE_DEPRECATED_VERSION(4, 9, "Use KgTheme")
explicit KGameTheme(const QString &themeGroup = QStringLiteral("KGameTheme"));
virtual ~KGameTheme();
......@@ -95,3 +98,5 @@ class KDEGAMESPRIVATE_EXPORT KGameTheme
};
#endif
#endif
......@@ -31,6 +31,8 @@
#include "ui_kgamethemeselector.h"
#include "kgametheme.h"
#if KDEGAMESPRIVATE_BUILD_DEPRECATED_SINCE(4, 9)
class KGameThemeSelector::KGameThemeSelectorPrivate
{
public:
......@@ -215,3 +217,5 @@ void KGameThemeSelector::KGameThemeSelectorPrivate::_k_openKNewStuffDialog()
}
#include "moc_kgamethemeselector.cpp"
#endif
......@@ -28,6 +28,8 @@ class KGameTheme;
class KConfigSkeleton;
class KGameThemeSelectorPrivate;
#if KDEGAMESPRIVATE_ENABLE_DEPRECATED_SINCE(4, 9)
/**
* \class KGameThemeSelector kgamethemeselector.h <KGameThemeSelector>
*
......@@ -44,7 +46,7 @@ class KGameThemeSelectorPrivate;
* directory for .desktop files with a group called "KGameTheme".
*
* @author Mauricio Piacentini
* @deprecated Use KgThemeSelector instead.
* @deprecated Since 4.9, use KgThemeSelector instead.
**/
class KDEGAMESPRIVATE_EXPORT KGameThemeSelector : public QWidget
{
......@@ -63,6 +65,7 @@ class KDEGAMESPRIVATE_EXPORT KGameThemeSelector : public QWidget
* @param directory subdirectory (of share/apps/appname) to search in
* @return true if the theme files and properties could be loaded
*/
KDEGAMESPRIVATE_DEPRECATED_VERSION(4, 9, "Use KgThemeSelector")
KGameThemeSelector(QWidget* parent, KConfigSkeleton* config, KGameThemeSelector::NewStuffState knsflags = KGameThemeSelector::NewStuffEnableDownload, const QString &groupName = QStringLiteral("KGameTheme"), const QString &directory = QStringLiteral("themes"));
virtual ~KGameThemeSelector();
......@@ -78,3 +81,5 @@ class KDEGAMESPRIVATE_EXPORT KGameThemeSelector : public QWidget
};
#endif
#endif
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