on xenial help sign in
Add a Status enum
8accd3eMichael Terry
Shell.qml+2−2
@@ -500,10 +500,10 @@ FocusScope {
500 onDisplayPowerStateChange: {
500 onDisplayPowerStateChange: {
501 // We ignore any display-off signals when the proximity sensor
501 // We ignore any display-off signals when the proximity sensor
502 // is active. This usually indicates something like a phone call.
502 // is active. This usually indicates something like a phone call.
503− if (state == 0 && (flags & Powerd.UseProximity) == 0) {
503+ if (state == Powerd.Off && (flags & Powerd.UseProximity) == 0) {
504 powerConnection.setFocused(false);
504 powerConnection.setFocused(false);
505 greeter.show();
505 greeter.show();
506− } else if (state == 1) {
506+ } else if (state == Powerd.On) {
507 powerConnection.setFocused(true);
507 powerConnection.setFocused(true);
508 }
508 }
509 }
509 }
plugins/Powerd/Powerd.h+10−3
@@ -26,19 +26,26 @@
26class Powerd: public QObject
26class Powerd: public QObject
27{
27{
28 Q_OBJECT
28 Q_OBJECT
29+ Q_ENUMS(Status)
29− Q_FLAGS(DisplayFlags)
30+ Q_FLAGS(DisplayFlag DisplayFlags)
30
31
31public:
32public:
32− enum DisplayFlags {
33+ enum DisplayFlag {
33 UseProximity = 1, // Use proximity sensor to override screen state
34 UseProximity = 1, // Use proximity sensor to override screen state
34 DisableAutoBrightness = 2, // Force autobrightness to be disabled
35 DisableAutoBrightness = 2, // Force autobrightness to be disabled
35 Bright = 4, // Request the screen to stay bright
36 Bright = 4, // Request the screen to stay bright
36 };
37 };
38+ Q_DECLARE_FLAGS(DisplayFlags, DisplayFlag)
39+
40+ enum Status {
41+ Off,
42+ On,
43+ };
37
44
38 explicit Powerd(QObject *parent = 0);
45 explicit Powerd(QObject *parent = 0);
39
46
40Q_SIGNALS:
47Q_SIGNALS:
41− void displayPowerStateChange(int state, unsigned int flags);
48+ void displayPowerStateChange(int status, unsigned int flags);
42
49
43private:
50private:
44 QDBusInterface *powerd;
51 QDBusInterface *powerd;
tests/mocks/Powerd/Powerd.h+10−3
@@ -24,19 +24,26 @@
24class Powerd: public QObject
24class Powerd: public QObject
25{
25{
26 Q_OBJECT
26 Q_OBJECT
27+ Q_ENUMS(Status)
27− Q_FLAGS(DisplayFlags)
28+ Q_FLAGS(DisplayFlag DisplayFlags)
28
29
29public:
30public:
30− enum DisplayFlags {
31+ enum DisplayFlag {
31 UseProximity = 1, // Use proximity sensor to override screen state
32 UseProximity = 1, // Use proximity sensor to override screen state
32 DisableAutoBrightness = 2, // Force autobrightness to be disabled
33 DisableAutoBrightness = 2, // Force autobrightness to be disabled
33 Bright = 4, // Request the screen to stay bright
34 Bright = 4, // Request the screen to stay bright
34 };
35 };
36+ Q_DECLARE_FLAGS(DisplayFlags, DisplayFlag)
37+
38+ enum Status {
39+ Off,
40+ On,
41+ };
35
42
36 explicit Powerd(QObject *parent = 0);
43 explicit Powerd(QObject *parent = 0);
37
44
38Q_SIGNALS:
45Q_SIGNALS:
39− void displayPowerStateChange(int state, unsigned int flags);
46+ void displayPowerStateChange(int status, unsigned int flags);
40};
47};
41
48
42#endif
49#endif