diff options
-rw-r--r-- | libLumina/LuminaOS-Debian.cpp | 3 | ||||
-rw-r--r-- | libLumina/LuminaOS-DragonFly.cpp | 3 | ||||
-rw-r--r-- | libLumina/LuminaOS-FreeBSD.cpp | 21 | ||||
-rw-r--r-- | libLumina/LuminaOS-Linux.cpp | 4 | ||||
-rw-r--r-- | libLumina/LuminaOS-OpenBSD.cpp | 4 | ||||
-rw-r--r-- | libLumina/LuminaOS-kFreeBSD.cpp | 3 | ||||
-rw-r--r-- | libLumina/LuminaOS-template.cpp | 3 | ||||
-rw-r--r-- | libLumina/LuminaOS.h | 3 | ||||
-rw-r--r-- | lumina-desktop/desktop-plugins/systemmonitor/MonitorWidget.cpp | 6 | ||||
-rw-r--r-- | lumina-desktop/desktop-plugins/systemmonitor/MonitorWidget.ui | 60 |
10 files changed, 99 insertions, 11 deletions
diff --git a/libLumina/LuminaOS-Debian.cpp b/libLumina/LuminaOS-Debian.cpp index d1d5d344..82374fed 100644 --- a/libLumina/LuminaOS-Debian.cpp +++ b/libLumina/LuminaOS-Debian.cpp @@ -269,4 +269,7 @@ int LOS::MemoryUsagePercent(){ return qRound(per); } +QStringList LOS::DiskUsage(){ //Returns: List of current read/write stats for each device + return QStringList(); //not implemented yet +} #endif diff --git a/libLumina/LuminaOS-DragonFly.cpp b/libLumina/LuminaOS-DragonFly.cpp index dde24d0c..79f84e65 100644 --- a/libLumina/LuminaOS-DragonFly.cpp +++ b/libLumina/LuminaOS-DragonFly.cpp @@ -207,4 +207,7 @@ int LOS::MemoryUsagePercent(){ return -1; //not implemented yet } +QStringList LOS::DiskUsage(){ //Returns: List of current read/write stats for each device + return QStringList(); //not implemented yet +} #endif diff --git a/libLumina/LuminaOS-FreeBSD.cpp b/libLumina/LuminaOS-FreeBSD.cpp index ae394f38..fe001ab2 100644 --- a/libLumina/LuminaOS-FreeBSD.cpp +++ b/libLumina/LuminaOS-FreeBSD.cpp @@ -325,4 +325,25 @@ int LOS::MemoryUsagePercent(){ return qRound(perc); } +QStringList LOS::DiskUsage(){ //Returns: List of current read/write stats for each device + QStringList info = LUtils::getCmdOutput("iostat -dx -t IDE -t SCSI -t da"); + if(info.length()<3){ return QStringList(); } //nothing from command + QStringList labs = info[1].split(" ",QString::SkipEmptyParts); + QStringList out; + QString fmt = "%1: %2 %3"; + for(int i=2; i<info.length(); i++){ //skip the first two lines, just labels + info[i].replace("\t"," "); + if(i==1){ labs = info[i].split(" ", QString::SkipEmptyParts); }//the labels for each column + else{ + QStringList data = info[i].split(" ",QString::SkipEmptyParts); //data[0] is always the device + qDebug() << "Data Line:" << data; + if(data.length()>2 && labs.length()>2){ + out << fmt.arg(data[0], data[1]+" "+labs[1], data[2]+" "+labs[2]); + } + } + } + + return out; +} + #endif diff --git a/libLumina/LuminaOS-Linux.cpp b/libLumina/LuminaOS-Linux.cpp index 2368f773..ebf49a08 100644 --- a/libLumina/LuminaOS-Linux.cpp +++ b/libLumina/LuminaOS-Linux.cpp @@ -235,4 +235,8 @@ int LOS::MemoryUsagePercent(){ return -1; //not implemented yet } +QStringList LOS::DiskUsage(){ //Returns: List of current read/write stats for each device + return QStringList(); //not implemented yet +} + #endif diff --git a/libLumina/LuminaOS-OpenBSD.cpp b/libLumina/LuminaOS-OpenBSD.cpp index 10bb4e15..f33fed97 100644 --- a/libLumina/LuminaOS-OpenBSD.cpp +++ b/libLumina/LuminaOS-OpenBSD.cpp @@ -244,4 +244,8 @@ int LOS::MemoryUsagePercent(){ return -1; //not implemented yet } +QStringList LOS::DiskUsage(){ //Returns: List of current read/write stats for each device + return QStringList(); //not implemented yet +} + #endif diff --git a/libLumina/LuminaOS-kFreeBSD.cpp b/libLumina/LuminaOS-kFreeBSD.cpp index 8954d685..91de843c 100644 --- a/libLumina/LuminaOS-kFreeBSD.cpp +++ b/libLumina/LuminaOS-kFreeBSD.cpp @@ -185,5 +185,8 @@ int LOS::MemoryUsagePercent(){ return -1; //not implemented yet } +QStringList LOS::DiskUsage(){ //Returns: List of current read/write stats for each device + return QStringList(); //not implemented yet +} #endif #endif diff --git a/libLumina/LuminaOS-template.cpp b/libLumina/LuminaOS-template.cpp index eb233913..298f9ddd 100644 --- a/libLumina/LuminaOS-template.cpp +++ b/libLumina/LuminaOS-template.cpp @@ -133,4 +133,7 @@ int LOS::MemoryUsagePercent(){ return -1; //not implemented yet } +QStringList LOS::DiskUsage(){ //Returns: List of current read/write stats for each device + return QStringList(); //not implemented yet +} #endif diff --git a/libLumina/LuminaOS.h b/libLumina/LuminaOS.h index 738be5e4..2780c80c 100644 --- a/libLumina/LuminaOS.h +++ b/libLumina/LuminaOS.h @@ -1,6 +1,6 @@ //=========================================== // Lumina-DE source code -// Copyright (c) 2014, Ken Moore +// Copyright (c) 2014-15, Ken Moore // Available under the 3-clause BSD license // See the LICENSE file for full details //=========================================== @@ -96,6 +96,7 @@ public: static QStringList CPUTemperatures(); //Returns: List containing the temperature of any CPU's ("50C" for example) static int CPUUsagePercent(); //Returns: Overall percentage of the amount of CPU cycles in use (-1 for errors) static int MemoryUsagePercent(); //Returns: Overall percentage of the amount of available memory in use (-1 for errors) + static QStringList DiskUsage(); //Returns: List of current read/write stats for each device }; #endif diff --git a/lumina-desktop/desktop-plugins/systemmonitor/MonitorWidget.cpp b/lumina-desktop/desktop-plugins/systemmonitor/MonitorWidget.cpp index f5bff7b3..0d568a45 100644 --- a/lumina-desktop/desktop-plugins/systemmonitor/MonitorWidget.cpp +++ b/lumina-desktop/desktop-plugins/systemmonitor/MonitorWidget.cpp @@ -26,8 +26,9 @@ MonitorWidget::~MonitorWidget(){ void MonitorWidget::LoadIcons(){ ui->tabWidget->setTabIcon(0,LXDG::findIcon("appointment-recurring","") ); //Summary - ui->tabWidget->setTabIcon(1,LXDG::findIcon("cpu","") ); //CPU Log - ui->tabWidget->setTabIcon(2,LXDG::findIcon("media-flash-memory-stick","") ); //Mem Log + 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(){ @@ -43,6 +44,7 @@ void MonitorWidget::UpdateStats(){ 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 -- } diff --git a/lumina-desktop/desktop-plugins/systemmonitor/MonitorWidget.ui b/lumina-desktop/desktop-plugins/systemmonitor/MonitorWidget.ui index c3a58017..0c1fd500 100644 --- a/lumina-desktop/desktop-plugins/systemmonitor/MonitorWidget.ui +++ b/lumina-desktop/desktop-plugins/systemmonitor/MonitorWidget.ui @@ -31,7 +31,7 @@ <property name="currentIndex"> <number>0</number> </property> - <widget class="QWidget" name="tab"> + <widget class="QWidget" name="tab_summary"> <attribute name="title"> <string>Summary</string> </attribute> @@ -80,15 +80,59 @@ </item> </layout> </widget> - <widget class="QWidget" name="tab_2"> + <widget class="QWidget" name="tab_disks"> <attribute name="title"> - <string>CPU Log</string> - </attribute> - </widget> - <widget class="QWidget" name="tab_3"> - <attribute name="title"> - <string>Memory Log</string> + <string>Disk Usage</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>90</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> |