From 1c55e1b3e763cf416767e01be1152d1947b3bdcc Mon Sep 17 00:00:00 2001 From: TangoCash Date: Sat, 30 Apr 2022 16:31:45 +0200 Subject: [PATCH] fix progressbar in moviebrowser Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/d2918e8857779435fa9539823a35b81fede24e42 Author: TangoCash Date: 2022-04-30 (Sat, 30 Apr 2022) --- src/gui/moviebrowser/mb.cpp | 30 ++++-------------------------- 1 file changed, 4 insertions(+), 26 deletions(-) diff --git a/src/gui/moviebrowser/mb.cpp b/src/gui/moviebrowser/mb.cpp index 6db2aaa7b..17da1d933 100644 --- a/src/gui/moviebrowser/mb.cpp +++ b/src/gui/moviebrowser/mb.cpp @@ -1638,32 +1638,10 @@ void CMovieBrowser::refreshDetailsLine(int pos) void CMovieBrowser::info_hdd_level(bool paint_hdd) { - if (show_mode == MB_SHOW_YT) - return; - - int percent_used = 0; - int tmp_percent_used = 0; - struct statfs s; - if (getSelectedFile() != NULL) { - if (::statfs(getSelectedFile()->Name.c_str(), &s) == 0) { - if (s.f_blocks > 0) { - uint64_t bytes_total = s.f_blocks * s.f_bsize; - uint64_t bytes_free = s.f_bfree * s.f_bsize; - uint64_t bytes_used = bytes_total - bytes_free; - percent_used = (bytes_used * 200 + bytes_total) / 2 / bytes_total; - } - } - } - - if (tmp_percent_used != percent_used || paint_hdd) { - tmp_percent_used = percent_used; - const short pbw = 100; - const short border = m_cBoxFrameTitleRel.iHeight/4; - CProgressBar pb(m_cBoxFrame.iX+ m_cBoxFrameFootRel.iWidth - m_header->getContextBtnObject()->getWidth() - pbw - border, m_cBoxFrame.iY+m_cBoxFrameTitleRel.iY + border, pbw, m_cBoxFrameTitleRel.iHeight/2); - pb.setType(CProgressBar::PB_REDRIGHT); - pb.setValues(percent_used, 100); - pb.paint(false); - } + if (g_settings.infobar_show_sysfs_hdd && paint_hdd) + m_header->enableProgessBar(cHddStat::getInstance()->getPercent()); + else + m_header->setProgessBar(cHddStat::getInstance()->getPercent()); } void CMovieBrowser::refreshLCD(void)