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

Port to KF5

parent 073bcad6
project (kubrick)
if(NOT COMPILING_KDEGAMES)
find_package(KDE4 REQUIRED)
include(KDE4Defaults)
include(MacroLibrary)
find_package(KDEGames REQUIRED)
set (QT_MIN_VERSION "5.3.0")
find_package(OpenGL REQUIRED)
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.")
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()
find_package(ECM 1.3.0 REQUIRED CONFIG)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
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)
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Widgets Qml Quick QuickWidgets Svg Test OpenGL)
find_package(KF5 REQUIRED COMPONENTS
CoreAddons
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 (data)
......
......@@ -15,17 +15,18 @@ set(kubrick_SRCS
scenelabel.cpp )
kde4_add_app_icon(kubrick_SRCS "hi*-app-kubrick.png")
kde4_add_executable(kubrick ${kubrick_SRCS})
add_executable(kubrick ${kubrick_SRCS})
if(WIN32)
set(opengl_libs opengl32.lib glu32.lib)
endif(WIN32)
target_link_libraries(kubrick
${QT_QTOPENGL_LIBRARY}
${KDE4_KDEUI_LIBS}
${KDE4_KIO_LIBS}
kdegames
Qt5::OpenGL
Qt5::Svg
KF5::KDELibs4Support
KF5::KIOCore
KF5KDEGames
${OPENGL_gl_LIBRARY}
${OPENGL_glu_LIBRARY}
)
......@@ -38,6 +39,6 @@ install(TARGETS kubrick ${INSTALL_TARGETS_DEFAULT_ARGS})
install( FILES kubrickui.rc DESTINATION ${DATA_INSTALL_DIR}/kubrick )
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 @@
#include "game.h"
#include "movetracker.h"
#include "scenelabel.h"
#include <KUrl>
#include <KDebug>
// Create the main game/document object
......
......@@ -32,7 +32,8 @@
#include <KAboutData>
#include <QSvgRenderer>
#include <KDebug>
#include <KGlobal>
#include <K4AboutData>
// C++ includes
#include <iostream>
......
......@@ -80,7 +80,7 @@ Kubrick::Kubrick () :
// Set up a status bar.
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.
QFont f = statusBar()->font();
......@@ -219,7 +219,7 @@ void Kubrick::initGUI()
"and start a new puzzle with the same "
"dimensions and number of shuffling moves."));
KAction *
QAction *
a = KStandardGameAction::load (
game, SLOT (load()), this);
actionCollection()->addAction (a->objectName(), a);
......@@ -297,7 +297,7 @@ void Kubrick::initGUI()
"and the cube's axes are parallel to the XYZ "
"axes, thus making keyboard moves properly "
"meaningful."));
a->setIcon (KIcon( QLatin1String( "go-home" )));
a->setIcon (QIcon::fromTheme( QLatin1String( "go-home" )));
a->setShortcut (Qt::Key_Home);
connect (a, SIGNAL (triggered(bool)), game, SLOT (setStandardView()));
......@@ -310,13 +310,13 @@ void Kubrick::initGUI()
singmasterLabel = new QLabel (i18n("Singmaster Moves"), this);
singmasterMoves = new QLineEdit (this);
KAction * w = new KAction (this);
QAction * w = new QAction (this);
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);
w->setDefaultWidget (singmasterMoves);
//QT5 w->setDefaultWidget (singmasterMoves);
QString singmasterToolTip = i18n("This area shows Singmaster moves.");
QString singmasterWhatsThis = i18nc("The letters RLFBUD are mathematical "
......@@ -385,7 +385,7 @@ void Kubrick::initGUI()
b->setToolTip (i18n ("Show one view of this cube."));
b->setWhatsThis (i18n ("Show one view of this cube, "
"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()));
b->setChecked (true);
viewMapper->setMapping (b, OneCube);
......@@ -396,7 +396,7 @@ void Kubrick::initGUI()
b->setToolTip (i18n ("Show two views of this cube."));
b->setWhatsThis (i18n ("Show two views of this cube, from "
"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()));
viewMapper->setMapping (b, TwoCubes);
viewGroup->addAction (b);
......@@ -408,7 +408,7 @@ void Kubrick::initGUI()
"large one, from the front, and two small "
"ones, from the front and the back. Only "
"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()));
viewMapper->setMapping (b, ThreeCubes);
viewGroup->addAction (b);
......@@ -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)
{
KAction * a;
QAction * a;
a = actionCollection()->addAction (name);
a->setText (text);
a->setShortcut (key);
......@@ -570,7 +570,7 @@ void Kubrick::setToggle (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,
{
// 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++) {
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);
t->setData (i); // Save the index of the item inside the action.
list.append (t);
......@@ -628,28 +628,28 @@ void Kubrick::saveNewToolbarConfig()
void Kubrick::easySelected (int index)
{
statusBar()->changeItem (i18n (easyItems [index].menuText), 1001);
//QT5 statusBar()->changeItem (i18n (easyItems [index].menuText), 1001);
game->changePuzzle (easyItems [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]);
}
void Kubrick::hardSelected (int index)
{
statusBar()->changeItem (i18n (hardItems [index].menuText), 1001);
//QT5 statusBar()->changeItem (i18n (hardItems [index].menuText), 1001);
game->changePuzzle (hardItems [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]);
}
......@@ -657,12 +657,12 @@ void Kubrick::veryHardSelected (int index)
void Kubrick::patternSelected()
{
// 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();
if (index > 0) {
game->loadDemo (patterns[index].filename);
statusBar()->changeItem (i18n (patterns[index].menuText), 1001);
//QT5 statusBar()->changeItem (i18n (patterns[index].menuText), 1001);
}
else {
KMessageBox::information (this,
......@@ -675,12 +675,12 @@ void Kubrick::patternSelected()
void Kubrick::movesSelected()
{
// 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();
if (index > 0) {
game->loadDemo (solvingMoves[index].filename);
statusBar()->changeItem (i18n (solvingMoves[index].menuText), 1001);
//QT5 statusBar()->changeItem (i18n (solvingMoves[index].menuText), 1001);
}
else {
KMessageBox::information (this,
......@@ -705,7 +705,7 @@ void Kubrick::describePuzzle (int xDim, int yDim, int zDim, int shMoves)
descr = i18n ("%1x%2x%3 mat, %4 shuffling moves",
xDim, yDim, zDim, shMoves);
}
statusBar()->changeItem (descr, 1001);
//QT5 statusBar()->changeItem (descr, 1001);
}
......
......@@ -32,7 +32,7 @@ class QAction;
class QSignalMapper;
class QLineEdit;
class QLabel;
class KAction;
class QAction;
/**
* @short Application Main Window
......@@ -134,7 +134,7 @@ private:
void fillDemoList (const DemoItem itemList [], QList<QAction*> &list,
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);
};
......
......@@ -17,7 +17,7 @@
*******************************************************************************/
#include <KApplication>
#include <KAboutData>
#include <K4AboutData>
#include <KCmdLineArgs>
#include <KLocale>
......@@ -30,9 +30,9 @@ static const char version [] = "1.0";
int main(int argc, char **argv)
{
KAboutData about ("kubrick", 0, ki18n ("Kubrick"),
K4AboutData about ("kubrick", 0, ki18n ("Kubrick"),
version, ki18n (description),
KAboutData::License_GPL,
K4AboutData::License_GPL,
ki18n ("(C) 2008 Ian Wadham"), KLocalizedString(),
"http://kde.org/applications/games/kubrick/" );
about.addAuthor (ki18n ("Ian Wadham"), ki18n ("Author"),
......@@ -43,9 +43,6 @@ int main(int argc, char **argv)
KApplication app;
Kubrick * mainWindow = 0;
// Get access to KDE Games library string translations.
KGlobal::locale()->insertCatalog( QLatin1String( "libkdegames" ));
if (app.isSessionRestored ()) {
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