aboutsummaryrefslogtreecommitdiff
path: root/src/views/mspinnerview.h
blob: 2ec95bedf0685603988a31685073a5dd3cc1dc31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of libmeegotouch.
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/

#ifndef MSPINNERVIEW_H
#define MSPINNERVIEW_H

#include "mwidgetview.h"
#include <mprogressindicatormodel.h>
#include <mspinnerstyle.h>

class MSpinnerViewPrivate;
class MProgressIndicator;
class QGraphicsSceneResizeEvent;
class QTimerEvent;

/*!
    \class MSpinnerView
    \brief Spinner view for MProgressIndicator.

    \ingroup views

    \tableofcontents

    \section SpinnerOverview Overview
        Spinner rotates clockwise indefinitely until the process is finished or interrupted. Spinner is
        used only for unknown durations. It can can be placed anywhere in UI and also on top of other UI
        components to indicate ongoing processes. It should be used when the available space is limited.
        It can be used to indicate e.g. scanning or refreshing

        <TABLE border="0">
        <TR><TD> \image html circular_progress.png</TD>
            <TD> Progress indicator with spinner view.</TD></TR>
        </TABLE>

    \section SpinnerInteractions Interactions
        Spinner is always non-interactive.

    \section SpinnerOpenIssues Open issues
        \li Progress indicator shape, visualization, animation, size and possible subcomponents such
            as label and error notification? Nothing yet decided by UI/Graphics team, so far only concepting
            has been done.
        \li Layout: where to display the current status (%, time, data bytes) of the progress indication?
        \li Graphics

    \sa MProgressIndicator MProgressIndicatorModel MSpinnerStyle
*/

class M_EXPORT MSpinnerView : public MWidgetView
{
    Q_OBJECT
    M_VIEW(MProgressIndicatorModel, MSpinnerStyle)

public:
    /*!
     * \brief Constructor
     *
     * \param controller  Pointer to the progressindicator's controller
     */
    MSpinnerView(MProgressIndicator *controller);

    /*!
     * \brief Destructor
     */
    virtual ~MSpinnerView();

protected:
    //! \reimp
    virtual void drawContents(QPainter *painter, const QStyleOptionGraphicsItem *option) const;
    void resizeEvent(QGraphicsSceneResizeEvent *event);
    virtual void setupModel();
    virtual void applyStyle();
    //! \reimp_end
    MSpinnerViewPrivate *const d_ptr;

protected slots:
    //! \reimp
    virtual void updateData(const QList<const char *>& modifications);
    //! \reimp_end

private:
    Q_DISABLE_COPY(MSpinnerView)
    Q_DECLARE_PRIVATE(MSpinnerView)

    Q_PRIVATE_SLOT(d_func(), void visibilityChanged())
    Q_PRIVATE_SLOT(d_func(), void animationTimeout())
};

#endif // MSPINNERVIEW_H