30 #include <hbdevicedialogtrace_p.h> |
30 #include <hbdevicedialogtrace_p.h> |
31 #include <QTimer> |
31 #include <QTimer> |
32 #include <QTimerEvent> |
32 #include <QTimerEvent> |
33 |
33 |
34 /*! |
34 /*! |
|
35 @stable |
|
36 @hbwidgets |
35 \class HbDeviceNotificationDialog |
37 \class HbDeviceNotificationDialog |
36 \brief HbDeviceNotificationDialog is a non-modal dialog displayed on the top of |
38 \brief HbDeviceNotificationDialog is a non-modal dialog displayed on the top of |
37 running applications. Functionality is based on HbNotificationDialog and it uses |
39 running applications. Functionality is based on HbNotificationDialog and it uses |
38 HbDeviceDialog framework. |
40 HbDeviceDialog framework. |
39 |
41 |
44 It is recommended that the dialog data is initialized before calling show() or update() |
46 It is recommended that the dialog data is initialized before calling show() or update() |
45 methods, because those methods use interprocess communication. |
47 methods, because those methods use interprocess communication. |
46 |
48 |
47 Main use of HbDeviceNotificationDialog is to show information to user without user input. |
49 Main use of HbDeviceNotificationDialog is to show information to user without user input. |
48 |
50 |
49 \code |
51 \section _usecases HbDeviceNotificationDialog use cases |
50 Following code snippet creates a device notification dialog containing title, text and icon. |
52 |
51 |
53 Use cases in this section: |
|
54 - \ref _uc2 |
|
55 - \ref _uc2_001 |
|
56 - \ref _uc2_002 |
|
57 |
|
58 \subsection _uc2 Creating a device notification dialog |
|
59 |
|
60 The following code snippet creates a device notification dialog containing title, text and icon. |
|
61 |
|
62 \code |
52 QString iconName("C:/xxxx.png"); |
63 QString iconName("C:/xxxx.png"); |
53 |
64 |
54 HbDeviceNotificationDialog notificationDialog; |
65 HbDeviceNotificationDialog notificationDialog; |
55 notificationDialog.setIconName(iconName); |
66 notificationDialog.setIconName(iconName); |
56 notificationDialog.setTitle("Title"); |
67 notificationDialog.setTitle("Title"); |
64 HbDeviceNotificationDialog::notification(iconName, "Text", "Title"); |
75 HbDeviceNotificationDialog::notification(iconName, "Text", "Title"); |
65 \endcode |
76 \endcode |
66 |
77 |
67 When using convenience methods, it is not possible to receive user interaction events, |
78 When using convenience methods, it is not possible to receive user interaction events, |
68 because the HbDeviceNotificationDialog instance is destroyed when the call returns. Ownership |
79 because the HbDeviceNotificationDialog instance is destroyed when the call returns. Ownership |
69 and handling of the dialog is transferred to HbDeviceDialog framework. Also dialog can not |
80 and handling of the dialog is transferred to HbDeviceDialog framework. In this case the dialog |
70 be closed nor updated. |
81 can neither be closed nor updated programmatically. |
|
82 |
|
83 \subsection _uc2_001 Receiving user interactions events |
71 |
84 |
72 Below is an example of receiving user interaction events from device notification dialog. With |
85 Below is an example of receiving user interaction events from device notification dialog. With |
73 following example user is able to receive activated and close events. Note that |
86 following example user is able to receive activated and close events. Note that |
74 dialog is cancelled, if it goes out of scope. |
87 dialog is cancelled, if it goes out of scope. |
75 |
88 |
81 mNotificationDialog->setTitle("Title"); |
94 mNotificationDialog->setTitle("Title"); |
82 mNotificationDialog->setText("Text"); |
95 mNotificationDialog->setText("Text"); |
83 mNotificationDialog->show(); |
96 mNotificationDialog->show(); |
84 \endcode |
97 \endcode |
85 |
98 |
86 HbDeviceNotificationDialog supports animations. |
99 \subsection _uc2_002 Using animations in a device notification dialog |
|
100 |
|
101 HbDeviceNotificationDialog supports animations. |
87 Supported formats are the following. |
102 Supported formats are the following. |
88 |
103 |
89 - GIF (.gif) |
104 - GIF (.gif) |
90 - MNG (.mng) |
105 - MNG (.mng) |
91 - Frame animations |
106 - Frame animations (.axml) |
92 |
107 |
93 There is a built-in support for GIF and MNG animations. |
108 There is a built-in support for GIF and MNG animations. |
94 |
109 |
95 Frame animations can be created by following way: |
110 Frame animations can be used by first creating an animation definition file: |
96 |
111 |
97 \code |
112 \code |
98 Create an animation definition file. |
113 <animations> |
99 |
114 <icon name="frame_anim_looping" playmode="loop"> |
100 <animations> |
115 <frame duration="100">c:\icon1.svg</frame> |
101 <icon name="frame_anim_looping" playmode="loop"> |
116 <frame duration="200">c:\icon2.svg</frame> |
102 <frame duration="100">c:\icon1.svg</frame> |
117 <frame duration="300">c:\icon3.svg</frame> |
103 <frame duration="200">c:\icon2.svg</frame> |
118 </icon> |
104 <frame duration="300">c:\icon3.svg</frame> |
119 </animations> |
105 </icon> |
120 \endcode |
106 </animations> |
121 |
107 |
122 After this, create a HbDeviceNotificationDialog as described above and |
108 Create HbDeviceNotificationDialog in a way described before and |
123 set the definition file and the logical name of the animation: |
109 set definition file and animation's logical name. |
124 |
110 |
125 \code |
111 QString animationDefinitionXML("c:\animation.axml"); |
126 QString animationDefinitionXML("c:\animation.axml"); |
112 QString logicalIconName("frame_anim_looping"); |
127 QString logicalIconName("frame_anim_looping"); |
113 |
128 |
114 mNotificationDialog->setAnimationDefinition(animationDefinitionXML); |
129 mNotificationDialog->setAnimationDefinition(animationDefinitionXML); |
115 mNotificationDialog->setIconName(logicalIconName); |
130 mNotificationDialog->setIconName(logicalIconName); |
116 |
131 \endcode |
117 \endcode |
132 |
118 \sa HbIconAnimationManager::addDefinitionFile |
133 \sa HbIconAnimationManager::addDefinitionFile |
119 \note Animation definition files must be stored to a place where they |
134 \note Animation definition files must be stored in a place where they can |
120 can be accessed. |
135 be accessed. |
121 |
|
122 \beta |
|
123 \hbwidgets |
|
124 |
|
125 */ |
136 */ |
126 |
137 |
127 /*! |
138 /*! |
128 \fn void HbDeviceNotificationDialog::aboutToClose(); |
139 \fn void HbDeviceNotificationDialog::aboutToClose(); |
129 |
140 |
505 TRACE_EXIT |
516 TRACE_EXIT |
506 return d->mData["timeout"].toInt(); |
517 return d->mData["timeout"].toInt(); |
507 } |
518 } |
508 |
519 |
509 /*! |
520 /*! |
510 Get title text wrapping setting. |
521 Returns the style of text wrapping for the title. |
511 |
522 |
512 \sa setTitleTextWrapping() |
523 The default is Hb::TextWordWrap. |
513 */ |
524 |
|
525 \sa setTitleTextWrapping() |
|
526 */ |
514 Hb::TextWrapping HbDeviceNotificationDialog::titleTextWrapping() const |
527 Hb::TextWrapping HbDeviceNotificationDialog::titleTextWrapping() const |
515 { |
528 { |
516 TRACE_ENTRY |
529 TRACE_ENTRY |
517 Q_D(const HbDeviceNotificationDialog); |
530 Q_D(const HbDeviceNotificationDialog); |
518 TRACE_EXIT |
531 TRACE_EXIT |
519 return (Hb::TextWrapping)d->mData["titleTextWrapping"].toInt(); |
532 return (Hb::TextWrapping)d->mData["titleTextWrapping"].toInt(); |
520 } |
533 } |
521 |
534 |
522 /*! |
535 /*! |
523 Get title animation definition file name. |
536 Returns the animation definition file name. |
524 |
537 |
525 \sa setAnimationDefinition() |
538 \sa setAnimationDefinition() |
526 */ |
539 */ |
527 QString HbDeviceNotificationDialog::animationDefinition() const |
540 QString HbDeviceNotificationDialog::animationDefinition() const |
528 { |
541 { |