Show a patch.

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

{
    "id": 17069,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/17069/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/17069/",
    "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": "<20220810150349.414043-4-utkarsh02t@gmail.com>",
    "date": "2022-08-10T15:03:44",
    "name": "[libcamera-devel,v8,3/8] qcam: MainWindow: Replace cameraCombo_ with CameraSelectorDialog",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "30bb6ef851f5cbd9792ecebbe26f07195755f627",
    "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/17069/mbox/",
    "series": [
        {
            "id": 3402,
            "url": "https://patchwork.libcamera.org/api/1.1/series/3402/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3402",
            "date": "2022-08-10T15:03:41",
            "name": "Introduce capture scripts to qcam",
            "version": 8,
            "mbox": "https://patchwork.libcamera.org/series/3402/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/17069/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/17069/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 2771BC3272\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 10 Aug 2022 15:04:06 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B27AB63335;\n\tWed, 10 Aug 2022 17:04:05 +0200 (CEST)",
            "from mail-pg1-x530.google.com (mail-pg1-x530.google.com\n\t[IPv6:2607:f8b0:4864:20::530])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8124763333\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 10 Aug 2022 17:04:02 +0200 (CEST)",
            "by mail-pg1-x530.google.com with SMTP id l64so14641391pge.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 10 Aug 2022 08:04:02 -0700 (PDT)",
            "from localhost.localdomain ([2404:bd00:3:d2bc:2a55:4cae:bf8f:f4ed])\n\tby smtp.gmail.com with ESMTPSA id\n\tb3-20020a1709027e0300b0016f1319d2a7sm12882624plm.297.2022.08.10.08.03.59\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 10 Aug 2022 08:04:01 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1660143845;\n\tbh=Wch9S/K/rq7sqVEfWKmqaA/Tk9UfQePdXxaS0+8gKDc=;\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=31X+83DMjEjFBv1euaGEC+GK/KB4WeQuQ8SXZoSNj64onURqMfHkHMzlP9rrqv3qw\n\tUNva2JnJl7jHHQTc2ZBgP4X08QsnOf05i3vd3yMcKAw8JtJr5/3FMpOo9ypstEgdBD\n\tGoKodLEbIzHIskZbRBAIa6IbP52IDOji1dRjjw78jW4ghd32+0ryuLIsom8m0wm4Km\n\tJsYSPvKkIX1ePmmN+sNRO73sbJhmmddZ5N3ZbzMrzlGPUHMTcEg/Kadju/xy4CtkWr\n\tw0PNMHgPPoZrzFQwY2A2n4UPzMdnxT5UX6Z9SJKjhl8X7qZ2VXd8Z1wIdesRgxQ1Ig\n\tye4yd8WUHJtTw==",
            "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=9iwKcpTOSLNqoHIQa8Jl32eZDEficXvu3/ctjnyaBtA=;\n\tb=YHXSJO7AjvZ7Qrh3AxnTRk66WXX+hhmOKxOtqtOFrWmC7pu2zXGVR/cNDuhX4pvf0i\n\tun1HeiQ6CTAGjHcBU2XebyjklwCiZOMko7uMs0Zsl+YYJervrKB0zMGwby8g9ntaNSRb\n\tlQkSoEh5BgIPgo0BegGkj0UCkXufXOtA0Vumf4kPe5eI3kYARTX3vk/678hNNdR+WCHN\n\tyrY25M1DczGZQV8S/iVSkMXfo9AfqzKClFYVDeAg+OiLPgFzYbcF+fjXi8rulJ1EvMgt\n\tjpwJpJUTbCA3pBNxbCh11oVQyZ7TPqAjAcoz8XLY1KBAtA7Iuf1uamxErduoe+xS92lb\n\teJFQ=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"YHXSJO7A\"; 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=9iwKcpTOSLNqoHIQa8Jl32eZDEficXvu3/ctjnyaBtA=;\n\tb=qRL7d1DCuAJ3JfIaMWGV3GWlClLnDHbIvK+Z3LxwJEAVporyudE4dxTpbjqzUfYwpi\n\toRWD5IqpERpddsCCIsmHWf6MtycrikHlOvv9JI+KxIfzeAt+uyDhggV5xg1X4xR0iJWu\n\t0qJ8yNfbIJWwJ3HG5lAzkYoPbyuJIvN/ULi4JJojKZ9auppVoF6SF7bG9+G7Omq8cFMg\n\t0dNSPg6uyds7A60tuM7G2cn4iR+ty/qL2YLGW7Ec7Wls49/572ieHo/twUxoq8F/q0OO\n\trq+5QXLnsXUOpawRUsUzFJoBCdiEIaTmmG6Xd5n3nOrQDD0QqN6kLfK/Rb9BqIaJ4sT8\n\tz03w==",
        "X-Gm-Message-State": "ACgBeo0fGdmM4kkWYs6aHk2bZjw5MmWIsSP2VHsXFj8SSmPzilLZ9kS5\n\tnJCREwbiJh74nqfK8AhzQd88Eo5Oveo=",
        "X-Google-Smtp-Source": "AA6agR4DwaF7NWYxCG2ZcBGiF3W3r65OCTTF/yZnNwyPNNVAWZ/ugeCS5TZZCOOt4sUOh4CH+QmKPg==",
        "X-Received": "by 2002:a05:6a00:9a7:b0:52d:bbf9:c3d5 with SMTP id\n\tu39-20020a056a0009a700b0052dbbf9c3d5mr27987008pfg.9.1660143841722; \n\tWed, 10 Aug 2022 08:04:01 -0700 (PDT)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Wed, 10 Aug 2022 20:33:44 +0530",
        "Message-Id": "<20220810150349.414043-4-utkarsh02t@gmail.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20220810150349.414043-1-utkarsh02t@gmail.com>",
        "References": "<20220810150349.414043-1-utkarsh02t@gmail.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v8 3/8] 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>\n---\nDifference from v7:\n\t1. Moved firstCameraSelect_ from 8/8 to here because if we were previously\n\t\tsupplied camera id on the cmdline we always used that and sdisabled the\n\t\tshowing of the dialog\n src/qcam/main_window.cpp | 51 ++++++++++++++++++++--------------------\n src/qcam/main_window.h   |  6 +++--\n 2 files changed, 30 insertions(+), 27 deletions(-)",
    "diff": "diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp\nindex 9ec94708..d1b8d2dd 100644\n--- a/src/qcam/main_window.cpp\n+++ b/src/qcam/main_window.cpp\n@@ -98,7 +98,8 @@ private:\n \n MainWindow::MainWindow(CameraManager *cm, const OptionsParser::Options &options)\n \t: saveRaw_(nullptr), cameraSelectorDialog_(nullptr), options_(options),\n-\t  cm_(cm), allocator_(nullptr), isCapturing_(false), captureRaw_(false)\n+\t  cm_(cm), allocator_(nullptr), isCapturing_(false), captureRaw_(false),\n+\t  firstCameraSelect_(true)\n {\n \tint ret;\n \n@@ -193,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@@ -260,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@@ -298,12 +300,17 @@ std::string MainWindow::chooseCamera()\n \t * Use the camera specified on the command line, if any, or display the\n \t * camera selection dialog box otherwise.\n \t */\n-\tif (options_.isSet(OptCamera))\n+\tif (firstCameraSelect_ && options_.isSet(OptCamera)) {\n+\t\tfirstCameraSelect_ = false;\n \t\treturn static_cast<std::string>(options_[OptCamera]);\n+\t}\n \n-\tif (cameraSelectorDialog_->exec() == QDialog::Accepted)\n-\t\treturn cameraSelectorDialog_->getCameraId();\n-\telse\n+\tif (cameraSelectorDialog_->exec() == QDialog::Accepted) {\n+\t\tstd::string cameraId = cameraSelectorDialog_->getCameraId();\n+\t\tcameraSelectButton_->setText(QString::fromStdString(cameraId));\n+\n+\t\treturn cameraId;\n+\t} else\n \t\treturn std::string();\n }\n \n@@ -327,8 +334,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@@ -592,22 +599,16 @@ void MainWindow::processHotplug(HotplugEvent *e)\n \tCamera *camera = e->camera();\n \tHotplugEvent::PlugEvent event = e->hotplugEvent();\n \n-\tif (event == HotplugEvent::HotPlug) {\n-\t\tcameraCombo_->addItem(QString::fromStdString(camera->id()));\n-\n+\tif (event == HotplugEvent::HotPlug)\n \t\tcameraSelectorDialog_->cameraAdded(camera);\n-\t} else if (event == HotplugEvent::HotUnplug) {\n+\telse if (event == HotplugEvent::HotUnplug) {\n \t\t/* Check if the currently-streaming camera is removed. */\n \t\tif (camera == camera_.get()) {\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(QString::fromStdString(camera->id()));\n-\t\tcameraCombo_->removeItem(camIndex);\n-\n \t\tcameraSelectorDialog_->cameraRemoved(camera);\n \t}\n }\ndiff --git a/src/qcam/main_window.h b/src/qcam/main_window.h\nindex 4ad5e6e9..f9ea8bd3 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@@ -116,6 +117,7 @@ private:\n \t/* Capture state, buffers queue and statistics */\n \tbool isCapturing_;\n \tbool captureRaw_;\n+\tbool firstCameraSelect_;\n \tlibcamera::Stream *vfStream_;\n \tlibcamera::Stream *rawStream_;\n \tstd::map<const libcamera::Stream *, QQueue<libcamera::FrameBuffer *>> freeBuffers_;\n",
    "prefixes": [
        "libcamera-devel",
        "v8",
        "3/8"
    ]
}