Skip to content

Commit

Permalink
Cleanup some old/unused code from MythGenericTree and fix sorting.
Browse files Browse the repository at this point in the history
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 1805637
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 361 deletions.
12 changes: 6 additions & 6 deletions mythplugins/mythgame/mythgame/gameui.cpp
Expand Up @@ -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(
Expand Down Expand Up @@ -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())
{
Expand Down Expand Up @@ -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 =
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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());
Expand Down
34 changes: 17 additions & 17 deletions mythplugins/mythmusic/mythmusic/playlisteditorview.cpp
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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),
Expand All @@ -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),
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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();
Expand Down
16 changes: 8 additions & 8 deletions mythplugins/mythnetvision/mythnetvision/nettree.cpp
Expand Up @@ -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)
Expand Down Expand Up @@ -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();
Expand All @@ -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")
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythbase/mythversion.h
Expand Up @@ -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.
*
Expand Down

0 comments on commit 1805637

Please sign in to comment.