Moviebrowser: Deleting recordings

- Deleting of active recordings will be disabled.

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-beta@2112 e54a6e83-5905-42d5-8d5c-058d10e6a962


Origin commit data
------------------
Branch: ni/coolstream
Commit: c85c353344
Author: Michael Liebmann <tuxcode.bbg@gmail.com>
Date: 2012-02-18 (Sat, 18 Feb 2012)

Origin message was:
------------------
* Moviebrowser: Deleting recordings

- Deleting of active recordings will be disabled.

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-beta@2112 e54a6e83-5905-42d5-8d5c-058d10e6a962


------------------
This commit was generated by Migit
This commit is contained in:
Michael Liebmann
2012-02-17 23:31:36 +00:00
parent a9923bcc35
commit eadb8b51dd
4 changed files with 37 additions and 15 deletions

View File

@@ -1636,6 +1636,20 @@ bool CRecordManager::MountDirectory(const char *recordingDir)
return ret;
}
bool CRecordManager::IsFileRecord(std::string file)
{
mutex.lock();
for(recmap_iterator_t it = recmap.begin(); it != recmap.end(); it++) {
CRecordInstance * inst = it->second;
if ((((std::string)inst->GetFileName()) + ".ts") == file) {
mutex.unlock();
return true;
}
}
mutex.unlock();
return false;
}
#if 0 // not used, saved in case we needed it
extern bool autoshift_delete;
bool CRecordManager::LinkTimeshift()

View File

@@ -213,5 +213,6 @@ class CRecordManager : public CMenuTarget, public CChangeObserver
bool IsTimeshift(t_channel_id channel_id=0);
void StartTimeshift();
int GetRecordMode(const t_channel_id channel_id=0);
bool IsFileRecord(std::string file);
};
#endif

View File

@@ -67,6 +67,7 @@
#include <gui/widget/progressbar.h>
#include <gui/pictureviewer.h>
#include <gui/customcolor.h>
#include <driver/record.h>
extern CPictureViewer * g_PicViewer;
static CProgressBar *timescale;
@@ -515,6 +516,7 @@ void CMovieBrowser::init(void)
refreshBrowserList();
refreshFilterList();
g_PicViewer->getSupportedImageFormats(PicExts);
IsRecord = false;
#if 0
TRACE_1("Frames\r\n\tScren:\t%3d,%3d,%3d,%3d\r\n\tMain:\t%3d,%3d,%3d,%3d\r\n\tTitle:\t%3d,%3d,%3d,%3d \r\n\tBrowsr:\t%3d,%3d,%3d,%3d \r\n\tPlay:\t%3d,%3d,%3d,%3d \r\n\tRecord:\t%3d,%3d,%3d,%3d\r\n\r\n",
g_settings.screen_StartX,
@@ -1208,13 +1210,18 @@ void CMovieBrowser::refreshMovieInfo(void)
m_pcInfo->setText(&emptytext);
return;
}
if (m_movieSelectionHandler == NULL)
{
if (m_movieSelectionHandler == NULL) {
// There is no selected element, clear LCD
m_pcInfo->setText(&emptytext);
}
else
{
else {
// Is record?
bool tmp = CRecordManager::getInstance()->IsFileRecord(m_movieSelectionHandler->file.Name);
if (tmp != IsRecord) {
IsRecord = tmp;
refreshFoot();
}
bool logo_ok = false;
int picw = (int)(((float)16 / (float)9) * (float)m_cBoxFrameInfo.iHeight);
int pich = m_cBoxFrameInfo.iHeight;
@@ -1615,10 +1622,13 @@ void CMovieBrowser::refreshFoot(void)
m_pcWindow->getIconSize(NEUTRINO_ICON_BUTTON_OKAY, &iw, &ih);
m_pcWindow->paintIcon(NEUTRINO_ICON_BUTTON_OKAY, m_cBoxFrame.iX+xpos1+width*2, m_cBoxFrame.iY+m_cBoxFrameFootRel.iY, m_cBoxFrameFootRel.iHeight+ 6);
m_pcFontFoot->RenderString(m_cBoxFrame.iX+xpos1+width*2 + 10 + iw, m_cBoxFrame.iY+m_cBoxFrameFootRel.iY + m_cBoxFrameFootRel.iHeight + 4 , width-30, ok_text.c_str(), (CFBWindow::color_t)color, 0, true); // UTF-8
//delte icon
m_pcWindow->getIconSize(NEUTRINO_ICON_BUTTON_MUTE_SMALL, &iw, &ih);
m_pcWindow->paintIcon(NEUTRINO_ICON_BUTTON_MUTE_SMALL, m_cBoxFrame.iX+xpos1+width*3, m_cBoxFrame.iY+m_cBoxFrameFootRel.iY, m_cBoxFrameFootRel.iHeight+ 6);
m_pcFontFoot->RenderString(m_cBoxFrame.iX+xpos1+width*3 + 10 + iw , m_cBoxFrame.iY+m_cBoxFrameFootRel.iY + m_cBoxFrameFootRel.iHeight + 4 , width-30, g_Locale->getText(LOCALE_FILEBROWSER_DELETE), (CFBWindow::color_t)color, 0, true); // UTF-8
if (IsRecord == false) {
//delte icon
m_pcWindow->getIconSize(NEUTRINO_ICON_BUTTON_MUTE_SMALL, &iw, &ih);
m_pcWindow->paintIcon(NEUTRINO_ICON_BUTTON_MUTE_SMALL, m_cBoxFrame.iX+xpos1+width*3, m_cBoxFrame.iY+m_cBoxFrameFootRel.iY, m_cBoxFrameFootRel.iHeight+ 6);
m_pcFontFoot->RenderString(m_cBoxFrame.iX+xpos1+width*3 + 10 + iw , m_cBoxFrame.iY+m_cBoxFrameFootRel.iY + m_cBoxFrameFootRel.iHeight + 4 , width-30, g_Locale->getText(LOCALE_FILEBROWSER_DELETE), (CFBWindow::color_t)color, 0, true); // UTF-8
}
}
@@ -1714,13 +1724,8 @@ bool CMovieBrowser::onButtonPressMainFrame(neutrino_msg_t msg)
}
else if (msg == CRCInput::RC_spkr)
{
if(m_vMovieInfo.size() > 0)
{
if(m_movieSelectionHandler != NULL)
{
onDeleteFile(*m_movieSelectionHandler);
}
}
if ((m_vMovieInfo.size() > 0) && (m_movieSelectionHandler != NULL) && (IsRecord == false))
onDeleteFile(*m_movieSelectionHandler);
}
else if (msg == CRCInput::RC_help || msg == CRCInput::RC_info)
{

View File

@@ -294,6 +294,8 @@ class CMovieBrowser : public CMenuTarget
MB_SETTINGS m_settings;
std::vector<MB_DIR> m_dir;
bool IsRecord;
int movieInfoUpdateAll[MB_INFO_MAX_NUMBER];
int movieInfoUpdateAllIfDestEmptyOnly;