lxde/libqtxdg.git
12 months agofixup...correct context object for disconnection master
Palo Kisa [Thu, 1 Feb 2018 08:53:36 +0000 (09:53 +0100)] 
fixup...correct context object for disconnection

12 months agofixup...only one watcher object & invalidate key
Palo Kisa [Tue, 30 Jan 2018 10:05:59 +0000 (11:05 +0100)] 
fixup...only one watcher object & invalidate key

12 months agoxdgiconloader: Add GTK cache revalidation
Palo Kisa [Mon, 15 Jan 2018 09:29:47 +0000 (10:29 +0100)] 
xdgiconloader: Add GTK cache revalidation

In case an icon is added and the GTK cache is refreshed the already
running Qt application does not get the information from GTK cache.
That's because the cache file is changed (modified or deleted+newly
created), but the mapped memory used to read the file is not affected.

We will re-map the cache file for such situations to properly use the
cache also after the content change.

13 months agoxdgiconloader: Cache ScalableFollowsColorEntry properly
Palo Kisa [Mon, 8 Jan 2018 09:30:04 +0000 (10:30 +0100)] 
xdgiconloader: Cache ScalableFollowsColorEntry properly

..by using the QSvgIconEngine under the hood.

This was done previously in be58584d0e6c11feaa6929099885ff2a7d882401,
but was reverted by 81e6ffa52ff2ec6d6bcff7e936b6a7fe04c5bbdb (this
completely lacks any caching and does read/process file and generate
image for each pixmap() call).

In this commit we don't create the (private) QSvgIconEngine manually,
but use the operators <<, >> to achieve it. Thus reducing the chance
to break things with future Qt versions (the (de)serialization will
never change for requested QDataStream::Version).

13 months agoPrevent a possible container detach
Luís Pereira [Mon, 8 Jan 2018 18:48:31 +0000 (18:48 +0000)] 
Prevent a possible container detach

Introduced by commit 78b4fe3d.

13 months agoFixed a typo in searching gtk icon cache
Tsu Jan [Thu, 11 Jan 2018 22:00:41 +0000 (01:30 +0330)] 
Fixed a typo in searching gtk icon cache

Fixes https://github.com/lxde/lxqt/issues/1349

13 months agoNormalize signal/slot signatures
Luís Pereira [Mon, 8 Jan 2018 16:25:19 +0000 (16:25 +0000)] 
Normalize signal/slot signatures

QObject::connect() brings a severe performance penalty when not using
normalized signatures. Signal lookup is first attempted with the signature
as-is, and if that fails QMetaObject::normalizedSignature() called.

That means, when using non-normalized signal/slot signatures, you not only
pay for a strcpy(), but also for a doomed-to-fail first lookup attempt.
Sure, connects are usually done during startup, and a profiler won’t show
you, but using non-normalized signatures is hereby firmly put into the
realm of premature pessimisation.

Reference:
https://marcmutz.wordpress.com/effective-qt/prefer-to-use-normalised-signalslot-signatures/

13 months agoFix symbolic SVG icons with Qt5.10
Tsu Jan [Fri, 5 Jan 2018 17:29:38 +0000 (20:59 +0330)] 
Fix symbolic SVG icons with Qt5.10

Fixes https://github.com/lxde/lxqt/issues/1425 by using less private stuff.

13 months agoDon't allow Q_FOREACH to be used
Luís Pereira [Fri, 22 Dec 2017 18:11:28 +0000 (18:11 +0000)] 
Don't allow Q_FOREACH to be used

Enforce the fact that we are Q_FOREACH-free.

14 months agoxdgdesktopfile: Fix typo made in 24c9845
Palo Kisa [Thu, 14 Dec 2017 07:25:19 +0000 (08:25 +0100)] 
xdgdesktopfile: Fix typo made in 24c9845

15 months agoRelease 3.1.0: Update changelog 3.1.0
Alf Gaida [Sat, 21 Oct 2017 18:49:05 +0000 (20:49 +0200)] 
Release 3.1.0: Update changelog

16 months agoMerge pull request #143 from lxde/bump-version-3.1.0
tsujan [Mon, 16 Oct 2017 09:02:25 +0000 (12:32 +0330)] 
Merge pull request #143 from lxde/bump-version-3.1.0

Bump version to 3.1.0

16 months agoBump version to 3.1.0
Alf Gaida [Sun, 15 Oct 2017 19:26:10 +0000 (21:26 +0200)] 
Bump version to 3.1.0

16 months agoxdgdesktopfile: Add API for getting actions info
Palo Kisa [Wed, 11 Oct 2017 10:21:37 +0000 (12:21 +0200)] 
xdgdesktopfile: Add API for getting actions info

16 months agoxdgdesktopfile: Add support for activating actions
Palo Kisa [Wed, 11 Oct 2017 10:07:52 +0000 (12:07 +0200)] 
xdgdesktopfile: Add support for activating actions

16 months agoxdgdesktopfile: Add getting actions
Palo Kisa [Wed, 11 Oct 2017 08:45:17 +0000 (10:45 +0200)] 
xdgdesktopfile: Add getting actions

