From 432a2db13fe9d4f6dcde6ac4f564c0471eab3dea Mon Sep 17 00:00:00 2001 From: thilo Date: Tue, 1 Nov 2011 23:41:48 +0000 Subject: [PATCH] *neutrino record: reduce multiple code for record calls Some lines with recording-actions calls in record.cpp and neutrino.cpp were redundant. Now we use only the exec() call with action key "Record" from record.cpp. So we use the same functions with record button and with the recording menu item in user menu. This also causes, that we can see the infobar as response for user on used menu item in user menu. git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-beta@1803 e54a6e83-5905-42d5-8d5c-058d10e6a962 --- src/driver/record.cpp | 13 +++++++++++-- src/gui/user_menue.cpp | 9 --------- src/neutrino.cpp | 20 +++----------------- 3 files changed, 14 insertions(+), 28 deletions(-) diff --git a/src/driver/record.cpp b/src/driver/record.cpp index 7f9c603a6..030b024a2 100644 --- a/src/driver/record.cpp +++ b/src/driver/record.cpp @@ -1213,9 +1213,18 @@ int CRecordManager::exec(CMenuTarget* parent, const std::string & actionKey ) { printf("[neutrino] direct record\n"); t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); - if(!CRecordManager::getInstance()->RecordingStatus(live_channel_id)) + + if(!CRecordManager::getInstance()->RecordingStatus(live_channel_id)) + { CRecordManager::getInstance()->Record(live_channel_id); - return menu_return::RETURN_EXIT_ALL; + + if(!g_InfoViewer->is_visible) // show Infoviewer + CNeutrinoApp::getInstance()->showInfo(); + + return menu_return::RETURN_EXIT_ALL; + } + else + DisplayInfoMessage(g_Locale->getText(LOCALE_RECORDING_IS_RUNNING)); }else if(actionKey == "Timeshift") { StartTimeshift(); diff --git a/src/gui/user_menue.cpp b/src/gui/user_menue.cpp index dfd600d8c..e33ff165f 100644 --- a/src/gui/user_menue.cpp +++ b/src/gui/user_menue.cpp @@ -174,17 +174,8 @@ bool CUserMenu::showUserMenu(int button) menu_items++; menu_prev = SNeutrinoSettings::ITEM_RECORD; keyhelper.get(&key,&icon,CRCInput::RC_red); -#if 1 //NEW, show menu, how better ? menu_item = new CMenuForwarder(LOCALE_MAINMENU_RECORDING, true, NULL, CRecordManager::getInstance(), "-1", key, icon); -#else //OLD, show start/stop chooser - menu_item = new CMenuOptionChooser(LOCALE_MAINMENU_RECORDING, &CRecordManager::getInstance()->recordingstatus, - MAINMENU_RECORDING_OPTIONS, MAINMENU_RECORDING_OPTION_COUNT, true, - CRecordManager::getInstance(), key, icon); -#endif - menu->addItem(menu_item, false); - //if(has_hdd) - // menu->addItem(new CMenuForwarder(LOCALE_EXTRA_AUTO_TO_RECORD, autoshift, NULL, CNeutrinoApp::getInstance(), "autolink"), false); break; } case SNeutrinoSettings::ITEM_MOVIEPLAYER_MB: diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 2507faa68..55661f940 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -2340,22 +2340,8 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu) CMoviePlayerGui::getInstance().exec(NULL, "rtimeshift"); } } - else if( msg == CRCInput::RC_record /* || msg == CRCInput::RC_stop*/ ) { - printf("[neutrino] direct record\n"); - t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); - if(!CRecordManager::getInstance()->RecordingStatus(live_channel_id)) { -#if 0 // uncomment, if ChooseRecDir and g_settings.recording_choose_direct_rec_dir ever used to select recording dir - CRecordManager::getInstance()->recordingstatus = 1; - CRecordManager::getInstance()->doGuiRecord(); -#else // direct record without any GUI - CRecordManager::getInstance()->Record(live_channel_id); - - if(!g_InfoViewer->is_visible) // show Infoviewer - showInfo(); -#endif - } - else - DisplayInfoMessage(g_Locale->getText(LOCALE_RECORDING_IS_RUNNING)); + else if( msg == CRCInput::RC_record) { + CRecordManager::getInstance()->exec(NULL, "Record"); } else if( msg == CRCInput::RC_stop ) { if(CRecordManager::getInstance()->RecordingStatus()) @@ -3816,7 +3802,7 @@ int CNeutrinoApp::exec(CMenuTarget* parent, const std::string & actionKey) } else if(actionKey=="recording") { setupRecordingDevice(); - } + } else if(actionKey=="reloadplugins") { CHintBox * hintBox = new CHintBox(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_SERVICEMENU_GETPLUGINS_HINT)); hintBox->paint();