Make System and Utils class based on QObject.

Those classes use Qt objects anyway, and making them based on QObject moved the
strings into the appropriate class when translating.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26931 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Dominik Riebeling 2010-06-18 19:04:06 +00:00
parent ae64b59afa
commit 2c6895207d
4 changed files with 15 additions and 11 deletions

View file

@ -116,16 +116,16 @@ QString System::userPermissionsString(void)
int perm = userPermissions();
switch(perm) {
case GUEST:
result = QObject::tr("Guest");
result = tr("Guest");
break;
case ADMIN:
result = QObject::tr("Admin");
result = tr("Admin");
break;
case USER:
result = QObject::tr("User");
result = tr("User");
break;
default:
result = QObject::tr("Error");
result = tr("Error");
break;
}
return result;
@ -254,7 +254,7 @@ QMap<uint32_t, QString> System::listUsbDevices(void)
libusb_close(dh);
}
if(name.isEmpty())
name = QObject::tr("(no description available)");
name = tr("(no description available)");
if(id) {
usbids.insert(id, name);
qDebug("[System] USB: 0x%08x, %s", id, name.toLocal8Bit().data());
@ -299,7 +299,7 @@ QMap<uint32_t, QString> System::listUsbDevices(void)
}
}
usb_close(dev);
if(name.isEmpty()) name = QObject::tr("(no description available)");
if(name.isEmpty()) name = tr("(no description available)");
if(id) {
usbids.insert(id, name);

View file

@ -23,12 +23,14 @@
#ifndef SYSTEM_H
#define SYSTEM_H
#include <QtCore/QObject>
#include <inttypes.h>
#include <QString>
#include <QUrl>
class System
class System : public QObject
{
public:
System() {}

View file

@ -180,7 +180,7 @@ QString Utils::checkEnvironment(bool permission)
#if defined(Q_OS_WIN32)
if(System::userPermissions() != System::ADMIN)
{
text += QObject::tr("<li>Permissions insufficient for bootloader "
text += tr("<li>Permissions insufficient for bootloader "
"installation.\nAdministrator priviledges are necessary.</li>");
}
#endif
@ -192,14 +192,14 @@ QString Utils::checkEnvironment(bool permission)
if(!installed.isEmpty() && installed !=
SystemInfo::value(SystemInfo::CurConfigureModel).toString())
{
text += QObject::tr("<li>Target mismatch detected.\n"
text += tr("<li>Target mismatch detected.\n"
"Installed target: %1, selected target: %2.</li>")
.arg(installed, SystemInfo::value(SystemInfo::CurPlatformName).toString());
// FIXME: replace installed by human-friendly name
}
if(!text.isEmpty())
return QObject::tr("Problem detected:") + "<ul>" + text + "</ul>";
return tr("Problem detected:") + "<ul>" + text + "</ul>";
else
return text;
}

View file

@ -23,10 +23,12 @@
#ifndef UTILS_H
#define UTILS_H
#include <QtCore/QObject>
#include <QString>
#include <QUrl>
class Utils
class Utils : public QObject
{
public:
static bool recursiveRmdir(const QString &dirName);