ui/views/detailsview/inc/glxdetailsviewmodelwrapper.h
changeset 62 36d93b4dc635
equal deleted inserted replaced
58:383b67fbdb11 62:36d93b4dc635
       
     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:   ?Description
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef GLXDETAILSVIEWMODELWRAPPER
       
    19 #define GLXDETAILSVIEWMODELWRAPPER
       
    20 
       
    21 //Includes
       
    22 #include <QAbstractItemModel>
       
    23 
       
    24 /**
       
    25  * Class Description
       
    26  * This is Wrapper class,which access the model [GlxMediaModel] for the widgets created in the details view
       
    27  * Here it specifies the no:of custom widgets to be created in the list view for the details view
       
    28  */
       
    29 
       
    30 class GlxDetailsViewModelWrapper : public QAbstractItemModel
       
    31     {
       
    32 Q_OBJECT
       
    33 public:
       
    34 
       
    35     /**
       
    36      * Constructor
       
    37      * @param - QAbstractItemModel object, this object is passed from the details view, while creating this
       
    38      *          class object 
       
    39      */
       
    40     GlxDetailsViewModelWrapper(QAbstractItemModel *model);
       
    41 
       
    42     /**
       
    43      * Destructor
       
    44      */
       
    45     ~GlxDetailsViewModelWrapper();
       
    46 
       
    47     /**
       
    48      * From QAbstractItemModel
       
    49      * This Function specifies the no:of custom widgets to be created as well
       
    50      * the no:of custom widgets present.
       
    51      */
       
    52     int rowCount(const QModelIndex &parent = QModelIndex()) const;
       
    53 
       
    54     /**
       
    55      * From QAbstractItemModel
       
    56      */
       
    57     int columnCount(const QModelIndex &parent = QModelIndex()) const;
       
    58 
       
    59     /**
       
    60      * From QAbstractItemModel
       
    61      */
       
    62     QModelIndex parent(const QModelIndex &child) const;
       
    63 
       
    64     /**
       
    65      * From QAbstractItemModel
       
    66      * This Function returns the data fetched from the Model corresponding to the role passed
       
    67      */
       
    68     QVariant data(const QModelIndex &index, int role) const;
       
    69 
       
    70     /**
       
    71      * From QAbstractItemModel
       
    72      * This Function verifies if the index passed is valid or not.
       
    73      */
       
    74     QModelIndex index(int row, int column, const QModelIndex &parent =
       
    75             QModelIndex()) const;
       
    76 
       
    77     /**
       
    78      * This Function Emits the Signal for the Custom widgets to refresh  thier data shown
       
    79      */
       
    80     void refreshCustomWidget();
       
    81 
       
    82 private:
       
    83     
       
    84     /**
       
    85      * This Function returns the size in standard form like Bytes,KB,MB,GB
       
    86      * @param :size , specified in Bytes 
       
    87      */
       
    88     QString sizeinStrings(int size) const;
       
    89 
       
    90 signals:
       
    91     /*
       
    92      * This Signal Specifies Custom widgets to refresh  thier data shown as there is change in data in the model 
       
    93      */
       
    94     void updateCustomWidgets();
       
    95 private:
       
    96 
       
    97     //This variable is initialised with model passed by the view, while creating this class object
       
    98     QAbstractItemModel *mModel;
       
    99     };
       
   100 
       
   101 #endif //GLXDETAILSVIEWMODELWRAPPER_H