radioapp/radiowidgets/inc/radioxmluiloader.h
changeset 19 afea38384506
parent 16 f54ebcfc1b80
child 21 6bac020dcc51
child 23 a2b50a479edf
equal deleted inserted replaced
16:f54ebcfc1b80 19:afea38384506
     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 RADIOXMLUILOADER_H_
       
    19 #define RADIOXMLUILOADER_H_
       
    20 
       
    21 // System includes
       
    22 #include <HbDocumentLoader>
       
    23 
       
    24 // Constants
       
    25 
       
    26 namespace DOCML
       
    27 {
       
    28 
       
    29     #ifdef USE_LAYOUT_FROM_E_DRIVE
       
    30         static const char* FILE_TUNINGVIEW              = "e:/radiotest/layout/tuningview.docml";
       
    31         static const char* FILE_STATIONSVIEW            = "e:/radiotest/layout/stationsview.docml";
       
    32         static const char* FILE_HISTORYVIEW             = "e:/radiotest/layout/historyview.docml";
       
    33     #else
       
    34         static const char* FILE_TUNINGVIEW              = ":/layout/tuningview.docml";
       
    35         static const char* FILE_STATIONSVIEW            = ":/layout/stationsview.docml";
       
    36         static const char* FILE_HISTORYVIEW             = ":/layout/historyview.docml";
       
    37     #endif
       
    38 
       
    39     // Generic XML UI definitions
       
    40     static const char* NAME_VIEW                        = "view";
       
    41     static const char* SECTION_PORTRAIT                 = "portrait";
       
    42     static const char* SECTION_LANDSCAPE                = "landscape";
       
    43     static const char* NAME_LOUDSPEAKER_ACTION          = "loudspeaker_action";
       
    44 
       
    45     // RadioTuningView
       
    46     static const char* TV_NAME_HISTORYVIEW_ACTION       = "tv:historyview_action";
       
    47     static const char* TV_NAME_STATION_CAROUSEL         = "tv:station_carousel";
       
    48     static const char* TV_NAME_FREQUENCY_STRIP          = "tv:frequency_strip";
       
    49     static const char* TV_NAME_STATIONS_BUTTON          = "tv:stations_button";
       
    50     static const char* TV_NAME_SCAN_BUTTON              = "tv:scan_button";
       
    51     static const char* TV_NAME_SPEAKER_BUTTON           = "tv:loudspeaker_button";
       
    52     static const char* TV_SECTION_NO_ANTENNA            = "tv:no_antenna";
       
    53     static const char* TV_SECTION_SEEKING               = "tv:seeking";
       
    54     static const char* TV_SECTION_SCANNING              = "tv:scanning";
       
    55     static const char* TV_SECTION_NO_FAVORITES          = "tv:no_favorites";
       
    56     static const char* TV_SECTION_NORMAL                = "tv:normal";
       
    57 
       
    58     // RadioStationsView
       
    59     static const char* SV_NAME_HEADING_BANNER           = "sv:heading_banner";
       
    60     static const char* SV_NAME_STATIONS_LIST            = "sv:stations_list";
       
    61     static const char* SV_NAME_FAVORITES_BUTTON         = "sv:favorite_stations_button";
       
    62     static const char* SV_NAME_LOCALS_BUTTON            = "sv:local_stations_button";
       
    63     static const char* SV_NAME_SCAN_ACTION              = "sv:scan_action";
       
    64     static const char* SV_NAME_CLEAR_LIST_ACTION        = "sv:clear_list_action";
       
    65     static const char* SV_NAME_SCAN_BUTTON              = "sv:scan_button";
       
    66 
       
    67     static const char* SV_SECTION_SHOW_ALL_STATIONS     = "show_all_stations";
       
    68     static const char* SV_SECTION_SHOW_FAVORITES        = "show_favorites";
       
    69     static const char* SV_SECTION_SHOW_SCAN_TEXT        = "show_scan_text";
       
    70     static const char* SV_SECTION_HIDE_SCAN_TEXT        = "hide_scan_text";
       
    71 
       
    72     // RadioStationsView Context Menu
       
    73     static const char* NAME_CONTEXT_MENU                = "sv:context_menu";
       
    74     static const char* NAME_CONTEXT_RENAME              = "sv:rename_action";
       
    75     static const char* NAME_CONTEXT_FAVORITE            = "sv:toggle_favorite_action";
       
    76     static const char* NAME_CONTEXT_DELETE              = "sv:delete_action";
       
    77     static const char* NAME_INPUT_QUERY                 = "sv:station_name_query";
       
    78 
       
    79     // Station Carousel
       
    80     static const char* NAME_INFO_FIRST_ROW              = "tv:InfoFirstRow";
       
    81     static const char* NAME_INFO_SECOND_ROW             = "tv:InfoSecondRow";
       
    82     static const char* NAME_INFO_THIRD_ROW              = "tv:InfoThirdRow";
       
    83     static const char* NAME_INFO_FOURTH_ROW             = "tv:InfoFourthRow";
       
    84     static const char* TV_NAME_INFO_TEXT                = "tv:info_text";
       
    85 
       
    86     // History View
       
    87     static const char* HV_NAME_CLEAR_LIST_ACTION        = "hv:clear_list_action";
       
    88     static const char* HV_NAME_HISTORY_LIST             = "hv:history_list";
       
    89     static const char* HV_NAME_ALL_SONGS_BUTTON         = "hv:all_songs_button";
       
    90     static const char* HV_NAME_TAGGED_SONGS_BUTTON      = "hv:tagged_songs_button";
       
    91     static const char* HV_SECTION_SHOW_LIST             = "show_list";
       
    92     static const char* HV_SECTION_HIDE_LIST             = "hide_list";
       
    93     static const char* HV_SECTION_HISTORY_MODE          = "history_mode";
       
    94     static const char* HV_SECTION_FAVORITE_MODE         = "favorite_mode";
       
    95 
       
    96 }
       
    97 
       
    98 // Class declaration
       
    99 class RadioXmlUiLoader : public HbDocumentLoader
       
   100 {
       
   101 public:
       
   102 
       
   103     RadioXmlUiLoader();
       
   104 
       
   105     /*!
       
   106      * Returns the requested widget casted to correct type
       
   107      *
       
   108      * @param name Name of the widget
       
   109      * @return Pointer to the widget
       
   110      */
       
   111     template<class T>
       
   112     T* findWidget( QString name )
       
   113     {
       
   114         return qobject_cast<T*>( HbDocumentLoader::findWidget( name ) );
       
   115     }
       
   116 
       
   117     /*!
       
   118      * Returns the requested object casted to correct type
       
   119      *
       
   120      * @param name Name of the object
       
   121      * @return Pointer to the object
       
   122      */
       
   123     template<class T>
       
   124     T* findObject( QString name )
       
   125     {
       
   126         return qobject_cast<T*>( HbDocumentLoader::findObject( name ) );
       
   127     }
       
   128 
       
   129 };
       
   130 
       
   131 #endif // RADIOXMLUILOADER_H_