[mythtv] <webbrowser> widget for general use

Paul Harrison mythtv at sky.com
Mon Jan 12 19:31:49 UTC 2009


Robert McNamara wrote:
> Hate to respond to myself but it seemed it might make sense to show
> the parsing changes I made.  The <url> tag is being parsed properly
> from the theme xml, but attempting to embed a webbrowser object
> results in... well, nothing, actually.  I'm aware I'm not "feeding"
> the browser widget with the QUrl that's parsed, but having tried a
> multitude of things, I've not had much luck in figuring out the right
> way to do that.  Paul, perhaps you can weigh in and help me put 2 and
> 2 together here?  How can I take the m_widgetUrl QUrl and load it if
> it exists?
>
> Thanks,
>
> Robert
>
> Index: libs/libmythui/mythuiwebbrowser.cpp
> ===================================================================
> --- libs/libmythui/mythuiwebbrowser.cpp	(revision 19642)
> +++ libs/libmythui/mythuiwebbrowser.cpp	(working copy)
> @@ -120,9 +120,10 @@
>   *
>   *
>   *      <webbrowser name="webbrowser">
> + *           <url>http://www.google.com/</url>
>   *           <area>20,55,760,490</area>
>   *           <zoom>1.4</zoom>
> - *           <background> color="white" alpha=255" />
> + *           <background color="white" alpha="255" />
>   *      </webbrowser>
>   *
>   * area is the screen area the widget should use.
> @@ -154,9 +155,9 @@
>  #endif
>        m_image(NULL),         m_active(false),
>        m_initialized(false),  m_zoom(1.0),
> -      m_bgColor("White"),    m_inputToggled(false),
> -      m_lastMouseAction(""), m_mouseKeyCount(0),
> -      m_lastMouseActionTime()
> +      m_bgColor("White"),    m_widgetUrl(""),
> +      m_inputToggled(false), m_lastMouseAction(""),
> +      m_mouseKeyCount(0),    m_lastMouseActionTime()
>  {
>      SetCanTakeFocus(true);
>  }
> @@ -739,6 +740,11 @@
>          QString zoom = getFirstText(element);
>          m_zoom = zoom.toFloat();
>      }
> +    else if (element.tagName() == "url")
> +    {
> +        QUrl widgetUrl = getFirstText(element);
> +        m_widgetUrl = widgetUrl;
> +    }
>      else if (element.tagName() == "background")
>      {
>          m_bgColor = QColor(element.attribute("color", "#ffffff"));
> @@ -764,6 +770,7 @@
>
>      m_zoom = browser->m_zoom;
>      m_bgColor = browser->m_bgColor;
> +    m_widgetUrl = browser->m_widgetUrl;
>
>      MythUIType::CopyFrom(base);
>  }
> Index: libs/libmythui/mythuiwebbrowser.h
> ===================================================================
> --- libs/libmythui/mythuiwebbrowser.h	(revision 19642)
> +++ libs/libmythui/mythuiwebbrowser.h	(working copy)
> @@ -109,6 +109,7 @@
>      bool         m_initialized;
>      float        m_zoom;
>      QColor       m_bgColor;
> +    QUrl         m_widgetUrl;
>
>      bool         m_inputToggled;
>      QString      m_lastMouseAction;
>
>   

I think you just need to add  LoadPage(m_widgetUrl); at the bottom of 
Init(). I can't test this just now but will look at it later tonight or 
tomorrow. Assuming I haven't been stabbed in the back by my fellow devs 
by then ;-)

Paul H.



More information about the mythtv-dev mailing list