Changeset 55498 in webkit
- Timestamp:
- Mar 3, 2010 7:13:57 PM (14 years ago)
- Location:
- trunk/WebKitTools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKitTools/ChangeLog
r55489 r55498 1 2010-03-03 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> 2 3 Reviewed by Simon Hausmann. 4 5 Add a missing 'm_' to class variables names. 6 7 [Qt] QtLauncher is not respecting class variable names 8 https://bugs.webkit.org/show_bug.cgi?id=35542 9 10 * QtLauncher/main.cpp: 11 (LauncherWindow::LauncherWindow): 12 (LauncherWindow::init): 13 (LauncherWindow::sendTouchEvent): 14 (LauncherWindow::eventFilter): 15 (LauncherWindow::zoomIn): 16 (LauncherWindow::zoomOut): 17 (LauncherWindow::resetZoom): 18 (LauncherWindow::setEditable): 19 (LauncherWindow::setTouchMocking): 20 (LauncherWindow::initializeView): 21 (LauncherWindow::createChrome): 22 1 23 2010-03-03 Alexey Proskuryakov <ap@apple.com> 2 24 -
trunk/WebKitTools/QtLauncher/main.cpp
r55460 r55498 128 128 129 129 private: 130 QVector<int> zoomLevels;131 int currentZoom;130 QVector<int> m_zoomLevels; 131 int m_currentZoom; 132 132 133 133 QWidget* m_view; 134 WebInspector* inspector;135 136 QAction* formatMenuAction;137 QAction* flipAnimated;138 QAction* flipYAnimated;134 WebInspector* m_inspector; 135 136 QAction* m_formatMenuAction; 137 QAction* m_flipAnimated; 138 QAction* m_flipYAnimated; 139 139 140 140 #if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) 141 QList<QTouchEvent::TouchPoint> touchPoints;142 bool touchMocking;141 QList<QTouchEvent::TouchPoint> m_touchPoints; 142 bool m_touchMocking; 143 143 #endif 144 144 … … 150 150 LauncherWindow::LauncherWindow(LauncherWindow* other, bool shareScene) 151 151 : MainWindow() 152 , currentZoom(100)152 , m_currentZoom(100) 153 153 , m_view(0) 154 , inspector(0)155 , formatMenuAction(0)156 , flipAnimated(0)157 , flipYAnimated(0)154 , m_inspector(0) 155 , m_formatMenuAction(0) 156 , m_flipAnimated(0) 157 , m_flipYAnimated(0) 158 158 { 159 159 if (other) { … … 198 198 page()->settings()->setInspectorUrl(gInspectorUrl); 199 199 200 inspector = new WebInspector(splitter);201 inspector->setPage(page());202 inspector->hide();203 connect(this, SIGNAL(destroyed()), inspector, SLOT(deleteLater()));200 m_inspector = new WebInspector(splitter); 201 m_inspector->setPage(page()); 202 m_inspector->hide(); 203 connect(this, SIGNAL(destroyed()), m_inspector, SLOT(deleteLater())); 204 204 205 205 // the zoom values are chosen to be like in Mozilla Firefox 3 206 zoomLevels << 30 << 50 << 67 << 80 << 90;207 zoomLevels << 100;208 zoomLevels << 110 << 120 << 133 << 150 << 170 << 200 << 240 << 300;206 m_zoomLevels << 30 << 50 << 67 << 80 << 90; 207 m_zoomLevels << 100; 208 m_zoomLevels << 110 << 120 << 133 << 150 << 170 << 200 << 240 << 300; 209 209 210 210 grabZoomKeys(true); … … 283 283 void LauncherWindow::sendTouchEvent() 284 284 { 285 if ( touchPoints.isEmpty())285 if (m_touchPoints.isEmpty()) 286 286 return; 287 287 288 288 QEvent::Type type = QEvent::TouchUpdate; 289 if ( touchPoints.size() == 1) {290 if ( touchPoints[0].state() == Qt::TouchPointReleased)289 if (m_touchPoints.size() == 1) { 290 if (m_touchPoints[0].state() == Qt::TouchPointReleased) 291 291 type = QEvent::TouchEnd; 292 else if ( touchPoints[0].state() == Qt::TouchPointPressed)292 else if (m_touchPoints[0].state() == Qt::TouchPointPressed) 293 293 type = QEvent::TouchBegin; 294 294 } 295 295 296 296 QTouchEvent touchEv(type); 297 touchEv.setTouchPoints( touchPoints);297 touchEv.setTouchPoints(m_touchPoints); 298 298 QCoreApplication::sendEvent(page(), &touchEv); 299 299 300 300 // After sending the event, remove all touchpoints that were released 301 if ( touchPoints[0].state() == Qt::TouchPointReleased)302 touchPoints.removeAt(0);303 if ( touchPoints.size() > 1 &&touchPoints[1].state() == Qt::TouchPointReleased)304 touchPoints.removeAt(1);301 if (m_touchPoints[0].state() == Qt::TouchPointReleased) 302 m_touchPoints.removeAt(0); 303 if (m_touchPoints.size() > 1 && m_touchPoints[1].state() == Qt::TouchPointReleased) 304 m_touchPoints.removeAt(1); 305 305 } 306 306 307 307 bool LauncherWindow::eventFilter(QObject* obj, QEvent* event) 308 308 { 309 if (! touchMocking || obj != m_view)309 if (!m_touchMocking || obj != m_view) 310 310 return QObject::eventFilter(obj, event); 311 311 … … 334 334 335 335 // If the point already exists, update it. Otherwise create it. 336 if ( touchPoints.size() > 0 && !touchPoints[0].id())337 touchPoints[0] = touchPoint;338 else if ( touchPoints.size() > 1 && !touchPoints[1].id())339 touchPoints[1] = touchPoint;336 if (m_touchPoints.size() > 0 && !m_touchPoints[0].id()) 337 m_touchPoints[0] = touchPoint; 338 else if (m_touchPoints.size() > 1 && !m_touchPoints[1].id()) 339 m_touchPoints[1] = touchPoint; 340 340 else 341 touchPoints.append(touchPoint);341 m_touchPoints.append(touchPoint); 342 342 343 343 sendTouchEvent(); … … 347 347 348 348 // If the keyboard point is already pressed, release it. 349 // Otherwise create it and append to touchPoints.350 if ( touchPoints.size() > 0 &&touchPoints[0].id() == 1) {351 touchPoints[0].setState(Qt::TouchPointReleased);349 // Otherwise create it and append to m_touchPoints. 350 if (m_touchPoints.size() > 0 && m_touchPoints[0].id() == 1) { 351 m_touchPoints[0].setState(Qt::TouchPointReleased); 352 352 sendTouchEvent(); 353 } else if ( touchPoints.size() > 1 &&touchPoints[1].id() == 1) {354 touchPoints[1].setState(Qt::TouchPointReleased);353 } else if (m_touchPoints.size() > 1 && m_touchPoints[1].id() == 1) { 354 m_touchPoints[1].setState(Qt::TouchPointReleased); 355 355 sendTouchEvent(); 356 356 } else { … … 361 361 touchPoint.setPos(m_view->mapFromGlobal(QCursor::pos())); 362 362 touchPoint.setPressure(1); 363 touchPoints.append(touchPoint);363 m_touchPoints.append(touchPoint); 364 364 sendTouchEvent(); 365 365 366 366 // After sending the event, change the touchpoint state to stationary 367 touchPoints.last().setState(Qt::TouchPointStationary);367 m_touchPoints.last().setState(Qt::TouchPointStationary); 368 368 } 369 369 } … … 397 397 void LauncherWindow::zoomIn() 398 398 { 399 int i = zoomLevels.indexOf(currentZoom);399 int i = m_zoomLevels.indexOf(m_currentZoom); 400 400 Q_ASSERT(i >= 0); 401 if (i < zoomLevels.count() - 1)402 currentZoom =zoomLevels[i + 1];403 404 page()->mainFrame()->setZoomFactor(qreal( currentZoom) / 100.0);401 if (i < m_zoomLevels.count() - 1) 402 m_currentZoom = m_zoomLevels[i + 1]; 403 404 page()->mainFrame()->setZoomFactor(qreal(m_currentZoom) / 100.0); 405 405 } 406 406 407 407 void LauncherWindow::zoomOut() 408 408 { 409 int i = zoomLevels.indexOf(currentZoom);409 int i = m_zoomLevels.indexOf(m_currentZoom); 410 410 Q_ASSERT(i >= 0); 411 411 if (i > 0) 412 currentZoom =zoomLevels[i - 1];413 414 page()->mainFrame()->setZoomFactor(qreal( currentZoom) / 100.0);412 m_currentZoom = m_zoomLevels[i - 1]; 413 414 page()->mainFrame()->setZoomFactor(qreal(m_currentZoom) / 100.0); 415 415 } 416 416 417 417 void LauncherWindow::resetZoom() 418 418 { 419 currentZoom = 100;419 m_currentZoom = 100; 420 420 page()->mainFrame()->setZoomFactor(1.0); 421 421 } … … 455 455 { 456 456 page()->setContentEditable(on); 457 formatMenuAction->setVisible(on);457 m_formatMenuAction->setVisible(on); 458 458 } 459 459 … … 494 494 { 495 495 #if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) 496 touchMocking = on;496 m_touchMocking = on; 497 497 #endif 498 498 } … … 522 522 view->setPage(page()); 523 523 524 if ( flipAnimated)525 connect( flipAnimated, SIGNAL(triggered()), view, SLOT(animatedFlip()));526 527 if ( flipYAnimated)528 connect( flipYAnimated, SIGNAL(triggered()), view, SLOT(animatedYFlip()));524 if (m_flipAnimated) 525 connect(m_flipAnimated, SIGNAL(triggered()), view, SLOT(animatedFlip())); 526 527 if (m_flipYAnimated) 528 connect(m_flipYAnimated, SIGNAL(triggered()), view, SLOT(animatedYFlip())); 529 529 530 530 m_view = view; … … 533 533 #if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) 534 534 m_view->installEventFilter(this); 535 touchMocking = false;535 m_touchMocking = false; 536 536 #endif 537 537 } … … 587 587 588 588 QMenu* formatMenu = new QMenu("F&ormat", this); 589 formatMenuAction = menuBar()->addMenu(formatMenu);590 formatMenuAction->setVisible(false);589 m_formatMenuAction = menuBar()->addMenu(formatMenu); 590 m_formatMenuAction->setVisible(false); 591 591 formatMenu->addAction(page()->action(QWebPage::ToggleBold)); 592 592 formatMenu->addAction(page()->action(QWebPage::ToggleItalic)); … … 603 603 QMenu* toolsMenu = menuBar()->addMenu("&Develop"); 604 604 toolsMenu->addAction("Select Elements...", this, SLOT(selectElements())); 605 QAction* showInspectorAction = toolsMenu->addAction("Show Web Inspector", inspector, SLOT(setVisible(bool)), QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_I));605 QAction* showInspectorAction = toolsMenu->addAction("Show Web Inspector", m_inspector, SLOT(setVisible(bool)), QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_I)); 606 606 showInspectorAction->setCheckable(true); 607 showInspectorAction->connect( inspector, SIGNAL(visibleChanged(bool)), SLOT(setChecked(bool)));607 showInspectorAction->connect(m_inspector, SIGNAL(visibleChanged(bool)), SLOT(setChecked(bool))); 608 608 609 609 #if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) … … 632 632 graphicsViewMenu->addSeparator(); 633 633 634 flipAnimated = graphicsViewMenu->addAction("Animated Flip");635 flipAnimated->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool)));636 flipAnimated->setEnabled(isGraphicsBased());637 638 flipYAnimated = graphicsViewMenu->addAction("Animated Y-Flip");639 flipYAnimated->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool)));640 flipYAnimated->setEnabled(isGraphicsBased());634 m_flipAnimated = graphicsViewMenu->addAction("Animated Flip"); 635 m_flipAnimated->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); 636 m_flipAnimated->setEnabled(isGraphicsBased()); 637 638 m_flipYAnimated = graphicsViewMenu->addAction("Animated Y-Flip"); 639 m_flipYAnimated->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); 640 m_flipYAnimated->setEnabled(isGraphicsBased()); 641 641 642 642 if (isGraphicsBased()) { 643 643 WebViewGraphicsBased* view = static_cast<WebViewGraphicsBased*>(m_view); 644 connect( flipAnimated, SIGNAL(triggered()), view, SLOT(animatedFlip()));645 connect( flipYAnimated, SIGNAL(triggered()), view, SLOT(animatedYFlip()));644 connect(m_flipAnimated, SIGNAL(triggered()), view, SLOT(animatedFlip())); 645 connect(m_flipYAnimated, SIGNAL(triggered()), view, SLOT(animatedYFlip())); 646 646 } 647 647
Note: See TracChangeset
for help on using the changeset viewer.