Debian Codegraph @

avogadro/qtplugins/forcefield/forcefielddialog.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_QTPLUGINS_FORCEFIELDDIALOG_H
7 #define AVOGADRO_QTPLUGINS_FORCEFIELDDIALOG_H
8
9 #include <QDialog>
10 #include <QVariantMap>
11
12 class QPushButton;
13
14 namespace Avogadro {
15 namespace QtPlugins {
16
17 namespace Ui {
18 class ForceFieldDialog;
19 }
20
21 /**
22 * @brief The ForceFieldDialog class is used to prompt the user for parameters
23 * to be used in a force field optimization.
24 */
25 class ForceFieldDialog : public QDialog
26 {
27 Q_OBJECT
28
29 public:
30 /**
31 * Construct a new dialog using the forcefields in @a forceFields.
32 */
33 explicit ForceFieldDialog(const QStringList& forceFields,
34 QWidget* parent_ = nullptr);
35 ~ForceFieldDialog() override;
36
37 /**
38 * Construct a new dialog using the forcefields in @a forceFields and
39 * initialize the options to those in @a startingOptions (see setOptions).
40 * If the user chooses the recommended force field, @a recommendedForceField_
41 * will be set. This is useful for preferring a specific force field for a
42 * particular molecule.
43 * When the user closes the dialog, the options they selected are returned. If
44 * the user cancels the dialog, an empty list is returned.
45 */
46 static QVariantMap prompt(QWidget* parent_, const QStringList& forceFields,
47 const QVariantMap& startingOptions,
48 const QString& recommendedForceField_ = QString());
49
50 /**
51 * Get/set the options displayed in the dialog.
52 */
53 QVariantMap options() const;
54 void setOptions(const QVariantMap& opts);
55
56 /**
57 * Get/set the recommended forcefield for the current molecule. If an empty
58 * string, the user will not be shown an option to use the recommended
59 * forcefield.
60 * If the string is non-empty (and in the forceFields list passed in the
61 * constructor), the user will have the option of setting the forcefield to
62 * this value.
63 *
64 * @{
65 */
66 QString recommendedForceField() const { return m_recommendedForceField; }
67 void setRecommendedForceField(const QString& rff);
68 /**@}*/
69
70 private slots:
71 void useRecommendedForceFieldToggled(bool state);
72 void modelOptionsClicked();
73
74 private:
75 void updateRecommendedForceField();
76 void updateOptionsButton();
77
78 Ui::ForceFieldDialog* ui;
79 QString m_recommendedForceField;
80 QVariantMap m_modelUserOptionSchemas;
81 QVariantMap m_modelUserOptions;
82 QPushButton* m_optionsButton = nullptr;
83 };
84
85 } // namespace QtPlugins
86 } // namespace Avogadro
87 #endif // AVOGADRO_QTPLUGINS_FORCEFIELDDIALOG_H