/*****************************************************************************
 *
 *  console.h -- Class for console IO.
 *
 *  Copyright (C) 2010 Starbuck <starbuck@labdv.com>
 *  All rights reserved.
 *
 *  This file is part of the JobManager 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 CONSOLE_H
#define CONSOLE_H

#include <QString>
#include <QTextEdit>

class Console 
{
public:
	Console();
	//~Console();

	void clearLog();
	void clearStdErr();
	void clearStdIn();
	void clearStdOut();

	void		log(const QString &);
	void		log(const int verbose, const QString &msg);
	QTextEdit	*logChannel() { return m_log; };  // only for usage of old SmartEncoder

	void		stdErr(const QString &);
	void		stdErr(const int verbose, const QString &msg);
	QTextEdit	*stdErrChannel() { return m_stdErr; };  // only for usage of old SmartEncoder

	void		stdIn(const QString &);
	void		stdIn(const int verbose, const QString &msg);
	QTextEdit	*stdInChannel() { return m_stdIn; };  // only for usage of old SmartEncoder

	void		stdOut(const QString &);
	void		stdOut(const int verbose, const QString &msg);
	QTextEdit	*stdOutChannel() { return m_stdOut; };  // only for usage of old SmartEncoder

	void setVerbose(const int);
	void start(QTextEdit *stdIn, QTextEdit *stdOut, QTextEdit *stdErr, QTextEdit *log);

	int verbosity() { return m_verbose; };  // only for usage of old SmartEncoder

	enum Verbose { Quiet = 1, Default, Verbose };
	// Quiet: application high-level (un-mute-able) errors
	// Default: application (user readable) errors and informational message
	// Verbose: other errors (not user readable), debug stuff and very verbose infos

protected:
	QTextEdit	*m_log;
	
	QTextEdit	*m_stdErr;
	QTextEdit	*m_stdIn;
	QTextEdit	*m_stdOut;
	
	int			m_verbose;
};

#endif
