From 131a3a15d353ea4d86ba19d54042dae320561b10 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Mon, 15 Apr 2013 11:24:59 +0100 Subject: [PATCH] Don't show the rating filter for the movie list if there are no ratings in the database. --- mythtv/programs/mythfrontend/proglist.cpp | 29 +++++++++++++++++++---- mythtv/programs/mythfrontend/proglist.h | 2 ++ 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/mythtv/programs/mythfrontend/proglist.cpp b/mythtv/programs/mythfrontend/proglist.cpp index 5373a2c921c..5fc6be37975 100644 --- a/mythtv/programs/mythfrontend/proglist.cpp +++ b/mythtv/programs/mythfrontend/proglist.cpp @@ -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; @@ -112,7 +129,9 @@ ProgLister::ProgLister( m_curviewText(NULL), m_positionText(NULL), m_progList(NULL), - m_messageText(NULL) + m_messageText(NULL), + + m_allowViewDialog(true) { } @@ -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); @@ -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())); } @@ -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; diff --git a/mythtv/programs/mythfrontend/proglist.h b/mythtv/programs/mythfrontend/proglist.h index 8846e9872cc..485791231c1 100644 --- a/mythtv/programs/mythfrontend/proglist.h +++ b/mythtv/programs/mythfrontend/proglist.h @@ -134,6 +134,8 @@ class ProgLister : public ScheduleCommon MythUIText *m_positionText; MythUIButtonList *m_progList; MythUIText *m_messageText; + + bool m_allowViewDialog; }; #endif