Skip to content

Commit

Permalink
MythUIWebBrowser: Make the web page always active by default.
Browse files Browse the repository at this point in the history
The web page is now always active if it is on the top screen unless you tell it
otherwise. This also removes the Taking/LosingFocus slots which are no longer
needed.
  • Loading branch information
Paul Harrison committed May 5, 2011
1 parent 600c22f commit 9bbffca
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 45 deletions.
56 changes: 13 additions & 43 deletions mythtv/libs/libmythui/mythuiwebbrowser.cpp
Expand Up @@ -567,7 +567,7 @@ bool MythWebView::isVideoFile(const QString &extension)
*/
MythUIWebBrowser::MythUIWebBrowser(MythUIType *parent, const QString &name)
: MythUIType(parent, name), m_browser(NULL),
m_image(NULL), m_active(false),
m_image(NULL), m_active(false), m_wasActive(false),
m_initialized(false), m_lastUpdateTime(QTime()),
m_updateInterval(0), m_zoom(1.0),
m_bgColor("White"), m_widgetUrl(QUrl()), m_userCssFile(""),
Expand Down Expand Up @@ -642,11 +642,6 @@ void MythUIWebBrowser::Init(void)
connect(m_browser, SIGNAL(linkClicked(const QUrl&)),
this, SLOT(slotLinkClicked(const QUrl&)));

connect(this, SIGNAL(TakingFocus()),
this, SLOT(slotTakingFocus(void)));
connect(this, SIGNAL(LosingFocus()),
this, SLOT(slotLosingFocus(void)));

// find what screen we are on
m_parentScreen = NULL;
QObject *parentObject = parent();
Expand Down Expand Up @@ -804,26 +799,21 @@ void MythUIWebBrowser::SetActive(bool active)
return;

m_active = active;
m_wasActive = active;

if (m_active)
{
if (m_HasFocus)
{
m_browser->setUpdatesEnabled(false);
m_browser->setFocus();
m_browser->show();
m_browser->raise();
m_browser->setUpdatesEnabled(true);
}
m_browser->setUpdatesEnabled(false);
m_browser->setFocus();
m_browser->show();
m_browser->raise();
m_browser->setUpdatesEnabled(true);
}
else
{
if (m_HasFocus)
{
m_browser->clearFocus();
m_browser->hide();
UpdateBuffer();
}
m_browser->clearFocus();
m_browser->hide();
UpdateBuffer();
}
}

Expand Down Expand Up @@ -998,28 +988,6 @@ void MythUIWebBrowser::slotIconChanged(void)
emit iconChanged();
}

void MythUIWebBrowser::slotTakingFocus(void)
{
if (m_active)
{
m_browser->setUpdatesEnabled(false);
m_browser->setFocus();
m_browser->show();
m_browser->raise();
m_browser->setUpdatesEnabled(true);
}
else
UpdateBuffer();
}

void MythUIWebBrowser::slotLosingFocus(void)
{
m_browser->clearFocus();
m_browser->hide();

UpdateBuffer();
}

void MythUIWebBrowser::slotTopScreenChanged(MythScreenType* screen)
{
(void) screen;
Expand All @@ -1038,12 +1006,14 @@ void MythUIWebBrowser::slotTopScreenChanged(MythScreenType* screen)

if (stack->GetTopScreen() == m_parentScreen)
{
SetActive(true);
SetActive(m_wasActive);
break;
}
else
{
bool wasActive = m_active;
SetActive(false);
m_wasActive = wasActive;
break;
}
}
Expand Down
3 changes: 1 addition & 2 deletions mythtv/libs/libmythui/mythuiwebbrowser.h
Expand Up @@ -149,8 +149,6 @@ class MUI_PUBLIC MythUIWebBrowser : public MythUIType
void slotLoadFinished(bool Ok);
void slotLoadProgress(int progress);
void slotTitleChanged(const QString &title);
void slotTakingFocus(void);
void slotLosingFocus(void);
void slotStatusBarMessage(const QString &text);
void slotIconChanged(void);
void slotLinkClicked(const QUrl &url);
Expand All @@ -177,6 +175,7 @@ class MUI_PUBLIC MythUIWebBrowser : public MythUIType
MythImage *m_image;

bool m_active;
bool m_wasActive;
bool m_initialized;
QTime m_lastUpdateTime;
int m_updateInterval;
Expand Down

0 comments on commit 9bbffca

Please sign in to comment.