/***************************************************************************
 * options.cpp: implementation of Options class
 *
 * This file is part of KGuitar, a KDE tabulature editor
 *
 * copyright (C) 2002-2003 the KGuitar development team <mrgwen@gmail.com>
 ***************************************************************************/

/***************************************************************************
 * 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.
 *
 * See the file COPYING for more information.
 ***************************************************************************/

#include "options.h"

#include <QFrame>
#include <QVBoxLayout>

#include <KLocale>

#include "optionspage.h"
#include "optionsmusictheory.h"
#include "optionsmelodyeditor.h"
#include "optionsexportmusixtex.h"
#include "optionsmidi.h"
#include "optionstimidity.h"
#include "optionsprinting.h"
#include "optionsexportascii.h"
#include "optionsscore.h"

#include <tse3/MidiScheduler.h>

#include <kconfigskeleton.h>

Options::Options(TSE3::MidiSchedulerFactory& midiFactory, TSE3::MidiScheduler** scheduler, KConfig* config, QWidget* parent)
: KConfigDialog(parent, i18n("Preferences"), new KConfigSkeleton())
{
	setFaceType(KPageDialog::Tree);
	setButtons(KDialog::Help | KDialog::Default | KDialog::Ok | KDialog::Apply | KDialog::Cancel);
	setDefaultButton(KDialog::Ok);
	
	resize(530, 300);
	
	addPage(new OptionsMusicTheory(config, this), i18n("Music Theory"), "lookandfeel");
	addPage(new OptionsMelodyEditor(config, this), i18n("Melody Constructor"), "melodyeditor");
//	addPage(new OptionsPrinting(config), i18n("Printing"), "printmgr");
//	addPage(new OptionsMidi(midiFactory, scheduler, config), i18n("Midi"), "midi");
	addPage(new OptionsTimidity(config, this), i18n("Timidity"), "Timidity");
	addPage(new OptionsScore(config, this), i18n("Score"), "Score");
	addPage(new OptionsExportMusixtex(config, this), i18n("MusiXTeX"), "musixtex");
	addPage(new OptionsExportAscii(config, this), i18n("ASCII"), "ascii");
	
/*	mOptPage.append(addPage(i18n("Music Theory"), 0, SmallIcon("lookandfeel")));
	mOptPage.append(addPage(i18n("Melody Constructor"), 0, SmallIcon("melodyeditor")));
	mOptPage.append(addPage(QStringList::split('/', i18n("Export") + "/" + i18n("MusiXTeX")), 0, SmallIcon("musixtex")));
	mOptPage.append(addPage(i18n("Printing"), 0, SmallIcon("printmgr")));
	mOptPage.append(addPage(QStringList::split('/', i18n("Export") + "/" + i18n("ASCII")), 0, SmallIcon("ascii")));
	mOptPage.append(addPage(i18n("Midi"), 0, SmallIcon("midi")));
	mOptPage.append(addPage(i18n("Timidity"), 0, SmallIcon("Timidity")));
	mOptPage.append(addPage(i18n("Score"), 0, SmallIcon("Score")));
	
	mOptWidget.append(new OptionsMusicTheory(config, mOptPage.at(0)));
	mOptWidget.append(new OptionsMelodyEditor(config, mOptPage.at(1)));
	mOptWidget.append(new OptionsExportMusixtex(config, mOptPage.at(2)));
	mOptWidget.append(new OptionsPrinting(config, mOptPage.at(3)));
	mOptWidget.append(new OptionsExportAscii(config, mOptPage.at(4)));
	mOptWidget.append(new OptionsMidi(midiFactory, scheduler, config, mOptPage.at(5)));
	mOptWidget.append(new OptionsTimidity(config, mOptPage.at(6)));
	mOptWidget.append(new OptionsScore(config, mOptPage.at(7)));
	*/
	
	// Special weird layout stuff to pack everything
	//
/*	for (uint i = 0; i < mOptPage.count(); i++) {
		mLayout.append(new QVBoxLayout(mOptPage.at(i), 0, KDialog::spacingHint()));
		mLayout.at(i)->addWidget(mOptWidget.at(i));
	}
	*/
	connect(this, SIGNAL(defaultClicked()), SLOT(defaultBtnClicked()));
	connect(this, SIGNAL(okClicked()), SLOT(applyBtnClicked()));
	connect(this, SIGNAL(applyClicked()), SLOT(applyBtnClicked()));
}

Options::~Options()
{
}

void Options::applyBtnClicked()
{
//	for (uint i = 0; i < mOptPage.count(); i++)
//		mOptWidget.at(i)->applyBtnClicked();
}

void Options::defaultBtnClicked()
{
//	for (uint i = 0; i < mOptPage.count(); i++)
//		mOptWidget.at(i)->defaultBtnClicked();
}

#include "options.moc"
