Page MenuHomePhabricator

Implement possibility to switch between different icon sets
Closed, ResolvedPublic

Description

Currently we are using a number of hand painted icons. These could be replaced by more serious, designed icons. One possible example would be the tango icon set or the awesome font icon set.

Depending on the theme (e.g. dark theme) there might be a requirement to switch between different icon sets, as some might be more easily visible in one theme, others in another.

Event Timeline

goch added a subscriber: goch.

Links of interest could be:

[1] The ctk icon engine
[2] Using an icon from a specific theme

[1] http://www.commontk.org/docs/html/classctkIconEngine.html
[2] http://qt-project.org/doc/qt-4.8/qicon.html#fromTheme

User goch has pushed new remote branch:

bug-18160-use-icon-themes

The pushed branch uses the tango icons if no system theme is available. Basically this means any system but linux will use tango as fromTheme will return null.

I also switched from pngs to svgs for these icons.

I might look further into providing different themes using setThemeName. This will however require us to provide icon.theme files [3] for our different themes and add our own custom directories via setThemeSearchPaths.

Switching between different themes should probably be possible in the preference menu. Giving an option for system default, tango, awesome font (and possibly future icons)

It would be great if a linux user could test whether he gets other than the fallback icons on their system.

[3] http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html

Peter just tested it on Linux with a non-tango theme. The system theme icons were displayed and on changing the system theme while the application was running they did change appropriately.

The preference menu now contains an additional combo box to select the icon theme. For now I added the tango and awesome theme. Selecting the <<default>> theme uses the tango theme.

This is due to the fact, that using "" or "icons" as default theme name on windows does not revert to the fallback icons but instead either does not find any icons or uses the windows default, which is also no icons. Testing on Linux might reveal which it is.

However for now all plattforms will be forced to use one of the two, further specialization using ifdefs and different default icons for different platforms (or providing default icons for some but not others) seemed like overkill.

I expect that additional icon themes will be available on Linux, as Qt should recognize all system themes.

Tests on Linux show that all system themes are recognized as well. Although it is not given that each theme actually has every required icon.

Potentially one could check for each icon whether it is available using QIcon::hasThemeIcon( iconName )and provide a default icon for each. This would solve the fallback icons being ignored issue.

However this would be a lot of special code for the edge case of people using an incomplete icon set and not very practicable in many cases, such as warning/info/error... icons being used implicitly by using corresponding QMessageBox.

It was decided at todays MITK meeting to include this feature in the current release.

[ac775a]: Merge branch 'bug-18160-use-icon-themes'

Merged commits:

2014-10-02 13:46:36 Caspar Goch [5f8794]
Use tango theme by default

In order not to have no icons on windows upon selecting the default icon theme I
had to define a default theme.


2014-10-02 13:08:06 Caspar Goch [7d92fa]
Add message box icons


2014-10-01 18:17:51 Caspar Goch [7930c8]
Added tango and awesome icons

Additionally the user can now use the preferences menu to switch between
them at runtime.


2014-10-01 02:25:37 Caspar Goch [a662b1]
Use theme for common actions

Added tango icon svgs as fallback