radioapp/radiowidgets/inc/radiouiloader.h
changeset 23 a2b50a479edf
parent 19 afea38384506
child 24 6df133bd92e1
equal deleted inserted replaced
19:afea38384506 23:a2b50a479edf
     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 QString FILE_MAINVIEW                    = ":/layout/mainview.docml";
       
    29     static QString FILE_STATIONSVIEW                = ":/layout/stationsview.docml";
       
    30     static QString FILE_HISTORYVIEW                 = ":/layout/historyview.docml";
       
    31 
       
    32     // Generic XML UI definitions
       
    33     static QString NAME_VIEW                        = "view";
       
    34     static QString SECTION_PORTRAIT                 = "portrait";
       
    35     static QString SECTION_LANDSCAPE                = "landscape";
       
    36     static QString NAME_LOUDSPEAKER_ACTION          = "loudspeaker_action";
       
    37 
       
    38     // RadioMainView
       
    39     static QString MV_NAME_HISTORYVIEW_ACTION       = "mv:historyview_action";
       
    40     static QString MV_NAME_STATION_CAROUSEL         = "mv:station_carousel";
       
    41     static QString MV_NAME_FREQUENCY_STRIP          = "mv:frequency_strip";
       
    42     static QString MV_NAME_STATIONS_BUTTON          = "mv:stations_button";
       
    43     static QString MV_NAME_SCAN_BUTTON              = "mv:scan_button";
       
    44     static QString MV_NAME_SPEAKER_BUTTON           = "mv:loudspeaker_button";
       
    45     static QString MV_SECTION_NO_ANTENNA            = "mv:no_antenna";
       
    46     static QString MV_SECTION_SEEKING               = "mv:seeking";
       
    47     static QString MV_SECTION_SCANNING              = "mv:scanning";
       
    48     static QString MV_SECTION_NO_FAVORITES          = "mv:no_favorites";
       
    49     static QString MV_SECTION_NORMAL                = "mv:normal";
       
    50 
       
    51     // RadioStationsView
       
    52     static QString SV_NAME_HEADING_BANNER           = "sv:heading_banner";
       
    53     static QString SV_NAME_STATIONS_LIST            = "sv:stations_list";
       
    54     static QString SV_NAME_FAVORITES_BUTTON         = "sv:favorite_stations_button";
       
    55     static QString SV_NAME_LOCALS_BUTTON            = "sv:local_stations_button";
       
    56     static QString SV_NAME_SCAN_ACTION              = "sv:scan_action";
       
    57     static QString SV_NAME_CLEAR_LIST_ACTION        = "sv:clear_list_action";
       
    58     static QString SV_NAME_SCAN_BUTTON              = "sv:scan_button";
       
    59 
       
    60     static QString SV_SECTION_SHOW_ALL_STATIONS     = "show_all_stations";
       
    61     static QString SV_SECTION_SHOW_FAVORITES        = "show_favorites";
       
    62     static QString SV_SECTION_SHOW_SCAN_TEXT        = "show_scan_text";
       
    63     static QString SV_SECTION_HIDE_SCAN_TEXT        = "hide_scan_text";
       
    64 
       
    65     // RadioStationsView Context Menu
       
    66     static QString NAME_CONTEXT_MENU                = "sv:context_menu";
       
    67     static QString NAME_CONTEXT_RENAME              = "sv:rename_action";
       
    68     static QString NAME_CONTEXT_FAVORITE            = "sv:toggle_favorite_action";
       
    69     static QString NAME_CONTEXT_DELETE              = "sv:delete_action";
       
    70     static QString NAME_INPUT_QUERY                 = "sv:station_name_query";
       
    71 
       
    72     // Station Carousel
       
    73     static QString MV_NAME_INFO_FIRST_ROW           = "mv:InfoFirstRow";
       
    74     static QString MV_NAME_INFO_SECOND_ROW          = "mv:InfoSecondRow";
       
    75     static QString MV_NAME_INFO_THIRD_ROW           = "mv:InfoThirdRow";
       
    76     static QString MV_NAME_INFO_FOURTH_ROW          = "mv:InfoFourthRow";
       
    77     static QString MV_NAME_INFO_TEXT                = "mv:info_text";
       
    78 
       
    79     // History View
       
    80     static QString HV_NAME_CLEAR_LIST_ACTION        = "hv:clear_list_action";
       
    81     static QString HV_NAME_HISTORY_LIST             = "hv:history_list";
       
    82     static QString HV_NAME_ALL_SONGS_BUTTON         = "hv:all_songs_button";
       
    83     static QString HV_NAME_TAGGED_SONGS_BUTTON      = "hv:tagged_songs_button";
       
    84     static QString HV_SECTION_SHOW_LIST             = "hv:show_list";
       
    85     static QString HV_SECTION_HIDE_LIST             = "hv:hide_list";
       
    86     static QString HV_SECTION_HISTORY_MODE          = "hv:history_mode";
       
    87     static QString HV_SECTION_FAVORITE_MODE         = "hv:tagged_mode";
       
    88     static QString HV_NAME_CONTEXT_MENU             = "hv:context_menu";
       
    89 
       
    90     // History View Context Menu
       
    91     static QString HV_NAME_CONTEXT_TAG              = "hv:toggle_tag_action";
       
    92     static QString HV_NAME_CONTEXT_SEARCH           = "hv:search_from_other_store_action";
       
    93 
       
    94 }
       
    95 
       
    96 // Class declaration
       
    97 class RadioUiLoader : public HbDocumentLoader
       
    98 {
       
    99 public:
       
   100 
       
   101     RadioUiLoader();
       
   102 
       
   103     /*!
       
   104      * Returns the requested widget casted to correct type
       
   105      *
       
   106      * @param name Name of the widget
       
   107      * @return Pointer to the widget
       
   108      */
       
   109     template<class T>
       
   110     T* findWidget( QString name )
       
   111     {
       
   112         return qobject_cast<T*>( HbDocumentLoader::findWidget( name ) );
       
   113     }
       
   114 
       
   115     /*!
       
   116      * Returns the requested object casted to correct type
       
   117      *
       
   118      * @param name Name of the object
       
   119      * @return Pointer to the object
       
   120      */
       
   121     template<class T>
       
   122     T* findObject( QString name )
       
   123     {
       
   124         return qobject_cast<T*>( HbDocumentLoader::findObject( name ) );
       
   125     }
       
   126 
       
   127 };
       
   128 
       
   129 #endif // RADIOUILOADER_H_