#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif

#include <stdio.h>
#include <malloc.h>
#include <string.h>

#include <getopt.h>
#include <stdlib.h>
#include <vdr/interface.h>
#include <vdr/plugin.h>
#include <unistd.h>
#include "menu.h"
#include "config.h"
#include "cHauptmenuVdrconvertItem.h"
#include "cUntermenuVdrconvert.h"


// --- cHauptmenu ------------------------------------------------------------
cHauptmenu::cHauptmenu(void) : cOsdMenu(tr("Vdrconvert"), 12, 6)
{
  
  SetHelp();
  
  Add(new cHauptmenuVdrconvertItem("DVD",1));
  //  Add(new cHauptmenuVdrconvertItem("SVCD",2));
  Add(new cHauptmenuVdrconvertItem("MP3",3));
  //  Add(new cHauptmenuVdrconvertItem("DivX ;-)",4));
}

cHauptmenu::~cHauptmenu(){
}

eOSState cHauptmenu::eintragAuswahl() {
  cHauptmenuVdrconvertItem *item = (cHauptmenuVdrconvertItem*)Get(Current());
  if (item) {
    AddSubMenu(new cUntermenu(item->beschreibung,item->projekttyp));
    Skins.Flush();
  }
  
  return osContinue;
}


eOSState cHauptmenu::ProcessKey(eKeys Key){
  
  eOSState state = cOsdMenu::ProcessKey(Key);
  
  if (state == osUnknown) {
    switch (Key) {
    case kOk:
      eintragAuswahl();
      break;
    default:
      break;
    }//switch
  }//if

  return state;
}

void cHauptmenu::SetHelp() {
  cOsdMenu::SetHelp(NULL,NULL,NULL,NULL);
}
