4 * Copyright (C) 2003 Andreas Monzner <ghostrider@tuxbox.org>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 * $Id: setup_extra.cpp,v 1.77 2008/08/30 16:47:35 dbluelle Exp $
23 #include <setup_extra.h>
24 #include <setupengrab.h>
25 #include <setupnetwork.h>
26 #include <software_update.h>
28 #include <swapmanager.h>
29 #include <lib/dvb/decoder.h>
30 #include <lib/gui/emessage.h>
31 #include <lib/system/info.h>
33 #ifndef TUXTXT_CFG_STANDALONE
34 extern "C" int tuxtxt_stop();
35 extern "C" void tuxtxt_close();
36 extern "C" int tuxtxt_init();
37 extern "C" int tuxtxt_start(int tpid
);
40 eExpertSetup::eExpertSetup()
41 :eSetupWindow(_("Expert Setup"), 10, 400)
46 void eExpertSetup::init_eExpertSetup()
48 cmove(ePoint(170, 115));
51 if ( eConfig::getInstance()->getKey("/ezap/webif/lockWebIf", lockWebIf
) )
52 eConfig::getInstance()->setKey("/ezap/webif/lockWebIf", lockWebIf
);
55 if ( eConfig::getInstance()->getKey("/extras/showSatPos", showSatPos
) )
56 eConfig::getInstance()->setKey("/extras/showSatPos", showSatPos
);
59 #ifndef DISABLE_NETWORK
60 if (eSystemInfo::getInstance()->hasNetwork())
62 CONNECT((new eListBoxEntryMenu(&list
, _("Communication Setup"), eString().sprintf("(%d) %s", ++entry
, _("open communication setup")) ))->selected
, eExpertSetup::communication_setup
);
63 CONNECT((new eListBoxEntryMenu(&list
, _("Ngrab Streaming Setup"), eString().sprintf("(%d) %s", ++entry
, _("open ngrab server setup")) ))->selected
, eExpertSetup::ngrab_setup
);
64 switch (eSystemInfo::getInstance()->getHwType())
66 case eSystemInfo::DM7020
:
67 case eSystemInfo::DM600PVR
:
68 case eSystemInfo::DM500PLUS
:
71 CONNECT((new eListBoxEntryMenu(&list
, _("Software Update"), eString().sprintf("(%d) %s", ++entry
, _("open software update")) ))->selected
, eExpertSetup::software_update
);
75 if ( eConfig::getInstance()->getKey("/elitedvb/network/samba", startSamba
) )
76 eConfig::getInstance()->setKey("/elitedvb/network/samba", startSamba
);
78 CONNECT((new eListBoxEntryMenu(&list
, _("Remote Control"), eString().sprintf("(%d) %s", ++entry
, _("open remote control setup")) ))->selected
, eExpertSetup::rc_setup
);
81 CONNECT((new eListBoxEntryMenu(&list
, _("Swap Manager"), eString().sprintf("(%d) %s", ++entry
, _("open swapspace setup")) ))->selected
, eExpertSetup::swapmanager
);
84 if ( eSystemInfo::getInstance()->getHwType() >= eSystemInfo::DM7000
)
85 CONNECT((new eListBoxEntryMenu(&list
, _("Factory reset"), eString().sprintf("(%d) %s", ++entry
, _("all settings will set to factory defaults")) ))->selected
, eExpertSetup::factory_reset
);
86 new eListBoxEntryMenuSeparator(&list
, eSkin::getActive()->queryImage("listbox.separator"), 0, true );
87 list
.setFlags(list
.getFlags()|eListBoxBase::flagNoPageMovement
);
89 if ( eSystemInfo::getInstance()->canRecordTS() && !eDVB::getInstance()->recorder
)
91 record_split_size
= new eListBoxEntryMulti(&list
, _("record split size (left, right)"));
92 record_split_size
->add(" 650MB >", 650*1024);
93 record_split_size
->add("< 700MB >", 700*1024);
94 record_split_size
->add("< 800MB >", 800*1024);
95 record_split_size
->add("< 1GB >", 1024*1024);
96 record_split_size
->add("< 1,5GB >", 1536*1024);
97 record_split_size
->add("< 2GB >", 2*1024*1024);
98 record_split_size
->add("< 4GB >", 4*1024*1024);
99 record_split_size
->add("< 8GB >", 8*1024*1024);
100 record_split_size
->add("< 16GB ", 16*1024*1024);
102 if (eConfig::getInstance()->getKey("/extras/record_splitsize", splitsize
))
103 splitsize
=1024*1024; // 1G
104 record_split_size
->setCurrent(splitsize
);
105 CONNECT( list
.selchanged
, eExpertSetup::selChanged
);
108 if ( eSystemInfo::getInstance()->getHwType() >= eSystemInfo::DM7000
)
109 CONNECT((new eListBoxEntryCheck(&list
,_("Enable fast zapping"),"/elitedvb/extra/fastzapping",_("enables faster zapping.. but with visible sync")))->selected
, eExpertSetup::fastZappingChanged
);
110 CONNECT((new eListBoxEntryCheck(&list
, _("Use http authentification"), "/ezap/webif/lockWebIf", _("enables the http (user/password) authentification")))->selected
, eExpertSetup::reinitializeHTTPServer
);
111 CONNECT((new eListBoxEntryCheck(&list
, _("Don't open serial port"), "/ezap/extra/disableSerialOutput", _("don't write debug messages to /dev/tts/0")))->selected
, eExpertSetup::reinitializeHTTPServer
);
112 new eListBoxEntryCheck(&list
, _("Auto bouquet change"), "/elitedvb/extra/autobouquetchange", _("change into next bouquet when end of current bouquet is reached"));
113 new eListBoxEntryCheck(&list
, _("Auto reconnect cahandler"), "/elitedvb/extra/cahandlerReconnect", _("try to reconnect when an external cahandler connection was lost"));
114 #ifndef DISABLE_NETWORK
115 if ( eSystemInfo::getInstance()->getHwType() == eSystemInfo::DM7000
||
116 eSystemInfo::getInstance()->getHwType() == eSystemInfo::DM7020
)
117 new eListBoxEntryCheck(&list
, _("Enable file sharing"), "/elitedvb/network/samba", _("start file sharing(samba) on startup"));
119 #ifndef TUXTXT_CFG_STANDALONE
120 CONNECT((new eListBoxEntryCheck(&list
, _("Disable teletext caching"), "/ezap/extra/teletext_caching", _("don't cache teletext pages in background")))->selected
, eExpertSetup::tuxtxtCachingChanged
);
122 new eListBoxEntryCheck(&list
, _("Enable Zapping History"), "/elitedvb/extra/extzapping", _("don't care about actual mode when zapping in history list"));
123 if ( eSystemInfo::getInstance()->getHwType() < eSystemInfo::DM5600
)
124 new eListBoxEntryCheck(&list
, _("Disable Standby"), "/extras/fastshutdown", _("Box goes directly into Deep-Standby"));
125 #ifdef ENABLE_MHW_EPG
127 if ( eConfig::getInstance()->getKey("/extras/mhwepg", mhwepg
) )
128 eConfig::getInstance()->setKey("/extras/mhwepg", mhwepg
);
129 new eListBoxEntryCheck(&list
, _("Enable MHW EPG"), "/extras/mhwepg", _("Mediahighway EPG, activate swap space when using with multiple operators"));
131 #ifdef HAVE_DREAMBOX_HARDWARE
132 if ( eSystemInfo::getInstance()->getHwType() == eSystemInfo::DM7000
)
134 int corefilesDisable
= 0;
135 if (access("/var/etc/.no_corefiles", R_OK
) == 0)
136 corefilesDisable
= 1;
137 eConfig::getInstance()->setKey("/extras/corefiles_disable", corefilesDisable
);
138 new eListBoxEntryMenuSeparator(&list
, eSkin::getActive()->queryImage("listbox.separator"), 0, true );
139 CONNECT_2_1((new eListBoxEntryCheck(&list
, _("Disable CoreFiles"), "/extras/corefiles_disable", _("don't create 'Corefiles' after an Enigma crash")))->selected
, eExpertSetup::fileToggle
,"/var/etc/.no_corefiles");
140 #ifdef ENABLE_EXPERT_WEBIF
141 int dontMountHDD
= 0;
142 if (access("/var/etc/.dont_mount_hdd", R_OK
) == 0)
144 eConfig::getInstance()->setKey("/extras/dont_mount_hdd", dontMountHDD
);
145 CONNECT_2_1((new eListBoxEntryCheck(&list
, _("Disable HDD mount"), "/extras/dont_mount_hdd", _("don't mount the HDD via 'rcS'")))->selected
, eExpertSetup::fileToggle
,"/var/etc/.dont_mount_hdd");
151 if ( eConfig::getInstance()->getKey("/ezap/extra/autoplay", autoplay
) )
152 eConfig::getInstance()->setKey("/ezap/extra/autoplay", autoplay
);
153 new eListBoxEntryCheck(&list
, _("Enable Filemode Autoplay"), "/ezap/extra/autoplay", _("continue playing last selected movie when entering Filemode"));
155 #ifndef HAVE_DREAMBOX_HARDWARE
156 new eListBoxEntryMenuSeparator(&list
, eSkin::getActive()->queryImage("listbox.separator"), 0, true );
159 if (access("/var/etc/.boot_info", R_OK
) == 0)
161 eConfig::getInstance()->setKey("/extras/bootinfo", bootInfo
);
162 CONNECT_2_1((new eListBoxEntryCheck(&list
, _("Show Boot-Info"), "/extras/bootinfo", _("Show Boot-Infos (IP, etc.)")))->selected
, eExpertSetup::fileToggle
,"/var/etc/.boot_info");
164 int hwSectionsDisable
= 0;
165 if (access("/var/etc/.hw_sections", R_OK
) == 0)
166 hwSectionsDisable
= 1;
167 eConfig::getInstance()->setKey("/extras/hw_sections_disable", hwSectionsDisable
);
168 CONNECT_2_1((new eListBoxEntryCheck(&list
, _("Disable HW_Sections"), "/extras/hw_sections_disable", _("don't use hardware section filtering")))->selected
, eExpertSetup::fileToggle
,"/var/etc/.hw_sections");
170 int watchdogDisable
= 0;
171 if (access("/var/etc/.no_watchdog", R_OK
) == 0)
173 eConfig::getInstance()->setKey("/extras/watchdog_disable", watchdogDisable
);
174 CONNECT_2_1((new eListBoxEntryCheck(&list
, _("Disable Watchdog"), "/extras/watchdog_disable", _("don't use the Watchdog")))->selected
, eExpertSetup::fileToggle
,"/var/etc/.no_watchdog");
175 //ENX-Watchdog - Philips and Sagem
176 if ( eSystemInfo::getInstance()->getHwType() != eSystemInfo::dbox2Nokia
)
178 int enxWatchdogDisable
= 0;
179 if (access("/var/etc/.no_enxwatchdog", R_OK
) == 0)
180 enxWatchdogDisable
= 1;
181 eConfig::getInstance()->setKey("/extras/enxwatchdog_disable", enxWatchdogDisable
);
182 CONNECT_2_1((new eListBoxEntryCheck(&list
, _("Disable ENX-Watchdog"), "/extras/enxwatchdog_disable", _("don't use the ENX-Watchdog")))->selected
, eExpertSetup::fileToggle
,"/var/etc/.no_enxwatchdog");
186 if (access("/var/etc/.spts_mode", R_OK
) == 0)
188 eConfig::getInstance()->setKey("/extras/spts_mode", sptsMode
);
189 CONNECT_2_1((new eListBoxEntryCheck(&list
, _("Enable SPTS-Mode"), "/extras/spts_mode", _("use SPTS-Mode (enables TS-recording)")))->selected
, eExpertSetup::fileToggle
,"/var/etc/.spts_mode");
191 int OSyncDisable
= 0;
192 if (access("/var/etc/.no_o_sync", R_OK
) == 0)
194 eConfig::getInstance()->setKey("/extras/O_SYNC_disable", OSyncDisable
);
195 CONNECT_2_1((new eListBoxEntryCheck(&list
, _("Disable O_SYNC"), "/extras/O_SYNC_disable", _("The file/recording is not opened for synchronous I/O")))->selected
, eExpertSetup::fileToggle
,"/var/etc/.no_o_sync");
196 //Alternative Frontenddriver for Philips
197 if ( eSystemInfo::getInstance()->getHwType() == eSystemInfo::dbox2Philips
)
200 if (access("/var/etc/.tda80xx", R_OK
) == 0)
202 eConfig::getInstance()->setKey("/extras/tda80xx", tda80xx
);
203 CONNECT_2_1((new eListBoxEntryCheck(&list
, _("New Philips driver"), "/extras/tda80xx", _("use tda80xx driver for Philips boxes")))->selected
, eExpertSetup::fileToggle
,"/var/etc/.tda80xx");
209 void eExpertSetup::fileToggle(bool newState
, const char* filename
)
212 test
= fopen(filename
,"r");
220 eString cmd
= "touch ";
226 #ifndef TUXTXT_CFG_STANDALONE
227 void eExpertSetup::tuxtxtCachingChanged(bool b
)
231 if (Decoder::current
.tpid
!= -1)
238 if (Decoder::current
.tpid
!= -1)
239 tuxtxt_start(Decoder::current
.tpid
);
245 void eExpertSetup::selChanged(eListBoxEntryMenu
* e
)
247 if ( eSystemInfo::getInstance()->canRecordTS() &&
248 e
== (eListBoxEntryMenu
*)record_split_size
)
249 eConfig::getInstance()->setKey("/extras/record_splitsize", (int)e
->getKey());
253 void eExpertSetup::reinitializeHTTPServer(bool)
255 eZap::getInstance()->reconfigureHTTPServer();
258 void eExpertSetup::fastZappingChanged(bool b
)
260 Decoder::setFastZap(b
);
263 #ifndef DISABLE_NETWORK
264 void eExpertSetup::communication_setup()
267 eZapNetworkSetup setup
;
269 setup
.setLCD(LCDTitle
, LCDElement
);
277 void eExpertSetup::ngrab_setup()
282 setup
.setLCD(LCDTitle
, LCDElement
);
290 void eExpertSetup::software_update()
293 eSoftwareUpdate setup
;
295 setup
.setLCD(LCDTitle
, LCDElement
);
305 void eExpertSetup::rc_setup()
310 setup
.setLCD(LCDTitle
, LCDElement
);
319 void eExpertSetup::swapmanager()
324 setup
.setLCD(LCDTitle
, LCDElement
);
334 //implemented in upgrade.cpp
335 extern bool erase(char mtd
[30], const char *titleText
);
337 void eExpertSetup::factory_reset()
341 _("When you do a factory reset, you will lose ALL your configuration data\n"
342 "(including bouquets, services, satellite data ...)\n"
343 "After completion of factory reset, your receiver will restart automatically!\n\n"
344 "Really do a factory reset?"),
346 eMessageBox::btYes
|eMessageBox::btNo
|eMessageBox::iconQuestion
,
351 if ( ret
== eMessageBox::btYes
)
353 switch( eSystemInfo::getInstance()->getHwType() )
355 case eSystemInfo::DM500PLUS
:
356 case eSystemInfo::DM600PVR
:
357 case eSystemInfo::DM7020
:
358 system("rm -R /etc/enigma && killall -9 enigma");
360 case eSystemInfo::DM7000
:
361 case eSystemInfo::DM500
:
362 case eSystemInfo::DM5620
:
363 case eSystemInfo::DM5600
:
364 case eSystemInfo::TR_DVB272S
:
365 erase("/dev/mtd/1", _("Factory reset..."));
369 eDebug("factory reset not implemented for this hardware!!\n");