Show a patch.

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

{
    "id": 1618,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/1618/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/1618/",
    "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": "<20190704145942.17879-6-kieran.bingham@ideasonboard.com>",
    "date": "2019-07-04T14:59:41",
    "name": "[libcamera-devel,v4,5/6] qcam: Update window title with FPS",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "759d64ef746fbf8feeba6bc9af3e70432ef7c3ef",
    "submitter": {
        "id": 4,
        "url": "https://patchwork.libcamera.org/api/1.1/people/4/?format=api",
        "name": "Kieran Bingham",
        "email": "kieran.bingham@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/1618/mbox/",
    "series": [
        {
            "id": 405,
            "url": "https://patchwork.libcamera.org/api/1.1/series/405/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=405",
            "date": "2019-07-04T14:59:36",
            "name": "Automatic Version Generation ++",
            "version": 4,
            "mbox": "https://patchwork.libcamera.org/series/405/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/1618/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/1618/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<kieran.bingham@ideasonboard.com>",
        "Received": [
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id EF8946157B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  4 Jul 2019 16:59:47 +0200 (CEST)",
            "from localhost.localdomain\n\t(cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 7DC742AF;\n\tThu,  4 Jul 2019 16:59:47 +0200 (CEST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1562252387;\n\tbh=SmEDt2vdm7wf1fhUB5FuqYR9+6h5HD1FrHFWr5tWWjg=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=mePJG7yR4IRcwO+uKYnpvcvY17G7c+yo0bhJxQXayh8czyqKsOUcz/3mAV1elevAe\n\tAX6g9S9bsx6kOkw9O8Gca5s5U9F1UlMRSo9s4c7ZzUM4BtbdjKhFHg5Qnrqqlgb4m3\n\tUlYVaHJLFU9yGYDeSbo+2DhR1/p9bxJjlgWXKaHw=",
        "From": "Kieran Bingham <kieran.bingham@ideasonboard.com>",
        "To": "LibCamera Devel <libcamera-devel@lists.libcamera.org>",
        "Date": "Thu,  4 Jul 2019 15:59:41 +0100",
        "Message-Id": "<20190704145942.17879-6-kieran.bingham@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.20.1",
        "In-Reply-To": "<20190704145942.17879-1-kieran.bingham@ideasonboard.com>",
        "References": "<20190704145942.17879-1-kieran.bingham@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v4 5/6] qcam: Update window title with FPS",
        "X-BeenThere": "libcamera-devel@lists.libcamera.org",
        "X-Mailman-Version": "2.1.23",
        "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": "Thu, 04 Jul 2019 14:59:49 -0000"
    },
    "content": "Provide an average FPS in the QCam title bar to show the current rate of\nframe processing.\n\nThe QCam compilation is updated to process the QT MoC headers to support\nsignals and slots accordingly.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n---\nv4\n - Start and stop title timer with the stream\n---\n src/qcam/main_window.cpp | 23 +++++++++++++++++++++++\n src/qcam/main_window.h   | 15 +++++++++++++++\n src/qcam/meson.build     | 11 +++++++++--\n 3 files changed, 47 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp\nindex d61369109d66..5693b9256a08 100644\n--- a/src/qcam/main_window.cpp\n+++ b/src/qcam/main_window.cpp\n@@ -28,6 +28,7 @@ MainWindow::MainWindow(const OptionsParser::Options &options)\n \n \ttitle_ = \"QCam \" + QString::fromStdString(libcamera::version);\n \tsetWindowTitle(title_);\n+\tconnect(&titleTimer_, SIGNAL(timeout()), this, SLOT(updateTitle()));\n \n \tviewfinder_ = new ViewFinder(this);\n \tsetCentralWidget(viewfinder_);\n@@ -54,6 +55,19 @@ MainWindow::~MainWindow()\n \tCameraManager::instance()->stop();\n }\n \n+void MainWindow::updateTitle()\n+{\n+\tunsigned int duration = frameRateInterval_.elapsed();\n+\tunsigned int frames = framesCaptured_ - previousFrames_;\n+\tdouble fps = frames * 1000.0 / duration;\n+\n+\t/* Restart counters */\n+\tframeRateInterval_.start();\n+\tpreviousFrames_ = framesCaptured_;\n+\n+\tsetWindowTitle(title_ + \" : \" + QString::number(fps, 'f', 2) + \" fps\");\n+}\n+\n int MainWindow::openCamera()\n {\n \tCameraManager *cm = CameraManager::instance();\n@@ -148,6 +162,10 @@ int MainWindow::startCapture()\n \t\trequests.push_back(request);\n \t}\n \n+\ttitleTimer_.start(2000);\n+\tframeRateInterval_.start();\n+\tpreviousFrames_ = 0;\n+\tframesCaptured_ = 0;\n \tlastBufferTime_ = 0;\n \n \tret = camera_->start();\n@@ -188,6 +206,9 @@ void MainWindow::stopCapture()\n \tisCapturing_ = false;\n \n \tconfig_.reset();\n+\n+\ttitleTimer_.stop();\n+\tsetWindowTitle(title_);\n }\n \n void MainWindow::requestComplete(Request *request,\n@@ -196,6 +217,8 @@ void MainWindow::requestComplete(Request *request,\n \tif (request->status() == Request::RequestCancelled)\n \t\treturn;\n \n+\tframesCaptured_++;\n+\n \tBuffer *buffer = buffers.begin()->second;\n \n \tdouble fps = buffer->timestamp() - lastBufferTime_;\ndiff --git a/src/qcam/main_window.h b/src/qcam/main_window.h\nindex 46a494a9d783..e97d92402f1e 100644\n--- a/src/qcam/main_window.h\n+++ b/src/qcam/main_window.h\n@@ -10,7 +10,11 @@\n #include <map>\n #include <memory>\n \n+\n+#include <QElapsedTimer>\n #include <QMainWindow>\n+#include <QObject>\n+#include <QTimer>\n \n #include <libcamera/camera.h>\n #include <libcamera/stream.h>\n@@ -28,10 +32,15 @@ enum {\n \n class MainWindow : public QMainWindow\n {\n+\tQ_OBJECT\n+\n public:\n \tMainWindow(const OptionsParser::Options &options);\n \t~MainWindow();\n \n+public Q_SLOTS:\n+\tvoid updateTitle();\n+\n private:\n \tint openCamera();\n \n@@ -43,6 +52,8 @@ private:\n \tint display(Buffer *buffer);\n \n \tQString title_;\n+\tQTimer titleTimer_;\n+\n \tconst OptionsParser::Options &options_;\n \n \tstd::shared_ptr<Camera> camera_;\n@@ -51,6 +62,10 @@ private:\n \n \tuint64_t lastBufferTime_;\n \n+\tQElapsedTimer frameRateInterval_;\n+\tuint32_t previousFrames_;\n+\tuint32_t framesCaptured_;\n+\n \tViewFinder *viewfinder_;\n };\n \ndiff --git a/src/qcam/meson.build b/src/qcam/meson.build\nindex 9f1fa75f9813..21f91f25cec0 100644\n--- a/src/qcam/meson.build\n+++ b/src/qcam/meson.build\n@@ -7,14 +7,21 @@ qcam_sources = files([\n     'viewfinder.cpp',\n ])\n \n-import('qt5')\n+qcam_moc_headers = files([\n+    'main_window.h',\n+])\n+\n+qt5 = import('qt5')\n qt5_dep = dependency('qt5',\n                      method : 'pkg-config',\n                      modules : ['Core', 'Gui', 'Widgets'],\n                      required : false)\n \n if qt5_dep.found()\n-    qcam  = executable('qcam', qcam_sources,\n+    moc_files = qt5.preprocess(moc_headers: qcam_moc_headers,\n+                               dependencies: qt5_dep)\n+\n+    qcam  = executable('qcam', qcam_sources, moc_files,\n                        install : true,\n                        dependencies : [libcamera_dep, qt5_dep],\n                        cpp_args : '-DQT_NO_KEYWORDS')\n",
    "prefixes": [
        "libcamera-devel",
        "v4",
        "5/6"
    ]
}