- fixed console input mode restore
[enigma2.git] / main / enigma.cpp
index faff4d8..b055619 100644 (file)
 #include <lib/python/python.h>
 #include <lib/python/connections.h>
 
+#include <lib/gui/elistboxcontent.h>
+
+#include <lib/driver/rc.h>
+
 #ifdef OBJECT_DEBUG
 int object_total_remaining;
 
@@ -49,25 +53,68 @@ void dumpRegion(const gRegion &region)
        }
 }
 
+eWidgetDesktop *wdsk;
+
+// typedef struct _object PyObject;
+
+void print(int i)
+{
+       printf("C++ says: it's a %d!!!\n", i);
+}
+
+PSignal1<void,int> keyPressed;
+
+PSignal1<void,int> &keyPressedSignal()
+{
+       return keyPressed;
+}
+
+void keyEvent(const eRCKey &key)
+{
+       if (!key.flags)
+               keyPressed(key.code);
+}
+
+/************************************************/
+#include <unistd.h>
+#include <lib/components/scan.h>
+#include <lib/dvb/idvb.h>
+#include <lib/dvb/dvb.h>
+#include <lib/dvb/db.h>
 
 class eMain: public eApplication, public Object
 {
        eInit init;
+       
+       ePtr<eDVBResourceManager> m_mgr;
+       ePtr<eDVBDB> m_dvbdb;
+
+       ePtr<eComponentScan> 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;
        }
 };
 
-eWidgetDesktop *wdsk;
+/************************************************/
 
-// typedef struct _object PyObject;
-
-void print(int i)
-{
-       printf("C++ says: it's a %d!!!\n", i);
-}
 
 int main(int argc, char **argv)
 {
@@ -76,9 +123,10 @@ int main(int argc, char **argv)
 #endif
 
 
-#if 1
+       ePython python;
        eMain main;
 
+#if 1
        ePtr<gFBDC> my_dc;
        gFBDC::getInstance(my_dc);
 
@@ -105,17 +153,20 @@ int main(int argc, char **argv)
        eWidgetDesktop dsk(eSize(720, 576));
        
        wdsk = &dsk;
+       dsk.setBackgroundColor(gColor(0));
        dsk.setDC(my_dc);
 #endif
 
                /* redrawing is done in an idle-timer, so we have to set the context */
        dsk.setRedrawTask(main);
        
-       ePython python;
+       eRCInput::getInstance()->keyEvent.connect(slot(keyEvent));
        
        printf("executing main\n");
        python.execute("mytest", "__main__");
 
+//     eApp->exec();
+
        return 0;
 }
 
@@ -128,3 +179,8 @@ void runMainloop()
 {
        eApp->exec();
 }
+
+void quitMainloop()
+{
+       eApp->quit(0);
+}