本文整理汇总了C++中ThemeInfo::GetDirectoryName方法的典型用法代码示例。如果您正苦于以下问题:C++ ThemeInfo::GetDirectoryName方法的具体用法?C++ ThemeInfo::GetDirectoryName怎么用?C++ ThemeInfo::GetDirectoryName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ThemeInfo
的用法示例。
在下文中一共展示了ThemeInfo::GetDirectoryName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: removeTheme
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();
}
示例2: 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");
}
}
示例3: 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);
}