X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/87bfe5dfced0fb7a4e9839fdafa898261a39c86c..2f6625c7a2308755191b04facd03a4a5527c064c:/main/enigma.cpp diff --git a/main/enigma.cpp b/main/enigma.cpp index a798b727..9c2a5ed6 100644 --- a/main/enigma.cpp +++ b/main/enigma.cpp @@ -1,8 +1,10 @@ #undef WITH_SDL + #ifdef WITH_SDL #error #define SDLDC #endif + #include #include #include @@ -14,6 +16,8 @@ #include #include +#include + #ifdef WITH_SDL #error #include @@ -69,7 +73,7 @@ void dumpRegion(const gRegion ®ion) } -eWidgetDesktop *wdsk; +eWidgetDesktop *wdsk, *lcddsk; // typedef struct _object PyObject; @@ -132,12 +136,16 @@ public: ~eMain() { + m_dvbdb->save(); m_scan = 0; } }; /************************************************/ +eLabel *lcd_label, *lcd_clock; + +int exit_code; int main(int argc, char **argv) { @@ -145,9 +153,15 @@ int main(int argc, char **argv) atexit(object_dump); #endif + // set pythonpath if unset + setenv("PYTHONPATH", LIBDIR "/enigma2/python", 0); + printf("PYTHONPATH: %s\n", getenv("PYTHONPATH")); + ePython python; eMain main; + + int double_buffer = 0; #if 1 #ifdef SDLDC @@ -156,23 +170,35 @@ int main(int argc, char **argv) #else ePtr my_dc; gFBDC::getInstance(my_dc); + + double_buffer = my_dc->haveDoubleBuffering(); #endif + ePtr my_lcd_dc; + gLCDDC::getInstance(my_lcd_dc); + fontRenderClass::getInstance()->AddFont(FONTDIR "/arial.ttf", "Arial", 100); eWidgetDesktop dsk(eSize(720, 576)); + eWidgetDesktop dsk_lcd(eSize(132, 64)); -// dsk.setCompositionMode(eWidgetDesktop::cmBuffered); +/* if (double_buffer) + { + eDebug(" - double buffering found, enable buffered graphics mode."); + dsk.setCompositionMode(eWidgetDesktop::cmBuffered); + } */ wdsk = &dsk; + lcddsk = &dsk_lcd; dsk.setDC(my_dc); + dsk_lcd.setDC(my_lcd_dc); ePtr m_pm; - loadPNG(m_pm, "data/pal.png"); + loadPNG(m_pm, DATADIR "/enigma2/pal.png"); if (!m_pm) { - eFatal("hi ghost, please copy pal.png into your ./data, thanks!"); + eFatal("pal.png not found!"); } else dsk.setPalette(*m_pm); @@ -181,6 +207,31 @@ 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); + + eWindow *lcd_win = new eWindow(&dsk_lcd); + + lcd_win->setFlag(eWindow::wfNoBorder); + + lcd_win->move(ePoint(0, 0)); + lcd_win->resize(eSize(132, 64)); + + lcd_label = new eLabel(lcd_win); + lcd_label->move(ePoint(0, 10)); + lcd_label->resize(eSize(132, 36)); + ePtr font = new gFont("Arial", 16); + lcd_label->setFont(font); + + lcd_clock = new eLabel(lcd_win); + lcd_clock->move(ePoint(50, 46)); + lcd_clock->resize(eSize(132, 20)); + //ePtr clkfont = new gFont("Arial", 18); + lcd_clock->setFont(font); + + //lcd_label->setText("bla bla bla, this lcd\nSUCKS!"); + //lcd_clock->setText("88:88:88"); + + lcd_win->show(); eRCInput::getInstance()->keyEvent.connect(slot(keyEvent)); @@ -190,7 +241,7 @@ int main(int argc, char **argv) // eApp->exec(); - return 0; + return exit_code; } eWidgetDesktop *getDesktop() @@ -200,10 +251,20 @@ eWidgetDesktop *getDesktop() void runMainloop() { - eApp->exec(); + exit_code = eApp->exec(); +} + +void quitMainloop(int exitCode) +{ + eApp->quit(exitCode); +} + +void setLCD(const char *string) +{ + lcd_label->setText(string); } -void quitMainloop() +void setLCDClock(const char *string) { - eApp->quit(0); + lcd_clock->setText(string); }