From 4c15ac9ff2959d902099498ba44169037d355cf2 Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Tue, 28 Oct 2008 13:58:08 -0500
Subject: Add main menu popup. -about entry -reboot -shutdown

Add jumpoint for mythsmolt
---
 abs/core-testing/mythtv/stable/mythtv/PKGBUILD     |  24 ++--
 .../mythtv/stable/mythtv/myththemedmenu.cpp.patch  | 125 +++++++++++++++++++++
 .../mythtv/stable/mythtv/myththemedmenu.h.patch    |  25 +++++
 .../mythtv/stable/mythtv/smolt_jump.patch          |   9 ++
 4 files changed, 173 insertions(+), 10 deletions(-)
 create mode 100644 abs/core-testing/mythtv/stable/mythtv/myththemedmenu.cpp.patch
 create mode 100644 abs/core-testing/mythtv/stable/mythtv/myththemedmenu.h.patch
 create mode 100644 abs/core-testing/mythtv/stable/mythtv/smolt_jump.patch

diff --git a/abs/core-testing/mythtv/stable/mythtv/PKGBUILD b/abs/core-testing/mythtv/stable/mythtv/PKGBUILD
index f72bf49..af6a718 100644
--- a/abs/core-testing/mythtv/stable/mythtv/PKGBUILD
+++ b/abs/core-testing/mythtv/stable/mythtv/PKGBUILD
@@ -1,21 +1,17 @@
-# $Id: PKGBUILD 356 2008-04-18 22:56:27Z aaron $
-# Contributor: <kleptophobiac@gmail.com>
-# Contributor: dorphell <dorphell@archlinux.org>
-# Maintainer: Paul Mattal <paul@archlinux.org>
-
 pkgname=mythtv
 pkgver=0.21
-pkgrel=10
+pkgrel=14
 pkgdesc="A Homebrew PVR project"
 arch=('i686' 'x86_64')
 depends=('bash' 'mysql-clients>=5.0' 'qt3' 'lame' 'lirc-utils' 'ffmpeg' \
 	'libxvmc')
 backup=(etc/mythtv/mythbackend.conf etc/mythtv/mysql.txt)
 source=(ftp://ftp.knoppmyth.net/R6/sources/${pkgname}-${pkgver}-fixes.tar.bz2 \
-	mythbackend\
-	QUICKSTART.archlinux)
-md5sums=('08506f0c5120c072085b6995f529167a' '7ef6de58240e7aad389a0b13d91b1cf6'\
-         'a0ecb7f476cb71c0c1ac90d349fc7695')
+	mythbackend myththemedmenu.cpp.patch myththemedmenu.h.patch  smolt_jump.patch  )
+
+#md5sums=('08506f0c5120c072085b6995f529167a' '7ef6de58240e7aad389a0b13d91b1cf6'\
+#         'a0ecb7f476cb71c0c1ac90d349fc7695')
+
 license=('GPL2')
 makedepends=(libgl subversion)
 groups=('pvr')
