S5L8700: fix buttons used in debug menu
[kugel-rb.git] / rbutil / rbutilqt / sysinfo.cpp
blobf5c0e47eeb5c66c7dacc8dc378c139062199c3df
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 "detect.h"
24 #include "utils.h"
25 #include "autodetection.h"
28 Sysinfo::Sysinfo(QWidget *parent) : QDialog(parent)
30 ui.setupUi(this);
31 this->setModal(true);
33 updateSysinfo();
34 connect(ui.buttonOk, SIGNAL(clicked()), this, SLOT(close()));
35 connect(ui.buttonRefresh, SIGNAL(clicked()), this, SLOT(updateSysinfo()));
38 void Sysinfo::updateSysinfo(void)
40 QString info;
41 info += tr("<b>OS</b><br/>") + Detect::osVersionString() + "<hr/>";
42 info += tr("<b>Username</b><br/>%1<hr/>").arg(Detect::userName());
43 #if defined(Q_OS_WIN32)
44 info += tr("<b>Permissions</b><br/>%1<hr/>").arg(Detect::userPermissionsString());
45 #endif
46 info += tr("<b>Attached USB devices</b><br/>");
47 QMap<uint32_t, QString> usbids = Detect::listUsbDevices();
48 QList<uint32_t> usbkeys = usbids.keys();
49 for(int i = 0; i < usbkeys.size(); i++) {
50 info += tr("VID: %1 PID: %2, %3")
51 .arg((usbkeys.at(i)&0xffff0000)>>16, 4, 16, QChar('0'))
52 .arg(usbkeys.at(i)&0xffff, 4, 16, QChar('0'))
53 .arg(usbids.value(usbkeys.at(i)));
54 if(i + 1 < usbkeys.size())
55 info += "<br/>";
57 info += "<hr/>";
59 info += "<b>" + tr("Filesystem") + "</b><br/>";
60 QStringList drives = Autodetection::mountpoints();
61 for(int i = 0; i < drives.size(); i++) {
62 info += tr("%1, %2 MiB available")
63 .arg(QDir::toNativeSeparators(drives.at(i)))
64 .arg(filesystemFree(drives.at(i)) / (1024*1024));
65 if(i + 1 < drives.size())
66 info += "<br/>";
68 info += "<hr/>";
70 ui.textBrowser->setHtml(info);