| 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_IMPORTPQR_H |
| 7 |
#define AVOGADRO_QTPLUGINS_IMPORTPQR_H |
| 8 |
|
| 9 |
#include <avogadro/core/avogadrocore.h> |
| 10 |
#include <avogadro/io/fileformatmanager.h> |
| 11 |
#include <avogadro/qtgui/extensionplugin.h> |
| 12 |
|
| 13 |
#include <QtNetwork/QNetworkAccessManager> |
| 14 |
#include <QtNetwork/QNetworkReply> |
| 15 |
|
| 16 |
#include <QtCore/QString> |
| 17 |
|
| 18 |
class QAction; |
| 19 |
class QDialog; |
| 20 |
|
| 21 |
namespace Avogadro { |
| 22 |
|
| 23 |
namespace QtPlugins { |
| 24 |
|
| 25 |
class PQRWidget; |
| 26 |
|
| 27 |
class ImportPQR : public QtGui::ExtensionPlugin |
| 28 |
{ |
| 29 |
Q_OBJECT |
| 30 |
|
| 31 |
public: |
| 32 |
explicit ImportPQR(QObject* parent = nullptr); |
| 33 |
~ImportPQR() override; |
| 34 |
|
| 35 |
QString name() const override { return tr("Import From PQR"); } |
| 36 |
|
| 37 |
QString description() const override |
| 38 |
{ |
| 39 |
return tr("Download a molecule from PQR."); |
| 40 |
} |
| 41 |
|
| 42 |
QList<QAction*> actions() const override; |
| 43 |
|
| 44 |
QStringList menuPath(QAction*) const override; |
| 45 |
|
| 46 |
void setMoleculeData(QByteArray& molData, QString name); |
| 47 |
|
| 48 |
public slots: |
| 49 |
void setMolecule(QtGui::Molecule* mol) override; |
| 50 |
bool readMolecule(QtGui::Molecule& mol) override; |
| 51 |
|
| 52 |
private slots: |
| 53 |
void menuActivated(); |
| 54 |
void checkAccess(QNetworkReply* reply); |
| 55 |
|
| 56 |
private: |
| 57 |
QAction* m_action; |
| 58 |
QtGui::Molecule* m_molecule; |
| 59 |
PQRWidget* m_dialog; |
| 60 |
const Io::FileFormat* m_outputFormat; |
| 61 |
QString m_moleculeName; |
| 62 |
QString m_moleculePath; |
| 63 |
QByteArray m_moleculeData; |
| 64 |
QNetworkAccessManager* m_manager; |
| 65 |
}; |
| 66 |
} // namespace QtPlugins |
| 67 |
} // namespace Avogadro |
| 68 |
|
| 69 |
#endif // AVOGADRO_QTPLUGINS_IMPORTPQR_H |