{"id":16594,"url":"https://patchwork.libcamera.org/api/patches/16594/?format=json","web_url":"https://patchwork.libcamera.org/patch/16594/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20220711165327.675198-1-utkarsh02t@gmail.com>","date":"2022-07-11T16:53:27","name":"[libcamera-devel] qcam: Centralize toggling of Capture Script Action","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"4200abda1d71896bf075558613957d8ebc8edd01","submitter":{"id":114,"url":"https://patchwork.libcamera.org/api/people/114/?format=json","name":"Utkarsh Tiwari","email":"utkarsh02t@gmail.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/16594/mbox/","series":[{"id":3272,"url":"https://patchwork.libcamera.org/api/series/3272/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3272","date":"2022-07-11T16:53:27","name":"[libcamera-devel] qcam: Centralize toggling of Capture Script Action","version":1,"mbox":"https://patchwork.libcamera.org/series/3272/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/16594/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/16594/checks/","tags":{},"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 0CFCFBE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 11 Jul 2022 16:53:37 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 71D566331A;\n\tMon, 11 Jul 2022 18:53:36 +0200 (CEST)","from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com\n\t[IPv6:2607:f8b0:4864:20::62f])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id AD1AE63312\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 11 Jul 2022 18:53:35 +0200 (CEST)","by mail-pl1-x62f.google.com with SMTP id r6so2489913plg.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 11 Jul 2022 09:53:35 -0700 (PDT)","from localhost.localdomain\n\t([2406:3003:2005:1c27:a546:e276:c41e:ea9b])\n\tby smtp.gmail.com with ESMTPSA id\n\t195-20020a6217cc000000b0050dc762818csm4991301pfx.102.2022.07.11.09.53.32\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 11 Jul 2022 09:53:33 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1657558416;\n\tbh=mjLINYTD0Y6yoG9AzSGOz7/l66qv4O7EMXMYRLEeot0=;\n\th=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:From;\n\tb=cst1EkjLAEERK+U27znjYtXMx7mPfGJB811BlU4BMBkSpAefOWqYNJoRiTNtToreL\n\t/mS8u0kHXOzhsqZy89+9ahdlUYtjqAUHHgxVh0AOixop0MoiO9CTnpUOnWVzgTpYuN\n\tzTn5Hj7Y2Tn78OuLKEMPjF6ocHRM5qAks3+AoOu0S0WyCAz86BhsPQbx7DunxWnyeZ\n\tsb2fpKM0/WiInBpJfqSdnrh2PSRNVehLeGQE2o/asBSEet7F49lrrFRCVCi1MZqVny\n\tmXWVNdjqx3szFVO+DPlZbqAeAgT7Tulp0cbfeXFKA5Q5Gshoa41KugB2IlhTwFg/Ax\n\tfA1SY1fVMynUQ==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;\n\th=from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=7DaV2orSq1zEmH6H81yyBIWw8/tLMAksvlEp/OMRSZI=;\n\tb=WzjF+//cBJke/pDtoGznq1reZh/8r+w+s13rmjkYS9+YKnj+sXp1fARxbPZ331DGRO\n\tD+gV3F2xuEhJffC8DocJeTnCHVHdqnbZQqnGYDeVeSP+91sntk96pBAEuAGRrIPIS2yy\n\tHiB044TWIT9AVEwG8g21YXiExhfzleFU5TcgQf4siZy+EvSkq/1xqWuqttvq4WzIv2zS\n\t02HcKQrId96KMPU3NTkbY4eGSsAzQX1smslCKfnvE7Vk6cGZucgJ1E7br4SKPAG06wPj\n\t7HfPmLq0CdCdwOJkXw4QiirzMzioaZgdIRU1aHLe5OSsoel8UOjq9hwl349oThV+kCfk\n\tB8oA=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"WzjF+//c\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=7DaV2orSq1zEmH6H81yyBIWw8/tLMAksvlEp/OMRSZI=;\n\tb=fMwN4jNEsHb752wRda4JBbni62njZ/waEpCNXUgzGSECfhVbkB5BbCC5iEF1I4MNHf\n\th0z1WSvS0bkXpVwJWfQ0KPrM4IVlSzvEYqcx7OrstNVz1r0X9MAQ/QY9OwxJi5jrZpVI\n\t0JAoXt3s3g7Lit4ekwlDcPYo7mtHPCxHVaNAnBP7gQNiKXXzpO4GGBwWt+fvgSbcSjo7\n\t9uE4YQGG/D44Zf3tCsDfDOmFrfY0o6jvAdk4yJ3aW2LYE0TFaKsSblC6d9GdCepaNrfD\n\tQ7JMQlU0LxzYq54dte2BVErr+eo6SFzaEGNVkCYpjz2AXLO6sqF4qQTBEUZyBVOWg1ZO\n\tKpxg==","X-Gm-Message-State":"AJIora8rWb5wJCtj13cQPEIm/XLeIOR2GxVNK21VLQmBFIkOH0i5TtvU\n\t1wGnSKhGRo16MZePKFKMaWNVisFGB0kWmw==","X-Google-Smtp-Source":"AGRyM1uJmPc6wQ93+1JO+6eurDT3dKgcY6Y9W2srkIxO11opvF365R2Ulzcow0A9567Il/bvdvb7Qw==","X-Received":"by 2002:a17:902:f546:b0:16b:e4c7:671b with SMTP id\n\th6-20020a170902f54600b0016be4c7671bmr19516883plf.129.1657558413854; \n\tMon, 11 Jul 2022 09:53:33 -0700 (PDT)","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 12 Jul 2022 00:53:27 +0800","Message-Id":"<20220711165327.675198-1-utkarsh02t@gmail.com>","X-Mailer":"git-send-email 2.25.1","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH] qcam: Centralize toggling of Capture\n\tScript Action","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":"Utkarsh Tiwari via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Utkarsh Tiwari <utkarsh02t@gmail.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Centralize the use of scriptExecAction_ in a single\nfunction toggleScriptAction().\n\nCall toggleScriptAction() with a true value to\nreset script_ and set the icon to show availability\nto load script to the user.\nCall with a false value to set the icon to show\nthe stopping icon.\n\nSigned-off-by: Utkarsh Tiwari <utkarsh02t@gmail.com>\n---\nThis patch applies on top of series\nhttps://lists.libcamera.org/pipermail/libcamera-devel/2022-June/031151.html\n\n src/qcam/main_window.cpp | 26 ++++++++++++++++++--------\n src/qcam/main_window.h   |  2 ++\n 2 files changed, 20 insertions(+), 8 deletions(-)","diff":"diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp\nindex a13a8b34..d4b3d629 100644\n--- a/src/qcam/main_window.cpp\n+++ b/src/qcam/main_window.cpp\n@@ -161,8 +161,7 @@ MainWindow::MainWindow(CameraManager *cm, const OptionsParser::Options &options)\n \t\t}\n \n \t\t/* Show stopping availability. */\n-\t\tscriptExecAction_->setIcon(QIcon(\":x-square.svg\"));\n-\t\tscriptExecAction_->setText(\"Stop Script execution\");\n+\t\ttoggleScriptAction(false);\n \t}\n \n \tstartStopAction_->setChecked(true);\n@@ -252,6 +251,8 @@ int MainWindow::createToolbars()\n \t\t\t\t\t\t      QIcon(\":file.svg\")),\n \t\t\t\t     \"Open Capture Script\");\n \tconnect(action, &QAction::triggered, this, &MainWindow::chooseScript);\n+\n+\t/* Do not operate directly call toggleScriptAction */\n \tscriptExecAction_ = action;\n \n \treturn 0;\n@@ -289,10 +290,7 @@ void MainWindow::chooseScript()\n \t\t * This is the second valid press of load script button,\n \t\t * It indicates stopping, Stop and set button for new script.\n \t\t */\n-\t\tscript_.reset();\n-\t\tscriptExecAction_->setIcon(QIcon::fromTheme(\"document-open\",\n-\t\t\t\t\t\t\t    QIcon(\":file.svg\")));\n-\t\tscriptExecAction_->setText(\"Open Capture Script\");\n+\t\ttoggleScriptAction(true);\n \t\treturn;\n \t}\n \n@@ -323,14 +321,26 @@ void MainWindow::chooseScript()\n \t * Valid script verified\n \t * Set the button to indicate stopping availibility.\n \t */\n-\tscriptExecAction_->setIcon(QIcon(\":x-square.svg\"));\n-\tscriptExecAction_->setText(\"Stop Script execution\");\n+\ttoggleScriptAction(false);\n \n \t/* Start capture again if we were capturing before. */\n \tif (wasCapturing)\n \t\ttoggleCapture(true);\n }\n \n+void MainWindow::toggleScriptAction(bool showAvailable)\n+{\n+\tif (showAvailable) {\n+\t\tscript_.reset();\n+\t\tscriptExecAction_->setIcon(QIcon::fromTheme(\"document-open\",\n+\t\t\t\t\t\t\t    QIcon(\":file.svg\")));\n+\t\tscriptExecAction_->setText(\"Open Capture Script\");\n+\t} else {\n+\t\tscriptExecAction_->setIcon(QIcon(\":x-square.svg\"));\n+\t\tscriptExecAction_->setText(\"Stop Script execution\");\n+\t}\n+}\n+\n /* -----------------------------------------------------------------------------\n  * Camera Selection\n  */\ndiff --git a/src/qcam/main_window.h b/src/qcam/main_window.h\nindex 4d19ab64..6f131b17 100644\n--- a/src/qcam/main_window.h\n+++ b/src/qcam/main_window.h\n@@ -90,6 +90,8 @@ private:\n \n \tvoid chooseScript();\n \n+\tvoid toggleScriptAction(bool showAvailable);\n+\n \t/* UI elements */\n \tQToolBar *toolbar_;\n \tQAction *startStopAction_;\n","prefixes":["libcamera-devel"]}