• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ ThemeInfo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: ThemeInfo

ThemeInfo *ThemeChooser::loadThemeInfo(QFileInfo &theme)
{
    if (theme.fileName() == "default" || theme.fileName() == "default-wide")
        return NULL;

    ThemeInfo *themeinfo = NULL;
    if (theme.exists()) // local directory vs http:// or remote URL
        themeinfo = new ThemeInfo(theme.absoluteFilePath());
    else
        themeinfo = new ThemeInfo(theme.filePath());

    if (!themeinfo)
        return NULL;

    if (themeinfo->GetName().isEmpty() || !(themeinfo->GetType() & THEME_UI))
    {
        delete themeinfo;
        return NULL;
    }

    m_themeFileNameInfos[theme.filePath()] = themeinfo;
    m_themeNameInfos[theme.fileName()] = themeinfo;

    return themeinfo;
}
开发者ID:StefanRoss,项目名称:mythtv,代码行数:25,代码来源:themechooser.cpp


示例2: QObject

ThemeLoader::ThemeLoader(QObject* parent) : QObject(parent)
{
    ThemeInfo info;
    if (!info.load(":/themes/cute/cute.theme"))
        qWarning() << "Failed to load cute.theme";
    d.themes.append(info.name());
    d.infos.insert(info.name(), info);

    QDir inst(COMMUNI_INSTALL_THEMES);
    if (inst.exists())
        load(inst);

#if defined(Q_OS_MAC)
    QDir dir(QApplication::applicationDirPath());
    if (dir.dirName() == "MacOS" && dir.cd("../Resources/themes"))
        load(dir);
#elif defined(Q_OS_WIN)
    QDir dir(QApplication::applicationDirPath());
    if (dir.cd("themes") || (dir.cdUp() && dir.cd("themes")))
        load(dir);
#elif defined(Q_OS_UNIX)
    QDir sys("/usr/share/themes/communi");
    if (sys != inst && sys.exists())
        load(sys);
    QDir home = QDir::home();
    if (home.cd(".local/share/themes/communi"))
        load(home);
    QDir dev(QApplication::applicationDirPath());
    if (dev.cdUp() && dev.cd("themes"))
        load(dev);
#endif
}
开发者ID:communi,项目名称:communi-desktop,代码行数:32,代码来源:themeloader.cpp


示例3: ShowOkPopup

void ThemeChooser::removeTheme(void)
{
    MythUIButtonListItem *current = m_themes->GetItemCurrent();
    if (!current)
    {
        ShowOkPopup(tr("Error, no theme selected."));
        return;
    }

    ThemeInfo *info = qVariantValue<ThemeInfo *>(current->GetData());
    if (!info)
    {
        ShowOkPopup(tr("Error, unable to find current theme."));
        return;
    }

    QString themeDir = GetConfDir() + "/themes/";

    if (!info->GetPreviewPath().startsWith(themeDir))
    {
        ShowOkPopup(tr("%1 is not a user-installed theme and can not "
                       "be deleted.").arg(info->GetName()));
        return;
    }

    themeDir.append(info->GetDirectoryName());
    removeThemeDir(themeDir);

    ReloadInBackground();
}
开发者ID:StefanRoss,项目名称:mythtv,代码行数:30,代码来源:themechooser.cpp


示例4: setTheme

void WindowTheme::setTheme(QWidget* window, const ThemeInfo& theme)
{
    window->setStyleSheet(theme.style());

#ifdef QT_X11EXTRAS_LIB
    setGtkTheme(window->winId(), theme.gtkTheme().toUtf8());
#endif
}
开发者ID:0Knowledge,项目名称:communi-desktop,代码行数:8,代码来源:windowtheme.cpp


示例5: foreach

