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


C++ ThemeInfo::GetMinorVersion方法代码示例

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


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

示例1: Init

void ThemeChooser::Init(void)
{
    QString curTheme = gCoreContext->GetSetting("Theme");
    ThemeInfo *themeinfo = NULL;
    ThemeInfo *curThemeInfo = NULL;
    MythUIButtonListItem *item = NULL;

    m_themes->Reset();
    for( QFileInfoList::iterator it =  m_infoList.begin();
                                 it != m_infoList.end();
                               ++it )
    {
        QFileInfo  &theme = *it;

        if (!m_themeFileNameInfos.contains(theme.filePath()))
            continue;

        themeinfo = m_themeFileNameInfos[theme.filePath()];
        if (!themeinfo)
            continue;

        QString buttonText = QString("%1 %2.%3")
                                .arg(themeinfo->GetName())
                                .arg(themeinfo->GetMajorVersion())
                                .arg(themeinfo->GetMinorVersion());

        item = new MythUIButtonListItem(m_themes, buttonText);
        if (item)
        {
            if (themeinfo->GetDownloadURL().isEmpty())
                item->DisplayState("local", "themelocation");
            else
                item->DisplayState("remote", "themelocation");

            item->DisplayState(themeinfo->GetAspect(), "aspectstate");

            item->DisplayState(m_themeStatuses[themeinfo->GetName()],
                               "themestatus");
            QHash<QString, QString> infomap;
            themeinfo->ToMap(infomap);
            item->SetTextFromMap(infomap);
            item->SetData(qVariantFromValue(themeinfo));

            QString thumbnail = themeinfo->GetPreviewPath();
            QFileInfo fInfo(thumbnail);
            // Downloadable themeinfos have thumbnail copies of their preview images
            if (!themeinfo->GetDownloadURL().isEmpty())
                thumbnail = thumbnail.append(".thumb.jpg");
            item->SetImage(thumbnail);

            if (curTheme == themeinfo->GetDirectoryName())
                curThemeInfo = themeinfo;
        }
        else
            delete item;
    }

    SetFocusWidget(m_themes);

    if (curThemeInfo)
        m_themes->SetValueByData(qVariantFromValue(curThemeInfo));

    MythUIButtonListItem *current = m_themes->GetItemCurrent();
    if (current)
        itemChanged(current);
}
开发者ID:StefanRoss,项目名称:mythtv,代码行数:66,代码来源:themechooser.cpp

示例2: checkForUpdate

void ThemeUpdateChecker::checkForUpdate(void)
{
    if (GetMythUI()->GetCurrentLocation(false, true) != "mainmenu")
        return;

    if (RemoteFile::Exists(m_infoPackage))
    {
        QString remoteThemeDir =
            gCoreContext->GenMythURL(gCoreContext->GetSetting("MasterServerIP"),
                                     0,
                                     QString("%1/%2").arg(m_mythVersion).arg(GetMythUI()->GetThemeName()),
                                     "Temp");

        QString infoXML = remoteThemeDir;
        infoXML.append("/themeinfo.xml");

        if (RemoteFile::Exists(infoXML))
        {
            ThemeInfo *remoteTheme = new ThemeInfo(remoteThemeDir);
            if (!remoteTheme)
            {
                LOG(VB_GENERAL, LOG_ERR,
                    QString("ThemeUpdateChecker::checkForUpdate(): "
                            "Unable to create ThemeInfo for %1")
                        .arg(infoXML));
                return;
            }
                
            ThemeInfo *localTheme = new ThemeInfo(GetMythUI()->GetThemeDir());
            if (!localTheme)
            {
                LOG(VB_GENERAL, LOG_ERR,
                    "ThemeUpdateChecker::checkForUpdate(): " 
                    "Unable to create ThemeInfo for current theme");
                return;
            }

            int rmtMaj = remoteTheme->GetMajorVersion();
            int rmtMin = remoteTheme->GetMinorVersion();
            int locMaj = localTheme->GetMajorVersion();
            int locMin = localTheme->GetMinorVersion();

            if ((rmtMaj > locMaj) ||
                ((rmtMaj == locMaj) &&
                 (rmtMin > locMin)))
            {
                m_lastKnownThemeVersion =
                    QString("%1-%2.%3").arg(GetMythUI()->GetThemeName())
                                       .arg(rmtMaj).arg(rmtMin);

                QString status = gCoreContext->GetSetting("ThemeUpdateStatus");
                QString currentLocation = GetMythUI()->GetCurrentLocation(false, true);

                if ((!status.startsWith(m_lastKnownThemeVersion)) &&
                    (currentLocation == "mainmenu"))
                {
                    m_currentVersion = QString("%1.%2").arg(locMaj).arg(locMin);
                    m_newVersion = QString("%1.%2").arg(rmtMaj).arg(rmtMin);

                    gCoreContext->SaveSetting("ThemeUpdateStatus",
                                         m_lastKnownThemeVersion + " notified");

                    QString message = tr("Version %1 of the %2 theme is now "
                                         "available in the Theme Chooser.  The "
                                         "currently installed version is %3.")
                                         .arg(m_newVersion)
                                         .arg(GetMythUI()->GetThemeName())
                                         .arg(m_currentVersion);

                    ShowOkPopup(message);
                }
            }
                
            delete remoteTheme;
            delete localTheme;
        }
    }
}
开发者ID:StefanRoss,项目名称:mythtv,代码行数:78,代码来源:themechooser.cpp

