piprofilerui/ui/hb/inc/pimainview.h
branchRCL_3
changeset 12 aefcba28a3e0
equal deleted inserted replaced
11:454d022d514b 12:aefcba28a3e0
       
     1 /*
       
     2 * Copyright (c) 2010 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: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef PIMAINVIEW_H
       
    20 #define PIMAINVIEW_H
       
    21 
       
    22 #include <hbview.h>
       
    23 #include <hbicon.h>
       
    24 
       
    25 #include "pluginattributes.h"
       
    26 #include "piprofilerengine.h"
       
    27 
       
    28 class HbAction;
       
    29 class HbMainWindow;
       
    30 class HbDocumentLoader;
       
    31 class HbApplication;
       
    32 class HbLabel;
       
    33 class HbWidget;
       
    34 class HbListWidget;
       
    35 class HbListWidgetItem;
       
    36 class HbMenu;
       
    37 class PISettingsView;
       
    38 class PIMainWindow;
       
    39 class HbDialog;
       
    40 
       
    41 class PIMainView: public HbView
       
    42 {
       
    43 Q_OBJECT
       
    44 
       
    45 public:
       
    46 
       
    47     /**
       
    48      * Constructor
       
    49      */
       
    50     PIMainView();
       
    51 
       
    52     /**
       
    53      * Destructor
       
    54      */
       
    55     ~PIMainView();
       
    56 
       
    57     /**
       
    58      * Initializes view
       
    59      */
       
    60     void init(PIMainWindow *mainWindow, HbApplication *app, HbDocumentLoader &loader,
       
    61         PIProfilerEngine *engine);
       
    62 
       
    63     /**
       
    64      * Sets and updates new plug-in list into main view
       
    65      * @param pluginList List of plug-ins
       
    66      */
       
    67     void setPluginList(QList<PluginAttributes> *pluginList);
       
    68 
       
    69 private:
       
    70 
       
    71     /**
       
    72      * connects signals and slots
       
    73      */
       
    74     void connectSignalsAndSlots(HbApplication* app);
       
    75 
       
    76     /**
       
    77      * Loads all UI items from xml file
       
    78      */
       
    79     void loadItemsFromResources(HbDocumentLoader &loader);
       
    80 
       
    81     /**
       
    82      * Updates plug-in list according to member variable mPluginList
       
    83      */
       
    84     void updatePlugInLists();
       
    85 
       
    86     /**
       
    87      * Gets plug-in attributes for plug-in which UID number is defined in parameter
       
    88      * If plugin for UID if not found, empty pluginattributes variable is returned
       
    89      */
       
    90     PluginAttributes getPluginAttributes(int uid);
       
    91 
       
    92     /**
       
    93      * Shows profiling note
       
    94      */
       
    95     void showProfilingNote();
       
    96 
       
    97 private slots:
       
    98 
       
    99     /**
       
   100      * Slot that is called when profiling status is changed.
       
   101      * Method updated text in popup that is shown in the screen
       
   102      */
       
   103     void profilingStatusChanged(ProfilerEngineStatus status, const QString &text = 0,
       
   104         ProfilingMode profilingMode = PI_PROFILINGMODENORMAL, ProfilingOutput output =
       
   105             PI_FILE_OUTPUT);
       
   106 
       
   107     /**
       
   108      * shows about popup
       
   109      */
       
   110     void showAboutPopup();
       
   111 
       
   112     /**
       
   113      * opens settings view
       
   114      */
       
   115     void openSettingsView();
       
   116 
       
   117     /**
       
   118      * Enables or disables plug-in from plug-in list. If parameter is zero, selected 
       
   119      * plug-in from plug-in list is enabled/disabled.
       
   120      */
       
   121     void enableOrDisablePlugin(HbListWidgetItem *widget = 0);
       
   122 
       
   123     /**
       
   124      * Shows context menu for list widget
       
   125      */
       
   126     void showContexMenu(HbListWidgetItem *widget, const QPointF &point);
       
   127 
       
   128     /**
       
   129      * Opens sampler info for plug-in that is selected.
       
   130      */
       
   131     void openSampleInfo();
       
   132 
       
   133     /**
       
   134      * sets context menu pointer to zero
       
   135      */
       
   136 
       
   137     void contextMenuClosed();
       
   138 
       
   139     /**
       
   140      * Shows profiling-popup and starts profiling
       
   141      */
       
   142     void startProfiling();
       
   143 
       
   144     /**
       
   145      * Shows profiling popup and starts profiling
       
   146      */
       
   147     void startTimedProfiling();
       
   148 
       
   149     /**
       
   150      * Stops profiling
       
   151      */
       
   152     void stopProfiling();
       
   153 
       
   154     /**
       
   155      * Updates "Start timed profiling for xx seconds" text according to settings
       
   156      */
       
   157     void updateTimedProfilingText();
       
   158 
       
   159     /**
       
   160      * Exits and leaves profiling on
       
   161      */
       
   162     void exitAndLeaveProfilingOn();
       
   163 
       
   164     /**
       
   165      * Opens plug-in specific settings for selected plug-in
       
   166      */
       
   167     void openPluginSpecificSettings();
       
   168 private:
       
   169 
       
   170     // main application
       
   171     HbApplication *application;
       
   172 
       
   173     // main window
       
   174     PIMainWindow *mMainWindow;
       
   175 
       
   176     // engine pointer
       
   177     PIProfilerEngine *mEngine;
       
   178 
       
   179     // list of plug-ins
       
   180     QList<PluginAttributes> *mPluginList;
       
   181 
       
   182     // context menu
       
   183     HbMenu *mContextMenu;
       
   184 
       
   185     // Actions
       
   186     HbAction *mActionExit;
       
   187     HbAction *mActionExitAndLeaveProfilingOn;
       
   188     HbAction *mActionAbout;
       
   189     HbAction *mActionStartProfiling;
       
   190     HbAction *mActionStartTimedProfiling;
       
   191     HbAction *mActionSettings;
       
   192     HbAction *mActionStopProfiling;
       
   193 
       
   194     // plug-in list widget
       
   195     HbListWidget *mListPlugins;
       
   196 
       
   197     // Profiling note
       
   198     HbDialog *mProfilingNote;
       
   199 
       
   200     // Icons for enabled and disabled plug-ins
       
   201     HbIcon mIconEnabled;
       
   202     HbIcon mIconDisabled;
       
   203 
       
   204 };
       
   205 
       
   206 #endif // PIMAINVIEW_H