Moviebrowser: Ask if the file of a running recording to be deleted.

Origin commit data
------------------
Branch: ni/coolstream
Commit: fefa483469
Author: Michael Liebmann <tuxcode.bbg@gmail.com>
Date: 2012-11-26 (Mon, 26 Nov 2012)

Origin message was:
------------------
* Moviebrowser: Ask if the file of a running recording to be deleted.

------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
Michael Liebmann
2012-11-26 11:05:20 +01:00
parent e08ca85e92
commit de3fc8ed1c
8 changed files with 36 additions and 26 deletions

View File

@@ -1171,6 +1171,7 @@ motorcontrol.store Speichere Motorposition (a)
motorcontrol.timed_mode Zeitgesteuerter Schrittweitenmodus
motorcontrol.user_menu Benutzermenü
motorcontrol.west_limit Setze westliches (soft) Limit
moviebrowser.ask_rec_to_delete Das Löschen des Films beendet auch die laufende Aufnahme!\n[%s]\nTrotzdem fortsetzen?
moviebrowser.book_add Lesezeichen setzen
moviebrowser.book_clear_all Lösche alle
moviebrowser.book_head Markierungen

View File

@@ -1171,6 +1171,7 @@ motorcontrol.store Store Motor Position (a)
motorcontrol.timed_mode Timed Step Mode
motorcontrol.user_menu User menu
motorcontrol.west_limit Set West (soft) Limit
moviebrowser.ask_rec_to_delete Deletion of movie stops current recording!\n[%s]\nContinue anyway?
moviebrowser.book_add Add bookmark
moviebrowser.book_clear_all Clear all
moviebrowser.book_head Bookmarks

View File

@@ -1650,18 +1650,18 @@ void CRecordManager::RestoreNeutrino(void)
g_Sectionsd->setPauseScanning(false);
}
bool CRecordManager::IsFileRecord(std::string file)
CRecordInstance* CRecordManager::getRecordInstance(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;
return inst;
}
}
mutex.unlock();
return false;
return NULL;
}
#if 0

View File

@@ -218,7 +218,7 @@ class CRecordManager : public CMenuTarget /*, public CChangeObserver*/
int GetRecordCount() { return recmap.size(); };
void StartTimeshift();
int GetRecordMode(const t_channel_id channel_id=0);
bool IsFileRecord(std::string file);
CRecordInstance* getRecordInstance(std::string file);
// old code
#if 0
bool IsTimeshift(t_channel_id channel_id=0);

View File

@@ -520,7 +520,6 @@ 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,
@@ -1229,13 +1228,6 @@ void CMovieBrowser::refreshMovieInfo(void)
m_pcInfo->setText(&emptytext);
}
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;
@@ -1638,13 +1630,9 @@ 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
if (IsRecord == false) {
//delete 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
}
}
@@ -1740,8 +1728,28 @@ bool CMovieBrowser::onButtonPressMainFrame(neutrino_msg_t msg)
}
else if (msg == CRCInput::RC_spkr)
{
if ((!m_vMovieInfo.empty()) && (m_movieSelectionHandler != NULL) && (IsRecord == false))
onDeleteFile(*m_movieSelectionHandler);
if ((!m_vMovieInfo.empty()) && (m_movieSelectionHandler != NULL)) {
bool onDelete = true;
bool skipAsk = false;
CRecordInstance* inst = CRecordManager::getInstance()->getRecordInstance(m_movieSelectionHandler->file.Name);
if (inst != NULL) {
std::string delName = m_movieSelectionHandler->epgTitle;
if (delName == "")
delName = m_movieSelectionHandler->file.getFileName();
char buf1[1024];
memset(buf1, '\0', sizeof(buf1));
snprintf(buf1, sizeof(buf1)-1, g_Locale->getText(LOCALE_MOVIEBROWSER_ASK_REC_TO_DELETE), delName.c_str());
if(ShowMsgUTF(LOCALE_RECORDINGMENU_RECORD_IS_RUNNING, buf1,
CMessageBox::mbrNo, CMessageBox::mbYes | CMessageBox::mbNo, NULL, 450, 30, false) == CMessageBox::mbrNo)
onDelete = false;
else {
g_Timerd->removeTimerEvent(inst->GetRecordingId());
skipAsk = true;
}
}
if (onDelete)
onDeleteFile(*m_movieSelectionHandler, skipAsk);
}
}
else if (msg == CRCInput::RC_help || msg == CRCInput::RC_info)
{
@@ -2045,7 +2053,7 @@ bool CMovieBrowser::onButtonPressMovieInfoList(neutrino_msg_t msg)
return (result);
}
void CMovieBrowser::onDeleteFile(MI_MOVIE_INFO& movieSelectionHandler)
void CMovieBrowser::onDeleteFile(MI_MOVIE_INFO& movieSelectionHandler, bool skipAsk)
{
//TRACE( "[onDeleteFile] ");
int test= movieSelectionHandler.file.Name.find(".ts");
@@ -2068,7 +2076,7 @@ void CMovieBrowser::onDeleteFile(MI_MOVIE_INFO& movieSelectionHandler)
msg += "\r\n ";
msg += g_Locale->getText(LOCALE_FILEBROWSER_DODELETE2);
if (ShowMsgUTF(LOCALE_FILEBROWSER_DELETE, msg, CMessageBox::mbrYes, CMessageBox::mbYes|CMessageBox::mbNo)==CMessageBox::mbrYes)
if ((skipAsk) || (ShowMsgUTF(LOCALE_FILEBROWSER_DELETE, msg, CMessageBox::mbrYes, CMessageBox::mbYes|CMessageBox::mbNo)==CMessageBox::mbrYes))
{
delFile(movieSelectionHandler.file);

View File

@@ -294,8 +294,6 @@ class CMovieBrowser : public CMenuTarget
MB_SETTINGS m_settings;
std::vector<MB_DIR> m_dir;
bool IsRecord;
int movieInfoUpdateAll[MB_INFO_MAX_NUMBER];
int movieInfoUpdateAllIfDestEmptyOnly;
@@ -368,7 +366,7 @@ class CMovieBrowser : public CMenuTarget
void onSetGUIWindow(MB_GUI gui);
void onSetGUIWindowNext(void);
void onSetGUIWindowPrev(void);
void onDeleteFile(MI_MOVIE_INFO& movieSelectionHandler); // P4
void onDeleteFile(MI_MOVIE_INFO& movieSelectionHandler, bool skipAsk = false); // P4
bool onSortMovieInfoHandleList(std::vector<MI_MOVIE_INFO*>& pv_handle_list, MB_INFO_ITEM sort_type, MB_DIRECTION direction);
///// parse Storage Directories /////////////

View File

@@ -1198,6 +1198,7 @@ typedef enum
LOCALE_MOTORCONTROL_TIMED_MODE,
LOCALE_MOTORCONTROL_USER_MENU,
LOCALE_MOTORCONTROL_WEST_LIMIT,
LOCALE_MOVIEBROWSER_ASK_REC_TO_DELETE,
LOCALE_MOVIEBROWSER_BOOK_ADD,
LOCALE_MOVIEBROWSER_BOOK_CLEAR_ALL,
LOCALE_MOVIEBROWSER_BOOK_HEAD,

View File

@@ -1198,6 +1198,7 @@ const char * locale_real_names[] =
"motorcontrol.timed_mode",
"motorcontrol.user_menu",
"motorcontrol.west_limit",
"moviebrowser.ask_rec_to_delete",
"moviebrowser.book_add",
"moviebrowser.book_clear_all",
"moviebrowser.book_head",