37
|
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:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef INFOWIDGET_H
|
|
19 |
#define INFOWIDGET_H
|
|
20 |
|
|
21 |
#include <hbwidget.h>
|
|
22 |
#include <QGraphicsSceneMouseEvent>
|
|
23 |
#include <QList>
|
|
24 |
#include <QFlags>
|
|
25 |
#include "infowidgetlayoutmanager.h"
|
|
26 |
|
|
27 |
class QLabel;
|
|
28 |
class QGraphicsLinearLayout;
|
|
29 |
class QTranslator;
|
|
30 |
class HbDialog;
|
|
31 |
class HbIconItem;
|
|
32 |
class HbMarqueeItem;
|
|
33 |
class HbLabel;
|
|
34 |
class HbCheckBox;
|
|
35 |
class HbPushButton;
|
|
36 |
class HbFrameDrawer;
|
|
37 |
class InfoWidgetEngine;
|
|
38 |
class InfoWidgetPreferences;
|
|
39 |
|
|
40 |
|
|
41 |
class InfoWidget : public HbWidget
|
|
42 |
{
|
|
43 |
Q_OBJECT
|
|
44 |
|
|
45 |
public:
|
|
46 |
InfoWidget(QGraphicsItem *parent = 0, Qt::WindowFlags flags = 0);
|
|
47 |
~InfoWidget();
|
|
48 |
|
|
49 |
public: // From QGraphicsItem.
|
|
50 |
QRectF boundingRect() const;
|
|
51 |
QPainterPath shape() const;
|
|
52 |
QSizeF sizeHint(Qt::SizeHint which, const QSizeF & constraint) const;
|
|
53 |
QSizePolicy sizePolicy () const;
|
|
54 |
|
|
55 |
public: // Property definitions
|
|
56 |
Q_PROPERTY(QString homeZoneDisplay READ homeZoneDisplay WRITE setHomeZoneDisplay)
|
|
57 |
Q_PROPERTY(QString mcnDisplay READ mcnDisplay WRITE setMcnDisplay)
|
|
58 |
Q_PROPERTY(QString activeLineDisplay READ activeLineDisplay WRITE setActiveLineDisplay)
|
|
59 |
Q_PROPERTY(QString satDisplay READ satDisplay WRITE setSatDisplay)
|
|
60 |
Q_PROPERTY(QString spnDisplay READ spnDisplay WRITE setSpnDisplay)
|
|
61 |
QString homeZoneDisplay();
|
|
62 |
void setHomeZoneDisplay(QString value);
|
|
63 |
QString mcnDisplay();
|
|
64 |
void setMcnDisplay(QString value);
|
|
65 |
QString activeLineDisplay();
|
|
66 |
void setActiveLineDisplay(QString value);
|
|
67 |
QString satDisplay();
|
|
68 |
void setSatDisplay(QString value);
|
|
69 |
QString spnDisplay();
|
|
70 |
void setSpnDisplay(QString value);
|
|
71 |
|
|
72 |
protected:
|
|
73 |
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
|
|
74 |
void mousePressEvent(QGraphicsSceneMouseEvent *event);
|
|
75 |
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
|
|
76 |
void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
|
|
77 |
|
|
78 |
void updateInfoDisplay();
|
|
79 |
bool readPersistentPreferences();
|
|
80 |
void initializeCheckBoxStates();
|
|
81 |
void changeEvent(QEvent *event);
|
|
82 |
bool installTranslator(QString translationFile);
|
|
83 |
void removeTranslators();
|
|
84 |
|
|
85 |
private:
|
|
86 |
void updateItemsVisibility();
|
|
87 |
void layoutInfoDisplay();
|
|
88 |
void layoutSettingsDisplay();
|
|
89 |
void initializeInfoDisplayItems();
|
|
90 |
void initializeSettingsDisplayItems();
|
|
91 |
void startChanges();
|
|
92 |
void endChanges();
|
|
93 |
|
|
94 |
public slots:
|
|
95 |
// Slots from HsWidget
|
|
96 |
void onInitialize();
|
|
97 |
void onUninitialize();
|
|
98 |
void onShow();
|
|
99 |
void onHide();
|
|
100 |
|
|
101 |
// Info widget specific slots
|
|
102 |
void readModel();
|
|
103 |
void handleModelError(int operation,int errorCode);
|
|
104 |
void spnDisplaySettingChanged(int state);
|
|
105 |
void mcnDisplaySettingChanged(int state);
|
|
106 |
void satDisplaySettingChanged(int state);
|
|
107 |
void settingsEditingFinished();
|
|
108 |
void settingsValidationFailed();
|
|
109 |
|
|
110 |
signals:
|
|
111 |
void setPreferences(const QStringList &names);
|
|
112 |
|
|
113 |
private:
|
|
114 |
Q_DISABLE_COPY(InfoWidget)
|
|
115 |
|
|
116 |
// Engine for widget
|
|
117 |
InfoWidgetEngine *m_engine;
|
|
118 |
|
|
119 |
// Widget preference store
|
|
120 |
InfoWidgetPreferences *m_preferences;
|
|
121 |
|
|
122 |
// Layout manager for widget
|
|
123 |
InfoWidgetLayoutManager *m_layoutManager;
|
|
124 |
|
|
125 |
QGraphicsLinearLayout *m_layout;
|
|
126 |
QList<QTranslator *> m_translators;
|
|
127 |
QColor m_backGroundColor;
|
|
128 |
HbFrameDrawer *m_frameDrawer;
|
|
129 |
bool m_layoutChanging;
|
|
130 |
bool m_dragEvent;
|
|
131 |
bool m_initialized;
|
|
132 |
};
|
|
133 |
|
|
134 |
|
|
135 |
#endif // INFOWIDGET_H
|
|
136 |
|