|
If created a new clas, search window derived
from mythpopupbox
this class has an constuctor wich add's the
buttons to the class and a function wich shows the popup:
but now. when i had shown the popup and close my
window, i could not control mythtv agian.
what di i wrong??
my cpp file of my class:
using namespace std;
#include "searchrom.h"
#include <mythtv/mythdialogs.h>
#include <mythtv/mythwidgets.h>
#include <mythtv/mythcontext.h>
void MythSearchRomDialog::dosearch(void)
{
}
MythSearchRomDialog::MythSearchRomDialog(MythMainWindow *parent, const char *name): MythPopupBox(parent, name)
{
//MythPopupBox *search_rom_popup = new MythPopupBox(gContext->GetMainWindow(), "search_rom_popup");, "search_rom_popup
// create the widgets
addLabel(QString("Search for Rom..."));
editor = new MythRemoteLineEdit(this);
//connect(editor, SIGNAL(textChanged()), this, SLOT(searchTextChanged()));
addWidget(editor);
editor->setFocus();
addButton("OK", this, SLOT(okPressed()));
addButton("Cancel", this, SLOT(cancelPressed()));
}
void MythSearchRomDialog::closeRomPopup(void)
{
if (!search_rom_popup)
return;
search_rom_popup->hide();
delete search_rom_popup;
search_rom_popup = NULL;
}
void MythSearchRomDialog::keyPressEvent(QKeyEvent *e)
{
bool handled = false;
QStringList actions;
if (gContext->GetMainWindow()->TranslateKeyPress("qt", e, actions))
{
for (unsigned int i = 0; i < actions.size() && !handled; i++)
{
QString action = ""
if (action == "ESCAPE")
{
handled = true;
done(-1);
}
if (action == "LEFT")
{
handled = true;
}
if (action == "RIGHT")
{
handled = true;
}
}
}
if (!handled)
MythPopupBox::keyPressEvent(e);
}
void MythSearchRomDialog::okPressed(void)
{
done(0);
}
void MythSearchRomDialog::cancelPressed(void)
{
done(1);
}
MythSearchRomDialog::~MythSearchRomDialog()
{
if (editor)
{
delete editor;
editor = NULL;
}
}
my header file:
my call of my class:
i another cpp file:
void GameTreeItem::searchrom(void)
{
srom = new MythSearchRomDialog(gContext->GetMainWindow(), "search_rom_popup");
srom->ShowPopup(this,SLOT(closeSearchRom()));
if (!info_popup)
return;
info_popup->hide();
delete info_popup;
info_popup = NULL;
}
void GameTreeItem::closeSearchRom(void)
{
if (!srom)
return;
srom->hide();
delete srom;
srom = NULL;
} |
_______________________________________________ mythtv-dev mailing list [email protected] http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev
