no one help???
----- Original Message -----
Sent: Friday, August 26, 2005 6:02 PM
Subject: [mythtv] Own Class Searchwindows (Base Class: mythpopupbox)

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:
 
#ifndef GAMESEARCH_H_
#define GAMESEARCH_H_

#include <mythtv/mythdialogs.h>
#include <mythtv/mythdialogs.h>
#include <mythtv/mythwidgets.h>


class MythSearchRomDialog  : public MythPopupBox
{
  Q_OBJECT
  
  public:

    MythSearchRomDialog(MythMainWindow *parent, const char *name = 0);
    ~MythSearchRomDialog();

  public: 
    void dosearch(void);
    void setSearchText(QString text);
    void setItems(QStringList items); 
    QString getResult(void);*/
    
 protected slots:
    void okPressed(void);
    void cancelPressed(void);   
    void closeRomPopup(void);   
 protected:
    void keyPressEvent(QKeyEvent *e);

  private:
  
    QLabel              *caption;
    MythRemoteLineEdit  *editor;
    QButton             *ok_button;
    QButton             *cancel_button;
    MythPopupBox        *search_rom_popup;
};

#endif
 
 
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
_______________________________________________
mythtv-dev mailing list
[email protected]
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev
  • Re: [mythtv] Own Class Searchwindows (Base Class: myth... Jochen Kühner

Reply via email to