~sil/ubuntu-keyboard/numbers-on-top-row

« back to all changes in this revision

Viewing changes to src/plugin/keyboardgeometry.h

  • Committer: Tarmac
  • Author(s): Guenter Schwann
  • Date: 2013-11-08 08:01:33 UTC
  • mfrom: (96.1.9 keyboard-size-in-mir)
  • Revision ID: tarmac-20131108080133-j08xha13k1kw2evl
Set the keyboard geometry from QML to C++, not the other way around. Fixes: https://bugs.launchpad.net/bugs/1245481.

Approved by Thomas Moenicke, PS Jenkins bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2013 Canonical, Ltd.
 
3
 *
 
4
 * Redistribution and use in source and binary forms, with or without modification,
 
5
 * are permitted provided that the following conditions are met:
 
6
 *
 
7
 * Redistributions of source code must retain the above copyright notice, this list
 
8
 * of conditions and the following disclaimer.
 
9
 * Redistributions in binary form must reproduce the above copyright notice, this list
 
10
 * of conditions and the following disclaimer in the documentation and/or other materials
 
11
 * provided with the distribution.
 
12
 * Neither the name of Nokia Corporation nor the names of its contributors may be
 
13
 * used to endorse or promote products derived from this software without specific
 
14
 * prior written permission.
 
15
 *
 
16
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
 
17
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 
18
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
 
19
 * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 
20
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 
21
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 
22
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 
23
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 
24
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
25
 *
 
26
 */
 
27
 
 
28
#ifndef KEYBOARDGEOMETRY_H
 
29
#define KEYBOARDGEOMETRY_H
 
30
 
 
31
#include <QObject>
 
32
#include <QRectF>
 
33
 
 
34
//! \brief The KeyboardGeometry class hold the geometry of the QML keyboard
 
35
//! representation
 
36
class KeyboardGeometry : public QObject
 
37
{
 
38
    Q_OBJECT
 
39
    Q_PROPERTY(int keypadHeight READ keypadHeight NOTIFY keypadHeightChanged)
 
40
    Q_PROPERTY(int canvasHeight READ canvasHeight NOTIFY canvasHeightChanged)
 
41
    Q_PROPERTY(QRectF visibleRect READ visibleRect WRITE setVisibleRect NOTIFY visibleRectChanged)
 
42
    Q_PROPERTY(Qt::ScreenOrientation orientation READ orientation NOTIFY orientationChanged)
 
43
    Q_PROPERTY(bool shown READ shown WRITE setShown NOTIFY shownChanged)
 
44
 
 
45
public:
 
46
    explicit KeyboardGeometry(QObject *parent = 0);
 
47
 
 
48
    int keypadHeight() const;
 
49
    void setKeypadHeight(int height);
 
50
 
 
51
    int canvasHeight() const;
 
52
    void setCanvasHeight(int height);
 
53
 
 
54
    const QRectF &visibleRect() const;
 
55
    Q_SLOT void setVisibleRect(const QRectF &rect);
 
56
 
 
57
    Qt::ScreenOrientation orientation() const;
 
58
    void setOrientation(Qt::ScreenOrientation orient);
 
59
 
 
60
    bool shown() const;
 
61
    Q_SLOT void setShown(bool show);
 
62
 
 
63
Q_SIGNALS:
 
64
    void keypadHeightChanged();
 
65
    void canvasHeightChanged();
 
66
    void visibleRectChanged();
 
67
    void orientationChanged();
 
68
    void shownChanged();
 
69
    
 
70
private:
 
71
    int m_keypadHeight;
 
72
    int m_canvasHeight;
 
73
    QRectF m_visibleRect;
 
74
    Qt::ScreenOrientation m_orientation;
 
75
    bool m_shown;
 
76
};
 
77
 
 
78
#endif // KEYBOARDGEOMETRY_H