[libcamera-devel,10/11] qcam: ControlFrame: Add GUI way to interact with ControlTypeIntger32
diff mbox series

Message ID 20220715191400.890976-11-utkarsh02t@gmail.com
State Superseded
Headers show
Series
  • Introduce control interaction to qcam
Related show

Commit Message

Utkarsh Tiwari July 15, 2022, 7:13 p.m. UTC
Add an integer slider for ControlTypeIntger32 control types.
The default value on the slider is the default value for the control
and it may not be the current value for the control.

Signed-off-by: Utkarsh Tiwari <utkarsh02t@gmail.com>
---
 src/qcam/settings/control_frame.cpp | 16 ++++++++++++++++
 src/qcam/settings/control_frame.h   |  1 +
 2 files changed, 17 insertions(+)

Patch
diff mbox series

diff --git a/src/qcam/settings/control_frame.cpp b/src/qcam/settings/control_frame.cpp
index 10dcd05a..5a3258d6 100644
--- a/src/qcam/settings/control_frame.cpp
+++ b/src/qcam/settings/control_frame.cpp
@@ -94,6 +94,19 @@  QWidget *ControlFrame::controlInteraction(QWidget *parent)
 		SliderLayout *fSliderLayout = new SliderLayout(floatSlider_, this);
 		return fSliderLayout;
 	}
+	case ControlTypeInteger32: {
+		intSlider_ = new Slider(this);
+		intSlider_->setRange(controlInfo_.min().get<int32_t>(),
+				     controlInfo_.max().get<int32_t>());
+		intSlider_->setValue(controlInfo_.def().get<int32_t>());
+		intSlider_->setOrientation(Qt::Orientation::Horizontal);
+
+		connect(intSlider_, &Slider::valueChanged,
+			this, &ControlFrame::notifyControlChange);
+
+		SliderLayout *iSliderLayout = new SliderLayout(intSlider_, this);
+		return iSliderLayout;
+	}
 	default:
 		return (new QLabel("Currently Unavailable"));
 	}
@@ -163,6 +176,9 @@  void ControlFrame::notifyControlChange()
 	case ControlTypeFloat:
 		controlValue.set<float>(floatSlider_->value());
 		break;
+	case ControlTypeInteger32:
+		controlValue.set<int32_t>(intSlider_->value());
+		break;
 	default:
 		/* Nothing to emit so return */
 		return;
diff --git a/src/qcam/settings/control_frame.h b/src/qcam/settings/control_frame.h
index e9e256aa..205bb96b 100644
--- a/src/qcam/settings/control_frame.h
+++ b/src/qcam/settings/control_frame.h
@@ -47,6 +47,7 @@  private:
 	QCheckBox *controlCheckBox_;
 	QLabel *currentValue_;
 	FloatSlider *floatSlider_;
+	Slider *intSlider_;
 
 	/* Helper Hunctions */
 	QString getDefaultValueQStr();