Permalink
Browse files

Introduce DisKMonitor GUI application

  • Loading branch information...
1 parent b93c77c commit 1f1711880716350033969386b96f459446fe2c25 @papylhomme committed Feb 4, 2015
View
@@ -0,0 +1,5 @@
+build
+*.user
+*.orig
+*.swp
+
View
No changes.
View
@@ -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)
+
View
@@ -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
+
View
@@ -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} )
+
View
@@ -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);
+}
View
@@ -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
View
@@ -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

Please sign in to comment.