1 /******************************************************************************
2 
3   This source file is part of the Avogadro project.
4 
5   Copyright 2012 Kitware, Inc.
6 
7   This source code is released under the New BSD License, (the "License").
8 
9   Unless required by applicable law or agreed to in writing, software
10   distributed under the License is distributed on an "AS IS" BASIS,
11   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12   See the License for the specific language governing permissions and
13   limitations under the License.
14 
15 ******************************************************************************/
16 
17 #ifndef CP2KINPUTDIALOG_H
18 #define CP2KINPUTDIALOG_H
19 
20 #include <QButtonGroup>
21 #include <QDialog>
22 #include <QModelIndex>
23 
24 #include "ui_cp2kinputdialog.h"
25 
26 #include <QtCore/QSettings>
27 
28 class QJsonObject;
29 
30 namespace Avogadro {
31 namespace MoleQueue {
32 class JobObject;
33 }
34 namespace QtGui {
35 class Molecule;
36 }
37 
38 namespace QtPlugins {
39 // class GamessHighlighter;
40 
41 class Cp2kInputDialog : public QDialog
42 {
43   Q_OBJECT
44 
45 public:
46   explicit Cp2kInputDialog(QWidget* parent_ = 0, Qt::WindowFlags f = 0);
47   ~Cp2kInputDialog();
48 
49   void setMolecule(QtGui::Molecule* mol);
50 
51 signals:
52   /**
53    * Emitted when the user requests that a job's output be loaded in Avogadro.
54    */
55   void openJobOutput(const Avogadro::MoleQueue::JobObject& job);
56 
57 protected:
58   void showEvent(QShowEvent* e);
59 
60 private slots:
61   void updatePreviewText();
62 
63   void defaultsClicked();
64   void resetClicked();
65   void generateClicked();
66   void computeClicked();
67 
68   void updateTitlePlaceholder();
69 
70 private:
71   void connectBasic();
72   void connectPreview();
73   void connectButtons();
74 
75   void buildOptions();
76   void updateOptionCache();
77   void restoreOptionCache();
78 
79   void buildCalculateOptions();
80   void buildFunctionalOptions();
81   void buildMethodOptions();
82   void buildBasisOptions();
83   void buildStateOptions();
84   void buildMultiplicityOptions();
85   void buildChargeOptions();
86 
87   void buildEWALDTypeOptions();
88 
89   void buildSCFGuessOptions();
90   void buildOTMinimizerOptions();
91 
92   void setBasicDefaults();
93 
94   QString generateJobTitle() const;
95 
96   Ui::Cp2kInputDialog ui;
97   QtGui::Molecule* m_molecule;
98   // GamessHighlighter *m_highlighter;
99 
100   bool m_updatePending;
101   QMap<QComboBox*, int> m_optionCache;
102 };
103 
104 } // end namespace QtPlugins
105 } // end namespace Avogadro
106 
107 #endif // CP2KINPUTDIALOG_H
108