videocollection/videocollectionview/inc/videolistmenu.h
changeset 65 a9d57bd8d7b7
equal deleted inserted replaced
62:0e1e938beb1a 65:a9d57bd8d7b7
       
     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:   VideoListMenu class definition
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef VIDEOLISTMENU_H
       
    19 #define VIDEOLISTMENU_H
       
    20 
       
    21 #include <qobject.h>
       
    22 #include <qmap.h>
       
    23 #include <hbaction.h>
       
    24 
       
    25 class TMPXItemId;
       
    26 class VideoListView;
       
    27 class VideoCollectionViewUtils;
       
    28 class VideoProxyModelGeneric;
       
    29 class VideoCollectionUiLoader;
       
    30 class VideoListSelectionDialog;
       
    31 class VideoServices;
       
    32 
       
    33 /**
       
    34  * Class handles the menu for VideoListView.
       
    35  */
       
    36 class VideoListMenu : public QObject
       
    37 {
       
    38     Q_OBJECT
       
    39 
       
    40 public:
       
    41 
       
    42     /**
       
    43      * Contructor.
       
    44      * @param uiLoader VideoCollectionUiLoader instance
       
    45      * @param parent VideoListView parent
       
    46      */
       
    47     VideoListMenu(VideoCollectionUiLoader* uiLoader, VideoListView* parent);
       
    48 
       
    49     /**
       
    50      * Destructor.
       
    51      *
       
    52      */
       
    53     ~VideoListMenu();
       
    54 
       
    55     /**
       
    56      * Creates and initializes menu and connects signals
       
    57      *
       
    58      * @return 0 if ok, < 0 if initialisation fails
       
    59      */
       
    60     int initializeMenu();
       
    61 
       
    62 private:
       
    63     
       
    64     /**
       
    65      * Shows or hides a menu action.
       
    66      */
       
    67     void showAction(bool show, const QString &name);
       
    68     
       
    69 private slots:
       
    70     
       
    71     /**
       
    72      * Slot is connected into main menus sort -items
       
    73      * Method checks sorting role based on active menu item and initiates sorting
       
    74      *
       
    75      */
       
    76     void startSorting();
       
    77 
       
    78     /**
       
    79      * Method checks the sorting role and starts sorting
       
    80      *
       
    81      */
       
    82     void doSorting(int role);
       
    83     
       
    84     /**
       
    85      * Slot is connected into main menus "delete items" (delete...) signal
       
    86      *
       
    87      * Calls ui utils to show multiple delete dialog for current widget
       
    88      *
       
    89      */
       
    90     void deleteItemsSlot();
       
    91 
       
    92     /**
       
    93      * Slot is connected into main menus "Create new collection..." signal
       
    94      * Shows a selection dialog for creating a new collection
       
    95      *
       
    96      */
       
    97     void createCollectionSlot();
       
    98 
       
    99     /**
       
   100      * Slot is connected into toolbar's  "Add videos" signal
       
   101      *
       
   102      */
       
   103     void addVideosToCollectionSlot();
       
   104     
       
   105     /**
       
   106      * Slot is connected into main menus aboutToShow -signal
       
   107      *
       
   108      */
       
   109     void aboutToShowMainMenuSlot();
       
   110     
       
   111     /**
       
   112      * Prepare menu when videos used through browsing service.
       
   113      */
       
   114     void prepareBrowseServiceMenu();
       
   115 
       
   116     /**
       
   117      * Slot which is called when an object has been loaded.
       
   118      */
       
   119     void objectReadySlot(QObject *object, const QString &name);
       
   120     
       
   121 private:
       
   122 
       
   123     /**
       
   124      * Reference to video collection view utils
       
   125      */
       
   126     VideoCollectionViewUtils &mUiUtils;
       
   127 
       
   128     /**
       
   129      * Pointer to the XML UI (DocML) loader, not owned
       
   130      */
       
   131     VideoCollectionUiLoader* mUiLoader;
       
   132     
       
   133     /**
       
   134      * Pointer to VideoListView.
       
   135      * Not own.
       
   136      */
       
   137     VideoListView* mListView;
       
   138     
       
   139     /**
       
   140      * Pointer to videoservices instance
       
   141      * if exists, app has started as service
       
   142      */
       
   143     VideoServices* mVideoServices;
       
   144 
       
   145     /**
       
   146      * Sorting roles mapped to appropriate actions.
       
   147      */
       
   148     QMap<HbAction*, int> mSortingRoles;
       
   149 
       
   150 };
       
   151 
       
   152 #endif // VIDEOLISTMENU_H