mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-12 14:42:31 -05:00
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:
parent
ae64b59afa
commit
2c6895207d
4 changed files with 15 additions and 11 deletions
|
|
@ -116,16 +116,16 @@ QString System::userPermissionsString(void)
|
||||||
int perm = userPermissions();
|
int perm = userPermissions();
|
||||||
switch(perm) {
|
switch(perm) {
|
||||||
case GUEST:
|
case GUEST:
|
||||||
result = QObject::tr("Guest");
|
result = tr("Guest");
|
||||||
break;
|
break;
|
||||||
case ADMIN:
|
case ADMIN:
|
||||||
result = QObject::tr("Admin");
|
result = tr("Admin");
|
||||||
break;
|
break;
|
||||||
case USER:
|
case USER:
|
||||||
result = QObject::tr("User");
|
result = tr("User");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
result = QObject::tr("Error");
|
result = tr("Error");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
@ -254,7 +254,7 @@ QMap<uint32_t, QString> System::listUsbDevices(void)
|
||||||
libusb_close(dh);
|
libusb_close(dh);
|
||||||
}
|
}
|
||||||
if(name.isEmpty())
|
if(name.isEmpty())
|
||||||
name = QObject::tr("(no description available)");
|
name = tr("(no description available)");
|
||||||
if(id) {
|
if(id) {
|
||||||
usbids.insert(id, name);
|
usbids.insert(id, name);
|
||||||
qDebug("[System] USB: 0x%08x, %s", id, name.toLocal8Bit().data());
|
qDebug("[System] USB: 0x%08x, %s", id, name.toLocal8Bit().data());
|
||||||
|
|
@ -299,7 +299,7 @@ QMap<uint32_t, QString> System::listUsbDevices(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
usb_close(dev);
|
usb_close(dev);
|
||||||
if(name.isEmpty()) name = QObject::tr("(no description available)");
|
if(name.isEmpty()) name = tr("(no description available)");
|
||||||
|
|
||||||
if(id) {
|
if(id) {
|
||||||
usbids.insert(id, name);
|
usbids.insert(id, name);
|
||||||
|
|
|
||||||
|
|
@ -23,12 +23,14 @@
|
||||||
#ifndef SYSTEM_H
|
#ifndef SYSTEM_H
|
||||||
#define SYSTEM_H
|
#define SYSTEM_H
|
||||||
|
|
||||||
|
#include <QtCore/QObject>
|
||||||
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
|
||||||
class System
|
class System : public QObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
System() {}
|
System() {}
|
||||||
|
|
|
||||||
|
|
@ -180,7 +180,7 @@ QString Utils::checkEnvironment(bool permission)
|
||||||
#if defined(Q_OS_WIN32)
|
#if defined(Q_OS_WIN32)
|
||||||
if(System::userPermissions() != System::ADMIN)
|
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>");
|
"installation.\nAdministrator priviledges are necessary.</li>");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -192,14 +192,14 @@ QString Utils::checkEnvironment(bool permission)
|
||||||
if(!installed.isEmpty() && installed !=
|
if(!installed.isEmpty() && installed !=
|
||||||
SystemInfo::value(SystemInfo::CurConfigureModel).toString())
|
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>")
|
"Installed target: %1, selected target: %2.</li>")
|
||||||
.arg(installed, SystemInfo::value(SystemInfo::CurPlatformName).toString());
|
.arg(installed, SystemInfo::value(SystemInfo::CurPlatformName).toString());
|
||||||
// FIXME: replace installed by human-friendly name
|
// FIXME: replace installed by human-friendly name
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!text.isEmpty())
|
if(!text.isEmpty())
|
||||||
return QObject::tr("Problem detected:") + "<ul>" + text + "</ul>";
|
return tr("Problem detected:") + "<ul>" + text + "</ul>";
|
||||||
else
|
else
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,10 +23,12 @@
|
||||||
#ifndef UTILS_H
|
#ifndef UTILS_H
|
||||||
#define UTILS_H
|
#define UTILS_H
|
||||||
|
|
||||||
|
#include <QtCore/QObject>
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
|
||||||
class Utils
|
class Utils : public QObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static bool recursiveRmdir(const QString &dirName);
|
static bool recursiveRmdir(const QString &dirName);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue