create first beta release #23
@ -8,7 +8,7 @@
|
||||
#include "../../include/reHDD.h"
|
||||
|
||||
|
||||
TUI::TUI(void){
|
||||
TUI::TUI(void) {
|
||||
|
||||
|
||||
|
||||
@ -35,20 +35,29 @@ void TUI::initTUI()
|
||||
clear();
|
||||
curs_set(0);
|
||||
init_color(COLOR_GRAY, 173, 170, 173);
|
||||
|
||||
|
||||
init_pair(COLOR_AREA_STDSCR,COLOR_WHITE, COLOR_BLUE);
|
||||
wbkgd(stdscr, COLOR_PAIR(COLOR_AREA_STDSCR));
|
||||
|
||||
int stdscrX, stdscrY;
|
||||
getmaxyx(stdscr, stdscrY, stdscrX);
|
||||
mvprintw(0, 2, "reHDD - HDD refurbishing tool - Licensed under GPL 3.0 X:%d Y:%d",stdscrX,stdscrY);
|
||||
|
||||
}
|
||||
|
||||
void TUI::updateTUI(vector <Drive>* pvecDrives) {
|
||||
|
||||
|
||||
werase(stdscr);
|
||||
|
||||
//werase(stdscr);
|
||||
|
||||
int stdscrX, stdscrY;
|
||||
getmaxyx(stdscr, stdscrY, stdscrX);
|
||||
|
||||
init_pair(COLOR_AREA_STDSCR,COLOR_WHITE, COLOR_BLUE);
|
||||
wbkgd(stdscr, COLOR_PAIR(COLOR_AREA_STDSCR));
|
||||
|
||||
mvprintw(0, 2, "reHDD - HDD refurbishing tool - Licensed under GPL 3.0 X:%d Y:%d",stdscrX,stdscrY);
|
||||
|
||||
// mvprintw(0, 2, "reHDD - HDD refurbishing tool - Licensed under GPL 3.0 X:%d Y:%d",stdscrX,stdscrY);
|
||||
|
||||
refresh();
|
||||
|
||||
@ -61,7 +70,7 @@ void TUI::updateTUI(vector <Drive>* pvecDrives) {
|
||||
vWinDriveEntries.clear();
|
||||
|
||||
|
||||
int i = 0;
|
||||
// int i = 0;
|
||||
|
||||
vector <Drive>::iterator it;
|
||||
for (it = pvecDrives->begin(); it != pvecDrives->end(); ++it)
|
||||
@ -71,17 +80,14 @@ int i = 0;
|
||||
string sModelName = it->getModelName();
|
||||
string sCapacity = it->sCapacityToText();
|
||||
|
||||
|
||||
WINDOW * tmp = createEntryWindow( ((int)(stdscrX/3) - 2), 5, 3, (5* (it - pvecDrives->begin()) )+3, sModelFamily, sModelName, sCapacity);
|
||||
|
||||
// WINDOW * tmp = createEntryWindow( ((int)(stdscrX/3) - 2), 5, 3, (5* (it - pvecDrives->begin()) )+3, sModelFamily, sModelName, sCapacity);
|
||||
// WINDOW * tmp = createEntryWindow( ((int)(stdscrX/3) - 2), 5, 3, (5* (i) )+3, sModelFamily, sModelName, sCapacity);
|
||||
|
||||
|
||||
WINDOW * tmp = createEntryWindow( ((int)(stdscrX/3) - 2), 5, 3, (5* (i) )+3, sModelFamily, sModelName, sCapacity);
|
||||
|
||||
// vWinDriveEntries.push_back(tmp);
|
||||
// vWinDriveEntries.push_back(tmp);
|
||||
wrefresh(tmp);
|
||||
|
||||
i++;
|
||||
// i++;
|
||||
}
|
||||
|
||||
|
||||
@ -107,20 +113,23 @@ WINDOW* TUI::createOverViewWindow( int iXSize, int iYSize) {
|
||||
wbkgd(newWindow, COLOR_PAIR(COLOR_AREA_OVERVIEW));
|
||||
box(newWindow, ACS_VLINE, ACS_HLINE);
|
||||
|
||||
|
||||
time_t rawtime;
|
||||
struct tm * timeinfo;
|
||||
char buffer[80];
|
||||
struct tm * timeinfo;
|
||||
char buffer[80];
|
||||
|
||||
time (&rawtime);
|
||||
timeinfo = localtime(&rawtime);
|
||||
time (&rawtime);
|
||||
timeinfo = localtime(&rawtime);
|
||||
|
||||
strftime(buffer,sizeof(buffer),"%d-%m-%Y %H:%M:%S",timeinfo);
|
||||
std::string str(buffer);
|
||||
strftime(buffer,sizeof(buffer),"%d-%m-%Y %H:%M:%S",timeinfo);
|
||||
std::string str(buffer);
|
||||
|
||||
|
||||
centerTitle(newWindow, str.c_str());
|
||||
|
||||
//mvwaddstr(newWindow, 2, 3, "Drücke eine Taste");
|
||||
|
||||
//refresh();
|
||||
|
||||
return newWindow;
|
||||
}
|
||||
|
||||
@ -133,8 +142,6 @@ WINDOW* TUI::createDetailViewWindow( int iXSize, int iYSize, int iXStart) {
|
||||
box(newWindow, ACS_VLINE, ACS_HLINE);
|
||||
centerTitle(newWindow, "Selected Drive: xyz");
|
||||
|
||||
// mvaddstr(iXStart+1, 5, "Test");
|
||||
|
||||
return newWindow;
|
||||
}
|
||||
|
||||
@ -146,17 +153,12 @@ WINDOW* TUI::createEntryWindow(int iXSize, int iYSize, int iXStart, int iYStart,
|
||||
box(newWindow, ACS_VLINE, ACS_HLINE);
|
||||
|
||||
attron(COLOR_PAIR(COLOR_AREA_ENTRY));
|
||||
mvaddstr(iYStart+1, 5, "Test");
|
||||
|
||||
mvwaddstr(newWindow,1, 1, sModelFamily.c_str());
|
||||
mvwaddstr(newWindow,2, 1, sModelName.c_str());
|
||||
mvwaddstr(newWindow,3, 1, sCapacity.c_str());
|
||||
|
||||
//addstr("test");
|
||||
|
||||
|
||||
//cout << "X: " << sModelFamily << endl;
|
||||
|
||||
// mvaddstr(iYStart+2, 5, sModelName.c_str());
|
||||
//mvaddstr(iYStart+3, 5, sCapacity.c_str());
|
||||
|
||||
refresh();
|
||||
// refresh();
|
||||
|
||||
return newWindow;
|
||||
}
|
||||
|
@ -46,13 +46,13 @@ uint32_t Drive::getPowerCycles(void)
|
||||
return u32PowerCycles;
|
||||
}
|
||||
|
||||
string Drive::sCapacityToText(){
|
||||
if(getCapacity() <= (999*1000000000U)){
|
||||
string Drive::sCapacityToText() {
|
||||
if(getCapacity() <= (999*1000000000U)) {
|
||||
// Less or even 999 GB --> GB
|
||||
return to_string(getCapacity() / 1000000000U) + " GB";
|
||||
return to_string(getCapacity() / 1000000000U) + " GB";
|
||||
}
|
||||
else{
|
||||
// More 999 GB --> TB
|
||||
else {
|
||||
// More 999 GB --> TB
|
||||
return to_string(getCapacity() / 1000000000000U) + " TB";
|
||||
}
|
||||
return "ERROR";
|
||||
|
@ -30,7 +30,7 @@ reHDD::reHDD(void)
|
||||
{
|
||||
cout << "created app" << endl;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -80,7 +80,7 @@ void reHDD::app_logic(void)
|
||||
|
||||
void reHDD::ThreadScannDevices() {
|
||||
while(true) {
|
||||
// cout << "Thread" << endl;
|
||||
// cout << "Thread" << endl;
|
||||
mxScannDrives.lock();
|
||||
vecNewDrives.clear();
|
||||
searchDrives(&vecNewDrives); //search for new drives and store them in list
|
||||
@ -110,7 +110,7 @@ void reHDD::filterNewDrives(vector <Drive>* pvecOldDrives, vector <Drive>* pvecN
|
||||
}
|
||||
|
||||
if(bOldDriveIsOffline == true) {
|
||||
cout << "offline drive found: " << itOld->getPath() << endl;
|
||||
//cout << "offline drive found: " << itOld->getPath() << endl;
|
||||
//TODO kill wipe thread
|
||||
}
|
||||
}
|
||||
@ -130,7 +130,7 @@ void reHDD::filterNewDrives(vector <Drive>* pvecOldDrives, vector <Drive>* pvecN
|
||||
*/
|
||||
void reHDD::searchDrives(vector <Drive>* pvecDrives)
|
||||
{
|
||||
// cout << "search drives ..." << endl;
|
||||
// cout << "search drives ..." << endl;
|
||||
char * cLine = NULL;
|
||||
size_t len = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user