File indexing completed on 2024-04-14 03:40:18

0001 /*
0002     SPDX-FileCopyrightText: 2006 Carsten Niehaus <cniehaus@kde.org>
0003     SPDX-FileCopyrightText: 2007-2008 Marcus D. Hanwell <marcus@cryos.org>
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef MOLECULEVIEW_H
0008 #define MOLECULEVIEW_H
0009 
0010 #include <QDialog>
0011 #include <avogadro/qtgui/molecule.h>
0012 
0013 #include "ui_moleculeviewerwidget.h"
0014 
0015 namespace OpenBabel
0016 {
0017 class OBForceField;
0018 }
0019 namespace Avogadro
0020 {
0021 namespace QtGui
0022 {
0023 class PeriodicTableView;
0024 }
0025 }
0026 class QSettings;
0027 
0028 /**
0029  * @author Carsten Niehaus
0030  */
0031 class MoleculeDialog : public QDialog
0032 {
0033     Q_OBJECT
0034 
0035 public:
0036     explicit MoleculeDialog(QWidget *parent);
0037     ~MoleculeDialog();
0038 
0039     void loadMolecule(const QString &filename);
0040 
0041 private:
0042     QString m_path; /// to store the path were the molecules are located
0043     QList<int> m_elementsIndex; // Index storing the element combo index
0044     Avogadro::QtGui::PeriodicTableView *m_periodicTable;
0045     OpenBabel::OBForceField *m_forceField;
0046     QSettings *m_drawSettings;
0047 
0048     Ui::moleculeViewerForm ui;
0049 
0050 private slots:
0051     /**
0052      * Load a molecule
0053      */
0054     void slotLoadMolecule();
0055 
0056     /**
0057      * Update the currently active scene plugin.
0058      */
0059     void slotUpdateScenePlugin();
0060 
0061     /**
0062      * Get a new molecule using hot new stuff
0063      */
0064     void slotDownloadNewStuff();
0065 
0066     /**
0067      * Save a molecule
0068      */
0069     void slotSaveMolecule();
0070 
0071     /**
0072      * Set view/edit mode
0073      */
0074     void setViewEdit(int mode);
0075 
0076     /**
0077      * Update the statistical information about the current molecule
0078      */
0079     void slotUpdateStatistics();
0080 
0081     /**
0082      * Geometry optimization
0083      */
0084     void slotGeometryOptimize();
0085 
0086     /// Clears the view
0087     void clearAllElementsInEditor();
0088 
0089 private:
0090     // workaround for broken copy-operator of QtGui::Molecule
0091     // would be removed after next Avogadro release greater 0.9
0092     Avogadro::QtGui::Molecule m_molecule;
0093 };
0094 
0095 #endif // MOLECULEVIEW_H