Patch Detail
Show a patch.
GET /api/1.1/patches/16996/?format=api
{ "id": 16996, "url": "https://patchwork.libcamera.org/api/1.1/patches/16996/?format=api", "web_url": "https://patchwork.libcamera.org/patch/16996/", "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": "<20220806190433.59128-4-utkarsh02t@gmail.com>", "date": "2022-08-06T19:04:32", "name": "[libcamera-devel,v2,3/4] qcam: MainWindow: Replace cameraCombo_ with camSelectDialog", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "0d85f99fba0487dc6e901c4946e1516ef2cf4c2e", "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/16996/mbox/", "series": [ { "id": 3379, "url": "https://patchwork.libcamera.org/api/1.1/series/3379/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3379", "date": "2022-08-06T19:04:29", "name": "Improve Camera Selection GUI in QCam", "version": 2, "mbox": "https://patchwork.libcamera.org/series/3379/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/16996/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/16996/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 7E58DC3275\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 6 Aug 2022 19:04:58 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3722B63334;\n\tSat, 6 Aug 2022 21:04:58 +0200 (CEST)", "from mail-pf1-x433.google.com (mail-pf1-x433.google.com\n\t[IPv6:2607:f8b0:4864:20::433])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 019EC63332\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 6 Aug 2022 21:04:57 +0200 (CEST)", "by mail-pf1-x433.google.com with SMTP id g12so4939202pfb.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 06 Aug 2022 12:04:56 -0700 (PDT)", "from localhost.localdomain ([2404:bd00:3:daa9:adf3:a099:1bff:e55])\n\tby smtp.gmail.com with ESMTPSA id\n\tz17-20020aa79911000000b0052f20d70845sm406025pff.150.2022.08.06.12.04.53\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tSat, 06 Aug 2022 12:04:55 -0700 (PDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1659812698;\n\tbh=1b7MXtW5af+YTtPbczKoGvLv5lK9dyRdeyIxNcHbMF8=;\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=kPho5X8sdDSqPKLzI/4DuQm/2WSYfCQLEfezJHmOcAi2Bhw1us2YYWHq3PVHXCAQK\n\tZpMADuowG1UJTOEij6JZ1b0NiW1GZktAGSRIbyPLaddenqyagxdiY/M6/H4R1qN27V\n\t8Go5BhKUcvfVwliXRNpVpXSOyy7XAlP83Z8D0kUnX+QU2PzAFIJDVg/m3BXinPd3dR\n\t3Qde28aKziXKuhe8z2uf/AmIgPKZ16jks7PkZ3FmOlfF4zmLpApyXC0kYoGCHmpDXm\n\tezNLwdpVXIOa3WTjaoY8R76P5RajyXZ9PoRDPbguVUA7SuY/skR//HyjCmbYkj3sN5\n\tv2B70ZqZsNfYw==", "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=IorJXIXuqkipodRbivrzwNMOGa86T9Mi2AbdLW61dK4=;\n\tb=eRfHG5D99ikmBAeneHBsF8AMeC/BzF9btSdZZMwEPpyH2YoJUVGosp7iXfadk3MXfE\n\tXDZAH2MnEN0rwEZQulzYuNPDnFp0wLqnc2OIXIfAyv9iTSeCY5eJuffI97dE0b3d7KBh\n\t827T8A0I21GdEDY4S7nZU4WJobLUzuglBsYfuFHWPXknODaR+5TRxGjpaePHcbtuA6Xs\n\tuvVm0umUxLGTl9IINSbhDFRVpiDAfRiw5Y3XccD2jZ/KrrWU8ByT7JDfg64IDbnfQkSl\n\t4paK0paRdFv/EruB5y89TgLpb29JhAYwL9HNNcy/GIiLUf5FPEWqa1ba78G3vjCX07X+\n\t9nGQ==" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"eRfHG5D9\"; 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=IorJXIXuqkipodRbivrzwNMOGa86T9Mi2AbdLW61dK4=;\n\tb=XJH5NaZPV9cse85QHOAGif8heaURuh/GfCzuiIfN18NzFiEafA8kVyGYPfgqutNGHm\n\tAmTi37mu0tJ+tn3UX8hmUXBqfxjEYEcte4c0ldLU0FyBbUQv6y1SOJoe6ysGr7Vje3Nw\n\tXti86z0ekT7fq9OJAbbRMznXdzInDD3k2sF5bJPak0lG+ImTkLcQ+6P2gSJqQtbiJEYK\n\trOMu9M+NfeN1igDHt2honfTKVFRIUZrnxvlTO2ZYmYZBvUR7UdWsc7y4j6UH3FNIRT0v\n\tvNMbrlZPQZ/Sz4sFf4hIchS/ksakxOycxmQCm8jnBU5TPN9reX+bJwL4Nekisy/fnzEg\n\taDqg==", "X-Gm-Message-State": "ACgBeo0Gfn3tFmFun7G2VDYiyTfOGCohGmkUb/PN/U5QWegPa6H3rMOC\n\tfFyplPL9tjUYbFWVxCt4GtQdRQjTDh4=", "X-Google-Smtp-Source": "AA6agR5unG3EzC8Za68zqSMs1ZotbqwApRBG+VqiMNf6+IbjMLP57q/oI0oYv+K/+jvUpHcXkL930A==", "X-Received": "by 2002:aa7:87d8:0:b0:52e:ba7a:7fc0 with SMTP id\n\ti24-20020aa787d8000000b0052eba7a7fc0mr8489716pfo.46.1659812695371; \n\tSat, 06 Aug 2022 12:04:55 -0700 (PDT)", "To": "libcamera-devel@lists.libcamera.org", "Date": "Sun, 7 Aug 2022 00:34:32 +0530", "Message-Id": "<20220806190433.59128-4-utkarsh02t@gmail.com>", "X-Mailer": "git-send-email 2.25.1", "In-Reply-To": "<20220806190433.59128-1-utkarsh02t@gmail.com>", "References": "<20220806190433.59128-1-utkarsh02t@gmail.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v2 3/4] qcam: MainWindow: Replace\n\tcameraCombo_ with camSelectDialog", "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 camSelectDialog. 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/cam_select_dialog.h | 5 +++++\n src/qcam/main_window.cpp | 41 ++++++++++++++++++------------------\n src/qcam/main_window.h | 5 +++--\n 3 files changed, 28 insertions(+), 23 deletions(-)", "diff": "diff --git a/src/qcam/cam_select_dialog.h b/src/qcam/cam_select_dialog.h\nindex ee65eb88..a5189ec3 100644\n--- a/src/qcam/cam_select_dialog.h\n+++ b/src/qcam/cam_select_dialog.h\n@@ -56,6 +56,11 @@ public:\n \t\treturn cameraIdComboBox_->currentText().toStdString();\n \t}\n \n+\tstd::string getCurrentCamera()\n+\t{\n+\t\treturn cameraIdComboBox_->currentText().toStdString();\n+\t}\n+\n \t/* Hotplug / Unplug Support. */\n \tvoid cameraAdded(libcamera::Camera *camera)\n \t{\ndiff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp\nindex dd30817d..98c22b71 100644\n--- a/src/qcam/main_window.cpp\n+++ b/src/qcam/main_window.cpp\n@@ -193,14 +193,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+\tcameraSwitchButton_ = new QPushButton;\n+\tconnect(cameraSwitchButton_, &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(cameraSwitchButton_);\n \n \ttoolbar_->addSeparator();\n \n@@ -260,14 +257,19 @@ 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 newCameraId = chooseCamera();\n+\n+\tif (newCameraId.empty())\n \t\treturn;\n \n-\tconst std::shared_ptr<Camera> &cam = cameras[index];\n+\tif (camera_) {\n+\t\tif (newCameraId == camera_->id())\n+\t\t\treturn;\n+\t}\n+\tconst std::shared_ptr<Camera> &cam = cm_->get(newCameraId);\n \n \tif (cam->acquire()) {\n \t\tqInfo() << \"Failed to acquire camera\" << cam->id().c_str();\n@@ -292,9 +294,12 @@ std::string MainWindow::chooseCamera()\n {\n \tcamSelectDialog_ = new CamSelectDialog(cm_, this);\n \n-\tif (camSelectDialog_->exec() == QDialog::Accepted)\n-\t\treturn camSelectDialog_->getCameraId();\n-\telse\n+\tif (camSelectDialog_->exec() == QDialog::Accepted) {\n+\t\tstd::string cameraId = camSelectDialog_->getCameraId();\n+\t\tcameraSwitchButton_->setText(QString::fromStdString(cameraId));\n+\n+\t\treturn cameraId;\n+\t} else\n \t\treturn std::string();\n }\n \n@@ -327,8 +332,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 camera switch button with the currently selected Camera id. */\n+\tcameraSwitchButton_->setText(QString::fromStdString(cameraName));\n \n \treturn 0;\n }\n@@ -593,8 +598,6 @@ void MainWindow::processHotplug(HotplugEvent *e)\n \tHotplugEvent::PlugEvent event = e->hotplugEvent();\n \n \tif (event == HotplugEvent::HotPlug) {\n-\t\tcameraCombo_->addItem(QString::fromStdString(camera->id()));\n-\n \t\tif (camSelectDialog_)\n \t\t\tcamSelectDialog_->cameraAdded(camera);\n \t} else if (event == HotplugEvent::HotUnplug) {\n@@ -603,12 +606,8 @@ 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\tint camIndex = cameraCombo_->findText(QString::fromStdString(camera->id()));\n-\t\tcameraCombo_->removeItem(camIndex);\n-\n \t\tif (camSelectDialog_)\n \t\t\tcamSelectDialog_->cameraRemoved(camera);\n \t}\ndiff --git a/src/qcam/main_window.h b/src/qcam/main_window.h\nindex 6d80b5be..fe0f5938 100644\n--- a/src/qcam/main_window.h\n+++ b/src/qcam/main_window.h\n@@ -24,6 +24,7 @@\n #include <QMutex>\n #include <QObject>\n #include <QPointer>\n+#include <QPushButton>\n #include <QQueue>\n #include <QTimer>\n \n@@ -61,7 +62,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@@ -91,7 +92,7 @@ private:\n \t/* UI elements */\n \tQToolBar *toolbar_;\n \tQAction *startStopAction_;\n-\tQComboBox *cameraCombo_;\n+\tQPushButton *cameraSwitchButton_;\n \tQAction *saveRaw_;\n \tViewFinder *viewfinder_;\n \n", "prefixes": [ "libcamera-devel", "v2", "3/4" ] }