Commit 38223782 authored by Laurent Montel's avatar Laurent Montel 😁

Port to KF5

parent 073bcad6
project (kubrick) project (kubrick)
if(NOT COMPILING_KDEGAMES) set (QT_MIN_VERSION "5.3.0")
find_package(KDE4 REQUIRED)
include(KDE4Defaults)
include(MacroLibrary)
find_package(KDEGames REQUIRED)
find_package(OpenGL REQUIRED) find_package(ECM 1.3.0 REQUIRED CONFIG)
macro_log_feature(OPENGL_FOUND "OpenGL" "API for developing portable, interactive 2D and 3Dgraphics applications" "http://mesa3d.sourceforge.net" TRUE "" "Kubrick will not be built and KSudoku will not have Roxdoku support without OpenGL.") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
macro_log_feature(QT_QTOPENGL_FOUND "QtOpenGL" "Qt module that make it easy to use OpenGL in Qt apps" "http://doc.trolltech.com/latest/qtopengl.html" TRUE "" "Kubrick will not be built and KSudoku will not have Roxdoku support without QtOpenGL.")
macro_display_feature_log()
add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS}) find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Widgets Qml Quick QuickWidgets Svg Test OpenGL)
add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS) find_package(KF5 REQUIRED COMPONENTS
include_directories(${KDEGAMES_INCLUDE_DIRS} ${KDE4_INCLUDES} ${QDBUS_INCLUDE_DIRS}) CoreAddons
endif(NOT COMPILING_KDEGAMES) Config
ItemModels
WidgetsAddons
WindowSystem
Config
DBusAddons
I18n
ConfigWidgets
TextWidgets
XmlGui
KIO
NotifyConfig
NewStuff
KDELibs4Support)
find_package(KF5KDEGames 4.9.0 REQUIRED)
include(FeatureSummary)
include(ECMInstallIcons)
include(KDEInstallDirs)
include(KDECompilerSettings)
include(KDECMakeSettings)
add_subdirectory (src) add_subdirectory (src)
add_subdirectory (data) add_subdirectory (data)
......
...@@ -15,17 +15,18 @@ set(kubrick_SRCS ...@@ -15,17 +15,18 @@ set(kubrick_SRCS
scenelabel.cpp ) scenelabel.cpp )
kde4_add_app_icon(kubrick_SRCS "hi*-app-kubrick.png") kde4_add_app_icon(kubrick_SRCS "hi*-app-kubrick.png")
kde4_add_executable(kubrick ${kubrick_SRCS}) add_executable(kubrick ${kubrick_SRCS})
if(WIN32) if(WIN32)
set(opengl_libs opengl32.lib glu32.lib) set(opengl_libs opengl32.lib glu32.lib)
endif(WIN32) endif(WIN32)
target_link_libraries(kubrick target_link_libraries(kubrick
${QT_QTOPENGL_LIBRARY} Qt5::OpenGL
${KDE4_KDEUI_LIBS} Qt5::Svg
${KDE4_KIO_LIBS} KF5::KDELibs4Support
kdegames KF5::KIOCore
KF5KDEGames
${OPENGL_gl_LIBRARY} ${OPENGL_gl_LIBRARY}
${OPENGL_glu_LIBRARY} ${OPENGL_glu_LIBRARY}
) )
...@@ -38,6 +39,6 @@ install(TARGETS kubrick ${INSTALL_TARGETS_DEFAULT_ARGS}) ...@@ -38,6 +39,6 @@ install(TARGETS kubrick ${INSTALL_TARGETS_DEFAULT_ARGS})
install( FILES kubrickui.rc DESTINATION ${DATA_INSTALL_DIR}/kubrick ) install( FILES kubrickui.rc DESTINATION ${DATA_INSTALL_DIR}/kubrick )
install( PROGRAMS kubrick.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} ) install( PROGRAMS kubrick.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} )
kde4_install_icons( ${ICON_INSTALL_DIR} ) ecm_install_icons( ${ICON_INSTALL_DIR} )
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include "game.h" #include "game.h"
#include "movetracker.h" #include "movetracker.h"
#include "scenelabel.h" #include "scenelabel.h"
#include <KUrl>
#include <KDebug> #include <KDebug>
// Create the main game/document object // Create the main game/document object
......
...@@ -32,7 +32,8 @@ ...@@ -32,7 +32,8 @@
#include <KAboutData> #include <KAboutData>
#include <QSvgRenderer> #include <QSvgRenderer>
#include <KDebug> #include <KDebug>
#include <KGlobal>
#include <K4AboutData>
// C++ includes // C++ includes
#include <iostream> #include <iostream>
......
...@@ -80,7 +80,7 @@ Kubrick::Kubrick () : ...@@ -80,7 +80,7 @@ Kubrick::Kubrick () :
// Set up a status bar. // Set up a status bar.
statusBar()->show (); statusBar()->show ();
statusBar()->insertItem (i18n("Welcome to Kubrick"), 1001, 1); //QT5 statusBar()->insertItem (i18n("Welcome to Kubrick"), 1001, 1);
// Set a larger font than toolbar-default for the Singmaster-moves display. // Set a larger font than toolbar-default for the Singmaster-moves display.
QFont f = statusBar()->font(); QFont f = statusBar()->font();
...@@ -219,7 +219,7 @@ void Kubrick::initGUI() ...@@ -219,7 +219,7 @@ void Kubrick::initGUI()
"and start a new puzzle with the same " "and start a new puzzle with the same "
"dimensions and number of shuffling moves.")); "dimensions and number of shuffling moves."));
KAction * QAction *
a = KStandardGameAction::load ( a = KStandardGameAction::load (
game, SLOT (load()), this); game, SLOT (load()), this);
actionCollection()->addAction (a->objectName(), a); actionCollection()->addAction (a->objectName(), a);
...@@ -297,7 +297,7 @@ void Kubrick::initGUI() ...@@ -297,7 +297,7 @@ void Kubrick::initGUI()
"and the cube's axes are parallel to the XYZ " "and the cube's axes are parallel to the XYZ "
"axes, thus making keyboard moves properly " "axes, thus making keyboard moves properly "
"meaningful.")); "meaningful."));
a->setIcon (KIcon( QLatin1String( "go-home" ))); a->setIcon (QIcon::fromTheme( QLatin1String( "go-home" )));
a->setShortcut (Qt::Key_Home); a->setShortcut (Qt::Key_Home);
connect (a, SIGNAL (triggered(bool)), game, SLOT (setStandardView())); connect (a, SIGNAL (triggered(bool)), game, SLOT (setStandardView()));
...@@ -310,13 +310,13 @@ void Kubrick::initGUI() ...@@ -310,13 +310,13 @@ void Kubrick::initGUI()
singmasterLabel = new QLabel (i18n("Singmaster Moves"), this); singmasterLabel = new QLabel (i18n("Singmaster Moves"), this);
singmasterMoves = new QLineEdit (this); singmasterMoves = new QLineEdit (this);
KAction * w = new KAction (this); QAction * w = new QAction (this);
actionCollection()->addAction ( QLatin1String( "singmaster_label" ), w); actionCollection()->addAction ( QLatin1String( "singmaster_label" ), w);
w->setDefaultWidget (singmasterLabel); //QT5 w->setDefaultWidget (singmasterLabel);
w = new KAction (this); w = new QAction (this);
actionCollection()->addAction ( QLatin1String( "singmaster_moves" ), w); actionCollection()->addAction ( QLatin1String( "singmaster_moves" ), w);
w->setDefaultWidget (singmasterMoves); //QT5 w->setDefaultWidget (singmasterMoves);
QString singmasterToolTip = i18n("This area shows Singmaster moves."); QString singmasterToolTip = i18n("This area shows Singmaster moves.");
QString singmasterWhatsThis = i18nc("The letters RLFBUD are mathematical " QString singmasterWhatsThis = i18nc("The letters RLFBUD are mathematical "
...@@ -385,7 +385,7 @@ void Kubrick::initGUI() ...@@ -385,7 +385,7 @@ void Kubrick::initGUI()
b->setToolTip (i18n ("Show one view of this cube.")); b->setToolTip (i18n ("Show one view of this cube."));
b->setWhatsThis (i18n ("Show one view of this cube, " b->setWhatsThis (i18n ("Show one view of this cube, "
"from the front.")); "from the front."));
b->setIcon (KIcon( QLatin1String( "arrow-left" ))); // IDW - Temporary. b->setIcon (QIcon::fromTheme( QLatin1String( "arrow-left" ))); // IDW - Temporary.
connect (b, SIGNAL(triggered(bool)), viewMapper, SLOT(map())); connect (b, SIGNAL(triggered(bool)), viewMapper, SLOT(map()));
b->setChecked (true); b->setChecked (true);
viewMapper->setMapping (b, OneCube); viewMapper->setMapping (b, OneCube);
...@@ -396,7 +396,7 @@ void Kubrick::initGUI() ...@@ -396,7 +396,7 @@ void Kubrick::initGUI()
b->setToolTip (i18n ("Show two views of this cube.")); b->setToolTip (i18n ("Show two views of this cube."));
b->setWhatsThis (i18n ("Show two views of this cube, from " b->setWhatsThis (i18n ("Show two views of this cube, from "
"the front and the back. Both can rotate.")); "the front and the back. Both can rotate."));
b->setIcon (KIcon( QLatin1String( "arrow-up" ))); // IDW - Temporary. b->setIcon (QIcon::fromTheme( QLatin1String( "arrow-up" ))); // IDW - Temporary.
connect (b, SIGNAL(triggered(bool)), viewMapper, SLOT(map())); connect (b, SIGNAL(triggered(bool)), viewMapper, SLOT(map()));
viewMapper->setMapping (b, TwoCubes); viewMapper->setMapping (b, TwoCubes);
viewGroup->addAction (b); viewGroup->addAction (b);
...@@ -408,7 +408,7 @@ void Kubrick::initGUI() ...@@ -408,7 +408,7 @@ void Kubrick::initGUI()
"large one, from the front, and two small " "large one, from the front, and two small "
"ones, from the front and the back. Only " "ones, from the front and the back. Only "
"the large one can rotate.")); "the large one can rotate."));
b->setIcon (KIcon( QLatin1String( "arrow-right" ))); // IDW - Temporary. b->setIcon (QIcon::fromTheme( QLatin1String( "arrow-right" ))); // IDW - Temporary.
connect (b, SIGNAL(triggered(bool)), viewMapper, SLOT(map())); connect (b, SIGNAL(triggered(bool)), viewMapper, SLOT(map()));
viewMapper->setMapping (b, ThreeCubes); viewMapper->setMapping (b, ThreeCubes);
viewGroup->addAction (b); viewGroup->addAction (b);
...@@ -549,10 +549,10 @@ void Kubrick::initGUI() ...@@ -549,10 +549,10 @@ void Kubrick::initGUI()
} }
KAction * Kubrick::mapAction (QSignalMapper * mapper, const QString & name, QAction * Kubrick::mapAction (QSignalMapper * mapper, const QString & name,
const QString & text, const Qt::Key key, SingmasterMove mapping) const QString & text, const Qt::Key key, SingmasterMove mapping)
{ {
KAction * a; QAction * a;
a = actionCollection()->addAction (name); a = actionCollection()->addAction (name);
a->setText (text); a->setText (text);
a->setShortcut (key); a->setShortcut (key);
...@@ -570,7 +570,7 @@ void Kubrick::setToggle (const char * actionName, bool onOff) ...@@ -570,7 +570,7 @@ void Kubrick::setToggle (const char * actionName, bool onOff)
void Kubrick::setAvail (const char * actionName, bool onOff) void Kubrick::setAvail (const char * actionName, bool onOff)
{ {
((KAction *) ACTION (actionName))->setEnabled (onOff); ((QAction *) ACTION (actionName))->setEnabled (onOff);
} }
...@@ -603,7 +603,7 @@ void Kubrick::fillDemoList (const DemoItem itemList [], QList<QAction *> & list, ...@@ -603,7 +603,7 @@ void Kubrick::fillDemoList (const DemoItem itemList [], QList<QAction *> & list,
{ {
// Generate an action list with one action for each item in the demo list. // Generate an action list with one action for each item in the demo list.
for (uint i = 0; (strcmp (itemList[i].filename, "END") != 0); i++) { for (uint i = 0; (strcmp (itemList[i].filename, "END") != 0); i++) {
KAction * t = new KAction (i18n (itemList[i].menuText), this); QAction * t = new QAction (i18n (itemList[i].menuText), this);
actionCollection()->addAction ( QString (QLatin1String("%1%2" )).arg(uilist).arg(i), t); actionCollection()->addAction ( QString (QLatin1String("%1%2" )).arg(uilist).arg(i), t);
t->setData (i); // Save the index of the item inside the action. t->setData (i); // Save the index of the item inside the action.
list.append (t); list.append (t);
...@@ -628,28 +628,28 @@ void Kubrick::saveNewToolbarConfig() ...@@ -628,28 +628,28 @@ void Kubrick::saveNewToolbarConfig()
void Kubrick::easySelected (int index) void Kubrick::easySelected (int index)
{ {
statusBar()->changeItem (i18n (easyItems [index].menuText), 1001); //QT5 statusBar()->changeItem (i18n (easyItems [index].menuText), 1001);
game->changePuzzle (easyItems [index]); game->changePuzzle (easyItems [index]);
} }
void Kubrick::notSoEasySelected (int index) void Kubrick::notSoEasySelected (int index)
{ {
statusBar()->changeItem (i18n (notSoEasyItems [index].menuText), 1001); //QT5 statusBar()->changeItem (i18n (notSoEasyItems [index].menuText), 1001);
game->changePuzzle (notSoEasyItems [index]); game->changePuzzle (notSoEasyItems [index]);
} }
void Kubrick::hardSelected (int index) void Kubrick::hardSelected (int index)
{ {
statusBar()->changeItem (i18n (hardItems [index].menuText), 1001); //QT5 statusBar()->changeItem (i18n (hardItems [index].menuText), 1001);
game->changePuzzle (hardItems [index]); game->changePuzzle (hardItems [index]);
} }
void Kubrick::veryHardSelected (int index) void Kubrick::veryHardSelected (int index)
{ {
statusBar()->changeItem (i18n (veryHardItems [index].menuText), 1001); //QT5 statusBar()->changeItem (i18n (veryHardItems [index].menuText), 1001);
game->changePuzzle (veryHardItems [index]); game->changePuzzle (veryHardItems [index]);
} }
...@@ -657,12 +657,12 @@ void Kubrick::veryHardSelected (int index) ...@@ -657,12 +657,12 @@ void Kubrick::veryHardSelected (int index)
void Kubrick::patternSelected() void Kubrick::patternSelected()
{ {
// Retrieve the index of of the demo item from the action. // Retrieve the index of of the demo item from the action.
const KAction * action = static_cast <const KAction *> (sender()); const QAction * action = static_cast <const QAction *> (sender());
int index = action->data().toInt(); int index = action->data().toInt();
if (index > 0) { if (index > 0) {
game->loadDemo (patterns[index].filename); game->loadDemo (patterns[index].filename);
statusBar()->changeItem (i18n (patterns[index].menuText), 1001); //QT5 statusBar()->changeItem (i18n (patterns[index].menuText), 1001);
} }
else { else {
KMessageBox::information (this, KMessageBox::information (this,
...@@ -675,12 +675,12 @@ void Kubrick::patternSelected() ...@@ -675,12 +675,12 @@ void Kubrick::patternSelected()
void Kubrick::movesSelected() void Kubrick::movesSelected()
{ {
// Retrieve the index of of the demo item from the action. // Retrieve the index of of the demo item from the action.
const KAction * action = static_cast <const KAction *> (sender()); const QAction * action = static_cast <const QAction *> (sender());
int index = action->data().toInt(); int index = action->data().toInt();
if (index > 0) { if (index > 0) {
game->loadDemo (solvingMoves[index].filename); game->loadDemo (solvingMoves[index].filename);
statusBar()->changeItem (i18n (solvingMoves[index].menuText), 1001); //QT5 statusBar()->changeItem (i18n (solvingMoves[index].menuText), 1001);
} }
else { else {
KMessageBox::information (this, KMessageBox::information (this,
...@@ -705,7 +705,7 @@ void Kubrick::describePuzzle (int xDim, int yDim, int zDim, int shMoves) ...@@ -705,7 +705,7 @@ void Kubrick::describePuzzle (int xDim, int yDim, int zDim, int shMoves)
descr = i18n ("%1x%2x%3 mat, %4 shuffling moves", descr = i18n ("%1x%2x%3 mat, %4 shuffling moves",
xDim, yDim, zDim, shMoves); xDim, yDim, zDim, shMoves);
} }
statusBar()->changeItem (descr, 1001); //QT5 statusBar()->changeItem (descr, 1001);
} }
......
...@@ -32,7 +32,7 @@ class QAction; ...@@ -32,7 +32,7 @@ class QAction;
class QSignalMapper; class QSignalMapper;
class QLineEdit; class QLineEdit;
class QLabel; class QLabel;
class KAction; class QAction;
/** /**
* @short Application Main Window * @short Application Main Window
...@@ -134,7 +134,7 @@ private: ...@@ -134,7 +134,7 @@ private:
void fillDemoList (const DemoItem itemList [], QList<QAction*> &list, void fillDemoList (const DemoItem itemList [], QList<QAction*> &list,
const char *uilist, const char *slot); const char *uilist, const char *slot);
KAction * mapAction (QSignalMapper * mapper, const QString & name, QAction * mapAction (QSignalMapper * mapper, const QString & name,
const QString & text, const Qt::Key key, SingmasterMove mapping); const QString & text, const Qt::Key key, SingmasterMove mapping);
}; };
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
*******************************************************************************/ *******************************************************************************/
#include <KApplication> #include <KApplication>
#include <KAboutData> #include <K4AboutData>
#include <KCmdLineArgs> #include <KCmdLineArgs>
#include <KLocale> #include <KLocale>
...@@ -30,9 +30,9 @@ static const char version [] = "1.0"; ...@@ -30,9 +30,9 @@ static const char version [] = "1.0";
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
KAboutData about ("kubrick", 0, ki18n ("Kubrick"), K4AboutData about ("kubrick", 0, ki18n ("Kubrick"),
version, ki18n (description), version, ki18n (description),
KAboutData::License_GPL, K4AboutData::License_GPL,
ki18n ("(C) 2008 Ian Wadham"), KLocalizedString(), ki18n ("(C) 2008 Ian Wadham"), KLocalizedString(),
"http://kde.org/applications/games/kubrick/" ); "http://kde.org/applications/games/kubrick/" );
about.addAuthor (ki18n ("Ian Wadham"), ki18n ("Author"), about.addAuthor (ki18n ("Ian Wadham"), ki18n ("Author"),
...@@ -43,9 +43,6 @@ int main(int argc, char **argv) ...@@ -43,9 +43,6 @@ int main(int argc, char **argv)
KApplication app; KApplication app;
Kubrick * mainWindow = 0; Kubrick * mainWindow = 0;
// Get access to KDE Games library string translations.
KGlobal::locale()->insertCatalog( QLatin1String( "libkdegames" ));
if (app.isSessionRestored ()) { if (app.isSessionRestored ()) {
RESTORE (Kubrick); RESTORE (Kubrick);
} }
......
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