Debian Codegraph @

avogadro/qtplugins/spectra/spectradialog.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_SPECTRADIALOG_H
7 #define AVOGADRO_QTPLUGINS_SPECTRADIALOG_H
8
9 #include <QDialog>
10
11 #include <avogadro/core/matrix.h>
12 #include <avogadro/core/molecule.h>
13
14 namespace Ui {
15 class SpectraDialog;
16 }
17
18 namespace Avogadro {
19
20 namespace QtGui {
21 class ChartWidget;
22 }
23
24 namespace QtPlugins {
25
26 enum class SpectraType
27 {
28 Infrared,
29 Raman,
30 NMR,
31 Electronic,
32 CircularDichroism,
33 VibrationalCD,
34 MagneticCD,
35 DensityOfStates
36 };
37
38 class SpectraDialog : public QDialog
39 {
40 Q_OBJECT
41
42 public:
43 explicit SpectraDialog(QWidget* parent = nullptr);
44 ~SpectraDialog() override;
45
46 void writeSettings() const;
47 void readSettings();
48
49 void setSpectra(const std::map<std::string, MatrixX>& spectra);
50 void setElements(const std::vector<unsigned char>& elements)
51 {
52 m_elements = elements;
53 updateElementCombo();
54 }
55
56 QtGui::ChartWidget* chartWidget();
57
58 void disconnectOptions();
59 void connectOptions();
60
61 void changeEvent(QEvent* event) override;
62 void mouseDoubleClickEvent(QMouseEvent* e) override;
63
64 private slots:
65 void changeBackgroundColor();
66 void changeForegroundColor();
67 void changeCalculatedSpectraColor();
68 void changeRawSpectraColor();
69 void changeImportedSpectraColor();
70 void changeFontSize();
71 void changeLineWidth();
72 void changeSpectra();
73
74 void importData();
75 void exportData();
76
77 void updateElementCombo();
78 void updatePlot();
79
80 void toggleOptions();
81
82 private:
83 std::map<std::string, MatrixX> m_spectra;
84 MatrixX m_importedSpectra;
85 std::vector<unsigned char> m_elements; // for NMR
86 // current spectra data
87 std::vector<double> m_transitions;
88 std::vector<double> m_intensities;
89 // imported spectra (if available)
90 std::vector<double> m_importedTransitions;
91 std::vector<double> m_importedIntensities;
92
93 QString m_currentSpectraType;
94 Ui::SpectraDialog* m_ui;
95 };
96
97 } // namespace QtPlugins
98 } // namespace Avogadro
99
100 #endif