Hi Leute,
Reine Enigma plugins kann ich schon starten,
aber kein tuxcom.so, tuxtxt.so, ...
#include <stdio.h>
#include <plugin.h>
#include <dlfcn.h>
#include <lib/gui/ewindow.h>
#include <lib/gui/elabel.h>
#include <lib/gui/ebutton.h>
#include <lib/gui/emessage.h>
#include <src/enigma.h>
#include <src/enigma_main.h>
//plugin funktions
int pl_exec(char *filename);
char * find_file (const char *file);
//find_file checking path to plugins
char * find_file (const char *file)
{
struct stat st;
static char filename[256];
printf ("FINDFILE: file=(%s)\n", file);
sprintf ( filename, "/usr/lib/tuxbox/plugins/%s", file);
if (stat (filename, &st) == 0)
return filename;
sprintf ( filename, "/var/tuxbox/plugins/%s", file);
if (stat (filename, &st) == 0)
return filename;
sprintf ( filename, "/lib/tuxbox/plugins/%s", file);
if (stat (filename, &st) == 0)
return filename;
sprintf ( filename, "/var/bin/%s", file);
if (stat (filename, &st) == 0)
return filename;
sprintf ( filename, "/usr/bin/%s", file);
if (stat (filename, &st) == 0)
return filename;
sprintf ( filename, "/bin/%s", file);
if (stat (filename, &st) == 0)
return filename;
//printf ("NOT FOUND\n");
strcpy (filename, file);
return filename;
}
//controlling handle of plugins
int pl_exec(char *so)
{
int ok = 0;
void *handle;
char filename[256];
char *error;
int (*do_plugin_exec) (PluginParam * par);
strcpy (filename, find_file (so) );
ok = 1;
if (ok == 1)
{
handle = dlopen (filename, RTLD_GLOBAL | RTLD_NOW);
if (!handle)
{
fprintf (stderr, "%s\n", dlerror ());
ok = 0;
}
dlerror (); /* Clear any existing error */
*(void **) (&do_plugin_exec) = dlsym (handle, "plugin_exec");
if ((error = dlerror ()) != NULL)
{
fprintf (stderr, "%s\n", error);
ok = 0;
}
if (ok == 1)
{
(*do_plugin_exec) (NULL);
dlclose (handle);
}
}
return ok;
}
// The Class declaration of our Main Window
class MyMainWindow: public eWindow
{
// the label1 to show the text
eLabel *label1;
// the button
eButton *button_ok;
eString *plug;
void MyMainWindow::exeplug();
public:
// the constructor.
MyMainWindow();
// the destructor.
~MyMainWindow();
};
// The plugin entry point, Here start the code execution
extern "C" int plugin_exec( PluginParam *par )
{
// our demo dialog instance.
MyMainWindow dlg;
// show the dialog...
dlg.show();
// give control to dialog.. (the dialog is modal!)
int result=dlg.exec();
// and after it, hide it again.
dlg.hide();
return result;
}
void MyMainWindow::exeplug()
{ this->hide();
if ( !pl_exec("jukebox.so") )
{
eMessageBox msg (_("Cannot find the 'jukebox.so' plugin"), _("Cannot find plugin"), eMessageBox::btOK | eMessageBox::iconError);
msg.show ();
msg.exec ();
msg.hide ();
}
this->show ();
}
MyMainWindow::MyMainWindow(): eWindow(1)
{
// move our dialog to 100.100...
cmove(ePoint(100, 100));
// ...and give x and y dimensions.
cresize(eSize(520, 376));
// set a title.
setText("openpanel");
// create a label1 to show a text.
label1=new eLabel(this);
// give a position
label1->move(ePoint(50, 50));
// set the label1 dimensions
label1->resize(eSize(300, 100));
// set the label1 text
label1->setText("Press Button to launch jukebox!!");
// create the button
button_ok = new eButton(this);
// set the button text
button_ok->setText("start");
// set position
button_ok->move(ePoint((clientrect.width() - 90)/2, clientrect.height() - 60));
// set size
button_ok->resize(eSize(90, 40));
// set shortcut and pixmap
button_ok->setShortcut("green");
button_ok->setShortcutPixmap("green");
// decore with a frame
button_ok->loadDeco();
// function to call when buton is pressed
CONNECT(button_ok->selected, MyMainWindow::exeplug);
// set focus to the button
setFocus(button_ok);
}
MyMainWindow::~MyMainWindow()
{
}
Alles anzeigen
Vielleicht weiß ja wer was...
Emanuel