diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-10-14 07:33:44 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-10-14 07:33:44 (GMT) |
commit | c0fd373d61c0ed7e9528203d658a5b55dcd1e618 (patch) | |
tree | 9d5a42dc612b2855cabe1293fa4aa3d22d1eae0e /examples/webkit/imageanalyzer/mainwindow.cpp | |
parent | 235d1d687dcc2d21860cd753c9d67964c5270be2 (diff) | |
parent | bb1b5345d7e81a0ee0695a2de0605b3ce3aef868 (diff) | |
download | Qt-c0fd373d61c0ed7e9528203d658a5b55dcd1e618.zip Qt-c0fd373d61c0ed7e9528203d658a5b55dcd1e618.tar.gz Qt-c0fd373d61c0ed7e9528203d658a5b55dcd1e618.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1: (51 commits)
Revert "qmake: pass include directories to MS resource compiler"
Fix User 46 Panic in bearer management on Symbian.
Assistant: Insert all keywords with empty ids, as ids are not mendatory.
qmake: delete .pdb file when making 'distclean' instead of 'clean'
qmake: pass include directories to MS resource compiler
use specified pkg-config
qmake/symbian: Add icons with backslashes in pkg files
Make qtconfig help messages translatable
remove exec bits again ...
Add TIFFClose to QTIffHandler::option() to avoid memory leak
[QCocoaView scrollWheel:] can end up recursing infinitely when a scrollWheel event is sent to two stacked MDI windows
Added missing QtWebKit example files and some whitespace fixes.
Added missing native separator transforms.
Doc: tuning search reasult box
qdoc: Don't generate html output for png files.
Doc: Correcting Windows CE 6.0 to Windows Embedded CE 6.0
Doc: correcting bug - lenght() pointed to setLength() in "See also" section. Correct link is resize()
Doc: correct spelling
Doc: correcting spelling - qdbusxml2dcpp to qdbusxml2cpp
Doc: correcting grammar on the installation pages
...
Diffstat (limited to 'examples/webkit/imageanalyzer/mainwindow.cpp')
-rw-r--r-- | examples/webkit/imageanalyzer/mainwindow.cpp | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/examples/webkit/imageanalyzer/mainwindow.cpp b/examples/webkit/imageanalyzer/mainwindow.cpp new file mode 100644 index 0000000..d89098e --- /dev/null +++ b/examples/webkit/imageanalyzer/mainwindow.cpp @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "mainwindow.h" +#include "imageanalyzer.h" + +#include <QWebFrame> +#include <QWebElementCollection> +#include <QNetworkDiskCache> + +/* + * Default Constructor + */ +//! [MainWindow - constructor] +MainWin::MainWin(QWidget * parent) : QWebView(parent) +{ + m_network = new QNetworkAccessManager(this); + m_cache = new QNetworkDiskCache(this); + m_cache->setCacheDirectory(QDesktopServices::storageLocation(QDesktopServices::CacheLocation) + "/imageanalyzer"); + m_cache->setMaximumCacheSize(1000000); //set the cache to 10megs + m_network->setCache(m_cache); + page()->setNetworkAccessManager(m_network); + + //! The object we will expose to JavaScript engine: + m_analyzer = new ImageAnalyzer(m_cache, this); + + // Signal is emitted before frame loads any web content: + QObject::connect(page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), + this, SLOT(addJSObject())); + + // qrc:// URLs refer to resources. See imagenalayzer.qrc + QUrl startURL = QUrl("qrc:/index.html"); + + // Load web content now! + setUrl(startURL); +} +//! [MainWindow - constructor] + +//! [MainWindow - addJSObject] +void MainWin::addJSObject() { + // Add pAnalyzer to JavaScript Frame as member "imageAnalyzer". + page()->mainFrame()->addToJavaScriptWindowObject(QString("imageAnalyzer"), m_analyzer); +} +//! [MainWindow - addJSObject] |