on xenial help sign in
Add a Status enum
commit8accd3e3c074767d1abbd06518f28905137b6c28 authorMichael Terry <michael.terry@canonical.com> dateTue 20 Aug 2013, 18:36 (13 years ago) parent3c5f8cd
3 files changed+22−8
Shell.qml+2−2 plugins/Powerd/Powerd.h+10−3 tests/mocks/Powerd/Powerd.h+10−3
Shell.qml+2−2
@@ -500,10 +500,10 @@ FocusScope {
500500 onDisplayPowerStateChange: {
501501 // We ignore any display-off signals when the proximity sensor
502502 // 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) {
504504 powerConnection.setFocused(false);
505505 greeter.show();
506− } else if (state == 1) {
506+ } else if (state == Powerd.On) {
507507 powerConnection.setFocused(true);
508508 }
509509 }
plugins/Powerd/Powerd.h+10−3
@@ -26,19 +26,26 @@
2626class Powerd: public QObject
2727{
2828 Q_OBJECT
29− Q_FLAGS(DisplayFlags)
29+ Q_ENUMS(Status)
30+ Q_FLAGS(DisplayFlag DisplayFlags)
3031
3132public:
32− enum DisplayFlags {
33+ enum DisplayFlag {
3334 UseProximity = 1, // Use proximity sensor to override screen state
3435 DisableAutoBrightness = 2, // Force autobrightness to be disabled
3536 Bright = 4, // Request the screen to stay bright
3637 };
38+ Q_DECLARE_FLAGS(DisplayFlags, DisplayFlag)
39+
40+ enum Status {
41+ Off,
42+ On,
43+ };
3744
3845 explicit Powerd(QObject *parent = 0);
3946
4047Q_SIGNALS:
41− void displayPowerStateChange(int state, unsigned int flags);
48+ void displayPowerStateChange(int status, unsigned int flags);
4249
4350private:
4451 QDBusInterface *powerd;
tests/mocks/Powerd/Powerd.h+10−3
@@ -24,19 +24,26 @@
2424class Powerd: public QObject
2525{
2626 Q_OBJECT
27− Q_FLAGS(DisplayFlags)
27+ Q_ENUMS(Status)
28+ Q_FLAGS(DisplayFlag DisplayFlags)
2829
2930public:
30− enum DisplayFlags {
31+ enum DisplayFlag {
3132 UseProximity = 1, // Use proximity sensor to override screen state
3233 DisableAutoBrightness = 2, // Force autobrightness to be disabled
3334 Bright = 4, // Request the screen to stay bright
3435 };
36+ Q_DECLARE_FLAGS(DisplayFlags, DisplayFlag)
37+
38+ enum Status {
39+ Off,
40+ On,
41+ };
3542
3643 explicit Powerd(QObject *parent = 0);
3744
3845Q_SIGNALS:
39− void displayPowerStateChange(int state, unsigned int flags);
46+ void displayPowerStateChange(int status, unsigned int flags);
4047};
4148
4249#endif