当前位置: 首页>>代码示例>>C++>>正文


C++ ConfigObject::getValueString方法代码示例

本文整理汇总了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());
    }
}
开发者ID:coinhelper,项目名称:mixxx,代码行数:21,代码来源:control.cpp

示例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;
    }
开发者ID:neo1973,项目名称:mixxx,代码行数:66,代码来源:upgrade.cpp


注:本文中的ConfigObject::getValueString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。