radioapp/radiowidgets/inc/radiouiloader.h
branchRCL_3
changeset 20 93c594350b9a
parent 19 cce62ebc198e
equal deleted inserted replaced
19:cce62ebc198e 20:93c594350b9a
     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 RADIOUILOADER_H_
       
    19 #define RADIOUILOADER_H_
       
    20 
       
    21 // System includes
       
    22 #include <HbDocumentLoader>
       
    23 
       
    24 // Constants
       
    25 
       
    26 namespace DOCML
       
    27 {
       
    28     static const QLatin1String FILE_MAINVIEW                    ( ":/layout/mainview.docml" );
       
    29     static const QLatin1String FILE_STATIONSVIEW                ( ":/layout/stationsview.docml" );
       
    30     static const QLatin1String FILE_HISTORYVIEW                 ( ":/layout/historyview.docml" );
       
    31 
       
    32     // Generic XML UI definitions
       
    33     static const QLatin1String NAME_VIEW                        ( "view" );
       
    34     static const QLatin1String SECTION_LAZY_LOAD                ( "lazy_load" );
       
    35     static const QLatin1String SECTION_PORTRAIT                 ( "portrait" );
       
    36     static const QLatin1String SECTION_LANDSCAPE                ( "landscape" );
       
    37     static const QLatin1String NAME_LOUDSPEAKER_ACTION          ( "loudspeaker_action" );
       
    38     static const QLatin1String NAME_EXIT_ACTION                 ( "exit_action" );
       
    39 
       
    40     // RadioMainView
       
    41     static const QLatin1String MV_NAME_HISTORYVIEW_ACTION       ( "mv:historyview_action" );
       
    42     static const QLatin1String MV_NAME_CAROUSEL_BACKGROUND      ( "mv:carousel_background" );
       
    43     static const QLatin1String MV_NAME_CAROUSEL_OVERLAY         ( "mv:carousel_overlay" );
       
    44     static const QLatin1String MV_NAME_STATION_CAROUSEL         ( "mv:station_carousel" );
       
    45     static const QLatin1String MV_NAME_FREQUENCY_BACKGROUND     ( "mv:frequency_background" );
       
    46     static const QLatin1String MV_NAME_FREQUENCY_STRIP          ( "mv:frequency_strip" );
       
    47     static const QLatin1String MV_NAME_STATIONS_BUTTON          ( "mv:stations_button" );
       
    48     static const QLatin1String MV_NAME_FAVORITE_BUTTON          ( "mv:favorite_button" );
       
    49     static const QLatin1String MV_NAME_SPEAKER_BUTTON           ( "mv:loudspeaker_button" );
       
    50     static const QLatin1String MV_NAME_PREV_BUTTON              ( "mv:prev_button" );
       
    51     static const QLatin1String MV_NAME_NEXT_BUTTON              ( "mv:next_button" );
       
    52     static const QLatin1String MV_NAME_SCAN_ACTION              ( "mv:scan_action" );
       
    53     static const QLatin1String MV_NAME_CAROUSEL_RT_MENU         ( "mv:carousel_rt_menu" );
       
    54     static const QLatin1String MV_SECTION_NO_ANTENNA            ( "mv:no_antenna" );
       
    55     static const QLatin1String MV_SECTION_SEEKING               ( "mv:seeking" );
       
    56     static const QLatin1String MV_SECTION_SCANNING              ( "mv:scanning" );
       
    57     static const QLatin1String MV_SECTION_NO_FAVORITES          ( "mv:no_favorites" );
       
    58     static const QLatin1String MV_SECTION_NORMAL                ( "mv:normal" );
       
    59 
       
    60     // RadioStationsView
       
    61     static const QLatin1String SV_NAME_HEADING_BANNER           ( "sv:heading_banner" );
       
    62     static const QLatin1String SV_NAME_STATIONS_LIST            ( "sv:stations_list" );
       
    63     static const QLatin1String SV_NAME_FAVORITES_BUTTON         ( "sv:favorite_stations_button" );
       
    64     static const QLatin1String SV_NAME_LOCALS_BUTTON            ( "sv:local_stations_button" );
       
    65     static const QLatin1String SV_NAME_SCAN_ACTION              ( "sv:scan_action" );
       
    66     static const QLatin1String SV_NAME_CLEAR_LIST_ACTION        ( "sv:clear_list_action" );
       
    67     static const QLatin1String SV_NAME_SCAN_BUTTON              ( "sv:scan_button" );
       
    68     static const QLatin1String SV_NAME_PLAY_ACTION              ( "sv:play_action" );
       
    69     static const QLatin1String SV_NAME_RENAME_ACTION            ( "sv:rename_action" );
       
    70     static const QLatin1String SV_NAME_FAVORITE_ACTION          ( "sv:toggle_favorite_action" );
       
    71     static const QLatin1String SV_NAME_DELETE_ACTION            ( "sv:delete_action" );
       
    72 
       
    73     static const QLatin1String SV_SECTION_SHOW_ALL_STATIONS     ( "show_all_stations" );
       
    74     static const QLatin1String SV_SECTION_SHOW_FAVORITES        ( "show_favorites" );
       
    75     static const QLatin1String SV_SECTION_SHOW_SCAN_TEXT        ( "show_scan_text" );
       
    76     static const QLatin1String SV_SECTION_HIDE_SCAN_TEXT        ( "hide_scan_text" );
       
    77 
       
    78     // RadioStationsView Context Menu
       
    79     static const QLatin1String NAME_CONTEXT_MENU                ( "sv:context_menu" );
       
    80     static const QLatin1String NAME_CONTEXT_RENAME              ( "sv:rename_action" );
       
    81     static const QLatin1String NAME_CONTEXT_FAVORITE            ( "sv:toggle_favorite_action" );
       
    82     static const QLatin1String NAME_CONTEXT_DELETE              ( "sv:delete_action" );
       
    83     static const QLatin1String NAME_INPUT_QUERY                 ( "sv:station_name_query" );
       
    84 
       
    85     // Station Carousel
       
    86     static const QLatin1String MV_NAME_INFO_FIRST_ROW           ( "mv:InfoFirstRow" );
       
    87     static const QLatin1String MV_NAME_INFO_SECOND_ROW          ( "mv:InfoSecondRow" );
       
    88     static const QLatin1String MV_NAME_INFO_THIRD_ROW           ( "mv:InfoThirdRow" );
       
    89     static const QLatin1String MV_NAME_INFO_FOURTH_ROW          ( "mv:InfoFourthRow" );
       
    90     static const QLatin1String MV_NAME_INFO_TEXT                ( "mv:info_text" );
       
    91 
       
    92     // History View
       
    93     static const QLatin1String HV_NAME_CLEAR_LIST_ACTION        ( "hv:clear_list_action" );
       
    94     static const QLatin1String HV_NAME_HISTORY_LIST             ( "hv:history_list" );
       
    95     static const QLatin1String HV_NAME_ALL_SONGS_BUTTON         ( "hv:all_songs_button" );
       
    96     static const QLatin1String HV_NAME_TAGGED_SONGS_BUTTON      ( "hv:tagged_songs_button" );
       
    97     static const QLatin1String HV_SECTION_SHOW_LIST             ( "hv:show_list" );
       
    98     static const QLatin1String HV_SECTION_HIDE_LIST             ( "hv:hide_list" );
       
    99     static const QLatin1String HV_SECTION_HISTORY_MODE          ( "hv:history_mode" );
       
   100     static const QLatin1String HV_SECTION_FAVORITE_MODE         ( "hv:tagged_mode" );
       
   101     static const QLatin1String HV_NAME_CONTEXT_MENU             ( "hv:context_menu" );
       
   102     static const QLatin1String HV_NAME_TOGGLE_TAG_ACTION        ( "hv:toggle_tag_action" );
       
   103     static const QLatin1String HV_NAME_OVI_STORE_ACTION         ( "hv:ovi_store_action" );
       
   104     static const QLatin1String HV_NAME_OTHER_STORE_ACTION       ( "hv:other_store_action" );
       
   105 
       
   106     // History View Context Menu
       
   107     static const QLatin1String HV_NAME_CONTEXT_TAG              ( "hv:toggle_tag_action" );
       
   108     static const QLatin1String HV_NAME_CONTEXT_SEARCH           ( "hv:search_from_other_store_action" );
       
   109 
       
   110 }
       
   111 
       
   112 // Class declaration
       
   113 class RadioUiLoader : public HbDocumentLoader
       
   114 {
       
   115 public:
       
   116 
       
   117     RadioUiLoader();
       
   118 
       
   119     /*!
       
   120      * Returns the requested widget casted to correct type
       
   121      *
       
   122      * @param name Name of the widget
       
   123      * @return Pointer to the widget
       
   124      */
       
   125     template<class T>
       
   126     T* findWidget( QString name )
       
   127     {
       
   128         return qobject_cast<T*>( HbDocumentLoader::findWidget( name ) );
       
   129     }
       
   130 
       
   131     /*!
       
   132      * Returns the requested object casted to correct type
       
   133      *
       
   134      * @param name Name of the object
       
   135      * @return Pointer to the object
       
   136      */
       
   137     template<class T>
       
   138     T* findObject( QString name )
       
   139     {
       
   140         return qobject_cast<T*>( HbDocumentLoader::findObject( name ) );
       
   141     }
       
   142 
       
   143 };
       
   144 
       
   145 #endif // RADIOUILOADER_H_