radioapp/radiowidgets/inc/radioviewbase.h
changeset 13 46974bebc798
child 14 63aabac4416d
equal deleted inserted replaced
0:f3d95d9c00ab 13:46974bebc798
       
     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:
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef _RADIOVIEWBASE_H_
       
    19 #define _RADIOVIEWBASE_H_
       
    20 
       
    21 // System includes
       
    22 #include <hbview.h>
       
    23 
       
    24 //#define QT_SHAREDPOINTER_TRACK_POINTERS // Debugging support for QSharedPointer
       
    25 #include <qsharedpointer>
       
    26 
       
    27 // User includes
       
    28 
       
    29 // Forward declarations
       
    30 class RadioMainWindow;
       
    31 class RadioStationModel;
       
    32 class RadioXmlUiLoader;
       
    33 class HbAction;
       
    34 
       
    35 // Constants
       
    36 namespace MenuItem
       
    37 {
       
    38     enum CommonMenuItem
       
    39     {
       
    40         UseLoudspeaker
       
    41     };
       
    42 }
       
    43 
       
    44 // Class declaration
       
    45 class RadioViewBase : public HbView
       
    46 {
       
    47     Q_OBJECT
       
    48     Q_DISABLE_COPY( RadioViewBase )
       
    49 
       
    50 public:
       
    51     explicit RadioViewBase( RadioXmlUiLoader* uiLoader, bool transient = true );
       
    52 
       
    53     virtual ~RadioViewBase();
       
    54 
       
    55     virtual void init( RadioMainWindow* aMainWindow, RadioStationModel* aModel );
       
    56 
       
    57     bool isTransient() const;
       
    58 
       
    59     virtual void initSecondarySoftkey();
       
    60     HbAction* secondarySoftkey() const;
       
    61 
       
    62     void updateOrientation( Qt::Orientation orientation, bool forceUpdate = false );
       
    63 
       
    64 protected slots:
       
    65 
       
    66     void updateAudioRouting( bool loudspeaker );
       
    67     void activatePreviousView();
       
    68     void quit();
       
    69 
       
    70 protected:
       
    71 
       
    72 // New functinos
       
    73 
       
    74     HbAction* addMenuItem( const QString& aTitle, QObject* aRecipient, const char* aSlot );
       
    75 
       
    76     void connectCommonMenuItem( int menuItem );
       
    77 
       
    78     void connectXmlElement( const char* name, const char* signal, QObject* receiver, const char* slot );
       
    79 
       
    80     void connectViewChangeMenuItem( QString name, const char* slot );
       
    81 
       
    82 private:
       
    83 
       
    84     virtual void setOrientation();
       
    85 
       
    86 protected: // data
       
    87 
       
    88     /**
       
    89      * Pointer to the main window.
       
    90      * Not own.
       
    91      */
       
    92     RadioMainWindow*                	mMainWindow;
       
    93 
       
    94     /**
       
    95      * Pointer to the radio data model.
       
    96      * Not own.
       
    97      */
       
    98     RadioStationModel*                  mModel;
       
    99 
       
   100     /**
       
   101      * Pointer to the XML UI (DocML) loader
       
   102      * Own.
       
   103      */
       
   104     QSharedPointer<RadioXmlUiLoader>	mUiLoader;
       
   105 
       
   106     /**
       
   107      * Flag indicating whether or not the view is transient
       
   108      * Transient views are deleted when they are hidden.
       
   109      */
       
   110     bool                            	mTransientView;
       
   111 
       
   112     /**
       
   113      * Route audio to Loudspeaker/Headset menu item
       
   114      */
       
   115     HbAction*                       	mUseLoudspeakerAction;
       
   116 
       
   117     /**
       
   118      * Action for the secondary softkey. Used for "back" and "done" buttons
       
   119      */
       
   120     HbAction*                       	mSecondarySoftkeyction;
       
   121 
       
   122     /**
       
   123      * View orientation.
       
   124      */
       
   125     Qt::Orientation                 	mOrientation;
       
   126 
       
   127 };
       
   128 
       
   129 
       
   130 #endif // _RADIOVIEWBASE_H_