Overte C++ Documentation
PlatformHelper.h
1 //
2 // Created by Bradley Austin Davis on 2019/08/22
3 // Copyright 2013-2019 High Fidelity, Inc.
4 //
5 // Distributed under the Apache License, Version 2.0.
6 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
7 //
8 
9 #pragma once
10 #ifndef hifi_shared_PlatformHelper_h
11 #define hifi_shared_PlatformHelper_h
12 
13 #include <atomic>
14 #include <QtCore/QtGlobal>
15 #include "../DependencyManager.h"
16 
17 class PlatformHelper : public QObject, public Dependency {
18  Q_OBJECT
19 public:
20  PlatformHelper() {}
21  virtual ~PlatformHelper() {}
22 
23  void onSleep();
24  void onWake();
25 
26 signals:
27  void systemWillSleep();
28  void systemWillWake();
29 
30 public:
31  // Run the per-platform code to instantiate a platform-dependent PlatformHelper dependency object
32  static void setup();
33  // Run the per-platform code to cleanly shutdown a platform-dependent PlatformHelper dependency object
34  static void shutdown();
35  // Fetch the platform specific instance of the helper
36  static PlatformHelper* instance();
37 
38  std::atomic<bool> _awake{ true };
39 };
40 
41 
42 
43 #endif