[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.21-584-g1e41756

eric at webkit.org eric at webkit.org
Fri Feb 26 22:25:49 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit 4c75b5219be61195389d7b5246077dc646aadd60
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Feb 19 19:47:00 2010 +0000

    2010-02-19  Jesus Sanchez-Palencia  <jesus.palencia at openbossa.org>
    
            Reviewed by Kenneth Rohde Christiansen.
    
            [Qt] Need a final integration between QtLauncher and QGVLauncher
            https://bugs.webkit.org/show_bug.cgi?id=35161
    
            Add animated flip support to QtLauncher when running on QGraphicsView mode.
    
            * QtLauncher/main.cpp:
            (LauncherWindow::initializeView):
            (LauncherWindow::setupUI):
            * QtLauncher/webview.cpp:
            (WebViewGraphicsBased::WebViewGraphicsBased):
            (WebViewGraphicsBased::animatedFlip):
            (WebViewGraphicsBased::animatedYFlip):
            * QtLauncher/webview.h:
            (WebViewGraphicsBased::setYRotation):
            (WebViewGraphicsBased::yRotation):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55025 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 70d8bad..6a4b7b3 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,23 @@
+2010-02-19  Jesus Sanchez-Palencia  <jesus.palencia at openbossa.org>
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        [Qt] Need a final integration between QtLauncher and QGVLauncher
+        https://bugs.webkit.org/show_bug.cgi?id=35161
+
+        Add animated flip support to QtLauncher when running on QGraphicsView mode.
+
+        * QtLauncher/main.cpp:
+        (LauncherWindow::initializeView):
+        (LauncherWindow::setupUI):
+        * QtLauncher/webview.cpp:
+        (WebViewGraphicsBased::WebViewGraphicsBased):
+        (WebViewGraphicsBased::animatedFlip):
+        (WebViewGraphicsBased::animatedYFlip):
+        * QtLauncher/webview.h:
+        (WebViewGraphicsBased::setYRotation):
+        (WebViewGraphicsBased::yRotation):
+
 2010-02-19  Andras Becsi  <abecsi at webkit.org>
 
         Reviewed by Kenneth Rohde Christiansen.
diff --git a/WebKitTools/QtLauncher/main.cpp b/WebKitTools/QtLauncher/main.cpp
index c725c2f..1203ce7 100644
--- a/WebKitTools/QtLauncher/main.cpp
+++ b/WebKitTools/QtLauncher/main.cpp
@@ -133,6 +133,8 @@ private:
     WebInspector* inspector;
 
     QAction* formatMenuAction;
+    QAction* flipAnimated;
+    QAction* flipYAnimated;
 
 #if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
     QList<QTouchEvent::TouchPoint> touchPoints;
@@ -461,6 +463,13 @@ void LauncherWindow::initializeView(bool useGraphicsView)
         if (gShowFrameRate)
             view->enableFrameRateMeasurement();
         page()->settings()->setAttribute(QWebSettings::AcceleratedCompositingEnabled, gUseCompositing);
+
+        if (flipAnimated)
+            connect(flipAnimated, SIGNAL(triggered()), view, SLOT(animatedFlip()));
+
+        if (flipYAnimated)
+            connect(flipYAnimated, SIGNAL(triggered()), view, SLOT(animatedYFlip()));
+
         m_view = view;
     }
 
@@ -540,13 +549,26 @@ void LauncherWindow::setupUI()
     touchMockAction->setShortcut(QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_T));
 #endif
 
-    QAction* toggleAcceleratedCompositing = toolsMenu->addAction("Toggle Accelerated Compositing", this, SLOT(toggleAcceleratedCompositing(bool)));
+    QMenu* graphicsViewMenu = toolsMenu->addMenu("QGraphicsView");
+    QAction* toggleGraphicsView = graphicsViewMenu->addAction("Toggle use of QGraphicsView", this, SLOT(initializeView(bool)));
+    toggleGraphicsView->setCheckable(true);
+    toggleGraphicsView->setChecked(false);
+
+    QAction* toggleAcceleratedCompositing = graphicsViewMenu->addAction("Toggle Accelerated Compositing", this, SLOT(toggleAcceleratedCompositing(bool)));
     toggleAcceleratedCompositing->setCheckable(true);
     toggleAcceleratedCompositing->setChecked(false);
+    toggleAcceleratedCompositing->setEnabled(false);
+    toggleAcceleratedCompositing->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool)));
 
