7 #include <libsig_comp.h>
9 #include <lib/actions/action.h>
10 #include <lib/driver/rc.h>
11 #include <lib/base/ioprio.h>
12 #include <lib/base/ebase.h>
13 #include <lib/base/eerror.h>
14 #include <lib/base/init.h>
15 #include <lib/base/init_num.h>
16 #include <lib/gdi/gfbdc.h>
17 #include <lib/gdi/glcddc.h>
18 #include <lib/gdi/grc.h>
20 #include <lib/gdi/sdl.h>
22 #include <lib/gdi/epng.h>
23 #include <lib/gdi/font.h>
24 #include <lib/gui/ebutton.h>
25 #include <lib/gui/elabel.h>
26 #include <lib/gui/elistboxcontent.h>
27 #include <lib/gui/ewidget.h>
28 #include <lib/gui/ewidgetdesktop.h>
29 #include <lib/gui/ewindow.h>
30 #include <lib/python/connections.h>
31 #include <lib/python/python.h>
40 int object_total_remaining;
44 printf("%d items left\n", object_total_remaining);
48 static eWidgetDesktop *wdsk, *lcddsk;
50 static int prev_ascii_code;
52 int getPrevAsciiCode()
54 int ret = prev_ascii_code;
59 void keyEvent(const eRCKey &key)
62 eActionMap::getInstance(ptr);
63 if (key.flags & eRCKey::flagAscii)
65 prev_ascii_code = key.code;
66 ptr->keyPressed(0, 510 /* faked KEY_ASCII */, 0);
69 ptr->keyPressed(0, key.code, key.flags);
72 /************************************************/
74 #include <lib/components/scan.h>
75 #include <lib/dvb/idvb.h>
76 #include <lib/dvb/dvb.h>
77 #include <lib/dvb/db.h>
78 #include <lib/dvb/dvbtime.h>
79 #include <lib/dvb/epgcache.h>
81 class eMain: public eApplication, public Object
85 ePtr<eDVBResourceManager> m_mgr;
87 ePtr<eDVBLocalTimeHandler> m_locale_time_handler;
88 ePtr<eComponentScan> m_scan;
89 ePtr<eEPGCache> m_epgcache;
94 init.setRunlevel(eAutoInitNumbers::main);
96 /* TODO: put into init */
97 m_dvbdb = new eDVBDB();
98 m_mgr = new eDVBResourceManager();
99 m_locale_time_handler = new eDVBLocalTimeHandler();
100 m_epgcache = new eEPGCache();
101 m_mgr->setChannelList(m_dvbdb);
106 m_dvbdb->saveServicelist();
113 int main(int argc, char **argv)
123 #ifdef HAVE_GSTREAMER
124 gst_init(&argc, &argv);
127 // set pythonpath if unset
128 setenv("PYTHONPATH", LIBDIR "/enigma2/python", 0);
129 printf("PYTHONPATH: %s\n", getenv("PYTHONPATH"));
139 gSDLDC::getInstance(my_dc);
142 gFBDC::getInstance(my_dc);
144 int double_buffer = my_dc->haveDoubleBuffering();
147 ePtr<gLCDDC> my_lcd_dc;
148 gLCDDC::getInstance(my_lcd_dc);
151 /* ok, this is currently hardcoded for arabic. */
152 /* some characters are wrong in the regular font, force them to use the replacement font */
153 for (int i = 0x60c; i <= 0x66d; ++i)
154 eTextPara::forceReplacementGlyph(i);
155 eTextPara::forceReplacementGlyph(0xfdf2);
156 for (int i = 0xfe80; i < 0xff00; ++i)
157 eTextPara::forceReplacementGlyph(i);
160 eWidgetDesktop dsk(eSize(720, 576));
161 eWidgetDesktop dsk_lcd(eSize(132, 64));
163 /* if (double_buffer)
165 eDebug(" - double buffering found, enable buffered graphics mode.");
166 dsk.setCompositionMode(eWidgetDesktop::cmBuffered);
173 dsk_lcd.setDC(my_lcd_dc);
176 loadPNG(m_pm, DATADIR "/enigma2/pal.png");
179 eFatal("pal.png not found!");
181 dsk.setPalette(*m_pm);
183 dsk.setBackgroundColor(gRGB(0,0,0,0xFF));
186 /* redrawing is done in an idle-timer, so we have to set the context */
187 dsk.setRedrawTask(main);
188 dsk_lcd.setRedrawTask(main);
190 eRCInput::getInstance()->keyEvent.connect(slot(keyEvent));
192 printf("executing main\n");
196 setIoPrio(IOPRIO_CLASS_BE, 3);
198 python.execute("mytest", "__main__");
200 if (exit_code == 5) /* python crash */
207 gPainter p(my_lcd_dc);
208 p.resetClip(eRect(0, 0, 132, 64));
216 eWidgetDesktop *getDesktop(int which)
218 return which ? lcddsk : wdsk;
221 eApplication *getApplication()
231 void quitMainloop(int exitCode)
233 exit_code = exitCode;
237 void addFont(const char *filename, const char *alias, int scale_factor, int is_replacement)
239 fontRenderClass::getInstance()->AddFont(filename, alias, scale_factor);
241 eTextPara::setReplacementFont(alias);