[kde-doc-english] [picmi/frameworks] /: initial port to Qt5 & KF5

Stefan Derkits stefan at derkits.at
Tue Oct 21 09:36:37 UTC 2014


Git commit 92a6b62290178f5231c93fa2d482c5edd495a2c2 by Stefan Derkits.
Committed on 20/10/2014 at 11:31.
Pushed by gruber into branch 'frameworks'.

initial port to Qt5 & KF5

M  +21   -8    CMakeLists.txt
M  +2    -1    doc/CMakeLists.txt
M  +1    -1    doc/index.docbook
R  +-    --    icons/128-apps-picmi.png [from: icons/hi128-apps-picmi.png - 100% similarity]
R  +-    --    icons/16-apps-picmi.png [from: icons/hi16-apps-picmi.png - 100% similarity]
R  +-    --    icons/22-apps-picmi.png [from: icons/hi22-apps-picmi.png - 100% similarity]
R  +-    --    icons/256-apps-picmi.png [from: icons/hi256-apps-picmi.png - 100% similarity]
R  +-    --    icons/32-apps-picmi.png [from: icons/hi32-apps-picmi.png - 100% similarity]
R  +-    --    icons/48-apps-picmi.png [from: icons/hi48-apps-picmi.png - 100% similarity]
R  +-    --    icons/64-apps-picmi.png [from: icons/hi64-apps-picmi.png - 100% similarity]
M  +1    -2    icons/CMakeLists.txt
M  +11   -9    src/CMakeLists.txt
M  +2    -2    src/gui/CMakeLists.txt
M  +2    -2    src/gui/mainwindow.cpp
M  +2    -2    src/gui/mainwindow.h
M  +1    -1    src/gui/settingswindow.cpp
M  +1    -1    src/logic/CMakeLists.txt
M  +5    -5    src/main.cpp

http://commits.kde.org/picmi/92a6b62290178f5231c93fa2d482c5edd495a2c2

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c9c31e4..609fe24 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,18 +1,31 @@
-cmake_minimum_required (VERSION 2.8.0)
+cmake_minimum_required (VERSION 2.8.12)
 project (picmi)
 
 if (NOT CMAKE_BUILD_TYPE)
    set(CMAKE_BUILD_TYPE Release)
 endif ()
 
-set(QT_USE_QTSVG TRUE)
-set(QT_USE_QTXML TRUE)
+find_package(ECM REQUIRED NO_MODULE)
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
 
-find_package(Qt4 REQUIRED)
-find_package(KDE4 REQUIRED)
-find_package(KDEGames 4.9.0 REQUIRED)
+find_package(Qt5 5.2.0 CONFIG REQUIRED Core Widgets Svg Xml Qml Quick QuickWidgets)
+find_package(KF5 REQUIRED COMPONENTS
+ CoreAddons
+ WidgetsAddons
+ I18n
+ XmlGui
+ KDELibs4Support
+ NewStuff
+ Declarative
+)
 
-include(KDE4Defaults)
+find_package(KF5KDEGames 4.9.0 REQUIRED)
+
+include(KDEInstallDirs)
+include(KDECompilerSettings)
+include(KDECMakeSettings)
+include(FeatureSummary)
+include(ECMInstallIcons)
 
 add_subdirectory(themes)
 add_subdirectory(icons)
@@ -22,6 +35,6 @@ add_subdirectory(src)
 add_subdirectory(test)
 
 install(FILES ${CMAKE_SOURCE_DIR}/picmi.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})
-install(FILES ${CMAKE_SOURCE_DIR}/picmiui.rc DESTINATION ${DATA_INSTALL_DIR}/picmi)
+install(FILES ${CMAKE_SOURCE_DIR}/picmiui.rc DESTINATION  ${KXMLGUI_INSTALL_DIR}/picmi)
 
 # vim:set ts=4 sw=4 et:
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
index 1c6c53f..6afceba 100644
--- a/doc/CMakeLists.txt
+++ b/doc/CMakeLists.txt
@@ -1,3 +1,4 @@
-kde4_create_handbook(index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/en SUBDIR picmi)
+kdoctools_create_handbook(index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/en SUBDIR picmi)
+
 
 # vim:set ts=4 sw=4 et:
diff --git a/doc/index.docbook b/doc/index.docbook
index b0e442c..3c4f98e 100644
--- a/doc/index.docbook
+++ b/doc/index.docbook
@@ -1,5 +1,5 @@
 <?xml version="1.0" ?>
-<!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.2-Based Variant V1.1//EN" "dtd/kdex.dtd" [
+<!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.5-Based Variant V1.1//EN" "dtd/kdedbx45.dtd" [
 <!ENTITY picmi "<application>Picmi</application>">
 <!ENTITY kappname "&picmi;">
 <!ENTITY package "kdegames">
