Debian Codegraph @

avogadro/qtplugins/insertfragment/insertfragment.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_INSERTFRAGMENT_H
7 #define AVOGADRO_QTPLUGINS_INSERTFRAGMENT_H
8
9 #include <avogadro/qtgui/extensionplugin.h>
10
11 #include <QtCore/QMap>
12
13 #include <string>
14
15 namespace Avogadro {
16 namespace Io {
17 class FileFormat;
18 }
19 namespace QtGui {
20 class InsertFragmentDialog;
21 }
22
23 namespace QtPlugins {
24
25 /**
26 * @brief Load molecules through a tree browser.
27 */
28 class InsertFragment : public QtGui::ExtensionPlugin
29 {
30 Q_OBJECT
31 public:
32 explicit InsertFragment(QObject* parent_ = nullptr);
33 ~InsertFragment() override;
34
35 QString name() const override { return tr("InsertFragment"); }
36 QString description() const override;
37 QList<QAction*> actions() const override;
38 QStringList menuPath(QAction*) const override;
39
40 public slots:
41 void setMolecule(QtGui::Molecule*) override;
42
43 private slots:
44 void showDialog();
45 void performInsert(const QString& fileName, bool crystal);
46
47 private:
48 QList<QAction*> m_actions;
49 QtGui::InsertFragmentDialog* m_moleculeDialog;
50 QtGui::InsertFragmentDialog* m_crystalDialog;
51 /// Maps identifier to extension:
52 QMap<QString, std::string> m_formats;
53
54 QtGui::Molecule* m_molecule;
55 Io::FileFormat* m_reader;
56 };
57
58 inline QString InsertFragment::description() const
59 {
60 return tr("Insert molecular fragments for building larger molecules.");
61 }
62
63 } // namespace QtPlugins
64 } // namespace Avogadro
65
66 #endif // AVOGADRO_QTPLUGINS_INSERTFRAGMENT_H