Formatting New Linux Filesystems Using Qt
-
I have had a Google around and a search on Qt DevNet but haven't been able to find an answer to the following.
Suppose I wanted to create a tool used to format removable drives in Qt - does Qt provide a library which gives the fnctionality to format new filesystems?
If not what is the recommended way of doing this from within a Qt application in Linux?
-
Well, as far as I know, Qt doesn't provide that functionality. But, you could take a look at GParted, which uses "GNU/Parted":http://www.gnu.org/software/parted/ at the backend. Its a great tool which comes bundled with Ubuntu Live CD. You could install it from synaptic to take a look. Take the lead from there to make a Qt application instead of GTK.
bq. GNU Parted manipulates partition tables. This is useful for creating space for new operating systems, reorganizing disk usage, copying data on hard disks and disk imaging. The package contains a library, libparted, as well as well as a command-line frontend, parted, which can also be used in scripts.
-
Or look at "http://qtparted.sourceforge.net/" :)
-
Of course, there would already be an app doing it using Qt :).. Just a comment, the sourceforge link opens up, but not the link to a forum thread in the link (http://developer.qt.nokia.com/forums/viewthread/6762/QtParted).
-
Fixed the link but it I'm not sure what happened, it look ok.
-
You could also call the usual command line applications mkfs.* via QProcess.
-
ZapB: Probably the simplest!
-
Or you could just take the same approach that the above mentioned applications took and use libparted directly.
Here is a tutorial for libparted Note: example's may need to be justed to fit the current api.
LibParted Handbook "Note: LibParted is a library used to create, destroy, resize and copy PC disk partitions"
http://zester.googlecode.com/files/libparted_handbook.pdfHere is the libparted API reference
http://www.gnu.org/software/parted/api/
And if you want to work directly with just CD/DVD drives
Libburn
http://api.libburnia-project.org/libburn
Libisofs
http://api.libburnia-project.org/libisofs
Libisoburn
-
Some great replies, thanks for the informationall, gives me plenty to be looking at :-)
-
I forgot to mention that libparted is a bit on the lowlevel side so for getting disk information you might want to
use QtMobility http://doc.qt.nokia.com/qtmobility-1.1.3/systeminfo.html with libparted. If thats the approach
that you decide to take. -
Hmm.. But mobility classes are only for mobile platforms?
-
Nope. QtMobility has some features for all platforms mobile and desktop.
-
No you can use them on a regular desktop also. There are some classes/functions that might not make sense for the desktop like the tilt sensor API but it might be relevant for a tablet.
-
bq. QtMobility has some features for all platforms mobile and desktop.
I didn't know that because i'm on desktop only until now. That's good news.Is there a web page/link where we can see a list of the goodies available for desktop?
Or how can we determine (without prior qtmobility knowledge) which ones are accesible for desktop? -
One could use the
@
QFSFileEngine::drives ()
or
QDir::drives ()
@I'm not sure how much of mobility is supported on the desktop. It is still quite early for that kind of support. I may be wrong though. But, for example, the Camera API doesn't use the webcam on desktop.
-
bq. But, for example, the Camera API doesn’t use the webcam on desktop.
Actually you just might be wrong there I do know that the QtMobility Multimedia Library has been moved to
to Qt 4.8 I think and if I am not mistaken there is a webcam api in there. I will have to test that on my system. -
bq. Actually you just might be wrong there I do know that the QtMobility Multimedia Library has been moved to
to Qt 4.8 I think and if I am not mistaken there is a webcam api in there. I will have to test that on my system.In that case.. my bad, still with 4.7.3/4 here :P, working on the official SDK 1.1 for deploying to OVI store.