Permalink
Please sign in to comment.
Showing
with
2,289 additions
and 1 deletion.
- +5 −0 .gitignore
- 0 CHANGELOG
- +39 −0 CMakeLists.txt
- +14 −1 README.md
- +38 −0 app/CMakeLists.txt
- +71 −0 app/drivepanel.cpp
- +32 −0 app/drivepanel.h
- +52 −0 app/drivepanel.ui
- +150 −0 app/drivepropertiesmodel.cpp
- +33 −0 app/drivepropertiesmodel.h
- +27 −0 app/main.cpp
- +150 −0 app/mainwindow.cpp
- +32 −0 app/mainwindow.h
- +181 −0 app/mainwindow.ui
- +92 −0 app/mdraidpanel.cpp
- +37 −0 app/mdraidpanel.h
- +52 −0 app/mdraidpanel.ui
- +109 −0 app/mdraidpropertiesmodel.cpp
- +31 −0 app/mdraidpropertiesmodel.h
- +133 −0 app/storagedatamodel.cpp
- +31 −0 app/storagedatamodel.h
- +14 −0 libdiskmonitor/CMakeLists.txt
- +37 −0 libdiskmonitor/dbus_metatypes.h
- +140 −0 libdiskmonitor/drive.cpp
- +39 −0 libdiskmonitor/drive.h
- +130 −0 libdiskmonitor/mdraid.cpp
- +42 −0 libdiskmonitor/mdraid.h
- +168 −0 libdiskmonitor/storageunit.cpp
- +64 −0 libdiskmonitor/storageunit.h
- +273 −0 libdiskmonitor/udisks2wrapper.cpp
- +73 −0 libdiskmonitor/udisks2wrapper.h
| @@ -0,0 +1,5 @@ | ||
| +build | ||
| +*.user | ||
| +*.orig | ||
| +*.swp | ||
| + |
| @@ -0,0 +1,39 @@ | ||
| +project(diskmonitor) | ||
| + | ||
| +cmake_minimum_required(VERSION 2.8.12) | ||
| +set (QT_MIN_VERSION "5.2.0") | ||
| + | ||
| +find_package(ECM 1.6.0 REQUIRED NO_MODULE) | ||
| +set (CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) | ||
| + | ||
| +add_definitions(-DTRANSLATION_DOMAIN="diskmonitor") | ||
| + | ||
| +include(KDEInstallDirs) | ||
| +include(KDECompilerSettings) | ||
| +include(KDECMakeSettings) | ||
| +include(ECMMarkAsTest) | ||
| +include(FeatureSummary) | ||
| + | ||
| +find_package (Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS | ||
| + Core | ||
| + DBus | ||
| + Widgets | ||
| +) | ||
| + | ||
| +find_package(KF5 REQUIRED COMPONENTS | ||
| + I18n | ||
| + IconThemes | ||
| +) | ||
| + | ||
| + | ||
| +kde_enable_exceptions() | ||
| + | ||
| + | ||
| +include_directories( ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/libdiskmonitor ) | ||
| + | ||
| +add_subdirectory( libdiskmonitor ) | ||
| +add_subdirectory( app ) | ||
| + | ||
| + | ||
| +feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) | ||
| + |
| @@ -1,2 +1,15 @@ | ||
| -# diskmonitor | ||
| +# DisKMonitor | ||
| KDE tools to monitor SMART devices and MDRaid health status | ||
| + | ||
| +# Requirements | ||
| +* **KF5** | ||
| +* **UDisks2** >= 2.1 | ||
| + | ||
| +# Build | ||
| + mkdir build && cd build | ||
| + cmake .. | ||
| + make | ||
| + | ||
| +# Planned | ||
| + * A small daemon app watching silently the status of devices and notifying the user via KDE Notifications when something goes wrong | ||
| + |
| @@ -0,0 +1,38 @@ | ||
| +set(APP_SRCS | ||
| + main.cpp | ||
| + mdraidpropertiesmodel.cpp | ||
| + mainwindow.cpp | ||
| + drivepanel.cpp | ||
| + mdraidpanel.cpp | ||
| + storagedatamodel.cpp | ||
| + drivepropertiesmodel.cpp | ||
| +) | ||
| + | ||
| +ki18n_wrap_ui(APP_SRCS | ||
| + mainwindow.ui | ||
| + drivepanel.ui | ||
| + mdraidpanel.ui | ||
| +) | ||
| + | ||
| + | ||
| +add_executable( diskmonitor ${APP_SRCS} ) | ||
| + | ||
| +target_link_libraries( diskmonitor | ||
| + libdiskmonitor | ||
| + Qt5::Core | ||
| + Qt5::DBus | ||
| + KF5::I18n | ||
| + KF5::IconThemes | ||
| + | ||
| +#TODO cleanup | ||
| +# KF5::ConfigWidgets | ||
| +# KF5::GuiAddons | ||
| +# KF5::Notifications | ||
| +# KF5::XmlGui | ||
| +) | ||
| + | ||
| +#kconfig_add_kcfg_files(kcalc_KDEINIT_SRCS kcalc_settings.kcfgc ) | ||
| +#kf5_add_kdeinit_executable( diskmonitor ${SRCS}) | ||
| + | ||
| +install(TARGETS diskmonitor ${INSTALL_TARGETS_DEFAULT_ARGS} ) | ||
| + |
| @@ -0,0 +1,71 @@ | ||
| +#include "drivepanel.h" | ||
| +#include "ui_drivepanel.h" | ||
| + | ||
| +#include "udisks2wrapper.h" | ||
| + | ||
| + | ||
| +/* | ||
| + * | ||
| + */ | ||
| +DrivePanel::DrivePanel(QWidget *parent) : | ||
| + QWidget(parent), | ||
| + ui(new Ui::DrivePanel) | ||
| +{ | ||
| + ui->setupUi(this); | ||
| + | ||
| + this -> model = new DrivePropertiesModel(); | ||
| + ui -> tableView -> verticalHeader() -> hide(); | ||
| + ui -> tableView -> horizontalHeader() -> setSectionResizeMode(QHeaderView::ResizeMode::ResizeToContents); | ||
| + ui -> tableView -> horizontalHeader() -> setStretchLastSection(true); | ||
| + ui -> tableView -> setModel(this -> model); | ||
| + | ||
| + connect(ui -> startSelfTestButton, SIGNAL(clicked()), this, SLOT(startSelfTest())); | ||
| + | ||
| +} | ||
| + | ||
| + | ||
| + | ||
| +/* | ||
| + * | ||
| + */ | ||
| +DrivePanel::~DrivePanel() | ||
| +{ | ||
| + delete model; | ||
| + delete ui; | ||
| +} | ||
| + | ||
| + | ||
| + | ||
| +/* | ||
| + * | ||
| + */ | ||
| +void DrivePanel::setDrive(Drive* drive) | ||
| +{ | ||
| + model -> updateDrive(drive); | ||
| + | ||
| + ui -> tableView -> setEnabled(drive -> isSmartSupported() && drive -> isSmartEnabled()); | ||
| + ui -> startSelfTestButton -> setEnabled(drive -> isSmartSupported() && drive -> isSmartEnabled()); | ||
| +} | ||
| + | ||
| + | ||
| + | ||
| +/* | ||
| + * | ||
| + */ | ||
| +void DrivePanel::refresh() | ||
| +{ | ||
| + model -> refreshAll(); | ||
| +} | ||
| + | ||
| + | ||
| + | ||
| +/* | ||
| + * | ||
| + */ | ||
| +void DrivePanel::startSelfTest() | ||
| +{ | ||
| + Drive* currentDrive = model -> getDrive(); | ||
| + | ||
| + if(currentDrive != NULL) | ||
| + UDisks2Wrapper::getInstance() -> startDriveSelfTest(currentDrive); | ||
| +} |
| @@ -0,0 +1,32 @@ | ||
| +#ifndef DRIVEPANEL_H | ||
| +#define DRIVEPANEL_H | ||
| + | ||
| +#include <QWidget> | ||
| + | ||
| +#include "drivepropertiesmodel.h" | ||
| + | ||
| + | ||
| +namespace Ui { | ||
| +class DrivePanel; | ||
| +} | ||
| + | ||
| +class DrivePanel : public QWidget | ||
| +{ | ||
| + Q_OBJECT | ||
| + | ||
| +public: | ||
| + explicit DrivePanel(QWidget *parent = 0); | ||
| + ~DrivePanel(); | ||
| + | ||
| + void setDrive(Drive* drive); | ||
| + void refresh(); | ||
| + | ||
| +private: | ||
| + Ui::DrivePanel *ui; | ||
| + DrivePropertiesModel* model; | ||
| + | ||
| +public slots: | ||
| + void startSelfTest(); | ||
| +}; | ||
| + | ||
| +#endif // DRIVEPANEL_H |
| @@ -0,0 +1,52 @@ | ||
| +<?xml version="1.0" encoding="UTF-8"?> | ||
| +<ui version="4.0"> | ||
| + <class>DrivePanel</class> | ||
| + <widget class="QWidget" name="DrivePanel"> | ||
| + <property name="geometry"> | ||
| + <rect> | ||
| + <x>0</x> | ||
| + <y>0</y> | ||
| + <width>400</width> | ||
| + <height>300</height> | ||
| + </rect> | ||
| + </property> | ||
| + <property name="windowTitle"> | ||
| + <string>Form</string> | ||
| + </property> | ||
| + <layout class="QVBoxLayout" name="verticalLayout"> | ||
| + <item> | ||
| + <widget class="QTableView" name="tableView"> | ||
| + <property name="alternatingRowColors"> | ||
| + <bool>true</bool> | ||
| + </property> | ||
| + </widget> | ||
| + </item> | ||
| + <item> | ||
| + <layout class="QHBoxLayout" name="horizontalLayout"> | ||
| + <item> | ||
| + <spacer name="horizontalSpacer"> | ||
| + <property name="orientation"> | ||
| + <enum>Qt::Horizontal</enum> | ||
| + </property> | ||
| + <property name="sizeHint" stdset="0"> | ||
| + <size> | ||
| + <width>40</width> | ||
| + <height>20</height> | ||
| + </size> | ||
| + </property> | ||
| + </spacer> | ||
| + </item> | ||
| + <item> | ||
| + <widget class="QPushButton" name="startSelfTestButton"> | ||
| + <property name="text"> | ||
| + <string>Start SelfTest</string> | ||
| + </property> | ||
| + </widget> | ||
| + </item> | ||
| + </layout> | ||
| + </item> | ||
| + </layout> | ||
| + </widget> | ||
| + <resources/> | ||
| + <connections/> | ||
| +</ui> |
Oops, something went wrong.
0 comments on commit
1f17118