/*
 * See the files COPYING and README for copyright information and how to reach 
 * the author.
 *
 *  $Id: setup.c,v 1.3 2004/12/02 15:02:52 lordjaxom Exp $
 */

#include "setup.h"
#include "common.h"
#include "i18n.h"
#include <vdr/menuitems.h>
#include <vdr/videodir.h>

int DVDSIZE = 4462;

cBurnSetup BurnSetup;

const char *Datadir = NULL;
const char *DVDdev  = NULL;
const char *ISOdir  = NULL;

cBurnSetup::cBurnSetup(void) {
	CreateArchiveMarks = 0;
	DiskType = (int)dtDVD;
	HidePathInfo = 1;
	RenderRecordingIndex = 0;
	UseIso2UTF = 0;
	VerifyAfterBurn = 1;
}

bool cBurnSetup::SetupParse(const char *Name, const char *Value) {
	if (strcmp(Name, "CreateArchiveMarks") == 0) CreateArchiveMarks = atoi(Value);
	else if (strcmp(Name, "DiskType") == 0) DiskType = atoi(Value);
	else if (strcmp(Name, "DVDSize") == 0) DVDSIZE = atoi(Value);
	else if (strcmp(Name, "HidePathInfo") == 0) HidePathInfo = atoi(Value);
	else if (strcmp(Name, "RenderRecordingIndex") == 0) RenderRecordingIndex = atoi(Value);
	else if (strcmp(Name, "UseIso2UTF") == 0) UseIso2UTF = atoi(Value);
	else if (strcmp(Name, "VerifyAfterBurn") == 0) VerifyAfterBurn = atoi(Value);
	else return false;
	return true;
}

cBurnMenuSetupPage::cBurnMenuSetupPage(void) {
	mData = BurnSetup;

	Add(new cMenuEditBoolItem(tr("Convert texts to UTF-8"), &mData.UseIso2UTF));
	Add(new cMenuEditBoolItem(tr("Create archive marks"), &mData.CreateArchiveMarks));
	Add(new cMenuEditIntItem(tr("DVD size"), &DVDSIZE, 0, 10000));
	Add(new cMenuEditBoolItem(tr("Hide path info"), &mData.HidePathInfo));
	Add(new cMenuEditBoolItem(tr("Number recordings in DVD menu"), &mData.RenderRecordingIndex));
	Add(new cMenuEditBoolItem(tr("Verify after burn"), &mData.VerifyAfterBurn));
}

cBurnMenuSetupPage::~cBurnMenuSetupPage() {
}

void cBurnMenuSetupPage::Store(void) {
	SetupStore("CreateArchiveMarks", mData.CreateArchiveMarks);
	SetupStore("DiskType", mData.DiskType);
	SetupStore("DVDSize", DVDSIZE);
	SetupStore("HidePathInfo", mData.HidePathInfo);
	SetupStore("RenderRecordingIndex", mData.RenderRecordingIndex);
	SetupStore("UseIso2UTF", mData.UseIso2UTF);
	SetupStore("VerifyAfterBurn", mData.VerifyAfterBurn);
	BurnSetup = mData;
}
