phoneapp/phoneuiview2/inc/phoneuiqtview.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 03 May 2010 12:31:11 +0300
changeset 27 2f8f8080a020
parent 22 6bb1b21d2484
child 30 ebdbd102c78a
permissions -rw-r--r--
Revision: 201015 Kit: 201018

/*!
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:  Phone UI's Qt view.
*
*/

#ifndef PHONEUIQTVIEW_H
#define PHONEUIQTVIEW_H

#include <QObject>
#include <hbview.h>
#include "phoneuiqtviewif.h"
#include <bubblemanagerif.h>

class BubbleManager;
class HbAction;
class QSignalMapper;
class HbToolBar;
class HbVolumeSliderPopup;
class Dialpad;
class XqKeyCapture;

#ifdef BUILD_PHONEUIQTVIEW
#define PHONEUIQTVIEW_EXPORT Q_DECL_EXPORT
#else
#define PHONEUIQTVIEW_EXPORT Q_DECL_IMPORT
#endif

class PHONEUIQTVIEW_EXPORT PhoneUIQtView : public HbView, public PhoneUIQtViewIF
{
    Q_OBJECT

public:

    /*!
       Constructor
    */
    PhoneUIQtView (HbMainWindow &window, QGraphicsItem *parent = 0);
    
    /*!
       Destructor
    */
    virtual ~PhoneUIQtView ();
            
    /*!
        \fn void PhoneUIQtView::bubbleManager ()
        
        Returns BubbleManager interface.
    */
    BubbleManagerIF& bubbleManager();
    
    /*!
        \fn void PhoneUIQtView::addBubbleCommand ()
        
        Adds new command to bubble. Command id will be emitted as
        a parameter from view's command(int) signal.
    */
    void addBubbleCommand (int bubbleId, const PhoneAction& action);

    /*!
        \fn void PhoneUIQtView::clearBubbleCommands ()
        
        Clears commands from bubble.
    */
    void clearBubbleCommands (int bubbleId);
    
    /*!
        \fn void PhoneUIQtView::addParticipantListAction ()
        
        Adds new patricipant list command to conference bubble. 
    */
    void addParticipantListAction(int commandId, const QString &text, const HbIcon &icon);

    /*!
        \fn void PhoneUIQtView::clearBubbleCommands ()
        
        Clears participant list commands from conference bubble.
    */
    void clearParticipantListActions();
    
    /*!
        \fn void PhoneUIQtViewIF::setToolbarActions()
        
       Sets toolbar actions.
    */
    void setToolbarActions(const QList<PhoneAction*>& actions);
    
    /*!
        \fn void PhoneUIQtView::hideToolbar ()
        
        Hides toolbar.
    */
    void hideToolbar ();
    
    /*!
        \fn void PhoneUIQtView::showToolbar ()
        
        Shows toolbar.
    */
    void showToolbar ();

    /*!
        \fn void PhoneUIQtView::volumeSliderValue ()
        
        Returns HbVolumeSliderPopup's volume value.
        If this volume slider isn't active -1 is returned.
    */
    int volumeSliderValue ();

    /*!
        \fn void PhoneUIQtView::setVolumeSliderValue (int value)
        
        Sets slider value to HbVolumeSliderPopup.
    */
    void setVolumeSliderValue (
            int value,
            int commandId, 
            int maxVolumeValue, 
            int minVolumeValue);

    /*!
        \fn void PhoneUIQtView::removeVolumeSlider ()
        
        Removes HbVolumeSliderPopup.
    */
    void removeVolumeSlider ();

    /*!
        \fn void PhoneUIQtView::setExpandAction ()
        
        Sets expand action.
    */
    void setExpandAction(int bubbleId, int commandId);
    
        /*!
        \fn void PhoneUIQtView::removeExpandAction ()
        
        Removes expand action.
    */    
    void removeExpandAction(int bubbleId);
    
    /*!
        \fn void PhoneUIQtView::showDialpad()
        
        Shows dialpad widget.
    */    
    void showDialpad();
    
    /*!
        \fn void PhoneUIQtView::hideDialpad()
        
        Hides dialer widget.
    */    
    void hideDialpad();
    
    /*!
        \fn void PhoneUIQtView::isDialpadVisible()
        
        Checks is dialpad visible.
    */    
    bool isDialpadVisible();
    
