Skip to content

Commit

Permalink
Don't show the rating filter for the movie list if there are no ratin…
Browse files Browse the repository at this point in the history
…gs in the database.
  • Loading branch information
stuartm committed Apr 15, 2013
1 parent 9ec7421 commit 131a3a1
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
29 changes: 24 additions & 5 deletions mythtv/programs/mythfrontend/proglist.cpp
Expand Up @@ -62,8 +62,25 @@ ProgLister::ProgLister(MythScreenStack *parent, ProgListType pltype,
m_curviewText(NULL),
m_positionText(NULL),
m_progList(NULL),
m_messageText(NULL)
m_messageText(NULL),

m_allowViewDialog(true)
{
if (pltype == plMovies)
{
MSqlQuery query(MSqlQuery::InitCon());
query.prepare("SELECT COUNT(*) FROM program WHERE stars > 0");

if (query.exec() && query.next())
{
if (query.value(0).toInt() == 0) // No ratings in database
{
m_curView = 0; // Show All
m_allowViewDialog = false;
}
}
}

switch (pltype)
{
case plTitleSearch: m_searchType = kTitleSearch; break;
Expand Down Expand Up @@ -112,7 +129,9 @@ ProgLister::ProgLister(
m_curviewText(NULL),
m_positionText(NULL),
m_progList(NULL),
m_messageText(NULL)
m_messageText(NULL),

m_allowViewDialog(true)
{
}

Expand Down Expand Up @@ -190,7 +209,7 @@ bool ProgLister::Create()

void ProgLister::Load(void)
{
if (m_curView < 0)
if (m_viewList.isEmpty() || m_curView < 0)
FillViewList(m_view);

FillItemList(false, false);
Expand Down Expand Up @@ -299,7 +318,7 @@ void ProgLister::ShowMenu(void)

MythMenu *menu = new MythMenu(tr("Options"), this, "menu");

if (m_type != plPreviouslyRecorded)
if (m_allowViewDialog && m_type != plPreviouslyRecorded)
{
menu->AddItem(tr("Choose Search Phrase..."), SLOT(ShowChooseViewMenu()));
}
Expand Down Expand Up @@ -1712,7 +1731,7 @@ void ProgLister::customEvent(QEvent *event)
MythEvent *me = (MythEvent *)event;
QString message = me->Message();

if (message == "CHOOSE_VIEW")
if (m_allowViewDialog && message == "CHOOSE_VIEW")
ShowChooseViewMenu();
else if (message == "SCHEDULE_CHANGE")
needUpdate = true;
Expand Down
2 changes: 2 additions & 0 deletions mythtv/programs/mythfrontend/proglist.h
Expand Up @@ -134,6 +134,8 @@ class ProgLister : public ScheduleCommon
MythUIText *m_positionText;
MythUIButtonList *m_progList;
MythUIText *m_messageText;

bool m_allowViewDialog;
};

#endif

0 comments on commit 131a3a1

Please sign in to comment.