Show a patch.

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

{
    "id": 3249,
    "url": "https://patchwork.libcamera.org/api/patches/3249/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/3249/",
    "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": "<20200323142205.28342-7-laurent.pinchart@ideasonboard.com>",
    "date": "2020-03-23T14:21:50",
    "name": "[libcamera-devel,06/21] qcam: main_window: Replace start and stop actions with a toggle action",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "013ade4c24f0426034beb94a2c66a51d4017aa19",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/3249/mbox/",
    "series": [
        {
            "id": 760,
            "url": "https://patchwork.libcamera.org/api/series/760/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=760",
            "date": "2020-03-23T14:21:44",
            "name": "qcam: Bypass format conversion when not required",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/760/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/3249/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/3249/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<laurent.pinchart@ideasonboard.com>",
        "Received": [
            "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 8684862C48\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 23 Mar 2020 15:22:20 +0100 (CET)",
            "from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 08505308\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 23 Mar 2020 15:22:19 +0100 (CET)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1584973340;\n\tbh=eW09ti/wOhxVQFXKOBaWJE47HHMZe5xlSLIBrHdwJ54=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=bk2E/Pt2chfQhtaqlLvos5gXMF9U77P2wW+ijU3Fjghs5yGVqmSvAX7FbgD3IV3VP\n\tfozMLV0wAYlbsULOj9JC60Z3XLLj/Sv0qvg3mYIx1Jnv5uyzNU5aFSLEBbFAFLFCjv\n\tY4IQBCRBzxTcx6K9HHDD7pJso1Aess+PFi+PnJ2k=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon, 23 Mar 2020 16:21:50 +0200",
        "Message-Id": "<20200323142205.28342-7-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.24.1",
        "In-Reply-To": "<20200323142205.28342-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20200323142205.28342-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 06/21] qcam: main_window: Replace start\n\tand stop actions with a toggle 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>",
        "X-List-Received-Date": "Mon, 23 Mar 2020 14:22:24 -0000"
    },
    "content": "The main window toolbar contains a start button and a stop button. This\nallows starting an already started camera (which is currently not\nhandled and results in an error) or stopping an already stopped camera.\nReplace the two actions with a single start/stop toggle action,\npreventing UI misuse and reducing confusion.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/qcam/main_window.cpp | 30 ++++++++++++++++++++----------\n src/qcam/main_window.h   |  9 ++++++---\n 2 files changed, 26 insertions(+), 13 deletions(-)",
    "diff": "diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp\nindex afd8b9c413f5..86f92360a1a9 100644\n--- a/src/qcam/main_window.cpp\n+++ b/src/qcam/main_window.cpp\n@@ -63,11 +63,10 @@ MainWindow::MainWindow(CameraManager *cm, const OptionsParser::Options &options)\n \tadjustSize();\n \n \tret = openCamera();\n-\tif (!ret)\n-\t\tret = startCapture();\n-\n \tif (ret < 0)\n \t\tquit();\n+\n+\tstartStopAction_->setChecked(true);\n }\n \n MainWindow::~MainWindow()\n@@ -113,11 +112,10 @@ int MainWindow::createToolbars()\n \n \ttoolbar_->addSeparator();\n \n-\taction = toolbar_->addAction(QIcon(\":play-circle.svg\"), \"start\");\n-\tconnect(action, &QAction::triggered, this, &MainWindow::startCapture);\n-\n-\taction = toolbar_->addAction(QIcon(\":stop-circle.svg\"), \"stop\");\n-\tconnect(action, &QAction::triggered, this, &MainWindow::stopCapture);\n+\taction = toolbar_->addAction(QIcon(\":play-circle.svg\"), \"Start Capture\");\n+\taction->setCheckable(true);\n+\tconnect(action, &QAction::toggled, this, &MainWindow::toggleCapture);\n+\tstartStopAction_ = action;\n \n \taction = toolbar_->addAction(QIcon(\":save.svg\"), \"saveAs\");\n \tconnect(action, &QAction::triggered, this, &MainWindow::saveImageAs);\n@@ -159,12 +157,12 @@ void MainWindow::switchCamera(int index)\n \n \tstd::cout << \"Switching to camera \" << cam->name() << std::endl;\n \n-\tstopCapture();\n+\tstartStopAction_->setChecked(false);\n \n \tcamera_->release();\n \tcamera_ = cam;\n \n-\tstartCapture();\n+\tstartStopAction_->setChecked(true);\n }\n \n std::string MainWindow::chooseCamera()\n@@ -217,6 +215,17 @@ int MainWindow::openCamera()\n \treturn 0;\n }\n \n+void MainWindow::toggleCapture(bool start)\n+{\n+\tif (start) {\n+\t\tstartCapture();\n+\t\tstartStopAction_->setText(\"Stop Capture\");\n+\t} else {\n+\t\tstopCapture();\n+\t\tstartStopAction_->setText(\"Start Capture\");\n+\t}\n+}\n+\n int MainWindow::startCapture()\n {\n \tint ret;\n@@ -322,6 +331,7 @@ int MainWindow::startCapture()\n \t}\n \n \tisCapturing_ = true;\n+\n \treturn 0;\n \n error_disconnect:\ndiff --git a/src/qcam/main_window.h b/src/qcam/main_window.h\nindex c623120d5894..3d8d02b44696 100644\n--- a/src/qcam/main_window.h\n+++ b/src/qcam/main_window.h\n@@ -26,6 +26,7 @@\n \n using namespace libcamera;\n \n+class QAction;\n class ViewFinder;\n \n enum {\n@@ -49,9 +50,7 @@ private Q_SLOTS:\n \tvoid updateTitle();\n \n \tvoid switchCamera(int index);\n-\n-\tint startCapture();\n-\tvoid stopCapture();\n+\tvoid toggleCapture(bool start);\n \n \tvoid saveImageAs();\n \n@@ -60,6 +59,9 @@ private:\n \tstd::string chooseCamera();\n \tint openCamera();\n \n+\tint startCapture();\n+\tvoid stopCapture();\n+\n \tvoid requestComplete(Request *request);\n \tvoid processCapture();\n \tint display(FrameBuffer *buffer);\n@@ -87,6 +89,7 @@ private:\n \tQQueue<FrameBuffer *> doneQueue_;\n \n \tQToolBar *toolbar_;\n+\tQAction *startStopAction_;\n \tViewFinder *viewfinder_;\n \tstd::map<int, std::pair<void *, unsigned int>> mappedBuffers_;\n };\n",
    "prefixes": [
        "libcamera-devel",
        "06/21"
    ]
}