    /*!
        \fn void PhoneUIQtView::dialpadText()
        
        Returns content of the dialpad.
    */  
    QString dialpadText();
    
    /*!
        \fn void PhoneUIQtView::dialpadString()
        
        Clears and hides dialpad.
    */
    void clearAndHideDialpad();
    
    /*!
        \fn void PhoneUIQtView::bringToForeground()
        
        Brings to foreground.
    */
    void bringToForeground();
    
    /*!
        \fn void PhoneUIQtViewIF::setToolbarActions()
        
       Sets menu actions for call handling.
    */
    void setMenuActions(const QList<PhoneAction*>& actions);
    
    /*!
        \fn void PhoneUIQtView::setBackButtonVisible()
        
        Set the Back command visibility in TitleBar
    */
    void setBackButtonVisible(bool visible);
    
    /*!
        \fn void PhoneUIQtViewIF::menuReference()
        
        Returns HbMenu reference.
    */
    HbMenu &menuReference();

public slots:

    /*!
        \fn void PhoneUIQtView::volumeSliderClosed ()
        
        HbVolumeSliderPopup calls this method when slider
        is going to be closed.
    */
    void volumeSliderClosed ();
    
    /*!
        \fn void PhoneUIQtView::volumeSliderChanged (int value)
        
        HbVolumeSliderPopup calls this method when it's value is changed.
    */
    void volumeSliderChanged(int value);

    /*!
        \fn void PhoneUIQtView::handleOrientationChange(Qt::Orientation orientation)
        
        HbMainWindow calls this method when orientation is changed.
    */
    void handleOrientationChange(Qt::Orientation orientation);
        
    /*!
        \fn void PhoneUIQtView::backButtonClicked(Qt::Orientation orientation)
        
        HbMainWindow calls this method when back softkey is clicked.
    */    
    void backButtonClicked();
    
    /*!
        \fn void PhoneUIQtView::onEditorContentChanged()
        
        Dialpad calls this method when dialpad content is changed.
    */
    void onEditorContentChanged();
    
    /*!
        \fn void dialpadClosed()
        
        Dialpad calls this method when dialpad is closed.
    */
    void dialpadClosed();

    /*!
        \fn void PhoneUIQtView::shutdownPhoneApp()
        
        Shutdown phone application.
    */
    void shutdownPhoneApp();
    
   
signals:

    /*!
        \fn void keyPressed (QKeyEvent *event)
        
        This signal is emitted when key is pressed down.
    */
    void keyPressed (QKeyEvent *event);

    /*!
        \fn void keyPressed (QKeyEvent *event)
        
        This signal is emitted when key is released.
    */
    void keyReleased (QKeyEvent *event);
    
    /*!
        \fn void command(int command)
        
        This signal is emitted when UI action is handled.
    */
    void command (int command);
    
    /*!
        \fn void dialpadIsAboutToClose()
        
        This signal is emitted when dialpad is about to close.
    */
    void dialpadIsAboutToClose();
    
    
protected:

    /*!
        \fn void eventFilter(int command)
        
        Handles key events.
    */
    bool eventFilter(QObject * watched, QEvent * event);
    
private:

    /*!
        \fn void setDialpadPosition(int command)
        
        Sets dialpad position.
    */
    void setDialpadPosition();

    /*!
        \fn void setActionRole()
        
        Sets action role.
    */    
    static void setActionRole(const PhoneAction& pa, HbAction& action);

    /*!
        \fn void createToolBarActions()
        
        Creates tool bar actions.
    */
    void createToolBarActions();
    
private:
    HbMainWindow        &m_window;
    BubbleManager       *m_bubbleManager;
    QMap<int , QSignalMapper *> m_bubbleMap;
    QMap<int , QList<HbAction *> *> m_bubbleActionMap;
    QSignalMapper       *m_signalMapper;
    QList<HbAction *>   m_toolbarActions;
    HbVolumeSliderPopup *m_volumeSlider;
    QSignalMapper       *m_expandSignalMapper;
    QMap<int , HbAction*> m_expandActionMap;
    QSignalMapper       *m_participantListSignalMapper;
    QList<HbAction *>   m_participantListActions;
    int                 m_volumeCommandId;
    HbAction            *m_backAction;
    Dialpad             *m_dialpad;
    QSignalMapper       *m_menuSignalMapper;
    XqKeyCapture        *m_keyCapture;
};

#endif // PHONEUIQTVIEW_H