on musescore exit, [FileDialog] settings written to ~/.config/QtProject.conf (arch & ubuntu, both nightly & 2.0.2)
EDIT: My conclusion after investigating is that there is no problem, since the write is expected Qt behavior. /EDIT
I was diagnosing an issue where if ~/.config/QtProject.conf was locked, then musescore process would never actually finish after I close the musescore window on my x86-64 arch linux machine and lubuntu 15.04 x86-64 machine, on both the nightly, self compile, and official distro release builds of musescore, and even on my i686 arch machine which doesn't have QtCreator or many other Qt tools setup. Removing the lock, would let execution finish, but I saw that .conf file would be modified upon exit with [FileDialog] settings. So the greater question I'm trying to address is why does the musescore process write to ~/.config/QtProject.conf upon exit in the first place? This happens right at the end of qApp->exec() in the main loop of musescore.cpp. Looking at http://doc.qt.io/qt-5/qsettings.html#platform-specific-notes I see that QSettings will write to $HOME/.config/QtProject.conf if the organization name is QtProject, however the part that confuses me is that MuseScore does not belong to QtProject org. So I think there is some mistake in the code. If QtProject.conf is used by other apps, then I suppose there might be conflicts. I think all the musescore settings should be stored in the one file (which on unix should be ~/.config/MuseScore/MuseScore2.ini for any 2.* release). Note, I have to open a file dialog window of some sort for this QtProject.conf to be modified with settings.
On my arch machine, if I set nativeDialogs=true before executing mscore, then after mscore finishes, then ~/.config/QtProject.conf will contain:
[FileDialog] history=@Invalid() lastVisited=file:///home/e/Documents/MuseScore2/Scores qtVersion=5.5.0 viewMode=Detail
If I set nativeDialogs=false before executing mscore, then after mscore finishes will instead contain
[FileDialog] history=file:///home/e/Documents/MuseScore2/Scores, file:///home/e/mscz-folder lastVisited=file:///home/e/mscz-folder qtVersion=5.5.0 shortcuts=file:///home/e, file:///home/e/Documents/MuseScore2/Scores, file:///home/e/Downloads, file:///usr/share/mscore-2.0/demos sidebarWidth=68 treeViewHeader=@ByteArray(\0\0\0\xff\0\0\0\0\0\0\0\x1\0\0\0\0\0\0\0\0\x1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x1\xe0\0\0\0\x4\x1\x1\0\0\0\0\0\0\0\0\0\0\0\0\0\0`\xff\xff\xff\xff\0\0\0\x81\0\0\0\0\0\0\0\x4\0\0\0\xd0\0\0\0\x1\0\0\0\0\0\0\0H\0\0\0\x1\0\0\0\0\0\0\0H\0\0\0\x1\0\0\0\0\0\0\0\x80\0\0\0\x1\0\0\0\0\0\0\x3\xe8\0) viewMode=Detail
I'm going to try to fix this. I think maybe these FileDialog settings aren't being written to the musescore ini file along with the rest of the file dialog settings, which might possibly be causing them to be written to this QtProject.conf file as fallback. Any advice is welcome.
Comments
After running musescore on windows the corresponding file $HKEY_CURRENT_USER/Software/QtProject/OrganizationDefaults is NOT overwritten with new [FileDialog] settings, so this leads me to think that there is some mistake with the musescore code speicifically with linux (I don't have a mac to test if $HOME/Library/Preferences/com.QtProject.plist is being overwritten after run musescore, but that would be nice to know).
on the ubuntu machine, if I start with empty MuseScore2.ini and empty QtProject.conf, then after running musescore, pressing the "Open" in start center, but not opening anything and quitting immediately, will result in QtProject.conf containing:
Which is slightly different than that arch linux result, which has [FileDialog] as its own header. If I set nativeDialogs=true, and do the same thing, the result is:
I wonder if this is the expected behavior for musescore to write to QtProject.conf, but I'm confused why my window machine doesn't write there, so I think it is a bug. I'm going to look in the Qt code for QFileDialog and see when it performs the writing.
Ok, I finally found where these settings get saved. It is http://code.qt.io/cgit/qt/qtbase.git/tree/src/widgets/dialogs/qfiledial… in QFileDialogPrivate::saveSettings() and it is indeed under org name QtProject:
So I guess maybe there isn't any thing wrong going on. Everything is as excepted. Part of me thinks all settings that musescore deals with should be stored in the one musescore .ini file, but I suppose that since this is how qt handles these file dialog settings, then musescore code shouldn't try to interfere. Those two functions saveSettings and restoreSettings are enclosed by a #ifndef QT_NO_SETTINGS, so I suppose if QT_NO_SETTINGS was defined, then these settings aren't stored to the QtProject.conf. I suspect the reason musescore on windows is not writing to QtProject.conf is because the windows Qt library that I have is was compiled with #define QT_NO_SETTINGS.
I won't look into this any further, since it seems to be as expected.