homescreenapp/stateplugins/hsapplibrarystateplugin/inc/hsmenuviewbuilder.h
author hgs
Fri, 06 Aug 2010 13:36:36 +0300
changeset 71 1db7cc813a4e
parent 69 87476091b3f5
child 86 e4f038c420f7
permissions -rw-r--r--
201031
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
35
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     1
/*
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     2
 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     3
 * All rights reserved.
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     4
 * This component and the accompanying materials are made available
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     5
 * under the terms of "Eclipse Public License v1.0"
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     6
 * which accompanies this distribution, and is available
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     8
 *
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     9
 * Initial Contributors:
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    10
 * Nokia Corporation - initial contribution.
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    11
 *
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    12
 * Contributors:
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    13
 *
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    14
 * Description: Menu View Builder
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    15
 *
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    16
 */
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    17
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    18
#ifndef HSMENUVIEWBUILDER_H
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    19
#define HSMENUVIEWBUILDER_H
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    20
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    21
#include <QFlags>
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    22
#include <QMap>
69
hgs
parents: 55
diff changeset
    23
#include <QPair>
46
23b5d6a29cce Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 35
diff changeset
    24
#include <QSet>
69
hgs
parents: 55
diff changeset
    25
#include <QSharedPointer>
35
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    26
#include <QString>
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    27
#include <qnamespace.h>
46
23b5d6a29cce Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 35
diff changeset
    28
#include <HbDocumentLoader>
55
03646e8da489 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 46
diff changeset
    29
#include "hsmenustates_global.h"
35
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    30
46
23b5d6a29cce Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 35
diff changeset
    31
class QActionGroup;
35
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    32
class HbAction;
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    33
class HbGroupBox;
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    34
class HbLineEdit;
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    35
class HbListView;
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    36
class HbToolBar;
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    37
class HbView;
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    38
class HbWidget;
46
23b5d6a29cce Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 35
diff changeset
    39
class HbToolBarExtension;
55
03646e8da489 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 46
diff changeset
    40
class HbPushButton;
46
23b5d6a29cce Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 35
diff changeset
    41
69
hgs
parents: 55
diff changeset
    42
enum HsStateContext {
hgs
parents: 55
diff changeset
    43
    HsAllAppsContext = 0,
46
23b5d6a29cce Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 35
diff changeset
    44
    HsAllCollectionsContext,
23b5d6a29cce Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 35
diff changeset
    45
    HsInstalledAppsContext,
23b5d6a29cce Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 35
diff changeset
    46
    HsCollectionContext,
69
hgs
parents: 55
diff changeset
    47
    InvalidStateContext
46
23b5d6a29cce Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 35
diff changeset
    48
};
23b5d6a29cce Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 35
diff changeset
    49
23b5d6a29cce Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 35
diff changeset
    50
enum HsOperationalContext {
69
hgs
parents: 55
diff changeset
    51
    HsItemViewContext = 0,
55
03646e8da489 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 46
diff changeset
    52
    HsButtonContext,
69
hgs
parents: 55
diff changeset
    53
    HsEmptyLabelContext,
hgs
parents: 55
diff changeset
    54
    InvalidOperationalContext
46
23b5d6a29cce Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 35
diff changeset
    55
};
23b5d6a29cce Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 35
diff changeset
    56
55
03646e8da489 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 46
diff changeset
    57
