Skip to content

Commit

Permalink
Merge pull request cryos#28 from cryos/fix-apbs-progress-dialog
Browse files Browse the repository at this point in the history
Fixed issue where progress dialog showed
  • Loading branch information
cryos committed Aug 14, 2015
2 parents 2d2f8d3 + 9bb2266 commit 808df5b
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions avogadro/qtplugins/apbs/apbs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ using Core::Mesh;

Apbs::Apbs(QObject *parent_)
: QtGui::ExtensionPlugin(parent_),
m_molecule(0)
m_molecule(NULL),
m_progressDialog(NULL),
m_dialog(NULL)
{
QAction *action = new QAction(this);
action->setText(tr("Run APBS"));
Expand All @@ -48,12 +50,6 @@ Apbs::Apbs(QObject *parent_)
action->setText(tr("Open Output File"));
connect(action, SIGNAL(triggered()), this, SLOT(onOpenOutputFile()));
m_actions.append(action);

m_dialog = new ApbsDialog;
m_dialog->hide();

m_progressDialog = new QProgressDialog(qobject_cast<QWidget*>(parent_));
m_progressDialog->hide();
}

Apbs::~Apbs()
Expand Down Expand Up @@ -111,6 +107,9 @@ void Apbs::onMeshGeneratorProgress(int value)

void Apbs::onRunApbs()
{
if (!m_dialog)
m_dialog = new ApbsDialog(qobject_cast<QWidget*>(parent()));

m_dialog->setMolecule(m_molecule);
int code = m_dialog->exec();
m_dialog->hide();
Expand Down Expand Up @@ -161,6 +160,9 @@ bool Apbs::loadOpenDxFile(const QString &fileName, QtGui::Molecule &molecule)
tr("Error reading OpenDX file: No cube found"));
}
else {
if (!m_progressDialog)
m_progressDialog = new QProgressDialog(qobject_cast<QWidget*>(parent()));

// generate positive mesh
m_progressDialog->setLabelText("Generating Positive Potential Mesh");
m_progressDialog->setRange(0, 100);
Expand Down

0 comments on commit 808df5b

Please sign in to comment.