Freedesktop icons

95 views
Skip to first unread message

N.A.Y.

unread,
May 7, 2012, 5:26:23 AM5/7/12
to razo...@googlegroups.com
I'm writing a program for Razor-Qt and want to use standard icons like edit-undo, edit-cut, application-exit, etc. But oxygen icons theme isn't loaded in Razor-Qt just in KDE or Gnome. My program loads hicolor icon theme. I found the way: I load ~/.config/razor/razor.conf and read icon_theme parameter, but this is a hack. I cannot use this method for other Qt applications. A want to use some standard method. Maybe, Qt can load freedesktop icons theme value. But there is it? I know you are using my method for load current theme. I have read Qt sources, but there is no answer.
From "src/gui/kernel/qguiplatformplugin.cpp":
/* the default icon theme name for QIcon::fromTheme. */
QString QGuiPlatformPlugin::systemIconThemeName()
{
    QString result;
#ifdef Q_WS_X11
    if (X11->desktopEnvironment == DE_GNOME) {
        result = QString::fromLatin1("gnome");
#ifndef QT_NO_STYLE_GTK
        result = QGtkStylePrivate::getGConfString(QLatin1String("/desktop/gnome/interface/icon_theme"), result);
#endif
    } else if (X11->desktopEnvironment == DE_KDE) {
        result =  X11->desktopVersion >= 4 ? QString::fromLatin1("oxygen") : QString::fromLatin1("crystalsvg");
        QSettings settings(QKde::kdeHome() + QLatin1String("/share/config/kdeglobals"), QSettings::IniFormat);
        settings.beginGroup(QLatin1String("Icons"));
        result = settings.value(QLatin1String("Theme"), result).toString();
    }
#endif
    return result;
}

 Thanks.

Petr Vanek

unread,
May 7, 2012, 5:42:36 AM5/7/12
to razo...@googlegroups.com
yes. This is real problem. There is no common standard for it (as I know). I can create a patch for Qt with one more else if (de==razor) but I don't think it's the correct solution...

--
You received this message because you are subscribed to the Google
Groups "Razor-qt" group.
For more options, visit this group at
http://groups.google.com/group/razor-qt?hl=en

Jerome Leclanche

unread,
May 7, 2012, 6:06:48 AM5/7/12
to razo...@googlegroups.com
I had a theme-config-spec proposal but it was rejected by the GTK guys. Apparently, the next solution is for Qt to implement getting theme config from xsettings.

J. Leclanche

PICCORO McKAY Lenz

unread,
May 7, 2012, 9:22:52 AM5/7/12
to razo...@googlegroups.com
Fucking GTK+ guys.. make unhappy the life of programers.. 

Kevin Krammer

unread,
May 7, 2012, 10:03:22 AM5/7/12
to razo...@googlegroups.com
On Monday, 2012-05-07, N.A.Y. wrote:
> I'm writing a program for Razor-Qt and want to use standard icons like *
> edit-undo*, *edit-cut*, *application-exit*, etc. But *oxygen* icons theme
> isn't loaded in Razor-Qt just in KDE or Gnome. My program loads
> *hicolor*icon theme. I found the way: I load *~/.config/razor/razor.conf*
> and read *icon_theme* parameter, but this is a hack. I cannot use this
> method for other Qt applications. A want to use some standard method.

Doesn't QIcon::fromTheme() handle this?

Cheers,
Kevin
--
Kevin Krammer, KDE developer, xdg-utils developer
KDE user support, developer mentoring
signature.asc

N.A.Y.

unread,
May 7, 2012, 11:05:32 AM5/7/12
to razo...@googlegroups.com
понедельник, 7 мая 2012 г., 21:03:22 UTC+7 пользователь anda...@gmail.com написал:
Doesn't. 

Jerome Leclanche

unread,
May 7, 2012, 11:50:37 AM5/7/12
to razo...@googlegroups.com
--
You received this message because you are subscribed to the Google
Groups "Razor-qt" group.
For more options, visit this group at
http://groups.google.com/group/razor-qt?hl=en

Their reasoning made a lot of sense which is why I did not insist on my spec. Reasoning being that setting *storage* should not be absolute to files. xsettings provides a transient storage for themes and fallback themes which is completely fine. Additionally, if Qt starts supporting it, it'll also be supported by Gtk automatically. It's a good solution, however a dev needs to step up to implement it -- I would do it in a heartbeat but I'm a python programmer, not C++.

The issue with ::fromTheme is that it only looks in KDE settings, and/or assumes "oxygen" depending on the DE, then falls back to hicolor, so we cannot rely on it as it is.

J. Leclanche

Reply all
Reply to author
Forward
0 new messages