本文整理汇总了C++中WebView类的典型用法代码示例。如果您正苦于以下问题:C++ WebView类的具体用法?C++ WebView怎么用?C++ WebView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WebView类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: TEST_F
TEST_F(WebPluginContainerTest, PrintAllPages)
{
URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("test.pdf"), WebString::fromUTF8("application/pdf"));
TestPluginWebFrameClient pluginWebFrameClient; // Must outlive webViewHelper.
FrameTestHelpers::WebViewHelper webViewHelper;
WebView* webView = webViewHelper.initializeAndLoad(m_baseURL + "test.pdf", true, &pluginWebFrameClient);
ASSERT(webView);
webView->updateAllLifecyclePhases();
runPendingTasks();
WebFrame* frame = webView->mainFrame();
WebPrintParams printParams;
printParams.printContentArea.width = 500;
printParams.printContentArea.height = 500;
frame->printBegin(printParams);
SkPictureRecorder recorder;
frame->printPagesWithBoundaries(recorder.beginRecording(IntRect()), WebSize());
frame->printEnd();
ASSERT(pluginWebFrameClient.printedAtLeastOnePage());
}
开发者ID:shaoboyan,项目名称:chromium-crosswalk,代码行数:22,代码来源:WebPluginContainerTest.cpp
示例2: Q_ASSERT
void TabWidget::currentChanged(int index)
{
WebView *webView = this->webView(index);
if (!webView)
return;
Q_ASSERT(m_lineEdits->count() == count());
WebView *oldWebView = this->webView(m_lineEdits->currentIndex());
if (oldWebView) {
disconnect(oldWebView, SIGNAL(statusBarMessage(const QString&)),
this, SIGNAL(showStatusBarMessage(const QString&)));
disconnect(oldWebView->page(), SIGNAL(linkHovered(const QString&, const QString&, const QString&)),
this, SIGNAL(linkHovered(const QString&)));
disconnect(oldWebView, SIGNAL(loadProgress(int)),
this, SIGNAL(loadProgress(int)));
}
connect(webView, SIGNAL(statusBarMessage(const QString&)),
this, SIGNAL(showStatusBarMessage(const QString&)));
connect(webView->page(), SIGNAL(linkHovered(const QString&, const QString&, const QString&)),
this, SIGNAL(linkHovered(const QString&)));
connect(webView, SIGNAL(loadProgress(int)),
this, SIGNAL(loadProgress(int)));
for (int i = 0; i < m_actions.count(); ++i) {
WebActionMapper *mapper = m_actions[i];
mapper->updateCurrent(webView->page());
}
emit setCurrentTitle(webView->title());
m_lineEdits->setCurrentIndex(index);
emit loadProgress(webView->progress());
emit showStatusBarMessage(webView->lastStatusBarText());
if (webView->url().isEmpty())
m_lineEdits->currentWidget()->setFocus();
else
webView->setFocus();
}
开发者ID:eagafonov,项目名称:qtmoko,代码行数:38,代码来源:tabwidget.cpp
示例3: LRE
void StatusBarMessage::showMessage(const QString &message)
{
if (m_window->statusBar()->isVisible()) {
const static QChar LRE(0x202a);
m_window->statusBar()->showMessage(message.isRightToLeft() ? message : (LRE + message));
}
#ifdef Q_OS_WIN
else if (mApp->activeWindow() == m_window) {
#else
else {
#endif
WebView* view = m_window->weView();
m_statusBarText->setText(message);
m_statusBarText->setMaximumWidth(view->width() - 20);
m_statusBarText->resize(m_statusBarText->sizeHint());
QPoint position(0, view->height() - m_statusBarText->height());
const QRect statusRect = QRect(view->mapToGlobal(QPoint(0, position.y())), m_statusBarText->size());
if (statusRect.contains(QCursor::pos())) {
position.setY(position.y() - m_statusBarText->height());
}
m_statusBarText->move(view->mapToGlobal(position));
m_statusBarText->show(view);
}
}
void StatusBarMessage::clearMessage()
{
if (m_window->statusBar()->isVisible()) {
m_window->statusBar()->showMessage(QString());
}
else {
m_statusBarText->hideDelayed();
}
}
开发者ID:Acidburn0zzz,项目名称:qupzilla,代码行数:38,代码来源:statusbarmessage.cpp
示例4: kit
void WebVisitedLinkStore::populateVisitedLinksIfNeeded(Page& sourcePage)
{
if (m_visitedLinksPopulated)
return;
m_visitedLinksPopulated = true;
WebView* webView = kit(&sourcePage);
if (!webView)
return;
COMPtr<IWebHistoryDelegate> historyDelegate;
webView->historyDelegate(&historyDelegate);
if (historyDelegate) {
historyDelegate->populateVisitedLinksForWebView(webView);
return;
}
WebHistory* history = WebHistory::sharedHistory();
if (!history)
return;
history->addVisitedLinksToVisitedLinkStore(*this);
}
开发者ID:cheekiatng,项目名称:webkit,代码行数:23,代码来源:WebVisitedLinkStore.cpp
示例5: getMainFrame
void TextInputController::setComposition(const CppArgumentList& arguments, CppVariant* result)
{
result->setNull();
WebView* view = getMainFrame() ? getMainFrame()->view() : 0;
if (!view)
return;
if (arguments.size() < 1)
return;
// Sends a keydown event with key code = 0xE5 to emulate input method behavior.
WebKeyboardEvent keyDown;
keyDown.type = WebInputEvent::RawKeyDown;
keyDown.modifiers = 0;
keyDown.windowsKeyCode = 0xE5; // VKEY_PROCESSKEY
keyDown.setKeyIdentifierFromWindowsKeyCode();
view->handleInputEvent(keyDown);
WebVector<WebCompositionUnderline> underlines;
WebString text(WebString::fromUTF8(arguments[0].toString()));
view->setComposition(text, underlines, 0, text.length());
}
开发者ID:achellies,项目名称:WinCEWebKit,代码行数:23,代码来源:TextInputController.cpp
示例6: dispatchWillSendRequest
void WebFrameLoaderClient::dispatchWillSendRequest(DocumentLoader* loader, unsigned long identifier, ResourceRequest& request, const ResourceResponse& redirectResponse)
{
WebView* webView = m_webFrame->webView();
COMPtr<IWebResourceLoadDelegate> resourceLoadDelegate;
if (FAILED(webView->resourceLoadDelegate(&resourceLoadDelegate)))
return;
COMPtr<WebMutableURLRequest> webURLRequest(AdoptCOM, WebMutableURLRequest::createInstance(request));
COMPtr<WebURLResponse> webURLRedirectResponse(AdoptCOM, WebURLResponse::createInstance(redirectResponse));
COMPtr<IWebURLRequest> newWebURLRequest;
if (FAILED(resourceLoadDelegate->willSendRequest(webView, identifier, webURLRequest.get(), webURLRedirectResponse.get(), getWebDataSource(loader), &newWebURLRequest)))
return;
if (webURLRequest == newWebURLRequest)
return;
COMPtr<WebMutableURLRequest> newWebURLRequestImpl(Query, newWebURLRequest);
if (!newWebURLRequestImpl)
return;
request = newWebURLRequestImpl->resourceRequest();
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:23,代码来源:WebFrameLoaderClient.cpp
示例7: ENABLE
void WebFrameLoaderClient::dispatchDidReceiveResponse(DocumentLoader* loader, unsigned long identifier, const ResourceResponse& response)
{
#if ENABLE(WIDGET_ENGINE)
SharedPtr<WebWidgetEngineDelegate> widgetEngineDelegate = m_webFrame->webView()->webWidgetEngineDelegate();
if (widgetEngineDelegate && loader->responseMIMEType() == "application/widget") {
const char* url = widgetEngineDelegate->receiveWidget(strdup(loader->responseURL().string().utf8().data()), m_webFrame);
loader->stopLoading();
if (url)
m_webFrame->loadURL(url);
return;
}
#endif
WebView* webView = m_webFrame->webView();
SharedPtr<WebResourceLoadDelegate> resourceLoadDelegate = webView->webResourceLoadDelegate();
if (!resourceLoadDelegate)
return;
WebURLResponse* webURLResponse = WebURLResponse::createInstance(response);
resourceLoadDelegate->didReceiveResponse(webView, identifier, webURLResponse, getWebDataSource(loader));
delete webURLResponse;
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:23,代码来源:WebFrameLoaderClient.cpp
示例8: QObject
ApplicationUI::ApplicationUI(bb::cascades::Application *app) :
QObject(app)
{
// prepare the localization
m_pTranslator = new QTranslator(this);
m_pLocaleHandler = new LocaleHandler(this);
bool res = QObject::connect(m_pLocaleHandler, SIGNAL(systemLanguageChanged()), this, SLOT(onSystemLanguageChanged()));
// This is only available in Debug builds
Q_ASSERT(res);
// Since the variable is not used in the app, this is added to avoid a
// compiler warning
Q_UNUSED(res);
// initial load
onSystemLanguageChanged();
// Create scene document from main.qml asset, the parent is set
// to ensure the document gets destroyed properly at shut down.
QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
qml->setContextProperty("app", this);
// Create root object for the UI
AbstractPane *root = qml->createRootObject<AbstractPane>();
WebView* wv = root->findChild<WebView*>("oauthWebView");
QString url = "https://www.dropbox.com/1/oauth2/authorize?";
url.append("client_id=").append("<appkey>").append("&");
url.append("response_type=token&");
url.append("redirect_uri=").append("<redirect_uri>").append("&");
url.append("state=").append("<CSRF token>");
wv->setUrl(QUrl(url));
// Set created root object as the application scene
app->setScene(root);
}
开发者ID:Jendorski,项目名称:oauth-webview,代码行数:36,代码来源:applicationui.cpp
示例9: updateGlobalHistoryRedirectLinks
void WebFrameLoaderClient::updateGlobalHistoryRedirectLinks()
{
WebView* webView = m_webFrame->webView();
SharedPtr<WebHistoryDelegate> historyDelegate = webView->historyDelegate();
WebHistory* history = WebHistory::sharedHistory();
DocumentLoader* loader = core(m_webFrame)->loader()->documentLoader();
ASSERT(loader->unreachableURL().isEmpty());
if (!loader->clientRedirectSourceForHistory().isNull()) {
if (historyDelegate) {
String sourceURL(loader->clientRedirectSourceForHistory());
String destinationURL(loader->clientRedirectDestinationForHistory());
historyDelegate->didPerformClientRedirectFromURL(webView, sourceURL.utf8().data(), destinationURL.utf8().data(), m_webFrame);
} else {
if (history) {
if (WebHistoryItem* webHistoryItem = history->itemForURLString(strdup(loader->clientRedirectSourceForHistory().utf8().data())))
webHistoryItem->getPrivateItem()->m_historyItem.get()->addRedirectURL(loader->clientRedirectDestinationForHistory());
}
}
}
if (!loader->serverRedirectSourceForHistory().isNull()) {
if (historyDelegate) {
String sourceURL(loader->serverRedirectSourceForHistory());
String destinationURL(loader->serverRedirectDestinationForHistory());
historyDelegate->didPerformServerRedirectFromURL(webView, sourceURL.utf8().data(), destinationURL.utf8().data(), m_webFrame);
} else {
if (history) {
if (WebHistoryItem *webHistoryItem = history->itemForURLString(strdup(loader->serverRedirectSourceForHistory().utf8().data())))
webHistoryItem->getPrivateItem()->m_historyItem.get()->addRedirectURL(loader->serverRedirectDestinationForHistory());
}
}
}
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:36,代码来源:WebFrameLoaderClient.cpp
示例10: core
void WebFrameLoaderClient::updateGlobalHistory()
{
DocumentLoader* loader = core(m_webFrame)->loader()->documentLoader();
WebView* webView = m_webFrame->webView();
COMPtr<IWebHistoryDelegate> historyDelegate;
webView->historyDelegate(&historyDelegate);
if (historyDelegate) {
COMPtr<IWebURLResponse> urlResponse(AdoptCOM, WebURLResponse::createInstance(loader->response()));
COMPtr<IWebURLRequest> urlRequest(AdoptCOM, WebMutableURLRequest::createInstance(loader->originalRequestCopy()));
COMPtr<IWebNavigationData> navigationData(AdoptCOM, WebNavigationData::createInstance(
loader->urlForHistory(), loader->title(), urlRequest.get(), urlResponse.get(), loader->substituteData().isValid(), loader->clientRedirectSourceForHistory()));
historyDelegate->didNavigateWithNavigationData(webView, navigationData.get(), m_webFrame);
return;
}
WebHistory* history = WebHistory::sharedHistory();
if (!history)
return;
history->visitedURL(loader->urlForHistory(), loader->title(), loader->originalRequestCopy().httpMethod(), loader->urlForHistoryReflectsFailure(), !loader->clientRedirectSourceForHistory());
}
开发者ID:,项目名称:,代码行数:24,代码来源:
示例11: aboutToShowEditMenu
void MainMenu::aboutToShowEditMenu()
{
if (!m_window) {
return;
}
WebView* view = m_window->weView();
m_actions[QSL("Edit/Undo")]->setEnabled(view->pageAction(QWebPage::Undo)->isEnabled());
m_actions[QSL("Edit/Redo")]->setEnabled(view->pageAction(QWebPage::Redo)->isEnabled());
m_actions[QSL("Edit/Cut")]->setEnabled(view->pageAction(QWebPage::Cut)->isEnabled());
m_actions[QSL("Edit/Copy")]->setEnabled(view->pageAction(QWebPage::Copy)->isEnabled());
m_actions[QSL("Edit/Paste")]->setEnabled(view->pageAction(QWebPage::Paste)->isEnabled());
m_actions[QSL("Edit/SelectAll")]->setEnabled(view->pageAction(QWebPage::SelectAll)->isEnabled());
m_actions[QSL("Edit/Find")]->setEnabled(true);
}
开发者ID:Gcrosby5269,项目名称:qupzilla,代码行数:16,代码来源:mainmenu.cpp
示例12: TEST_F
TEST_F(WebFrameTest, DeviceScaleFactorUsesDefaultWithoutViewportTag)
{
registerMockedHttpURLLoad("no_viewport_tag.html");
int viewportWidth = 640;
int viewportHeight = 480;
FixedLayoutTestWebViewClient client;
client.m_screenInfo.horizontalDPI = 160;
client.m_windowRect = WebRect(0, 0, viewportWidth, viewportHeight);
WebView* webView = static_cast<WebView*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "no_viewport_tag.html", true, 0, &client));
webView->resize(WebSize(viewportWidth, viewportHeight));
webView->settings()->setViewportEnabled(true);
webView->settings()->setDefaultDeviceScaleFactor(2);
webView->enableFixedLayoutMode(true);
webView->layout();
EXPECT_EQ(2, webView->deviceScaleFactor());
}
开发者ID:Moondee,项目名称:Artemis,代码行数:21,代码来源:WebFrameTest.cpp
示例13: OS
void WebFrameLoaderClient::setTitle(const String& title, const KURL& url)
{
#if OS(AMIGAOS4)
if (!m_webFrame->parentFrame()) {
BalWidget* viewWindow = m_webFrame->webView()->viewWindow();
if (viewWindow && viewWindow->window) {
extern char* utf8ToAmiga(const char* utf8);
char *titlestr = utf8ToAmiga(title.utf8().data());
if (titlestr && titlestr[0])
snprintf(viewWindow->title, sizeof(viewWindow->title), viewWindow->clickTabNode ? "%s" : "OWB: %s", titlestr);
else
strcpy(viewWindow->title, "Origyn Web Browser");
free(titlestr);
if (amigaConfig.tabs) {
IIntuition->SetGadgetAttrs(viewWindow->gad_clicktab, viewWindow->window, NULL,
CLICKTAB_Labels, ~0,
TAG_DONE);
IClickTab->SetClickTabNodeAttrs(viewWindow->clickTabNode, TNA_Text, viewWindow->title, TAG_DONE);
IIntuition->RefreshSetGadgetAttrs(viewWindow->gad_clicktab, viewWindow->window, NULL,
CLICKTAB_Labels, viewWindow->clickTabList,
TAG_DONE);
}
else
IIntuition->SetWindowTitles(viewWindow->window, viewWindow->title, (STRPTR)~0UL);
CString urlLatin1 = url.prettyURL().latin1();
const char *urlstr = urlLatin1.data();
if (urlstr && urlstr[0] && viewWindow->gad_url) {
snprintf(viewWindow->url, sizeof(viewWindow->url), "%s", urlstr);
if (ILayout->SetPageGadgetAttrs(viewWindow->gad_url, viewWindow->page,
viewWindow->window, NULL,
STRINGA_TextVal, viewWindow->url,
TAG_DONE))
ILayout->RefreshPageGadget(viewWindow->gad_url, viewWindow->page, viewWindow->window, NULL);
}
}
}
#endif
WebView* webView = m_webFrame->webView();
SharedPtr<WebHistoryDelegate> historyDelegate = webView->historyDelegate();
if (historyDelegate) {
historyDelegate->updateHistoryTitle(webView, title.utf8().data(), url.string().utf8().data());
return;
}
bool privateBrowsingEnabled = false;
WebPreferences* preferences = m_webFrame->webView()->preferences();
if (preferences)
privateBrowsingEnabled = preferences->privateBrowsingEnabled();
if (privateBrowsingEnabled)
return;
// update title in global history
WebHistory* history = webHistory();
if (!history)
return;
WebHistoryItem* item = history->itemForURL(strdup(url.string().utf8().data()));
if (!item)
return;
item->setTitle(title.utf8().data());
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:66,代码来源:WebFrameLoaderClient.cpp
示例14: QMenu
SiteInfoWidget::SiteInfoWidget(QupZilla* mainClass, QWidget* parent)
: QMenu(parent)
, ui(new Ui::SiteInfoWidget)
, p_QupZilla(mainClass)
{
this->setAttribute(Qt::WA_DeleteOnClose);
ui->setupUi(this);
WebView* view = p_QupZilla->weView();
WebPage* webPage = qobject_cast<WebPage*>(view->page());
QUrl url = view->url();
if (webPage->sslCertificate().isValid()) {
ui->secureLabel->setText(tr("Your connection to this site is <b>secured</b>."));
ui->secureIcon->setPixmap(QPixmap(":/icons/locationbar/accept.png"));
}
else {
ui->secureLabel->setText(tr("Your connection to this site is <b>unsecured</b>."));
ui->secureIcon->setPixmap(QPixmap(":/icons/locationbar/warning.png"));
}
QString scheme = url.scheme();
QSqlQuery query;
QString host = url.host();
query.exec("SELECT sum(count) FROM history WHERE url LIKE '" + scheme + "://" + host + "%' ");
if (query.next()) {
int count = query.value(0).toInt();
if (count > 3) {
ui->historyLabel->setText(tr("This is your <b>%1</b> visit of this site.").arg(QString::number(count) + "."));
ui->historyIcon->setPixmap(QPixmap(":/icons/locationbar/accept.png"));
}
else if (count == 0) {
ui->historyLabel->setText(tr("You have <b>never</b> visited this site before."));
ui->historyIcon->setPixmap(QPixmap(":/icons/locationbar/warning.png"));
}
else {
ui->historyIcon->setPixmap(QPixmap(":/icons/locationbar/warning.png"));
QString text;
if (count == 1) {
text = tr("first");
}
else if (count == 2) {
text = tr("second");
}
else if (count == 3) {
text = tr("third");
}
ui->historyLabel->setText(tr("This is your <b>%1</b> visit of this site.").arg(text));
}
}
connect(ui->pushButton, SIGNAL(clicked()), p_QupZilla, SLOT(showPageInfo()));
#ifndef KDE
// Use light color for QLabels even with Ubuntu Ambiance theme
QPalette pal = palette();
pal.setColor(QPalette::WindowText, QToolTip::palette().color(QPalette::ToolTipText));
ui->historyLabel->setPalette(pal);
ui->secureLabel->setPalette(pal);
#endif
}
开发者ID:JHooverman,项目名称:QupZilla,代码行数:61,代码来源:siteinfowidget.cpp
示例15: WebView
WebView* WebView::create()
{
WebView* view = new WebView();
view->setContentSize(CCSizeMake(300, 400));
return (WebView*)(view->autorelease());
}
开发者ID:xiangry,项目名称:cocos2d-x-webview,代码行数:6,代码来源:WebView.cpp
示例16: switch
//.........这里部分代码省略.........
settings.setValue(QLatin1String("fixedFont"), m_fixedFont);
settings.setValue(QLatin1String("standardFont"), m_standardFont);
settings.setValue(QLatin1String("blockPopupWindows"), blockPopupWindows->isChecked());
settings.setValue(QLatin1String("enableJavascript"), enableJavascript->isChecked());
settings.setValue(QLatin1String("enablePlugins"), enablePlugins->isChecked());
settings.setValue(QLatin1String("enableImages"), enableImages->isChecked());
QString userStyleSheetString = userStyleSheet->text();
if (QFile::exists(userStyleSheetString))
settings.setValue(QLatin1String("userStyleSheet"), QUrl::fromLocalFile(userStyleSheetString));
else
settings.setValue(QLatin1String("userStyleSheet"), QUrl::fromEncoded(userStyleSheetString.toUtf8()));
settings.setValue(QLatin1String("enableClickToFlash"), clickToFlash->isChecked());
settings.endGroup();
// Privacy
settings.beginGroup(QLatin1String("cookies"));
CookieJar::AcceptPolicy acceptCookies;
switch (acceptCombo->currentIndex()) {
default:
case 0:
acceptCookies = CookieJar::AcceptAlways;
break;
case 1:
acceptCookies = CookieJar::AcceptNever;
break;
case 2:
acceptCookies = CookieJar::AcceptOnlyFromSitesNavigatedTo;
break;
}
CookieJar *jar = BrowserApplication::cookieJar();
QMetaEnum acceptPolicyEnum = jar->staticMetaObject.enumerator(jar->staticMetaObject.indexOfEnumerator("AcceptPolicy"));
settings.setValue(QLatin1String("acceptCookies"), QLatin1String(acceptPolicyEnum.valueToKey(acceptCookies)));
CookieJar::KeepPolicy keepPolicy;
switch (keepUntilCombo->currentIndex()) {
default:
case 0:
keepPolicy = CookieJar::KeepUntilExpire;
break;
case 1:
keepPolicy = CookieJar::KeepUntilExit;
break;
case 2:
keepPolicy = CookieJar::KeepUntilTimeLimit;
break;
}
QMetaEnum keepPolicyEnum = jar->staticMetaObject.enumerator(jar->staticMetaObject.indexOfEnumerator("KeepPolicy"));
settings.setValue(QLatin1String("keepCookiesUntil"), QLatin1String(keepPolicyEnum.valueToKey(keepPolicy)));
settings.setValue(QLatin1String("filterTrackingCookies"), filterTrackingCookiesCheckbox->isChecked());
settings.endGroup();
#if QT_VERSION >= 0x040500
// Network
settings.beginGroup(QLatin1String("network"));
settings.setValue(QLatin1String("cacheEnabled"), networkCache->isChecked());
settings.setValue(QLatin1String("maximumCacheSize"), networkCacheMaximumSizeSpinBox->value());
settings.endGroup();
#endif
// proxy
settings.beginGroup(QLatin1String("proxy"));
settings.setValue(QLatin1String("enabled"), proxySupport->isChecked());
settings.setValue(QLatin1String("type"), proxyType->currentIndex());
settings.setValue(QLatin1String("hostName"), proxyHostName->text());
settings.setValue(QLatin1String("port"), proxyPort->text());
settings.setValue(QLatin1String("userName"), proxyUserName->text());
settings.setValue(QLatin1String("password"), proxyPassword->text());
settings.endGroup();
// Tabs
settings.beginGroup(QLatin1String("tabs"));
settings.setValue(QLatin1String("selectNewTabs"), selectTabsWhenCreated->isChecked());
settings.setValue(QLatin1String("confirmClosingMultipleTabs"), confirmClosingMultipleTabs->isChecked());
#if QT_VERSION >= 0x040500
settings.setValue(QLatin1String("oneCloseButton"), oneCloseButton->isChecked());
#endif
settings.setValue(QLatin1String("quitAsLastTabClosed"), quitAsLastTabClosed->isChecked());
settings.setValue(QLatin1String("openTargetBlankLinksIn"), openTargetBlankLinksIn->currentIndex());
settings.setValue(QLatin1String("openLinksFromAppsIn"), openLinksFromAppsIn->currentIndex());
settings.endGroup();
BrowserApplication::instance()->loadSettings();
BrowserApplication::networkAccessManager()->loadSettings();
BrowserApplication::cookieJar()->loadSettings();
BrowserApplication::historyManager()->loadSettings();
if (BrowserMainWindow *mw = static_cast<BrowserMainWindow*>(parent())) {
WebView *webView = mw->currentTab();
if (webView) {
webView->webPage()->webPluginFactory()->refreshPlugins();
}
}
QList<BrowserMainWindow*> list = BrowserApplication::instance()->mainWindows();
foreach (BrowserMainWindow *mainWindow, list) {
mainWindow->tabWidget()->loadSettings();
}
}
开发者ID:eborges,项目名称:arora,代码行数:101,代码来源:settings.cpp
示例17: CustomControl
WebViewRecipe::WebViewRecipe(Container *parent) :
CustomControl(parent)
{
bool connectResult;
Q_UNUSED(connectResult);
// Get the UIConfig object in order to use resolution independent sizes.
UIConfig *ui = this->ui();
// The recipe Container
Container *recipeContainer = new Container();
recipeContainer->setLayout(new DockLayout());
WebView *webView = new WebView();
webView->setUrl(QUrl("https://github.com/blackberry/Cascades-Samples/blob/master/cascadescookbookqml/assets/Slider.qml"));
// We let the scroll view scroll in both x and y and enable zooming,
// max and min content zoom property is set in the WebViews onMinContentScaleChanged
// and onMaxContentScaleChanged signal handlers.
mScrollView = ScrollView::create().scrollMode(ScrollMode::Both).pinchToZoomEnabled(true);
mScrollView->setContent(webView);
// Connect to signals to manage the progress indicator.
connectResult = connect(webView, SIGNAL(loadingChanged(bb::cascades::WebLoadRequest *)), this,
SLOT(onLoadingChanged(bb::cascades::WebLoadRequest *)));
Q_ASSERT(connectResult);
connectResult = connect(webView, SIGNAL(loadProgressChanged(int)), this,
SLOT(onProgressChanged(int)));
Q_ASSERT(connectResult);
connectResult = connect(webView, SIGNAL(navigationRequested(bb::cascades::WebNavigationRequest *)), this,
SLOT(onNavigationRequested(bb::cascades::WebNavigationRequest *)));
Q_ASSERT(connectResult);
// Connect signals to manage the web contents suggested size.
connectResult = connect(webView, SIGNAL(maxContentScaleChanged(float)), this,
SLOT(onMaxContentScaleChanged(float)));
Q_ASSERT(connectResult);
connectResult = connect(webView, SIGNAL(minContentScaleChanged(float)), this,
SLOT(onMinContentScaleChanged(float)));
Q_ASSERT(connectResult);
// Connect signal to handle java script calls to navigator.cascades.postMessage()
connectResult = connect(webView, SIGNAL(messageReceived(const QVariantMap&)), this,
SLOT(onMessageReceived(const QVariantMap&)));
Q_ASSERT(connectResult);
WebSettings *settings = webView->settings();
QVariantMap settingsMap;
settingsMap["width"] = QString("device-width");
settingsMap["initial-scale"] = 1.0;
settings->setViewportArguments(settingsMap);
// A progress indicator that is used to show the loading status
Container *progressContainer = Container::create().bottom(ui->du(2));
progressContainer->setLayout(new DockLayout());
progressContainer->setVerticalAlignment(VerticalAlignment::Bottom);
progressContainer->setHorizontalAlignment(HorizontalAlignment::Center);
mLoadingIndicator = ProgressIndicator::create().opacity(0.0);
progressContainer->add(mLoadingIndicator);
// Add the controls and set the root Container of the Custom Control.
recipeContainer->add(mScrollView);
recipeContainer->add(progressContainer);
setRoot(recipeContainer);
}
开发者ID:13natty,项目名称:Cascades-Samples,代码行数:68,代码来源:webviewrecipe.cpp
示例18: resetWebSettings
void TestShell::resetWebSettings(WebView& webView)
{
// Match the settings used by Mac DumpRenderTree, with the exception of
// fonts.
WebSettings* settings = webView.settings();
#if OS(MAC_OS_X)
WebString serif = WebString::fromUTF8("Times");
settings->setCursiveFontFamily(WebString::fromUTF8("Apple Chancery"));
settings->setFantasyFontFamily(WebString::fromUTF8("Papyrus"));
#else
// NOTE: case matters here, this must be 'times new roman', else
// some layout tests fail.
WebString serif = WebString::fromUTF8("times new roman");
// These two fonts are picked from the intersection of
// Win XP font list and Vista font list :
// http://www.microsoft.com/typography/fonts/winxp.htm
// http://blogs.msdn.com/michkap/archive/2006/04/04/567881.aspx
// Some of them are installed only with CJK and complex script
// support enabled on Windows XP and are out of consideration here.
// (although we enabled both on our buildbots.)
// They (especially Impact for fantasy) are not typical cursive
// and fantasy fonts, but it should not matter for layout tests
// as long as they're available.
settings->setCursiveFontFamily(WebString::fromUTF8("Comic Sans MS"));
settings->setFantasyFontFamily(WebString::fromUTF8("Impact"));
#endif
settings->setSerifFontFamily(serif);
settings->setStandardFontFamily(serif);
settings->setFixedFontFamily(WebString::fromUTF8("Courier"));
settings->setSansSerifFontFamily(WebString::fromUTF8("Helvetica"));
settings->setDefaultTextEncodingName(WebString::fromUTF8("ISO-8859-1"));
settings->setDefaultFontSize(16);
settings->setDefaultFixedFontSize(13);
settings->setMinimumFontSize(1);
settings->setMinimumLogicalFontSize(9);
settings->setJavaScriptCanOpenWindowsAutomatically(true);
settings->setJavaScriptCanAccessClipboard(true);
settings->setDOMPasteAllowed(true);
settings->setDeveloperExtrasEnabled(false);
settings->setNeedsSiteSpecificQuirks(true);
settings->setShrinksStandaloneImagesToFit(false);
settings->setUsesEncodingDetector(false);
settings->setTextAreasAreResizable(false);
settings->setJavaEnabled(false);
settings->setAllowScriptsToCloseWindows(false);
settings->setXSSAuditorEnabled(false);
settings->setDownloadableBinaryFontsEnabled(true);
settings->setLocalStorageEnabled(true);
settings->setOfflineWebApplicationCacheEnabled(true);
settings->setAllowFileAccessFromFileURLs(true);
// LayoutTests were written with Safari Mac in mind which does not allow
// tabbing to links by default.
webView.setTabsToLinks(false);
// Allow those layout tests running as local files, i.e. under
// LayoutTests/http/tests/local, to access http server.
settings->setAllowUniversalAccessFromFileURLs(true);
settings->setJavaScriptEnabled(true);
settings->setPluginsEnabled(true);
settings->setWebSecurityEnabled(true);
settings->setEditableLinkBehaviorNeverLive();
settings->setFontRenderingModeNormal();
settings->setShouldPaintCustomScrollbars(true);
settings->setTextDirectionSubmenuInclusionBehaviorNeverIncluded();
settings->setLoadsImagesAutomatically(true);
settings->setImagesEnabled(true);
#if OS(DARWIN)
settings->setEditingBehavior(WebSettings::EditingBehaviorMac);
#else
settings->setEditingBehavior(WebSettings::EditingBehaviorWin);
#endif
}
开发者ID:,项目名称:,代码行数:78,代码来源:
示例19: getWebViewSize
static IntSize getWebViewSize(WebView& webView)
{
RECT r;
webView.frameRect(&r);
return IntSize(r.right - r.left, r.bottom - r.top);
}
开发者ID:clbr,项目名称:webkitfltk,代码行数:6,代码来源:AcceleratedCompositingContext.cpp
示例20: webViewSizeAllocate
static void webViewSizeAllocate(GtkWidget* widget, GtkAllocation* allocation)
{
WebView* webView = webViewWidgetGetWebViewInstance(WEB_VIEW_WIDGET(widget));
GTK_WIDGET_CLASS(webViewWidgetParentClass)->size_allocate(widget, allocation);
webView->setSize(widget, IntSize(allocation->width, allocation->height));
}
开发者ID:ACSOP,项目名称:android_external_webkit,代码行数:6,代码来源:WebViewWidget.cpp
注:本文中的WebView类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论