rbutil: split RbSettings. use Stable/unstable status from server.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24331 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Dominik Wenger 2010-01-24 21:12:11 +00:00
parent 7fe60537d4
commit 6128bd14e9
18 changed files with 620 additions and 409 deletions

View file

@ -20,6 +20,7 @@
#include <QtCore> #include <QtCore>
#include "autodetection.h" #include "autodetection.h"
#include "rbsettings.h" #include "rbsettings.h"
#include "systeminfo.h"
#include "../ipodpatcher/ipodpatcher.h" #include "../ipodpatcher/ipodpatcher.h"
#include "../sansapatcher/sansapatcher.h" #include "../sansapatcher/sansapatcher.h"
@ -384,9 +385,9 @@ bool Autodetection::detectUsb()
// usbids holds the mapping in the form // usbids holds the mapping in the form
// ((VID<<16)|(PID)), targetname // ((VID<<16)|(PID)), targetname
// the ini file needs to hold the IDs as hex values. // the ini file needs to hold the IDs as hex values.
QMap<int, QString> usbids = RbSettings::usbIdMap(RbSettings::MapDevice); QMap<int, QString> usbids = SystemInfo::usbIdMap(SystemInfo::MapDevice);
QMap<int, QString> usberror = RbSettings::usbIdMap(RbSettings::MapError); QMap<int, QString> usberror = SystemInfo::usbIdMap(SystemInfo::MapError);
QMap<int, QString> usbincompat = RbSettings::usbIdMap(RbSettings::MapIncompatible); QMap<int, QString> usbincompat = SystemInfo::usbIdMap(SystemInfo::MapIncompatible);
// usb pid detection // usb pid detection
QList<uint32_t> attached; QList<uint32_t> attached;
@ -405,7 +406,7 @@ bool Autodetection::detectUsb()
return true; return true;
} }
QString idstring = QString("%1").arg(attached.at(i), 8, 16, QChar('0')); QString idstring = QString("%1").arg(attached.at(i), 8, 16, QChar('0'));
if(!RbSettings::platformValue(idstring, RbSettings::CurName).toString().isEmpty()) { if(!SystemInfo::platformValue(idstring, SystemInfo::CurName).toString().isEmpty()) {
m_incompat = idstring; m_incompat = idstring;
qDebug() << "[USB] detected incompatible player" << m_incompat; qDebug() << "[USB] detected incompatible player" << m_incompat;
return true; return true;

View file

@ -18,46 +18,13 @@
****************************************************************************/ ****************************************************************************/
#include "rbsettings.h" #include "rbsettings.h"
#include "systeminfo.h"
#include <QSettings> #include <QSettings>
#if defined(Q_OS_LINUX) #if defined(Q_OS_LINUX)
#include <unistd.h> #include <unistd.h>
#endif #endif
// device settings
const static struct {
RbSettings::SystemSettings setting;
const char* name;
const char* def;
} SystemSettingsList[] = {
{ RbSettings::ManualUrl, "manual_url", "" },
{ RbSettings::BleedingUrl, "bleeding_url", "" },
{ RbSettings::BootloaderUrl, "bootloader_url", "" },
{ RbSettings::BootloaderInfoUrl, "bootloader_info_url", "" },
{ RbSettings::FontUrl, "font_url", "" },
{ RbSettings::VoiceUrl, "voice_url", "" },
{ RbSettings::DoomUrl, "doom_url", "" },
{ RbSettings::ReleaseUrl, "release_url", "" },
{ RbSettings::DailyUrl, "daily_url", "" },
{ RbSettings::ServerConfUrl, "server_conf_url", "" },
{ RbSettings::GenlangUrl, "genlang_url", "" },
{ RbSettings::ThemesUrl, "themes_url", "" },
{ RbSettings::RbutilUrl, "rbutil_url", "" },
{ RbSettings::BleedingInfo, "bleeding_info", "" },
{ RbSettings::CurPlatformName, ":platform:/name", "" },
{ RbSettings::CurManual, ":platform:/manualname","rockbox-:platform:" },
{ RbSettings::CurBootloaderMethod, ":platform:/bootloadermethod", "none" },
{ RbSettings::CurBootloaderName, ":platform:/bootloadername", "" },
{ RbSettings::CurBootloaderFile, ":platform:/bootloaderfile", "" },
{ RbSettings::CurEncoder, ":platform:/encoder", "" },
{ RbSettings::CurBrand, ":platform:/brand", "" },
{ RbSettings::CurName, ":platform:/name", "" },
{ RbSettings::CurBuildserverModel, ":platform:/buildserver_modelname", "" },
{ RbSettings::CurConfigureModel, ":platform:/configure_modelname", "" },
};
// user settings // user settings
const static struct { const static struct {
RbSettings::UserSettings setting; RbSettings::UserSettings setting;
@ -94,35 +61,11 @@ const static struct {
{ RbSettings::EncoderVolume, ":encoder:/volume", "1.0" }, { RbSettings::EncoderVolume, ":encoder:/volume", "1.0" },
}; };
// server settings
const static struct {
RbSettings::ServerSettings setting;
const char* name;
const char* def;
} ServerSettingsList[] = {
{ RbSettings::CurReleaseVersion, ":platform:/releaseversion", "" },
{ RbSettings::CurStatus, ":platform:/status", "" },
{ RbSettings::DailyRevision, "dailyrev", "" },
{ RbSettings::DailyDate, "dailydate", "" },
{ RbSettings::BleedingRevision, "bleedingrev", "" },
{ RbSettings::BleedingDate, "bleedingdate", "" },
};
//! pointer to setting object to NULL //! pointer to setting object to NULL
QSettings* RbSettings::systemSettings = NULL;
QSettings* RbSettings::userSettings = NULL; QSettings* RbSettings::userSettings = NULL;
//! global volatile settings
QMap<QString, QVariant> RbSettings::serverSettings;
void RbSettings::ensureRbSettingsExists() void RbSettings::ensureRbSettingsExists()
{ {
//check and create settings object
if(systemSettings == NULL)
{
// only use built-in rbutil.ini
systemSettings = new QSettings(":/ini/rbutil.ini", QSettings::IniFormat, 0);
}
if(userSettings == NULL) if(userSettings == NULL)
{ {
// portable installation: // portable installation:
@ -180,22 +123,6 @@ QString RbSettings::userSettingFilename()
return userSettings->fileName(); return userSettings->fileName();
} }
QVariant RbSettings::value(enum SystemSettings setting)
{
ensureRbSettingsExists();
// locate setting item
int i = 0;
while(SystemSettingsList[i].setting != setting)
i++;
QString s = constructSettingPath(SystemSettingsList[i].name);
QString d = SystemSettingsList[i].def;
d.replace(":platform:", userSettings->value("platform").toString());
qDebug() << "[Settings] GET S:" << s << systemSettings->value(s, d).toString();
return systemSettings->value(s, d);
}
QVariant RbSettings::value(enum UserSettings setting) QVariant RbSettings::value(enum UserSettings setting)
{ {
QString empty; QString empty;
@ -216,24 +143,6 @@ QVariant RbSettings::subValue(QString sub, enum UserSettings setting)
return userSettings->value(s, UserSettingsList[i].def); return userSettings->value(s, UserSettingsList[i].def);
} }
QVariant RbSettings::value(enum ServerSettings setting)
{
ensureRbSettingsExists();
// locate setting item
int i = 0;
while(ServerSettingsList[i].setting != setting)
i++;
QString s = constructSettingPath(ServerSettingsList[i].name);
qDebug() << "[Settings] GET SERV:" << s
<< serverSettings.value(s, ServerSettingsList[i].def).toString();
if(serverSettings.contains(s))
return serverSettings.value(s);
else
return ServerSettingsList[i].def;
}
void RbSettings::setValue(enum UserSettings setting , QVariant value) void RbSettings::setValue(enum UserSettings setting , QVariant value)
{ {
QString empty; QString empty;
@ -254,133 +163,6 @@ void RbSettings::setSubValue(QString sub, enum UserSettings setting, QVariant va
qDebug() << "[Settings] SET U:" << s << userSettings->value(s).toString(); qDebug() << "[Settings] SET U:" << s << userSettings->value(s).toString();
} }
void RbSettings::setValue(enum ServerSettings setting, QVariant value)
{
QString empty;
return setPlatformValue(empty, setting, value);
}
void RbSettings::setPlatformValue(QString platform, enum ServerSettings setting, QVariant value)
{
ensureRbSettingsExists();
// locate setting item
int i = 0;
while(ServerSettingsList[i].setting != setting)
i++;
QString s = ServerSettingsList[i].name;
s.replace(":platform:", platform);
serverSettings.insert(s, value);
qDebug() << "[Settings] SET SERV:" << s << serverSettings.value(s).toString();
}
QVariant RbSettings::platformValue(QString platform, enum SystemSettings setting)
{
ensureRbSettingsExists();
// locate setting item
int i = 0;
while(SystemSettingsList[i].setting != setting)
i++;
QString s = SystemSettingsList[i].name;
s.replace(":platform:", platform);
QString d = SystemSettingsList[i].def;
d.replace(":platform:", platform);
qDebug() << "[Settings] GET P:" << s << systemSettings->value(s, d).toString();
return systemSettings->value(s, d);
}
QStringList RbSettings::platforms()
{
ensureRbSettingsExists();
QStringList result;
systemSettings->beginGroup("platforms");
QStringList a = systemSettings->childKeys();
systemSettings->endGroup();
for(int i = 0; i < a.size(); i++)
{
//only add not disabled targets
QString target = systemSettings->value("platforms/"+a.at(i), "null").toString();
if(systemSettings->value(target+"/status").toString() != "disabled")
result.append(target);
}
return result;
}
QStringList RbSettings::languages()
{
ensureRbSettingsExists();
QStringList result;
systemSettings->beginGroup("languages");
QStringList a = systemSettings->childKeys();
for(int i = 0; i < a.size(); i++)
{
result.append(systemSettings->value(a.at(i), "null").toString());
}
systemSettings->endGroup();
return result;
}
QString RbSettings::name(QString platform)
{
ensureRbSettingsExists();
return systemSettings->value(platform + "/name").toString();
}
QString RbSettings::brand(QString platform)
{
ensureRbSettingsExists();
return systemSettings->value(platform + "/brand").toString();
}
QMap<int, QString> RbSettings::usbIdMap(enum MapType type)
{
ensureRbSettingsExists();
QMap<int, QString> map;
// get a list of ID -> target name
QStringList platforms;
systemSettings->beginGroup("platforms");
platforms = systemSettings->childKeys();
systemSettings->endGroup();
QString t;
switch(type) {
case MapDevice:
t = "usbid";
break;
case MapError:
t = "usberror";
break;
case MapIncompatible:
t = "usbincompat";
break;
}
for(int i = 0; i < platforms.size(); i++)
{
systemSettings->beginGroup("platforms");
QString target = systemSettings->value(platforms.at(i)).toString();
systemSettings->endGroup();
systemSettings->beginGroup(target);
QStringList ids = systemSettings->value(t).toStringList();
int j = ids.size();
while(j--)
map.insert(ids.at(j).toInt(0, 16), target);
systemSettings->endGroup();
}
return map;
}
QString RbSettings::constructSettingPath(QString path, QString substitute) QString RbSettings::constructSettingPath(QString path, QString substitute)
{ {
QString platform = userSettings->value("platform").toString(); QString platform = userSettings->value("platform").toString();
@ -390,7 +172,7 @@ QString RbSettings::constructSettingPath(QString path, QString substitute)
} }
else { else {
path.replace(":tts:", userSettings->value("tts").toString()); path.replace(":tts:", userSettings->value("tts").toString());
path.replace(":encoder:", systemSettings->value(platform + "/encoder").toString()); path.replace(":encoder:", SystemInfo::platformValue(platform,SystemInfo::CurEncoder).toString());
} }
path.replace(":platform:", platform); path.replace(":platform:", platform);

View file

@ -24,18 +24,10 @@
#include <QtCore> #include <QtCore>
class QSettings;
class RbSettings : public QObject class RbSettings : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
//! Type of requested usb-id map
enum MapType {
MapDevice,
MapError,
MapIncompatible,
};
//! All user settings //! All user settings
enum UserSettings { enum UserSettings {
@ -68,77 +60,19 @@ class RbSettings : public QObject
EncoderQuality, EncoderQuality,
EncoderVolume, EncoderVolume,
}; };
//! All system settings
enum SystemSettings {
ManualUrl,
BleedingUrl,
BootloaderUrl,
BootloaderInfoUrl,
FontUrl,
VoiceUrl,
DoomUrl,
ReleaseUrl,
DailyUrl,
ServerConfUrl,
GenlangUrl,
ThemesUrl,
RbutilUrl,
BleedingInfo,
CurPlatformName,
CurManual,
CurBootloaderMethod,
CurBootloaderName,
CurBootloaderFile,
CurEncoder,
CurBrand,
CurName,
CurBuildserverModel,
CurConfigureModel,
};
//! All Server settings
enum ServerSettings {
CurReleaseVersion,
CurStatus,
DailyRevision,
DailyDate,
BleedingRevision,
BleedingDate,
};
//! call this to flush the user Settings //! call this to flush the user Settings
static void sync(); static void sync();
//! returns the filename of the usersettings file //! returns the filename of the usersettings file
static QString userSettingFilename(); static QString userSettingFilename();
//! return a list of all platforms (rbutil internal names)
static QStringList platforms(void);
//! returns a list of all languages
static QStringList languages(void);
//! maps a platform to its name
static QString name(QString plattform);
//! maps a platform to its brand
static QString brand(QString plattform);
//! returns a map of usb-ids and their targets
static QMap<int, QString> usbIdMap(enum MapType);
//! get a value from system settings
static QVariant value(enum SystemSettings setting);
//! get a value from user settings //! get a value from user settings
static QVariant value(enum UserSettings setting); static QVariant value(enum UserSettings setting);
//! get a value from server settings
static QVariant value(enum ServerSettings setting);
//! set a user setting value //! set a user setting value
static void setValue(enum UserSettings setting , QVariant value); static void setValue(enum UserSettings setting , QVariant value);
//! set a server setting value
static void setValue(enum ServerSettings setting , QVariant value);
//! get a user setting from a subvalue (ie for encoders and tts engines) //! get a user setting from a subvalue (ie for encoders and tts engines)
static QVariant subValue(QString sub, enum UserSettings setting); static QVariant subValue(QString sub, enum UserSettings setting);
//! set a user setting from a subvalue (ie for encoders and tts engines) //! set a user setting from a subvalue (ie for encoders and tts engines)
static void setSubValue(QString sub, enum UserSettings setting, QVariant value); static void setSubValue(QString sub, enum UserSettings setting, QVariant value);
//! set a value for a server settings for a named platform.
static void setPlatformValue(QString platform, enum ServerSettings setting, QVariant value);
//! get a value from system settings for a named platform.
static QVariant platformValue(QString platform, enum SystemSettings setting);
private: private:
//! you shouldnt call this, its a fully static calls //! you shouldnt call this, its a fully static calls
@ -148,11 +82,8 @@ class RbSettings : public QObject
//! create a settings path, substitute platform, tts and encoder //! create a settings path, substitute platform, tts and encoder
static QString constructSettingPath(QString path, QString substitute = QString()); static QString constructSettingPath(QString path, QString substitute = QString());
//! pointers to our setting objects //! pointers to our setting object
static QSettings *systemSettings;
static QSettings *userSettings; static QSettings *userSettings;
//! global volatile settings
static QMap<QString, QVariant> serverSettings;
}; };
#endif #endif

View file

@ -0,0 +1,149 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
*
* Copyright (C) 2010 by Dominik Wenger
* $Id$
*
* All files in this archive are subject to the GNU General Public License.
* See the file COPYING in the source tree root for full license agreement.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#include "serverinfo.h"
#include "rbsettings.h"
#include "systeminfo.h"
#if defined(Q_OS_LINUX)
#include <unistd.h>
#endif
// server infos
const static struct {
ServerInfo::ServerInfos info;
const char* name;
const char* def;
} ServerInfoList[] = {
{ ServerInfo::CurReleaseVersion, ":platform:/releaseversion", "" },
{ ServerInfo::CurStatus, ":platform:/status", "Unknown" },
{ ServerInfo::DailyRevision, "dailyrev", "" },
{ ServerInfo::DailyDate, "dailydate", "" },
{ ServerInfo::BleedingRevision, "bleedingrev", "" },
{ ServerInfo::BleedingDate, "bleedingdate", "" },
};
QMap<QString, QVariant> ServerInfo::serverInfos;
void ServerInfo::readBuildInfo(QString file)
{
QSettings info(file, QSettings::IniFormat);
setValue(ServerInfo::DailyRevision,info.value("dailies/rev"));
QDate date = QDate::fromString(info.value("dailies/date").toString(), "yyyyMMdd");
setValue(ServerInfo::DailyDate,date.toString(Qt::ISODate));
info.beginGroup("release");
QStringList keys = info.allKeys();
for(int i=0; i < keys.size(); i++)
{
setAllConfigPlatformValue(keys[i],ServerInfo::CurReleaseVersion,info.value(keys[i]));
}
info.endGroup();
info.beginGroup("status");
keys = info.allKeys();
for(int i=0; i < keys.size(); i++)
{
switch(info.value(keys[i]).toInt())
{
case 1:
ServerInfo::setAllConfigPlatformValue(keys[i],ServerInfo::CurStatus,tr("Unusable"));
break;
case 2:
ServerInfo::setAllConfigPlatformValue(keys[i],ServerInfo::CurStatus,tr("Unstable"));
break;
case 3:
ServerInfo::setAllConfigPlatformValue(keys[i],ServerInfo::CurStatus,tr("Stable"));
break;
default:
ServerInfo::setAllConfigPlatformValue(keys[i],ServerInfo::CurStatus,tr("Unknown"));
break;
}
}
info.endGroup();
}
void ServerInfo::readBleedingInfo(QString file)
{
QSettings info(file, QSettings::IniFormat);
setValue(ServerInfo::BleedingRevision,info.value("bleeding/rev"));
QDateTime date = QDateTime::fromString(info.value("bleeding/timestamp").toString(), "yyyyMMddThhmmssZ");
setValue(ServerInfo::BleedingDate,date.toString(Qt::ISODate));
}
QVariant ServerInfo::value(enum ServerInfos info)
{
// locate info item
int i = 0;
while(ServerInfoList[i].info != info)
i++;
QString s = ServerInfoList[i].name;
s.replace(":platform:", RbSettings::value(RbSettings::CurrentPlatform).toString());
qDebug() << "[ServerIndo] GET:" << s << serverInfos.value(s, ServerInfoList[i].def).toString();
return serverInfos.value(s, ServerInfoList[i].def);
}
void ServerInfo::setValue(enum ServerInfos setting, QVariant value)
{
QString empty;
return setPlatformValue(empty, setting, value);
}
void ServerInfo::setPlatformValue(QString platform, enum ServerInfos info, QVariant value)
{
// locate setting item
int i = 0;
while(ServerInfoList[i].info != info)
i++;
QString s = ServerInfoList[i].name;
s.replace(":platform:", platform);
serverInfos.insert(s, value);
qDebug() << "[ServerInfo] SET:" << s << serverInfos.value(s).toString();
}
void ServerInfo::setAllConfigPlatformValue(QString configplatform, ServerInfos info, QVariant value)
{
// insert intp all platforms where configurename matches
QStringList platforms = SystemInfo::platforms();
for(int i =0; i < platforms.size(); i++)
{
if(SystemInfo::platformValue(platforms.at(i),SystemInfo::CurConfigureModel) == configplatform)
setPlatformValue(platforms.at(i),info,value);
}
}
QVariant ServerInfo::platformValue(QString platform, enum ServerInfos info)
{
// locate setting item
int i = 0;
while(ServerInfoList[i].info != info)
i++;
QString s = ServerInfoList[i].name;
s.replace(":platform:", platform);
QString d = ServerInfoList[i].def;
d.replace(":platform:", platform);
qDebug() << "[ServerInfo] GET" << s << serverInfos.value(s, d).toString();
return serverInfos.value(s, d);
}

View file

@ -0,0 +1,67 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
*
* Copyright (C) 2010 by Dominik Wenger
* $Id$
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#ifndef SERVERINFO_H
#define SERVERINFO_H
#include <QtCore>
class ServerInfo : public QObject
{
Q_OBJECT
public:
//! All Server infos
enum ServerInfos {
CurReleaseVersion,
CurStatus,
DailyRevision,
DailyDate,
BleedingRevision,
BleedingDate,
};
//! read in buildinfo file
static void readBuildInfo(QString file);
//! read in bleeding info file
static void readBleedingInfo(QString file);
//! get a value from server info
static QVariant value(enum ServerInfos setting);
//! get a value from server info for a named platform.
static QVariant platformValue(QString platform, enum ServerInfos setting);
private:
//! set a server info to all platforms where configurename matches
static void setAllConfigPlatformValue(QString configplatform,ServerInfos info, QVariant value);
//! set a server info value
static void setValue(enum ServerInfos setting , QVariant value);
//! set a value for a server info for a named platform.
static void setPlatformValue(QString platform, enum ServerInfos setting, QVariant value);
//! you shouldnt call this, its a fully static class
ServerInfo() {}
//! map of server infos
static QMap<QString, QVariant> serverInfos;
};
#endif

View file

@ -0,0 +1,196 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
*
* Copyright (C) 2010 by Dominik Wenger
* $Id$
*
* All files in this archive are subject to the GNU General Public License.
* See the file COPYING in the source tree root for full license agreement.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#include "systeminfo.h"
#include "rbsettings.h"
#include <QSettings>
#if defined(Q_OS_LINUX)
#include <unistd.h>
#endif
// device settings
const static struct {
SystemInfo::SystemInfos info;
const char* name;
const char* def;
} SystemInfosList[] = {
{ SystemInfo::ManualUrl, "manual_url", "" },
{ SystemInfo::BleedingUrl, "bleeding_url", "" },
{ SystemInfo::BootloaderUrl, "bootloader_url", "" },
{ SystemInfo::BootloaderInfoUrl, "bootloader_info_url", "" },
{ SystemInfo::FontUrl, "font_url", "" },
{ SystemInfo::VoiceUrl, "voice_url", "" },
{ SystemInfo::DoomUrl, "doom_url", "" },
{ SystemInfo::ReleaseUrl, "release_url", "" },
{ SystemInfo::DailyUrl, "daily_url", "" },
{ SystemInfo::ServerConfUrl, "server_conf_url", "" },
{ SystemInfo::GenlangUrl, "genlang_url", "" },
{ SystemInfo::ThemesUrl, "themes_url", "" },
{ SystemInfo::RbutilUrl, "rbutil_url", "" },
{ SystemInfo::BleedingInfo, "bleeding_info", "" },
{ SystemInfo::CurPlatformName, ":platform:/name", "" },
{ SystemInfo::CurManual, ":platform:/manualname","rockbox-:platform:" },
{ SystemInfo::CurBootloaderMethod, ":platform:/bootloadermethod", "none" },
{ SystemInfo::CurBootloaderName, ":platform:/bootloadername", "" },
{ SystemInfo::CurBootloaderFile, ":platform:/bootloaderfile", "" },
{ SystemInfo::CurEncoder, ":platform:/encoder", "" },
{ SystemInfo::CurBrand, ":platform:/brand", "" },
{ SystemInfo::CurName, ":platform:/name", "" },
{ SystemInfo::CurBuildserverModel, ":platform:/buildserver_modelname", "" },
{ SystemInfo::CurConfigureModel, ":platform:/configure_modelname", "" },
};
//! pointer to setting object to NULL
QSettings* SystemInfo::systemInfos = NULL;
void SystemInfo::ensureSystemInfoExists()
{
//check and create settings object
if(systemInfos == NULL)
{
// only use built-in rbutil.ini
systemInfos = new QSettings(":/ini/rbutil.ini", QSettings::IniFormat, 0);
}
}
QVariant SystemInfo::value(enum SystemInfos info)
{
ensureSystemInfoExists();
// locate setting item
int i = 0;
while(SystemInfosList[i].info != info)
i++;
QString s = SystemInfosList[i].name;
s.replace(":platform:", RbSettings::value(RbSettings::CurrentPlatform).toString());
QString d = SystemInfosList[i].def;
d.replace(":platform:", RbSettings::value(RbSettings::CurrentPlatform).toString());
qDebug() << "[SystemInfos] GET:" << s << systemInfos->value(s, d).toString();
return systemInfos->value(s, d);
}
QVariant SystemInfo::platformValue(QString platform, enum SystemInfos info)
{
ensureSystemInfoExists();
// locate setting item
int i = 0;
while(SystemInfosList[i].info != info)
i++;
QString s = SystemInfosList[i].name;
s.replace(":platform:", platform);
QString d = SystemInfosList[i].def;
d.replace(":platform:", platform);
qDebug() << "[SystemInfo] GET P:" << s << systemInfos->value(s, d).toString();
return systemInfos->value(s, d);
}
QStringList SystemInfo::platforms()
{
ensureSystemInfoExists();
QStringList result;
systemInfos->beginGroup("platforms");
QStringList a = systemInfos->childKeys();
systemInfos->endGroup();
for(int i = 0; i < a.size(); i++)
{
//only add not disabled targets
QString target = systemInfos->value("platforms/"+a.at(i), "null").toString();
if(systemInfos->value(target+"/status").toString() != "disabled")
result.append(target);
}
return result;
}
QStringList SystemInfo::languages()
{
ensureSystemInfoExists();
QStringList result;
systemInfos->beginGroup("languages");
QStringList a = systemInfos->childKeys();
for(int i = 0; i < a.size(); i++)
{
result.append(systemInfos->value(a.at(i), "null").toString());
}
systemInfos->endGroup();
return result;
}
QString SystemInfo::name(QString platform)
{
ensureSystemInfoExists();
return systemInfos->value(platform + "/name").toString();
}
QString SystemInfo::brand(QString platform)
{
ensureSystemInfoExists();
return systemInfos->value(platform + "/brand").toString();
}
QMap<int, QString> SystemInfo::usbIdMap(enum MapType type)
{
ensureSystemInfoExists();
QMap<int, QString> map;
// get a list of ID -> target name
QStringList platforms;
systemInfos->beginGroup("platforms");
platforms = systemInfos->childKeys();
systemInfos->endGroup();
QString t;
switch(type) {
case MapDevice:
t = "usbid";
break;
case MapError:
t = "usberror";
break;
case MapIncompatible:
t = "usbincompat";
break;
}
for(int i = 0; i < platforms.size(); i++)
{
systemInfos->beginGroup("platforms");
QString target = systemInfos->value(platforms.at(i)).toString();
systemInfos->endGroup();
systemInfos->beginGroup(target);
QStringList ids = systemInfos->value(t).toStringList();
int j = ids.size();
while(j--)
map.insert(ids.at(j).toInt(0, 16), target);
systemInfos->endGroup();
}
return map;
}

View file

@ -0,0 +1,91 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
*
* Copyright (C) 2010 by Dominik Wenger
* $Id$
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#ifndef SYSTEMINFO_H
#define SYSTEMINFO_H
#include <QtCore>
class SystemInfo : public QObject
{
Q_OBJECT
public:
//! Type of requested usb-id map
enum MapType {
MapDevice,
MapError,
MapIncompatible,
};
//! All system settings
enum SystemInfos {
ManualUrl,
BleedingUrl,
BootloaderUrl,
BootloaderInfoUrl,
FontUrl,
VoiceUrl,
DoomUrl,
ReleaseUrl,
DailyUrl,
ServerConfUrl,
GenlangUrl,
ThemesUrl,
RbutilUrl,
BleedingInfo,
CurPlatformName,
CurManual,
CurBootloaderMethod,
CurBootloaderName,
CurBootloaderFile,
CurEncoder,
CurBrand,
CurName,
CurBuildserverModel,
CurConfigureModel,
};
//! return a list of all platforms (rbutil internal names)
static QStringList platforms(void);
//! returns a list of all languages
static QStringList languages(void);
//! maps a platform to its name
static QString name(QString plattform);
//! maps a platform to its brand
static QString brand(QString plattform);
//! returns a map of usb-ids and their targets
static QMap<int, QString> usbIdMap(enum MapType);
//! get a value from system settings
static QVariant value(enum SystemInfos info);
//! get a value from system settings for a named platform.
static QVariant platformValue(QString platform, enum SystemInfos info);
private:
//! you shouldnt call this, its a fully static calls
SystemInfo() {}
//! create the setting objects if neccessary
static void ensureSystemInfoExists();
//! pointers to our setting objects
static QSettings *systemInfos;
};
#endif

View file

@ -19,6 +19,7 @@
#include "talkgenerator.h" #include "talkgenerator.h"
#include "rbsettings.h" #include "rbsettings.h"
#include "systeminfo.h"
#include "wavtrim.h" #include "wavtrim.h"
TalkGenerator::TalkGenerator(QObject* parent): QObject(parent) TalkGenerator::TalkGenerator(QObject* parent): QObject(parent)
@ -48,7 +49,7 @@ TalkGenerator::Status TalkGenerator::process(QList<TalkEntry>* list,int wavtrimt
// Encoder // Encoder
emit logItem(tr("Starting Encoder Engine"),LOGINFO); emit logItem(tr("Starting Encoder Engine"),LOGINFO);
m_enc = EncBase::getEncoder(this,RbSettings::value(RbSettings::CurEncoder).toString()); m_enc = EncBase::getEncoder(this,SystemInfo::value(SystemInfo::CurEncoder).toString());
if(!m_enc->start()) if(!m_enc->start())
{ {
emit logItem(tr("Init of Encoder engine failed"),LOGERROR); emit logItem(tr("Init of Encoder engine failed"),LOGERROR);

View file

@ -20,6 +20,7 @@
#include "ttssapi.h" #include "ttssapi.h"
#include "utils.h" #include "utils.h"
#include "rbsettings.h" #include "rbsettings.h"
#include "systeminfo.h"
TTSSapi::TTSSapi(QObject* parent) : TTSBase(parent) TTSSapi::TTSSapi(QObject* parent) : TTSBase(parent)
{ {
@ -31,7 +32,7 @@ TTSSapi::TTSSapi(QObject* parent) : TTSBase(parent)
void TTSSapi::generateSettings() void TTSSapi::generateSettings()
{ {
// language // language
QStringList languages = RbSettings::languages(); QStringList languages = SystemInfo::languages();
languages.sort(); languages.sort();
EncTtsSetting* setting =new EncTtsSetting(this,EncTtsSetting::eSTRINGLIST, EncTtsSetting* setting =new EncTtsSetting(this,EncTtsSetting::eSTRINGLIST,
tr("Language:"),RbSettings::subValue("sapi",RbSettings::TtsLanguage),languages); tr("Language:"),RbSettings::subValue("sapi",RbSettings::TtsLanguage),languages);

View file

@ -20,6 +20,7 @@
#include "utils.h" #include "utils.h"
#include "system.h" #include "system.h"
#include "rbsettings.h" #include "rbsettings.h"
#include "systeminfo.h"
#ifdef UNICODE #ifdef UNICODE
#define _UNICODE #define _UNICODE
@ -187,11 +188,11 @@ QString check(bool permission)
// Check TargetId // Check TargetId
RockboxInfo rbinfo(RbSettings::value(RbSettings::Mountpoint).toString()); RockboxInfo rbinfo(RbSettings::value(RbSettings::Mountpoint).toString());
QString installed = rbinfo.target(); QString installed = rbinfo.target();
if(!installed.isEmpty() && installed != RbSettings::value(RbSettings::CurConfigureModel).toString()) if(!installed.isEmpty() && installed != SystemInfo::value(SystemInfo::CurConfigureModel).toString())
{ {
text += QObject::tr("<li>Target mismatch detected.\n" text += QObject::tr("<li>Target mismatch detected.\n"
"Installed target: %1, selected target: %2.</li>") "Installed target: %1, selected target: %2.</li>")
.arg(installed, RbSettings::value(RbSettings::CurPlatformName).toString()); .arg(installed, SystemInfo::value(SystemInfo::CurPlatformName).toString());
// FIXME: replace installed by human-friendly name // FIXME: replace installed by human-friendly name
} }

View file

@ -20,6 +20,7 @@
#include "voicefile.h" #include "voicefile.h"
#include "utils.h" #include "utils.h"
#include "rbsettings.h" #include "rbsettings.h"
#include "systeminfo.h"
VoiceFileCreator::VoiceFileCreator(QObject* parent) :QObject(parent) VoiceFileCreator::VoiceFileCreator(QObject* parent) :QObject(parent)
{ {
@ -61,7 +62,7 @@ bool VoiceFileCreator::createVoiceFile()
version = version.left(version.indexOf("-")).remove("r"); version = version.left(version.indexOf("-")).remove("r");
//prepare download url //prepare download url
QUrl genlangUrl = RbSettings::value(RbSettings::GenlangUrl).toString() QUrl genlangUrl = SystemInfo::value(SystemInfo::GenlangUrl).toString()
+"?lang=" + m_lang + "&t=" + target + "&rev=" + version + "&f=" + features; +"?lang=" + m_lang + "&t=" + target + "&rev=" + version + "&f=" + features;
qDebug() << "downloading " << genlangUrl; qDebug() << "downloading " << genlangUrl;

View file

@ -29,6 +29,8 @@
#include "system.h" #include "system.h"
#include "encttscfggui.h" #include "encttscfggui.h"
#include "rbsettings.h" #include "rbsettings.h"
#include "serverinfo.h"
#include "systeminfo.h"
#include "utils.h" #include "utils.h"
#include <stdio.h> #include <stdio.h>
#if defined(Q_OS_WIN32) #if defined(Q_OS_WIN32)
@ -286,14 +288,15 @@ void Config::setDevices()
// setup devices table // setup devices table
qDebug() << "[Config] setting up devices list"; qDebug() << "[Config] setting up devices list";
QStringList platformList = RbSettings::platforms(); QStringList platformList = SystemInfo::platforms();
QMap <QString, QString> manuf; QMap <QString, QString> manuf;
QMap <QString, QString> devcs; QMap <QString, QString> devcs;
for(int it = 0; it < platformList.size(); it++) for(int it = 0; it < platformList.size(); it++)
{ {
QString curname = RbSettings::name(platformList.at(it)); QString curname = SystemInfo::name(platformList.at(it)) +
QString curbrand = RbSettings::brand(platformList.at(it)); " (" +ServerInfo::platformValue(platformList.at(it),ServerInfo::CurStatus).toString() + ")";
QString curbrand = SystemInfo::brand(platformList.at(it));
manuf.insertMulti(curbrand, platformList.at(it)); manuf.insertMulti(curbrand, platformList.at(it));
devcs.insert(platformList.at(it), curname); devcs.insert(platformList.at(it), curname);
} }
@ -321,8 +324,9 @@ void Config::setDevices()
// go through platforms again for sake of order // go through platforms again for sake of order
for(int it = 0; it < platformList.size(); it++) { for(int it = 0; it < platformList.size(); it++) {
QString curname = RbSettings::name(platformList.at(it)); QString curname = SystemInfo::name(platformList.at(it)) +
QString curbrand = RbSettings::brand(platformList.at(it)); " (" +ServerInfo::platformValue(platformList.at(it),ServerInfo::CurStatus).toString() +")";
QString curbrand = SystemInfo::brand(platformList.at(it));
if(curbrand != brands.at(c)) continue; if(curbrand != brands.at(c)) continue;
qDebug() << "[Config] add supported device:" << brands.at(c) << curname; qDebug() << "[Config] add supported device:" << brands.at(c) << curname;
@ -382,10 +386,10 @@ void Config::updateEncState()
return; return;
QString devname = ui.treeDevices->selectedItems().at(0)->data(0, Qt::UserRole).toString(); QString devname = ui.treeDevices->selectedItems().at(0)->data(0, Qt::UserRole).toString();
QString encoder = RbSettings::platformValue(devname, QString encoder = SystemInfo::platformValue(devname,
RbSettings::CurEncoder).toString(); SystemInfo::CurEncoder).toString();
ui.encoderName->setText(EncBase::getEncoderName(RbSettings::platformValue(devname, ui.encoderName->setText(EncBase::getEncoderName(SystemInfo::platformValue(devname,
RbSettings::CurEncoder).toString())); SystemInfo::CurEncoder).toString()));
EncBase* enc = EncBase::getEncoder(this,encoder); EncBase* enc = EncBase::getEncoder(this,encoder);
@ -601,8 +605,8 @@ void Config::autodetect()
QString text; QString text;
text = tr("Detected an unsupported player:\n%1\n" text = tr("Detected an unsupported player:\n%1\n"
"Sorry, Rockbox doesn't run on your player.") "Sorry, Rockbox doesn't run on your player.")
.arg(RbSettings::platformValue(detector.incompatdev(), .arg(SystemInfo::platformValue(detector.incompatdev(),
RbSettings::CurName).toString()); SystemInfo::CurName).toString());
QMessageBox::critical(this, tr("Fatal: player incompatible"), QMessageBox::critical(this, tr("Fatal: player incompatible"),
text, QMessageBox::Ok); text, QMessageBox::Ok);
@ -723,10 +727,10 @@ void Config::configEnc()
return; return;
QString devname = ui.treeDevices->selectedItems().at(0)->data(0, Qt::UserRole).toString(); QString devname = ui.treeDevices->selectedItems().at(0)->data(0, Qt::UserRole).toString();
QString encoder = RbSettings::platformValue(devname, QString encoder = SystemInfo::platformValue(devname,
RbSettings::CurEncoder).toString(); SystemInfo::CurEncoder).toString();
ui.encoderName->setText(EncBase::getEncoderName(RbSettings::platformValue(devname, ui.encoderName->setText(EncBase::getEncoderName(SystemInfo::platformValue(devname,
RbSettings::CurEncoder).toString())); SystemInfo::CurEncoder).toString()));
EncBase* enc = EncBase::getEncoder(this,encoder); EncBase* enc = EncBase::getEncoder(this,encoder);

View file

@ -23,6 +23,7 @@
#include "browsedirtree.h" #include "browsedirtree.h"
#include "configure.h" #include "configure.h"
#include "rbsettings.h" #include "rbsettings.h"
#include "systeminfo.h"
CreateVoiceWindow::CreateVoiceWindow(QWidget *parent) : QDialog(parent) CreateVoiceWindow::CreateVoiceWindow(QWidget *parent) : QDialog(parent)
{ {
@ -72,7 +73,7 @@ void CreateVoiceWindow::accept()
void CreateVoiceWindow::updateSettings(void) void CreateVoiceWindow::updateSettings(void)
{ {
// fill in language combobox // fill in language combobox
QStringList languages = RbSettings::languages(); QStringList languages = SystemInfo::languages();
languages.sort(); languages.sort();
ui.comboLanguage->addItems(languages); ui.comboLanguage->addItems(languages);
// set saved lang // set saved lang
@ -99,7 +100,7 @@ void CreateVoiceWindow::updateSettings(void)
ui.labelTtsProfile->setText(tr("Selected TTS engine: <b>%1</b>") ui.labelTtsProfile->setText(tr("Selected TTS engine: <b>%1</b>")
.arg("Invalid TTS configuration!")); .arg("Invalid TTS configuration!"));
QString encoder = RbSettings::value(RbSettings::CurEncoder).toString(); QString encoder = SystemInfo::value(SystemInfo::CurEncoder).toString();
// only proceed if encoder setting is set // only proceed if encoder setting is set
EncBase* enc = EncBase::getEncoder(this,encoder); EncBase* enc = EncBase::getEncoder(this,encoder);
if(enc != NULL) { if(enc != NULL) {

View file

@ -23,6 +23,7 @@
#include "browsedirtree.h" #include "browsedirtree.h"
#include "configure.h" #include "configure.h"
#include "rbsettings.h" #include "rbsettings.h"
#include "systeminfo.h"
InstallTalkWindow::InstallTalkWindow(QWidget *parent) : QDialog(parent) InstallTalkWindow::InstallTalkWindow(QWidget *parent) : QDialog(parent)
{ {
@ -130,7 +131,7 @@ void InstallTalkWindow::updateSettings(void)
ui.labelTtsProfile->setText(tr("Selected TTS engine: <b>%1</b>") ui.labelTtsProfile->setText(tr("Selected TTS engine: <b>%1</b>")
.arg("Invalid TTS configuration!")); .arg("Invalid TTS configuration!"));
QString encoder = RbSettings::value(RbSettings::CurEncoder).toString(); QString encoder = SystemInfo::value(SystemInfo::CurEncoder).toString();
EncBase* enc = EncBase::getEncoder(this,encoder); EncBase* enc = EncBase::getEncoder(this,encoder);
if(enc != NULL) { if(enc != NULL) {
if(enc->configOk()) if(enc->configOk())

View file

@ -22,6 +22,8 @@
#include "rbzip.h" #include "rbzip.h"
#include "system.h" #include "system.h"
#include "rbsettings.h" #include "rbsettings.h"
#include "serverinfo.h"
#include "systeminfo.h"
#include "utils.h" #include "utils.h"
InstallWindow::InstallWindow(QWidget *parent) : QDialog(parent) InstallWindow::InstallWindow(QWidget *parent) : QDialog(parent)
@ -54,24 +56,24 @@ InstallWindow::InstallWindow(QWidget *parent) : QDialog(parent)
backupCheckboxChanged(Qt::Unchecked); backupCheckboxChanged(Qt::Unchecked);
if(RbSettings::value(RbSettings::DailyRevision).toString().isEmpty()) { if(ServerInfo::value(ServerInfo::DailyRevision).toString().isEmpty()) {
ui.radioArchived->setEnabled(false); ui.radioArchived->setEnabled(false);
qDebug() << "[Install] no information about archived version available!"; qDebug() << "[Install] no information about archived version available!";
} }
if(RbSettings::value(RbSettings::CurReleaseVersion).toString().isEmpty()) { if(ServerInfo::value(ServerInfo::CurReleaseVersion).toString().isEmpty()) {
ui.radioStable->setEnabled(false); ui.radioStable->setEnabled(false);
} }
// try to use the old selection first. If no selection has been made // try to use the old selection first. If no selection has been made
// in the past, use a preselection based on released status. // in the past, use a preselection based on released status.
if(RbSettings::value(RbSettings::Build).toString() == "stable" if(RbSettings::value(RbSettings::Build).toString() == "stable"
&& !RbSettings::value(RbSettings::CurReleaseVersion).toString().isEmpty()) && !ServerInfo::value(ServerInfo::CurReleaseVersion).toString().isEmpty())
ui.radioStable->setChecked(true); ui.radioStable->setChecked(true);
else if(RbSettings::value(RbSettings::Build).toString() == "archived") else if(RbSettings::value(RbSettings::Build).toString() == "archived")
ui.radioArchived->setChecked(true); ui.radioArchived->setChecked(true);
else if(RbSettings::value(RbSettings::Build).toString() == "current") else if(RbSettings::value(RbSettings::Build).toString() == "current")
ui.radioCurrent->setChecked(true); ui.radioCurrent->setChecked(true);
else if(!RbSettings::value(RbSettings::CurReleaseVersion).toString().isEmpty()) { else if(!ServerInfo::value(ServerInfo::CurReleaseVersion).toString().isEmpty()) {
ui.radioStable->setChecked(true); ui.radioStable->setChecked(true);
ui.radioStable->setEnabled(true); ui.radioStable->setEnabled(true);
QFont font; QFont font;
@ -138,30 +140,30 @@ void InstallWindow::accept()
} }
QString myversion; QString myversion;
QString buildname = RbSettings::value(RbSettings::CurBuildserverModel).toString(); QString buildname = SystemInfo::value(SystemInfo::CurBuildserverModel).toString();
if(ui.radioStable->isChecked()) { if(ui.radioStable->isChecked()) {
file = RbSettings::value(RbSettings::ReleaseUrl).toString(); file = SystemInfo::value(SystemInfo::ReleaseUrl).toString();
RbSettings::setValue(RbSettings::Build, "stable"); RbSettings::setValue(RbSettings::Build, "stable");
myversion = RbSettings::value(RbSettings::CurReleaseVersion).toString(); myversion = ServerInfo::value(ServerInfo::CurReleaseVersion).toString();
} }
else if(ui.radioArchived->isChecked()) { else if(ui.radioArchived->isChecked()) {
file = RbSettings::value(RbSettings::DailyUrl).toString(); file = SystemInfo::value(SystemInfo::DailyUrl).toString();
RbSettings::setValue(RbSettings::Build, "archived"); RbSettings::setValue(RbSettings::Build, "archived");
myversion = "r" + RbSettings::value(RbSettings::DailyRevision).toString() + "-" + RbSettings::value(RbSettings::DailyDate).toString(); myversion = "r" + ServerInfo::value(ServerInfo::DailyRevision).toString() + "-" + ServerInfo::value(ServerInfo::DailyDate).toString();
} }
else if(ui.radioCurrent->isChecked()) { else if(ui.radioCurrent->isChecked()) {
file = RbSettings::value(RbSettings::BleedingUrl).toString(); file = SystemInfo::value(SystemInfo::BleedingUrl).toString();
RbSettings::setValue(RbSettings::Build, "current"); RbSettings::setValue(RbSettings::Build, "current");
myversion = "r" + RbSettings::value(RbSettings::BleedingRevision).toString(); myversion = "r" + ServerInfo::value(ServerInfo::BleedingRevision).toString();
} }
else { else {
qDebug() << "[Install] no build selected -- this shouldn't happen"; qDebug() << "[Install] no build selected -- this shouldn't happen";
return; return;
} }
file.replace("%MODEL%", buildname); file.replace("%MODEL%", buildname);
file.replace("%RELVERSION%", RbSettings::value(RbSettings::CurReleaseVersion).toString()); file.replace("%RELVERSION%", ServerInfo::value(ServerInfo::CurReleaseVersion).toString());
file.replace("%REVISION%", RbSettings::value(RbSettings::DailyRevision).toString()); file.replace("%REVISION%", ServerInfo::value(ServerInfo::DailyRevision).toString());
file.replace("%DATE%", RbSettings::value(RbSettings::DailyDate).toString()); file.replace("%DATE%", ServerInfo::value(ServerInfo::DailyDate).toString());
RbSettings::sync(); RbSettings::sync();
@ -268,8 +270,8 @@ void InstallWindow::setDetailsCurrent(bool show)
ui.labelDetails->setText(tr("This is the absolute up to the minute " ui.labelDetails->setText(tr("This is the absolute up to the minute "
"Rockbox built. A current build will get updated every time " "Rockbox built. A current build will get updated every time "
"a change is made. Latest version is r%1 (%2).") "a change is made. Latest version is r%1 (%2).")
.arg(RbSettings::value(RbSettings::BleedingRevision).toString(),RbSettings::value(RbSettings::BleedingDate).toString())); .arg(ServerInfo::value(ServerInfo::BleedingRevision).toString(),ServerInfo::value(ServerInfo::BleedingDate).toString()));
if(RbSettings::value(RbSettings::CurReleaseVersion).toString().isEmpty()) if(ServerInfo::value(ServerInfo::CurReleaseVersion).toString().isEmpty())
ui.labelNote->setText(tr("<b>This is the recommended version.</b>")); ui.labelNote->setText(tr("<b>This is the recommended version.</b>"));
else else
ui.labelNote->setText(""); ui.labelNote->setText("");
@ -283,11 +285,11 @@ void InstallWindow::setDetailsStable(bool show)
ui.labelDetails->setText( ui.labelDetails->setText(
tr("This is the last released version of Rockbox.")); tr("This is the last released version of Rockbox."));
if(!RbSettings::value(RbSettings::CurReleaseVersion).toString().isEmpty()) if(!ServerInfo::value(ServerInfo::CurReleaseVersion).toString().isEmpty())
ui.labelNote->setText(tr("<b>Note:</b> " ui.labelNote->setText(tr("<b>Note:</b> "
"The lastest released version is %1. " "The lastest released version is %1. "
"<b>This is the recommended version.</b>") "<b>This is the recommended version.</b>")
.arg(RbSettings::value(RbSettings::CurReleaseVersion).toString())); .arg(ServerInfo::value(ServerInfo::CurReleaseVersion).toString()));
else ui.labelNote->setText(""); else ui.labelNote->setText("");
} }
} }
@ -301,7 +303,7 @@ void InstallWindow::setDetailsArchived(bool show)
"features than the last stable release but may be much less stable. " "features than the last stable release but may be much less stable. "
"Features may change regularly.")); "Features may change regularly."));
ui.labelNote->setText(tr("<b>Note:</b> archived version is r%1 (%2).") ui.labelNote->setText(tr("<b>Note:</b> archived version is r%1 (%2).")
.arg(RbSettings::value(RbSettings::DailyRevision).toString(),RbSettings::value(RbSettings::DailyDate).toString())); .arg(ServerInfo::value(ServerInfo::DailyRevision).toString(),ServerInfo::value(ServerInfo::DailyDate).toString()));
} }
} }

View file

@ -36,6 +36,8 @@
#include "system.h" #include "system.h"
#include "systrace.h" #include "systrace.h"
#include "rbsettings.h" #include "rbsettings.h"
#include "serverinfo.h"
#include "systeminfo.h"
#include "progressloggerinterface.h" #include "progressloggerinterface.h"
@ -179,7 +181,7 @@ void RbUtilQt::downloadInfo()
ui.statusbar->showMessage(tr("Downloading build information, please wait ...")); ui.statusbar->showMessage(tr("Downloading build information, please wait ..."));
qDebug() << "[RbUtil] downloading build info"; qDebug() << "[RbUtil] downloading build info";
daily->setFile(&buildInfo); daily->setFile(&buildInfo);
daily->getFile(QUrl(RbSettings::value(RbSettings::ServerConfUrl).toString())); daily->getFile(QUrl(SystemInfo::value(SystemInfo::ServerConfUrl).toString()));
} }
@ -194,30 +196,10 @@ void RbUtilQt::downloadDone(bool error)
} }
qDebug() << "[RbUtil] network status:" << daily->error(); qDebug() << "[RbUtil] network status:" << daily->error();
// read info into settings object // read info into ServerInfo object
buildInfo.open(); buildInfo.open();
QSettings info(buildInfo.fileName(), QSettings::IniFormat, this); ServerInfo::readBuildInfo(buildInfo.fileName());
buildInfo.close(); buildInfo.close();
RbSettings::setValue(RbSettings::DailyRevision,info.value("dailies/rev"));
QDate date = QDate::fromString(info.value("dailies/date").toString(), "yyyyMMdd");
RbSettings::setValue(RbSettings::DailyDate,date.toString());
info.beginGroup("release");
QStringList keys = info.allKeys();
for(int i=0; i < keys.size(); i++)
{
RbSettings::setPlatformValue(keys[i],RbSettings::CurReleaseVersion,info.value(keys[i]));
}
info.endGroup();
info.beginGroup("status");
keys = info.allKeys();
for(int i=0; i < keys.size(); i++)
{
RbSettings::setPlatformValue(keys[i],RbSettings::CurStatus,info.value(keys[i]));
}
info.endGroup();
//start bleeding info download //start bleeding info download
bleeding = new HttpGet(this); bleeding = new HttpGet(this);
@ -227,7 +209,7 @@ void RbUtilQt::downloadDone(bool error)
if(RbSettings::value(RbSettings::CacheOffline).toBool()) if(RbSettings::value(RbSettings::CacheOffline).toBool())
bleeding->setCache(true); bleeding->setCache(true);
bleeding->setFile(&bleedingInfo); bleeding->setFile(&bleedingInfo);
bleeding->getFile(QUrl(RbSettings::value(RbSettings::BleedingInfo).toString())); bleeding->getFile(QUrl(SystemInfo::value(SystemInfo::BleedingInfo).toString()));
ui.statusbar->showMessage(tr("Downloading build information, please wait ...")); ui.statusbar->showMessage(tr("Downloading build information, please wait ..."));
} }
@ -240,12 +222,9 @@ void RbUtilQt::downloadBleedingDone(bool error)
} }
else { else {
bleedingInfo.open(); bleedingInfo.open();
QSettings info(bleedingInfo.fileName(), QSettings::IniFormat, this); ServerInfo::readBleedingInfo(bleedingInfo.fileName());
bleedingInfo.close(); bleedingInfo.close();
RbSettings::setValue(RbSettings::BleedingRevision,info.value("bleeding/rev"));
QDateTime date = QDateTime::fromString(info.value("bleeding/timestamp").toString(), "yyyyMMddThhmmssZ");
RbSettings::setValue(RbSettings::BleedingDate,date.toString());
ui.statusbar->showMessage(tr("Download build information finished."), 5000); ui.statusbar->showMessage(tr("Download build information finished."), 5000);
updateSettings(); updateSettings();
m_gotInfo = true; m_gotInfo = true;
@ -361,14 +340,14 @@ void RbUtilQt::updateDevice()
/* Enable bootloader installation, if possible */ /* Enable bootloader installation, if possible */
bool bootloaderInstallable = bool bootloaderInstallable =
RbSettings::value(RbSettings::CurBootloaderMethod) != "none"; SystemInfo::value(SystemInfo::CurBootloaderMethod) != "none";
ui.buttonBootloader->setEnabled(bootloaderInstallable); ui.buttonBootloader->setEnabled(bootloaderInstallable);
ui.labelBootloader->setEnabled(bootloaderInstallable); ui.labelBootloader->setEnabled(bootloaderInstallable);
ui.actionInstall_Bootloader->setEnabled(bootloaderInstallable); ui.actionInstall_Bootloader->setEnabled(bootloaderInstallable);
/* Enable bootloader uninstallation, if possible */ /* Enable bootloader uninstallation, if possible */
bool bootloaderUninstallable = bootloaderInstallable && bool bootloaderUninstallable = bootloaderInstallable &&
RbSettings::value(RbSettings::CurBootloaderMethod) != "fwpatcher"; SystemInfo::value(SystemInfo::CurBootloaderMethod) != "fwpatcher";
ui.labelRemoveBootloader->setEnabled(bootloaderUninstallable); ui.labelRemoveBootloader->setEnabled(bootloaderUninstallable);
ui.buttonRemoveBootloader->setEnabled(bootloaderUninstallable); ui.buttonRemoveBootloader->setEnabled(bootloaderUninstallable);
ui.actionRemove_bootloader->setEnabled(bootloaderUninstallable); ui.actionRemove_bootloader->setEnabled(bootloaderUninstallable);
@ -380,15 +359,16 @@ void RbUtilQt::updateDevice()
// displayed device info // displayed device info
QString mountpoint = RbSettings::value(RbSettings::Mountpoint).toString(); QString mountpoint = RbSettings::value(RbSettings::Mountpoint).toString();
QString brand = RbSettings::value(RbSettings::CurBrand).toString(); QString brand = SystemInfo::value(SystemInfo::CurBrand).toString();
QString name = RbSettings::value(RbSettings::CurName).toString(); QString name = SystemInfo::value(SystemInfo::CurName).toString() +
" (" + ServerInfo::value(ServerInfo::CurStatus).toString() + ")";
if(name.isEmpty()) name = "&lt;none&gt;"; if(name.isEmpty()) name = "&lt;none&gt;";
if(mountpoint.isEmpty()) mountpoint = "&lt;invalid&gt;"; if(mountpoint.isEmpty()) mountpoint = "&lt;invalid&gt;";
ui.labelDevice->setText(tr("<b>%1 %2</b> at <b>%3</b>") ui.labelDevice->setText(tr("<b>%1 %2</b> at <b>%3</b>")
.arg(brand, name, QDir::toNativeSeparators(mountpoint))); .arg(brand, name, QDir::toNativeSeparators(mountpoint)));
// hide quickstart buttons if no release available // hide quickstart buttons if no release available
bool installable = !RbSettings::value(RbSettings::CurReleaseVersion).toString().isEmpty(); bool installable = !ServerInfo::value(ServerInfo::CurReleaseVersion).toString().isEmpty();
ui.buttonSmall->setEnabled(installable); ui.buttonSmall->setEnabled(installable);
ui.buttonComplete->setEnabled(installable); ui.buttonComplete->setEnabled(installable);
ui.actionSmall_Installation->setEnabled(installable); ui.actionSmall_Installation->setEnabled(installable);
@ -400,15 +380,15 @@ void RbUtilQt::updateManual()
{ {
if(RbSettings::value(RbSettings::Platform) != "") if(RbSettings::value(RbSettings::Platform) != "")
{ {
QString manual= RbSettings::value(RbSettings::CurManual).toString(); QString manual= SystemInfo::value(SystemInfo::CurManual).toString();
if(manual == "") if(manual == "")
manual = "rockbox-" + RbSettings::value(RbSettings::Platform).toString(); manual = "rockbox-" + RbSettings::value(RbSettings::Platform).toString();
QString pdfmanual; QString pdfmanual;
pdfmanual = RbSettings::value(RbSettings::ManualUrl).toString() pdfmanual = SystemInfo::value(SystemInfo::ManualUrl).toString()
+ "/" + manual + ".pdf"; + "/" + manual + ".pdf";
QString htmlmanual; QString htmlmanual;
htmlmanual = RbSettings::value(RbSettings::ManualUrl).toString() htmlmanual = SystemInfo::value(SystemInfo::ManualUrl).toString()
+ "/" + manual + "/rockbox-build.html"; + "/" + manual + "/rockbox-build.html";
ui.labelPdfManual->setText(tr("<a href='%1'>PDF Manual</a>") ui.labelPdfManual->setText(tr("<a href='%1'>PDF Manual</a>")
.arg(pdfmanual)); .arg(pdfmanual));
@ -431,7 +411,7 @@ void RbUtilQt::completeInstall()
"This will install Rockbox %1. To install the most recent " "This will install Rockbox %1. To install the most recent "
"development build available press \"Cancel\" and " "development build available press \"Cancel\" and "
"use the \"Installation\" tab.") "use the \"Installation\" tab.")
.arg(RbSettings::value(RbSettings::CurReleaseVersion).toString()), .arg(ServerInfo::value(ServerInfo::CurReleaseVersion).toString()),
QMessageBox::Ok | QMessageBox::Cancel) != QMessageBox::Ok) QMessageBox::Ok | QMessageBox::Cancel) != QMessageBox::Ok)
return; return;
// create logger // create logger
@ -489,7 +469,7 @@ void RbUtilQt::smallInstall()
"This will install Rockbox %1. To install the most recent " "This will install Rockbox %1. To install the most recent "
"development build available press \"Cancel\" and " "development build available press \"Cancel\" and "
"use the \"Installation\" tab.") "use the \"Installation\" tab.")
.arg(RbSettings::value(RbSettings::CurReleaseVersion).toString()), .arg(ServerInfo::value(ServerInfo::CurReleaseVersion).toString()),
QMessageBox::Ok | QMessageBox::Cancel) != QMessageBox::Ok) QMessageBox::Ok | QMessageBox::Cancel) != QMessageBox::Ok)
return; return;
@ -510,7 +490,7 @@ bool RbUtilQt::smallInstallInner()
return true; return true;
} }
// Bootloader // Bootloader
if(RbSettings::value(RbSettings::CurBootloaderMethod) != "none") if(SystemInfo::value(SystemInfo::CurBootloaderMethod) != "none")
{ {
m_error = false; m_error = false;
m_installed = false; m_installed = false;
@ -561,9 +541,9 @@ void RbUtilQt::installBtn()
bool RbUtilQt::installAuto() bool RbUtilQt::installAuto()
{ {
QString file = RbSettings::value(RbSettings::ReleaseUrl).toString(); QString file = SystemInfo::value(SystemInfo::ReleaseUrl).toString();
file.replace("%MODEL%", RbSettings::value(RbSettings::CurBuildserverModel).toString()); file.replace("%MODEL%", SystemInfo::value(SystemInfo::CurBuildserverModel).toString());
file.replace("%RELVERSION%", RbSettings::value(RbSettings::CurReleaseVersion).toString()); file.replace("%RELVERSION%", ServerInfo::value(ServerInfo::CurReleaseVersion).toString());
// check installed Version and Target // check installed Version and Target
QString warning = check(false); QString warning = check(false);
@ -620,7 +600,7 @@ bool RbUtilQt::installAuto()
ZipInstaller* installer = new ZipInstaller(this); ZipInstaller* installer = new ZipInstaller(this);
installer->setUrl(file); installer->setUrl(file);
installer->setLogSection("Rockbox (Base)"); installer->setLogSection("Rockbox (Base)");
installer->setLogVersion(RbSettings::value(RbSettings::CurReleaseVersion).toString()); installer->setLogVersion(ServerInfo::value(ServerInfo::CurReleaseVersion).toString());
if(!RbSettings::value(RbSettings::CacheDisabled).toBool()) if(!RbSettings::value(RbSettings::CacheDisabled).toBool())
installer->setCache(true); installer->setCache(true);
installer->setMountPoint(RbSettings::value(RbSettings::Mountpoint).toString()); installer->setMountPoint(RbSettings::value(RbSettings::Mountpoint).toString());
@ -668,7 +648,7 @@ void RbUtilQt::installBootloader()
// create installer // create installer
BootloaderInstallBase *bl; BootloaderInstallBase *bl;
QString type = RbSettings::value(RbSettings::CurBootloaderMethod).toString(); QString type = SystemInfo::value(SystemInfo::CurBootloaderMethod).toString();
if(type == "mi4") { if(type == "mi4") {
bl = new BootloaderInstallMi4(this); bl = new BootloaderInstallMi4(this);
} }
@ -700,15 +680,15 @@ void RbUtilQt::installBootloader()
} }
// set bootloader filename. Do this now as installed() needs it. // set bootloader filename. Do this now as installed() needs it.
QStringList blfile = RbSettings::value(RbSettings::CurBootloaderFile).toStringList(); QStringList blfile = SystemInfo::value(SystemInfo::CurBootloaderFile).toStringList();
QStringList blfilepath; QStringList blfilepath;
for(int a = 0; a < blfile.size(); a++) { for(int a = 0; a < blfile.size(); a++) {
blfilepath.append(RbSettings::value(RbSettings::Mountpoint).toString() blfilepath.append(RbSettings::value(RbSettings::Mountpoint).toString()
+ blfile.at(a)); + blfile.at(a));
} }
bl->setBlFile(blfilepath); bl->setBlFile(blfilepath);
QUrl url(RbSettings::value(RbSettings::BootloaderUrl).toString() QUrl url(SystemInfo::value(SystemInfo::BootloaderUrl).toString()
+ RbSettings::value(RbSettings::CurBootloaderName).toString()); + SystemInfo::value(SystemInfo::CurBootloaderName).toString());
bl->setBlUrl(url); bl->setBlUrl(url);
bl->setLogfile(RbSettings::value(RbSettings::Mountpoint).toString() bl->setLogfile(RbSettings::value(RbSettings::Mountpoint).toString()
+ "/.rockbox/rbutil.log"); + "/.rockbox/rbutil.log");
@ -734,7 +714,7 @@ void RbUtilQt::installBootloader()
else if(bl->installed() == BootloaderInstallBase::BootloaderOther else if(bl->installed() == BootloaderInstallBase::BootloaderOther
&& bl->capabilities() & BootloaderInstallBase::Backup) && bl->capabilities() & BootloaderInstallBase::Backup)
{ {
QString targetFolder = RbSettings::value(RbSettings::CurPlatformName).toString() QString targetFolder = SystemInfo::value(SystemInfo::CurPlatformName).toString()
+ " Firmware Backup"; + " Firmware Backup";
// remove invalid character(s) // remove invalid character(s)
targetFolder.remove(QRegExp("[:/]")); targetFolder.remove(QRegExp("[:/]"));
@ -852,9 +832,9 @@ void RbUtilQt::installFonts()
// create zip installer // create zip installer
installer = new ZipInstaller(this); installer = new ZipInstaller(this);
installer->setUrl(RbSettings::value(RbSettings::FontUrl).toString()); installer->setUrl(SystemInfo::value(SystemInfo::FontUrl).toString());
installer->setLogSection("Fonts"); installer->setLogSection("Fonts");
installer->setLogVersion(RbSettings::value(RbSettings::DailyDate).toString()); installer->setLogVersion(ServerInfo::value(ServerInfo::DailyDate).toString());
installer->setMountPoint(RbSettings::value(RbSettings::Mountpoint).toString()); installer->setMountPoint(RbSettings::value(RbSettings::Mountpoint).toString());
if(!RbSettings::value(RbSettings::CacheDisabled).toBool()) if(!RbSettings::value(RbSettings::CacheDisabled).toBool())
installer->setCache(true); installer->setCache(true);
@ -890,15 +870,15 @@ void RbUtilQt::installVoice()
// create zip installer // create zip installer
installer = new ZipInstaller(this); installer = new ZipInstaller(this);
QString voiceurl = RbSettings::value(RbSettings::VoiceUrl).toString(); QString voiceurl = SystemInfo::value(SystemInfo::VoiceUrl).toString();
voiceurl += RbSettings::value(RbSettings::CurBuildserverModel).toString() + "-" + voiceurl += SystemInfo::value(SystemInfo::CurBuildserverModel).toString() + "-" +
RbSettings::value(RbSettings::DailyDate).toString() + "-english.zip"; ServerInfo::value(ServerInfo::DailyDate).toString() + "-english.zip";
qDebug() << "[RbUtil] voicefile URL:" << voiceurl; qDebug() << "[RbUtil] voicefile URL:" << voiceurl;
installer->setUrl(voiceurl); installer->setUrl(voiceurl);
installer->setLogSection("Voice"); installer->setLogSection("Voice");
installer->setLogVersion(RbSettings::value(RbSettings::DailyDate).toString()); installer->setLogVersion(ServerInfo::value(ServerInfo::DailyDate).toString());
installer->setMountPoint(RbSettings::value(RbSettings::Mountpoint).toString()); installer->setMountPoint(RbSettings::value(RbSettings::Mountpoint).toString());
if(!RbSettings::value(RbSettings::CacheDisabled).toBool()) if(!RbSettings::value(RbSettings::CacheDisabled).toBool())
installer->setCache(true); installer->setCache(true);
@ -946,9 +926,9 @@ void RbUtilQt::installDoom()
// create zip installer // create zip installer
installer = new ZipInstaller(this); installer = new ZipInstaller(this);
installer->setUrl(RbSettings::value(RbSettings::DoomUrl).toString()); installer->setUrl(SystemInfo::value(SystemInfo::DoomUrl).toString());
installer->setLogSection("Game Addons"); installer->setLogSection("Game Addons");
installer->setLogVersion(RbSettings::value(RbSettings::DailyDate).toString()); installer->setLogVersion(ServerInfo::value(ServerInfo::DailyDate).toString());
installer->setMountPoint(RbSettings::value(RbSettings::Mountpoint).toString()); installer->setMountPoint(RbSettings::value(RbSettings::Mountpoint).toString());
if(!RbSettings::value(RbSettings::CacheDisabled).toBool()) if(!RbSettings::value(RbSettings::CacheDisabled).toBool())
installer->setCache(true); installer->setCache(true);
@ -973,8 +953,6 @@ void RbUtilQt::createTalkFiles(void)
{ {
if(chkConfig(true)) return; if(chkConfig(true)) return;
InstallTalkWindow *installWindow = new InstallTalkWindow(this); InstallTalkWindow *installWindow = new InstallTalkWindow(this);
connect(installWindow, SIGNAL(settingsUpdated()), this, SLOT(downloadInfo()));
connect(installWindow, SIGNAL(settingsUpdated()), this, SLOT(updateSettings())); connect(installWindow, SIGNAL(settingsUpdated()), this, SLOT(updateSettings()));
installWindow->show(); installWindow->show();
@ -985,7 +963,6 @@ void RbUtilQt::createVoiceFile(void)
if(chkConfig(true)) return; if(chkConfig(true)) return;
CreateVoiceWindow *installWindow = new CreateVoiceWindow(this); CreateVoiceWindow *installWindow = new CreateVoiceWindow(this);
connect(installWindow, SIGNAL(settingsUpdated()), this, SLOT(downloadInfo()));
connect(installWindow, SIGNAL(settingsUpdated()), this, SLOT(updateSettings())); connect(installWindow, SIGNAL(settingsUpdated()), this, SLOT(updateSettings()));
installWindow->show(); installWindow->show();
} }
@ -1013,7 +990,7 @@ void RbUtilQt::uninstallBootloader(void)
// create installer // create installer
BootloaderInstallBase *bl; BootloaderInstallBase *bl;
QString type = RbSettings::value(RbSettings::CurBootloaderMethod).toString(); QString type = SystemInfo::value(SystemInfo::CurBootloaderMethod).toString();
if(type == "mi4") { if(type == "mi4") {
bl = new BootloaderInstallMi4(this); bl = new BootloaderInstallMi4(this);
} }
@ -1035,7 +1012,7 @@ void RbUtilQt::uninstallBootloader(void)
return; return;
} }
QStringList blfile = RbSettings::value(RbSettings::CurBootloaderFile).toStringList(); QStringList blfile = SystemInfo::value(SystemInfo::CurBootloaderFile).toStringList();
QStringList blfilepath; QStringList blfilepath;
for(int a = 0; a < blfile.size(); a++) { for(int a = 0; a < blfile.size(); a++) {
blfilepath.append(RbSettings::value(RbSettings::Mountpoint).toString() blfilepath.append(RbSettings::value(RbSettings::Mountpoint).toString()
@ -1063,11 +1040,11 @@ void RbUtilQt::downloadManual(void)
QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes) QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes)
return; return;
QString manual = RbSettings::value(RbSettings::CurManual).toString(); QString manual = SystemInfo::value(SystemInfo::CurManual).toString();
if(manual.isEmpty()) if(manual.isEmpty())
manual = "rockbox-" + RbSettings::value(RbSettings::Platform).toString(); manual = "rockbox-" + RbSettings::value(RbSettings::Platform).toString();
QString date = RbSettings::value(RbSettings::DailyDate).toString(); QString date = ServerInfo::value(ServerInfo::DailyDate).toString();
QString manualurl; QString manualurl;
QString target; QString target;
@ -1080,7 +1057,7 @@ void RbUtilQt::downloadManual(void)
target = "/" + manual + "-" + date + "-html.zip"; target = "/" + manual + "-" + date + "-html.zip";
section = "Manual (HTML)"; section = "Manual (HTML)";
} }
manualurl = RbSettings::value(RbSettings::ManualUrl).toString() + "/" + target; manualurl = SystemInfo::value(SystemInfo::ManualUrl).toString() + "/" + target;
qDebug() << "[RbUtil] Manual URL:" << manualurl; qDebug() << "[RbUtil] Manual URL:" << manualurl;
ProgressLoggerGui* logger = new ProgressLoggerGui(this); ProgressLoggerGui* logger = new ProgressLoggerGui(this);
@ -1243,7 +1220,7 @@ bool RbUtilQt::chkConfig(bool warn)
void RbUtilQt::checkUpdate(void) void RbUtilQt::checkUpdate(void)
{ {
QString url = RbSettings::value(RbSettings::RbutilUrl).toString(); QString url = SystemInfo::value(SystemInfo::RbutilUrl).toString();
#if defined(Q_OS_WIN32) #if defined(Q_OS_WIN32)
url += "win32/"; url += "win32/";
#elif defined(Q_OS_LINUX) #elif defined(Q_OS_LINUX)
@ -1308,7 +1285,7 @@ void RbUtilQt::downloadUpdateDone(bool error)
// if we found something newer, display info // if we found something newer, display info
if(newVersion != "") if(newVersion != "")
{ {
QString url = RbSettings::value(RbSettings::RbutilUrl).toString(); QString url = SystemInfo::value(SystemInfo::RbutilUrl).toString();
#if defined(Q_OS_WIN32) #if defined(Q_OS_WIN32)
url += "win32/"; url += "win32/";
#elif defined(Q_OS_LINUX) #elif defined(Q_OS_LINUX)

View file

@ -97,6 +97,8 @@ SOURCES += rbutilqt.cpp \
base/voicefile.cpp \ base/voicefile.cpp \
createvoicewindow.cpp \ createvoicewindow.cpp \
base/rbsettings.cpp \ base/rbsettings.cpp \
base/serverinfo.cpp \
base/systeminfo.cpp \
base/rbunzip.cpp \ base/rbunzip.cpp \
base/rbzip.cpp \ base/rbzip.cpp \
base/system.cpp \ base/system.cpp \
@ -158,6 +160,8 @@ HEADERS += rbutilqt.h \
base/voicefile.h \ base/voicefile.h \
createvoicewindow.h \ createvoicewindow.h \
base/rbsettings.h \ base/rbsettings.h \
base/serverinfo.h \
base/systeminfo.h \
base/rbunzip.h \ base/rbunzip.h \
base/rbzip.h \ base/rbzip.h \
sysinfo.h \ sysinfo.h \

View file

@ -25,6 +25,7 @@
#include "progressloggergui.h" #include "progressloggergui.h"
#include "utils.h" #include "utils.h"
#include "rbsettings.h" #include "rbsettings.h"
#include "systeminfo.h"
ThemesInstallWindow::ThemesInstallWindow(QWidget *parent) : QDialog(parent) ThemesInstallWindow::ThemesInstallWindow(QWidget *parent) : QDialog(parent)
{ {
@ -63,9 +64,9 @@ void ThemesInstallWindow::downloadInfo()
themesInfo.close(); themesInfo.close();
QUrl url; QUrl url;
url = QUrl(RbSettings::value(RbSettings::ThemesUrl).toString() url = QUrl(SystemInfo::value(SystemInfo::ThemesUrl).toString()
+ "/rbutilqt.php?target=" + "/rbutilqt.php?target="
+ RbSettings::value(RbSettings::CurConfigureModel).toString()); + SystemInfo::value(SystemInfo::CurConfigureModel).toString());
qDebug() << "[Themes] Info URL:" << url << "Query:" << url.queryItems(); qDebug() << "[Themes] Info URL:" << url << "Query:" << url.queryItems();
if(RbSettings::value(RbSettings::CacheOffline).toBool()) if(RbSettings::value(RbSettings::CacheOffline).toBool())
getter->setCache(true); getter->setCache(true);
@ -195,9 +196,9 @@ void ThemesInstallWindow::updateDetails(QListWidgetItem* cur, QListWidgetItem* p
iniDetails.beginGroup(cur->data(Qt::UserRole).toString()); iniDetails.beginGroup(cur->data(Qt::UserRole).toString());
QUrl img, txt; QUrl img, txt;
txt = QUrl(QString(RbSettings::value(RbSettings::ThemesUrl).toString() + "/" txt = QUrl(QString(SystemInfo::value(SystemInfo::ThemesUrl).toString() + "/"
+ iniDetails.value("descriptionfile").toString())); + iniDetails.value("descriptionfile").toString()));
img = QUrl(QString(RbSettings::value(RbSettings::ThemesUrl).toString() + "/" img = QUrl(QString(SystemInfo::value(SystemInfo::ThemesUrl).toString() + "/"
+ iniDetails.value("image").toString())); + iniDetails.value("image").toString()));
QString text; QString text;
@ -311,7 +312,7 @@ void ThemesInstallWindow::accept()
QSettings iniDetails(themesInfo.fileName(), QSettings::IniFormat, this); QSettings iniDetails(themesInfo.fileName(), QSettings::IniFormat, this);
for(int i = 0; i < ui.listThemes->selectedItems().size(); i++) { for(int i = 0; i < ui.listThemes->selectedItems().size(); i++) {
iniDetails.beginGroup(ui.listThemes->selectedItems().at(i)->data(Qt::UserRole).toString()); iniDetails.beginGroup(ui.listThemes->selectedItems().at(i)->data(Qt::UserRole).toString());
zip = RbSettings::value(RbSettings::ThemesUrl).toString() zip = SystemInfo::value(SystemInfo::ThemesUrl).toString()
+ "/" + iniDetails.value("archive").toString(); + "/" + iniDetails.value("archive").toString();
themes.append(zip); themes.append(zip);
names.append("Theme: " + names.append("Theme: " +