From patchwork Sun Aug 7 20:32:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Utkarsh Tiwari X-Patchwork-Id: 17021 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 1812BBE173 for ; Sun, 7 Aug 2022 20:32:28 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id CBE076332D; Sun, 7 Aug 2022 22:32:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1659904347; bh=mDM/AqDCeM00UHYfpX5f1RIyHRRuplHtHJbTxOHBOE0=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=zx46pBe9D3wWUmitRSbd0Lcy+lvliMiZhKK2g5Wz2706ba7zdhLWpq87f/TEgI1mt c6htj8b3A+tPvyA0SvKtw1Ta/ZJHJnCzNl5WnVHNj2Wx9f+xnCR5Y33pgKYfh8p3DD NdlHwQ7MfWjQK8wpimqRIKj2r/rZutUxOkTwT/UGbNAHMhAKEV7i32YLc0v2K7F19t NutOU0AIqhwZZstIgy5RKiWqpoyzVnfQai3JVwLP72XAzH17dh3RN1RHPmhVlUluXg n/PX0NmsJzFRe8e9tdxaSNj9eCSGJnlvtaqsLO72LYYQIGaPA8+1WauoQWzjrx0OMu 6vYgJfxKDtXGw== Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B424C63327 for ; Sun, 7 Aug 2022 22:32:26 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="aFVbkFsR"; dkim-atps=neutral Received: by mail-pg1-x52e.google.com with SMTP id q16so6933479pgq.6 for ; Sun, 07 Aug 2022 13:32:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=kanfHGJITr6TvtYEOvkfhBTL2ZgRI2xaXV9xshtHLHQ=; b=aFVbkFsR/DYbdVHhyDWiW5hHP+g7mUlZxQekw7t41QsUjQkxsfHOPQQg+t6hxW58Lk gByMVMwE47rVWK1f/whu4cJzcVLGIzPdpCLcLvzGlkEPRLfMIkLylo7jZ7wTNFF0GYjK ULqvDxvckHtbraOQ6daEN+f1JXF/RHTblTdl/3iFnxzpuY/kRNm6e0NAuz31HNW/VNOM 1jb9aMGf8NrJ0/C1yguyPccY9yTpSsQGfRa9OPZK1WQJHReZrww/HKNjE+WhCnd9rumY HQHKvX5hGcWTdVWofWD2LSZAoEZu6H+5ooZJ/zZ1zhXsvGDxEwtwy1I6rh7plVEEC000 eVcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=kanfHGJITr6TvtYEOvkfhBTL2ZgRI2xaXV9xshtHLHQ=; b=wZCaODH2PXU0qWMqMc5t7w785N4oaKIsFxM7yQiTq4g/RmeDh02LjD/XgO7rJVFkPR s/vUcyBp6qQE2J5x0Ws5m98hFWKCCLsb/bK8ElPq89NoQ4XUFs8T3kLXhYp/OJAW42C8 Edj29LN+8Hvg5JTn6AnhNvGLF1ghX4R4IQiOzJy5PxEZoscHy22O03b02G+Aq7llAAtA 8fvfv82qPEPHLjWX8HW8AMlRu3nC7pEF8h94RnkTTdllv0C0uBwWZMSbQjOzVtL2nrUL 1zKra/xxW5lsLMuSgDAIswBGH5OpGoKKQWMI6b4vzLzgfVZ0Ymkwy1n9vFctsQagjCYj lVSg== X-Gm-Message-State: ACgBeo0aVa6d7PIv9hFbj8TYr5ilO9RH51Nq88C6u0lzkWMcVhHWwhTl tnK81ERdHw3+AbgtsJjPFx1hjd3xKII= X-Google-Smtp-Source: AA6agR6QOQwiYt+oqsL4/JMcMLTIDiDkeT23pakktQs0fs2aSXzZ4JhTHMNuaRVqwi7pyBKEObzuOg== X-Received: by 2002:aa7:9157:0:b0:52f:20d6:e4f6 with SMTP id 23-20020aa79157000000b0052f20d6e4f6mr4616705pfi.40.1659904344877; Sun, 07 Aug 2022 13:32:24 -0700 (PDT) Received: from localhost.localdomain ([2404:bd00:3:d2bc:8eec:115d:8ea8:b700]) by smtp.gmail.com with ESMTPSA id x29-20020aa7941d000000b0052d194a6602sm7006334pfo.102.2022.08.07.13.32.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Aug 2022 13:32:24 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Mon, 8 Aug 2022 02:02:03 +0530 Message-Id: <20220807203204.152358-4-utkarsh02t@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220807203204.152358-1-utkarsh02t@gmail.com> References: <20220807203204.152358-1-utkarsh02t@gmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v6 3/4] qcam: CamSelectDialog: Display Capture script path X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Utkarsh Tiwari via libcamera-devel From: Utkarsh Tiwari Reply-To: Utkarsh Tiwari Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Display the path of the selected capture script in a thinner font. Signed-off-by: Utkarsh Tiwari --- Difference from V5: came to existance. src/qcam/cam_select_dialog.h | 41 +++++++++++++++++++++++++++++++----- src/qcam/main_window.cpp | 3 ++- 2 files changed, 38 insertions(+), 6 deletions(-) diff --git a/src/qcam/cam_select_dialog.h b/src/qcam/cam_select_dialog.h index fc29b46a..7dc44794 100644 --- a/src/qcam/cam_select_dialog.h +++ b/src/qcam/cam_select_dialog.h @@ -19,18 +19,22 @@ #include #include #include +#include #include #include #include #include +#include +#include class CamSelectDialog : public QDialog { Q_OBJECT public: CamSelectDialog(libcamera::CameraManager *cameraManager, - bool isScriptRunning, QWidget *parent) - : QDialog(parent), cm_(cameraManager), isScriptRunning_(isScriptRunning) + bool isScriptRunning, std::string scriptPath, QWidget *parent) + : QDialog(parent), cm_(cameraManager), + isScriptRunning_(isScriptRunning), scriptPath_(scriptPath) { /* Use a QFormLayout for the dialog. */ QFormLayout *camSelectDialogLayout = new QFormLayout(this); @@ -51,14 +55,31 @@ public: cameraIdComboBox_->currentText().toStdString())); }); + /* Setup widget for capture script button. */ + QWidget *captureWidget = new QWidget; + captureWidgetLayout_ = new QVBoxLayout(captureWidget); + captureWidgetLayout_->setMargin(0); + captureScriptButton_ = new QPushButton; connect(captureScriptButton_, &QPushButton::clicked, this, &CamSelectDialog::handleCaptureScriptButton); + captureWidgetLayout_->addWidget(captureScriptButton_); + + /* Use a thinner font to indicate script info. */ + QFont smallFont; + smallFont.setWeight(QFont::Thin); + + scriptPathLabel_ = new QLabel; + scriptPathLabel_->setFont(smallFont); + scriptPathLabel_->setWordWrap(true); /* Display the action that would be performed when button is clicked. */ - if (isScriptRunning_) + if (isScriptRunning_) { captureScriptButton_->setText("Stop"); - else + + scriptPathLabel_->setText(QString::fromStdString(scriptPath_)); + captureWidgetLayout_->addWidget(scriptPathLabel_); + } else captureScriptButton_->setText("Open"); /* Setup the QDialogButton Box */ @@ -75,7 +96,7 @@ public: camSelectDialogLayout->addRow("Camera: ", cameraIdComboBox_); camSelectDialogLayout->addRow("Location: ", cameraLocation_); camSelectDialogLayout->addRow("Model: ", cameraModel_); - camSelectDialogLayout->addRow("Capture Script: ", captureScriptButton_); + camSelectDialogLayout->addRow("Capture Script: ", captureWidget); camSelectDialogLayout->addWidget(dialogButtonBox); } @@ -148,6 +169,8 @@ public: Q_EMIT stopCaptureScript(); isScriptRunning_ = false; captureScriptButton_->setText("Open"); + + captureWidgetLayout_->removeWidget(scriptPathLabel_); } else { scriptPath_ = QFileDialog::getOpenFileName(this, "Run Capture Script", QDir::currentPath(), "Capture Script (*.yaml)") @@ -155,6 +178,11 @@ public: if (!scriptPath_.empty()) captureScriptButton_->setText("Loaded"); + else + return; + + scriptPathLabel_->setText(QString::fromStdString(scriptPath_)); + captureWidgetLayout_->addWidget(scriptPathLabel_); } } @@ -171,5 +199,8 @@ private: QComboBox *cameraIdComboBox_; QLabel *cameraLocation_; QLabel *cameraModel_; + + QVBoxLayout *captureWidgetLayout_; QPushButton *captureScriptButton_; + QLabel *scriptPathLabel_ = new QLabel; }; diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp index e0219e5e..e354ba10 100644 --- a/src/qcam/main_window.cpp +++ b/src/qcam/main_window.cpp @@ -332,7 +332,8 @@ void MainWindow::loadCaptureScript() std::string MainWindow::chooseCamera() { bool scriptRunning = script_ != nullptr; - camSelectDialog_ = new CamSelectDialog(cm_, scriptRunning, this); + camSelectDialog_ = new CamSelectDialog(cm_, scriptRunning, + scriptPath_, this); connect(camSelectDialog_, &CamSelectDialog::stopCaptureScript, this, &MainWindow::stopCaptureScript);