aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Semke <[email protected]>2018-01-14 17:13:49 +0100
committerAlexander Semke <[email protected]>2018-01-14 17:13:49 +0100
commit110db28599f4b00e2230b240d87a59c21ba58b55 (patch)
tree29bc4c1ac3b950da7649dbc394472ed34212c9ce
parentef0b008189bef14ca74ce4c79b00d692460ba6bf (diff)
Added couple of missing default member initializations and some more usage of the constructor member initializer lists.
-rw-r--r--src/backends/maxima/maximaexpression.cpp14
-rw-r--r--src/backends/maxima/maximaexpression.h21
-rw-r--r--src/backends/octave/octaveexpression.cpp16
-rw-r--r--src/backends/octave/octaveexpression.h38
-rw-r--r--src/backends/sage/sageexpression.cpp10
-rw-r--r--src/backends/sage/sageexpression.h13
-rw-r--r--src/cantor_part.cpp13
-rw-r--r--src/cantor_part.h3
-rw-r--r--src/lib/expression.cpp7
-rw-r--r--src/lib/session.cpp8
10 files changed, 57 insertions, 86 deletions
diff --git a/src/backends/maxima/maximaexpression.cpp b/src/backends/maxima/maximaexpression.cpp
index d7a2e0b..4695515 100644
--- a/src/backends/maxima/maximaexpression.cpp
+++ b/src/backends/maxima/maximaexpression.cpp
@@ -40,18 +40,14 @@
#include <QChar>
#include <QUrl>
-MaximaExpression::MaximaExpression( Cantor::Session* session ) : Cantor::Expression(session)
+MaximaExpression::MaximaExpression( Cantor::Session* session ) : Cantor::Expression(session),
+ m_tempFile(nullptr),
+ m_isHelpRequest(false),
+ m_isPlot(false),
+ m_gotErrorContent(false)
{
- qDebug();
- m_tempFile=nullptr;
-}
-
-MaximaExpression::~MaximaExpression()
-{
-
}
-
void MaximaExpression::evaluate()
{
setStatus(Cantor::Expression::Computing);
diff --git a/src/backends/maxima/maximaexpression.h b/src/backends/maxima/maximaexpression.h
index 48935bc..b2a29c8 100644
--- a/src/backends/maxima/maximaexpression.h
+++ b/src/backends/maxima/maximaexpression.h
@@ -24,22 +24,20 @@
#include "expression.h"
#include "KDirWatch"
#include <QStringList>
-#include <QXmlStreamReader>
-class QTimer;
class QTemporaryFile;
class MaximaExpression : public Cantor::Expression
{
Q_OBJECT
- public:
- explicit MaximaExpression( Cantor::Session* session);
- ~MaximaExpression() override;
+
+public:
+ explicit MaximaExpression(Cantor::Session*);
void evaluate() Q_DECL_OVERRIDE;
void interrupt() Q_DECL_OVERRIDE;
- void addInformation(const QString& information) Q_DECL_OVERRIDE;
+ void addInformation(const QString&) Q_DECL_OVERRIDE;
bool needsLatexResult();
@@ -52,21 +50,20 @@ class MaximaExpression : public Cantor::Expression
void forceDone();
//reads from @param out until a prompt indicates that a new expression has started
- bool parseOutput(QString& out);
- void parseError(const QString& out);
+ bool parseOutput(QString&);
+ void parseError(const QString&);
- private Q_SLOTS:
+private Q_SLOTS:
void imageChanged();
- private:
+private:
QString additionalLatexHeaders() Q_DECL_OVERRIDE;
Cantor::Result* parseResult(int* idx,QString& out,QString& textBuffer,QString& latexBuffer);
- private:
+
QTemporaryFile *m_tempFile;
KDirWatch m_fileWatch;
bool m_isHelpRequest;
bool m_isPlot;
- QTimer* m_askTimer;
QString m_errorBuffer;
bool m_gotErrorContent;
};
diff --git a/src/backends/octave/octaveexpression.cpp b/src/backends/octave/octaveexpression.cpp
index 944d6d9..2bd159a 100644
--- a/src/backends/octave/octaveexpression.cpp
+++ b/src/backends/octave/octaveexpression.cpp
@@ -32,26 +32,18 @@
static const char* printCommand = "cantor_print();";
-OctaveExpression::OctaveExpression(Cantor::Session* session): Expression(session)
+OctaveExpression::OctaveExpression(Cantor::Session* session): Expression(session),
+ m_plotPending(false),
+ m_finished(false),
+ m_error(false)
{
- qDebug() << "OctaveExpression construtor";
m_plotCommands << QLatin1String("plot") << QLatin1String("semilogx") << QLatin1String("semilogy") << QLatin1String("loglog")
<< QLatin1String("polar") << QLatin1String("mesh") << QLatin1String("contour") << QLatin1String("bar")
<< QLatin1String("stairs") << QLatin1String("errorbar") << QLatin1String("surf") << QLatin1String("sombrero")
<< QLatin1String("hist") << QLatin1String("fplot") << QLatin1String("imshow");
m_plotCommands << QLatin1String("cantor_plot2d") << QLatin1String("cantor_plot3d");
-
- m_error = false;
- m_plotPending = false;
}
-
-OctaveExpression::~OctaveExpression()
-{
-
-}
-
-
void OctaveExpression::interrupt()
{
qDebug() << "interrupt";
diff --git a/src/backends/octave/octaveexpression.h b/src/backends/octave/octaveexpression.h
index ac8a78a..3b2566b 100644
--- a/src/backends/octave/octaveexpression.h
+++ b/src/backends/octave/octaveexpression.h
@@ -32,30 +32,28 @@ typedef Cantor::ImageResult OctavePlotResult;
#endif
-
class OctaveExpression : public Cantor::Expression
{
Q_OBJECT
- public:
- OctaveExpression(Cantor::Session* session);
- ~OctaveExpression() override;
- void interrupt() Q_DECL_OVERRIDE;
- void evaluate() Q_DECL_OVERRIDE;
- void parseOutput ( QString output );
- void parseError(QString error);
- void parsePlotFile(QString file);
-
- void finalize();
- void setPlotPending(bool plot);
-
- private:
- QString m_resultString;
- int m_numberOfLines;
- bool m_plotPending;
- bool m_finished;
- bool m_error;
- QStringList m_plotCommands;
+public:
+ OctaveExpression(Cantor::Session*);
+
+ void interrupt() Q_DECL_OVERRIDE;
+ void evaluate() Q_DECL_OVERRIDE;
+ void parseOutput (QString);
+ void parseError(QString);
+ void parsePlotFile(QString file);
+
+ void finalize();
+ void setPlotPending(bool);
+
+private:
+ QString m_resultString;
+ bool m_plotPending;
+ bool m_finished;
+ bool m_error;
+ QStringList m_plotCommands;
};
#endif // OCTAVEEXPRESSION_H
diff --git a/src/backends/sage/sageexpression.cpp b/src/backends/sage/sageexpression.cpp
index 4d75606..ec6f091 100644
--- a/src/backends/sage/sageexpression.cpp
+++ b/src/backends/sage/sageexpression.cpp
@@ -31,14 +31,10 @@
#include <QMimeDatabase>
#include <QRegExp>
-SageExpression::SageExpression( Cantor::Session* session ) : Cantor::Expression(session)
+SageExpression::SageExpression( Cantor::Session* session ) : Cantor::Expression(session),
+ m_isHelpRequest(false),
+ m_promptCount(0)
{
- qDebug();
-}
-
-SageExpression::~SageExpression()
-{
-
}
void SageExpression::evaluate()
diff --git a/src/backends/sage/sageexpression.h b/src/backends/sage/sageexpression.h
index 0c12c33..e963262 100644
--- a/src/backends/sage/sageexpression.h
+++ b/src/backends/sage/sageexpression.h
@@ -27,23 +27,24 @@ class SageExpression : public Cantor::Expression
{
Q_OBJECT
public:
- SageExpression( Cantor::Session* session);
- ~SageExpression() override;
+ SageExpression(Cantor::Session*);
void evaluate() Q_DECL_OVERRIDE;
void interrupt() Q_DECL_OVERRIDE;
- void parseOutput(const QString& text);
- void parseError(const QString& text);
+ void parseOutput(const QString&);
+ void parseError(const QString&);
- void addFileResult(const QString& path);
+ void addFileResult(const QString&);
+
+ void onProcessError(const QString&);
- void onProcessError(const QString& msg);
public Q_SLOTS:
void evalFinished();
protected:
QString additionalLatexHeaders() Q_DECL_OVERRIDE;
+
private:
QString m_outputCache;
QString m_imagePath;
diff --git a/src/cantor_part.cpp b/src/cantor_part.cpp
index eee703c..470d539 100644
--- a/src/cantor_part.cpp
+++ b/src/cantor_part.cpp
@@ -111,13 +111,13 @@ class WorksheetAccessInterfaceImpl : public Cantor::WorksheetAccessInterface
Worksheet* m_worksheet;
};
-CantorPart::CantorPart( QWidget *parentWidget, QObject *parent, const QVariantList & args ): KParts::ReadWritePart(parent)
+CantorPart::CantorPart( QWidget *parentWidget, QObject *parent, const QVariantList & args ): KParts::ReadWritePart(parent),
+ m_searchBar(nullptr),
+ m_initProgressDlg(nullptr),
+ m_showProgressDlg(true),
+ m_showBackendHelp(nullptr),
+ m_statusBarBlocked(false)
{
- m_showBackendHelp=nullptr;
- m_initProgressDlg=nullptr;
- m_statusBarBlocked=false;
- m_showProgressDlg=true;
-
qDebug()<<"Created a CantorPart";
m_panelHandler=new Cantor::PanelPluginHandler(this);
@@ -161,7 +161,6 @@ CantorPart::CantorPart( QWidget *parentWidget, QObject *parent, const QVariantLi
connect(actionCollection(), SIGNAL(inserted(QAction*)), m_worksheet,
SLOT(registerShortcut(QAction*)));
- m_searchBar = nullptr;
layout->addWidget(m_worksheetview);
// notify the part that this is our internal widget
setWidget(widget);
diff --git a/src/cantor_part.h b/src/cantor_part.h
index 129151e..bf58617 100644
--- a/src/cantor_part.h
+++ b/src/cantor_part.h
@@ -175,9 +175,6 @@ private:
QString m_cachedStatusMessage;
bool m_statusBarBlocked;
-
};
-
-
#endif // CANTORPART_H
diff --git a/src/lib/expression.cpp b/src/lib/expression.cpp
index 61e9c16..ae6bdf3 100644
--- a/src/lib/expression.cpp
+++ b/src/lib/expression.cpp
@@ -41,10 +41,9 @@ using namespace Cantor;
class Cantor::ExpressionPrivate
{
public:
- ExpressionPrivate() {
- result=nullptr;
- session=nullptr;
- isInternal=false;
+ ExpressionPrivate() : result(nullptr), status(Expression::Done), session(nullptr),
+ finishingBehavior(Expression::DoNotDelete), isInternal(false)
+ {
}
int id;
diff --git a/src/lib/session.cpp b/src/lib/session.cpp
index 9795b10..a223ca0 100644
--- a/src/lib/session.cpp
+++ b/src/lib/session.cpp
@@ -26,11 +26,8 @@ using namespace Cantor;
class Cantor::SessionPrivate
{
public:
- SessionPrivate()
+ SessionPrivate() : backend(nullptr), status(Session::Done), typesettingEnabled(false), expressionCount(0)
{
- backend=nullptr;
- expressionCount=0;
- typesettingEnabled=false;
}
Backend* backend;
@@ -39,8 +36,7 @@ class Cantor::SessionPrivate
int expressionCount;
};
-Session::Session( Backend* backend ) : QObject(backend),
- d(new SessionPrivate)
+Session::Session( Backend* backend ) : QObject(backend), d(new SessionPrivate)
{
d->backend=backend;
}