summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Feck <[email protected]>2014-09-29 00:23:13 +0200
committerChristoph Feck <[email protected]>2014-09-29 00:23:13 +0200
commit16b8db13dee5c9b88bbbb60d2674c4d4acd18cd0 (patch)
tree5cb832d4267a7acb868c41ba2af6398e988de08f
parent03100aaf78ee1df04216d1c4780667e9fd91d795 (diff)
Initial port to KF5
Compiles and runs (using kdelibs4support), but detection of QAccessibleClient has been disabled, because it would find the KDE4 version. CCMAIL: [email protected]
-rw-r--r--CMakeLists.txt37
-rw-r--r--colorsim.cpp2
-rw-r--r--colorsim.h4
-rw-r--r--doc/CMakeLists.txt4
-rw-r--r--kmag.cpp27
-rw-r--r--kmag.h13
-rw-r--r--kmagselrect.cpp14
-rw-r--r--kmagselrect.h8
-rw-r--r--kmagzoomview.cpp29
-rw-r--r--kmagzoomview.h26
-rw-r--r--main.cpp6
11 files changed, 94 insertions, 76 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ebbe146..f16f701 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,17 +1,34 @@
project(kmag)
-find_package(KDE4 REQUIRED)
-include (KDE4Defaults)
-include (MacroLibrary)
+cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
+set(QT_MIN_VERSION "5.2.0")
-macro_optional_find_package(QAccessibilityClient)
-macro_log_feature(QAccessibilityClient_FOUND "qaccessibilityclient" "KDE client-side accessibility library" "https://projects.kde.org/projects/playground/accessibility/libkdeaccessibilityclient" FALSE "" "Required to enable keyboard focus tracking.")
+find_package(ECM 1.3.0 REQUIRED NO_MODULE)
+set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
+
+add_definitions(-DTRANSLATION_DOMAIN="kmag")
+
+include(KDEInstallDirs)
+include(KDECompilerSettings)
+include(KDECMakeSettings)
+include(FeatureSummary)
+
+find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS
+ Core
+ Widgets
+)
+
+find_package(KF5 REQUIRED COMPONENTS
+ KDELibs4Support
+)
+
+#macro_optional_find_package(QAccessibilityClient)
+#macro_log_feature(QAccessibilityClient_FOUND "qaccessibilityclient" "KDE client-side accessibility library" "https://projects.kde.org/projects/playground/accessibility/libkdeaccessibilityclient" FALSE "" "Required to enable keyboard focus tracking.")
configure_file(
"${PROJECT_SOURCE_DIR}/focustrackconfig.h.in"
"${PROJECT_BINARY_DIR}/focustrackconfig.h")
-add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
add_definitions( -DQT_NO_CAST_FROM_ASCII )
add_definitions( -DQT_NO_CAST_TO_ASCII )
add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
@@ -32,21 +49,21 @@ set(kmag_SRCS
colorsim.cpp
main.cpp )
-kde4_add_executable(kmag ${kmag_SRCS})
+add_executable(kmag ${kmag_SRCS})
-target_link_libraries(kmag ${KDE4_KIO_LIBS})
+target_link_libraries(kmag Qt5::Core Qt5::Widgets KF5::KDELibs4Support)
if(QAccessibilityClient_FOUND)
target_link_libraries(kmag ${QACCESSIBILITYCLIENT_LIBRARY})
endif(QAccessibilityClient_FOUND)
install(TARGETS kmag ${INSTALL_TARGETS_DEFAULT_ARGS} )
-macro_display_feature_log()
+feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
########### install files ###############
install( PROGRAMS kmag.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} )
-install( FILES kmagui.rc DESTINATION ${DATA_INSTALL_DIR}/kmag )
+install( FILES kmagui.rc DESTINATION ${KXMLGUI_INSTALL_DIR}/kmag )
kde4_install_icons( ${ICON_INSTALL_DIR} )
diff --git a/colorsim.cpp b/colorsim.cpp
index c550483..d5935d9 100644
--- a/colorsim.cpp
+++ b/colorsim.cpp
@@ -33,7 +33,7 @@ Citations:
#include "colorsim.h"
// include files for Qt
-#include <QtGui/QColor>
+#include <QColor>
#include <math.h>
diff --git a/colorsim.h b/colorsim.h
index 23d2f9c..75c4ed0 100644
--- a/colorsim.h
+++ b/colorsim.h
@@ -19,8 +19,8 @@
#define KMAGCOLORSIM_H
// include files for Qt
-#include <QtGui/QImage>
-#include <QtGui/QPixmap>
+#include <QImage>
+#include <QPixmap>
namespace ColorSim {
/**
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
index c19af9f..408411a 100644
--- a/doc/CMakeLists.txt
+++ b/doc/CMakeLists.txt
@@ -1,5 +1,5 @@
########### install files ###############
#
-kde4_create_handbook(index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/en SUBDIR kmag)
-kde4_create_manpage(man-kmag.1.docbook 1 INSTALL_DESTINATION ${MAN_INSTALL_DIR})
+kdoctools_create_handbook(index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/en SUBDIR kmag)
+kdoctools_create_manpage(man-kmag.1.docbook 1 INSTALL_DESTINATION ${MAN_INSTALL_DIR})
diff --git a/kmag.cpp b/kmag.cpp
index dd2331f..71530e3 100644
--- a/kmag.cpp
+++ b/kmag.cpp
@@ -22,15 +22,15 @@
***************************************************************************/
// include files for QT
-#include <QtCore/QDir>
-#include <QtCore/QPointer>
-#include <QtGui/QPrintDialog>
-#include <QtGui/QPainter>
-#include <QtGui/QLayout>
-#include <QtGui/QClipboard>
-#include <QtGui/QContextMenuEvent>
-#include <QtGui/QPixmap>
-#include <QtGui/QDesktopWidget>
+#include <QDir>
+#include <QPointer>
+#include <QPrintDialog>
+#include <QPainter>
+#include <QLayout>
+#include <QClipboard>
+#include <QContextMenuEvent>
+#include <QPixmap>
+#include <QDesktopWidget>
// include files for KDE
#include <kxmlguiclient.h>
@@ -50,6 +50,7 @@
#include <kmenubar.h>
#include <klocale.h>
#include <kconfig.h>
+#include <kconfiggroup.h>
#include <kdebug.h>
#include <kstandardaction.h>
#include <khelpmenu.h>
@@ -63,7 +64,7 @@
#include <kdeprintdialog.h>
// application specific includes
-#include "kmag.moc"
+#include "kmag.h"
#include "kmagzoomview.h"
#include "kmagselrect.h"
@@ -583,7 +584,7 @@ void KmagApp::saveZoomPixmap()
toggled = true;
}
- KUrl url = KFileDialog::getSaveUrl(QString(),
+ QUrl url = KFileDialog::getSaveUrl(QString(),
KImageIO::pattern(KImageIO::Writing),
0,i18n("Save Snapshot As"));
@@ -602,7 +603,7 @@ void KmagApp::saveZoomPixmap()
KMessageBox::error(0, i18n("Unable to upload file over the network."),
i18n("Error Writing File"));
} else {
- KMessageBox::information(0, i18n("Current zoomed image saved to\n%1", url.prettyUrl()),
+ KMessageBox::information(0, i18n("Current zoomed image saved to\n%1", url.toDisplayString()),
i18n("Information"), QLatin1String( "save_confirm" ));
}
}
@@ -615,7 +616,7 @@ void KmagApp::saveZoomPixmap()
KMessageBox::error(0, i18n("Unable to save file. Please check if you have permission to write to the directory."),
i18n("Error Writing File"));
} else {
- KMessageBox::information(0, i18n("Current zoomed image saved to\n%1", url.prettyUrl()),
+ KMessageBox::information(0, i18n("Current zoomed image saved to\n%1", url.toDisplayString()),
i18n("Information"), QLatin1String( "save_confirm" ));
}
}
diff --git a/kmag.h b/kmag.h
index 5caeaf2..23ccfb9 100644
--- a/kmag.h
+++ b/kmag.h
@@ -28,14 +28,15 @@
#include "focustrackconfig.h"
// include files for Qt
-#include <QtGui/QContextMenuEvent>
-#include <QtGui/QPrinter>
+#include <QContextMenuEvent>
+#include <QPrinter>
// include files for KDE
#include <kxmlguiwindow.h>
-#include <kaction.h>
+#include <ktoggleaction.h>
+#include <kselectaction.h>
#include <knuminput.h>
-#include <kconfig.h>
+#include <ksharedconfig.h>
/**
* The base class for Kmag application windows. It sets up the main
@@ -183,12 +184,12 @@ class KmagApp : public KXmlGuiWindow
KSharedConfigPtr config;
// KAction pointers to enable/disable actions
- KAction *fileNewWindow, *m_pSnapshot, *m_pCopy, *m_keyConf, *m_toolConf;
+ QAction *fileNewWindow, *m_pSnapshot, *m_pCopy, *m_keyConf, *m_toolConf;
QAction *m_pPrint;
QAction *m_pZoomIn;
QAction *m_pZoomOut;
QAction *m_pQuit;
- KAction *refreshSwitch;
+ QAction *refreshSwitch;
KToggleAction *m_pShowMenu;
KSelectAction *m_pZoomBox, *m_pRotationBox, *m_pFPSBox, *m_pColorBox;
diff --git a/kmagselrect.cpp b/kmagselrect.cpp
index 456c1ee..a5777c1 100644
--- a/kmagselrect.cpp
+++ b/kmagselrect.cpp
@@ -20,13 +20,13 @@
#include "kmagselrect.h"
#include "kmagselrect.moc"
-#include <QtGui/QApplication>
-#include <QtGui/QCursor>
-#include <QtGui/QPixmap>
-#include <QtGui/QBitmap>
-#include <QtGui/QMouseEvent>
-#include <QtGui/QLabel>
-#include <QtGui/QDesktopWidget>
+#include <QApplication>
+#include <QCursor>
+#include <QPixmap>
+#include <QBitmap>
+#include <QMouseEvent>
+#include <QLabel>
+#include <QDesktopWidget>
#include <klocale.h>
diff --git a/kmagselrect.h b/kmagselrect.h
index d219fe8..2445a90 100644
--- a/kmagselrect.h
+++ b/kmagselrect.h
@@ -23,10 +23,10 @@
#include <stdlib.h>
// Qt includes
-#include <QtCore/QRect>
-#include <QtGui/QWidget>
-#include <QtGui/QLabel>
-#include <QtGui/QMouseEvent>
+#include <QRect>
+#include <QWidget>
+#include <QLabel>
+#include <QMouseEvent>
class KMagSelWinCorner : public QLabel
{
diff --git a/kmagzoomview.cpp b/kmagzoomview.cpp
index 25b0088..b043625 100644
--- a/kmagzoomview.cpp
+++ b/kmagzoomview.cpp
@@ -28,21 +28,20 @@
#include "colorsim.h"
// include files for Qt
-#include <QtGui/QBitmap>
-#include <QtGui/QCursor>
-#include <QtCore/qglobal.h>
-#include <QtGui/QPainter>
-#include <QtGui/QWidget>
-#include <QtGui/QScrollBar>
-#include <QtGui/QPixmap>
-#include <QtGui/QFocusEvent>
-#include <QtGui/QHideEvent>
-#include <QtGui/QKeyEvent>
-#include <QtGui/QShowEvent>
-#include <QtGui/QResizeEvent>
-#include <QtGui/QMouseEvent>
-#include <QtGui/QDesktopWidget>
-#include <QtDBus/QDBusConnection>
+#include <QBitmap>
+#include <QCursor>
+#include <QPainter>
+#include <QWidget>
+#include <QScrollBar>
+#include <QPixmap>
+#include <QFocusEvent>
+#include <QHideEvent>
+#include <QKeyEvent>
+#include <QShowEvent>
+#include <QResizeEvent>
+#include <QMouseEvent>
+#include <QDesktopWidget>
+#include <QDBusConnection>
// include files for KDE
#include <kapplication.h>
diff --git a/kmagzoomview.h b/kmagzoomview.h
index c6dcb4d..a1d86f5 100644
--- a/kmagzoomview.h
+++ b/kmagzoomview.h
@@ -25,19 +25,19 @@
#define KMagZoomView_h
// include files for Qt
-#include <QtGui/QWidget>
-#include <QtGui/QPainter>
-#include <QtGui/QPixmap>
-#include <QtCore/QTimer>
-#include <QtGui/QAbstractScrollArea>
-#include <QtCore/QRect>
-#include <QtGui/QCursor>
-#include <QtGui/QFocusEvent>
-#include <QtGui/QHideEvent>
-#include <QtGui/QKeyEvent>
-#include <QtGui/QShowEvent>
-#include <QtGui/QResizeEvent>
-#include <QtGui/QMouseEvent>
+#include <QWidget>
+#include <QPainter>
+#include <QPixmap>
+#include <QTimer>
+#include <QAbstractScrollArea>
+#include <QRect>
+#include <QCursor>
+#include <QFocusEvent>
+#include <QHideEvent>
+#include <QKeyEvent>
+#include <QShowEvent>
+#include <QResizeEvent>
+#include <QMouseEvent>
//class KMagSelRect;
#include "kmagselrect.h"
diff --git a/main.cpp b/main.cpp
index 3469742..cd5a590 100644
--- a/main.cpp
+++ b/main.cpp
@@ -16,7 +16,7 @@
***************************************************************************/
#include <kcmdlineargs.h>
-#include <kaboutdata.h>
+#include <k4aboutdata.h>
#include <klocale.h>
#include <ktoggleaction.h>
#include <kselectaction.h>
@@ -36,9 +36,9 @@ KmagApp *kmagapp;
int main(int argc, char *argv[])
{
// about the application
- KAboutData *aboutData = new KAboutData("kmag", 0, ki18n("KMagnifier"), KMAG_VERSION,
+ K4AboutData *aboutData = new K4AboutData("kmag", 0, ki18n("KMagnifier"), KMAG_VERSION,
ki18n("Screen magnifier for the K Desktop Environment (KDE)"),
- KAboutData::License_GPL,
+ K4AboutData::License_GPL,
ki18n("Copyright 2001-2003 Sarang Lakare\nCopyright 2003-2004 Olaf Schmidt\nCopyright 2008 Matthew Woehlke"), KLocalizedString(),
"http://accessibility.kde.org/");