diff --git a/CMakeLists.txt b/CMakeLists.txt index da57d748..9e062d37 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,129 +1,128 @@ project(gwenview) # KDE Application Version, managed by release script set (KDE_APPLICATIONS_VERSION_MAJOR "17") set (KDE_APPLICATIONS_VERSION_MINOR "04") set (KDE_APPLICATIONS_VERSION_MICRO "0") set (KDE_APPLICATIONS_VERSION "${KDE_APPLICATIONS_VERSION_MAJOR}.${KDE_APPLICATIONS_VERSION_MINOR}.${KDE_APPLICATIONS_VERSION_MICRO}") set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ) cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR) set (QT_MIN_VERSION "5.6.0") find_package(ECM 1.7.0 REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) include(KDEInstallDirs) include(KDECMakeSettings) include(KDECompilerSettings NO_POLICY_SCOPE) include(ECMOptionalAddSubdirectory) include(ECMInstallIcons) include(ECMSetupVersion) include(ECMMarkNonGuiExecutable) include(ECMGenerateHeaders) include(ECMAddAppIcon) include(GenerateExportHeader) include(FeatureSummary) ## Generate header with version number ecm_setup_version(${KDE_APPLICATIONS_VERSION} VARIABLE_PREFIX GWENVIEW VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/lib/gwenview_version.h" ) ## CMake options set(GWENVIEW_SEMANTICINFO_BACKEND_NONE OFF) set(GWENVIEW_SEMANTICINFO_BACKEND_FAKE OFF) set(GWENVIEW_SEMANTICINFO_BACKEND_BALOO OFF) set(GWENVIEW_SEMANTICINFO_BACKEND "Baloo" CACHE STRING "Semantic info backend for Gwenview (Baloo/Fake/None)") # Init GWENVIEW_SEMANTICINFO_BACKEND_* vars if(GWENVIEW_SEMANTICINFO_BACKEND STREQUAL "None") set(GWENVIEW_SEMANTICINFO_BACKEND_NONE ON) elseif(GWENVIEW_SEMANTICINFO_BACKEND STREQUAL "Fake") set(GWENVIEW_SEMANTICINFO_BACKEND_FAKE ON) else() set(GWENVIEW_SEMANTICINFO_BACKEND_BALOO ON) endif() find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED Core Widgets Concurrent Svg OpenGL PrintSupport) find_package(Phonon4Qt5 4.6.60 NO_MODULE REQUIRED) include_directories(BEFORE ${PHONON_INCLUDES}) add_definitions(-DPHONON_LIB_SONAME=\"${PHONON_LIB_SONAME}\") find_package(KF5 5.25 REQUIRED COMPONENTS KIO Activities ItemModels I18n DocTools Parts WindowSystem IconThemes Notifications ) ## Dependencies find_package(JPEG) set_package_properties(JPEG PROPERTIES URL "http://libjpeg.sourceforge.net/" DESCRIPTION "JPEG image manipulation support" TYPE REQUIRED) find_package(PNG) set_package_properties(PNG PROPERTIES URL "http://www.libpng.org" DESCRIPTION "PNG image manipulation support" TYPE REQUIRED) find_package(Exiv2) set_package_properties(Exiv2 PROPERTIES URL "http://www.exiv2.org" DESCRIPTION "image metadata support" TYPE REQUIRED) find_package(KF5Kipi) if (KF5Kipi_FOUND) set(KIPI_FOUND true) endif() # set_package_properties(Kipi PROPERTIES URL"http://www.kipi-plugins.org" DESCRIPTION "Provides various image manipulation and export features" TYPE OPTIONAL) find_package(LCMS2) set_package_properties(LCMS2 PROPERTIES URL "http://www.littlecms.com" DESCRIPTION "Color management engine" TYPE REQUIRED) if (GWENVIEW_SEMANTICINFO_BACKEND_BALOO) find_package(KF5Baloo 5.1.90) set_package_properties(KF5Baloo PROPERTIES URL "https://projects.kde.org/projects/kde/kdelibs/baloo" DESCRIPTION "Desktop-wide semantic information support" TYPE OPTIONAL) if (NOT KF5Baloo_FOUND) message (STATUS "You have selected Baloo for semantic backend, but required version was not found. Overriding the backend to None") unset(GWENVIEW_SEMANTICINFO_BACKEND_BALOO) set(GWENVIEW_SEMANTICINFO_BACKEND_NONE ON) endif () endif () find_package(KF5KDcraw) if (KF5KDcraw_FOUND) add_definitions(-DKDCRAW_FOUND) endif() #set_package_properties(KDCRAW_FOUND PROPERTIES URL "http://www.kde.org" DESCRIPTION "KDE Dcraw library" TYPE OPTIONAL) find_package(X11) if(X11_FOUND) find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED X11Extras) set(HAVE_X11 1) endif() configure_file(config-gwenview.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-gwenview.h) include_directories(${CMAKE_CURRENT_BINARY_DIR}) -add_definitions(-DTRANSLATION_DOMAIN="gwenview") add_definitions(-DQT_NO_URL_CAST_FROM_STRING) ## dirs to build add_subdirectory(lib) add_subdirectory(app) add_subdirectory(importer) add_subdirectory(part) add_subdirectory(tests) add_subdirectory(icons) add_subdirectory(images) add_subdirectory(cursors) add_subdirectory(color-schemes) add_subdirectory(doc) feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/app/main.cpp b/app/main.cpp index 291fa325..3f78e2f9 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -1,158 +1,158 @@ /* Gwenview: an image viewer Copyright 2007-2012 Aurélien Gâteau 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 // STL #include // Qt #include #include #include #include #include #include // KDE #include #include #include #include // Local #include #include #include "mainwindow.h" class StartHelper { public: StartHelper(const QStringList & args, bool fullscreen, bool slideshow) : mFullScreen(false) , mSlideShow(false) { if (!args.isEmpty()) { parseArgs(args, fullscreen, slideshow); } } void parseArgs(const QStringList &args, bool fullscreen, bool slideshow) { if (args.count() > 1) { // Create a temp dir containing links to url args mMultipleUrlsDir.reset(new QTemporaryDir); mUrl = QUrl::fromLocalFile(mMultipleUrlsDir->path()); QList list; QStringList tmpArgs = args; tmpArgs.removeDuplicates(); foreach(const QString & url, tmpArgs) { list << QUrl::fromUserInput(url, QDir::currentPath(), QUrl::AssumeLocalFile); } KIO::CopyJob* job = KIO::link(list, mUrl); job->exec(); } else { QString tmpArg = args.first(); mUrl = QUrl::fromUserInput(tmpArg, QDir::currentPath(), QUrl::AssumeLocalFile); } if (mUrl.isValid() && (fullscreen || slideshow)) { mFullScreen = true; if (slideshow) { mSlideShow = true; } } } void createMainWindow() { Gwenview::MainWindow* window = new Gwenview::MainWindow(); if (mUrl.isValid()) { window->setInitialUrl(mUrl); } else { window->showStartMainPage(); } window->show(); if (mFullScreen) { window->actionCollection()->action("fullscreen")->trigger(); } else { window->show(); } if (mSlideShow) { window->startSlideShow(); } } private: QUrl mUrl; bool mFullScreen; bool mSlideShow; std::unique_ptr mMultipleUrlsDir; std::unique_ptr mMainWindow; }; int main(int argc, char *argv[]) { + QApplication app(argc, argv); KLocalizedString::setApplicationDomain("gwenview"); QScopedPointer aboutData( Gwenview::createAboutData( QStringLiteral("gwenview"), /* component name */ i18n("Gwenview") /* display name */ )); aboutData->setShortDescription(i18n("An Image Viewer")); - QApplication app(argc, argv); app.setAttribute(Qt::AA_UseHighDpiPixmaps, true); KAboutData::setApplicationData(*aboutData); QApplication::setWindowIcon(QIcon::fromTheme(QStringLiteral("gwenview"), app.windowIcon())); QCommandLineParser parser; aboutData.data()->setupCommandLine(&parser); parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("f") << QStringLiteral("fullscreen"), i18n("Start in fullscreen mode"))); parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("s") << QStringLiteral("slideshow"), i18n("Start in slideshow mode"))); parser.addHelpOption(); parser.addVersionOption(); parser.addPositionalArgument("url", i18n("A starting file or folders")); parser.process(app); aboutData.data()->processCommandLine(&parser); //KF5 TODO //Gwenview::ImageFormats::registerPlugins(); // startHelper must live for the whole life of the application StartHelper startHelper(parser.positionalArguments(), parser.isSet(QStringLiteral("f")), parser.isSet(QStringLiteral("s"))); if (app.isSessionRestored()) { kRestoreMainWindows(); } else { startHelper.createMainWindow(); } // Workaround for QTBUG-38613 // Another solution would be to port BalooSemanticInfoBackend::refreshAllTags // to be async rather than using exec(). qApp->sendPostedEvents(0, QEvent::DeferredDelete); return app.exec(); } diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index c88d0482..f6b4d628 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -1,256 +1,258 @@ project(gwenviewlib) +add_definitions(-DTRANSLATION_DOMAIN="gwenview") + set(LIBGWENVIEW_VERSION "4.97.0") # Extract version of libjpeg so that we can use the appropriate dir # See bug #227313 message(STATUS "Looking for libjpeg version in ${JPEG_INCLUDE_DIR}/jpeglib.h") # Due to the large variety of different headers the version data might be # found in (between libjpeg, libjpeg-turbo and various multilib header # forwarding schemes seen in distros), have a simple program print out the # right version. set(JPEGLIB_VERSION_CHECK_PATH "${CMAKE_CURRENT_BINARY_DIR}/jpeglib-version-check.c") file(WRITE ${JPEGLIB_VERSION_CHECK_PATH} " #include #include #include int main(void) { printf(\"%d\\\n\", JPEG_LIB_VERSION); } ") try_run(JPEGLIB_RUN_RESULT JPEGLIB_COMPILE_RESULT ${CMAKE_CURRENT_BINARY_DIR} ${JPEGLIB_VERSION_CHECK_PATH} CMAKE_FLAGS -DINCLUDE_DIRECTORIES:PATH=${JPEG_INCLUDE_DIR} RUN_OUTPUT_VARIABLE jpeglib_version) if ((${JPEGLIB_COMPILE_RESULT} EQUAL FALSE) OR ("${JPEGLIB_RUN_RESULT}" EQUAL FAILED_TO_RUN) OR "${jpeglib_version}" STREQUAL "") message(FATAL_ERROR "Could not find jpeglib.h. This file comes with libjpeg.") endif() if ("${jpeglib_version}" LESS 80) set(GV_JPEG_DIR libjpeg-62) endif() if ("${jpeglib_version}" EQUAL 80) set(GV_JPEG_DIR libjpeg-80) endif() if ("${jpeglib_version}" EQUAL 90) set(GV_JPEG_DIR libjpeg-90) endif() if ("${GV_JPEG_DIR}" STREQUAL "") message(FATAL_ERROR "Unknown libjpeg version: ${jpeglib_version}") endif() message(STATUS "libjpeg version: ${jpeglib_version}") add_definitions(-Dlibjpeg_EXPORTS) include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/${GV_JPEG_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_BINARY_DIR} ${EXIV2_INCLUDE_DIR} ${JPEG_INCLUDE_DIR} ${PNG_INCLUDE_DIRS} ) # For config-gwenview.h include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ) set(gwenviewlib_SRCS cms/iccjpeg.c cms/cmsprofile.cpp cms/cmsprofile_png.cpp contextmanager.cpp crop/cropwidget.cpp crop/cropimageoperation.cpp crop/croptool.cpp document/abstractdocumentimpl.cpp document/documentjob.cpp document/animateddocumentloadedimpl.cpp document/document.cpp document/documentfactory.cpp document/documentloadedimpl.cpp document/emptydocumentimpl.cpp document/jpegdocumentloadedimpl.cpp document/loadingdocumentimpl.cpp document/loadingjob.cpp document/savejob.cpp document/svgdocumentloadedimpl.cpp document/videodocumentloadedimpl.cpp documentview/abstractdocumentviewadapter.cpp documentview/abstractimageview.cpp documentview/abstractrasterimageviewtool.cpp documentview/birdeyeview.cpp documentview/documentview.cpp documentview/documentviewcontroller.cpp documentview/documentviewsynchronizer.cpp documentview/loadingindicator.cpp documentview/messageviewadapter.cpp documentview/rasterimageview.cpp documentview/rasterimageviewadapter.cpp documentview/svgviewadapter.cpp documentview/videoviewadapter.cpp about.cpp abstractimageoperation.cpp disabledactionshortcutmonitor.cpp documentonlyproxymodel.cpp documentview/documentviewcontainer.cpp binder.cpp eventwatcher.cpp historymodel.cpp recentfilesmodel.cpp archiveutils.cpp datewidget.cpp exiv2imageloader.cpp flowlayout.cpp fullscreenbar.cpp hud/hudbutton.cpp hud/hudbuttonbox.cpp hud/hudcountdown.cpp hud/hudlabel.cpp hud/hudmessagebubble.cpp hud/hudslider.cpp hud/hudtheme.cpp hud/hudwidget.cpp graphicswidgetfloater.cpp imageformats/imageformats.cpp # imageformats/jpegplugin.cpp # imageformats/jpeghandler.cpp imagemetainfomodel.cpp imagescaler.cpp imageutils.cpp invisiblebuttongroup.cpp iodevicejpegsourcemanager.cpp jpegcontent.cpp kindproxymodel.cpp semanticinfo/sorteddirmodel.cpp memoryutils.cpp mimetypeutils.cpp paintutils.cpp placetreemodel.cpp preferredimagemetainfomodel.cpp print/printhelper.cpp print/printoptionspage.cpp recursivedirmodel.cpp shadowfilter.cpp slidecontainer.cpp slideshow.cpp statusbartoolbutton.cpp redeyereduction/redeyereductionimageoperation.cpp redeyereduction/redeyereductiontool.cpp resize/resizeimageoperation.cpp resize/resizeimagedialog.cpp thumbnailprovider/thumbnailgenerator.cpp thumbnailprovider/thumbnailprovider.cpp thumbnailprovider/thumbnailwriter.cpp thumbnailview/abstractthumbnailviewhelper.cpp thumbnailview/abstractdocumentinfoprovider.cpp thumbnailview/contextbarbutton.cpp thumbnailview/dragpixmapgenerator.cpp thumbnailview/itemeditor.cpp thumbnailview/previewitemdelegate.cpp thumbnailview/thumbnailbarview.cpp thumbnailview/thumbnailslider.cpp thumbnailview/thumbnailview.cpp thumbnailview/tooltipwidget.cpp timeutils.cpp transformimageoperation.cpp urlutils.cpp widgetfloater.cpp zoomslider.cpp zoomwidget.cpp ${GV_JPEG_DIR}/transupp.c ) if (NOT GWENVIEW_SEMANTICINFO_BACKEND_NONE) set(gwenviewlib_SRCS ${gwenviewlib_SRCS} semanticinfo/abstractsemanticinfobackend.cpp semanticinfo/semanticinfodirmodel.cpp semanticinfo/tagitemdelegate.cpp semanticinfo/tagmodel.cpp semanticinfo/tagwidget.cpp ) endif() if (GWENVIEW_SEMANTICINFO_BACKEND_FAKE) set(gwenviewlib_SRCS ${gwenviewlib_SRCS} semanticinfo/fakesemanticinfobackend.cpp ) endif() if (GWENVIEW_SEMANTICINFO_BACKEND_BALOO) set(gwenviewlib_SRCS ${gwenviewlib_SRCS} semanticinfo/baloosemanticinfobackend.cpp ) endif() kde_source_files_enable_exceptions( exiv2imageloader.cpp imagemetainfomodel.cpp timeutils.cpp ) ki18n_wrap_ui(gwenviewlib_SRCS crop/cropwidget.ui documentview/messageview.ui print/printoptionspage.ui redeyereduction/redeyereductionwidget.ui resize/resizeimagewidget.ui ) kconfig_add_kcfg_files(gwenviewlib_SRCS gwenviewconfig.kcfgc ) add_library(gwenviewlib SHARED ${gwenviewlib_SRCS}) generate_export_header(gwenviewlib BASE_NAME gwenviewlib) set_target_properties(gwenviewlib PROPERTIES VERSION ${LIBGWENVIEW_VERSION} SOVERSION 5) if (WIN32) set_target_properties(gwenviewlib PROPERTIES COMPILE_FLAGS -DJPEG_STATIC) endif() target_link_libraries(gwenviewlib Qt5::Concurrent Qt5::Svg Qt5::OpenGL Qt5::PrintSupport KF5::KIOCore KF5::KIOWidgets KF5::KIOFileWidgets KF5::I18n KF5::WindowSystem KF5::IconThemes ${JPEG_LIBRARY} ${EXIV2_LIBRARIES} ${PNG_LIBRARIES} ${LCMS2_LIBRARIES} ${PHONON_LIBRARY} ) if (WIN32) target_link_libraries(gwenviewlib ${EXPAT_LIBRARIES}) endif() if (KF5KDcraw_FOUND) target_link_libraries(gwenviewlib KF5::KDcraw) endif() if (HAVE_X11) target_link_libraries(gwenviewlib Qt5::X11Extras ${X11_X11_LIB}) endif() if (GWENVIEW_SEMANTICINFO_BACKEND_BALOO) target_link_libraries(gwenviewlib KF5::Baloo KF5::FileMetaData ) endif() install(TARGETS gwenviewlib ${KDE_INSTALL_TARGETS_DEFAULT_ARGS} LIBRARY NAMELINK_SKIP) diff --git a/part/CMakeLists.txt b/part/CMakeLists.txt index 7e66f824..9d17eed2 100644 --- a/part/CMakeLists.txt +++ b/part/CMakeLists.txt @@ -1,18 +1,20 @@ +add_definitions(-DTRANSLATION_DOMAIN="gwenview") + include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/.. ${EXIV2_INCLUDE_DIR} ) set(gvpart_SRCS gvbrowserextension.cpp gvpart.cpp ) add_library(gvpart MODULE ${gvpart_SRCS}) target_link_libraries(gvpart KF5::Parts gwenviewlib) install(TARGETS gvpart DESTINATION ${KDE_INSTALL_PLUGINDIR}) install(FILES gvpart.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}) install(FILES gvpart.rc DESTINATION ${KDE_INSTALL_KXMLGUI5DIR}/gvpart)