本文整理汇总了C++中MythUIText类的典型用法代码示例。如果您正苦于以下问题:C++ MythUIText类的具体用法?C++ MythUIText怎么用?C++ MythUIText使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MythUIText类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetTextFromMap
void ChannelRecPriority::updateInfo(MythUIButtonListItem *item)
{
if (!item)
return;
ChannelInfo *channelItem = item->GetData().value<ChannelInfo *>();
if (!m_channelData.isEmpty() && channelItem)
{
QString rectype;
if (m_iconImage)
{
QString iconUrl = gCoreContext->GetMasterHostPrefix("ChannelIcons", channelItem->icon);
m_iconImage->SetFilename(iconUrl);
m_iconImage->Load();
}
InfoMap chanmap;
channelItem->ToMap(chanmap);
SetTextFromMap(chanmap);
if (m_chanstringText)
m_chanstringText->SetText(channelItem->GetFormatted(ChannelInfo::kChannelLong));
}
MythUIText *norecordingText = dynamic_cast<MythUIText*>
(GetChild("norecordings_info"));
if (norecordingText)
norecordingText->SetVisible(m_channelData.isEmpty());
}
示例2: SetTextFromMap
void MythUIStateType::SetTextFromMap(const InfoMap &infoMap)
{
if (m_ObjectsByName.isEmpty() && m_ObjectsByState.isEmpty())
return;
QMap<QString, MythUIType *>::Iterator i;
for (i = m_ObjectsByName.begin(); i != m_ObjectsByName.end(); ++i)
{
MythUIType *type = i.value();
MythUIText *textType = dynamic_cast<MythUIText *> (type);
if (textType)
textType->SetTextFromMap(infoMap);
MythUIComposite *group = dynamic_cast<MythUIComposite *> (type);
if (group)
group->SetTextFromMap(infoMap);
}
QMap<int, MythUIType *>::Iterator j;
for (j = m_ObjectsByState.begin(); j != m_ObjectsByState.end(); ++j)
{
MythUIType *type = j.value();
MythUIText *textType = dynamic_cast<MythUIText *> (type);
if (textType)
textType->SetTextFromMap(infoMap);
MythUIComposite *group = dynamic_cast<MythUIComposite *> (type);
if (group)
group->SetTextFromMap(infoMap);
}
}
示例3: Create
bool PlotDialog::Create()
{
if (!LoadWindowFromXML("video-ui.xml", "descriptionpopup", this))
return false;
MythUIText *plotText = nullptr;
MythUIButton *okButton = nullptr;
bool err = false;
UIUtilE::Assign(this, plotText, "description", &err);
if (err)
{
LOG(VB_GENERAL, LOG_ERR, "Cannot load screen 'descriptionpopup'");
return false;
}
UIUtilW::Assign(this, okButton, "ok");
plotText->SetText(m_metadata->GetPlot());
if (okButton)
connect(okButton, SIGNAL(Clicked()), SLOT(Close()));
BuildFocusList();
return true;
}
示例4: LOG
/** \fn RawSettingsEditor::Create(void)
* \brief Creates the UI screen.
*/
bool RawSettingsEditor::Create(void)
{
if (!LoadWindowFromXML("settings-ui.xml", "rawsettingseditor", this))
return false;
m_settingsList = dynamic_cast<MythUIButtonList *> (GetChild("settings"));
m_saveButton = dynamic_cast<MythUIButton *> (GetChild("save"));
m_cancelButton = dynamic_cast<MythUIButton *> (GetChild("cancel"));
m_textLabel = dynamic_cast<MythUIText *> (GetChild("label-text"));
if (!m_settingsList || !m_textLabel || !m_saveButton || !m_cancelButton)
{
LOG(VB_GENERAL, LOG_EMERG,
"Theme is missing critical theme elements.");
return false;
}
BuildFocusList();
MythUIText *text = dynamic_cast<MythUIText *> (GetChild("heading"));
if (text)
text->SetText(m_title);
MythUIShape *shape = nullptr;
for (int i = -8; i <= 8; i++)
{
text = dynamic_cast<MythUIText *>
(GetChild(QString("value%1%2").arg(i >= 0? "+" : "").arg(i)));
if (text)
m_prevNextTexts[i] = text;
shape = dynamic_cast<MythUIShape *>
(GetChild(QString("shape%1%2").arg(i >= 0? "+" : "").arg(i)));
if (shape)
m_prevNextShapes[i] = shape;
}
m_settingValue = dynamic_cast<MythUITextEdit *> (GetChild("settingvalue"));
connect(m_settingsList, SIGNAL(itemSelected(MythUIButtonListItem*)),
SLOT(selectionChanged(MythUIButtonListItem*)));
connect(m_settingValue, SIGNAL(LosingFocus()), SLOT(valueChanged()));
connect(m_saveButton, SIGNAL(Clicked()), this, SLOT(Save()));
connect(m_cancelButton, SIGNAL(Clicked()), this, SLOT(Close()));
LoadInBackground();
return true;
}
示例5: LoadWindowFromXML
bool ScreenSetup::Create()
{
bool foundtheme = false;
// Load the theme for this screen
foundtheme = LoadWindowFromXML("weather-ui.xml", "screen-setup", this);
if (!foundtheme)
return false;
m_helpText = dynamic_cast<MythUIText *> (GetChild("helptxt"));
m_activeList = dynamic_cast<MythUIButtonList *> (GetChild("activelist"));
m_inactiveList = dynamic_cast<MythUIButtonList *> (GetChild("inactivelist"));
m_finishButton = dynamic_cast<MythUIButton *> (GetChild("finishbutton"));
MythUIText *activeheader = dynamic_cast<MythUIText *> (GetChild("activehdr"));
if (activeheader)
activeheader->SetText(tr("Active Screens"));
MythUIText *inactiveheader = dynamic_cast<MythUIText *> (GetChild("inactivehdr"));
if (inactiveheader)
inactiveheader->SetText(tr("Inactive Screens"));
if (!m_activeList || !m_inactiveList || !m_finishButton || !m_helpText)
{
LOG(VB_GENERAL, LOG_ERR, "Theme is missing required elements.");
return false;
}
BuildFocusList();
connect(m_activeList, SIGNAL(itemSelected(MythUIButtonListItem *)),
this, SLOT(updateHelpText()));
connect(m_activeList, SIGNAL(itemClicked(MythUIButtonListItem *)),
this, SLOT(doListSelect(MythUIButtonListItem *)));
connect(m_inactiveList, SIGNAL(itemSelected(MythUIButtonListItem *)),
this, SLOT(updateHelpText()));
connect(m_inactiveList, SIGNAL(itemClicked(MythUIButtonListItem *)),
this, SLOT(doListSelect(MythUIButtonListItem *)));
SetFocusWidget(m_inactiveList);
m_finishButton->SetText(tr("Finish"));
connect(m_finishButton, SIGNAL(Clicked()), this, SLOT(saveData()));
loadData();
return true;
}
示例6: MythUIButtonListItem
void ChannelRecPriority::updateList()
{
m_channelList->Reset();
QMap<QString, ChannelInfo*>::Iterator it;
MythUIButtonListItem *item;
for (it = m_sortedChannel.begin(); it != m_sortedChannel.end(); ++it)
{
ChannelInfo *chanInfo = *it;
item = new MythUIButtonListItem(m_channelList, "",
qVariantFromValue(chanInfo));
QString fontState = "default";
if (!m_visMap[chanInfo->chanid])
fontState = "disabled";
QString stringFormat = item->GetText();
if (stringFormat.isEmpty())
stringFormat = "<num> <sign> \"<name>\"";
item->SetText(chanInfo->GetFormatted(stringFormat), fontState);
item->SetText(chanInfo->chanstr, "channum", fontState);
item->SetText(chanInfo->callsign, "callsign", fontState);
item->SetText(chanInfo->channame, "name", fontState);
item->SetText(QString().setNum(chanInfo->sourceid), "sourceid",
fontState);
item->SetText(chanInfo->sourcename, "sourcename", fontState);
if (m_visMap[chanInfo->chanid])
item->DisplayState("normal", "status");
else
item->DisplayState("disabled", "status");
item->SetImage(chanInfo->iconpath, "icon");
item->SetImage(chanInfo->iconpath);
item->SetText(chanInfo->recpriority, "priority", fontState);
if (m_currentItem == chanInfo)
m_channelList->SetItemCurrent(item);
}
MythUIText *norecordingText = dynamic_cast<MythUIText*>
(GetChild("norecordings_info"));
if (norecordingText)
norecordingText->SetVisible(m_channelData.isEmpty());
}
示例7: MythUIButtonListItem
void ChannelRecPriority::updateList()
{
m_channelList->Reset();
QMap<QString, ChannelInfo*>::Iterator it;
for (it = m_sortedChannel.begin(); it != m_sortedChannel.end(); ++it)
{
ChannelInfo *chanInfo = *it;
MythUIButtonListItem *item =
new MythUIButtonListItem(m_channelList, "",
qVariantFromValue(chanInfo));
QString fontState = "default";
item->SetText(chanInfo->GetFormatted(ChannelInfo::kChannelLong),
fontState);
InfoMap infomap;
chanInfo->ToMap(infomap);
item->SetTextFromMap(infomap, fontState);
item->DisplayState("normal", "status");
if (!chanInfo->icon.isEmpty())
{
QString iconUrl = gCoreContext->GetMasterHostPrefix("ChannelIcons",
chanInfo->icon);
item->SetImage(iconUrl, "icon");
item->SetImage(iconUrl);
}
item->SetText(QString::number(chanInfo->recpriority), "priority", fontState);
if (m_currentItem == chanInfo)
m_channelList->SetItemCurrent(item);
}
// this textarea name is depreciated use 'nochannels_warning' instead
MythUIText *noChannelsText = dynamic_cast<MythUIText*>(GetChild("norecordings_info"));
if (!noChannelsText)
noChannelsText = dynamic_cast<MythUIText*>(GetChild("nochannels_warning"));
if (noChannelsText)
noChannelsText->SetVisible(m_channelData.isEmpty());
}
示例8: MythUIButtonListItem
void ChannelRecPriority::updateList()
{
m_channelList->Reset();
QMap<QString, ChannelInfo*>::Iterator it;
MythUIButtonListItem *item;
for (it = m_sortedChannel.begin(); it != m_sortedChannel.end(); ++it)
{
ChannelInfo *chanInfo = *it;
item = new MythUIButtonListItem(m_channelList, "",
qVariantFromValue(chanInfo));
QString fontState = "default";
if (!m_visMap[chanInfo->chanid])
fontState = "disabled";
item->SetText(chanInfo->GetFormatted(ChannelInfo::kChannelLong),
fontState);
InfoMap infomap;
chanInfo->ToMap(infomap);
item->SetTextFromMap(infomap, fontState);
if (m_visMap[chanInfo->chanid])
item->DisplayState("normal", "status");
else
item->DisplayState("disabled", "status");
item->SetImage(chanInfo->iconpath, "icon");
item->SetImage(chanInfo->iconpath);
item->SetText(chanInfo->recpriority, "priority", fontState);
if (m_currentItem == chanInfo)
m_channelList->SetItemCurrent(item);
}
MythUIText *norecordingText = dynamic_cast<MythUIText*>
(GetChild("norecordings_info"));
if (norecordingText)
norecordingText->SetVisible(m_channelData.isEmpty());
}
示例9: font
void SubtitleScreen::DrawTextSubtitles(QStringList &wrappedsubs,
uint64_t start, uint64_t duration)
{
QFontMetrics font(*(gTextSubFont->GetFace()));
int height = font.height() * (1 + PAD_HEIGHT);
int pad_width = font.maxWidth() * PAD_WIDTH;
int y = m_safeArea.height() - (height * wrappedsubs.size());
int centre = m_safeArea.width() / 2;
QBrush bgfill = QBrush(QColor(0, 0, 0), Qt::SolidPattern);
foreach (QString subtitle, wrappedsubs)
{
if (subtitle.isEmpty())
continue;
int width = font.width(subtitle) + pad_width * 2;
int x = centre - (width / 2) - pad_width;
QRect rect(x, y, width, height);
if (m_useBackground)
{
MythUIShape *shape = new MythUIShape(this,
QString("tsubbg%1%2").arg(x).arg(y));
shape->SetFillBrush(bgfill);
shape->SetArea(MythRect(rect));
if (duration > 0)
m_expireTimes.insert(shape, start + duration);
}
MythUIText* text = new MythUIText(subtitle, *gTextSubFont, rect,
rect, this, QString("tsub%1%2").arg(x).arg(y));
if (text)
text->SetJustification(Qt::AlignCenter);
y += height;
LOG(VB_PLAYBACK, LOG_INFO, LOC + subtitle);
m_refreshArea = true;
if (duration > 0)
{
m_expireTimes.insert(text, start + duration);
LOG(VB_PLAYBACK, LOG_INFO, LOC +
QString("Display text subtitle for %1 ms").arg(duration));
}
}
}
示例10: while
bool MythScreenType::SetFocusWidget(MythUIType *widget)
{
if (!widget || !widget->IsVisible())
{
QMap<int, MythUIType *>::iterator it = m_FocusWidgetList.begin();
MythUIType *current;
while (it != m_FocusWidgetList.end())
{
current = *it;
if (current->CanTakeFocus() && current->IsVisible())
{
widget = current;
break;
}
++it;
}
}
if (!widget)
return false;
if (m_CurrentFocusWidget == widget)
return true;
MythUIText *helpText = dynamic_cast<MythUIText *>(GetChild("helptext"));
if (helpText)
helpText->Reset();
if (m_CurrentFocusWidget)
m_CurrentFocusWidget->LoseFocus();
m_CurrentFocusWidget = widget;
m_CurrentFocusWidget->TakeFocus();
if (helpText && !widget->GetHelpText().isEmpty())
helpText->SetText(widget->GetHelpText());
return true;
}
示例11: if
void IdleScreen::UpdateStatus(void)
{
QString state = "idle";
if (CheckConnectionToServer())
{
if (m_secondsToShutdown >= 0)
state = "shuttingdown";
else if (RemoteGetRecordingStatus())
state = "recording";
}
else
{
state = "offline";
}
m_statusState->DisplayState(state);
MythUIType* shuttingdown = m_statusState->GetState("shuttingdown");
if (shuttingdown)
{
MythUIText *statusText = dynamic_cast<MythUIText *>(shuttingdown->GetChild("status"));
if (statusText)
{
if (m_secondsToShutdown >= 0)
{
QString status = tr("Backend will shutdown in %n "
"second(s).", "", m_secondsToShutdown);
statusText->SetText(status);
}
else
statusText->Reset();
}
}
}
示例12: DoSetTextFromMap
static void DoSetTextFromMap(MythUIType *UItype, QHash<QString, QString> &infoMap)
{
QList<MythUIType *> *children = UItype->GetAllChildren();
MythUIText *textType;
QMutableListIterator<MythUIType *> i(*children);
while (i.hasNext())
{
MythUIType *type = i.next();
if (!type->IsVisible())
continue;
textType = dynamic_cast<MythUIText *> (type);
if (textType && infoMap.contains(textType->objectName()))
textType->SetTextFromMap(infoMap);
MythUIGroup *group = dynamic_cast<MythUIGroup *> (type);
if (group)
DoSetTextFromMap(type, infoMap);
}
}
示例13: Create
bool MythConfirmationDialog::Create(void)
{
if (!CopyWindowFromBase("MythConfirmationDialog", this))
return false;
MythUIText *messageText = NULL;
MythUIButton *okButton = NULL;
MythUIButton *cancelButton = NULL;
bool err = false;
UIUtilE::Assign(this, messageText, "message", &err);
UIUtilE::Assign(this, okButton, "ok", &err);
UIUtilE::Assign(this, cancelButton, "cancel", &err);
if (err)
{
VERBOSE(VB_IMPORTANT, "Cannot load screen 'MythConfirmationDialog'");
return false;
}
if (m_showCancel)
{
connect(cancelButton, SIGNAL(Clicked()), SLOT(Cancel()));
}
else
cancelButton->SetVisible(false);
connect(okButton, SIGNAL(Clicked()), SLOT(Confirm()));
messageText->SetText(m_message);
BuildFocusList();
SetFocusWidget(okButton);
return true;
}
示例14: updateInfo
void ChannelRecPriority::updateInfo(MythUIButtonListItem *item)
{
if (!item)
return;
ChannelInfo *channelItem = qVariantValue<ChannelInfo *>(item->GetData());
if (!m_channelData.isEmpty() && channelItem)
{
QString rectype;
if (m_iconImage)
{
m_iconImage->SetFilename(channelItem->iconpath);
m_iconImage->Load();
}
if (m_chanstringText)
m_chanstringText->SetText(channelItem->GetFormatted(m_longchannelformat));
if (m_callsignText)
m_callsignText->SetText(channelItem->callsign);
if (m_channumText)
m_channumText->SetText(channelItem->chanstr);
if (m_channameText)
m_channameText->SetText(channelItem->channame);
if (m_sourcenameText)
m_sourcenameText->SetText(channelItem->sourcename);
if (m_sourceidText)
m_sourceidText->SetText(QString().setNum(channelItem->sourceid));
if (m_priorityText)
m_priorityText->SetText(channelItem->recpriority);
}
MythUIText *norecordingText = dynamic_cast<MythUIText*>
(GetChild("norecordings_info"));
if (norecordingText)
norecordingText->SetVisible(m_channelData.isEmpty());
}
示例15: LOG
//.........这里部分代码省略.........
QString rawstring = list[i]->str;
mythfont = Get708Font(list[i]->attr);
if ((list[i]->y < row) || !mythfont || rawstring.isEmpty())
continue;
QString trimmed = rawstring.trimmed();
if (!trimmed.size() && last)
continue;
QFontMetrics font(*(mythfont->GetFace()));
uint height = (uint)font.height() * (1 + PAD_HEIGHT);
maxheight = max(maxheight, height);
uint spacewidth = font.width(QString(" "));
uint textwidth = font.width(trimmed);
int leading = 0;
int trailing = 0;
if (trimmed.size() != rawstring.size())
{
if (trimmed.size())
{
leading = rawstring.indexOf(trimmed.at(0));
trailing = rawstring.size() - trimmed.size() - leading;
}
else
{
leading = rawstring.size();
}
leading *= spacewidth;
trailing *= spacewidth;
}
if (!leading)
textwidth += spacewidth * PAD_WIDTH;
if (!trailing)
textwidth += spacewidth * PAD_WIDTH;
bool background = list[i]->attr.GetBGAlpha();
QBrush bgfill = QBrush((list[i]->attr.GetBGColor(), Qt::SolidPattern));
if (leading && background && !first)
{
// draw background for leading space
QRect space(x, y, leading, height);
MythUIShape *shape = new MythUIShape(this,
QString("cc708shape%1x%2lead").arg(row).arg(i));
shape->SetFillBrush(bgfill);
shape->SetArea(MythRect(space));
m_708imageCache[num].append(shape);
m_refreshArea = true;
}
x += leading;
QRect rect(x, y, textwidth, height);
if (trimmed.size() && textwidth && background)
{
MythUIShape *shape = new MythUIShape(this,
QString("cc708shape%1x%2main").arg(row).arg(i));
shape->SetFillBrush(bgfill);
shape->SetArea(MythRect(rect));
m_708imageCache[num].append(shape);
m_refreshArea = true;
}
if (trimmed.size() && textwidth)
{
MythUIText *text = new MythUIText(list[i]->str, *mythfont,
rect, rect,
(MythUIType*)this,
QString("cc708text%1x%2").arg(row).arg(i));
m_708imageCache[num].append(text);
if (text)
text->SetJustification(Qt::AlignCenter);
m_refreshArea = true;
}
x += textwidth;
if (trailing && background && !last)
{
// draw background for trailing space
QRect space(x, y, trailing, height);
MythUIShape *shape = new MythUIShape(this,
QString("cc708shape%1x%2trail").arg(row).arg(i));
shape->SetFillBrush(bgfill);
shape->SetArea(MythRect(space));
m_708imageCache[num].append(shape);
m_refreshArea = true;
}
x += trailing;
first = false;
LOG(VB_VBI, LOG_INFO, QString("Win %1 row %2 String '%3'")
.arg(num).arg(row).arg(list[i]->str));
}
y += maxheight;
}
}