Support for injected commands V2
ClosedPublic

Authored by rizzitello on Mar 4 2018, 4:55 PM.

Details

Summary

Solve: T7746

Diff Face off. Only one can be merged.

Both D10814 and D11024 provide the same features in a different ways.

This is the CommandLineParser Version

Test Plan

Test File:

Diff Detail

Repository
R232 AtCore
Branch
injectParser
Lint
No Linters Available
Unit
No Unit Test Coverage
rizzitello requested review of this revision.Mar 4 2018, 4:55 PM
rizzitello created this revision.
rizzitello retitled this revision from Support for injected commands to Support for injected commands V2.Mar 4 2018, 5:01 PM
rizzitello edited the summary of this revision. (Show Details)
rizzitello edited the test plan for this revision. (Show Details)
rizzitello added a project: Atelier: AtCore.
rizzitello added a subscriber: Atelier: AtCore.
rizzitello updated this revision to Diff 28648.Mar 5 2018, 12:33 AM
rizzitello edited the summary of this revision. (Show Details)
  • Remove extra debug calls, Remaing debug strings are same as D10842
rizzitello updated this revision to Diff 28649.Mar 5 2018, 1:00 AM
  • move option construction into the private data
rizzitello updated this revision to Diff 28654.Mar 5 2018, 1:39 AM
  • Doxyfix
rizzitello edited the test plan for this revision. (Show Details)Mar 5 2018, 1:43 AM

What's the difference in terms of speed and code from this one or v1? can you choose one to be the true one and discard the other one?

What's the difference in terms of speed and code from this one or v1? can you choose one to be the true one and discard the other one?

i have not profiled these. i like the string version better because it does not add any new includes and provides the same functionality in a more robust way since its less error prone to pick out a string then look for a command. Again without doing any profiling its just personal preferance for now.

patrickelectric requested changes to this revision.Mar 12 2018, 12:13 PM

I think that this implementation is much more cleaner

src/printthread.cpp
172

This function should be used ir our default gcode handle also, I would be nice to use it in text gui gcode entry.

184
static QCommandLineParser parser;
if(!parser.optionNames()) {
    parser.setSingleDashWordOptionMode(QCommandLineParser::ParseAsLongOptions);
    parser.addOptions(d->options);
}
192

bool wait = !QString::compare(args.at(2).simplified(), QStringLiteral("true"), Qt::CaseInsensitive); ?

199

first().toInt() will make it more legible

This revision now requires changes to proceed.Mar 12 2018, 12:13 PM
rizzitello added inline comments.Mar 12 2018, 12:17 PM
src/printthread.cpp
172

this is our default gcode handing for AtCore

Any gcode pased thur atcore will use this function.
GUI parts are not in the libary scope.

192

If the string is True bool should be True ..

rizzitello updated this revision to Diff 29354.Mar 12 2018, 8:29 PM
rizzitello marked 5 inline comments as done.
  • rebase
  • most of patrick's suggestions
src/printthread.cpp
199

I would rather use at() to be consistant.

patrickelectric requested changes to this revision.Mar 14 2018, 2:40 AM
patrickelectric added inline comments.
src/printthread.cpp
192

What are you saying does not make sense with the code, shouldn't it be without the !

This revision now requires changes to proceed.Mar 14 2018, 2:40 AM
rizzitello marked an inline comment as done.Mar 14 2018, 11:29 AM
rizzitello added inline comments.
src/printthread.cpp
192

yea you would think (i thought so too) . then it didn't work and i read the docs...
https://doc.qt.io/qt-5/qstring.html#compare-2
compare only returns 0 if the strings are equal . if the string is greater or less then it will return a number greater or less then zero.

this is why i had == 0 before but, if ! 0 is true and if ! other ints is false so it works.

patrickelectric accepted this revision.Mar 14 2018, 4:33 PM
This revision is now accepted and ready to land.Mar 14 2018, 4:33 PM
rizzitello marked 4 inline comments as done.Mar 14 2018, 7:36 PM
  • ref for injectCommand
  • ;- before ;
  • !parser.options() -> parser.options.isEmpty()
laysrodrigues accepted this revision.Mar 17 2018, 2:25 AM
rizzitello closed this revision.Mar 17 2018, 3:10 AM