Commit 83e7173c authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Port to KF5

parent d96645af
project(kdiamond)
if(NOT COMPILING_KDEGAMES)
find_package(KDE4 REQUIRED)
include(KDE4Defaults)
include(MacroLibrary)
find_package(KDEGames 4.9.0 REQUIRED)
cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR)
set (QT_MIN_VERSION "5.3.0")
find_package(ECM 1.3.0 REQUIRED CONFIG)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Widgets )
find_package(KF5 REQUIRED COMPONENTS
CoreAddons
Config
WidgetsAddons
Config
I18n
GuiAddons
ConfigWidgets
ItemViews
IconThemes
XmlGui
KIO
NotifyConfig
KDELibs4Support)
find_package(KF5KDEGames 4.9.0 REQUIRED)
include(FeatureSummary)
include(ECMInstallIcons)
include(KDEInstallDirs)
include(KDECompilerSettings)
include(KDECMakeSettings)
add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
add_definitions(-DTRANSLATION_DOMAIN="kdiamond")
add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
include_directories(${KDEGAMES_INCLUDE_DIRS} ${KDE4_INCLUDES} ${QDBUS_INCLUDE_DIRS})
endif(NOT COMPILING_KDEGAMES)
add_subdirectory(src)
add_subdirectory(sounds)
......
########### install files ###############
#
#
kde4_create_handbook(index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/en SUBDIR kdiamond)
kdoctools_create_handbook(index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/en SUBDIR kdiamond)
......@@ -12,12 +12,12 @@ set(kdiamond_SRCS
view.cpp
)
kde4_add_kcfg_files(kdiamond_SRCS settings.kcfgc)
kconfig_add_kcfg_files(kdiamond_SRCS settings.kcfgc)
kde4_add_app_icon(kdiamond_SRCS "pics/hi*-app-kdiamond.png")
kde4_add_executable(kdiamond ${kdiamond_SRCS})
target_link_libraries(kdiamond ${KDE4_KDEUI_LIBS} kdegames ${KDE4_KNOTIFYCONFIG_LIBS})
add_executable(kdiamond ${kdiamond_SRCS})
target_link_libraries(kdiamond KF5KDEGames KF5::NotifyConfig KF5::KDELibs4Support)
install(TARGETS kdiamond ${INSTALL_TARGETS_DEFAULT_ARGS})
install(FILES kdiamond.kcfg kdiamond.notifyrc kdiamondui.rc DESTINATION ${DATA_INSTALL_DIR}/kdiamond)
......
......@@ -20,12 +20,14 @@
#include "settings.h"
#include <KLocalizedString>
#include <KStatusBar>
#include <QStatusBar>
KDiamond::InfoBar::InfoBar(KStatusBar* bar)
KDiamond::InfoBar::InfoBar(QStatusBar* bar)
: m_untimed(Settings::untimed())
, m_bar(bar)
{
//PORT TO QT5
#if 0
m_bar->insertPermanentItem(i18n("Points: %1", 0), 1, 1);
if (m_untimed)
m_bar->insertPermanentItem(i18n("Untimed game"), 2, 1);
......@@ -33,30 +35,38 @@ KDiamond::InfoBar::InfoBar(KStatusBar* bar)
m_bar->insertPermanentItem(i18n("Time left: %1", QLatin1String("0:00")), 2, 1);
m_bar->insertPermanentItem(i18n("Possible moves: %1", 0), 3, 1);
m_bar->show();
#endif
}
void KDiamond::InfoBar::setUntimed(bool untimed)
{
#if 0 //PORT QT5
if (untimed)
m_bar->changeItem(i18n("Untimed game"), 2);
m_untimed = untimed;
#endif
}
void KDiamond::InfoBar::updatePoints(int points)
{
#if 0 //PORT QT5
m_bar->changeItem(i18n("Points: %1", points), 1);
#endif
}
void KDiamond::InfoBar::updateMoves(int moves)
{
#if 0 //PORT QT5
if (moves == -1)
m_bar->changeItem(i18nc("Shown when the board is in motion.", "Possible moves: ..."), 3);
else
m_bar->changeItem(i18n("Possible moves: %1", moves), 3);
#endif
}
void KDiamond::InfoBar::updateRemainingTime(int remainingSeconds)
{
#if 0 //PORT QT5
if (m_untimed)
return;
//split time in seconds and minutes
......@@ -71,6 +81,7 @@ void KDiamond::InfoBar::updateRemainingTime(int remainingSeconds)
//special treatment if game is finished
if (remainingSeconds == 0)
updateMoves(0);
#endif
}
#include "infobar.moc"
......@@ -20,7 +20,7 @@
#define KDIAMOND_INFOBAR_H
#include <QObject>
class KStatusBar;
class QStatusBar;
namespace KDiamond
{
......@@ -29,7 +29,7 @@ namespace KDiamond
{
Q_OBJECT
public:
InfoBar(KStatusBar* bar);
InfoBar(QStatusBar* bar);
public Q_SLOTS:
void setUntimed(bool untimed);
void updatePoints(int points);
......@@ -37,7 +37,7 @@ namespace KDiamond
void updateRemainingTime(int remainingSeconds);
private:
bool m_untimed;
KStatusBar* m_bar;
QStatusBar* m_bar;
};
}
......
......@@ -21,7 +21,7 @@
#include <ctime>
#include <KApplication>
#include <KAboutData>
#include <K4AboutData>
#include <KCmdLineArgs>
#include <KGlobal>
#include <KLocale>
......@@ -34,8 +34,8 @@ static const char version[] = "1.4";
int main(int argc, char ** argv)
{
qsrand(time(0));
KAboutData about("kdiamond", 0, ki18nc("The application's name", "KDiamond"), version, ki18n(description),
KAboutData::License_GPL, ki18n("(C) 2008-2010 Stefan Majewsky and others"), KLocalizedString(), "http://games.kde.org/kdiamond" );
K4AboutData about("kdiamond", 0, ki18nc("The application's name", "KDiamond"), version, ki18n(description),
K4AboutData::License_GPL, ki18n("(C) 2008-2010 Stefan Majewsky and others"), KLocalizedString(), "http://games.kde.org/kdiamond" );
about.addAuthor(ki18n("Stefan Majewsky"), ki18n("Original author and current maintainer"), "majewsky@gmx.net");
about.addAuthor(ki18n("Paul Bunbury"), ki18n("Gameplay refinement"), "happysmileman@googlemail.com");
about.addCredit(ki18n("Eugene Trounev"), ki18n("Default theme"), "eugene.trounev@gmail.com");
......
......@@ -27,7 +27,7 @@
#include <QPointer>
#include <QTime>
#include <QTimer>
#include <KAction>
#include <QAction>
#include <KActionMenu>
#include <KActionCollection>
#include <KApplication>
......@@ -48,14 +48,14 @@ MainWindow::MainWindow(QWidget *parent)
, m_game(0)
, m_view(new KDiamond::View)
, m_infoBar(0)
, m_newAct(new KActionMenu(KIcon( QLatin1String( "document-new") ), i18nc("new game", "&New" ), this))
, m_newTimedAct(new KAction(i18n("Timed game"), this))
, m_newUntimedAct(new KAction(i18n("Untimed game"), this))
, m_newAct(new KActionMenu(QIcon::fromTheme( QLatin1String( "document-new") ), i18nc("new game", "&New" ), this))
, m_newTimedAct(new QAction(i18n("Timed game"), this))
, m_newUntimedAct(new QAction(i18n("Untimed game"), this))
, m_selector(KDiamond::renderer()->themeProvider(), KgThemeSelector::EnableNewStuffDownload)
{
KDiamond::renderer()->setDefaultPrimaryView(m_view);
//init GUI - "New Action"
m_newAct->setShortcut(KStandardShortcut::openNew());
//PORT QT5 m_newAct->setShortcut(KStandardShortcut::openNew());
m_newAct->setToolTip(i18n("Start a new game"));
m_newAct->setWhatsThis(i18n("Start a new game."));
actionCollection()->addAction( QLatin1String( "game_new" ), m_newAct);
......
......@@ -23,7 +23,7 @@ class Game;
#include "game-state.h"
class QTime;
class KAction;
class QAction;
class KActionMenu;
#include <KXmlGuiWindow>
#include <KgThemeSelector>
......@@ -60,10 +60,10 @@ class MainWindow : public KXmlGuiWindow
KDiamond::InfoBar* m_infoBar;
KActionMenu *m_newAct;
KAction *m_newTimedAct;
KAction *m_newUntimedAct;
KAction *m_pauseAct;
KAction *m_hintAct;
QAction *m_newTimedAct;
QAction *m_newUntimedAct;
QAction *m_pauseAct;
QAction *m_hintAct;
KgThemeSelector m_selector;
};
......
kde4_install_icons(${ICON_INSTALL_DIR})
ecm_install_icons(${ICON_INSTALL_DIR})
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