From f73c6ec22234462a58dc30921691fc8bb2a82c9b Mon Sep 17 00:00:00 2001 From: thilo Date: Thu, 23 Dec 2010 22:43:55 +0000 Subject: [PATCH] port: use own modules for record and network setup - changes on locales - moved functions int safe_mkdir() and int check_dir from neutrino.cpp into settings_helper.cpp/ - /gui/makefile.am: added network_setup.cpp and record_setup.cpp - small whitespace clean ups and useles comments removed - TODO: Filename Templates in record settings git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@958 e54a6e83-5905-42d5-8d5c-058d10e6a962 --- data/locale/deutsch.locale | 17 +- data/locale/english.locale | 15 +- src/driver/vcrcontrol.cpp | 8 +- src/gui/Makefile.am | 2 + src/gui/hdd_menu.cpp | 1 - src/neutrino.cpp | 113 +-------- src/neutrino.h | 10 +- src/neutrino_menue.cpp | 430 ++++++++++++++------------------- src/system/locals.h | 9 + src/system/locals_intern.h | 9 + src/system/setting_helpers.cpp | 249 ++++++++++++++----- src/system/setting_helpers.h | 12 +- 12 files changed, 431 insertions(+), 444 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 142e8de26..4b0e74b06 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -959,13 +959,17 @@ mpkey.plugin Starte Plugin mpkey.rewind Rücklauf mpkey.stop Stopp mpkey.time Zeitanzeige +networkmenu.apply_settings Änderungen werden übernommen... +networkmenu.apply_settings_now Änderungen jetzt zuweisen? networkmenu.broadcast Broadcast networkmenu.dhcp DHCP +networkmenu.error_no_address Keine %s-Adresse angegeben! networkmenu.gateway Standard Gateway networkmenu.head Netzwerk Einstellungen networkmenu.hostname Hostname -networkmenu.ipaddress IP-Adresse -networkmenu.mount NFS/CIFS/FTPFS +networkmenu.inactive_network Netzwerk nicht aktiviert! +networkmenu.ipaddress IP +networkmenu.mount Netzwerkfreigaben bearbeiten networkmenu.nameserver Nameserver networkmenu.netmask Netzmaske networkmenu.ntpenable Zeit per INet synchronisieren @@ -976,6 +980,7 @@ networkmenu.ntpserver NTP-URL (Zeitserver) networkmenu.ntpserver_hint1 NTP-URL Beispiel: ntp1.ptb.de networkmenu.ntpserver_hint2 braucht Reboot oder EPG-Reset networkmenu.ntptitle Zeitsynchronisation +networkmenu.reset_settings_now Sollen die vorherigen Einstellungen \nwieder hergestellt werden? networkmenu.setupnow Einstellungen jetzt zuweisen networkmenu.setuponstartup Beim Start Netzwerk setzen networkmenu.show Aktive Einstellungen zeigen @@ -1010,6 +1015,8 @@ nvodselector.head Anfangszeit auswählen nvodselector.subservice Perspektiven options.default Voreinstellungen benutzen options.fb framebuffer +options.ntp_off DVB +options.ntp_on NTP options.null null options.off aus options.on ein @@ -1077,7 +1084,7 @@ rclock.lockmsg Die Fernbedienung der Coolstream wird gesperrt.\n Um die Sperre a rclock.menueadd FB sperren rclock.title Fernbedienung sperren rclock.unlockmsg Fernbedienung reaktiviert... -recordingmenu.apids Voreinstellung für Tonspuren +recordingmenu.apids Tonspuren recordingmenu.apids_ac3 AC3 Tonspuren aufnehmen recordingmenu.apids_alt Alternative Tonspuren aufn. recordingmenu.apids_std Standard Tonspur aufnehmen @@ -1091,6 +1098,7 @@ recordingmenu.help Aufnahmegeräte:\n-----------------------\nServer:\nauf PC mi recordingmenu.no_scart Unterdrücke Scart-Umschaltung recordingmenu.off aus recordingmenu.record_in_spts_mode in SPTS-Modus aufnehmen +recordingmenu.record_is_running Aufnahme läuft! recordingmenu.recording_type Aufnahme Gerät recordingmenu.ringbuffers Anz. Ringpuffer recordingmenu.save_in_channeldir Speichere im Kanalverzeichnis @@ -1105,6 +1113,7 @@ recordingmenu.stopplayback Wiedergabe anhalten recordingmenu.stopsectionsd "sectionsd" anhalten recordingmenu.stream_pmt_pid PMT aufzeichnen recordingmenu.stream_vtxt_pid Teletext aufzeichnen +recordingmenu.timeshift Timeshift recordingmenu.tsdir TS Aufnahmeverzeichnis recordingmenu.use_fdatasync Synchrones Schreiben (fdatasync) recordingmenu.use_o_sync Synchrones Schreiben (O_SYNC) @@ -1356,7 +1365,7 @@ timersettings.record_safety_time_after.hint_2 zeit des jeweiligen Timers addiert timersettings.record_safety_time_before Aufnahmestart-Korrektur timersettings.record_safety_time_before.hint_1 Korrekturzeit in Min. (00=aus), die beim Start timersettings.record_safety_time_before.hint_2 des jeweiligen Timers abgezogen werden -timersettings.separator Timereinstellungen +timersettings.separator Timer timing.chanlist Kanalliste timing.epg EPG timing.filebrowser Filebrowser diff --git a/data/locale/english.locale b/data/locale/english.locale index f8c06a0df..57790542c 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -599,13 +599,17 @@ movieplayer.vlchelp7 skip approx. 1 minute movieplayer.vlchelp8 approx. 5 minutes back movieplayer.vlchelp9 skip approx. 5 minutes movieplayer.wrongvlcversion This feature is not support by your current version of VLC +networkmenu.apply_settings Changes are applied... +networkmenu.apply_settings_now Do you want to apply settings now? networkmenu.broadcast Broadcast networkmenu.dhcp DHCP +networkmenu.error_no_address Missing %s-address! networkmenu.gateway default gateway networkmenu.head Network Settings networkmenu.hostname Hostname +networkmenu.inactive_network Network inactiv! networkmenu.ipaddress IP address -networkmenu.mount NFS/CIFS/FTPFS +networkmenu.mount Edit network shares networkmenu.nameserver name server networkmenu.netmask netmask networkmenu.ntpenable Syncronisation via @@ -616,6 +620,7 @@ networkmenu.ntpserver NTP-Server networkmenu.ntpserver_hint1 NTP-Server example: ntp1.ptb.de networkmenu.ntpserver_hint2 need reboot or epg-reset networkmenu.ntptitle Time-Syncronisation +networkmenu.reset_settings_now Do you want restore the previous settings? networkmenu.setupnow setup network now networkmenu.setuponstartup setup network on startup networkmenu.show show active network settings @@ -649,6 +654,8 @@ nvodselector.head Select starting-time nvodselector.subservice Select Subservice options.default Reset to defaults options.fb framebuffer +options.ntp_off DVB +options.ntp_on NTP options.null null options.off off options.on on @@ -723,6 +730,7 @@ recordingmenu.head Recording Settings recordingmenu.help Recording devices:\n--------------------------\nserver:\nusing streaming software on a PC\n\n(analog) vcr:\nusing the vcr outlet\n\ndirect (file):\ndirectly into an NFS mounted directory\nor onto an internal hard drive\nTS: use spts mode(dbox2)\nPES: do not use spts mode(dbox2)\n\n\nMax. file size:\n---------------------\nNFS V2: 2 GB (2048 MB)\nNFS V3: almost unlimited (0 MB)\nFAT: 2 GB (2048 MB)\nFAT32: 4 GB (4096 MB) recordingmenu.no_scart do not switch to scart mode recordingmenu.off off +recordingmenu.record_is_running Record is running! recordingmenu.recording_type recording device recordingmenu.ringbuffers no. of ringbuffers recordingmenu.server server @@ -735,6 +743,7 @@ recordingmenu.splitsize Max. file size (MB) recordingmenu.stopplayback stop playback recordingmenu.stopsectionsd stop sectionsd recordingmenu.stream_vtxt_pid record videotext +recordingmenu.timeshift Timeshift recordingmenu.use_fdatasync write synchronous (fdatasync) recordingmenu.use_o_sync write synchronous (O_SYNC) recordingmenu.vcr vcr @@ -913,7 +922,7 @@ timersettings.record_safety_time_after.hint_2 will added to stop time of every r timersettings.record_safety_time_before Record start time correction timersettings.record_safety_time_before.hint_1 Correction time in min. (00=off). This time timersettings.record_safety_time_before.hint_2 will be deducted of every record timer. -timersettings.separator Timer settings +timersettings.separator Timer timing.chanlist Channellist timing.epg Epg timing.filebrowser Filebrowser @@ -1253,7 +1262,7 @@ miscsettings.epg_old_events_hint2 Set in hours miscsettings.epg_save Save/Restore epg on reboot miscsettings.virtual_zap_mode Virtual zap shutdown.recoding_query You really want to to stop record ? -recordingmenu.apids default audio streams +recordingmenu.apids Audio streams recordingmenu.apids_ac3 record AC3 streams recordingmenu.apids_alt record alternative streams recordingmenu.apids_std record standard stream diff --git a/src/driver/vcrcontrol.cpp b/src/driver/vcrcontrol.cpp index f7621fc78..8af7cd947 100644 --- a/src/driver/vcrcontrol.cpp +++ b/src/driver/vcrcontrol.cpp @@ -38,6 +38,7 @@ #include + #include #include @@ -82,7 +83,6 @@ extern "C" { static CMovieInfo * g_cMovieInfo; static MI_MOVIE_INFO * g_movieInfo; t_channel_id rec_channel_id; -int safe_mkdir(char * path); static CVCRControl vcrControl; @@ -291,8 +291,8 @@ bool CVCRControl::CVCRDevice::Record(const t_channel_id channel_id, int mode, co { // Auf Scart schalten CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::VCR_ON, 0 ); - // Das ganze nochmal in die queue, da obiges RC_timeout erst in der naechsten ev. loop ausgeführt wird - // und dann das menu widget das display falsch rücksetzt + // Das ganze nochmal in die queue, da obiges RC_timeout erst in der naechsten ev. loop ausgeführt wird + // und dann das menu widget das display falsch rücksetzt g_RCInput->postMsg( NeutrinoMessages::VCR_ON, 0 ); } @@ -350,7 +350,7 @@ void CVCRControl::CFileAndServerDevice::CutBackNeutrino(const t_channel_id chann if (channel_id != 0) { if (mode != last_mode && (last_mode != NeutrinoMessages::mode_standby || mode != CNeutrinoApp::getInstance()->getLastMode())) { CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::CHANGEMODE , mode | NeutrinoMessages::norezap ); - // Wenn wir im Standby waren, dann brauchen wir fürs streamen nicht aufwachen... + // Wenn wir im Standby waren, dann brauchen wir fürs streamen nicht aufwachen... if(last_mode == NeutrinoMessages::mode_standby) CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::CHANGEMODE , NeutrinoMessages::mode_standby); } diff --git a/src/gui/Makefile.am b/src/gui/Makefile.am index 19659deb8..81ab5896e 100644 --- a/src/gui/Makefile.am +++ b/src/gui/Makefile.am @@ -52,6 +52,7 @@ libneutrino_gui_a_SOURCES = \ moviebrowser.cpp \ movieinfo.cpp \ movieplayer.cpp \ + network_setup.cpp \ nfs.cpp \ osd_setup.cpp \ osdlang_setup.cpp \ @@ -61,6 +62,7 @@ libneutrino_gui_a_SOURCES = \ plugins.cpp \ proxyserver_setup.cpp \ rc_lock.cpp \ + record_setup.cpp \ scan.cpp \ screensetup.cpp \ sleeptimer.cpp \ diff --git a/src/gui/hdd_menu.cpp b/src/gui/hdd_menu.cpp index a8f76989b..3529e21ae 100644 --- a/src/gui/hdd_menu.cpp +++ b/src/gui/hdd_menu.cpp @@ -62,7 +62,6 @@ #include #include -int safe_mkdir(char * path); static int my_filter(const struct dirent * dent) { diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 9eecc5726..983f9a6cc 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -271,30 +271,6 @@ CVCRControl::CDevice * recordingdevice = NULL; #define NEUTRINO_SCAN_START_SCRIPT CONFIGDIR "/recording.start" #endif -int safe_mkdir(char * path) -{ - struct statfs s; - int ret = 0; - if(!strncmp(path, "/hdd", 4)) { - ret = statfs("/hdd", &s); - if((ret != 0) || (s.f_type == 0x72b6)) - ret = -1; - else - mkdir(path, 0755); - } else - mkdir(path, 0755); - return ret; -} - -static int check_dir(const char * newdir) -{ - if(strncmp(newdir, "/media/sda1/", 12) && strncmp(newdir, "/media/sdb1/", 12) && strncmp(newdir, "/mnt/", 5) && strncmp(newdir, "/tmp/", 5) && strncmp(newdir, "/media/", 7)) { - return 1; - } - - return 0; -} - static void initGlobals(void) { g_fontRenderer = NULL; @@ -328,10 +304,11 @@ CNeutrinoApp::CNeutrinoApp() SetupFrameBuffer(); mode = mode_unknown; - channelList = NULL; - TVchannelList = NULL; - RADIOchannelList = NULL; - nextRecordingInfo = NULL; + channelList = NULL; + TVchannelList = NULL; + RADIOchannelList = NULL; + nextRecordingInfo = NULL; + networksetup = NULL; skipShutdownTimer=false; current_muted = 0; } @@ -2208,8 +2185,6 @@ int CNeutrinoApp::run(int argc, char **argv) CMenuWidget mainMenu (LOCALE_MAINMENU_HEAD , NEUTRINO_ICON_MAINMENU/*, 22*/); CMenuWidget mainSettings (LOCALE_MAINSETTINGS_HEAD , NEUTRINO_ICON_SETTINGS); CMenuWidget audioSettings (LOCALE_AUDIOMENU_HEAD , NEUTRINO_ICON_AUDIO); - CMenuWidget networkSettings (LOCALE_NETWORKMENU_HEAD , NEUTRINO_ICON_NETWORK); - CMenuWidget recordingSettings (LOCALE_RECORDINGMENU_HEAD , NEUTRINO_ICON_RECORDING); CMenuWidget streamingSettings (LOCALE_STREAMINGMENU_HEAD , NEUTRINO_ICON_STREAMING); CMenuWidget miscSettings (LOCALE_MISCSETTINGS_HEAD , NEUTRINO_ICON_SETTINGS); CMenuWidget audioplPicSettings (LOCALE_AUDIOPLAYERPICSETTINGS_GENERAL, NEUTRINO_ICON_SETTINGS); @@ -2218,8 +2193,7 @@ int CNeutrinoApp::run(int argc, char **argv) CMenuWidget moviePlayer (LOCALE_MOVIEPLAYER_HEAD , NEUTRINO_ICON_STREAMING); gmoviePlayer = &moviePlayer; - InitMainMenu(mainMenu, mainSettings, audioSettings, networkSettings, recordingSettings, miscSettings, - service, audioplPicSettings, streamingSettings, moviePlayer); + InitMainMenu(mainMenu, mainSettings, audioSettings, miscSettings, service, audioplPicSettings, streamingSettings, moviePlayer); InitServiceSettings(service, _scanSettings); InitAudioplPicSettings(audioplPicSettings); @@ -2288,7 +2262,6 @@ int CNeutrinoApp::run(int argc, char **argv) g_Timerd->registerEvent(CTimerdClient::EVT_REMIND, 222, NEUTRINO_UDS_NAME); g_Timerd->registerEvent(CTimerdClient::EVT_EXEC_PLUGIN, 222, NEUTRINO_UDS_NAME); - InitNetworkSettings(networkSettings); if (display_language_selection) { @@ -2313,9 +2286,9 @@ int CNeutrinoApp::run(int argc, char **argv) } if(ret != menu_return::RETURN_EXIT_ALL) { - networkSettings.setWizardMode(true); - ret = networkSettings.exec(NULL, ""); - networkSettings.setWizardMode(false); + networksetup->setWizardMode(CNetworkSetup::N_SETUP_MODE_WIZARD); + ret = networksetup->exec(NULL, ""); + networksetup->setWizardMode(CNetworkSetup::N_SETUP_MODE_WIZARD_NO); } if(ret != menu_return::RETURN_EXIT_ALL) { @@ -2342,7 +2315,6 @@ int CNeutrinoApp::run(int argc, char **argv) delete hdd; InitZapper(); - InitRecordingSettings(recordingSettings); InitStreamingSettings(streamingSettings); AudioMute( current_muted, true); @@ -3461,8 +3433,6 @@ void CNeutrinoApp::ExitRun(const bool /*write_si*/, int retcode) frameBuffer->paintBackground(); videoDecoder->ShowPicture(DATADIR "/neutrino/icons/shutdown.jpg"); - networkConfig.automatic_start = (network_automatic_start == 1); - networkConfig.commitConfig(); saveSetup(NEUTRINO_SETTINGS_FILE); if(g_settings.epg_save /* && timeset && g_Sectionsd->getIsTimeSet ()*/) { @@ -4097,20 +4067,6 @@ int CNeutrinoApp::exec(CMenuTarget* parent, const std::string & actionKey) g_RCInput->postMsg( NeutrinoMessages::VCR_ON, 0 ); returnval = menu_return::RETURN_EXIT_ALL; } - else if(actionKey=="network") { - networkConfig.automatic_start = (network_automatic_start == 1); - networkConfig.stopNetwork(); - networkConfig.commitConfig(); - networkConfig.startNetwork(); - } - else if(actionKey=="networktest") { - dprintf(DEBUG_INFO, "doing network test...\n"); - testNetworkSettings(networkConfig.address.c_str(), networkConfig.netmask.c_str(), networkConfig.broadcast.c_str(), networkConfig.gateway.c_str(), networkConfig.nameserver.c_str(), networkConfig.inet_static); - } - else if(actionKey=="networkshow") { - dprintf(DEBUG_INFO, "showing current network settings...\n"); - showCurrentNetworkSettings(); - } else if(actionKey=="savescansettings") { SaveMotorPositions(); } @@ -4118,8 +4074,6 @@ int CNeutrinoApp::exec(CMenuTarget* parent, const std::string & actionKey) CHintBox * hintBox = new CHintBox(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_MAINSETTINGS_SAVESETTINGSNOW_HINT)); // UTF-8 hintBox->paint(); - networkConfig.automatic_start = (network_automatic_start == 1); - networkConfig.commitConfig(); saveSetup(NEUTRINO_SETTINGS_FILE); SaveMotorPositions(); @@ -4168,8 +4122,6 @@ int CNeutrinoApp::exec(CMenuTarget* parent, const std::string & actionKey) CHintBox * hintBox = new CHintBox(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_SERVICEMENU_RESTART_HINT)); hintBox->paint(); - networkConfig.automatic_start = (network_automatic_start == 1); - networkConfig.commitConfig(); saveSetup(NEUTRINO_SETTINGS_FILE); /* this is an ugly mess :-( */ @@ -4231,53 +4183,6 @@ int CNeutrinoApp::exec(CMenuTarget* parent, const std::string & actionKey) strncpy(g_settings.network_nfs_moviedir, b.getSelectedFile()->Name.c_str(), sizeof(g_settings.network_nfs_moviedir)-1); return menu_return::RETURN_REPAINT; } - else if(actionKey == "recordingdir") { - parent->hide(); - CFileBrowser b; - b.Dir_Mode=true; - if (b.exec(g_settings.network_nfs_recordingdir)) { - const char * newdir = b.getSelectedFile()->Name.c_str(); -printf("New recordingdir: selected %s\n", newdir); - if(check_dir(newdir)) - printf("Wrong/unsupported recording dir %s\n", newdir); - else { - strncpy(g_settings.network_nfs_recordingdir, b.getSelectedFile()->Name.c_str(), sizeof(g_settings.network_nfs_recordingdir)-1); -printf("New recordingdir: %s (timeshift %s)\n", g_settings.network_nfs_recordingdir, g_settings.timeshiftdir); - if(strlen(g_settings.timeshiftdir) == 0) { - sprintf(timeshiftDir, "%s/.timeshift", g_settings.network_nfs_recordingdir); - safe_mkdir(timeshiftDir); -printf("New timeshift dir: %s\n", timeshiftDir); - } - } - } - return menu_return::RETURN_REPAINT; - } - else if(actionKey == "timeshiftdir") { - parent->hide(); - CFileBrowser b; - b.Dir_Mode=true; - if (b.exec(g_settings.timeshiftdir)) { - const char * newdir = b.getSelectedFile()->Name.c_str(); -printf("New timeshift: selected %s\n", newdir); - if(check_dir(newdir)) - printf("Wrong/unsupported recording dir %s\n", newdir); - else { -printf("New timeshift dir: old %s (record %s)\n", g_settings.timeshiftdir, g_settings.network_nfs_recordingdir); - if(strcmp(newdir, g_settings.network_nfs_recordingdir)) { -printf("New timeshift != rec dir\n"); - strncpy(g_settings.timeshiftdir, b.getSelectedFile()->Name.c_str(), sizeof(g_settings.timeshiftdir)-1); - strcpy(timeshiftDir, g_settings.timeshiftdir); - } else { - sprintf(timeshiftDir, "%s/.timeshift", g_settings.network_nfs_recordingdir); - strcpy(g_settings.timeshiftdir, newdir); - safe_mkdir(timeshiftDir); -printf("New timeshift == rec dir\n"); - } -printf("New timeshift dir: %s\n", timeshiftDir); - } - } - return menu_return::RETURN_REPAINT; - } else if(actionKey == "update_dir") { parent->hide(); CFileBrowser fileBrowser; diff --git a/src/neutrino.h b/src/neutrino.h index 25241f7dc..6e00b487e 100644 --- a/src/neutrino.h +++ b/src/neutrino.h @@ -40,6 +40,7 @@ #include #include #include +#include #include #include /* CChannelList */ #include @@ -137,6 +138,7 @@ private: bool skipShutdownTimer; bool pbBlinkChange; CColorSetupNotifier *colorSetupNotifier; + CNetworkSetup *networksetup; CNVODChangeExec *NVODChanger; CStreamFeaturesChangeExec *StreamFeaturesChanger; CMoviePluginChangeExec *MoviePluginChanger; @@ -144,7 +146,7 @@ private: CIPChangeNotifier *MyIPChanger; // CVCRControl *vcrControl; CConsoleDestChangeNotifier *ConsoleDestinationChanger; - CRCLock *rcLock; + CRCLock *rcLock; // USERMENU CTimerList *Timerlist; @@ -154,7 +156,6 @@ private: void firstChannel(); void setupNetwork( bool force= false ); void setupNFS(); - void setupRecordingDevice(void); void startNextRecording(); @@ -171,15 +172,12 @@ private: void InitZapper(); void InitServiceSettings(CMenuWidget &, CMenuWidget &); void InitAudioSettings(CMenuWidget &audioSettings, CAudioSetupNotifier* audioSetupNotifier); - void InitNetworkSettings(CMenuWidget &networkSettings); - void InitRecordingSettings(CMenuWidget &recordingSettings); void InitStreamingSettings(CMenuWidget &streamingSettings); void InitScreenSettings(CMenuWidget &); void InitAudioplPicSettings(CMenuWidget &); void InitMiscSettings(CMenuWidget &); void InitScanSettings(CMenuWidget &); void InitMainMenu(CMenuWidget &mainMenu, CMenuWidget &mainSettings, CMenuWidget &audioSettings, - CMenuWidget &networkSettings1, CMenuWidget &networkSettings2, CMenuWidget &miscSettings, CMenuWidget &service, CMenuWidget &audioplPicSettings, CMenuWidget &streamingSettings, CMenuWidget &moviePlayer); void SetupFrameBuffer(); @@ -199,6 +197,7 @@ public: void saveKeys(const char * fname); void SetupTiming(); void SetupFonts(); + void setupRecordingDevice(void); void setVolume(const neutrino_msg_t key, const bool bDoPaint = true, bool nowait = false); ~CNeutrinoApp(); @@ -209,7 +208,6 @@ public: CChannelList *TVchannelList; CChannelList *RADIOchannelList; CChannelList *channelList; - CNetworkConfig networkConfig; static CNeutrinoApp* getInstance(); diff --git a/src/neutrino_menue.cpp b/src/neutrino_menue.cpp index 623aa6c25..4788b0081 100644 --- a/src/neutrino_menue.cpp +++ b/src/neutrino_menue.cpp @@ -75,8 +75,8 @@ #include "gui/widget/messagebox.h" #include "gui/widget/hintbox.h" #include "gui/widget/icons.h" -// #include "gui/widget/vfdcontroler.h" #include "gui/proxyserver_setup.h" +#include "gui/record_setup.h" #include "gui/keybind_setup.h" #include "gui/widget/keychooser.h" #include "gui/widget/stringinput.h" @@ -91,7 +91,7 @@ #include "gui/bouquetlist.h" #include "gui/eventlist.h" #include "gui/channellist.h" -//#include "gui/screensetup.h" +#include "gui/network_setup.h" #include "gui/parentallock_setup.h" #include "gui/user_menue_setup.h" #include "gui/pluginlist.h" @@ -109,7 +109,6 @@ #include "gui/audioplayer.h" #include "gui/imageinfo.h" #include "gui/movieplayer.h" -#include "gui/nfs.h" #include "gui/pictureviewer.h" #include "gui/motorcontrol.h" #include "gui/filebrowser.h" @@ -171,8 +170,6 @@ extern bool autoshift; //static CTimingSettingsNotifier timingsettingsnotifier; -int safe_mkdir(char * path); - #ifdef TEST_MENU class CTestMenu : public CMenuTarget @@ -392,8 +389,7 @@ CMenuWidget * TestMenu; /************************************************************************************** * CNeutrinoApp - init main menu * **************************************************************************************/ -void CNeutrinoApp::InitMainMenu(CMenuWidget &mainMenu, CMenuWidget &mainSettings, CMenuWidget &audioSettings, - CMenuWidget &networkSettings, CMenuWidget &recordingSettings, CMenuWidget &miscSettings, +void CNeutrinoApp::InitMainMenu(CMenuWidget &mainMenu, CMenuWidget &mainSettings, CMenuWidget &audioSettings, /*CMenuWidget &recordingSettings,*/ CMenuWidget &miscSettings, CMenuWidget &service, CMenuWidget &audiopl_picSettings, CMenuWidget &/*streamingSettings*/, CMenuWidget &moviePlayer) { unsigned int system_rev = cs_get_revision(); @@ -537,8 +533,10 @@ void CNeutrinoApp::InitMainMenu(CMenuWidget &mainMenu, CMenuWidget &mainSettings else mainSettings.addItem(new CMenuForwarder(LOCALE_PARENTALLOCK_PARENTALLOCK, true, NULL, &parentallockSettings, NULL, CRCInput::convertDigitToKey(sett_count++))); #endif - mainSettings.addItem(new CMenuForwarder(LOCALE_MAINSETTINGS_NETWORK , true, NULL, &networkSettings , NULL, CRCInput::convertDigitToKey(sett_count++))); - mainSettings.addItem(new CMenuForwarder(LOCALE_MAINSETTINGS_RECORDING , true, NULL, &recordingSettings, NULL, CRCInput::convertDigitToKey(sett_count++))); + if(networksetup == NULL) + networksetup = new CNetworkSetup(); + mainSettings.addItem(new CMenuForwarder(LOCALE_MAINSETTINGS_NETWORK , true, NULL, networksetup , NULL, CRCInput::convertDigitToKey(sett_count++))); + mainSettings.addItem(new CMenuForwarder(LOCALE_MAINSETTINGS_RECORDING , true, NULL, new CRecordSetup()/*&recordingSettings*/, NULL, CRCInput::convertDigitToKey(sett_count++))); //mainSettings.addItem(new CMenuForwarder(LOCALE_MAINSETTINGS_STREAMING , true, NULL, &streamingSettings, NULL, CRCInput::convertDigitToKey(sett_count++))); mainSettings.addItem(new CMenuForwarder(LOCALE_MAINSETTINGS_LANGUAGE , true, NULL, new COsdLangSetup()/* &languageSettings*/ , NULL, CRCInput::convertDigitToKey(sett_count++))); @@ -1489,245 +1487,181 @@ void CNeutrinoApp::InitAudioSettings(CMenuWidget &audioSettings, CAudioSetupNoti } -void CNeutrinoApp::InitNetworkSettings(CMenuWidget &networkSettings) -{ - CIPInput * networkSettings_NetworkIP = new CIPInput(LOCALE_NETWORKMENU_IPADDRESS , networkConfig.address , LOCALE_IPSETUP_HINT_1, LOCALE_IPSETUP_HINT_2, MyIPChanger); - CIPInput * networkSettings_NetMask = new CIPInput(LOCALE_NETWORKMENU_NETMASK , networkConfig.netmask , LOCALE_IPSETUP_HINT_1, LOCALE_IPSETUP_HINT_2); - CIPInput * networkSettings_Broadcast = new CIPInput(LOCALE_NETWORKMENU_BROADCAST , networkConfig.broadcast , LOCALE_IPSETUP_HINT_1, LOCALE_IPSETUP_HINT_2); - CIPInput * networkSettings_Gateway = new CIPInput(LOCALE_NETWORKMENU_GATEWAY , networkConfig.gateway , LOCALE_IPSETUP_HINT_1, LOCALE_IPSETUP_HINT_2); - CIPInput * networkSettings_NameServer = new CIPInput(LOCALE_NETWORKMENU_NAMESERVER, networkConfig.nameserver, LOCALE_IPSETUP_HINT_1, LOCALE_IPSETUP_HINT_2); - - CSectionsdConfigNotifier* sectionsdConfigNotifier = new CSectionsdConfigNotifier; - CStringInputSMS * networkSettings_NtpServer = new CStringInputSMS(LOCALE_NETWORKMENU_NTPSERVER, &g_settings.network_ntpserver, 30, LOCALE_NETWORKMENU_NTPSERVER_HINT1, LOCALE_NETWORKMENU_NTPSERVER_HINT2, "abcdefghijklmnopqrstuvwxyz0123456789-. ", sectionsdConfigNotifier); - - CStringInput * networkSettings_NtpRefresh = new CStringInput(LOCALE_NETWORKMENU_NTPREFRESH, &g_settings.network_ntprefresh, 3,LOCALE_NETWORKMENU_NTPREFRESH_HINT1, LOCALE_NETWORKMENU_NTPREFRESH_HINT2 , "0123456789 ", sectionsdConfigNotifier); - - CStringInputSMS * networkSettings_Hostname = new CStringInputSMS(LOCALE_NETWORKMENU_HOSTNAME, &networkConfig.hostname, 30, LOCALE_NETWORKMENU_NTPSERVER_HINT1, LOCALE_NETWORKMENU_NTPSERVER_HINT2, "abcdefghijklmnopqrstuvwxyz0123456789-. "); - - CMenuForwarder *m0 = new CMenuForwarder(LOCALE_NETWORKMENU_SETUPNOW, true, NULL, this, "network", CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED); - CMenuForwarder *m1 = new CMenuForwarder(LOCALE_NETWORKMENU_IPADDRESS , networkConfig.inet_static, networkConfig.address , networkSettings_NetworkIP ); - CMenuForwarder *m2 = new CMenuForwarder(LOCALE_NETWORKMENU_NETMASK , networkConfig.inet_static, networkConfig.netmask , networkSettings_NetMask ); - CMenuForwarder *m3 = new CMenuForwarder(LOCALE_NETWORKMENU_BROADCAST , networkConfig.inet_static, networkConfig.broadcast , networkSettings_Broadcast ); - CMenuForwarder *m4 = new CMenuForwarder(LOCALE_NETWORKMENU_GATEWAY , networkConfig.inet_static, networkConfig.gateway , networkSettings_Gateway ); - CMenuForwarder *m5 = new CMenuForwarder(LOCALE_NETWORKMENU_NAMESERVER, networkConfig.inet_static, networkConfig.nameserver, networkSettings_NameServer); - CMenuForwarder *m6 = new CMenuForwarder(LOCALE_NETWORKMENU_NTPSERVER, true , g_settings.network_ntpserver, networkSettings_NtpServer ); - CMenuForwarder *m7 = new CMenuForwarder(LOCALE_NETWORKMENU_NTPREFRESH, true , g_settings.network_ntprefresh, networkSettings_NtpRefresh ); - - CMenuForwarder *m8 = new CMenuForwarder(LOCALE_NETWORKMENU_HOSTNAME, !networkConfig.inet_static, networkConfig.hostname, networkSettings_Hostname); - - CDHCPNotifier* dhcpNotifier = new CDHCPNotifier(m1,m2,m3,m4,m5, m8); - - network_automatic_start = networkConfig.automatic_start ? 1 : 0; - CMenuOptionChooser* oj = new CMenuOptionChooser(LOCALE_NETWORKMENU_SETUPONSTARTUP, &network_automatic_start, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true); - - networkSettings.addIntroItems(); - - networkSettings.addItem( oj ); - networkSettings.addItem(new CMenuForwarder(LOCALE_NETWORKMENU_TEST, true, NULL, this, "networktest")); - networkSettings.addItem(new CMenuForwarder(LOCALE_NETWORKMENU_SHOW, true, NULL, this, "networkshow", CRCInput::RC_help, NEUTRINO_ICON_BUTTON_HELP_SMALL)); - networkSettings.addItem( m0 ); - - networkSettings.addItem(GenericMenuSeparatorLine); - - - network_dhcp = networkConfig.inet_static ? 0 : 1; - oj = new CMenuOptionChooser(LOCALE_NETWORKMENU_DHCP, &network_dhcp, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, dhcpNotifier); - networkSettings.addItem(oj); - networkSettings.addItem(m8); - networkSettings.addItem(GenericMenuSeparatorLine); - - networkSettings.addItem( m1); - networkSettings.addItem( m2); - networkSettings.addItem( m3); - - networkSettings.addItem(GenericMenuSeparatorLine); - networkSettings.addItem( m4); - networkSettings.addItem( m5); - networkSettings.addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_NETWORKMENU_NTPTITLE)); - networkSettings.addItem(new CMenuOptionChooser(LOCALE_NETWORKMENU_NTPENABLE, &g_settings.network_ntpenable, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, sectionsdConfigNotifier)); - networkSettings.addItem( m6); - networkSettings.addItem( m7); - - networkSettings.addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_NETWORKMENU_MOUNT)); - networkSettings.addItem(new CMenuForwarder(LOCALE_NFS_MOUNT , true, NULL, new CNFSMountGui(), NULL, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN)); - networkSettings.addItem(new CMenuForwarder(LOCALE_NFS_UMOUNT, true, NULL, new CNFSUmountGui(), NULL, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW)); -} - -#define RECORDINGMENU_RECORDING_TYPE_OPTION_COUNT 4 -const CMenuOptionChooser::keyval RECORDINGMENU_RECORDING_TYPE_OPTIONS[RECORDINGMENU_RECORDING_TYPE_OPTION_COUNT] = -{ - { CNeutrinoApp::RECORDING_OFF , LOCALE_RECORDINGMENU_OFF }, - { CNeutrinoApp::RECORDING_SERVER, LOCALE_RECORDINGMENU_SERVER }, - { CNeutrinoApp::RECORDING_VCR , LOCALE_RECORDINGMENU_VCR }, - { CNeutrinoApp::RECORDING_FILE , LOCALE_RECORDINGMENU_FILE } -}; - -#define CHOOSE_DIRECT_REC_DIR_COUNT 3 -const CMenuOptionChooser::keyval CHOOSE_DIRECT_REC_DIR[RECORDINGMENU_RECORDING_TYPE_OPTION_COUNT] = -{ - {0, LOCALE_OPTIONS_OFF}, - {1, LOCALE_NFS_TYPE_NFS}, - {2, LOCALE_NFS_LOCALDIR} -}; -void CNeutrinoApp::InitRecordingSettings(CMenuWidget &recordingSettings) -{ -#if 0 - CIPInput * recordingSettings_server_ip = new CIPInput(LOCALE_RECORDINGMENU_SERVER_IP, g_settings.recording_server_ip, LOCALE_IPSETUP_HINT_1, LOCALE_IPSETUP_HINT_2); - CStringInput * recordingSettings_server_port = new CStringInput(LOCALE_RECORDINGMENU_SERVER_PORT, g_settings.recording_server_port, 6, LOCALE_IPSETUP_HINT_1, LOCALE_IPSETUP_HINT_2, "0123456789 "); - - CMenuForwarder * mf1 = new CMenuForwarder(LOCALE_RECORDINGMENU_SERVER_IP, (g_settings.recording_type == RECORDING_SERVER), g_settings.recording_server_ip, recordingSettings_server_ip); - CMenuForwarder * mf2 = new CMenuForwarder(LOCALE_RECORDINGMENU_SERVER_PORT, (g_settings.recording_type == RECORDING_SERVER), g_settings.recording_server_port, recordingSettings_server_port); - - CMACInput * recordingSettings_server_mac = new CMACInput(LOCALE_RECORDINGMENU_SERVER_MAC, g_settings.recording_server_mac, LOCALE_IPSETUP_HINT_1, LOCALE_IPSETUP_HINT_2); - CMenuForwarder * mf3 = new CMenuForwarder(LOCALE_RECORDINGMENU_SERVER_MAC, ((g_settings.recording_type == RECORDING_SERVER) && g_settings.recording_server_wakeup==1), g_settings.recording_server_mac, recordingSettings_server_mac); - - CRecordingNotifier2 * RecordingNotifier2 = new CRecordingNotifier2(mf3); - - CMenuOptionChooser * oj2 = new CMenuOptionChooser(LOCALE_RECORDINGMENU_SERVER_WAKEUP, &g_settings.recording_server_wakeup, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, (g_settings.recording_type == RECORDING_SERVER), RecordingNotifier2); - - CMenuOptionChooser* oj3 = new CMenuOptionChooser(LOCALE_RECORDINGMENU_STOPPLAYBACK, &g_settings.recording_stopplayback, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, (g_settings.recording_type == RECORDING_SERVER || g_settings.recording_type == RECORDING_FILE)); - - CMenuOptionChooser* oj4 = new CMenuOptionChooser(LOCALE_RECORDINGMENU_STOPSECTIONSD, &g_settings.recording_stopsectionsd, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, (g_settings.recording_type == RECORDING_SERVER || g_settings.recording_type == RECORDING_FILE)); - CMenuOptionChooser* oj4b = new CMenuOptionChooser(LOCALE_RECORDINGMENU_ZAP_ON_ANNOUNCE, &g_settings.recording_zap_on_announce, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true); - - CMenuOptionChooser* oj5 = new CMenuOptionChooser(LOCALE_RECORDINGMENU_NO_SCART, &g_settings.recording_vcr_no_scart, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, (g_settings.recording_type == RECORDING_VCR)); - - CMenuOptionChooser* oj12 = new CMenuOptionChooser(LOCALE_RECORDINGMENU_RECORD_IN_SPTS_MODE, &g_settings.recording_in_spts_mode, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT,(g_settings.recording_type == RECORDING_SERVER || g_settings.recording_type == RECORDING_FILE) ); -#endif - int pre,post; - g_Timerd->getRecordingSafety(pre,post); - sprintf(g_settings.record_safety_time_before, "%02d", pre/60); - sprintf(g_settings.record_safety_time_after, "%02d", post/60); - - CRecordingSafetyNotifier *RecordingSafetyNotifier = new CRecordingSafetyNotifier; - CStringInput * timerBefore = new CStringInput(LOCALE_TIMERSETTINGS_RECORD_SAFETY_TIME_BEFORE, g_settings.record_safety_time_before, 2, LOCALE_TIMERSETTINGS_RECORD_SAFETY_TIME_BEFORE_HINT_1, LOCALE_TIMERSETTINGS_RECORD_SAFETY_TIME_BEFORE_HINT_2,"0123456789 ", RecordingSafetyNotifier); - CMenuForwarder *fTimerBefore = new CMenuForwarder(LOCALE_TIMERSETTINGS_RECORD_SAFETY_TIME_BEFORE, true, g_settings.record_safety_time_before, timerBefore); - - CStringInput * timerAfter = new CStringInput(LOCALE_TIMERSETTINGS_RECORD_SAFETY_TIME_AFTER, g_settings.record_safety_time_after, 2, LOCALE_TIMERSETTINGS_RECORD_SAFETY_TIME_AFTER_HINT_1, LOCALE_TIMERSETTINGS_RECORD_SAFETY_TIME_AFTER_HINT_2,"0123456789 ", RecordingSafetyNotifier); - CMenuForwarder *fTimerAfter = new CMenuForwarder(LOCALE_TIMERSETTINGS_RECORD_SAFETY_TIME_AFTER, true, g_settings.record_safety_time_after, timerAfter); - - // default recording audio pids - //CMenuWidget * apidMenu = new CMenuWidget(LOCALE_RECORDINGMENU_APIDS, NEUTRINO_ICON_AUDIO); - //CMenuForwarder* fApidMenu = new CMenuForwarder(LOCALE_RECORDINGMENU_APIDS ,true, NULL, apidMenu); - g_settings.recording_audio_pids_std = ( g_settings.recording_audio_pids_default & TIMERD_APIDS_STD ) ? 1 : 0 ; - g_settings.recording_audio_pids_alt = ( g_settings.recording_audio_pids_default & TIMERD_APIDS_ALT ) ? 1 : 0 ; - g_settings.recording_audio_pids_ac3 = ( g_settings.recording_audio_pids_default & TIMERD_APIDS_AC3 ) ? 1 : 0 ; - - CRecAPIDSettingsNotifier * an = new CRecAPIDSettingsNotifier; - CMenuOptionChooser* aoj1 = new CMenuOptionChooser(LOCALE_RECORDINGMENU_APIDS_STD, &g_settings.recording_audio_pids_std, MESSAGEBOX_NO_YES_OPTIONS, MESSAGEBOX_NO_YES_OPTION_COUNT, true, an); - CMenuOptionChooser* aoj2 = new CMenuOptionChooser(LOCALE_RECORDINGMENU_APIDS_ALT, &g_settings.recording_audio_pids_alt, MESSAGEBOX_NO_YES_OPTIONS, MESSAGEBOX_NO_YES_OPTION_COUNT, true, an); - CMenuOptionChooser* aoj3 = new CMenuOptionChooser(LOCALE_RECORDINGMENU_APIDS_AC3, &g_settings.recording_audio_pids_ac3, MESSAGEBOX_NO_YES_OPTIONS, MESSAGEBOX_NO_YES_OPTION_COUNT, true, an); -#if 0 - apidRecordingSettings->addItem(GenericMenuSeparator); - apidRecordingSettings->addItem(GenericMenuBack); - apidRecordingSettings->addItem(GenericMenuSeparatorLine); - apidRecordingSettings->addItem(aoj1); - apidRecordingSettings->addItem(aoj2); - apidRecordingSettings->addItem(aoj3); -#endif - CMenuForwarder* fRecDir = new CMenuForwarder(LOCALE_RECORDINGMENU_DEFDIR, true, g_settings.network_nfs_recordingdir, this, "recordingdir"); - CMenuForwarder* fTsDir = new CMenuForwarder(LOCALE_RECORDINGMENU_TSDIR, true, g_settings.timeshiftdir, this, "timeshiftdir"); - CMenuOptionChooser* zapAnnounce = new CMenuOptionChooser(LOCALE_RECORDINGMENU_ZAP_ON_ANNOUNCE, &g_settings.recording_zap_on_announce, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true); - - recordingSettings.addItem(GenericMenuSeparator); - recordingSettings.addItem(GenericMenuBack); - recordingSettings.addItem(new CMenuForwarder(LOCALE_RECORDINGMENU_SETUPNOW, true, NULL, this, "recording", CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED)); - recordingSettings.addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_TIMERSETTINGS_SEPARATOR)); - recordingSettings.addItem(fTimerBefore); - recordingSettings.addItem(fTimerAfter); - recordingSettings.addItem(zapAnnounce); - recordingSettings.addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_RECORDINGMENU_APIDS)); - recordingSettings.addItem(aoj1); - recordingSettings.addItem(aoj2); - recordingSettings.addItem(aoj3); - recordingSettings.addItem(GenericMenuSeparatorLine); - recordingSettings.addItem(fRecDir); - recordingSettings.addItem(fTsDir); - recordingSettings.addItem(new CMenuOptionNumberChooser(LOCALE_EXTRA_RECORD_TIME, &g_settings.record_hours, true, 1, 24, NULL) ); - if (1) { //has_hdd) { - recordingSettings.addItem(new CMenuOptionChooser(LOCALE_EXTRA_TIMESHIFT_PAUSE, &g_settings.timeshift_pause, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true)); - recordingSettings.addItem(new CMenuOptionNumberChooser(LOCALE_EXTRA_AUTO_TIMESHIFT, &g_settings.auto_timeshift, true, 0, 300, NULL)); - recordingSettings.addItem(new CMenuOptionChooser(LOCALE_EXTRA_AUTO_DELETE, &g_settings.auto_delete, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true)); - recordingSettings.addItem(new CMenuOptionChooser(LOCALE_EXTRA_TEMP_TIMESHIFT, &g_settings.temp_timeshift, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true)); - } -#if 0 - // for direct recording - CMenuWidget *directRecordingSettings = new CMenuWidget(LOCALE_RECORDINGMENU_FILESETTINGS, NEUTRINO_ICON_RECORDING); - - CMenuForwarder* mf7 = new CMenuForwarder(LOCALE_RECORDINGMENU_FILESETTINGS,(g_settings.recording_type == RECORDING_FILE),NULL,directRecordingSettings, NULL, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN); - - - CStringInput * recordingSettings_splitsize = new CStringInput(LOCALE_RECORDINGMENU_SPLITSIZE, g_settings.recording_splitsize, 6, LOCALE_IPSETUP_HINT_1, LOCALE_IPSETUP_HINT_2, "0123456789 "); - CMenuForwarder* mf9 = new CMenuForwarder(LOCALE_RECORDINGMENU_SPLITSIZE, true, g_settings.recording_splitsize,recordingSettings_splitsize); - - CMenuOptionChooser* oj6 = new CMenuOptionChooser(LOCALE_RECORDINGMENU_USE_O_SYNC, &g_settings.recording_use_o_sync, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true); - - CMenuOptionChooser* oj7 = new CMenuOptionChooser(LOCALE_RECORDINGMENU_USE_FDATASYNC, &g_settings.recording_use_fdatasync, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true); - - CMenuOptionChooser* oj8 = new CMenuOptionChooser(LOCALE_RECORDINGMENU_STREAM_VTXT_PID, &g_settings.recording_stream_vtxt_pid, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true); - CMenuOptionChooser* oj9 = new CMenuOptionChooser(LOCALE_RECORDINGMENU_STREAM_PMT_PID, &g_settings.recording_stream_pmt_pid, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true); - - CStringInput * recordingSettings_ringbuffers = new CStringInput(LOCALE_RECORDINGMENU_RINGBUFFERS, g_settings.recording_ringbuffers, 2, LOCALE_IPSETUP_HINT_1, LOCALE_IPSETUP_HINT_2, "0123456789 "); - CMenuForwarder* mf10 = new CMenuForwarder(LOCALE_RECORDINGMENU_RINGBUFFERS, true, g_settings.recording_ringbuffers,recordingSettings_ringbuffers); - //CMenuOptionChooser* oj10 = new CMenuOptionChooser(LOCALE_RECORDINGMENU_CHOOSE_DIRECT_REC_DIR, &g_settings.recording_choose_direct_rec_dir, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true); - CMenuOptionChooser* oj10 = new CMenuOptionChooser(LOCALE_RECORDINGMENU_CHOOSE_DIRECT_REC_DIR, &g_settings.recording_choose_direct_rec_dir, CHOOSE_DIRECT_REC_DIR, CHOOSE_DIRECT_REC_DIR_COUNT, true); - - CMenuOptionChooser* oj11 = new CMenuOptionChooser(LOCALE_RECORDINGMENU_EPG_FOR_FILENAME, &g_settings.recording_epg_for_filename, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true); - CMenuOptionChooser* oj13 = new CMenuOptionChooser(LOCALE_RECORDINGMENU_SAVE_IN_CHANNELDIR, &g_settings.recording_save_in_channeldir, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true); - - CRecordingNotifier *RecordingNotifier = new CRecordingNotifier(mf1,mf2,oj2,mf3,oj3,oj4,oj5,mf7,oj12); - - CMenuOptionChooser* oj1 = new CMenuOptionChooser(LOCALE_RECORDINGMENU_RECORDING_TYPE, &g_settings.recording_type, RECORDINGMENU_RECORDING_TYPE_OPTIONS, RECORDINGMENU_RECORDING_TYPE_OPTION_COUNT, true, RecordingNotifier); - - recordingSettings.addItem(GenericMenuSeparator); - recordingSettings.addItem(GenericMenuBack); - //recordingSettings.addItem(new CMenuForwarder(LOCALE_SETTINGS_HELP, true, NULL, this, "help_recording", CRCInput::RC_help, NEUTRINO_ICON_BUTTON_HELP_SMALL)); - recordingSettings.addItem(new CMenuForwarder(LOCALE_RECORDINGMENU_SETUPNOW, true, NULL, this, "recording", CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED)); - recordingSettings.addItem(GenericMenuSeparatorLine); - recordingSettings.addItem( oj1); - recordingSettings.addItem(GenericMenuSeparatorLine); - recordingSettings.addItem( mf1); - recordingSettings.addItem( mf2); - recordingSettings.addItem( oj2); - recordingSettings.addItem( mf3); - recordingSettings.addItem( oj3); - recordingSettings.addItem( oj4); - recordingSettings.addItem(GenericMenuSeparatorLine); - recordingSettings.addItem( oj5); - recordingSettings.addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_TIMERSETTINGS_SEPARATOR)); - recordingSettings.addItem( mf5); - recordingSettings.addItem( mf6); - recordingSettings.addItem( oj4b); - recordingSettings.addItem(new CMenuOptionNumberChooser(LOCALE_EXTRA_RECORD_TIME, &g_settings.record_hours, true, 1, 24) ); - recordingSettings.addItem(GenericMenuSeparatorLine); -#if 0 - recordingSettings.addItem(oj12); -#endif - recordingSettings.addItem( mf13); - recordingSettings.addItem( mf7); - - directRecordingSettings->addItem(GenericMenuSeparator); - directRecordingSettings->addItem(GenericMenuBack); - directRecordingSettings->addItem(GenericMenuSeparatorLine); - directRecordingSettings->addItem(mf8); - directRecordingSettings->addItem(mf9); - directRecordingSettings->addItem(mf10); - directRecordingSettings->addItem(oj6); - directRecordingSettings->addItem(oj7); - directRecordingSettings->addItem(oj8); - directRecordingSettings->addItem(oj9); - directRecordingSettings->addItem(oj10); - directRecordingSettings->addItem(oj11); - directRecordingSettings->addItem(oj13); - recordingstatus = 0; - if (has_hdd) { - directRecordingSettings->addItem(new CMenuOptionChooser(LOCALE_EXTRA_TIMESHIFT_PAUSE, &g_settings.timeshift_pause, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true)); - directRecordingSettings->addItem(new CMenuOptionNumberChooser(LOCALE_EXTRA_AUTO_TIMESHIFT, &g_settings.auto_timeshift, true, 0, 300)); - directRecordingSettings->addItem(new CMenuOptionChooser(LOCALE_EXTRA_AUTO_DELETE, &g_settings.auto_delete, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true)); - directRecordingSettings->addItem(new CMenuOptionChooser(LOCALE_EXTRA_TEMP_TIMESHIFT, &g_settings.temp_timeshift, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true)); - } -#endif -} +// #define RECORDINGMENU_RECORDING_TYPE_OPTION_COUNT 4 +// const CMenuOptionChooser::keyval RECORDINGMENU_RECORDING_TYPE_OPTIONS[RECORDINGMENU_RECORDING_TYPE_OPTION_COUNT] = +// { +// { CNeutrinoApp::RECORDING_OFF , LOCALE_RECORDINGMENU_OFF }, +// { CNeutrinoApp::RECORDING_SERVER, LOCALE_RECORDINGMENU_SERVER }, +// { CNeutrinoApp::RECORDING_VCR , LOCALE_RECORDINGMENU_VCR }, +// { CNeutrinoApp::RECORDING_FILE , LOCALE_RECORDINGMENU_FILE } +// }; +// +// #define CHOOSE_DIRECT_REC_DIR_COUNT 3 +// const CMenuOptionChooser::keyval CHOOSE_DIRECT_REC_DIR[RECORDINGMENU_RECORDING_TYPE_OPTION_COUNT] = +// { +// {0, LOCALE_OPTIONS_OFF}, +// {1, LOCALE_NFS_TYPE_NFS}, +// {2, LOCALE_NFS_LOCALDIR} +// }; +// void CNeutrinoApp::InitRecordingSettings(CMenuWidget &recordingSettings) +// { +// #if 0 +// CIPInput * recordingSettings_server_ip = new CIPInput(LOCALE_RECORDINGMENU_SERVER_IP, g_settings.recording_server_ip, LOCALE_IPSETUP_HINT_1, LOCALE_IPSETUP_HINT_2); +// CStringInput * recordingSettings_server_port = new CStringInput(LOCALE_RECORDINGMENU_SERVER_PORT, g_settings.recording_server_port, 6, LOCALE_IPSETUP_HINT_1, LOCALE_IPSETUP_HINT_2, "0123456789 "); +// +// CMenuForwarder * mf1 = new CMenuForwarder(LOCALE_RECORDINGMENU_SERVER_IP, (g_settings.recording_type == RECORDING_SERVER), g_settings.recording_server_ip, recordingSettings_server_ip); +// CMenuForwarder * mf2 = new CMenuForwarder(LOCALE_RECORDINGMENU_SERVER_PORT, (g_settings.recording_type == RECORDING_SERVER), g_settings.recording_server_port, recordingSettings_server_port); +// +// CMACInput * recordingSettings_server_mac = new CMACInput(LOCALE_RECORDINGMENU_SERVER_MAC, g_settings.recording_server_mac, LOCALE_IPSETUP_HINT_1, LOCALE_IPSETUP_HINT_2); +// CMenuForwarder * mf3 = new CMenuForwarder(LOCALE_RECORDINGMENU_SERVER_MAC, ((g_settings.recording_type == RECORDING_SERVER) && g_settings.recording_server_wakeup==1), g_settings.recording_server_mac, recordingSettings_server_mac); +// +// CRecordingNotifier2 * RecordingNotifier2 = new CRecordingNotifier2(mf3); +// +// CMenuOptionChooser * oj2 = new CMenuOptionChooser(LOCALE_RECORDINGMENU_SERVER_WAKEUP, &g_settings.recording_server_wakeup, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, (g_settings.recording_type == RECORDING_SERVER), RecordingNotifier2); +// +// CMenuOptionChooser* oj3 = new CMenuOptionChooser(LOCALE_RECORDINGMENU_STOPPLAYBACK, &g_settings.recording_stopplayback, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, (g_settings.recording_type == RECORDING_SERVER || g_settings.recording_type == RECORDING_FILE)); +// +// CMenuOptionChooser* oj4 = new CMenuOptionChooser(LOCALE_RECORDINGMENU_STOPSECTIONSD, &g_settings.recording_stopsectionsd, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, (g_settings.recording_type == RECORDING_SERVER || g_settings.recording_type == RECORDING_FILE)); +// CMenuOptionChooser* oj4b = new CMenuOptionChooser(LOCALE_RECORDINGMENU_ZAP_ON_ANNOUNCE, &g_settings.recording_zap_on_announce, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true); +// +// CMenuOptionChooser* oj5 = new CMenuOptionChooser(LOCALE_RECORDINGMENU_NO_SCART, &g_settings.recording_vcr_no_scart, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, (g_settings.recording_type == RECORDING_VCR)); +// +// CMenuOptionChooser* oj12 = new CMenuOptionChooser(LOCALE_RECORDINGMENU_RECORD_IN_SPTS_MODE, &g_settings.recording_in_spts_mode, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT,(g_settings.recording_type == RECORDING_SERVER || g_settings.recording_type == RECORDING_FILE) ); +// #endif +// int pre,post; +// g_Timerd->getRecordingSafety(pre,post); +// sprintf(g_settings.record_safety_time_before, "%02d", pre/60); +// sprintf(g_settings.record_safety_time_after, "%02d", post/60); +// +// CRecordingSafetyNotifier *RecordingSafetyNotifier = new CRecordingSafetyNotifier; +// CStringInput * timerBefore = new CStringInput(LOCALE_TIMERSETTINGS_RECORD_SAFETY_TIME_BEFORE, g_settings.record_safety_time_before, 2, LOCALE_TIMERSETTINGS_RECORD_SAFETY_TIME_BEFORE_HINT_1, LOCALE_TIMERSETTINGS_RECORD_SAFETY_TIME_BEFORE_HINT_2,"0123456789 ", RecordingSafetyNotifier); +// CMenuForwarder *fTimerBefore = new CMenuForwarder(LOCALE_TIMERSETTINGS_RECORD_SAFETY_TIME_BEFORE, true, g_settings.record_safety_time_before, timerBefore); +// +// CStringInput * timerAfter = new CStringInput(LOCALE_TIMERSETTINGS_RECORD_SAFETY_TIME_AFTER, g_settings.record_safety_time_after, 2, LOCALE_TIMERSETTINGS_RECORD_SAFETY_TIME_AFTER_HINT_1, LOCALE_TIMERSETTINGS_RECORD_SAFETY_TIME_AFTER_HINT_2,"0123456789 ", RecordingSafetyNotifier); +// CMenuForwarder *fTimerAfter = new CMenuForwarder(LOCALE_TIMERSETTINGS_RECORD_SAFETY_TIME_AFTER, true, g_settings.record_safety_time_after, timerAfter); +// +// // default recording audio pids +// //CMenuWidget * apidMenu = new CMenuWidget(LOCALE_RECORDINGMENU_APIDS, NEUTRINO_ICON_AUDIO); +// //CMenuForwarder* fApidMenu = new CMenuForwarder(LOCALE_RECORDINGMENU_APIDS ,true, NULL, apidMenu); +// g_settings.recording_audio_pids_std = ( g_settings.recording_audio_pids_default & TIMERD_APIDS_STD ) ? 1 : 0 ; +// g_settings.recording_audio_pids_alt = ( g_settings.recording_audio_pids_default & TIMERD_APIDS_ALT ) ? 1 : 0 ; +// g_settings.recording_audio_pids_ac3 = ( g_settings.recording_audio_pids_default & TIMERD_APIDS_AC3 ) ? 1 : 0 ; +// +// CRecAPIDSettingsNotifier * an = new CRecAPIDSettingsNotifier; +// CMenuOptionChooser* aoj1 = new CMenuOptionChooser(LOCALE_RECORDINGMENU_APIDS_STD, &g_settings.recording_audio_pids_std, MESSAGEBOX_NO_YES_OPTIONS, MESSAGEBOX_NO_YES_OPTION_COUNT, true, an); +// CMenuOptionChooser* aoj2 = new CMenuOptionChooser(LOCALE_RECORDINGMENU_APIDS_ALT, &g_settings.recording_audio_pids_alt, MESSAGEBOX_NO_YES_OPTIONS, MESSAGEBOX_NO_YES_OPTION_COUNT, true, an); +// CMenuOptionChooser* aoj3 = new CMenuOptionChooser(LOCALE_RECORDINGMENU_APIDS_AC3, &g_settings.recording_audio_pids_ac3, MESSAGEBOX_NO_YES_OPTIONS, MESSAGEBOX_NO_YES_OPTION_COUNT, true, an); +// #if 0 +// apidRecordingSettings->addItem(GenericMenuSeparator); +// apidRecordingSettings->addItem(GenericMenuBack); +// apidRecordingSettings->addItem(GenericMenuSeparatorLine); +// apidRecordingSettings->addItem(aoj1); +// apidRecordingSettings->addItem(aoj2); +// apidRecordingSettings->addItem(aoj3); +// #endif +// CMenuForwarder* fRecDir = new CMenuForwarder(LOCALE_RECORDINGMENU_DEFDIR, true, g_settings.network_nfs_recordingdir, this, "recordingdir"); +// CMenuForwarder* fTsDir = new CMenuForwarder(LOCALE_RECORDINGMENU_TSDIR, true, g_settings.timeshiftdir, this, "timeshiftdir"); +// CMenuOptionChooser* zapAnnounce = new CMenuOptionChooser(LOCALE_RECORDINGMENU_ZAP_ON_ANNOUNCE, &g_settings.recording_zap_on_announce, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true); +// +// recordingSettings.addItem(GenericMenuSeparator); +// recordingSettings.addItem(GenericMenuBack); +// recordingSettings.addItem(new CMenuForwarder(LOCALE_RECORDINGMENU_SETUPNOW, true, NULL, this, "recording", CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED)); +// recordingSettings.addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_TIMERSETTINGS_SEPARATOR)); +// recordingSettings.addItem(fTimerBefore); +// recordingSettings.addItem(fTimerAfter); +// recordingSettings.addItem(zapAnnounce); +// recordingSettings.addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_RECORDINGMENU_APIDS)); +// recordingSettings.addItem(aoj1); +// recordingSettings.addItem(aoj2); +// recordingSettings.addItem(aoj3); +// recordingSettings.addItem(GenericMenuSeparatorLine); +// recordingSettings.addItem(fRecDir); +// recordingSettings.addItem(fTsDir); +// recordingSettings.addItem(new CMenuOptionNumberChooser(LOCALE_EXTRA_RECORD_TIME, &g_settings.record_hours, true, 1, 24, NULL) ); +// if (1) { //has_hdd) { +// recordingSettings.addItem(new CMenuOptionChooser(LOCALE_EXTRA_TIMESHIFT_PAUSE, &g_settings.timeshift_pause, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true)); +// recordingSettings.addItem(new CMenuOptionNumberChooser(LOCALE_EXTRA_AUTO_TIMESHIFT, &g_settings.auto_timeshift, true, 0, 300, NULL)); +// recordingSettings.addItem(new CMenuOptionChooser(LOCALE_EXTRA_AUTO_DELETE, &g_settings.auto_delete, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true)); +// recordingSettings.addItem(new CMenuOptionChooser(LOCALE_EXTRA_TEMP_TIMESHIFT, &g_settings.temp_timeshift, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true)); +// } +// #if 0 +// // for direct recording +// CMenuWidget *directRecordingSettings = new CMenuWidget(LOCALE_RECORDINGMENU_FILESETTINGS, NEUTRINO_ICON_RECORDING); +// +// CMenuForwarder* mf7 = new CMenuForwarder(LOCALE_RECORDINGMENU_FILESETTINGS,(g_settings.recording_type == RECORDING_FILE),NULL,directRecordingSettings, NULL, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN); +// +// +// CStringInput * recordingSettings_splitsize = new CStringInput(LOCALE_RECORDINGMENU_SPLITSIZE, g_settings.recording_splitsize, 6, LOCALE_IPSETUP_HINT_1, LOCALE_IPSETUP_HINT_2, "0123456789 "); +// CMenuForwarder* mf9 = new CMenuForwarder(LOCALE_RECORDINGMENU_SPLITSIZE, true, g_settings.recording_splitsize,recordingSettings_splitsize); +// +// CMenuOptionChooser* oj6 = new CMenuOptionChooser(LOCALE_RECORDINGMENU_USE_O_SYNC, &g_settings.recording_use_o_sync, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true); +// +// CMenuOptionChooser* oj7 = new CMenuOptionChooser(LOCALE_RECORDINGMENU_USE_FDATASYNC, &g_settings.recording_use_fdatasync, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true); +// +// CMenuOptionChooser* oj8 = new CMenuOptionChooser(LOCALE_RECORDINGMENU_STREAM_VTXT_PID, &g_settings.recording_stream_vtxt_pid, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true); +// CMenuOptionChooser* oj9 = new CMenuOptionChooser(LOCALE_RECORDINGMENU_STREAM_PMT_PID, &g_settings.recording_stream_pmt_pid, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true); +// +// CStringInput * recordingSettings_ringbuffers = new CStringInput(LOCALE_RECORDINGMENU_RINGBUFFERS, g_settings.recording_ringbuffers, 2, LOCALE_IPSETUP_HINT_1, LOCALE_IPSETUP_HINT_2, "0123456789 "); +// CMenuForwarder* mf10 = new CMenuForwarder(LOCALE_RECORDINGMENU_RINGBUFFERS, true, g_settings.recording_ringbuffers,recordingSettings_ringbuffers); +// //CMenuOptionChooser* oj10 = new CMenuOptionChooser(LOCALE_RECORDINGMENU_CHOOSE_DIRECT_REC_DIR, &g_settings.recording_choose_direct_rec_dir, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true); +// CMenuOptionChooser* oj10 = new CMenuOptionChooser(LOCALE_RECORDINGMENU_CHOOSE_DIRECT_REC_DIR, &g_settings.recording_choose_direct_rec_dir, CHOOSE_DIRECT_REC_DIR, CHOOSE_DIRECT_REC_DIR_COUNT, true); +// +// CMenuOptionChooser* oj11 = new CMenuOptionChooser(LOCALE_RECORDINGMENU_EPG_FOR_FILENAME, &g_settings.recording_epg_for_filename, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true); +// CMenuOptionChooser* oj13 = new CMenuOptionChooser(LOCALE_RECORDINGMENU_SAVE_IN_CHANNELDIR, &g_settings.recording_save_in_channeldir, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true); +// +// CRecordingNotifier *RecordingNotifier = new CRecordingNotifier(mf1,mf2,oj2,mf3,oj3,oj4,oj5,mf7,oj12); +// +// CMenuOptionChooser* oj1 = new CMenuOptionChooser(LOCALE_RECORDINGMENU_RECORDING_TYPE, &g_settings.recording_type, RECORDINGMENU_RECORDING_TYPE_OPTIONS, RECORDINGMENU_RECORDING_TYPE_OPTION_COUNT, true, RecordingNotifier); +// +// recordingSettings.addItem(GenericMenuSeparator); +// recordingSettings.addItem(GenericMenuBack); +// //recordingSettings.addItem(new CMenuForwarder(LOCALE_SETTINGS_HELP, true, NULL, this, "help_recording", CRCInput::RC_help, NEUTRINO_ICON_BUTTON_HELP_SMALL)); +// recordingSettings.addItem(new CMenuForwarder(LOCALE_RECORDINGMENU_SETUPNOW, true, NULL, this, "recording", CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED)); +// recordingSettings.addItem(GenericMenuSeparatorLine); +// recordingSettings.addItem( oj1); +// recordingSettings.addItem(GenericMenuSeparatorLine); +// recordingSettings.addItem( mf1); +// recordingSettings.addItem( mf2); +// recordingSettings.addItem( oj2); +// recordingSettings.addItem( mf3); +// recordingSettings.addItem( oj3); +// recordingSettings.addItem( oj4); +// recordingSettings.addItem(GenericMenuSeparatorLine); +// recordingSettings.addItem( oj5); +// recordingSettings.addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_TIMERSETTINGS_SEPARATOR)); +// recordingSettings.addItem( mf5); +// recordingSettings.addItem( mf6); +// recordingSettings.addItem( oj4b); +// recordingSettings.addItem(new CMenuOptionNumberChooser(LOCALE_EXTRA_RECORD_TIME, &g_settings.record_hours, true, 1, 24) ); +// recordingSettings.addItem(GenericMenuSeparatorLine); +// #if 0 +// recordingSettings.addItem(oj12); +// #endif +// recordingSettings.addItem( mf13); +// recordingSettings.addItem( mf7); +// +// directRecordingSettings->addItem(GenericMenuSeparator); +// directRecordingSettings->addItem(GenericMenuBack); +// directRecordingSettings->addItem(GenericMenuSeparatorLine); +// directRecordingSettings->addItem(mf8); +// directRecordingSettings->addItem(mf9); +// directRecordingSettings->addItem(mf10); +// directRecordingSettings->addItem(oj6); +// directRecordingSettings->addItem(oj7); +// directRecordingSettings->addItem(oj8); +// directRecordingSettings->addItem(oj9); +// directRecordingSettings->addItem(oj10); +// directRecordingSettings->addItem(oj11); +// directRecordingSettings->addItem(oj13); +// recordingstatus = 0; +// if (has_hdd) { +// directRecordingSettings->addItem(new CMenuOptionChooser(LOCALE_EXTRA_TIMESHIFT_PAUSE, &g_settings.timeshift_pause, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true)); +// directRecordingSettings->addItem(new CMenuOptionNumberChooser(LOCALE_EXTRA_AUTO_TIMESHIFT, &g_settings.auto_timeshift, true, 0, 300)); +// directRecordingSettings->addItem(new CMenuOptionChooser(LOCALE_EXTRA_AUTO_DELETE, &g_settings.auto_delete, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true)); +// directRecordingSettings->addItem(new CMenuOptionChooser(LOCALE_EXTRA_TEMP_TIMESHIFT, &g_settings.temp_timeshift, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true)); +// } +// #endif +// } #define STREAMINGMENU_STREAMING_TRANSCODE_VIDEO_CODEC_OPTION_COUNT 2 const CMenuOptionChooser::keyval STREAMINGMENU_STREAMING_TRANSCODE_VIDEO_CODEC_OPTIONS[STREAMINGMENU_STREAMING_TRANSCODE_VIDEO_CODEC_OPTION_COUNT] = diff --git a/src/system/locals.h b/src/system/locals.h index e6f142d9a..9fffe2e84 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -796,11 +796,15 @@ typedef enum { LOCALE_MOVIEPLAYER_VLCHELP8, LOCALE_MOVIEPLAYER_VLCHELP9, LOCALE_MOVIEPLAYER_WRONGVLCVERSION, + LOCALE_NETWORKMENU_APPLY_SETTINGS, + LOCALE_NETWORKMENU_APPLY_SETTINGS_NOW, LOCALE_NETWORKMENU_BROADCAST, LOCALE_NETWORKMENU_DHCP, + LOCALE_NETWORKMENU_ERROR_NO_ADDRESS, LOCALE_NETWORKMENU_GATEWAY, LOCALE_NETWORKMENU_HEAD, LOCALE_NETWORKMENU_HOSTNAME, + LOCALE_NETWORKMENU_INACTIVE, LOCALE_NETWORKMENU_IPADDRESS, LOCALE_NETWORKMENU_MOUNT, LOCALE_NETWORKMENU_NAMESERVER, @@ -813,6 +817,7 @@ typedef enum { LOCALE_NETWORKMENU_NTPSERVER_HINT1, LOCALE_NETWORKMENU_NTPSERVER_HINT2, LOCALE_NETWORKMENU_NTPTITLE, + LOCALE_NETWORKMENU_RESET_SETTINGS_NOW, LOCALE_NETWORKMENU_SETUPNOW, LOCALE_NETWORKMENU_SETUPONSTARTUP, LOCALE_NETWORKMENU_SHOW, @@ -846,6 +851,8 @@ typedef enum { LOCALE_NVODSELECTOR_SUBSERVICE, LOCALE_OPTIONS_DEFAULT, LOCALE_OPTIONS_FB, + LOCALE_OPTIONS_NTP_OFF, + LOCALE_OPTIONS_NTP_ON, LOCALE_OPTIONS_NULL, LOCALE_OPTIONS_OFF, LOCALE_OPTIONS_ON, @@ -927,6 +934,7 @@ typedef enum { LOCALE_RECORDINGMENU_NO_SCART, LOCALE_RECORDINGMENU_OFF, LOCALE_RECORDINGMENU_RECORD_IN_SPTS_MODE, + LOCALE_RECORDINGMENU_RECORD_IS_RUNNING, LOCALE_RECORDINGMENU_RECORDING_TYPE, LOCALE_RECORDINGMENU_RINGBUFFERS, LOCALE_RECORDINGMENU_SAVE_IN_CHANNELDIR, @@ -941,6 +949,7 @@ typedef enum { LOCALE_RECORDINGMENU_STOPSECTIONSD, LOCALE_RECORDINGMENU_STREAM_VTXT_PID, LOCALE_RECORDINGMENU_STREAM_PMT_PID, + LOCALE_RECORDINGMENU_TIMESHIFT, LOCALE_RECORDINGMENU_USE_FDATASYNC, LOCALE_RECORDINGMENU_USE_O_SYNC, LOCALE_RECORDINGMENU_VCR, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 990fd5cd7..87c3d88b1 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -796,11 +796,15 @@ const char *locale_real_names[] = { "movieplayer.vlchelp8", "movieplayer.vlchelp9", "movieplayer.wrongvlcversion", + "networkmenu.apply_settings", + "networkmenu.apply_settings_now", "networkmenu.broadcast", "networkmenu.dhcp", + "networkmenu.error_no_address", "networkmenu.gateway", "networkmenu.head", "networkmenu.hostname", + "networkmenu.inactive_network", "networkmenu.ipaddress", "networkmenu.mount", "networkmenu.nameserver", @@ -813,6 +817,7 @@ const char *locale_real_names[] = { "networkmenu.ntpserver_hint1", "networkmenu.ntpserver_hint2", "networkmenu.ntptitle", + "networkmenu.reset_settings_now", "networkmenu.setupnow", "networkmenu.setuponstartup", "networkmenu.show", @@ -846,6 +851,8 @@ const char *locale_real_names[] = { "nvodselector.subservice", "options.default", "options.fb", + "options.ntp_off", + "options.ntp_on", "options.null", "options.off", "options.on", @@ -927,6 +934,7 @@ const char *locale_real_names[] = { "recordingmenu.no_scart", "recordingmenu.off", "recordingmenu.record_in_spts_mode", + "recordingmenu.record_is_running", "recordingmenu.recording_type", "recordingmenu.ringbuffers", "recordingmenu.save_in_channeldir", @@ -941,6 +949,7 @@ const char *locale_real_names[] = { "recordingmenu.stopsectionsd", "recordingmenu.stream_vtxt_pid", "recordingmenu.stream_pmt_pid", + "recordingmenu.timeshift", "recordingmenu.use_fdatasync", "recordingmenu.use_o_sync", "recordingmenu.vcr", diff --git a/src/system/setting_helpers.cpp b/src/system/setting_helpers.cpp index 3a122ca88..18eaf699d 100644 --- a/src/system/setting_helpers.cpp +++ b/src/system/setting_helpers.cpp @@ -30,16 +30,26 @@ */ #include - +#include "configure_network.h" +#include +#include +#include #include +#include +#include +#include +#include +#include +#include +#include +#include #include #include +#include #include #include #include -#include -#include -#include "libnet.h" +#include #include @@ -60,6 +70,7 @@ #include #include #include +#include #include #include "libdvbsub/dvbsub.h" #include "libtuxtxt/teletext.h" @@ -220,11 +231,11 @@ CDHCPNotifier::CDHCPNotifier( CMenuForwarder* a1, CMenuForwarder* a2, CMenuForwa bool CDHCPNotifier::changeNotify(const neutrino_locale_t, void * data) { - CNeutrinoApp::getInstance()->networkConfig.inet_static = ((*(int*)(data)) == 0); + CNetworkConfig::getInstance()->inet_static = ((*(int*)(data)) == 0); for(int x=0;x<5;x++) - toDisable[x]->setActive(CNeutrinoApp::getInstance()->networkConfig.inet_static); + toDisable[x]->setActive(CNetworkConfig::getInstance()->inet_static); - toEnable[0]->setActive(!CNeutrinoApp::getInstance()->networkConfig.inet_static); + toEnable[0]->setActive(!CNetworkConfig::getInstance()->inet_static); return true; } @@ -538,13 +549,13 @@ bool CIPChangeNotifier::changeNotify(const neutrino_locale_t, void * Data) sscanf((char*) Data, "%hhu.%hhu.%hhu.%hhu", &_ip[0], &_ip[1], &_ip[2], &_ip[3]); sprintf(ip, "%hhu.%hhu.%hhu.255", _ip[0], _ip[1], _ip[2]); - CNeutrinoApp::getInstance()->networkConfig.broadcast = ip; + CNetworkConfig::getInstance()->broadcast = ip; - CNeutrinoApp::getInstance()->networkConfig.netmask = (_ip[0] == 10) ? "255.0.0.0" : "255.255.255.0"; + CNetworkConfig::getInstance()->netmask = (_ip[0] == 10) ? "255.0.0.0" : "255.255.255.0"; sprintf(ip, "%hhu.%hhu.%hhu.1", _ip[0], _ip[1], _ip[2]); - CNeutrinoApp::getInstance()->networkConfig.nameserver = ip; - CNeutrinoApp::getInstance()->networkConfig.gateway = ip; + CNetworkConfig::getInstance()->nameserver = ip; + CNetworkConfig::getInstance()->gateway = ip; return true; } @@ -731,6 +742,70 @@ int CUCodeCheckExec::exec(CMenuTarget* /*parent*/, const std::string & /*actionK return 1; } +long CNetAdapter::mac_addr_sys ( u_char *addr) //only for function getMacAddr() +{ + struct ifreq ifr; + struct ifreq *IFR; + struct ifconf ifc; + char buf[1024]; + int s, i; + int ok = 0; + s = socket(AF_INET, SOCK_DGRAM, 0); + if (s==-1) + { + return -1; + } + + ifc.ifc_len = sizeof(buf); + ifc.ifc_buf = buf; + ioctl(s, SIOCGIFCONF, &ifc); + IFR = ifc.ifc_req; + for (i = ifc.ifc_len / sizeof(struct ifreq); --i >= 0; IFR++) + { + strcpy(ifr.ifr_name, IFR->ifr_name); + if (ioctl(s, SIOCGIFFLAGS, &ifr) == 0) + { + if (! (ifr.ifr_flags & IFF_LOOPBACK)) + { + if (ioctl(s, SIOCGIFHWADDR, &ifr) == 0) + { + ok = 1; + break; + } + } + } + } + close(s); + if (ok) + { + memmove(addr, ifr.ifr_hwaddr.sa_data, 6); + } + else + { + return -1; + } + return 0; +} + +std::string CNetAdapter::getMacAddr(void) +{ + long stat; + u_char addr[6]; + stat = mac_addr_sys( addr); + if (0 == stat) + { + std::stringstream mac_tmp; + for(int i=0;i<6;++i) + mac_tmp<getText(LOCALE_NETWORKMENU_GATEWAY); - text += ": "; - text += our_gateway; - text += ' '; - text += mypinghost(our_gateway); - text += '\n'; - text += g_Locale->getText(LOCALE_NETWORKMENU_NAMESERVER); - text += ": "; - text += our_nameserver; - text += ' '; - text += mypinghost(our_nameserver); - text += "\ndboxupdate.berlios.de: "; - text += mypinghost("195.37.77.138"); - + printf("testNw Testsite %s\n", testsite.c_str()); + + if (our_ip[0] == 0) + { + text = g_Locale->getText(LOCALE_NETWORKMENU_INACTIVE); + } + else + { + text = "Box: " + ethID + "\n "; + text += (std::string)our_ip + " " + (std::string)mypinghost(our_ip); + text += "\n"; + text += g_Locale->getText(LOCALE_NETWORKMENU_GATEWAY); + text += " (Router)\n "; + text += (std::string)our_gateway + " " +(std::string)mypinghost(our_gateway); + text += "\n"; + text += g_Locale->getText(LOCALE_NETWORKMENU_NAMESERVER); + text += "\n "; + text += (std::string)our_nameserver + " " + (std::string)mypinghost(our_nameserver); + text += "\n"; + text += "wiki.neutrino-hd.de:\n "; + text += "via IP (" + wiki_IP + "): " + (std::string)mypinghost(wiki_IP.c_str()); + text += ":\n "; + if (1 == pinghost(our_nameserver)) + { + text += "via DNS: " + (std::string)mypinghost("wiki.neutrino-hd.de"); + text += "\n"; + text += testsite + ":\n "; + text += "via DNS: " + (std::string)mypinghost(testsite.c_str()) + ":\n"; + } + } + ShowMsgUTF(LOCALE_NETWORKMENU_TEST, text, CMessageBox::mbrBack, CMessageBox::mbBack); // UTF-8 } @@ -801,33 +906,23 @@ void showCurrentNetworkSettings() char router[16]; char nameserver[16]; std::string text; - - netGetIP((char *) "eth0",ip,mask,broadcast); + + netGetIP("eth0", ip, mask, broadcast); if (ip[0] == 0) { - text = "Network inactive\n"; + text = g_Locale->getText(LOCALE_NETWORKMENU_INACTIVE); } else { netGetNameserver(nameserver); netGetDefaultRoute(router); - text = g_Locale->getText(LOCALE_NETWORKMENU_IPADDRESS ); - text += ": "; - text += ip; - text += '\n'; - text += g_Locale->getText(LOCALE_NETWORKMENU_NETMASK ); - text += ": "; - text += mask; - text += '\n'; - text += g_Locale->getText(LOCALE_NETWORKMENU_BROADCAST ); - text += ": "; - text += broadcast; - text += '\n'; - text += g_Locale->getText(LOCALE_NETWORKMENU_NAMESERVER); - text += ": "; - text += nameserver; - text += '\n'; - text += g_Locale->getText(LOCALE_NETWORKMENU_GATEWAY ); - text += ": "; - text += router; + CNetworkConfig networkConfig; + std::string dhcp = networkConfig.inet_static ? g_Locale->getText(LOCALE_OPTIONS_OFF) : g_Locale->getText(LOCALE_OPTIONS_ON); + + text = (std::string)g_Locale->getText(LOCALE_NETWORKMENU_DHCP) + ": " + dhcp + '\n' + + g_Locale->getText(LOCALE_NETWORKMENU_IPADDRESS ) + ": " + ip + '\n' + + g_Locale->getText(LOCALE_NETWORKMENU_NETMASK ) + ": " + mask + '\n' + + g_Locale->getText(LOCALE_NETWORKMENU_BROADCAST ) + ": " + broadcast + '\n' + + g_Locale->getText(LOCALE_NETWORKMENU_NAMESERVER) + ": " + nameserver + '\n' + + g_Locale->getText(LOCALE_NETWORKMENU_GATEWAY ) + ": " + router; } ShowMsgUTF(LOCALE_NETWORKMENU_SHOW, text, CMessageBox::mbrBack, CMessageBox::mbBack); // UTF-8 } @@ -992,3 +1087,29 @@ bool CAutoModeNotifier::changeNotify(const neutrino_locale_t /*OptionName*/, voi videoDecoder->SetAutoModes(modes); return true; } + +int safe_mkdir(char * path) +{ + struct statfs s; + int ret = 0; + if(!strncmp(path, "/hdd", 4)) { + ret = statfs("/hdd", &s); + if((ret != 0) || (s.f_type == 0x72b6)) + ret = -1; + else + mkdir(path, 0755); + } else + mkdir(path, 0755); + return ret; +} + +int check_dir(const char * newdir) +{ + if(strncmp(newdir, "/media/sda1/", 12) && strncmp(newdir, "/media/sdb1/", 12) && strncmp(newdir, "/mnt/", 5) && strncmp(newdir, "/tmp/", 5) && strncmp(newdir, "/media/", 7)) { + return 1; + } + + return 0; +} + + diff --git a/src/system/setting_helpers.h b/src/system/setting_helpers.h index f4459dd61..b26fc480a 100644 --- a/src/system/setting_helpers.h +++ b/src/system/setting_helpers.h @@ -270,17 +270,9 @@ class CUCodeCheckExec : public CMenuTarget void testNetworkSettings(const char* ip, const char* netmask, const char* broadcast, const char* gateway, const char* nameserver, bool dhcp); void showCurrentNetworkSettings(); +int safe_mkdir(char * path); +int check_dir(const char * newdir); -// // USERMENU -// class CUserMenuMenu : public CMenuTarget -// { -// private: -// int button; -// neutrino_locale_t local; -// public: -// CUserMenuMenu(neutrino_locale_t _local, int _button){local = _local;button = _button;}; -// int exec(CMenuTarget* parent, const std::string & actionKey); -// }; class CTZChangeNotifier : public CChangeObserver {