summaryrefslogtreecommitdiffstats
path: root/rbutil/rbutilqt/base/utils.cpp
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2009-08-10 19:46:51 +0000
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2009-08-10 19:46:51 +0000
commite2f508691646935685c122af36a9bbce0cc7ba3c (patch)
treebff48ae9049fb6497172e4dabeabd9c36df802d5 /rbutil/rbutilqt/base/utils.cpp
parent84ced00bbd1b86585de508176fa63f09a2faf79b (diff)
downloadrockbox-e2f508691646935685c122af36a9bbce0cc7ba3c.tar.gz
rockbox-e2f508691646935685c122af36a9bbce0cc7ba3c.tar.bz2
rockbox-e2f508691646935685c122af36a9bbce0cc7ba3c.zip
Clean up and rename Detect class.
Move check() function out of the Detect class and place it into utils.cpp for now. Rename Detect class to System, as it now only retrieves data about the underlying system and doesn't detect anything anymore. Cleans up with the confusion between Detect and Autodetection. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22238 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil/rbutilqt/base/utils.cpp')
-rw-r--r--rbutil/rbutilqt/base/utils.cpp43
1 files changed, 43 insertions, 0 deletions
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;