Port Qalculate to QProcess
ClosedPublic

Authored by rishabhg on Jun 3 2017, 10:38 AM.

Details

Summary
  • Set up the connection between Cantor and qalc
  • Use streams for I/O
  • Parse the output returned by qalc
  • Segregate API dependent parts fromqalc
  • Use expression queue and command queue for commands that are to be processed by qalc
  • use qalc for saving variables
  • update variable model

Diff Detail

Repository
R55 Cantor
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
rishabhg created this revision.Jun 3 2017, 10:38 AM
rishabhg created this object with visibility "Cantor (Project)".
rishabhg created this object with edit policy "Cantor (Project)".
rishabhg updated this revision to Diff 15362.Jun 11 2017, 6:47 PM
rishabhg edited the summary of this revision. (Show Details)
rishabhg changed the visibility from "Cantor (Project)" to "Public (No Login Required)".
rishabhg updated this revision to Diff 15549.Jun 18 2017, 2:55 PM
rishabhg edited the summary of this revision. (Show Details)
chinmoyr added inline comments.
src/backends/qalculate/qalculateexpression.cpp
109

You should comment out this line. It's only for testing isn't it?

133

same here.

src/backends/qalculate/qalculatesession.cpp
134

comment out?

149

this and also others following this.

240

const QString

279

IF cantor uses Qt5 then why not switch to QRegularExpression? IIRC it provides some improvements over QRegExp.

292

I think return currentCmd.clear() also does the same thing

311

Use QStringLiteral("...").arg(...) instead.

313

Use QStringLiteral

314

Do something like this

currentCmd = QStringLiteral(...).arg(...);
return  currentCmd;
324

Use currentCmd + QStringLiteral combination.

339

return QString();, though both are same.

367

comment out.

filipesaraiva accepted this revision.Jun 25 2017, 5:02 PM

Hi Rishabh, your patch looks ok for me. The previous reviewer pointed some interesting questions, please address them except by those related to comments to follow debug, sometimes it is usual.

This revision is now accepted and ready to land.Jun 25 2017, 5:02 PM

@filipesaraiva
Most of them were related to commenting out the debug statements. Do you think we should keep the debug statements for now ?
I will address the rest of them ASAP.

rishabhg added inline comments.Jun 27 2017, 10:44 AM
src/backends/qalculate/qalculateexpression.cpp
109

I am keeping the debug statements for now.
They will be removed at some point later

src/backends/qalculate/qalculatesession.cpp
279

Thanks for pointing out .
QRegexp is being used through cantor. It will be ported to QRegularExpression eventually

292

Yes. I don't know why I did this

311

Correct. QStringLiteral is less expensive as pointed out here

339

No they both are not same.
The docs provide good info on both QString and QLatin1String

Most of them were related to commenting out the debug statements. Do you think we should keep the debug statements for now ?

Sure! I like to keep the debug statements. You can keep them for now.

rishabhg updated this revision to Diff 16015.Jun 29 2017, 3:37 PM
filipesaraiva requested changes to this revision.Jun 30 2017, 12:58 PM
filipesaraiva added inline comments.
src/backends/qalculate/qalculatesession.cpp
386

Unfortunately we are not able to use or or and expressions yet, so change it to old logic operators syntax.

In addition, could you provide parentheses for this verification? It is really bad to read (and it is creating an error message during building).

This revision now requires changes to proceed.Jun 30 2017, 12:58 PM
rishabhg updated this revision to Diff 16065.Jun 30 2017, 3:26 PM
rishabhg edited edge metadata.
rishabhg removed a subscriber: chinmoyr.

@filipesaraiva
I have made the changes and If everything looks good to you, I'll push the changes

src/backends/qalculate/qalculatesession.cpp
386

I have changed the logic here a bit and have tried to improve the overall readability.

There were no build errors on my side. Please check if the new code works fine on your system

filipesaraiva accepted this revision.Jul 8 2017, 1:22 PM

Push it!

This revision is now accepted and ready to land.Jul 8 2017, 1:22 PM
This revision was automatically updated to reflect the committed changes.