/***************************************************************************
 *   Copyright (C) 2006 by Jens Koehler                                    *
 *   irimi_at_gmx_de                                                       *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/

#ifndef MENUAMBROWSER_H
#define MENUAMBROWSER_H
#include <vdr/menu.h>
#include "amarokData.h"

class cAmarokPlayer;

/////////////////////////////////////////////////////////////////////////
////////// cMenuAmBase
/////////////////////////////////////////////////////////////////////////

class cMenuAmBase : public cOsdMenu
{
private:


public:
    cMenuAmBase();
    virtual ~cMenuAmBase();

    virtual eOSState checkSleepKey(eKeys Key);

    bool setCurrentOsdItem(int index);
    void setOsdItemText(const char* text, int index=0);
    void addOsdItem(const char* text, bool bselect=true, int after=-1);
    void clearMenu()
    {
        Clear();
        Display();
    };

    virtual void initialize()=0;

protected:
#ifdef AMAROK_DEBUG

    void debugRemoteKey(eKeys Key);
#endif


    cAmarokPlayer *p_Player;

    bool b_initAction;
private:
};

/////////////////////////////////////////////////////////////////////////
////////// cMenuAmarok
/////////////////////////////////////////////////////////////////////////

class cMenuAmarok : public cMenuAmBase
{
private:
    eOSState Play(void);
    eOSState SetButtons();


public:
    cMenuAmarok();
    virtual ~cMenuAmarok();

    virtual eOSState ProcessKey(eKeys Key);
    virtual void initialize();


protected:



private:
    bool b_EditMode;
};

/////////////////////////////////////////////////////////////////////////
////////// cMenuAmarokTrack
/////////////////////////////////////////////////////////////////////////



class cMenuAmarokTrack : public cMenuAmBase
{
public:

    cMenuAmarokTrack(cAmarokPlayer *player);
    virtual ~cMenuAmarokTrack();
    virtual void initialize();

    void showTrackinfo(TrackItem*);

protected:
    virtual eOSState ProcessKey(eKeys Key);

private:
    eOSState SetButtons();

};

/////////////////////////////////////////////////////////////////////////
////////// cMenuAmarokQuery
/////////////////////////////////////////////////////////////////////////

class cMenuAmarokQuery : public cMenuAmBase
{
public:

    cMenuAmarokQuery(cAmarokPlayer *player);
    virtual ~cMenuAmarokQuery();
    virtual void initialize();

protected:
    virtual eOSState ProcessKey(eKeys Key);
    void displayResult(bool remember=false);

private:
    eOSState SetButtons();
    AmarokQueryResult m_Result;
    void addToPlaylist();
    void addNodeEntry(const char* addStr);
    void addSubEntry(const char* addStr);

    void addNodeEntry(int index);
    void doArtistQuery();
    void doAlbumQuery();
    void doGenreQuery();
    void doTitleQuery();
    void handleNode();
    void showWaitMessage();
};

/////////////////////////////////////////////////////////////////////////
////////// cMenuAmarokLists
/////////////////////////////////////////////////////////////////////////

class cMenuAmarokLists : public cMenuAmBase
{
public:

    cMenuAmarokLists(cAmarokPlayer *player);
    virtual ~cMenuAmarokLists();
    virtual void initialize();

protected:
    virtual eOSState ProcessKey(eKeys Key);

private:
    eOSState SetButtons();
    void loadSelectedList();
};

#endif