16 months agoCheck $XDG_CONFIG_HOME and $XDG_CONFIG_DIRS for mimeapps.list first.
i.Dark_Templar [Sat, 30 Sep 2017 15:33:26 +0000 (18:33 +0300)] 
Check $XDG_CONFIG_HOME and $XDG_CONFIG_DIRS for mimeapps.list first.

16 months agoFix reading and writing mimeapps.list file.
i.Dark_Templar [Sat, 30 Sep 2017 17:02:49 +0000 (20:02 +0300)] 
Fix reading and writing mimeapps.list file.

16 months agoDon't export github templates
Alf Gaida [Sun, 24 Sep 2017 16:57:15 +0000 (18:57 +0200)] 
Don't export github templates

16 months agoRelease 3.0.0: Update changelog 3.0.0
Alf Gaida [Fri, 22 Sep 2017 20:58:07 +0000 (22:58 +0200)] 
Release 3.0.0: Update changelog

17 months agoBackport support for Scale directory key according to Icon Theme spec
Luís Pereira [Mon, 7 Aug 2017 15:07:01 +0000 (16:07 +0100)] 
Backport support for Scale directory key according to Icon Theme spec

QIconLoader original commit:
http://code.qt.io/cgit/qt/qtbase.git/commit/src/gui/image?id=f299b565b5904e39a47b6133643448e46810f0ed

Implement support for Scale directory key according to Icon Theme spec

Qt already supports high DPI icons using the “@nx” approach, where the
device pixel ratio that the image was designed for is in the file
name. However, our implementation of the freedekstop.org Icon Theme
specification did not support the Scale directory key:

https://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html#directory_layout

This meant that users creating icons via QIcon::fromTheme() did not
get high DPI support. This patch fixes that.

[ChangeLog][QtGui][QIcon] Implemented support for Scale directory key
according to Icon Theme Spec. Icons created via QIcon::fromTheme()
now have high DPI support by specifying the Scale in the appropriate
entry of the relevant index.theme file.

Task-number: QTBUG-49820
Change-Id: If442fbc551034166d88defe607109de1c6ca1d28
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
18 months agoBump Major to 3
Alf Gaida [Wed, 26 Jul 2017 17:04:42 +0000 (19:04 +0200)] 
Bump Major to 3

18 months agotest: Drop Q_FOREACH
Luís Pereira [Thu, 27 Jul 2017 13:35:57 +0000 (14:35 +0100)] 
test: Drop Q_FOREACH

Qt 5.9 deprecated it. Replaced with C++11 ranged for-loops.
We don't use qAsConst(). It was introduced in Qt 5.7. We don't require
Qt 5.7. qAsConst() replaced with const_cast<const T&>(t).

18 months agoDrop Q_FOREACH
Luís Pereira [Tue, 25 Jul 2017 16:28:10 +0000 (17:28 +0100)] 
Drop Q_FOREACH

Qt 5.9 deprecated it. Replaced with C++11 ranged for-loops.
We don't use qAsConst(). It was introduced in Qt 5.7. We don't require
Qt 5.7. qAsConst() replaced with const_cast<const T&>(t).

19 months agoliblxqt make no sense here
Alf Gaida [Sun, 9 Jul 2017 10:47:20 +0000 (12:47 +0200)] 
liblxqt make no sense here

cmake do

19 months agoCopied issue template
Alf Gaida [Sat, 8 Jul 2017 21:35:22 +0000 (23:35 +0200)] 
Copied issue template

refs lxde/lxqt/issues/1322

19 months agoDrops Qt5Core_VERSION_STRING
Luís Pereira [Mon, 3 Jul 2017 10:37:16 +0000 (11:37 +0100)] 
Drops Qt5Core_VERSION_STRING

Use Qt5Core_VERSION. Qt5Core_VERSION_STRING is a compatibility variable and
it was removed in Qt 5.9 release.

20 months agoAvoid Qt special keywords collision
Luís Pereira [Fri, 9 Jun 2017 14:19:13 +0000 (15:19 +0100)] 
Avoid Qt special keywords collision

Use Q_ macros instead of signals, slots, emit, foreach... to increase
compatibility with other libraries (Boost, GLib, etc).

21 months agoXdgDesktopFile: Stops allocating unneeded QMap::keys()
Luís Pereira [Mon, 15 May 2017 22:35:37 +0000 (23:35 +0100)] 
XdgDesktopFile: Stops allocating unneeded QMap::keys()

We need both the key and the value. So iterate over it with a
QMap::const_iterator.

21 months agoXdgDesktopFile: Stop allocating unneeded QHash:values()
Luís Pereira [Mon, 15 May 2017 22:26:46 +0000 (23:26 +0100)] 
XdgDesktopFile: Stop allocating unneeded QHash:values()

Just iterator over the QHash container.

21 months agoXdgDesktopFile: Improve const-ness
Luís Pereira [Mon, 15 May 2017 21:42:07 +0000 (22:42 +0100)] 
XdgDesktopFile: Improve const-ness

