[SOLVED] Free disk space
-
wrote on 4 Mar 2011, 09:11 last edited by
Is there any Qt class which provides info about free disk space?
-
wrote on 4 Mar 2011, 12:21 last edited by
-Not that I know of.-
-
wrote on 4 Mar 2011, 13:54 last edited by
No API for that, sorry. Use platform-dependent code, or see if boost::filesystem::space is fine with you.
-
wrote on 8 Mar 2011, 18:55 last edited by
Yes, try QtMobility QtSystemStorageInfo class.
-
wrote on 9 Mar 2011, 09:19 last edited by
Thanks for the correction, Lorn.
-
wrote on 11 Mar 2011, 10:38 last edited by
[quote author="lpotter" date="1299610547"]Yes, try QtMobility QtSystemStorageInfo class.[/quote]
Thanks, I completely missed that class. But how are you supposed to use it? All it does (in 1.1) is reporting a list of drives...
-
wrote on 11 Mar 2011, 10:46 last edited by
[quote author="peppe" date="1299839932"]
[quote author="lpotter" date="1299610547"]Yes, try QtMobility QtSystemStorageInfo class.[/quote]Thanks, I completely missed that class. But how are you supposed to use it? All it does (in 1.1) is reporting a list of drives...[/quote]
Based on the documentation "here":http://doc.qt.nokia.com/qtmobility-1.2/qsystemstorageinfo.html , I gather that:
You can only be notified of changes in the storage state
You can't get the actual free storage, only undefined classifications of that storage (Unknown, Normal, Low, Very Low, Critical)
Though there is an enum for it, I don't see a documented way to actually get the drive type
All in all, I get the feeling the documentation may be incomplete.
Edit: indeed, the documentation is incomplete. If you read the "example code":http://doc.qt.nokia.com/qtmobility-1.2/sysinfo-dialog-cpp.html, you find some additional member functions:
- QSystemStorageInfo::DriveType QSystemStorageInfo::typeForDrive(volName)
- ??? QSystemStorageInfo::totalDiskSpace(volName)
- ??? QSystemStorageInfo::availableDiskSpace(volName)
That clears up a lot of confusion. It will take a look at the header for QSystemStorageInfo to see what other functions are available...
-
wrote on 11 Mar 2011, 10:57 last edited by
Oh, nice one. I just quick glanced through 1.1 and 1.2 docs and saw nothing like that :-)
-
wrote on 11 Mar 2011, 12:42 last edited by
I saw it somewhere on the net in 1.2 docs.
-
wrote on 11 Mar 2011, 17:06 last edited by
here's the link:
http://doc.qt.nokia.com/qt-mobility-snapshot/qsystemstorageinfo.html
1/10