Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions avogadro/qtplugins/surfaces/surfaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ namespace {
#include <QtWidgets/QFileDialog>
#include <QtWidgets/QMessageBox>
#include <QtWidgets/QProgressDialog>

#include<QJsonObject>
#include<QJsonDocument>
#include<QObject>
#include <QGuiApplication>
#include <QScreen>

Expand All @@ -76,6 +78,8 @@ class Surfaces::PIMPL
public:
GifWriter* gifWriter = nullptr;
gwavi_t* gwaviWriter = nullptr;
signals:
void sendMessage(const QJsonObject& message);
};

Surfaces::Surfaces(QObject* p) : ExtensionPlugin(p), d(new PIMPL())
Expand Down Expand Up @@ -368,7 +372,10 @@ float inline square(float x)
{
return x * x;
}

void sendMessage(QString& message)
{
qDebug() << "Message received:" << message;
}
void Surfaces::calculateEDT(Type type, float defaultResolution)
{
if (type == Unknown && m_dialog != nullptr)
Expand Down Expand Up @@ -447,7 +454,14 @@ void Surfaces::calculateEDT(Type type, float defaultResolution)
}
}
});

QJsonObject jsonMessage;
jsonMessage["status"] = "finished";
jsonMessage["message"] = "Surface calculation completed successfully.";
QJsonDocument doc(jsonMessage);
QString jsonString = doc.toJson(QJsonDocument::Compact);

// Emitting the signal to notify the plugin that the calculation is finished
emit sendMessage(jsonString);
innerFuture.waitForFinished();
});

Expand Down Expand Up @@ -514,8 +528,7 @@ void Surfaces::performEDTStep()
}
}
});

innerFuture.waitForFinished();

});

m_displayMeshWatcher.setFuture(future);
Expand Down
Loading