本文整理汇总了C++中MythGenericTree类的典型用法代码示例。如果您正苦于以下问题:C++ MythGenericTree类的具体用法?C++ MythGenericTree怎么用?C++ MythGenericTree使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MythGenericTree类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetNodePtrFromButton
void NetTree::doDeleteVideo(bool remove)
{
if (!remove)
return;
ResultItem *item;
if (m_type == DLG_TREE)
item = qVariantValue<ResultItem *>(m_siteMap->GetCurrentNode()->GetData());
else
{
MythGenericTree *node = GetNodePtrFromButton(m_siteButtonList->GetItemCurrent());
if (!node)
return;
item = qVariantValue<ResultItem *>(node->GetData());
}
if (!item)
return;
QString filename = GetDownloadFilename(item->GetTitle(),
item->GetMediaURL());
if (filename.startsWith("myth://"))
RemoteFile::DeleteFile(filename);
else
{
QFile file(filename);
file.remove();
}
}
示例2: searchStart
void GameUI::searchStart(void)
{
MythGenericTree *parent = m_gameUITree->GetCurrentNode()->getParent();
if (parent != NULL)
{
QStringList childList;
QList<MythGenericTree*>::iterator it;
QList<MythGenericTree*> *children = parent->getAllChildren();
for (it = children->begin(); it != children->end(); ++it)
{
MythGenericTree *child = *it;
childList << child->GetText();
}
MythScreenStack *popupStack =
GetMythMainWindow()->GetStack("popup stack");
MythUISearchDialog *searchDialog = new MythUISearchDialog(popupStack,
tr("Game Search"), childList, true, "");
if (searchDialog->Create())
{
connect(searchDialog, SIGNAL(haveResult(QString)),
SLOT(searchComplete(QString)));
popupStack->AddScreen(searchDialog);
}
else
delete searchDialog;
}
}
示例3: getVisibleChildAt
MythGenericTree* MythGenericTree::getVisibleChildAt(uint reference) const
{
if (reference >= (uint)m_ordered_subnodes->count())
return NULL;
QList<MythGenericTree*> *list;
if (m_currentOrderingIndex == -1)
list = m_subnodes;
else
list = m_ordered_subnodes;
uint n = 0;
for (int i = 0; i < list->size(); ++i)
{
MythGenericTree *child = list->at(i);
if (child->IsVisible())
{
if (n == reference)
return child;
n++;
}
}
return NULL;
}
示例4: RemoveItem
/*!
* \brief Remove the item from the tree
*
* \param item Item to be removed
* \param deleteNode Also delete the node from the tree? Modifies the tree.
*
* \return True if successful
*/
void MythUIButtonTree::RemoveItem(MythUIButtonListItem *item, bool deleteNode)
{
if (!item || !m_rootNode)
return;
MythGenericTree *node = qVariantValue<MythGenericTree *>(item->GetData());
if (node && node->getParent())
{
DoSetCurrentNode(node->getParent());
if (deleteNode)
node->getParent()->deleteNode(node);
else
node->SetVisible(false);
}
MythUIButtonList *list = item->parent();
list->RemoveItem(item);
if (list->IsEmpty())
{
if (m_currentDepth > 0)
m_currentDepth--;
else if (m_activeListID > 1)
m_activeListID--;
SetTreeState(true);
}
}
示例5: showMenu
void GameUI::showMenu()
{
MythGenericTree *node = m_gameUITree->GetCurrentNode();
MythScreenStack *popupStack = GetMythMainWindow()->
GetStack("popup stack");
MythDialogBox *showMenuPopup =
new MythDialogBox(node->GetText(), popupStack, "showMenuPopup");
if (showMenuPopup->Create())
{
showMenuPopup->SetReturnEvent(this, "showMenuPopup");
showMenuPopup->AddButton(tr("Scan For Changes"));
if (isLeaf(node))
{
RomInfo *romInfo = qVariantValue<RomInfo *>(node->GetData());
if (romInfo)
{
showMenuPopup->AddButton(tr("Show Information"));
if (romInfo->Favorite())
showMenuPopup->AddButton(tr("Remove Favorite"));
else
showMenuPopup->AddButton(tr("Make Favorite"));
showMenuPopup->AddButton(tr("Retrieve Details"));
showMenuPopup->AddButton(tr("Edit Details"));
}
}
popupStack->AddScreen(showMenuPopup);
}
else
delete showMenuPopup;
}
示例6: LOG
void MythGenericTree::reOrderAsSorted()
{
//
// Arrange (recursively) my subnodes in the same order as my ordered
// subnodes
//
if (m_subnodes->count() != m_ordered_subnodes->count())
{
LOG(VB_GENERAL, LOG_ERR, "Can't reOrderAsSorted(), because the number "
"of subnodes is different than the number of ordered subnodes");
return;
}
m_subnodes->clear();
m_currentOrderingIndex = -1;
QList<MythGenericTree*>::iterator it;
it = m_ordered_subnodes->begin();
MythGenericTree *child;
while ((child = *it) != 0)
{
m_subnodes->append(child);
child->reOrderAsSorted();
++it;
}
}
示例7: toggleFavorite
void GameUI::toggleFavorite(void)
{
MythGenericTree *node = m_gameUITree->GetCurrentNode();
if (isLeaf(node))
{
RomInfo *romInfo = qVariantValue<RomInfo *>(node->GetData());
romInfo->setFavorite(true);
updateChangedNode(node, romInfo);
}
}
示例8: SetNodeById
/*!
* \brief Using a path based on the node IDs, set the currently
* selected node
*
* \param route List defining the path using node IDs starting at the root node
*
* \return True if successful
*/
bool MythUIButtonTree::SetNodeById(QList<int> route)
{
MythGenericTree *node = m_rootNode->findNode(route);
if (node && node->isSelectable())
{
DoSetCurrentNode(node);
SetTreeState();
return true;
}
return false;
}
示例9: OnGameSearchDone
void GameUI::OnGameSearchDone(MetadataLookup *lookup)
{
if (m_busyPopup)
{
m_busyPopup->Close();
m_busyPopup = NULL;
}
if (!lookup)
return;
MythGenericTree *node = qVariantValue<MythGenericTree *>(lookup->GetData());
if (!node)
return;
RomInfo *metadata = qVariantValue<RomInfo *>(node->GetData());
if (!metadata)
return;
metadata->setGamename(lookup->GetTitle());
metadata->setYear(QString::number(lookup->GetYear()));
metadata->setPlot(lookup->GetDescription());
metadata->setSystem(lookup->GetSystem());
QStringList coverart, fanart, screenshot;
// Imagery
ArtworkList coverartlist = lookup->GetArtwork(kArtworkCoverart);
for (ArtworkList::const_iterator p = coverartlist.begin();
p != coverartlist.end(); ++p)
{
coverart.prepend((*p).url);
}
ArtworkList fanartlist = lookup->GetArtwork(kArtworkFanart);
for (ArtworkList::const_iterator p = fanartlist.begin();
p != fanartlist.end(); ++p)
{
fanart.prepend((*p).url);
}
ArtworkList screenshotlist = lookup->GetArtwork(kArtworkScreenshot);
for (ArtworkList::const_iterator p = screenshotlist.begin();
p != screenshotlist.end(); ++p)
{
screenshot.prepend((*p).url);
}
StartGameImageSet(node, coverart, fanart, screenshot);
metadata->SaveToDatabase();
updateChangedNode(node, metadata);
}
示例10: while
QList<int> MythGenericTree::getRouteById()
{
QList<int> routeByID;
routeByID.push_front(getInt());
MythGenericTree *parent = this;
while( (parent = parent->getParent()) )
{
routeByID.push_front(parent->getInt());
}
return routeByID;
}
示例11: sortBySelectable
void MythGenericTree::sortBySelectable()
{
m_ordered_subnodes->Sort(SortableMythGenericTreeList::SORT_SELECTABLE);
QList<MythGenericTree*>::iterator it;
it = m_subnodes->begin();
MythGenericTree *child;
while ((child = *it) != 0)
{
child->sortBySelectable();
++it;
}
}
示例12: getRouteByString
QStringList MythGenericTree::getRouteByString()
{
QStringList routeByString;
routeByString.push_front(getString());
MythGenericTree *parent = this;
while( (parent = parent->getParent()) )
{
routeByString.push_front(parent->getString());
}
return routeByString;
}
示例13: searchComplete
void GameUI::searchComplete(QString string)
{
if (!m_gameUITree->GetCurrentNode())
return;
MythGenericTree *parent = m_gameUITree->GetCurrentNode()->getParent();
if (!parent)
return;
MythGenericTree *new_node = parent->getChildByName(string);
if (new_node)
m_gameUITree->SetCurrentNode(new_node);
}
示例14: sortByAttributeThenByString
void MythGenericTree::sortByAttributeThenByString(int which_attribute)
{
m_ordered_subnodes->Sort(SortableMythGenericTreeList::SORT_ATT_THEN_STRING,
which_attribute);
QList<MythGenericTree*>::iterator it;
it = m_subnodes->begin();
MythGenericTree *child;
while ((child = *it) != 0)
{
child->sortByAttributeThenByString(which_attribute);
++it;
}
}
示例15: addYourselfIfSelectable
void MythGenericTree::addYourselfIfSelectable(QList<MythGenericTree*> *flat_list)
{
if (m_selectable)
flat_list->append(this);
QList<MythGenericTree*>::iterator it;
it = m_subnodes->begin();
MythGenericTree *child;
while ((child = *it) != 0)
{
child->addYourselfIfSelectable(flat_list);
++it;
}
}