1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Dominik Riebeling 2009-08-10 19:46:51 +00:00
parent 84ced00bbd
commit e2f5086916
10 changed files with 77 additions and 75 deletions

View file

@ -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;