ginebra2/ContentViews/GWebContentViewWidget.h
changeset 5 0f2326c2a325
parent 0 1450b09d0cfd
child 6 1c3b8676e58c
equal deleted inserted replaced
1:b0dd75e285d2 5:0f2326c2a325
     1 /*
     1 /*
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
     4 *
     9 * Initial Contributors:
     5 * This program is free software: you can redistribute it and/or modify
    10 * Nokia Corporation - initial contribution.
     6 * it under the terms of the GNU Lesser General Public License as published by
       
     7 * the Free Software Foundation, version 2.1 of the License.
    11 *
     8 *
    12 * Contributors:
     9 * This program is distributed in the hope that it will be useful,
       
    10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    12 * GNU Lesser General Public License for more details.
    13 *
    13 *
    14 * Description: 
    14 * You should have received a copy of the GNU Lesser General Public License
       
    15 * along with this program.  If not,
       
    16 * see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
    15 *
    17 *
       
    18 * Description:
    16 */
    19 */
    17 
       
    18 
    20 
    19 
    21 
    20 #ifndef GWebContentViewWidget_H_
    22 #ifndef GWebContentViewWidget_H_
    21 #define GWebContentViewWidget_H_
    23 #define GWebContentViewWidget_H_
    22 
    24 
    84     QWebPage* page() const;
    86     QWebPage* page() const;
    85     void setPage(QWebPage* pg);
    87     void setPage(QWebPage* pg);
    86     QWebPage* wrtPage() { return m_wrtPage; }
    88     QWebPage* wrtPage() { return m_wrtPage; }
    87     void showNormalPage();
    89     void showNormalPage();
    88 
    90 
    89     void createPagePixmap();
       
    90     void setBitmapZoom(qreal zoom);
    91     void setBitmapZoom(qreal zoom);
    91     void deletePagePixmap();
       
    92     void setPageCenterZoomFactor(qreal zoom);
    92     void setPageCenterZoomFactor(qreal zoom);
    93 
    93 
    94     void initializeViewportParams();
    94     void initializeViewportParams();
    95     void parseViewPortParam(const QString &propertyName, const QString &propertyValue);
    95     void parseViewPortParam(const QString &propertyName, const QString &propertyValue);
    96     bool isUserScalable();
    96     bool isUserScalable();
    97     qreal minimumScale();
    97     qreal minimumScale();
    98     qreal maximumScale();
    98     qreal maximumScale();
    99     qreal initialScale();
    99     qreal initialScale();
   100     void updateViewport();
   100     void updateViewport();
   101     void setBlockElement(QWebElement pt);
   101     void setBlockElement(const QWebElement &pt);
   102     QPointF mapToGlobal(const QPointF& p);
   102     QPointF mapToGlobal(const QPointF& p);
   103     QPointF mapFromGlobal(const QPointF& p);
   103     QPointF mapFromGlobal(const QPointF& p);
   104 
   104 
   105     void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0) ;
   105     void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0) ;
   106     void setPageZoomFactor(qreal zoom);
   106     void setPageZoomFactor(qreal zoom);
   119     void BlockFocusChanged(QPoint element);
   119     void BlockFocusChanged(QPoint element);
   120 
   120 
   121     void pageZoomMetaDataChange(QWebFrame* frame, ZoomMetaData data);protected:
   121     void pageZoomMetaDataChange(QWebFrame* frame, ZoomMetaData data);protected:
   122     void paintEvent(QPaintEvent *event);
   122     void paintEvent(QPaintEvent *event);
   123 
   123 
   124     virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
       
   125 
       
   126 public:
   124 public:
   127     void onLoadStarted();
   125     void onLoadStarted();
   128     void onLoadFinished();
   126     void onLoadFinished();
   129 
   127 
       
   128     bool frozen() const { return m_frozenCount > 0; }
       
   129     void freeze();
       
   130     void unfreeze();
       
   131 
   130 private:
   132 private:
   131     void updateViewportSize(QGraphicsSceneResizeEvent *e);
   133     void updateViewportSize(QGraphicsSceneResizeEvent *e);
       
   134     virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
       
   135     void updateFrozenImage();
   132 
   136 
   133     GVA::GWebContentView* m_webContentView;
   137     GVA::GWebContentView* m_webContentView;
   134     qreal       m_dirtyZoomFactor;
   138     qreal       m_dirtyZoomFactor;
   135     QPixmap    *m_frozenPixmap;
   139     QPixmap     *m_frozenPixmap;
   136     int         m_freezeCount;
   140     int         m_frozenCount;
   137     QWebPage   *m_wrtPage;
   141     QWebPage   *m_wrtPage;
   138     bool        m_bitmapZoom;
   142     bool        m_bitmapZoom;
   139     QPixmap    *m_pagePixmap;
       
   140     qreal       m_aspectRation;
   143     qreal       m_aspectRation;
   141     qreal       m_viewportWidth;
   144     qreal       m_viewportWidth;
   142     qreal       m_viewportHeight;
   145     qreal       m_viewportHeight;
   143     bool        m_userScalable;
   146     bool        m_userScalable;
   144     qreal       m_minimumScale;
   147     qreal       m_minimumScale;
   150     QWebElement m_BlockElement;
   153     QWebElement m_BlockElement;
   151     QWebElement m_BlockInFocus;
   154     QWebElement m_BlockInFocus;
   152     int         m_previousViewPortwidth;
   155     int         m_previousViewPortwidth;
   153     qreal       m_Ratiox;
   156     qreal       m_Ratiox;
   154     qreal       m_Ratioy;
   157     qreal       m_Ratioy;
   155     
   158 
   156     
   159 
   157     QImage*     m_bitmapImage;
   160     QImage*     m_bitmapImage;
   158     qreal       m_bitmapZoomFactor;
   161     qreal       m_bitmapZoomFactor;
   159     QPixmap*    m_checkeredBoxPixmap;
   162     QPixmap*    m_checkeredBoxPixmap;
   160     
   163 
   161     bool        m_inLoading;
   164     bool        m_inLoading;
   162     QTime       m_loadingTime;
   165     QTime       m_loadingTime;
   163 #ifndef NO_QSTM_GESTURE
   166 #ifndef NO_QSTM_GESTURE
   164     WebTouchNavigation* m_touchNavigation;
   167     WebTouchNavigation* m_touchNavigation;
   165 #endif
   168 #endif