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",
"Internal"));
m_zoomEdit->SetText(gCoreContext->GetSetting("WebBrowserZoomLevel", "1.4"));
m_zoomEdit->SetText(gCoreContext->GetSetting("WebBrowserZoomLevel", "1.0"));
int setting = gCoreContext->GetNumSetting("WebBrowserEnablePlugins", 1);
if (setting == 1)
@@ -372,7 +372,7 @@ void BookmarkManager::slotBookmarkClicked(MythUIButtonListItem *item)
m_savedBookmark = *site;
QString cmd = gCoreContext->GetSetting("WebBrowserCommand", "Internal");
QString zoom = gCoreContext->GetSetting("WebBrowserZoomLevel", "1.4");
QString zoom = gCoreContext->GetSetting("WebBrowserZoomLevel", "1.0");
QStringList urls;
urls.append(site->url);
@@ -591,7 +591,7 @@ void BookmarkManager::slotShowMarked(void)
}
QString cmd = gCoreContext->GetSetting("WebBrowserCommand", "Internal");
QString zoom = gCoreContext->GetSetting("WebBrowserZoomLevel", "1.4");
QString zoom = gCoreContext->GetSetting("WebBrowserZoomLevel", "1.0");
QStringList urls;
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);
float zoom = gCoreContext->GetSetting("WebBrowserZoomLevel", "1.4").toFloat();
float zoom = gCoreContext->GetSetting("WebBrowserZoomLevel", "1.0").toFloat();
MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
@@ -85,7 +85,7 @@ int mythplugin_init(const char *libversion)
gCoreContext->SaveSetting("WebBrowserCommand", "Internal");
if (gCoreContext->GetSetting("WebBrowserZoomLevel").isEmpty())
gCoreContext->SaveSetting("WebBrowserZoomLevel", "1.4");
gCoreContext->SaveSetting("WebBrowserZoomLevel", "1.0");
gCoreContext->ActivateSettingsCache(true);
@@ -56,7 +56,7 @@ MythNews::MythNews(MythScreenStack *parent, const QString &name) :
if (!dir.exists())
dir.mkdir(fileprefix);
m_zoom = gCoreContext->GetSetting("WebBrowserZoomLevel", "1.4");
m_zoom = gCoreContext->GetSetting("WebBrowserZoomLevel", "1.0");
m_browser = gCoreContext->GetSetting("WebBrowserCommand", "");
// Initialize variables
@@ -1164,6 +1164,8 @@ void MythUIWebBrowser::SetZoom(float zoom)
UpdateBuffer();
slotStatusBarMessage(tr("Zoom: %1%").arg(m_zoom * 100));
gCoreContext->SaveSetting("WebBrowserZoomLevel", QString("%1").arg(m_zoom));
}
void MythUIWebBrowser::SetDefaultSaveDirectory(const QString &saveDir)

0 comments on commit 1837955

Please sign in to comment.