radioapp/radiowidgets/inc/radioviewbase.h
branchRCL_3
changeset 19 cce62ebc198e
equal deleted inserted replaced
18:1a6714c53019 19:cce62ebc198e
       
     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>
       
    23 #include <QScopedPointer>
       
    24 #include <QSharedPointer>
       
    25 
       
    26 // User includes
       
    27 
       
    28 // Forward declarations
       
    29 class RadioWindow;
       
    30 class RadioStationModel;
       
    31 class RadioUiLoader;
       
    32 class HbAction;
       
    33 class RadioUiEngine;
       
    34 
       
    35 // Constants
       
    36 namespace MenuItem
       
    37 {
       
    38     enum CommonMenuItem
       
    39     {
       
    40         UseLoudspeaker,
       
    41         Exit
       
    42     };
       
    43 }
       
    44 
       
    45 // Class declaration
       
    46 class RadioViewBase : public HbView
       
    47 {
       
    48     Q_OBJECT
       
    49     Q_DISABLE_COPY( RadioViewBase )
       
    50 
       
    51 public:
       
    52     explicit RadioViewBase( bool transient = true );
       
    53 
       
    54     virtual ~RadioViewBase();
       
    55 
       
    56     void setMembers( RadioWindow* mainWindow, RadioUiLoader* uiLoader );
       
    57 
       
    58     virtual void preLazyLoadInit();
       
    59 
       
    60     void initialize( QSharedPointer<RadioUiEngine> uiEngine );
       
    61 
       
    62     bool isInitialized() const;
       
    63 
       
    64     bool isTransient() const;
       
    65 
       
    66     void updateOrientation( Qt::Orientation orientation, bool forceUpdate = false );
       
    67 
       
    68     void bringToForeground();
       
    69 
       
    70 protected slots:
       
    71 
       
    72     void updateAudioRouting( bool loudspeaker );
       
    73     void activatePreviousView();
       
    74     void quit();
       
    75 
       
    76 private slots:
       
    77 
       
    78     void handleUserAnswer( HbAction* answer );   // Needed by HbMessageBox inconvenience API
       
    79 
       
    80 protected:
       
    81 
       
    82 // New functinos
       
    83 
       
    84     void initBackAction();
       
    85 
       
    86     void connectCommonMenuItem( int menuItem );
       
    87 
       
    88     void connectXmlElement( const QString& name, const char* signal, QObject* receiver, const char* slot );
       
    89 
       
    90     void connectViewChangeMenuItem( QString name, const char* slot );
       
    91 
       
    92     void loadSection( const QString& docml, const QString& section );
       
    93 
       
    94     void askQuestion( const QString& question );
       
    95 
       
    96 private:
       
    97 
       
    98     virtual void init() = 0;
       
    99 
       
   100     virtual void setOrientation();
       
   101     virtual void userAccepted();
       
   102 
       
   103 protected: // data
       
   104 
       
   105     /**
       
   106      * Pointer to the main window.
       
   107      * Not own.
       
   108      */
       
   109     RadioWindow*                        mMainWindow;
       
   110 
       
   111     /**
       
   112      * Pointer to the XML UI (DocML) loader
       
   113      * Own.
       
   114      */
       
   115     QScopedPointer<RadioUiLoader>       mUiLoader;
       
   116 
       
   117     /**
       
   118      * Pointer to the ui engine
       
   119      * Shared among all views and the radio window
       
   120      */
       
   121     QSharedPointer<RadioUiEngine>       mUiEngine;
       
   122 
       
   123     /**
       
   124      * Flag indicating whether or not the view is transient
       
   125      * Transient views are deleted when they are hidden.
       
   126      */
       
   127     bool                                mTransientView;
       
   128 
       
   129     /**
       
   130      * Route audio to Loudspeaker/Headset menu item
       
   131      */
       
   132     HbAction*                           mUseLoudspeakerAction;
       
   133 
       
   134     /**
       
   135      * View orientation.
       
   136      */
       
   137     Qt::Orientation                     mOrientation;
       
   138 
       
   139 };
       
   140 
       
   141 
       
   142 #endif // _RADIOVIEWBASE_H_