Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 75275cbc authored by Luigi Toscano's avatar Luigi Toscano

Initial port to KF5

Mostly through the scripts from kde-dev-scripts/kf5 and few fixes
to make it compile.
It starts and basic operations are working (load files, create shapes,
edit shapes, save HTML) but there is at least one piece of commented
code that needs a proper port and in general more cleanup.
parent 0f17b66f
project(kimagemapeditor)
find_package(KDE4 REQUIRED)
include (KDE4Defaults)
include (MacroLibrary)
add_definitions( ${QT_QTDBUS_DEFINITIONS} ${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES})
cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR)
set (QT_MIN_VERSION "5.7.0")
set (KF5_MIN_VERSION "5.15.0")
find_package(ECM ${KF5_MIN_VERSION} 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
Gui
Widgets
)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
Config
ConfigWidgets
CoreAddons
Crash
DBusAddons
DocTools
GuiAddons
KHtml
Parts
I18n
WidgetsAddons
XmlGui
KDELibs4Support
)
include(FeatureSummary)
include(ECMInstallIcons)
include(KDEInstallDirs)
include(KDECompilerSettings NO_POLICY_SCOPE)
include(KDECMakeSettings)
include(ECMOptionalAddSubdirectory)
include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} )
add_subdirectory( pics )
macro_optional_add_subdirectory(doc)
ecm_optional_add_subdirectory(doc)
set(libkimagemapeditorcommon_SRC
areacreator.cpp
......@@ -21,7 +50,7 @@ set(libkimagemapeditorcommon_SRC
imageslistview.cpp
mapslistview.cpp
imagemapchoosedialog.cpp
)
)
########### next target ###############
......@@ -29,11 +58,11 @@ set(libkimagemapeditorcommon_SRC
set(kimagemapeditor_bin_SRCS main.cpp kimeshell.cpp ${libkimagemapeditorcommon_SRC})
kde4_add_executable(kimagemapeditor_bin ${kimagemapeditor_bin_SRCS})
add_executable(kimagemapeditor_bin ${kimagemapeditor_bin_SRCS})
set_target_properties(kimagemapeditor_bin PROPERTIES OUTPUT_NAME kimagemapeditor)
target_link_libraries(kimagemapeditor_bin ${KDE4_KHTML_LIBS} )
target_link_libraries(kimagemapeditor_bin KF5::KHtml KF5::KDELibs4Support)
install(TARGETS kimagemapeditor_bin ${INSTALL_TARGETS_DEFAULT_ARGS} )
......@@ -43,11 +72,10 @@ install(TARGETS kimagemapeditor_bin ${INSTALL_TARGETS_DEFAULT_ARGS} )
set(kimagemapeditor_PART_SRCS ${libkimagemapeditorcommon_SRC})
kde4_add_plugin(kimagemapeditor WITH_PREFIX ${kimagemapeditor_PART_SRCS})
add_library(kimagemapeditor MODULE ${kimagemapeditor_PART_SRCS})
target_link_libraries(kimagemapeditor ${KDE4_KHTML_LIBS} )
target_link_libraries(kimagemapeditor KF5::KHtml KF5::KDELibs4Support)
install(TARGETS kimagemapeditor DESTINATION ${PLUGIN_INSTALL_DIR})
......@@ -57,7 +85,8 @@ install(TARGETS kimagemapeditor DESTINATION ${PLUGIN_INSTALL_DIR})
########### install files ###############
install( FILES org.kde.kimagemapeditor.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})
install( FILES kimagemapeditorpart.desktop DESTINATION ${SERVICES_INSTALL_DIR})
install( FILES kimagemapeditorui.rc kimagemapeditorpartui.rc DESTINATION ${DATA_INSTALL_DIR}/kimagemapeditor)
install( FILES org.kde.kimagemapeditor.desktop DESTINATION ${KDE_INSTALL_APPDIR})
install( FILES kimagemapeditorpart.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR})
install( FILES kimagemapeditorui.rc kimagemapeditorpartui.rc DESTINATION ${KDE_INSTALL_KXMLGUI5DIR}/kimagemapeditor)
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
......@@ -15,16 +15,16 @@
* *
***************************************************************************/
// QT
// Qt
#include <QTreeWidget>
#include <qpushbutton.h>
#include <qtooltip.h>
// KDE
// KDE Frameworks
#include <kiconloader.h>
#include <klocale.h>
#include <klocalizedstring.h>
#include <kvbox.h>
// local
......
kde4_create_handbook(index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/en SUBDIR kimagemapeditor)
kdoctools_create_handbook(index.docbook INSTALL_DESTINATION ${KDE_INSTALL_DOCBUNDLEDIR}/en SUBDIR kimagemapeditor)
......@@ -15,7 +15,7 @@
* *
***************************************************************************/
// QT
// Qt
#include <qbitmap.h>
#include <qpainter.h>
#include <qpixmap.h>
......@@ -25,13 +25,14 @@
#include <QDragEnterEvent>
#include <QMouseEvent>
// KDE
// KDE Frameworks
#include <kdebug.h>
#include <kglobal.h>
#include <kstandarddirs.h>
#include <kapplication.h>
#include <kmimetype.h>
#include <kundostack.h>
#include <QStandardPaths>
// Local
#include "drawzone.h"
......@@ -67,16 +68,16 @@ DrawZone::DrawZone(QWidget *parent,KImageMapEditor* _imageMapEditor)
rectangleCursor = createRectangleCursor();
circleCursor = createCircleCursor();
QString path = KGlobal::dirs()->findResource( "data", "kimagemapeditor/polygoncursor.png" );
QString path = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kimagemapeditor/polygoncursor.png" );
polygonCursor = QCursor(QPixmap(path),8,8);
path = KGlobal::dirs()->findResource( "data", "kimagemapeditor/freehandcursor.png" );
path = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kimagemapeditor/freehandcursor.png" );
freehandCursor = QCursor(QPixmap(path),8,8);
path = KGlobal::dirs()->findResource( "data", "kimagemapeditor/addpointcursor.png" );
path = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kimagemapeditor/addpointcursor.png" );
addPointCursor = QCursor(QPixmap(path),8,8);
path = KGlobal::dirs()->findResource( "data", "kimagemapeditor/removepointcursor.png" );
path = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kimagemapeditor/removepointcursor.png" );
removePointCursor = QCursor(QPixmap(path),8,8);
}
......
......@@ -29,8 +29,6 @@
#include <QResizeEvent>
#include <QDropEvent>
#include "kdeversion.h"
#include "kimagemapeditor.h"
class Area;
......
......@@ -27,8 +27,6 @@
#include <QMouseEvent>
#include <QResizeEvent>
#include "kdeversion.h"
/**
*@author Jan Schäfer
*/
......
......@@ -15,12 +15,12 @@
* *
***************************************************************************/
// QT
// Qt
#include <QLinkedList>
// KDE
#include <klocale.h>
// KDE Frameworks
#include <klocalizedstring.h>
#include <kdebug.h>
// locale
......
This diff is collapsed.
......@@ -26,12 +26,9 @@
#include <QPixmap>
#include <QTextStream>
#include <KConfig>
#include <KParts/ReadWritePart>
#include <kurl.h>
#include <kparts/part.h>
#include <kparts/browserextension.h>
#include <kparts/factory.h>
#include <kdeversion.h>
#include "kimearea.h"
......@@ -111,12 +108,11 @@ typedef QList<HtmlElement*> HtmlContent;
class KSelectAction;
class KAction;
class QAction;
class KRecentFilesAction;
class KAction;
class QAction;
///class QListViewItem;
class KUndoStack;
class KApplication;
class QTabWidget;
class AreaListView;
class ImagesListView;
......@@ -142,7 +138,6 @@ public :
QObject *parent, const QStringList & args = QStringList());
virtual ~KImageMapEditor();
static KAboutData *createAboutData();
static KConfig *config();
/**
......@@ -178,8 +173,6 @@ public :
int showTagEditor(Area *);
KUndoStack *commandHistory() const;
KApplication* app() const;
// Only refreshes the listView
void updateSelection() const;
......@@ -262,49 +255,49 @@ private:
// Actions
//
KSelectAction* zoomAction;
KAction *arrowAction;
KAction *circleAction;
KAction *rectangleAction;
KAction *polygonAction;
KAction *freehandAction;
KAction *addPointAction;
KAction *removePointAction;
KAction *cutAction;
KAction *deleteAction;
KAction *copyAction;
KAction *pasteAction;
KAction *zoomInAction;
KAction *zoomOutAction;
KAction *mapNewAction;
KAction *mapDeleteAction;
KAction *mapNameAction;
KAction *mapDefaultAreaAction;
KAction *imageAddAction;
KAction *imageRemoveAction;
KAction *imageUsemapAction;
QAction *arrowAction;
QAction *circleAction;
QAction *rectangleAction;
QAction *polygonAction;
QAction *freehandAction;
QAction *addPointAction;
QAction *removePointAction;
QAction *cutAction;
QAction *deleteAction;
QAction *copyAction;
QAction *pasteAction;
QAction *zoomInAction;
QAction *zoomOutAction;
QAction *mapNewAction;
QAction *mapDeleteAction;
QAction *mapNameAction;
QAction *mapDefaultAreaAction;
QAction *imageAddAction;
QAction *imageRemoveAction;
QAction *imageUsemapAction;
KToggleAction *highlightAreasAction;
KToggleAction *showAltAction;
KAction *areaPropertiesAction;
QAction *areaPropertiesAction;
KAction *moveLeftAction;
KAction *moveRightAction;
KAction *moveUpAction;
KAction *moveDownAction;
QAction *moveLeftAction;
QAction *moveRightAction;
QAction *moveUpAction;
QAction *moveDownAction;
KAction *increaseWidthAction;
KAction *decreaseWidthAction;
KAction *increaseHeightAction;
KAction *decreaseHeightAction;
QAction *increaseWidthAction;
QAction *decreaseWidthAction;
QAction *increaseHeightAction;
QAction *decreaseHeightAction;
KAction *toFrontAction;
KAction *toBackAction;
KAction *forwardOneAction;
KAction *backOneAction;
QAction *toFrontAction;
QAction *toBackAction;
QAction *forwardOneAction;
QAction *backOneAction;
KToggleAction* configureShowAreaListAction;
KToggleAction* configureShowMapListAction;
......@@ -352,7 +345,7 @@ private:
void drawToCenter(QPainter* p, const QString & str, int y, int width);
public slots:
virtual bool openURL(const KUrl & url);
virtual bool openURL(const QUrl & url);
void slotChangeStatusCoords(int x,int y);
void slotUpdateSelectionCoords();
void slotUpdateSelectionCoords( const QRect &);
......
......@@ -18,17 +18,16 @@
#ifndef KIMEAREA_H
#define KIMEAREA_H
#include <QHash>
#include <qrect.h>
#include <qpoint.h>
#include <QList>
#include <QPixmap>
#include <QLinkedList>
#include <QHashIterator>
#include <QTreeWidgetItem>
#include <klocale.h>
#include <qhash.h>
#include "kdeversion.h"
#include <klocalizedstring.h>
class QPainter;
class QPolygon;
......
......@@ -16,7 +16,7 @@
***************************************************************************/
#include <qstring.h>
#include <kdebug.h>
#include <klocale.h>
#include <klocalizedstring.h>
#include "kimagemapeditor.h"
#include "kimecommands.h"
......
......@@ -21,8 +21,6 @@
#include <qundostack.h>
#include <kdeversion.h>
class KImageMapEditor;
class AreaSelection;
......
......@@ -15,7 +15,7 @@
* *
***************************************************************************/
// QT
// Qt
#include <qcheckbox.h>
#include <qlayout.h>
#include <qlabel.h>
......@@ -32,10 +32,10 @@
#include <QFrame>
#include <QVBoxLayout>
// KDE
// KDE Frameworks
#include <kiconloader.h>
#include <kfiledialog.h>
#include <klocale.h>
#include <klocalizedstring.h>
#include <kdebug.h>
#include <kapplication.h>
#include <khtmlview.h>
......@@ -43,8 +43,8 @@
#include <ktemporaryfile.h>
#include <kpushbutton.h>
#include <kstandardguiitem.h>
#include <kglobal.h>
#include <kvbox.h>
#include <KSharedConfig>
// LOCAL
#include "kimedialogs.h"
......@@ -610,14 +610,14 @@ PreferencesDialog::PreferencesDialog(QWidget *parent, KConfig* conf)
colorizeAreaChk = new QCheckBox(hbox);
colorizeAreaChk->setFixedWidth(60);
colorizeAreaChk->setChecked(KGlobal::config()->readEntry("highlightareas",true));
colorizeAreaChk->setChecked(KSharedConfig::openConfig()->readEntry("highlightareas",true));
hbox= new QHBox(page);
(void)new QLabel(i18n("Show alternative text")+" ",hbox);
showAltChk = new QCheckBox(hbox);
showAltChk->setFixedWidth(60);
showAltChk->setChecked(KGlobal::config()->readEntry("showalt",true));
showAltChk->setChecked(KSharedConfig::openConfig()->readEntry("showalt",true));
*/
connect(this,SIGNAL(okClicked()),this,SLOT(slotOk()));
connect(this,SIGNAL(applyClicked()),this,SLOT(slotApply()));
......
......@@ -18,6 +18,7 @@
#ifndef KIMEDIALOGS_H
#define KIMEDIALOGS_H
#include <QGridLayout>
#include <QLabel>
#include <QLinkedList>
......@@ -25,8 +26,6 @@
#include <kurl.h>
#include "kimagemapeditor.h"
#include "kdeversion.h"
class QLineEdit;
class QSpinBox;
......
......@@ -18,11 +18,11 @@
#include <iostream>
#include <QAction>
#include <QDockWidget>
#include <QScrollArea>
#include <kaction.h>
#include <kstandarddirs.h>
#include <kparts/guiactivateevent.h>
#include <kfiledialog.h>
#include <kmessagebox.h>
#include <kshortcutsdialog.h>
......@@ -43,6 +43,7 @@
#include "kimeshell.h"
#include "kimeshell.moc"
#include <kactioncollection.h>
#include <KSharedConfig>
KimeShell::KimeShell(const char * )
: KParts::MainWindow()
{
......@@ -116,7 +117,7 @@ bool KimeShell::queryExit()
#ifdef __GNUC__
#warning what group is correct here? A random one?
#endif
KConfigGroup cg( KGlobal::config(), QString() );
KConfigGroup cg( KSharedConfig::openConfig(), QString() );
saveProperties( cg );
return true;
......@@ -205,7 +206,7 @@ void KimeShell::fileOpen()
void KimeShell::readConfig() {
KSharedConfigPtr config = KGlobal::config();
KSharedConfigPtr config = KSharedConfig::openConfig();
readConfig(config->group("General Options") );
}
......@@ -216,7 +217,7 @@ void KimeShell::readConfig(const KConfigGroup &) {
}
void KimeShell::writeConfig() {
KConfigGroup config( KGlobal::config(), "General Options");
KConfigGroup config( KSharedConfig::openConfig(), "General Options");
writeConfig( config );
}
......@@ -257,7 +258,8 @@ void KimeShell::optionsConfigureKeys() {
void KimeShell::optionsConfigureToolbars()
{
saveMainWindowSettings(KGlobal::config()->group( autoSaveGroup()) );
KConfigGroup configGroup = KSharedConfig::openConfig()->group(autoSaveGroup());
saveMainWindowSettings(configGroup);
// use the standard toolbar editor
KEditToolBar dlg(factory());
......@@ -268,7 +270,8 @@ void KimeShell::optionsConfigureToolbars()
void KimeShell::applyNewToolbarConfig()
{
applyMainWindowSettings(KGlobal::config()->group( autoSaveGroup()) );
KConfigGroup configGroup = KSharedConfig::openConfig()->group(autoSaveGroup());
applyMainWindowSettings(configGroup);
}
......
......@@ -19,6 +19,8 @@
#define KIMESHELL_H
#include <kparts/mainwindow.h>
#include <KConfigGroup>
#include <kurl.h>
class KImageMapEditor;
......
......@@ -15,54 +15,57 @@
* *
***************************************************************************/
#include <kcmdlineargs.h>
#include <kaboutdata.h>
#include <klocale.h>
#include <kapplication.h>
#include <QApplication>
#include <QCommandLineParser>
#include <QCommandLineOption>
#include <KAboutData>
#include <KLocalizedString>
#include "kimeshell.h"
#include "version.h"
static const char *description =
I18N_NOOP("An HTML imagemap editor");
// INSERT A DESCRIPTION FOR YOUR APPLICATION HERE
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
KLocalizedString::setApplicationDomain("kimagemapeditor");
KAboutData aboutData( "kimagemapeditor", 0, ki18n("KImageMapEditor"),
KIMAGEMAPEDITOR_VERSION, ki18n(description), KAboutData::License_GPL,
ki18n("(c) 2001-2007 Jan Schaefer"), KLocalizedString(), "http://kde.org/applications/development/kimagemapeditor/", "janschaefer@users.sourceforge.net");
aboutData.addAuthor(ki18n("Jan Schaefer"),KLocalizedString(), "janschaefer@users.sourceforge.net");
aboutData.addCredit(ki18n("Joerg Jaspert"),ki18n("For helping me with the Makefiles, and creating the Debian package"));
aboutData.addCredit(ki18n("Aaron Seigo and Michael"),ki18n("For helping me fixing --enable-final mode"));
aboutData.addCredit(ki18n("Antonio Crevillen"),ki18n("For the Spanish translation"));
aboutData.addCredit(ki18n("Fabrice Mous"),ki18n("For the Dutch translation"));
aboutData.addCredit(ki18n("Germain Chazot"),ki18n("For the French translation"));
KCmdLineArgs::init( argc, argv, &aboutData );
KCmdLineOptions options;
options.add("c");
options.add("stdout", ki18n("Write HTML-Code to stdout on exit"));
options.add("+[File]", ki18n("File to open"));
KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
KAboutData aboutData( "kimagemapeditor", i18n("KImageMapEditor"),
KIMAGEMAPEDITOR_VERSION, i18n(description), KAboutLicense::GPL,
i18n("(c) 2001-2007 Jan Schaefer"), QString(),
QStringLiteral("http://kde.org/applications/development/kimagemapeditor/"), QStringLiteral("janschaefer@users.sourceforge.net"));
aboutData.addAuthor(i18n("Jan Schaefer"),QString(), "janschaefer@users.sourceforge.net");
aboutData.addCredit(i18n("Joerg Jaspert"),i18n("For helping me with the Makefiles, and creating the Debian package"));
aboutData.addCredit(i18n("Aaron Seigo and Michael"),i18n("For helping me fixing --enable-final mode"));
aboutData.addCredit(i18n("Antonio Crevillen"),i18n("For the Spanish translation"));
aboutData.addCredit(i18n("Fabrice Mous"),i18n("For the Dutch translation"));
aboutData.addCredit(i18n("Germain Chazot"),i18n("For the French translation"));
QCommandLineParser parser;
aboutData.setupCommandLine(&parser);
KAboutData::setApplicationData(aboutData);
parser.addVersionOption();
parser.addHelpOption();
KApplication a;
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("c") << QLatin1String("stdout"), i18n("Write HTML-Code to stdout on exit")));
parser.addPositionalArgument(QLatin1String("[File]"), i18n("File to open"));
parser.process(app);
aboutData.processCommandLine(&parser);
if (a.isSessionRestored())
if (app.isSessionRestored())
{
RESTORE(KimeShell);
}
else
{
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
if ( args->count() == 0 )
if ( parser.positionalArguments().count() == 0 )
{
KimeShell *kimeShell = new KimeShell();
kimeShell->setStdout(args->isSet("stdout"));
kimeShell->setStdout(parser.isSet("stdout"));
kimeShell->readConfig();
kimeShell->show();
kimeShell->openLastFile();
......@@ -70,17 +73,17 @@ int main(int argc, char *argv[])
else
{
int i = 0;
for (; i < args->count(); i++ )
for (; i < parser.positionalArguments().count(); i++ )
{
KimeShell *kimeShell = new KimeShell();
kimeShell->setStdout(args->isSet("stdout"));
kimeShell->setStdout(parser.isSet("stdout"));
kimeShell->readConfig();
kimeShell->show();
kimeShell->openFile(args->url(i));
kimeShell->openFile(parser.positionalArguments().at(i));
}
}
args->clear();
}
return a.exec();
}
return app.exec();
}
......@@ -16,8 +16,8 @@
***************************************************************************/
#include <QListWidget>
// KDE
#include <klocale.h>
// KDE Frameworks
#include <klocalizedstring.h>
#include <kdebug.h>
// locale
......
install( FILES addpointcursor.png freehandcursor.png polygoncursor.png removepointcursor.png DESTINATION ${DATA_INSTALL_DIR}/kimagemapeditor)
kde4_install_icons( ${ICON_INSTALL_DIR} )
ecm_install_icons(ICONS
16-apps-kimagemapeditor.png
22-actions-addpoint.png
22-actions-arrow.png
22-actions-circle.png
22-actions-circle2.png
22-actions-freehand.png
22-actions-lower.png
22-actions-polygon.png
22-actions-raise.png
22-actions-rectangle.png
22-actions-removepoint.png
32-apps-kimagemapeditor.png
48-apps-kimagemapeditor.png
DESTINATION ${ICON_INSTALL_DIR}
THEME hicolor
)
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