ginebra2/ContentViews/GWebContentView.cpp
changeset 10 232fbd5a2dcb
parent 6 1c3b8676e58c
child 15 73c48011b8c7
equal deleted inserted replaced
6:1c3b8676e58c 10:232fbd5a2dcb
   243         }
   243         }
   244     }
   244     }
   245 }
   245 }
   246 
   246 
   247 #endif
   247 #endif
       
   248 
       
   249 
       
   250 bool GWebContentView::gesturesEnabled() const 
       
   251 { 
       
   252 #ifndef BEDROCK_TILED_BACKING_STORE
       
   253     return m_touchNavigation->enabled(); 
       
   254 #else	
       
   255     return m_widget->gesturesEnabled();
       
   256 #endif
       
   257 }
       
   258 
       
   259 void GWebContentView::setGesturesEnabled(bool value) 
       
   260 { 
       
   261 #ifndef BEDROCK_TILED_BACKING_STORE		  
       
   262     m_touchNavigation->setEnabled(value); 
       
   263 #else
       
   264     m_widget->setGesturesEnabled(value);
       
   265 #endif
       
   266 }
       
   267 
   248   void GWebContentView::connectAll() {
   268   void GWebContentView::connectAll() {
   249     //qDebug() << "GWebContentView::connectAll: " << widget();
   269     //qDebug() << "GWebContentView::connectAll: " << widget();
   250 
   270 
   251 #ifndef __gva_no_chrome__
   271 #ifndef __gva_no_chrome__
   252 #ifndef BEDROCK_TILED_BACKING_STORE
   272 #ifndef BEDROCK_TILED_BACKING_STORE
   265 
   285 
   266     safe_connect(m_widget
   286     safe_connect(m_widget
   267                  , SIGNAL(viewScrolled(QPoint&, QPoint&))
   287                  , SIGNAL(viewScrolled(QPoint&, QPoint&))
   268                  , this
   288                  , this
   269                  , SLOT(handleViewScrolled(QPoint&, QPoint&)));
   289                  , SLOT(handleViewScrolled(QPoint&, QPoint&)));
       
   290 
       
   291     safe_connect(m_widget
       
   292                  , SIGNAL(mouseEvent(QEvent::Type)) 
       
   293                  , this
       
   294                  , SIGNAL(contentViewMouseEvent(QEvent::Type)));
       
   295 
       
   296     
   270 #endif
   297 #endif
   271     QObject::connect(webWidget(), SIGNAL(titleChanged(const QString &)), m_jsObject, SIGNAL(titleChanged(const QString &)));
   298     QObject::connect(webWidget(), SIGNAL(titleChanged(const QString &)), m_jsObject, SIGNAL(titleChanged(const QString &)));
   272     QObject::connect(webWidget(), SIGNAL(loadStarted()), m_jsObject, SIGNAL(loadStarted()));
   299     QObject::connect(webWidget(), SIGNAL(loadStarted()), m_jsObject, SIGNAL(loadStarted()));
   273     QObject::connect(webWidget(), SIGNAL(loadProgress(int)), m_jsObject, SIGNAL(loadProgress(int)));
   300     QObject::connect(webWidget(), SIGNAL(loadProgress(int)), m_jsObject, SIGNAL(loadProgress(int)));
   274     QObject::connect(webWidget(), SIGNAL(loadProgress(int)), this, SIGNAL(loadProgress(int)));
   301     QObject::connect(webWidget(), SIGNAL(loadProgress(int)), this, SIGNAL(loadProgress(int)));
   280     QObject::connect(this, SIGNAL(urlChanged(const QString&)), m_jsObject, SIGNAL(urlChanged(const QString&)));
   307     QObject::connect(this, SIGNAL(urlChanged(const QString&)), m_jsObject, SIGNAL(urlChanged(const QString&)));
   281     QObject::connect(this, SIGNAL(backEnabled(bool)), m_jsObject, SIGNAL(backEnabled(bool)));
   308     QObject::connect(this, SIGNAL(backEnabled(bool)), m_jsObject, SIGNAL(backEnabled(bool)));
   282     QObject::connect(this, SIGNAL(forwardEnabled(bool)), m_jsObject, SIGNAL(forwardEnabled(bool)));
   309     QObject::connect(this, SIGNAL(forwardEnabled(bool)), m_jsObject, SIGNAL(forwardEnabled(bool)));
   283     QObject::connect(this, SIGNAL(loadFinished(bool)), m_jsObject, SIGNAL(loadFinished(bool)));
   310     QObject::connect(this, SIGNAL(loadFinished(bool)), m_jsObject, SIGNAL(loadFinished(bool)));
   284     QObject::connect(this, SIGNAL(secureConnection(bool)), m_jsObject, SIGNAL(secureConnection(bool)));
   311     QObject::connect(this, SIGNAL(secureConnection(bool)), m_jsObject, SIGNAL(secureConnection(bool)));
       
   312 
   285 #ifndef BEDROCK_TILED_BACKING_STORE
   313 #ifndef BEDROCK_TILED_BACKING_STORE
   286     connect(m_touchNavigation, SIGNAL(startingPanGesture(int)), m_jsObject, SIGNAL(startingPanGesture(int)));
   314     connect(m_touchNavigation, SIGNAL(startingPanGesture(int)), m_jsObject, SIGNAL(startingPanGesture(int)));
   287 #endif
   315 #else
   288 	QObject::connect(this, SIGNAL(superPageShown(const QString&)), m_jsObject, SIGNAL(superPageShown(const QString&)));    
   316     connect(this, SIGNAL(startingPanGesture(int)), m_jsObject, SIGNAL(startingPanGesture(int)));
   289      
   317 #endif
       
   318 
       
   319 	QObject::connect(this, SIGNAL(superPageShown(const QString&)), m_jsObject, SIGNAL(superPageShown(const QString&)));         
   290 #endif
   320 #endif
   291     connect(WebPageController::getSingleton(), SIGNAL(pageCreated(WRT::WrtBrowserContainer*)),
   321     connect(WebPageController::getSingleton(), SIGNAL(pageCreated(WRT::WrtBrowserContainer*)),
   292             this, SLOT(pageCreated(WRT::WrtBrowserContainer*)));
   322             this, SLOT(pageCreated(WRT::WrtBrowserContainer*)));
   293     connect(WebPageController::getSingleton(), SIGNAL(pageChanged(WRT::WrtBrowserContainer*, WRT::WrtBrowserContainer*)),
   323     connect(WebPageController::getSingleton(), SIGNAL(pageChanged(WRT::WrtBrowserContainer*, WRT::WrtBrowserContainer*)),
   294             this, SLOT(pageChanged(WRT::WrtBrowserContainer*, WRT::WrtBrowserContainer*)));
   324             this, SLOT(pageChanged(WRT::WrtBrowserContainer*, WRT::WrtBrowserContainer*)));
   760       }
   790       }
   761   }
   791   }
   762 
   792 
   763   void GWebContentView::showNormalPage() {
   793   void GWebContentView::showNormalPage() {
   764     if (webWidget()) {
   794     if (webWidget()) {
   765 #ifndef BEDROCK_TILED_BACKING_STORE
       
   766       webWidget()->showNormalPage();
       
   767       webWidget()->setViewportSize();
       
   768       m_touchNavigation->setPage(currentPage());
       
   769       m_touchNavigation->setWantSlideViewCalls(true);
       
   770 #else
       
   771         m_widget->showPage(false);
       
   772 #endif
       
   773       //TODO: Further testing is needed to show if the following is a net benefit.
   795       //TODO: Further testing is needed to show if the following is a net benefit.
   774       if (currentPageIsSuperPage()) {
   796       if (currentPageIsSuperPage()) {
   775           if(currentSuperPage()->page() == m_sharedPage){
   797           if(currentSuperPage()->page() == m_sharedPage){
   776               //Clear contents of shared page to free resources. This should save
   798               //Clear contents of shared page to free resources. This should save
   777               //memory for big pages, but at the performance cost of loading an empty page.
   799               //memory for big pages, but at the performance cost of loading an empty page.
   781           }
   803           }
   782 
   804 
   783           currentSuperPage()->onHidden();
   805           currentSuperPage()->onHidden();
   784           m_currentPageIsSuperPage =false;
   806           m_currentPageIsSuperPage =false;
   785       }
   807       }
       
   808 #ifndef BEDROCK_TILED_BACKING_STORE
       
   809     webWidget()->showNormalPage();
       
   810     webWidget()->setViewportSize();
       
   811     m_touchNavigation->setPage(currentPage());
       
   812     m_touchNavigation->setWantSlideViewCalls(true);
       
   813 #else
       
   814     m_widget->showPage(false);
       
   815 #endif
   786     }
   816     }
   787   }
   817   }
   788 
   818 
   789   QObjectList GWebContentView::getSuperPages() {
   819   QObjectList GWebContentView::getSuperPages() {
   790     QObjectList *result = new QObjectList;
   820     QObjectList *result = new QObjectList;
   938           emit contextEvent(&context);
   968           emit contextEvent(&context);
   939       }
   969       }
   940   }
   970   }
   941 void GWebContentView::handleViewScrolled(QPoint& scrollPos, QPoint& delta)
   971 void GWebContentView::handleViewScrolled(QPoint& scrollPos, QPoint& delta)
   942 {
   972 {
   943     if (delta.manhattanLength() && scrollPos.y() <= 5 && !currentPageIsSuperPage())
   973     if (delta.manhattanLength() && (delta.y() > 0  || scrollPos.y() + delta.y() <= 40) 
       
   974         && !currentPageIsSuperPage())
   944         m_chrome->layout()->slideView(-delta.y());
   975         m_chrome->layout()->slideView(-delta.y());
       
   976     
       
   977     emit startingPanGesture(1);
   945 }
   978 }
   946 
   979 
   947 #endif
   980 #endif
   948   void GWebContentView::changeContentViewZoomInfo(WRT::WrtBrowserContainer* newPage){
   981   void GWebContentView::changeContentViewZoomInfo(WRT::WrtBrowserContainer* newPage){
   949      // Copy the new page zoom info into cv
   982      // Copy the new page zoom info into cv