diff --git a/CMakeLists.txt b/CMakeLists.txt index 3f2643ce..5524a60c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,277 +1,278 @@ cmake_minimum_required(VERSION 3.5) # KDE Application Version, managed by release script set(KDE_APPLICATIONS_VERSION_MAJOR "19") set(KDE_APPLICATIONS_VERSION_MINOR "11") set(KDE_APPLICATIONS_VERSION_MICRO "70") set(KDE_APPLICATIONS_VERSION "${KDE_APPLICATIONS_VERSION_MAJOR}.${KDE_APPLICATIONS_VERSION_MINOR}.${KDE_APPLICATIONS_VERSION_MICRO}") project(kig VERSION ${KDE_APPLICATIONS_VERSION}) find_package(Qt5Svg REQUIRED) find_package(Qt5PrintSupport REQUIRED) find_package(Qt5XmlPatterns 5.5.1) find_package(ECM 1.7 REQUIRED NO_MODULE) find_package(KF5Parts REQUIRED) find_package(KF5DocTools REQUIRED) find_package(KF5I18n REQUIRED) find_package(KF5TextEditor REQUIRED) find_package(KF5IconThemes REQUIRED) find_package(KF5ConfigWidgets REQUIRED) find_package(KF5Archive REQUIRED) find_package(KF5XmlGui 5.1 REQUIRED) find_package(KF5Crash 5.15 REQUIRED) find_package(KF5CoreAddons REQUIRED) set(CMAKE_MODULE_PATH ${kig_SOURCE_DIR}/cmake/modules ${ECM_MODULE_PATH}) set (KDE5_ICON_DIR ${CMAKE_INSTALL_PREFIX}/share/icons) include(ECMAddAppIcon) include(ECMInstallIcons) include(ECMAddTests) include(KDEInstallDirs) include(KDECompilerSettings NO_POLICY_SCOPE) include(KDECMakeSettings) include(FeatureSummary) include(GenerateExportHeader) include(ECMSetupVersion) ecm_setup_version(${KDE_APPLICATIONS_VERSION} VARIABLE_PREFIX KIG VERSION_HEADER kig_version.h) add_definitions (-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS) include_directories (${Qt5Gui_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE5_INCLUDES}) if (EXISTS "${CMAKE_SOURCE_DIR}/.git") add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x060000) + add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x060000) endif() if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "Intel") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") endif() include(KigConfigureChecks.cmake) find_package(BoostPython) add_subdirectory( doc ) add_subdirectory( icons ) add_subdirectory( kig ) add_subdirectory( mimetypes ) add_subdirectory( macros ) # reenable after porting kig's kkfile plugns to the strigi api #add_subdirectory( kfile ) add_subdirectory( data ) add_subdirectory( pykig ) if(BoostPython_FOUND) add_subdirectory( scripting ) add_definitions(-DKIG_ENABLE_PYTHON_SCRIPTING) endif(BoostPython_FOUND) set_package_properties( BoostPython PROPERTIES DESCRIPTION "Python scripting support in Boost" URL "http://www.boost.org/" TYPE OPTIONAL PURPOSE "Kig can optionally use Boost.Python for Python scripting" ) set_package_properties( Qt5XmlPatterns PROPERTIES DESCRIPTION "Qt5 XmlPatterns Module" URL "http://qt.io/" TYPE OPTIONAL PURPOSE "Kig uses the XML Patterns module in Qt to support Geogebra files" ) feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) include_directories( ${CMAKE_SOURCE_DIR}/modes ) if(BoostPython_FOUND) include_directories(${BoostPython_INCLUDE_DIRS}) endif(BoostPython_FOUND) # kigpart set(kigpart_PART_SRCS objects/angle_type.cc objects/arc_type.cc objects/base_type.cc objects/bogus_imp.cc objects/centerofcurvature_type.cc objects/circle_imp.cc objects/circle_type.cc objects/common.cc objects/conic_imp.cc objects/conic_types.cc objects/cubic_imp.cc objects/cubic_type.cc objects/curve_imp.cc objects/intersection_types.cc objects/inversion_type.cc objects/line_imp.cc objects/line_type.cc objects/locus_imp.cc objects/object_calcer.cc objects/object_drawer.cc objects/object_factory.cc objects/object_holder.cc objects/object_imp.cc objects/object_imp_factory.cc objects/object_type.cc objects/object_type_factory.cc objects/other_imp.cc objects/other_type.cc objects/point_imp.cc objects/point_type.cc objects/polygon_imp.cc objects/polygon_type.cc objects/bezier_imp.cc objects/bezier_type.cc objects/special_imptypes.cc objects/tangent_type.cc objects/tests_type.cc objects/text_imp.cc objects/text_type.cc objects/transform_types.cc objects/vector_type.cc misc/argsparser.cpp misc/builtin_stuff.cc misc/calcpaths.cc misc/common.cpp misc/conic-common.cpp misc/coordinate.cpp misc/coordinate_system.cpp misc/cubic-common.cc misc/equationstring.cc misc/goniometry.cc misc/guiaction.cc misc/kigcoordinateprecisiondialog.cpp misc/kigfiledialog.cc misc/kiginputdialog.cc misc/kignumerics.cpp misc/kigpainter.cpp misc/kigtransform.cpp misc/lists.cc misc/object_constructor.cc misc/object_hierarchy.cc misc/rect.cc misc/screeninfo.cc misc/special_constructors.cc misc/unit.cc modes/base_mode.cc modes/construct_mode.cc modes/dragrectmode.cc modes/edittype.cc modes/historydialog.cc modes/label.cc modes/linkslabel.cpp modes/macro.cc modes/macrowizard.cc modes/mode.cc modes/moving.cc modes/normal.cc modes/popup/popup.cc modes/popup/objectchooserpopup.cc modes/popup/propertiesactionsprovider.cc modes/popup/objectchooserpopup.cc modes/popup/objecttypeactionsprovider.cc modes/popup/nameobjectactionsprovider.cc modes/popup/objectconstructoractionsprovider.cc modes/popup/builtindocumentactionsprovider.cc modes/popup/builtinobjectactionsprovider.cc modes/textlabelwizard.cc modes/typesdialog.cpp filters/asyexporter.cc filters/asyexporteroptions.cc filters/asyexporterimpvisitor.cc filters/cabri-filter.cc filters/cabri-utils.cc filters/drgeo-filter.cc filters/exporter.cc filters/filter.cc filters/filters-common.cc filters/imageexporteroptions.cc filters/kgeo-filter.cc filters/kseg-filter.cc filters/latexexporter.cc filters/latexexporteroptions.cc filters/native-filter.cc filters/pgfexporterimpvisitor.cc filters/svgexporter.cc filters/svgexporteroptions.cc filters/xfigexporter.cc kig/kig_commands.cpp kig/kig_document.cc kig/kig_part.cpp kig/kig_view.cpp ) if (Qt5XmlPatterns_FOUND) set(kigpart_PART_SRCS ${kigpart_PART_SRCS} geogebra/geogebratransformer.cpp geogebra/geogebrasection.cpp filters/geogebra-filter.cpp) qt5_add_resources(kigpart_PART_SRCS ${CMAKE_SOURCE_DIR}/geogebra/geogebra.qrc) add_definitions(-DWITH_GEOGEBRA=1) endif(Qt5XmlPatterns_FOUND) ki18n_wrap_ui(kigpart_PART_SRCS modes/typeswidget.ui modes/edittypewidget.ui modes/historywidget.ui filters/asyexporteroptionswidget.ui filters/imageexporteroptionswidget.ui filters/latexexporteroptionswidget.ui filters/svgexporteroptionswidget.ui misc/kigcoordinateprecisiondialog.ui ) if(BoostPython_FOUND) set(kigpart_PART_SRCS ${kigpart_PART_SRCS} modes/popup/scriptactionsprovider.cc scripting/newscriptwizard.cc scripting/python_scripter.cc scripting/python_type.cc scripting/script-common.cc scripting/script_mode.cc ) kde_source_files_enable_exceptions(scripting/python_scripter.cc) endif(BoostPython_FOUND) add_library(kigpart MODULE ${kigpart_PART_SRCS}) generate_export_header(kigpart) target_link_libraries(kigpart Qt5::Gui Qt5::Svg Qt5::PrintSupport KF5::Crash KF5::Parts KF5::I18n KF5::TextEditor KF5::IconThemes KF5::ConfigWidgets KF5::Archive ${KDE5_KUTILS_LIBS} ) if(BoostPython_FOUND) target_link_libraries(kigpart ${BoostPython_LIBRARIES} ${KDE5_KTEXTEDITOR_LIBS}) endif(BoostPython_FOUND) if (Qt5XmlPatterns_FOUND) target_link_libraries(kigpart Qt5::XmlPatterns) endif(Qt5XmlPatterns_FOUND) install(TARGETS kigpart DESTINATION ${PLUGIN_INSTALL_DIR}) install(FILES org.kde.kig.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR}) # unit tests if (BUILD_TESTING) add_subdirectory(tests) endif () diff --git a/kig/main.cpp b/kig/main.cpp index 77b35e1a..2d574a9b 100644 --- a/kig/main.cpp +++ b/kig/main.cpp @@ -1,150 +1,150 @@ /** This file is part of Kig, a KDE program for Interactive Geometry... Copyright (C) 2002 Dominique Devriese This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **/ #include "kig.h" #include #include #include #include #include #include #include #include #include #include #include #include "aboutdata.h" #include static int convertToNative( const QUrl &file, const QByteArray& outfile ) { KPluginLoader libraryLoader( QStringLiteral("kigpart") ); QLibrary library( libraryLoader.fileName() ); int ( *converterfunction )( const QUrl&, const QByteArray& ); converterfunction = ( int ( * )( const QUrl&, const QByteArray& ) ) library.resolve( "convertToNative" ); if ( !converterfunction ) { qCritical() << "Error: broken Kig installation: different library and application version !" << endl; return -1; } return (*converterfunction)( file, outfile ); } static bool configMigration() { Kdelibs4ConfigMigrator migrator( QStringLiteral( "kig" ) ); migrator.setConfigFiles( QStringList() << QStringLiteral( "test.txt" ) ); return migrator.migrate(); } static void dataMigration() { Kdelibs4Migration datamigrator; QString file = datamigrator.locateLocal( "data", QStringLiteral("kig/kig-types/macros.kigt") ); if ( !file.isEmpty() ) { QFile macros( file ); const QDir writeableDataLocation ( QStandardPaths::writableLocation( QStandardPaths::DataLocation ) ); const QDir typesDir( writeableDataLocation.absoluteFilePath( QStringLiteral("kig-types") ) ); if ( !typesDir.exists() ) { writeableDataLocation.mkpath( QStringLiteral("kig-types") ); } macros.copy( typesDir.absoluteFilePath( QStringLiteral("macros.kigt") ) ); } } int main( int argc, char **argv ) { configMigration(); QApplication app( argc, argv ); KLocalizedString::setApplicationDomain( "kig" ); KAboutData about = kigAboutData( "kig", I18N_NOOP( "Kig" ) ); KCrash::initialize(); QCommandLineParser parser; QCommandLineOption convertToNativeOption( QStringList() << QStringLiteral("c") << QStringLiteral("convert-to-native"), i18n( "Do not show a GUI. Convert the specified file to the native Kig format. Output goes to stdout unless --outfile is specified." ) ); QCommandLineOption outfileOption( QStringList() << QStringLiteral("o") << QStringLiteral("outfile"), i18n( "File to output the created native file to. '-' means output to stdout. Default is stdout as well." ), QStringLiteral("file") ); QCoreApplication::setApplicationName( QStringLiteral("kig") ); QCoreApplication::setApplicationVersion( KIG_VERSION_STRING ); QCoreApplication::setOrganizationDomain( i18n( "kde.org" ) ); KAboutData::setApplicationData( about ); dataMigration(); // This needs the about AboutData to be set up about.setupCommandLine( &parser ); parser.addHelpOption(); parser.addOption( convertToNativeOption ); parser.addOption( outfileOption ); parser.addPositionalArgument( QStringLiteral("URL"), i18n( "Document to open" ) ); parser.process( app ); about.processCommandLine( &parser ); QStringList urls = parser.positionalArguments(); if ( parser.isSet( QStringLiteral("convert-to-native") ) ) { QString outfile = parser.value( QStringLiteral("outfile") ); if ( outfile.isNull() ) outfile = '-'; if ( urls.isEmpty() ) { qCritical() << "Error: --convert-to-native specified without a file to convert." << endl; return -1; } if ( urls.count() > 1 ) { qCritical() << "Error: --convert-to-native specified with more than one file to convert." << endl; return -1; } return convertToNative( QUrl::fromLocalFile( urls[0] ), outfile.toLocal8Bit() ); } else { if ( parser.isSet( QStringLiteral("outfile") ) ) { qCritical() << "Error: --outfile specified without convert-to-native." << endl; return -1; } // see if we are starting with session management if ( app.isSessionRestored() ) { - RESTORE( Kig ) + kRestoreMainWindows(); } Kig *widget = new Kig; widget->show(); if( urls.count() > 0 ) { widget->load( QUrl::fromLocalFile( urls[ 0 ] ) ); } return app.exec(); } }