Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 45644288 authored by Nikita Sirgienko's avatar Nikita Sirgienko

[Julia] Remove friend relatitionship between JuliaSession and JuliaExpression

parent 85f88305
......@@ -70,15 +70,17 @@ QString JuliaExpression::internalCommand()
return cmd;
}
void JuliaExpression::finalize()
void JuliaExpression::finalize(const QString& output, const QString& error, bool wasException)
{
auto juliaSession = static_cast<JuliaSession *>(session());
/*
setErrorMessage(
juliaSession->getError()
error
.replace(QLatin1String("\n"), QLatin1String("<br>"))
);
if (juliaSession->getWasException()) {
setResult(new Cantor::TextResult(juliaSession->getOutput()));
*/
if (wasException) {
setErrorMessage(QString(error).replace(QLatin1String("\n"), QLatin1String("<br>")));
setResult(new Cantor::TextResult(output));
setStatus(Cantor::Expression::Error);
} else {
if (!m_plot_filename.isEmpty()
......@@ -88,7 +90,6 @@ void JuliaExpression::finalize()
new Cantor::ImageResult(QUrl::fromLocalFile(m_plot_filename)));
QDir().remove(m_plot_filename);
} else {
const QString& output = juliaSession->getOutput();
if (!output.isEmpty())
setResult(new Cantor::TextResult(output));
}
......
......@@ -55,7 +55,7 @@ public:
*
* This checks inline plots, exceptions and set appropriate result
*/
void finalize();
void finalize(const QString& output, const QString& error, bool wasException);
private:
/// If not empty, it's a filename of plot image file expression is awaiting
......
......@@ -185,7 +185,7 @@ void JuliaSession::runJuliaCommandAsync(const QString &command)
void JuliaSession::onResultReady()
{
static_cast<JuliaExpression*>(expressionQueue().first())->finalize();
static_cast<JuliaExpression*>(expressionQueue().first())->finalize(getOutput(), getError(), getWasException());
finishFirstExpression(true);
}
......
......@@ -102,7 +102,6 @@ private:
/// Cache to speedup modules whos calls
QMap<QString, QString> m_whos_cache;
friend JuliaExpression;
friend JuliaCompletionObject;
void runFirstExpression() override;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment