diff --git a/src/Views/HomebrewView/homebrewView.cpp b/src/Views/HomebrewView/homebrewView.cpp index 07561f5..ae91aa0 100644 --- a/src/Views/HomebrewView/homebrewView.cpp +++ b/src/Views/HomebrewView/homebrewView.cpp @@ -8,6 +8,10 @@ #include #include #include +#include +#include + + extern unsigned char _binary_assets_spr_img_preview_infobg_png_start; extern unsigned char _binary_assets_spr_img_preview_btn_download_png_start; @@ -207,6 +211,16 @@ void HomebrewView::startYoutube() const 0x20000, (std::string("webmodal: https://www.youtube.com/embed/") + hb_.trailer + "?autoplay=1").c_str()); } +std::string HomebrewView::sizeRoundAndString(int sizeinbytes){ + double i = 0.000001*sizeinbytes; +i = round( i * 100.0 ) / 100.0; +std::string sizevalueinmb; +std::stringstream ss; +ss << i; +sizevalueinmb = ss.str() + "MB"; +return sizevalueinmb; +} + int HomebrewView::Display() { bg.Display(); @@ -217,7 +231,7 @@ int HomebrewView::Display() font_40.Draw(Point(HB_X + 225, HB_Y + 88), hb_.name, COLOR_WHITE); font_25.Draw(Point(HB_X + 225, HB_Y + 115), hb_.author, COLOR_AQUA); font_25.Draw(Point(HB_X + 225, HB_Y + 144), hb_.version, COLOR_WHITE); - // font_20.Draw(Point(HB_X + 100, HB_Y + 189), std::string("0 Kb"), COLOR_WHITE); + font_20.Draw(Point(HB_X + 100, HB_Y + 200), sizeRoundAndString(hb_.size+hb_.datasize), COLOR_WHITE); // font_20.Draw(Point(HB_X + 850, HB_Y + 503), hb_.date.str, COLOR_WHITE); font_25.Draw(Point(HB_X + 40, HB_Y + 362), description); diff --git a/src/Views/HomebrewView/homebrewView.h b/src/Views/HomebrewView/homebrewView.h index 65f51d8..110f1be 100644 --- a/src/Views/HomebrewView/homebrewView.h +++ b/src/Views/HomebrewView/homebrewView.h @@ -48,4 +48,5 @@ class HomebrewView : public View void checkInstalled(); void homebrewInstall(); void startYoutube() const; + std::string sizeRoundAndString(int); }; diff --git a/src/homebrew.cpp b/src/homebrew.cpp index 0a1fdcb..32c73dc 100644 --- a/src/homebrew.cpp +++ b/src/homebrew.cpp @@ -55,7 +55,8 @@ namespace YAML hb.url = node["url"].as(); if (node["data"]) hb.data = node["data"].as(); - + hb.size = node["size"].as(); + hb.datasize = node["data_size"].as(); return true; } }; // namespace YAML diff --git a/src/homebrew.h b/src/homebrew.h index 63a635a..c3fbf95 100644 --- a/src/homebrew.h +++ b/src/homebrew.h @@ -22,6 +22,8 @@ class Homebrew { std::vector screenshots; std::string url; std::string data; + int size; + int datasize; bool IsInstalled(); };