Changeset View
Changeset View
Standalone View
Standalone View
src/backends/octave/octaveexpression.cpp
Show First 20 Lines • Show All 111 Lines • ▼ Show 20 Line(s) | 111 | { | |||
---|---|---|---|---|---|
112 | setResult(new Cantor::HelpResult(output)); | 112 | setResult(new Cantor::HelpResult(output)); | ||
113 | } | 113 | } | ||
114 | else | 114 | else | ||
115 | { | 115 | { | ||
116 | setResult(new Cantor::TextResult(output)); | 116 | setResult(new Cantor::TextResult(output)); | ||
117 | } | 117 | } | ||
118 | } | 118 | } | ||
119 | 119 | | |||
120 | // TODO: remove this, then there is method for notify both Highlighter and variable model about new variable | | |||
121 | foreach ( const QString& line, output.simplified().split(QLatin1Char('\n'), QString::SkipEmptyParts) ) | | |||
122 | { | | |||
123 | if ((output.contains(QLatin1Char('='))) && !(command().startsWith(QLatin1String("help("))) | | |||
124 | && !(command().contains(QLatin1String("help "))) && !(command().contains(QLatin1String("type(")))) | | |||
125 | { | | |||
126 | qDebug() << line; | | |||
127 | // Probably a new variable | | |||
128 | QStringList parts = line.split(QLatin1Char('=')); | | |||
129 | if (parts.size() >= 2) | | |||
130 | { | | |||
131 | Cantor::DefaultVariableModel* model = dynamic_cast<Cantor::DefaultVariableModel*>(session()->variableModel()); | | |||
132 | if (model) | | |||
133 | { | | |||
134 | const QString varname = parts.first().trimmed(); | | |||
135 | if (varname != QLatin1String("__cantor_tmp__")) | | |||
136 | model->addVariable(varname, parts.last().trimmed()); | | |||
137 | } | | |||
138 | } | | |||
139 | } | | |||
140 | } | | |||
141 | | ||||
142 | m_finished = true; | 120 | m_finished = true; | ||
143 | if (!m_plotPending) | 121 | if (!m_plotPending) | ||
144 | setStatus(Done); | 122 | setStatus(Done); | ||
145 | } | 123 | } | ||
146 | 124 | | |||
147 | void OctaveExpression::parseError(const QString& error) | 125 | void OctaveExpression::parseError(const QString& error) | ||
148 | { | 126 | { | ||
149 | setErrorMessage(error); | 127 | setErrorMessage(error); | ||
Show All 24 Lines |