HAVE_X11 usage in KIO/core

Kevin Krammer krammer at kde.org
Fri Feb 7 14:25:42 UTC 2014


On Friday, 2014-02-07, 09:51:27, Martin Gräßlin wrote:
> On Friday 07 February 2014 09:38:41 Kevin Krammer wrote:
> > On Friday, 2014-02-07, 08:53:54, Martin Gräßlin wrote:

> > > I'm wondering what to do about it. The best would be to use
> > > QGuiApplication::platformName, but it's a core app. Also finding X11 in
> > > CMakeLists to get the HAVE_X11 defined looks very wrong to me and not
> > > future safe (Wayland).
> > 
> > My guess is that platform() in this context means operating system, not
> > windowing/display system.
> 
> See the comment I pasted, it's explicitly saying it's the windowing system
> and not the OS...

Ah, didn't see that. Does it actually make sense?

If yes than this obviously has be to be done at runtime, at least for 
platforms with multiple UI systems:

#if  defined(Q_OS_MAC)
    return QL1S("Macintosh")
#elfi defined(Q_OS_WINDOWS)
      return QL1S("Windows")
#else
    const QVariant platformName = qApp ? qApp->property("platformName") : 
QVariant();
    if (platformName.isValid()) {
        const QString name = platformName.toString();
        if (!name.isEmpty())
            return name;
    }
#endif
return QL1S("Unknown");

Cheers,
Kevin

-- 
Kevin Krammer, KDE developer, xdg-utils developer
KDE user support, developer mentoring
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20140207/75e231a8/attachment.sig>


More information about the Kde-frameworks-devel mailing list