Debian Codegraph @

avogadro/qtplugins/coordinateeditor/coordinateeditordialog.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_COORDINATEEDITORDIALOG_H
7 #define AVOGADRO_QTPLUGINS_COORDINATEEDITORDIALOG_H
8
9 #include <QtWidgets/QDialog>
10
11 namespace Avogadro {
12 namespace QtGui {
13 class Molecule;
14 }
15
16 namespace QtPlugins {
17
18 namespace Ui {
19 class CoordinateEditorDialog;
20 }
21
22 /**
23 * @brief The CoordinateEditorDialog class implements a free-text coordinate
24 * editor.
25 */
26 class CoordinateEditorDialog : public QDialog
27 {
28 Q_OBJECT
29 public:
30 explicit CoordinateEditorDialog(QWidget* parent_ = nullptr);
31 ~CoordinateEditorDialog() override;
32
33 void setMolecule(QtGui::Molecule* mol);
34
35 signals:
36 void validationFinished(bool valid);
37 void pastedMolecule();
38
39 private slots:
40 void moleculeChanged(uint);
41 void presetChanged(int);
42 void specChanged();
43 void specEdited();
44 void updateText();
45
46 void helpClicked();
47
48 void validateInput();
49 void validateInputWorker();
50
51 void cutClicked();
52 void copyClicked();
53 void pasteClicked();
54 void revertClicked();
55 void clearClicked();
56
57 void applyClicked();
58 void applyFinish(bool valid);
59
60 void textModified(bool modified);
61
62 private:
63 void buildPresets();
64
65 // Enable/disable input validation when the text edit is modified.
66 void listenForTextEditChanges(bool enable);
67
68 QString detectInputFormat() const;
69
70 Ui::CoordinateEditorDialog* m_ui;
71 QtGui::Molecule* m_molecule;
72
73 // State storage for validateInput methods. PIMPL'd for organization.
74 class ValidateStorage;
75 ValidateStorage* m_validate;
76
77 QString m_defaultSpec;
78 };
79
80 } // namespace QtPlugins
81 } // namespace Avogadro
82
83 #endif // AVOGADRO_QTPLUGINS_COORDINATEEDITORDIALOG_H