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


C++ SsuCoreConfig::deviceMode方法代码示例

本文整理汇总了C++中SsuCoreConfig::deviceMode方法的典型用法代码示例。如果您正苦于以下问题:C++ SsuCoreConfig::deviceMode方法的具体用法?C++ SsuCoreConfig::deviceMode怎么用?C++ SsuCoreConfig::deviceMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SsuCoreConfig的用法示例。


在下文中一共展示了SsuCoreConfig::deviceMode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: add

int SsuRepoManager::add(QString repo, QString repoUrl){
  SsuCoreConfig *ssuSettings = SsuCoreConfig::instance();

  // adding a repo is a noop when device is in update mode...
  if ((ssuSettings->deviceMode() & Ssu::UpdateMode) == Ssu::UpdateMode)
    return -1;

  // ... or in AppInstallMode
  if ((ssuSettings->deviceMode() & Ssu::AppInstallMode) == Ssu::AppInstallMode)
    return -1;

  if (repoUrl == ""){
    // just enable a repository which has URL in repos.ini
    QStringList enabledRepos;
    if (ssuSettings->contains("enabled-repos"))
      enabledRepos = ssuSettings->value("enabled-repos").toStringList();

    enabledRepos.append(repo);
    enabledRepos.removeDuplicates();
    ssuSettings->setValue("enabled-repos", enabledRepos);
  } else
    ssuSettings->setValue("repository-urls/" + repo, repoUrl);

  ssuSettings->sync();
  return 0;
}
开发者ID:giucam,项目名称:ssu,代码行数:26,代码来源:ssurepomanager.cpp

示例2: remove

int SsuRepoManager::remove(QString repo){
  SsuCoreConfig *ssuSettings = SsuCoreConfig::instance();

  // removing a repo is a noop when device is in update mode...
  if ((ssuSettings->deviceMode() & Ssu::UpdateMode) == Ssu::UpdateMode)
    return -1;

  // ... or AppInstallMode
  if ((ssuSettings->deviceMode() & Ssu::AppInstallMode) == Ssu::AppInstallMode)
    return -1;

  if (ssuSettings->contains("repository-urls/" + repo))
    ssuSettings->remove("repository-urls/" + repo);

  if (ssuSettings->contains("enabled-repos")){
    QStringList enabledRepos = ssuSettings->value("enabled-repos").toStringList();
    if (enabledRepos.contains(repo)){
      enabledRepos.removeAll(repo);
      enabledRepos.removeDuplicates();
      ssuSettings->setValue("enabled-repos", enabledRepos);
    }
  }

  ssuSettings->sync();

  return 0;
}
开发者ID:giucam,项目名称:ssu,代码行数:27,代码来源:ssurepomanager.cpp

示例3: repos

// @todo the non-device specific repository resolving should move from deviceInfo to repomanager
QStringList SsuRepoManager::repos(bool rnd, SsuDeviceInfo &deviceInfo, int filter){
  QStringList result;

  // read the adaptation specific repositories, as well as the default
  // repositories; default repos are read through deviceInfo as an
  // adaptation is allowed to disable core repositories
  result = deviceInfo.repos(rnd, filter);

  // read the repositories of the available features. While devices have
  // a default list of features to be installed those are only relevant
  // for bootstrapping, so this code just operates on installed features
  SsuFeatureManager featureManager;
  result.append(featureManager.repos(rnd, filter));

  // read user-defined repositories from ssu.ini. This step needs to
  // happen at the end, after all other required repositories are
  // added already

  // TODO: in strict mode, filter the repository list from there
  SsuCoreConfig *ssuSettings = SsuCoreConfig::instance();

  bool updateMode = false;
  bool appInstallMode = false;

  if ((ssuSettings->deviceMode() & Ssu::UpdateMode) == Ssu::UpdateMode)
    updateMode = true;

  if ((ssuSettings->deviceMode() & Ssu::AppInstallMode) == Ssu::AppInstallMode){
    updateMode = true;
    appInstallMode = true;
  }

  if (filter == Ssu::NoFilter ||
      filter == Ssu::UserFilter){
    // user defined repositories, or ones overriding URLs for default ones
    // -> in update mode we need to check for each of those if it already
    //    exists. If it exists, keep it, if it does not, disable it
    ssuSettings->beginGroup("repository-urls");
    QStringList repoUrls = ssuSettings->allKeys();
    ssuSettings->endGroup();

    if (updateMode){
      foreach(const QString &key, repoUrls){
        if (result.contains(key))
          result.append(key);
      }
    } else {
开发者ID:giucam,项目名称:ssu,代码行数:48,代码来源:ssurepomanager.cpp

示例4: deviceMode

int Ssu::deviceMode(){
  SsuCoreConfig *settings = SsuCoreConfig::instance();
  return settings->deviceMode();
}
开发者ID:lbt,项目名称:ssu,代码行数:4,代码来源:ssu.cpp


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