Skip to content

Commit

Permalink
Merge pull request cryos#146 from ghutchis/add-workflow-scripts
Browse files Browse the repository at this point in the history
Add workflow scripts and refactor InputGenerator
  • Loading branch information
cryos authored Dec 28, 2016
2 parents 3023af7 + b9b789b commit a9c4411
Show file tree
Hide file tree
Showing 14 changed files with 3,132 additions and 1 deletion.
30 changes: 30 additions & 0 deletions avogadro/molequeue/inputgeneratorwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <QtWidgets/QLineEdit>
#include <QtWidgets/QMessageBox>
#include <QtWidgets/QSpinBox>
#include <QtWidgets/QDoubleSpinBox>
#include <QtWidgets/QTextEdit>

#include <QtCore/QJsonDocument>
Expand Down Expand Up @@ -835,6 +836,8 @@ QWidget *InputGeneratorWidget::createOptionWidget(const QJsonValue &option)
return createFilePathWidget(obj);
else if (type == "integer")
return createIntegerWidget(obj);
else if (type == "float")
return createFloatWidget(obj);
else if (type == "boolean")
return createBooleanWidget(obj);

Expand Down Expand Up @@ -906,6 +909,33 @@ QWidget *InputGeneratorWidget::createIntegerWidget(const QJsonObject &obj)
return spin;
}

QWidget *InputGeneratorWidget::createFloatWidget(const QJsonObject &obj)
{
QDoubleSpinBox *spin = new QDoubleSpinBox(this);
if (obj.contains("minimum") &&
obj.value("minimum").isDouble()) {
spin->setMinimum(obj["minimum"].toDouble());
}
if (obj.contains("maximum") &&
obj.value("maximum").isDouble()) {
spin->setMaximum(obj["maximum"].toDouble());
}
if (obj.contains("precision") &&
obj.value("precision").isDouble()) {
spin->setDecimals(static_cast<int>(obj["precision"].toDouble()));
}
if (obj.contains("prefix") &&
obj.value("prefix").isString()) {
spin->setPrefix(obj["prefix"].toString());
}
if (obj.contains("suffix") &&
obj.value("suffix").isString()) {
spin->setSuffix(obj["suffix"].toString());
}
connect(spin, SIGNAL(valueChanged(double)), SLOT(updatePreviewText()));
return spin;
}

QWidget *InputGeneratorWidget::createBooleanWidget(const QJsonObject &obj)
{
Q_UNUSED(obj);
Expand Down
1 change: 1 addition & 0 deletions avogadro/molequeue/inputgeneratorwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ private slots:
QWidget* createStringWidget(const QJsonObject &obj);
QWidget* createFilePathWidget(const QJsonObject &obj);
QWidget* createIntegerWidget(const QJsonObject &obj);
QWidget* createFloatWidget(const QJsonObject &obj);
QWidget* createBooleanWidget(const QJsonObject &obj);
/**@}*/

Expand Down
4 changes: 4 additions & 0 deletions avogadro/qtgui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ set(HEADERS
fileformatdialog.h
generichighlighter.h
hydrogentools.h
interfacescript.h
interfacewidget.h
meshgenerator.h
molecule.h
moleculemodel.h
Expand Down Expand Up @@ -63,6 +65,8 @@ set(SOURCES
fileformatdialog.cpp
generichighlighter.cpp
hydrogentools.cpp
interfacescript.cpp
interfacewidget.cpp
meshgenerator.cpp
molecule.cpp
moleculemodel.cpp
Expand Down
2 changes: 1 addition & 1 deletion avogadro/qtgui/hydrogentools.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace QtGui {
class RWAtom;
class RWMolecule;

class AVOGADROCORE_EXPORT HydrogenTools
class AVOGADROQTGUI_EXPORT HydrogenTools
{
public:

Expand Down
Loading

0 comments on commit a9c4411

Please sign in to comment.