
/*
 * See the files COPYING and README for copyright information and how to reach 
 * the author.
 *
 *  $Id: menuburn.h,v 1.2 2004/12/05 18:50:34 lordjaxom Exp $
 */

#ifndef VDR_BURN_MENUBURN_H
#define VDR_BURN_MENUBURN_H

#include "jobs.h"
#include "vdr_compat.h"
#include "menuitems.h"
#include <vdr/recording.h>

#define kKeepAlive ((eKeys)(kSetup+4711))

class cBurnMenuBurn:
    public cOsdMenu
{
  private:
    static cRecordings VDRRecordings;
    static cBurnJobQueue ActiveJobs;
    static cBurnJobQueue ErrorJobs;
    static cBurnJobQueue FinishedJobs;
    static cBurnJob *Pending;

    static bool mConfirmResult;
    static bool mOpen;
    static char *mPrompt;
    static cCondVar mWait;
    static cMutex mMutex;
    static cMutex mProtect;

    eBurnState mBurnState;
    eDiskType mDiskType;

  protected:
    void Set();
    void DisplayRecordings();
    void DisplayStatus();
    void SetHelpKeys();
    void ToggleDisplay();

    void EnqueuePending();
    void RemoveCurrent();
    void RepeatCurrent();
    void SetCurrentPending();

    bool IsQueued(cBurnJob *Job);
    bool IsQueued(cBurnJob *Job, cBurnJobQueue *Queue);
    cBurnJob* DeleteFromQueue(cBurnJob *Job, cBurnJobQueue *Queue);

  public:
    static void NextJob();
    static bool Confirm(const char *Prompt);
    static bool JobActive() { return ActiveJobs.Count() > 0; }
    static void Cleanup();
    static void Housekeeping();

    cBurnMenuBurn(void);
    virtual ~cBurnMenuBurn();

    virtual eOSState ProcessKey(eKeys Key);
};

#endif // VDR_BURN_MENUBURN_H
