1 /**
2  * UGENE - Integrated Bioinformatics Tools.
3  * Copyright (C) 2008-2021 UniPro <ugene@unipro.ru>
4  * http://ugene.net
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19  * MA 02110-1301, USA.
20  */
21 
22 #ifndef _U2_CREATE_SCRIPT_WORKER_DIALOG_H_
23 #define _U2_CREATE_SCRIPT_WORKER_DIALOG_H_
24 
25 #include <QDomDocument>
26 
27 #include <U2Core/AppContext.h>
28 #include <U2Core/IOAdapter.h>
29 #include <U2Core/Settings.h>
30 
31 #include <U2Designer/DelegateEditors.h>
32 
33 #include <U2Lang/ActorModel.h>
34 #include <U2Lang/BaseTypes.h>
35 #include <U2Lang/WorkflowEnv.h>
36 
37 #include "ui_CreateScriptBlockDialog.h"
38 
39 namespace U2 {
40 using namespace Workflow;
41 
42 class CreateScriptElementDialog : public QDialog, public Ui_CreateScriptBlockDialog {
43     Q_OBJECT
44 public:
45     // CreateScriptElementDialog(QWidget* p = NULL);
46     CreateScriptElementDialog(QWidget *p = nullptr, ActorPrototype *proto = nullptr);
47     QList<DataTypePtr> getInput() const;
48     QList<DataTypePtr> getOutput() const;
49     QList<Attribute *> getAttributes() const;
50     const QString getName() const;
51     const QString getDescription() const;
52     const QString getActorFilePath() const;
53 
54 private slots:
55     void sl_addInputClicked();
56     void sl_addOutputClicked();
57     void sl_okClicked();
58     void sl_cancelClicked();
59     void sl_addAttribute();
60     void sl_deleteInputClicked();
61     void sl_deleteOutputClicked();
62     void sl_deleteAttributeClicked();
63     void sl_getDirectory();
64 
65 private:
66     QDomDocument saveXml();
67     bool saveParams();
68     void fillFields(ActorPrototype *proto);
69     void changeDirectoryForActors();
70 
71     QList<DataTypePtr> input;
72     QList<DataTypePtr> output;
73     QList<Attribute *> attrs;
74     QString name;
75     QString description;
76     bool editing;
77     QString actorFilePath;
78 };
79 
80 }  // namespace U2
81 
82 #endif
83