| 1 |
#ifndef AVOGADRO_PQRWIDGET_H |
| 2 |
#define AVOGADRO_PQRWIDGET_H |
| 3 |
|
| 4 |
#include <QtWidgets/QDialog> |
| 5 |
#include <QtWidgets/QGraphicsRectItem> |
| 6 |
#include <QtWidgets/QLineEdit> |
| 7 |
#include <QtWidgets/QPushButton> |
| 8 |
#include <QtWidgets/QTableWidget> |
| 9 |
#include <QtWidgets/QTableWidgetItem> |
| 10 |
|
| 11 |
#include <QtGui/QPixmap> |
| 12 |
|
| 13 |
#include <QtNetwork/QNetworkReply> |
| 14 |
|
| 15 |
#include <QtCore/QDir> |
| 16 |
#include <QtCore/QFile> |
| 17 |
#include <QtCore/QSortFilterProxyModel> |
| 18 |
|
| 19 |
/** |
| 20 |
* PQRWidget is a class extending QDialog to provide the ui for |
| 21 |
* importing/downloading |
| 22 |
* molecules from PQR. |
| 23 |
*/ |
| 24 |
|
| 25 |
namespace Ui { |
| 26 |
class PQRWidget; |
| 27 |
} |
| 28 |
|
| 29 |
namespace Avogadro { |
| 30 |
|
| 31 |
namespace QtGui { |
| 32 |
class Molecule; |
| 33 |
} |
| 34 |
|
| 35 |
namespace QtPlugins { |
| 36 |
class PQRRequest; |
| 37 |
class ImportPQR; |
| 38 |
|
| 39 |
class PQRWidget : public QDialog |
| 40 |
{ |
| 41 |
Q_OBJECT |
| 42 |
|
| 43 |
public: |
| 44 |
PQRWidget(QWidget* parent = nullptr, ImportPQR* p = nullptr); |
| 45 |
~PQRWidget() override; |
| 46 |
void loadMolecule(QByteArray&, QString); |
| 47 |
void loadPNG(QByteArray&); |
| 48 |
|
| 49 |
private slots: |
| 50 |
|
| 51 |
/** |
| 52 |
* @brief Called when the search button is clicked to send a query to PQR |
| 53 |
*/ |
| 54 |
void searchAction(); |
| 55 |
|
| 56 |
/** |
| 57 |
* @brief Called when a table result is double clicked to display preview |
| 58 |
* information |
| 59 |
* about the result before downloading. |
| 60 |
* @param row The row of the result selected. |
| 61 |
* @param col The column of the result selected. |
| 62 |
*/ |
| 63 |
void molSelected(int, int); |
| 64 |
|
| 65 |
/** |
| 66 |
* @brief Called when the download button is clicked to send a request to |
| 67 |
* download |
| 68 |
* molecule information from PQR. |
| 69 |
*/ |
| 70 |
void downloadMol(); |
| 71 |
|
| 72 |
private: |
| 73 |
/** The mol2 of the molecule result currently selected */ |
| 74 |
QString currentlySelectedMol; |
| 75 |
/** Pointer to the ui objects */ |
| 76 |
Ui::PQRWidget* ui; |
| 77 |
/** Pointer to a PQRRequest object to handle network requests */ |
| 78 |
PQRRequest* request; |
| 79 |
/** Pointer to the plugin that opened the dialog */ |
| 80 |
ImportPQR* plugin; |
| 81 |
}; |
| 82 |
} // namespace QtPlugins |
| 83 |
} // namespace Avogadro |
| 84 |
#endif // AVOGADRO_PQRWIDGET_H |