1 /*
2 	Actiona
3     Copyright (C) 2005 Jonathan Mercier-Ganady
4 
5 	Actiona is free software: you can redistribute it and/or modify
6 	it under the terms of the GNU General Public License as published by
7 	the Free Software Foundation, either version 3 of the License, or
8 	(at your option) any later version.
9 
10 	Actiona is distributed in the hope that it will be useful,
11 	but WITHOUT ANY WARRANTY; without even the implied warranty of
12 	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 	GNU General Public License for more details.
14 
15 	You should have received a copy of the GNU General Public License
16 	along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18 	Contact : jmgr@jmgr.info
19 */
20 
21 #pragma once
22 
23 #include "actioninstance.h"
24 #include "stringlistpair.h"
25 
26 class QInputDialog;
27 
28 namespace Actions
29 {
30 	class DataInputInstance : public ActionTools::ActionInstance
31 	{
32 		Q_OBJECT
33 
34 	public:
35 		enum DataType
36 		{
37 			TextType,
38 			IntegerType,
39 			DecimalType
40 		};
41         enum EditorType
42         {
43             LineEditorType,
44             MultilineEditorType,
45             PasswordEditorType
46         };
47 
48 		DataInputInstance(const ActionTools::ActionDefinition *definition, QObject *parent = nullptr);
49 
50         static Tools::StringListPair dataTypes;
51         static Tools::StringListPair editorTypes;
52 
53 		void startExecution() override;
54 		void stopExecution() override;
55 
56 	private slots:
57 		void dataEntered(int);
58 		void dataEntered(double);
59 		void dataEntered(const QString &value);
60 		void canceled();
61 
62 	private:
63 		void endExecution();
64 
65 		QInputDialog *mInputDialog;
66 		QString mVariable;
67 		DataType mDataType;
68 
69 		Q_DISABLE_COPY(DataInputInstance)
70 	};
71 }
72 
73