diff options
author | Adriano Rezende <adriano.rezende@openbossa.org> | 2009-10-29 22:20:36 -0300 |
---|---|---|
committer | Adriano Rezende <adriano.rezende@openbossa.org> | 2009-10-29 22:37:01 -0300 |
commit | e949f009e717f556c923be2b3378ab028cb6f4ed (patch) | |
tree | 7f8c53dbb1ebf831f731aa11757e97c26b265fdd /hyperui | |
parent | c95329ef791f589570991a5bead175af1e46c1ed (diff) |
HyperUI: Added black overlay in the phone view
Diffstat (limited to 'hyperui')
-rw-r--r-- | hyperui/phoneview.cpp | 46 | ||||
-rw-r--r-- | hyperui/phoneview.h | 2 | ||||
-rw-r--r-- | hyperui/resource/640x360/hyperui.ini | 1 | ||||
-rw-r--r-- | hyperui/resource/800x480/hyperui.ini | 1 |
4 files changed, 50 insertions, 0 deletions
diff --git a/hyperui/phoneview.cpp b/hyperui/phoneview.cpp index d0e0c9c..50927e6 100644 --- a/hyperui/phoneview.cpp +++ b/hyperui/phoneview.cpp @@ -45,6 +45,22 @@ #include "dialerwidget.h" +class Overlay : public QObject, + public QGraphicsRectItem +{ + Q_OBJECT + Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity) + Q_PROPERTY(bool visible READ isVisible WRITE setVisible) + +public: + Overlay(QGraphicsItem *parent = 0) + : QGraphicsRectItem(parent) {} + +protected: + void mousePressEvent(QGraphicsSceneMouseEvent *) { } +}; + + class CallBoard : public QGraphicsWidget { Q_OBJECT @@ -329,6 +345,10 @@ PhoneView::PhoneView(QGraphicsItem *parent) m_contactsButton->setParentItem(this); m_contactsButton->setPos(contactsButtonPos); + m_overlay = new Overlay(this); + m_overlay->setBrush(Qt::black); + m_overlay->setRect(Resource::value("phone-view/overlay-rect").toRect()); + m_callButton = new Button(Resource::pixmap("dialer_bt_call.png"), Resource::pixmap("dialer_bt_call_over.png")); m_callButton->setText(tr("CALL")); @@ -396,6 +416,8 @@ void PhoneView::createStateMachine() state1->assignProperty(m_endCallButton, "visible", false); state1->assignProperty(m_board->contents, "opacity", 0.0); state1->assignProperty(m_board, "geometry", m_board->geometry()); + state1->assignProperty(m_overlay, "opacity", 0.0); + state1->assignProperty(m_overlay, "visible", false); // create calling state QState *state2 = new QState(); @@ -413,6 +435,8 @@ void PhoneView::createStateMachine() state2->assignProperty(m_board->panelInCall, "opacity", 0.0); state2->assignProperty(m_board->panelWait, "visible", true); state2->assignProperty(m_board->panelInCall, "visible", false); + state2->assignProperty(m_overlay, "opacity", 0.5); + state2->assignProperty(m_overlay, "visible", true); // create in-call state QState *state3 = new QState(); @@ -420,6 +444,8 @@ void PhoneView::createStateMachine() state3->assignProperty(m_board->panelInCall, "opacity", 1.0); state3->assignProperty(m_board->panelWait, "visible", false); state3->assignProperty(m_board->panelInCall, "visible", true); + state3->assignProperty(m_overlay, "opacity", 0.5); + state3->assignProperty(m_overlay, "visible", true); // associates state1-state2 transition QSignalTransition *transition1 = @@ -470,6 +496,10 @@ QAbstractAnimation *PhoneView::createCallAnimation() animation->setDuration(200); result->addAnimation(animation); + animation = new QPropertyAnimation(m_overlay, "opacity"); + animation->setDuration(200); + result->addAnimation(animation); + return result; } @@ -482,6 +512,10 @@ QAbstractAnimation *PhoneView::createInCallAnimation() QSequentialAnimationGroup *result = new QSequentialAnimationGroup(); + animation = new QPropertyAnimation(m_overlay, "opacity"); + animation->setDuration(200); + result->addAnimation(animation); + animation = new QPropertyAnimation(m_board->panelWait, "opacity"); animation->setDuration(300); result->addAnimation(animation); @@ -494,6 +528,10 @@ QAbstractAnimation *PhoneView::createInCallAnimation() animation->setDuration(300); result->addAnimation(animation); + animation = new QPropertyAnimation(m_overlay, "visible"); + animation->setDuration(0); + result->addAnimation(animation); + return result; } @@ -506,6 +544,10 @@ QAbstractAnimation *PhoneView::createEndCallAnimation() QSequentialAnimationGroup *result = new QSequentialAnimationGroup(); + animation = new QPropertyAnimation(m_overlay, "opacity"); + animation->setDuration(200); + result->addAnimation(animation); + animation = new QPropertyAnimation(m_board->contents, "opacity"); animation->setDuration(200); result->addAnimation(animation); @@ -526,6 +568,10 @@ QAbstractAnimation *PhoneView::createEndCallAnimation() animation->setDuration(0); result->addAnimation(animation); + animation = new QPropertyAnimation(m_overlay, "visible"); + animation->setDuration(0); + result->addAnimation(animation); + return result; } diff --git a/hyperui/phoneview.h b/hyperui/phoneview.h index c8352d5..7d2b6fe 100644 --- a/hyperui/phoneview.h +++ b/hyperui/phoneview.h @@ -38,6 +38,7 @@ #include "view.h" class Label; +class Overlay; class CallBoard; class DialerWidget; class DialerDisplay; @@ -67,6 +68,7 @@ private slots: private: QTimer m_callTimer; Label *m_label; + Overlay *m_overlay; Button *m_callButton; Button *m_endCallButton; Button *m_contactsButton; diff --git a/hyperui/resource/640x360/hyperui.ini b/hyperui/resource/640x360/hyperui.ini index 5434efe..f8a26a3 100644 --- a/hyperui/resource/640x360/hyperui.ini +++ b/hyperui/resource/640x360/hyperui.ini @@ -61,6 +61,7 @@ spacing=6 [phone-view] display-pos=@Point(9 10) +overlay-rect=@Rect(0 -90 360 640) call-timeout=2000 display-font-size=38 display-cancel-pos=@Point(281 23) diff --git a/hyperui/resource/800x480/hyperui.ini b/hyperui/resource/800x480/hyperui.ini index 4865368..dac33e7 100644 --- a/hyperui/resource/800x480/hyperui.ini +++ b/hyperui/resource/800x480/hyperui.ini @@ -61,6 +61,7 @@ spacing=6 [phone-view] display-pos=@Point(10 0) +overlay-rect=@Rect(0 -110 480 800) call-timeout=2000 display-font-size=50 display-cancel-pos=@Point(375 30) |