videocollection/videocollectionview/inc/videocollectionviewutils.h
branchRCL_3
changeset 56 839377eedc2b
equal deleted inserted replaced
54:315810614048 56:839377eedc2b
       
     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 #include <qvariant.h>
       
    23 #include "videocollectioncommon.h"
       
    24 
       
    25 class HbListView;
       
    26 class VideoSortFilterProxyModel;
       
    27 
       
    28 class VideoCollectionViewUtils : public QObject
       
    29 {
       
    30     Q_OBJECT
       
    31     
       
    32 public:
       
    33     /**
       
    34      * Returns singleton instance for this class.
       
    35      * 
       
    36      * WARNING! Not safe to call this from destructor of another function scope static object!
       
    37      * 
       
    38      * @return The singleton instance.
       
    39      */
       
    40     static VideoCollectionViewUtils& instance();
       
    41     
       
    42     /**
       
    43      * Saves the sorting role and order to cenrep.
       
    44      * 
       
    45      * @param role The sorting role.
       
    46      * @param order The sorting order (e.g. ascending or descending).
       
    47      * @return Zero if operation succeeded, less than zero in error cases.
       
    48      */
       
    49     int saveSortingValues(int role, Qt::SortOrder order, VideoCollectionCommon::TCollectionLevels target);
       
    50     
       
    51     /**
       
    52      * Loads the sorting role and order from cenrep.
       
    53      * 
       
    54      * @param role On return contains the sorting role.
       
    55      * @param order On return contains the sorting order
       
    56      * @return Zero if operation succeeded, less than zero in error cases.
       
    57      */
       
    58     int loadSortingValues(int& role, Qt::SortOrder& order, VideoCollectionCommon::TCollectionLevels target);
       
    59     
       
    60     /**
       
    61      * Get string value for a key from central repository.
       
    62      * 
       
    63      * @param key Video collection central repository key.
       
    64      * @return String stored in central repository. Empty string in error cases.
       
    65      */
       
    66     QString getCenRepStringValue(int key);
       
    67     
       
    68     /**
       
    69      * Get int value for a key from central repository.
       
    70      * 
       
    71      * @param key Video collection central repository key.
       
    72      * @param value Contains the read integer from cenrep at return.  
       
    73      * @return Application UID if operation succeeded, less than zero in error cases.
       
    74      */
       
    75     int getCenRepIntValue(int key);
       
    76 
       
    77 public:
       
    78     /**
       
    79      * Initializes list view for collection and selection dialog with common
       
    80      * properties.
       
    81      */
       
    82     static void initListView(HbListView *view);
       
    83     
       
    84     /**
       
    85      * Initilizes model sort values.
       
    86      */
       
    87     static void sortModel(VideoSortFilterProxyModel *model, bool async, VideoCollectionCommon::TCollectionLevels target);
       
    88     
       
    89     /**
       
    90      * Method saves the latest videolist widget level into local activity manager 
       
    91      * data container.
       
    92      * 
       
    93      * Note that collection id will be cleared in activity data in case level is
       
    94      * all videos or collection list. 
       
    95      * 
       
    96      * @param level collection level
       
    97      */
       
    98     static void setWidgetActivityLevel(const VideoCollectionCommon::TCollectionLevels &level);
       
    99    
       
   100     /**
       
   101      * Method gets the latest videolist widget level from local activity manager 
       
   102      * data container.
       
   103      * 
       
   104      * @param level, reference to level variable where value is saved
       
   105      */
       
   106     static void getActivityWidgetLevel(VideoCollectionCommon::TCollectionLevels &level);
       
   107     
       
   108     /**
       
   109      * method saves provided id and string into local activity
       
   110      * manager data container.
       
   111      * 
       
   112      * @param id. Id to save
       
   113      */
       
   114     static void setCollectionActivityData(const TMPXItemId &id, const QString &name);
       
   115     
       
   116     /**
       
   117      * method reads id and string from from local activity manager data 
       
   118      * container and prepares MPX item id.
       
   119      * 
       
   120      * @param id. Id to return
       
   121      */
       
   122     static void getCollectionActivityData(TMPXItemId &id, QString &name);
       
   123 
       
   124 public slots:
       
   125     
       
   126     /**
       
   127      * Shows status msgs
       
   128      *
       
   129      * @param statusCode status code
       
   130      * @param additional additional data gotten from the status 
       
   131      */
       
   132     void showStatusMsgSlot(int statusCode, QVariant &additional);
       
   133    
       
   134 private:
       
   135     
       
   136     /**
       
   137      * disables copy-constructor and assingment operator
       
   138      */
       
   139     Q_DISABLE_COPY(VideoCollectionViewUtils)
       
   140     
       
   141     /**
       
   142      * constructor
       
   143      */
       
   144     VideoCollectionViewUtils();
       
   145      
       
   146     /**
       
   147      * destructor
       
   148      */
       
   149     virtual ~VideoCollectionViewUtils();
       
   150 
       
   151 private:
       
   152     /** current sorting role */
       
   153     int mVideosSortRole;
       
   154     int mCollectionsSortRole;
       
   155     
       
   156     /** current sorting order */
       
   157     Qt::SortOrder mVideosSortOrder;
       
   158     Qt::SortOrder mCollectionsSortOrder;
       
   159 };
       
   160 
       
   161 #endif //__VIDEOCOLLECTIONUIUTILS_H__
       
   162