[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75
tonikitoo at webkit.org
tonikitoo at webkit.org
Thu Oct 29 20:50:00 UTC 2009
The following commit has been merged in the webkit-1.1 branch:
commit 11f284b31eb42004b1b0a8ba7fbe8f9fabe88703
Author: tonikitoo at webkit.org <tonikitoo at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Oct 22 16:34:38 2009 +0000
Add a Y-Axis rotation to QGVLauncher.
Patch by Antonio Gomes <tonikitoo at webkit.org> on 2009-10-22
Reviewed by Tor Arne Vestbø.
It uses the QStateMachine API from Qt 4.6.
* QGVLauncher/main.cpp:
(WebView::WebView):
(WebView::setYRotation):
(WebView::yRotation):
(MainView::flip):
(MainView::animatedYFlip):
(SharedScene::SharedScene):
(SharedScene::webView):
(MainWindow::init):
(MainWindow::animatedYFlip):
(MainWindow::buildUI):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49942 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog
index ea03cbd..c238d76 100644
--- a/WebKit/qt/ChangeLog
+++ b/WebKit/qt/ChangeLog
@@ -1,3 +1,23 @@
+2009-10-22 Antonio Gomes <tonikitoo at webkit.org>
+
+ Reviewed by Tor Arne Vestbø.
+
+ Add a Y-Axis rotation to QGVLauncher.
+
+ It uses the QStateMachine API from Qt 4.6.
+
+ * QGVLauncher/main.cpp:
+ (WebView::WebView):
+ (WebView::setYRotation):
+ (WebView::yRotation):
+ (MainView::flip):
+ (MainView::animatedYFlip):
+ (SharedScene::SharedScene):
+ (SharedScene::webView):
+ (MainWindow::init):
+ (MainWindow::animatedYFlip):
+ (MainWindow::buildUI):
+
2009-10-20 Kenneth Rohde Christiansen <kenneth at webkit.org>
Reviewed By Adam Barth.
diff --git a/WebKit/qt/QGVLauncher/main.cpp b/WebKit/qt/QGVLauncher/main.cpp
index c31e301..f1300c0 100644
--- a/WebKit/qt/QGVLauncher/main.cpp
+++ b/WebKit/qt/QGVLauncher/main.cpp
@@ -50,6 +50,35 @@
#include <qwebsettings.h>
#include <qwebview.h>
+class WebView : public QGraphicsWebView {
+ Q_OBJECT
+ Q_PROPERTY(qreal yRotation READ yRotation WRITE setYRotation)
+
+public:
+ WebView(QGraphicsItem* parent = 0)
+ : QGraphicsWebView(parent)
+ {
+ }
+ void setYRotation(qreal angle)
+ {
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+ QRectF r = boundingRect();
+ 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;
+ }
+
+private:
+ qreal m_yRotation;
+};
+
class WebPage : public QWebPage {
Q_OBJECT
@@ -100,7 +129,8 @@ public:
m_mainWidget->unsetCursor();
}
- void flip()
+public slots:
+ void flip()
{
#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
QSizeF center = m_mainWidget->boundingRect().size() / 2;
@@ -125,6 +155,15 @@ public:
animation->start(QAbstractAnimation::DeleteWhenStopped);
#endif
}
+
+ void animatedYFlip()
+ {
+ emit flipRequest();
+ }
+
+signals:
+ void flipRequest();
+
private:
QGraphicsWidget* m_mainWidget;
};
@@ -134,7 +173,7 @@ public:
SharedScene()
{
m_scene = new QGraphicsScene;
- m_item = new QGraphicsWebView;
+ m_item = new WebView;
m_item->setPage((m_page = new WebPage));
m_scene->addItem(m_item);
@@ -149,15 +188,14 @@ public:
}
QGraphicsScene* scene() const { return m_scene; }
- QGraphicsWebView* webView() const { return m_item; }
+ WebView* webView() const { return m_item; }
private:
QGraphicsScene* m_scene;
- QGraphicsWebView* m_item;
+ WebView* m_item;
WebPage* m_page;
};
-
class MainWindow : public QMainWindow {
Q_OBJECT
@@ -189,6 +227,30 @@ public:
connect(scene->webView(), SIGNAL(titleChanged(const QString&)), this, SLOT(setWindowTitle(const QString&)));
connect(scene->webView()->page(), SIGNAL(windowCloseRequested()), this, SLOT(close()));
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+ QStateMachine *machine = new QStateMachine(this);
+ QState *s0 = new QState(machine);
+ s0->assignProperty(scene->webView(), "yRotation", 0);
+
+ QState *s1 = new QState(machine);
+ s1->assignProperty(scene->webView(), "yRotation", 90);
+
+ QAbstractTransition *t1 = s0->addTransition(view, SIGNAL(flipRequest()), s1);
+ QPropertyAnimation *yRotationAnim = new QPropertyAnimation(scene->webView(), "yRotation", this);
+ yRotationAnim->setDuration(1000);
+ t1->addAnimation(yRotationAnim);
+
+ QState *s2 = new QState(machine);
+ s2->assignProperty(scene->webView(), "yRotation", -90);
+ s1->addTransition(s1, SIGNAL(polished()), s2);
+
+ QAbstractTransition *t2 = s2->addTransition(s0);
+ t2->addAnimation(yRotationAnim);
+
+ machine->setInitialState(s0);
+ machine->start();
+#endif
+
resize(640, 480);
buildUI();
}
@@ -274,6 +336,12 @@ public slots:
{
view->animatedFlip();
}
+
+ void animatedYFlip()
+ {
+ view->animatedYFlip();
+ }
+
private:
void buildUI()
{
@@ -304,7 +372,8 @@ private:
QMenu* fxMenu = menuBar()->addMenu("&Effects");
fxMenu->addAction("Flip", this, SLOT(flip()));
- fxMenu->addAction("Animated Flip", this, SLOT(animatedFlip()));
+ fxMenu->addAction("Animated Flip", this, SLOT(animatedFlip()), QKeySequence("Ctrl+R"));
+ fxMenu->addAction("Animated Y-Flip", this, SLOT(animatedYFlip()), QKeySequence("Ctrl+Y"));
}
private:
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list