add support icons
[groove] / qmaemo5rotator.h
1 #ifndef QMAEMO5ROTATOR_H
2 #define QMAEMO5ROTATOR_H
3 //----------
4 // Provides a means of WORKING automatic rotation for Maemo 5 apps. (The default Qt solution is buggy.)
5 //----------
6
7 #include <Qt>
8 #include <QtGui>
9 #include <QtCore>
10
11 class QMaemo5Rotator : private QObject
12 {
13
14     Q_OBJECT
15
16 public:
17
18     enum RotationBehavior
19     {
20         AutomaticBehavior = 0,
21         LandscapeBehavior = 1,
22         PortraitBehavior = 2
23     };
24
25     enum Orientation
26     {
27         LandscapeOrientation = 0,
28         PortraitOrientation = 1
29     };
30
31 private:
32
33     bool isSetUp;
34     RotationBehavior _currentBehavior;
35     Orientation _currentOrientation;
36
37 public:
38
39     explicit QMaemo5Rotator(RotationBehavior behavior = LandscapeBehavior, QWidget *parent = NULL);
40     ~QMaemo5Rotator();
41
42     const RotationBehavior currentBehavior();
43     const Orientation currentOrientation();
44     void setCurrentBehavior(RotationBehavior value);
45     void setCurrentOrientation(Orientation value);
46
47 private slots:
48
49     void on_orientation_changed(const QString& newOrienation);
50
51 signals:
52
53     void orientationChanged(Orientation orientation);
54
55 };
56 #endif // QMAEMO5ROTATOR_H