aboutsummaryrefslogtreecommitdiff
path: root/src-qt5
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5')
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/StatusTray.qml1
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/status_tray/BatteryButton.qml2
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/status_tray/TrayIcon.qml1
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/status_tray/VolumeButton.qml16
-rw-r--r--src-qt5/src-cpp/framework-OSInterface.h2
-rw-r--r--src-qt5/src-cpp/framework-OSInterface_private.cpp40
6 files changed, 53 insertions, 9 deletions
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/StatusTray.qml b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/StatusTray.qml
index 8f2239b9..254ffff2 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/StatusTray.qml
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/StatusTray.qml
@@ -27,7 +27,6 @@ Rectangle {
//Volume Status
QML.VolumeButton{
- id: "volButton"
Layout.preferredHeight: status_tray.prefsize
Layout.preferredWidth: status_tray.prefsize
}
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/status_tray/BatteryButton.qml b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/status_tray/BatteryButton.qml
index 8ceec2d4..38ed6a64 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/status_tray/BatteryButton.qml
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/status_tray/BatteryButton.qml
@@ -13,7 +13,7 @@ import Lumina.Backend.OSInterface 2.0
ToolButton{
property OSInterface os: RootObject.os_interface()
id: "batButton"
- iconName: os.icon
+ iconName: os.batteryIcon
tooltip: os.batteryCharge+"%: "+os.batteryRemaining
visible: os.batteryAvailable()
enabled: false
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/status_tray/TrayIcon.qml b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/status_tray/TrayIcon.qml
index 4207b156..8b8367b0 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/status_tray/TrayIcon.qml
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/status_tray/TrayIcon.qml
@@ -6,6 +6,7 @@
//===========================================
import QtQuick 2.2
import QtQuick.Controls 2
+
import Lumina.Backend.NativeWindowObject 2.0
Rectangle{
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/status_tray/VolumeButton.qml b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/status_tray/VolumeButton.qml
index 43992fc4..e98a2603 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/status_tray/VolumeButton.qml
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/status_tray/VolumeButton.qml
@@ -7,7 +7,19 @@
import QtQuick 2.2
import QtQuick.Controls 1
+import Lumina.Backend.RootDesktopObject 2.0
+import Lumina.Backend.OSInterface 2.0
+
ToolButton{
- text: "volume"
- tooltip: "volume"
+ property OSInterface os: RootObject.os_interface()
+ id: "volButton"
+ iconName: os.volumeIcon
+ tooltip: os.volume+"%"
+ visible: os.volumeSupported()
+ enabled: os.hasAudioMixer()
+ //Simple launch of mixer at the moment - make this popup a menu later
+ onClicked: {
+ RootObject.launchApplication( os.audioMixerShortcut() )
+ }
+
}
diff --git a/src-qt5/src-cpp/framework-OSInterface.h b/src-qt5/src-cpp/framework-OSInterface.h
index c12561de..52ef6af7 100644
--- a/src-qt5/src-cpp/framework-OSInterface.h
+++ b/src-qt5/src-cpp/framework-OSInterface.h
@@ -45,6 +45,7 @@ class OSInterface : public QObject{
Q_PROPERTY( QString batteryIcon READ batteryIcon NOTIFY batteryChanged)
//Volume
Q_PROPERTY( int volume READ volume WRITE setVolume NOTIFY volumeChanged)
+ Q_PROPERTY( QString volumeIcon READ volumeIcon NOTIFY volumeChanged)
//Network
Q_PROPERTY( bool networkAvailable READ networkAvailable NOTIFY networkStatusChanged)
Q_PROPERTY( QString networkType READ networkType NOTIFY networkStatusChanged)
@@ -86,6 +87,7 @@ public:
Q_INVOKABLE bool volumeSupported();
Q_INVOKABLE int volume();
Q_INVOKABLE void setVolume(int);
+ Q_INVOKABLE QString volumeIcon();
// = Network Information =
Q_INVOKABLE bool networkAvailable();
diff --git a/src-qt5/src-cpp/framework-OSInterface_private.cpp b/src-qt5/src-cpp/framework-OSInterface_private.cpp
index 27bf910a..7b328849 100644
--- a/src-qt5/src-cpp/framework-OSInterface_private.cpp
+++ b/src-qt5/src-cpp/framework-OSInterface_private.cpp
@@ -212,7 +212,7 @@ QString OSInterface::networkStatus(){
//NetworkAccessManager slots
void OSInterface::netAccessChanged(QNetworkAccessManager::NetworkAccessibility stat){
- qDebug() << "[DEBUG] Got Net Access Changed";
+ //qDebug() << "[DEBUG] Got Net Access Changed";
INFO.insert("netaccess/available", stat== QNetworkAccessManager::Accessible);
//Update all the other network status info at the same time
QNetworkConfiguration active = netman->activeConfiguration();
@@ -271,7 +271,7 @@ void OSInterface::netAccessChanged(QNetworkAccessManager::NetworkAccessibility s
icon = "network-workgroup"; //failover to a generic "network" icon
}
INFO.insert("netaccess/icon",icon);
- qDebug() << "[DEBUG] Emit NetworkStatusChanged";
+ //qDebug() << "[DEBUG] Emit NetworkStatusChanged";
emit networkStatusChanged();
}
@@ -281,30 +281,37 @@ void OSInterface::netAccessChanged(QNetworkAccessManager::NetworkAccessibility s
// ========================
//Timer slots
void OSInterface::BatteryTimerUpdate(){
+ if(batteryTimer->isActive()){ batteryTimer->stop(); } //just in case this was manually triggered
QtConcurrent::run(this, &OSInterface::syncBatteryInfo, this, &INFO, batteryTimer);
}
void OSInterface::UpdateTimerUpdate(){
+ if(updateTimer->isActive()){ updateTimer->stop(); } //just in case this was manually triggered
QtConcurrent::run(this, &OSInterface::syncUpdateInfo, this, &INFO, updateTimer);
}
void OSInterface::BrightnessTimerUpdate(){
+ if(brightnessTimer->isActive()){ brightnessTimer->stop(); } //just in case this was manually triggered
QtConcurrent::run(this, &OSInterface::syncBrightnessInfo, this, &INFO, brightnessTimer);
}
void OSInterface::VolumeTimerUpdate(){
+ if(volumeTimer->isActive()){ volumeTimer->stop(); } //just in case this was manually triggered
QtConcurrent::run(this, &OSInterface::syncVolumeInfo, this, &INFO, volumeTimer);
}
void OSInterface::CpuTimerUpdate(){
+ if(cpuTimer->isActive()){ cpuTimer->stop(); } //just in case this was manually triggered
QtConcurrent::run(this, &OSInterface::syncCpuInfo, this, &INFO, cpuTimer);
}
void OSInterface::MemTimerUpdate(){
+ if(memTimer->isActive()){ memTimer->stop(); } //just in case this was manually triggered
QtConcurrent::run(this, &OSInterface::syncMemoryInfo, this, &INFO, memTimer);
}
void OSInterface::DiskTimerUpdate(){
+ if(diskTimer->isActive()){ diskTimer->stop(); } //just in case this was manually triggered
QtConcurrent::run(this, &OSInterface::syncDiskInfo, this, &INFO, diskTimer);
}
@@ -408,7 +415,18 @@ void OSInterface::syncBrightnessInfo(OSInterface *os, QHash<QString, QVariant> *
}
void OSInterface::syncVolumeInfo(OSInterface *os, QHash<QString, QVariant> *hash, QTimer *timer){
-
+ int oldvol = volume();
+ int newvol = OS_volume();
+ if(oldvol!=newvol){
+ hash->insert("volume/current",newvol);
+ QString icon;
+ if(newvol>66){ icon = "audio-volume-high"; }
+ else if(newvol>33){ icon = "audio-volume-medium"; }
+ else if(newvol>0){ icon = "audio-volume-low"; }
+ else{ icon = "audio-volume-muted"; }
+ hash->insert("volume/icon",icon);
+ os->emit volumeChanged();
+ }
QTimer::singleShot(0, timer, SLOT(start()));
}
@@ -448,8 +466,20 @@ QString OSInterface::batteryIcon(){
// = Volume =
bool OSInterface::volumeSupported(){ return OS_volumeSupported(); }
-int OSInterface::volume(){ return -1; }
-void OSInterface::setVolume(int){}
+int OSInterface::volume(){
+ if(INFO.contains("volume/current")){ return INFO.value("volume/current").toInt(); }
+ return 0;
+}
+
+void OSInterface::setVolume(int vol){
+ OS_setVolume(vol);
+ VolumeTimerUpdate(); //update the internal cache
+}
+
+QString OSInterface::volumeIcon(){
+ if(INFO.contains("volume/icon")){ return INFO.value("volume/icon").toString(); }
+ return "";
+}
// = Media =
QStringList OSInterface::mediaDirectories(){ return OS_mediaDirectories(); }
bgstack15