Changeset 55951 in webkit
- Timestamp:
- Mar 13, 2010 12:14:24 AM (14 years ago)
- Location:
- trunk/WebKitTools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKitTools/ChangeLog
r55940 r55951 1 2010-03-13 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> 2 3 Reviewed by Kenneth Rohde Christiansen. 4 5 Add a "Toggle FullScreen" option to QtLauncher Menu. 6 7 [Qt] QtLauncher needs an option to toggle FullScreen Mode 8 https://bugs.webkit.org/show_bug.cgi?id=35755 9 10 * QtLauncher/main.cpp: 11 (LauncherWindow::init): 12 (LauncherWindow::eventFilter): 13 (LauncherWindow::initializeView): 14 (LauncherWindow::toggleFullScreenMode): 15 (LauncherWindow::createChrome): 16 1 17 2010-03-12 Dirk Pranke <dpranke@chromium.org> 2 18 -
trunk/WebKitTools/QtLauncher/main.cpp
r55610 r55951 71 71 #endif 72 72 73 73 static const int gExitClickArea = 80; 74 74 static bool gUseGraphicsView = false; 75 75 static bool gUseCompositing = false; … … 91 91 #if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) 92 92 void sendTouchEvent(); 93 #endif 94 93 95 bool eventFilter(QObject* obj, QEvent* event); 94 #endif95 96 96 97 protected slots: … … 120 121 void initializeView(bool useGraphicsView = false); 121 122 void toggleSpatialNavigation(bool b); 123 void toggleFullScreenMode(bool enable); 122 124 123 125 public slots: 124 126 void newWindow(); 125 127 void cloneWindow(); 128 129 signals: 130 void enteredFullScreenMode(bool on); 126 131 127 132 private: … … 184 189 185 190 #if defined(Q_WS_S60) 186 s howMaximized();191 setWindowState(Qt::WindowMaximized); 187 192 #else 193 setWindowState(Qt::WindowNoState); 188 194 resize(800, 600); 189 195 #endif … … 195 201 connect(page(), SIGNAL(linkHovered(const QString&, const QString&, const QString&)), 196 202 this, SLOT(showLinkHover(const QString&, const QString&))); 203 connect(this, SIGNAL(enteredFullScreenMode(bool)), this, SLOT(toggleFullScreenMode(bool))); 197 204 198 205 if (!gInspectorUrl.isEmpty()) … … 305 312 m_touchPoints.removeAt(1); 306 313 } 314 #endif // QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) 307 315 308 316 bool LauncherWindow::eventFilter(QObject* obj, QEvent* event) 309 317 { 318 // If click pos is the bottom right corner (square with size defined by gExitClickArea) 319 // and the window is on FullScreen, the window must return to its original state. 320 if (event->type() == QEvent::MouseButtonRelease) { 321 QMouseEvent* ev = static_cast<QMouseEvent*>(event); 322 if (windowState() == Qt::WindowFullScreen 323 && ev->pos().x() > (width() - gExitClickArea) 324 && ev->pos().y() > (height() - gExitClickArea)) { 325 326 emit enteredFullScreenMode(false); 327 } 328 } 329 330 #if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) 310 331 if (!m_touchMocking || obj != m_view) 311 332 return QObject::eventFilter(obj, event); … … 369 390 } 370 391 } 392 #endif // QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) 393 371 394 return false; 372 395 } 373 #endif // QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)374 396 375 397 void LauncherWindow::loadStarted() … … 518 540 WebViewTraditional* view = new WebViewTraditional(splitter); 519 541 view->setPage(page()); 542 543 view->installEventFilter(this); 544 520 545 m_view = view; 521 546 } else { … … 529 554 connect(m_flipYAnimated, SIGNAL(triggered()), view, SLOT(animatedYFlip())); 530 555 556 // The implementation of QAbstractScrollArea::eventFilter makes us need 557 // to install the event filter on the viewport of a QGraphicsView. 558 view->viewport()->installEventFilter(this); 559 531 560 m_view = view; 532 561 } 533 562 534 563 #if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) 535 m_view->installEventFilter(this);536 564 m_touchMocking = false; 537 565 #endif … … 541 569 { 542 570 page()->settings()->setAttribute(QWebSettings::SpatialNavigationEnabled, b); 571 } 572 573 void LauncherWindow::toggleFullScreenMode(bool enable) 574 { 575 if (enable) 576 setWindowState(Qt::WindowFullScreen); 577 else { 578 #if defined(Q_WS_S60) 579 setWindowState(Qt::WindowMaximized); 580 #else 581 setWindowState(Qt::WindowNoState); 582 #endif 583 } 543 584 } 544 585 … … 607 648 resetZoom->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_0)); 608 649 650 QMenu* windowMenu = menuBar()->addMenu("&Window"); 651 QAction* toggleFullScreen = windowMenu->addAction("Toggle FullScreen", this, SIGNAL(enteredFullScreenMode(bool))); 652 toggleFullScreen->setCheckable(true); 653 toggleFullScreen->setChecked(false); 654 655 // when exit fullscreen mode by clicking on the exit area (bottom right corner) we must 656 // uncheck the Toggle FullScreen action 657 toggleFullScreen->connect(this, SIGNAL(enteredFullScreenMode(bool)), SLOT(setChecked(bool))); 658 609 659 QMenu* toolsMenu = menuBar()->addMenu("&Develop"); 610 660 toolsMenu->addAction("Select Elements...", this, SLOT(selectElements()));
Note: See TracChangeset
for help on using the changeset viewer.