/***************************************************************************
         dcusercommandedit.h  -  Valknut User Command Editor Dialog
                             -------------------
    begin                : Sun May 25 2008
    copyright            : (C) 2008 by Edward Sheldrake
    email                : ejs1920@yahoo.co.uk
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef DCUSERCOMMANDEDITOR_H
#define DCUSERCOMMANDEDITOR_H

#include <QDialog>

#include "ui/DCDialogUserCommandEditor.h"

class DC_UserMenuCommand;

/**
 * @author Edward Sheldrake
 */
class DCUserCommandEditor: public QDialog, private Ui::DCDialogUserCommandEditor {
Q_OBJECT

public:
	/** Constructor */
	DCUserCommandEditor( QWidget * parent );
	/** Destructor */
	virtual ~DCUserCommandEditor();
	
	/** Initialises the values in the dialog to the given usercommand */
	void SetValues( DC_UserMenuCommand * usercommand );
	/**
	 * Gets the usercommand object representing the input.
	 * DCOptions is responsbile for deleting it.
	 */
	DC_UserMenuCommand * GetObject();

private:
	/** Get command prefix e.g. "<%[myNI]> " */
	QString getCurrentPrefix();
	/** Get command suffix e.g. "|" */
	QString getCurrentSuffix();
	/** Stores things from original command e.g. menu position */
	DC_UserMenuCommand * command;

private slots:
	/** the type of the command was changed, enable/disable items */
	void slotTypeChanged( bool checked );
	/** the command text changed, update preview */
	void slotCommandChanged( const QString & text );
};

#endif // DCUSERCOMMANDEDITOR_H
