[{"id":23529,"web_url":"https://patchwork.libcamera.org/comment/23529/","msgid":"<165591364518.18145.560260507311207979@Monstersaurus>","date":"2022-06-22T16:00:45","subject":"Re: [libcamera-devel] [PATCH v2 3/3] qcam: Add --script to load\n\tcapture script","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Utkarsh Tiwari via libcamera-devel (2022-06-22 14:16:38)\n> Add --script as an individual option to load capture scripts.\n> Load the capture script before starting the capture.\n\nI think this is missing the update to the isScriptExecuting_; however -\nI think it's better to use the presence of script_ as the marker to know\nif there is a valid script anyway, so I don't think it should be added.\n\n\nThis does leave the state of the capture script button incorrect though\n- as it will be in the 'load' icon state, not the 'stop' icon.\n\nThat also makes me wonder if the script stop button would confuse people\nwith the camera stop button...\n\nBut otherwise, I think being able to load the script at commandline\ncould be useful too so:\n\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> Signed-off-by: Utkarsh Tiwari <utkarsh02t@gmail.com>\n> ---\n>  src/qcam/main.cpp        |  3 +++\n>  src/qcam/main_window.cpp | 10 ++++++++++\n>  src/qcam/main_window.h   |  1 +\n>  3 files changed, 14 insertions(+)\n> \n> diff --git a/src/qcam/main.cpp b/src/qcam/main.cpp\n> index d3f01a85..91166be5 100644\n> --- a/src/qcam/main.cpp\n> +++ b/src/qcam/main.cpp\n> @@ -43,6 +43,9 @@ OptionsParser::Options parseOptions(int argc, char *argv[])\n>                          \"Set configuration of a camera stream\", \"stream\", true);\n>         parser.addOption(OptVerbose, OptionNone,\n>                          \"Print verbose log messages\", \"verbose\");\n> +       parser.addOption(OptCaptureScript, OptionString,\n> +                        \"Load a capture session configuration script from a file\",\n> +                        \"script\", ArgumentRequired, \"script\");\n>  \n>         OptionsParser::Options options = parser.parse(argc, argv);\n>         if (options.isSet(OptHelp))\n> diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp\n> index 29da3947..17cc3185 100644\n> --- a/src/qcam/main_window.cpp\n> +++ b/src/qcam/main_window.cpp\n> @@ -151,6 +151,16 @@ MainWindow::MainWindow(CameraManager *cm, const OptionsParser::Options &options)\n>                 return;\n>         }\n>  \n> +       if (options_.isSet(OptCaptureScript)) {\n> +               std::string scriptName = options_[OptCaptureScript].toString();\n> +               script_ = std::make_unique<CaptureScript>(camera_, scriptName);\n> +               if (!script_->valid()) {\n> +                       QMessageBox::critical(this, \"Invalid Script\",\n> +                                             \"Couldn't load the capture script\");\n> +                       script_.reset();\n> +               }\n> +       }\n> +\n>         startStopAction_->setChecked(true);\n>  }\n>  \n> diff --git a/src/qcam/main_window.h b/src/qcam/main_window.h\n> index 58df4e15..1b4a4fd6 100644\n> --- a/src/qcam/main_window.h\n> +++ b/src/qcam/main_window.h\n> @@ -42,6 +42,7 @@ enum {\n>         OptRenderer = 'r',\n>         OptStream = 's',\n>         OptVerbose = 'v',\n> +       OptCaptureScript = 256,\n>  };\n>  \n>  class MainWindow : public QMainWindow\n> -- \n> 2.25.1\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 20F8DBD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 22 Jun 2022 16:00:50 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 578AB65635;\n\tWed, 22 Jun 2022 18:00:49 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 166E961FB2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 22 Jun 2022 18:00:48 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 7E23A31A;\n\tWed, 22 Jun 2022 18:00:47 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1655913649;\n\tbh=8LSLOTV88Cv0bmaO4+feHpbWJWBn5Adt4lMZ1F+BbuI=;\n\th=In-Reply-To:References:To:Date:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=MeKa74ab0wSvvB7H7KJbnX5iqJBTRWs/rEfLlKphzBVaQzYuz2YV2LSJA9VSEwLob\n\tilsZOslShPGXEVMTvVMr/zpAGcX9s91Z2eyRfUYCm9wrV9cg890bDXnj3n3VDr8qAH\n\trQH0qcft8F2M91BcH+eSAVoJis07zFhWFOeluxgnnseGMwOPFqYVWeVrFeMi87NlSM\n\tgpDAGc9T1aM0SUFYJh9lsH5QUQqclEq1ktTSk47VE/k+k3P+1KZj/+CpnZbZunekOc\n\tFirjcCxnzUmXS20uHmUfYgDUBd5bdACyrgbrgGi16ZYlg4C/OueHLGqfClkYWErNqF\n\txyuYxhMwaLKvg==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1655913647;\n\tbh=8LSLOTV88Cv0bmaO4+feHpbWJWBn5Adt4lMZ1F+BbuI=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=OF4unSdvaEGjXLIlK3xLl4hzSsKaT+YyYWj0yL2y+OC0Q4InkoM70SSiKN7beXeKE\n\tPRN2pWvbAL7XQQsMIGfH4cu6jC8sqv4uS/pjvcIeBD9chvrTIfzi3Uva6HYtjtn+bz\n\t+UXdeHOKPs/Ou+CIKz3TlNkfcaghR2tqLOXWoZYM="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"OF4unSdv\"; dkim-atps=neutral","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20220622131638.79122-4-utkarsh02t@gmail.com>","References":"<20220622131638.79122-1-utkarsh02t@gmail.com>\n\t<20220622131638.79122-4-utkarsh02t@gmail.com>","To":"Utkarsh Tiwari <utkarsh02t@gmail.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Wed, 22 Jun 2022 17:00:45 +0100","Message-ID":"<165591364518.18145.560260507311207979@Monstersaurus>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [PATCH v2 3/3] qcam: Add --script to load\n\tcapture script","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Kieran Bingham via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]