HS_STATES_TEST_CLASS(MenuStatesTest)
35
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    58
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    59
class HsMenuViewBuilder
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    60
{
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    61
public:
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    62
    HsMenuViewBuilder();
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    63
    ~HsMenuViewBuilder();
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    64
46
23b5d6a29cce Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 35
diff changeset
    65
    // mandatory context independent widgets accessors
35
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    66
    HbAction *allAppsAction() const;
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    67
    HbAction *allCollectionsAction() const;
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    68
    HbAction *searchAction() const;
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    69
    HbAction *oviStoreAction() const;
46
23b5d6a29cce Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 35
diff changeset
    70
    HbAction *operatorAction() const;
35
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    71
    HbToolBar *toolBar() const;
46
23b5d6a29cce Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 35
diff changeset
    72
    QActionGroup *toolBarActionGroup() const;
23b5d6a29cce Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 35
diff changeset
    73
    HbToolBarExtension *toolBarExtension() const;
23b5d6a29cce Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 35
diff changeset
    74
23b5d6a29cce Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 35
diff changeset
    75
    // mandatory context dependent widgets accessors
69
hgs
parents: 55
diff changeset
    76
    HbView *currentView();
hgs
parents: 55
diff changeset
    77
    HbListView *currentListView();
46
23b5d6a29cce Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 35
diff changeset
    78
23b5d6a29cce Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 35
diff changeset
    79
23b5d6a29cce Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 35
diff changeset
    80
    // optional widgets accessors
69
hgs
parents: 55
diff changeset
    81
    HbGroupBox *currentViewLabel();
hgs
parents: 55
diff changeset
    82
    HbPushButton *currentAddContentButton();
46
23b5d6a29cce Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 35
diff changeset
    83
23b5d6a29cce Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 35
diff changeset
    84
69
hgs
parents: 55
diff changeset
    85
    void setStateContext(HsStateContext stateContext);
46
23b5d6a29cce Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 35
diff changeset
    86
    void setOperationalContext(HsOperationalContext operationalContext);
23b5d6a29cce Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 35
diff changeset
    87
35
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    88
private:
69
hgs
parents: 55
diff changeset
    89
    typedef QPair<HsStateContext, HsOperationalContext> Context;
hgs
parents: 55
diff changeset
    90
    typedef QMap<Context, QSharedPointer<HbDocumentLoader> > LoaderMap;
hgs
parents: 55
diff changeset
    91
hgs
parents: 55
diff changeset
    92
    QSharedPointer<HbDocumentLoader>
hgs
parents: 55
diff changeset
    93
            parseDocument(const QString &documentBaseName);
35
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    94
69
hgs
parents: 55
diff changeset
    95
    QSharedPointer<HbDocumentLoader> readContextConfiguration();
46
23b5d6a29cce Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 35
diff changeset
    96
69
hgs
parents: 55
diff changeset
    97
    Context context() const;
46
23b5d6a29cce Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 35
diff changeset
    98
69
hgs
parents: 55
diff changeset
    99
    QSharedPointer<HbDocumentLoader> currentLoader();
46
23b5d6a29cce Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 35
diff changeset
   100
23b5d6a29cce Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 35
diff changeset
   101
23b5d6a29cce Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 35
diff changeset
   102
    QSet<QObject *> mLoadedObjects;
35
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   103
71
hgs
parents: 69
diff changeset
   104
35
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   105
    const QString ALL_APPS_ACTION_NAME;
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   106
    const QString ALL_COLLECTIONS_ACTION_NAME;
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   107
    const QString SEARCH_ACTION_NAME;
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   108
    const QString OVI_STORE_ACTION_NAME;
46
23b5d6a29cce Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 35
diff changeset
   109
    const QString OPERATOR_ACTION_NAME;
23b5d6a29cce Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 35
diff changeset
   110
23b5d6a29cce Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 35
diff changeset
   111
    QActionGroup *mToolBarActionGroup;
23b5d6a29cce Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 35
diff changeset
   112
    HbToolBar *mToolBar;
23b5d6a29cce Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 35
diff changeset
   113
    HbToolBarExtension *mToolBarExtension;
23b5d6a29cce Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 35
diff changeset
   114
    HbAction *mToolBarExtensionAction;
23b5d6a29cce Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 35
diff changeset
   115
69
hgs
parents: 55
diff changeset
   116
    HsStateContext mStateContext;
46
23b5d6a29cce Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 35
diff changeset
   117
    HsOperationalContext mOperationalContext;
55
03646e8da489 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 46
diff changeset
   118
03646e8da489 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 46
diff changeset
   119
    HS_STATES_TEST_FRIEND_CLASS(MenuStatesTest)
69
hgs
parents: 55
diff changeset
   120
hgs
parents: 55
diff changeset
   121
    LoaderMap mLoaderMap;
hgs
parents: 55
diff changeset
   122
    QSharedPointer<HbDocumentLoader> mCommonObjectsLoader;
35
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   123
};
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   124
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   125
#endif // HSMENUVIEWBUILDER_H