summaryrefslogtreecommitdiffstats
path: root/src/gui/outputmethoddlg.h
blob: 1bf4879710316278a914b2118a8c772588445f08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/***************************************************************************
 *   Copyright (C) 2003-2004 by David Saxton                               *
 *   david@bluehaze.org                                                    *
 *                                                                         *
 *   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 OUTPUTMETHODDLG_H
#define OUTPUTMETHODDLG_H

#include <kdialogbase.h>
#include <kurl.h>

class TextDocument;
class KTechlab;
class MicroSelectWidget;
class OutputMethodDlg;
class OutputMethodWidget;

class OutputMethodInfo
{
	public:
		class Method
		{
			public:
				enum Type
				{
					Direct,
					SaveAndForget,
					SaveAndLoad
				};
		};
		
		OutputMethodInfo();
		void initialize( OutputMethodDlg * dlg );
		
		Method::Type method() const { return m_method; }
		void setMethod( Method::Type method ) { m_method = method; }
		
		bool addToProject() const { return m_bAddToProject; }
		void setAddToProject( bool add ) { m_bAddToProject = add; }
		
		TQString picID() const { return m_picID; }
		void setPicID( const TQString & id ) { m_picID = id; }
		
		KURL outputFile() const { return m_outputFile; }
		void setOutputFile( const KURL & outputFile ) { m_outputFile = outputFile; }
		
	protected:
		Method::Type m_method;
		bool m_bAddToProject;
		TQString m_picID;
		KURL m_outputFile;
};

/**
@author David Saxton
*/
class OutputMethodDlg : public KDialogBase
{
	Q_OBJECT
  TQ_OBJECT
	public:
		/**
		 * @param Caption The caption of the dialog window
		 * @param inputURL Used for saving/restoring previous options the user has selected for this file; set this to null if temporary file
		 * @param showPICSelect Whether to show the combo boxes for selecting a PIC
		 */
		OutputMethodDlg( const TQString & caption, const KURL & inputURL, bool showPICSelect = false, TQWidget *tqparent = 0, const char *name = 0);
		~OutputMethodDlg();
	
		void setOutputExtension( const TQString & outputExtension );
		void setFilter( const TQString  &filter );
		void setMethod( OutputMethodInfo::Method::Type m );
		void setOutputFile( const KURL & out );
		void setPicID( const TQString & id );

		virtual void reject();
		virtual void accept();
		bool isAccepted() const { return m_bAccepted; }
		
		OutputMethodInfo info() const { return m_outputMethodInfo; }
		
		MicroSelectWidget * microSelect() const;

	protected:
		OutputMethodWidget *m_widget;
		TQString m_outputExtension;
		KURL m_inputURL;
		OutputMethodInfo m_outputMethodInfo;
		bool m_bAccepted;
		
		friend class OutputMethodInfo;
};

#endif