File: networkdatabases.h

package info (click to toggle)
avogadrolibs 1.101.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 78,480 kB
  • sloc: cpp: 139,780; ansic: 2,212; python: 1,435; perl: 321; sh: 90; makefile: 46
file content (65 lines) | stat: -rw-r--r-- 1,686 bytes parent folder | download
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