/*
 * menu_setup.c: A plugin for the Video Disk Recorder
 *
 * See the README file for copyright information and how to reach the author.
 *
 * $Id$
 */

#include "menu_setup.h"
#include "deluxe_config.h"
#include "i18n.h"

char AllowedChars[] = trNOOP("$ abcdefghijklmnopqrstuvwxyz0123456789-.#~\\^$[]|()*+?{}/:%@");

const char *AudioFormats[2];

cMenuDeluxeSetup::cMenuDeluxeSetup(void) 
{
    AudioFormats[0] = tr("MP3");
    AudioFormats[1] = tr("OGG");

    strcpy(format, DeluxeConfig.format.c_str());
    offset = DeluxeConfig.offset;
    hideMainMenuEntry = DeluxeConfig.hideMainMenuEntry;
    avoidRepeats = DeluxeConfig.avoidRepeats;
    audioFormat = DeluxeConfig.audioFormat;
    Add(new cMenuEditBoolItem(tr("Hide main menu entry"), &hideMainMenuEntry, trVDR("no"), trVDR("yes")));
    Add(new cMenuEditStrItem(tr("Format for cut marks"), format, sizeof(format), tr(AllowedChars)));
    Add(new cMenuEditIntItem(tr("Offset for marks [s]"), &offset, -99, 99));
    Add(new cMenuEditBoolItem(tr("Avoid repeats"), &avoidRepeats, trVDR("no"), trVDR("yes")));
    Add(new cMenuEditStraItem(tr("Audio format"), &audioFormat, 2, AudioFormats));
}

void cMenuDeluxeSetup::Store(void) 
{
    DeluxeConfig.format = format;
    DeluxeConfig.offset = offset;
    DeluxeConfig.hideMainMenuEntry = hideMainMenuEntry;
    DeluxeConfig.avoidRepeats = avoidRepeats;
    DeluxeConfig.audioFormat = audioFormat;
    SetupStore("format", DeluxeConfig.format.c_str());
    SetupStore("offset", DeluxeConfig.offset);
    SetupStore("hidemainmenuentry", DeluxeConfig.hideMainMenuEntry);
    SetupStore("avoidrepeats", DeluxeConfig.avoidRepeats);
    SetupStore("audioformat", DeluxeConfig.audioFormat);
}