示例3: Load


//.........这里部分代码省略.........
        dir.mkpath(destdir);
        bool result = GetMythDownloadManager()->download(url, remoteThemesFile);

        SetBusyPopupMessage(tr("Extracting Downloadable Themes Information"));

        if (!result || !extractZIP(remoteThemesFile, destdir))
        {
            QFile::remove(remoteThemesFile);

            downloadFailures++;
            gCoreContext->SaveSetting("ThemeInfoDownloadFailures",
                                      downloadFailures);
        }
    }

    QDir remoteThemesDir(GetMythUI()->GetThemeCacheDir()
                             .append("/themechooser/").append(MythVersion));

    if ((QFile::exists(remoteThemesFile)) &&
        (remoteThemesDir.exists()))
    {
        SetBusyPopupMessage(tr("Loading Downloadable Themes"));

        LOG(VB_GUI, LOG_INFO, LOC +
            QString("%1 and %2 exist, using cached remote themes list")
                .arg(remoteThemesFile).arg(remoteThemesDir.absolutePath()));

        QString themesPath = remoteThemesDir.absolutePath();
        themes.setPath(themesPath);

        QFileInfoList downloadableThemes = themes.entryInfoList();
        for( QFileInfoList::iterator it =  downloadableThemes.begin();
                                     it != downloadableThemes.end();
                                   ++it )
        {
            QString dirName = (*it).fileName();
            QString themeName = dirName;
            QString remoteDir = themeSite;
            remoteDir.append("/").append(dirName);
            QString localDir = themes.absolutePath();
            localDir.append("/").append(dirName);

            if (themesSeen.contains(dirName))
            {
                ThemeInfo remoteTheme((*it).absoluteFilePath());
                ThemeInfo *localTheme = m_themeNameInfos[dirName];

                themeName = remoteTheme.GetName();

                int rmtMaj = remoteTheme.GetMajorVersion();
                int rmtMin = remoteTheme.GetMinorVersion();
                int locMaj = localTheme->GetMajorVersion();
                int locMin = localTheme->GetMinorVersion();

                if ((rmtMaj > locMaj) ||
                    ((rmtMaj == locMaj) &&
                     (rmtMin > locMin)))
                {
                    if (loadThemeInfo(*it))
                    {
                        m_infoList << *it;
                        m_themeStatuses[themeName] = "updateavailable";

                        QFileInfo finfo(remoteTheme.GetPreviewPath());
                        GetMythDownloadManager()->queueDownload(
                            remoteDir.append("/").append(finfo.fileName()),
                            localDir.append("/").append(finfo.fileName()),
                            NULL);
                    }
                }
                else if ((rmtMaj == locMaj) &&
                         (rmtMin == locMin))
                {
                    m_themeStatuses[themeName] = "uptodate";
                }
            }
            else
            {
                ThemeInfo *remoteTheme = loadThemeInfo(*it);
                if (remoteTheme)
                {
                    themeName = remoteTheme->GetName();
                    themesSeen << dirName;
                    m_infoList << *it;
                    m_themeStatuses[themeName] = "updateavailable";

                    QFileInfo finfo(remoteTheme->GetPreviewPath());
                    GetMythDownloadManager()->queueDownload(
                        remoteDir.append("/").append(finfo.fileName()),
                        localDir.append("/").append(finfo.fileName()),
                        NULL);
                }
            }
        }
    }

    ResetBusyPopup();

    qSort(m_infoList.begin(), m_infoList.end(), sortThemeNames);
}
开发者ID:StefanRoss,项目名称:mythtv,代码行数:101,代码来源:themechooser.cpp


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