Permalink
Browse files

Cleanup some old/unused code from MythGenericTree and fix sorting.

Strip it back to basics, a less bloated and more managable class that offers
just the features it needs to. In this first pass I've mostly slashed
and burned the fat, there's scope for further improvements through
refactoring what remains.

Member variables have been renamed to meet coding standards, methods
need similar treatment but I'll do that as a separate commit because
of the potential to break plugins.
  • Loading branch information...
stuartm committed Mar 29, 2013
1 parent 55751e6 commit 1805637b488d7ecab6e110017b9b1a93883b6ac9
@@ -269,7 +269,7 @@ void GameUI::itemClicked(MythUIButtonListItem*)
else
{
//: %1 is the game name
QString msg = tr("Choose System for:\n%1").arg(node->getString());
QString msg = tr("Choose System for:\n%1").arg(node->GetText());
MythScreenStack *popupStack = GetMythMainWindow()->
GetStack("popup stack");
MythDialogBox *chooseSystemPopup = new MythDialogBox(
@@ -431,7 +431,7 @@ void GameUI::showMenu()
MythScreenStack *popupStack = GetMythMainWindow()->
GetStack("popup stack");
MythDialogBox *showMenuPopup =
new MythDialogBox(node->getString(), popupStack, "showMenuPopup");
new MythDialogBox(node->GetText(), popupStack, "showMenuPopup");
if (showMenuPopup->Create())
{
@@ -471,7 +471,7 @@ void GameUI::searchStart(void)
for (it = children->begin(); it != children->end(); ++it)
{
MythGenericTree *child = *it;
childList << child->getString();
childList << child->GetText();
}
MythScreenStack *popupStack =
@@ -552,7 +552,7 @@ void GameUI::customEvent(QEvent *event)
RomInfo *romInfo = qVariantValue<RomInfo *>(dce->GetData());
node->SetData(qVariantFromValue(romInfo));
node->setString(romInfo->Gamename());
node->SetText(romInfo->Gamename());
romInfo->SaveToDatabase();
updateChangedNode(node, romInfo);
@@ -637,7 +637,7 @@ void GameUI::customEvent(QEvent *event)
QString GameUI::getFillSql(MythGenericTree *node) const
{
QString layer = node->getString();
QString layer = node->GetText();
int childDepth = node->getInt() + 1;
QString childLevel = getChildLevelString(node);
QString filter = getFilter(node);
@@ -790,7 +790,7 @@ bool GameUI::isLeaf(MythGenericTree *node) const
void GameUI::fillNode(MythGenericTree *node)
{
QString layername = node->getString();
QString layername = node->GetText();
RomInfo *romInfo = qVariantValue<RomInfo *>(node->GetData());
MSqlQuery query(MSqlQuery::InitCon());
@@ -64,7 +64,7 @@ void MusicGenericTree::setCheck(MythUIButtonListItem::CheckState state)
MythUIButtonListItem *MusicGenericTree::CreateListButton(MythUIButtonList *list)
{
MusicButtonItem *item = new MusicButtonItem(list, getString());
MusicButtonItem *item = new MusicButtonItem(list, GetText());
item->SetData(qVariantFromValue((MythGenericTree*) this));
if (visibleChildCount() > 0)
@@ -230,7 +230,7 @@ void PlaylistEditorView::customEvent(QEvent *event)
{
QString category;
if (mnode->getAction() == "smartplaylistcategory")
category = mnode->getString();
category = mnode->GetText();
MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
SmartPlaylistEditor* editor = new SmartPlaylistEditor(mainStack);
@@ -250,17 +250,17 @@ void PlaylistEditorView::customEvent(QEvent *event)
}
else if (resulttext == tr("Remove Smart Playlist"))
{
QString category = mnode->getParent()->getString();
QString name = mnode->getString();
QString category = mnode->getParent()->GetText();
QString name = mnode->GetText();
ShowOkPopup(tr("Are you sure you want to delete this Smart Playlist?\n"
"Category: %1 - Name: %2").arg(category).arg(name),
this, SLOT(deleteSmartPlaylist(bool)), true);
}
else if (resulttext == tr("Edit Smart Playlist"))
{
QString category = mnode->getParent()->getString();
QString name = mnode->getString();
QString category = mnode->getParent()->GetText();
QString name = mnode->GetText();
MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
SmartPlaylistEditor* editor = new SmartPlaylistEditor(mainStack);
@@ -304,7 +304,7 @@ void PlaylistEditorView::customEvent(QEvent *event)
if (resulttext == tr("Remove Playlist"))
{
QString name = mnode->getString();
QString name = mnode->GetText();
ShowOkPopup(tr("Are you sure you want to delete this Playlist?\n"
"Name: %1").arg(name),
@@ -353,8 +353,8 @@ bool PlaylistEditorView::keyPressEvent(QKeyEvent *event)
{
if (mnode->getAction() == "smartplaylist" && action == "EDIT")
{
QString category = mnode->getParent()->getString();
QString name = mnode->getString();
QString category = mnode->getParent()->GetText();
QString name = mnode->GetText();
MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
SmartPlaylistEditor* editor = new SmartPlaylistEditor(mainStack);
@@ -375,7 +375,7 @@ bool PlaylistEditorView::keyPressEvent(QKeyEvent *event)
}
else if (mnode->getAction() == "smartplaylistcategory" && action == "EDIT")
{
QString category = mnode->getString();
QString category = mnode->GetText();
MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
SmartPlaylistEditor* editor = new SmartPlaylistEditor(mainStack);
@@ -423,8 +423,8 @@ bool PlaylistEditorView::keyPressEvent(QKeyEvent *event)
{
if (mnode->getAction() == "smartplaylist")
{
QString category = mnode->getParent()->getString();
QString name = mnode->getString();
QString category = mnode->getParent()->GetText();
QString name = mnode->GetText();
ShowOkPopup(tr("Are you sure you want to delete this Smart Playlist?\n"
"Category: %1 - Name: %2").arg(category).arg(name),
@@ -433,7 +433,7 @@ bool PlaylistEditorView::keyPressEvent(QKeyEvent *event)
}
else if (mnode->getAction() == "playlist")
{
QString name = mnode->getString();
QString name = mnode->GetText();
ShowOkPopup(tr("Are you sure you want to delete this Playlist?\n"
"Name: %1").arg(name),
@@ -733,11 +733,11 @@ void PlaylistEditorView::treeItemVisible(MythUIButtonListItem *item)
}
else if (mnode->getAction() == "compartist")
{
artFile = findIcon("artist", mnode->getString().toLower());
artFile = findIcon("artist", mnode->GetText().toLower());
}
else
{
artFile = findIcon(mnode->getAction(), mnode->getString().toLower());
artFile = findIcon(mnode->getAction(), mnode->GetText().toLower());
}
QString state = "default";
@@ -1564,8 +1564,8 @@ void PlaylistEditorView::deleteSmartPlaylist(bool ok)
{
if (mnode->getAction() == "smartplaylist")
{
QString category = mnode->getParent()->getString();
QString name = mnode->getString();
QString category = mnode->getParent()->GetText();
QString name = mnode->GetText();
SmartPlaylistEditor::deleteSmartPlaylist(category, name);
reloadTree();
@@ -279,15 +279,15 @@ void NetTree::UpdateItem(MythUIButtonListItem *item)
{
item->SetText(QString("%1").arg(node->visibleChildCount()), "childcount");
item->DisplayState("subfolder", "nodetype");
item->SetText(node->getString(), "title");
item->SetText(node->getString());
item->SetText(node->GetText(), "title");
item->SetText(node->GetText());
item->SetImage(node->GetData().toString());
}
else if (nodeInt == kUpFolder)
{
item->DisplayState("upfolder", "nodetype");
item->SetText(node->getString(), "title");
item->SetText(node->getString());
item->SetText(node->GetText(), "title");
item->SetText(node->GetText());
}
if (site)
@@ -326,7 +326,7 @@ void NetTree::UpdateItem(MythUIButtonListItem *item)
}
else
{
item->SetText(node->getString());
item->SetText(node->GetText());
if (!node->GetData().toString().isEmpty())
{
QString tpath = node->GetData().toString();
@@ -339,11 +339,11 @@ void NetTree::UpdateItem(MythUIButtonListItem *item)
pos = m_siteButtonList->GetItemPos(item);
QString dlfile = GetThumbnailFilename(tpath,
node->getString());
node->GetText());
if (QFile::exists(dlfile))
item->SetImage(dlfile);
else
m_imageDownload->addThumb(node->getString(), tpath,
m_imageDownload->addThumb(node->GetText(), tpath,
qVariantFromValue<uint>(pos));
}
else if (tpath != "0")
@@ -1259,7 +1259,7 @@ void NetTree::customEvent(QEvent *event)
if (m_type == DLG_TREE)
{
if (title == m_siteMap->GetCurrentNode()->getString() &&
if (title == m_siteMap->GetCurrentNode()->GetText() &&
m_thumbImage)
{
m_thumbImage->SetFilename(file);
@@ -12,7 +12,7 @@
/// Update this whenever the plug-in ABI changes.
/// Including changes in the libmythbase, libmyth, libmythtv, libmythav* and
/// libmythui class methods in exported headers.
#define MYTH_BINARY_VERSION "0.27.20130301-1"
#define MYTH_BINARY_VERSION "0.27.20130329-1"
/** \brief Increment this whenever the MythTV network protocol changes.
*
Oops, something went wrong.

0 comments on commit 1805637

Please sign in to comment.