| 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_QUANTUMINPUT_H |
| 7 |
#define AVOGADRO_QTPLUGINS_QUANTUMINPUT_H |
| 8 |
|
| 9 |
#include <avogadro/qtgui/extensionplugin.h> |
| 10 |
|
| 11 |
#include <QtCore/QMap> |
| 12 |
#include <QtCore/QMultiHash> |
| 13 |
#include <QtCore/QVariantMap> |
| 14 |
|
| 15 |
class QAction; |
| 16 |
class QDialog; |
| 17 |
|
| 18 |
namespace Avogadro { |
| 19 |
namespace Io { |
| 20 |
class FileFormat; |
| 21 |
} |
| 22 |
|
| 23 |
namespace MoleQueue { |
| 24 |
class InputGeneratorDialog; |
| 25 |
class JobObject; |
| 26 |
} // namespace MoleQueue |
| 27 |
|
| 28 |
namespace QtPlugins { |
| 29 |
|
| 30 |
/** |
| 31 |
* @brief The QuantumInput class implements the extension interface for |
| 32 |
* simulation input generators. |
| 33 |
* @author Allison Vacanti |
| 34 |
*/ |
| 35 |
class QuantumInput : public QtGui::ExtensionPlugin |
| 36 |
{ |
| 37 |
Q_OBJECT |
| 38 |
|
| 39 |
public: |
| 40 |
explicit QuantumInput(QObject* parent = nullptr); |
| 41 |
~QuantumInput() override; |
| 42 |
|
| 43 |
QString name() const override { return tr("Quantum input"); } |
| 44 |
|
| 45 |
QString description() const override |
| 46 |
{ |
| 47 |
return tr("Generate input for quantum codes."); |
| 48 |
} |
| 49 |
|
| 50 |
QList<QAction*> actions() const override; |
| 51 |
|
| 52 |
QStringList menuPath(QAction*) const override; |
| 53 |
|
| 54 |
void setMolecule(QtGui::Molecule* mol) override; |
| 55 |
|
| 56 |
public slots: |
| 57 |
/** |
| 58 |
* Scan for new scripts in the input generator directories. |
| 59 |
*/ |
| 60 |
void refreshGenerators(); |
| 61 |
|
| 62 |
/** |
| 63 |
* Emitted when the user requests that a job's output be loaded in Avogadro. |
| 64 |
*/ |
| 65 |
void openJobOutput(const MoleQueue::JobObject& job); |
| 66 |
|
| 67 |
bool readMolecule(QtGui::Molecule& mol) override; |
| 68 |
|
| 69 |
/** |
| 70 |
* Handle a feature registered by PackageManager. |
| 71 |
*/ |
| 72 |
void registerFeature(const QString& type, const QString& packageDir, |
| 73 |
const QString& command, const QString& identifier, |
| 74 |
const QVariantMap& metadata); |
| 75 |
|
| 76 |
/** |
| 77 |
* Handle a feature removed by PackageManager. |
| 78 |
*/ |
| 79 |
void unregisterFeature(const QString& type, const QString& packageDir, |
| 80 |
const QString& command, const QString& identifier); |
| 81 |
|
| 82 |
private slots: |
| 83 |
void menuActivated(); |
| 84 |
void moleculeChanged(unsigned int change); |
| 85 |
|
| 86 |
private: |
| 87 |
void updateActionStates(); |
| 88 |
|
| 89 |
QtGui::Molecule* m_molecule; |
| 90 |
// keyed on package feature key |
| 91 |
QMap<QString, MoleQueue::InputGeneratorDialog*> m_dialogs; |
| 92 |
QMultiHash<QString, QAction*> m_packageActions; |
| 93 |
|
| 94 |
const Io::FileFormat* m_outputFormat; |
| 95 |
QString m_outputFileName; |
| 96 |
}; |
| 97 |
} // namespace QtPlugins |
| 98 |
} // namespace Avogadro |
| 99 |
|
| 100 |
#endif // AVOGADRO_QTPLUGINS_QUANTUMINPUT_H |