/*****************************************************************************
 *
 *  confaudmp2mencoderdialog.h -- Input the MP2 audio codec parameters.
 *
 *  Copyright (C) 2010 Starbuck <starbuck@labdv.com>
 *  All rights reserved.
 *
 *  This file is part of the Gui4 module of the DVDx 4 application.
 *
 *  GNU Lesser General Public License Usage
 *  This file may be used under the terms of the GNU Lesser General
 *  Public License version 2.1 as published by the Free Software
 *  Foundation and appearing in the file LICENSE.LGPL included in the
 *  packaging of this file.  Please review the following information to
 *  ensure the GNU Lesser General Public License version 2.1 requirements
 *  will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
 *
 *  GNU General Public License Usage
 *  Alternatively, this file may be used under the terms of the GNU
 *  General Public License version 3.0 as published by the Free Software
 *  Foundation and appearing in the file LICENSE.GPL included in the
 *  packaging of this file.  Please review the following information to
 *  ensure the GNU General Public License version 3.0 requirements will be
 *  met: http://www.gnu.org/copyleft/gpl.html.
 *
 *****************************************************************************/

#ifndef CONFAUDMP2MENCODERDIALOG_H
#define CONFAUDMP2MENCODERDIALOG_H

#include "../video/video_struct.h"

#include <QtCore/QLocale>
#include <QtCore/QVariant>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
#include <QtGui/QCheckBox>
#include <QtGui/QComboBox>
#include <QtGui/QDialog>
#include <QtGui/QDialogButtonBox>
#include <QtGui/QGroupBox>
#include <QtGui/QHBoxLayout>
#include <QtGui/QHeaderView>
#include <QtGui/QLabel>
#include <QtGui/QLineEdit>
#include <QtGui/QPushButton>
#include <QtGui/QSlider>
#include <QtGui/QSpacerItem>
#include <QtGui/QVBoxLayout>
#include <QtGui/QWidget>


class ConfAudMp2MEncoderDialog : public QDialog
{
	Q_OBJECT

public:
	ConfAudMp2MEncoderDialog(encoder_audio_settings_t *settings, 
		audio_t *track,
		QWidget *parent = 0);

private slots:
	void accept();
	void selectBitrate(const int);
	void selectVbrMax(const int);
	void vbr_rangeSliderChanged(const int);
	void vbr_rangeLineEditChanged(const QString &);
	void selectBrAllocation(const int);
	void selectSampling(const int);
	void selectStereo(const int);
	void selectPsy(const int);
	void selectPresetDvd();
	void selectPresetSvcd();
	void selectPresetVcd();
	void defaultPushButtonClicked();

private:
	void setToolTip();
	QString simpleToolTip( const QString &text );
	QString labelToolTip( const QString &defaults, const QString &details );
	QString editToolTip( const QString &name, const QString &range = tr("") );
	QString boxToolTip( const QString &name, const QString &defaults, const QString &range, const QString &details );

	void setWhatsThis();

	void populateBitrate();
	void populateVbrMax(const int);
	void populateBrAllocation();
	void populateSampling();
	void populateStereo();
	void populatePsy();

	void updateControls();

	// Tabs
	QTabWidget *tabWidget;
	QDialogButtonBox *buttonBox;
	QVBoxLayout *verticalLayout;
	QWidget *mainTab;

	// Main tab
	QVBoxLayout *mainTabVLayout;
	QGroupBox *bitrateGroupBox;
	QHBoxLayout *bitrateHLayout;
	QLabel *bitrateLabel;
	QComboBox *bitrateComboBox;
	QSpacerItem *bitrateHSpacer;
	QLabel *maxvbrLabel;
	QComboBox *maxvbrComboBox;

	QGroupBox *br_allocGroupBox;
	QVBoxLayout *br_allocVLayout;
	QComboBox *br_allocComboBox;
	QHBoxLayout *vbr_rangeHLayout;
	QLabel *vbr_rangeLabel;
	QSlider *vbr_rangeSlider;
	QLineEdit *vbr_rangeLineEdit;

	QGroupBox *srateGroupBox;
	QHBoxLayout *srateHLayout;
	QComboBox *srateComboBox;
	QSpacerItem *srateHSpacer;

	QGroupBox *modeGroupBox;
	QHBoxLayout *modeHLayout;
	QComboBox *stereoComboBox;
	QComboBox *psyComboBox;

	QGroupBox *presetGroupBox;
	QVBoxLayout *presetVLayout;
	QCheckBox *presetDvdCheckBox;
	QCheckBox *presetSvcdCheckBox;
	QCheckBox *presetVcdCheckBox;

	QHBoxLayout *defaultHLayout;
	QPushButton *defaultPushButton;
	QSpacerItem *defaultHSpacer;

	QSpacerItem *verticalSpacer;

	encoder_audio_settings_t *callerSettings;  // settings to modify
	encoder_audio_settings_t *encSettings;  // local copy
	audio_t *audioSource;  // for recommended stuff (rez, fps)

	QIntValidator *vbr_rangeValidator;
};

#endif
