Debian Codegraph @

avogadro/molequeue/inputgeneratordialog.h

raw
1 /******************************************************************************
2 This source file is part of the Avogadro project.
3 This source code is released under the 3-Clause BSD License, (see "LICENSE").
4 ******************************************************************************/
5
6 #ifndef AVOGADRO_MOLEQUEUE_INPUTGENERATORDIALOG_H
7 #define AVOGADRO_MOLEQUEUE_INPUTGENERATORDIALOG_H
8
9 #include "avogadromolequeueexport.h"
10 #include "inputgeneratorwidget.h"
11 #include <QtWidgets/QDialog>
12 #include <avogadro/core/avogadrocore.h>
13
14 namespace Avogadro {
15 namespace QtGui {
16 class Molecule;
17 }
18
19 namespace MoleQueue {
20 class BatchJob;
21 namespace Ui {
22 class InputGeneratorDialog;
23 }
24 class InputGeneratorWidget;
25 /**
26 * @class InputGeneratorDialog inputgeneratordialog.h
27 * <avogadro/molequeue/inputgeneratordialog.h>
28 * @brief The InputGeneratorDialog class provides a thin wrapper around
29 * InputGeneratorWidget for standalone use.
30 * @sa InputGenerator InputGeneratorWidget
31 */
32 class AVOGADROMOLEQUEUE_EXPORT InputGeneratorDialog : public QDialog
33 {
34 Q_OBJECT
35
36 public:
37 explicit InputGeneratorDialog(QWidget* parent_ = nullptr);
38 explicit InputGeneratorDialog(const QString& scriptFileName,
39 QWidget* parent_ = nullptr);
40 ~InputGeneratorDialog() override;
41
42 /**
43 * Use the input generator script pointed to by scriptFilePath.
44 * @param scriptFilePath Absolute path to generator script.
45 */
46 void setInputGeneratorScript(const QString& scriptFilePath);
47
48 /**
49 * @return A reference to the internal InputGeneratorWidget.
50 * @{
51 */
52 InputGeneratorWidget& widget();
53 const InputGeneratorWidget& widget() const;
54 /** @} */
55
56 /**
57 * Used to configure batch jobs.
58 *
59 * When performing the same calculation on a number of molecules, this method
60 * will ask the user to configure a calculation using the current molecule and
61 * input generator settings. After the calculation settings are accepted, a
62 * MoleQueueDialog is used to set job options. Both calculation and job
63 * options are stored in the supplied BatchJob object.
64 *
65 * Errors are handled internally. User cancellation is indicated by this
66 * method returning false.
67 *
68 * To submit jobs using the configured options, call BatchJob::submitNextJob
69 * for each molecule.
70 *
71 * Typical usage:
72 ~~~
73 BatchJob *batch = ...;
74 InputGeneratorDialog dlg(scriptFilePath, windowParent);
75 dlg.setMolecule(&refMol); // Representative molecule as placeholder in GUI.
76 dlg.configureBatchJob(*batch);
77 foreach(mol)
78 batch->submitNextJob(mol);
79 ~~~
80 */
81 bool configureBatchJob(BatchJob& batch);
82
83 public slots:
84 /**
85 * Set the molecule used in the simulation.
86 */
87 void setMolecule(QtGui::Molecule* mol);
88
89 private:
90 Ui::InputGeneratorDialog* ui;
91 };
92
93 } // namespace MoleQueue
94 } // namespace Avogadro
95
96 #endif // AVOGADRO_MOLEQUEUE_INPUTGENERATORDIALOG_H