Show a patch.

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

{
    "id": 12592,
    "url": "https://patchwork.libcamera.org/api/patches/12592/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/12592/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/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": "<20210614111110.33324-1-kieran.bingham@ideasonboard.com>",
    "date": "2021-06-14T11:11:10",
    "name": "[libcamera-devel,v2] qcam: viewfinder: Maintain aspect ratio",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "fbac307e3e92402716385719a95d5fafad6c0111",
    "submitter": {
        "id": 4,
        "url": "https://patchwork.libcamera.org/api/people/4/?format=api",
        "name": "Kieran Bingham",
        "email": "kieran.bingham@ideasonboard.com"
    },
    "delegate": {
        "id": 11,
        "url": "https://patchwork.libcamera.org/api/users/11/?format=api",
        "username": "kbingham",
        "first_name": "Kieran",
        "last_name": "Bingham",
        "email": "kieran.bingham@ideasonboard.com"
    },
    "mbox": "https://patchwork.libcamera.org/patch/12592/mbox/",
    "series": [
        {
            "id": 2131,
            "url": "https://patchwork.libcamera.org/api/series/2131/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2131",
            "date": "2021-06-14T11:11:10",
            "name": "[libcamera-devel,v2] qcam: viewfinder: Maintain aspect ratio",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/2131/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/12592/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/12592/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 7518FC3218\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 14 Jun 2021 11:11:16 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id EA8906892E;\n\tMon, 14 Jun 2021 13:11:15 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2C2266029D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 14 Jun 2021 13:11:15 +0200 (CEST)",
            "from Q.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net\n\t[86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 3FD62A59;\n\tMon, 14 Jun 2021 13:11:14 +0200 (CEST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"B8lOSLiM\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1623669074;\n\tbh=LHTzgC3SGcknbUsDYCtumc2BVJYbpYf0T7SnajkaIG4=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=B8lOSLiMpvJZnxx3zj75avcmqj4Bt6Ip9FBw0HGg0EcMkIeUCq83CPbwNgPxy1sRg\n\tInAt/TzACKXPnnAbQkJPD6M74nb2dkUiPVdUJTmssTqjdTF9m/t96gN6Ixw0UmFUfK\n\tOC1aesHTAxzMDLvNenkHbiJFMCk1r0UlgrDmVlKM=",
        "From": "Kieran Bingham <kieran.bingham@ideasonboard.com>",
        "To": "libcamera devel <libcamera-devel@lists.libcamera.org>",
        "Date": "Mon, 14 Jun 2021 12:11:10 +0100",
        "Message-Id": "<20210614111110.33324-1-kieran.bingham@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2] qcam: viewfinder: Maintain aspect ratio",
        "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>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Keep the image aspect ratio when displaying in the viewfinder.\n\nWhen the window is adjusted to a size that differs in aspect ratio to\nthe image, keep the image centered in the main viewpoint.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n\nv2: (fixed up from Laurent's review comments)\n\n - No longer accept event on an invalid size.\n - centering simplifed\n\n\n src/qcam/viewfinder_qt.cpp | 16 ++++++++++++++--\n src/qcam/viewfinder_qt.h   |  2 ++\n 2 files changed, 16 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/src/qcam/viewfinder_qt.cpp b/src/qcam/viewfinder_qt.cpp\nindex e436714c6bdb..08ac29e9fa99 100644\n--- a/src/qcam/viewfinder_qt.cpp\n+++ b/src/qcam/viewfinder_qt.cpp\n@@ -15,6 +15,7 @@\n #include <QMap>\n #include <QMutexLocker>\n #include <QPainter>\n+#include <QResizeEvent>\n #include <QtDebug>\n \n #include <libcamera/formats.h>\n@@ -34,7 +35,7 @@ static const QMap<libcamera::PixelFormat, QImage::Format> nativeFormats\n };\n \n ViewFinderQt::ViewFinderQt(QWidget *parent)\n-\t: QWidget(parent), buffer_(nullptr)\n+\t: QWidget(parent), place_(rect()), buffer_(nullptr)\n {\n \ticon_ = QIcon(\":camera-off.svg\");\n }\n@@ -146,7 +147,7 @@ void ViewFinderQt::paintEvent(QPaintEvent *)\n \n \t/* If we have an image, draw it. */\n \tif (!image_.isNull()) {\n-\t\tpainter.drawImage(rect(), image_, image_.rect());\n+\t\tpainter.drawImage(place_, image_, image_.rect());\n \t\treturn;\n \t}\n \n@@ -179,3 +180,14 @@ QSize ViewFinderQt::sizeHint() const\n {\n \treturn size_.isValid() ? size_ : QSize(640, 480);\n }\n+\n+void ViewFinderQt::resizeEvent(QResizeEvent *event)\n+{\n+\tif (!size_.isValid())\n+\t\treturn;\n+\n+\tplace_.setSize(size_.scaled(event->size(), Qt::KeepAspectRatio));\n+\tplace_.moveCenter(rect().center());\n+\n+\tevent->accept();\n+}\ndiff --git a/src/qcam/viewfinder_qt.h b/src/qcam/viewfinder_qt.h\nindex d755428887c0..bf31b81b3437 100644\n--- a/src/qcam/viewfinder_qt.h\n+++ b/src/qcam/viewfinder_qt.h\n@@ -42,6 +42,7 @@ Q_SIGNALS:\n \n protected:\n \tvoid paintEvent(QPaintEvent *) override;\n+\tvoid resizeEvent(QResizeEvent *) override;\n \tQSize sizeHint() const override;\n \n private:\n@@ -49,6 +50,7 @@ private:\n \n \tlibcamera::PixelFormat format_;\n \tQSize size_;\n+\tQRect place_;\n \n \t/* Camera stopped icon */\n \tQSize vfSize_;\n",
    "prefixes": [
        "libcamera-devel",
        "v2"
    ]
}