Poprawiona tabela

This commit is contained in:
yanczi 2025-11-24 06:56:43 +01:00
parent bfb1bf5f61
commit c27949ff3f
7 changed files with 100 additions and 74 deletions

View file

@ -25,8 +25,8 @@ ViewCargo::ViewCargo()
, filesLen(0)
, tablePos(0)
{
// TODO Auto-generated constructor stub
std::vector<std::string> header = {"Comress", "Encrypt", "Path", "RefHASH"};
list.push_back(header);
}
//-----------------------------------------------------------------------------
@ -55,17 +55,6 @@ bool ViewCargo::View(const std::string& path)
return false;
}
//Table Header
std::vector<ftxui::Element> headElements;
headElements.push_back(ftxui::text(" Compressed ") | ftxui::bold);
headElements.push_back(ftxui::text(" Encrypted ") | ftxui::bold);
headElements.push_back(ftxui::text("Nazwa pliku") | ftxui::bold | ftxui::size(ftxui::WIDTH, ftxui::EQUAL, 56));
headElements.push_back(ftxui::text("Hash Name") | ftxui::bold | ftxui::size(ftxui::WIDTH, ftxui::EQUAL, 20));
filesList.push_back(hbox(std::move(headElements)));
//Pobieranie listy plików
GetFileList(path);
@ -151,6 +140,7 @@ void ViewCargo::GetFileList(const std::string& path)
}
cargo.close();
tui.table(list);
}
//-----------------------------------------------------------------------------
@ -162,6 +152,9 @@ void ViewCargo::CreateTableRow(const std::string& file, const uint8_t& zip, cons
std::stringstream ss;
ss << "0x" << std::hex << std::uppercase << hash;
//Lista
std::vector<std::string> tmpList = { "[ ]", "[ ]", file, ss.str() };
std::vector<ftxui::Element> cell;
ftxui::Element eZip;
@ -171,34 +164,28 @@ void ViewCargo::CreateTableRow(const std::string& file, const uint8_t& zip, cons
switch (zip)
{
case 1:
eZip = ftxui::text(" [x] ") | ftxui::color(ftxui::Color::Cyan);
eEnc = ftxui::text(" [ ] ") | ftxui::color(ftxui::Color::White);
//eZip = ftxui::text(" [x] ") | ftxui::color(ftxui::Color::Cyan);
//eEnc = ftxui::text(" [ ] ") | ftxui::color(ftxui::Color::White);
tmpList[0] = "[x]";
break;
case 2:
eZip = ftxui::text(" [ ] ") | ftxui::color(ftxui::Color::White);
eEnc = ftxui::text(" [x] ") | ftxui::color(ftxui::Color::Cyan);
tmpList[1] = "[x]";
break;
case 3:
eZip = ftxui::text(" [x] ") | ftxui::color(ftxui::Color::Cyan);
eEnc = ftxui::text(" [x] ") | ftxui::color(ftxui::Color::Cyan);
tmpList[0] = "[x]";
tmpList[1] = "[x]";
break;
default:
eZip = ftxui::text(" [ ] ") | ftxui::color(ftxui::Color::White);
eEnc = ftxui::text(" [ ] ") | ftxui::color(ftxui::Color::White);
tmpList[0] = "[ ]";
tmpList[1] = "[ ]";
break;
}
//Dodawanie komurek
cell.push_back(eZip);
cell.push_back(eEnc | ftxui::size(ftxui::WIDTH, ftxui::EQUAL, 7));
cell.push_back(ftxui::text(file) | ftxui::size(ftxui::WIDTH, ftxui::EQUAL, 56));
cell.push_back(ftxui::text(ss.str()) | ftxui::size(ftxui::WIDTH, ftxui::EQUAL, 20));
//Konwersja komurek na wiersz
filesList.push_back(ftxui::hbox(std::move(cell)));
//Dodanie wiersza do listy
list.push_back(tmpList);
}
//-----------------------------------------------------------------------------