本文整理汇总了C++中QWebSettings::setIconDatabasePath方法的典型用法代码示例。如果您正苦于以下问题:C++ QWebSettings::setIconDatabasePath方法的具体用法?C++ QWebSettings::setIconDatabasePath怎么用?C++ QWebSettings::setIconDatabasePath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QWebSettings
的用法示例。
在下文中一共展示了QWebSettings::setIconDatabasePath方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createWidget
WebWidget* QtWebKitWebBackend::createWidget(bool isPrivate, ContentsWidget *parent)
{
if (!m_isInitialized)
{
m_isInitialized = true;
QWebHistoryInterface::setDefaultInterface(new QtWebKitHistoryInterface(this));
QWebSettings *globalSettings = QWebSettings::globalSettings();
globalSettings->setAttribute(QWebSettings::DnsPrefetchEnabled, true);
globalSettings->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
const QString cachePath = SessionsManager::getCachePath();
if (!cachePath.isEmpty())
{
QDir().mkpath(cachePath);
globalSettings->setIconDatabasePath(cachePath);
globalSettings->setLocalStoragePath(cachePath + QLatin1String("/localStorage/"));
globalSettings->setOfflineStoragePath(cachePath + QLatin1String("/offlineStorage/"));
globalSettings->setOfflineWebApplicationCachePath(cachePath + QLatin1String("/offlineWebApplicationCache/"));
}
QWebSettings::setMaximumPagesInCache(SettingsManager::getValue(QLatin1String("Cache/PagesInMemoryLimit")).toInt());
optionChanged(QLatin1String("Browser/"));
connect(SettingsManager::getInstance(), SIGNAL(valueChanged(QString,QVariant)), this, SLOT(optionChanged(QString)));
}
return new QtWebKitWebWidget(isPrivate, this, NULL, parent);
}
示例2: initWebSettings
bool WebSettings::initWebSettings()
{
if (!localSettingsLoaded)
return false;
qDebug("webOS::WebSettings::initWebSettings");
QWebSettings* globalWebSettings = QWebSettings::globalSettings();
QSettings settings;
if (settings.value(WEB_SETTINGS_KEY_PERSISTENT_STORAGE).toBool()) {
QString path = settings.value(WEB_SETTINGS_KEY_PERSISTENT_STORAGE_PATH).toString();
if (!path.isEmpty()) {
globalWebSettings->setAttribute(QWebSettings::LocalStorageEnabled, true);
globalWebSettings->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, true);
globalWebSettings->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, true);
globalWebSettings->setIconDatabasePath(path);
globalWebSettings->setOfflineWebApplicationCachePath(path);
globalWebSettings->setOfflineStoragePath(QString("%1/Databases").arg(path));
globalWebSettings->setLocalStoragePath(QString("%1/LocalStorage").arg(path));
}
}
if (settings.contains(WEB_SETTINGS_KEY_AUTO_LOAD_IMAGES))
globalWebSettings->setAttribute(QWebSettings::AutoLoadImages, settings.value(WEB_SETTINGS_KEY_AUTO_LOAD_IMAGES).toBool());
if (settings.contains(WEB_SETTINGS_KEY_DNS_PREFETCH))
globalWebSettings->setAttribute(QWebSettings::DnsPrefetchEnabled, settings.value(WEB_SETTINGS_KEY_DNS_PREFETCH).toBool());
if (settings.contains(WEB_SETTINGS_KEY_ICON_DATABASE_PATH))
globalWebSettings->setIconDatabasePath(settings.value(WEB_SETTINGS_KEY_ICON_DATABASE_PATH).toString());
if (settings.contains(WEB_SETTINGS_KEY_JAVASCRIPT))
globalWebSettings->setAttribute(QWebSettings::JavascriptEnabled, settings.value(WEB_SETTINGS_KEY_JAVASCRIPT).toBool());
if (settings.contains(WEB_SETTINGS_KEY_PLUGINS))
globalWebSettings->setAttribute(QWebSettings::PluginsEnabled, settings.value(WEB_SETTINGS_KEY_PLUGINS).toBool());
if (settings.contains(WEB_SETTINGS_KEY_PRIVATE_BROWSING))
globalWebSettings->setAttribute(QWebSettings::PrivateBrowsingEnabled, settings.value(WEB_SETTINGS_KEY_PRIVATE_BROWSING).toBool());
if (settings.contains(WEB_SETTINGS_KEY_JAVASCRIPT_CAN_OPEN_WINDOWS))
globalWebSettings->setAttribute(QWebSettings::JavascriptCanOpenWindows, settings.value(WEB_SETTINGS_KEY_JAVASCRIPT_CAN_OPEN_WINDOWS).toBool());
if (settings.contains(WEB_SETTINGS_KEY_JAVASCRIPT_CAN_CLOSE_WINDOWS))
globalWebSettings->setAttribute(QWebSettings::JavascriptCanCloseWindows, settings.value(WEB_SETTINGS_KEY_JAVASCRIPT_CAN_CLOSE_WINDOWS).toBool());
if (settings.contains(WEB_SETTINGS_KEY_JAVASCRIPT_CAN_ACCESS_CLIPBOARD))
globalWebSettings->setAttribute(QWebSettings::JavascriptCanAccessClipboard, settings.value(WEB_SETTINGS_KEY_JAVASCRIPT_CAN_ACCESS_CLIPBOARD).toBool());
if (settings.contains(WEB_SETTINGS_KEY_DEVELOPER_EXTRAS))
globalWebSettings->setAttribute(QWebSettings::DeveloperExtrasEnabled, settings.value(WEB_SETTINGS_KEY_DEVELOPER_EXTRAS).toBool());
if (settings.contains(WEB_SETTINGS_KEY_SPACIAL_NAVIGATION))
globalWebSettings->setAttribute(QWebSettings::SpatialNavigationEnabled, settings.value(WEB_SETTINGS_KEY_SPACIAL_NAVIGATION).toBool());
if (settings.contains(WEB_SETTINGS_KEY_LINKS_INCLUDED_IN_FOCUS_CHAIN))
globalWebSettings->setAttribute(QWebSettings::LinksIncludedInFocusChain, settings.value(WEB_SETTINGS_KEY_LINKS_INCLUDED_IN_FOCUS_CHAIN).toBool());
if (settings.contains(WEB_SETTINGS_KEY_ZOOM_TEXT_ONLY))
globalWebSettings->setAttribute(QWebSettings::ZoomTextOnly, settings.value(WEB_SETTINGS_KEY_ZOOM_TEXT_ONLY).toBool());
if (settings.contains(WEB_SETTINGS_KEY_PRINT_ELEMENT_BACKGROUNDS))
globalWebSettings->setAttribute(QWebSettings::PrintElementBackgrounds, settings.value(WEB_SETTINGS_KEY_PRINT_ELEMENT_BACKGROUNDS).toBool());
if (settings.contains(WEB_SETTINGS_KEY_OFFLINE_STORAGE_DATABASE)) {
bool offlineStorageDatabaseEnabled = settings.value(WEB_SETTINGS_KEY_OFFLINE_STORAGE_DATABASE).toBool();
globalWebSettings->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, offlineStorageDatabaseEnabled);
if (offlineStorageDatabaseEnabled && settings.contains(WEB_SETTINGS_KEY_OFFLINE_STORAGE_DATABASE_PATH))
globalWebSettings->setOfflineStoragePath(settings.value(WEB_SETTINGS_KEY_OFFLINE_STORAGE_DATABASE_PATH).toString());
}
if (settings.contains(WEB_SETTINGS_KEY_OFFLINE_WEBAPP_CACHE)) {
bool offlineWebApplicationCachedEnabled = settings.value(WEB_SETTINGS_KEY_OFFLINE_WEBAPP_CACHE).toBool();
globalWebSettings->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, offlineWebApplicationCachedEnabled);
if (offlineWebApplicationCachedEnabled && settings.contains(WEB_SETTINGS_KEY_OFFLINE_WEBAPP_CACHE_PATH))
globalWebSettings->setOfflineWebApplicationCachePath(settings.value(WEB_SETTINGS_KEY_OFFLINE_WEBAPP_CACHE_PATH).toString());
}
if (settings.contains(WEB_SETTINGS_KEY_LOCAL_STORAGE)) {
bool localStorageEnabled = settings.value(WEB_SETTINGS_KEY_LOCAL_STORAGE).toBool();
globalWebSettings->setAttribute(QWebSettings::LocalStorageEnabled, localStorageEnabled);
if (localStorageEnabled && settings.contains(WEB_SETTINGS_KEY_LOCAL_STORAGE_PATH))
globalWebSettings->setLocalStoragePath(settings.value(WEB_SETTINGS_KEY_LOCAL_STORAGE_PATH).toString());
}
if (settings.contains(WEB_SETTINGS_KEY_LOCAL_CONTENT_CAN_ACCESS_REMOTE_URLS))
globalWebSettings->setAttribute(QWebSettings::LocalContentCanAccessRemoteUrls, settings.value(WEB_SETTINGS_KEY_LOCAL_CONTENT_CAN_ACCESS_REMOTE_URLS).toBool());
if (settings.contains(WEB_SETTINGS_KEY_LOCAL_CONTENT_CAN_ACCESS_FILE_URLS))
globalWebSettings->setAttribute(QWebSettings::LocalContentCanAccessFileUrls, settings.value(WEB_SETTINGS_KEY_LOCAL_CONTENT_CAN_ACCESS_FILE_URLS).toBool());
if (settings.contains(WEB_SETTINGS_KEY_XSS_AUDITING))
globalWebSettings->setAttribute(QWebSettings::XSSAuditingEnabled, settings.value(WEB_SETTINGS_KEY_XSS_AUDITING).toBool());
if (settings.contains(WEB_SETTINGS_KEY_ACCELERATED_COMPOSITING))
globalWebSettings->setAttribute(QWebSettings::AcceleratedCompositingEnabled, settings.value(WEB_SETTINGS_KEY_ACCELERATED_COMPOSITING).toBool());
if (settings.contains(WEB_SETTINGS_KEY_WEBGL))
//.........这里部分代码省略.........
示例3: dir
// --- CONSTRUCTOR ---
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent) {
setupUi(this);
// menu connections
connect(actionQuit, SIGNAL(triggered()), this, SLOT(quit()));
connect(actionAbout_WildFox, SIGNAL(triggered()), this, SLOT(about()));
connect(actionNewTab, SIGNAL(triggered()), this, SLOT(newTab()));
connect(actionClose_Tab, SIGNAL(triggered()), this, SLOT(closeTab()));
connect(actionOptions, SIGNAL(triggered()), this, SLOT(options()));
connect(actionBookmarksSidebar, SIGNAL(triggered()), this, SLOT(sidebarBookmarks()));
// other interface connections
connect(backButton, SIGNAL(pressed()), this, SLOT(back()));
connect(forwardButton, SIGNAL(pressed()), this, SLOT(forward()));
connect(reloadButton, SIGNAL(pressed()), this, SLOT(loadInteraction()));
tabWidget->addAction(actionReload);
connect(actionReload, SIGNAL(triggered()), this, SLOT(reload()));
connect(actionStop, SIGNAL(triggered()), this, SLOT(stop()));
connect(addressBar, SIGNAL(returnPressed()), this, SLOT(gotoURL()));
connect(addressBarGo, SIGNAL(pressed()), this, SLOT(gotoURL()));
connect(tabWidget, SIGNAL(currentChanged(int)), this, SLOT(changeTab(int)));
tabWidget->addAction(actionClose_Tab);
connect(tabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)));
connect(bookmarksTree, SIGNAL(itemClicked(QTreeWidgetItem*,int)), this, SLOT(loadBookmark(QTreeWidgetItem*,int)));
connect(actionBookmark_this_page, SIGNAL(triggered()), this, SLOT(bookmarkAdd()));
addAction(actionGo_to_address_bar);
connect(actionGo_to_address_bar, SIGNAL(triggered()), this, SLOT(gotoAddressBar()));
// defaults
QCoreApplication::setOrganizationName("Nyanko");
QCoreApplication::setOrganizationDomain("nyanko.ws");
QCoreApplication::setApplicationName("WildFox");
QList<QNetworkProxy> proxies = QNetworkProxyFactory::systemProxyForQuery();
QNetworkProxy::setApplicationProxy(proxies[0]);
wv = 0;
//icondb = "./";
cookiejar = new CookieJar();
bookmarks = new Bookmarks(this);
nam = new QNetworkAccessManager(this);
nam->setCookieJar(cookiejar);
stopbutton = false;
QApplication::setActiveWindow(this);
//settings = new QSettings("Nyanko", "WildFox");
settings = new QSettings();
storagePath = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
QDir dir(storagePath);
if (!dir.exists()) {
dir.mkpath(storagePath); // create path if it doesn't exist yet
}
qDebug() << "Storage path: " << storagePath;
QWebSettings* ws = QWebSettings::globalSettings();
ws->setAttribute(QWebSettings::PluginsEnabled, true);
ws->setAttribute(QWebSettings::JavascriptCanOpenWindows, true);
ws->setIconDatabasePath(storagePath);
// load any extensions. For each found extension, read in the JSON manifest
// and create a WebPage object for background scripts and load the extension
// into it. Register URL filters.
// TESTING: XMarks extension is at ./extensions/xmarks/manifest.json
manifest.setFileName(QString("extensions/xmarks/manifest.json"));
if (!manifest.exists() || !manifest.open(QIODevice::ReadOnly)) {
qDebug() << "Failed to open the manifest file.";
}
else {
QString manifestString = manifest.readAll();
bool ok;
QMap<QString, QVariant> result;
result = QtJson::Json::parse(manifestString, ok).toMap();
if (!ok) {
qDebug() << "Parsing of manifest failed.";
}
if (result.contains("background_page")) {
// load this extension into a webpage object.
QWebPage* page = new QWebPage;
page->mainFrame()->load(manifest.fileName());
extPages.append(page);
}
if (result.contains("content_scripts")) {
// add the content scripts in this list to the specified filters.
QMap<QString, QVariant> scripts = result["content_scripts"].toMap();
if (scripts.contains("matches")) {
QList<QVariant> matches = scripts["matches"].toList();
QList<QVariant> js = scripts["js"].toList();
Filter filter;
filter.extId = extPages.size() - 1;
for (int i = 0; i < js.size(); ++i) {
filter.scripts.append(QString("extensions/xmarks/") + js[i].toString());
}
for (int i = 0; i < matches.size(); ++i) {
QStringList urlbit = matches[i].toString().split("://");
if (urlbit.size() < 2) {
continue;
//.........这里部分代码省略.........