reHDD/include/tui.h

82 lines
2.8 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
2022-10-01 14:21:08 +02:00
#define COLOR_AREA_ENTRY_EVEN 3
#define COLOR_AREA_ENTRY_ODD 4
#define COLOR_AREA_ENTRY_SELECTED 5
#define COLOR_AREA_DETAIL 6
2020-08-03 22:40:07 +02:00
class TUI
{
protected:
public:
2024-04-24 22:31:09 +02:00
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
2024-04-24 22:31:09 +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;
2024-04-24 22:31:09 +02:00
WINDOW *overview;
WINDOW *systemview;
WINDOW *detailview;
WINDOW *menuview;
WINDOW *dialog;
WINDOW *smartWarning;
2020-08-04 22:35:29 +02:00
2024-04-24 22:31:09 +02:00
static void centerTitle(WINDOW *pwin, const char *title);
static WINDOW *createOverViewWindow(int iXSize, int iYSize);
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);
2024-04-24 22:31:09 +02:00
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);
2024-04-24 22:31:09 +02:00
static void vTruncateText(string *psText, uint16_t u16MaxLenght);
2020-08-09 23:05:32 +02:00
};
2024-04-24 22:31:09 +02:00
#endif // TUI_H_