changeset 28 | b7da29130b0e |
parent 21 | 4633027730f5 |
child 30 | 80e4d18b72f5 |
23:e6ad4ef83b23 | 28:b7da29130b0e |
---|---|
275 } |
275 } |
276 } |
276 } |
277 } |
277 } |
278 |
278 |
279 /*! |
279 /*! |
280 \stable |
|
281 \hbwidgets |
|
282 |
|
280 \class HbDeviceProgressDialog |
283 \class HbDeviceProgressDialog |
281 \brief HbDeviceProgressDialog is a device dialog version of HbProgressDialog. |
284 \brief HbDeviceProgressDialog displays a progress dialog on top all applications. |
282 |
285 |
283 It displays a dialog with a wait animation or progress bar, text, icon or animation and a |
286 HbDeviceProgressDialog is a device-dialog version of HbProgressDialog. It is a modal |
287 dialog and displayed on top all applications by a device-dialog service. |
|
288 HbDeviceProgressDialog is a client of the service. |
|
289 |
|
290 HbDeviceProgressDialog provides a similar kind of interface as HbProgressDialog. |
|
291 Progress dialogs are always shown asynchronously as application needs to perform an operation |
|
292 and update the dialog while the dialog is showing. |
|
293 |
|
294 For content it provides wait animation or progress bar, text, icon or icon-animation and a |
|
284 cancel button. |
295 cancel button. |
285 |
296 |
286 Device dialogs are shown on top of any running applications and are always modal by nature. |
297 Two different dialogs are supported: wait and progress. Progress dialog displays a progress |
287 |
298 bar indicating progress of the operation. Wait dialog displays a wait animation in place of |
288 Two different dialogs are supported: wait and progress. The wait dialog displays an animated |
299 the progress bar. |
289 bar and progress dialog a progress bar indicating progress of the operation. |
300 |
290 |
301 Wait dialog is used when length of an operation cannot be determined beforehand. |
291 Wait dialog is used when length of an operation cannot be determined beforehand. It displays |
302 The dialog is closed by user pressing dialog cancel button or by an application closing |
292 an animated bar to indicate an action. The dialog is closed by the user pressing the cancel |
303 the dialog after the operation has finished by HbDeviceProgressDialog::close(). |
293 button, the application closing the dialog after the operation is finished. |
304 |
294 |
305 Progress dialog is used when the length of operation can be determined. beforehand. |
295 Progress dialog is used when the length of operation can be determined. For example |
306 For example when deleting a number of files, the progress could be shown as a |
296 when deleting a number of files, the progress of the operation could be shown as a |
|
297 percentage of the files deleted. Application updates the progress bar during the |
307 percentage of the files deleted. Application updates the progress bar during the |
298 operation. The dialog closes by user pressing the cancel button, the application closing the |
308 operation. The dialog closes by user pressing the cancel button, the application closing the |
299 dialog after the operation is finished or automatically when progress value reaches a |
309 dialog after the operation is finished or automatically when progress value reaches a |
300 maximum. |
310 maximum, HbDeviceProgressDialog::autoClose(). |
301 |
311 |
302 HbDeviceProgressDialog provides a similar kind of interface as HbProgressDialog, excluding |
312 Device progress dialog is launched when show() is called. Launched dialog can be updated by |
303 functions which handle concrete UI-component related information. Progress dialogs are |
313 setters. Changed properties are updated to the displayed dialog automatically next time event |
304 always asynchronous by as the client needs to perform the operation and update the dialog |
314 loop is entered or updated values can be sent immediately by calling update(). |
305 while the dialog is showing. |
|
306 |
|
307 Device progress dialog is launched when show() is called. Launched dialog can be updated by setters. |
|
308 Because updating a dialog requires interprocess communication, it's advisable to fully construct the |
315 Because updating a dialog requires interprocess communication, it's advisable to fully construct the |
309 progress dialog before calling show(). |
316 progress dialog before calling show(). |
310 |
317 |
311 Supported icon animation formats are following: |
318 An animation can replace an icon on device progress dialog. Supported icon animation formats are |
319 following: |
|
320 |
|
312 - GIF (.gif) |
321 - GIF (.gif) |
313 - MNG (.mng) |
322 - MNG (.mng) |
314 - Frame animations |
323 - Frame animations |
315 |
324 |
316 Sample code: |
325 \section _platform_spec Platform-specific implementation notes for HbDeviceProgressDialog |
317 |
326 |
318 An example showing the wait dialog: |
327 \subsection _nonsymbian Non-Symbian |
328 Device dialog service is implemented only for the Symbian platform. On other platforms device |
|
329 progress dialogs are displayed on client's main window. |
|
330 |
|
331 \section _code_samples Sample code |
|
332 |
|
333 An example showing a wait dialog: |
|
319 |
334 |
320 \code |
335 \code |
321 mDialog = new HbDeviceProgressDialog(HbProgressDialog::WaitDialog); |
336 mDialog = new HbDeviceProgressDialog(HbProgressDialog::WaitDialog); |
322 mDialog->setText("Connecting..."); |
337 mDialog->setText("Connecting..."); |
323 mDialog->show(); |
338 mDialog->show(); |
324 \endcode |
339 \endcode |
325 |
340 |
326 An example showing the progress dialog: |
341 An example showing a progress dialog: |
327 |
342 |
328 \include deviceprogressdialog/main.cpp |
343 \include tsrc/fute/ultimatecodesnippet/deviceprogressdialog.cpp |
329 |
344 |
330 Creating a frame animation. |
345 Showing an icon animation. |
331 |
346 |
332 Create an animation definition file: |
347 Create an animation definition file: |
333 \code |
348 \code |
334 <animations> |
349 <animations> |
335 <icon name="frame_anim_looping" playmode="loop"> |
350 <icon name="frame_anim_looping" playmode="loop"> |
351 msg->setIconName(logicalIconName); |
366 msg->setIconName(logicalIconName); |
352 msg->show(); |
367 msg->show(); |
353 \endcode |
368 \endcode |
354 |
369 |
355 \sa HbProgressDialog, HbDialog, HbDeviceDialog |
370 \sa HbProgressDialog, HbDialog, HbDeviceDialog |
356 \stable |
|
357 \hbwidgets |
|
358 */ |
371 */ |
359 |
372 |
360 /*! |
373 /*! |
361 \fn void HbDeviceProgressDialog::aboutToClose(); |
374 \fn void HbDeviceProgressDialog::aboutToClose(); |
362 |
375 |
412 d->init(HbProgressDialog::ProgressDialog); |
425 d->init(HbProgressDialog::ProgressDialog); |
413 TRACE_EXIT |
426 TRACE_EXIT |
414 } |
427 } |
415 |
428 |
416 /*! |
429 /*! |
417 Destructs the class. |
430 Destructor. |
418 */ |
431 */ |
419 HbDeviceProgressDialog::~HbDeviceProgressDialog() |
432 HbDeviceProgressDialog::~HbDeviceProgressDialog() |
420 { |
433 { |
421 TRACE_ENTRY |
434 TRACE_ENTRY |
422 delete d; |
435 delete d; |
423 TRACE_EXIT |
436 TRACE_EXIT |
424 } |
437 } |
425 |
438 |
426 /*! |
439 /*! |
427 Executes the dialog asynchronously. |
440 Shows a dialog and returns immediately without waiting for it to close. Closing |
441 is indicated by aboutToClose() signal. User cancellation is indicated by cancelled() |
|
442 signal. Button press is also indicated by QAction::triggered() signal. |
|
443 The dialog can be updated while showing by property setters. A new dialog is launched |
|
444 each time show() is called. |
|
445 |
|
446 \sa update(), aboutToClose(), cancelled() |
|
428 */ |
447 */ |
429 void HbDeviceProgressDialog::show() |
448 void HbDeviceProgressDialog::show() |
430 { |
449 { |
431 TRACE_ENTRY |
450 TRACE_ENTRY |
432 d->sendToServer(true); |
451 d->sendToServer(true); |
434 } |
453 } |
435 |
454 |
436 /*! |
455 /*! |
437 Updates changed properties of a launched progress dialog to device dialog service using |
456 Updates changed properties of a launched progress dialog to device dialog service using |
438 interprocess communication. Has no effect if show() has not been called or dialog has |
457 interprocess communication. Has no effect if show() has not been called or dialog has |
439 closed already. Calling show() is optional as updating any property schedules an event |
458 closed already. Calling update() is optional as updating any property schedules an event |
440 and the dialog is updated next time Qt event loop executes. |
459 and the dialog is updated next time Qt event loop executes. |
441 |
460 |
442 \sa show() |
461 \sa show() |
443 */ |
462 */ |
444 void HbDeviceProgressDialog::update() |
463 void HbDeviceProgressDialog::update() |
473 } |
492 } |
474 return 0; |
493 return 0; |
475 } |
494 } |
476 |
495 |
477 /*! |
496 /*! |
478 Sets the maximum value of the progress bar within the dialog. |
497 Sets progress bar maximum value. |
479 |
498 |
480 \sa maximum() |
499 \sa maximum() |
481 */ |
500 */ |
482 void HbDeviceProgressDialog::setMaximum(int max) |
501 void HbDeviceProgressDialog::setMaximum(int max) |
483 { |
502 { |
490 d->setProperty(HbDeviceProgressDialogPrivate::Maximum, max); |
509 d->setProperty(HbDeviceProgressDialogPrivate::Maximum, max); |
491 TRACE_EXIT |
510 TRACE_EXIT |
492 } |
511 } |
493 |
512 |
494 /*! |
513 /*! |
495 Returns the maximum value of the progress bar within the dialog. Default value is 100. |
514 Returns progress bar maximum value. Default value is 100. |
496 |
515 |
497 \sa setMaximum() |
516 \sa setMaximum() |
498 */ |
517 */ |
499 int HbDeviceProgressDialog::maximum() const |
518 int HbDeviceProgressDialog::maximum() const |
500 { |
519 { |
501 return d->mProperties[HbDeviceProgressDialogPrivate::Maximum].mValue.toInt(); |
520 return d->mProperties[HbDeviceProgressDialogPrivate::Maximum].mValue.toInt(); |
502 } |
521 } |
503 |
522 |
504 /*! |
523 /*! |
505 Sets the minimum value of the progress bar within the dialog. |
524 Sets progress bar minimum value. |
506 |
525 |
507 \sa minimum() |
526 \sa minimum() |
508 */ |
527 */ |
509 void HbDeviceProgressDialog::setMinimum(int min) |
528 void HbDeviceProgressDialog::setMinimum(int min) |
510 { |
529 { |
517 d->setProperty(HbDeviceProgressDialogPrivate::Minimum, min); |
536 d->setProperty(HbDeviceProgressDialogPrivate::Minimum, min); |
518 TRACE_EXIT |
537 TRACE_EXIT |
519 } |
538 } |
520 |
539 |
521 /*! |
540 /*! |
522 Returns the minimum value of the progress bar within the dialog. Default value is 0. |
541 Returns progress bar minimum value. Default value is 0. |
523 |
542 |
524 \sa setMinimum() |
543 \sa setMinimum() |
525 */ |
544 */ |
526 int HbDeviceProgressDialog::minimum() const |
545 int HbDeviceProgressDialog::minimum() const |
527 { |
546 { |
528 return d->mProperties[HbDeviceProgressDialogPrivate::Minimum].mValue.toInt(); |
547 return d->mProperties[HbDeviceProgressDialogPrivate::Minimum].mValue.toInt(); |
529 } |
548 } |
530 |
549 |
531 /*! |
550 /*! |
532 Sets the minimum and maximum value of the progress bar within the dialog. |
551 Sets progress bar minimum and maximum values. |
533 |
552 |
534 \sa minimum(), maximum() |
553 \sa minimum(), maximum() |
535 */ |
554 */ |
536 void HbDeviceProgressDialog::setRange(int min, int max) |
555 void HbDeviceProgressDialog::setRange(int min, int max) |
537 { |
556 { |
538 setMinimum(min); |
557 setMinimum(min); |
539 setMaximum(max); |
558 setMaximum(max); |
540 } |
559 } |
541 |
560 |
542 /*! |
561 /*! |
543 Sets the value of the progress bar within the dialog. |
562 Sets progress bar value. |
544 |
563 |
545 \sa progressValue() |
564 \sa progressValue() |
546 */ |
565 */ |
547 void HbDeviceProgressDialog::setProgressValue(int progressValue) |
566 void HbDeviceProgressDialog::setProgressValue(int progressValue) |
548 { |
567 { |
550 d->setProperty(HbDeviceProgressDialogPrivate::Value, progressValue); |
569 d->setProperty(HbDeviceProgressDialogPrivate::Value, progressValue); |
551 TRACE_EXIT |
570 TRACE_EXIT |
552 } |
571 } |
553 |
572 |
554 /*! |
573 /*! |
555 Returns the value of the progress bar within the dialog. |
574 Returns progress bar value. |
556 |
575 |
557 \sa setProgressValue() |
576 \sa setProgressValue() |
558 */ |
577 */ |
559 int HbDeviceProgressDialog::progressValue() const |
578 int HbDeviceProgressDialog::progressValue() const |
560 { |
579 { |
561 return d->mProperties[HbDeviceProgressDialogPrivate::Value].mValue.toInt(); |
580 return d->mProperties[HbDeviceProgressDialogPrivate::Value].mValue.toInt(); |
562 } |
581 } |
563 |
582 |
564 /*! |
583 /*! |
565 Sets the autoClose property value of the dialog. |
584 Sets dialog auto-closing. |
566 |
585 |
567 \param autoClose When set, the dialog is closed when value of the progress bar reaches |
586 \param autoClose When set, the dialog is closed when value of the progress bar reaches |
568 the maximum value of the progress bar. |
587 the maximum value of the progress bar. |
569 |
588 |
570 \sa autoClose() |
589 \sa autoClose() |
575 d->setProperty(HbDeviceProgressDialogPrivate::AutoClose, autoClose); |
594 d->setProperty(HbDeviceProgressDialogPrivate::AutoClose, autoClose); |
576 TRACE_EXIT |
595 TRACE_EXIT |
577 } |
596 } |
578 |
597 |
579 /*! |
598 /*! |
580 Returns the value of the autoClose property of the dialog. |
599 Returns auto-closing property of a dialog. |
581 |
600 |
582 The default value is true for HbProgressDialog::ProgressDialog and false |
601 The default value is true for HbProgressDialog::ProgressDialog and false |
583 for HbProgressDialog::WaitDialog. |
602 for HbProgressDialog::WaitDialog. |
584 |
603 |
585 \sa setAutoClose() |
604 \sa setAutoClose() |
588 { |
607 { |
589 return d->mProperties[HbDeviceProgressDialogPrivate::AutoClose].mValue.toInt(); |
608 return d->mProperties[HbDeviceProgressDialogPrivate::AutoClose].mValue.toInt(); |
590 } |
609 } |
591 |
610 |
592 /*! |
611 /*! |
593 Sets dialog's progress type. After setProgressType(), a new dialog is launched by a show(). |
612 Sets dialog's progress type. All dialog properties are initialized to default values. |
613 After setProgressType(), a new dialog is launched by a show(). |
|
594 |
614 |
595 \sa progressType() |
615 \sa progressType() |
596 */ |
616 */ |
597 void HbDeviceProgressDialog::setProgressType(HbProgressDialog::ProgressDialogType type) |
617 void HbDeviceProgressDialog::setProgressType(HbProgressDialog::ProgressDialogType type) |
598 { |
618 { |
614 return static_cast<HbProgressDialog::ProgressDialogType> |
634 return static_cast<HbProgressDialog::ProgressDialogType> |
615 (d->mProperties[HbDeviceProgressDialogPrivate::ProgressType].mValue.toInt()); |
635 (d->mProperties[HbDeviceProgressDialogPrivate::ProgressType].mValue.toInt()); |
616 } |
636 } |
617 |
637 |
618 /*! |
638 /*! |
619 Sets text of the dialog. |
639 Sets dialog text. |
620 |
640 |
621 \sa text() |
641 \sa text() |
622 */ |
642 */ |
623 void HbDeviceProgressDialog::setText(const QString &text) |
643 void HbDeviceProgressDialog::setText(const QString &text) |
624 { |
644 { |
626 d->setProperty(HbDeviceProgressDialogPrivate::Text, text); |
646 d->setProperty(HbDeviceProgressDialogPrivate::Text, text); |
627 TRACE_EXIT |
647 TRACE_EXIT |
628 } |
648 } |
629 |
649 |
630 /*! |
650 /*! |
631 Returns text of the dialog. |
651 Returns dialog text. |
652 |
|
632 \sa setText() |
653 \sa setText() |
633 */ |
654 */ |
634 QString HbDeviceProgressDialog::text() const |
655 QString HbDeviceProgressDialog::text() const |
635 { |
656 { |
636 return d->mProperties[HbDeviceProgressDialogPrivate::Text].mValue.toString(); |
657 return d->mProperties[HbDeviceProgressDialogPrivate::Text].mValue.toString(); |
693 return d->mProperties[HbDeviceProgressDialogPrivate::AnimationDefinition].mValue.toString(); |
714 return d->mProperties[HbDeviceProgressDialogPrivate::AnimationDefinition].mValue.toString(); |
694 } |
715 } |
695 |
716 |
696 /*! |
717 /*! |
697 Sets a new action into progress dialog. When users presses a button on dialog, triggered() |
718 Sets a new action into progress dialog. When users presses a button on dialog, triggered() |
698 signal of the action is emitted. HbDeviceProgressDialog constructor sets a default action |
719 signal of the action is emitted. HbDeviceProgressDialog sets a default action |
699 into a dialog. |
720 into a dialog on construction. |
700 |
721 |
701 \param action Action or Null. Ownership is not transferred. |
722 \param action Action or Null. Ownership is not transferred. |
702 \param role Selects an action to set. |
723 \param role Selects an action to set. |
703 |
724 |
704 \sa action() |
725 \sa action() |