@@ -24,6 +20,14 @@ install=mythtv.install
 
 build() {
    cd $startdir/src/${pkgname}-${pkgver} || return 1
+
+#apply patches 
+	 patch -p0 < ../myththemedmenu.cpp.patch
+	 patch -p0 < ../myththemedmenu.h.patch
+#	 patch -p0 < ../pop_be_restart.h.patch
+#	 patch -p0 < ../pop_be_restart.cpp.patch
+	 patch -p0 < ../smolt_jump.patch
+
    . /etc/profile.d/qt3.sh
 
    # use QT3 qmake
diff --git a/abs/core-testing/mythtv/stable/mythtv/myththemedmenu.cpp.patch b/abs/core-testing/mythtv/stable/mythtv/myththemedmenu.cpp.patch
new file mode 100644
index 0000000..3bc7a38
--- /dev/null
+++ b/abs/core-testing/mythtv/stable/mythtv/myththemedmenu.cpp.patch
@@ -0,0 +1,125 @@
+--- libs/libmythui/myththemedmenu.cpp.orig	2008-01-31 15:26:38.000000000 +0000
++++ libs/libmythui/myththemedmenu.cpp	2008-02-07 22:24:27.000000000 +0000
+@@ -2102,6 +2102,10 @@
+             }
+             lastbutton = NULL;
+         }
++        else if (action == "MENU")
++        {
++            parent->doMenu();
++        }
+         else if (action == "EJECT")
+         {
+             myth_eject();
+@@ -2482,6 +2486,8 @@
+ 
+     if (d->foundtheme)
+         d->parseMenu(menufile);
++
++    m_menuPopup = NULL;
+ }
+ 
+ MythThemedMenu::~MythThemedMenu(void)
+@@ -2592,3 +2598,102 @@
+     MythScreenType::aboutToShow();
+     d->updateLCD();
+ }
++void MythThemedMenu::doMenu()
++{
++    int allowsd = gContext->GetNumSetting("AllowQuitShutdown");
++    if (m_menuPopup)
++        return;
++    QString label = "System Menu";
++    MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
++    m_menuPopup = new MythDialogBox(label, mainStack, "menuPopup");
++    if (m_menuPopup->Create())
++        mainStack->AddScreen(m_menuPopup);
++
++    //changed line to always show shutdown/reboot
++    if ( allowsd != 10 && allowsd !=14  )
++    {
++        m_menuPopup->SetReturnEvent(this,"popmenu_exit");
++        m_menuPopup->AddButton("Shutdown");
++        m_menuPopup->AddButton("Reboot");
++        m_menuPopup->AddButton("About");
++        m_menuPopup->AddButton("Cancel");
++    }
++    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(IO_ReadOnly | IO_Translate) )
++        {
++            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(QCustomEvent *event)
++{
++    if (event->type() == kMythDialogBoxCompletionEventType)
++    {
++        DialogCompletionEvent *dce =
++                dynamic_cast<DialogCompletionEvent*>(event);
++
++        QString resultid= dce->GetId();
++        int buttonnum  = dce->GetResult();
++        if (resultid == "popmenu_exit")
++        {
++            if (buttonnum == 0)
++            {
++                QString halt_cmd = gContext->GetSetting("HaltCommand",
++                        "sudo /sbin/halt -p");
++                if (!halt_cmd.isEmpty())
++                    system(halt_cmd.ascii());
++            }
++
++            if (buttonnum == 1)
++            {
++                QString reboot_cmd = gContext->GetSetting("RebootCommand",
++                        "sudo /sbin/reboot");
++                if (!reboot_cmd.isEmpty())
++                    system(reboot_cmd.ascii());
++            }
++
++            if (buttonnum == 2)
++            {
++                aboutScreen();
++            }
++        }
++
++        if (resultid == "popmenu_noexit")
++        {
++            if (buttonnum == 0)
++                aboutScreen();
++        }
++
++        m_menuPopup = NULL;
++    }
++}
diff --git a/abs/core-testing/mythtv/stable/mythtv/myththemedmenu.h.patch b/abs/core-testing/mythtv/stable/mythtv/myththemedmenu.h.patch
new file mode 100644
index 0000000..9744b11
--- /dev/null
+++ b/abs/core-testing/mythtv/stable/mythtv/myththemedmenu.h.patch
@@ -0,0 +1,25 @@
+--- libs/libmythui/myththemedmenu.h.orig	2008-01-31 15:26:45.000000000 +0000
++++ libs/libmythui/myththemedmenu.h	2008-02-07 21:00:22.000000000 +0000
+@@ -2,6 +2,7 @@
+ #define MYTHTHEMEDMENU_H_
+ 
+ #include "mythscreentype.h"
++#include "mythdialogbox.h"
+ 
+ class MythMainWindow;
+ class MythThemedMenuPrivate;
+@@ -26,8 +27,14 @@
+ 
+     void ReloadTheme(void);
+     void ReloadExitKey(void);
++
+     virtual void aboutToShow(void);
+ 
++    void doMenu();
++    void aboutScreen();
++    MythDialogBox *m_menuPopup;
++    void customEvent(QCustomEvent *event);
++
+   protected:
+     virtual bool keyPressEvent(QKeyEvent *e);
+     virtual void gestureEvent(MythUIType *origtype, MythGestureEvent *ge);
diff --git a/abs/core-testing/mythtv/stable/mythtv/smolt_jump.patch b/abs/core-testing/mythtv/stable/mythtv/smolt_jump.patch
new file mode 100644
index 0000000..696be80
--- /dev/null
+++ b/abs/core-testing/mythtv/stable/mythtv/smolt_jump.patch
@@ -0,0 +1,9 @@
+--- programs/mythfrontend/networkcontrol.cpp.orig	2008-03-23 23:00:25.000000000 +0000
++++ programs/mythfrontend/networkcontrol.cpp	2008-03-23 23:01:33.000000000 +0000
+@@ -81,6 +81,7 @@
+     jumpMap["zoneminderliveview"]    = "ZoneMinder Live View";
+     jumpMap["zoneminderevents"]      = "ZoneMinder Events";
++    jumpMap["mythsmolt"]             = "MythSmolt";
+ 
+     // These jump point names match the (lowercased) locations from gContext
+     jumpMap["channelrecpriority"]    = "Channel Recording Priorities";
-- 
cgit v0.12