void ThemeLoader::load(QDir dir)
{
    QStringList dirs = dir.entryList(QDir::NoDotAndDotDot | QDir::Dirs);
    foreach (const QString& sd, dirs) {
        if (dir.cd(sd)) {
            QStringList files = dir.entryList(QStringList("*.theme"), QDir::Files);
            foreach (const QString& fn, files) {
                ThemeInfo info;
                if (info.load(dir.filePath(fn))) {
                    if (!d.infos.contains(info.name())) {
                        d.themes.append(info.name());
                        d.infos.insert(info.name(), info);
                    }
                }
            }
            dir.cdUp();
        }
开发者ID:communi,项目名称:communi-desktop,代码行数:17,代码来源:themeloader.cpp


示例6: itemChanged

void ThemeChooser::itemChanged(MythUIButtonListItem *item)
{
    ThemeInfo *info = qVariantValue<ThemeInfo*>(item->GetData());

    if (!info)
        return;

    QFileInfo preview(info->GetPreviewPath());
    QHash<QString, QString> infomap;
    info->ToMap(infomap);
    SetTextFromMap(infomap);
    if (m_preview)
    {
        if (preview.exists())
        {
            m_preview->SetFilename(info->GetPreviewPath());
            m_preview->Load();
        }
        else
            m_preview->Reset();
    }
    if (m_fullPreviewShowing && m_fullPreviewStateType)
    {
        if (m_fullScreenPreview)
        {
            if (preview.exists())
            {
                m_fullScreenPreview->SetFilename(info->GetPreviewPath());
                m_fullScreenPreview->Load();
            }
            else
                m_fullScreenPreview->Reset();
        }

        if (m_fullScreenName)
            m_fullScreenName->SetText(info->GetName());
    }

    MythUIStateType *themeLocation =
                    dynamic_cast<MythUIStateType*>(GetChild("themelocation"));
    if (themeLocation)
    {
        if (info->GetDownloadURL().isEmpty())
            themeLocation->DisplayState("local");
        else
            themeLocation->DisplayState("remote");
    }

    MythUIStateType *aspectState =
                        dynamic_cast<MythUIStateType*>(GetChild("aspectstate"));
    if (aspectState)
        aspectState->DisplayState(info->GetAspect());
}
开发者ID:StefanRoss,项目名称:mythtv,代码行数:53,代码来源:themechooser.cpp


示例7: saveAndReload

void ThemeChooser::saveAndReload(MythUIButtonListItem *item)
{
    ThemeInfo *info = qVariantValue<ThemeInfo *>(item->GetData());

    if (!info)
        return;

    if (!info->GetDownloadURL().isEmpty())
    {
        QString downloadURL = info->GetDownloadURL();
        QFileInfo qfile(downloadURL);
        QString baseName = qfile.fileName();

        if (!gCoreContext->GetSetting("ThemeDownloadURL").isEmpty())
        {
            QStringList tokens =
                gCoreContext->GetSetting("ThemeDownloadURL")
                    .split(";", QString::SkipEmptyParts);
            QString origURL = downloadURL;
            downloadURL.replace(tokens[0], tokens[1]);
            LOG(VB_FILE, LOG_WARNING, LOC +
                QString("Theme download URL overridden from %1 to %2.")
                    .arg(origURL).arg(downloadURL));
        }

        OpenBusyPopup(tr("Downloading %1 Theme").arg(info->GetName()));
        m_downloadTheme = info;
        m_downloadFile = RemoteDownloadFile(downloadURL,
                                            "Temp", baseName);
        m_downloadState = dsDownloadingOnBackend;
    }
    else
    {
        gCoreContext->SaveSetting("Theme", info->GetDirectoryName());
        GetMythMainWindow()->JumpTo("Reload Theme");
    }
}
开发者ID:StefanRoss,项目名称:mythtv,代码行数:37,代码来源:themechooser.cpp


示例8: toggleFullscreenPreview

void ThemeChooser::toggleFullscreenPreview(void)
{
    if (m_fullPreviewStateType)
    {
        if (m_fullPreviewShowing)
        {
            if (m_fullScreenPreview)
                m_fullScreenPreview->Reset();

            if (m_fullScreenName)
                m_fullScreenName->Reset();

            m_fullPreviewStateType->Reset();
            m_fullPreviewShowing = false;
        }
        else
        {
            MythUIButtonListItem *item = m_themes->GetItemCurrent();
            ThemeInfo *info = qVariantValue<ThemeInfo*>(item->GetData());
            if (info)
            {
                if (m_fullScreenPreview)
                {
                    m_fullScreenPreview->SetFilename(info->GetPreviewPath());
                    m_fullScreenPreview->Load();
                }

                if (m_fullScreenName)
                    m_fullScreenName->SetText(info->GetName());

                m_fullPreviewStateType->DisplayState("fullscreen");
                m_fullPreviewShowing = true;
            }
        }
    }
}
开发者ID:StefanRoss,项目名称:mythtv,代码行数:36,代码来源:themechooser.cpp


示例9: GetMythDB

void MythUIHelper::LoadQtConfig(void)
{
    gCoreContext->ResetLanguage();
    d->themecachedir.clear();

    if (GetMythDB()->GetNumSetting("UseVideoModes", 0))
    {
        DisplayRes *dispRes = DisplayRes::GetDisplayRes(); // create singleton

        if (dispRes)
        {
            d->display_res = dispRes;
            // Make sure DisplayRes has current context info
            d->display_res->Initialize();
            // Switch to desired GUI resolution
            if (d->display_res->SwitchToGUI())
            {
                d->WaitForScreenChange();
            }
        }
    }

    // Note the possibly changed screen settings
    d->GetScreenBounds();

    delete d->m_qtThemeSettings;

    d->m_qtThemeSettings = new Settings;

    qApp->setStyle("Windows");

    QString themename = GetMythDB()->GetSetting("Theme", DEFAULT_UI_THEME);
    QString themedir = FindThemeDir(themename);

    ThemeInfo *themeinfo = new ThemeInfo(themedir);

    if (themeinfo)
    {
        d->m_isWide = themeinfo->IsWide();
        d->m_baseWidth = themeinfo->GetBaseRes()->width();
        d->m_baseHeight = themeinfo->GetBaseRes()->height();
        d->m_themename = themeinfo->GetName();
        LOG(VB_GUI, LOG_INFO, LOC +
            QString("Using theme base resolution of %1x%2")
            .arg(d->m_baseWidth).arg(d->m_baseHeight));
        delete themeinfo;
    }

    // Recalculate GUI dimensions
    d->StoreGUIsettings();

    d->m_themepathname = themedir + '/';

    themedir += "/qtlook.txt";
    d->m_qtThemeSettings->ReadSettings(themedir);
    d->m_themeloaded = false;

    themename = GetMythDB()->GetSetting("MenuTheme", "defaultmenu");

    if (themename == "default")
        themename = "defaultmenu";

    d->m_menuthemepathname = FindMenuThemeDir(themename) + '/';
}
开发者ID:chadparry,项目名称:mythtv,代码行数:64,代码来源:mythuihelper.cpp


示例10: QString

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


示例11: GetMythMainWindow

void ThemeChooser::showPopupMenu(void)
{
    if (m_popupMenu)
        return;

    MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
    QString label = tr("Theme Chooser Menu");

    m_popupMenu =
        new MythDialogBox(label, popupStack, "themechoosermenupopup");

    connect(m_popupMenu, SIGNAL(Closed(QString, int)), SLOT(popupClosed(QString, int)));

    if (m_popupMenu->Create())
        popupStack->AddScreen(m_popupMenu);
    else
    {
        delete m_popupMenu;
        m_popupMenu = NULL;
        return;
    }

    m_popupMenu->SetReturnEvent(this, "popupmenu");

    if (m_fullPreviewStateType)
    {
        if (m_fullPreviewShowing)
            m_popupMenu->AddButton(tr("Hide Fullscreen Preview"),
                                   SLOT(toggleFullscreenPreview()));
        else
            m_popupMenu->AddButton(tr("Show Fullscreen Preview"),
                                   SLOT(toggleFullscreenPreview()));
    }

    m_popupMenu->AddButton(tr("Refresh Downloadable Themes"),
                           SLOT(refreshDownloadableThemes()));

    MythUIButtonListItem *current = m_themes->GetItemCurrent();
    if (current)
    {
        ThemeInfo *info = qVariantValue<ThemeInfo *>(current->GetData());

        if (info)
        {
            m_popupMenu->AddButton(tr("Select Theme"),
                                   SLOT(saveAndReload()));

            QString themeDir = GetConfDir() + "/themes/";

            if (info->GetPreviewPath().startsWith(themeDir))
                m_popupMenu->AddButton(tr("Delete Theme"),
                                       SLOT(removeTheme()));
        }
    }

    if (gCoreContext->GetNumSetting("ThemeUpdateNofications", 1))
        m_popupMenu->AddButton(tr("Disable Theme Update Notifications"),
                               SLOT(toggleThemeUpdateNotifications()));
    else
        m_popupMenu->AddButton(tr("Enable Theme Update Notifications"),
                               SLOT(toggleThemeUpdateNotifications()));
}
开发者ID:StefanRoss,项目名称:mythtv,代码行数:62,代码来源:themechooser.cpp


示例12: SetBusyPopupMessage

void ThemeChooser::Load(void)
{
    SetBusyPopupMessage(tr("Loading Installed Themes"));

    QString MythVersion = MYTH_SOURCE_PATH;
    QStringList themesSeen;
    QDir themes(GetConfDir() + "/themes");
    themes.setFilter(QDir::Dirs | QDir::NoDotAndDotDot);
    themes.setSorting(QDir::Name | QDir::IgnoreCase);

    // FIXME: For now, treat git master the same as svn trunk
    if (MythVersion == "master")
        MythVersion = "trunk";

    if (MythVersion != "trunk")
    {
        MythVersion = MYTH_BINARY_VERSION; // Example: 0.25.20101017-1
        MythVersion.replace(QRegExp("\\.[0-9]{8,}.*"), "");
    }

    m_infoList = themes.entryInfoList();

    for( QFileInfoList::iterator it =  m_infoList.begin();
                                 it != m_infoList.end();
                               ++it )
    {
        if (loadThemeInfo(*it))
        {
            themesSeen << (*it).fileName();
            m_themeStatuses[(*it).fileName()] = "default";
        }
    }

    themes.setPath(GetThemesParentDir());
    QFileInfoList sharedThemes = themes.entryInfoList();
    for( QFileInfoList::iterator it =  sharedThemes.begin();
                                 it != sharedThemes.end();
                               ++it )
    {
        if ((!themesSeen.contains((*it).fileName())) &&
            (loadThemeInfo(*it)))
        {
            m_infoList << *it;
            themesSeen << (*it).fileName();
            m_themeStatuses[(*it).fileName()] = "default";
        }
    }

    QString remoteThemesFile = GetConfDir();
    remoteThemesFile.append("/tmp/themes.zip");
    QString themeSite = QString("%1/%2")
        .arg(gCoreContext->GetSetting("ThemeRepositoryURL",
             "http://themes.mythtv.org/themes/repository")).arg(MythVersion);

    int downloadFailures =
        gCoreContext->GetNumSetting("ThemeInfoDownloadFailures", 0);
    if (QFile::exists(remoteThemesFile))
    {
        QFileInfo finfo(remoteThemesFile);
        if (finfo.lastModified() < mythCurrentDateTime().addSecs(-600))
        {
            LOG(VB_GUI, LOG_INFO, LOC +
                QString("%1 is over 10 minutes old, forcing "
                        "remote theme list download").arg(remoteThemesFile));
            m_refreshDownloadableThemes = true;
        }
    }
    else if (downloadFailures < 2) // (and themes.zip does not exist)
    {
        LOG(VB_GUI, LOG_INFO, LOC +
            QString("%1 does not exist, forcing remote theme "
                    "list download").arg(remoteThemesFile));
        m_refreshDownloadableThemes = true;
    }

    if (m_refreshDownloadableThemes)
    {
        SetBusyPopupMessage(tr("Refreshing Downloadable Themes Information"));

        QString url = themeSite;
        url.append("/themes.zip");
        QString destdir = GetMythUI()->GetThemeCacheDir();
        destdir.append("/themechooser");
        QString versiondir = QString("%1/%2").arg(destdir).arg(MythVersion);
        removeThemeDir(versiondir);
        QDir dir;
        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);
        }
    }
//.........这里部分代码省略.........
开发者ID:StefanRoss,项目名称:mythtv,代码行数:101,代码来源:themechooser.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ThermalZone类代码示例发布时间:2022-05-31
下一篇:
C++ Theme类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap