Debian Codegraph @

avogadro/qtplugins/molecularproperties/molecularproperties.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_MOLECULARPROPERTIES_H
7 #define AVOGADRO_QTPLUGINS_MOLECULARPROPERTIES_H
8
9 #include <avogadro/qtgui/extensionplugin.h>
10
11 class QDialog;
12 class QNetworkAccessManager;
13 class QNetworkReply;
14
15 namespace Avogadro {
16
17 namespace Core {
18 class Molecule;
19 }
20
21 namespace QtPlugins {
22
23 class MolecularModel;
24
25 /**
26 * @brief The MolecularProperties class is an extension to launch
27 * a MolecularPropertiesDialog.
28 */
29 class MolecularProperties : public Avogadro::QtGui::ExtensionPlugin
30 {
31 Q_OBJECT
32 public:
33 explicit MolecularProperties(QObject* parent_ = nullptr);
34 ~MolecularProperties() override;
35
36 QString name() const override { return tr("Molecular Properties"); }
37 QString description() const override;
38 QList<QAction*> actions() const override;
39 QStringList menuPath(QAction*) const override;
40
41 public slots:
42 void setMolecule(QtGui::Molecule* mol) override;
43
44 private slots:
45 void showDialog();
46 void updateName(bool checkDialog = true);
47 void updateNameReady(QNetworkReply* reply);
48
49 private:
50 QAction* m_action;
51 QtGui::Molecule* m_molecule;
52 QDialog* m_dialog;
53 QNetworkAccessManager* m_network;
54 QNetworkReply* m_pendingReply = nullptr;
55 bool m_nameRequestPending = false;
56
57 MolecularModel* m_model;
58 };
59
60 } // namespace QtPlugins
61 } // namespace Avogadro
62
63 #endif // AVOGADRO_QTPLUGINS_MOLECULARPROPERTIESEXTENSION_H