| 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_LINEFORMATINPUT_H |
| 7 |
#define AVOGADRO_QTPLUGINS_LINEFORMATINPUT_H |
| 8 |
|
| 9 |
#include <avogadro/qtgui/extensionplugin.h> |
| 10 |
|
| 11 |
#include <QtCore/QMap> |
| 12 |
|
| 13 |
#include <string> |
| 14 |
|
| 15 |
namespace Avogadro { |
| 16 |
namespace Io { |
| 17 |
class FileFormat; |
| 18 |
} |
| 19 |
namespace QtPlugins { |
| 20 |
|
| 21 |
/** |
| 22 |
* @brief Load single-line molecule descriptors through an input dialog. |
| 23 |
*/ |
| 24 |
class LineFormatInput : public QtGui::ExtensionPlugin |
| 25 |
{ |
| 26 |
Q_OBJECT |
| 27 |
public: |
| 28 |
explicit LineFormatInput(QObject* parent_ = nullptr); |
| 29 |
~LineFormatInput() override; |
| 30 |
|
| 31 |
QString name() const override { return tr("LineFormatInput"); } |
| 32 |
QString description() const override; |
| 33 |
QList<QAction*> actions() const override; |
| 34 |
QStringList menuPath(QAction*) const override; |
| 35 |
|
| 36 |
public slots: |
| 37 |
void setMolecule(QtGui::Molecule*) override; |
| 38 |
|
| 39 |
private slots: |
| 40 |
void showDialog(); |
| 41 |
|
| 42 |
private: |
| 43 |
QList<QAction*> m_actions; |
| 44 |
/// Maps identifier to extension: |
| 45 |
QMap<QString, std::string> m_formats; |
| 46 |
|
| 47 |
QtGui::Molecule* m_molecule; |
| 48 |
Io::FileFormat* m_reader; |
| 49 |
std::string m_descriptor; |
| 50 |
}; |
| 51 |
|
| 52 |
inline QString LineFormatInput::description() const |
| 53 |
{ |
| 54 |
return tr("Load single-line molecule descriptors through an input dialog."); |
| 55 |
} |
| 56 |
|
| 57 |
} // namespace QtPlugins |
| 58 |
} // namespace Avogadro |
| 59 |
|
| 60 |
#endif // AVOGADRO_QTPLUGINS_LINEFORMATINPUT_H |