summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--rbutil/rbutilqt/base/autodetection.cpp4
-rw-r--r--rbutil/rbutilqt/base/system.cpp (renamed from rbutil/rbutilqt/base/detect.cpp)64
-rw-r--r--rbutil/rbutilqt/base/system.h (renamed from rbutil/rbutilqt/base/detect.h)10
-rw-r--r--rbutil/rbutilqt/base/utils.cpp43
-rw-r--r--rbutil/rbutilqt/base/utils.h1
-rw-r--r--rbutil/rbutilqt/configure.cpp4
-rw-r--r--rbutil/rbutilqt/install.cpp4
-rw-r--r--rbutil/rbutilqt/rbutilqt.cpp8
-rw-r--r--rbutil/rbutilqt/rbutilqt.pro4
-rw-r--r--rbutil/rbutilqt/sysinfo.cpp10
10 files changed, 77 insertions, 75 deletions
diff --git a/rbutil/rbutilqt/base/autodetection.cpp b/rbutil/rbutilqt/base/autodetection.cpp
index 5bab1d62d3..e6819992cf 100644
--- a/rbutil/rbutilqt/base/autodetection.cpp
+++ b/rbutil/rbutilqt/base/autodetection.cpp
@@ -52,7 +52,7 @@
#include <sys/mount.h>
#endif
-#include "detect.h"
+#include "system.h"
#include "utils.h"
Autodetection::Autodetection(QObject* parent): QObject(parent)
@@ -404,7 +404,7 @@ bool Autodetection::detectUsb()
// usb pid detection
QList<uint32_t> attached;
- attached = Detect::listUsbIds();
+ attached = System::listUsbIds();
int i = attached.size();
while(i--) {
diff --git a/rbutil/rbutilqt/base/detect.cpp b/rbutil/rbutilqt/base/system.cpp
index 3b8547bdaf..054f1c59ef 100644
--- a/rbutil/rbutilqt/base/detect.cpp
+++ b/rbutil/rbutilqt/base/system.cpp
@@ -18,7 +18,7 @@
****************************************************************************/
-#include "detect.h"
+#include "system.h"
#include <QtCore>
#include <QDebug>
@@ -69,7 +69,7 @@
* @return enum userlevel.
*/
#if defined(Q_OS_WIN32)
-enum Detect::userlevel Detect::userPermissions(void)
+enum System::userlevel System::userPermissions(void)
{
LPUSER_INFO_1 buf;
NET_API_STATUS napistatus;
@@ -106,7 +106,7 @@ enum Detect::userlevel Detect::userPermissions(void)
/** @brief detects user permissions (only Windows at moment).
* @return a user readable string with the permission.
*/
-QString Detect::userPermissionsString(void)
+QString System::userPermissionsString(void)
{
QString result;
int perm = userPermissions();
@@ -132,7 +132,7 @@ QString Detect::userPermissionsString(void)
/** @brief detects current Username.
* @return string with Username.
*/
-QString Detect::userName(void)
+QString System::userName(void)
{
#if defined(Q_OS_WIN32)
wchar_t userbuf[UNLEN];
@@ -154,7 +154,7 @@ QString Detect::userName(void)
/** @brief detects the OS Version
* @return String with OS Version.
*/
-QString Detect::osVersionString(void)
+QString System::osVersionString(void)
{
QString result;
#if defined(Q_OS_WIN32)
@@ -182,7 +182,7 @@ QString Detect::osVersionString(void)
return result;
}
-QList<uint32_t> Detect::listUsbIds(void)
+QList<uint32_t> System::listUsbIds(void)
{
return listUsbDevices().keys();
}
@@ -190,11 +190,11 @@ QList<uint32_t> Detect::listUsbIds(void)
/** @brief detect devices based on usb pid / vid.
* @return list with usb VID / PID values.
*/
-QMap<uint32_t, QString> Detect::listUsbDevices(void)
+QMap<uint32_t, QString> System::listUsbDevices(void)
{
QMap<uint32_t, QString> usbids;
// usb pid detection
- qDebug() << "[Detect] Searching for USB devices";
+ qDebug() << "[System] Searching for USB devices";
#if defined(Q_OS_LINUX) || defined(Q_OS_MACX)
#if defined(LIBUSB1)
libusb_device **devs;
@@ -225,7 +225,7 @@ QMap<uint32_t, QString> Detect::listUsbDevices(void)
name = QObject::tr("(no description available)");
if(id) {
usbids.insert(id, name);
- qDebug("[Detect] USB: 0x%08x, %s", id, name.toLocal8Bit().data());
+ qDebug("[System] USB: 0x%08x, %s", id, name.toLocal8Bit().data());
}
}
}
@@ -271,7 +271,7 @@ QMap<uint32_t, QString> Detect::listUsbDevices(void)
if(id) {
usbids.insert(id, name);
- qDebug() << "[Detect] USB:" << QString("0x%1").arg(id, 8, 16) << name;
+ qDebug() << "[System] USB:" << QString("0x%1").arg(id, 8, 16) << name;
}
u = u->next;
}
@@ -346,7 +346,7 @@ QMap<uint32_t, QString> Detect::listUsbDevices(void)
uint32_t id;
id = vid << 16 | pid;
usbids.insert(id, description);
- qDebug("[Detect] USB VID: %04x, PID: %04x", vid, pid);
+ qDebug("[System] USB VID: %04x, PID: %04x", vid, pid);
}
if(buffer) free(buffer);
}
@@ -360,7 +360,7 @@ QMap<uint32_t, QString> Detect::listUsbDevices(void)
/** @brief detects current system proxy
* @return QUrl with proxy or empty
*/
-QUrl Detect::systemProxy(void)
+QUrl System::systemProxy(void)
{
#if defined(Q_OS_LINUX)
return QUrl(getenv("http_proxy"));
@@ -396,43 +396,3 @@ QUrl Detect::systemProxy(void)
}
-/** @brief checks different Enviroment things. Ask if user wants to continue.
- * @param settings A pointer to rbutils settings class
- * @param permission if it should check for permission
- * @param targetId the targetID to check for. if it is -1 no check is done.
- * @return string with error messages if problems occurred, empty strings if none.
- */
-QString Detect::check(bool permission)
-{
- QString text = "";
-
- // check permission
- if(permission)
- {
-#if defined(Q_OS_WIN32)
- if(Detect::userPermissions() != Detect::ADMIN)
- {
- text += QObject::tr("<li>Permissions insufficient for bootloader "
- "installation.\nAdministrator priviledges are necessary.</li>");
- }
-#endif
- }
-
- // Check TargetId
- RockboxInfo rbinfo(RbSettings::value(RbSettings::Mountpoint).toString());
- QString installed = rbinfo.target();
- if(!installed.isEmpty() && installed != RbSettings::value(RbSettings::CurConfigureModel).toString())
- {
- text += QObject::tr("<li>Target mismatch detected.\n"
- "Installed target: %1, selected target: %2.</li>")
- .arg(installed, RbSettings::value(RbSettings::CurPlatformName).toString());
- // FIXME: replace installed by human-friendly name
- }
-
- if(!text.isEmpty())
- return QObject::tr("Problem detected:") + "<ul>" + text + "</ul>";
- else
- return text;
-}
-
-
diff --git a/rbutil/rbutilqt/base/detect.h b/rbutil/rbutilqt/base/system.h
index fe4b01f1a1..25c404e37c 100644
--- a/rbutil/rbutilqt/base/detect.h
+++ b/rbutil/rbutilqt/base/system.h
@@ -20,18 +20,18 @@
****************************************************************************/
-#ifndef DETECT_H
-#define DETECT_H
+#ifndef SYSTEM_H
+#define SYSTEM_H
#include <inttypes.h>
#include <QString>
#include <QUrl>
-class Detect
+class System
{
public:
- Detect() {}
+ System() {}
#if defined(Q_OS_WIN32)
enum userlevel { ERR, GUEST, USER, ADMIN };
@@ -46,8 +46,6 @@ public:
static QUrl systemProxy(void);
- static QString check(bool permission);
-
};
#endif
diff --git a/rbutil/rbutilqt/base/utils.cpp b/rbutil/rbutilqt/base/utils.cpp
index a1b6e2bd0e..8b5127efbf 100644
--- a/rbutil/rbutilqt/base/utils.cpp
+++ b/rbutil/rbutilqt/base/utils.cpp
@@ -18,6 +18,9 @@
****************************************************************************/
#include "utils.h"
+#include "system.h"
+#include "rbsettings.h"
+
#ifdef UNICODE
#define _UNICODE
#endif
@@ -159,6 +162,46 @@ QString findExecutable(QString name)
}
+/** @brief checks different Enviroment things. Ask if user wants to continue.
+ * @param settings A pointer to rbutils settings class
+ * @param permission if it should check for permission
+ * @param targetId the targetID to check for. if it is -1 no check is done.
+ * @return string with error messages if problems occurred, empty strings if none.
+ */
+QString check(bool permission)
+{
+ QString text = "";
+
+ // check permission
+ if(permission)
+ {
+#if defined(Q_OS_WIN32)
+ if(Detect::userPermissions() != Detect::ADMIN)
+ {
+ text += QObject::tr("<li>Permissions insufficient for bootloader "
+ "installation.\nAdministrator priviledges are necessary.</li>");
+ }
+#endif
+ }
+
+ // Check TargetId
+ RockboxInfo rbinfo(RbSettings::value(RbSettings::Mountpoint).toString());
+ QString installed = rbinfo.target();
+ if(!installed.isEmpty() && installed != RbSettings::value(RbSettings::CurConfigureModel).toString())
+ {
+ text += QObject::tr("<li>Target mismatch detected.\n"
+ "Installed target: %1, selected target: %2.</li>")
+ .arg(installed, RbSettings::value(RbSettings::CurPlatformName).toString());
+ // FIXME: replace installed by human-friendly name
+ }
+
+ if(!text.isEmpty())
+ return QObject::tr("Problem detected:") + "<ul>" + text + "</ul>";
+ else
+ return text;
+}
+
+
RockboxInfo::RockboxInfo(QString mountpoint)
{
qDebug() << "[RockboxInfo] trying to find rockbox-info at" << mountpoint;
diff --git a/rbutil/rbutilqt/base/utils.h b/rbutil/rbutilqt/base/utils.h
index 9113eba7df..ef7d30ec90 100644
--- a/rbutil/rbutilqt/base/utils.h
+++ b/rbutil/rbutilqt/base/utils.h
@@ -30,6 +30,7 @@ bool recRmdir( const QString &dirName );
QString resolvePathCase(QString path);
qulonglong filesystemFree(QString path);
QString findExecutable(QString name);
+QString check(bool permission);
class RockboxInfo
{
diff --git a/rbutil/rbutilqt/configure.cpp b/rbutil/rbutilqt/configure.cpp
index e32cccb00f..23d275dd6e 100644
--- a/rbutil/rbutilqt/configure.cpp
+++ b/rbutil/rbutilqt/configure.cpp
@@ -26,7 +26,7 @@
#include "browsedirtree.h"
#include "encoders.h"
#include "tts.h"
-#include "detect.h"
+#include "system.h"
#include "encttscfggui.h"
#include "rbsettings.h"
#include "utils.h"
@@ -420,7 +420,7 @@ void Config::setSystemProxy(bool checked)
proxy.setHost(ui.proxyHost->text());
proxy.setPort(ui.proxyPort->text().toInt());
// show system values in input box
- QUrl envproxy = Detect::systemProxy();
+ QUrl envproxy = System::systemProxy();
ui.proxyHost->setText(envproxy.host());
diff --git a/rbutil/rbutilqt/install.cpp b/rbutil/rbutilqt/install.cpp
index 34a4da17e4..8deaf95c29 100644
--- a/rbutil/rbutilqt/install.cpp
+++ b/rbutil/rbutilqt/install.cpp
@@ -20,7 +20,7 @@
#include "install.h"
#include "ui_installfrm.h"
#include "rbzip.h"
-#include "detect.h"
+#include "system.h"
#include "rbsettings.h"
#include "utils.h"
@@ -130,7 +130,7 @@ void Install::accept()
RbSettings::sync();
- QString warning = Detect::check(false);
+ QString warning = check(false);
if(!warning.isEmpty())
{
if(QMessageBox::warning(this, tr("Really continue?"), warning,
diff --git a/rbutil/rbutilqt/rbutilqt.cpp b/rbutil/rbutilqt/rbutilqt.cpp
index f7ddb37e4c..dff0395bc1 100644
--- a/rbutil/rbutilqt/rbutilqt.cpp
+++ b/rbutil/rbutilqt/rbutilqt.cpp
@@ -33,7 +33,7 @@
#include "utils.h"
#include "rbzip.h"
#include "sysinfo.h"
-#include "detect.h"
+#include "system.h"
#include "rbsettings.h"
#include "progressloggerinterface.h"
@@ -308,7 +308,7 @@ void RbUtilQt::updateSettings()
updateDevice();
updateManual();
if(RbSettings::value(RbSettings::ProxyType) == "system") {
- HttpGet::setGlobalProxy(Detect::systemProxy());
+ HttpGet::setGlobalProxy(System::systemProxy());
}
else if(RbSettings::value(RbSettings::ProxyType) == "manual") {
HttpGet::setGlobalProxy(RbSettings::value(RbSettings::Proxy).toString());
@@ -526,7 +526,7 @@ bool RbUtilQt::installAuto()
buildInfo.close();
// check installed Version and Target
- QString warning = Detect::check(false);
+ QString warning = check(false);
if(!warning.isEmpty())
{
if(QMessageBox::warning(this, tr("Really continue?"), warning,
@@ -1181,7 +1181,7 @@ QUrl RbUtilQt::proxy()
if(RbSettings::value(RbSettings::ProxyType) == "manual")
return QUrl(RbSettings::value(RbSettings::Proxy).toString());
else if(RbSettings::value(RbSettings::ProxyType) == "system")
- return Detect::systemProxy();
+ return System::systemProxy();
return QUrl("");
}
diff --git a/rbutil/rbutilqt/rbutilqt.pro b/rbutil/rbutilqt/rbutilqt.pro
index 998bffc8ad..31b07bf068 100644
--- a/rbutil/rbutilqt/rbutilqt.pro
+++ b/rbutil/rbutilqt/rbutilqt.pro
@@ -75,7 +75,7 @@ SOURCES += rbutilqt.cpp \
base/rbsettings.cpp \
base/rbunzip.cpp \
base/rbzip.cpp \
- base/detect.cpp \
+ base/system.cpp \
sysinfo.cpp \
base/bootloaderinstallbase.cpp \
base/bootloaderinstallmi4.cpp \
@@ -129,7 +129,7 @@ HEADERS += rbutilqt.h \
base/rbunzip.h \
base/rbzip.h \
sysinfo.h \
- base/detect.h \
+ base/system.h \
base/bootloaderinstallbase.h \
base/bootloaderinstallmi4.h \
base/bootloaderinstallhex.h \
diff --git a/rbutil/rbutilqt/sysinfo.cpp b/rbutil/rbutilqt/sysinfo.cpp
index f5c0e47eeb..ca34b4b063 100644
--- a/rbutil/rbutilqt/sysinfo.cpp
+++ b/rbutil/rbutilqt/sysinfo.cpp
@@ -20,7 +20,7 @@
#include <QtGui>
#include "sysinfo.h"
#include "ui_sysinfofrm.h"
-#include "detect.h"
+#include "system.h"
#include "utils.h"
#include "autodetection.h"
@@ -38,13 +38,13 @@ Sysinfo::Sysinfo(QWidget *parent) : QDialog(parent)
void Sysinfo::updateSysinfo(void)
{
QString info;
- info += tr("<b>OS</b><br/>") + Detect::osVersionString() + "<hr/>";
- info += tr("<b>Username</b><br/>%1<hr/>").arg(Detect::userName());
+ info += tr("<b>OS</b><br/>") + System::osVersionString() + "<hr/>";
+ info += tr("<b>Username</b><br/>%1<hr/>").arg(System::userName());
#if defined(Q_OS_WIN32)
- info += tr("<b>Permissions</b><br/>%1<hr/>").arg(Detect::userPermissionsString());
+ info += tr("<b>Permissions</b><br/>%1<hr/>").arg(System::userPermissionsString());
#endif
info += tr("<b>Attached USB devices</b><br/>");
- QMap<uint32_t, QString> usbids = Detect::listUsbDevices();
+ QMap<uint32_t, QString> usbids = System::listUsbDevices();
QList<uint32_t> usbkeys = usbids.keys();
for(int i = 0; i < usbkeys.size(); i++) {
info += tr("VID: %1 PID: %2, %3")