-    QAction* toggleGraphicsView = toolsMenu->addAction("Toggle use of QGraphicsView", this, SLOT(initializeView(bool)));
-    toggleGraphicsView->setCheckable(true);
-    toggleGraphicsView->setChecked(false);
+    graphicsViewMenu->addSeparator();
+
+    flipAnimated = graphicsViewMenu->addAction("Animated Flip");
+    flipAnimated->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool)));
+    flipAnimated->setEnabled(false);
+
+    flipYAnimated = graphicsViewMenu->addAction("Animated Y-Flip");
+    flipYAnimated->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool)));
+    flipYAnimated->setEnabled(false);
 }
 
 QWebPage* WebPage::createWindow(QWebPage::WebWindowType type)
diff --git a/WebKitTools/QtLauncher/webview.cpp b/WebKitTools/QtLauncher/webview.cpp
index 443fc3e..311d79b 100644
--- a/WebKitTools/QtLauncher/webview.cpp
+++ b/WebKitTools/QtLauncher/webview.cpp
@@ -48,6 +48,29 @@ WebViewGraphicsBased::WebViewGraphicsBased(QWidget* parent)
     setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
     setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
 
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+    QStateMachine* machine = new QStateMachine(this);
+    QState* s0 = new QState(machine);
+    s0->assignProperty(this, "yRotation", 0);
+
+    QState* s1 = new QState(machine);
+    s1->assignProperty(this, "yRotation", 90);
+
+    QAbstractTransition* t1 = s0->addTransition(this, SIGNAL(yFlipRequest()), s1);
+    QPropertyAnimation* yRotationAnim = new QPropertyAnimation(this, "yRotation", this);
+    yRotationAnim->setDuration(1000);
+    t1->addAnimation(yRotationAnim);
+
+    QState* s2 = new QState(machine);
+    s2->assignProperty(this, "yRotation", -90);
+    s1->addTransition(s1, SIGNAL(propertiesAssigned()), s2);
+
+    QAbstractTransition* t2 = s2->addTransition(s0);
+    t2->addAnimation(yRotationAnim);
+
+    machine->setInitialState(s0);
+    machine->start();
+#endif
 }
 
 void WebViewGraphicsBased::resizeEvent(QResizeEvent* event)
@@ -83,6 +106,30 @@ void WebViewGraphicsBased::updateFrameRate()
     m_numPaintsSinceLastMeasure = 0;
 }
 
+void WebViewGraphicsBased::animatedFlip()
+{
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+    QSizeF center = m_item->boundingRect().size() / 2;
+    QPointF centerPoint = QPointF(center.width(), center.height());
+    m_item->setTransformOriginPoint(centerPoint);
+
+    QPropertyAnimation* animation = new QPropertyAnimation(m_item, "rotation", this);
+    animation->setDuration(1000);
+
+    int rotation = int(m_item->rotation());
+
+    animation->setStartValue(rotation);
+    animation->setEndValue(rotation + 180 - (rotation % 180));
+
+    animation->start(QAbstractAnimation::DeleteWhenStopped);
+#endif
+}
+
+void WebViewGraphicsBased::animatedYFlip()
+{
+    emit yFlipRequest();
+}
+
 void WebViewGraphicsBased::paintEvent(QPaintEvent* event)
 {
     QGraphicsView::paintEvent(event);
diff --git a/WebKitTools/QtLauncher/webview.h b/WebKitTools/QtLauncher/webview.h
index 83bd801..297d975 100644
--- a/WebKitTools/QtLauncher/webview.h
+++ b/WebKitTools/QtLauncher/webview.h
@@ -66,6 +66,7 @@ protected:
 
 class WebViewGraphicsBased : public QGraphicsView {
     Q_OBJECT
+    Q_PROPERTY(qreal yRotation READ yRotation WRITE setYRotation)
 
 public:
     WebViewGraphicsBased(QWidget* parent);
@@ -76,8 +77,29 @@ public:
     void enableFrameRateMeasurement();
     virtual void paintEvent(QPaintEvent* event);
 
+    void setYRotation(qreal angle)
+    {
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+        QRectF r = m_item->boundingRect();
+        m_item->setTransform(QTransform()
+            .translate(r.width() / 2, r.height() / 2)
+            .rotate(angle, Qt::YAxis)
+            .translate(-r.width() / 2, -r.height() / 2));
+#endif
+        m_yRotation = angle;
+    }
+    qreal yRotation() const
+    {
+        return m_yRotation;
+    }
+
 public slots:
     void updateFrameRate();
+    void animatedFlip();
+    void animatedYFlip();
+
+signals:
+    void yFlipRequest();
 
 private:
     GraphicsWebView* m_item;
@@ -86,6 +108,7 @@ private:
     QTime m_startTime;
     QTime m_lastConsultTime;
     bool m_measureFps;
+    qreal m_yRotation;
 };
 
 #endif

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list