X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/b2fe29b773ada2caf62721d7dfe07d9807876055..5136ec8c8b20d83f744ce76d7fbcc5b885059e80:/main/enigma.cpp?ds=sidebyside diff --git a/main/enigma.cpp b/main/enigma.cpp index cc9781cc..be9d9a53 100644 --- a/main/enigma.cpp +++ b/main/enigma.cpp @@ -1,9 +1,8 @@ -#ifdef WITH_SDL -#define SDLDC -#endif - -#include #include +#include +#include +#include +#include #include #include @@ -20,7 +19,7 @@ #include #endif #include -#include +#include #include #include #include @@ -30,7 +29,7 @@ #include #include -#include "bsod.h" +#include "bsod.h" #ifdef HAVE_GSTREAMER #include @@ -58,8 +57,26 @@ int getPrevAsciiCode() void keyEvent(const eRCKey &key) { + static eRCKey last(0, 0, 0); + static int num_repeat; + ePtr ptr; eActionMap::getInstance(ptr); + + if ((key.code == last.code) && (key.producer == last.producer) && key.flags & eRCKey::flagRepeat) + num_repeat++; + else + { + num_repeat = 0; + last = key; + } + + if (num_repeat == 4) + { + ptr->keyPressed(key.producer->getIdentifier(), key.code, eRCKey::flagLong); + num_repeat++; + } + if (key.flags & eRCKey::flagAscii) { prev_ascii_code = key.code; @@ -81,19 +98,17 @@ void keyEvent(const eRCKey &key) class eMain: public eApplication, public Object { eInit init; - - ePtr m_mgr; + ePtr m_dvbdb; + ePtr m_mgr; ePtr m_locale_time_handler; - ePtr m_scan; ePtr m_epgcache; public: eMain() { init.setRunlevel(eAutoInitNumbers::main); - - /* TODO: put into init */ + /* TODO: put into init */ m_dvbdb = new eDVBDB(); m_mgr = new eDVBResourceManager(); m_locale_time_handler = new eDVBLocalTimeHandler(); @@ -104,7 +119,7 @@ public: ~eMain() { m_dvbdb->saveServicelist(); - m_scan = 0; + m_mgr->releaseCachedChannel(); } }; @@ -132,9 +147,9 @@ int main(int argc, char **argv) ePython python; eMain main; - + #if 1 -#ifdef SDLDC +#ifdef WITH_SDL ePtr my_dc; gSDLDC::getInstance(my_dc); #else @@ -155,7 +170,6 @@ int main(int argc, char **argv) eTextPara::forceReplacementGlyph(0xfdf2); for (int i = 0xfe80; i < 0xff00; ++i) eTextPara::forceReplacementGlyph(i); - eWidgetDesktop dsk(eSize(720, 576)); eWidgetDesktop dsk_lcd(eSize(132, 64)); @@ -176,7 +190,7 @@ int main(int argc, char **argv) dsk_lcd.setDC(my_lcd_dc); ePtr m_pm; - loadPNG(m_pm, DATADIR "/enigma2/pal.png"); + loadPNG(m_pm, DATADIR "/enigma2/skin_default/pal.png"); if (!m_pm) { eFatal("pal.png not found!"); @@ -189,6 +203,36 @@ int main(int argc, char **argv) /* redrawing is done in an idle-timer, so we have to set the context */ dsk.setRedrawTask(main); dsk_lcd.setRedrawTask(main); + + + eDebug("Loading spinners..."); + + { + int i; +#define MAX_SPINNER 64 + ePtr wait[MAX_SPINNER]; + for (i=0; isetSpinner(eRect(ePoint(100, 100), wait[0]->size()), wait, i); + else + my_dc->setSpinner(eRect(100, 100, 0, 0), wait, 1); + } + + gRC::getInstance()->setSpinnerDC(my_dc); eRCInput::getInstance()->keyEvent.connect(slot(keyEvent)); @@ -198,10 +242,17 @@ int main(int argc, char **argv) setIoPrio(IOPRIO_CLASS_BE, 3); - python.execute("mytest", "__main__"); - +// python.execute("mytest", "__main__"); + python.execFile("/usr/lib/enigma2/python/mytest.py"); + + extern void setFullsize(); // definend in lib/gui/evideo.cpp + setFullsize(); + if (exit_code == 5) /* python crash */ - bsodFatal(); + { + eDebug("(exit code 5)"); + bsodFatal(0); + } dsk.paint(); dsk_lcd.paint(); @@ -210,7 +261,6 @@ int main(int argc, char **argv) gPainter p(my_lcd_dc); p.resetClip(eRect(0, 0, 132, 64)); p.clear(); - p.flush(); } return exit_code; @@ -233,6 +283,44 @@ void runMainloop() void quitMainloop(int exitCode) { + FILE *f = fopen("/proc/stb/fp/was_timer_wakeup", "w"); + if (f) + { + fprintf(f, "%d", 0); + fclose(f); + } + else + { + int fd = open("/dev/dbox/fp0", O_WRONLY); + if (fd >= 0) + { + if (ioctl(fd, 10 /*FP_CLEAR_WAKEUP_TIMER*/) < 0) + eDebug("FP_CLEAR_WAKEUP_TIMER failed (%m)"); + close(fd); + } + else + eDebug("open /dev/dbox/fp0 for wakeup timer clear failed!(%m)"); + } exit_code = exitCode; eApp->quit(0); } + +#include "version.h" + +const char *getEnigmaVersionString() +{ + return +#ifdef ENIGMA2_CHECKOUT_TAG + ENIGMA2_CHECKOUT_TAG +#else + "HEAD" +#endif + "-" __DATE__; +} +#include + +void dump_malloc_stats(void) +{ + struct mallinfo mi = mallinfo(); + eDebug("MALLOC: %d total", mi.uordblks); +}