MythThemedMenu Class Reference

Themed menu class, used for main menus in MythTV frontend. More...

#include <myththemedmenu.h>

Inheritance diagram for MythThemedMenu:
MythThemedMenuState MythScreenType MythUIType XMLParseBase

List of all members.

Public Member Functions

 MythThemedMenu (const QString &cdir, const QString &menufile, MythScreenStack *parent, const QString &name, bool allowreorder=false, MythThemedMenuState *state=NULL)
 Creates a themed menu.
 ~MythThemedMenu ()
bool foundTheme (void)
 Returns true iff a theme has been found by a previous call to Init().
void setCallback (void(*lcallback)(void *, QString &), void *data)
 Set the themed menus callback function and data for that function.
void setKillable (void)
QString getSelection (void)
virtual void aboutToShow (void)
void ShowMenu ()
void aboutScreen ()
void customEvent (QEvent *event)
void mediaEvent (MythMediaEvent *event)

Public Attributes

MythDialogBoxm_menuPopup

Protected Member Functions

virtual bool keyPressEvent (QKeyEvent *e)
 keyboard/LIRC event handler.

Private Slots

void setButtonActive (MythUIButtonListItem *item)
void buttonAction (MythUIButtonListItem *item, bool skipPass=false)

Private Member Functions

void Init (const QString &menufile)
 Loads the main UI theme, and a menu theme.
bool parseMenu (const QString &menuname)
 Parse the themebuttons to be added based on the name of the menu file provided.
void parseThemeButton (QDomElement &element)
 Parses the element's tags and set the ThemeButton's type, text, depends, and action, then adds the button.
void addButton (const QString &type, const QString &text, const QString &alttext, const QStringList &action, const QString &description, const QString &password)
 Create a new MythThemedButton based on the MythThemedMenuState m_state and the type, text, alt-text and action provided in the parameters.
bool handleAction (const QString &action, const QString &password=QString())
 Handle a MythTV action for the Menus.
bool findDepends (const QString &fileList)
QString findMenuFile (const QString &menuname)
 Locates the appropriate menu file from which to parse the menu.
bool checkPinCode (const QString &password_setting)
 Queries the user for a password to enter a part of MythTV restricted by a password.

Private Attributes

MythThemedMenum_parent
MythThemedMenuStatem_state
bool m_allocedstate
QString m_selection
bool m_foundtheme
bool m_ignorekeys
bool m_wantpop
QString m_menumode

Detailed Description

Themed menu class, used for main menus in MythTV frontend.

Definition at line 63 of file myththemedmenu.h.


Constructor & Destructor Documentation

MythThemedMenu::MythThemedMenu ( const QString &  cdir,
const QString &  menufile,
MythScreenStack parent,
const QString &  name,
bool  allowreorder = false,
MythThemedMenuState state = NULL 
)

Creates a themed menu.

Parameters:
menufile file name of menu definition file
parent the screen stack that owns this UI type
name the name of this UI type
state theme state associated with this menu

Definition at line 93 of file myththemedmenu.cpp.

Referenced by handleAction().

MythThemedMenu::~MythThemedMenu ( void   ) 

Definition at line 142 of file myththemedmenu.cpp.


Member Function Documentation

bool MythThemedMenu::foundTheme ( void   ) 

Returns true iff a theme has been found by a previous call to Init().

Definition at line 149 of file myththemedmenu.cpp.

Referenced by handleAction(), mythplugin_config(), runMenu(), and RunMenu().

void MythThemedMenu::setCallback ( void(*)(void *, QString &)  lcallback,
void *  data 
)

Set the themed menus callback function and data for that function.

Definition at line 155 of file myththemedmenu.cpp.

Referenced by mythplugin_config(), runMenu(), and RunMenu().

void MythThemedMenu::setKillable ( void   ) 

Definition at line 162 of file myththemedmenu.cpp.

Referenced by mythplugin_config(), and runMenu().

QString MythThemedMenu::getSelection ( void   ) 

Definition at line 167 of file myththemedmenu.cpp.

void MythThemedMenu::aboutToShow ( void   )  [virtual]

Reimplemented from MythScreenType.

Definition at line 280 of file myththemedmenu.cpp.

void MythThemedMenu::ShowMenu ( void   )  [virtual]

Reimplemented from MythScreenType.

Definition at line 286 of file myththemedmenu.cpp.

void MythThemedMenu::aboutScreen (  ) 

Definition at line 329 of file myththemedmenu.cpp.

Referenced by customEvent(), and keyPressEvent().

void MythThemedMenu::customEvent ( QEvent *  event  )  [virtual]

Reimplemented from MythUIType.

Definition at line 356 of file myththemedmenu.cpp.

void MythThemedMenu::mediaEvent ( MythMediaEvent event  )  [virtual]

Media/Device status event handler, received from MythMediaMonitor.

