summaryrefslogtreecommitdiffstats
path: root/abs/core-testing/mythtv/trunk/mythtv-svn/svn_main_menu_popup.patch
diff options
context:
space:
mode:
authorJames Meyer <james.meyer@operamail.com>2008-12-09 21:15:29 (GMT)
committerJames Meyer <james.meyer@operamail.com>2008-12-09 21:15:29 (GMT)
commit8203006cf9ee68a8e33e30d48ea6b396d1a7b7e4 (patch)
treee90f032f43f9db0f3d6593ebe79ed2b8a572b64e /abs/core-testing/mythtv/trunk/mythtv-svn/svn_main_menu_popup.patch
parentf7db724accbaa234c839a7147e79e1cef47c6772 (diff)
downloadlinhes_pkgbuild-8203006cf9ee68a8e33e30d48ea6b396d1a7b7e4.zip
linhes_pkgbuild-8203006cf9ee68a8e33e30d48ea6b396d1a7b7e4.tar.gz
linhes_pkgbuild-8203006cf9ee68a8e33e30d48ea6b396d1a7b7e4.tar.bz2
Initial checkin for mythtv-trunk builds
Diffstat (limited to 'abs/core-testing/mythtv/trunk/mythtv-svn/svn_main_menu_popup.patch')
-rw-r--r--abs/core-testing/mythtv/trunk/mythtv-svn/svn_main_menu_popup.patch211
1 files changed, 211 insertions, 0 deletions
diff --git a/abs/core-testing/mythtv/trunk/mythtv-svn/svn_main_menu_popup.patch b/abs/core-testing/mythtv/trunk/mythtv-svn/svn_main_menu_popup.patch
new file mode 100644
index 0000000..5556683
--- /dev/null
+++ b/abs/core-testing/mythtv/trunk/mythtv-svn/svn_main_menu_popup.patch
@@ -0,0 +1,211 @@
+Index: libs/libmythui/myththemedmenu.h
+===================================================================
+--- libs/libmythui/myththemedmenu.h (revision 19291)
++++ libs/libmythui/myththemedmenu.h (working copy)
+@@ -2,6 +2,7 @@
+ #define MYTHTHEMEDMENU_H_
+
+ #include "mythscreentype.h"
++#include "mythdialogbox.h"
+ #include "mythuistatetype.h"
+ #include "mythuibuttonlist.h"
+ #include "xmlparsebase.h"
+@@ -77,6 +78,11 @@
+ void ReloadExitKey(void);
+ virtual void aboutToShow(void);
+
++ void doMenu();
++ void aboutScreen();
++ MythDialogBox *m_menuPopup;
++ void customEvent(QEvent *event);
++
+ protected:
+ virtual bool keyPressEvent(QKeyEvent *e);
+
+Index: libs/libmythui/myththemedmenu.cpp
+===================================================================
+--- libs/libmythui/myththemedmenu.cpp (revision 19291)
++++ libs/libmythui/myththemedmenu.cpp (working copy)
+@@ -32,6 +32,7 @@
+ m_callbackdata = NULL;
+
+ m_killable = false;
++
+ }
+
+ MythThemedMenuState::~MythThemedMenuState()
+@@ -95,7 +96,7 @@
+ m_exitModifier = -1;
+ m_menumode = "";
+ m_buttonList = NULL;
+-
++ m_menuPopup = NULL;
+ if (!m_state)
+ {
+ m_state = new MythThemedMenuState(parent, "themedmenustate");
+@@ -271,6 +272,10 @@
+ m_wantpop = true;
+ }
+ }
++ else if (action == "MENU")
++ {
++ doMenu();
++ }
+ else
+ handled = false;
+ }
+@@ -292,6 +297,154 @@
+ updateLCD();
+ }
+
++void MythThemedMenu::doMenu()
++{
++
++ if (m_menuPopup)
++ return;
++ int allowsd = GetMythDB()->GetNumSetting("AllowQuitShutdown");
++ int override_menu = GetMythDB()->GetNumSetting("OverRideExitMenu");
++ QString label = "System Menu";
++ MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
++ m_menuPopup = new MythDialogBox(label, mainStack, "menuPopup");
++ if (m_menuPopup->Create())
++ mainStack->AddScreen(m_menuPopup);
++ if ( override_menu == 0 )
++ {
++ if ( allowsd != 0 && allowsd !=4 )
++ {
++ m_menuPopup->SetReturnEvent(this,"popmenu_exit");
++ m_menuPopup->AddButton("Shutdown");
++ m_menuPopup->AddButton("Reboot");
++ }
++ else
++ {
++ m_menuPopup->SetReturnEvent(this,"popmenu_noexit");
++ }
++ }
++ if ( override_menu == 5 )
++ { // reboot
++ m_menuPopup->SetReturnEvent(this,"popmenu_reboot");
++ m_menuPopup->AddButton("Reboot");
++ }
++ else if ( override_menu == 2 || override_menu == 4 )
++ { // shutdown
++ m_menuPopup->SetReturnEvent(this,"popmenu_shutdown");
++ m_menuPopup->AddButton("Shutdown");
++ }
++ else if ( override_menu == 3 || override_menu == 6 )
++ { // both
++ m_menuPopup->SetReturnEvent(this,"popmenu_exit");
++ m_menuPopup->AddButton("Shutdown");
++ m_menuPopup->AddButton("Reboot");
++ }
++ else
++ {
++ m_menuPopup->SetReturnEvent(this,"popmenu_noexit");
++ }
++
++ m_menuPopup->AddButton("About");
++ m_menuPopup->AddButton("Cancel");
++
++}
++void MythThemedMenu::aboutScreen()
++{
++
++ extern const char *myth_source_version;
++ extern const char *myth_source_path;
++ QString distro_line;
++ distro_line="";
++
++ QFile file("/etc/os_myth_release");
++ if ( file.open(QFile::ReadOnly))
++ {
++ QTextStream t( &file ); // use a text stream
++ distro_line = t.readLine();
++ file.close();
++ }
++
++ QString label = "";
++ label.append(QObject::tr("Revision: ") + myth_source_version + " \n Branch:" + myth_source_path + "\n" + distro_line );
++
++ MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
++ m_menuPopup = new MythDialogBox(label, mainStack, "About");
++ if (m_menuPopup->Create())
++ mainStack->AddScreen(m_menuPopup);
++
++ m_menuPopup->SetReturnEvent(this,"About");
++ m_menuPopup->AddButton("OK!");
++
++}
++
++void MythThemedMenu::customEvent(QEvent *event)
++{
++ if (event->type() == kMythDialogBoxCompletionEventType)
++ {
++ DialogCompletionEvent *dce =
++ dynamic_cast<DialogCompletionEvent*>(event);
++ QString resultid= dce->GetId();
++ int buttonnum = dce->GetResult();
++ QString halt_cmd=GetMythDB()->GetSetting("HaltCommand");
++ QString reboot_cmd=GetMythDB()->GetSetting("RebootCommand");
++
++ if (resultid == "popmenu_exit")
++ {
++ if (buttonnum == 0)
++ {
++ if (!halt_cmd.isEmpty() )
++ system(halt_cmd.toAscii());
++ }
++
++ if (buttonnum == 1)
++ {
++ if (!reboot_cmd.isEmpty() )
++ system(reboot_cmd.toAscii());
++ }
++
++ if (buttonnum == 2)
++ {
++ aboutScreen();
++ }
++ }
++
++ if (resultid == "popmenu_noexit")
++ {
++ if (buttonnum == 0)
++ aboutScreen();
++ }
++
++ if (resultid == "popmenu_reboot")
++ {
++ if (buttonnum == 0)
++ {
++ if (!reboot_cmd.isEmpty() )
++ system(reboot_cmd.toAscii());
++ }
++
++ if (buttonnum == 1)
++ {
++ aboutScreen();
++ }
++ }
++
++ if (resultid == "popmenu_shutdown")
++ {
++ if (buttonnum == 0)
++ {
++ if (!halt_cmd.isEmpty() )
++ system(halt_cmd.toAscii());
++ }
++
++ if (buttonnum == 1)
++ {
++ aboutScreen();
++ }
++ }
++
++ m_menuPopup = NULL;
++ }
++}
++
+ /** \brief Parses the element's tags and set the ThemeButton's type,
+ * text, depends, and action, then adds the button.
+ *