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)
61 static eRCKey last(0, 0, 0);
62 static int num_repeat;
65 eActionMap::getInstance(ptr);
67 if ((key.code == last.code) && (key.producer == last.producer) && key.flags & eRCKey::flagRepeat)
77 ptr->keyPressed(key.producer->getIdentifier(), key.code, eRCKey::flagLong);
81 if (key.flags & eRCKey::flagAscii)
83 prev_ascii_code = key.code;
84 ptr->keyPressed(key.producer->getIdentifier(), 510 /* faked KEY_ASCII */, 0);
87 ptr->keyPressed(key.producer->getIdentifier(), key.code, key.flags);
90 /************************************************/
92 #include <lib/components/scan.h>
93 #include <lib/dvb/idvb.h>
94 #include <lib/dvb/dvb.h>
95 #include <lib/dvb/db.h>
96 #include <lib/dvb/dvbtime.h>
97 #include <lib/dvb/epgcache.h>
99 class eMain: public eApplication, public Object
103 ePtr<eDVBResourceManager> m_mgr;
104 ePtr<eDVBDB> m_dvbdb;
105 ePtr<eDVBLocalTimeHandler> m_locale_time_handler;
106 ePtr<eComponentScan> m_scan;
107 ePtr<eEPGCache> m_epgcache;
112 init.setRunlevel(eAutoInitNumbers::main);
114 /* TODO: put into init */
115 m_dvbdb = new eDVBDB();
116 m_mgr = new eDVBResourceManager();
117 m_locale_time_handler = new eDVBLocalTimeHandler();
118 m_epgcache = new eEPGCache();
119 m_mgr->setChannelList(m_dvbdb);
124 m_dvbdb->saveServicelist();
131 int main(int argc, char **argv)
141 #ifdef HAVE_GSTREAMER
142 gst_init(&argc, &argv);
145 // set pythonpath if unset
146 setenv("PYTHONPATH", LIBDIR "/enigma2/python", 0);
147 printf("PYTHONPATH: %s\n", getenv("PYTHONPATH"));
157 gSDLDC::getInstance(my_dc);
160 gFBDC::getInstance(my_dc);
162 int double_buffer = my_dc->haveDoubleBuffering();
165 ePtr<gLCDDC> my_lcd_dc;
166 gLCDDC::getInstance(my_lcd_dc);
169 /* ok, this is currently hardcoded for arabic. */
170 /* some characters are wrong in the regular font, force them to use the replacement font */
171 for (int i = 0x60c; i <= 0x66d; ++i)
172 eTextPara::forceReplacementGlyph(i);
173 eTextPara::forceReplacementGlyph(0xfdf2);
174 for (int i = 0xfe80; i < 0xff00; ++i)
175 eTextPara::forceReplacementGlyph(i);
177 eWidgetDesktop dsk(eSize(720, 576));
178 eWidgetDesktop dsk_lcd(eSize(132, 64));
181 dsk_lcd.setStyleID(1);
183 /* if (double_buffer)
185 eDebug(" - double buffering found, enable buffered graphics mode.");
186 dsk.setCompositionMode(eWidgetDesktop::cmBuffered);
193 dsk_lcd.setDC(my_lcd_dc);
196 loadPNG(m_pm, DATADIR "/enigma2/pal.png");
199 eFatal("pal.png not found!");
201 dsk.setPalette(*m_pm);
203 dsk.setBackgroundColor(gRGB(0,0,0,0xFF));
206 /* redrawing is done in an idle-timer, so we have to set the context */
207 dsk.setRedrawTask(main);
208 dsk_lcd.setRedrawTask(main);
211 eDebug("Loading spinners...");
215 #define MAX_SPINNER 64
216 ePtr<gPixmap> wait[MAX_SPINNER];
217 for (i=0; i<MAX_SPINNER; ++i)
219 char filename[strlen(DATADIR) + 20];
220 sprintf(filename, DATADIR "/enigma2/wait%d.png", i + 1);
221 if (loadPNG(wait[i], filename))
224 eDebug("failed to load %s! (%m)", filename);
226 eDebug("found %d spinner!\n", i);
231 my_dc->setSpinner(eRect(ePoint(100, 100), wait[0]->size()), wait, i);
234 gRC::getInstance()->setSpinnerDC(my_dc);
236 eRCInput::getInstance()->keyEvent.connect(slot(keyEvent));
238 printf("executing main\n");
242 setIoPrio(IOPRIO_CLASS_BE, 3);
244 python.execute("mytest", "__main__");
246 if (exit_code == 5) /* python crash */
253 gPainter p(my_lcd_dc);
254 p.resetClip(eRect(0, 0, 132, 64));
262 eWidgetDesktop *getDesktop(int which)
264 return which ? lcddsk : wdsk;
267 eApplication *getApplication()
277 void quitMainloop(int exitCode)
279 exit_code = exitCode;