本文整理汇总了C++中ConfigObject::getValueString方法的典型用法代码示例。如果您正苦于以下问题:C++ ConfigObject::getValueString方法的具体用法?C++ ConfigObject::getValueString怎么用?C++ ConfigObject::getValueString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfigObject
的用法示例。
在下文中一共展示了ConfigObject::getValueString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initialize
void ControlDoublePrivate::initialize(double defaultValue) {
m_defaultValue.setValue(defaultValue);
double initialValue = defaultValue;
if (m_bPersistInConfiguration) {
ConfigObject<ConfigValue>* pConfig = ControlDoublePrivate::s_pUserConfig;
if (pConfig != NULL) {
// Assume toDouble() returns 0 if conversion fails.
initialValue = pConfig->getValueString(m_key).toDouble();
}
}
m_value.setValue(initialValue);
//qDebug() << "Creating:" << m_trackKey << "at" << &m_value << sizeof(m_value);
if (m_bTrack) {
// TODO(rryan): Make configurable.
Stat::track(m_trackKey, static_cast<Stat::StatType>(m_trackType),
static_cast<Stat::ComputeFlags>(m_trackFlags),
m_value.getValue());
}
}
示例2: qDebug
//.........这里部分代码省略.........
#ifdef __WINDOWS__
oldFilePath = oldLocation.arg("mixxx.cfg");
#else
oldFilePath = oldLocation.arg(".mixxx.cfg");
#endif
newFilePath = newLocation.arg(SETTINGS_FILE);
oldFile = new QFile(oldFilePath);
if (oldFile->copy(newFilePath))
oldFile->remove();
else {
if (oldFile->error()==14) qDebug() << errorText.arg("configuration", oldFilePath, newFilePath) << "The destination file already exists.";
else qDebug() << errorText.arg("configuration", oldFilePath, newFilePath) << "Error #" << oldFile->error();
}
delete oldFile;
}
// Tidy up
delete pre170Config;
// End pre-1.7.0 code
/***************************************************************************
* Post-1.7.0 upgrade code
*
* Add entries to the IF ladder below if anything needs to change from the
* previous to the current version. This allows for incremental upgrades
* incase a user upgrades from a few versions prior.
****************************************************************************/
// Read the config file from home directory
ConfigObject<ConfigValue> *config = new ConfigObject<ConfigValue>(settingsPath + SETTINGS_FILE);
QString configVersion = config->getValueString(ConfigKey("[Config]","Version"));
if (configVersion.isEmpty()) {
#ifdef __APPLE__
qDebug() << "Config version is empty, trying to read pre-1.9.0 config";
//Try to read the config from the pre-1.9.0 final directory on OS X (we moved it in 1.9.0 final)
QFile* oldFile = new QFile(QDir::homePath().append("/").append(".mixxx/mixxx.cfg"));
if (oldFile->exists()) {
qDebug() << "Found pre-1.9.0 config for OS X";
config = new ConfigObject<ConfigValue>(QDir::homePath().append("/").append(".mixxx/mixxx.cfg"));
//Note: We changed SETTINGS_PATH in 1.9.0 final on OS X so it must be hardcoded to ".mixxx" here for legacy.
configVersion = config->getValueString(ConfigKey("[Config]","Version"));
delete oldFile;
}
else {
#endif
//This must have been the first run... right? :)
qDebug() << "No version number in configuration file. Setting to" << VERSION;
config->set(ConfigKey("[Config]","Version"), ConfigValue(VERSION));
m_bFirstRun = true;
return config;
#ifdef __APPLE__
}
#endif
}
// If it's already current, stop here
if (configVersion == VERSION) {
qDebug() << "Configuration file is at the current version" << VERSION;
return config;
}