telutils/dialpad/src/dialpad.cpp
changeset 33 8d5d7fcf9b59
parent 32 1f002146abb4
child 42 35488577e233
equal deleted inserted replaced
32:1f002146abb4 33:8d5d7fcf9b59
    25 #include <hbstyleloader.h>
    25 #include <hbstyleloader.h>
    26 #include <hblineedit.h>
    26 #include <hblineedit.h>
    27 #include <hbapplication.h>
    27 #include <hbapplication.h>
    28 #include <hbswipegesture.h>
    28 #include <hbswipegesture.h>
    29 #include <hbeffect.h>
    29 #include <hbeffect.h>
       
    30 #include <hbevent.h>
    30 
    31 
    31 #include "dialpad.h"
    32 #include "dialpad.h"
    32 #include "dialpadinputfield.h"
    33 #include "dialpadinputfield.h"
    33 #include "dialpadkeypad.h"
    34 #include "dialpadkeypad.h"
    34 #include "dialpadbutton.h"
    35 #include "dialpadbutton.h"
    43 static const int DialpadCloseAnimDuration = 200; // ms
    44 static const int DialpadCloseAnimDuration = 200; // ms
    44 static const int DialpadOpenAnimDuration = 200; // ms
    45 static const int DialpadOpenAnimDuration = 200; // ms
    45 static const qreal DialpadComponentMargin = 0.75; // units
    46 static const qreal DialpadComponentMargin = 0.75; // units
    46 static const qreal DialpadCloseHandleHeight = 2.23; // units
    47 static const qreal DialpadCloseHandleHeight = 2.23; // units
    47 static const qreal DialpadCloseHandleWidth = 18.8; // units
    48 static const qreal DialpadCloseHandleWidth = 18.8; // units
    48 static const qreal DialpadCallButtonHeight = 8.0; // units
    49 static const qreal DialpadCallButtonHeight = 8.75; // units, same as numeric buttons
    49 static const qreal DialpadCallButtonHeightH = 6.0; // units
    50 static const qreal DialpadCallButtonHeightH = 7.25; // units
    50 
    51 
    51 static const QLatin1String handsetIcon("qtg_mono_call");
    52 static const QLatin1String handsetIcon("qtg_mono_call");
    52 static const QLatin1String vmbxIcon("qtg_mono_voice_mailbox");
    53 static const QLatin1String vmbxIcon("qtg_mono_voice_mailbox");
    53 
    54 
    54 const QLatin1String DIALPAD_TO_PRT_FXML(":/dialpad_to_prt.fxml");
    55 const QLatin1String DIALPAD_TO_PRT_FXML(":/dialpad_to_prt.fxml");
   111         new QGraphicsLinearLayout(Qt::Vertical);
   112         new QGraphicsLinearLayout(Qt::Vertical);
   112     popupLayout->addItem(mInputField);
   113     popupLayout->addItem(mInputField);
   113     popupLayout->addItem(mKeypad);
   114     popupLayout->addItem(mKeypad);
   114     popupLayout->addItem(&mKeypad->callButton());
   115     popupLayout->addItem(&mKeypad->callButton());
   115     popupLayout->setContentsMargins(margin, mCloseHandleHeight, margin, margin);
   116     popupLayout->setContentsMargins(margin, mCloseHandleHeight, margin, margin);
   116     popupLayout->setSpacing(margin);
   117     popupLayout->setSpacing(0);
       
   118     popupLayout->setItemSpacing(0,margin);
   117     setLayout(popupLayout);
   119     setLayout(popupLayout);
   118 
   120 
   119     // asterisk multitap handler
   121     // asterisk multitap handler
   120     mMultitap = new DialpadMultitapHandler(mInputField->editor(),this);
   122     mMultitap = new DialpadMultitapHandler(mInputField->editor(),this);
   121     mInputField->editor().installEventFilter(mMultitap);
   123     mInputField->editor().installEventFilter(mMultitap);
   210         }
   212         }
   211     }
   213     }
   212 
   214 
   213     mIconDrawer->setFrameType(HbFrameDrawer::OnePiece);
   215     mIconDrawer->setFrameType(HbFrameDrawer::OnePiece);
   214     mIconDrawer->paint(painter, rect);
   216     mIconDrawer->paint(painter, rect);
       
   217 }
       
   218 
       
   219 void Dialpad::changeEvent(QEvent *event)
       
   220 {
       
   221     if (event->type() == QEvent::LayoutDirectionChange) {
       
   222         mBackgroundDrawer->setLayoutDirection(layoutDirection());
       
   223     } else if (event->type() == HbEvent::ThemeChanged) {
       
   224         mBackgroundDrawer->themeChanged();
       
   225         mIconDrawer->themeChanged();
       
   226     }
   215 }
   227 }
   216 
   228 
   217 bool Dialpad::isOpen() const
   229 bool Dialpad::isOpen() const
   218 {
   230 {
   219     return mIsOpen;
   231     return mIsOpen;