videocollection/videocollectionview/inc/videocollectionviewutils.h
changeset 15 cf5481c2bc0b
child 17 69946d1824c4
equal deleted inserted replaced
2:dec420019252 15:cf5481c2bc0b
       
     1 /*
       
     2 * Copyright (c) 2008 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: video collection view plugin's ui utils class
       
    15 * 
       
    16 */
       
    17 
       
    18 #ifndef __VIDEOCOLLECTIONVIEWUTILS_H__
       
    19 #define __VIDEOCOLLECTIONVIEWUTILS_H__
       
    20 
       
    21 #include <qobject.h>
       
    22 
       
    23 class HbListView;
       
    24 class VideoSortFilterProxyModel;
       
    25 
       
    26 class VideoCollectionViewUtils : public QObject
       
    27 {
       
    28     Q_OBJECT
       
    29     
       
    30 public:
       
    31     /**
       
    32      * Returns singleton instance for this class.
       
    33      * 
       
    34      * WARNING! Not safe to call this from destructor of another function scope static object!
       
    35      * 
       
    36      * @return The singleton instance.
       
    37      */
       
    38     static VideoCollectionViewUtils& instance();
       
    39     
       
    40     /**
       
    41      * Saves the sorting role and order to cenrep.
       
    42      * 
       
    43      * @param role The sorting role.
       
    44      * @param order The sorting order (e.g. ascending or descending).
       
    45      * @return Zero if operation succeeded, less than zero in error cases.
       
    46      */
       
    47     int saveSortingValues(int role, Qt::SortOrder order);
       
    48     
       
    49     /**
       
    50      * Loads the sorting role and order from cenrep.
       
    51      * 
       
    52      * @param role On return contains the sorting role.
       
    53      * @param order On return contains the sorting order
       
    54      * @return Zero if operation succeeded, less than zero in error cases.
       
    55      */
       
    56     int loadSortingValues(int& role, Qt::SortOrder& order);
       
    57     
       
    58     /**
       
    59      * Get service icon resource strings from cenrep.
       
    60      * 
       
    61      * @param icon On return contains the resource string for icon image.
       
    62      * @param iconPressed On return contains the resource string for pressed icon image.
       
    63      * @return Zero if operation succeeded, less than zero in error cases. 
       
    64      */
       
    65     int getServiceIconStrings(QString& icon, QString& iconPressed);
       
    66     
       
    67     /**
       
    68      * Get service URI string.
       
    69      * 
       
    70      * @return Service URI string. Invalid string in error cases.
       
    71      */
       
    72     QString getServiceUriString();
       
    73     
       
    74 public:
       
    75     /**
       
    76      * Initializes list view for collection and selection dialog with common
       
    77      * properties.
       
    78      */
       
    79     static void initListView(HbListView *view);
       
    80     
       
    81     /**
       
    82      * Initilizes model sort values.
       
    83      */
       
    84     static void sortModel(VideoSortFilterProxyModel *model, bool async);
       
    85 
       
    86 public slots:
       
    87     
       
    88     /**
       
    89      * Shows status msgs
       
    90      *
       
    91      * @param statusCode status code
       
    92      * @param additional additional data gotten from the status 
       
    93      */
       
    94     void showStatusMsgSlot(int statusCode, QVariant &additional);
       
    95    
       
    96 private:
       
    97     
       
    98     /**
       
    99      * disables copy-constructor and assingment operator
       
   100      */
       
   101     Q_DISABLE_COPY(VideoCollectionViewUtils)
       
   102     
       
   103     /**
       
   104      * constructor
       
   105      */
       
   106     VideoCollectionViewUtils();
       
   107      
       
   108     /**
       
   109      * destructor
       
   110      */
       
   111     virtual ~VideoCollectionViewUtils();
       
   112 
       
   113 private:
       
   114     /** current sorting role */
       
   115     int mSortRole;
       
   116     
       
   117     /** current sorting order */
       
   118     Qt::SortOrder mSortOrder;
       
   119 };
       
   120 
       
   121 #endif //__VIDEOCOLLECTIONUIUTILS_H__
       
   122