<div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 26 Jul, 2022, 00:38 Kieran Bingham, <<a href="mailto:kieran.bingham@ideasonboard.com">kieran.bingham@ideasonboard.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Quoting Umang Jain via libcamera-devel (2022-07-25 19:54:32)<br>
> Hi Utkarsh,<br>
> <br>
> On 7/3/22 10:07, Utkarsh Tiwari via libcamera-devel wrote:<br>
> > Add --script as an individual option to load capture scripts.<br>
> > Load the capture script before starting the capture.<br>
> ><br>
> > If an invalid capture script has been given, show error<br>
> > but start the capture without the script.<br>
> <br>
> <br>
> umm, why would you do that? If --script is specified, it is pretty clear <br>
> that the user intends to use the capture script. If there are errors in <br>
> the scripts, we sould fail loudly and not proceed with the start() at all.<br>
> <br>
<br>
That's quite a good point. Failing through the GUI makes sense when<br>
started in the GUI - but indeed, if the script was specified on the<br>
command line, and fails - that's probably expected to fail on the<br>
command line ...<br>
<br>
Perhaps it would make sense to keep the qmessagebox::critical to pop up<br>
a gui failure, but also present a console warning, and then exit after<br>
the message box is closed.<br>
<br>
> The user 'might' get a false impression that the script is valid hence, <br>
> the capture is started and "miss" to take a note of the invalidity <br>
> error. Was this discussed in previous iterations?<br>
<br>
I don't think so.<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Well seems reasonable, new version for the patchset it seems. </div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
> <br>
> ><br>
> > Signed-off-by: Utkarsh Tiwari <<a href="mailto:utkarsh02t@gmail.com" target="_blank" rel="noreferrer">utkarsh02t@gmail.com</a>><br>
> > Reviewed-by: Kieran Bingham <<a href="mailto:kieran.bingham@ideasonboard.com" target="_blank" rel="noreferrer">kieran.bingham@ideasonboard.com</a>><br>
> > ---<br>
> > src/qcam/main.cpp | 3 +++<br>
> > src/qcam/main_window.cpp | 14 ++++++++++++++<br>
> > src/qcam/main_window.h | 1 +<br>
> > 3 files changed, 18 insertions(+)<br>
> ><br>
> > diff --git a/src/qcam/main.cpp b/src/qcam/main.cpp<br>
> > index d3f01a85..91166be5 100644<br>
> > --- a/src/qcam/main.cpp<br>
> > +++ b/src/qcam/main.cpp<br>
> > @@ -43,6 +43,9 @@ OptionsParser::Options parseOptions(int argc, char *argv[])<br>
> > "Set configuration of a camera stream", "stream", true);<br>
> > parser.addOption(OptVerbose, OptionNone,<br>
> > "Print verbose log messages", "verbose");<br>
> > + parser.addOption(OptCaptureScript, OptionString,<br>
> > + "Load a capture session configuration script from a file",<br>
> > + "script", ArgumentRequired, "script");<br>
> > <br>
> > OptionsParser::Options options = parser.parse(argc, argv);<br>
> > if (options.isSet(OptHelp))<br>
> > diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp<br>
> > index 4fbaeccc..7ec53a7c 100644<br>
> > --- a/src/qcam/main_window.cpp<br>
> > +++ b/src/qcam/main_window.cpp<br>
> > @@ -151,6 +151,20 @@ MainWindow::MainWindow(CameraManager *cm, const OptionsParser::Options &options)<br>
> > return;<br>
> > }<br>
> > <br>
> > + if (options_.isSet(OptCaptureScript)) {<br>
> > + std::string scriptName = options_[OptCaptureScript].toString();<br>
> > + script_ = std::make_unique<CaptureScript>(camera_, scriptName);<br>
> > + if (!script_->valid()) {<br>
> > + QMessageBox::critical(this, "Invalid Script",<br>
> > + "Couldn't load the capture script");<br>
> > + script_.reset();<br>
> > + }<br>
> > +<br>
> > + /* Show stopping availability. */<br>
> > + scriptExecAction_->setIcon(QIcon(":x-square.svg"));<br>
> > + scriptExecAction_->setText("Stop Script execution");<br>
> > + }<br>
> > +<br>
> > startStopAction_->setChecked(true);<br>
> > }<br>
> > <br>
> > diff --git a/src/qcam/main_window.h b/src/qcam/main_window.h<br>
> > index 2cdf7169..4d19ab64 100644<br>
> > --- a/src/qcam/main_window.h<br>
> > +++ b/src/qcam/main_window.h<br>
> > @@ -42,6 +42,7 @@ enum {<br>
> > OptRenderer = 'r',<br>
> > OptStream = 's',<br>
> > OptVerbose = 'v',<br>
> > + OptCaptureScript = 256,<br>
> > };<br>
> > <br>
> > class MainWindow : public QMainWindow<br>
</blockquote></div></div></div>