reHDD/include/tui.h

72 lines
2.6 KiB
C
Raw Normal View History

2020-08-03 22:40:07 +02:00
/**
* @file tui.h
* @brief display user interface
* @author hendrik schutter
* @date 03.08.2020
*/
#ifndef TUI_H_
#define TUI_H_
#include "reHDD.h"
#define COLOR_AREA_STDSCR 1
#define COLOR_AREA_OVERVIEW 2
#define COLOR_AREA_ENTRY 3
2020-08-07 11:38:00 +02:00
#define COLOR_AREA_ENTRY_SELECTED 4
2020-08-07 16:17:45 +02:00
#define COLOR_AREA_DETAIL 5
2020-08-03 22:40:07 +02:00
class TUI
{
protected:
public:
enum UserInput { UpKey, DownKey, Abort, Shred, ShredAll, Delete, Enter, ESC, Undefined};
2020-08-09 21:41:28 +02:00
struct MenuState
{
bool bAbort;
bool bShred;
bool bDelete;
bool bConfirmShred;
bool bConfirmDelete;
};
2020-08-06 22:45:05 +02:00
2020-08-04 17:18:32 +02:00
TUI(void);
2020-08-03 22:40:07 +02:00
2020-08-04 22:35:29 +02:00
static void initTUI();
2020-08-04 17:18:32 +02:00
2020-09-16 15:13:32 +02:00
void updateTUI(list <Drive>* plistDrives, uint8_t u8SelectedEntry);
2020-08-03 22:40:07 +02:00
2020-08-06 22:45:05 +02:00
static enum UserInput readUserInput();
2020-08-03 22:40:07 +02:00
private:
2020-08-04 22:35:29 +02:00
static string sCpuUsage;
static string sRamUsage;
static string sLocalTime;
2020-08-09 21:41:28 +02:00
WINDOW* overview;
WINDOW* systemview;
2020-08-10 22:52:13 +02:00
WINDOW* detailview;
2020-08-09 21:41:28 +02:00
WINDOW* menuview;
2020-08-09 23:05:32 +02:00
WINDOW* dialog;
2020-09-21 14:45:52 +02:00
WINDOW* smartWarning;
2020-08-04 22:35:29 +02:00
static void centerTitle(WINDOW *pwin, const char * title);
static WINDOW *createOverViewWindow( int iXSize, int iYSize);
2020-08-07 12:07:29 +02:00
static WINDOW *createDetailViewWindow( int iXSize, int iYSize, int iXStart, Drive drive);
static WINDOW *overwriteDetailViewWindow( int iXSize, int iYSize, int iXStart);
static WINDOW *createEntryWindow(int iXSize, int iYSize, int iXStart, int iYStart, int iListIndex, string sModelFamily, string sSerial, string sCapacity, string sState, string sTime, string sSpeed, string sTemp, bool bSelected);
2020-09-21 16:11:31 +02:00
static WINDOW *createSystemStats(int iXSize, int iYSize, int iXStart, int iYStart);
2020-08-09 21:41:28 +02:00
static WINDOW *createMenuView(int iXSize, int iYSize, int iXStart, int iYStart, struct MenuState menustate);
2020-08-09 23:05:32 +02:00
static WINDOW *createDialog(int iXSize, int iYSize, int iXStart, int iYStart, string selectedTask, string optionA, string optionB);
static WINDOW* createFrozenWarning(int iXSize, int iYSize, int iXStart, int iYStart, string sPath, string sModelFamily, string sModelName, string sSerial, string sProgress);
static WINDOW* createSmartWarning(int iXSize, int iYSize, int iXStart, int iYStart, string sPath, uint32_t u32PowerOnHours, uint32_t u32PowerCycles, uint32_t u32ErrorCount, uint32_t u32Temperature);
static WINDOW* createZeroChecksumWarning(int iXSize, int iYSize, int iXStart, int iYStart, string sPath, string sModelFamily, string sModelName, string sSerial, uint32_t u32Checksum);
2020-08-23 11:04:10 +02:00
2020-08-10 22:52:13 +02:00
void displaySelectedDrive(Drive drive, int stdscrX, int stdscrY);
string formatTimeDuration(time_t u32Duration);
2022-06-30 00:32:13 +02:00
string formatSpeed(time_t u32ShredTimeDelta, unsigned long ulWrittenBytes);
2022-05-11 23:45:05 +02:00
2020-08-09 23:05:32 +02:00
};
2020-08-03 22:40:07 +02:00
#endif // TUI_H_