aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/src-cpp/framework-OSInterface.h
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5/src-cpp/framework-OSInterface.h')
-rw-r--r--src-qt5/src-cpp/framework-OSInterface.h56
1 files changed, 47 insertions, 9 deletions
diff --git a/src-qt5/src-cpp/framework-OSInterface.h b/src-qt5/src-cpp/framework-OSInterface.h
index 3d64483d..f8345bac 100644
--- a/src-qt5/src-cpp/framework-OSInterface.h
+++ b/src-qt5/src-cpp/framework-OSInterface.h
@@ -77,10 +77,12 @@ public:
Q_INVOKABLE float batteryCharge();
Q_INVOKABLE bool batteryCharging();
Q_INVOKABLE double batterySecondsLeft();
+
// = Volume =
- Q_INVOKABLE bool volumeAvailable();
+ Q_INVOKABLE bool volumeSupported();
Q_INVOKABLE int volume();
Q_INVOKABLE void setVolume(int);
+
// = Network Information =
Q_INVOKABLE bool networkAvailable();
Q_INVOKABLE QString networkType(); //"wifi", "wired", "cell", "cell-2G", "cell-3G", "cell-4G"
@@ -88,6 +90,7 @@ public:
Q_INVOKABLE float networkStrength(); //percentage. ("wired" type should always be 100%)
Q_INVOKABLE QString networkHostname();
Q_INVOKABLE QHostAddress networkAddress();
+
// = Network Modification =
Q_INVOKABLE bool hasNetworkManager();
Q_INVOKABLE QString networkManagerUtility(); //binary name or *.desktop filename (if registered on the system)
@@ -95,7 +98,9 @@ public:
// = Media Shortcuts =
Q_INVOKABLE QStringList mediaDirectories(); //directory where XDG shortcuts are placed for interacting with media (local/remote)
Q_INVOKABLE QStringList mediaShortcuts(); //List of currently-available XDG shortcut file paths
+
// = Updates =
+ Q_INVOKABLE bool updatesSupported(); //is thie subsystem supported for the OS?
Q_INVOKABLE bool updatesAvailable();
Q_INVOKABLE QString updateDetails(); //Information about any available updates
Q_INVOKABLE bool updatesRunning();
@@ -104,8 +109,10 @@ public:
Q_INVOKABLE QString updateResults(); //Information about any finished update
Q_INVOKABLE void startUpdates();
Q_INVOKABLE bool updateOnlyOnReboot(); //Should the startUpdates function be called only when rebooting the system?
+ Q_INVOKABLE bool updateCausesReboot(); //Does the update power-cycle the system?
Q_INVOKABLE QDateTime lastUpdate(); //The date/time of the previous updates
Q_INVOKABLE QString lastUpdateResults(); //Information about the previously-finished update
+
// = System Power =
Q_INVOKABLE bool canReboot();
Q_INVOKABLE void startReboot();
@@ -113,17 +120,26 @@ public:
Q_INVOKABLE void startShutdown();
Q_INVOKABLE bool canSuspend();
Q_INVOKABLE void startSuspend();
+
// = Screen Brightness =
+ Q_INVOKABLE bool brightnessSupported(); //is this subsystem available for the OS?
Q_INVOKABLE int brightness(); //percentage: 0-100 with -1 for errors
Q_INVOKABLE void setBrightness(int);
+
// = System Status Monitoring
+ Q_INVOKABLE bool cpuSupported(); //is this subsystem available for the OS?
Q_INVOKABLE QList<int> cpuPercentage(); // (one per CPU) percentage: 0-100 with -1 for errors
Q_INVOKABLE QStringList cpuTemperatures(); // (one per CPU) Temperature of CPU ("50C" for example)
+
+ Q_INVOKABLE bool memorySupported(); //is this subsystem available for the OS?
Q_INVOKABLE int memoryUsedPercentage(); //percentage: 0-100 with -1 for errors
Q_INVOKABLE QString memoryTotal(); //human-readable form - does not tend to change within a session
Q_INVOKABLE QStringList diskIO(); //Returns list of current read/write stats for each device
+
+ Q_INVOKABLE bool diskSupported(); //is this subsystem available for the OS?
Q_INVOKABLE int fileSystemPercentage(QString dir); //percentage of capacity used: 0-100 with -1 for errors
Q_INVOKABLE QString fileSystemCapacity(QString dir); //human-readable form - total capacity
+
// = OS-Specific Utilities =
Q_INVOKABLE bool hasControlPanel();
Q_INVOKABLE QString controlPanelShortcut(); //relative *.desktop shortcut name (Example: "some_utility.desktop")
@@ -132,6 +148,9 @@ public:
Q_INVOKABLE bool hasAppStore();
Q_INVOKABLE QString appStoreShortcut(); //relative *.desktop shortcut name (Example: "some_utility.desktop")
+
+ // QML-Accessible properties/functions
+
private slots:
// ================
// SEMI-VIRTUAL FUNCTIONS - NEED TO BE DEFINED IN THE OS-SPECIFIC FILES
@@ -148,7 +167,13 @@ private slots:
void netRequestFinished(QNetworkReply*);
void netSslErrors(QNetworkReply*, const QList<QSslError>&);
//Timer slots
- void timerUpdate();
+ void BatteryTimerUpdate();
+ void UpdateTimerUpdate();
+ void BrightnessTimerUpdate();
+ void VolumeTimerUpdate();
+ void CpuTimerUpdate();
+ void MemTimerUpdate();
+ void DiskTimerUpdate();
signals:
void batteryChargeChanged();
@@ -164,6 +189,7 @@ signals:
private:
//Internal persistant data storage, OS-specific usage implementation
QHash< QString, QVariant> INFO;
+ bool _started;
// ============
// Internal possibilities for watching the system (OS-Specific usage/implementation)
@@ -175,14 +201,13 @@ private:
//Network Access Manager (check network connectivity, etc)
QNetworkAccessManager *netman;
//Timer for regular probes/updates
- QTimer *timer;
+ QTimer *batteryTimer, *updateTimer, *brightnessTimer, *volumeTimer, *cpuTimer, *memTimer, *diskTimer;
// Internal implifications for connecting the various watcher objects to their respective slots
// (OS-agnostic - defined in the "OSInterface_private.cpp" file)
void connectWatcher(); //setup the internal connections *only*
void connectIodevice(); //setup the internal connections *only*
void connectNetman(); //setup the internal connections *only*
- void connectTimer(); //setup the internal connections *only*
//Internal simplification routines
bool verifyAppOrBin(QString chk);
@@ -194,11 +219,24 @@ private:
// Qt-based NetworkAccessManager usage
void setupNetworkManager();
- //void setupBatteryMonitor(int update_ms);
- //void setupUpdateMonitor(int update_ms);
- //void setupBrightnessMonitor(int update_ms);
- //void setupVolumeMonitor(int update_ms);
- //void
+
+ // Timer-based monitors
+ void setupBatteryMonitor(int update_ms, int delay_ms);
+ void setupUpdateMonitor(int update_ms, int delay_ms);
+ void setupBrightnessMonitor(int update_ms, int delay_ms);
+ void setupVolumeMonitor(int update_ms, int delay_ms);
+ void setupCpuMonitor(int update_ms, int delay_ms);
+ void setupMemoryMonitor(int update_ms, int delay_ms);
+ void setupDiskMonitor(int update_ms, int delay_ms);
+
+ // Timer-based monitor update routines (NOTE: these are all run in a separate thread!!)
+ void syncBatteryInfo(OSInterface *os, QHash<QString, QVariant> *hash, QTimer *timer);
+ void syncUpdateInfo(OSInterface *os, QHash<QString, QVariant> *hash, QTimer *timer);
+ void syncBrightnessInfo(OSInterface *os, QHash<QString, QVariant> *hash, QTimer *timer);
+ void syncVolumeInfo(OSInterface *os, QHash<QString, QVariant> *hash, QTimer *timer);
+ void syncCpuInfo(OSInterface *os, QHash<QString, QVariant> *hash, QTimer *timer);
+ void syncMemoryInfo(OSInterface *os, QHash<QString, QVariant> *hash, QTimer *timer);
+ void syncDiskInfo(OSInterface *os, QHash<QString, QVariant> *hash, QTimer *timer);
public:
OSInterface(QObject *parent = 0);
bgstack15