ginebra2/ContentViews/GWebContentViewWidget.cpp
changeset 15 73c48011b8c7
parent 10 232fbd5a2dcb
equal deleted inserted replaced
13:491a1d15372f 15:73c48011b8c7
    57 const int KMinViewportHeight = 200;
    57 const int KMinViewportHeight = 200;
    58 const int KMaxViewportHeight = 10000;
    58 const int KMaxViewportHeight = 10000;
    59 const int KMaxPageZoom = 10;
    59 const int KMaxPageZoom = 10;
    60 const qreal KDefaultMinScale = 0.25;
    60 const qreal KDefaultMinScale = 0.25;
    61 const qreal KDefaultMaxScale = 10.00;
    61 const qreal KDefaultMaxScale = 10.00;
       
    62 const qreal KInitialZoomFactorValue = 0.653061;
    62 const QPoint KFocussPoint(5, 50);
    63 const QPoint KFocussPoint(5, 50);
    63 const int checkerSize = 16;
    64 const int checkerSize = 16;
    64 const unsigned checkerColor1 = 0xff555555;
    65 const unsigned checkerColor1 = 0xff555555;
    65 const unsigned checkerColor2 = 0xffaaaaaa;
    66 const unsigned checkerColor2 = 0xffaaaaaa;
    66 
    67 
   338   if ( m_dirtyZoomFactor != zoom ) {
   339   if ( m_dirtyZoomFactor != zoom ) {
   339       m_dirtyZoomFactor = zoom;
   340       m_dirtyZoomFactor = zoom;
   340       #if QT_VERSION < 0x040600
   341       #if QT_VERSION < 0x040600
   341 		  page()->setFixedContentsSize(QSize(m_viewportWidth, m_viewportHeight/zoom));
   342 		  page()->setFixedContentsSize(QSize(m_viewportWidth, m_viewportHeight/zoom));
   342 	  #else
   343 	  #else
   343 	  	  page()->setPreferredContentsSize(QSize((int)m_viewportWidth, (int)m_viewportHeight/zoom));
   344           if(!m_webContentView->currentPageIsSuperPage()) 
       
   345             page()->setPreferredContentsSize(QSize((int)m_viewportWidth, (int)m_viewportHeight/zoom));
   344 	  #endif
   346 	  #endif
   345   }
   347   }
   346 
   348 
   347   QGraphicsWebView::setZoomFactor( zoom );
   349   QGraphicsWebView::setZoomFactor( zoom );
   348 
   350 
   652     ZoomMetaData data;
   654     ZoomMetaData data;
   653 
   655 
   654     data.maxScale = KDefaultMaxScale;
   656     data.maxScale = KDefaultMaxScale;
   655     data.minScale =  KDefaultMinScale;
   657     data.minScale =  KDefaultMinScale;
   656     data.userScalable = false;
   658     data.userScalable = false;
       
   659     data.zoomValue = KInitialZoomFactorValue;
   657 
   660 
   658     return data;
   661     return data;
   659 }
   662 }
   660 
   663 
   661 /*!
   664 /*!
   703 		page()->setFixedContentsSize(QSize(m_viewportWidth, m_viewportHeight));
   706 		page()->setFixedContentsSize(QSize(m_viewportWidth, m_viewportHeight));
   704 	#else
   707 	#else
   705 		page()->setPreferredContentsSize(QSize((int)m_viewportWidth, (int)m_viewportHeight));
   708 		page()->setPreferredContentsSize(QSize((int)m_viewportWidth, (int)m_viewportHeight));
   706 	#endif
   709 	#endif
   707 #endif //NO_RESIZE_ON_LOAD
   710 #endif //NO_RESIZE_ON_LOAD
       
   711    if((m_webContentView->currentPageIsSuperPage())){
       
   712         page()->setPreferredContentsSize(QSize((int)m_viewportWidth, (int)m_viewportHeight));
       
   713    }
   708 #ifndef NO_RESIZE_ON_LOAD
   714 #ifndef NO_RESIZE_ON_LOAD
   709   qreal zoomF = 0.0;
   715   qreal zoomF = 0.0;
   710   QString str;
   716   QString str;
   711   if (m_isResize &&  (m_currentinitialScale != zoomFactor())) {
   717   if (m_isResize &&  (m_currentinitialScale != zoomFactor())) {
   712     zoomF = ((qreal)(page()->viewportSize().width()-10) * zoomFactor())/(m_previousViewPortwidth-10);
   718     zoomF = ((qreal)(page()->viewportSize().width()-10) * zoomFactor())/(m_previousViewPortwidth-10);
   840     ZoomMetaData data;
   846     ZoomMetaData data;
   841 
   847 
   842     data.minScale = m_minimumScale;
   848     data.minScale = m_minimumScale;
   843     data.maxScale = m_maximumScale;
   849     data.maxScale = m_maximumScale;
   844     data.userScalable = m_userScalable;
   850     data.userScalable = m_userScalable;
       
   851     data.zoomValue = view()->getSavedZoomValueInView();
   845 
   852 
   846     return data;
   853     return data;
   847 }
   854 }
   848 
   855 
   849 void GWebContentViewWidget::setPageZoomMetaData(ZoomMetaData data) {
   856 void GWebContentViewWidget::setPageZoomMetaData(ZoomMetaData data) {
   850 
   857 
   851     m_minimumScale = data.minScale ;
   858     m_minimumScale = data.minScale ;
   852     m_maximumScale = data.maxScale ;
   859     m_maximumScale = data.maxScale ;
   853     m_userScalable = data.userScalable;
   860     m_userScalable = data.userScalable;
       
   861     view()->setSavedZoomValueInView(data.zoomValue);
   854 }
   862 }
   855 
   863 
   856 QWebPage* GWebContentViewWidget::page() const
   864 QWebPage* GWebContentViewWidget::page() const
   857 {
   865 {
   858     if (!m_wrtPage) {
   866     if (!m_wrtPage) {