├── icon.rc ├── icons ├── up.ico ├── clock.ico ├── down.ico ├── flag.ico ├── graph.ico ├── icon.ico ├── left.ico ├── plus.ico ├── right.ico ├── star.ico ├── tick.ico ├── tools.ico ├── user.ico ├── zoom.ico ├── cancel.ico ├── clipboard.ico ├── multiply.ico ├── piechart.ico └── settings.ico ├── images ├── cd.png ├── cpu.png ├── home.png ├── mac.png ├── ram.png ├── camera.png ├── floppy.png ├── folder.png ├── linux.png ├── splash.png ├── system.png ├── trash.png ├── Printer 1.png ├── console.png └── windows.png ├── defs.h ├── README.md ├── .gitignore ├── images.qrc ├── resourceswidget.h ├── QtSysMonitor.pro ├── platforminfo.h ├── aboutdialog.h ├── aboutdialog.cpp ├── diskinfo.cpp ├── sysinfofactory.h ├── settingsdialog.h ├── systemmonitor.h ├── processwidget.h ├── diskinfo.h ├── main.cpp ├── settingsdialog.cpp ├── qfilelogger.h ├── mainwindow.h ├── platforminfo.cpp ├── qfilelogger.cpp ├── aboutdialog.ui ├── batteryinfo.h ├── networksocket.h ├── resourceswidget.cpp ├── process.h ├── processwidget.cpp ├── disk.h ├── process.cpp ├── networksocket.cpp ├── systemutil.h ├── disk.cpp ├── systemmonitor.cpp ├── settingsdialog.ui ├── batteryinfo.cpp ├── mainwindow.cpp ├── mainwindow.ui ├── systemutil.cpp └── LICENSE /icon.rc: -------------------------------------------------------------------------------- 1 | IDI_ICON1 ICON DISCARDABLE "icons/icon.ico" -------------------------------------------------------------------------------- /icons/up.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoic1979/QtSysMonitor/HEAD/icons/up.ico -------------------------------------------------------------------------------- /icons/clock.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoic1979/QtSysMonitor/HEAD/icons/clock.ico -------------------------------------------------------------------------------- /icons/down.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoic1979/QtSysMonitor/HEAD/icons/down.ico -------------------------------------------------------------------------------- /icons/flag.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoic1979/QtSysMonitor/HEAD/icons/flag.ico -------------------------------------------------------------------------------- /icons/graph.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoic1979/QtSysMonitor/HEAD/icons/graph.ico -------------------------------------------------------------------------------- /icons/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoic1979/QtSysMonitor/HEAD/icons/icon.ico -------------------------------------------------------------------------------- /icons/left.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoic1979/QtSysMonitor/HEAD/icons/left.ico -------------------------------------------------------------------------------- /icons/plus.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoic1979/QtSysMonitor/HEAD/icons/plus.ico -------------------------------------------------------------------------------- /icons/right.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoic1979/QtSysMonitor/HEAD/icons/right.ico -------------------------------------------------------------------------------- /icons/star.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoic1979/QtSysMonitor/HEAD/icons/star.ico -------------------------------------------------------------------------------- /icons/tick.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoic1979/QtSysMonitor/HEAD/icons/tick.ico -------------------------------------------------------------------------------- /icons/tools.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoic1979/QtSysMonitor/HEAD/icons/tools.ico -------------------------------------------------------------------------------- /icons/user.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoic1979/QtSysMonitor/HEAD/icons/user.ico -------------------------------------------------------------------------------- /icons/zoom.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoic1979/QtSysMonitor/HEAD/icons/zoom.ico -------------------------------------------------------------------------------- /images/cd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoic1979/QtSysMonitor/HEAD/images/cd.png -------------------------------------------------------------------------------- /images/cpu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoic1979/QtSysMonitor/HEAD/images/cpu.png -------------------------------------------------------------------------------- /images/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoic1979/QtSysMonitor/HEAD/images/home.png -------------------------------------------------------------------------------- /images/mac.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoic1979/QtSysMonitor/HEAD/images/mac.png -------------------------------------------------------------------------------- /images/ram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoic1979/QtSysMonitor/HEAD/images/ram.png -------------------------------------------------------------------------------- /icons/cancel.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoic1979/QtSysMonitor/HEAD/icons/cancel.ico -------------------------------------------------------------------------------- /images/camera.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoic1979/QtSysMonitor/HEAD/images/camera.png -------------------------------------------------------------------------------- /images/floppy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoic1979/QtSysMonitor/HEAD/images/floppy.png -------------------------------------------------------------------------------- /images/folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoic1979/QtSysMonitor/HEAD/images/folder.png -------------------------------------------------------------------------------- /images/linux.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoic1979/QtSysMonitor/HEAD/images/linux.png -------------------------------------------------------------------------------- /images/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoic1979/QtSysMonitor/HEAD/images/splash.png -------------------------------------------------------------------------------- /images/system.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoic1979/QtSysMonitor/HEAD/images/system.png -------------------------------------------------------------------------------- /images/trash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoic1979/QtSysMonitor/HEAD/images/trash.png -------------------------------------------------------------------------------- /icons/clipboard.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoic1979/QtSysMonitor/HEAD/icons/clipboard.ico -------------------------------------------------------------------------------- /icons/multiply.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoic1979/QtSysMonitor/HEAD/icons/multiply.ico -------------------------------------------------------------------------------- /icons/piechart.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoic1979/QtSysMonitor/HEAD/icons/piechart.ico -------------------------------------------------------------------------------- /icons/settings.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoic1979/QtSysMonitor/HEAD/icons/settings.ico -------------------------------------------------------------------------------- /images/Printer 1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoic1979/QtSysMonitor/HEAD/images/Printer 1.png -------------------------------------------------------------------------------- /images/console.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoic1979/QtSysMonitor/HEAD/images/console.png -------------------------------------------------------------------------------- /images/windows.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoic1979/QtSysMonitor/HEAD/images/windows.png -------------------------------------------------------------------------------- /defs.h: -------------------------------------------------------------------------------- 1 | #ifndef DEFS_H 2 | #define DEFS_H 3 | 4 | 5 | #define ST_SUCCESS 1 6 | #define ST_FAILED 0 7 | #define ERROR_MESSAGE "ERROR OCCURRED !!" 8 | 9 | #endif // DEFS_H 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # QtSysMonitor 2 | System monitoring tool developed in Qt for Windows, Linux and Mac Desktops 3 | 4 | 5 | # Troubleshooting 6 | 7 | If you get link error for Graphics Library on LInux, 8 | /usr/bin/ld: cannot find -lGL 9 | 10 | Try this fix: 11 | $ sudo apt-get install libgl1-mesa-dev 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # C++ objects and libs 2 | 3 | *.slo 4 | *.lo 5 | *.o 6 | *.a 7 | *.la 8 | *.lai 9 | *.so 10 | *.dll 11 | *.dylib 12 | 13 | # Qt-es 14 | 15 | /.qmake.cache 16 | /.qmake.stash 17 | *.pro.user 18 | *.pro.user.* 19 | *.qbs.user 20 | *.qbs.user.* 21 | *.moc 22 | moc_*.cpp 23 | qrc_*.cpp 24 | ui_*.h 25 | Makefile* 26 | *build-* 27 | 28 | # QtCreator 29 | 30 | *.autosave 31 | 32 | # QtCtreator Qml 33 | *.qmlproject.user 34 | *.qmlproject.user.* 35 | 36 | # QtCtreator CMake 37 | CMakeLists.txt.user 38 | 39 | -------------------------------------------------------------------------------- /images.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | images/camera.png 4 | images/cd.png 5 | images/console.png 6 | images/floppy.png 7 | images/folder.png 8 | images/home.png 9 | images/Printer 1.png 10 | images/system.png 11 | images/trash.png 12 | images/splash.png 13 | images/linux.png 14 | images/cpu.png 15 | images/ram.png 16 | 17 | 18 | -------------------------------------------------------------------------------- /resourceswidget.h: -------------------------------------------------------------------------------- 1 | #ifndef RESOURCESWIDGET_H 2 | #define RESOURCESWIDGET_H 3 | 4 | #include 5 | #include 6 | 7 | #include "systemutil.h" 8 | 9 | class ResourcesWidget : public QWidget 10 | { 11 | Q_OBJECT 12 | public: 13 | explicit ResourcesWidget(QTableWidget *wid, QWidget *parent = 0); 14 | ~ResourcesWidget(); 15 | 16 | private: 17 | SystemUtil *utilities; 18 | QTableWidget *widget; 19 | 20 | signals: 21 | void refreshData(); 22 | 23 | public slots: 24 | void populateUi(); 25 | void deleteAllocatedItems(); 26 | void refreshTimer(); 27 | }; 28 | 29 | #endif // RESOURCESWIDGET_H 30 | -------------------------------------------------------------------------------- /QtSysMonitor.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2016-11-18T18:41:16 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += core gui charts 8 | 9 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 10 | 11 | TARGET = QtSysMonitor 12 | TEMPLATE = app 13 | 14 | RC_FILE = icon.rc 15 | 16 | SOURCES += main.cpp\ 17 | mainwindow.cpp \ 18 | systemmonitor.cpp \ 19 | diskinfo.cpp \ 20 | qfilelogger.cpp \ 21 | aboutdialog.cpp \ 22 | settingsdialog.cpp \ 23 | platforminfo.cpp \ 24 | process.cpp \ 25 | disk.cpp \ 26 | networksocket.cpp \ 27 | batteryinfo.cpp \ 28 | systemutil.cpp \ 29 | processwidget.cpp \ 30 | resourceswidget.cpp 31 | 32 | HEADERS += mainwindow.h \ 33 | systemmonitor.h \ 34 | diskinfo.h \ 35 | qfilelogger.h \ 36 | aboutdialog.h \ 37 | settingsdialog.h \ 38 | platforminfo.h \ 39 | process.h \ 40 | disk.h \ 41 | networksocket.h \ 42 | batteryinfo.h \ 43 | defs.h \ 44 | systemutil.h \ 45 | processwidget.h \ 46 | resourceswidget.h \ 47 | sysinfofactory.h 48 | 49 | 50 | FORMS += mainwindow.ui \ 51 | aboutdialog.ui \ 52 | settingsdialog.ui 53 | 54 | RESOURCES += \ 55 | images.qrc 56 | 57 | DISTFILES += \ 58 | images/linux.png \ 59 | images/mac.png \ 60 | images/windows.png 61 | -------------------------------------------------------------------------------- /platforminfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ----------------------------------- 3 | * QtSysMonitor 4 | * ----------------------------------- 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * --------------------------------------------------------------------------- 20 | * Started By: Navjot Singh in November 2016 21 | * 22 | * Organization:Weavebytes Infotech Pvt Ltd 23 | * --------------------------------------------------------------------------- 24 | */ 25 | 26 | #ifndef PLATFORMINFO_H 27 | #define PLATFORMINFO_H 28 | 29 | #include 30 | 31 | class PlatformInfo : public QObject 32 | { 33 | Q_OBJECT 34 | public: 35 | explicit PlatformInfo(QObject *parent = 0); 36 | 37 | QString getOsName(); 38 | QString getCpuArchitecture(); 39 | 40 | signals: 41 | 42 | public slots: 43 | }; 44 | 45 | #endif // PLATFORMINFO_H 46 | -------------------------------------------------------------------------------- /aboutdialog.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ----------------------------------- 3 | * QtSysMonitor 4 | * ----------------------------------- 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * --------------------------------------------------------------------------- 20 | * Started By: Navjot Singh in November 2016 21 | * 22 | * Organization:Weavebytes Infotech Pvt Ltd 23 | * --------------------------------------------------------------------------- 24 | */ 25 | 26 | #ifndef ABOUTDIALOG_H 27 | #define ABOUTDIALOG_H 28 | 29 | #include 30 | 31 | namespace Ui { 32 | class AboutDialog; 33 | } 34 | 35 | class AboutDialog : public QDialog 36 | { 37 | Q_OBJECT 38 | 39 | public: 40 | explicit AboutDialog(QWidget *parent = 0); 41 | ~AboutDialog(); 42 | 43 | private: 44 | Ui::AboutDialog *ui; 45 | }; 46 | 47 | #endif // ABOUTDIALOG_H 48 | -------------------------------------------------------------------------------- /aboutdialog.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * ----------------------------------- 3 | * QtSysMonitor 4 | * ----------------------------------- 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * --------------------------------------------------------------------------- 20 | * Started By: Navjot Singh in November 2016 21 | * 22 | * Organization:Weavebytes Infotech Pvt Ltd 23 | * --------------------------------------------------------------------------- 24 | */ 25 | 26 | #include "aboutdialog.h" 27 | #include "ui_aboutdialog.h" 28 | 29 | AboutDialog::AboutDialog(QWidget *parent) : 30 | QDialog(parent), 31 | ui(new Ui::AboutDialog) 32 | { 33 | ui->setupUi(this); 34 | 35 | setModal(true); 36 | setFixedSize(width(), height()); 37 | 38 | ui->lblIcon->setPixmap(QPixmap(":/images/system.png")); 39 | } 40 | 41 | AboutDialog::~AboutDialog() 42 | { 43 | delete ui; 44 | } 45 | -------------------------------------------------------------------------------- /diskinfo.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * ----------------------------------- 3 | * QtSysMonitor 4 | * ----------------------------------- 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * --------------------------------------------------------------------------- 20 | * Started By: Navjot Singh in November 2016 21 | * 22 | * Organization:Weavebytes Infotech Pvt Ltd 23 | * --------------------------------------------------------------------------- 24 | */ 25 | 26 | #include "diskinfo.h" 27 | 28 | #include 29 | 30 | DiskInfo::DiskInfo(QObject *parent) : QObject(parent) 31 | { 32 | // pass 33 | } 34 | 35 | /** 36 | * @brief DiskInfo::getDisksInfo 37 | * 38 | * Function will fetch disks info 39 | * and emit signal with disks info 40 | */ 41 | void DiskInfo::getDisksInfo() { 42 | 43 | qDebug() << "[DiskInfo] getting disks' info..."; 44 | 45 | // ToDo: emit signal with disks info 46 | } 47 | -------------------------------------------------------------------------------- /sysinfofactory.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ----------------------------------- 3 | * QtSysMonitor 4 | * ----------------------------------- 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * --------------------------------------------------------------------------- 20 | * Started By: Navjot Singh in November 2016 21 | * 22 | * Organization: Weavebytes Infotech Pvt Ltd 23 | * --------------------------------------------------------------------------- 24 | */ 25 | 26 | #ifndef SYSINFOFACTORY_H 27 | #define SYSINFOFACTORY_H 28 | 29 | #include "batteryinfo.h" 30 | #include "diskinfo.h" 31 | #include "platforminfo.h" 32 | 33 | /** 34 | * Abstract Factory for creating various system info objects/elements 35 | * depending upon the features and type of platform/OS - Linux, Windows, Mac 36 | */ 37 | class SysInfoFactory { 38 | 39 | public: 40 | virtual BatteryInfo* createBatteryInfo() = 0; 41 | virtual DiskInfo* createDiskInfo() = 0; 42 | virtual PlatformInfo* createPlatformInfo() = 0; 43 | 44 | }; 45 | 46 | #endif // SYSINFOFACTORY_H 47 | -------------------------------------------------------------------------------- /settingsdialog.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ----------------------------------- 3 | * QtSysMonitor 4 | * ----------------------------------- 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * --------------------------------------------------------------------------- 20 | * Started By: Navjot Singh in November 2016 21 | * 22 | * Organization:Weavebytes Infotech Pvt Ltd 23 | * --------------------------------------------------------------------------- 24 | */ 25 | 26 | #ifndef SETTINGSDIALOG_H 27 | #define SETTINGSDIALOG_H 28 | 29 | #include 30 | #include 31 | 32 | namespace Ui { 33 | class SettingsDialog; 34 | } 35 | 36 | class SettingsDialog : public QDialog 37 | { 38 | Q_OBJECT 39 | 40 | public: 41 | explicit SettingsDialog(QWidget *parent = 0); 42 | ~SettingsDialog(); 43 | QSettings settings; 44 | 45 | private slots: 46 | void on_btnSaveSettings_clicked(); 47 | 48 | void on_btnCancelSettings_clicked(); 49 | 50 | signals: 51 | void settingsChanged(); 52 | 53 | private: 54 | Ui::SettingsDialog *ui; 55 | }; 56 | 57 | #endif // SETTINGSDIALOG_H 58 | -------------------------------------------------------------------------------- /systemmonitor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ----------------------------------- 3 | * QtSysMonitor 4 | * ----------------------------------- 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * --------------------------------------------------------------------------- 20 | * Started By: Navjot Singh in November 2016 21 | * 22 | * Organization:Weavebytes Infotech Pvt Ltd 23 | * --------------------------------------------------------------------------- 24 | */ 25 | 26 | #ifndef SYSTEMMONITOR_H 27 | #define SYSTEMMONITOR_H 28 | 29 | #include 30 | 31 | 32 | 33 | class SystemMonitor : public QObject 34 | { 35 | Q_OBJECT 36 | public: 37 | explicit SystemMonitor(QObject *parent = 0); 38 | 39 | /** 40 | * Returns the size of physical memory (RAM) in bytes. 41 | */ 42 | size_t getMemorySize(); 43 | 44 | 45 | /** 46 | * @brief getMemorySizeStr 47 | * @return String description of memory, eg. 4GB etc. 48 | */ 49 | QString getMemorySizeStr(); 50 | 51 | signals: 52 | 53 | public slots: 54 | }; 55 | 56 | #endif // SYSTEMMONITOR_H 57 | -------------------------------------------------------------------------------- /processwidget.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ----------------------------------- 3 | * QtSysMonitor 4 | * ----------------------------------- 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * --------------------------------------------------------------------------- 20 | * Started By: Navjot Singh in November 2016 21 | * 22 | * Organization:Weavebytes Infotech Pvt Ltd 23 | * --------------------------------------------------------------------------- 24 | */ 25 | 26 | #ifndef USERINTERFACE_H 27 | #define USERINTERFACE_H 28 | 29 | #include 30 | #include 31 | #include "systemutil.h" 32 | 33 | /** 34 | * @brief The ProcessWidget class 35 | * 36 | * Description: 37 | * 38 | * This class shows the list of processes running on the system 39 | */ 40 | class ProcessWidget : public QWidget { 41 | Q_OBJECT 42 | 43 | public: 44 | explicit ProcessWidget(QTableWidget *wid, QWidget *parent = 0); 45 | ~ProcessWidget(); 46 | 47 | 48 | private: 49 | QTableWidget *widget; 50 | 51 | signals: 52 | void refreshData(); 53 | 54 | public slots: 55 | void populateUi(); 56 | void deleteAllocatedItems(); 57 | void refreshTimer(); 58 | 59 | }; 60 | 61 | #endif // USERINTERFACE_H 62 | -------------------------------------------------------------------------------- /diskinfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ----------------------------------- 3 | * QtSysMonitor 4 | * ----------------------------------- 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * --------------------------------------------------------------------------- 20 | * Started By: Navjot Singh in November 2016 21 | * 22 | * Organization:Weavebytes Infotech Pvt Ltd 23 | * --------------------------------------------------------------------------- 24 | */ 25 | 26 | #ifndef DISKINFO_H 27 | #define DISKINFO_H 28 | 29 | #include 30 | 31 | /** 32 | * @brief The DiskInfo class 33 | * 34 | * Class for getting information for disks/partitions on system, 35 | * their total disk size, used/free space etc. 36 | */ 37 | class DiskInfo : public QObject 38 | { 39 | Q_OBJECT 40 | public: 41 | explicit DiskInfo(QObject *parent = 0); 42 | 43 | /** 44 | * @brief getDisksInfo 45 | * Function gets latest information about all disks 46 | * 47 | * Note:- 48 | * ------ 49 | * Qt will be using platform specific source codes for 50 | * Linux, Mac, Windows to obtain this informaiton. 51 | */ 52 | void getDisksInfo(); 53 | 54 | signals: 55 | 56 | public slots: 57 | }; 58 | 59 | #endif // DISKINFO_H 60 | -------------------------------------------------------------------------------- /main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * ----------------------------------- 3 | * QtSysMonitor 4 | * ----------------------------------- 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * --------------------------------------------------------------------------- 20 | * Started By: Navjot Singh in November 2016 21 | * 22 | * Organization:Weavebytes Infotech Pvt Ltd 23 | * --------------------------------------------------------------------------- 24 | */ 25 | 26 | #include "mainwindow.h" 27 | #include 28 | 29 | #include 30 | #include 31 | 32 | int main(int argc, char *argv[]) 33 | { 34 | QApplication app(argc, argv); 35 | 36 | QApplication::setOrganizationDomain("weavebytes.com"); 37 | QApplication::setOrganizationName("Weave Bytes"); 38 | QApplication::setApplicationName("QtSysMonitor"); 39 | 40 | // showing splash 41 | QPixmap pixmap(":images/splash.png"); 42 | QSplashScreen splash(pixmap); 43 | splash.show(); 44 | splash.showMessage("Loading Please Wait..."); 45 | 46 | app.processEvents(); 47 | 48 | // showing main window 49 | MainWindow w; 50 | w.show(); 51 | 52 | // hiding splash 53 | splash.hide(); 54 | 55 | return app.exec(); 56 | } 57 | -------------------------------------------------------------------------------- /settingsdialog.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * ----------------------------------- 3 | * QtSysMonitor 4 | * ----------------------------------- 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * --------------------------------------------------------------------------- 20 | * Started By: Navjot Singh in November 2016 21 | * 22 | * Organization:Weavebytes Infotech Pvt Ltd 23 | * --------------------------------------------------------------------------- 24 | */ 25 | 26 | #include "settingsdialog.h" 27 | #include "ui_settingsdialog.h" 28 | 29 | #include 30 | #include 31 | 32 | SettingsDialog::SettingsDialog(QWidget *parent) : 33 | QDialog(parent), 34 | ui(new Ui::SettingsDialog) 35 | { 36 | ui->setupUi(this); 37 | 38 | setModal(true); 39 | setFixedSize(width(), height()); 40 | 41 | ui->processSpinBox->setValue(settings.value("timer/process").toInt()); 42 | ui->socketSpinBox->setValue(settings.value("timer/socket").toInt()); 43 | } 44 | 45 | SettingsDialog::~SettingsDialog() 46 | { 47 | delete ui; 48 | } 49 | 50 | void SettingsDialog::on_btnSaveSettings_clicked() 51 | { 52 | QSpinBox *box = ui->processSpinBox; 53 | settings.setValue("timer/process",box->value()); 54 | box = ui->socketSpinBox; 55 | settings.setValue("timer/socket",box->value()); 56 | emit settingsChanged(); 57 | hide(); 58 | } 59 | 60 | void SettingsDialog::on_btnCancelSettings_clicked() 61 | { 62 | hide(); 63 | } 64 | -------------------------------------------------------------------------------- /qfilelogger.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ----------------------------------- 3 | * QtSysMonitor 4 | * ----------------------------------- 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * --------------------------------------------------------------------------- 20 | * Started By: Navjot Singh in November 2016 21 | * 22 | * Organization:Weavebytes Infotech Pvt Ltd 23 | * --------------------------------------------------------------------------- 24 | */ 25 | 26 | #ifndef QFILELOGGER_H 27 | #define QFILELOGGER_H 28 | 29 | #include 30 | #include 31 | 32 | namespace logger { 33 | 34 | enum LogLevel{ 35 | DEBUG, 36 | INFO, 37 | WARNING, 38 | CRITICAL, 39 | ERROR 40 | }; 41 | 42 | 43 | 44 | /** 45 | * @brief The QFileLogger class 46 | * 47 | * Class for logging logs of various levels - debug, info etc in log file. 48 | * 49 | * This logger is desinged to be a singleton for an application. 50 | */ 51 | class QFileLogger { 52 | public: 53 | static QFileLogger* CreateLogger(QString filepath, LogLevel level); 54 | static QFileLogger* Instance(); 55 | 56 | 57 | void Debug(const char* msg); 58 | void Info(const char* msg); 59 | void Warning(const char* msg); 60 | void Critical(const char* msg); 61 | void Error(const char* msg); 62 | 63 | 64 | private: 65 | QFileLogger(QString filepath, LogLevel level); 66 | void AddLog(const char* msg); 67 | 68 | private: 69 | QString filepath; 70 | QFile file; 71 | LogLevel level; 72 | 73 | }; 74 | 75 | } // namespace logger 76 | 77 | #endif // QFILELOGGER_H 78 | -------------------------------------------------------------------------------- /mainwindow.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ----------------------------------- 3 | * QtSysMonitor 4 | * ----------------------------------- 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * --------------------------------------------------------------------------- 20 | * Started By: Navjot Singh in November 2016 21 | * 22 | * Organization:Weavebytes Infotech Pvt Ltd 23 | * --------------------------------------------------------------------------- 24 | */ 25 | 26 | #ifndef MAINWINDOW_H 27 | #define MAINWINDOW_H 28 | 29 | #include 30 | #include 31 | 32 | #include "settingsdialog.h" 33 | #include "aboutdialog.h" 34 | #include "processwidget.h" 35 | #include "resourceswidget.h" 36 | 37 | using namespace QtCharts; 38 | 39 | namespace Ui { 40 | class MainWindow; 41 | } 42 | 43 | class MainWindow : public QMainWindow 44 | { 45 | Q_OBJECT 46 | 47 | public: 48 | explicit MainWindow(QWidget *parent = 0); 49 | ~MainWindow(); 50 | 51 | void changeEvent(QEvent* e); 52 | 53 | private slots: 54 | void open(); 55 | void save(); 56 | void about(); 57 | void showSettings(); 58 | void handleLabel(QPieSlice*, bool); 59 | 60 | private: 61 | void createMenus(); 62 | void addPieChart(); 63 | void addDonutChart(); 64 | 65 | void showPlatformInfo(); 66 | 67 | private: 68 | Ui::MainWindow *ui; 69 | AboutDialog dlgAbout; 70 | SettingsDialog dlgSettings; 71 | ProcessWidget *widProcesses; 72 | ResourcesWidget *widResources; 73 | QTimer *processTimer; 74 | QTimer *socketTimer; 75 | QSettings settings; 76 | 77 | public slots: 78 | void refreshSettings(); 79 | }; 80 | 81 | #endif // MAINWINDOW_H 82 | -------------------------------------------------------------------------------- /platforminfo.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * ----------------------------------- 3 | * QtSysMonitor 4 | * ----------------------------------- 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * --------------------------------------------------------------------------- 20 | * Started By: Navjot Singh in November 2016 21 | * 22 | * Organization:Weavebytes Infotech Pvt Ltd 23 | * --------------------------------------------------------------------------- 24 | */ 25 | 26 | #include "platforminfo.h" 27 | 28 | #include 29 | 30 | PlatformInfo::PlatformInfo(QObject *parent) : QObject(parent) 31 | { 32 | } 33 | 34 | QString PlatformInfo::getOsName() 35 | { 36 | 37 | #ifdef Q_OS_WIN 38 | switch(QSysInfo::windowsVersion()) 39 | { 40 | case QSysInfo::WV_2000: return "Windows 2000"; 41 | case QSysInfo::WV_XP: return "Windows XP"; 42 | case QSysInfo::WV_VISTA: return "Windows Vista"; 43 | case QSysInfo::WV_WINDOWS7: return "Windows 7"; 44 | case QSysInfo::WV_WINDOWS8: return "Windows 8"; 45 | case QSysInfo::WV_WINDOWS10: return "Windows 10"; 46 | 47 | default: return "Windows"; 48 | } 49 | #endif 50 | 51 | #ifdef Q_OS_LINUX 52 | return "Linux"; 53 | #endif 54 | 55 | #ifdef Q_OS_MAC 56 | switch(QSysInfo::macVersion()) 57 | { 58 | case QSysInfo::MV_9: return "macOS 9"; 59 | case QSysInfo::MV_10_0: return "macOS 10.0"; 60 | case QSysInfo::MV_10_1: return "macOS 10.1"; 61 | case QSysInfo::MV_10_2: return "macOS 10.2"; 62 | case QSysInfo::MV_10_3: return "macOS 10.3"; 63 | case QSysInfo::MV_10_4: return "macOS 10.4"; 64 | case QSysInfo::MV_10_5: return "macOS 10.5"; 65 | case QSysInfo::MV_10_6: return "macOS 10.6"; 66 | case QSysInfo::MV_10_7: return "macOS 10.7"; 67 | case QSysInfo::MV_10_8: return "macOS 10.8"; 68 | case QSysInfo::MV_10_9: return "macOS 10.9"; 69 | case QSysInfo::MV_10_10: return "macOS 10.10"; 70 | case QSysInfo::MV_10_11: return "macOS 10.11"; 71 | case QSysInfo::MV_10_12: return "macOS 10.12"; 72 | 73 | default: return "Macintosh"; 74 | } 75 | #endif 76 | 77 | return "Unknow OS"; 78 | } 79 | 80 | QString PlatformInfo::getCpuArchitecture() 81 | { 82 | return QSysInfo::currentCpuArchitecture(); 83 | } 84 | -------------------------------------------------------------------------------- /qfilelogger.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * ----------------------------------- 3 | * QtSysMonitor 4 | * ----------------------------------- 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * --------------------------------------------------------------------------- 20 | * Started By: Navjot Singh in November 2016 21 | * 22 | * Organization:Weavebytes Infotech Pvt Ltd 23 | * --------------------------------------------------------------------------- 24 | */ 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | #include "qfilelogger.h" 31 | 32 | using namespace logger; 33 | 34 | static QFileLogger* instance; 35 | 36 | QFileLogger::QFileLogger(QString filepath, LogLevel level): 37 | filepath(filepath), 38 | file(filepath), 39 | level(level) 40 | { 41 | if(!file.open(QIODevice::WriteOnly | QIODevice::Append)) { 42 | qDebug() << "[QFileLogger] :: failed to open log file"; 43 | } 44 | } 45 | 46 | QFileLogger* QFileLogger::Instance() { 47 | return instance; 48 | } 49 | 50 | QFileLogger* QFileLogger::CreateLogger(QString filepath, LogLevel level) { 51 | if(!instance) { 52 | instance = new QFileLogger(filepath, level); 53 | } 54 | 55 | return instance; 56 | } 57 | 58 | void QFileLogger::AddLog(const char* msg) { 59 | 60 | QTextStream out(&file); 61 | out << QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss.zzz") << msg << "\r\n"; 62 | } 63 | 64 | 65 | void QFileLogger::Debug(const char* msg) { 66 | if(level <= DEBUG) { 67 | AddLog(QString(" [DEBUG] %1").arg(msg).toLatin1() ); 68 | } 69 | } 70 | 71 | void QFileLogger::Info(const char* msg) { 72 | if(level <= INFO) { 73 | AddLog(QString(" [INFO] %1").arg(msg).toLatin1() ); 74 | } 75 | } 76 | 77 | void QFileLogger::Warning(const char* msg) { 78 | if(level <= WARNING) { 79 | AddLog(QString(" [WARNING] %1").arg(msg).toLatin1() ); 80 | } 81 | } 82 | 83 | void QFileLogger::Critical(const char* msg) { 84 | if(level <= CRITICAL) { 85 | AddLog(QString(" [CRITICAL] %1").arg(msg).toLatin1() ); 86 | } 87 | } 88 | 89 | void QFileLogger::Error(const char* msg) { 90 | if(level <= ERROR) { 91 | AddLog(QString(" [ERROR] %1").arg(msg).toLatin1() ); 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /aboutdialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | AboutDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 512 10 | 354 11 | 12 | 13 | 14 | 15 | 0 16 | 0 17 | 18 | 19 | 20 | About QtSysMonitor 21 | 22 | 23 | 24 | 25 | 170 26 | 140 27 | 181 28 | 61 29 | 30 | 31 | 32 | 33 | 15 34 | 75 35 | true 36 | 37 | 38 | 39 | QtSysMonitor 40 | 41 | 42 | 43 | 44 | 45 | 60 46 | 170 47 | 421 48 | 91 49 | 50 | 51 | 52 | A system monitoring application developed for Linux, Mac and Windows Desktop. You can also port it to mobile platforms. 53 | 54 | 55 | true 56 | 57 | 58 | 59 | 60 | 61 | 110 62 | 290 63 | 351 64 | 16 65 | 66 | 67 | 68 | 69 | 8 70 | 71 | 72 | 73 | Under Reseach & Development By Weavebytes 74 | 75 | 76 | 77 | 78 | 79 | 170 80 | 310 81 | 191 82 | 16 83 | 84 | 85 | 86 | 87 | 8 88 | 75 89 | false 90 | true 91 | true 92 | 93 | 94 | 95 | www.weavebytes.com 96 | 97 | 98 | 99 | 100 | 101 | 180 102 | 20 103 | 131 104 | 131 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | -------------------------------------------------------------------------------- /batteryinfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ----------------------------------- 3 | * QtSysMonitor 4 | * ----------------------------------- 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * --------------------------------------------------------------------------- 20 | * Started By: Navjot Singh in November 2016 21 | * 22 | * Organization:Weavebytes Infotech Pvt Ltd 23 | * --------------------------------------------------------------------------- 24 | */ 25 | #ifndef BATTERYINFO_H 26 | #define BATTERYINFO_H 27 | 28 | #include 29 | 30 | class BatteryInfo { 31 | 32 | private: 33 | QString mName; 34 | QString mStatus; 35 | int mSupplyPresent; 36 | QString mSupplyTechnology; 37 | quint64 mSupplyCycleCount; 38 | quint64 mSupplyVoltageMinDesign; 39 | quint64 mSupplyVoltageNow; 40 | quint64 mSupplyCurrentNow; 41 | quint64 mSupplyChargeFullDesign; 42 | quint64 mSupplyChargeFull; 43 | quint64 mSupplyChargeNow; 44 | quint64 mSupplyCapacity; 45 | QString mSupplyCapacityLevel; 46 | QString mSupplyModelName; 47 | QString mSupplyManufacturer; 48 | 49 | public: 50 | explicit BatteryInfo(); 51 | 52 | void setName(QString val); 53 | void setStatus(QString val); 54 | void setSupplyPresent(int val); 55 | void setSupplyTechnology(QString val); 56 | void setSupplyCycleCount(quint64 val); 57 | void setSupplyVoltageMinDesign(quint64 val); 58 | void setSupplyVoltageNow(quint64 val); 59 | void setSupplyCurrentNow(quint64 val); 60 | void setSupplyChargeFullDesign(quint64 val); 61 | void setSupplyChargeFull(quint64 val); 62 | void setSupplyChargeNow(quint64 val); 63 | void setSupplyCapacity(quint64 val); 64 | void setSupplyCapacityLevel(QString val); 65 | void setSupplyModelName(QString val); 66 | void setSupplyManufacturer(QString val); 67 | 68 | QString getName () const; 69 | QString getStatus () const; 70 | int getSupplyPresent () const; 71 | QString getSupplyTechnology () const; 72 | quint64 getSupplyCycleCount () const; 73 | quint64 getSupplyVoltageMinDesign () const; 74 | quint64 getSupplyVoltageNow () const; 75 | quint64 getSupplyCurrentNow () const; 76 | quint64 getSupplyChargeFullDesign () const; 77 | quint64 getSupplyChargeFull () const; 78 | quint64 getSupplyChargeNow () const; 79 | quint64 getSupplyCapacity () const; 80 | QString getSupplyCapacityLevel () const; 81 | QString getSupplyModelName () const; 82 | QString getSupplyManufacturer () const; 83 | 84 | void showInfo(); 85 | 86 | }; 87 | 88 | #endif //BATTERYINFO_H 89 | -------------------------------------------------------------------------------- /networksocket.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ----------------------------------- 3 | * QtSysMonitor 4 | * ----------------------------------- 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * --------------------------------------------------------------------------- 20 | * Started By: Navjot Singh in November 2016 21 | * 22 | * Organization: Weavebytes Infotech Pvt Ltd 23 | * --------------------------------------------------------------------------- 24 | */ 25 | 26 | 27 | #ifndef NETWORKSOCKET_H 28 | #define NETWORKSOCKET_H 29 | 30 | #include 31 | 32 | /** 33 | * @brief The NetworkSocket class 34 | * 35 | * This class acts as data structure for storing network information of various sockets. 36 | * 37 | */ 38 | class NetworkSocket 39 | { 40 | QString mProtocolType; 41 | quint64 mReceiveQ; 42 | quint64 mSendQ; 43 | QString mLocalAddress; 44 | QString mForeignAddress; 45 | QString mState; 46 | quint64 mPID; 47 | QString mProgramName; 48 | 49 | public: 50 | /** 51 | * @brief NetworkSocket 52 | * Default constructor 53 | */ 54 | explicit NetworkSocket(); 55 | 56 | /** 57 | * @brief NetworkSocket 58 | * @param protocolType - stores the type of protocol 59 | * @param receiveQ - stores the bytes in Recive-Q 60 | * @param sendQ - stores the bytes in Send-Q 61 | * @param localAddress - stores the local address for the socket 62 | * @param foreignAddress - stores the foreign address for the socket 63 | * @param state - stores the state of socket 64 | * @param pID - stores the PID of the process using the socket 65 | * @param programName - stores the name of the program using the socket 66 | */ 67 | explicit NetworkSocket(QString protocolType, 68 | quint64 receiveQ, 69 | quint64 sendQ, 70 | QString localAddress, 71 | QString foreignAddress, 72 | QString state, 73 | quint64 pID, 74 | QString programName); 75 | 76 | QString getProtocolType() const; 77 | quint64 getReceiveQ() const; 78 | quint64 getSendQ() const; 79 | QString getLocalAddress() const; 80 | QString getForeignAddress() const; 81 | QString getState() const; 82 | quint64 getPID() const; 83 | QString getProgramName() const; 84 | 85 | void setProtocolType(QString protocol); 86 | void setReceiveQ(quint64 receiveQ); 87 | void setSendQ(quint64 sendQ); 88 | void setLocalAddress(QString localAddress); 89 | void setForeignAddress(QString foreignAddress); 90 | void setState(QString state); 91 | void setPID(quint64 pID); 92 | void setProgramName(QString programName); 93 | 94 | void showInfo() const; 95 | 96 | }; 97 | 98 | #endif // NETWORKSOCKET_H 99 | -------------------------------------------------------------------------------- /resourceswidget.cpp: -------------------------------------------------------------------------------- 1 | #include "resourceswidget.h" 2 | 3 | ResourcesWidget::ResourcesWidget(QTableWidget *wid, QWidget *parent) : 4 | QWidget(parent), 5 | widget(wid) 6 | { 7 | connect(this, SIGNAL(refreshData()), this, SLOT(deleteAllocatedItems())); 8 | connect(this, SIGNAL(refreshData()), this, SLOT(populateUi())); 9 | } 10 | 11 | ResourcesWidget::~ResourcesWidget(){ 12 | deleteAllocatedItems(); 13 | } 14 | 15 | void ResourcesWidget::populateUi(){ 16 | 17 | utilities = new SystemUtil(); 18 | QList socketList; 19 | 20 | int returnStatus = utilities->getSocketList(&socketList); 21 | 22 | if(returnStatus == ST_SUCCESS){ 23 | qDebug() << "Successfully retrieved disk list. . . "; 24 | }else { 25 | qDebug() << "Problem retrieving disk list . . . . ."; 26 | } 27 | 28 | widget->setRowCount(socketList.size()); 29 | 30 | QTableWidgetItem *protocolType; 31 | QTableWidgetItem *receiveQ; 32 | QTableWidgetItem *sendQ; 33 | QTableWidgetItem *localAddress; 34 | QTableWidgetItem *foreignAddress; 35 | QTableWidgetItem *state; 36 | QTableWidgetItem *pID; 37 | QTableWidgetItem *programName; 38 | 39 | for(int i = 0 ; i < socketList.size(); i++){ 40 | protocolType = new QTableWidgetItem(QString(socketList.at(i).getProtocolType())); 41 | 42 | receiveQ = new QTableWidgetItem(QString("%1 B").arg 43 | (QString::number(socketList.at(i).getReceiveQ()))); 44 | sendQ = new QTableWidgetItem(QString("%1 B").arg 45 | (QString::number(socketList.at(i).getSendQ()))); 46 | localAddress = new QTableWidgetItem(QString(socketList.at(i).getLocalAddress())); 47 | 48 | foreignAddress = new QTableWidgetItem(QString(socketList.at(i).getForeignAddress())); 49 | 50 | state = new QTableWidgetItem(QString(socketList.at(i).getState())); 51 | 52 | pID = new QTableWidgetItem(QString("%1").arg 53 | (QString::number(socketList.at(i).getPID()))); 54 | programName = new QTableWidgetItem(QString(socketList.at(i).getProgramName())); 55 | 56 | 57 | 58 | protocolType->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); 59 | receiveQ->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); 60 | sendQ->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); 61 | localAddress->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); 62 | foreignAddress->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); 63 | state->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); 64 | pID->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); 65 | programName->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); 66 | 67 | widget->setItem(i, 0, protocolType); 68 | widget->setItem(i, 1, receiveQ); 69 | widget->setItem(i, 2, sendQ); 70 | widget->setItem(i, 3, localAddress); 71 | widget->setItem(i, 4, foreignAddress); 72 | widget->setItem(i, 5, state); 73 | widget->setItem(i, 6, pID); 74 | widget->setItem(i, 7, programName); 75 | 76 | } 77 | 78 | widget->setCurrentCell(0,0); 79 | 80 | } 81 | 82 | void ResourcesWidget::deleteAllocatedItems(){ 83 | 84 | for(int i = 0; i < widget->rowCount(); i++){ 85 | for(int j = 0 ;j < widget->columnCount(); j++){ 86 | widget->setCurrentCell(i, j); 87 | delete widget->currentItem(); 88 | } 89 | } 90 | 91 | } 92 | 93 | void ResourcesWidget::refreshTimer(){ 94 | emit refreshData(); 95 | } 96 | -------------------------------------------------------------------------------- /process.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ----------------------------------- 3 | * QtSysMonitor 4 | * ----------------------------------- 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * --------------------------------------------------------------------------- 20 | * Started By: Navjot Singh in November 2016 21 | * 22 | * Organization:Weavebytes Infotech Pvt Ltd 23 | * --------------------------------------------------------------------------- 24 | */ 25 | 26 | 27 | #ifndef PROCESS_H 28 | #define PROCESS_H 29 | 30 | #include 31 | #include 32 | 33 | /** 34 | * @brief The Process class 35 | * This class acts as data sturcture to store the individual process details 36 | */ 37 | class Process 38 | { 39 | quint64 mProcessId; 40 | QString mProcessName; 41 | float mCpuUsage; 42 | double mMemoryUsage; 43 | QString mUser; 44 | 45 | public: 46 | /** 47 | * @brief Process 48 | * Default constructor 49 | */ 50 | explicit Process(); 51 | 52 | /** 53 | * @brief Process Parameterized constructor 54 | * @param processId PID of process 55 | * @param processName Name of process 56 | * @param cpuUsage CPU usage by process 57 | * @param memoryUsage Memory usage by process 58 | * @param user User that has invoked the process 59 | */ 60 | explicit Process(quint64 processId, 61 | QString processName, 62 | float cpuUsage, 63 | double memoryUsage, 64 | QString user); 65 | /** 66 | * @brief showInfo 67 | * Shows the details of process 68 | */ 69 | void showInfo() const; 70 | 71 | /** 72 | * @brief getProcessId 73 | * @return mProcessId 74 | */ 75 | quint64 getProcessId() const; 76 | 77 | /** 78 | * @brief getProcessName 79 | * @return mProcessName 80 | */ 81 | QString getProcessName() const; 82 | 83 | /** 84 | * @brief getCpuUsage 85 | * @return mCpuUsage 86 | */ 87 | float getCpuUsage() const; 88 | 89 | /** 90 | * @brief getMemoryUsage 91 | * @return mMemoryUsage 92 | */ 93 | double getMemoryUsage() const; 94 | 95 | /** 96 | * @brief getUser 97 | * @return mUser 98 | */ 99 | QString getUser() const; 100 | 101 | /** 102 | * @brief setProcessId 103 | * @param val 104 | */ 105 | void setProcessId(quint64 val); 106 | 107 | /** 108 | * @brief setProcessName 109 | * @param str 110 | */ 111 | void setProcessName(QString str); 112 | 113 | /** 114 | * @brief setCpuUsage 115 | * @param val 116 | */ 117 | void setCpuUsage(float val); 118 | 119 | /** 120 | * @brief setMemoryUsage 121 | * @param val 122 | */ 123 | void setMemoryUsage(double val); 124 | 125 | /** 126 | * @brief setUser 127 | * @param str 128 | */ 129 | void setUser(QString str); 130 | 131 | }; 132 | 133 | #endif // PROCESS_H 134 | -------------------------------------------------------------------------------- /processwidget.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * ----------------------------------- 3 | * QtSysMonitor 4 | * ----------------------------------- 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * --------------------------------------------------------------------------- 20 | * Started By: Navjot Singh in November 2016 21 | * 22 | * Organization:Weavebytes Infotech Pvt Ltd 23 | * --------------------------------------------------------------------------- 24 | */ 25 | 26 | #include "processwidget.h" 27 | 28 | ProcessWidget::ProcessWidget(QTableWidget *wid, QWidget *parent) : 29 | QWidget(parent), 30 | widget(wid) 31 | { 32 | connect(this, SIGNAL(refreshData()), this, SLOT(deleteAllocatedItems())); 33 | connect(this, SIGNAL(refreshData()), this, SLOT(populateUi())); 34 | 35 | } 36 | 37 | ProcessWidget::~ProcessWidget(){ 38 | deleteAllocatedItems(); 39 | } 40 | 41 | void ProcessWidget::populateUi(){ 42 | 43 | SystemUtil util; 44 | QList processList; 45 | int returnCode = util.getProcessesList(&processList); 46 | 47 | if(returnCode == ST_SUCCESS){ 48 | qDebug() << "Successfully retrieved process list. . . "; 49 | }else { 50 | qDebug() << "Problem retrieving process list . . . . ."; 51 | } 52 | 53 | widget->setRowCount(processList.size()); 54 | 55 | QTableWidgetItem *pidItem; 56 | QTableWidgetItem *pNameItem; 57 | QTableWidgetItem *pUserItem; 58 | QTableWidgetItem *pCpuUsageItem; 59 | QTableWidgetItem *pMemUsageItem; 60 | 61 | for(int i = 0;i < processList.size(); i++ ){ 62 | 63 | pidItem = new QTableWidgetItem(QString::number 64 | (processList.at(i).getProcessId())); 65 | pNameItem = new QTableWidgetItem(QString 66 | (processList.at(i).getProcessName())); 67 | pUserItem = new QTableWidgetItem(QString 68 | (processList.at(i).getUser())); 69 | pCpuUsageItem = new QTableWidgetItem(QString("%1 %"). 70 | arg(QString::number(processList.at(i).getCpuUsage(),'f',2))); 71 | pMemUsageItem = new QTableWidgetItem(QString("%1 KiB"). 72 | arg(QString::number(processList.at(i).getMemoryUsage(),'f',2))); 73 | 74 | pidItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); 75 | pUserItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); 76 | pCpuUsageItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); 77 | pMemUsageItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); 78 | 79 | widget->setItem(i,0,pidItem); 80 | widget->setItem(i,1,pNameItem); 81 | widget->setItem(i,2,pUserItem); 82 | widget->setItem(i,3,pCpuUsageItem); 83 | widget->setItem(i,4,pMemUsageItem); 84 | } 85 | widget->setCurrentCell(0,0); 86 | 87 | } 88 | 89 | void ProcessWidget::deleteAllocatedItems(){ 90 | 91 | for(int i = 0; i < widget->rowCount(); i++){ 92 | for(int j = 0 ;j < widget->columnCount(); j++){ 93 | widget->setCurrentCell(i, j); 94 | delete widget->currentItem(); 95 | } 96 | } 97 | 98 | } 99 | 100 | void ProcessWidget::refreshTimer(){ 101 | emit refreshData(); 102 | } 103 | -------------------------------------------------------------------------------- /disk.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ----------------------------------- 3 | * QtSysMonitor 4 | * ----------------------------------- 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * --------------------------------------------------------------------------- 20 | * Started By: Navjot Singh in November 2016 21 | * 22 | * Organization: Weavebytes Infotech Pvt Ltd 23 | * --------------------------------------------------------------------------- 24 | */ 25 | 26 | 27 | #ifndef DISK_H 28 | #define DISK_H 29 | 30 | #include 31 | 32 | /** 33 | * @brief The Disk class 34 | * Acts as data structure to store information of mounted disks on the system 35 | */ 36 | class Disk 37 | { 38 | QString mName; 39 | QString mRootPath; 40 | quint64 mAvailableBytes; 41 | quint64 mTotalBytes; 42 | QString mFileSystemType; 43 | QString mDevice; 44 | 45 | /** 46 | * @brief showSize 47 | * @param val 48 | * @return value with its size byte 49 | * 50 | * Evaluate whether the size is in KBs, MBs, GBs and so on 51 | */ 52 | QString showSize(quint64 val) const; 53 | 54 | public: 55 | /** 56 | * @brief Disk 57 | * Default constructor 58 | */ 59 | explicit Disk(); 60 | 61 | /** 62 | * @brief Disk 63 | * @param name - Stores display name of disk 64 | * @param rootPath - Stores root path of disk 65 | * @param availableBytes - Stores available bytes of disk for user 66 | * @param totalBytes - Stores total bytes of disk 67 | * @param fileSystemType - Stores file system type 68 | * @param device - Stores device name 69 | */ 70 | explicit Disk(QString name, 71 | QString rootPath, 72 | quint64 availableBytes, 73 | quint64 totalBytes, 74 | QString fileSystemType, 75 | QString device); 76 | 77 | /** 78 | * @brief getName 79 | * @return mName 80 | */ 81 | QString getName() const; 82 | 83 | /** 84 | * @brief getRootPath 85 | * @return mRootPath 86 | */ 87 | QString getRootPath() const; 88 | 89 | /** 90 | * @brief getAvailableBytes 91 | * @return mAvaiableBytes 92 | */ 93 | quint64 getAvailableBytes() const; 94 | 95 | /** 96 | * @brief getTotalBytes 97 | * @return mTotalBytes 98 | */ 99 | quint64 getTotalBytes() const; 100 | 101 | /** 102 | * @brief getFileSystemType 103 | * @return mFileSystemType 104 | */ 105 | QString getFileSystemType() const; 106 | 107 | /** 108 | * @brief getDevice 109 | * @return mDevice 110 | */ 111 | QString getDevice() const; 112 | 113 | /** 114 | * @brief showInfo 115 | * shows the details of disk 116 | */ 117 | void showInfo() const; 118 | 119 | /** 120 | * Setter functions 121 | */ 122 | /**-------------------------------------------------------------**/ 123 | void setName(QString name); 124 | void setRootPath(QString rootPath); 125 | void setAvailableBytes(quint64 availableBytes); 126 | void setTotalBytes(quint64 totalBytes); 127 | void setFileSystemType(QString fileSystemType); 128 | void setDevice(QString device); 129 | /**-------------------------------------------------------------**/ 130 | 131 | }; 132 | 133 | #endif // DISK_H 134 | -------------------------------------------------------------------------------- /process.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * ----------------------------------- 3 | * QtSysMonitor 4 | * ----------------------------------- 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * --------------------------------------------------------------------------- 20 | * Started By: Navjot Singh in November 2016 21 | * 22 | * Organization:Weavebytes Infotech Pvt Ltd 23 | * --------------------------------------------------------------------------- 24 | */ 25 | 26 | 27 | #include "process.h" 28 | 29 | /** 30 | * @brief Process::Process 31 | * Data structure to store the required process information 32 | */ 33 | Process::Process() {} 34 | 35 | /** 36 | * @brief Process::Process 37 | * @param processId PID of process 38 | * @param processName Name of process 39 | * @param cpuUsage CPU usage by process 40 | * @param memoryUsage Memory usage by process 41 | * @param user User that has invoked the process 42 | */ 43 | Process::Process(quint64 processId, 44 | QString processName, 45 | float cpuUsage, 46 | double memoryUsage, 47 | QString user) 48 | 49 | { 50 | 51 | mProcessId = processId; 52 | mProcessName = processName; 53 | mCpuUsage = cpuUsage; 54 | mMemoryUsage = memoryUsage; 55 | mUser = user; 56 | 57 | } 58 | 59 | /** 60 | * @brief Process::showInfo 61 | * Shows the process details 62 | */ 63 | void Process::showInfo() const{ 64 | 65 | qDebug() << "----------------[ PROCESS ]----------------" ; 66 | qDebug() << "Process No . . . . . : " << mProcessId ; 67 | qDebug() << "User . . . . . . . . .: " << mUser ; 68 | qDebug() << "Process Name . . . . .: " << mProcessName ; 69 | qDebug() << "Process CPU Usage . .: " << mCpuUsage << " % "; 70 | qDebug() << "Process Memory Usage .: " << mMemoryUsage << " KiB "; 71 | qDebug() << "-------------------------------------------" ; 72 | 73 | } 74 | 75 | /** 76 | * @brief Process::getProcessId 77 | * @return mProcessId 78 | */ 79 | quint64 Process::getProcessId() const{ 80 | return this->mProcessId; 81 | } 82 | 83 | /** 84 | * @brief Process::getProcessName 85 | * @return mProcessName 86 | */ 87 | QString Process::getProcessName() const{ 88 | return this->mProcessName; 89 | } 90 | 91 | /** 92 | * @brief Process::getCpuUsage 93 | * @return mCpuUsage 94 | */ 95 | float Process::getCpuUsage() const{ 96 | return this->mCpuUsage; 97 | } 98 | 99 | /** 100 | * @brief Process::getMemoryUsage 101 | * @return mMemoryUsage 102 | */ 103 | double Process::getMemoryUsage() const{ 104 | return this->mMemoryUsage; 105 | } 106 | 107 | /** 108 | * @brief Process::getUser 109 | * @return mUser 110 | */ 111 | QString Process::getUser() const{ 112 | return this->mUser; 113 | } 114 | 115 | /** 116 | * @brief Process::setProcessId 117 | * @param val 118 | * sets mProcessId to val 119 | */ 120 | void Process::setProcessId( quint64 val ){ 121 | this->mProcessId = val ; 122 | } 123 | 124 | /** 125 | * @brief Process::setProcessName 126 | * @param str 127 | * sets mProcessName to val 128 | */ 129 | void Process::setProcessName( QString str ){ 130 | this->mProcessName = str ; 131 | } 132 | 133 | /** 134 | * @brief Process::setCpuUsage 135 | * @param val 136 | * sets mCpuUsage to val 137 | */ 138 | void Process::setCpuUsage( float val ){ 139 | this->mCpuUsage = val ; 140 | } 141 | 142 | /** 143 | * @brief Process::setMemoryUsage 144 | * @param val 145 | * sets mMemoryUsage to val 146 | */ 147 | void Process::setMemoryUsage( double val){ 148 | this->mMemoryUsage = val ; 149 | } 150 | 151 | /** 152 | * @brief Process::setUser 153 | * @param str 154 | * sets mUser to str 155 | */ 156 | void Process::setUser( QString str ){ 157 | this->mUser = str ; 158 | } 159 | -------------------------------------------------------------------------------- /networksocket.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * ----------------------------------- 3 | * QtSysMonitor 4 | * ----------------------------------- 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * --------------------------------------------------------------------------- 20 | * Started By: Navjot Singh in November 2016 21 | * 22 | * Organization: Weavebytes Infotech Pvt Ltd 23 | * --------------------------------------------------------------------------- 24 | */ 25 | 26 | #include "networksocket.h" 27 | 28 | #include 29 | 30 | NetworkSocket::NetworkSocket() {} 31 | 32 | NetworkSocket::NetworkSocket(QString protocolType, 33 | quint64 receiveQ, 34 | quint64 sendQ, 35 | QString localAddress, 36 | QString foreignAddress, 37 | QString state, 38 | quint64 pID, 39 | QString programName) 40 | { 41 | 42 | mProtocolType = protocolType; 43 | mReceiveQ = receiveQ; 44 | mSendQ = sendQ; 45 | mLocalAddress = localAddress; 46 | mForeignAddress = foreignAddress; 47 | mState = state; 48 | mPID = pID; 49 | mProgramName = programName; 50 | } 51 | 52 | void NetworkSocket::showInfo() const { 53 | 54 | qDebug() << "-------------------[ SOCKET ]---------------------"; 55 | qDebug() << " Protocol type . . : " << getProtocolType(); 56 | qDebug() << " ReceiveQ. . . . . : " << getReceiveQ()<< " bytes"; 57 | qDebug() << " SendQ . . . . . . : " << getSendQ() << " bytes"; 58 | qDebug() << " Local Address . . : " << getLocalAddress() << " bytes"; 59 | qDebug() << " Foreign Address . : " << getForeignAddress(); 60 | qDebug() << " State . . . . . . : " << getState(); 61 | qDebug() << " PID . . . . . . . : " << getPID(); 62 | qDebug() << " Program Name. . . : " << getProgramName(); 63 | qDebug() << "--------------------------------------------------"; 64 | } 65 | 66 | 67 | /**----------------------------- Getter Functions ----------------------------------------**/ 68 | QString NetworkSocket::getProtocolType() const{ 69 | return this->mProtocolType; 70 | } 71 | 72 | quint64 NetworkSocket::getReceiveQ() const{ 73 | return this->mReceiveQ; 74 | } 75 | 76 | quint64 NetworkSocket::getSendQ() const{ 77 | return this->mSendQ; 78 | } 79 | 80 | QString NetworkSocket::getLocalAddress() const{ 81 | return this->mLocalAddress; 82 | } 83 | 84 | QString NetworkSocket::getForeignAddress() const{ 85 | return this->mForeignAddress; 86 | } 87 | 88 | QString NetworkSocket::getState() const{ 89 | return this->mState; 90 | } 91 | 92 | quint64 NetworkSocket::getPID() const{ 93 | return this->mPID; 94 | } 95 | 96 | QString NetworkSocket::getProgramName() const{ 97 | return this->mProgramName; 98 | } 99 | 100 | /**--------------------------------- Setter Functions -----------------------------**/ 101 | 102 | void NetworkSocket::setProtocolType(QString protocol) { 103 | mProtocolType = protocol; 104 | } 105 | 106 | void NetworkSocket::setReceiveQ(quint64 receiveQ) { 107 | mReceiveQ = receiveQ; 108 | } 109 | 110 | void NetworkSocket::setSendQ(quint64 sendQ) { 111 | mSendQ = sendQ; 112 | } 113 | 114 | void NetworkSocket::setLocalAddress(QString localAddress) { 115 | mLocalAddress = localAddress; 116 | } 117 | 118 | void NetworkSocket::setForeignAddress(QString foreignAddress) { 119 | mForeignAddress = foreignAddress; 120 | } 121 | 122 | void NetworkSocket::setState(QString state) { 123 | mState = state; 124 | } 125 | 126 | void NetworkSocket::setPID(quint64 pID) { 127 | mPID = pID; 128 | } 129 | 130 | void NetworkSocket::setProgramName(QString programName) { 131 | mProgramName = programName; 132 | } 133 | 134 | /**--------------------------------------------------------------------------------------**/ 135 | -------------------------------------------------------------------------------- /systemutil.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ----------------------------------- 3 | * QtSysMonitor 4 | * ----------------------------------- 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * --------------------------------------------------------------------------- 20 | * Started By: Navjot Singh in November 2016 21 | * 22 | * Organization: Weavebytes Infotech Pvt Ltd 23 | * --------------------------------------------------------------------------- 24 | */ 25 | 26 | 27 | #ifndef SYSTEMUTIL_H 28 | #define SYSTEMUTIL_H 29 | 30 | #include "process.h" 31 | #include "disk.h" 32 | #include "networksocket.h" 33 | #include "defs.h" 34 | #include "batteryinfo.h" 35 | 36 | #include 37 | #include 38 | #include 39 | 40 | /** 41 | * @brief The SystemUtil class 42 | * This class handles backend of getting data 43 | */ 44 | class SystemUtil : public QObject 45 | { 46 | 47 | Q_OBJECT 48 | 49 | QProcess *mTopProcess; // Qprocess mTopProcess handle the subprocess 'top' 50 | QProcess *mNetstatProcess; // QProcess mNetstatProcess handle the subprocess 'netstat' 51 | QProcess *mDfProcess; // QProcess mDfProcess handle the subprocess 'df' 52 | QString mProcess; // The path of subprocess 'top' 53 | QStringList mEnv; // Sets necessary TERM environment variable required for top command 54 | QStringList mArguments; // Arguments list to handle processes properly 55 | QString mOutputString; // To store the output produced by the commands 56 | QStringList mOutputList; // To store the split values of output 57 | 58 | int findHeaderRow(); 59 | int findNetstatHeaderRow(); 60 | 61 | public: 62 | explicit SystemUtil(QObject *parent = 0); 63 | ~SystemUtil(); 64 | 65 | /** 66 | * @brief getProcessesList 67 | * @param processList - contains list of Processes 68 | * @return exit_status 69 | * 70 | * Execute top process to analyze the current system status 71 | * and populate the processList with Process objects 72 | */ 73 | int getProcessesList(QList *processList); 74 | 75 | /** 76 | * @brief getDiskList 77 | * @param diskList - contains list of Disks 78 | * @return exit_status 79 | * 80 | * Analyze the details of disks on the system 81 | * and poplutes the diskList with Disk object 82 | */ 83 | int getDiskList(QList *diskList); 84 | 85 | /** 86 | * @brief getSocketList 87 | * @param socketList - contains list of Sockets 88 | * @return exit_status 89 | * 90 | * Execute netstat process to analyze the current system status 91 | * and populate the socketList with NetworkSocket objects 92 | */ 93 | int getSocketList(QList *socketList); 94 | 95 | /** 96 | * @brief parseProcesses 97 | * @param processList 98 | * @return exit_status 99 | * 100 | * takes the output of top command, split it and store it in Process value object 101 | * appends the process to processList 102 | */ 103 | int parseProcesses(QList *processList); 104 | 105 | /** 106 | * @brief parseDisks 107 | * @param diskList 108 | * @return exit_status 109 | * 110 | * takes the output of df command, split it and store it in Disk value object 111 | * appends the disk to diskList 112 | */ 113 | int parseDisks(QList *diskList); 114 | 115 | /** 116 | * @brief parseSockets 117 | * @param socketList 118 | * @return exit_status 119 | * 120 | * takes the output of netstat command, split it and store it in NetworkSocket value object 121 | * appends the process to socketList 122 | */ 123 | int parseSockets(QList *socketList); 124 | 125 | /** 126 | * @brief showBatteryDetails 127 | * 128 | * Shows the battery details. 129 | */ 130 | void showBatteryDetails(); 131 | 132 | 133 | signals: 134 | 135 | public slots: 136 | 137 | }; 138 | 139 | #endif // SYSTEMUTIL_H 140 | -------------------------------------------------------------------------------- /disk.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * ----------------------------------- 3 | * QtSysMonitor 4 | * ----------------------------------- 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * --------------------------------------------------------------------------- 20 | * Started By: Navjot Singh in November 2016 21 | * 22 | * Organization: Weavebytes Infotech Pvt Ltd 23 | * --------------------------------------------------------------------------- 24 | */ 25 | 26 | 27 | #include "disk.h" 28 | 29 | #include 30 | 31 | /** 32 | * @brief Disk::Disk 33 | * Default constructor 34 | */ 35 | Disk::Disk() {} 36 | 37 | 38 | /** 39 | * @brief Disk::Disk Parametrized constructor 40 | * @param name - Stores display name of disk 41 | * @param rootPath - Stores root path of disk 42 | * @param availableBytes - Stores available bytes of disk for user 43 | * @param totalBytes - Stores total bytes of disk 44 | * @param fileSystemType - Stores file system type 45 | * @param device - Stores device name 46 | */ 47 | Disk::Disk(QString name, 48 | QString rootPath, 49 | quint64 availableBytes, 50 | quint64 totalBytes, 51 | QString fileSystemType, 52 | QString device) 53 | { 54 | mName = name; 55 | mRootPath = rootPath; 56 | mAvailableBytes = availableBytes; 57 | mTotalBytes = totalBytes; 58 | mFileSystemType = fileSystemType; 59 | mDevice = device; 60 | 61 | } 62 | 63 | /** 64 | * @brief Disk::getName 65 | * @return mName 66 | */ 67 | QString Disk::getName() const{ 68 | return this->mName; 69 | } 70 | 71 | /** 72 | * @brief Disk::getRootPath 73 | * @return mRootPath 74 | */ 75 | 76 | QString Disk::getRootPath() const{ 77 | return this->mRootPath; 78 | } 79 | 80 | /** 81 | * @brief Disk::getAvailableBytes 82 | * @return mAvailableBytes 83 | */ 84 | quint64 Disk::getAvailableBytes() const{ 85 | return this->mAvailableBytes; 86 | } 87 | 88 | /** 89 | * @brief Disk::getTotalBytes 90 | * @return mTotalBytes 91 | */ 92 | quint64 Disk::getTotalBytes() const{ 93 | return this->mTotalBytes; 94 | } 95 | 96 | /** 97 | * @brief Disk::getFileSystemType 98 | * @return mFileSystemType 99 | */ 100 | QString Disk::getFileSystemType() const{ 101 | return this->mFileSystemType; 102 | } 103 | 104 | /** 105 | * @brief Disk::getDevice 106 | * @return mDevice 107 | */ 108 | QString Disk::getDevice() const{ 109 | return this->mDevice; 110 | } 111 | 112 | /** 113 | * @brief Disk::showInfo 114 | * shows the details of disk 115 | */ 116 | void Disk::showInfo() const{ 117 | qDebug() << "---------------- DISK INFO ------------------"; 118 | qDebug() << "Name . . . . . . : " << getName(); 119 | qDebug() << "Root path. . . . : " << getRootPath(); 120 | qDebug() << "Available bytes. : " << showSize(getAvailableBytes()); 121 | qDebug() << "Total bytes. . . : " << showSize(getTotalBytes()); 122 | qDebug() << "File System type : " << getFileSystemType(); 123 | qDebug() << "Device . . . . . : " << getDevice(); 124 | qDebug() << "---------------------------------------------"; 125 | } 126 | 127 | /**----------------------------Setter functions----------------------------**/ 128 | void Disk::setName(QString name){ 129 | mName = name; 130 | } 131 | 132 | void Disk::setRootPath(QString rootPath){ 133 | mRootPath = rootPath; 134 | } 135 | 136 | void Disk::setAvailableBytes(quint64 availableBytes){ 137 | mAvailableBytes = availableBytes; 138 | } 139 | 140 | void Disk::setTotalBytes(quint64 totalBytes){ 141 | mTotalBytes = totalBytes; 142 | } 143 | 144 | void Disk::setFileSystemType(QString fileSystemType){ 145 | mFileSystemType = fileSystemType; 146 | } 147 | 148 | void Disk::setDevice(QString device){ 149 | mDevice = device; 150 | } 151 | /**-----------------------------------------------------------------------**/ 152 | 153 | /** 154 | * @brief Disk::showSize 155 | * @param val 156 | * @return value with its size byte 157 | * 158 | * Evaluate whether the size is in KBs, MBs, GBs and so on 159 | */ 160 | QString Disk::showSize(quint64 val) const{ 161 | QString charSet = "KMGTPEZY"; 162 | int i = 0; 163 | 164 | QString result; 165 | QString res = charSet.at(i); 166 | double prevValue, value ; 167 | value = val; 168 | 169 | while(value > 1){ 170 | prevValue = value; 171 | value = value/1024; 172 | i+=1; 173 | } 174 | 175 | result = QString::number(prevValue); 176 | result = QString(result +" " + charSet.at(i-1) + "B"); 177 | 178 | return result; 179 | 180 | } 181 | -------------------------------------------------------------------------------- /systemmonitor.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * ----------------------------------- 3 | * QtSysMonitor 4 | * ----------------------------------- 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * --------------------------------------------------------------------------- 20 | * Started By: Navjot Singh in November 2016 21 | * 22 | * Organization:Weavebytes Infotech Pvt Ltd 23 | * --------------------------------------------------------------------------- 24 | */ 25 | 26 | #include "systemmonitor.h" 27 | 28 | #if defined(_WIN32) 29 | #include 30 | 31 | #elif defined(__unix__) || defined(__unix) || defined(unix) || (defined(__APPLE__) && defined(__MACH__)) 32 | #include 33 | #include 34 | #include 35 | #if defined(BSD) 36 | #include 37 | #endif 38 | 39 | #else 40 | #error "Unable to define getMemorySize( ) for an unknown OS." 41 | #endif 42 | 43 | SystemMonitor::SystemMonitor(QObject *parent) : QObject(parent) 44 | { 45 | 46 | } 47 | 48 | /** 49 | * @brief SystemMonitor::getMemorySize 50 | * @return size_t of RAM 51 | * This function contains native/legacy source code for Windows, Linux and Mac 52 | */ 53 | size_t SystemMonitor::getMemorySize() { 54 | #if defined(_WIN32) && (defined(__CYGWIN__) || defined(__CYGWIN32__)) 55 | /* Cygwin under Windows. ------------------------------------ */ 56 | /* New 64-bit MEMORYSTATUSEX isn't available. Use old 32.bit */ 57 | MEMORYSTATUS status; 58 | status.dwLength = sizeof(status); 59 | GlobalMemoryStatus( &status ); 60 | return (size_t)status.dwTotalPhys; 61 | 62 | #elif defined(_WIN32) 63 | /* Windows. ------------------------------------------------- */ 64 | /* Use new 64-bit MEMORYSTATUSEX, not old 32-bit MEMORYSTATUS */ 65 | MEMORYSTATUSEX status; 66 | status.dwLength = sizeof(status); 67 | GlobalMemoryStatusEx( &status ); 68 | return (size_t)status.ullTotalPhys; 69 | 70 | #elif defined(__unix__) || defined(__unix) || defined(unix) || (defined(__APPLE__) && defined(__MACH__)) 71 | /* UNIX variants. ------------------------------------------- */ 72 | /* Prefer sysctl() over sysconf() except sysctl() HW_REALMEM and HW_PHYSMEM */ 73 | 74 | #if defined(CTL_HW) && (defined(HW_MEMSIZE) || defined(HW_PHYSMEM64)) 75 | int mib[2]; 76 | mib[0] = CTL_HW; 77 | #if defined(HW_MEMSIZE) 78 | mib[1] = HW_MEMSIZE; /* OSX. --------------------- */ 79 | #elif defined(HW_PHYSMEM64) 80 | mib[1] = HW_PHYSMEM64; /* NetBSD, OpenBSD. --------- */ 81 | #endif 82 | int64_t size = 0; /* 64-bit */ 83 | size_t len = sizeof( size ); 84 | if ( sysctl( mib, 2, &size, &len, NULL, 0 ) == 0 ) 85 | return (size_t)size; 86 | return 0L; /* Failed? */ 87 | 88 | #elif defined(_SC_AIX_REALMEM) 89 | /* AIX. ----------------------------------------------------- */ 90 | return (size_t)sysconf( _SC_AIX_REALMEM ) * (size_t)1024L; 91 | 92 | #elif defined(_SC_PHYS_PAGES) && defined(_SC_PAGESIZE) 93 | /* FreeBSD, Linux, OpenBSD, and Solaris. -------------------- */ 94 | return (size_t)sysconf( _SC_PHYS_PAGES ) * 95 | (size_t)sysconf( _SC_PAGESIZE ); 96 | 97 | #elif defined(_SC_PHYS_PAGES) && defined(_SC_PAGE_SIZE) 98 | /* Legacy. -------------------------------------------------- */ 99 | return (size_t)sysconf( _SC_PHYS_PAGES ) * 100 | (size_t)sysconf( _SC_PAGE_SIZE ); 101 | 102 | #elif defined(CTL_HW) && (defined(HW_PHYSMEM) || defined(HW_REALMEM)) 103 | /* DragonFly BSD, FreeBSD, NetBSD, OpenBSD, and OSX. -------- */ 104 | int mib[2]; 105 | mib[0] = CTL_HW; 106 | #if defined(HW_REALMEM) 107 | mib[1] = HW_REALMEM; /* FreeBSD. ----------------- */ 108 | #elif defined(HW_PYSMEM) 109 | mib[1] = HW_PHYSMEM; /* Others. ------------------ */ 110 | #endif 111 | unsigned int size = 0; /* 32-bit */ 112 | size_t len = sizeof( size ); 113 | if ( sysctl( mib, 2, &size, &len, NULL, 0 ) == 0 ) 114 | return (size_t)size; 115 | return 0L; /* Failed? */ 116 | #endif /* sysctl and sysconf variants */ 117 | 118 | #else 119 | return 0L; /* Unknown OS. */ 120 | #endif 121 | } 122 | 123 | QString SystemMonitor::getMemorySizeStr() { 124 | QString charSet = " KMGTPEZY"; 125 | int i = 0; 126 | 127 | QString result; 128 | QString res = charSet.at(i); 129 | double prevValue, value ; 130 | value = getMemorySize(); 131 | 132 | while(value > 1){ 133 | prevValue = value; 134 | value = value/1024; 135 | i+=1; 136 | } 137 | 138 | result = QString::number(prevValue); 139 | result = QString(result +" " + charSet.at(i-1) + "B"); 140 | 141 | return result; 142 | } 143 | -------------------------------------------------------------------------------- /settingsdialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | SettingsDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 640 10 | 472 11 | 12 | 13 | 14 | QtSysMonitor - Settings 15 | 16 | 17 | 18 | 19 | 550 20 | 431 21 | 80 22 | 31 23 | 24 | 25 | 26 | Save 27 | 28 | 29 | 30 | 31 | 32 | 10 33 | 20 34 | 621 35 | 401 36 | 37 | 38 | 39 | 0 40 | 41 | 42 | 43 | Debug 44 | 45 | 46 | 47 | 48 | 10 49 | 20 50 | 141 51 | 20 52 | 53 | 54 | 55 | Use file logger 56 | 57 | 58 | 59 | 60 | 61 | 20 62 | 50 63 | 100 64 | 20 65 | 66 | 67 | 68 | Debug 69 | 70 | 71 | 72 | 73 | 74 | 20 75 | 130 76 | 100 77 | 20 78 | 79 | 80 | 81 | Error 82 | 83 | 84 | 85 | 86 | 87 | 20 88 | 110 89 | 100 90 | 20 91 | 92 | 93 | 94 | Critica&l 95 | 96 | 97 | 98 | 99 | 100 | 20 101 | 70 102 | 100 103 | 20 104 | 105 | 106 | 107 | Info 108 | 109 | 110 | 111 | 112 | 113 | 20 114 | 90 115 | 100 116 | 20 117 | 118 | 119 | 120 | Warning 121 | 122 | 123 | 124 | 125 | 126 | Appearance 127 | 128 | 129 | 130 | 131 | 20 132 | 30 133 | 121 134 | 16 135 | 136 | 137 | 138 | Background Color 139 | 140 | 141 | 142 | 143 | 144 | 160 145 | 30 146 | 80 147 | 22 148 | 149 | 150 | 151 | Choose 152 | 153 | 154 | 155 | 156 | 157 | Refresh Rate 158 | 159 | 160 | 161 | 162 | 60 163 | 50 164 | 291 165 | 191 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | Process tab 175 | 176 | 177 | 178 | 179 | 180 | 181 | Qt::Horizontal 182 | 183 | 184 | 185 | 40 186 | 20 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | Resources tab 202 | 203 | 204 | 205 | 206 | 207 | 208 | Qt::Horizontal 209 | 210 | 211 | 212 | 40 213 | 20 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 10 231 | 431 232 | 80 233 | 31 234 | 235 | 236 | 237 | Cancel 238 | 239 | 240 | 241 | 242 | 243 | 244 | processLabel 245 | linkHovered(QString) 246 | processSpinBox 247 | clear() 248 | 249 | 250 | 92 251 | 146 252 | 253 | 254 | 346 255 | 146 256 | 257 | 258 | 259 | 260 | 261 | -------------------------------------------------------------------------------- /batteryinfo.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * ----------------------------------- 3 | * QtSysMonitor 4 | * ----------------------------------- 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * --------------------------------------------------------------------------- 20 | * Started By: Navjot Singh in November 2016 21 | * 22 | * Organization:Weavebytes Infotech Pvt Ltd 23 | * --------------------------------------------------------------------------- 24 | */ 25 | 26 | #include "batteryinfo.h" 27 | 28 | /** 29 | * @brief BatteryInfo::BatteryInfo 30 | */ 31 | BatteryInfo::BatteryInfo(){ 32 | 33 | } 34 | 35 | /** 36 | * @brief BatteryInfo::setName 37 | * @param val 38 | */ 39 | void BatteryInfo::setName(QString val){ 40 | mName = val ; 41 | } 42 | 43 | /** 44 | * @brief BatteryInfo::setStatus 45 | * @param val 46 | */ 47 | void BatteryInfo::setStatus(QString val){ 48 | mStatus = val ; 49 | } 50 | 51 | /** 52 | * @brief BatteryInfo::setSupplyPresent 53 | * @param val 54 | */ 55 | void BatteryInfo::setSupplyPresent(int val){ 56 | mSupplyPresent = val ; 57 | } 58 | 59 | /** 60 | * @brief BatteryInfo::setSupplyTechnology 61 | * @param val 62 | */ 63 | void BatteryInfo::setSupplyTechnology(QString val){ 64 | mSupplyTechnology = val ; 65 | } 66 | 67 | /** 68 | * @brief BatteryInfo::setSupplyCycleCount 69 | * @param val 70 | */ 71 | void BatteryInfo::setSupplyCycleCount(quint64 val){ 72 | mSupplyCycleCount = val ; 73 | } 74 | 75 | /** 76 | * @brief BatteryInfo::setSupplyVoltageMinDesign 77 | * @param val 78 | */ 79 | void BatteryInfo::setSupplyVoltageMinDesign(quint64 val){ 80 | mSupplyVoltageMinDesign = val ; 81 | } 82 | 83 | /** 84 | * @brief BatteryInfo::setSupplyVoltageNow 85 | * @param val 86 | */ 87 | void BatteryInfo::setSupplyVoltageNow(quint64 val){ 88 | mSupplyVoltageNow = val ; 89 | } 90 | 91 | /** 92 | * @brief BatteryInfo::setSupplyCurrentNow 93 | * @param val 94 | */ 95 | void BatteryInfo::setSupplyCurrentNow(quint64 val){ 96 | mSupplyCurrentNow = val ; 97 | } 98 | 99 | /** 100 | * @brief BatteryInfo::setSupplyChargeFullDesign 101 | * @param val 102 | */ 103 | void BatteryInfo::setSupplyChargeFullDesign(quint64 val){ 104 | mSupplyChargeFullDesign = val ; 105 | } 106 | 107 | /** 108 | * @brief BatteryInfo::setSupplyChargeFull 109 | * @param val 110 | */ 111 | void BatteryInfo::setSupplyChargeFull(quint64 val){ 112 | mSupplyChargeFull = val ; 113 | } 114 | 115 | /** 116 | * @brief BatteryInfo::setSupplyChargeNow 117 | * @param val 118 | */ 119 | void BatteryInfo::setSupplyChargeNow(quint64 val){ 120 | mSupplyChargeNow = val ; 121 | } 122 | 123 | /** 124 | * @brief BatteryInfo::setSupplyCapacity 125 | * @param val 126 | */ 127 | void BatteryInfo::setSupplyCapacity(quint64 val){ 128 | mSupplyCapacity = val ; 129 | } 130 | 131 | /** 132 | * @brief BatteryInfo::setSupplyCapacityLevel 133 | * @param val 134 | */ 135 | void BatteryInfo::setSupplyCapacityLevel(QString val){ 136 | mSupplyCapacityLevel = val ; 137 | } 138 | 139 | /** 140 | * @brief BatteryInfo::setSupplyModelName 141 | * @param val 142 | */ 143 | void BatteryInfo::setSupplyModelName(QString val){ 144 | mSupplyModelName = val ; 145 | } 146 | 147 | /** 148 | * @brief BatteryInfo::setSupplyManufacturer 149 | * @param val 150 | */ 151 | void BatteryInfo::setSupplyManufacturer(QString val){ 152 | mSupplyManufacturer = val ; 153 | } 154 | 155 | /** 156 | * @brief BatteryInfo::getName 157 | * @return 158 | */ 159 | QString BatteryInfo::getName () const{ 160 | return this->mName; 161 | } 162 | 163 | /** 164 | * @brief BatteryInfo::getStatus 165 | * @return 166 | */ 167 | QString BatteryInfo::getStatus () const{ 168 | return this->mStatus; 169 | } 170 | 171 | /** 172 | * @brief BatteryInfo::getSupplyPresent 173 | * @return 174 | */ 175 | int BatteryInfo::getSupplyPresent () const{ 176 | return this->mSupplyPresent; 177 | } 178 | 179 | /** 180 | * @brief BatteryInfo::getSupplyTechnology 181 | * @return 182 | */ 183 | QString BatteryInfo::getSupplyTechnology () const{ 184 | return this->mSupplyTechnology; 185 | } 186 | 187 | /** 188 | * @brief BatteryInfo::getSupplyCycleCount 189 | * @return 190 | */ 191 | quint64 BatteryInfo::getSupplyCycleCount () const{ 192 | return this->mSupplyCycleCount; 193 | } 194 | 195 | /** 196 | * @brief BatteryInfo::getSupplyVoltageMinDesign 197 | * @return 198 | */ 199 | quint64 BatteryInfo::getSupplyVoltageMinDesign () const{ 200 | return this->mSupplyVoltageMinDesign; 201 | } 202 | 203 | /** 204 | * @brief BatteryInfo::getSupplyVoltageNow 205 | * @return 206 | */ 207 | quint64 BatteryInfo::getSupplyVoltageNow () const{ 208 | return this->mSupplyVoltageNow; 209 | } 210 | 211 | /** 212 | * @brief BatteryInfo::getSupplyCurrentNow 213 | * @return 214 | */ 215 | quint64 BatteryInfo::getSupplyCurrentNow () const{ 216 | return this->mSupplyCurrentNow; 217 | } 218 | 219 | /** 220 | * @brief BatteryInfo::getSupplyChargeFullDesign 221 | * @return 222 | */ 223 | quint64 BatteryInfo::getSupplyChargeFullDesign () const{ 224 | return this->mSupplyChargeFullDesign; 225 | } 226 | 227 | /** 228 | * @brief BatteryInfo::getSupplyChargeFull 229 | * @return 230 | */ 231 | quint64 BatteryInfo::getSupplyChargeFull () const{ 232 | return this->mSupplyChargeFull; 233 | } 234 | 235 | /** 236 | * @brief BatteryInfo::getSupplyChargeNow 237 | * @return 238 | */ 239 | quint64 BatteryInfo::getSupplyChargeNow () const{ 240 | return this->mSupplyChargeNow; 241 | } 242 | 243 | /** 244 | * @brief BatteryInfo::getSupplyCapacity 245 | * @return 246 | */ 247 | quint64 BatteryInfo::getSupplyCapacity () const{ 248 | return this->mSupplyCapacity; 249 | } 250 | 251 | /** 252 | * @brief BatteryInfo::getSupplyCapacityLevel 253 | * @return 254 | */ 255 | QString BatteryInfo::getSupplyCapacityLevel () const{ 256 | return this->mSupplyCapacityLevel; 257 | } 258 | 259 | /** 260 | * @brief BatteryInfo::getSupplyModelName 261 | * @return 262 | */ 263 | QString BatteryInfo::getSupplyModelName () const{ 264 | return this->mSupplyModelName; 265 | } 266 | 267 | /** 268 | * @brief BatteryInfo::getSupplyManufacturer 269 | * @return 270 | */ 271 | QString BatteryInfo::getSupplyManufacturer () const{ 272 | return this->mSupplyManufacturer; 273 | } 274 | 275 | /** 276 | * @brief BatteryInfo::showInfo 277 | */ 278 | void BatteryInfo::showInfo(){ 279 | qDebug() << "------------------Battery Info -------------------"; 280 | qDebug() << "POWER_SUPPLY_NAME. . . . . . . . : " << getName(); 281 | qDebug() << "POWER_SUPPLY_STATUS. . . . . . . : " << getStatus(); 282 | qDebug() << "POWER_SUPPLY_PRESENT . . . . . . : " << getSupplyPresent(); 283 | qDebug() << "POWER_SUPPLY_TECHNOLOGY. . . . . : " << getSupplyTechnology(); 284 | qDebug() << "POWER_SUPPLY_CYCLE_COUNT . . . . : " << getSupplyCycleCount(); 285 | qDebug() << "POWER_SUPPLY_VOLTAGE_MIN_DESIGN. : " << getSupplyVoltageMinDesign(); 286 | qDebug() << "POWER_SUPPLY_VOLTAGE_NOW . . . . : " << getSupplyVoltageNow(); 287 | qDebug() << "POWER_SUPPLY_CURRENT_NOW . . . . : " << getSupplyCurrentNow(); 288 | qDebug() << "POWER_SUPPLY_CHARGE_FULL_DESIGN. : " << getSupplyChargeFullDesign(); 289 | qDebug() << "POWER_SUPPLY_CHARGE_FULL . . . . : " << getSupplyChargeFull(); 290 | qDebug() << "POWER_SUPPLY_CHARGE_NOW . . . . : " << getSupplyChargeNow(); 291 | qDebug() << "POWER_SUPPLY_CAPACITY. . . . . . : " << getSupplyCapacity(); 292 | qDebug() << "POWER_SUPPLY_CAPACITY_LEVEL. . . : " << getSupplyCapacityLevel(); 293 | qDebug() << "POWER_SUPPLY_MODEL_NAME. . . . . : " << getSupplyModelName(); 294 | qDebug() << "POWER_SUPPLY_MANUFACTURER. . . . : " << getSupplyManufacturer(); 295 | qDebug() << "--------------------------------------------------"; 296 | } 297 | 298 | -------------------------------------------------------------------------------- /mainwindow.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * ----------------------------------- 3 | * QtSysMonitor 4 | * ----------------------------------- 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * --------------------------------------------------------------------------- 20 | * Started By: Navjot Singh in November 2016 21 | * 22 | * Organization:Weavebytes Infotech Pvt Ltd 23 | * --------------------------------------------------------------------------- 24 | */ 25 | 26 | #include "mainwindow.h" 27 | #include "ui_mainwindow.h" 28 | #include "systemmonitor.h" 29 | #include "qfilelogger.h" 30 | #include "platforminfo.h" 31 | 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | using namespace QtCharts; 38 | using namespace logger; 39 | 40 | MainWindow::MainWindow(QWidget *parent) : 41 | QMainWindow(parent), 42 | ui(new Ui::MainWindow) 43 | { 44 | ui->setupUi(this); 45 | setWindowTitle("Qt System Monitor"); 46 | setFixedSize(width(), height()); 47 | 48 | createMenus(); 49 | 50 | // pie chart 51 | addPieChart(); 52 | 53 | // donut chart 54 | // addDonutChart(); 55 | 56 | QFileLogger::CreateLogger(QString("logs.txt"), DEBUG); 57 | QFileLogger::Instance()->Debug("debug"); 58 | QFileLogger::Instance()->Info("info"); 59 | QFileLogger::Instance()->Warning("warning"); 60 | QFileLogger::Instance()->Critical("critical"); 61 | QFileLogger::Instance()->Error("error"); 62 | 63 | showPlatformInfo(); 64 | widProcesses = new ProcessWidget(ui->tableWidget); 65 | widProcesses->populateUi(); 66 | 67 | widResources = new ResourcesWidget(ui->resourcesTable); 68 | widResources->populateUi(); 69 | 70 | processTimer = new QTimer(this); processTimer->start(); 71 | socketTimer = new QTimer(this); socketTimer->start(); 72 | 73 | processTimer->setInterval(settings.value("timer/process").toInt() * 1000); 74 | socketTimer->setInterval(settings.value("timer/socket").toInt() * 1000); 75 | 76 | connect(processTimer, SIGNAL(timeout()), widProcesses, SLOT(refreshTimer())); 77 | connect(socketTimer, SIGNAL(timeout()), widResources, SLOT(refreshTimer())); 78 | connect(&dlgSettings, SIGNAL(settingsChanged()), this, SLOT(refreshSettings())); 79 | } 80 | 81 | MainWindow::~MainWindow() 82 | { 83 | delete socketTimer; 84 | delete processTimer; 85 | delete widProcesses; 86 | delete ui; 87 | } 88 | 89 | void MainWindow::showPlatformInfo() 90 | { 91 | PlatformInfo pInfo; 92 | 93 | // OS 94 | ui->lblOsName->setText(pInfo.getOsName()); 95 | ui->lblOsIcon->setPixmap(QPixmap(":/images/linux.png")); 96 | 97 | qDebug() << "CPU Architecure: " << pInfo.getCpuArchitecture(); 98 | 99 | // CPU 100 | ui->lblCpuArch->setText(pInfo.getCpuArchitecture()); 101 | ui->lblCpuIcon->setPixmap(QPixmap(":/images/cpu.png")); 102 | 103 | 104 | // RAM 105 | SystemMonitor sm; 106 | qDebug() << "RAM: " << sm.getMemorySize(); 107 | 108 | ui->lblRam->setText(sm.getMemorySizeStr()); 109 | ui->lblRamIcon->setPixmap(QPixmap(":/images/ram.png")); 110 | } 111 | 112 | void MainWindow::changeEvent(QEvent* e) 113 | { 114 | switch (e->type()) 115 | { 116 | case QEvent::LanguageChange: 117 | this->ui->retranslateUi(this); 118 | break; 119 | case QEvent::WindowStateChange: 120 | { 121 | if (this->windowState() & Qt::WindowMinimized) 122 | { 123 | //if (Preferences::instance().minimizeToTray()) 124 | //{ 125 | QTimer::singleShot(250, this, SLOT(hide())); 126 | //} 127 | } 128 | 129 | break; 130 | } 131 | default: 132 | break; 133 | } 134 | 135 | QMainWindow::changeEvent(e); 136 | } 137 | 138 | void MainWindow::createMenus() 139 | { 140 | 141 | QMenu *const fileMenu = menuBar()->addMenu(tr("&File")); 142 | fileMenu->addAction(tr("&Open..."), this, SLOT(open()), QKeySequence::Open); 143 | fileMenu->addAction("&Save As...", this, SLOT(save())); 144 | fileMenu->addSeparator(); 145 | fileMenu->addAction(tr("E&xit"),this, SLOT(close()), QKeySequence::Quit); 146 | 147 | QMenu *const editMenu = menuBar()->addMenu(tr("&Edit")); 148 | editMenu->addAction("Settings", this, SLOT(showSettings())); 149 | 150 | 151 | QMenu *const helpMenu = menuBar()->addMenu(tr("&Help")); 152 | helpMenu->addAction(tr("&About..."), this, SLOT(about())); 153 | helpMenu->addSeparator(); 154 | 155 | 156 | } 157 | void MainWindow::showSettings() { 158 | dlgSettings.show(); 159 | } 160 | 161 | void MainWindow::about() { 162 | dlgAbout.show(); 163 | } 164 | 165 | void MainWindow::open() { 166 | 167 | } 168 | 169 | void MainWindow::save() { 170 | } 171 | 172 | void MainWindow::addPieChart() { 173 | 174 | SystemUtil util; 175 | QList *diskList = new QList(); 176 | int returnCode = util.getDiskList(diskList); 177 | 178 | if(returnCode == ST_SUCCESS){ 179 | qDebug() << "Successfully retrieved disk list. . . "; 180 | }else { 181 | qDebug() << "Problem retrieving disk list . . . . ."; 182 | } 183 | 184 | QPieSeries *series = new QPieSeries(); 185 | QList sliceList; 186 | QPieSlice *slice; 187 | quint64 totalBytes = 0; 188 | 189 | for(int i = 0; i < diskList->size() ; i++){ 190 | totalBytes += diskList->at(i).getTotalBytes(); 191 | } 192 | 193 | for(int i = 0; i < diskList->size() ; i++){ 194 | qreal percentage = (qreal)diskList->at(i).getTotalBytes() / (qreal)totalBytes; 195 | QString str = QString(diskList->at(i).getRootPath()+" = " 196 | + QString::number(percentage*100) + " %"); 197 | slice = new QPieSlice(str, percentage); 198 | sliceList.append(slice); 199 | } 200 | 201 | series->append(sliceList); 202 | connect(series, SIGNAL(hovered(QPieSlice*,bool)), this, SLOT(handleLabel(QPieSlice*,bool))); 203 | 204 | QChart *chart = new QChart(); 205 | chart->addSeries(series); 206 | chart->legend()->setVisible(true); 207 | chart->legend()->setAlignment(Qt::AlignLeft); 208 | chart->legend()->setShowToolTips(true); 209 | chart->setTitle(QString("Disk Information (Disk Count : "+QString::number(diskList->size())+" )")); 210 | 211 | QChartView *chartView = new QChartView(chart); 212 | chartView->setRenderHint(QPainter::Antialiasing); 213 | 214 | ui->hlFileSystems->addWidget(chartView); 215 | } 216 | 217 | 218 | void MainWindow::addDonutChart() { 219 | QPieSeries *series = new QPieSeries(); 220 | series->setHoleSize(0.35); 221 | series->append("Protein 4.2%", 4.2); 222 | QPieSlice *slice = series->append("Fat 15.6%", 15.6); 223 | slice->setExploded(); 224 | slice->setLabelVisible(); 225 | series->append("Other 23.8%", 23.8); 226 | series->append("Carbs 56.4%", 56.4); 227 | 228 | QChartView *chartView = new QChartView(); 229 | chartView->setRenderHint(QPainter::Antialiasing); 230 | chartView->chart()->setTitle("Donut with a lemon glaze (100g)"); 231 | chartView->chart()->addSeries(series); 232 | chartView->chart()->legend()->setAlignment(Qt::AlignBottom); 233 | chartView->chart()->setTheme(QChart::ChartThemeBlueCerulean); 234 | chartView->chart()->legend()->setFont(QFont("Arial", 7)); 235 | 236 | ui->hlFileSystems->addWidget(chartView); 237 | } 238 | 239 | /** 240 | * @brief MainWindow::handleLabel 241 | * @param slice 242 | * @param state 243 | * 244 | * Changes states of label of slices on the basis of hovering 245 | */ 246 | void MainWindow::handleLabel(QPieSlice *slice, bool state){ 247 | 248 | if(state == true){ 249 | slice->setLabelVisible(true); 250 | slice->setBorderColor(QColor(Qt::green)); 251 | slice->setBorderWidth(2); 252 | }else{ 253 | slice->setLabelVisible(false); 254 | slice->setBorderColor(QColor(Qt::white)); 255 | slice->setBorderWidth(1); 256 | } 257 | 258 | } 259 | 260 | /** 261 | * @brief MainWindow::refreshSettings 262 | * 263 | * Slot function to apply the settings as soon as settings are changed. 264 | */ 265 | void MainWindow::refreshSettings(){ 266 | 267 | processTimer->setInterval(settings.value("timer/process").toInt() * 1000); 268 | socketTimer->setInterval(settings.value("timer/socket").toInt() * 1000); 269 | } 270 | -------------------------------------------------------------------------------- /mainwindow.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | MainWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 1000 10 | 680 11 | 12 | 13 | 14 | MainWindow 15 | 16 | 17 | 18 | 19 | 20 | 10 21 | 0 22 | 981 23 | 631 24 | 25 | 26 | 27 | 0 28 | 29 | 30 | 31 | Platform 32 | 33 | 34 | Show information about OS etc.. 35 | 36 | 37 | 38 | 39 | 70 40 | 50 41 | 140 42 | 140 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 100 53 | 210 54 | 91 55 | 16 56 | 57 | 58 | 59 | 60 | 10 61 | 75 62 | true 63 | 64 | 65 | 66 | OS Name 67 | 68 | 69 | 70 | 71 | 72 | 260 73 | 50 74 | 140 75 | 140 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 300 86 | 210 87 | 91 88 | 16 89 | 90 | 91 | 92 | 93 | 10 94 | 75 95 | true 96 | 97 | 98 | 99 | CPU Arch 100 | 101 | 102 | 103 | 104 | 105 | 500 106 | 50 107 | 140 108 | 140 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 550 119 | 210 120 | 91 121 | 16 122 | 123 | 124 | 125 | 126 | 10 127 | 75 128 | true 129 | 130 | 131 | 132 | RAM 133 | 134 | 135 | 136 | 137 | 138 | Processes 139 | 140 | 141 | Show list of all running processes etc. 142 | 143 | 144 | 145 | 146 | 0 147 | 0 148 | 981 149 | 581 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 0 158 | 0 159 | 160 | 161 | 162 | true 163 | 164 | 165 | QAbstractItemView::NoEditTriggers 166 | 167 | 168 | QAbstractItemView::SingleSelection 169 | 170 | 171 | QAbstractItemView::SelectRows 172 | 173 | 174 | true 175 | 176 | 177 | 140 178 | 179 | 180 | false 181 | 182 | 183 | 184 | Process ID 185 | 186 | 187 | 188 | 189 | Process Name 190 | 191 | 192 | 193 | 194 | User 195 | 196 | 197 | 198 | 199 | CPU Usage 200 | 201 | 202 | 203 | 204 | Memory Usage 205 | 206 | 207 | 208 | 209 | 210 | 211 | layoutWidget 212 | tableWidget 213 | 214 | 215 | 216 | Resources 217 | 218 | 219 | 220 | 221 | 0 222 | 0 223 | 981 224 | 581 225 | 226 | 227 | 228 | QAbstractItemView::NoEditTriggers 229 | 230 | 231 | QAbstractItemView::SingleSelection 232 | 233 | 234 | QAbstractItemView::SelectRows 235 | 236 | 237 | 110 238 | 239 | 240 | false 241 | 242 | 243 | 244 | Protocol Type 245 | 246 | 247 | 248 | 249 | Receive-Q 250 | 251 | 252 | 253 | 254 | Send-Q 255 | 256 | 257 | 258 | 259 | Local Address 260 | 261 | 262 | 263 | 264 | Foreign Address 265 | 266 | 267 | 268 | 269 | State 270 | 271 | 272 | 273 | 274 | PID 275 | 276 | 277 | 278 | 279 | Program Name 280 | 281 | 282 | 283 | 284 | 285 | 286 | File Systems 287 | 288 | 289 | 290 | 291 | 30 292 | 40 293 | 941 294 | 541 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 0 306 | 0 307 | 1000 308 | 30 309 | 310 | 311 | 312 | 313 | 314 | TopToolBarArea 315 | 316 | 317 | false 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | -------------------------------------------------------------------------------- /systemutil.cpp: -------------------------------------------------------------------------------- 1 | #include "systemutil.h" 2 | #include 3 | #include 4 | 5 | /** 6 | * @brief SystemUtil::SystemUtil 7 | * @param parent 8 | * Constructor to initialize variables 9 | */ 10 | SystemUtil::SystemUtil( QObject *parent ) 11 | : QObject( parent ) 12 | { 13 | 14 | mTopProcess = new QProcess(parent); 15 | mNetstatProcess = new QProcess(parent); 16 | mDfProcess = new QProcess(parent); 17 | 18 | mEnv = QProcess::systemEnvironment(); 19 | //---------------------------------------------------------// 20 | // Note:- 21 | // top command requires the value of TERM environment variable 22 | // for execution of the process 23 | // 24 | // top command contains maximum 512 characters in single row and 25 | // hence we need to redefine COLUMNS environment variable also 26 | // 27 | //---------------------------------------------------------// 28 | mEnv << "TERM=vt100" << "COLUMNS=512"; 29 | 30 | mTopProcess -> setEnvironment( mEnv ); 31 | 32 | } 33 | 34 | 35 | /** 36 | * @brief SystemUtil::~SystemUtil 37 | * Destructor 38 | */ 39 | SystemUtil::~SystemUtil(){ 40 | delete mTopProcess; 41 | delete mNetstatProcess; 42 | delete mDfProcess; 43 | } 44 | 45 | /** 46 | * @brief SystemUtil::getProcessesList 47 | * @param processList - contains list of Processes 48 | * @return exit_status 49 | * 50 | * Execute top process to analyze the current system status 51 | * and populate the processList with Process objects 52 | */ 53 | int SystemUtil::getProcessesList(QList *processList){ 54 | 55 | qDebug() <<"Getting Process List . . . . . . . . . "; 56 | 57 | mProcess = "top"; 58 | 59 | //---------------------------------------------------------// 60 | // -b for batch output 61 | // -n for number of iterations 62 | //---------------------------------------------------------// 63 | mArguments.clear(); 64 | mArguments << "-b" << "-n" << "1" ; 65 | 66 | mTopProcess -> start( mProcess , mArguments ); 67 | 68 | //---------------------------------------------------------// 69 | // to check whether mTopProcess has started or not 70 | //---------------------------------------------------------// 71 | if( !mTopProcess->waitForStarted() ) { 72 | qDebug() << "ERROR : " << mTopProcess->error(); 73 | } 74 | 75 | mTopProcess->waitForFinished() ; 76 | 77 | return parseProcesses(processList); 78 | 79 | } 80 | 81 | /** 82 | * @brief SystemUtil::parseProcesses 83 | * @param processList 84 | * @return exit_status 85 | * 86 | * takes the output of top command, split it and store it in Process data structure 87 | * appends the process to processList 88 | */ 89 | int SystemUtil::parseProcesses(QList *processList){ 90 | 91 | mOutputString.clear(); 92 | mOutputString = QString( mTopProcess -> readAll() ); 93 | 94 | mOutputList.clear(); 95 | mOutputList = mOutputString.split('\n' , QString::SkipEmptyParts ); 96 | 97 | /**************************************************************************/ 98 | /**************************************************************************/ 99 | // This is necessary because top command can produce different 100 | // output in different platforms . 101 | /**************************************************************************/ 102 | 103 | //---------------------------------------------------------// 104 | // headerRowIndex stores the value of index of header row, 105 | // so that we know where actual data starts.(from next line) 106 | //---------------------------------------------------------// 107 | int headerRowIndex = findHeaderRow(); 108 | 109 | if(headerRowIndex == -1) { 110 | return ST_FAILED; 111 | } 112 | 113 | QString headerRow = mOutputList.at(headerRowIndex); 114 | QStringList splittedHeaderRow = headerRow.split(' ',QString::SkipEmptyParts ); 115 | 116 | //---------------------------------------------------------// 117 | // Variables to store the indexes of headings so that actual 118 | // required data can be retrieved . 119 | //---------------------------------------------------------// 120 | int indexId, indexUser, indexCpu, indexMemory; 121 | 122 | for(int i = 0 ; i < splittedHeaderRow.size() ; i++){ 123 | QString val = splittedHeaderRow.at(i); 124 | if(val.toUpper() == "PID"){ 125 | indexId = i; 126 | }else if(val.toUpper() == "USER"){ 127 | indexUser = i; 128 | }else if(val.toUpper() == "%CPU"){ 129 | indexCpu = i; 130 | }else if(val.toUpper() == "RES"){ 131 | indexMemory = i; 132 | } 133 | } 134 | /**************************************************************************/ 135 | /**************************************************************************/ 136 | 137 | Process p; 138 | //---------------------------------------------------------// 139 | // headerRowIndex contains the headings and hence the 140 | // first row with required data will be at headerRowIndex+1 141 | // contains the first process in the list 142 | //---------------------------------------------------------// 143 | for(int i = headerRowIndex+1 ; i < mOutputList.size() ; i++ ){ 144 | 145 | QString str = mOutputList.at( i ) ; 146 | 147 | //---------------------------------------------------------// 148 | // splits one process string on the basis of whitespaces. 149 | //---------------------------------------------------------// 150 | QStringList splittedString = str.split( QRegExp("\\s"), QString::SkipEmptyParts ); 151 | 152 | //------------------------------------------------------------------// 153 | //splits the numerical value of memory from string on the basis of m 154 | //------------------------------------------------------------------// 155 | QStringList memValue = splittedString[ indexMemory ] 156 | .split( QRegExp("m"), QString::SkipEmptyParts ); 157 | 158 | QString pName = splittedString.last() ; 159 | QString user = splittedString[ indexUser ] ; 160 | quint64 pID = splittedString[ indexId ].toLongLong(); 161 | float cpuUsage = splittedString[ indexCpu ].toDouble(); 162 | double memUsage = memValue[0].toDouble(); 163 | 164 | p.setProcessId(pID); 165 | p.setCpuUsage(cpuUsage); 166 | p.setMemoryUsage(memUsage); 167 | p.setProcessName(pName); 168 | p.setUser(user); 169 | 170 | processList->append( p ); 171 | 172 | } 173 | 174 | return ST_SUCCESS; 175 | 176 | } 177 | 178 | /** 179 | * @brief SystemUtil::getDiskList 180 | * @param diskList - contains list of Disks 181 | * @return exit_status 182 | * 183 | * Analyze the details of disks on the system 184 | * and poplutes the diskList with Disk object 185 | */ 186 | int SystemUtil::getDiskList(QList *diskList){ 187 | 188 | qDebug() <<"Getting Disk List . . . . . . . . . "; 189 | 190 | mProcess = "df"; 191 | 192 | //---------------------------------------------------------// 193 | // -T for file system type 194 | //---------------------------------------------------------// 195 | mArguments.clear(); 196 | mArguments << "-T" ; 197 | 198 | mDfProcess -> start( mProcess , mArguments ); 199 | 200 | //---------------------------------------------------------// 201 | // to check whether mDfProcess has started or not 202 | //---------------------------------------------------------// 203 | if( !mDfProcess->waitForStarted() ) { 204 | qDebug() << "ERROR : " << mDfProcess->error(); 205 | } 206 | 207 | mDfProcess->waitForFinished() ; 208 | 209 | return parseDisks(diskList); 210 | } 211 | 212 | /** 213 | * @brief SystemUtil::parseDisks 214 | * @param diskList 215 | * @return exit_status 216 | * 217 | * takes the output of df command, split it and store it in Disk value object 218 | * appends the disk to diskList 219 | */ 220 | int SystemUtil::parseDisks(QList *diskList){ 221 | 222 | mOutputString.clear(); 223 | mOutputString = QString(mDfProcess->readAll()); 224 | 225 | mOutputList.clear(); 226 | mOutputList = mOutputString.split(QRegExp("\n"), QString::SkipEmptyParts); 227 | 228 | //---------------------------------------------------------// 229 | // No need to find the index of header row this time because 230 | // the arguments forces the output of command to have header 231 | // row in first row mOutputList. 232 | //---------------------------------------------------------// 233 | QString headerRow = mOutputList.at(0); 234 | 235 | QStringList splittedHeaderRow = headerRow.split(QRegExp("\\s"), QString::SkipEmptyParts); 236 | 237 | int indexName, indexRootPath, indexAvailable, indexTotal, indexFileSystem, indexDevice; 238 | 239 | for(int i = 0; i < splittedHeaderRow.size();i++){ 240 | bool mountOn = false; 241 | QString val = splittedHeaderRow.at(i); 242 | val = val.toUpper(); 243 | 244 | if(val == QString("TYPE")){ 245 | if(!mountOn){ 246 | indexFileSystem = i; 247 | }else { 248 | indexFileSystem = i-1; 249 | } 250 | }else if(val == QString("1K-BLOCKS")) { 251 | if(!mountOn){ 252 | indexTotal = i; 253 | }else{ 254 | indexTotal = i - 1; 255 | } 256 | }else if(val == QString("AVAILABLE")) { 257 | if(!mountOn){ 258 | indexAvailable = i; 259 | }else { 260 | indexAvailable = i - 1; 261 | } 262 | }else if(val == QString("FILESYSTEM")) { 263 | if(!mountOn){ 264 | indexDevice = i; 265 | }else{ 266 | indexDevice = i - 1; 267 | } 268 | }else if(val == QString("MOUNTED")){ 269 | indexRootPath = i; 270 | mountOn = true; 271 | } 272 | } 273 | indexName = indexRootPath; 274 | 275 | Disk d; 276 | 277 | for(int i = 1; i < mOutputList.size(); i++){ 278 | 279 | QString singleRow = mOutputList.at(i); 280 | QStringList splittedSingleRow = singleRow.split(QRegExp("\\s"), QString::SkipEmptyParts); 281 | 282 | quint64 total = splittedSingleRow.at(indexTotal).toLongLong(); 283 | quint64 available = splittedSingleRow.at(indexAvailable).toLongLong(); 284 | 285 | d.setName(splittedSingleRow.at( indexName )); 286 | d.setRootPath(splittedSingleRow.at( indexRootPath )); 287 | d.setAvailableBytes(available); 288 | d.setTotalBytes(total); 289 | d.setDevice(splittedSingleRow.at( indexDevice )); 290 | d.setFileSystemType(splittedSingleRow.at( indexFileSystem)); 291 | 292 | diskList->append(d); 293 | 294 | } 295 | 296 | return ST_SUCCESS; 297 | 298 | } 299 | 300 | int SystemUtil::getSocketList(QList *socketList){ 301 | 302 | qDebug() <<"Getting Socket List . . . . . . . . . "; 303 | 304 | mProcess = "netstat"; 305 | 306 | mArguments.clear(); 307 | mArguments << "-a" << "-p" << "--inet"; 308 | 309 | mNetstatProcess->start(mProcess, mArguments); 310 | 311 | //---------------------------------------------------------// 312 | // to check whether mNetstatProcess has started or not 313 | //---------------------------------------------------------// 314 | if( !mNetstatProcess->waitForStarted() ) { 315 | qDebug() << "ERROR : " << mNetstatProcess->error(); 316 | } 317 | 318 | mNetstatProcess->waitForFinished(); 319 | 320 | return parseSockets(socketList); 321 | } 322 | 323 | 324 | /** 325 | * @brief SystemUtil::parseSockets 326 | * @param socketList 327 | * @return exit_status 328 | * 329 | * takes the output of netstat command, split it and store it in NetworkSocket data structure 330 | * appends the process to socketList 331 | */ 332 | int SystemUtil::parseSockets(QList *socketList){ 333 | 334 | mOutputString.clear(); 335 | mOutputString = QString( mNetstatProcess -> readAll() ); 336 | 337 | mOutputList.clear(); 338 | mOutputList = mOutputString.split('\n' , QString::SkipEmptyParts ); 339 | 340 | /**************************************************************************/ 341 | /**************************************************************************/ 342 | // This is necessary because netstat command can produce different 343 | // output in different platforms . 344 | /**************************************************************************/ 345 | 346 | //---------------------------------------------------------// 347 | // headerRowIndex stores the value of index of header row, 348 | // so that we know where actual data starts.(from next line) 349 | //---------------------------------------------------------// 350 | int headerRowIndex = findNetstatHeaderRow(); 351 | 352 | if(headerRowIndex == -1) { 353 | return ST_FAILED; 354 | } 355 | 356 | QString headerRow = mOutputList.at(headerRowIndex); 357 | QStringList splittedHeaderRow = headerRow.split(' ',QString::SkipEmptyParts ); 358 | 359 | //---------------------------------------------------------// 360 | // Variables to store the indexes of headings so that actual 361 | // required data can be retrieved . 362 | //---------------------------------------------------------// 363 | int indexProto, indexReceive, indexSend, indexLAddress, indexFAddress, indexState; 364 | 365 | //---------------------------------------------------------// 366 | // To determine whether local address and foreign address 367 | // have appeared or not, because they both appear as "foreign" and "address" 368 | // as two different strings 369 | //---------------------------------------------------------// 370 | bool flagLAddress = false; 371 | bool flagFAddress = false; 372 | for(int i = 0 ; i < splittedHeaderRow.size() ; i++){ 373 | QString val = splittedHeaderRow.at(i); 374 | if(val.toUpper() == "PROTO"){ 375 | 376 | if(!flagFAddress && !flagLAddress){ 377 | indexProto = i; 378 | }else{ 379 | if(flagFAddress && flagLAddress){ 380 | indexProto = i - 2; 381 | }else if(flagLAddress || flagFAddress){ 382 | indexProto = i - 1; 383 | } 384 | } 385 | 386 | }else if(val.toUpper() == "RECV-Q"){ 387 | 388 | if(!flagFAddress && !flagLAddress){ 389 | indexReceive = i; 390 | }else{ 391 | if(flagFAddress && flagLAddress){ 392 | indexReceive = i - 2; 393 | }else if(flagLAddress || flagFAddress){ 394 | indexReceive = i - 1; 395 | } 396 | } 397 | 398 | }else if(val.toUpper() == "SEND-Q"){ 399 | 400 | if(!flagFAddress && !flagLAddress){ 401 | indexSend = i; 402 | }else{ 403 | if(flagFAddress && flagLAddress){ 404 | indexSend = i - 2; 405 | }else if(flagLAddress || flagFAddress){ 406 | indexSend = i - 1; 407 | } 408 | } 409 | 410 | }else if(val.toUpper() == "LOCAL"){ 411 | flagLAddress = true; 412 | 413 | if(!flagFAddress && !flagLAddress){ 414 | indexLAddress = i; 415 | }else{ 416 | if(flagFAddress && flagLAddress){ 417 | indexFAddress = i - 2; 418 | }else if(flagLAddress || flagFAddress){ 419 | indexLAddress = i - 1; 420 | } 421 | } 422 | 423 | }else if(val.toUpper() == "FOREIGN"){ 424 | flagFAddress = true; 425 | 426 | if(!flagFAddress && !flagLAddress){ 427 | indexFAddress = i; 428 | }else{ 429 | if(flagFAddress && flagLAddress){ 430 | indexFAddress = i - 2; 431 | }else if(flagLAddress || flagFAddress){ 432 | indexFAddress = i - 1; 433 | } 434 | } 435 | 436 | }else if(val.toUpper() == "STATE"){ 437 | 438 | if(!flagFAddress && !flagLAddress){ 439 | indexState = i; 440 | }else{ 441 | if(flagFAddress && flagLAddress){ 442 | indexState = i - 2; 443 | }else if(flagLAddress || flagFAddress){ 444 | indexState = i - 1; 445 | } 446 | } 447 | 448 | } 449 | } 450 | /**************************************************************************/ 451 | /**************************************************************************/ 452 | 453 | 454 | NetworkSocket s; 455 | 456 | //---------------------------------------------------------// 457 | // loop start from 2 because mOutputList.at( 2 ) 458 | // contains the first socket information in the list 459 | //---------------------------------------------------------// 460 | for(int i = 2; i < mOutputList.size(); i++) { 461 | 462 | 463 | QString str = mOutputList.at( i ) ; 464 | 465 | //---------------------------------------------------------// 466 | // splits one socket string on the basis of whitespaces. 467 | //---------------------------------------------------------// 468 | QStringList splittedString = str.split( QRegExp("\\s"), QString::SkipEmptyParts ); 469 | 470 | QString ProtocolType = splittedString.at(indexProto); 471 | quint64 ReceiveQ = splittedString.at(indexReceive).toLongLong(); 472 | quint64 SendQ = splittedString.at(indexSend).toLongLong(); 473 | QString LocalAddress = splittedString.at(indexLAddress); 474 | QString ForeignAddress = splittedString.at(indexFAddress); 475 | 476 | QString State; 477 | quint64 PID; 478 | QString ProgramName; 479 | 480 | //------------------------------------------------------------// 481 | // Size of splittedString should be 7 482 | // if it is not 7, then it means that one column value is missing 483 | // and that column in state columns 484 | //------------------------------------------------------------// 485 | if(splittedString.size() < 7) { 486 | State = ""; 487 | } else { 488 | State = splittedString.at(indexState); 489 | } 490 | 491 | //------------------------------------------------------------// 492 | // If splittedString.last value is equal to "-" 493 | // this implies that no program is using it 494 | //------------------------------------------------------------// 495 | if(splittedString.last() == "-") { 496 | PID = 0L; 497 | ProgramName = ""; 498 | } else { 499 | QString lastColumnValue = splittedString.last(); 500 | QStringList splittedLastColumn = lastColumnValue.split(QRegExp("/")); 501 | 502 | PID = splittedLastColumn.at(0).toLongLong(); 503 | ProgramName = splittedLastColumn.at(1); 504 | } 505 | 506 | s.setProtocolType( ProtocolType); 507 | s.setReceiveQ( ReceiveQ); 508 | s.setSendQ( SendQ); 509 | s.setLocalAddress( LocalAddress); 510 | s.setForeignAddress( ForeignAddress); 511 | s.setState( State); 512 | s.setPID( PID); 513 | s.setProgramName( ProgramName); 514 | 515 | socketList->append(s); 516 | 517 | } 518 | 519 | return ST_SUCCESS; 520 | } 521 | 522 | /** 523 | * @brief SystemUtil::showBatteryDetails 524 | * 525 | * Shows the battery details. 526 | * Reads from the file "/sys/class/power_supply/BAT0/uevent" 527 | */ 528 | void SystemUtil::showBatteryDetails() { 529 | 530 | QFile batteryDetail(QString("/sys/class/power_supply/BAT0/uevent")); 531 | batteryDetail.open(QIODevice::ReadOnly); 532 | 533 | QString str(batteryDetail.readAll()); 534 | QStringList strList = str.split('\n',QString::SkipEmptyParts); 535 | BatteryInfo b; 536 | 537 | for( int i = 0 ; i < strList.size() ; i++ ){ 538 | QString str = strList.at( i ); 539 | QStringList splittedString = str.split('='); 540 | 541 | switch (i) { 542 | case 0: b.setName(splittedString.at(1)); 543 | break; 544 | case 1: b.setStatus(splittedString.at(1)); 545 | break; 546 | case 2: b.setSupplyPresent(splittedString.at(1).toLongLong()); 547 | break; 548 | case 3: b.setSupplyTechnology(splittedString.at(1)); 549 | break; 550 | case 4: b.setSupplyCycleCount(splittedString.at(1).toLongLong()); 551 | break; 552 | case 5: b.setSupplyVoltageMinDesign(splittedString.at(1).toLongLong()); 553 | break; 554 | case 6: b.setSupplyVoltageNow(splittedString.at(1).toLongLong()); 555 | break; 556 | case 7: b.setSupplyCurrentNow(splittedString.at(1).toLongLong()); 557 | break; 558 | case 8: b.setSupplyChargeFullDesign(splittedString.at(1).toLongLong()); 559 | break; 560 | case 9: b.setSupplyChargeFull(splittedString.at(1).toLongLong()); 561 | break; 562 | case 10: b.setSupplyChargeNow(splittedString.at(1).toLongLong()); 563 | break; 564 | case 11: b.setSupplyCapacity(splittedString.at(1).toLongLong()); 565 | break; 566 | case 12: b.setSupplyCapacityLevel(splittedString.at(1)); 567 | break; 568 | case 13: b.setSupplyModelName(splittedString.at(1)); 569 | break; 570 | case 14: b.setSupplyManufacturer(splittedString.at(1)); 571 | default: 572 | break; 573 | } 574 | } 575 | 576 | b.showInfo(); 577 | 578 | } 579 | 580 | /** 581 | * @brief SystemUtil::findHeaderRow 582 | * @return index of header row 583 | * This functions helps to find out the first header row index 584 | * after which required data will be present for the top process output. 585 | */ 586 | int SystemUtil::findHeaderRow(){ 587 | 588 | int iterator = 0; 589 | while(iterator < mOutputList.size()){ 590 | 591 | QString singleRow = mOutputList.at(iterator); 592 | QStringList splittedSingleRow = singleRow.split(QRegExp("\\s"),QString::SkipEmptyParts); 593 | 594 | QString firstMember = splittedSingleRow.at(0); 595 | firstMember = firstMember.toUpper(); 596 | if(firstMember == "PID"){ 597 | return iterator; 598 | } 599 | iterator+=1; 600 | } 601 | return -1; 602 | } 603 | 604 | /** 605 | * @brief SystemUtil::findNetstatHeaderRow 606 | * @return 607 | * This functions helps to find out the first header row index 608 | * after which required data will be present for the netstat process output 609 | */ 610 | int SystemUtil::findNetstatHeaderRow(){ 611 | 612 | int iterator = 0; 613 | while(iterator < mOutputList.size()){ 614 | 615 | QString singleRow = mOutputList.at(iterator); 616 | QStringList splittedSingleRow = singleRow.split(QRegExp("\\s"),QString::SkipEmptyParts); 617 | 618 | QString firstMember = splittedSingleRow.at(0); 619 | firstMember = firstMember.toUpper(); 620 | if(firstMember == "PROTO"){ 621 | return iterator; 622 | } 623 | iterator+=1; 624 | } 625 | return -1; 626 | } 627 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | {one line to give the program's name and a brief idea of what it does.} 635 | Copyright (C) {year} {name of author} 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | {project} Copyright (C) {year} {fullname} 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------