6 #include <libsig_comp.h>
8 #include <lib/actions/action.h>
9 #include <lib/driver/rc.h>
10 #include <lib/base/ioprio.h>
11 #include <lib/base/ebase.h>
12 #include <lib/base/eerror.h>
13 #include <lib/base/init.h>
14 #include <lib/base/init_num.h>
15 #include <lib/gdi/gfbdc.h>
16 #include <lib/gdi/glcddc.h>
17 #include <lib/gdi/grc.h>
19 #include <lib/gdi/sdl.h>
21 #include <lib/gdi/epng.h>
22 #include <lib/gdi/font.h>
23 #include <lib/gui/ebutton.h>
24 #include <lib/gui/elabel.h>
25 #include <lib/gui/elistboxcontent.h>
26 #include <lib/gui/ewidget.h>
27 #include <lib/gui/ewidgetdesktop.h>
28 #include <lib/gui/ewindow.h>
29 #include <lib/python/connections.h>
30 #include <lib/python/python.h>
39 int object_total_remaining;
43 printf("%d items left\n", object_total_remaining);
47 static eWidgetDesktop *wdsk, *lcddsk;
49 static int prev_ascii_code;
51 int getPrevAsciiCode()
53 int ret = prev_ascii_code;
58 void keyEvent(const eRCKey &key)
60 static eRCKey last(0, 0, 0);
61 static int num_repeat;
64 eActionMap::getInstance(ptr);
66 if ((key.code == last.code) && (key.producer == last.producer) && key.flags & eRCKey::flagRepeat)
76 ptr->keyPressed(key.producer->getIdentifier(), key.code, eRCKey::flagLong);
80 if (key.flags & eRCKey::flagAscii)
82 prev_ascii_code = key.code;
83 ptr->keyPressed(key.producer->getIdentifier(), 510 /* faked KEY_ASCII */, 0);
86 ptr->keyPressed(key.producer->getIdentifier(), key.code, key.flags);
89 /************************************************/
91 #include <lib/components/scan.h>
92 #include <lib/dvb/idvb.h>
93 #include <lib/dvb/dvb.h>
94 #include <lib/dvb/db.h>
95 #include <lib/dvb/dvbtime.h>
96 #include <lib/dvb/epgcache.h>
98 class eMain: public eApplication, public Object
102 ePtr<eDVBDB> m_dvbdb;
103 ePtr<eDVBResourceManager> m_mgr;
104 ePtr<eDVBLocalTimeHandler> m_locale_time_handler;
105 ePtr<eEPGCache> m_epgcache;
110 init.setRunlevel(eAutoInitNumbers::main);
111 /* TODO: put into init */
112 m_dvbdb = new eDVBDB();
113 m_mgr = new eDVBResourceManager();
114 m_locale_time_handler = new eDVBLocalTimeHandler();
115 m_epgcache = new eEPGCache();
116 m_mgr->setChannelList(m_dvbdb);
121 m_dvbdb->saveServicelist();
122 m_mgr->releaseCachedChannel();
128 int main(int argc, char **argv)
138 #ifdef HAVE_GSTREAMER
139 gst_init(&argc, &argv);
142 // set pythonpath if unset
143 setenv("PYTHONPATH", LIBDIR "/enigma2/python", 0);
144 printf("PYTHONPATH: %s\n", getenv("PYTHONPATH"));
154 gSDLDC::getInstance(my_dc);
157 gFBDC::getInstance(my_dc);
159 int double_buffer = my_dc->haveDoubleBuffering();
162 ePtr<gLCDDC> my_lcd_dc;
163 gLCDDC::getInstance(my_lcd_dc);
166 /* ok, this is currently hardcoded for arabic. */
167 /* some characters are wrong in the regular font, force them to use the replacement font */
168 for (int i = 0x60c; i <= 0x66d; ++i)
169 eTextPara::forceReplacementGlyph(i);
170 eTextPara::forceReplacementGlyph(0xfdf2);
171 for (int i = 0xfe80; i < 0xff00; ++i)
172 eTextPara::forceReplacementGlyph(i);
174 eWidgetDesktop dsk(eSize(720, 576));
175 eWidgetDesktop dsk_lcd(eSize(132, 64));
178 dsk_lcd.setStyleID(1);
180 /* if (double_buffer)
182 eDebug(" - double buffering found, enable buffered graphics mode.");
183 dsk.setCompositionMode(eWidgetDesktop::cmBuffered);
190 dsk_lcd.setDC(my_lcd_dc);
193 loadPNG(m_pm, DATADIR "/enigma2/skin_default/pal.png");
196 eFatal("pal.png not found!");
198 dsk.setPalette(*m_pm);
200 dsk.setBackgroundColor(gRGB(0,0,0,0xFF));
203 /* redrawing is done in an idle-timer, so we have to set the context */
204 dsk.setRedrawTask(main);
205 dsk_lcd.setRedrawTask(main);
208 eDebug("Loading spinners...");
212 #define MAX_SPINNER 64
213 ePtr<gPixmap> wait[MAX_SPINNER];
214 for (i=0; i<MAX_SPINNER; ++i)
216 char filename[strlen(DATADIR) + 20];
217 sprintf(filename, DATADIR "/enigma2/skin_default/spinner/wait%d.png", i + 1);
218 loadPNG(wait[i], filename);
223 eDebug("failed to load %s! (%m)", filename);
225 eDebug("found %d spinner!\n", i);
230 my_dc->setSpinner(eRect(ePoint(100, 100), wait[0]->size()), wait, i);
232 my_dc->setSpinner(eRect(100, 100, 0, 0), wait, 1);
235 gRC::getInstance()->setSpinnerDC(my_dc);
237 eRCInput::getInstance()->keyEvent.connect(slot(keyEvent));
239 printf("executing main\n");
243 setIoPrio(IOPRIO_CLASS_BE, 3);
245 // python.execute("mytest", "__main__");
246 python.execFile("/usr/lib/enigma2/python/mytest.py");
248 if (exit_code == 5) /* python crash */
250 eDebug("(exit code 5)");
258 gPainter p(my_lcd_dc);
259 p.resetClip(eRect(0, 0, 132, 64));
266 eWidgetDesktop *getDesktop(int which)
268 return which ? lcddsk : wdsk;
271 eApplication *getApplication()
281 void quitMainloop(int exitCode)
283 FILE *f = fopen("/proc/stb/fp/was_timer_wakeup", "w");
291 int fd = open("/dev/dbox/fp0", O_WRONLY);
294 if (ioctl(fd, 10 /*FP_CLEAR_WAKEUP_TIMER*/) < 0)
295 eDebug("FP_CLEAR_WAKEUP_TIMER failed (%m)");
299 eDebug("open /dev/dbox/fp0 for wakeup timer clear failed!(%m)");
301 exit_code = exitCode;
307 const char *getEnigmaVersionString()
310 #ifdef ENIGMA2_CHECKOUT_TAG
319 void dump_malloc_stats(void)
321 struct mallinfo mi = mallinfo();
322 eDebug("MALLOC: %d total", mi.uordblks);