diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2012-04-23 09:07:55 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2012-04-23 09:07:55 +0200 |
commit | 3d32b07862aff8de213e999f27eaf9082696ec01 (patch) | |
tree | 89a8261b475654df3cce58b81743ecc451aab448 /menu.c | |
parent | 09e58657a1abc2dcebf1761c5c2406f3b4a4345f (diff) | |
download | vdr-3d32b07862aff8de213e999f27eaf9082696ec01.tar.gz vdr-3d32b07862aff8de213e999f27eaf9082696ec01.tar.bz2 |
The disk usage is no longer automatically added to the title of the main and "Recordings" menus
Diffstat (limited to 'menu.c')
-rw-r--r-- | menu.c | 67 |
1 files changed, 2 insertions, 65 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menu.c 2.49 2012/04/22 10:44:20 kls Exp $ + * $Id: menu.c 2.50 2012/04/22 15:13:14 kls Exp $ */ #include "menu.h" @@ -34,7 +34,6 @@ #define MAXWAIT4EPGINFO 3 // seconds #define MODETIMEOUT 3 // seconds -#define DISKSPACECHEK 5 // seconds between disk space checks #define NEWTIMERLIMIT 120 // seconds until the start time of a new timer created from the Schedule menu, // within which it will go directly into the "Edit timer" menu to allow // further parameter settings @@ -52,47 +51,6 @@ #define CHNUMWIDTH (numdigits(Channels.MaxNumber()) + 1) #define CHNAMWIDTH (min(MAXCHNAMWIDTH, Channels.MaxShortChannelNameLength() + 1)) -// --- cFreeDiskSpace -------------------------------------------------------- - -#define MB_PER_MINUTE 25.75 // this is just an estimate! - -class cFreeDiskSpace { -private: - static time_t lastDiskSpaceCheck; - static int lastFreeMB; - static cString freeDiskSpaceString; -public: - static bool HasChanged(bool ForceCheck = false); - static const char *FreeDiskSpaceString(void) { HasChanged(); return freeDiskSpaceString; } - }; - -time_t cFreeDiskSpace::lastDiskSpaceCheck = 0; -int cFreeDiskSpace::lastFreeMB = 0; -cString cFreeDiskSpace::freeDiskSpaceString; - -cFreeDiskSpace FreeDiskSpace; - -bool cFreeDiskSpace::HasChanged(bool ForceCheck) -{ - if (ForceCheck || time(NULL) - lastDiskSpaceCheck > DISKSPACECHEK) { - int FreeMB; - int Percent = VideoDiskSpace(&FreeMB); - lastDiskSpaceCheck = time(NULL); - if (ForceCheck || FreeMB != lastFreeMB) { - int MBperMinute = Recordings.MBperMinute(); - if (MBperMinute <= 0) - MBperMinute = MB_PER_MINUTE; - int Minutes = int(double(FreeMB) / MBperMinute); - int Hours = Minutes / 60; - Minutes %= 60; - freeDiskSpaceString = cString::sprintf("%s %d%% - %2d:%02d %s", tr("Disk"), Percent, Hours, Minutes, tr("free")); - lastFreeMB = FreeMB; - return true; - } - } - return false; -} - // --- cMenuEditCaItem ------------------------------------------------------- class cMenuEditCaItem : public cMenuEditIntItem { @@ -2234,7 +2192,6 @@ cMenuRecordings::cMenuRecordings(const char *Base, int Level, bool OpenSubMenus) helpKeys = -1; Display(); // this keeps the higher level menus from showing up briefly when pressing 'Back' during replay Set(); - SetFreeDiskDisplay(true); if (Current() < 0) SetCurrent(First()); else if (OpenSubMenus && cReplayControl::LastReplayed() && Open(true)) @@ -2249,16 +2206,6 @@ cMenuRecordings::~cMenuRecordings() free(base); } -bool cMenuRecordings::SetFreeDiskDisplay(bool Force) -{ - if (FreeDiskSpace.HasChanged(Force)) { - //XXX -> skin function!!! - SetTitle(cString::sprintf("%s - %s", base ? base : tr("Recordings"), FreeDiskSpace.FreeDiskSpaceString())); - return true; - } - return false; -} - void cMenuRecordings::SetHelpKeys(void) { cMenuRecordingItem *ri = (cMenuRecordingItem *)Get(Current()); @@ -2321,7 +2268,6 @@ void cMenuRecordings::Set(bool Refresh) } } free(LastItemText); - Refresh |= SetFreeDiskDisplay(Refresh); if (Refresh) Display(); } @@ -2427,7 +2373,7 @@ eOSState cMenuRecordings::Delete(void) Recordings.DelByName(ri->FileName()); cOsdMenu::Del(Current()); SetHelpKeys(); - SetFreeDiskDisplay(true); + cVideoDiskUsage::ForceCheck(); Display(); if (!Count()) return osBack; @@ -2500,8 +2446,6 @@ eOSState cMenuRecordings::ProcessKey(eKeys Key) Display(); } if (!HasSubMenu()) { - if (HadSubMenu) - SetFreeDiskDisplay(); if (Key != kNone) SetHelpKeys(); } @@ -3416,13 +3360,6 @@ bool cMenuMain::Update(bool Force) { bool result = false; - // Title with disk usage: - if (FreeDiskSpace.HasChanged(Force)) { - //XXX -> skin function!!! - SetTitle(cString::sprintf("%s - %s", tr("VDR"), FreeDiskSpace.FreeDiskSpaceString())); - result = true; - } - bool NewReplaying = cControl::Control() != NULL; if (Force || NewReplaying != replaying) { replaying = NewReplaying; |