src/hbwidgets/devicedialogs/hbdeviceprogressdialog_p.h
changeset 0 16d8024aca5e
child 2 06ff229162e9
equal deleted inserted replaced
-1:000000000000 0:16d8024aca5e
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (developer.feedback@nokia.com)
       
     6 **
       
     7 ** This file is part of the HbWidgets module of the UI Extensions for Mobile.
       
     8 **
       
     9 ** GNU Lesser General Public License Usage
       
    10 ** This file may be used under the terms of the GNU Lesser General Public
       
    11 ** License version 2.1 as published by the Free Software Foundation and
       
    12 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
       
    13 ** Please review the following information to ensure the GNU Lesser General
       
    14 ** Public License version 2.1 requirements will be met:
       
    15 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    16 **
       
    17 ** In addition, as a special exception, Nokia gives you certain additional
       
    18 ** rights.  These rights are described in the Nokia Qt LGPL Exception
       
    19 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
       
    20 **
       
    21 ** If you have questions regarding the use of this file, please contact
       
    22 ** Nokia at developer.feedback@nokia.com.
       
    23 **
       
    24 ****************************************************************************/
       
    25 
       
    26 #ifndef HBDEVICEPROGRESSDIALOGPRIVATE_H
       
    27 #define HBDEVICEPROGRESSDIALOGPRIVATE_H
       
    28 
       
    29 #include <hbprogressdialog.h>
       
    30 #include <QVariantMap>
       
    31 
       
    32 #include <hbdevicedialog.h>
       
    33 #include "hbdeviceprogressdialog.h"
       
    34 
       
    35 class HbDeviceDialog;
       
    36 class QAction;
       
    37 
       
    38 class HbDeviceProgressDialogPrivate : public QObject
       
    39 {
       
    40     Q_OBJECT
       
    41 
       
    42 public:
       
    43     enum PropertySelector {
       
    44         ProgressType,
       
    45         Maximum,
       
    46         Minimum,
       
    47         Value,
       
    48         AutoClose,
       
    49         Text,
       
    50         TextAlignment,
       
    51         IconName,
       
    52         IconAlignment,
       
    53         AnimationDefinition,
       
    54         NumProperties
       
    55     };
       
    56     enum ActionSelector {
       
    57         InvalidSelector = -1,
       
    58         CancelButton,
       
    59         NumActions
       
    60     };
       
    61     enum PropertyFlag {
       
    62         NoFlags = 0,
       
    63         Modified = 1,
       
    64         SentToServer = 2
       
    65     };
       
    66     Q_DECLARE_FLAGS(PropertyFlags, PropertyFlag)
       
    67 
       
    68     struct Property {
       
    69         QVariant mValue;
       
    70         PropertyFlags mFlags;
       
    71     };
       
    72     struct Action {
       
    73         QAction *mAction;
       
    74         PropertyFlags mFlags;
       
    75         bool mTriggered;
       
    76     };
       
    77 
       
    78 public:
       
    79     HbDeviceProgressDialogPrivate();
       
    80     virtual ~HbDeviceProgressDialogPrivate();
       
    81 
       
    82     void initProperties(HbProgressDialog::ProgressDialogType type);
       
    83     void sendToServer(bool show = false);
       
    84     bool propertiesModified() const;
       
    85     void clearActions();
       
    86     void setProperty(PropertySelector propertySelector, int value);
       
    87     void setProperty(PropertySelector propertySelector, const QString &value);
       
    88 
       
    89     void cancel();
       
    90     void init(HbProgressDialog::ProgressDialogType type);
       
    91 
       
    92     void scheduleUpdateEvent();
       
    93     void timerEvent(QTimerEvent *event);
       
    94 
       
    95     static ActionSelector actionSelector(HbDeviceProgressDialog::ActionRole role);
       
    96 
       
    97 public slots:
       
    98     void aboutToClose();
       
    99     void dataReceived(QVariantMap data);
       
   100 
       
   101 public: // data
       
   102     friend class HbDeviceProgressDialog;
       
   103 
       
   104     HbDeviceProgressDialog *q;
       
   105     HbDeviceDialog mDeviceDialog;
       
   106     bool mVisible;
       
   107     int mUpdateTimerId;
       
   108     Property  mProperties[NumProperties];
       
   109     QAction *mDefaultActions[NumActions];
       
   110     Action mActions[NumActions];
       
   111 };
       
   112 
       
   113 #endif // HBDEVICEPROGRESSDIALOGPRIVATE_H