[KDE/Mac] Thoughts on standard directories in Qt5 - QStandardPaths

Marko Käning mk-lists at email.de
Sat Dec 6 14:28:59 UTC 2014


Hi Ian and René,

On 06 Dec 2014, at 05:50 , Ian Wadham <iandw.au at gmail.com> wrote:
> I think the way out of the maze is to cross-check the following:
>    a) What QSP location-type and what sub-directory within that is Bovo requesting?
>    b) Where does the QSP code look for the relevant data-files and directories?
>    c) Where has the build actually installed those files?
> 
> Points a) and b) can be investigated by inserting qDebug() statements in the code
> for qstandardpaths.cpp, qstandardpaths_mac.cpp (or qstandardpaths_mac.mm,
> as the case may be) and in Bovo's gui/mainwindow.cc code.

well, I think there’s stuff happening further up the chain in kxmlgui or so...


> These qDebug() will even trap requests coming from Frameworks libraries before
> the main app gets started (e.g. requests used to set up menus).  It may also help
> to have kDebug() messages turned on for some Frameworks modules so that
> we can see which modules the requests to QSP are coming from.
> 
> Point c) is up to you, Marko.  You are the buildmaster… :-)

Here we are (excerpt):
---
$ pwd
/opt/kde/install/darwin/mavericks/clang/kf5-qt5/kde/kdegames/bovo
MVM2:bovo marko$ tree
.
└── inst
    ├── Applications
    │   └── KF5
    │       └── bovo.app
    │           └── Contents
    │               ├── Info.plist
    │               └── MacOS
    │                   └── bovo
    ├── Library
    │   └── Application\ Support
    │       ├── appdata
    │       │   └── bovo.appdata.xml
    │       └── bovo
    │           └── themes
    │               ├── ...
    │               .
    └── share
        ├── applications
        │   └── org.kde.bovo.desktop
        ├── doc
        │   └── ...
        ├── icons
        │   └── hicolor
        │       ├── 128x128
        │       │   └── apps
        │       │       └── bovo.png
        │       ├── ...
        │       .
        └── kxmlgui5
            └── bovo
                └── bovoui.rc

37 directories, 21 files
---

If I start bovo I get this:
---
$ /opt/kde/install/darwin/mavericks/clang/kf5-qt5/kde/kdegames/bovo/inst/Applications/KF5/bovo.app/Contents/MacOS/bovo 
Could not find drkonqi at /opt/kde/install/darwin/mavericks/clang/kf5-qt5/frameworks/kcrash/inst/lib/libexec/drkonqi
Couldn't start kglobalaccel from org.kde.kglobalaccel.service: QDBusError("org.freedesktop.DBus.Error.ServiceUnknown", "The name org.kde.kglobalaccel was not provided by any .service files")
games.ui: KStandardGameAction::create(  1 = game_new , KActionCollection(0x7fa7f9449a90, name = "KXMLGUIClient-KActionCollection")  )
games.ui: KStandardGameAction::create(  11 = game_quit , KActionCollection(0x7fa7f9449a90, name = "KXMLGUIClient-KActionCollection")  )
games.ui: KStandardGameAction::create(  23 = move_hint , KActionCollection(0x7fa7f9449a90, name = "KXMLGUIClient-KActionCollection")  )
games.ui: KStandardGameAction::create(  13 = move_undo , KActionCollection(0x7fa7f9449a90, name = "KXMLGUIClient-KActionCollection")  )
QFSFileEngine::open: No file name specified
Cannot open file '', because: No file name specified
ui/ui_standards.rc not found in ("/Users/marko/Library/Preferences")
cannot find .rc file "bovoui.rc" for component "bovo"
QCoreApplication::arguments: Please instantiate the QApplication object first

^CSegmentation fault: 11
$
---

One can already see that it tries to read ui_standards.rc from /Users/marko/Library/Preferences,
but it is unclear where it searches for bovoui.rc, which lives on the OSX/CI system in

	/opt/kde/install/darwin/mavericks/clang/kf5-qt5/kde/kdegames/bovo/share/kxmlgui5/bovo

These files get accessed through kxmlgui, which is why I haven’t gotten further - back then -
with my analysis. I think we need to put some qDebug()'s in kxmlgui!!!

Here’s an excerpt of kxmlgui’s installation:
---
$ tree kxmlgui 
kxmlgui
└── inst
    ├── Library
    │   └── Application\ Support
    │       └── kf5
    │           └── kxmlgui
    │               └── pics
    │                   ├── aboutkde.png
    │                   └── thumb_frame.png
    ├── etc
    │   └── xdg
    │       └── ui
    │           └── ui_standards.rc
    ├── include
    │   └── KF5
    │       ├── KXmlGui
---
i.e. the ui_standards.rc is located in /etc/xdg/ui/ !

So, there we are back to the discussion I had this summer with David Faure on K-F-D:
We need to figure out where to place the relevant files of the various frameworks on OSX!

Checking on /opt/local/etc/xdg on a Qt4/KDE4-based VM I see this:
---
$  tree /opt/local/etc/xdg
/opt/local/etc/xdg
└── menus
    ├── kde-information.menu
    └── kde4-applications.menu

1 directory, 2 files
---
i.e. we’re already making use of this location on MacPorts... So, perhaps it is just fine to
keep KF5’s files there just as well?!

But I remember that David didn’t really like the idea, as it is not really an OSX-specific
location, IIRC.



I see also that there are QSP calls like these in bovo’s code: 
---
   const QStringList themeDirs = QStandardPaths::locateAll(QStandardPaths::DataLocation, QStringLiteral("themes"), QStandardPaths::LocateDirectory);
   const QString rc = QStandardPaths::locate(QStandardPaths::ConfigLocation, "bovorc");
---
and a qDebug() for the 2nd line told me that ‘rc’ is (correctly) set to

	/Users/marko/Library/Preferences/bovorc

and well, there’s of course no such file, yet, as I couldn’t test-play bovo. :)




Please send me any QSP (and very probably kxmlgui) patches, which might help you getting the
required information.


> The qDebug() and kDebug() output should tell us what is going wrong.  We can
> then fix it by changing the installation locations in the build, by modifying the QSP
> code or both.
> 
> If you would like to go ahead with this, Marko, please send me (privately will do)
> your working copies of the files qstandardpaths.cpp, qstandardpaths_mac.cpp
> (or qstandardpaths_mac.mm) and Bovo's gui/mainwindow.cc and I will send
> them back with some suggested qDebug() lines inserted.  Let's go!!!

The patch mentioned in [1] which I am currently using for QSP can be found on [2].

Greets,
Marko


[1] https://trac.macports.org/wiki/KDEProblems/KDEMacPortsCI/Status#StandardpathsforQt5
[2] http://quickgit.kde.org/?p=clones%2Fwebsites%2Fbuild-kde-org%2Fkaning%2Fmp-osx-ci.git&a=blob&h=e0b488e55a279023c1750543cb1daf8b40980321&hb=41fa7caf1af41a74d7cfd09dbb480d0bd70dce79&f=patches%2Fqt5%2Fkf5-qt5%2Fpatch-qstandardpaths_mac.cpp.diff


More information about the kde-mac mailing list