Hallo,
ich würde gern über ein eigenes Plugin (exisitiert zum Teil bereits) in den Dateimodus wechseln, dort den Benutzer eine Datei auswählen lassen (vorzugsweise mp3, welche dann auch abgespielt werden soll. Optimal wäre, wenn ich als Rückmeldung die INfo bekomme welche Datei gewählt würde und wo. Ich habe nun versucht das Enigma-Demo plugin dahin gehend zu verändern. Ich war aber leider überhaupt nicht erfolgreich und das ganze ist doch sehr frustierend, wenn man nicht weiter kommt. Anbei mal der Code, evtl.kann mir ja jemand weiterhelfen. Danke schonmal.
C
a small enigma plugin sample. just a dialog with a listbox and some dizzy logic behind it */
#include <plugin.h>
#include <stdio.h>
#include <lib/gui/ewindow.h>
#include <lib/gui/ebutton.h>
#include <lib/gui/emessage.h>
#include <lib/gui/listbox.h>
#include "enigma_bouquet.h"
#include <enigma.h>
#include <enigma_main.h>
#include <sselect.h>
#include <lib/dvb/servicestructure.h>
#include <lib/dvb/frontend.h>
#include <lib/gui/actions.h>
#include <lib/system/info.h>
#include <enigma_mainmenu.h>
#include <enigma_setup.h>
#include <enigma_plugins.h>
#include <enigma_info.h>
#include <enigma_vcr.h>
#include <enigma_lcd.h>
#include <timer.h>
#include <lib/gui/eskin.h>
#include <lib/driver/eavswitch.h>
#include <lib/gui/elabel.h>
#include <lib/dvb/epgcache.h>
#include <lib/dvb/decoder.h>
#include <lib/base/i18n.h>
#include <lib/gui/guiactions.h>
#include <lib/system/init_num.h>
#include <lib/system/info.h>
// our plugin entry point, declared to use C calling convention
extern "C" int plugin_exec( PluginParam *par );
// our small demo dialog. based on a eWindow and thus is toplevel and has decoration.
class eDemoDialog: public eWindow
{
// our listbox we like to use.
eListBox<eListBoxEntryMenu> *listbox;
// two buttons, one for abort and another one for accept.
eButton *bt_abort, *bt_ok;
eLabel *lb_selected;
// our callback if the user selects something:
void selectedItem(eListBoxEntryMenu *item);
void selectionChanged(eListBoxEntryMenu *item);
void sel_file();
int counter,entry;
public:
eDemoDialog();
~eDemoDialog();
};
// our entry point.
int plugin_exec( PluginParam *par )
{
// our demo dialog instance.
eDemoDialog 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();
// if the result of the dialog is non-zero, show this warning.
if (result)
{
eMessageBox msg("enigma demo", "User Abort", eMessageBox::iconWarning|eMessageBox::btOK);
msg.show(); msg.exec(); msg.hide();
}
return 0;
}
eDemoDialog::eDemoDialog(): eWindow(1)
{
// move our dialog to 100.100...
cmove(ePoint(100, 100));
// ...and make it fill the screen.
cresize(eSize(520, 376));
// set a title.
setText("enigma demo");
// create our listbox. it's a child of our window, thus we give "this" as parent.
listbox=new eListBox<eListBoxEntryMenu>(this);
// move it into our widget. all positions are relative to the parent widget.
listbox->move(ePoint(10, 10));
// leave some space for the buttons (thus height()-100)
listbox->resize(eSize(clientrect.width()-20, clientrect.height()-60));
listbox->loadDeco();
// create the ok button
bt_ok=new eButton(this);
bt_ok->move(ePoint(clientrect.width()-110, clientrect.height()-40));
bt_ok->resize(eSize(100, 30));
// set the shortcut action. in this case, it's the green button.
bt_ok->setShortcut("green");
bt_ok->setShortcutPixmap("green");
// load some decoration (border)
bt_ok->loadDeco();
// set Text
bt_ok->setText("START");
// "connect" the button. if the user pressed this button (either by selecting it and pressing
// OK or by pressing green) the button should to something:
// in this case, this will connect bt_ok->selected to our "accept dialog".
// accept is just a close(0); - we will return with zero as return code.
CONNECT(bt_ok->selected, eWidget::accept);
lb_selected=new eLabel(this);
lb_selected->move(ePoint(120, clientrect.height()-40));
lb_selected->resize(eSize(clientrect.width()-120-120, 30)); // leave space for both buttons
lb_selected->setText("select a URL");
// create the abort button
bt_abort=new eButton(this);
bt_abort->move(ePoint(10, clientrect.height()-40)); // listbox goes to height()-40
bt_abort->resize(eSize(100, 30));
bt_abort->setShortcut("red");
bt_abort->setShortcutPixmap("red");
bt_abort->loadDeco();
bt_abort->setText("STOP");
// reject is close(1) - we will return with nonzero return code.
CONNECT(bt_abort->selected, eWidget::reject);
CONNECT((new eListBoxEntryMenu(listbox, _("File mode"), eString().sprintf("(%d) %s", ++entry, _("File mode")) ))->selected, eDemoDialog::sel_file);
counter=0;
}
void eDemoDialog::sel_file()
{
eZapMain::getInstance()->getMode(eZapMain::modeFile, 1);
}
eDemoDialog::~eDemoDialog()
{
// we have to do almost nothing here. all widgets are automatically removed
// since they are child of us. the eWidget-destructor will to this for us.
}
void eDemoDialog::selectedItem(eListBoxEntryMenu *item)
{
switch ((int)item->getKey())
{
case 0:
break;
case 1:
break;
}
reject();
}
void eDemoDialog::selectionChanged(eListBoxEntryMenu *item)
{
counter=0;
lb_selected->setText(eString().sprintf("you selected item %d", (int)(item->getKey())));
}
Alles anzeigen