Show a patch.

GET /api/1.1/patches/17267/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 17267,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/17267/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/17267/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api",
        "name": "libcamera",
        "link_name": "libcamera",
        "list_id": "libcamera_core",
        "list_email": "libcamera-devel@lists.libcamera.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": ""
    },
    "msgid": "<20220831054938.21617-4-utkarsh02t@gmail.com>",
    "date": "2022-08-31T05:49:34",
    "name": "[libcamera-devel,v9,3/7] qcam: MainWindow: Replace cameraCombo_ with CameraSelectorDialog",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "81bc7910f5d3969b33dbb4cb611a73dac0885859",
    "submitter": {
        "id": 114,
        "url": "https://patchwork.libcamera.org/api/1.1/people/114/?format=api",
        "name": "Utkarsh Tiwari",
        "email": "utkarsh02t@gmail.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/17267/mbox/",
    "series": [
        {
            "id": 3457,
            "url": "https://patchwork.libcamera.org/api/1.1/series/3457/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3457",
            "date": "2022-08-31T05:49:31",
            "name": "Introduce capture scripts to qcam",
            "version": 9,
            "mbox": "https://patchwork.libcamera.org/series/3457/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/17267/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/17267/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 DF365C3272\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 31 Aug 2022 05:50:02 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0ABBB61FBB;\n\tWed, 31 Aug 2022 07:50:02 +0200 (CEST)",
            "from mail-pl1-x633.google.com (mail-pl1-x633.google.com\n\t[IPv6:2607:f8b0:4864:20::633])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9F9AE61F9B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 31 Aug 2022 07:50:00 +0200 (CEST)",
            "by mail-pl1-x633.google.com with SMTP id u22so13175680plq.12\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 30 Aug 2022 22:50:00 -0700 (PDT)",
            "from devut-HP-Laptop-14q-cs0xxx.. ([103.36.82.122])\n\tby smtp.gmail.com with ESMTPSA id\n\tq19-20020aa79833000000b00537eacc8fa6sm8307333pfl.40.2022.08.30.22.49.56\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 30 Aug 2022 22:49:58 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1661925002;\n\tbh=hu64cImvTVadUShZEqI/nuzEqRWxOMJ5I3KUx/TRGQ8=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=NXtcsREAC/LnlSepGS6bl7bt/YG/y51ZE9dxWhmfNKnytTQdA4nYpKPMLA1XrN8hz\n\tCoZAns4Qm+v8NX5Rkb/BxN4r1HNOMY+3wv7aDbz/h1JzqmmkZf34v1xyKCMWrGy+YS\n\tjg7tWsPx6N0TlT7mZUur/+dVYqD6yPtVUBhZhvowjCRCBk1L4uRwg6jhqYvGQ42n+4\n\tQ5k0k4NbEd2QFFBDX9t8XcR8E75CsV50Jq6HOKGpZw4o51tfHtVUpMcQYkioOzh0q9\n\tc0EHd61wzK1RDZrVy1ogi5DQdVF0sl3MrX4LgEsSb8TpSEJHPO+MF7UrICKYQkcSPT\n\t6h58EJQTtoEDQ==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc;\n\tbh=1/DFNJqcQfnMM+yUXqCldUE401lVkLLcP0bJcD0xqfw=;\n\tb=RRPuQf7XoQMRIOUTKXwdlmz3xBsN+HTGly5RfJyIA3jmDbqXt9VmUluw/RZmUOecUd\n\tJDRWivvtVHQbKw0EBt/IMETd4dwvSkIxNndLEL7z/jeA++R3eWObOY0SK4AxXyuUp9nm\n\t+nScfE4dNdANT3dt8oRCfmjH0tIiPY7mogKvcwxtoHyzeWwxFzoEVIwIlK+XL7OkH7rb\n\tWXuMDpbFQtgk7pb4C9b1LUrBM3GRTX1uBByP1zwoGK4Tk+gFfMmFr/FZeIyi8ER2eXSB\n\t1xKPCPHUtig6YYYXaCCzxMt8bNAhbzONAduNIy8myTyL7HbbaI9Axb/EPsNGKERNzxrG\n\ttOCQ=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"RRPuQf7X\"; dkim-atps=neutral",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc;\n\tbh=1/DFNJqcQfnMM+yUXqCldUE401lVkLLcP0bJcD0xqfw=;\n\tb=mlwqe18quu/OVrf6swCAKtxxw3WOEfSHoDgGQYIH7Pj6G3Dept84rwf0TFsNVxSyEo\n\tdIkjmxZYtmjTnij78fx6qvXthXSDhPGwVz1HAugONUr9eS+9QUP0hOK5pTX6Imzou8aO\n\tn2x/fXJsgORvw46iBPd5HL/SKgY+fMbFet+9PmkmUCd5C70g+TJMFborW5wEX7P5zGTK\n\t0M+1VVgtAT7ZJqk+7YXqH8Yc1eETesHp8RH4+IfLTRVjQpHl4qoJxIrmSJiw9FabjR1l\n\tAW+9QooweKpA9OqdKupiSzxFT9hbZkVSBY0HEIKK9BWZ2OfnFAcFpwQHOky5qudhZG0c\n\tK2DA==",
        "X-Gm-Message-State": "ACgBeo24Em3tpUoH/4YhUT5oBVsf9MGVoGIYvxaCjdRFDmh3C55drutf\n\tC/F8RpcYxSkFvGE1pdbtFxI3FPkKRQ0=",
        "X-Google-Smtp-Source": "AA6agR4V0AvL7FHCK4u4L+hBoTO/leeFDpOi7wMku0BjA6A/wmguI7uV8WnhnMJ5rPWsu8oR2n01pw==",
        "X-Received": "by 2002:a17:90b:350b:b0:1fd:fe88:7cdf with SMTP id\n\tls11-20020a17090b350b00b001fdfe887cdfmr1638375pjb.236.1661924999040; \n\tTue, 30 Aug 2022 22:49:59 -0700 (PDT)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Wed, 31 Aug 2022 11:19:34 +0530",
        "Message-Id": "<20220831054938.21617-4-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",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v9 3/7] qcam: MainWindow: Replace\n\tcameraCombo_ with CameraSelectorDialog",
        "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": "Replace the cameraCombo_ on the toolbar with a QPushButton which\ndisplays the CameraSelectorDialog. This would allow the user to view\ninformation about the camera when switching.\n\nThe QPushButton text is set to the camera Id currently in use.\n\nSigned-off-by: Utkarsh Tiwari <utkarsh02t@gmail.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\nDifferences from v9:\n    1. Checking for OptCamera now happens in 1/7 in openCamera dropping\n    the firstCameraSelect_\n    2. Improve curly brace structure\n    3. Drop QComboBox\n src/qcam/main_window.cpp | 33 ++++++++++++++++-----------------\n src/qcam/main_window.h   |  5 +++--\n 2 files changed, 19 insertions(+), 19 deletions(-)",
    "diff": "diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp\nindex e8e22d49..505bdc56 100644\n--- a/src/qcam/main_window.cpp\n+++ b/src/qcam/main_window.cpp\n@@ -14,7 +14,6 @@\n #include <libcamera/camera_manager.h>\n #include <libcamera/version.h>\n \n-#include <QComboBox>\n #include <QCoreApplication>\n #include <QFileDialog>\n #include <QImage>\n@@ -195,14 +194,11 @@ int MainWindow::createToolbars()\n \tconnect(action, &QAction::triggered, this, &MainWindow::quit);\n \n \t/* Camera selector. */\n-\tcameraCombo_ = new QComboBox();\n-\tconnect(cameraCombo_, QOverload<int>::of(&QComboBox::activated),\n+\tcameraSelectButton_ = new QPushButton;\n+\tconnect(cameraSelectButton_, &QPushButton::clicked,\n \t\tthis, &MainWindow::switchCamera);\n \n-\tfor (const std::shared_ptr<Camera> &cam : cm_->cameras())\n-\t\tcameraCombo_->addItem(QString::fromStdString(cam->id()));\n-\n-\ttoolbar_->addWidget(cameraCombo_);\n+\ttoolbar_->addWidget(cameraSelectButton_);\n \n \ttoolbar_->addSeparator();\n \n@@ -262,14 +258,18 @@ void MainWindow::updateTitle()\n  * Camera Selection\n  */\n \n-void MainWindow::switchCamera(int index)\n+void MainWindow::switchCamera()\n {\n \t/* Get and acquire the new camera. */\n-\tconst auto &cameras = cm_->cameras();\n-\tif (static_cast<unsigned int>(index) >= cameras.size())\n+\tstd::string newCameraId = chooseCamera();\n+\n+\tif (newCameraId.empty())\n \t\treturn;\n \n-\tconst std::shared_ptr<Camera> &cam = cameras[index];\n+\tif (camera_ && newCameraId == camera_->id())\n+\t\treturn;\n+\n+\tconst std::shared_ptr<Camera> &cam = cm_->get(newCameraId);\n \n \tif (cam->acquire()) {\n \t\tqInfo() << \"Failed to acquire camera\" << cam->id().c_str();\n@@ -288,6 +288,9 @@ void MainWindow::switchCamera(int index)\n \tcamera_ = cam;\n \n \tstartStopAction_->setChecked(true);\n+\n+\t/* Display the current cameraId in the toolbar .*/\n+\tcameraSelectButton_->setText(QString::fromStdString(newCameraId));\n }\n \n std::string MainWindow::chooseCamera()\n@@ -324,8 +327,8 @@ int MainWindow::openCamera()\n \t\treturn -EBUSY;\n \t}\n \n-\t/* Set the combo-box entry with the currently selected Camera. */\n-\tcameraCombo_->setCurrentText(QString::fromStdString(cameraName));\n+\t/* Set the camera switch button with the currently selected Camera id. */\n+\tcameraSelectButton_->setText(QString::fromStdString(cameraName));\n \n \treturn 0;\n }\n@@ -591,7 +594,6 @@ void MainWindow::processHotplug(HotplugEvent *e)\n \tHotplugEvent::PlugEvent event = e->hotplugEvent();\n \n \tif (event == HotplugEvent::HotPlug) {\n-\t\tcameraCombo_->addItem(cameraId);\n \t\tcameraSelectorDialog_->addCamera(cameraId);\n \t} else if (event == HotplugEvent::HotUnplug) {\n \t\t/* Check if the currently-streaming camera is removed. */\n@@ -599,11 +601,8 @@ void MainWindow::processHotplug(HotplugEvent *e)\n \t\t\ttoggleCapture(false);\n \t\t\tcamera_->release();\n \t\t\tcamera_.reset();\n-\t\t\tcameraCombo_->setCurrentIndex(0);\n \t\t}\n \n-\t\tint camIndex = cameraCombo_->findText(cameraId);\n-\t\tcameraCombo_->removeItem(camIndex);\n \t\tcameraSelectorDialog_->removeCamera(cameraId);\n \t}\n }\ndiff --git a/src/qcam/main_window.h b/src/qcam/main_window.h\nindex def44605..79723256 100644\n--- a/src/qcam/main_window.h\n+++ b/src/qcam/main_window.h\n@@ -23,6 +23,7 @@\n #include <QMainWindow>\n #include <QMutex>\n #include <QObject>\n+#include <QPushButton>\n #include <QQueue>\n #include <QTimer>\n \n@@ -60,7 +61,7 @@ private Q_SLOTS:\n \tvoid quit();\n \tvoid updateTitle();\n \n-\tvoid switchCamera(int index);\n+\tvoid switchCamera();\n \tvoid toggleCapture(bool start);\n \n \tvoid saveImageAs();\n@@ -90,7 +91,7 @@ private:\n \t/* UI elements */\n \tQToolBar *toolbar_;\n \tQAction *startStopAction_;\n-\tQComboBox *cameraCombo_;\n+\tQPushButton *cameraSelectButton_;\n \tQAction *saveRaw_;\n \tViewFinder *viewfinder_;\n \n",
    "prefixes": [
        "libcamera-devel",
        "v9",
        "3/7"
    ]
}