aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/lumina-desktop/desktop-plugins/systemmonitor
diff options
context:
space:
mode:
authorKen Moore <moorekou@gmail.com>2016-04-25 13:08:12 -0400
committerKen Moore <moorekou@gmail.com>2016-04-25 13:08:12 -0400
commited5ecf7ea7a482b4649e66ecb35fbc60af680684 (patch)
treeacc0fa17d228259e847f55c678db9fb0a9b50f0c /src-qt5/core/lumina-desktop/desktop-plugins/systemmonitor
parentMerge branch 'master' of github.com:pcbsd/lumina (diff)
downloadlumina-ed5ecf7ea7a482b4649e66ecb35fbc60af680684.tar.gz
lumina-ed5ecf7ea7a482b4649e66ecb35fbc60af680684.tar.bz2
lumina-ed5ecf7ea7a482b4649e66ecb35fbc60af680684.zip
Rearrange the Lumina source tree quite a bit:
Now the utilites are arranged by category (core, core-utils, desktop-utils), so all the -utils may be excluded by a package system (or turned into separate packages) as needed.
Diffstat (limited to 'src-qt5/core/lumina-desktop/desktop-plugins/systemmonitor')
-rw-r--r--src-qt5/core/lumina-desktop/desktop-plugins/systemmonitor/MonitorWidget.cpp63
-rw-r--r--src-qt5/core/lumina-desktop/desktop-plugins/systemmonitor/MonitorWidget.h62
-rw-r--r--src-qt5/core/lumina-desktop/desktop-plugins/systemmonitor/MonitorWidget.ui143
3 files changed, 268 insertions, 0 deletions
diff --git a/src-qt5/core/lumina-desktop/desktop-plugins/systemmonitor/MonitorWidget.cpp b/src-qt5/core/lumina-desktop/desktop-plugins/systemmonitor/MonitorWidget.cpp
new file mode 100644
index 00000000..951bcc98
--- /dev/null
+++ b/src-qt5/core/lumina-desktop/desktop-plugins/systemmonitor/MonitorWidget.cpp
@@ -0,0 +1,63 @@
+//===========================================
+// Lumina-DE source code
+// Copyright (c) 2015, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+#include "MonitorWidget.h"
+#include "ui_MonitorWidget.h"
+
+
+#include <LuminaXDG.h>
+#include <LuminaOS.h>
+
+MonitorWidget::MonitorWidget(QWidget *parent) : QWidget(parent), ui(new Ui::MonitorWidget()){
+ ui->setupUi(this); //load the designer form
+ upTimer = new QTimer(this);
+ upTimer->setInterval(2000); //update every 2 seconds
+ connect(upTimer, SIGNAL(timeout()), this, SLOT(UpdateStats()) );
+ LoadIcons();
+ upTimer->start();
+}
+
+MonitorWidget::~MonitorWidget(){
+ //qDebug() << "Removing MonitorWidget";
+}
+
+void MonitorWidget::LoadIcons(){
+ ui->tabWidget->setTabIcon(0,LXDG::findIcon("appointment-recurring","") ); //Summary
+ ui->tabWidget->setTabIcon(1,LXDG::findIcon("drive-harddisk","") ); //Disk Usage
+ //ui->tabWidget->setTabIcon(1,LXDG::findIcon("cpu","") ); //CPU Log
+ //ui->tabWidget->setTabIcon(2,LXDG::findIcon("media-flash-memory-stick","") ); //Mem Log
+}
+
+void MonitorWidget::UpdateStats(){
+ //qDebug() << "Updating System statistics...";
+ ui->label_temps->setText( LOS::CPUTemperatures().join(", ") );
+ if(ui->progress_cpu->isEnabled()){
+ int perc = LOS::CPUUsagePercent();
+ ui->progress_cpu->setValue(perc);
+ if(perc<0){ ui->progress_cpu->setEnabled(false); } //disable this for future checks
+ }
+ if(ui->progress_mem->isEnabled()){
+ int perc = LOS::MemoryUsagePercent();
+ ui->progress_mem->setValue(perc);
+ if(perc<0){ ui->progress_mem->setEnabled(false); } //disable this for future checks
+ }
+ ui->label_diskinfo->setText( LOS::DiskUsage().join("\n") );
+ //Also perform/update the logs as necessary
+ // -- TO DO --
+}
+
+SysMonitorPlugin::SysMonitorPlugin(QWidget *parent, QString ID) : LDPlugin(parent, ID){
+ monitor = new MonitorWidget(this);
+ this->setLayout( new QVBoxLayout() );
+ this->layout()->setContentsMargins(0,0,0,0);
+ this->layout()->addWidget(monitor);
+
+ //this->setInitialSize(monitor->sizeHint().width(),monitor->sizeHint().height());
+}
+
+SysMonitorPlugin::~SysMonitorPlugin(){
+ //qDebug() << "Remove SysMonitorPlugin";
+} \ No newline at end of file
diff --git a/src-qt5/core/lumina-desktop/desktop-plugins/systemmonitor/MonitorWidget.h b/src-qt5/core/lumina-desktop/desktop-plugins/systemmonitor/MonitorWidget.h
new file mode 100644
index 00000000..618ac8f4
--- /dev/null
+++ b/src-qt5/core/lumina-desktop/desktop-plugins/systemmonitor/MonitorWidget.h
@@ -0,0 +1,62 @@
+//===========================================
+// Lumina-DE source code
+// Copyright (c) 2015, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+// This plugin is a simple hardware status monitor on the desktop
+//===========================================
+#ifndef _LUMINA_DESKTOP_PLUGIN_HW_MONITOR_WIDGET_H
+#define _LUMINA_DESKTOP_PLUGIN_HW_MONITOR_WIDGET_H
+
+#include <QTimer>
+#include <QWidget>
+
+#include "../LDPlugin.h"
+
+namespace Ui{
+ class MonitorWidget;
+};
+
+class MonitorWidget : public QWidget{
+ Q_OBJECT
+public:
+ MonitorWidget(QWidget *parent = 0);
+ ~MonitorWidget();
+
+public slots:
+ void LoadIcons();
+
+private:
+ Ui::MonitorWidget *ui;
+ QTimer *upTimer;
+
+private slots:
+ void UpdateStats();
+};
+
+// Wrapper class to put this into a desktop plugin container
+class SysMonitorPlugin : public LDPlugin{
+ Q_OBJECT
+public:
+ SysMonitorPlugin(QWidget* parent, QString ID);
+ ~SysMonitorPlugin();
+
+ virtual QSize defaultPluginSize(){
+ // The returned QSize is in grid points (typically 100 or 200 pixels square)
+ return QSize(3,2);
+ }
+
+private:
+ MonitorWidget *monitor;
+
+public slots:
+ void LocaleChange(){
+ QTimer::singleShot(0,monitor, SLOT(LoadIcons()));
+ }
+ void ThemeChange(){
+ QTimer::singleShot(0,monitor, SLOT(LoadIcons()));
+ }
+};
+
+#endif
diff --git a/src-qt5/core/lumina-desktop/desktop-plugins/systemmonitor/MonitorWidget.ui b/src-qt5/core/lumina-desktop/desktop-plugins/systemmonitor/MonitorWidget.ui
new file mode 100644
index 00000000..8798bc25
--- /dev/null
+++ b/src-qt5/core/lumina-desktop/desktop-plugins/systemmonitor/MonitorWidget.ui
@@ -0,0 +1,143 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MonitorWidget</class>
+ <widget class="QWidget" name="MonitorWidget">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>300</width>
+ <height>122</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <property name="leftMargin">
+ <number>2</number>
+ </property>
+ <property name="topMargin">
+ <number>2</number>
+ </property>
+ <property name="rightMargin">
+ <number>2</number>
+ </property>
+ <property name="bottomMargin">
+ <number>2</number>
+ </property>
+ <item>
+ <widget class="QTabWidget" name="tabWidget">
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
+ <widget class="QWidget" name="tab_summary">
+ <attribute name="title">
+ <string>Summary</string>
+ </attribute>
+ <layout class="QFormLayout" name="formLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>CPU Temp:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLabel" name="label_temps">
+ <property name="text">
+ <string notr="true"/>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>CPU Usage:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QProgressBar" name="progress_cpu">
+ <property name="value">
+ <number>0</number>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>Mem Usage:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QProgressBar" name="progress_mem">
+ <property name="value">
+ <number>0</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="tab_disks">
+ <attribute name="title">
+ <string>Disk I/O</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QScrollArea" name="scrollArea">
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="widgetResizable">
+ <bool>true</bool>
+ </property>
+ <widget class="QWidget" name="scrollAreaWidgetContents">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>292</width>
+ <height>89</height>
+ </rect>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QLabel" name="label_diskinfo">
+ <property name="text">
+ <string notr="true"/>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
bgstack15