reHDD/include/tui.h

67 lines
1.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
#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:
2020-08-06 22:45:05 +02:00
enum UserInput { UpKey, DownKey, Abort, Shred, 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
void updateTUI(vector <Drive>* pvecDrives, 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-23 11:04:10 +02:00
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-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);
2020-08-23 09:26:32 +02:00
static WINDOW *createEntryWindow(int iXSize, int iYSize, int iXStart, int iYStart,string sModelFamily, string sModelName, string sCapacity, string sState, bool bSelected);
2020-08-07 22:52:11 +02:00
static WINDOW *createSystemStats(int iXSize, int iYSize, 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);
2020-08-23 11:04:10 +02:00
2020-08-10 22:52:13 +02:00
void displaySelectedDrive(Drive drive, int stdscrX, int stdscrY);
2020-08-03 22:40:07 +02:00
2020-08-09 23:05:32 +02:00
};
2020-08-03 22:40:07 +02:00
#endif // TUI_H_