Parameters:
event Media event

Reimplemented from MythUIType.

Definition at line 926 of file myththemedmenu.cpp.

bool MythThemedMenu::keyPressEvent ( QKeyEvent *  event  )  [protected, virtual]

keyboard/LIRC event handler.

This translates key presses through the "Main Menu" context into MythTV actions and then handles them as appropriate.

Reimplemented from MythScreenType.

Definition at line 190 of file myththemedmenu.cpp.

void MythThemedMenu::setButtonActive ( MythUIButtonListItem item  )  [private, slot]

Definition at line 172 of file myththemedmenu.cpp.

Referenced by Init().

void MythThemedMenu::buttonAction ( MythUIButtonListItem item,
bool  skipPass = false 
) [private, slot]

Definition at line 681 of file myththemedmenu.cpp.

Referenced by customEvent(), and Init().

void MythThemedMenu::Init ( const QString &  menufile  )  [private]

Loads the main UI theme, and a menu theme.

See also foundtheme(void), it will return true when called after this method if this method was successful.

Parameters:
menufile name of menu item xml file

Definition at line 118 of file myththemedmenu.cpp.

bool MythThemedMenu::parseMenu ( const QString &  menuname  )  [private]

Parse the themebuttons to be added based on the name of the menu file provided.

If the menu to be parsed is the main menu and this fails to find the XML file this will simply return false. Otherwise if it fails to find the menu it will pop up an error dialog and then return false.

The idea behind this is that if we can't parse the main menu we have to exit from the frontend entirely. But in all other cases we can simply return to the main menu and hope that it is a non-essential portion of MythTV which the theme does not support.

Definition at line 565 of file myththemedmenu.cpp.

Referenced by Init().

void MythThemedMenu::parseThemeButton ( QDomElement &  element  )  [private]

Parses the element's tags and set the ThemeButton's type, text, depends, and action, then adds the button.

Parameters:
element DOM element describing features of the themeButton

Definition at line 415 of file myththemedmenu.cpp.

Referenced by parseMenu().

void MythThemedMenu::addButton ( const QString &  type,
const QString &  text,
const QString &  alttext,
const QStringList &  action,
const QString &  description,
const QString &  password 
) [private]

Create a new MythThemedButton based on the MythThemedMenuState m_state and the type, text, alt-text and action provided in the parameters.

Parameters:
type type of button to be created
text text to appear on the button
alttext alternate text to appear when required
action actions to be associated with button

Definition at line 657 of file myththemedmenu.cpp.

Referenced by parseThemeButton().

bool MythThemedMenu::handleAction ( const QString &  action,
const QString &  password = QString() 
) [private]

Handle a MythTV action for the Menus.

Parameters:
action single action to be handled
Returns:
true if the action is not to EXEC another program

Definition at line 754 of file myththemedmenu.cpp.

Referenced by buttonAction(), and keyPressEvent().

bool MythThemedMenu::findDepends ( const QString &  fileList  )  [private]

Definition at line 846 of file myththemedmenu.cpp.

Referenced by parseThemeButton().

QString MythThemedMenu::findMenuFile ( const QString &  menuname  )  [private]

Locates the appropriate menu file from which to parse the menu.

Parameters:
menuname file name of the menu you want to find
Returns:
the directory in which the menu file is found

Definition at line 702 of file myththemedmenu.cpp.

Referenced by findDepends(), and parseMenu().

bool MythThemedMenu::checkPinCode ( const QString &  password_setting  )  [private]

Queries the user for a password to enter a part of MythTV restricted by a password.

Parameters:
timestamp_setting time settings to be checked
password_setting password to be checked
text the message text to be displayed
Returns:
true if password checks out or is not needed.

Definition at line 875 of file myththemedmenu.cpp.

Referenced by handleAction().


Member Data Documentation

Definition at line 83 of file myththemedmenu.h.

Referenced by aboutScreen(), customEvent(), MythThemedMenu(), and ShowMenu().

Definition at line 110 of file myththemedmenu.h.

Definition at line 113 of file myththemedmenu.h.

Referenced by handleAction(), keyPressEvent(), MythThemedMenu(), and ~MythThemedMenu().

QString MythThemedMenu::m_selection [private]

Definition at line 115 of file myththemedmenu.h.

Referenced by getSelection(), handleAction(), and parseMenu().

Definition at line 116 of file myththemedmenu.h.

Referenced by foundTheme(), and Init().

Definition at line 118 of file myththemedmenu.h.

Referenced by keyPressEvent().

Definition at line 120 of file myththemedmenu.h.

Referenced by handleAction(), and keyPressEvent().

QString MythThemedMenu::m_menumode [private]

Definition at line 122 of file myththemedmenu.h.

Referenced by parseMenu().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends
Generated on Fri May 25 06:42:15 2012 for MythTV by  doxygen 1.6.3