ui/views/detailsview/inc/glxdetailsview.h
changeset 62 36d93b4dc635
parent 52 a3a4c0de738e
equal deleted inserted replaced
58:383b67fbdb11 62:36d93b4dc635
     1 /*
     1 /*
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     2  * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3  * All rights reserved.
     4 * This component and the accompanying materials are made available
     4  * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5  * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6  * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     8  *
     9 * Initial Contributors:
     9  * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    10  * Nokia Corporation - initial contribution.
    11 *
    11  *
    12 * Contributors:
    12  * Contributors:
    13 *
    13  *
    14 * Description:   ?Description
    14  * Description:   ?Description
    15 *
    15  *
    16 */
    16  */
    17  
    17 
    18 #ifndef GLXDETAILSVIEW_H
    18 #ifndef GLXDETAILSVIEW_H
    19 #define GLXDETAILSVIEW_H
    19 #define GLXDETAILSVIEW_H
    20 
    20 
       
    21 //Includes
    21 #include <glxview.h>
    22 #include <glxview.h>
    22 
    23 #include <QAbstractItemModel>
    23 
    24 
    24 class GlxMediaModel;
    25 //Orbit/Qt forward declartion
    25 class QAbstractItemModel;
    26 class HbIcon;
       
    27 class HbLabel;
    26 class HbIconItem;
    28 class HbIconItem;
    27 
    29 class HbListView;
       
    30 class HbPushButton;
       
    31 
       
    32 //User Defined forward declartion
       
    33 class GlxDetailsIcon;
    28 class GlxFavMediaModel;
    34 class GlxFavMediaModel;
    29 class HbDocumentLoader;
       
    30 class HbLabel;
       
    31 class HbPushButton;
       
    32 class GlxDetailsTextEdit;
    35 class GlxDetailsTextEdit;
    33 class GlxDetailsIcon;
       
    34 
       
    35 class GlxDetailsViewDocLoader;
    36 class GlxDetailsViewDocLoader;
    36 
    37 class GlxDetailsViewModelWrapper;
    37 class GlxDetailsView : public GlxView  
    38 
    38 {
    39 /**
    39 
    40  * Class Description
    40     Q_OBJECT
    41  * This is Details view class .The functionality of details view is to show the detail of the image like
       
    42  * Name of the image ,Date the image was created , time the image was modified , size of the image
       
    43  * and show the description of the image.here in this view , the name of the image and description can be changed. 
       
    44  */
       
    45 class GlxDetailsView : public GlxView
       
    46     {
       
    47 
       
    48 Q_OBJECT
    41 
    49 
    42 public:
    50 public:
       
    51 
    43     /*
    52     /*
    44      * class constructor.
    53      * class constructor.
       
    54      * @param - HbMainWindow object
    45      */
    55      */
    46     GlxDetailsView(HbMainWindow *window);
    56     GlxDetailsView(HbMainWindow *window);
    47     /*
    57     /*
    48      * class Destructor.
    58      * class Destructor.
    49      */
    59      */
    50     ~GlxDetailsView();
    60     ~GlxDetailsView();
    51 
    61 
    52     /*
    62     /*
       
    63      * From GlxView
       
    64      * This is called from the view manager before the view is going to Activated.
       
    65      */
       
    66     void initializeView(QAbstractItemModel *model, GlxView *preView);
       
    67 
       
    68     /**
       
    69      * From GlxView
    53      * This is called from the view manager when the view is going to be activated.
    70      * This is called from the view manager when the view is going to be activated.
    54      */
    71      */
    55     void activate() ;
    72     void activate();
    56 
    73 
    57     /*
    74     /*
       
    75      * From GlxView
       
    76      * This is called from the view manager before the view is going to de-activated.
       
    77      */
       
    78     void resetView();
       
    79 
       
    80     /*
       
    81      * From GlxView 
    58      * This is called from the view manager when the view is going to be de-activated.
    82      * This is called from the view manager when the view is going to be de-activated.
    59      */
    83      */
    60     void deActivate();
    84     void deActivate();
    61 
    85 
    62     /*
    86     /*
       
    87      * From GlxView
       
    88      * Sets the model corresponding to this view.
    63      * This is called from the view manager before the view is going to Activated.
    89      * This is called from the view manager before the view is going to Activated.
    64      */
    90      * @Param - model is of type GlxMediaModel
    65     void initializeView( QAbstractItemModel *model, GlxView *preView );
    91      */
    66 
    92     void setModel(QAbstractItemModel *model);
    67     /*
    93 
    68      * This is called from the view manager before the view is going to de-activated.
    94     /*
    69      */
    95      * //From GlxView
    70     void resetView();
    96      * This is called from the view manager before the view is going to Activated.
    71 
       
    72     /*
       
    73      * Sets the model corresponding to this view.
       
    74      */
       
    75     void setModel (QAbstractItemModel *model);
       
    76     /*
       
    77      * return the view item for animation
    97      * return the view item for animation
    78      */    
    98      */
    79     QGraphicsItem * getAnimationItem(GlxEffect transtionEffect);
    99     QGraphicsItem * getAnimationItem(GlxEffect transtionEffect);
    80 
   100 
    81 
   101 private:
    82 public slots:
   102 
       
   103     /*
       
   104      * cleanUp()
       
   105      * cleans up the resources used.
       
   106      */
       
   107     void cleanUp();
       
   108 
       
   109     /*
       
   110      * showImage()
       
   111      * Retrieves the image from the model and displays the image
       
   112      */
       
   113     void showImage();
       
   114 
       
   115     /*
       
   116      * setFavModel
       
   117      * This Function creates the favourite model, to determine if the image is added to favourite.
       
   118      */
       
   119     void setFavModel();
       
   120 
       
   121     /*
       
   122      * initializeNewModel()
       
   123      * Add all the model related connection and data
       
   124      */
       
   125     void initializeNewModel();
       
   126 
       
   127     /*
       
   128      * clearCurrentModel()
       
   129      * clear all the model releted connection and data
       
   130      */
       
   131     void clearCurrentModel();
       
   132 
       
   133     /*
       
   134      * setConnections()
       
   135      * connects the items to slot to respective signals
       
   136      */
       
   137     void setConnections();
       
   138 
       
   139     /*
       
   140      * clearConnections()
       
   141      * clear the connections
       
   142      */
       
   143     void clearConnections();
       
   144 
       
   145     /**
       
   146      * getSubState()
       
   147      * This Function retrieves the state of the details view, whether it launched from the Photos app
       
   148      * or whether it was launched from other app like File Manager, MMS , Camera ...
       
   149      */
       
   150     int getSubState();
       
   151 
       
   152 private slots:
       
   153 
       
   154     /**
       
   155      * updateLayout()
       
   156      * This Loads the View/Section corresponding to the  Orientation.
       
   157      * @Param - Orientation , specifies the current Orientation.
       
   158      */
    83     void updateLayout(Qt::Orientation);
   159     void updateLayout(Qt::Orientation);
       
   160 
       
   161     /**
       
   162      * rowsRemoved()
       
   163      * This Slot is called when the item is removed from the model.
       
   164      * @Param - parent is of type QModelIndex.
       
   165      * @Param - start, this specifies the starting index of the item being removed. 
       
   166      * @Param - end ,this specifies the ending  index of the item being removed.
       
   167      */
    84     void rowsRemoved(const QModelIndex &parent, int start, int end);
   168     void rowsRemoved(const QModelIndex &parent, int start, int end);
       
   169 
       
   170     /**
       
   171      * modelDestroyed()
       
   172      * This Slot is called whenever the model is deleted.
       
   173      */
       
   174     void modelDestroyed();
       
   175 
       
   176     /**
       
   177      * dataChanged()
       
   178      * This Slot is called whenever the data in an existing item changes.
       
   179      * @Param - startIndex, this specifies the starting index of the  affected items.  
       
   180      * @Param - endIndex ,this specifies the ending  index of the  affected items .
       
   181      */
    85     void dataChanged(QModelIndex startIndex, QModelIndex endIndex);
   182     void dataChanged(QModelIndex startIndex, QModelIndex endIndex);
    86     void modelDestroyed();
   183 
       
   184     /**
       
   185      * refreshDetailsview()
       
   186      * This Slot is called  when the data shown in details view has to be refreshed.
       
   187      */
       
   188     void refreshDetailsview();
       
   189 
       
   190     /**
       
   191      * triggerTheCommand()
       
   192      * This Slot is called when the file details has to be changed like file name and description
       
   193      * @param - row, The Row specifies the row index of the widget in the list widget of details view.
       
   194      */
       
   195     void triggerTheCommand(int row);
       
   196 
       
   197     /**
       
   198      * updateFavourites()
       
   199      * This Slot is called whenever the image is added to Favourites
       
   200      */
    87     void updateFavourites();
   201     void updateFavourites();
    88     void UpdateDescription();
   202 
    89     void FillDetails();
   203     /**
    90     
   204      * launchShareDialog()
       
   205      * This Slot is called  when the image has to be sent via services like MMS, Bluetooth,Email...
       
   206      */
       
   207     void launchShareDialog();
       
   208 
    91 private:
   209 private:
    92 
   210 
    93     /*
   211     //Contains the thumbnail shown in teh details view.
    94      * Retrieves the image from the model and shows the image
   212     HbLabel *mImageBackGround;
    95      */
   213 
    96     void showImage();
       
    97 
       
    98     /*
       
    99      * Sets the Date to the label recieved from MDS
       
   100      */
       
   101     void setImageName();
       
   102     
       
   103     void setDesc();
       
   104 
       
   105     /*
       
   106      * Sets the Date to the label received from MDS
       
   107      */
       
   108     void setDate();
       
   109     
       
   110     /*
       
   111      * Sets the time to the label received from MDS
       
   112      */
       
   113     void setTime();
       
   114     
       
   115     /*
       
   116      * Sets the size to the label received from MDS
       
   117      */
       
   118     void setSize();    
       
   119     
       
   120     /*
       
   121      * create the favourite model
       
   122      */
       
   123     void setFavModel();
       
   124     
       
   125     /*
       
   126      * Add all the model releted connection and data
       
   127      */
       
   128     void initializeNewModel();
       
   129     /*
       
   130      * clear all the model releted connection and data
       
   131      */
       
   132     void clearCurrentModel();
       
   133     
       
   134     /*
       
   135      * cleans up the resources used.
       
   136      */
       
   137     void cleanUp();
       
   138     
       
   139     QString sizeinStrings(int size);
       
   140 
       
   141     /*
       
   142      * connects the items to slot to respective signals
       
   143      */
       
   144     void setConnections();
       
   145 
       
   146     /*
       
   147      * clear the connections
       
   148      */
       
   149     void clearConnections();
       
   150     
       
   151     int getSubState();
       
   152 private:
       
   153     
       
   154     //Contains the thumbnail shown in teh details view.
   214     //Contains the thumbnail shown in teh details view.
   155     HbLabel *mDetailsIcon;
   215     HbLabel *mDetailsIcon;
       
   216 
       
   217     //contains the view instance 
       
   218     HbView *mView;
   156     
   219     
   157     //Contains the favourite icon which adds or removes the image to favourite folder
   220     //Contains the favourite icon which adds or removes the image to favourite folder
   158     GlxDetailsIcon *mFavIcon;
   221     GlxDetailsIcon *mFavIcon;
   159    
   222 
   160     //The media Model to acess the attributes; not owned,dont delete.
   223     //The media Model to acess the attributes; not owned,dont delete.
   161     QAbstractItemModel *mModel; 
   224     QAbstractItemModel *mModel;
   162     
   225 
   163     //The media Model to acess the attributes whether image is in favourite folder or not;owned by this view
   226     //The media Model to acess the attributes whether image is in favourite folder or not;owned by this view
   164     GlxFavMediaModel *mFavModel;    
   227     GlxFavMediaModel *mFavModel;
   165  
   228 
   166     //The reference to the Main Window
   229     //The reference to the Main Window
   167     HbMainWindow *mWindow;
   230     HbMainWindow *mWindow;
   168      
   231 
   169     int mSelIndex;
   232     int mSelIndex;
   170     
   233 
   171    //Document Loader  
   234     //custom Document Loader to load the details view  
   172     GlxDetailsViewDocLoader *mDocLoader;
   235     GlxDetailsViewDocLoader *mDocLoader;
   173   
   236 
   174     //Shows the Images
   237     //Contains the disabled favourite icon 
   175     GlxDetailsTextEdit *mImageName;
       
   176 	
       
   177 	//Shows the descriptions
       
   178     GlxDetailsTextEdit *mDescriptions;
       
   179 	
       
   180 	//Shows the Date 
       
   181     HbLabel *mDateLabel;
       
   182 	
       
   183 	//Shows the size of the image
       
   184     HbLabel *mSizeLabel;
       
   185 	
       
   186 	//Shows the time 
       
   187     HbLabel *mTimeLabel;    
       
   188     
       
   189     HbIcon mFavIconEnabled;
   238     HbIcon mFavIconEnabled;
       
   239 
       
   240     //Contains the enabled favourite icon 
   190     HbIcon mFavIconDisabled;
   241     HbIcon mFavIconDisabled;
   191 };
   242 
       
   243     //Contains the List view
       
   244     HbListView *mListView;
       
   245 
       
   246     //Contains the List model
       
   247     GlxDetailsViewModelWrapper *mListModel;
       
   248 
       
   249     //holds the share button
       
   250     HbPushButton *mShareButton;
       
   251     };
   192 #endif //GLXDETAILSVIEW_H
   252 #endif //GLXDETAILSVIEW_H