X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=blobdiff_plain;f=main%2Fenigma.cpp;h=4f3287f57a0eeea26e1a955eed0d873262ad4399;hp=df28bcd75c4c01bf1ef7c64884ae757018d517bf;hb=4c1d83d373b4a0737da668945d1ddb3278b6c3b7;hpb=84670d3dc9c9dc29fd3af42b2f25092b3b6c2a09 diff --git a/main/enigma.cpp b/main/enigma.cpp index df28bcd..4f3287f 100644 --- a/main/enigma.cpp +++ b/main/enigma.cpp @@ -9,6 +9,9 @@ #include #include +#ifdef SDLDC +#include +#endif #include #include @@ -21,8 +24,14 @@ #include #include +#include + #include +#include + +#include + #ifdef OBJECT_DEBUG int object_total_remaining; @@ -51,17 +60,6 @@ void dumpRegion(const gRegion ®ion) } } - -class eMain: public eApplication, public Object -{ - eInit init; -public: - eMain() - { - init.setRunlevel(eAutoInitNumbers::main); - } -}; - eWidgetDesktop *wdsk; // typedef struct _object PyObject; @@ -80,10 +78,54 @@ PSignal1 &keyPressedSignal() void keyEvent(const eRCKey &key) { - if (!key.flags) - keyPressed(key.code); + ePtr ptr; + eActionMap::getInstance(ptr); + ptr->keyPressed(0, key.code, key.flags); +// if (!key.flags) +// keyPressed(key.code); } +/************************************************/ +#include +#include +#include +#include +#include + +class eMain: public eApplication, public Object +{ + eInit init; + + ePtr m_mgr; + ePtr m_dvbdb; + + ePtr m_scan; + +public: + eMain() + { + init.setRunlevel(eAutoInitNumbers::main); + + /* TODO: put into init */ + m_dvbdb = new eDVBDB(); + m_mgr = new eDVBResourceManager(); + + m_mgr->setChannelList(m_dvbdb); + +// m_scan = new eComponentScan(); +// m_scan->start(); + + } + + ~eMain() + { + m_scan = 0; + } +}; + +/************************************************/ + + int main(int argc, char **argv) { #ifdef OBJECT_DEBUG @@ -91,37 +133,36 @@ int main(int argc, char **argv) #endif -#if 1 + ePython python; eMain main; +#if 1 +#ifdef SDLDC + ePtr my_dc; + gSDLDC::getInstance(my_dc); +#else ePtr my_dc; gFBDC::getInstance(my_dc); +#endif - gPainter p(my_dc); - - gRGB pal[256]; - pal[0] = 0; - pal[1] = 0xff00ff; - pal[2] = 0xffFFff; - pal[3] = 0x00ff00; - - for (int a=0; a<0x10; ++a) - pal[a | 0x10] = 0x111111 * a; - for (int a=0; a<0x10; ++a) - pal[a | 0x20] = (0x111100 * a) | 0xFF; - for (int a=0; a<0x10; ++a) - pal[a | 0x30] = (0x110011 * a) | 0xFF00; - for (int a=0; a<0x10; ++a) - pal[a | 0x40] = (0x001111 * a) | 0xFF0000; - p.setPalette(pal, 0, 256); - - fontRenderClass::getInstance()->AddFont("/dbox2/cdkroot/share/fonts/arial.ttf", "Arial", 100); + fontRenderClass::getInstance()->AddFont("/usr/share/fonts/arial.ttf", "Arial", 100); eWidgetDesktop dsk(eSize(720, 576)); wdsk = &dsk; - dsk.setBackgroundColor(gColor(0)); + + dsk.setDC(my_dc); + + ePtr m_pm; + loadPNG(m_pm, "data/pal.png"); + if (!m_pm) + { + eFatal("hi ghost, please copy pal.png into your ./data, thanks!"); + } else + dsk.setPalette(*m_pm); + + dsk.setBackgroundColor(gRGB(0,0,0,0)); #endif /* redrawing is done in an idle-timer, so we have to set the context */ @@ -129,11 +170,12 @@ int main(int argc, char **argv) eRCInput::getInstance()->keyEvent.connect(slot(keyEvent)); - ePython python; - printf("executing main\n"); + python.execute("mytest", "__main__"); +// eApp->exec(); + return 0; } @@ -146,3 +188,8 @@ void runMainloop() { eApp->exec(); } + +void quitMainloop() +{ + eApp->quit(0); +}