add thread for determining free hdd (recording dir) space, enable hdd usage icons on vfd (untested)

Conflicts:
	data/locale/deutsch.locale
	data/locale/english.locale
	src/driver/simple_display.cpp
	src/gui/hdd_menu.cpp
	src/gui/infoviewer_bb.cpp
	src/gui/infoviewer_bb.h
	src/gui/moviebrowser.cpp
	src/gui/record_setup.cpp
	src/neutrino.cpp
	src/system/ytcache.h
This commit is contained in:
martii
2013-11-27 20:08:32 +01:00
committed by [CST] Focus
parent b74e80ee6f
commit 7c15db185f
15 changed files with 231 additions and 38 deletions

View File

@@ -51,6 +51,7 @@
#include <gui/pictureviewer.h>
#include <gui/movieplayer.h>
#include <system/helpers.h>
#include <system/hddstat.h>
#include <daemonc/remotecontrol.h>
#include <driver/volume.h>
@@ -80,9 +81,8 @@ CInfoViewerBB::CInfoViewerBB()
pthread_detach(scrambledT);
}
#endif
hddpercent = 0;
hddperT = 0;
hddperTflag = false;
hddscale = NULL;
sysscale = NULL;
bbIconInfo[0].x = 0;
bbIconInfo[0].h = 0;
BBarY = 0;
@@ -108,13 +108,6 @@ void CInfoViewerBB::Init()
bbButtonInfo[i].x = -1;
}
// get HDD info in a separate thread
if (g_settings.infobar_show_sysfs_hdd && !hddperTflag) {
hddperTflag=true;
pthread_create(&hddperT, NULL, hddperThread, (void*) this);
pthread_detach(hddperT);
}
InfoHeightY_Info = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight() + 5;
setBBOffset();
@@ -127,11 +120,10 @@ CInfoViewerBB::~CInfoViewerBB()
pthread_cancel(scrambledT);
scrambledT = 0;
}
if(hddperTflag) {
pthread_cancel(hddperT);
hddperT = 0;
hddperTflag = false;
}
if (hddscale)
delete hddscale;
if (sysscale)
delete sysscale;
}
CInfoViewerBB* CInfoViewerBB::getInstance()
@@ -653,25 +645,10 @@ void CInfoViewerBB::showSysfsHdd()
percent = (int)((u * 100ULL) / t);
showBarSys(percent);
if (check_dir(g_settings.network_nfs_recordingdir.c_str()) == 0)
showBarHdd(hddpercent);
else
showBarHdd(-1);
showBarHdd(cHddStat::getInstance()->getPercent());
}
}
void* CInfoViewerBB::hddperThread(void *arg)
{
CInfoViewerBB *infoViewerBB = (CInfoViewerBB*) arg;
uint64_t t, u;
if (get_fs_usage(g_settings.network_nfs_recordingdir.c_str(), t, u))
infoViewerBB->hddpercent = (int)((u * 100ULL) / t);
else
infoViewerBB->hddpercent = 0;
infoViewerBB->hddperTflag=false;
pthread_exit(NULL);
}
void CInfoViewerBB::showBarSys(int percent)
{
if (is_visible){

View File

@@ -40,6 +40,7 @@
#include <driver/fontrenderer.h>
#include <driver/fade.h>
#include <system/settings.h>
#include <system/hddstat.h>
#include "widget/menue.h"
#include <gui/components/cc.h>
#include <string>
@@ -125,13 +126,9 @@ class CInfoViewerBB
void showBarSys(int percent = 0);
void showBarHdd(int percent = 0);
int hddpercent;
pthread_t hddperT;
static void* hddperThread(void *arg);
bool hddperTflag;
CInfoViewerBB();
public:
CInfoViewerBB();
~CInfoViewerBB();
static CInfoViewerBB* getInstance();
void Init(void);

View File

@@ -66,6 +66,7 @@
#include <system/helpers.h>
#include <timerdclient/timerdclient.h>
#include <system/hddstat.h>
extern CPictureViewer * g_PicViewer;
static CProgressBar *timescale;
@@ -2520,6 +2521,7 @@ void CMovieBrowser::updateDir(void)
if(!g_settings.network_nfs_recordingdir.empty())
{
addDir(g_settings.network_nfs_recordingdir, &m_settings.storageDirRecUsed);
cHddStat::getInstance()->statOnce();
}
for(int i = 0; i < MB_MAX_DIRS; i++)

View File

@@ -877,6 +877,14 @@ void COsdSetup::showOsdMenusSetup(CMenuWidget *menu_menus)
submenu_menus->addItem(mc);
}
#define HDD_STATFS_OPTION_COUNT 3
const CMenuOptionChooser::keyval HDD_STATFS_OPTIONS[HDD_STATFS_OPTION_COUNT] =
{
{ SNeutrinoSettings::HDD_STATFS_OFF, LOCALE_OPTIONS_OFF },
{ SNeutrinoSettings::HDD_STATFS_ALWAYS, LOCALE_HDD_STATFS_ALWAYS },
{ SNeutrinoSettings::HDD_STATFS_RECORDING, LOCALE_HDD_STATFS_RECORDING }
};
//infobar
void COsdSetup::showOsdInfobarSetup(CMenuWidget *menu_infobar)
{
@@ -915,6 +923,11 @@ void COsdSetup::showOsdInfobarSetup(CMenuWidget *menu_infobar)
mc->setHint("", LOCALE_MENU_HINT_INFOBAR_FILESYS);
menu_infobar->addItem(mc);
// hdd update
mc = new CMenuOptionChooser(LOCALE_HDD_STATFS, &g_settings.hdd_statfs_mode, HDD_STATFS_OPTIONS, HDD_STATFS_OPTION_COUNT, true);
mc->setHint("", LOCALE_MENU_HINT_HDD_STATFS);
menu_infobar->addItem(mc);
// resolution
mc = new CMenuOptionChooser(LOCALE_MISCSETTINGS_INFOBAR_SHOW_RES, &g_settings.infobar_show_res, INFOBAR_SHOW_RES_MODE_OPTIONS, INFOBAR_SHOW_RES_MODE_OPTION_COUNT, true);
mc->setHint("", LOCALE_MENU_HINT_INFOBAR_RES);
@@ -952,7 +965,7 @@ void COsdSetup::showOsdInfobarSetup(CMenuWidget *menu_infobar)
// radiotext
mc = new CMenuOptionChooser(LOCALE_MISCSETTINGS_RADIOTEXT, &g_settings.radiotext_enable, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this);
mc->setHint("", LOCALE_MENU_HINT_INFOBAR_RADIOTEXT);
menu_infobar->addItem(mc);
menu_infobar->addItem(mc);
}
//channellist

View File

@@ -54,6 +54,7 @@
#include <system/debug.h>
#include <system/helpers.h>
#include <system/hddstat.h>
CRecordSetup::CRecordSetup()
{
@@ -99,6 +100,7 @@ int CRecordSetup::exec(CMenuTarget* parent, const std::string &actionKey)
printf("New timeshift dir: %s\n", timeshiftDir.c_str());
CRecordManager::getInstance()->SetTimeshiftDirectory(timeshiftDir);
}
cHddStat::getInstance()->setDir(g_settings.network_nfs_recordingdir);
}
return res;
}