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