aboutsummaryrefslogtreecommitdiff
path: root/src/corelib/video/mvideowidgetmodel.h
blob: d61d2aaea979a0e9b80bd79e599dd3596b001a81 (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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/* * This file is part of libmeegotouch *
 *
 * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 *
 * Contact: Tomas Junnonen <tomas.junnonen@nokia.com>
 *
 * This software, including documentation, is protected by copyright
 * controlled by Nokia Corporation. All rights are reserved. Copying,
 * including reproducing, storing, adapting or translating, any or all of
 * this material requires the prior written consent of Nokia Corporation.
 * This material also contains confidential information which may not be
 * disclosed to others without the prior written consent of Nokia.
 */
#ifndef MVIDEOWIDGETMODEL_H
#define MVIDEOWIDGETMODEL_H

#include <mwidgetmodel.h>
#include "mvideo.h"

/*!
    \class MVideoWidgetModel
    \brief Data model class for MVideoWidget.

    \ingroup models
    \sa MVideoWidget
*/
class M_CORE_EXPORT MVideoWidgetModel : public MWidgetModel
{
    Q_OBJECT
    M_MODEL_INTERNAL(MVideoWidgetModel)

public:
    enum Scale
    {
        ScaleDisabled,
        ScaleToFit
    };

    enum AspectRatio
    {
        AspectRatioOriginal,
        AspectRatioScaled
    };

    /*!
        \property MVideoWidgetModel::state
        \brief Current state of the video playback. 
    */
    M_MODEL_PROPERTY(MVideo::State, state, State, true, MVideo::NotReady)

    /*!
        \property MVideoWidgetModel::filename
        \brief Name of the opened video file. 
    */
    M_MODEL_PROPERTY(QString, filename, Filename, true, QString())

    /*!
        \property MVideoWidgetModel::length
        \brief Length of the opened video in milliseconds. 
    */
    M_MODEL_PROPERTY(quint64, length, Length, true, 0)

    /*!
        \property MVideoWidgetModel::position
        \brief Current position of the played video in milliseconds. 
    */
    M_MODEL_PROPERTY(quint64, position, Position, true, 0)

    /*!
        \property MVideoWidgetModel::looping
        \brief Boolean flag defining whether video is looping automatically. 
    */
    M_MODEL_PROPERTY(bool, looping, Looping, true, true)

    /*!
        \property MVideoWidgetModel::scaleMode
        \brief Defines how the video is scaled to the canvas.
    */
    M_MODEL_PROPERTY(MVideoWidgetModel::Scale, scaleMode, ScaleMode, true, MVideoWidgetModel::ScaleToFit)

    /*!
        \property MVideoWidgetModel::aspectRatio
        \brief Defines how to set up aspect ratio for the video.
    */
    M_MODEL_PROPERTY(MVideoWidgetModel::AspectRatio, aspectRatioMode, AspectRatioMode, true, MVideoWidgetModel::AspectRatioOriginal)

    /*!
        \property MVideoWidgetModel::keepAspectRatio
        \brief Boolean flag defining if the video should be displayed in 
               fullscreen mode.
    */
    M_MODEL_PROPERTY(bool, fullscreen, Fullscreen, true, false)

    /*!
        \property MVideoWidgetModel::mute
        \brief Boolean flag defining audio of video should be muted. 
    */
    M_MODEL_PROPERTY(bool, muted, Muted, true, false)

    /*!
        \property MVideoWidgetModel::volume
        \brief Current audio volume of played video. 
    */
    M_MODEL_PROPERTY(qreal, volume, Volume, true, 1.0)

public:

    /*!
        \brief Update the MVideoWidgetModel::position property without emitting the change signal. 
    */
    void setPositionNoEmit(const qint64& pos) 
    {
        _position() = pos;
    }
};

#endif