Properly export sleep_timer_call from main_menu.c in exported_menus.h
[kugel-rb.git] / rbutil / rbutilqt / sysinfo.cpp
blob1b2f44923b04c8751ebd861ce3ae6eedf1346ee5
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
9 * Copyright (C) 2007 by Dominik Riebeling
10 * $Id$
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
20 #include <QtGui>
21 #include "sysinfo.h"
22 #include "ui_sysinfofrm.h"
23 #include "system.h"
24 #include "utils.h"
25 #include "autodetection.h"
28 Sysinfo::Sysinfo(QWidget *parent) : QDialog(parent)
30 ui.setupUi(this);
32 updateSysinfo();
33 connect(ui.buttonOk, SIGNAL(clicked()), this, SLOT(close()));
34 connect(ui.buttonRefresh, SIGNAL(clicked()), this, SLOT(updateSysinfo()));
37 void Sysinfo::updateSysinfo(void)
39 ui.textBrowser->setHtml(getInfo());
42 QString Sysinfo::getInfo()
44 QString info;
45 info += tr("<b>OS</b><br/>") + System::osVersionString() + "<hr/>";
46 info += tr("<b>Username</b><br/>%1<hr/>").arg(System::userName());
47 #if defined(Q_OS_WIN32)
48 info += tr("<b>Permissions</b><br/>%1<hr/>").arg(System::userPermissionsString());
49 #endif
50 info += tr("<b>Attached USB devices</b><br/>");
51 QMap<uint32_t, QString> usbids = System::listUsbDevices();
52 QList<uint32_t> usbkeys = usbids.keys();
53 for(int i = 0; i < usbkeys.size(); i++) {
54 info += tr("VID: %1 PID: %2, %3")
55 .arg((usbkeys.at(i)&0xffff0000)>>16, 4, 16, QChar('0'))
56 .arg(usbkeys.at(i)&0xffff, 4, 16, QChar('0'))
57 .arg(usbids.value(usbkeys.at(i)));
58 if(i + 1 < usbkeys.size())
59 info += "<br/>";
61 info += "<hr/>";
63 info += "<b>" + tr("Filesystem") + "</b>";
64 QStringList drives = Utils::mountpoints();
65 info += "<table>";
66 info += "<tr><td>" + tr("Mountpoint") + "</td><td>" + tr("Label")
67 + "</td><td>" + tr("Free") + "</td><td>" + tr("Total") + "</td><td>"
68 + tr("Cluster Size") + "</td></tr>";
69 for(int i = 0; i < drives.size(); i++) {
70 info += tr("<tr><td>%1</td><td>%4</td><td>%2 GiB</td><td>%3 GiB</td><td>%5</td></tr>")
71 .arg(QDir::toNativeSeparators(drives.at(i)))
72 .arg((double)Utils::filesystemFree(drives.at(i)) / (1<<30), 0, 'f', 2)
73 .arg((double)Utils::filesystemTotal(drives.at(i)) / (1<<30), 0, 'f', 2)
74 .arg(Utils::filesystemName(drives.at(i)))
75 .arg(Utils::filesystemClusterSize(drives.at(i)));
77 info += "</table>";
78 info += "<hr/>";
80 return info;