2008-01-25 00:12:25 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
*
|
|
|
|
* Copyright (C) 2007 by Dominik Wenger
|
2008-06-30 22:09:45 +00:00
|
|
|
* $Id$
|
2008-01-25 00:12:25 +00:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
2009-02-25 21:05:57 +00:00
|
|
|
|
2008-01-25 00:12:25 +00:00
|
|
|
#include "rbsettings.h"
|
|
|
|
|
|
|
|
#include <QSettings>
|
|
|
|
|
2009-02-25 21:05:57 +00:00
|
|
|
#if defined(Q_OS_LINUX)
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
|
|
|
|
2008-01-25 00:12:25 +00:00
|
|
|
void RbSettings::open()
|
|
|
|
{
|
|
|
|
// only use built-in rbutil.ini
|
|
|
|
devices = new QSettings(":/ini/rbutil.ini", QSettings::IniFormat, 0);
|
|
|
|
// portable installation:
|
|
|
|
// check for a configuration file in the program folder.
|
|
|
|
QFileInfo config;
|
2009-02-25 21:05:57 +00:00
|
|
|
config.setFile(QCoreApplication::instance()->applicationDirPath()
|
|
|
|
+ "/RockboxUtility.ini");
|
|
|
|
if(config.isFile())
|
2008-01-25 00:12:25 +00:00
|
|
|
{
|
2009-02-25 21:05:57 +00:00
|
|
|
userSettings = new QSettings(QCoreApplication::instance()->applicationDirPath()
|
|
|
|
+ "/RockboxUtility.ini", QSettings::IniFormat, this);
|
2008-01-25 00:12:25 +00:00
|
|
|
qDebug() << "config: portable";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
userSettings = new QSettings(QSettings::IniFormat,
|
2008-01-30 19:46:02 +00:00
|
|
|
QSettings::UserScope, "rockbox.org", "RockboxUtility",this);
|
2008-01-25 00:12:25 +00:00
|
|
|
qDebug() << "config: system";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void RbSettings::sync()
|
|
|
|
{
|
|
|
|
userSettings->sync();
|
2009-02-25 21:05:57 +00:00
|
|
|
#if defined(Q_OS_LINUX)
|
|
|
|
// when using sudo it runs rbutil with uid 0 but unfortunately without a
|
|
|
|
// proper login shell, thus the configuration file gets placed in the
|
|
|
|
// calling users $HOME. This in turn will cause issues if trying to
|
|
|
|
// run rbutil later as user. Try to detect this case via the environment
|
|
|
|
// variable SUDO_UID and SUDO_GID and if set chown the user config file.
|
|
|
|
if(getuid() == 0)
|
|
|
|
{
|
|
|
|
char* realuser = getenv("SUDO_UID");
|
|
|
|
char* realgroup = getenv("SUDO_GID");
|
|
|
|
if(realuser != NULL && realgroup != NULL)
|
|
|
|
{
|
|
|
|
int realuid = atoi(realuser);
|
|
|
|
int realgid = atoi(realgroup);
|
|
|
|
chown(qPrintable(userSettings->fileName()), realuid, realgid);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
2008-01-25 00:12:25 +00:00
|
|
|
|
2008-04-24 20:40:33 +00:00
|
|
|
QVariant RbSettings::deviceSettingCurGet(QString entry,QString def)
|
|
|
|
{
|
|
|
|
QString platform = userSettings->value("platform").toString();
|
|
|
|
devices->beginGroup(platform);
|
|
|
|
QVariant result = devices->value(entry,def);
|
|
|
|
devices->endGroup();
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
QVariant RbSettings::userSettingsGroupGet(QString group,QString entry,QVariant def)
|
|
|
|
{
|
|
|
|
userSettings->beginGroup(group);
|
|
|
|
QVariant result = userSettings->value(entry,def);
|
|
|
|
userSettings->endGroup();
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
void RbSettings::userSettingsGroupSet(QString group,QString entry,QVariant value)
|
|
|
|
{
|
|
|
|
userSettings->beginGroup(group);
|
|
|
|
userSettings->setValue(entry,value);
|
|
|
|
userSettings->endGroup();
|
|
|
|
}
|
|
|
|
|
2008-01-25 00:12:25 +00:00
|
|
|
QString RbSettings::userSettingFilename()
|
|
|
|
{
|
|
|
|
return userSettings->fileName();
|
|
|
|
}
|
|
|
|
|
2008-07-07 21:40:44 +00:00
|
|
|
QString RbSettings::curVersion()
|
|
|
|
{
|
|
|
|
return userSettings->value("rbutil_version").toString();
|
|
|
|
}
|
2009-01-25 17:48:38 +00:00
|
|
|
|
2008-01-25 00:12:25 +00:00
|
|
|
bool RbSettings::cacheOffline()
|
|
|
|
{
|
|
|
|
return userSettings->value("offline").toBool();
|
|
|
|
}
|
|
|
|
|
|
|
|
QString RbSettings::mountpoint()
|
|
|
|
{
|
|
|
|
return userSettings->value("mountpoint").toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
QString RbSettings::manualUrl()
|
|
|
|
{
|
|
|
|
return devices->value("manual_url").toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
QString RbSettings::bleedingUrl()
|
|
|
|
{
|
|
|
|
return devices->value("bleeding_url").toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
QString RbSettings::cachePath()
|
|
|
|
{
|
|
|
|
return userSettings->value("cachepath", QDir::tempPath()).toString();
|
|
|
|
}
|
|
|
|
|
2008-12-19 22:18:07 +00:00
|
|
|
QString RbSettings::build()
|
|
|
|
{
|
|
|
|
return userSettings->value("build").toString();
|
|
|
|
}
|
|
|
|
|
2008-01-25 00:12:25 +00:00
|
|
|
QString RbSettings::bootloaderUrl()
|
|
|
|
{
|
|
|
|
return devices->value("bootloader_url").toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
QString RbSettings::bootloaderInfoUrl()
|
|
|
|
{
|
|
|
|
return devices->value("bootloader_info_url").toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
QString RbSettings::fontUrl()
|
|
|
|
{
|
|
|
|
return devices->value("font_url").toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
QString RbSettings::voiceUrl()
|
|
|
|
{
|
|
|
|
return devices->value("voice_url").toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
QString RbSettings::doomUrl()
|
|
|
|
{
|
|
|
|
return devices->value("doom_url").toString();
|
|
|
|
}
|
|
|
|
|
2008-10-18 16:19:07 +00:00
|
|
|
QString RbSettings::releaseUrl()
|
2008-01-25 00:12:25 +00:00
|
|
|
{
|
2008-10-18 16:19:07 +00:00
|
|
|
return devices->value("release_url").toString();
|
2008-01-25 00:12:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QString RbSettings::dailyUrl()
|
|
|
|
{
|
|
|
|
return devices->value("daily_url").toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
QString RbSettings::serverConfUrl()
|
|
|
|
{
|
|
|
|
return devices->value("server_conf_url").toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
QString RbSettings::genlangUrl()
|
|
|
|
{
|
|
|
|
return devices->value("genlang_url").toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
QString RbSettings::themeUrl()
|
|
|
|
{
|
|
|
|
return devices->value("themes_url").toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
QString RbSettings::bleedingInfo()
|
|
|
|
{
|
|
|
|
return devices->value("bleeding_info").toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool RbSettings::cacheDisabled()
|
|
|
|
{
|
|
|
|
return userSettings->value("cachedisable").toBool();
|
|
|
|
}
|
|
|
|
|
|
|
|
QString RbSettings::proxyType()
|
|
|
|
{
|
2008-02-23 21:27:00 +00:00
|
|
|
return userSettings->value("proxytype", "none").toString();
|
2008-01-25 00:12:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QString RbSettings::proxy()
|
|
|
|
{
|
|
|
|
return userSettings->value("proxy").toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
QString RbSettings::ofPath()
|
|
|
|
{
|
|
|
|
return userSettings->value("ofpath").toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
QString RbSettings::curBrand()
|
|
|
|
{
|
|
|
|
QString platform = userSettings->value("platform").toString();
|
|
|
|
return brand(platform);
|
|
|
|
}
|
|
|
|
|
|
|
|
QString RbSettings::curName()
|
|
|
|
{
|
|
|
|
QString platform = userSettings->value("platform").toString();
|
|
|
|
return name(platform);
|
|
|
|
}
|
|
|
|
|
|
|
|
QString RbSettings::curPlatform()
|
|
|
|
{
|
|
|
|
return userSettings->value("platform").toString();
|
|
|
|
}
|
|
|
|
|
2008-02-13 18:25:01 +00:00
|
|
|
QString RbSettings::curPlatformName()
|
|
|
|
{
|
2008-04-24 20:40:33 +00:00
|
|
|
return deviceSettingCurGet("platform").toString();
|
2008-02-13 18:25:01 +00:00
|
|
|
}
|
|
|
|
|
2008-01-25 00:12:25 +00:00
|
|
|
QString RbSettings::curManual()
|
|
|
|
{
|
2008-04-24 20:40:33 +00:00
|
|
|
return deviceSettingCurGet("manualname","rockbox-" +
|
2008-01-25 00:12:25 +00:00
|
|
|
devices->value("platform").toString()).toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
QString RbSettings::curBootloaderMethod()
|
|
|
|
{
|
2009-01-25 17:48:38 +00:00
|
|
|
return deviceSettingCurGet("bootloadermethod", "none").toString();
|
2008-01-25 00:12:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QString RbSettings::curBootloaderName()
|
|
|
|
{
|
2008-04-24 20:40:33 +00:00
|
|
|
return deviceSettingCurGet("bootloadername").toString();
|
2008-01-25 00:12:25 +00:00
|
|
|
}
|
|
|
|
|
2008-09-28 17:02:36 +00:00
|
|
|
QString RbSettings::curBootloaderFile()
|
|
|
|
{
|
|
|
|
return deviceSettingCurGet("bootloaderfile").toString();
|
|
|
|
}
|
|
|
|
|
2008-01-25 00:12:25 +00:00
|
|
|
QString RbSettings::curVoiceName()
|
|
|
|
{
|
2008-04-24 20:40:33 +00:00
|
|
|
return deviceSettingCurGet("voicename").toString();
|
2008-01-25 00:12:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QString RbSettings::curLang()
|
|
|
|
{
|
2008-07-25 19:28:24 +00:00
|
|
|
// QSettings::value only returns the default when the setting
|
|
|
|
// doesn't exist. Make sure to return the system language if
|
|
|
|
// the language in the configuration is present but empty too.
|
|
|
|
QString lang = userSettings->value("lang").toString();
|
|
|
|
if(lang.isEmpty())
|
|
|
|
lang = QLocale::system().name();
|
|
|
|
return lang;
|
2008-01-25 00:12:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QString RbSettings::curEncoder()
|
|
|
|
{
|
2008-05-10 15:23:15 +00:00
|
|
|
return deviceSettingCurGet("encoder").toString();
|
2008-01-25 00:12:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QString RbSettings::curTTS()
|
|
|
|
{
|
|
|
|
return userSettings->value("tts").toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
QString RbSettings::lastTalkedFolder()
|
|
|
|
{
|
|
|
|
return userSettings->value("last_talked_folder").toString();
|
|
|
|
}
|
2009-02-25 21:05:57 +00:00
|
|
|
|
2008-01-25 00:12:25 +00:00
|
|
|
QString RbSettings::voiceLanguage()
|
|
|
|
{
|
|
|
|
return userSettings->value("voicelanguage").toString();
|
|
|
|
}
|
2009-02-25 21:05:57 +00:00
|
|
|
|
2008-01-25 00:12:25 +00:00
|
|
|
int RbSettings::wavtrimTh()
|
|
|
|
{
|
|
|
|
return userSettings->value("wavtrimthreshold",500).toInt();
|
|
|
|
}
|
|
|
|
|
|
|
|
QString RbSettings::ttsPath(QString tts)
|
|
|
|
{
|
2008-04-24 20:40:33 +00:00
|
|
|
return userSettingsGroupGet(tts,"ttspath").toString();
|
2008-01-25 00:12:25 +00:00
|
|
|
}
|
|
|
|
QString RbSettings::ttsOptions(QString tts)
|
|
|
|
{
|
2008-04-24 20:40:33 +00:00
|
|
|
return userSettingsGroupGet(tts,"ttsoptions").toString();
|
2008-01-25 00:12:25 +00:00
|
|
|
}
|
|
|
|
QString RbSettings::ttsVoice(QString tts)
|
|
|
|
{
|
2008-04-27 18:06:09 +00:00
|
|
|
return userSettingsGroupGet(tts,"ttsvoice","Microsoft Sam").toString();
|
2008-01-25 00:12:25 +00:00
|
|
|
}
|
|
|
|
int RbSettings::ttsSpeed(QString tts)
|
|
|
|
{
|
2008-04-24 20:40:33 +00:00
|
|
|
return userSettingsGroupGet(tts,"ttsspeed",0).toInt();
|
2008-01-25 00:12:25 +00:00
|
|
|
}
|
|
|
|
QString RbSettings::ttsLang(QString tts)
|
|
|
|
{
|
2008-04-24 20:40:33 +00:00
|
|
|
return userSettingsGroupGet(tts,"ttslanguage","english").toString();
|
2008-01-25 00:12:25 +00:00
|
|
|
}
|
|
|
|
|
2008-02-11 17:39:07 +00:00
|
|
|
bool RbSettings::ttsUseSapi4()
|
|
|
|
{
|
2008-04-24 20:40:33 +00:00
|
|
|
return userSettingsGroupGet("sapi","useSapi4",false).toBool();
|
2008-02-11 17:39:07 +00:00
|
|
|
}
|
|
|
|
|
2008-01-25 00:12:25 +00:00
|
|
|
QString RbSettings::encoderPath(QString enc)
|
|
|
|
{
|
2008-04-24 20:40:33 +00:00
|
|
|
return userSettingsGroupGet(enc,"encoderpath").toString();
|
2008-01-25 00:12:25 +00:00
|
|
|
}
|
|
|
|
QString RbSettings::encoderOptions(QString enc)
|
|
|
|
{
|
2008-04-24 20:40:33 +00:00
|
|
|
return userSettingsGroupGet(enc,"encoderoptions").toString();
|
2008-01-25 00:12:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
double RbSettings::encoderQuality(QString enc)
|
|
|
|
{
|
2008-04-24 20:40:33 +00:00
|
|
|
return userSettingsGroupGet(enc,"quality",8.f).toDouble();
|
2008-01-25 00:12:25 +00:00
|
|
|
}
|
|
|
|
int RbSettings::encoderComplexity(QString enc)
|
|
|
|
{
|
2008-04-24 20:40:33 +00:00
|
|
|
return userSettingsGroupGet(enc,"complexity",10).toInt();
|
2008-01-25 00:12:25 +00:00
|
|
|
}
|
|
|
|
double RbSettings::encoderVolume(QString enc)
|
|
|
|
{
|
2008-04-24 20:40:33 +00:00
|
|
|
return userSettingsGroupGet(enc,"volume",1.f).toDouble();
|
2008-01-25 00:12:25 +00:00
|
|
|
}
|
|
|
|
bool RbSettings::encoderNarrowband(QString enc)
|
|
|
|
{
|
2008-04-24 20:40:33 +00:00
|
|
|
return userSettingsGroupGet(enc,"narrowband",false).toBool();
|
2008-01-25 00:12:25 +00:00
|
|
|
}
|
2008-07-07 21:40:44 +00:00
|
|
|
|
2008-01-25 00:12:25 +00:00
|
|
|
QStringList RbSettings::allPlatforms()
|
|
|
|
{
|
|
|
|
QStringList result;
|
|
|
|
devices->beginGroup("platforms");
|
|
|
|
QStringList a = devices->childKeys();
|
2009-02-25 21:05:57 +00:00
|
|
|
for(int i = 0; i < a.size(); i++)
|
2008-01-25 00:12:25 +00:00
|
|
|
{
|
|
|
|
result.append(devices->value(a.at(i), "null").toString());
|
|
|
|
}
|
|
|
|
devices->endGroup();
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
QStringList RbSettings::allLanguages()
|
|
|
|
{
|
|
|
|
QStringList result;
|
|
|
|
devices->beginGroup("languages");
|
|
|
|
QStringList a = devices->childKeys();
|
2009-02-25 21:05:57 +00:00
|
|
|
for(int i = 0; i < a.size(); i++)
|
2008-01-25 00:12:25 +00:00
|
|
|
{
|
|
|
|
result.append(devices->value(a.at(i), "null").toString());
|
|
|
|
}
|
|
|
|
devices->endGroup();
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString RbSettings::name(QString plattform)
|
|
|
|
{
|
|
|
|
devices->beginGroup(plattform);
|
|
|
|
QString name = devices->value("name").toString();
|
|
|
|
devices->endGroup();
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString RbSettings::brand(QString plattform)
|
|
|
|
{
|
|
|
|
devices->beginGroup(plattform);
|
|
|
|
QString brand = devices->value("brand").toString();
|
|
|
|
devices->endGroup();
|
|
|
|
return brand;
|
|
|
|
}
|
|
|
|
|
2008-06-23 20:31:44 +00:00
|
|
|
QString RbSettings::nameOfTargetId(int id)
|
|
|
|
{
|
|
|
|
QString result ="";
|
|
|
|
// get a list of ID -> target name
|
|
|
|
QStringList platforms;
|
|
|
|
devices->beginGroup("platforms");
|
|
|
|
platforms = devices->childKeys();
|
|
|
|
devices->endGroup();
|
|
|
|
for(int i = 0; i < platforms.size(); i++)
|
|
|
|
{
|
|
|
|
devices->beginGroup("platforms");
|
|
|
|
QString target = devices->value(platforms.at(i)).toString();
|
|
|
|
devices->endGroup();
|
|
|
|
devices->beginGroup(target);
|
|
|
|
if(devices->value("targetid").toInt() == id)
|
|
|
|
{
|
|
|
|
result = devices->value("name").toString();
|
|
|
|
}
|
|
|
|
devices->endGroup();
|
|
|
|
}
|
2009-02-25 21:05:57 +00:00
|
|
|
|
2008-06-23 20:31:44 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2008-04-03 20:05:13 +00:00
|
|
|
QMap<int, QString> RbSettings::usbIdMap()
|
|
|
|
{
|
|
|
|
QMap<int, QString> map;
|
|
|
|
// get a list of ID -> target name
|
|
|
|
QStringList platforms;
|
|
|
|
devices->beginGroup("platforms");
|
|
|
|
platforms = devices->childKeys();
|
|
|
|
devices->endGroup();
|
2009-02-25 21:05:57 +00:00
|
|
|
|
2008-04-03 20:05:13 +00:00
|
|
|
for(int i = 0; i < platforms.size(); i++)
|
|
|
|
{
|
|
|
|
devices->beginGroup("platforms");
|
|
|
|
QString target = devices->value(platforms.at(i)).toString();
|
|
|
|
devices->endGroup();
|
|
|
|
devices->beginGroup(target);
|
2008-04-03 23:14:58 +00:00
|
|
|
QStringList ids = devices->value("usbid").toStringList();
|
|
|
|
int j = ids.size();
|
|
|
|
while(j--)
|
|
|
|
map.insert(ids.at(j).toInt(0, 16), target);
|
|
|
|
|
2008-04-03 20:05:13 +00:00
|
|
|
devices->endGroup();
|
|
|
|
}
|
|
|
|
return map;
|
|
|
|
}
|
|
|
|
|
|
|
|
QMap<int, QString> RbSettings::usbIdErrorMap()
|
|
|
|
{
|
|
|
|
|
|
|
|
QMap<int, QString> map;
|
|
|
|
// get a list of ID -> target name
|
|
|
|
QStringList platforms;
|
|
|
|
devices->beginGroup("platforms");
|
|
|
|
platforms = devices->childKeys();
|
|
|
|
devices->endGroup();
|
2009-02-25 21:05:57 +00:00
|
|
|
|
2008-04-03 20:05:13 +00:00
|
|
|
for(int i = 0; i < platforms.size(); i++)
|
|
|
|
{
|
|
|
|
devices->beginGroup("platforms");
|
|
|
|
QString target = devices->value(platforms.at(i)).toString();
|
|
|
|
devices->endGroup();
|
|
|
|
devices->beginGroup(target);
|
2008-04-03 23:14:58 +00:00
|
|
|
QStringList ids = devices->value("usberror").toStringList();
|
|
|
|
int j = ids.size();
|
|
|
|
while(j--)
|
|
|
|
map.insert(ids.at(j).toInt(0, 16), target);
|
2008-04-03 20:05:13 +00:00
|
|
|
devices->endGroup();
|
|
|
|
}
|
|
|
|
return map;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-04-05 21:48:54 +00:00
|
|
|
QMap<int, QString> RbSettings::usbIdIncompatMap()
|
|
|
|
{
|
|
|
|
|
|
|
|
QMap<int, QString> map;
|
|
|
|
// get a list of ID -> target name
|
|
|
|
QStringList platforms;
|
|
|
|
devices->beginGroup("platforms");
|
|
|
|
platforms = devices->childKeys();
|
|
|
|
devices->endGroup();
|
2009-02-25 21:05:57 +00:00
|
|
|
|
2008-04-05 21:48:54 +00:00
|
|
|
for(int i = 0; i < platforms.size(); i++)
|
|
|
|
{
|
|
|
|
devices->beginGroup("platforms");
|
|
|
|
QString target = devices->value(platforms.at(i)).toString();
|
|
|
|
devices->endGroup();
|
|
|
|
devices->beginGroup(target);
|
|
|
|
QStringList ids = devices->value("usbincompat").toStringList();
|
|
|
|
int j = ids.size();
|
|
|
|
while(j--)
|
|
|
|
map.insert(ids.at(j).toInt(0, 16), target);
|
|
|
|
devices->endGroup();
|
|
|
|
}
|
|
|
|
return map;
|
|
|
|
}
|
|
|
|
|
2008-04-03 20:05:13 +00:00
|
|
|
|
2008-01-25 00:12:25 +00:00
|
|
|
QString RbSettings::curResolution()
|
|
|
|
{
|
2008-04-24 20:40:33 +00:00
|
|
|
return deviceSettingCurGet("resolution").toString();
|
2008-01-25 00:12:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int RbSettings::curTargetId()
|
|
|
|
{
|
2008-04-24 20:40:33 +00:00
|
|
|
return deviceSettingCurGet("targetid").toInt();
|
2008-01-25 00:12:25 +00:00
|
|
|
}
|
|
|
|
|
2008-07-07 21:40:44 +00:00
|
|
|
void RbSettings::setCurVersion(QString version)
|
|
|
|
{
|
|
|
|
userSettings->setValue("rbutil_version",version);
|
|
|
|
}
|
2008-01-25 00:12:25 +00:00
|
|
|
|
|
|
|
void RbSettings::setOfPath(QString path)
|
|
|
|
{
|
|
|
|
userSettings->setValue("ofpath",path);
|
|
|
|
}
|
|
|
|
|
|
|
|
void RbSettings::setCachePath(QString path)
|
|
|
|
{
|
|
|
|
userSettings->setValue("cachepath", path);
|
|
|
|
}
|
|
|
|
|
|
|
|
void RbSettings::setBuild(QString build)
|
|
|
|
{
|
|
|
|
userSettings->setValue("build", build);
|
|
|
|
}
|
|
|
|
|
|
|
|
void RbSettings::setLastTalkedDir(QString dir)
|
|
|
|
{
|
|
|
|
userSettings->setValue("last_talked_folder", dir);
|
|
|
|
}
|
|
|
|
|
|
|
|
void RbSettings::setVoiceLanguage(QString dir)
|
|
|
|
{
|
|
|
|
userSettings->setValue("voicelanguage", dir);
|
|
|
|
}
|
|
|
|
|
|
|
|
void RbSettings::setWavtrimTh(int th)
|
|
|
|
{
|
|
|
|
userSettings->setValue("wavtrimthreshold", th);
|
|
|
|
}
|
|
|
|
|
|
|
|
void RbSettings::setProxy(QString proxy)
|
|
|
|
{
|
|
|
|
userSettings->setValue("proxy", proxy);
|
|
|
|
}
|
|
|
|
|
|
|
|
void RbSettings::setProxyType(QString proxytype)
|
|
|
|
{
|
|
|
|
userSettings->setValue("proxytype", proxytype);
|
|
|
|
}
|
|
|
|
|
|
|
|
void RbSettings::setLang(QString lang)
|
|
|
|
{
|
|
|
|
userSettings->setValue("lang", lang);
|
|
|
|
}
|
|
|
|
|
|
|
|
void RbSettings::setMountpoint(QString mp)
|
|
|
|
{
|
|
|
|
userSettings->setValue("mountpoint",mp);
|
|
|
|
}
|
|
|
|
|
|
|
|
void RbSettings::setCurPlatform(QString platt)
|
|
|
|
{
|
|
|
|
userSettings->setValue("platform",platt);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void RbSettings::setCacheDisable(bool on)
|
|
|
|
{
|
|
|
|
userSettings->setValue("cachedisable",on);
|
|
|
|
}
|
|
|
|
|
|
|
|
void RbSettings::setCacheOffline(bool on)
|
|
|
|
{
|
|
|
|
userSettings->setValue("offline",on);
|
|
|
|
}
|
|
|
|
|
|
|
|
void RbSettings::setCurTTS(QString tts)
|
|
|
|
{
|
|
|
|
userSettings->setValue("tts",tts);
|
|
|
|
}
|
|
|
|
|
|
|
|
void RbSettings::setTTSPath(QString tts, QString path)
|
|
|
|
{
|
2008-04-24 20:40:33 +00:00
|
|
|
userSettingsGroupSet(tts,"ttspath",path);
|
2008-01-25 00:12:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void RbSettings::setTTSOptions(QString tts, QString options)
|
|
|
|
{
|
2008-04-24 20:40:33 +00:00
|
|
|
userSettingsGroupSet(tts,"ttsoptions",options);
|
2008-01-25 00:12:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void RbSettings::setTTSVoice(QString tts, QString voice)
|
|
|
|
{
|
2008-04-24 20:40:33 +00:00
|
|
|
userSettingsGroupSet(tts,"ttsvoice",voice);
|
2008-01-25 00:12:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void RbSettings::setTTSSpeed(QString tts, int speed)
|
|
|
|
{
|
2008-04-24 20:40:33 +00:00
|
|
|
userSettingsGroupSet(tts,"ttsspeed",speed);
|
2008-01-25 00:12:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void RbSettings::setTTSLang(QString tts, QString lang)
|
|
|
|
{
|
2008-04-24 20:40:33 +00:00
|
|
|
userSettingsGroupSet(tts,"ttslanguage",lang);
|
2008-01-25 00:12:25 +00:00
|
|
|
}
|
|
|
|
|
2008-02-11 17:39:07 +00:00
|
|
|
void RbSettings::setTTSUseSapi4(bool value)
|
|
|
|
{
|
2008-04-24 20:40:33 +00:00
|
|
|
userSettingsGroupSet("sapi","useSapi4",value);
|
2009-02-25 21:05:57 +00:00
|
|
|
}
|
2008-02-11 17:39:07 +00:00
|
|
|
|
2008-01-25 00:12:25 +00:00
|
|
|
void RbSettings::setEncoderPath(QString enc, QString path)
|
|
|
|
{
|
2008-04-24 20:40:33 +00:00
|
|
|
userSettingsGroupSet(enc,"encoderpath",path);
|
2008-01-25 00:12:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void RbSettings::setEncoderOptions(QString enc, QString options)
|
|
|
|
{
|
2008-04-24 20:40:33 +00:00
|
|
|
userSettingsGroupSet(enc,"encoderoptions",options);
|
2008-01-25 00:12:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void RbSettings::setEncoderQuality(QString enc, double q)
|
|
|
|
{
|
2008-04-24 20:40:33 +00:00
|
|
|
userSettingsGroupSet(enc,"quality",q);
|
2008-01-25 00:12:25 +00:00
|
|
|
}
|
|
|
|
void RbSettings::setEncoderComplexity(QString enc, int c)
|
|
|
|
{
|
2008-04-24 20:40:33 +00:00
|
|
|
userSettingsGroupSet(enc,"complexity",c);
|
2008-01-25 00:12:25 +00:00
|
|
|
}
|
|
|
|
void RbSettings::setEncoderVolume(QString enc,double v)
|
|
|
|
{
|
2008-04-24 20:40:33 +00:00
|
|
|
userSettingsGroupSet(enc,"volume",v);
|
2008-01-25 00:12:25 +00:00
|
|
|
}
|
|
|
|
void RbSettings::setEncoderNarrowband(QString enc,bool nb)
|
|
|
|
{
|
2008-04-24 20:40:33 +00:00
|
|
|
userSettingsGroupSet(enc,"narrowband",nb);
|
2008-01-25 00:12:25 +00:00
|
|
|
}
|
2008-09-28 17:02:36 +00:00
|
|
|
|