Debian Codegraph @

avogadro/qtplugins/scriptcharges/scriptcharges.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_SCRIPTCHARGES_H
7 #define AVOGADRO_QTPLUGINS_SCRIPTCHARGES_H
8
9 #include <avogadro/core/avogadrocore.h>
10 #include <avogadro/qtgui/extensionplugin.h>
11
12 #include <QtCore/QMultiHash>
13 #include <QtCore/QVariant>
14
15 namespace Avogadro {
16
17 namespace Calc {
18 class ChargeModel;
19 }
20
21 namespace QtPlugins {
22
23 /**
24 * @brief This extension registers ChargeModel electrostatics
25 * implemented as external scripts.
26 */
27 class ScriptCharges : public QtGui::ExtensionPlugin
28 {
29 Q_OBJECT
30
31 public:
32 explicit ScriptCharges(QObject* parent = nullptr);
33 ~ScriptCharges() override;
34
35 QString name() const override { return tr("Script Charge Models"); }
36
37 QString description() const override
38 {
39 return tr("Load electrostatic models from external scripts.");
40 }
41
42 QList<QAction*> actions() const override;
43
44 QStringList menuPath(QAction*) const override;
45
46 void setMolecule(QtGui::Molecule* mol) override;
47
48 public slots:
49 /**
50 * Handle a feature registered by PackageManager.
51 */
52 void registerFeature(const QString& type, const QString& packageDir,
53 const QString& command, const QString& identifier,
54 const QVariantMap& metadata);
55
56 /**
57 * Handle a feature removed by PackageManager.
58 */
59 void unregisterFeature(const QString& type, const QString& packageDir,
60 const QString& command, const QString& identifier);
61
62 private:
63 QList<Calc::ChargeModel*> m_models;
64 QMultiHash<QString, QString> m_packageModels;
65
66 void refreshModels();
67 void unregisterModels();
68 void registerModels();
69 };
70
71 } // namespace QtPlugins
72 } // namespace Avogadro
73
74 #endif // AVOGADRO_QTPLUGINS_SCRIPTCHARGES_H