Permalink
Browse files

MythUIWebBrowser: make the zoom level a live setting

This makes the web browser save the zoom setting when changed and will use the
same zoom level when reopened.

Make the default zoom if not set 100% since most web pages look best at that
zoom level.
  • Loading branch information...
Paul Harrison
Paul Harrison committed Apr 28, 2013
1 parent 5a25b30 commit 183795556e3b8ff4a93364b38491ebd11ff506da
@@ -65,7 +65,7 @@ bool BrowserConfig::Create()
m_commandEdit->SetText(gCoreContext->GetSetting("WebBrowserCommand", m_commandEdit->SetText(gCoreContext->GetSetting("WebBrowserCommand",
"Internal")); "Internal"));
m_zoomEdit->SetText(gCoreContext->GetSetting("WebBrowserZoomLevel", "1.4")); m_zoomEdit->SetText(gCoreContext->GetSetting("WebBrowserZoomLevel", "1.0"));
int setting = gCoreContext->GetNumSetting("WebBrowserEnablePlugins", 1); int setting = gCoreContext->GetNumSetting("WebBrowserEnablePlugins", 1);
if (setting == 1) if (setting == 1)
@@ -372,7 +372,7 @@ void BookmarkManager::slotBookmarkClicked(MythUIButtonListItem *item)
m_savedBookmark = *site; m_savedBookmark = *site;
QString cmd = gCoreContext->GetSetting("WebBrowserCommand", "Internal"); QString cmd = gCoreContext->GetSetting("WebBrowserCommand", "Internal");
QString zoom = gCoreContext->GetSetting("WebBrowserZoomLevel", "1.4"); QString zoom = gCoreContext->GetSetting("WebBrowserZoomLevel", "1.0");
QStringList urls; QStringList urls;
urls.append(site->url); urls.append(site->url);
@@ -591,7 +591,7 @@ void BookmarkManager::slotShowMarked(void)
} }
QString cmd = gCoreContext->GetSetting("WebBrowserCommand", "Internal"); QString cmd = gCoreContext->GetSetting("WebBrowserCommand", "Internal");
QString zoom = gCoreContext->GetSetting("WebBrowserZoomLevel", "1.4"); QString zoom = gCoreContext->GetSetting("WebBrowserZoomLevel", "1.0");
QStringList urls; QStringList urls;
for (int x = 0; x < m_siteList.size(); x++) for (int x = 0; x < m_siteList.size(); x++)
@@ -30,7 +30,7 @@ static int handleMedia(const QString &url, const QString &directory, const QStri
} }
QStringList urls = url.split(" ", QString::SkipEmptyParts); QStringList urls = url.split(" ", QString::SkipEmptyParts);
float zoom = gCoreContext->GetSetting("WebBrowserZoomLevel", "1.4").toFloat(); float zoom = gCoreContext->GetSetting("WebBrowserZoomLevel", "1.0").toFloat();
MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
@@ -85,7 +85,7 @@ int mythplugin_init(const char *libversion)
gCoreContext->SaveSetting("WebBrowserCommand", "Internal"); gCoreContext->SaveSetting("WebBrowserCommand", "Internal");
if (gCoreContext->GetSetting("WebBrowserZoomLevel").isEmpty()) if (gCoreContext->GetSetting("WebBrowserZoomLevel").isEmpty())
gCoreContext->SaveSetting("WebBrowserZoomLevel", "1.4"); gCoreContext->SaveSetting("WebBrowserZoomLevel", "1.0");
gCoreContext->ActivateSettingsCache(true); gCoreContext->ActivateSettingsCache(true);
@@ -56,7 +56,7 @@ MythNews::MythNews(MythScreenStack *parent, const QString &name) :
if (!dir.exists()) if (!dir.exists())
dir.mkdir(fileprefix); dir.mkdir(fileprefix);
m_zoom = gCoreContext->GetSetting("WebBrowserZoomLevel", "1.4"); m_zoom = gCoreContext->GetSetting("WebBrowserZoomLevel", "1.0");
m_browser = gCoreContext->GetSetting("WebBrowserCommand", ""); m_browser = gCoreContext->GetSetting("WebBrowserCommand", "");
// Initialize variables // Initialize variables
@@ -1164,6 +1164,8 @@ void MythUIWebBrowser::SetZoom(float zoom)
UpdateBuffer(); UpdateBuffer();
slotStatusBarMessage(tr("Zoom: %1%").arg(m_zoom * 100)); slotStatusBarMessage(tr("Zoom: %1%").arg(m_zoom * 100));
gCoreContext->SaveSetting("WebBrowserZoomLevel", QString("%1").arg(m_zoom));
} }
void MythUIWebBrowser::SetDefaultSaveDirectory(const QString &saveDir) void MythUIWebBrowser::SetDefaultSaveDirectory(const QString &saveDir)

0 comments on commit 1837955

Please sign in to comment.