Enumerate application profiles using QSettings
-
Hello!
I wonder, how can I count up profiles for my application? Each profile include couple of its files: config file, log etc. All of application profiles placed in own dir with unique name (profile ID).
Is it possible to count them up using Qt classes and how to do so.
Thanks in advance for your help and time :-) -
@Anton-Pleskanovskyy What are those "profiles"? How are they created? Who creates them?
If all these profiles are stored in same base directory then you just need to count the subdirectories.
Likec:\profiles\ profile1 profile2 profile3
In this example you would have 3 profiles. To make sure you only count valid profiles you can check the content of each profile subdirectory.
-
@jsulm , actually I want to try extend Trojita IMAP Client functionality.
I'm going to try make a simple launcher (also powered by Qt as well as original software) to start the Trojita with certain profile passed to executable. So, for the sake of simplicity, yes each profile stored in separate subdirectory of config folder then how to count subfolders (to be crossplatform)? ("rough" simplification of my case) -
@Anton-Pleskanovskyy See this: http://doc.qt.io/qt-5/qdir.html#entryList-1
Use QDir::Dirs as filter. -
@jsulm you are right!
I guess that is my case List files in sub-directories with QDir's filter