本文整理汇总了C++中QWebSettings::setOfflineWebApplicationCacheQuota方法的典型用法代码示例。如果您正苦于以下问题:C++ QWebSettings::setOfflineWebApplicationCacheQuota方法的具体用法?C++ QWebSettings::setOfflineWebApplicationCacheQuota怎么用?C++ QWebSettings::setOfflineWebApplicationCacheQuota使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QWebSettings
的用法示例。
在下文中一共展示了QWebSettings::setOfflineWebApplicationCacheQuota方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: optionChanged
void QtWebKitWebBackend::optionChanged(const QString &option)
{
if (option == QLatin1String("Cache/PagesInMemoryLimit"))
{
QWebSettings::setMaximumPagesInCache(SettingsManager::getValue(QLatin1String("Cache/PagesInMemoryLimit")).toInt());
}
if (!(option.startsWith(QLatin1String("Browser/")) || option.startsWith(QLatin1String("Content/"))))
{
return;
}
QWebSettings *globalSettings = QWebSettings::globalSettings();
globalSettings->setAttribute(QWebSettings::DnsPrefetchEnabled, true);
globalSettings->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
globalSettings->setAttribute(QWebSettings::AutoLoadImages, SettingsManager::getValue(QLatin1String("Browser/EnableImages")).toBool());
globalSettings->setAttribute(QWebSettings::PluginsEnabled, SettingsManager::getValue(QLatin1String("Browser/EnablePlugins")).toString() != QLatin1String("disabled"));
globalSettings->setAttribute(QWebSettings::JavaEnabled, SettingsManager::getValue(QLatin1String("Browser/EnableJava")).toBool());
globalSettings->setAttribute(QWebSettings::JavascriptEnabled, SettingsManager::getValue(QLatin1String("Browser/EnableJavaScript")).toBool());
globalSettings->setAttribute(QWebSettings::JavascriptCanAccessClipboard, SettingsManager::getValue(QLatin1String("Browser/JavaScriptCanAccessClipboard")).toBool());
globalSettings->setAttribute(QWebSettings::JavascriptCanCloseWindows, true);
globalSettings->setAttribute(QWebSettings::JavascriptCanOpenWindows, SettingsManager::getValue(QLatin1String("Browser/JavaScriptCanOpenWindows")).toBool());
globalSettings->setAttribute(QWebSettings::LocalStorageEnabled, SettingsManager::getValue(QLatin1String("Browser/EnableLocalStorage")).toBool());
globalSettings->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, SettingsManager::getValue(QLatin1String("Browser/EnableOfflineStorageDatabase")).toBool());
globalSettings->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, SettingsManager::getValue(QLatin1String("Browser/EnableOfflineWebApplicationCache")).toBool());
globalSettings->setAttribute(QWebSettings::ZoomTextOnly, SettingsManager::getValue(QLatin1String("Content/ZoomTextOnly")).toBool());
globalSettings->setFontSize(QWebSettings::DefaultFontSize, SettingsManager::getValue(QLatin1String("Content/DefaultFontSize")).toInt());
globalSettings->setFontSize(QWebSettings::DefaultFixedFontSize, SettingsManager::getValue(QLatin1String("Content/DefaultFixedFontSize")).toInt());
globalSettings->setFontSize(QWebSettings::MinimumFontSize, SettingsManager::getValue(QLatin1String("Content/MinimumFontSize")).toInt());
globalSettings->setFontFamily(QWebSettings::StandardFont, SettingsManager::getValue(QLatin1String("Content/StandardFont")).toString());
globalSettings->setFontFamily(QWebSettings::FixedFont, SettingsManager::getValue(QLatin1String("Content/FixedFont")).toString());
globalSettings->setFontFamily(QWebSettings::SerifFont, SettingsManager::getValue(QLatin1String("Content/SerifFont")).toString());
globalSettings->setFontFamily(QWebSettings::SansSerifFont, SettingsManager::getValue(QLatin1String("Content/SansSerifFont")).toString());
globalSettings->setFontFamily(QWebSettings::CursiveFont, SettingsManager::getValue(QLatin1String("Content/CursiveFont")).toString());
globalSettings->setFontFamily(QWebSettings::FantasyFont, SettingsManager::getValue(QLatin1String("Content/FantasyFont")).toString());
globalSettings->setOfflineStorageDefaultQuota(SettingsManager::getValue(QLatin1String("Browser/OfflineStorageLimit")).toInt() * 1024);
globalSettings->setOfflineWebApplicationCacheQuota(SettingsManager::getValue(QLatin1String("Content/OfflineWebApplicationCacheLimit")).toInt() * 1024);
}
示例2:
static void configureHtml5OfflineStorage()
{
BEDROCK_PROVISIONING::BedrockProvisioning * provisioning =
BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning();
QWebSettings * globalSettings = QWebSettings::globalSettings();
// Enable all kinds of persistent storage, then fine-tune using
// bedrock provisioning attributes.
QWebSettings::enablePersistentStorage();
// Local and database storage (using the global javascript localStorage
// and openDatabase items) is shared across pages and browser invocations,
// but it tied to the domain of the page in which the javascript code is
// running. This allows webpages hosted at, say, cnn.com to store data
// using the same keys as webpages hosted at bbc.co.uk without conflict.
//
// Note that local and database storage is persisted in directories
// beneath the application's private directory, so it is not shared
// with other browsers.
bool localStorageEnabled =
provisioning->valueAsInt("Html5LocalStorage") != 0;
bool databaseStorageEnabled =
provisioning->valueAsInt("Html5DatabaseStorage") != 0;
globalSettings->setAttribute(
QWebSettings::LocalStorageEnabled,
localStorageEnabled);
globalSettings->setAttribute(
QWebSettings::OfflineStorageDatabaseEnabled,
databaseStorageEnabled);
// There is no separate QWebSettings method to configure
// the default quota for local storage databases.
// It appears that both local storage and database storage
// use the same default quota.
if (localStorageEnabled || databaseStorageEnabled) {
globalSettings->setOfflineStorageDefaultQuota(
provisioning->valueAsInt64("Html5DatabaseStorageMaxSize"));
}
// The application cache allows websites to specify a manifest file in
// the outermost <html> element. The manifest file defines which files
// may be stored at the client and used when the network is inaccessible.
//
// Webkit stores the application cache in a single SQLite database
// named ApplicationCache.db. By default this database is located
// in the application's private directory, so it is not shared with
// other browsers.
bool applicationCacheEnabled =
provisioning->valueAsInt("Html5ApplicationCache") != 0;
globalSettings->setAttribute(
QWebSettings::OfflineWebApplicationCacheEnabled,
applicationCacheEnabled);
if (applicationCacheEnabled) {
globalSettings->setOfflineWebApplicationCacheQuota(
provisioning->valueAsInt64("Html5ApplicationCacheMaxSize"));
}
}