From patchwork Wed Aug 31 05:49:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Utkarsh Tiwari X-Patchwork-Id: 17271 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 7D66CC3272 for ; Wed, 31 Aug 2022 05:50:13 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 361A861FCE; Wed, 31 Aug 2022 07:50:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1661925013; bh=sfCzj5KVEAzrKNuGbN4WwAUaNUY/CmOphjxwj3CPXOI=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=fQh5hiYdG321ijvfr9jqZGmmeWcXBcvs5g82gEQdG4qrISfWz9HTvAUaHyhj0sY6F K1JRHvlFv920dKkx9P9BRv5jM/oQ3ijrdM1epY4yh4aSfW739tnV+DPZiDz4YuAK1N OneDlpXeFMfWykrj5iBT8pB1JszmKu9mB6bdYqvPTOINCDt1F4+Md+i2SQSxFJtjWp GuIOf96mEsPTOhvV3BcjEIayGEQyZ8fytSxns7r4s3Ry8DhZm5FMHUkhkYJjrz4dth 37beAAVYaigKh8cNBcoJfCx8GIZu6uQ1nIURCrThxwCws/0F3zEIiG6wgInPlnuTnq lBCTsQoZM6Whw== Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3E23F61FBC for ; Wed, 31 Aug 2022 07:50:12 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="HAOrPXQA"; dkim-atps=neutral Received: by mail-pj1-x1035.google.com with SMTP id w88-20020a17090a6be100b001fbb0f0b013so13967228pjj.5 for ; Tue, 30 Aug 2022 22:50:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=qi9RfznzV8BFNNvtVx87j3wkZRX+zAexw9WtM1zCQ94=; b=HAOrPXQA/Yxll96GqY5xcM7YQ3Zg/kXbRI6QSVw6UuX4TJPacU2je0Y146fzt39N9D F73PuNxb/WLNxPHmFztqnOgDKbn8zrQHj2gsymp3G+95xqug3aNei8njF0IxWmMmXTM1 kzHEns67ETsgzBQtT4rUEq1XTLgEylTmgKpUTagkZX5qTMXKsE8QugXAs/Ct//6d1tUW mb4YUTihsBZZVrM7JNup7ieMmfiRm0/Ya8K/v0ERlH346Or0/qZRyvDS4xLhKNFTFIIi T9Y1h05ZPhuVQ0hdwj1rxzqTj8ClI07W734GYwL9z4oyy4QGTDQ3d7B5AzIMz+psOhQh JgeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=qi9RfznzV8BFNNvtVx87j3wkZRX+zAexw9WtM1zCQ94=; b=TH/8HTk0jb4Xu7ufUBYr0sHitt6B3iTYT0kE6u/zWnbxPPsL+xKIpZGx0od5TFU6qR peIaW/hpSK+abGW/zZXBoyosa26ILX3EtywE2bTuTvP93ItzQiYf5UZeNPlrrBH4lp+T 5pg0xKSGh53TaCSrrXA4dQBIVjUItjzjkwZNMjkYPyZXx6YcFOw2gx03OcOB/DRL0CyS ixdu8av8pUQNjVsLMNom/ov2ieg4wkby5ef4Z9hI0SgcQ+8P1U9JQA3UeXv7y1YWnbn1 ++/CvGkBH3agT84W/bvttl2MQKJuNwP2LrKL0nzXHht4DfW+Ri8k+GmRewUremapK78g ps+Q== X-Gm-Message-State: ACgBeo0eQa04YAPSV0Uwr/50Hhio4W2b2o2RIGcJrPdAmEKf47hIo9xD kKXyqHL73hXzTTuoyAoXg+E5Ld/DKEc= X-Google-Smtp-Source: AA6agR4f2EGeNST++y+3++x4pJHSS/oN3wHuYpSI/n7thuzuGtqMcmPNprB50QeY8TWBx87IGy1xuA== X-Received: by 2002:a17:90a:8a90:b0:1fd:bf26:58fb with SMTP id x16-20020a17090a8a9000b001fdbf2658fbmr1575704pjn.91.1661925010628; Tue, 30 Aug 2022 22:50:10 -0700 (PDT) Received: from devut-HP-Laptop-14q-cs0xxx.. ([103.36.82.122]) by smtp.gmail.com with ESMTPSA id q19-20020aa79833000000b00537eacc8fa6sm8307333pfl.40.2022.08.30.22.50.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Aug 2022 22:50:10 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Wed, 31 Aug 2022 11:19:38 +0530 Message-Id: <20220831054938.21617-8-utkarsh02t@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220831054938.21617-1-utkarsh02t@gmail.com> References: <20220831054938.21617-1-utkarsh02t@gmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v9 7/7] qcam: Add --script to load capture script X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Utkarsh Tiwari via libcamera-devel From: Utkarsh Tiwari Reply-To: Utkarsh Tiwari Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add --script as an individual option to load capture scripts. Load the capture script before starting the capture. If an invalid capture script has been given, display an critical error QMessageBox and close the application. --- Differences from v8: 1. Functionally the patch remains same. 2. The difference is that checking for OptCaptureScript is now done in MainWindow::MainWindow() src/qcam/main.cpp | 3 +++ src/qcam/main_window.cpp | 11 +++++++++-- src/qcam/main_window.h | 1 + 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/qcam/main.cpp b/src/qcam/main.cpp index d3f01a85..91166be5 100644 --- a/src/qcam/main.cpp +++ b/src/qcam/main.cpp @@ -43,6 +43,9 @@ OptionsParser::Options parseOptions(int argc, char *argv[]) "Set configuration of a camera stream", "stream", true); parser.addOption(OptVerbose, OptionNone, "Print verbose log messages", "verbose"); + parser.addOption(OptCaptureScript, OptionString, + "Load a capture session configuration script from a file", + "script", ArgumentRequired, "script"); OptionsParser::Options options = parser.parse(argc, argv); if (options.isSet(OptHelp)) diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp index af992b94..e488b67f 100644 --- a/src/qcam/main_window.cpp +++ b/src/qcam/main_window.cpp @@ -145,6 +145,9 @@ MainWindow::MainWindow(CameraManager *cm, const OptionsParser::Options &options) cm_->cameraAdded.connect(this, &MainWindow::addCamera); cm_->cameraRemoved.connect(this, &MainWindow::removeCamera); + if (options_.isSet(OptCaptureScript)) + scriptPath_ = options_[OptCaptureScript].toString(); + cameraSelectorDialog_ = new CameraSelectorDialog(cm_, scriptPath_, this); connect(cameraSelectorDialog_, &CameraSelectorDialog::stopCaptureScript, this, &MainWindow::stopCaptureScript); @@ -157,9 +160,13 @@ MainWindow::MainWindow(CameraManager *cm, const OptionsParser::Options &options) } /* Start capture script. */ - if (!scriptPath_.empty()) + if (!scriptPath_.empty()) { ret = loadCaptureScript(); - + if (options_.isSet(OptCaptureScript)) { + quit(); + return; + } + } startStopAction_->setChecked(true); } diff --git a/src/qcam/main_window.h b/src/qcam/main_window.h index 7c877ae1..24ebd019 100644 --- a/src/qcam/main_window.h +++ b/src/qcam/main_window.h @@ -45,6 +45,7 @@ enum { OptRenderer = 'r', OptStream = 's', OptVerbose = 'v', + OptCaptureScript = 256, }; class MainWindow : public QMainWindow