diff --git a/icons/hi128-apps-picmi.png b/icons/128-apps-picmi.png
similarity index 100%
rename from icons/hi128-apps-picmi.png
rename to icons/128-apps-picmi.png
diff --git a/icons/hi16-apps-picmi.png b/icons/16-apps-picmi.png
similarity index 100%
rename from icons/hi16-apps-picmi.png
rename to icons/16-apps-picmi.png
diff --git a/icons/hi22-apps-picmi.png b/icons/22-apps-picmi.png
similarity index 100%
rename from icons/hi22-apps-picmi.png
rename to icons/22-apps-picmi.png
diff --git a/icons/hi256-apps-picmi.png b/icons/256-apps-picmi.png
similarity index 100%
rename from icons/hi256-apps-picmi.png
rename to icons/256-apps-picmi.png
diff --git a/icons/hi32-apps-picmi.png b/icons/32-apps-picmi.png
similarity index 100%
rename from icons/hi32-apps-picmi.png
rename to icons/32-apps-picmi.png
diff --git a/icons/hi48-apps-picmi.png b/icons/48-apps-picmi.png
similarity index 100%
rename from icons/hi48-apps-picmi.png
rename to icons/48-apps-picmi.png
diff --git a/icons/hi64-apps-picmi.png b/icons/64-apps-picmi.png
similarity index 100%
rename from icons/hi64-apps-picmi.png
rename to icons/64-apps-picmi.png
diff --git a/icons/CMakeLists.txt b/icons/CMakeLists.txt
index cc7c140..378d431 100644
--- a/icons/CMakeLists.txt
+++ b/icons/CMakeLists.txt
@@ -1,4 +1,3 @@
-kde4_install_icons(${ICON_INSTALL_DIR})
-kde4_update_iconcache()
+ecm_install_icons(${ICON_INSTALL_DIR})
 
 # vim:set ts=4 sw=4 et:
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a2fdd59..de61048 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -5,7 +5,7 @@ if (NOT PICMI_FILEPATH)
     set(PICMI_FILEPATH ${DATA_INSTALL_DIR}/picmi/)
 endif ()
 
-add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
+add_definitions(${QT_DEFINITIONS} ${KDE_DEFINITIONS})
 remove_definitions(-DQT_NO_STL)
 
 # See http://www.cmake.org/pipermail/cmake/2008-June/022381.html
@@ -17,7 +17,6 @@ if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
 endif ()
 
 include(CheckIncludeFileCXX)
