Show a patch.

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

{
    "id": 16956,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/16956/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/16956/",
    "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": "<20220803175517.175332-2-utkarsh02t@gmail.com>",
    "date": "2022-08-03T17:55:14",
    "name": "[libcamera-devel,1/4] qcam: Use QDialog for selection of cameras",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "beba1e69413470968767289abac8a934570516ab",
    "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/16956/mbox/",
    "series": [
        {
            "id": 3370,
            "url": "https://patchwork.libcamera.org/api/1.1/series/3370/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3370",
            "date": "2022-08-03T17:55:13",
            "name": "Improve Camera Selection GUI in QCam",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/3370/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/16956/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/16956/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 2FF02C3272\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  3 Aug 2022 17:55:30 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D6AAA6330F;\n\tWed,  3 Aug 2022 19:55:29 +0200 (CEST)",
            "from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com\n\t[IPv6:2607:f8b0:4864:20::1035])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A5E9D63314\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  3 Aug 2022 19:55:27 +0200 (CEST)",
            "by mail-pj1-x1035.google.com with SMTP id\n\tp14-20020a17090a74ce00b001f4d04492faso2901617pjl.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 03 Aug 2022 10:55:27 -0700 (PDT)",
            "from localhost.localdomain ([2404:bd00:3:d5b8:ad21:c99c:170f:1ae])\n\tby smtp.gmail.com with ESMTPSA id\n\tf3-20020a170902860300b0016357fd0fd1sm2193343plo.69.2022.08.03.10.55.24\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 03 Aug 2022 10:55:25 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1659549329;\n\tbh=Zk7ObCaikQB0Rr/hkHevWBkMzOIDVn8qxqSX+MzNb+g=;\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=t9b0exwnBGKBHwv21mAFmTtqr4Qkf/vM16X0+HEIoDfWZ+uH5Ya7JQpXNSc8ktpXU\n\tO4Ockhd/zfjtgZTCa98u/0NfDK03cjz4RTHK2xy7P+ASGo4fZqdDAbDHPhFKUcDxHi\n\tUc9r0z2wBzq2APNhuPbkWJ7ffuFKBrvecNI8vvVRVjPAG+7VpGL0gqMgfGyWLHOgLu\n\tk9I2vqKxFhoj+KtzE/zcwNRlBynft9+TknwOrmuvuTv/SA4APEYUd6UqYyl2dRNBLH\n\t6+fTiYZ8c/2+2T/1R6nD0u8+kaVO9JV0Et2+AQ7Lx6UKaXNe2KfEz4JICqXxaxVTzD\n\tXuOPvQ5VhxsvA==",
            "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=IW+h5cRdAHnoLrIKdaIkEIUEf3/NheN/VmD+zgCaZpE=;\n\tb=Up5ZLgn9kJJ7hyCLjksXktJZzXDvzONCbUyqxhPtz8R7qe7FdQKmSAfGxLBZXZ6NwN\n\tKAQfzfZZNdIBYuDVlkjTsF7NgHwyARDKHPV9lqYMkGhmhw90trT+U4S01VMNTO+Cq9bi\n\t+Oi6Roa6324P6+gxmmHwZsnVGqw2X31hRy5DKaUavry+hAEFvDxhPNM+TretpbNE2TRo\n\tjqdLmondGTftQLXxFLGG5huQz/AEiz2tQ79Z9UN04Artvs4cmcHfddfJfIalEogulw3u\n\tn6+fcYw7yR2TSSXg2xiyP/9UWkQWFWm1G/W23Dam/sFKLWSNU2xuIy5lvJj4uiA8wYiZ\n\t3ZKg=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"Up5ZLgn9\"; 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=IW+h5cRdAHnoLrIKdaIkEIUEf3/NheN/VmD+zgCaZpE=;\n\tb=0m3W3Pdv3KA0zMqBQxQiBwM2jHpUkJjNytRrPaIipPTsIjE56rOcsfSGycET5RLIYd\n\tuL+k05zluZhL0wcBzhxAyFU6gY9b1KLhVzul36OFLYV6xGWjwSCnJbM8111641joYz7J\n\tubGc3V7iBAIc/JxHfZ7WpWS7GpGU4fih/8xyHO0h6oJXBcnKw1x6DfmmigApxVDnkWv7\n\tyfQYlo+apXoeMe2Dx3YohsZIaY9y81BOHC1XDLCnYP5Mg6nAvu4CIO1bHi8IE/2qluLY\n\tMXRR8ZegHifcXPgbbOrRfqJtzUPZQuY50M8YNKgYrqoJzRuNmhQ2TrmvQcNXEFEu7pyu\n\tzDMw==",
        "X-Gm-Message-State": "ACgBeo3L6N4xCYcVYWA0w14pju335qv8AICldDUEy85qsNOrFvkbTgqs\n\teaH3ZtsxGZBGsB3Ca5q5xRPMTeGDoz4=",
        "X-Google-Smtp-Source": "AA6agR5liS4sUwTq0tDRCmHVoIFReUGJ8mT10ZsLhd8Qf/DDItBmD6LokdNgH9cus8/Sns6f93LJkQ==",
        "X-Received": "by 2002:a17:902:b605:b0:16d:3497:775d with SMTP id\n\tb5-20020a170902b60500b0016d3497775dmr27254994pls.1.1659549325916; \n\tWed, 03 Aug 2022 10:55:25 -0700 (PDT)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Wed,  3 Aug 2022 23:25:14 +0530",
        "Message-Id": "<20220803175517.175332-2-utkarsh02t@gmail.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20220803175517.175332-1-utkarsh02t@gmail.com>",
        "References": "<20220803175517.175332-1-utkarsh02t@gmail.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 1/4] qcam: Use QDialog for selection of\n\tcameras",
        "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": "Currently we use QInputDialog convenience dialogs to allow the user to\nselect a camera. This doesn't allow adding of more information (such as\ncamera location, model etc).\n\nCreate a QDialog with a QFormLayout that shows a QComboBox with camera\nIds. Use a QButtonBox to provide buttons for accepting and cancelling the\naction.\n\nSigned-off-by: Utkarsh Tiwari <utkarsh02t@gmail.com>\n---\n src/qcam/main_window.cpp | 47 ++++++++++++++++++++++++++++++----------\n 1 file changed, 35 insertions(+), 12 deletions(-)",
    "diff": "diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp\nindex 7433d647..7761a6c6 100644\n--- a/src/qcam/main_window.cpp\n+++ b/src/qcam/main_window.cpp\n@@ -16,7 +16,10 @@\n \n #include <QComboBox>\n #include <QCoreApplication>\n+#include <QDialog>\n+#include <QDialogButtonBox>\n #include <QFileDialog>\n+#include <QFormLayout>\n #include <QImage>\n #include <QImageWriter>\n #include <QInputDialog>\n@@ -291,23 +294,43 @@ void MainWindow::switchCamera(int index)\n std::string MainWindow::chooseCamera()\n {\n \tQStringList cameras;\n-\tbool result;\n-\n-\t/* If only one camera is available, use it automatically. */\n-\tif (cm_->cameras().size() == 1)\n-\t\treturn cm_->cameras()[0]->id();\n+\tstd::string result;\n \n \t/* Present a dialog box to pick a camera. */\n+\tQDialog *cameraSelectDialog = new QDialog(this);\n+\n+\t/* Setup a QComboBox to display camera Ids. */\n \tfor (const std::shared_ptr<Camera> &cam : cm_->cameras())\n-\t\tcameras.append(QString::fromStdString(cam->id()));\n+\t\tcameras.push_back(QString::fromStdString(cam->id()));\n+\n+\tQComboBox *cameraIdComboBox = new QComboBox;\n+\tcameraIdComboBox->addItems(cameras);\n+\n+\t/* Setup QDialogButtonBox. */\n+\tQDialogButtonBox *dialogButtonBox = new QDialogButtonBox;\n+\tdialogButtonBox->addButton(QDialogButtonBox::Cancel);\n+\tdialogButtonBox->addButton(QDialogButtonBox::Ok);\n+\n+\tconnect(dialogButtonBox, &QDialogButtonBox::accepted,\n+\t\tthis, [&]() {\n+\t\t\tresult = cameraIdComboBox->currentText().toStdString();\n+\t\t\tcameraSelectDialog->accept();\n+\t\t});\n+\n+\tconnect(dialogButtonBox, &QDialogButtonBox::rejected,\n+\t\tthis, [&]() {\n+\t\t\tresult = std::string();\n+\t\t\tcameraSelectDialog->reject();\n+\t\t});\n+\n+\t/* Setup the layout for the dialog. */\n+\tQFormLayout *cameraSelectLayout = new QFormLayout(cameraSelectDialog);\n+\tcameraSelectLayout->addRow(\"Camera: \", cameraIdComboBox);\n+\tcameraSelectLayout->addWidget(dialogButtonBox);\n \n-\tQString id = QInputDialog::getItem(this, \"Select Camera\",\n-\t\t\t\t\t   \"Camera:\", cameras, 0,\n-\t\t\t\t\t   false, &result);\n-\tif (!result)\n-\t\treturn std::string();\n+\tcameraSelectDialog->exec();\n \n-\treturn id.toStdString();\n+\treturn result;\n }\n \n int MainWindow::openCamera()\n",
    "prefixes": [
        "libcamera-devel",
        "1/4"
    ]
}