Debian Codegraph @

avogadro/qtplugins/vibrations/vibrations.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_VIBRATIONS_H
7 #define AVOGADRO_QTPLUGINS_VIBRATIONS_H
8
9 #include <avogadro/qtgui/extensionplugin.h>
10
11 class QAction;
12 class QDialog;
13 class QTimer;
14
15 namespace Avogadro {
16
17 namespace QtPlugins {
18
19 class VibrationDialog;
20
21 /**
22 * @brief The Vibration plugin handles vibration animations.
23 */
24
25 class Vibrations : public QtGui::ExtensionPlugin
26 {
27 Q_OBJECT
28
29 public:
30 explicit Vibrations(QObject* parent = nullptr);
31 ~Vibrations() override;
32
33 QString name() const override { return tr("Vibrations"); }
34
35 QString description() const override
36 {
37 return tr("Display vibrational modes.");
38 }
39
40 QList<QAction*> actions() const override;
41
42 QStringList menuPath(QAction*) const override;
43
44 void setMolecule(QtGui::Molecule* mol) override;
45
46 bool handleCommand(const QString& command,
47 const QVariantMap& options) override;
48
49 void registerCommands() override;
50
51 public slots:
52 void setMode(int mode);
53 void setAmplitude(int amplitude);
54 void startVibrationAnimation();
55 void stopVibrationAnimation();
56 void openDialog();
57 void moleculeChanged(unsigned int changes);
58
59 private slots:
60 void advanceFrame();
61
62 private:
63 QList<QAction*> m_actions;
64
65 QtGui::Molecule* m_molecule;
66
67 VibrationDialog* m_dialog;
68
69 QTimer* m_timer;
70
71 int m_currentFrame;
72 int m_totalFrames;
73 int m_mode;
74 int m_amplitude;
75 };
76
77 } // namespace QtPlugins
78 } // namespace Avogadro
79
80 #endif // AVOGADRO_QTPLUGINS_VIBRATIONS_H