phoneapp/phoneuiview2/inc/phoneuiqtview.h
branchRCL_3
changeset 61 41a7f70b3818
equal deleted inserted replaced
58:40a3f856b14d 61:41a7f70b3818
       
     1 /*!
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Phone UI's Qt view.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef PHONEUIQTVIEW_H
       
    19 #define PHONEUIQTVIEW_H
       
    20 
       
    21 #include <QObject>
       
    22 #include <hbview.h>
       
    23 #include "phoneuiqtviewif.h"
       
    24 #include <bubblemanagerif.h>
       
    25 #include <qsysteminfo.h>
       
    26 
       
    27 class BubbleManager;
       
    28 class HbAction;
       
    29 class QSignalMapper;
       
    30 class HbToolBar;
       
    31 class HbVolumeSliderPopup;
       
    32 class Dialpad;
       
    33 class XQKeyCapture;
       
    34 class DialpadKeyHandler;
       
    35 
       
    36 #ifdef BUILD_PHONEUIQTVIEW
       
    37 #define PHONEUIQTVIEW_EXPORT Q_DECL_EXPORT
       
    38 #else
       
    39 #define PHONEUIQTVIEW_EXPORT Q_DECL_IMPORT
       
    40 #endif
       
    41 
       
    42 using namespace QtMobility;
       
    43 
       
    44 
       
    45 class PHONEUIQTVIEW_EXPORT PhoneUIQtView : public HbView, public PhoneUIQtViewIF
       
    46 {
       
    47     Q_OBJECT
       
    48 
       
    49 public:
       
    50 
       
    51     /*!
       
    52        Constructor
       
    53     */
       
    54     PhoneUIQtView (HbMainWindow &window, QGraphicsItem *parent = 0);
       
    55     
       
    56     /*!
       
    57        Destructor
       
    58     */
       
    59     virtual ~PhoneUIQtView ();
       
    60             
       
    61     /*!
       
    62         \fn void PhoneUIQtView::bubbleManager ()
       
    63         
       
    64         Returns BubbleManager interface.
       
    65     */
       
    66     BubbleManagerIF& bubbleManager();
       
    67     
       
    68     /*!
       
    69         \fn void PhoneUIQtView::addBubbleCommand ()
       
    70         
       
    71         Adds new command to bubble. Command id will be emitted as
       
    72         a parameter from view's command(int) signal.
       
    73     */
       
    74     void addBubbleCommand (int bubbleId, const PhoneAction& action);
       
    75 
       
    76     /*!
       
    77         \fn void PhoneUIQtView::clearBubbleCommands ()
       
    78         
       
    79         Clears commands from bubble.
       
    80     */
       
    81     void clearBubbleCommands (int bubbleId);
       
    82     
       
    83     /*!
       
    84         \fn void PhoneUIQtView::addParticipantListAction ()
       
    85         
       
    86         Adds new patricipant list command to conference bubble. 
       
    87     */
       
    88     void addParticipantListAction(int commandId, const QString &text, const HbIcon &icon);
       
    89 
       
    90     /*!
       
    91         \fn void PhoneUIQtView::clearBubbleCommands ()
       
    92         
       
    93         Clears participant list commands from conference bubble.
       
    94     */
       
    95     void clearParticipantListActions();
       
    96     
       
    97     /*!
       
    98         \fn void PhoneUIQtViewIF::setToolbarActions()
       
    99         
       
   100        Sets toolbar actions.
       
   101     */
       
   102     void setToolbarActions(const QList<PhoneAction*>& actions);
       
   103     
       
   104     /*!
       
   105         \fn void PhoneUIQtView::hideToolbar ()
       
   106         
       
   107         Hides toolbar.
       
   108     */
       
   109     void hideToolbar ();
       
   110     
       
   111     /*!
       
   112         \fn void PhoneUIQtView::showToolbar ()
       
   113         
       
   114         Shows toolbar.
       
   115     */
       
   116     void showToolbar ();
       
   117 
       
   118     /*!
       
   119         \fn void PhoneUIQtView::volumeSliderValue ()
       
   120         
       
   121         Returns HbVolumeSliderPopup's volume value.
       
   122         If this volume slider isn't active -1 is returned.
       
   123     */
       
   124     int volumeSliderValue ();
       
   125 
       
   126     /*!
       
   127         \fn void PhoneUIQtView::setVolumeSliderValue (int value)
       
   128         
       
   129         Sets slider value to HbVolumeSliderPopup.
       
   130     */
       
   131     void setVolumeSliderValue (
       
   132             int value,
       
   133             int commandId, 
       
   134             int maxVolumeValue, 
       
   135             int minVolumeValue);
       
   136 
       
   137     /*!
       
   138         \fn void PhoneUIQtView::removeVolumeSlider ()
       
   139         
       
   140         Removes HbVolumeSliderPopup.
       
   141     */
       
   142     void removeVolumeSlider ();
       
   143 
       
   144     /*!
       
   145         \fn void PhoneUIQtView::setExpandAction ()
       
   146         
       
   147         Sets expand action.
       
   148     */
       
   149     void setExpandAction(int bubbleId, int commandId);
       
   150     
       
   151         /*!
       
   152         \fn void PhoneUIQtView::removeExpandAction ()
       
   153         
       
   154         Removes expand action.
       
   155     */    
       
   156     void removeExpandAction(int bubbleId);
       
   157     
       
   158     /*!
       
   159         \fn void PhoneUIQtView::showDialpad()
       
   160         
       
   161         Shows dialpad widget.
       
   162     */    
       
   163     void showDialpad();
       
   164     
       
   165     /*!
       
   166         \fn void PhoneUIQtView::hideDialpad()
       
   167         
       
   168         Hides dialer widget.
       
   169     */    
       
   170     void hideDialpad();
       
   171     
       
   172     /*!
       
   173         \fn void PhoneUIQtView::isDialpadVisible()
       
   174         
       
   175         Checks is dialpad visible.
       
   176     */    
       
   177     bool isDialpadVisible();
       
   178     
       
   179     /*!
       
   180         \fn void PhoneUIQtView::dialpadText()
       
   181         
       
   182         Returns content of the dialpad.
       
   183     */  
       
   184     QString dialpadText();
       
   185     
       
   186     /*!
       
   187         \fn void PhoneUIQtView::dialpadString()
       
   188         
       
   189         Clears and hides dialpad.
       
   190     */
       
   191     void clearAndHideDialpad();
       
   192     
       
   193     /*!
       
   194         \fn void PhoneUIQtView::clearDialpad()
       
   195         
       
   196         Clears text from dialpad.
       
   197     */
       
   198     void clearDialpad();
       
   199     
       
   200     /*!
       
   201         \fn void PhoneUIQtView::bringToForeground()
       
   202         
       
   203         Brings to foreground.
       
   204     */
       
   205     void bringToForeground();
       
   206     
       
   207     /*!
       
   208         \fn void PhoneUIQtViewIF::setToolbarActions()
       
   209         
       
   210        Sets menu actions for call handling.
       
   211     */
       
   212     void setMenuActions(const QList<PhoneAction*>& actions);
       
   213     
       
   214     /*!
       
   215         \fn void PhoneUIQtView::setBackButtonVisible()
       
   216         
       
   217         Set the Back command visibility in TitleBar
       
   218     */
       
   219     void setBackButtonVisible(bool visible);
       
   220     
       
   221     /*!
       
   222         \fn void PhoneUIQtViewIF::menuReference()
       
   223         
       
   224         Returns HbMenu reference.
       
   225     */
       
   226     HbMenu &menuReference();
       
   227 
       
   228     /*!
       
   229         \fn void PhoneUIQtViewIF::captureKey()
       
   230         
       
   231         Captures key.
       
   232     */
       
   233     void captureKey(Qt::Key key, bool capture);
       
   234     
       
   235     /*
       
   236         \fn void setRestrictedMode()
       
   237         
       
   238         Sets Ui to restricted mode. Decides which keyevent are allowed.
       
   239      */
       
   240     void setRestrictedMode(bool restrictedMode);
       
   241     
       
   242 public slots:
       
   243 
       
   244     /*!
       
   245         \fn void PhoneUIQtView::volumeSliderClosed ()
       
   246         
       
   247         HbVolumeSliderPopup calls this method when slider
       
   248         is going to be closed.
       
   249     */
       
   250     void volumeSliderClosed ();
       
   251     
       
   252     /*!
       
   253         \fn void PhoneUIQtView::volumeSliderChanged (int value)
       
   254         
       
   255         HbVolumeSliderPopup calls this method when it's value is changed.
       
   256     */
       
   257     void volumeSliderChanged(int value);
       
   258 
       
   259     /*!
       
   260         \fn void PhoneUIQtView::handleOrientationChange(Qt::Orientation orientation)
       
   261         
       
   262         HbMainWindow calls this method when orientation is changed.
       
   263     */
       
   264     void handleOrientationChange(Qt::Orientation orientation);
       
   265         
       
   266     /*!
       
   267         \fn void PhoneUIQtView::backButtonClicked(Qt::Orientation orientation)
       
   268         
       
   269         HbMainWindow calls this method when back softkey is clicked.
       
   270     */    
       
   271     void backButtonClicked();
       
   272     
       
   273     /*!
       
   274         \fn void PhoneUIQtView::onEditorContentChanged()
       
   275         
       
   276         Dialpad calls this method when dialpad content is changed.
       
   277     */
       
   278     void onEditorContentChanged();
       
   279     
       
   280     /*!
       
   281         \fn void dialpadClosed()
       
   282         
       
   283         Dialpad calls this method when dialpad is closed.
       
   284     */
       
   285     void dialpadClosed();
       
   286 
       
   287     /*!
       
   288         \fn void PhoneUIQtView::shutdownPhoneApp()
       
   289         
       
   290         Shutdown phone application.
       
   291     */
       
   292     void shutdownPhoneApp();
       
   293     
       
   294     /*!
       
   295         \fn void PhoneUIQtView::networkNameChanged(QSystemNetworkInfo::NetworkMode mode, const QString &netName)
       
   296         
       
   297         Network name change is informed via this method.
       
   298     */
       
   299     void networkNameChanged(QSystemNetworkInfo::NetworkMode mode, const QString &netName);
       
   300     
       
   301    
       
   302 signals:
       
   303 
       
   304     /*!
       
   305         \fn void keyPressed (QKeyEvent *event)
       
   306         
       
   307         This signal is emitted when key is pressed down.
       
   308     */
       
   309     void keyPressed (QKeyEvent *event);
       
   310 
       
   311     /*!
       
   312         \fn void keyPressed (QKeyEvent *event)
       
   313         
       
   314         This signal is emitted when key is released.
       
   315     */
       
   316     void keyReleased (QKeyEvent *event);
       
   317     
       
   318     /*!
       
   319         \fn void command(int command)
       
   320         
       
   321         This signal is emitted when UI action is handled.
       
   322     */
       
   323     void command (int command);
       
   324     
       
   325     /*!
       
   326         \fn void dialpadIsAboutToClose()
       
   327         
       
   328         This signal is emitted when dialpad is about to close.
       
   329     */
       
   330     void dialpadIsAboutToClose();
       
   331     
       
   332     /*!
       
   333          \fn void windowActivated();
       
   334          
       
   335          This signal is emitted when window is activated
       
   336      */
       
   337     void windowActivated();
       
   338     
       
   339     /*!
       
   340          \fn void windowDeactivated();
       
   341          
       
   342          This signal is emitted when window is deactivated
       
   343      */
       
   344     void windowDeactivated();
       
   345     
       
   346 protected:
       
   347 
       
   348     /*!
       
   349         \fn void eventFilter(int command)
       
   350         
       
   351         Handles key events.
       
   352     */
       
   353     bool eventFilter(QObject * watched, QEvent * event);
       
   354     
       
   355 private:
       
   356 
       
   357     /*!
       
   358         \fn void setDialpadPosition(int command)
       
   359         
       
   360         Sets dialpad position.
       
   361     */
       
   362     void setDialpadPosition();
       
   363 
       
   364     /*!
       
   365         \fn void setActionRole()
       
   366         
       
   367         Sets action role.
       
   368     */    
       
   369     static void setActionRole(const PhoneAction& pa, HbAction& action);
       
   370 
       
   371     /*!
       
   372         \fn void createToolBarActions()
       
   373         
       
   374         Creates tool bar actions.
       
   375     */
       
   376     void createToolBarActions();
       
   377     
       
   378 private:
       
   379     HbMainWindow        &m_window;
       
   380     BubbleManager       *m_bubbleManager;
       
   381     QMap<int , QSignalMapper *> m_bubbleMap;
       
   382     QMap<int , QList<HbAction *> *> m_bubbleActionMap;
       
   383     QSignalMapper       *m_signalMapper;
       
   384     QList<HbAction *>   m_toolbarActions;
       
   385     HbVolumeSliderPopup *m_volumeSlider;
       
   386     QSignalMapper       *m_expandSignalMapper;
       
   387     QMap<int , HbAction*> m_expandActionMap;
       
   388     QSignalMapper       *m_participantListSignalMapper;
       
   389     QList<HbAction *>   m_participantListActions;
       
   390     int                 m_volumeCommandId;
       
   391     HbAction            *m_backAction;
       
   392     Dialpad             *m_dialpad;
       
   393     QSignalMapper       *m_menuSignalMapper;
       
   394     XQKeyCapture        *m_keyCapture;
       
   395     QSystemNetworkInfo  *m_networkInfo;
       
   396     QList<Qt::Key>      m_keyCaptures;
       
   397     DialpadKeyHandler   *m_dialpadKeyHandler;
       
   398     bool                m_restrictedMode;
       
   399 };
       
   400 
       
   401 #endif // PHONEUIQTVIEW_H