1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
/******************************************************************************
This source file is part of the Avogadro project.
This source code is released under the 3-Clause BSD License, (see "LICENSE").
******************************************************************************/
#ifndef AVOGADRO_QTPLUGINS_NETWORKDATABASES_H
#define AVOGADRO_QTPLUGINS_NETWORKDATABASES_H
#include <avogadro/qtgui/extensionplugin.h>
#include <avogadro/core/avogadrocore.h>
#include <QtCore/QString>
class QNetworkAccessManager;
class QNetworkReply;
class QProgressDialog;
namespace Avogadro {
namespace QtPlugins {
/**
* @brief Queries online databases (currently the NIH structure resolver) and
* loads the returned structure if one is found.
*/
class NetworkDatabases : public QtGui::ExtensionPlugin
{
Q_OBJECT
public:
explicit NetworkDatabases(QObject* parent = nullptr);
~NetworkDatabases() override;
QString name() const override { return tr("Network Databases"); }
QString description() const override
{
return tr("Interact with online databases, query structures etc.");
}
QList<QAction*> actions() const override;
QStringList menuPath(QAction*) const override;
public slots:
void setMolecule(QtGui::Molecule* mol) override;
bool readMolecule(QtGui::Molecule& mol) override;
private slots:
void showDialog();
void replyFinished(QNetworkReply*);
private:
QAction* m_action;
QtGui::Molecule* m_molecule;
QNetworkAccessManager* m_network;
QString m_moleculeName;
QByteArray m_moleculeData;
QProgressDialog* m_progressDialog;
};
} // namespace QtPlugins
} // namespace Avogadro
#endif // AVOGADRO_QTPLUGINS_NETWORKDATABASES_H
|