/***************************************************************************
 * timidity.h: implementation of Timidity class
 *
 * This file is part of KTabEdit, a KDE tabulature editor
 *
 * copyright (C) 2003-2006 the KTabEdit 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.
 ***************************************************************************/

#ifndef TIMIDITY_H
#define TIMIDITY_H

#include <QWizardPage>
#include <QWidget>
#include <QString>
#include <QStringList>
#include <QCheckBox>
#include <QLabel>
#include <QLineEdit>
#include <QSpinBox>
#include <QComboBox>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QPushButton>

/**
	The Timidity class. This class creates the user interface for the Timidity
	configuration. The user can choose the timidity path, the output sound server,
	enable/disable reverb, delay effects for the performance.
*/
class Timidity: public QWizardPage {
	Q_OBJECT
public:
	/**
		Construct the Timidity interface.
		The constructor creates the user interface, with an edit box for the timidiy path,
		checkboxes for the real time, and some comboboxes (noise, delay, reverb, ...).
		@param parent the parent widget
		@param name the widget name
		@see QWidget constructor
	*/
	Timidity(QWidget* parent);
	
	/**
		Writes the timidity configuration.
		the configuratio is written inside the TIMIDITY group, the timidity
		path, buffer, fragment, output, chorus, reverb, vlpf, resample frequency,
		realtime fields are saved. Inside the group MIDI the field timidity is saved
	*/
	virtual void writeConfig();
	
	/**
		Check if timidity is wanted.
		@return true if timidity is wanted else it returns false
	*/
	virtual bool isTimidityWanted() const;
	
	virtual QString program() const;
	/**
		Build the command line for the timidity process.
		@param process a QProcess clears the last command line and builds the new one
	*/
	virtual QStringList buildCmdLine() const;
private slots:
	void search();
	void launchTimidity();
	
private:
	virtual void fillOptions();
	
	QCheckBox mMidiTimidity;
	
	QLabel mTimidityPathLabel;
	QLineEdit mTimidityPath;
	QPushButton mTimidityButton;
	
	QLabel mBufferLabel;
	QSpinBox mBuffer;
	
	QLabel mFragmentLabel;
	QSpinBox mFragment;
	
	QLabel mOutputLabel;
	QComboBox mOutput;
	
	QLabel mChorusLabel;
	QComboBox mChorus;
	
	QLabel mDelayLabel;
	QComboBox mDelay;
	
	QLabel mReverbLabel;
	QComboBox mReverb;
	
	QLabel mVlpfLabel;
	QComboBox mVlpf;
	
	QLabel mNoiseLabel;
	QComboBox mNoise;
	
	QLabel mResampLabel;
	QComboBox mResamp;
	
	QLabel mFrequencyLabel;
	QSpinBox mFrequency;
	
	QLabel mRealtimeEnableLabel;
	QCheckBox mRealtimeEnable;
	
	QLabel mRealtimeLabel;
	QSpinBox mRealtime;
	
	QVBoxLayout mTimidityLayout;
	QVBoxLayout mBufferLayout;
	QVBoxLayout mFragmentLayout;
	QVBoxLayout mOutputLayout;
	QVBoxLayout mChorusLayout;
	QVBoxLayout mDelayLayout;
	QVBoxLayout mReverbLayout;
	QVBoxLayout mVlpfLayout;
	QVBoxLayout mNoiseLayout;
	QVBoxLayout mResampLayout;
	QVBoxLayout mFrequencyLayout;
	QVBoxLayout mRealtimeEnableLayout;
	QVBoxLayout mRealtimeLayout;
	
	QHBoxLayout mTimidityPathLayout;
};

#endif
