Prepare libqtxdg 3.0.0
This commit is contained in:
parent
6548865b94
commit
4c58fcb9c3
2
AUTHORS
2
AUTHORS
@ -4,7 +4,7 @@ Upstream Authors:
|
||||
|
||||
Copyright:
|
||||
Copyright (c) 2010-2012 Razor team
|
||||
Copyright (c) 2012-2016 LXQt team
|
||||
Copyright (c) 2012-2017 LXQt team
|
||||
|
||||
License: LGPL-2.1+ and LGPL-2.1-or-3-with-Digia-1.1-exception
|
||||
The full text of the LGPL-2.1+ license can be found in the 'COPYING' file.
|
||||
|
@ -25,11 +25,13 @@ else()
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
endif()
|
||||
|
||||
set(QTXDG_MAJOR_VERSION 2)
|
||||
set(QTXDG_MAJOR_VERSION 3)
|
||||
set(QTXDG_MINOR_VERSION 0)
|
||||
set(QTXDG_PATCH_VERSION 0)
|
||||
set(QTXDG_VERSION_STRING ${QTXDG_MAJOR_VERSION}.${QTXDG_MINOR_VERSION}.${QTXDG_PATCH_VERSION})
|
||||
|
||||
set(QT_MINIMUM_VERSION "5.6.1")
|
||||
|
||||
include(GNUInstallDirs) # Standard directories for installation
|
||||
include(CMakePackageConfigHelpers)
|
||||
include(GenerateExportHeader)
|
||||
@ -37,13 +39,12 @@ include(create_portable_headers)
|
||||
include(create_pkgconfig_file)
|
||||
include(compiler_settings NO_POLICY_SCOPE)
|
||||
|
||||
find_package(Qt5Widgets REQUIRED QUIET)
|
||||
find_package(Qt5Svg REQUIRED QUIET)
|
||||
find_package(Qt5Xml REQUIRED QUIET)
|
||||
find_package(Qt5DBus REQUIRED QUIET)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
|
||||
find_package(Qt5 ${QT_MINIMUM_VERSION} CONFIG REQUIRED Widgets Svg Xml DBus)
|
||||
|
||||
if (BUILD_TESTS)
|
||||
find_package(Qt5Test REQUIRED QUIET)
|
||||
find_package(Qt5 ${QT_MINIMUM_VERSION} CONFIG REQUIRED Test)
|
||||
endif()
|
||||
|
||||
|
||||
@ -52,12 +53,13 @@ set(QTXDGX_FILE_NAME "qt5xdg")
|
||||
|
||||
set(QTXDGX_ICONLOADER_LIBRARY_NAME "Qt5XdgIconLoader")
|
||||
set(QTXDGX_ICONLOADER_FILE_NAME "qt5xdgiconloader")
|
||||
set(QTXDGX_ICONENGINEPLUGIN_LIBRARY_NAME "Qt5XdgIconPlugin")
|
||||
|
||||
set(QTXDGX_PKG_CONFIG_DESCRIPTION "Qt5Xdg, a Qt5 implementation of XDG standards")
|
||||
set(QTXDGX_PKG_CONFIG_REQUIRES "Qt5Core, Qt5Xml, Qt5Widgets, Qt5DBus, Qt5XdgIconLoader")
|
||||
set(QTXDGX_PKG_CONFIG_REQUIRES "Qt5Core >= ${QT_MINIMUM_VERSION}, Qt5Xml >= ${QT_MINIMUM_VERSION}, Qt5Widgets >= ${QT_MINIMUM_VERSION}, Qt5DBus >= ${QT_MINIMUM_VERSION}, Qt5XdgIconLoader = ${QTXDG_VERSION_STRING}")
|
||||
|
||||
set(QTXDGX_ICONLOADER_PKG_CONFIG_DESCRIPTION "Qt5XdgIconLader, a Qt5 XDG Icon Loader")
|
||||
set(QTXDGX_ICONLOADER_PKG_CONFIG_REQUIRES "Qt5Gui, Qt5Svg")
|
||||
set(QTXDGX_ICONLOADER_PKG_CONFIG_REQUIRES "Qt5Gui >= ${QT_MINIMUM_VERSION}, Qt5Svg >= ${QT_MINIMUM_VERSION}")
|
||||
|
||||
set(QTXDGX_INTREE_INCLUDEDIR "${CMAKE_CURRENT_BINARY_DIR}/InTreeBuild/include")
|
||||
|
||||
@ -65,7 +67,7 @@ if (NOT CMAKE_BUILD_TYPE)
|
||||
set ( CMAKE_BUILD_TYPE Release )
|
||||
endif (NOT CMAKE_BUILD_TYPE)
|
||||
|
||||
message(STATUS "Building with Qt ${Qt5Core_VERSION_STRING}")
|
||||
message(STATUS "Building ${PROJECT_NAME} with Qt ${Qt5Core_VERSION}")
|
||||
|
||||
add_subdirectory(xdgiconloader)
|
||||
add_subdirectory(qtxdg)
|
||||
@ -167,16 +169,5 @@ configure_file(
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
|
||||
IMMEDIATE @ONLY)
|
||||
|
||||
add_custom_target(uninstall
|
||||
COMMAND ${CMAKE_COMMAND} -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
|
||||
|
||||
|
||||
# building tarball with CPack -------------------------------------------------
|
||||
include (InstallRequiredSystemLibraries)
|
||||
set (CPACK_PACKAGE_VERSION_MAJOR ${QTXDG_MAJOR_VERSION})
|
||||
set (CPACK_PACKAGE_VERSION_MINOR ${QTXDG_MINOR_VERSION})
|
||||
set (CPACK_PACKAGE_VERSION_PATCH ${QTXDG_PATCH_VERSION})
|
||||
set (CPACK_GENERATOR TBZ2)
|
||||
set (CPACK_SOURCE_GENERATOR TBZ2)
|
||||
set (CPACK_SOURCE_IGNORE_FILES /build/;.gitignore;.*~;.git;.kdev4;temp)
|
||||
include (CPack)
|
||||
#add_custom_target(uninstall
|
||||
# COMMAND ${CMAKE_COMMAND} -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
|
||||
|
@ -1,5 +1,6 @@
|
||||
#=============================================================================
|
||||
# Copyright 2015 Luís Pereira <luis.artur.pereira@gmail.com>
|
||||
# Copyright 2013 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
@ -65,6 +66,14 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
endif()
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Global definitions
|
||||
#-----------------------------------------------------------------------------
|
||||
if (CMAKE_BUILD_TYPE MATCHES "Debug")
|
||||
add_definitions(-DQT_STRICT_ITERATORS)
|
||||
endif()
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Set visibility to hidden to hide symbols, unless they're exported manually
|
||||
# in the code
|
||||
@ -80,18 +89,25 @@ if (CMAKE_COMPILER_IS_GNUCXX OR QTXDG_COMPILER_IS_CLANGCXX)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions")
|
||||
endif()
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Common warning flags
|
||||
#-----------------------------------------------------------------------------
|
||||
set(QTXDG_COMMON_WARNING_FLAGS "-Wall")
|
||||
set(QTXDG_COMMON_WARNING_FLAGS "-Wall -Wextra -Wchar-subscripts -Wno-long-long -Wpointer-arith -Wundef -Wformat-security")
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Warning flags
|
||||
#-----------------------------------------------------------------------------
|
||||
if (CMAKE_COMPILER_IS_GNUCXX OR QTXDG_COMPILER_IS_CLANGCXX)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${__QTXDG_COMMON_WARNING_FLAGS} -Wnon-virtual-dtor -Woverloaded-virtual -Wpedantic")
|
||||
endif()
|
||||
|
||||
if (QTXDG_COMPILER_IS_CLANGCXX)
|
||||
# qCDebug(), qCWarning, etc trigger a very verbose warning, about.... nothing. Disable it.
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-gnu-zero-variadic-macro-arguments")
|
||||
endif()
|
||||
|
||||
list(APPEND QTXDG_WARNING_FLAGS ${QTXDG_COMMON_WARNING_FLAGS})
|
||||
add_definitions(${QTXDG_WARNING_FLAGS})
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# String conversion flags
|
||||
@ -103,3 +119,53 @@ add_definitions(
|
||||
-DQT_NO_URL_CAST_FROM_STRING
|
||||
-DQT_NO_CAST_FROM_BYTEARRAY
|
||||
)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Linker flags
|
||||
# Do not allow undefined symbols
|
||||
#-----------------------------------------------------------------------------
|
||||
if (CMAKE_COMPILER_IS_GNUCXX OR QTXDG_COMPILER_IS_CLANGCXX)
|
||||
# -Bsymbolic-functions: replace dynamic symbols used internally in
|
||||
# shared libs with direct addresses.
|
||||
set(SYMBOLIC_FLAGS
|
||||
"-Wl,-Bsymbolic-functions -Wl,-Bsymbolic"
|
||||
)
|
||||
set(CMAKE_SHARED_LINKER_FLAGS
|
||||
"-Wl,--no-undefined ${SYMBOLIC_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS}"
|
||||
)
|
||||
set(CMAKE_MODULE_LINKER_FLAGS
|
||||
"-Wl,--no-undefined ${SYMBOLIC_FLAGS} ${CMAKE_MODULE_LINKER_FLAGS}"
|
||||
)
|
||||
set(CMAKE_EXE_LINKER_FLAGS
|
||||
"${SYMBOLIC_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}"
|
||||
)
|
||||
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Turn on more aggrassive optimizations not supported by CMake
|
||||
# References: https://wiki.qt.io/Performance_Tip_Startup_Time
|
||||
#-----------------------------------------------------------------------------
|
||||
if (CMAKE_COMPILER_IS_GNUCXX OR QTXDG_COMPILER_IS_CLANGCXX)
|
||||
# -flto: use link-time optimizations to generate more efficient code
|
||||
if (CMAKE_COMPILER_IS_GNUCXX)
|
||||
set(LTO_FLAGS "-flto -fuse-linker-plugin")
|
||||
# When building static libraries with LTO in gcc >= 4.9,
|
||||
# "gcc-ar" and "gcc-ranlib" should be used instead of "ar" and "ranlib".
|
||||
# references:
|
||||
# https://gcc.gnu.org/gcc-4.9/changes.html
|
||||
# http://hubicka.blogspot.tw/2014/04/linktime-optimization-in-gcc-2-firefox.html
|
||||
# https://github.com/monero-project/monero/pull/1065/commits/1855213c8fb8f8727f4107716aab8e7ba826462b
|
||||
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.9.0") # gcc >= 4.9
|
||||
set(CMAKE_AR "gcc-ar")
|
||||
set(CMAKE_RANLIB "gcc-ranlib")
|
||||
endif()
|
||||
elseif (QTXDG_COMPILER_IS_CLANGCXX)
|
||||
# The link-time optimization of clang++/llvm seems to be too aggrassive.
|
||||
# After testing, it breaks the signal/slots of QObject sometimes.
|
||||
# So disable it for now until there is a solution.
|
||||
# set(LTO_FLAGS "-flto")
|
||||
endif()
|
||||
# apply these options to "Release" build type only
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${LTO_FLAGS}")
|
||||
endif()
|
||||
|
@ -1,13 +1,15 @@
|
||||
@PACKAGE_INIT@
|
||||
|
||||
include(CMakeFindDependencyMacro)
|
||||
if (NOT TARGET @QTXDGX_LIBRARY_NAME@)
|
||||
include(CMakeFindDependencyMacro)
|
||||
|
||||
find_dependency(Qt5Widgets)
|
||||
find_dependency(Qt5Xml)
|
||||
find_dependency(Qt5DBus)
|
||||
find_dependency(Qt5XdgIconLoader)
|
||||
find_dependency(Qt5Widgets @QT_MINIMUM_VERSION@)
|
||||
find_dependency(Qt5Xml @QT_MINIMUM_VERSION@)
|
||||
find_dependency(Qt5DBus @QT_MINIMUM_VERSION@)
|
||||
find_dependency(Qt5XdgIconLoader @QTXDG_VERSION_STRING@ EXACT)
|
||||
|
||||
if (CMAKE_VERSION VERSION_GREATER 2.8.12)
|
||||
cmake_policy(SET CMP0024 OLD)
|
||||
if (CMAKE_VERSION VERSION_GREATER 2.8.12)
|
||||
cmake_policy(SET CMP0024 NEW)
|
||||
endif()
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/qt5xdg-targets.cmake")
|
||||
endif()
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/qt5xdg-targets.cmake")
|
||||
|
@ -1,11 +1,13 @@
|
||||
@PACKAGE_INIT@
|
||||
|
||||
include(CMakeFindDependencyMacro)
|
||||
if (NOT TARGET @QTXDGX_ICONLOADER_LIBRARY_NAME@)
|
||||
include(CMakeFindDependencyMacro)
|
||||
|
||||
find_dependency(Qt5Gui)
|
||||
find_dependency(Qt5Svg)
|
||||
find_dependency(Qt5Gui @QT_MINIMUM_REQUIRED@)
|
||||
find_dependency(Qt5Svg @QT_MINIMUM_REQUIRED@)
|
||||
|
||||
if (CMAKE_VERSION VERSION_GREATER 2.8.12)
|
||||
cmake_policy(SET CMP0024 OLD)
|
||||
if (CMAKE_VERSION VERSION_GREATER 2.8.12)
|
||||
cmake_policy(SET CMP0024 NEW)
|
||||
endif()
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/qt5xdgiconloader-targets.cmake")
|
||||
endif()
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/qt5xdgiconloader-targets.cmake")
|
||||
|
1
debian/.gitignore
vendored
1
debian/.gitignore
vendored
@ -9,4 +9,5 @@
|
||||
/libqt5xdg-dev/
|
||||
/libqt5xdgiconloader-dev/
|
||||
/libqt5xdgiconloader2/
|
||||
/qtxdg-dev-tools/
|
||||
/tmp
|
||||
|
95
debian/changelog
vendored
95
debian/changelog
vendored
@ -1,72 +1,71 @@
|
||||
libqtxdg (2.0.0-3) experimental; urgency=medium
|
||||
libqtxdg (2.96.0-1) experimental; urgency=medium
|
||||
|
||||
* Fixed typo Recommmends -> Recommends
|
||||
* New snapshot: 2.0.0-58-gbc64037
|
||||
* Switched to experimental
|
||||
* Renamed packages to reflect the new soname
|
||||
* Bumped standards to 4.0.0, no changes needed
|
||||
|
||||
-- Alf Gaida <agaida@siduction.org> Tue, 04 Oct 2016 21:20:53 +0200
|
||||
-- Alf Gaida <agaida@siduction.org> Tue, 25 Jul 2017 00:42:08 +0200
|
||||
|
||||
libqtxdg (2.0.0-2) experimental; urgency=medium
|
||||
libqtxdg (2.0.0-7) unstable; urgency=medium
|
||||
|
||||
* XdgIconLoader: Recommend gtk-update-icon-cache instead depend on it.
|
||||
Thanks Rohan Garg <rohan@kde.org>
|
||||
* Added qttranslations5-l10n to Recommends - without this packagage there are
|
||||
no working shortcuts in localized LXQt desktops. So we want to make sure
|
||||
that the package is at least recommended for qtxdg based packages.
|
||||
|
||||
-- Alf Gaida <agaida@siduction.org> Fri, 30 Sep 2016 19:10:36 +0200
|
||||
-- Alf Gaida <agaida@siduction.org> Mon, 24 Jul 2017 21:54:16 +0200
|
||||
|
||||
libqtxdg (2.0.0-1) experimental; urgency=medium
|
||||
libqtxdg (2.0.0-6) unstable; urgency=medium
|
||||
|
||||
* Bump Standards to 4.0.0 - no changes needed
|
||||
* Added Dependeny share-mime-info (Closes: #866744)
|
||||
* Bumped year in copyrights
|
||||
* Removed --parallel from rules, default in compat-leveld 10
|
||||
|
||||
-- Alf Gaida <agaida@siduction.org> Sat, 01 Jul 2017 14:15:07 +0200
|
||||
|
||||
libqtxdg (2.0.0-5) unstable; urgency=medium
|
||||
|
||||
* Rebuild with Qt 5.7.1~
|
||||
|
||||
-- Alf Gaida <agaida@siduction.org> Fri, 04 Nov 2016 17:59:49 +0100
|
||||
|
||||
libqtxdg (2.0.0-4) unstable; urgency=medium
|
||||
|
||||
* Cherry-picked new upstream release 2.0.0.
|
||||
* Added current signing key
|
||||
* Bumped compat to 10
|
||||
* Bumped debhelper to (>=10)
|
||||
* Bumped debhelper to (>= 10)
|
||||
* Added build dependency libqt5svg5-dev
|
||||
* Renamed package libqt5xdg1 -> libqt5xdg2 (soname bump)
|
||||
* Renamed package libqt5xdgiconloader1 -> libqt5xdgiconloader2 (soname bump)
|
||||
* Added dependency gtk-update-icon-cache to libqt5xdgiconloader2
|
||||
* Added packages libqt5xdgiconloader2 and libqt5xdgiconloader-dev
|
||||
* XdgIconLoader: Recommend gtk-update-icon-cache
|
||||
Thanks Rohan Garg <rohan@kde.org>
|
||||
* Renamed install and symbols files
|
||||
* Fixed symbols
|
||||
* Fixed .gitignore
|
||||
|
||||
-- Alf Gaida <agaida@siduction.org> Sun, 18 Sep 2016 02:28:47 +0200
|
||||
|
||||
libqtxdg (1.3.1~50-g4fde773-4) experimental; urgency=medium
|
||||
|
||||
* Added libfile-mimeinfo-perl as dependency, we really need this, a
|
||||
recommendation is not enough. Thanks tsujan.
|
||||
|
||||
-- Alf Gaida <agaida@siduction.org> Wed, 10 Aug 2016 22:48:40 +0200
|
||||
|
||||
libqtxdg (1.3.1~50-g4fde773-3) experimental; urgency=medium
|
||||
|
||||
* Fixed typo in changelog
|
||||
|
||||
-- Alf Gaida <agaida@siduction.org> Sat, 23 Jul 2016 13:05:14 +0200
|
||||
|
||||
libqtxdg (1.3.1~50-g4fde773-2) experimental; urgency=medium
|
||||
|
||||
* Added build dependencies gcc (>= 4:6), g++ (>= 4:6)
|
||||
* Exported LC_ALL=C.UTF-8 - define language settings for
|
||||
reproducible builds
|
||||
|
||||
-- Alf Gaida <agaida@siduction.org> Sat, 16 Jul 2016 20:26:26 +0200
|
||||
|
||||
libqtxdg (1.3.1~50-g4fde773-1) experimental; urgency=medium
|
||||
|
||||
* New pre-release 1.3.1~50-g4fde773
|
||||
* Fixed libqt5xdgiconloader-dev.install
|
||||
* Reworked descriptions in debian/control to prevent lintian whining
|
||||
* Fixed symbols version
|
||||
* Fixed copyright for xdgiconloader
|
||||
* Fixed package descrioptions
|
||||
* Introduced the new package libqt5xdgiconloader1
|
||||
* Bumped standards to 3.9.8, no changes needed
|
||||
* Symbols sorted and unified
|
||||
* Added missed Symbol
|
||||
* Bump years in copyright
|
||||
* Added hardening=+all
|
||||
* Added README.md to debian/docs
|
||||
* set CMAKE_BUILD_TYPE=RelWithDebInfo
|
||||
* Set CMAKE_BUILD_TYPE=RelWithDebInfo
|
||||
|
||||
-- Alf Gaida <agaida@siduction.org> Sat, 09 Jul 2016 20:16:32 +0200
|
||||
|
||||
libqtxdg (1.3.0-4) unstable; urgency=medium
|
||||
|
||||
* Added libfile-mimeinfo-perl as dependency, we really need this, a
|
||||
recommendation is not enough. Thanks tsujan.
|
||||
* Bumped standards to 3.9.8, no changes needed
|
||||
* Bump years in copyright
|
||||
* Added README to debian/docs
|
||||
* Added hardening=+all
|
||||
* Exported LC_ALL=C.UTF-8 - define language settings for
|
||||
reproducible builds
|
||||
* Fixed VCS-fields, use https and plain /git/
|
||||
* Fixed copyrights Format field to https
|
||||
|
||||
-- Alf Gaida <agaida@siduction.org> Wed, 10 Aug 2016 23:06:12 +0200
|
||||
|
||||
libqtxdg (1.3.0-3) unstable; urgency=medium
|
||||
|
||||
* Remove dbg package in favor of dbgsym.
|
||||
|
26
debian/control
vendored
26
debian/control
vendored
@ -13,17 +13,19 @@ Build-Depends: debhelper (>= 10),
|
||||
qtbase5-private-dev,
|
||||
qttools5-dev,
|
||||
qttools5-dev-tools
|
||||
Standards-Version: 3.9.8
|
||||
Standards-Version: 4.1.0
|
||||
Vcs-Browser: https://anonscm.debian.org/cgit/pkg-lxqt/libqtxdg.git/?h=debian/experimental
|
||||
Vcs-Git: https://anonscm.debian.org/git/pkg-lxqt/libqtxdg.git -b debian/experimental
|
||||
Homepage: https://github.com/lxde/libqtxdg
|
||||
|
||||
Package: libqt5xdg2
|
||||
Package: libqt5xdg3
|
||||
Architecture: any
|
||||
Multi-Arch: same
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends},
|
||||
libfile-mimeinfo-perl
|
||||
libfile-mimeinfo-perl,
|
||||
shared-mime-info
|
||||
Recommends: qttranslations5-l10n
|
||||
Pre-Depends: ${misc:Pre-Depends}
|
||||
Provides: libqt5xdg
|
||||
Description: Implementation of the XDG Specifications for Qt (shared lib)
|
||||
@ -32,7 +34,7 @@ Description: Implementation of the XDG Specifications for Qt (shared lib)
|
||||
.
|
||||
This package provides the shared library.
|
||||
|
||||
Package: libqt5xdgiconloader2
|
||||
Package: libqt5xdgiconloader3
|
||||
Architecture: any
|
||||
Multi-Arch: same
|
||||
Depends: ${shlibs:Depends},
|
||||
@ -50,7 +52,7 @@ Package: libqt5xdg-dev
|
||||
Architecture: any
|
||||
Section: libdevel
|
||||
Depends: ${misc:Depends},
|
||||
libqt5xdg2 (= ${binary:Version}),
|
||||
libqt5xdg3 (= ${binary:Version}),
|
||||
libqt5xdgiconloader-dev (= ${binary:Version})
|
||||
Description: Development files for libqtxdg
|
||||
This library implements functions of the XDG Specifications in Qt. It is part
|
||||
@ -61,10 +63,20 @@ Description: Development files for libqtxdg
|
||||
Package: libqt5xdgiconloader-dev
|
||||
Architecture: any
|
||||
Section: libdevel
|
||||
Depends: ${misc:Depends},
|
||||
libqt5xdgiconloader2 (= ${binary:Version})
|
||||
Depends: ${shlibs:Depends},
|
||||
libqt5xdgiconloader3 (= ${binary:Version})
|
||||
Description: Development files for libqtxdgiconloader
|
||||
This library implements the backend to load icons which are handled according
|
||||
to the XDG Icon Theme Specification in Qt. It is part of LXQt.
|
||||
.
|
||||
This package provides development files.
|
||||
|
||||
Package: qtxdg-dev-tools
|
||||
Architecture: any
|
||||
Section: devel
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends},
|
||||
libqt5xdgiconloader3 (= ${binary:Version})
|
||||
Description: Development tools for libqtxdgiconloader
|
||||
This package provide some development tools for qtxdg.
|
||||
|
||||
|
2
debian/copyright
vendored
2
debian/copyright
vendored
@ -15,7 +15,7 @@ License: LGPL-2.1-or-3-with-Digia-1.1-exception
|
||||
|
||||
Files: debian/*
|
||||
Copyright: 2014-2016 ChangZhuo Chen (陳昌倬) <czchen@debian.org>
|
||||
2013-2016 Alf Gaida <agaida@siduction.org>
|
||||
2013-2017 Alf Gaida <agaida@siduction.org>
|
||||
2015 Andrew Lee (李健秋) <ajqlee@debian.org>
|
||||
License: LGPL-2.1+
|
||||
|
||||
|
2
debian/gbp.conf
vendored
2
debian/gbp.conf
vendored
@ -1,5 +1,5 @@
|
||||
[DEFAULT]
|
||||
debian-branch = debian/sid
|
||||
debian-branch = debian/experimental
|
||||
upstream-branch = upstream/latest
|
||||
pristine-tar = True
|
||||
|
||||
|
@ -1,9 +1,21 @@
|
||||
libQt5Xdg.so.2 libqt5xdg2 #MINVER#
|
||||
(c++)"XdgAction::XdgAction(QObject*)@Base" 1.0.0
|
||||
(c++)"XdgAction::XdgAction(QString const&, QObject*)@Base" 1.0.0
|
||||
(c++)"XdgAction::XdgAction(XdgAction const&, QObject*)@Base" 1.0.0
|
||||
(c++)"XdgAction::XdgAction(XdgDesktopFile const&, QObject*)@Base" 1.0.0
|
||||
(c++)"XdgAction::XdgAction(XdgDesktopFile const*, QObject*)@Base" 1.0.0
|
||||
libQt5Xdg.so.3 libqt5xdg3 #MINVER#
|
||||
(c++)"non-virtual thunk to XdgMenuWidget::~XdgMenuWidget()@Base" 1.0.0
|
||||
(c++)"typeinfo for XdgAction@Base" 1.0.0
|
||||
(c++)"typeinfo for XdgDesktopFile@Base" 1.0.0
|
||||
(c++)"typeinfo for XdgIcon@Base" 1.0.0
|
||||
(c++)"typeinfo for XdgMenu@Base" 1.0.0
|
||||
(c++)"typeinfo for XdgMenuWidget@Base" 1.0.0
|
||||
(c++)"typeinfo name for XdgAction@Base" 1.0.0
|
||||
(c++)"typeinfo name for XdgDesktopFile@Base" 1.0.0
|
||||
(c++)"typeinfo name for XdgIcon@Base" 1.0.0
|
||||
(c++)"typeinfo name for XdgMenu@Base" 1.0.0
|
||||
(c++)"typeinfo name for XdgMenuWidget@Base" 1.0.0
|
||||
(c++)"vtable for XdgAction@Base" 1.0.0
|
||||
(c++)"vtable for XdgDesktopFile@Base" 1.0.0
|
||||
(c++)"vtable for XdgIcon@Base" 1.0.0
|
||||
(c++)"vtable for XdgMenu@Base" 1.0.0
|
||||
(c++)"vtable for XdgMenuWidget@Base" 1.0.0
|
||||
|
||||
(c++)"XdgAction::isValid() const@Base" 1.0.0
|
||||
(c++)"XdgAction::load(XdgDesktopFile const&)@Base" 1.0.0
|
||||
(c++)"XdgAction::metaObject() const@Base" 1.0.0
|
||||
@ -14,18 +26,35 @@ libQt5Xdg.so.2 libqt5xdg2 #MINVER#
|
||||
(c++)"XdgAction::staticMetaObject@Base" 1.0.0
|
||||
(c++)"XdgAction::updateIcon()@Base" 1.0.0
|
||||
(c++)"XdgAction::~XdgAction()@Base" 1.0.0
|
||||
(c++)"XdgAutoStart::desktopFileList(QStringList, bool)@Base" 1.0.0
|
||||
(c++)"XdgAction::XdgAction(QObject*)@Base" 1.0.0
|
||||
(c++)"XdgAction::XdgAction(QString const&, QObject*)@Base" 1.0.0
|
||||
(c++)"XdgAction::XdgAction(XdgAction const&, QObject*)@Base" 1.0.0
|
||||
(c++)"XdgAction::XdgAction(XdgDesktopFile const*, QObject*)@Base" 1.0.0
|
||||
(c++)"XdgAction::XdgAction(XdgDesktopFile const&, QObject*)@Base" 1.0.0
|
||||
|
||||
(c++)"XdgAutoStart::desktopFileList(bool)@Base" 1.0.0
|
||||
(c++)"XdgAutoStart::desktopFileList(QStringList, bool)@Base" 1.0.0
|
||||
(c++)"XdgAutoStart::localPath(XdgDesktopFile const&)@Base" 1.0.0
|
||||
(c++)"XdgDesktopFile::XdgDesktopFile()@Base" 1.0.0
|
||||
(c++)"XdgDesktopFile::XdgDesktopFile(XdgDesktopFile const&)@Base" 1.0.0
|
||||
(c++)"XdgDesktopFile::XdgDesktopFile(XdgDesktopFile::Type, QString const&, QString const&)@Base" 1.0.0
|
||||
|
||||
(c++)"XdgDesktopFileCache::desktopFileSettingsFormat()@Base" 1.0.0
|
||||
(c++)"XdgDesktopFileCache::getAllFiles()@Base" 1.0.0
|
||||
(c++)"XdgDesktopFileCache::getAppsOfCategory(QString const&)@Base" 1.2.0
|
||||
(c++)"XdgDesktopFileCache::getApps(QString const&)@Base" 1.0.0
|
||||
(c++)"XdgDesktopFileCache::getDefaultApp(QString const&)@Base" 1.0.0
|
||||
(c++)"XdgDesktopFileCache::getFile(QString const&)@Base" 1.0.0
|
||||
(c++)"XdgDesktopFileCache::initialize()@Base" 1.0.0
|
||||
(c++)"XdgDesktopFileCache::initialize(QString const&)@Base" 1.0.0
|
||||
(c++)"XdgDesktopFileCache::instance()@Base" 1.0.0
|
||||
(c++)"XdgDesktopFileCache::load(QString const&)@Base" 1.0.0
|
||||
(c++)"XdgDesktopFileCache::~XdgDesktopFileCache()@Base" 1.0.0
|
||||
(c++)"XdgDesktopFileCache::XdgDesktopFileCache()@Base" 1.0.0
|
||||
|
||||
(c++)"XdgDesktopFile::categories() const@Base" 1.2.0
|
||||
(c++)"XdgDesktopFile::contains(QString const&) const@Base" 1.0.0
|
||||
(c++)"XdgDesktopFile::expandExecString(QStringList const&) const@Base" 1.0.0
|
||||
(c++)"XdgDesktopFile::fileName() const@Base" 1.0.0
|
||||
(c++)"XdgDesktopFile::icon(QIcon const&) const@Base" 1.0.0
|
||||
(c++)"XdgDesktopFile::iconName() const@Base" 1.0.0
|
||||
(c++)"XdgDesktopFile::icon(QIcon const&) const@Base" 1.0.0
|
||||
(c++)"XdgDesktopFile::id(QString const&, bool)@Base" 2.0.0
|
||||
(c++)"XdgDesktopFile::isShown(QString const&) const@Base" 1.0.0
|
||||
(c++)"XdgDesktopFile::isSuitable(bool, QString const&) const@Base" 1.0.0
|
||||
@ -47,18 +76,10 @@ libQt5Xdg.so.2 libqt5xdg2 #MINVER#
|
||||
(c++)"XdgDesktopFile::url() const@Base" 1.0.0
|
||||
(c++)"XdgDesktopFile::value(QString const&, QVariant const&) const@Base" 1.0.0
|
||||
(c++)"XdgDesktopFile::~XdgDesktopFile()@Base" 1.0.0
|
||||
(c++)"XdgDesktopFileCache::XdgDesktopFileCache()@Base" 1.0.0
|
||||
(c++)"XdgDesktopFileCache::desktopFileSettingsFormat()@Base" 1.0.0
|
||||
(c++)"XdgDesktopFileCache::getAllFiles()@Base" 1.0.0
|
||||
(c++)"XdgDesktopFileCache::getApps(QString const&)@Base" 1.0.0
|
||||
(c++)"XdgDesktopFileCache::getAppsOfCategory(QString const&)@Base" 1.2.0
|
||||
(c++)"XdgDesktopFileCache::getDefaultApp(QString const&)@Base" 1.0.0
|
||||
(c++)"XdgDesktopFileCache::getFile(QString const&)@Base" 1.0.0
|
||||
(c++)"XdgDesktopFileCache::initialize()@Base" 1.0.0
|
||||
(c++)"XdgDesktopFileCache::initialize(QString const&)@Base" 1.0.0
|
||||
(c++)"XdgDesktopFileCache::instance()@Base" 1.0.0
|
||||
(c++)"XdgDesktopFileCache::load(QString const&)@Base" 1.0.0
|
||||
(c++)"XdgDesktopFileCache::~XdgDesktopFileCache()@Base" 1.0.0
|
||||
(c++)"XdgDesktopFile::XdgDesktopFile()@Base" 1.0.0
|
||||
(c++)"XdgDesktopFile::XdgDesktopFile(XdgDesktopFile const&)@Base" 1.0.0
|
||||
(c++)"XdgDesktopFile::XdgDesktopFile(XdgDesktopFile::Type, QString const&, QString const&)@Base" 1.0.0
|
||||
|
||||
(c++)"XdgDirs::autostartDirs(QString const&)@Base" 1.0.0
|
||||
(c++)"XdgDirs::autostartHome(bool)@Base" 1.0.0
|
||||
(c++)"XdgDirs::cacheHome(bool)@Base" 1.0.0
|
||||
@ -68,18 +89,19 @@ libQt5Xdg.so.2 libqt5xdg2 #MINVER#
|
||||
(c++)"XdgDirs::dataHome(bool)@Base" 1.0.0
|
||||
(c++)"XdgDirs::runtimeDir()@Base" 1.0.0
|
||||
(c++)"XdgDirs::setUserDir(XdgDirs::UserDirectory, QString const&, bool)@Base" 1.0.0
|
||||
(c++)"XdgDirs::userDir(XdgDirs::UserDirectory)@Base" 1.0.0
|
||||
(c++)"XdgDirs::userDirDefault(XdgDirs::UserDirectory)@Base" 1.3.0
|
||||
(c++)"XdgIcon::XdgIcon()@Base" 1.0.0
|
||||
(c++)"XdgDirs::userDir(XdgDirs::UserDirectory)@Base" 1.0.0
|
||||
|
||||
(c++)"XdgIcon::defaultApplicationIcon()@Base" 1.0.0
|
||||
(c++)"XdgIcon::defaultApplicationIconName()@Base" 1.0.0
|
||||
(c++)"XdgIcon::followColorScheme()@Base" 2.0.1~
|
||||
(c++)"XdgIcon::fromTheme(QString const&, QIcon const&)@Base" 1.0.0
|
||||
(c++)"XdgIcon::fromTheme(QString const&, QString const&, QString const&, QString const&, QString const&)@Base" 1.0.0
|
||||
(c++)"XdgIcon::fromTheme(QStringList const&, QIcon const&)@Base" 1.0.0
|
||||
(c++)"XdgIcon::setThemeName(QString const&)@Base" 1.0.0
|
||||
(c++)"XdgIcon::themeName()@Base" 1.0.0
|
||||
(c++)"XdgIcon::setFollowColorScheme(bool)@Base" 2.0.1~
|
||||
(c++)"XdgIcon::~XdgIcon()@Base" 1.0.0
|
||||
(c++)"XdgMenu::XdgMenu(QObject*)@Base" 1.0.0
|
||||
(c++)"XdgIcon::XdgIcon()@Base" 1.0.0
|
||||
|
||||
(c++)"XdgMenu::addWatchPath(QString const&)@Base" 1.0.0
|
||||
(c++)"XdgMenu::changed()@Base" 1.0.0
|
||||
(c++)"XdgMenu::environments()@Base" 1.0.0
|
||||
@ -98,11 +120,7 @@ libQt5Xdg.so.2 libqt5xdg2 #MINVER#
|
||||
(c++)"XdgMenu::setEnvironments(QStringList const&)@Base" 1.0.0
|
||||
(c++)"XdgMenu::setLogDir(QString const&)@Base" 1.0.0
|
||||
(c++)"XdgMenu::staticMetaObject@Base" 1.0.0
|
||||
(c++)"XdgMenu::xml() const@Base" 1.0.0
|
||||
(c++)"XdgMenu::~XdgMenu()@Base" 1.0.0
|
||||
(c++)"XdgMenuWidget::XdgMenuWidget(QDomElement const&, QWidget*)@Base" 1.0.0
|
||||
(c++)"XdgMenuWidget::XdgMenuWidget(XdgMenu const&, QString const&, QWidget*)@Base" 1.0.0
|
||||
(c++)"XdgMenuWidget::XdgMenuWidget(XdgMenuWidget const&, QWidget*)@Base" 1.0.0
|
||||
|
||||
(c++)"XdgMenuWidget::event(QEvent*)@Base" 1.0.0
|
||||
(c++)"XdgMenuWidget::metaObject() const@Base" 1.0.0
|
||||
(c++)"XdgMenuWidget::operator=(XdgMenuWidget const&)@Base" 1.0.0
|
||||
@ -110,26 +128,18 @@ libQt5Xdg.so.2 libqt5xdg2 #MINVER#
|
||||
(c++)"XdgMenuWidget::qt_metacast(char const*)@Base" 1.0.0
|
||||
(c++)"XdgMenuWidget::staticMetaObject@Base" 1.0.0
|
||||
(c++)"XdgMenuWidget::~XdgMenuWidget()@Base" 1.0.0
|
||||
(c++)"XdgMimeType::XdgMimeType()@Base" 1.0.0
|
||||
(c++)"XdgMimeType::XdgMimeType(QMimeType const&)@Base" 1.0.0
|
||||
(c++)"XdgMimeType::XdgMimeType(XdgMimeType const&)@Base" 1.0.0
|
||||
(c++)"XdgMenuWidget::XdgMenuWidget(QDomElement const&, QWidget*)@Base" 1.0.0
|
||||
(c++)"XdgMenuWidget::XdgMenuWidget(XdgMenu const&, QString const&, QWidget*)@Base" 1.0.0
|
||||
(c++)"XdgMenuWidget::XdgMenuWidget(XdgMenuWidget const&, QWidget*)@Base" 1.0.0
|
||||
|
||||
(c++)"XdgMenu::~XdgMenu()@Base" 1.0.0
|
||||
(c++)"XdgMenu::XdgMenu(QObject*)@Base" 1.0.0
|
||||
(c++)"XdgMenu::xml() const@Base" 1.0.0
|
||||
|
||||
(c++)"XdgMimeType::icon() const@Base" 1.0.0
|
||||
(c++)"XdgMimeType::iconName() const@Base" 1.0.0
|
||||
(c++)"XdgMimeType::operator=(XdgMimeType const&)@Base" 1.0.0
|
||||
(c++)"XdgMimeType::~XdgMimeType()@Base" 1.0.0
|
||||
(c++)"non-virtual thunk to XdgMenuWidget::~XdgMenuWidget()@Base" 1.0.0
|
||||
(c++)"typeinfo for XdgAction@Base" 1.0.0
|
||||
(c++)"typeinfo for XdgDesktopFile@Base" 1.0.0
|
||||
(c++)"typeinfo for XdgIcon@Base" 1.0.0
|
||||
(c++)"typeinfo for XdgMenu@Base" 1.0.0
|
||||
(c++)"typeinfo for XdgMenuWidget@Base" 1.0.0
|
||||
(c++)"typeinfo name for XdgAction@Base" 1.0.0
|
||||
(c++)"typeinfo name for XdgDesktopFile@Base" 1.0.0
|
||||
(c++)"typeinfo name for XdgIcon@Base" 1.0.0
|
||||
(c++)"typeinfo name for XdgMenu@Base" 1.0.0
|
||||
(c++)"typeinfo name for XdgMenuWidget@Base" 1.0.0
|
||||
(c++)"vtable for XdgAction@Base" 1.0.0
|
||||
(c++)"vtable for XdgDesktopFile@Base" 1.0.0
|
||||
(c++)"vtable for XdgIcon@Base" 1.0.0
|
||||
(c++)"vtable for XdgMenu@Base" 1.0.0
|
||||
(c++)"vtable for XdgMenuWidget@Base" 1.0.0
|
||||
(c++)"XdgMimeType::XdgMimeType()@Base" 1.0.0
|
||||
(c++)"XdgMimeType::XdgMimeType(QMimeType const&)@Base" 1.0.0
|
||||
(c++)"XdgMimeType::XdgMimeType(XdgMimeType const&)@Base" 1.0.0
|
2
debian/libqt5xdgiconloader-dev.install
vendored
2
debian/libqt5xdgiconloader-dev.install
vendored
@ -3,6 +3,8 @@ usr/include/qt5xdgiconloader
|
||||
usr/lib/*/libQt5XdgIconLoader.so
|
||||
usr/lib/*/pkgconfig/Qt5XdgIconLoader.pc
|
||||
|
||||
usr/lib/*/qt5/plugins/iconengines/libQt5XdgIconPlugin.so
|
||||
|
||||
usr/share/cmake/qt5xdgiconloader/qt5xdgiconloader-config-version.cmake
|
||||
usr/share/cmake/qt5xdgiconloader/qt5xdgiconloader-config.cmake
|
||||
usr/share/cmake/qt5xdgiconloader/qt5xdgiconloader-targets.cmake
|
||||
|
@ -1,15 +1,8 @@
|
||||
libQt5XdgIconLoader.so.2 libqt5xdgiconloader2 #MINVER#
|
||||
(c++)"XdgIconLoader::XdgIconLoader()@Base" 2.0.0
|
||||
(c++)"XdgIconLoader::ensureInitialized()@Base" 2.0.0
|
||||
(c++)"XdgIconLoader::findIconHelper(QString const&, QString const&, QStringList&) const@Base" 2.0.0
|
||||
(c++)"XdgIconLoader::instance()@Base" 2.0.0
|
||||
(c++)"XdgIconLoader::loadIcon(QString const&) const@Base" 2.0.0
|
||||
(c++)"XdgIconLoader::setThemeName(QString const&)@Base" 2.0.0
|
||||
(c++)"XdgIconLoader::setThemeSearchPath(QStringList const&)@Base" 2.0.0
|
||||
(c++)"XdgIconLoader::themeSearchPaths() const@Base" 2.0.0
|
||||
(c++)"XdgIconLoader::updateSystemTheme()@Base" 2.0.0
|
||||
(c++)"XdgIconLoaderEngine::XdgIconLoaderEngine(QString const&)@Base" 2.0.0
|
||||
(c++)"XdgIconLoaderEngine::XdgIconLoaderEngine(XdgIconLoaderEngine const&)@Base" 2.0.0
|
||||
libQt5XdgIconLoader.so.3 libqt5xdgiconloader3 #MINVER#
|
||||
(c++)"typeinfo for XdgIconLoaderEngine@Base" 2.0.0
|
||||
(c++)"typeinfo name for XdgIconLoaderEngine@Base" 2.0.0
|
||||
(c++)"vtable for XdgIconLoaderEngine@Base" 2.0.0
|
||||
|
||||
(c++)"XdgIconLoaderEngine::actualSize(QSize const&, QIcon::Mode, QIcon::State)@Base" 2.0.0
|
||||
(c++)"XdgIconLoaderEngine::clone() const@Base" 2.0.0
|
||||
(c++)"XdgIconLoaderEngine::ensureLoaded()@Base" 2.0.0
|
||||
@ -22,6 +15,11 @@ libQt5XdgIconLoader.so.2 libqt5xdgiconloader2 #MINVER#
|
||||
(c++)"XdgIconLoaderEngine::virtual_hook(int, void*)@Base" 2.0.0
|
||||
(c++)"XdgIconLoaderEngine::write(QDataStream&) const@Base" 2.0.0
|
||||
(c++)"XdgIconLoaderEngine::~XdgIconLoaderEngine()@Base" 2.0.0
|
||||
(c++)"typeinfo for XdgIconLoaderEngine@Base" 2.0.0
|
||||
(c++)"typeinfo name for XdgIconLoaderEngine@Base" 2.0.0
|
||||
(c++)"vtable for XdgIconLoaderEngine@Base" 2.0.0
|
||||
(c++)"XdgIconLoaderEngine::XdgIconLoaderEngine(QString const&)@Base" 2.0.0
|
||||
(c++)"XdgIconLoaderEngine::XdgIconLoaderEngine(XdgIconLoaderEngine const&)@Base" 2.0.0
|
||||
|
||||
(c++)"XdgIconLoader::findIconHelper(QString const&, QString const&, QStringList&, bool) const@Base" 2.0.1~
|
||||
(c++)"XdgIconLoader::instance()@Base" 2.0.0
|
||||
(c++)"XdgIconLoader::loadIcon(QString const&) const@Base" 2.0.0
|
||||
(c++)"XdgIconLoader::setFollowColorScheme(bool)@Base" 2.0.1~
|
||||
(c++)"XdgIconLoader::unthemedFallback(QString const&, QStringList const&) const@Base" 2.0.1~
|
4
debian/qtxdg-dev-tools.install
vendored
Normal file
4
debian/qtxdg-dev-tools.install
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
usr/bin/qtxdg-iconfinder
|
||||
usr/bin/qtxdg-desktop-file-start
|
||||
|
||||
|
8
debian/rules
vendored
8
debian/rules
vendored
@ -6,11 +6,13 @@ export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
|
||||
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
|
||||
|
||||
%:
|
||||
dh ${@} --buildsystem cmake \
|
||||
--parallel \
|
||||
--fail-missing
|
||||
dh ${@} --buildsystem cmake
|
||||
|
||||
override_dh_missing:
|
||||
dh_missing --fail-missing
|
||||
|
||||
override_dh_auto_configure:
|
||||
dh_auto_configure -- \
|
||||
-DBUILD_DEV_UTILS=YES \
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo
|
||||
|
||||
|
@ -1,8 +1,5 @@
|
||||
set(QTX_LIBRARIES Qt5::Widgets Qt5::Xml Qt5::DBus)
|
||||
|
||||
include_directories(
|
||||
"${Qt5Gui_PRIVATE_INCLUDE_DIRS}"
|
||||
)
|
||||
set(libqtxdg_PUBLIC_H_FILES
|
||||
xdgaction.h
|
||||
xdgdesktopfile.h
|
||||
@ -63,14 +60,11 @@ set(libqtxdg_MOCS
|
||||
xdgmenuwidget.h
|
||||
)
|
||||
|
||||
QT5_WRAP_CPP(libqtxdg_CXX_FILES ${libqtxdg_MOCS})
|
||||
|
||||
add_library(${QTXDGX_LIBRARY_NAME} SHARED
|
||||
${libqtxdg_PUBLIC_H_FILES}
|
||||
${libqtxdg_PRIVATE_H_FILES}
|
||||
${libqtxdg_PRIVATE_H_FILES}
|
||||
${libqtxdg_CPP_FILES}
|
||||
${libqtxdg_CXX_FILES}
|
||||
${libqtxdg_MOCS}
|
||||
)
|
||||
|
||||
target_link_libraries(${QTXDGX_LIBRARY_NAME}
|
||||
@ -85,24 +79,22 @@ set_target_properties(${QTXDGX_LIBRARY_NAME} PROPERTIES
|
||||
)
|
||||
|
||||
target_compile_definitions(${QTXDGX_LIBRARY_NAME}
|
||||
PRIVATE "QTXDG_COMPILATION=\"1\""
|
||||
PRIVATE "QTXDG_VERSION=\"${QTXDG_VERSION_STRING}\""
|
||||
PRIVATE
|
||||
"QTXDG_COMPILATION=\"1\""
|
||||
"QTXDG_VERSION=\"${QTXDG_VERSION_STRING}\""
|
||||
"QT_NO_KEYWORDS"
|
||||
)
|
||||
|
||||
target_include_directories(${QTXDGX_LIBRARY_NAME}
|
||||
INTERFACE "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${QTXDGX_FILE_NAME}>"
|
||||
INTERFACE "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
|
||||
INTERFACE
|
||||
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${QTXDGX_FILE_NAME}>"
|
||||
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
|
||||
"$<BUILD_INTERFACE:${QTXDGX_INTREE_INCLUDEDIR}/${QTXDGX_FILE_NAME}>"
|
||||
"$<BUILD_INTERFACE:${QTXDGX_INTREE_INCLUDEDIR}>"
|
||||
PRIVATE
|
||||
${Qt5Gui_PRIVATE_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
# include directories and targets for the in tree build
|
||||
target_include_directories(${QTXDGX_LIBRARY_NAME}
|
||||
INTERFACE "$<BUILD_INTERFACE:${QTXDGX_INTREE_INCLUDEDIR}/${QTXDGX_FILE_NAME}>"
|
||||
INTERFACE "$<BUILD_INTERFACE:${QTXDGX_INTREE_INCLUDEDIR}>"
|
||||
)
|
||||
|
||||
export(TARGETS ${QTXDGX_LIBRARY_NAME} APPEND FILE "${CMAKE_BINARY_DIR}/${QTXDGX_FILE_NAME}-targets.cmake")
|
||||
# end of in tree build stuff
|
||||
|
||||
# create the portble headers
|
||||
create_portable_headers(libqtxdg_PORTABLE_HEADERS
|
||||
HEADER_NAMES ${libqtxdg_PUBLIC_CLASSES}
|
||||
|
@ -71,7 +71,7 @@ public:
|
||||
|
||||
const XdgDesktopFile& desktopFile() const { return mDesktopFile; }
|
||||
|
||||
private slots:
|
||||
private Q_SLOTS:
|
||||
void runConmmand() const;
|
||||
void updateIcon();
|
||||
|
||||
|
@ -57,14 +57,14 @@ XdgDesktopFileList XdgAutoStart::desktopFileList(QStringList dirs, bool excludeH
|
||||
|
||||
QSet<QString> processed;
|
||||
XdgDesktopFileList ret;
|
||||
foreach (const QString &dirName, dirs)
|
||||
Q_FOREACH (const QString &dirName, dirs)
|
||||
{
|
||||
QDir dir(dirName);
|
||||
if (!dir.exists())
|
||||
continue;
|
||||
|
||||
const QFileInfoList files = dir.entryInfoList(QStringList(QLatin1String("*.desktop")), QDir::Files | QDir::Readable);
|
||||
foreach (const QFileInfo &fi, files)
|
||||
Q_FOREACH (const QFileInfo &fi, files)
|
||||
{
|
||||
if (processed.contains(fi.fileName()))
|
||||
continue;
|
||||
|
@ -409,9 +409,9 @@ bool XdgDesktopFileData::startApplicationDetached(const XdgDesktopFile *q, const
|
||||
}
|
||||
|
||||
bool nonDetach = false;
|
||||
foreach(const QString &s, nonDetachExecs)
|
||||
Q_FOREACH(const QString &s, nonDetachExecs)
|
||||
{
|
||||
foreach(const QString &a, args)
|
||||
Q_FOREACH(const QString &a, args)
|
||||
{
|
||||
if (a.contains(s))
|
||||
{
|
||||
@ -953,7 +953,7 @@ QString expandEnvVariables(const QString str)
|
||||
QStringList expandEnvVariables(const QStringList strs)
|
||||
{
|
||||
QStringList res;
|
||||
foreach(const QString &s, strs)
|
||||
Q_FOREACH(const QString &s, strs)
|
||||
res << expandEnvVariables(s);
|
||||
|
||||
return res;
|
||||
@ -971,7 +971,7 @@ QStringList XdgDesktopFile::expandExecString(const QStringList& urls) const
|
||||
unEscapeExec(execStr);
|
||||
QStringList tokens = parseCombinedArgString(execStr);
|
||||
|
||||
foreach (QString token, tokens)
|
||||
Q_FOREACH (QString token, tokens)
|
||||
{
|
||||
// The parseCombinedArgString() splits the string by the space symbols,
|
||||
// we temporarily replaced them on the special characters.
|
||||
@ -1016,7 +1016,7 @@ QStringList XdgDesktopFile::expandExecString(const QStringList& urls) const
|
||||
// program. Local files may either be passed as file: URLs or as file path.
|
||||
if (token == QLatin1String("%U"))
|
||||
{
|
||||
foreach (const QString &s, urls)
|
||||
Q_FOREACH (const QString &s, urls)
|
||||
{
|
||||
QUrl url(expandEnvVariables(s));
|
||||
result << ((!url.toLocalFile().isEmpty()) ? url.toLocalFile() : QString::fromUtf8(url.toEncoded()));
|
||||
@ -1081,7 +1081,7 @@ bool checkTryExec(const QString& progName)
|
||||
|
||||
QStringList dirs = QFile::decodeName(qgetenv("PATH")).split(QLatin1Char(':'));
|
||||
|
||||
foreach (const QString &dir, dirs)
|
||||
Q_FOREACH (const QString &dir, dirs)
|
||||
{
|
||||
if (QFileInfo(QDir(dir), progName).isExecutable())
|
||||
return true;
|
||||
@ -1103,7 +1103,7 @@ QString XdgDesktopFile::id(const QString &fileName, bool checkFileExists)
|
||||
QString id = f.absoluteFilePath();
|
||||
const QStringList dataDirs = XdgDirs::dataDirs();
|
||||
|
||||
foreach(const QString &d, dataDirs) {
|
||||
Q_FOREACH(const QString &d, dataDirs) {
|
||||
if (id.startsWith(d)) {
|
||||
// remove only the first occurence
|
||||
id.replace(id.indexOf(d), d.size(), QString());
|
||||
@ -1211,7 +1211,7 @@ bool XdgDesktopFile::isSuitable(bool excludeHidden, const QString &environment)
|
||||
|
||||
QString expandDynamicUrl(QString url)
|
||||
{
|
||||
foreach(const QString &line, QProcess::systemEnvironment())
|
||||
Q_FOREACH(const QString &line, QProcess::systemEnvironment())
|
||||
{
|
||||
QString name = line.section(QLatin1Char('='), 0, 0);
|
||||
QString val = line.section(QLatin1Char('='), 1);
|
||||
@ -1253,7 +1253,7 @@ QString findDesktopFile(const QString& dirName, const QString& desktopName)
|
||||
|
||||
// Working recursively ............
|
||||
QFileInfoList dirs = dir.entryInfoList(QStringList(), QDir::Dirs | QDir::NoDotAndDotDot);
|
||||
foreach (const QFileInfo &d, dirs)
|
||||
Q_FOREACH (const QFileInfo &d, dirs)
|
||||
{
|
||||
QString cn = d.canonicalFilePath();
|
||||
if (dirName != cn)
|
||||
@ -1273,7 +1273,7 @@ QString findDesktopFile(const QString& desktopName)
|
||||
QStringList dataDirs = XdgDirs::dataDirs();
|
||||
dataDirs.prepend(XdgDirs::dataHome(false));
|
||||
|
||||
foreach (const QString &dirName, dataDirs)
|
||||
Q_FOREACH (const QString &dirName, dataDirs)
|
||||
{
|
||||
QString f = findDesktopFile(dirName + QLatin1String("/applications"), desktopName);
|
||||
if (!f.isEmpty())
|
||||
@ -1415,14 +1415,14 @@ bool writeDesktopFile(QIODevice & device, const QSettings::SettingsMap & map)
|
||||
QTextStream stream(&device);
|
||||
QString section;
|
||||
|
||||
foreach (const QString &key, map.keys())
|
||||
for (auto it = map.constBegin(); it != map.constEnd(); ++it)
|
||||
{
|
||||
if (! map.value(key).canConvert<QString>())
|
||||
if (! it.value().canConvert<QString>())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
QString thisSection = key.section(QLatin1Char('/'), 0, 0);
|
||||
QString thisSection = it.key().section(QLatin1Char('/'), 0, 0);
|
||||
if (thisSection.isEmpty())
|
||||
{
|
||||
qWarning() << "No section defined";
|
||||
@ -1435,7 +1435,7 @@ bool writeDesktopFile(QIODevice & device, const QSettings::SettingsMap & map)
|
||||
section = thisSection;
|
||||
}
|
||||
|
||||
QString remainingKey = key.section(QLatin1Char('/'), 1, -1);
|
||||
QString remainingKey = it.key().section(QLatin1Char('/'), 1, -1);
|
||||
|
||||
if (remainingKey.isEmpty())
|
||||
{
|
||||
@ -1443,7 +1443,7 @@ bool writeDesktopFile(QIODevice & device, const QSettings::SettingsMap & map)
|
||||
return false;
|
||||
}
|
||||
|
||||
stream << remainingKey << QLatin1Char('=') << map.value(key).toString() << QLatin1Char('\n');
|
||||
stream << remainingKey << QLatin1Char('=') << it.value().toString() << QLatin1Char('\n');
|
||||
|
||||
}
|
||||
|
||||
@ -1462,7 +1462,7 @@ void XdgDesktopFileCache::initialize(const QString& dirName)
|
||||
|
||||
// Working recursively ............
|
||||
QFileInfoList files = dir.entryInfoList(QStringList(), QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot);
|
||||
foreach (const QFileInfo &f, files)
|
||||
Q_FOREACH (const QFileInfo &f, files)
|
||||
{
|
||||
if (f.isDir())
|
||||
{
|
||||
@ -1482,7 +1482,7 @@ void XdgDesktopFileCache::initialize(const QString& dirName)
|
||||
|
||||
QStringList mimes = df->value(mimeTypeKey).toString().split(QLatin1Char(';'), QString::SkipEmptyParts);
|
||||
|
||||
foreach (const QString &mime, mimes)
|
||||
Q_FOREACH (const QString &mime, mimes)
|
||||
{
|
||||
int pref = df->value(initialPreferenceKey, 0).toInt();
|
||||
// We move the desktopFile forward in the list for this mime, so that
|
||||
@ -1522,8 +1522,8 @@ void loadMimeCacheDir(const QString& dirName, QHash<QString, QList<XdgDesktopFil
|
||||
|
||||
|
||||
// Working recursively ............
|
||||
QFileInfoList files = dir.entryInfoList(QStringList(), QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot);
|
||||
foreach (const QFileInfo &f, files)
|
||||
const QFileInfoList files = dir.entryInfoList(QStringList(), QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot);
|
||||
Q_FOREACH (const QFileInfo &f, files)
|
||||
{
|
||||
if (f.isDir())
|
||||
{
|
||||
@ -1536,9 +1536,9 @@ void loadMimeCacheDir(const QString& dirName, QHash<QString, QList<XdgDesktopFil
|
||||
if (!df)
|
||||
continue;
|
||||
|
||||
QStringList mimes = df->value(mimeTypeKey).toString().split(QLatin1Char(';'), QString::SkipEmptyParts);
|
||||
const QStringList mimes = df->value(mimeTypeKey).toString().split(QLatin1Char(';'), QString::SkipEmptyParts);
|
||||
|
||||
foreach (const QString &mime, mimes)
|
||||
Q_FOREACH (const QString &mime, mimes)
|
||||
{
|
||||
int pref = df->value(initialPreferenceKey, 0).toInt();
|
||||
// We move the desktopFile forward in the list for this mime, so that
|
||||
@ -1582,7 +1582,7 @@ void XdgDesktopFileCache::initialize()
|
||||
QStringList dataDirs = XdgDirs::dataDirs();
|
||||
dataDirs.prepend(XdgDirs::dataHome(false));
|
||||
|
||||
foreach (const QString &dirname, dataDirs)
|
||||
Q_FOREACH (const QString &dirname, dataDirs)
|
||||
{
|
||||
initialize(dirname + QLatin1String("/applications"));
|
||||
// loadMimeCacheDir(dirname + "/applications", m_defaultAppsCache);
|
||||
@ -1593,7 +1593,7 @@ QList<XdgDesktopFile*> XdgDesktopFileCache::getAppsOfCategory(const QString& cat
|
||||
{
|
||||
QList<XdgDesktopFile*> list;
|
||||
const QString _category = category.toUpper();
|
||||
foreach (XdgDesktopFile *desktopFile, instance().m_fileCache.values())
|
||||
Q_FOREACH (XdgDesktopFile *desktopFile, instance().m_fileCache)
|
||||
{
|
||||
QStringList categories = desktopFile->value(categoriesKey).toString().toUpper().split(QLatin1Char(';'));
|
||||
if (!categories.isEmpty() && (categories.contains(_category) || categories.contains(QLatin1String("X-") + _category)))
|
||||
@ -1614,10 +1614,10 @@ XdgDesktopFile* XdgDesktopFileCache::getDefaultApp(const QString& mimetype)
|
||||
// /usr/share/applications/mimeapps.list (in that order) for a default.
|
||||
QStringList dataDirs = XdgDirs::dataDirs();
|
||||
dataDirs.prepend(XdgDirs::dataHome(false));
|
||||
foreach(const QString &dataDir, dataDirs)
|
||||
Q_FOREACH(const QString &dataDir, dataDirs)
|
||||
{
|
||||
QString defaultsListPath = dataDir + QLatin1String("/applications/mimeapps.list");
|
||||
if (QFileInfo(defaultsListPath).exists())
|
||||
if (QFileInfo::exists(defaultsListPath))
|
||||
{
|
||||
QSettings defaults(defaultsListPath, desktopFileSettingsFormat());
|
||||
|
||||
@ -1628,7 +1628,7 @@ XdgDesktopFile* XdgDesktopFileCache::getDefaultApp(const QString& mimetype)
|
||||
QVariant value = defaults.value(mimetype);
|
||||
if (value.canConvert<QStringList>()) // A single string can also convert to a stringlist
|
||||
{
|
||||
foreach (const QString &desktopFileName, value.toStringList())
|
||||
Q_FOREACH (const QString &desktopFileName, value.toStringList())
|
||||
{
|
||||
XdgDesktopFile* desktopFile = XdgDesktopFileCache::getFile(desktopFileName);
|
||||
if (desktopFile)
|
||||
|
@ -108,7 +108,7 @@ QString userDirFallback(XdgDirs::UserDirectory dir)
|
||||
if (home.isEmpty())
|
||||
return QString::fromLatin1("/tmp");
|
||||
else if (dir == XdgDirs::Desktop)
|
||||
fallback = QString::fromLatin1("%1/%2").arg(home).arg(QLatin1String("Desktop"));
|
||||
fallback = QString::fromLatin1("%1/%2").arg(home, QLatin1String("Desktop"));
|
||||
else
|
||||
fallback = home;
|
||||
|
||||
@ -178,10 +178,12 @@ bool XdgDirs::setUserDir(XdgDirs::UserDirectory dir, const QString& value, bool
|
||||
if (dir < XdgDirs::Desktop || dir > XdgDirs::Videos)
|
||||
return false;
|
||||
|
||||
const QString home = QFile::decodeName(qgetenv("HOME"));
|
||||
if (!(value.startsWith(QLatin1String("$HOME"))
|
||||
|| value.startsWith(QLatin1String("~/"))
|
||||
|| value.startsWith(QFile::decodeName(qgetenv("HOME")))))
|
||||
return false;
|
||||
|| value.startsWith(home)
|
||||
|| value.startsWith(QDir(home).canonicalPath())))
|
||||
return false;
|
||||
|
||||
QString folderName = userDirectoryString[dir];
|
||||
|
||||
@ -215,7 +217,7 @@ bool XdgDirs::setUserDir(XdgDirs::UserDirectory dir, const QString& value, bool
|
||||
stream.reset();
|
||||
configFile.resize(0);
|
||||
if (!foundVar)
|
||||
stream << QString::fromLatin1("XDG_%1_DIR=\"%2\"\n").arg(folderName.toUpper()).arg(value);
|
||||
stream << QString::fromLatin1("XDG_%1_DIR=\"%2\"\n").arg(folderName.toUpper(),(value));
|
||||
|
||||
for (QVector<QString>::iterator i = lines.begin(); i != lines.end(); ++i)
|
||||
stream << *i << QLatin1Char('\n');
|
||||
@ -334,7 +336,7 @@ QStringList XdgDirs::autostartDirs(const QString &postfix)
|
||||
{
|
||||
QStringList dirs;
|
||||
const QStringList s = configDirs();
|
||||
foreach(const QString &dir, s)
|
||||
Q_FOREACH(const QString &dir, s)
|
||||
dirs << QString::fromLatin1("%1/autostart").arg(dir) + postfix;
|
||||
|
||||
return dirs;
|
||||
|
@ -50,7 +50,7 @@ struct QtIconCache: public IconCache
|
||||
}
|
||||
};
|
||||
}
|
||||
Q_GLOBAL_STATIC(IconCache, qtIconCache);
|
||||
Q_GLOBAL_STATIC(IconCache, qtIconCache)
|
||||
|
||||
static void qt_cleanup_icon_cache()
|
||||
{
|
||||
@ -68,25 +68,6 @@ XdgIcon::~XdgIcon()
|
||||
}
|
||||
|
||||
|
||||
/************************************************
|
||||
Returns the name of the current icon theme.
|
||||
************************************************/
|
||||
QString XdgIcon::themeName()
|
||||
{
|
||||
return QIcon::themeName();
|
||||
}
|
||||
|
||||
|
||||
/************************************************
|
||||
Sets the current icon theme to name.
|
||||
************************************************/
|
||||
void XdgIcon::setThemeName(const QString& themeName)
|
||||
{
|
||||
QIcon::setThemeName(themeName);
|
||||
XdgIconLoader::instance()->updateSystemTheme();
|
||||
}
|
||||
|
||||
|
||||
/************************************************
|
||||
Returns the QIcon corresponding to name in the current icon theme. If no such icon
|
||||
is found in the current theme fallback is return instead.
|
||||
@ -137,7 +118,7 @@ QIcon XdgIcon::fromTheme(const QString& iconName, const QIcon& fallback)
|
||||
************************************************/
|
||||
QIcon XdgIcon::fromTheme(const QStringList& iconNames, const QIcon& fallback)
|
||||
{
|
||||
foreach (const QString &iconName, iconNames)
|
||||
Q_FOREACH (const QString &iconName, iconNames)
|
||||
{
|
||||
QIcon icon = fromTheme(iconName);
|
||||
if (!icon.isNull())
|
||||
@ -164,6 +145,17 @@ QIcon XdgIcon::fromTheme(const QString &iconName,
|
||||
return fromTheme(icons);
|
||||
}
|
||||
|
||||
bool XdgIcon::followColorScheme()
|
||||
{
|
||||
return XdgIconLoader::instance()->followColorScheme();
|
||||
}
|
||||
|
||||
|
||||
void XdgIcon::setFollowColorScheme(bool enable)
|
||||
{
|
||||
XdgIconLoader::instance()->setFollowColorScheme(enable);
|
||||
}
|
||||
|
||||
|
||||
QIcon XdgIcon::defaultApplicationIcon()
|
||||
{
|
||||
|
@ -44,8 +44,19 @@ public:
|
||||
const QString &fallbackIcon4 = QString());
|
||||
static QIcon fromTheme(const QStringList& iconNames, const QIcon& fallback = QIcon());
|
||||
|
||||
static QString themeName();
|
||||
static void setThemeName(const QString& themeName);
|
||||
/*!
|
||||
* Flag if the "FollowsColorScheme" hint (the KDE extension to XDG
|
||||
* themes) should be honored. If enabled and the icon theme supports
|
||||
* this, the icon engine "colorizes" icons based on the application's
|
||||
* palette.
|
||||
*
|
||||
* Default is true (use this extension).
|
||||
*/
|
||||
static bool followColorScheme();
|
||||
static void setFollowColorScheme(bool enable);
|
||||
/* TODO: deprecate & remove all QIcon wrappers */
|
||||
static QString themeName() { return QIcon::themeName(); }
|
||||
static void setThemeName(const QString& themeName) { QIcon::setThemeName(themeName); }
|
||||
|
||||
static QIcon defaultApplicationIcon();
|
||||
static QString defaultApplicationIconName();
|
||||
|
@ -205,8 +205,7 @@ void XdgMenu::save(const QString& fileName)
|
||||
if (!file.open(QFile::WriteOnly | QFile::Text))
|
||||
{
|
||||
qWarning() << QString::fromLatin1("Cannot write file %1:\n%2.")
|
||||
.arg(fileName)
|
||||
.arg(file.errorString());
|
||||
.arg(fileName, file.errorString());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -225,7 +224,7 @@ void XdgMenuPrivate::load(const QString& fileName)
|
||||
QFile file(fileName);
|
||||
if (!file.open(QFile::ReadOnly | QFile::Text))
|
||||
{
|
||||
qWarning() << QString::fromLatin1("%1 not loading: %2").arg(fileName).arg(file.errorString());
|
||||
qWarning() << QString::fromLatin1("%1 not loading: %2").arg(fileName, file.errorString());
|
||||
return;
|
||||
}
|
||||
mXml.setContent(&file, true);
|
||||
@ -413,7 +412,7 @@ QDomElement XdgMenu::findMenu(QDomElement& baseElement, const QString& path, boo
|
||||
|
||||
const QStringList names = path.split(QLatin1Char('/'), QString::SkipEmptyParts);
|
||||
QDomElement el = baseElement;
|
||||
foreach (const QString &name, names)
|
||||
Q_FOREACH (const QString &name, names)
|
||||
{
|
||||
QDomElement p = el;
|
||||
el = d->mXml.createElement(QLatin1String("Menu"));
|
||||
@ -538,12 +537,12 @@ void XdgMenuPrivate::processDirectoryEntries(QDomElement& element, const QString
|
||||
dirs << parentDirs;
|
||||
|
||||
bool found = false;
|
||||
foreach(const QString &file, files){
|
||||
Q_FOREACH(const QString &file, files){
|
||||
if (file.startsWith(QLatin1Char('/')))
|
||||
found = loadDirectoryFile(file, element);
|
||||
else
|
||||
{
|
||||
foreach (const QString &dir, dirs)
|
||||
Q_FOREACH (const QString &dir, dirs)
|
||||
{
|
||||
found = loadDirectoryFile(dir + QLatin1Char('/') + file, element);
|
||||
if (found) break;
|
||||
@ -652,7 +651,7 @@ QString XdgMenu::getMenuFileName(const QString& baseName)
|
||||
const QStringList configDirs = XdgDirs::configDirs();
|
||||
QString menuPrefix = QString::fromLocal8Bit(qgetenv("XDG_MENU_PREFIX"));
|
||||
|
||||
foreach(const QString &configDir, configDirs)
|
||||
Q_FOREACH(const QString &configDir, configDirs)
|
||||
{
|
||||
QFileInfo file(QString::fromLatin1("%1/menus/%2%3").arg(configDir, menuPrefix, baseName));
|
||||
if (file.exists())
|
||||
@ -670,9 +669,9 @@ QString XdgMenu::getMenuFileName(const QString& baseName)
|
||||
wellKnownFiles << QLatin1String("gnome-applications.menu");
|
||||
wellKnownFiles << QLatin1String("lxde-applications.menu");
|
||||
|
||||
foreach(const QString &configDir, configDirs)
|
||||
Q_FOREACH(const QString &configDir, configDirs)
|
||||
{
|
||||
foreach (const QString &f, wellKnownFiles)
|
||||
Q_FOREACH (const QString &f, wellKnownFiles)
|
||||
{
|
||||
QFileInfo file(QString::fromLatin1("%1/menus/%2").arg(configDir, f));
|
||||
if (file.exists())
|
||||
@ -715,7 +714,7 @@ void XdgMenuPrivate::rebuild()
|
||||
if (prevHash != mHash)
|
||||
{
|
||||
mOutDated = true;
|
||||
emit changed();
|
||||
Q_EMIT changed();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ public:
|
||||
|
||||
bool isOutDated() const;
|
||||
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
void changed();
|
||||
|
||||
protected:
|
||||
|
@ -73,10 +73,10 @@ public:
|
||||
QFileSystemWatcher mWatcher;
|
||||
bool mOutDated;
|
||||
|
||||
public slots:
|
||||
public Q_SLOTS:
|
||||
void rebuild();
|
||||
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
void changed();
|
||||
|
||||
|
||||
|
@ -90,7 +90,7 @@ void XdgMenuApplinkProcessor::step1()
|
||||
}
|
||||
|
||||
// Process childs menus ...............................
|
||||
foreach (XdgMenuApplinkProcessor* child, mChilds)
|
||||
Q_FOREACH (XdgMenuApplinkProcessor* child, mChilds)
|
||||
child->step1();
|
||||
}
|
||||
|
||||
@ -100,7 +100,7 @@ void XdgMenuApplinkProcessor::step2()
|
||||
// Create AppLinks elements ...........................
|
||||
QDomDocument doc = mElement.ownerDocument();
|
||||
|
||||
foreach (XdgMenuAppFileInfo* fileInfo, mSelected)
|
||||
Q_FOREACH (XdgMenuAppFileInfo* fileInfo, mSelected)
|
||||
{
|
||||
if (mOnlyUnallocated && fileInfo->allocated())
|
||||
continue;
|
||||
@ -141,7 +141,7 @@ void XdgMenuApplinkProcessor::step2()
|
||||
|
||||
|
||||
// Process childs menus ...............................
|
||||
foreach (XdgMenuApplinkProcessor* child, mChilds)
|
||||
Q_FOREACH (XdgMenuApplinkProcessor* child, mChilds)
|
||||
child->step2();
|
||||
}
|
||||
|
||||
@ -189,7 +189,7 @@ void XdgMenuApplinkProcessor::findDesktopFiles(const QString& dirName, const QSt
|
||||
mMenu->addWatchPath(dir.absolutePath());
|
||||
const QFileInfoList files = dir.entryInfoList(QStringList(QLatin1String("*.desktop")), QDir::Files);
|
||||
|
||||
foreach (const QFileInfo &file, files)
|
||||
Q_FOREACH (const QFileInfo &file, files)
|
||||
{
|
||||
XdgDesktopFile* f = XdgDesktopFileCache::getFile(file.canonicalFilePath());
|
||||
if (f)
|
||||
@ -199,7 +199,7 @@ void XdgMenuApplinkProcessor::findDesktopFiles(const QString& dirName, const QSt
|
||||
|
||||
// Working recursively ............
|
||||
const QFileInfoList dirs = dir.entryInfoList(QStringList(), QDir::Dirs | QDir::NoDotAndDotDot);
|
||||
foreach (const QFileInfo &d, dirs)
|
||||
Q_FOREACH (const QFileInfo &d, dirs)
|
||||
{
|
||||
QString dn = d.canonicalFilePath();
|
||||
if (dn != dirName)
|
||||
@ -242,7 +242,7 @@ bool XdgMenuApplinkProcessor::checkTryExec(const QString& progName)
|
||||
|
||||
const QStringList dirs = QFile::decodeName(qgetenv("PATH")).split(QLatin1Char(':'));
|
||||
|
||||
foreach (const QString &dir, dirs)
|
||||
Q_FOREACH (const QString &dir, dirs)
|
||||
{
|
||||
if (QFileInfo(QDir(dir), progName).isExecutable())
|
||||
return true;
|
||||
|
@ -76,7 +76,7 @@ bool XdgMenuReader::load(const QString& fileName, const QString& baseDir)
|
||||
QFile file(mFileName);
|
||||
if (!file.open(QFile::ReadOnly | QFile::Text))
|
||||
{
|
||||
mErrorStr = QString::fromLatin1("%1 not loading: %2").arg(fileName).arg(file.errorString());
|
||||
mErrorStr = QString::fromLatin1("%1 not loading: %2").arg(fileName, file.errorString());
|
||||
return false;
|
||||
}
|
||||
//qDebug() << "Load file:" << mFileName;
|
||||
@ -215,7 +215,7 @@ void XdgMenuReader::processMergeFileTag(QDomElement& element, QStringList* merge
|
||||
QString relativeName;
|
||||
QStringList configDirs = XdgDirs::configDirs();
|
||||
|
||||
foreach (const QString &configDir, configDirs)
|
||||
Q_FOREACH (const QString &configDir, configDirs)
|
||||
{
|
||||
if (mFileName.startsWith(configDir))
|
||||
{
|
||||
@ -236,9 +236,9 @@ void XdgMenuReader::processMergeFileTag(QDomElement& element, QStringList* merge
|
||||
if (relativeName.isEmpty())
|
||||
return;
|
||||
|
||||
foreach (const QString &configDir, configDirs)
|
||||
Q_FOREACH (const QString &configDir, configDirs)
|
||||
{
|
||||
if (QFileInfo(configDir + relativeName).exists())
|
||||
if (QFileInfo::exists(configDir + relativeName))
|
||||
{
|
||||
mergeFile(configDir + relativeName, element, mergedFiles);
|
||||
return;
|
||||
@ -295,9 +295,9 @@ void XdgMenuReader::processDefaultMergeDirsTag(QDomElement& element, QStringList
|
||||
QStringList dirs = XdgDirs::configDirs();
|
||||
dirs << XdgDirs::configHome();
|
||||
|
||||
foreach (const QString &dir, dirs)
|
||||
Q_FOREACH (const QString &dir, dirs)
|
||||
{
|
||||
mergeDir(QString::fromLatin1("%1/menus/%2-merged").arg(dir).arg(menuBaseName), element, mergedFiles);
|
||||
mergeDir(QString::fromLatin1("%1/menus/%2-merged").arg(dir, menuBaseName), element, mergedFiles);
|
||||
}
|
||||
|
||||
if (menuBaseName == QLatin1String("applications"))
|
||||
@ -329,7 +329,7 @@ void XdgMenuReader::processDefaultAppDirsTag(QDomElement& element)
|
||||
QStringList dirs = XdgDirs::dataDirs();
|
||||
dirs.prepend(XdgDirs::dataHome(false));
|
||||
|
||||
foreach (const QString &dir, dirs)
|
||||
Q_FOREACH (const QString &dir, dirs)
|
||||
{
|
||||
//qDebug() << "Add AppDir: " << dir + "/applications/";
|
||||
addDirTag(element, QLatin1String("AppDir"), dir + QLatin1String("/applications/"));
|
||||
@ -360,7 +360,7 @@ void XdgMenuReader::processDefaultDirectoryDirsTag(QDomElement& element)
|
||||
QStringList dirs = XdgDirs::dataDirs();
|
||||
dirs.prepend(XdgDirs::dataHome(false));
|
||||
|
||||
foreach (const QString &dir, dirs)
|
||||
Q_FOREACH (const QString &dir, dirs)
|
||||
addDirTag(element, QLatin1String("DirectoryDir"), dir + QLatin1String("/desktop-directories/"));
|
||||
}
|
||||
|
||||
@ -431,7 +431,7 @@ void XdgMenuReader::mergeDir(const QString& dirName, QDomElement& element, QStri
|
||||
QDir dir = QDir(dirInfo.canonicalFilePath());
|
||||
const QFileInfoList files = dir.entryInfoList(QStringList() << QLatin1String("*.menu"), QDir::Files | QDir::Readable);
|
||||
|
||||
foreach (const QFileInfo &file, files)
|
||||
Q_FOREACH (const QFileInfo &file, files)
|
||||
mergeFile(file.canonicalFilePath(), element, mergedFiles);
|
||||
}
|
||||
}
|
||||
|
@ -47,9 +47,9 @@ public:
|
||||
QString errorString() const { return mErrorStr; }
|
||||
QDomDocument& xml() { return mXml; }
|
||||
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
|
||||
public slots:
|
||||
public Q_SLOTS:
|
||||
|
||||
protected:
|
||||
void processMergeTags(QDomElement& element);
|
||||
|
@ -44,7 +44,7 @@ class XdgMenuWidgetPrivate
|
||||
{
|
||||
private:
|
||||
XdgMenuWidget* const q_ptr;
|
||||
Q_DECLARE_PUBLIC(XdgMenuWidget);
|
||||
Q_DECLARE_PUBLIC(XdgMenuWidget)
|
||||
|
||||
public:
|
||||
explicit XdgMenuWidgetPrivate(XdgMenuWidget* parent):
|
||||
@ -186,7 +186,7 @@ void XdgMenuWidgetPrivate::buildMenu()
|
||||
|
||||
QAction* first = 0;
|
||||
if (!q->actions().isEmpty())
|
||||
first = q->actions().last();
|
||||
first = q->actions().constLast();
|
||||
|
||||
|
||||
DomElementIterator it(mXml, QString());
|
||||
|
@ -96,7 +96,7 @@ QString XdgMimeType::iconName() const
|
||||
names.append(QMimeType::iconName());
|
||||
names.append(QMimeType::genericIconName());
|
||||
|
||||
foreach (const QString &s, names) {
|
||||
Q_FOREACH (const QString &s, names) {
|
||||
if (!XdgIcon::fromTheme(s).isNull()) {
|
||||
dx->iconName = s;
|
||||
break;
|
||||
|
@ -41,6 +41,6 @@ QDebug operator<<(QDebug dbg, const QDomElement &el)
|
||||
for (int i=0; i<map.count(); ++i)
|
||||
args += QLatin1Char(' ') + map.item(i).nodeName() + QLatin1Char('=') + map.item(i).nodeValue() + QLatin1Char('\'');
|
||||
|
||||
dbg.nospace() << QString::fromLatin1("<%1%2>%3</%1>").arg(el.tagName()).arg(args).arg(el.text());
|
||||
dbg.nospace() << QString::fromLatin1("<%1%2>%3</%1>").arg(el.tagName(), args, el.text());
|
||||
return dbg.space();
|
||||
}
|
||||
|
28
release.sh
28
release.sh
@ -1,28 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
PROJECT="libqtxdg"
|
||||
version="$1"
|
||||
prefix=$PROJECT-$version
|
||||
shift
|
||||
|
||||
if [[ -z $version ]]; then
|
||||
>&2 echo "USAGE: $0 <tag>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "dist/$version"
|
||||
echo "Creating $prefix.tar.gz"
|
||||
git archive -9 --format tar.gz $version --prefix="$prefix/" > "dist/$version/$prefix.tar.gz"
|
||||
gpg --armor --detach-sign "dist/$version/$prefix.tar.gz"
|
||||
echo "Creating $prefix.tar.xz"
|
||||
git archive -9 --format tar.xz $version --prefix="$prefix/" > "dist/$version/$prefix.tar.xz"
|
||||
gpg --armor --detach-sign "dist/$version/$prefix.tar.xz"
|
||||
cd "dist/$version"
|
||||
|
||||
sha1sum --tag *.tar.gz *.tar.xz >> CHECKSUMS
|
||||
sha256sum --tag *.tar.gz *.tar.xz >> CHECKSUMS
|
||||
|
||||
cd ..
|
||||
echo "Uploading to lxqt.org..."
|
||||
|
||||
scp -r "$version" "downloads.lxqt.org:/srv/downloads.lxqt.org/$PROJECT/"
|
@ -1,25 +1,25 @@
|
||||
set(PROJECT_NAME "qtxdg_test")
|
||||
|
||||
remove_definitions(
|
||||
-DQT_USE_QSTRINGBUILDER
|
||||
-DQT_NO_CAST_FROM_ASCII
|
||||
)
|
||||
|
||||
set(CMAKE_AUTOMOC TRUE)
|
||||
add_definitions(
|
||||
-DQT_NO_KEYWORDS
|
||||
)
|
||||
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
macro(qtxdg_add_test)
|
||||
foreach(_testname ${ARGN})
|
||||
add_executable(${_testname} ${_testname}.cpp)
|
||||
target_link_libraries(${_testname} Qt5::Test ${QTXDGX_LIBRARY_NAME})
|
||||
target_include_directories(${_testname}
|
||||
PRIVATE "${PROJECT_SOURCE_DIR}/qtxdg"
|
||||
)
|
||||
add_test(NAME ${_testname} COMMAND ${_testname})
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
include_directories (
|
||||
"${CMAKE_SOURCE_DIR}/qtxdg"
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
|
||||
set_property(DIRECTORY APPEND
|
||||
PROPERTY COMPILE_DEFINITIONS "QTXDG_BUILDING_TESTS=\"1\""
|
||||
)
|
||||
|
@ -47,15 +47,15 @@ void QtXdgTest::testDefaultApp()
|
||||
{
|
||||
QStringList mimedirs = XdgDirs::dataDirs();
|
||||
mimedirs.prepend(XdgDirs::dataHome(false));
|
||||
foreach (QString mimedir, mimedirs)
|
||||
Q_FOREACH (QString mimedir, mimedirs)
|
||||
{
|
||||
QDir dir(mimedir + "/mime");
|
||||
qDebug() << dir.path();
|
||||
QStringList filters = (QStringList() << "*.xml");
|
||||
foreach(QFileInfo mediaDir, dir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot))
|
||||
Q_FOREACH(QFileInfo mediaDir, dir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot))
|
||||
{
|
||||
qDebug() << " " << mediaDir.fileName();
|
||||
foreach (QString mimeXmlFileName, QDir(mediaDir.absoluteFilePath()).entryList(filters, QDir::Files))
|
||||
Q_FOREACH (QString mimeXmlFileName, QDir(mediaDir.absoluteFilePath()).entryList(filters, QDir::Files))
|
||||
{
|
||||
QString mimetype = mediaDir.fileName() + "/" + mimeXmlFileName.left(mimeXmlFileName.length() - 4);
|
||||
QString xdg_utils_default = xdgUtilDefaultApp(mimetype);
|
||||
|
@ -39,7 +39,7 @@ class QtXdgTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
private Q_SLOTS:
|
||||
void testCustomFormat();
|
||||
|
||||
private:
|
||||
|
@ -27,20 +27,20 @@ class Language
|
||||
{
|
||||
public:
|
||||
Language (const QString& lang)
|
||||
: mPreviousLang(QString::fromLocal8Bit(qgetenv("LANG")))
|
||||
: mPreviousLang(QString::fromLocal8Bit(qgetenv("LC_MESSAGES")))
|
||||
{
|
||||
qputenv("LANG", lang.toLocal8Bit());
|
||||
qputenv("LC_MESSAGES", lang.toLocal8Bit());
|
||||
}
|
||||
~Language()
|
||||
{
|
||||
qputenv("LANG", mPreviousLang.toLocal8Bit());
|
||||
qputenv("LC_MESSAGES", mPreviousLang.toLocal8Bit());
|
||||
}
|
||||
private:
|
||||
QString mPreviousLang;
|
||||
};
|
||||
|
||||
|
||||
QTEST_MAIN(tst_xdgdesktopfile);
|
||||
QTEST_MAIN(tst_xdgdesktopfile)
|
||||
|
||||
void tst_xdgdesktopfile::testRead()
|
||||
{
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
class tst_xdgdesktopfile : public QObject {
|
||||
Q_OBJECT
|
||||
private slots:
|
||||
private Q_SLOTS:
|
||||
|
||||
void testRead();
|
||||
void testReadLocalized();
|
||||
|
@ -36,7 +36,7 @@ class tst_xdgdirs : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
private Q_SLOTS:
|
||||
void initTestCase();
|
||||
void cleanupTestCase();
|
||||
|
||||
|
@ -1,26 +1,52 @@
|
||||
include_directories (
|
||||
"${CMAKE_PROJECT_DIR}/qtxdg"
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
set(QTXDG_DESKTOP_FILE_START_SRCS
|
||||
qtxdg-desktop-file-start.cpp
|
||||
)
|
||||
|
||||
set(QTXDG_ICONFINDER_SRCS
|
||||
qtxdg-iconfinder.cpp
|
||||
)
|
||||
|
||||
add_executable(qtxdg-desktop-file-start
|
||||
${QTXDG_DESKTOP_FILE_START_SRCS}
|
||||
)
|
||||
|
||||
add_executable(qtxdg-iconfinder
|
||||
${QTXDG_ICONFINDER_SRCS}
|
||||
)
|
||||
|
||||
target_include_directories(qtxdg-desktop-file-start
|
||||
PRIVATE "${PROJECT_SOURCE_DIR}/qtxdg"
|
||||
)
|
||||
|
||||
target_include_directories(qtxdg-iconfinder
|
||||
PRIVATE "${Qt5Gui_PRIVATE_INCLUDE_DIRS}"
|
||||
)
|
||||
|
||||
target_compile_definitions(qtxdg-desktop-file-start
|
||||
PRIVATE "-DQTXDG_VERSION=\"${QTXDG_VERSION_STRING}\""
|
||||
PRIVATE
|
||||
"-DQTXDG_VERSION=\"${QTXDG_VERSION_STRING}\""
|
||||
"QT_NO_KEYWORDS"
|
||||
)
|
||||
|
||||
target_compile_definitions(qtxdg-iconfinder
|
||||
PRIVATE
|
||||
"-DQTXDG_VERSION=\"${QTXDG_VERSION_STRING}\""
|
||||
"QT_NO_KEYWORDS"
|
||||
)
|
||||
|
||||
target_link_libraries(qtxdg-desktop-file-start
|
||||
${QTXDGX_LIBRARY_NAME}
|
||||
)
|
||||
|
||||
target_link_libraries(qtxdg-iconfinder
|
||||
${QTXDGX_ICONLOADER_LIBRARY_NAME}
|
||||
)
|
||||
|
||||
install(TARGETS
|
||||
qtxdg-desktop-file-start
|
||||
qtxdg-iconfinder
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||
COMPONENT Runtime
|
||||
)
|
||||
|
74
util/qtxdg-iconfinder.cpp
Normal file
74
util/qtxdg-iconfinder.cpp
Normal file
@ -0,0 +1,74 @@
|
||||
/*
|
||||
* libqtxdg - An Qt implementation of freedesktop.org xdg specs
|
||||
* Copyright (C) 2017 Luís Pereira <luis.artur.pereira@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <QGuiApplication> // XdgIconLoader needs a QGuiApplication
|
||||
#include <QCommandLineParser>
|
||||
#include <QElapsedTimer>
|
||||
#include <private/xdgiconloader/xdgiconloader_p.h>
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include <QDebug>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QGuiApplication app(argc, argv);
|
||||
app.setApplicationName(QStringLiteral("qtxdg-iconfinder"));
|
||||
app.setApplicationVersion(QStringLiteral(QTXDG_VERSION));
|
||||
|
||||
QCommandLineParser parser;
|
||||
parser.setApplicationDescription(QStringLiteral("QtXdg icon finder"));
|
||||
parser.addPositionalArgument(QStringLiteral("iconnames"),
|
||||
QStringLiteral("The icon names to search for"),
|
||||
QStringLiteral("[iconnames...]"));
|
||||
parser.addVersionOption();
|
||||
parser.addHelpOption();
|
||||
parser.process(app);
|
||||
|
||||
if (parser.positionalArguments().isEmpty())
|
||||
parser.showHelp(EXIT_FAILURE);
|
||||
|
||||
qint64 totalElapsed = 0;
|
||||
const auto icons = parser.positionalArguments();
|
||||
for (const QString& iconName : icons) {
|
||||
QElapsedTimer t;
|
||||
t.start();
|
||||
const auto info = XdgIconLoader::instance()->loadIcon(iconName);
|
||||
qint64 elapsed = t.elapsed();
|
||||
const auto icon = info.iconName;
|
||||
const auto entries = info.entries;
|
||||
|
||||
std::cout << qPrintable(iconName) <<
|
||||
qPrintable(QString::fromLatin1(":")) << qPrintable(icon) <<
|
||||
qPrintable(QString::fromLatin1(":")) <<
|
||||
qPrintable(QString::number(elapsed)) << "\n";
|
||||
|
||||
for (const auto &i : entries) {
|
||||
std::cout << "\t" << qPrintable(i->filename) << "\n";
|
||||
}
|
||||
totalElapsed += elapsed;
|
||||
}
|
||||
|
||||
std::cout << qPrintable(QString::fromLatin1("Total loadIcon() time: ")) <<
|
||||
qPrintable(QString::number(totalElapsed)) <<
|
||||
qPrintable(QString::fromLatin1(" ms")) << "\n";
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
@ -1,7 +1,3 @@
|
||||
include_directories(
|
||||
"${Qt5Gui_PRIVATE_INCLUDE_DIRS}"
|
||||
)
|
||||
|
||||
set(xdgiconloader_PUBLIC_H_FILES
|
||||
)
|
||||
|
||||
@ -38,17 +34,22 @@ configure_file(
|
||||
COPYONLY
|
||||
)
|
||||
|
||||
target_include_directories(${QTXDGX_ICONLOADER_LIBRARY_NAME}
|
||||
INTERFACE "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${QTXDGX_ICONLOADER_FILE_NAME}>"
|
||||
INTERFACE "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
|
||||
INTERFACE "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${QTXDGX_ICONLOADER_FILE_NAME}/${QTXDG_VERSION_STRING}>"
|
||||
target_compile_definitions(${QTXDGX_ICONLOADER_LIBRARY_NAME}
|
||||
PRIVATE
|
||||
"QT_NO_KEYWORDS"
|
||||
)
|
||||
|
||||
# include directories and targets for the in tree build
|
||||
target_include_directories(${QTXDGX_ICONLOADER_LIBRARY_NAME}
|
||||
PUBLIC "$<BUILD_INTERFACE:${QTXDGX_INTREE_INCLUDEDIR}/${QTXDGX_ICONLOADER_FILE_NAME}>"
|
||||
PUBLIC "$<BUILD_INTERFACE:${QTXDGX_INTREE_INCLUDEDIR}>"
|
||||
PUBLIC "$<BUILD_INTERFACE:${QTXDGX_INTREE_INCLUDEDIR}/${QTXDGX_ICONLOADER_FILE_NAME}/${QTXDG_VERSION_STRING}>"
|
||||
INTERFACE
|
||||
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${QTXDGX_ICONLOADER_FILE_NAME}>"
|
||||
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
|
||||
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${QTXDGX_ICONLOADER_FILE_NAME}/${QTXDG_VERSION_STRING}>"
|
||||
PUBLIC
|
||||
"$<BUILD_INTERFACE:${QTXDGX_INTREE_INCLUDEDIR}/${QTXDGX_ICONLOADER_FILE_NAME}>"
|
||||
"$<BUILD_INTERFACE:${QTXDGX_INTREE_INCLUDEDIR}>"
|
||||
"$<BUILD_INTERFACE:${QTXDGX_INTREE_INCLUDEDIR}/${QTXDGX_ICONLOADER_FILE_NAME}/${QTXDG_VERSION_STRING}>"
|
||||
PRIVATE
|
||||
${Qt5Gui_PRIVATE_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
target_link_libraries(${QTXDGX_ICONLOADER_LIBRARY_NAME}
|
||||
@ -63,7 +64,7 @@ set_target_properties(${QTXDGX_ICONLOADER_LIBRARY_NAME}
|
||||
SOVERSION ${QTXDG_MAJOR_VERSION}
|
||||
)
|
||||
|
||||
export(TARGETS ${QTXDGX_ICONLOADER_LIBRARY_NAME} FILE "${CMAKE_BINARY_DIR}/${QTXDGX_ICONLOADER_FILE_NAME}-targets.cmake")
|
||||
add_subdirectory(plugin)
|
||||
|
||||
install(TARGETS
|
||||
${QTXDGX_ICONLOADER_LIBRARY_NAME} DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
@ -77,6 +78,11 @@ install(FILES
|
||||
COMPONENT Devel
|
||||
)
|
||||
|
||||
file(COPY
|
||||
${xdgiconloader_PRIVATE_INSTALLABLE_H_FILES}
|
||||
DESTINATION "${QTXDGX_INTREE_INCLUDEDIR}/${QTXDGX_ICONLOADER_FILE_NAME}/${QTXDG_VERSION_STRING}/private/xdgiconloader"
|
||||
)
|
||||
|
||||
install(FILES
|
||||
"${QTXDGX_INTREE_INCLUDEDIR}/${QTXDGX_ICONLOADER_FILE_NAME}/${XDGICONLOADER_EXPORT_FILE}"
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${QTXDGX_ICONLOADER_FILE_NAME}"
|
||||
|
49
xdgiconloader/plugin/CMakeLists.txt
Normal file
49
xdgiconloader/plugin/CMakeLists.txt
Normal file
@ -0,0 +1,49 @@
|
||||
set(xdgiconengineplugin_CPP_FILES
|
||||
xdgiconengineplugin.cpp
|
||||
)
|
||||
|
||||
add_library(${QTXDGX_ICONENGINEPLUGIN_LIBRARY_NAME} MODULE
|
||||
${xdgiconengineplugin_CPP_FILES}
|
||||
)
|
||||
|
||||
target_compile_definitions(${QTXDGX_ICONENGINEPLUGIN_LIBRARY_NAME}
|
||||
PRIVATE
|
||||
"QT_NO_KEYWORDS"
|
||||
)
|
||||
target_link_libraries(${QTXDGX_ICONENGINEPLUGIN_LIBRARY_NAME}
|
||||
PUBLIC
|
||||
Qt5::Gui
|
||||
"${QTXDGX_ICONLOADER_LIBRARY_NAME}"
|
||||
)
|
||||
|
||||
target_include_directories("${QTXDGX_ICONENGINEPLUGIN_LIBRARY_NAME}"
|
||||
PRIVATE
|
||||
"${Qt5Gui_PRIVATE_INCLUDE_DIRS}"
|
||||
)
|
||||
|
||||
mark_as_advanced(QTXDGX_ICONENGINEPLUGIN_INSTALL_PATH)
|
||||
|
||||
if (NOT DEFINED QTXDGX_ICONENGINEPLUGIN_INSTALL_PATH)
|
||||
get_target_property(QT_QMAKE_EXECUTABLE ${Qt5Core_QMAKE_EXECUTABLE} IMPORTED_LOCATION)
|
||||
if(NOT QT_QMAKE_EXECUTABLE)
|
||||
message(FATAL_ERROR "qmake is not found.")
|
||||
endif()
|
||||
|
||||
# execute the command "qmake -query QT_INSTALL_PLUGINS" to get the path of plugins dir.
|
||||
execute_process(COMMAND "${QT_QMAKE_EXECUTABLE}" -query QT_INSTALL_PLUGINS
|
||||
OUTPUT_VARIABLE QT_PLUGINS_DIR
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if (NOT QT_PLUGINS_DIR)
|
||||
message(FATAL_ERROR "Qt5 plugin directory cannot be detected.")
|
||||
endif()
|
||||
set(QTXDGX_ICONENGINEPLUGIN_INSTALL_PATH "${QT_PLUGINS_DIR}/iconengines")
|
||||
endif()
|
||||
|
||||
message(STATUS "XdgIconEnginePlugin will be installed into: ${QTXDGX_ICONENGINEPLUGIN_INSTALL_PATH}")
|
||||
|
||||
install(TARGETS
|
||||
"${QTXDGX_ICONENGINEPLUGIN_LIBRARY_NAME}" DESTINATION "${QTXDGX_ICONENGINEPLUGIN_INSTALL_PATH}"
|
||||
COMPONENT Runtime
|
||||
)
|
||||
|
35
xdgiconloader/plugin/xdgiconengineplugin.cpp
Normal file
35
xdgiconloader/plugin/xdgiconengineplugin.cpp
Normal file
@ -0,0 +1,35 @@
|
||||
/* BEGIN_COMMON_COPYRIGHT_HEADER
|
||||
* (c)LGPL2+
|
||||
*
|
||||
* LXQt - a lightweight Qt based desktop
|
||||
* http://lxqt.org
|
||||
*
|
||||
* Copyright: 2017 LXQt team
|
||||
* Authors:
|
||||
* Palo Kisa <palo.kisa@gmail.com>
|
||||
*
|
||||
* This program or library is free software; you can redistribute it
|
||||
* and/or modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Lesser General
|
||||
* Public License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
* END_COMMON_COPYRIGHT_HEADER */
|
||||
|
||||
#include "xdgiconengineplugin.h"
|
||||
#include "../xdgiconloader_p.h"
|
||||
|
||||
QIconEngine * XdgIconEnginePlugin::create(const QString & filename/* = QString{}*/)
|
||||
{
|
||||
return new XdgIconLoaderEngine{filename};
|
||||
}
|
||||
|
38
xdgiconloader/plugin/xdgiconengineplugin.h
Normal file
38
xdgiconloader/plugin/xdgiconengineplugin.h
Normal file
@ -0,0 +1,38 @@
|
||||
/* BEGIN_COMMON_COPYRIGHT_HEADER
|
||||
* (c)LGPL2+
|
||||
*
|
||||
* LXQt - a lightweight Qt based desktop
|
||||
* http://lxqt.org
|
||||
*
|
||||
* Copyright: 2017 LXQt team
|
||||
* Authors:
|
||||
* Palo Kisa <palo.kisa@gmail.com>
|
||||
*
|
||||
* This program or library is free software; you can redistribute it
|
||||
* and/or modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Lesser General
|
||||
* Public License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
* END_COMMON_COPYRIGHT_HEADER */
|
||||
|
||||
#include <QIconEnginePlugin>
|
||||
|
||||
class XdgIconEnginePlugin : public QIconEnginePlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QIconEngineFactoryInterface" FILE "xdgiconengineplugin.json")
|
||||
public:
|
||||
using QIconEnginePlugin::QIconEnginePlugin;
|
||||
virtual QIconEngine * create(const QString & filename = QString{}) override;
|
||||
};
|
||||
|
1
xdgiconloader/plugin/xdgiconengineplugin.json
Normal file
1
xdgiconloader/plugin/xdgiconengineplugin.json
Normal file
@ -0,0 +1 @@
|
||||
{"Keys": ["XdgIconLoaderEngine"]}
|
@ -45,6 +45,8 @@
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QSettings>
|
||||
#include <QtGui/QPainter>
|
||||
#include <QImageReader>
|
||||
#include <QXmlStreamReader>
|
||||
|
||||
#ifdef Q_DEAD_CODE_FROM_QT4_MAC
|
||||
#include <private/qt_cocoa_helpers_mac_p.h>
|
||||
@ -62,104 +64,36 @@ static QString fallbackTheme()
|
||||
{
|
||||
if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) {
|
||||
const QVariant themeHint = theme->themeHint(QPlatformTheme::SystemIconFallbackThemeName);
|
||||
if (themeHint.isValid())
|
||||
return themeHint.toString();
|
||||
if (themeHint.isValid()) {
|
||||
const QString theme = themeHint.toString();
|
||||
if (theme != QLatin1String("hicolor"))
|
||||
return theme;
|
||||
}
|
||||
}
|
||||
return QLatin1String("hicolor");
|
||||
return QString();
|
||||
}
|
||||
|
||||
XdgIconLoader::XdgIconLoader() :
|
||||
m_themeKey(1), m_supportsSvg(false), m_initialized(false)
|
||||
{
|
||||
}
|
||||
|
||||
static inline QString systemThemeName()
|
||||
{
|
||||
if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) {
|
||||
const QVariant themeHint = theme->themeHint(QPlatformTheme::SystemIconThemeName);
|
||||
if (themeHint.isValid())
|
||||
return themeHint.toString();
|
||||
}
|
||||
return QIcon::themeName();
|
||||
}
|
||||
|
||||
static inline QStringList systemIconSearchPaths()
|
||||
{
|
||||
if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) {
|
||||
const QVariant themeHint = theme->themeHint(QPlatformTheme::IconThemeSearchPaths);
|
||||
if (themeHint.isValid())
|
||||
return themeHint.toStringList();
|
||||
}
|
||||
return QIcon::themeSearchPaths();
|
||||
}
|
||||
|
||||
#ifndef QT_NO_LIBRARY
|
||||
//extern QFactoryLoader *qt_iconEngineFactoryLoader(); // qicon.cpp
|
||||
#endif
|
||||
|
||||
void XdgIconLoader::ensureInitialized()
|
||||
{
|
||||
if (!m_initialized) {
|
||||
m_initialized = true;
|
||||
|
||||
Q_ASSERT(qApp);
|
||||
|
||||
m_systemTheme = systemThemeName();
|
||||
|
||||
if (m_systemTheme.isEmpty())
|
||||
m_systemTheme = fallbackTheme();
|
||||
#ifndef QT_NO_LIBRARY
|
||||
// if (qt_iconEngineFactoryLoader()->keyMap().key(QLatin1String("svg"), -1) != -1)
|
||||
m_supportsSvg = true;
|
||||
#ifdef QT_NO_LIBRARY
|
||||
static bool gSupportsSvg = false;
|
||||
#else
|
||||
static bool gSupportsSvg = true;
|
||||
#endif //QT_NO_LIBRARY
|
||||
|
||||
void XdgIconLoader::setFollowColorScheme(bool enable)
|
||||
{
|
||||
if (m_followColorScheme != enable)
|
||||
{
|
||||
QIconLoader::instance()->invalidateKey();
|
||||
m_followColorScheme = enable;
|
||||
}
|
||||
}
|
||||
|
||||
XdgIconLoader *XdgIconLoader::instance()
|
||||
{
|
||||
iconLoaderInstance()->ensureInitialized();
|
||||
QIconLoader::instance()->ensureInitialized();
|
||||
return iconLoaderInstance();
|
||||
}
|
||||
|
||||
// Queries the system theme and invalidates existing
|
||||
// icons if the theme has changed.
|
||||
void XdgIconLoader::updateSystemTheme()
|
||||
{
|
||||
// Only change if this is not explicitly set by the user
|
||||
if (m_userTheme.isEmpty()) {
|
||||
QString theme = systemThemeName();
|
||||
if (theme.isEmpty())
|
||||
theme = fallbackTheme();
|
||||
if (theme != m_systemTheme) {
|
||||
m_systemTheme = theme;
|
||||
invalidateKey();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void XdgIconLoader::setThemeName(const QString &themeName)
|
||||
{
|
||||
m_userTheme = themeName;
|
||||
invalidateKey();
|
||||
}
|
||||
|
||||
void XdgIconLoader::setThemeSearchPath(const QStringList &searchPaths)
|
||||
{
|
||||
m_iconDirs = searchPaths;
|
||||
themeList.clear();
|
||||
invalidateKey();
|
||||
}
|
||||
|
||||
QStringList XdgIconLoader::themeSearchPaths() const
|
||||
{
|
||||
if (m_iconDirs.isEmpty()) {
|
||||
m_iconDirs = systemIconSearchPaths();
|
||||
// Always add resource directory as search path
|
||||
m_iconDirs.append(QLatin1String(":/icons"));
|
||||
}
|
||||
return m_iconDirs;
|
||||
}
|
||||
|
||||
/*!
|
||||
\class QIconCacheGtkReader
|
||||
\internal
|
||||
@ -172,7 +106,7 @@ class QIconCacheGtkReader
|
||||
{
|
||||
public:
|
||||
explicit QIconCacheGtkReader(const QString &themeDir);
|
||||
QVector<const char *> lookup(const QString &);
|
||||
QVector<const char *> lookup(const QStringRef &);
|
||||
bool isValid() const { return m_isValid; }
|
||||
private:
|
||||
QFile m_file;
|
||||
@ -203,7 +137,7 @@ private:
|
||||
QIconCacheGtkReader::QIconCacheGtkReader(const QString &dirName)
|
||||
: m_isValid(false)
|
||||
{
|
||||
QFileInfo info(dirName + QLatin1Literal("/icon-theme.cache"));
|
||||
QFileInfo info(dirName + QLatin1String("/icon-theme.cache"));
|
||||
if (!info.exists() || info.lastModified() < QFileInfo(dirName).lastModified())
|
||||
return;
|
||||
m_file.setFileName(info.absoluteFilePath());
|
||||
@ -245,7 +179,7 @@ static quint32 icon_name_hash(const char *p)
|
||||
with this name is present. The char* are pointers to the mapped data.
|
||||
For example, this would return { "32x32/apps", "24x24/apps" , ... }
|
||||
*/
|
||||
QVector<const char *> QIconCacheGtkReader::lookup(const QString &name)
|
||||
QVector<const char *> QIconCacheGtkReader::lookup(const QStringRef &name)
|
||||
{
|
||||
QVector<const char *> ret;
|
||||
if (!isValid())
|
||||
@ -295,12 +229,13 @@ QVector<const char *> QIconCacheGtkReader::lookup(const QString &name)
|
||||
return ret;
|
||||
}
|
||||
|
||||
QIconTheme::QIconTheme(const QString &themeName)
|
||||
XdgIconTheme::XdgIconTheme(const QString &themeName)
|
||||
: m_valid(false)
|
||||
, m_followsColorScheme(false)
|
||||
{
|
||||
QFile themeIndex;
|
||||
|
||||
QStringList iconDirs = QIcon::themeSearchPaths();
|
||||
const QStringList iconDirs = QIcon::themeSearchPaths();
|
||||
for ( int i = 0 ; i < iconDirs.size() ; ++i) {
|
||||
QDir iconDir(iconDirs[i]);
|
||||
QString themeDir = iconDir.path() + QLatin1Char('/') + themeName;
|
||||
@ -320,27 +255,26 @@ QIconTheme::QIconTheme(const QString &themeName)
|
||||
#ifndef QT_NO_SETTINGS
|
||||
if (themeIndex.exists()) {
|
||||
const QSettings indexReader(themeIndex.fileName(), QSettings::IniFormat);
|
||||
QStringListIterator keyIterator(indexReader.allKeys());
|
||||
while (keyIterator.hasNext()) {
|
||||
|
||||
const QString key = keyIterator.next();
|
||||
m_followsColorScheme = indexReader.value(QStringLiteral("Icon Theme/FollowsColorScheme"), false).toBool();
|
||||
const QStringList keys = indexReader.allKeys();
|
||||
for (auto const &key : keys) {
|
||||
if (key.endsWith(QLatin1String("/Size"))) {
|
||||
// Note the QSettings ini-format does not accept
|
||||
// slashes in key names, hence we have to cheat
|
||||
if (int size = indexReader.value(key).toInt()) {
|
||||
QString directoryKey = key.left(key.size() - 5);
|
||||
XdgIconDirInfo dirInfo(directoryKey);
|
||||
QIconDirInfo dirInfo(directoryKey);
|
||||
dirInfo.size = size;
|
||||
QString type = indexReader.value(directoryKey +
|
||||
QLatin1String("/Type")
|
||||
).toString();
|
||||
|
||||
if (type == QLatin1String("Fixed"))
|
||||
dirInfo.type = XdgIconDirInfo::Fixed;
|
||||
dirInfo.type = QIconDirInfo::Fixed;
|
||||
else if (type == QLatin1String("Scalable"))
|
||||
dirInfo.type = XdgIconDirInfo::Scalable;
|
||||
dirInfo.type = QIconDirInfo::Scalable;
|
||||
else
|
||||
dirInfo.type = XdgIconDirInfo::Threshold;
|
||||
dirInfo.type = QIconDirInfo::Threshold;
|
||||
|
||||
dirInfo.threshold = indexReader.value(directoryKey +
|
||||
QLatin1String("/Threshold"),
|
||||
@ -362,6 +296,7 @@ QIconTheme::QIconTheme(const QString &themeName)
|
||||
m_parents = indexReader.value(
|
||||
QLatin1String("Icon Theme/Inherits")).toStringList();
|
||||
m_parents.removeAll(QString());
|
||||
m_parents.removeAll(QLatin1String("hicolor"));
|
||||
|
||||
// Ensure a default platform fallback for all themes
|
||||
if (m_parents.isEmpty()) {
|
||||
@ -369,33 +304,51 @@ QIconTheme::QIconTheme(const QString &themeName)
|
||||
if (!fallback.isEmpty())
|
||||
m_parents.append(fallback);
|
||||
}
|
||||
|
||||
// Ensure that all themes fall back to hicolor
|
||||
if (!m_parents.contains(QLatin1String("hicolor")))
|
||||
m_parents.append(QLatin1String("hicolor"));
|
||||
}
|
||||
#endif //QT_NO_SETTINGS
|
||||
}
|
||||
|
||||
/* WARNING:
|
||||
*
|
||||
* https://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html
|
||||
*
|
||||
* <cite>
|
||||
* The dash “-” character is used to separate levels of specificity in icon
|
||||
* names, for all contexts other than MimeTypes. For instance, we use
|
||||
* “input-mouse” as the generic item for all mouse devices, and we use
|
||||
* “input-mouse-usb” for a USB mouse device. However, if the more specific
|
||||
* item does not exist in the current theme, and does exist in a parent
|
||||
* theme, the generic icon from the current theme is preferred, in order
|
||||
* to keep consistent style.
|
||||
* </cite>
|
||||
*
|
||||
* But we believe, that using the more specific icon (even from parents)
|
||||
* is better for user experience. So we are violating the standard
|
||||
* intentionally.
|
||||
*
|
||||
* Ref.
|
||||
* https://github.com/lxde/lxqt/issues/1252
|
||||
* https://github.com/lxde/libqtxdg/pull/116
|
||||
*/
|
||||
QThemeIconInfo XdgIconLoader::findIconHelper(const QString &themeName,
|
||||
const QString &iconName,
|
||||
QStringList &visited) const
|
||||
QStringList &visited,
|
||||
bool dashFallback) const
|
||||
{
|
||||
QThemeIconInfo info;
|
||||
Q_ASSERT(!themeName.isEmpty());
|
||||
|
||||
QPixmap pixmap;
|
||||
|
||||
// Used to protect against potential recursions
|
||||
visited << themeName;
|
||||
|
||||
QIconTheme theme = themeList.value(themeName);
|
||||
XdgIconTheme &theme = themeList[themeName];
|
||||
if (!theme.isValid()) {
|
||||
theme = QIconTheme(themeName);
|
||||
if (!theme.isValid())
|
||||
theme = QIconTheme(fallbackTheme());
|
||||
|
||||
themeList.insert(themeName, theme);
|
||||
theme = XdgIconTheme(themeName);
|
||||
if (!theme.isValid()) {
|
||||
const QString fallback = fallbackTheme();
|
||||
if (!fallback.isEmpty())
|
||||
theme = XdgIconTheme(fallback);
|
||||
}
|
||||
}
|
||||
|
||||
const QStringList contentDirs = theme.contentDirs();
|
||||
@ -405,7 +358,7 @@ QThemeIconInfo XdgIconLoader::findIconHelper(const QString &themeName,
|
||||
const QString xpmext(QLatin1String(".xpm"));
|
||||
|
||||
|
||||
QString iconNameFallback = iconName;
|
||||
QStringRef iconNameFallback(&iconName);
|
||||
|
||||
// Iterate through all icon's fallbacks in current theme
|
||||
while (info.entries.isEmpty()) {
|
||||
@ -415,21 +368,21 @@ QThemeIconInfo XdgIconLoader::findIconHelper(const QString &themeName,
|
||||
|
||||
// Add all relevant files
|
||||
for (int i = 0; i < contentDirs.size(); ++i) {
|
||||
QVector<XdgIconDirInfo> subDirs = theme.keyList();
|
||||
QVector<QIconDirInfo> subDirs = theme.keyList();
|
||||
|
||||
// Try to reduce the amount of subDirs by looking in the GTK+ cache in order to save
|
||||
// a massive amount of file stat (especially if the icon is not there)
|
||||
auto cache = theme.m_gtkCaches.at(i);
|
||||
if (cache->isValid()) {
|
||||
auto result = cache->lookup(iconNameFallback);
|
||||
const auto result = cache->lookup(iconNameFallback);
|
||||
if (cache->isValid()) {
|
||||
const QVector<XdgIconDirInfo> subDirsCopy = subDirs;
|
||||
const QVector<QIconDirInfo> subDirsCopy = subDirs;
|
||||
subDirs.clear();
|
||||
subDirs.reserve(result.count());
|
||||
foreach (const char *s, result) {
|
||||
for (const char *s : result) {
|
||||
QString path = QString::fromUtf8(s);
|
||||
auto it = std::find_if(subDirsCopy.cbegin(), subDirsCopy.cend(),
|
||||
[&](const XdgIconDirInfo &info) {
|
||||
[&](const QIconDirInfo &info) {
|
||||
return info.path == path; } );
|
||||
if (it != subDirsCopy.cend()) {
|
||||
subDirs.append(*it);
|
||||
@ -440,45 +393,41 @@ QThemeIconInfo XdgIconLoader::findIconHelper(const QString &themeName,
|
||||
|
||||
QString contentDir = contentDirs.at(i) + QLatin1Char('/');
|
||||
for (int j = 0; j < subDirs.size() ; ++j) {
|
||||
const XdgIconDirInfo &dirInfo = subDirs.at(j);
|
||||
QString subdir = dirInfo.path;
|
||||
QDir currentDir(contentDir + subdir);
|
||||
if (currentDir.exists(pngIconName)) {
|
||||
const QIconDirInfo &dirInfo = subDirs.at(j);
|
||||
const QString subDir = contentDir + dirInfo.path + QLatin1Char('/');
|
||||
const QString pngPath = subDir + pngIconName;
|
||||
if (QFile::exists(pngPath)) {
|
||||
PixmapEntry *iconEntry = new PixmapEntry;
|
||||
iconEntry->dir = dirInfo;
|
||||
iconEntry->filename = currentDir.filePath(pngIconName);
|
||||
iconEntry->filename = pngPath;
|
||||
// Notice we ensure that pixmap entries always come before
|
||||
// scalable to preserve search order afterwards
|
||||
info.entries.prepend(iconEntry);
|
||||
} else if (m_supportsSvg &&
|
||||
currentDir.exists(svgIconName)) {
|
||||
ScalableEntry *iconEntry = new ScalableEntry;
|
||||
iconEntry->dir = dirInfo;
|
||||
iconEntry->filename = currentDir.filePath(svgIconName);
|
||||
info.entries.append(iconEntry);
|
||||
} else if(currentDir.exists(iconName + xpmext)) {
|
||||
} else {
|
||||
const QString svgPath = subDir + svgIconName;
|
||||
if (gSupportsSvg && QFile::exists(svgPath)) {
|
||||
ScalableEntry *iconEntry = (followColorScheme() && theme.followsColorScheme()) ? new ScalableFollowsColorEntry : new ScalableEntry;
|
||||
iconEntry->dir = dirInfo;
|
||||
iconEntry->filename = svgPath;
|
||||
info.entries.append(iconEntry);
|
||||
}
|
||||
}
|
||||
const QString xpmPath = subDir + xpmIconName;
|
||||
if (QFile::exists(xpmPath)) {
|
||||
PixmapEntry *iconEntry = new PixmapEntry;
|
||||
iconEntry->dir = dirInfo;
|
||||
iconEntry->filename = currentDir.filePath(iconName + xpmext);
|
||||
iconEntry->filename = xpmPath;
|
||||
// Notice we ensure that pixmap entries always come before
|
||||
// scalable to preserve search order afterwards
|
||||
info.entries.append(iconEntry);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!info.entries.isEmpty()) {
|
||||
info.iconName = iconNameFallback;
|
||||
break;
|
||||
}
|
||||
if (!info.entries.isEmpty())
|
||||
info.iconName = iconNameFallback.toString();
|
||||
|
||||
// If it's possible - find next fallback for the icon
|
||||
const int indexOfDash = iconNameFallback.lastIndexOf(QLatin1Char('-'));
|
||||
if (indexOfDash == -1)
|
||||
break;
|
||||
|
||||
iconNameFallback.truncate(indexOfDash);
|
||||
break;
|
||||
}
|
||||
|
||||
if (info.entries.isEmpty()) {
|
||||
@ -496,83 +445,80 @@ QThemeIconInfo XdgIconLoader::findIconHelper(const QString &themeName,
|
||||
}
|
||||
}
|
||||
|
||||
if (info.entries.isEmpty()) {
|
||||
// Search for unthemed icons in main dir of search paths
|
||||
QStringList themeSearchPaths = QIcon::themeSearchPaths();
|
||||
foreach (QString contentDir, themeSearchPaths) {
|
||||
QDir currentDir(contentDir);
|
||||
|
||||
if (currentDir.exists(iconName + pngext)) {
|
||||
PixmapEntry *iconEntry = new PixmapEntry;
|
||||
iconEntry->filename = currentDir.filePath(iconName + pngext);
|
||||
// Notice we ensure that pixmap entries always come before
|
||||
// scalable to preserve search order afterwards
|
||||
info.entries.prepend(iconEntry);
|
||||
} else if (m_supportsSvg &&
|
||||
currentDir.exists(iconName + svgext)) {
|
||||
ScalableEntry *iconEntry = new ScalableEntry;
|
||||
iconEntry->filename = currentDir.filePath(iconName + svgext);
|
||||
info.entries.append(iconEntry);
|
||||
break;
|
||||
} else if (currentDir.exists(iconName + xpmext)) {
|
||||
PixmapEntry *iconEntry = new PixmapEntry;
|
||||
iconEntry->filename = currentDir.filePath(iconName + xpmext);
|
||||
// Notice we ensure that pixmap entries always come before
|
||||
// scalable to preserve search order afterwards
|
||||
info.entries.append(iconEntry);
|
||||
break;
|
||||
}
|
||||
if (dashFallback && info.entries.isEmpty()) {
|
||||
// If it's possible - find next fallback for the icon
|
||||
const int indexOfDash = iconNameFallback.lastIndexOf(QLatin1Char('-'));
|
||||
if (indexOfDash != -1) {
|
||||
iconNameFallback.truncate(indexOfDash);
|
||||
QStringList _visited;
|
||||
info = findIconHelper(themeName, iconNameFallback.toString(), _visited, true);
|
||||
}
|
||||
}
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
Author: Kaitlin Rupert <kaitlin.rupert@intel.com>
|
||||
Date: Aug 12, 2010
|
||||
Description: Make it so that the QIcon loader honors /usr/share/pixmaps
|
||||
directory. This is a valid directory per the Freedesktop.org
|
||||
icon theme specification.
|
||||
Bug: https://bugreports.qt.nokia.com/browse/QTBUG-12874
|
||||
*********************************************************************/
|
||||
#ifdef Q_OS_LINUX
|
||||
/* Freedesktop standard says to look in /usr/share/pixmaps last */
|
||||
if (info.entries.isEmpty()) {
|
||||
const QString pixmaps(QLatin1String("/usr/share/pixmaps"));
|
||||
QThemeIconInfo XdgIconLoader::unthemedFallback(const QString &iconName, const QStringList &searchPaths) const
|
||||
{
|
||||
QThemeIconInfo info;
|
||||
|
||||
const QString svgext(QLatin1String(".svg"));
|
||||
const QString pngext(QLatin1String(".png"));
|
||||
const QString xpmext(QLatin1String(".xpm"));
|
||||
|
||||
for (const auto &contentDir : searchPaths) {
|
||||
QDir currentDir(contentDir);
|
||||
|
||||
const QDir currentDir(pixmaps);
|
||||
const XdgIconDirInfo dirInfo(pixmaps);
|
||||
if (currentDir.exists(iconName + pngext)) {
|
||||
PixmapEntry *iconEntry = new PixmapEntry;
|
||||
iconEntry->dir = dirInfo;
|
||||
iconEntry->filename = currentDir.filePath(iconName + pngext);
|
||||
// Notice we ensure that pixmap entries always come before
|
||||
// scalable to preserve search order afterwards
|
||||
info.entries.prepend(iconEntry);
|
||||
} else if (m_supportsSvg &&
|
||||
currentDir.exists(iconName + svgext)) {
|
||||
} else if (gSupportsSvg &&
|
||||
currentDir.exists(iconName + svgext)) {
|
||||
ScalableEntry *iconEntry = new ScalableEntry;
|
||||
iconEntry->dir = dirInfo;
|
||||
iconEntry->filename = currentDir.filePath(iconName + svgext);
|
||||
info.entries.append(iconEntry);
|
||||
} else if (currentDir.exists(iconName + xpmext)) {
|
||||
PixmapEntry *iconEntry = new PixmapEntry;
|
||||
iconEntry->dir = dirInfo;
|
||||
iconEntry->filename = currentDir.filePath(iconName + xpmext);
|
||||
// Notice we ensure that pixmap entries always come before
|
||||
// scalable to preserve search order afterwards
|
||||
info.entries.append(iconEntry);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
QThemeIconInfo XdgIconLoader::loadIcon(const QString &name) const
|
||||
{
|
||||
if (!themeName().isEmpty()) {
|
||||
const QString theme_name = QIconLoader::instance()->themeName();
|
||||
if (!theme_name.isEmpty()) {
|
||||
QStringList visited;
|
||||
return findIconHelper(themeName(), name, visited);
|
||||
auto info = findIconHelper(theme_name, name, visited, true);
|
||||
if (info.entries.isEmpty()) {
|
||||
const auto hicolorInfo = findIconHelper(QLatin1String("hicolor"), name, visited, true);
|
||||
if (hicolorInfo.entries.isEmpty()) {
|
||||
const auto unthemedInfo = unthemedFallback(name, QIcon::themeSearchPaths());
|
||||
if (unthemedInfo.entries.isEmpty()) {
|
||||
/* Freedesktop standard says to look in /usr/share/pixmaps last */
|
||||
const QStringList pixmapPath = (QStringList() << QString::fromLatin1("/usr/share/pixmaps"));
|
||||
const auto pixmapInfo = unthemedFallback(name, pixmapPath);
|
||||
if (pixmapInfo.entries.isEmpty()) {
|
||||
return QThemeIconInfo();
|
||||
} else {
|
||||
return pixmapInfo;
|
||||
}
|
||||
} else {
|
||||
return unthemedInfo;
|
||||
}
|
||||
} else {
|
||||
return hicolorInfo;
|
||||
}
|
||||
} else {
|
||||
return info;
|
||||
}
|
||||
}
|
||||
|
||||
return QThemeIconInfo();
|
||||
@ -623,14 +569,14 @@ bool XdgIconLoaderEngine::hasIcon() const
|
||||
// Lazily load the icon
|
||||
void XdgIconLoaderEngine::ensureLoaded()
|
||||
{
|
||||
if (!(XdgIconLoader::instance()->themeKey() == m_key)) {
|
||||
if (!(QIconLoader::instance()->themeKey() == m_key)) {
|
||||
qDeleteAll(m_info.entries);
|
||||
m_info.entries.clear();
|
||||
m_info.iconName.clear();
|
||||
|
||||
Q_ASSERT(m_info.entries.size() == 0);
|
||||
m_info = XdgIconLoader::instance()->loadIcon(m_iconName);
|
||||
m_key = XdgIconLoader::instance()->themeKey();
|
||||
m_key = QIconLoader::instance()->themeKey();
|
||||
}
|
||||
}
|
||||
|
||||
@ -648,16 +594,16 @@ void XdgIconLoaderEngine::paint(QPainter *painter, const QRect &rect,
|
||||
* This algorithm is defined by the freedesktop spec:
|
||||
* http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html
|
||||
*/
|
||||
static bool directoryMatchesSize(const XdgIconDirInfo &dir, int iconsize)
|
||||
static bool directoryMatchesSize(const QIconDirInfo &dir, int iconsize)
|
||||
{
|
||||
if (dir.type == XdgIconDirInfo::Fixed) {
|
||||
if (dir.type == QIconDirInfo::Fixed) {
|
||||
return dir.size == iconsize;
|
||||
|
||||
} else if (dir.type == XdgIconDirInfo::Scalable) {
|
||||
} else if (dir.type == QIconDirInfo::Scalable) {
|
||||
return iconsize <= dir.maxSize &&
|
||||
iconsize >= dir.minSize;
|
||||
|
||||
} else if (dir.type == XdgIconDirInfo::Threshold) {
|
||||
} else if (dir.type == QIconDirInfo::Threshold) {
|
||||
return iconsize >= dir.size - dir.threshold &&
|
||||
iconsize <= dir.size + dir.threshold;
|
||||
}
|
||||
@ -670,12 +616,12 @@ static bool directoryMatchesSize(const XdgIconDirInfo &dir, int iconsize)
|
||||
* This algorithm is defined by the freedesktop spec:
|
||||
* http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html
|
||||
*/
|
||||
static int directorySizeDistance(const XdgIconDirInfo &dir, int iconsize)
|
||||
static int directorySizeDistance(const QIconDirInfo &dir, int iconsize)
|
||||
{
|
||||
if (dir.type == XdgIconDirInfo::Fixed) {
|
||||
if (dir.type == QIconDirInfo::Fixed) {
|
||||
return qAbs(dir.size - iconsize);
|
||||
|
||||
} else if (dir.type == XdgIconDirInfo::Scalable) {
|
||||
} else if (dir.type == QIconDirInfo::Scalable) {
|
||||
if (iconsize < dir.minSize)
|
||||
return dir.minSize - iconsize;
|
||||
else if (iconsize > dir.maxSize)
|
||||
@ -683,7 +629,7 @@ static int directorySizeDistance(const XdgIconDirInfo &dir, int iconsize)
|
||||
else
|
||||
return 0;
|
||||
|
||||
} else if (dir.type == XdgIconDirInfo::Threshold) {
|
||||
} else if (dir.type == QIconDirInfo::Threshold) {
|
||||
if (iconsize < dir.size - dir.threshold)
|
||||
return dir.minSize - iconsize;
|
||||
else if (iconsize > dir.size + dir.threshold)
|
||||
@ -695,7 +641,7 @@ static int directorySizeDistance(const XdgIconDirInfo &dir, int iconsize)
|
||||
return INT_MAX;
|
||||
}
|
||||
|
||||
XdgIconLoaderEngineEntry *XdgIconLoaderEngine::entryForSize(const QSize &size)
|
||||
QIconLoaderEngineEntry *XdgIconLoaderEngine::entryForSize(const QSize &size)
|
||||
{
|
||||
int iconsize = qMin(size.width(), size.height());
|
||||
|
||||
@ -706,7 +652,7 @@ XdgIconLoaderEngineEntry *XdgIconLoaderEngine::entryForSize(const QSize &size)
|
||||
|
||||
// Search for exact matches first
|
||||
for (int i = 0; i < numEntries; ++i) {
|
||||
XdgIconLoaderEngineEntry *entry = m_info.entries.at(i);
|
||||
QIconLoaderEngineEntry *entry = m_info.entries.at(i);
|
||||
if (directoryMatchesSize(entry->dir, iconsize)) {
|
||||
return entry;
|
||||
}
|
||||
@ -714,9 +660,9 @@ XdgIconLoaderEngineEntry *XdgIconLoaderEngine::entryForSize(const QSize &size)
|
||||
|
||||
// Find the minimum distance icon
|
||||
int minimalSize = INT_MAX;
|
||||
XdgIconLoaderEngineEntry *closestMatch = 0;
|
||||
QIconLoaderEngineEntry *closestMatch = 0;
|
||||
for (int i = 0; i < numEntries; ++i) {
|
||||
XdgIconLoaderEngineEntry *entry = m_info.entries.at(i);
|
||||
QIconLoaderEngineEntry *entry = m_info.entries.at(i);
|
||||
int distance = directorySizeDistance(entry->dir, iconsize);
|
||||
if (distance < minimalSize) {
|
||||
minimalSize = distance;
|
||||
@ -737,10 +683,10 @@ QSize XdgIconLoaderEngine::actualSize(const QSize &size, QIcon::Mode mode,
|
||||
{
|
||||
ensureLoaded();
|
||||
|
||||
XdgIconLoaderEngineEntry *entry = entryForSize(size);
|
||||
QIconLoaderEngineEntry *entry = entryForSize(size);
|
||||
if (entry) {
|
||||
const XdgIconDirInfo &dir = entry->dir;
|
||||
if (dir.type == XdgIconDirInfo::Scalable || dynamic_cast<ScalableEntry *>(entry))
|
||||
const QIconDirInfo &dir = entry->dir;
|
||||
if (dir.type == QIconDirInfo::Scalable || dynamic_cast<ScalableEntry *>(entry))
|
||||
return size;
|
||||
else {
|
||||
int dir_size = dir.size;
|
||||
@ -756,9 +702,10 @@ QSize XdgIconLoaderEngine::actualSize(const QSize &size, QIcon::Mode mode,
|
||||
return QSize(result, result);
|
||||
}
|
||||
}
|
||||
return QIconEngine::actualSize(size, mode, state);
|
||||
return {0, 0};
|
||||
}
|
||||
|
||||
// XXX: duplicated from qiconloader.cpp, because this symbol isn't exported :(
|
||||
QPixmap PixmapEntry::pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state)
|
||||
{
|
||||
Q_UNUSED(state);
|
||||
@ -794,6 +741,7 @@ QPixmap PixmapEntry::pixmap(const QSize &size, QIcon::Mode mode, QIcon::State st
|
||||
return cachedPixmap;
|
||||
}
|
||||
|
||||
// XXX: duplicated from qiconloader.cpp, because this symbol isn't exported :(
|
||||
QPixmap ScalableEntry::pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state)
|
||||
{
|
||||
if (svgIcon.isNull())
|
||||
@ -803,12 +751,90 @@ QPixmap ScalableEntry::pixmap(const QSize &size, QIcon::Mode mode, QIcon::State
|
||||
return svgIcon.pixmap(size, mode, state);
|
||||
}
|
||||
|
||||
|
||||
// XXX: duplicated from qicon.cpp, because the symbol qt_iconEngineFactoryLoader isn't exported :(
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, qt_iconEngineFactoryLoader,
|
||||
(QIconEngineFactoryInterface_iid, QLatin1String("/iconengines"), Qt::CaseInsensitive))
|
||||
//extern QFactoryLoader *qt_iconEngineFactoryLoader(); // qicon.cpp
|
||||
|
||||
QPixmap ScalableFollowsColorEntry::pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state)
|
||||
{
|
||||
QIcon & icon = QIcon::Selected == mode ? svgSelectedIcon : svgIcon;
|
||||
if (icon.isNull())
|
||||
{
|
||||
// The following lines are adapted and updated from KDE's "kiconloader.cpp" ->
|
||||
// KIconLoaderPrivate::processSvg() and KIconLoaderPrivate::createIconImage().
|
||||
// They read the SVG color scheme of SVG icons and give images based on the icon mode.
|
||||
QByteArray processedContents;
|
||||
QFile device{filename};;
|
||||
if (device.open(QIODevice::ReadOnly))
|
||||
{
|
||||
const QPalette pal = qApp->palette();
|
||||
QString styleSheet = QStringLiteral(".ColorScheme-Text{color:%1;}")
|
||||
.arg(mode == QIcon::Selected
|
||||
? pal.highlightedText().color().name()
|
||||
: pal.windowText().color().name());
|
||||
QXmlStreamReader xmlReader(&device);
|
||||
QXmlStreamWriter writer(&processedContents);
|
||||
while (!xmlReader.atEnd())
|
||||
{
|
||||
if (xmlReader.readNext() == QXmlStreamReader::StartElement
|
||||
&& xmlReader.qualifiedName() == QLatin1String("style")
|
||||
&& xmlReader.attributes().value(QLatin1String("id")) == QLatin1String("current-color-scheme"))
|
||||
{
|
||||
writer.writeStartElement(QLatin1String("style"));
|
||||
writer.writeAttributes(xmlReader.attributes());
|
||||
writer.writeCharacters(styleSheet);
|
||||
writer.writeEndElement();
|
||||
while (xmlReader.tokenType() != QXmlStreamReader::EndElement)
|
||||
xmlReader.readNext();
|
||||
}
|
||||
else if (xmlReader.tokenType() != QXmlStreamReader::Invalid)
|
||||
writer.writeCurrentToken(xmlReader);
|
||||
}
|
||||
}
|
||||
// use the QSvgIconEngine
|
||||
// - assemble the content as it is done by the QSvgIconEngine::write() (operator <<)
|
||||
// - create the QIcon with QSvgIconEngine initialized from the content
|
||||
const int index = qt_iconEngineFactoryLoader()->indexOf(QStringLiteral("svg"));
|
||||
if (index != -1)
|
||||
{
|
||||
if (QIconEnginePlugin * factory = qobject_cast<QIconEnginePlugin*>(qt_iconEngineFactoryLoader()->instance(index)))
|
||||
{
|
||||
if (QIconEngine * engine = factory->create())
|
||||
{
|
||||
QByteArray engine_arr;
|
||||
QDataStream str{&engine_arr, QIODevice::WriteOnly};
|
||||
str.setVersion(QDataStream::Qt_4_4);
|
||||
QHash<int, QString> filenames;
|
||||
filenames[0] = filename;
|
||||
QHash<int, QByteArray> svg_buffers;
|
||||
svg_buffers[0] = processedContents;
|
||||
str << filenames << static_cast<int>(0)/*isCompressed*/ << svg_buffers << static_cast<int>(0)/*hasAddedPimaps*/;
|
||||
|
||||
QDataStream str_read{&engine_arr, QIODevice::ReadOnly};
|
||||
str_read.setVersion(QDataStream::Qt_4_4);
|
||||
|
||||
engine->read(str_read);
|
||||
icon = QIcon{engine};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// load the icon directly from file, if still null
|
||||
if (icon.isNull())
|
||||
icon = QIcon(filename);
|
||||
}
|
||||
|
||||
return icon.pixmap(size, mode, state);
|
||||
}
|
||||
|
||||
QPixmap XdgIconLoaderEngine::pixmap(const QSize &size, QIcon::Mode mode,
|
||||
QIcon::State state)
|
||||
{
|
||||
ensureLoaded();
|
||||
|
||||
XdgIconLoaderEngineEntry *entry = entryForSize(size);
|
||||
QIconLoaderEngineEntry *entry = entryForSize(size);
|
||||
if (entry)
|
||||
return entry->pixmap(size, mode, state);
|
||||
|
||||
|
@ -31,8 +31,8 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QICONLOADER_P_H
|
||||
#define QICONLOADER_P_H
|
||||
#ifndef XDGICONLOADER_P_H
|
||||
#define XDGICONLOADER_P_H
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
|
||||
@ -52,65 +52,19 @@
|
||||
|
||||
#include <QtGui/QIcon>
|
||||
#include <QtGui/QIconEngine>
|
||||
#include <QtGui/QPixmapCache>
|
||||
#include <private/qicon_p.h>
|
||||
#include <private/qfactoryloader_p.h>
|
||||
#include <private/qiconloader_p.h>
|
||||
#include <QtCore/QHash>
|
||||
#include <QtCore/QVector>
|
||||
#include <QtCore/QTypeInfo>
|
||||
|
||||
//QT_BEGIN_NAMESPACE
|
||||
|
||||
class XdgIconLoader;
|
||||
|
||||
struct XdgIconDirInfo
|
||||
{
|
||||
enum Type { Fixed, Scalable, Threshold };
|
||||
XdgIconDirInfo(const QString &_path = QString()) :
|
||||
path(_path),
|
||||
size(0),
|
||||
maxSize(0),
|
||||
minSize(0),
|
||||
threshold(0),
|
||||
type(Threshold) {}
|
||||
QString path;
|
||||
short size;
|
||||
short maxSize;
|
||||
short minSize;
|
||||
short threshold;
|
||||
Type type;
|
||||
};
|
||||
|
||||
class XdgIconLoaderEngineEntry
|
||||
{
|
||||
public:
|
||||
virtual ~XdgIconLoaderEngineEntry() {}
|
||||
virtual QPixmap pixmap(const QSize &size,
|
||||
QIcon::Mode mode,
|
||||
QIcon::State state) = 0;
|
||||
QString filename;
|
||||
XdgIconDirInfo dir;
|
||||
static int count;
|
||||
};
|
||||
|
||||
struct ScalableEntry : public XdgIconLoaderEngineEntry
|
||||
struct ScalableFollowsColorEntry : public ScalableEntry
|
||||
{
|
||||
QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) Q_DECL_OVERRIDE;
|
||||
QIcon svgIcon;
|
||||
};
|
||||
|
||||
struct PixmapEntry : public XdgIconLoaderEngineEntry
|
||||
{
|
||||
QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) Q_DECL_OVERRIDE;
|
||||
QPixmap basePixmap;
|
||||
};
|
||||
|
||||
typedef QList<XdgIconLoaderEngineEntry*> QThemeIconEntries;
|
||||
|
||||
struct QThemeIconInfo
|
||||
{
|
||||
QThemeIconEntries entries;
|
||||
QString iconName;
|
||||
QIcon svgSelectedIcon;
|
||||
};
|
||||
|
||||
//class QIconLoaderEngine : public QIconEngine
|
||||
@ -120,19 +74,19 @@ public:
|
||||
XdgIconLoaderEngine(const QString& iconName = QString());
|
||||
~XdgIconLoaderEngine();
|
||||
|
||||
void paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state);
|
||||
QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state);
|
||||
QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state);
|
||||
QIconEngine *clone() const;
|
||||
bool read(QDataStream &in);
|
||||
bool write(QDataStream &out) const;
|
||||
void paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state) Q_DECL_OVERRIDE;
|
||||
QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) Q_DECL_OVERRIDE;
|
||||
QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state) Q_DECL_OVERRIDE;
|
||||
QIconEngine *clone() const Q_DECL_OVERRIDE;
|
||||
bool read(QDataStream &in) Q_DECL_OVERRIDE;
|
||||
bool write(QDataStream &out) const Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
QString key() const;
|
||||
QString key() const Q_DECL_OVERRIDE;
|
||||
bool hasIcon() const;
|
||||
void ensureLoaded();
|
||||
void virtual_hook(int id, void *data);
|
||||
XdgIconLoaderEngineEntry *entryForSize(const QSize &size);
|
||||
void virtual_hook(int id, void *data) Q_DECL_OVERRIDE;
|
||||
QIconLoaderEngineEntry *entryForSize(const QSize &size);
|
||||
XdgIconLoaderEngine(const XdgIconLoaderEngine &other);
|
||||
QThemeIconInfo m_info;
|
||||
QString m_iconName;
|
||||
@ -143,20 +97,24 @@ private:
|
||||
|
||||
class QIconCacheGtkReader;
|
||||
|
||||
class QIconTheme
|
||||
// Note: We can't simply reuse the QIconTheme from Qt > 5.7 because
|
||||
// the QIconTheme constructor symbol isn't exported.
|
||||
class XdgIconTheme
|
||||
{
|
||||
public:
|
||||
QIconTheme(const QString &name);
|
||||
QIconTheme() : m_valid(false) {}
|
||||
XdgIconTheme(const QString &name);
|
||||
XdgIconTheme() = default;
|
||||
QStringList parents() { return m_parents; }
|
||||
QVector <XdgIconDirInfo> keyList() { return m_keyList; }
|
||||
QVector <QIconDirInfo> keyList() { return m_keyList; }
|
||||
QStringList contentDirs() { return m_contentDirs; }
|
||||
bool isValid() { return m_valid; }
|
||||
bool isValid() const { return m_valid; }
|
||||
bool followsColorScheme() const { return m_followsColorScheme; }
|
||||
private:
|
||||
QStringList m_contentDirs;
|
||||
QVector <XdgIconDirInfo> m_keyList;
|
||||
QVector <QIconDirInfo> m_keyList;
|
||||
QStringList m_parents;
|
||||
bool m_valid;
|
||||
bool m_valid = false;
|
||||
bool m_followsColorScheme = false;
|
||||
public:
|
||||
QVector<QSharedPointer<QIconCacheGtkReader>> m_gtkCaches;
|
||||
};
|
||||
@ -164,43 +122,39 @@ public:
|
||||
class XDGICONLOADER_EXPORT XdgIconLoader
|
||||
{
|
||||
public:
|
||||
XdgIconLoader();
|
||||
QThemeIconInfo loadIcon(const QString &iconName) const;
|
||||
uint themeKey() const { return m_themeKey; }
|
||||
|
||||
QString themeName() const { return m_userTheme.isEmpty() ? m_systemTheme : m_userTheme; }
|
||||
void setThemeName(const QString &themeName);
|
||||
QIconTheme theme() { return themeList.value(themeName()); }
|
||||
void setThemeSearchPath(const QStringList &searchPaths);
|
||||
QStringList themeSearchPaths() const;
|
||||
XdgIconDirInfo dirInfo(int dirindex);
|
||||
/* TODO: deprecate & remove all QIconLoader wrappers */
|
||||
inline uint themeKey() const { return QIconLoader::instance()->themeKey(); }
|
||||
inline QString themeName() const { return QIconLoader::instance()->themeName(); }
|
||||
inline void setThemeName(const QString &themeName) { QIconLoader::instance()->setThemeName(themeName); }
|
||||
inline void setThemeSearchPath(const QStringList &searchPaths) { QIconLoader::instance()->setThemeSearchPath(searchPaths); }
|
||||
inline QIconDirInfo dirInfo(int dirindex) { return QIconLoader::instance()->dirInfo(dirindex); }
|
||||
inline QStringList themeSearchPaths() const { return QIconLoader::instance()->themeSearchPaths(); }
|
||||
inline void updateSystemTheme() { QIconLoader::instance()->updateSystemTheme(); }
|
||||
inline void invalidateKey() { QIconLoader::instance()->invalidateKey(); }
|
||||
inline void ensureInitialized() { QIconLoader::instance()->ensureInitialized(); }
|
||||
inline bool hasUserTheme() const { return QIconLoader::instance()->hasUserTheme(); }
|
||||
/*!
|
||||
* Flag if the "FollowsColorScheme" hint (the KDE extension to XDG
|
||||
* themes) should be honored.
|
||||
*/
|
||||
inline bool followColorScheme() const { return m_followColorScheme; }
|
||||
void setFollowColorScheme(bool enable);
|
||||
|
||||
XdgIconTheme theme() { return themeList.value(QIconLoader::instance()->themeName()); }
|
||||
static XdgIconLoader *instance();
|
||||
void updateSystemTheme();
|
||||
void invalidateKey() { m_themeKey++; }
|
||||
void ensureInitialized();
|
||||
bool hasUserTheme() const { return !m_userTheme.isEmpty(); }
|
||||
|
||||
private:
|
||||
QThemeIconInfo findIconHelper(const QString &themeName,
|
||||
const QString &iconName,
|
||||
QStringList &visited) const;
|
||||
uint m_themeKey;
|
||||
bool m_supportsSvg;
|
||||
bool m_initialized;
|
||||
|
||||
mutable QString m_userTheme;
|
||||
mutable QString m_systemTheme;
|
||||
mutable QStringList m_iconDirs;
|
||||
mutable QHash <QString, QIconTheme> themeList;
|
||||
QStringList &visited,
|
||||
bool dashFallback = false) const;
|
||||
QThemeIconInfo unthemedFallback(const QString &iconName, const QStringList &searchPaths) const;
|
||||
mutable QHash <QString, XdgIconTheme> themeList;
|
||||
bool m_followColorScheme = true;
|
||||
};
|
||||
|
||||
|
||||
// Note: class template specialization of 'QTypeInfo' must occur at
|
||||
// global scope
|
||||
Q_DECLARE_TYPEINFO(XdgIconDirInfo, Q_MOVABLE_TYPE);
|
||||
|
||||
//QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_ICON
|
||||
|
||||
#endif // QICONLOADER_P_H
|
||||
#endif // XDGICONLOADER_P_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user