diff options
Diffstat (limited to 'tests/manual/qstorageinfo/main.cpp')
-rw-r--r-- | tests/manual/qstorageinfo/main.cpp | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/tests/manual/qstorageinfo/main.cpp b/tests/manual/qstorageinfo/main.cpp index 5c106ff45b..61cdd55922 100644 --- a/tests/manual/qstorageinfo/main.cpp +++ b/tests/manual/qstorageinfo/main.cpp @@ -32,10 +32,11 @@ ****************************************************************************/ #include <QtCore/QCoreApplication> -#include <QtCore/QStorageInfo> #include <stdio.h> +#include "printvolumes.cpp" + int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); @@ -57,26 +58,7 @@ int main(int argc, char *argv[]) if (volumes.isEmpty()) volumes = QStorageInfo::mountedVolumes(); - // Sample output: - // Filesystem (Type) Size Available BSize Label Mounted on - // /dev/sda2 (ext4) RO 388480 171218 1024 /boot - // /dev/mapper/system-root (btrfs) RW - // 214958080 39088272 4096 / - // /dev/disk1s2 (hfs) RW 488050672 419909696 4096 Macintosh HD2 /Volumes/Macintosh HD2 - - printf("Filesystem (Type) Size Available BSize Label Mounted on\n"); - foreach (const QStorageInfo &info, volumes) { - QByteArray fsAndType = info.device(); - if (info.fileSystemType() != fsAndType) - fsAndType += " (" + info.fileSystemType() + ')'; - - printf("%-19s R%c ", fsAndType.constData(), info.isReadOnly() ? 'O' : 'W'); - if (fsAndType.size() > 19) - printf("\n%23s", ""); - - printf("%10llu %10llu %5u ", info.bytesTotal() / 1024, info.bytesFree() / 1024, info.blockSize()); - printf("%-16s %s\n", qPrintable(info.name()), qPrintable(info.rootPath())); - } + printVolumes(volumes, printf); return 0; } |