It helps the compiler and can in some cases prevent some container
detachment.

21 months agoxdgiconloader: Reworks the unthemed/pixmap search
Luís Pereira [Mon, 10 Apr 2017 14:58:48 +0000 (15:58 +0100)] 
xdgiconloader: Reworks the unthemed/pixmap search

Search for unthemed icons only after the themed ones
    Unthemed icons should be search only one time, after the hicolor theme.
    We are using QIcon::themeSearchPaths() to provide the list of directories
    and it doesn't depend on the theme.

Puts pixmaps at the end of the search hierarchy
    Their place is after the hicolor theme.
    And they should be searched one time only, after the hicolor theme.

Makes the pixmap fallback available to all operating systems.
Remove the followColorScheme stuff from unthemed/pixamp search.

21 months agoxdgiconloader: Puts the hicolor at the end of the theme hierarchy
Luís Pereira [Fri, 31 Mar 2017 14:29:09 +0000 (15:29 +0100)] 
xdgiconloader: Puts the hicolor at the end of the theme hierarchy

The hicolor theme is the ultimate resort. It should be allowed only at the
end of the fallback hierarchy. We are allowing the hicolor theme to be in
the middle of the theme hierarchy. Schematically:
        X -> hicolor -> Y -> Z -> hicolor
If an icon exists in the hicolor and Y theme the hicolor one, is wrongly
used.

This commit does four things:
    * Stops adding the hicolor theme to each theme as a fallback.
    * Stops adding the hicolor as a parent theme, even if added by the
index.theme Inherits key. The oxygen theme does it.
    * Stops return the hicolor theme in the fallbackTheme().
    * Adds the hicolor theme to the end of the fallback hierarchy list.

21 months agoXdgIcon: Add flag for "FollowsColorScheme" processing
Palo Kisa [Wed, 29 Mar 2017 09:56:48 +0000 (11:56 +0200)] 
XdgIcon: Add flag for "FollowsColorScheme" processing

Allow the user choose if she/he wants the iconengine to use this KDE
extension to XDG themes.

21 months agoxdgiconloader: Honor "FolowsColorScheme" theme hint
Palo Kisa [Tue, 28 Mar 2017 22:59:56 +0000 (00:59 +0200)] 
xdgiconloader: Honor "FolowsColorScheme" theme hint

..and optimize pixmap generation by use of the QSvgIconEngine.

21 months agoxdgiconloader: Support symbolic SVG icons
Tsu Jan [Tue, 28 Mar 2017 10:06:54 +0000 (14:36 +0430)] 
xdgiconloader: Support symbolic SVG icons

Fixes https://github.com/lxde/lxqt/issues/1181.

That means changing their colors so that they always have a high
contrast with their backgrounds. Symbolic icons should have SVG
stylesheets (as the Breeze icons do) and the style engine s
hould support them (as the Breeze and Kvantum styles do).

The code is taken from KDE's `kiconloader.cpp` (see the comments).

Currently Panel and those LXQt apps that use stylesheets will show the
wrong icon color if their stylesheets have a high contrast with the
active Qt style. This issue should be fixed in their codes before this
PR is merged.

