Patch Detail
Show a patch.
GET /api/1.1/patches/16959/?format=api
{ "id": 16959, "url": "https://patchwork.libcamera.org/api/1.1/patches/16959/?format=api", "web_url": "https://patchwork.libcamera.org/patch/16959/", "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-5-utkarsh02t@gmail.com>", "date": "2022-08-03T17:55:17", "name": "[libcamera-devel,4/4] qcam: MainWindow: Replace cameraCombo_ with cameraSelectDialog", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "da82ba002aa957e41ed9b93f71b642f3d5e31223", "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/16959/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/16959/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/16959/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 7978DC3272\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 3 Aug 2022 17:55:35 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 317BE63321;\n\tWed, 3 Aug 2022 19:55:35 +0200 (CEST)", "from mail-pg1-x533.google.com (mail-pg1-x533.google.com\n\t[IPv6:2607:f8b0:4864:20::533])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E06586331E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 3 Aug 2022 19:55:32 +0200 (CEST)", "by mail-pg1-x533.google.com with SMTP id 13so1333932pgc.8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 03 Aug 2022 10:55:32 -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.29\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 03 Aug 2022 10:55:30 -0700 (PDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1659549335;\n\tbh=xdyTipN04m4FOCC8IhJVcDGM5cq7LQ8at0Jd+ICqVrg=;\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=gm+PtUJ7aHD5lTw9qW17XTV01Y1dsWRGWSCSXxa4vIhWHhFZHnxNkDMiMRQ6mjish\n\tXD34LcJ9d1gxW7fSD9+h3f6fzqjk/zTjgJ0WVvvZ4InRrB8dtjNdmhMPzVHrK+Ol9B\n\t3PMvUeIni6wVKUK5ixud5j/4onHvaWNbcGK9aMaDr7pEUfTBJXeggtiH3wQ5cf0hCE\n\tGVxEfjc+6P1y/t1/WtIaOmhpY5edcN7mhilIrgcjww1alWzKEksw43pE/1qn+qIPcb\n\t3lGFejQORPh5tCIsjVHEEB2btiBf7J8UDYZ1iA1CTu9BhM/FQ2KB6Ne4YqDNsq10QA\n\tk+2SGmvRFZpCA==", "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=zTPzlmBu9WrbT3szxYMLbFPUmXMs8/t6CORexb8HThk=;\n\tb=aL0D0F39Gk4HZnCAbvq6I+WIPj37ffbOKxoVJCC6du8J8ua+lmKP3sngF5a5saqSLh\n\tnCMFRT9hD4hwToakL62+hHgLjkIPH9gpMk3mWNeGNop/PbzzTAt7m1DMeNLDMqDNW5Qu\n\tIMvKjYUjp1JS+xOJuDP+BzlY+7Q+XjM6u5A3zILiI0mV+JTZj7FT3iiPOe0BsaDInxac\n\t2Y66yRrX5JCnnwe2MBcWnufCtTpjFdRi0bY1mkHa3EF+mku3GmM7In4Sg22yX0e6mY0Y\n\tf1leiMCFutgQeEBL2IcVpodS6oYIYBNgHvjTafPeW6g9L9yQIYJsXIeF92ZFN7lhGT5d\n\tMx5g==" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"aL0D0F39\"; 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=zTPzlmBu9WrbT3szxYMLbFPUmXMs8/t6CORexb8HThk=;\n\tb=nKtCxDrir/NXri9YCqiD1uh4q+o2OBFo2wWafKvA7PhbyL6fLUS6++D6bFKJpCK3Cv\n\tUvwe6Mx8ZFDumaqED3xDlOjrddY2XoJunrlITwhW7mR3IyOFVdVKDJw8C3ZqWaenTMjP\n\tAtZVNXbXqJzzMleUFnqOkMb6tgvI8bk1Bl7pj0OERk3Umn2O8d6CBni/3xfUVunNLTom\n\tVLC/8xN7nDQuSARAdlzpQWx2S3kS4iyewWkwMjctR8cQD99H4XhsKaIYB8nw0z4EJpRI\n\tM58iBwjE47BFoVTkzNAE1Ed0C4nsD6tTJroQCy57zoSTOtrUtwBsgbT2zzOyI9DYtfYT\n\t5AZg==", "X-Gm-Message-State": "AJIora9T09LtYG34Fk/QTFjwtBoNeTvse2QygMQNmFDm3IwjtCgrUmJ7\n\tTeJaAcvZmaWEi0Iv76qwQzDLHSZxYzY=", "X-Google-Smtp-Source": "AGRyM1vRZsqdPS4tLIaAmb+MvvK0trf5ARIpltTzohntCcU6U/lgmhxjrFXAvyLqlNzXGdcAYfSdBQ==", "X-Received": "by 2002:a63:4c4d:0:b0:41a:a125:60c9 with SMTP id\n\tm13-20020a634c4d000000b0041aa12560c9mr21780249pgl.329.1659549331193; \n\tWed, 03 Aug 2022 10:55:31 -0700 (PDT)", "To": "libcamera-devel@lists.libcamera.org", "Date": "Wed, 3 Aug 2022 23:25:17 +0530", "Message-Id": "<20220803175517.175332-5-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 4/4] qcam: MainWindow: Replace\n\tcameraCombo_ with cameraSelectDialog", "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 cameraSelectDialog. 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>\n---\n src/qcam/main_window.cpp | 47 ++++++++++++++++++++++------------------\n src/qcam/main_window.h | 5 +++--\n 2 files changed, 29 insertions(+), 23 deletions(-)", "diff": "diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp\nindex 81fa3e60..2a9dcc1e 100644\n--- a/src/qcam/main_window.cpp\n+++ b/src/qcam/main_window.cpp\n@@ -198,14 +198,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@@ -265,14 +262,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 cameraId = chooseCamera();\n+\tif (cameraId.empty())\n \t\treturn;\n \n-\tconst std::shared_ptr<Camera> &cam = cameras[index];\n+\t/* Don't try the current camera. */\n+\tif (cameraId == camera_->id())\n+\t\treturn;\n+\n+\tconst std::shared_ptr<Camera> &cam = cm_->get(cameraId);\n \n \tif (cam->acquire()) {\n \t\tqInfo() << \"Failed to acquire camera\" << cam->id().c_str();\n@@ -290,6 +291,9 @@ void MainWindow::switchCamera(int index)\n \tcamera_->release();\n \tcamera_ = cam;\n \n+\t/* Set the QPushButton text with current camera. */\n+\tcameraSelectButton_->setText(QString::fromStdString(camera_->id()));\n+\n \tstartStopAction_->setChecked(true);\n }\n \n@@ -356,10 +360,16 @@ std::string MainWindow::chooseCamera()\n \t * When the Qdialog starts, the QComboBox would have the first\n \t * camera's Id as its currentText.\n \t */\n-\tif (cm_->cameras().size())\n-\t\tcurrentCamera = cm_->cameras()[0];\n-\telse\n-\t\tcurrentCamera = nullptr;\n+\tif (!isCapturing_) {\n+\t\tif (cm_->cameras().size())\n+\t\t\tcurrentCamera = cm_->cameras()[0];\n+\t\telse\n+\t\t\tcurrentCamera = nullptr;\n+\t} else {\n+\t\tint cameraIndex = cameraIdComboBox_->findText(QString::fromStdString(camera_->id()));\n+\t\tcameraIdComboBox_->setCurrentIndex(cameraIndex);\n+\t\tcurrentCamera = camera_;\n+\t}\n \n \tif (currentCamera)\n \t\tupdateCameraInfo(currentCamera);\n@@ -428,8 +438,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 QPushButton text with the currently selected Camera. */\n+\tcameraSelectButton_->setText(QString::fromStdString(cameraName));\n \n \treturn 0;\n }\n@@ -695,7 +705,6 @@ void MainWindow::processHotplug(HotplugEvent *e)\n \n \tif (event == HotplugEvent::HotPlug) {\n \t\tQString cameraId = QString::fromStdString(camera->id());\n-\t\tcameraCombo_->addItem(cameraId);\n \n \t\t/* Update cameraIdCombox_ to include the new camera. */\n \t\tif (cameraIdComboBox_)\n@@ -706,16 +715,12 @@ void MainWindow::processHotplug(HotplugEvent *e)\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\tif (cameraIdComboBox_) {\n \t\t\tint cameraIdIndex = cameraIdComboBox_->findText(QString::fromStdString(camera_->id()));\n \t\t\tcameraIdComboBox_->removeItem(cameraIdIndex);\n \t\t}\n-\n-\t\tint camIndex = cameraCombo_->findText(QString::fromStdString(camera->id()));\n-\t\tcameraCombo_->removeItem(camIndex);\n \t}\n }\n \ndiff --git a/src/qcam/main_window.h b/src/qcam/main_window.h\nindex 3a1c6156..b15f9409 100644\n--- a/src/qcam/main_window.h\n+++ b/src/qcam/main_window.h\n@@ -25,6 +25,7 @@\n #include <QMutex>\n #include <QObject>\n #include <QPointer>\n+#include <QPushButton>\n #include <QQueue>\n #include <QStringList>\n #include <QTimer>\n@@ -62,7 +63,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@@ -96,7 +97,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", "prefixes": [ "libcamera-devel", "4/4" ] }