-include(${QT_USE_FILE})
 add_definitions(${QT_DEFINITIONS})
 
 configure_file(
@@ -26,8 +25,6 @@ configure_file(
 )
 
 include_directories(
-    ${KDE4_INCLUDES}
-    ${KDEGAMES_INCLUDE_DIR}
     ${CMAKE_SOURCE_DIR}
     ${CMAKE_CURRENT_BINARY_DIR}
 )
@@ -42,8 +39,10 @@ set(picmi_SRCS
     systemexception.cpp
 )
 
+# only does work on windows & mac, not sure what the kf5 euqivalent is
 kde4_add_app_icon(picmi_SRCS "${CMAKE_SOURCE_DIR}/icons/hi*-apps-picmi.png")
-kde4_add_executable(picmi
+
+add_executable(picmi
     ${picmi_SRCS}
 )
 
@@ -51,10 +50,13 @@ set(picmi_LIBS picmi_gui picmi_logic)
 
 target_link_libraries(picmi
     ${picmi_LIBS}
-    ${KDEGAMES_LIBRARY}
-    ${KDE4_KDEUI_LIBS}
-    ${KDE4_KDECORE_LIBS}
-    ${QT_LIBRARIES}
+    KF5::CoreAddons
+    KF5::WidgetsAddons
+    KF5::KDELibs4Support
+    KF5::XmlGui
+    KF5::I18n
+    Qt5::Svg
+    KF5KDEGames
 )
 
 install(TARGETS picmi DESTINATION ${INSTALL_TARGETS_DEFAULT_ARGS})
diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt
index 43d75ed..c2b2d8a 100644
--- a/src/gui/CMakeLists.txt
+++ b/src/gui/CMakeLists.txt
@@ -20,13 +20,13 @@ set(picmi_FORMS
     ${CMAKE_CURRENT_SOURCE_DIR}/settingswindow.ui
     ${CMAKE_CURRENT_SOURCE_DIR}/selectboardwindow.ui
 )
-qt4_wrap_ui(picmi_FORMS_HEADERS ${picmi_FORMS})
+qt5_wrap_ui(picmi_FORMS_HEADERS ${picmi_FORMS})
 
 include_directories(
     ${CMAKE_CURRENT_BINARY_DIR}
 )
 
-kde4_add_library(picmi_gui STATIC
+add_library(picmi_gui STATIC
     ${gui_SRCS}
     ${graphicsitems_SRCS}
     ${picmi_FORMS_HEADERS}
diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp
index 1821fca..c978ea1 100644
--- a/src/gui/mainwindow.cpp
+++ b/src/gui/mainwindow.cpp
@@ -71,13 +71,13 @@ void MainWindow::setupActions() {
 
     m_action_save_state = actionCollection()->addAction("save-position");
     m_action_save_state->setText(i18n("Save Position"));
-    m_action_save_state->setIcon(KIcon("list-add"));
+    m_action_save_state->setIcon(QIcon("list-add"));
     m_action_save_state->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S));
     connect(m_action_save_state, SIGNAL(triggered()), this, SLOT(saveState()));
 
     m_action_load_state = actionCollection()->addAction("load-position");
     m_action_load_state->setText(i18n("Load Position"));
-    m_action_load_state->setIcon(KIcon("view-refresh"));
+    m_action_load_state->setIcon(QIcon("view-refresh"));
     m_action_load_state->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_L));
     connect(m_action_load_state, SIGNAL(triggered()), this, SLOT(loadState()));
 
diff --git a/src/gui/mainwindow.h b/src/gui/mainwindow.h
index 84dd502..ad097b8 100644
--- a/src/gui/mainwindow.h
+++ b/src/gui/mainwindow.h
@@ -23,7 +23,7 @@
 
 #include <QTimer>
 #include <highscore/kscoredialog.h>
-#include <kaction.h>
+#include <qaction.h>
 #include <ktoggleaction.h>
 #include <kxmlguiwindow.h>
 #include <kgdifficulty.h>
@@ -83,7 +83,7 @@ private:
     QSharedPointer<KScoreDialog> createScoreDialog();
     void setupActions();
 
-    KAction *m_action_undo,
+    QAction *m_action_undo,
             *m_action_save_state,
             *m_action_load_state,
             *m_action_hint,
diff --git a/src/gui/settingswindow.cpp b/src/gui/settingswindow.cpp
index dd838c8..750d9bf 100644
--- a/src/gui/settingswindow.cpp
+++ b/src/gui/settingswindow.cpp
@@ -70,7 +70,7 @@ void SettingsWindow::selectUnsolvedColor()
 
 void SettingsWindow::bgToolButtonClicked()
 {
-    QString fileName = KFileDialog::getOpenFileName(KUrl(),
+    QString fileName = KFileDialog::getOpenFileName(QUrl(),
                                                     i18n("*.png *.jpg|Image Files (*.png *.jpg)"),
                                                     this, i18n("Select Background"));
 
diff --git a/src/logic/CMakeLists.txt b/src/logic/CMakeLists.txt
index 0433665..62704c1 100644
--- a/src/logic/CMakeLists.txt
+++ b/src/logic/CMakeLists.txt
@@ -8,7 +8,7 @@ set(logic_SRCS
     streaks.cpp
 )
 
-kde4_add_library(picmi_logic STATIC
+add_library(picmi_logic STATIC
     ${logic_SRCS}
 )
 
diff --git a/src/main.cpp b/src/main.cpp
index 943854f..8e76d7b 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -17,7 +17,7 @@
 
 
 #include "config.h"
-#include <kaboutdata.h>
+#include <k4aboutdata.h>
 #include <kapplication.h>
 #include <kcmdlineargs.h>
 
@@ -25,20 +25,20 @@
 
 int main(int argc, char *argv[])
 {
-    KAboutData about ("picmi",
+    K4AboutData about ("picmi",
                       0,
                       ki18n("Picmi"),
                       QString("%1.%2.%3").arg(VERSION_MAJOR).arg(VERSION_MINOR).arg(VERSION_PATCH).toAscii(),
                       ki18n("Picmi - a nonogram puzzle game"),
-                      KAboutData::License_GPL_V2,
-                      ki18n("(c) 2012 The Picmi Authors"),
+                      K4AboutData::License_GPL_V2,
+                      ki18n("(c) 2012 - 2014 The Picmi Authors"),
                       KLocalizedString(),
                       "https://projects.kde.org/projects/kde/kdegames/picmi");
     about.addAuthor(ki18n("Jakob Gruber"), ki18n("Picmi Author"), "jakob.gruber at gmail.com");
 
     KCmdLineArgs::init(argc, argv, &about);
     KApplication app;
-    KGlobal::locale()->insertCatalog( QLatin1String( "libkdegames" ));
+    KLocalizedString::setApplicationDomain( "picmi" );
 
     MainWindow *w = new MainWindow;
     w->show();



More information about the kde-doc-english mailing list