Changeset View
Changeset View
Standalone View
Standalone View
src/backends/R/rsession.h
Show All 23 Lines | |||||
24 | #include <QRegExp> | 24 | #include <QRegExp> | ||
25 | #include <QStringList> | 25 | #include <QStringList> | ||
26 | 26 | | |||
27 | #include "session.h" | 27 | #include "session.h" | ||
28 | #include "rserver_interface.h" | 28 | #include "rserver_interface.h" | ||
29 | 29 | | |||
30 | class RExpression; | 30 | class RExpression; | ||
31 | class QProcess; | 31 | class QProcess; | ||
32 | class RVariableModel; | ||||
32 | 33 | | |||
33 | namespace Cantor { | 34 | namespace Cantor { | ||
34 | class DefaultVariableModel; | 35 | class DefaultVariableModel; | ||
35 | } | 36 | } | ||
36 | 37 | | |||
37 | class RSession : public Cantor::Session | 38 | class RSession : public Cantor::Session | ||
38 | { | 39 | { | ||
39 | Q_OBJECT | 40 | Q_OBJECT | ||
40 | public: | 41 | public: | ||
41 | explicit RSession( Cantor::Backend* backend); | 42 | explicit RSession( Cantor::Backend* backend); | ||
42 | ~RSession() override; | 43 | ~RSession() override; | ||
43 | 44 | | |||
44 | void login() override; | 45 | void login() override; | ||
45 | void logout() override; | 46 | void logout() override; | ||
46 | 47 | | |||
47 | void interrupt() override; | 48 | void interrupt() override; | ||
48 | 49 | | |||
49 | Cantor::Expression* evaluateExpression(const QString& command, Cantor::Expression::FinishingBehavior behave = Cantor::Expression::FinishingBehavior::DoNotDelete, bool internal = false) override; | 50 | Cantor::Expression* evaluateExpression(const QString& command, Cantor::Expression::FinishingBehavior behave = Cantor::Expression::FinishingBehavior::DoNotDelete, bool internal = false) override; | ||
50 | Cantor::CompletionObject* completionFor(const QString& command, int index=-1) override; | 51 | Cantor::CompletionObject* completionFor(const QString& command, int index=-1) override; | ||
51 | QSyntaxHighlighter* syntaxHighlighter(QObject* parent) override; | 52 | QSyntaxHighlighter* syntaxHighlighter(QObject* parent) override; | ||
52 | QAbstractItemModel* variableModel() override; | 53 | QAbstractItemModel* variableModel() override; | ||
53 | void sendInputToServer(const QString& input); | | |||
54 | void runFirstExpression() override; | 54 | void runFirstExpression() override; | ||
55 | 55 | | |||
56 | void sendInputToServer(const QString& input); | ||||
57 | void updateSymbols(const RVariableModel* model); | ||||
56 | protected Q_SLOTS: | 58 | protected Q_SLOTS: | ||
57 | void serverChangedStatus(int status); | 59 | void serverChangedStatus(int status); | ||
58 | void receiveSymbols(const QStringList& vars, const QStringList& values, const QStringList & funcs); | | |||
59 | void fillSyntaxRegExps(QVector<QRegExp>& v, QVector<QRegExp>& f); | | |||
60 | 60 | | |||
61 | Q_SIGNALS: | 61 | Q_SIGNALS: | ||
62 | void symbolsChanged(); | 62 | void symbolsChanged(); | ||
63 | void syntaxRegExpsFilled(); | | |||
64 | 63 | | |||
65 | private: | 64 | private: | ||
66 | QProcess* m_process; | 65 | QProcess* m_process; | ||
67 | org::kde::Cantor::R* m_rServer; | 66 | org::kde::Cantor::R* m_rServer; | ||
68 | 67 | | |||
69 | /* Available variables and functions, TODO make full classes and type info */ | 68 | RVariableModel* m_variableModel; | ||
70 | Cantor::DefaultVariableModel* m_variableModel; | 69 | bool m_needUpdate; | ||
71 | QStringList m_variables; | | |||
72 | QStringList m_functions; | | |||
73 | }; | 70 | }; | ||
74 | 71 | | |||
75 | #endif /* _RSESSION_H */ | 72 | #endif /* _RSESSION_H */ |