21 months agoMore fixes (#131)
Luís Pereira [Sat, 29 Apr 2017 13:19:24 +0000 (14:19 +0100)] 
More fixes (#131)

* Don't use cascading QString::arg()

It creates unneeded temporaries.

* Use static QFileInfo::exists()

The documentation says it's faster:
Note: Using this function is faster than using QFileInfo(file).exists()
for file system access.

* Use QList::constLast()

Get rid of unneeded temporary creation.

21 months agoxdgiconloader: Correct hierarchy of fallbacks (#116)
tsujan [Sat, 29 Apr 2017 13:17:01 +0000 (17:47 +0430)] 
xdgiconloader: Correct hierarchy of fallbacks (#116)

This is my idea of a *practically* correct hierarchy of fallbacks, in
contrast to what XDG specification tells us.

The icon is searched in the theme *and all of its parents*. Then, if it
is not found, the search is done for the first "dash fallback" in the
theme and all of its parents. And so on for the second, third,... "dash
fallbacks".

21 months agoxdgiconloader: Fix XdgIconLoaderEngine::actualSize() (#130)
palinek [Fri, 28 Apr 2017 20:44:51 +0000 (22:44 +0200)] 
xdgiconloader: Fix XdgIconLoaderEngine::actualSize() (#130)

Return an empty size if no suitable entry found to avoid mismatch
with the returned pixmap()'s size (the QIconEngine::actualSize() returns
the originally requested size).

22 months agoUpdate CMakeLists.txt
Alf Gaida [Tue, 11 Apr 2017 19:32:33 +0000 (21:32 +0200)] 
Update CMakeLists.txt

> 2017/04/11 20:06:42 <vc-01>          iconNameFallback.truncate(indexOfDash);
> 2017/04/11 20:06:42 <vc-01> This is because ‘truncate’ is available since Qt 5.6.

22 months agoIt adds loadIcon() timing measurements.
Luís Pereira [Fri, 17 Mar 2017 19:17:49 +0000 (19:17 +0000)] 
It adds loadIcon() timing measurements.

It adds an per icon load time and a Total loadIcon() timing info.

22 months agoxdgiconloader: Consider all existing files/images
Palo Kisa [Tue, 4 Apr 2017 07:15:35 +0000 (09:15 +0200)] 
xdgiconloader: Consider all existing files/images

We can't assume, that the first found scalable entry is the only and
best one and stop searching.

This was an false (over)optimization or a failed merge of upstream Qt
patches.

23 months agoCheck QTXDGX_ICONENGINEPLUGIN_INSTALL_PATH existence
Luís Pereira [Thu, 16 Mar 2017 10:56:00 +0000 (10:56 +0000)] 
Check QTXDGX_ICONENGINEPLUGIN_INSTALL_PATH existence

Not it's logical value. If the user set it on the command line... we should
not "mess" with it.

23 months agoMark QTXDGX_ICONENGINEPLUGIN_INSTALL_PATH as advanced
Luís Pereira [Thu, 16 Mar 2017 10:52:16 +0000 (10:52 +0000)] 
Mark QTXDGX_ICONENGINEPLUGIN_INSTALL_PATH as advanced

It caches it, making it faster on subsequent runs.
An advanced variable will not be displayed in any of the cmake GUIs unless
the show advanced option is on.

23 months agoxdgiconloader: Implement QIconEnginePlugin interface
Palo Kisa [Mon, 13 Mar 2017 21:59:31 +0000 (22:59 +0100)] 
xdgiconloader: Implement QIconEnginePlugin interface

There was no way to serialize-deserialize QIcon to-from QDataStream,
because the `QDataStream &operator>>(QDataStream &s, QIcon &icon)` does
use the QIconEnginePlugin interface to load specific (user-defined)
QIconEngines.

This implements the "factory" to create XdgIconLoaderEngine objects
based on the serialized type/key "XdgIconLoaderEngine" (provided for
serialization by `XdgIconLoaderEngine::key()`).

23 months agoDisables uninstall target
Luís Pereira [Wed, 8 Mar 2017 22:58:21 +0000 (22:58 +0000)] 
Disables uninstall target

It conflicts with the one in qtermwidget when in superbuild mode.

23 months agoRemove last uses of Java-style (non-mutable) iterators from QtBase
Luís Pereira [Mon, 6 Mar 2017 12:30:35 +0000 (12:30 +0000)] 
Remove last uses of Java-style (non-mutable) iterators from QtBase

Change-Id: I7531ffd4f2d5b2193bb6231c743ff0a074618b99
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Backport of:
http://code.qt.io/cgit/qt/qtbase.git/commit/src/gui/image/qiconloader.cpp?id=d08db1100874fdc36ea169d34a8902133186b84b

23 months agoAdds a development qtxdg-iconfinder utility tool
Luís Pereira [Wed, 15 Feb 2017 23:04:05 +0000 (23:04 +0000)] 
Adds a development qtxdg-iconfinder utility tool

Very hand to easily debug icon lookup.
It outputs:
    * The name of the found icon. It may be different from the given on due
      to the fallback mechanisms.
    * The absolute filename of all the found matches.

2 years agoEnable strict iterators for debug builds
Luís Pereira [Wed, 18 Jan 2017 13:48:03 +0000 (13:48 +0000)] 
Enable strict iterators for debug builds

Reference: https://wiki.qt.io/Iterators

By default, it sometimes becomes possible to assign non-const iterators to
const-iterators. Thinking of an iterator as a typedef of some pointer type,
C++ allows assignment of a non-const pointer to a const pointer. To
illustrate:

QMap<QString, QString> map;

/* code compiles and works fine but find() returns the non-const
   QMap::iterator that detaches!
*/
QMap<QString, QString>::const_iterator it = map.find("girish");

2 years agoRemoves extra semi-colons
Luís Pereira [Tue, 10 Jan 2017 11:44:27 +0000 (11:44 +0000)] 
Removes extra semi-colons

Detected by [-Wextra-semi] and [-Wpedantic].

2 years agoImprove build warnings
Luís Pereira [Tue, 10 Jan 2017 11:42:34 +0000 (11:42 +0000)] 
Improve build warnings

Port of the stuff from lxqt-build-tools.

2 years agoMerge branch 'xdgiconloader-maint'
Luís Pereira [Wed, 4 Jan 2017 11:22:41 +0000 (11:22 +0000)] 
Merge branch 'xdgiconloader-maint'

* xdgiconloader-maint:
  QtGui: eradicate Q_FOREACH loops [already const]
  Optimize QIconLoader::findIconHelper()

2 years agoBump year
Alf Gaida [Mon, 2 Jan 2017 19:50:16 +0000 (20:50 +0100)] 
Bump year

2 years agoQtGui: eradicate Q_FOREACH loops [already const]
Luís Pereira [Fri, 23 Dec 2016 11:57:30 +0000 (11:57 +0000)] 
QtGui: eradicate Q_FOREACH loops [already const]

(or trivially marked const) ... by replacing them
with C++11 range-for loops.

Change-Id: I3cce92b9d77a3ff96fad877d1d989145e530646f
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Port of:
https://code.qt.io/cgit/qt/qtbase.git/commit/src/gui/image/qiconloader.cpp?id=d09cfe04b82c1bd0738bca24def1e9c3bfdaaa4b

2 years agoOptimize QIconLoader::findIconHelper()
Luís Pereira [Thu, 22 Dec 2016 19:36:01 +0000 (19:36 +0000)] 
Optimize QIconLoader::findIconHelper()

Profiling QIconLoader::findIconHelper() shows that a significant portion of CPU time is being spent in
QDir::exists(), which creates a new QFileInfo object for the sole purpose of determining whether the passed-in
file path is relative or absolute, and then calls QFile::exists(). In this context, we can just as easily
generate the absolute path and call QFile::exists() directly, avoiding the creation of extra QDir and QFileInfo
objects.

Change-Id: Ib0b4568b6c16d423eb6c1b15158e44ff141e6175
Task-number: QTBUG-46767
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Port of:
https://code.qt.io/cgit/qt/qtbase.git/commit/src/gui/image/qiconloader.cpp?id=36aaf851ff2814e9e5c024e21b866c403137ff26

Note: Didn't port to our enhancements to the icon loader. They are not in
a loop, so the performance improvements are insignificant.

2 years agoMerge pull request #113 from lxde/xdgiconloader-maint
Luís Pereira [Mon, 26 Dec 2016 15:12:54 +0000 (15:12 +0000)] 
Merge pull request #113 from lxde/xdgiconloader-maint

Xdgiconloader maintenance.
Port of upstream qiconloader stuff.

2 years agoRemove unused variable in QIconLoader::findIconHelper()
Luís Pereira [Wed, 21 Dec 2016 17:41:58 +0000 (17:41 +0000)] 
Remove unused variable in QIconLoader::findIconHelper()

Change-Id: Idac0b24631187063445ea5acfd078b2479359d52
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Port of:
https://code.qt.io/cgit/qt/qtbase.git/commit/src/gui/image?id=2265fbe7c12cbb1f98fad8b4bb878d571427000c

2 years agoImprove use of QHash to minimize double hashing
Luís Pereira [Wed, 21 Dec 2016 17:36:50 +0000 (17:36 +0000)] 
Improve use of QHash to minimize double hashing

Avoid looking up by key twice in a row in various locations, but instead
using iterators and index lookup.

Change-Id: I61a079115199ab9c041ad3a26d36b45ee3f775e0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Port of:
https://code.qt.io/cgit/qt/qtbase.git/commit/src/gui/image?id=467b15a20c3d6eb611ea5f6ccffd5fc0df81b0c4

2 years agoQIconLoaderEngine: add missing Q_DECL_OVERRIDEs
Luís Pereira [Wed, 21 Dec 2016 17:20:49 +0000 (17:20 +0000)] 
QIconLoaderEngine: add missing Q_DECL_OVERRIDEs

Change-Id: I7671b05f2e3c218870dca04f3ed52c231dbe4a9d
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Port of:
https://code.qt.io/cgit/qt/qtbase.git/commit/src/gui/image?id=ef416e0faaa83cd122038db397dd24d949c9cafe

2 years agoReplace QLatin1Literal with QLatin1String
Luís Pereira [Wed, 21 Dec 2016 17:07:50 +0000 (17:07 +0000)] 
Replace QLatin1Literal with QLatin1String

QLatin1Literal is just alias of QLatin1String for Qt4 compatibility.
So it's style cleanup patch.

Change-Id: Ia3b3e5dc3169f13a1ef819d69be576b8a8bfb258
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Port of:
https://code.qt.io/cgit/qt/qtbase.git/commit/src/gui/image/qiconloader.cpp?id=6dbb16a856ab98830d8deb1741fc2615add340a5

2 years agoQIconCacheGtkReader: use QStringRef more
Luís Pereira [Wed, 21 Dec 2016 16:55:33 +0000 (16:55 +0000)] 
QIconCacheGtkReader: use QStringRef more

lookup() method now takes QStringRef arg.
Reduce allocations.

Change-Id: I556d01be5c5f268672121ab4c67c652cb6cfe090
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Port of:
https://code.qt.io/cgit/qt/qtbase.git/commit/src/gui/image/qiconloader.cpp?id=d2f6f66a03482a0a694cf164ea11ff3513ab7f68

2 years agoGui: use const (and const APIs) more
Luís Pereira [Wed, 21 Dec 2016 16:23:15 +0000 (16:23 +0000)] 
Gui: use const (and const APIs) more

For CoW types, prefer const methods to avoid needless detach()ing.

Change-Id: I88d08d499e1be72c1f6d983fecdcee513df18aa2
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Port of:
https://code.qt.io/cgit/qt/qtbase.git/commit/src/gui/image/qiconloader.cpp?id=a24b90a21c4f2feb61630ca6a1684312556a6bc7

2 years agoAdds Link Time Optimization
Luís Pereira [Mon, 19 Dec 2016 11:56:23 +0000 (11:56 +0000)] 
Adds Link Time Optimization

It also adds the --no-undefined linker flag.
This is a port of  Hong Jen Yee (PCMan) work on LXQtCompilerSettings.

2 years agoReplaces CMAKE_SOURCE_DIR by PROJECT_SOURCE_DIR
Luís Pereira [Wed, 9 Nov 2016 16:27:11 +0000 (16:27 +0000)] 
Replaces CMAKE_SOURCE_DIR by PROJECT_SOURCE_DIR

Rationale:
CMAKE_SOURCE_DIR is the directory which contains the top-level
    CMakeLists.txt, i.e. the top level source directory.
PROJECT_SOURCE_DIR contains the full path to the root of your project
    source directory, i.e. to the nearest directory where CMakeLists.txt
    contains the PROJECT() command.

When integrating a project into a larger project (superbuild mode)
CMAKE_SOURCE_DIR will contain the path to the top CMakeLists.txt not the
top of your project.

2 years agoRefactors superbuild support
Luís Pereira [Wed, 2 Nov 2016 16:29:09 +0000 (16:29 +0000)] 
Refactors superbuild support

Use CMake policy NEW CMP0024 behavior.
Reference: https://cmake.org/cmake/help/v3.0/policy/CMP0024.html

2 years agoMerge branch 'cmake-maint'
Luís Pereira [Thu, 3 Nov 2016 10:42:30 +0000 (10:42 +0000)] 
Merge branch 'cmake-maint'

* cmake-maint:
  Remove duplicate use of source header files
  Use AUTOMOC everywhere
  Stop using include_directories()
  Removes test project definition
  Use CMAKE_INCLUDE_CURRENT_DIR
  Adds PROJECT_NAME to the build Qt version message
  Simplify target_compile_definitions() and target_include_directories()

2 years agoRemove duplicate use of source header files
Luís Pereira [Tue, 1 Nov 2016 12:06:12 +0000 (12:06 +0000)] 
Remove duplicate use of source header files

2 years agoUse AUTOMOC everywhere
Luís Pereira [Tue, 1 Nov 2016 12:03:40 +0000 (12:03 +0000)] 
Use AUTOMOC everywhere

2 years agoStop using include_directories()
Luís Pereira [Mon, 31 Oct 2016 12:47:57 +0000 (12:47 +0000)] 
Stop using include_directories()

Using target_include_directories().

2 years agoRemoves test project definition
Luís Pereira [Mon, 31 Oct 2016 12:10:38 +0000 (12:10 +0000)] 
Removes test project definition

We don't need it.

2 years agoUse CMAKE_INCLUDE_CURRENT_DIR
Luís Pereira [Sun, 30 Oct 2016 15:17:50 +0000 (15:17 +0000)] 
Use CMAKE_INCLUDE_CURRENT_DIR

2 years agoAdds PROJECT_NAME to the build Qt version message
Luís Pereira [Thu, 27 Oct 2016 18:46:44 +0000 (19:46 +0100)] 
Adds PROJECT_NAME to the build Qt version message

2 years agoSimplify target_compile_definitions() and target_include_directories()
Luís Pereira [Thu, 27 Oct 2016 18:43:12 +0000 (19:43 +0100)] 
Simplify target_compile_definitions() and target_include_directories()

All in one place.

2 years agoqiconloader: Reuse Qt implementation
Palo Kisa [Mon, 10 Oct 2016 11:18:45 +0000 (13:18 +0200)] 
qiconloader: Reuse Qt implementation

1. Use as much of the Qt QIconLoader implementation as possible (do not
just copy-paste all of the logic from Qt sources).
2. Do not store the currently set theme name in XdgIconLoader instance,
but reuse the underlying QIconLoader for it.

With this change there is only one place where the current theme (name,
paths, etc.) is stored => the calls XdgIcon::*themeName and
QIcon::*themeName are interchangable.

TODO: deprecate and/or remove the XdgIcon & XdgIconLoader wrapper
functions (which only call QIcon & QIconLoader functions).

2 years agoXdgIconLoader: Fix FTBFS in super-build/in-tree builds
Luís Pereira [Mon, 17 Oct 2016 17:22:38 +0000 (18:22 +0100)] 
XdgIconLoader: Fix FTBFS in super-build/in-tree builds

We were not copying the XdgIconLoader private installable headers.

2 years agoAllow xdg-user-dirs in the realpath of $HOME.
Jesper Schmitz Mouridsen [Mon, 3 Oct 2016 23:05:47 +0000 (01:05 +0200)] 
Allow xdg-user-dirs in the realpath of $HOME.
On some systems /home is a symlink and $HOME points to the symlink.
This commit allows the xdg-user-dirs to start with the real/canonical path.

2 years agoMerge branch 'required-versions'
Luís Pereira [Tue, 4 Oct 2016 10:10:32 +0000 (11:10 +0100)] 
Merge branch 'required-versions'

* required-versions:
  Updates version requirements in pkg-config (.pc) stuff
  Make Qt5Xdg use only the same version Qt5XdgIconLoader
  Adds minimum Qt version requirement (5.4.2)

2 years agoUpdates version requirements in pkg-config (.pc) stuff
Luís Pereira [Mon, 3 Oct 2016 14:49:54 +0000 (15:49 +0100)] 
Updates version requirements in pkg-config (.pc) stuff

2 years agoMake Qt5Xdg use only the same version Qt5XdgIconLoader
Luís Pereira [Mon, 3 Oct 2016 16:57:35 +0000 (17:57 +0100)] 
Make Qt5Xdg use only the same version Qt5XdgIconLoader

They are part of the same package. They are meant to be used together.

2 years agoAdds minimum Qt version requirement (5.4.2)
Luís Pereira [Fri, 30 Sep 2016 11:07:29 +0000 (12:07 +0100)] 
Adds minimum Qt version requirement (5.4.2)

It also drops the QUIET option. The REQUIRED option will make it be verbose
anyway.
Use a more terse way of expressing the Qt required packages.

2 years agotest: Fixes false positive in tst_xdgdesktopfile::testReadLocalized()
Luís Pereira [Tue, 20 Sep 2016 17:52:39 +0000 (18:52 +0100)] 
test: Fixes false positive in tst_xdgdesktopfile::testReadLocalized()

LC_MESSAGES is the first in the hierarchy. Using LANG can lead to false
positives.

2 years agoRemove cpack (#106)
Alf Gaida [Fri, 30 Sep 2016 15:04:35 +0000 (17:04 +0200)] 
Remove cpack (#106)

* remove "building with cpack" from CMakeLists.txt - not used anymore

* Added very basic .gitattributes
Removed no longer used release script

2 years agoRelease 2.0.0: Add changelog 2.0.0
Alf Gaida [Sat, 17 Sep 2016 12:06:08 +0000 (14:06 +0200)] 
Release 2.0.0: Add changelog

2 years agoBump version to 2.0.0
Alf Gaida [Thu, 8 Sep 2016 16:28:20 +0000 (18:28 +0200)] 
Bump version to 2.0.0

2 years agoExtend README.md
Peter Mattern [Mon, 5 Sep 2016 14:10:03 +0000 (16:10 +0200)] 
Extend README.md

And adjust structure a little bit while at it.

2 years agoUpdates dependencies
Luís Pereira [Thu, 18 Aug 2016 14:44:57 +0000 (15:44 +0100)] 
Updates dependencies

Adds gtk-update-icon-cache to the optional runtime dependencies.

2 years agoMerge branch 'backport'
Luís Pereira [Fri, 5 Aug 2016 18:27:25 +0000 (19:27 +0100)] 
Merge branch 'backport'

* backport:
  QIconLoader: Use the GTK+ icon caches
  QIcon: add a hook in the engine so a non null QIconEngine can still be a null icon
  QIconLoader: don't make QIconDirInfo::type a bit-field
  Do not support static QIcon instances
  Respect manual set icon themes.
  Remove <qhash.h> where it's not used
  Make it more obvious that Q_WS_ is dead code, and should perhaps be ported

2 years agoFixes QIcon::hasThemeIcon() behavior with our Icon Loader Engine
Luís Pereira [Sat, 30 Jul 2016 16:00:23 +0000 (17:00 +0100)] 
Fixes QIcon::hasThemeIcon() behavior with our Icon Loader Engine

It was always returning true.
Closes lxde/libqtxdg#98.
Closes lxde/lxqt#1081.

2 years agoAdds Qt5Svg explicitly to the required packages
Luís Pereira [Mon, 1 Aug 2016 09:53:59 +0000 (10:53 +0100)] 
Adds Qt5Svg explicitly to the required packages

It was an implicit dependency as XdgIconLoader always support svg icons.
Let's make it explicit.

2 years agoQIconLoader: Use the GTK+ icon caches
Luís Pereira [Fri, 29 Jul 2016 17:49:19 +0000 (18:49 +0100)] 
QIconLoader: Use the GTK+ icon caches

Loading icons is quite slow because we need to stat many files in many directories.
That's why gtk adds a cache in the icon theme directory so it avoids stating lots
of files.

The cache file can be generated with gtk-update-icon-cache utility on a theme
directory. If the cache is not present, corrupted, or outdated, the normal slow lookup
is still run.

[ChangeLog][QtGui][QIcon] fromTheme gained the ability to use the GTK icon cache
to speed up lookups.

Change-Id: I3ab8a9910be67a34034556023be61a86789a7893
Reviewed-by: David Faure <david.faure@kdab.com>
2 years agoQIcon: add a hook in the engine so a non null QIconEngine can still be a null icon
Luís Pereira [Fri, 29 Jul 2016 19:05:27 +0000 (20:05 +0100)] 
QIcon: add a hook in the engine so a non null QIconEngine can still be a null icon

Implement it in the QIconLoader

We have to change detach() because some code does:
icon = QIcon::fromTheme("foobar"); if (icon.isNull()) icon.addPixmap(...);
so addPixmap and addFile have to work on a null QIcon by resetting
the iconEngine.

    Change-Id: I07719bef93930cf4692384a8c64e21a97dcce25c
Reviewed-by: David Faure <david.faure@kdab.com>
2 years agoQIconLoader: don't make QIconDirInfo::type a bit-field
Luís Pereira [Wed, 13 Jul 2016 17:01:03 +0000 (18:01 +0100)] 
QIconLoader: don't make QIconDirInfo::type a bit-field

It doesn't save any space, is not required for ABI compat
(because it's private API), generates more code to extract
the field, and triggers a bug in older GCCs when synthesizing
a move constructor for this type:

src/gui/image/qiconloader_p.h:64:8: error: invalid conversion from 'unsigned char:4' to 'QIconDirInfo::Type' [-fpermissive]
src/corelib/tools/qvector.h:641:13: note: synthesized method 'QIconDirInfo& QIconDirInfo::operator=(QIconDirInfo&&)' first required here

Change-Id: I61e886566b67c7a18a318a3d026dc762600f8ab4
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2 years agoDo not support static QIcon instances
Luís Pereira [Wed, 13 Jul 2016 16:57:02 +0000 (17:57 +0100)] 
Do not support static QIcon instances

There was an attempt to allow static instances of QIcon in
7727a4355876607a1a022ff54e2570dae883f79c (Qt 4). This patch does only
solve some of the corner cases and broke with
aa5f70c00a88edcddd26e8fea767a40e8c5c31b8. Since the "breakage" has been
there for two years, let's officially declare it unsupported instead of
trying to work around the issue.

Change-Id: I61e12fd03953763ee2e70eae58bcaecabdcb85b8
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2 years agoRespect manual set icon themes.
Luís Pereira [Wed, 13 Jul 2016 16:25:18 +0000 (17:25 +0100)] 
Respect manual set icon themes.

Currently all icon resolving is passed thru to the platform icon engine,
even in the case where the application developer has set their own
requested icon theme. In that case, the application developer
specifically does not want to follow the icon theme of the system, so
don't ask the platform, but rely on Qt code instead.

It leads to bugs reported to platform icon theme providers like this:
MMC: https://github.com/MultiMC/MultiMC5/issues/796
KDE: https://bugs.kde.org/show_bug.cgi?id=344469

Thanks to the multimc people (Jan Dalheimer and Peterix) for the
reports and testcases.

2 years agoRemove <qhash.h> where it's not used
Luís Pereira [Wed, 13 Jul 2016 16:24:09 +0000 (17:24 +0100)] 
Remove <qhash.h> where it's not used

To avoid source-incompatibilites, wrap in QT_DEPRECATED_SINCE(5, 5)
in public headers.

Change-Id: I6117e8a6b11200d2f1a0a94a0e87d5c27538218e
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2 years agoMake it more obvious that Q_WS_ is dead code, and should perhaps be ported
Luís Pereira [Wed, 13 Jul 2016 15:38:04 +0000 (16:38 +0100)] 
Make it more obvious that Q_WS_ is dead code, and should perhaps be ported

We still have a bunch of Q_WS_ ifdefs in our code, which are easy to
mistake for Q_OS_ ifdefs when quickly scanning the code. By renaming
the ifdefs we make it clear that the code in question is dead.

In incremental follow-ups, we can then selectively either remove, or
port, the pieces that are dead code.

Change-Id: Ib5ef3e9e0662d321f179f3e25122cacafff0f41f
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2 years agoXdgDesktopFileData: Explicitly initialize members (#91)
Luís Pereira [Sun, 26 Jun 2016 18:35:13 +0000 (19:35 +0100)] 
XdgDesktopFileData: Explicitly initialize members (#91)

Explicitly initialize all members.

2 years agobuild: Create separate Qt5XdgIconLoader target
Palo Kisa [Thu, 16 Jun 2016 07:18:09 +0000 (09:18 +0200)] 
build: Create separate Qt5XdgIconLoader target

After separating the iconloader engine there were no mean how to
use the qt5xdgiconloader separately in cmake projects (if we exclude
the use of generated pgkconfig file).
This commit adds generation of Qt5XdgIconLoader target and it's *.cmake
files. Also gives the Qt5XdgIconLoader as a dependency to Qt5Xdg.

2 years agoXdgDesktopFile: Adds tests
Luís Pereira [Fri, 17 Jun 2016 17:33:48 +0000 (18:33 +0100)] 
XdgDesktopFile: Adds tests

Test some (not all, yet) of it.

2 years agoxdgdesktopfile: Removes an not needed debug info
Luís Pereira [Wed, 15 Jun 2016 10:29:54 +0000 (11:29 +0100)] 
xdgdesktopfile: Removes an not needed debug info

It adds no value (anymore).