clang optimizations and cleanup
This commit is contained in:
@@ -14,17 +14,15 @@ CameraControlWidget::CameraControlWidget(SocketClient* socketClient, QWidget *pa
|
||||
|
||||
void CameraControlWidget::setupUI()
|
||||
{
|
||||
QVBoxLayout* mainLayout = new QVBoxLayout(this);
|
||||
auto* mainLayout = new QVBoxLayout(this);
|
||||
|
||||
// Create scroll area for all controls
|
||||
QScrollArea* scrollArea = new QScrollArea(this);
|
||||
auto* scrollArea = new QScrollArea(this);
|
||||
scrollArea->setWidgetResizable(true);
|
||||
scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
|
||||
QWidget* scrollWidget = new QWidget();
|
||||
QVBoxLayout* scrollLayout = new QVBoxLayout(scrollWidget);
|
||||
auto* scrollWidget = new QWidget();
|
||||
auto* scrollLayout = new QVBoxLayout(scrollWidget);
|
||||
|
||||
// Add all control groups
|
||||
scrollLayout->addWidget(createFormatGroup());
|
||||
scrollLayout->addWidget(createExposureGroup());
|
||||
scrollLayout->addWidget(createWhiteBalanceGroup());
|
||||
@@ -36,7 +34,6 @@ void CameraControlWidget::setupUI()
|
||||
|
||||
mainLayout->addWidget(scrollArea);
|
||||
|
||||
// Status label at bottom
|
||||
m_statusLabel = new QLabel("Status: Ready", this);
|
||||
m_statusLabel->setStyleSheet("QLabel { background-color: #f0f0f0; padding: 5px; border-radius: 3px; }");
|
||||
mainLayout->addWidget(m_statusLabel);
|
||||
@@ -46,8 +43,8 @@ void CameraControlWidget::setupUI()
|
||||
|
||||
QGroupBox* CameraControlWidget::createFormatGroup()
|
||||
{
|
||||
QGroupBox* groupBox = new QGroupBox("Video Format", this);
|
||||
QVBoxLayout* layout = new QVBoxLayout();
|
||||
auto* groupBox = new QGroupBox("Video Format", this);
|
||||
auto* layout = new QVBoxLayout();
|
||||
|
||||
m_formatCombo = new QComboBox(this);
|
||||
m_formatCombo->addItem("1280x720@30fps UYVY (Supported)", "1280,720,30,UYVY");
|
||||
@@ -69,10 +66,10 @@ QGroupBox* CameraControlWidget::createFormatGroup()
|
||||
|
||||
QGroupBox* CameraControlWidget::createExposureGroup()
|
||||
{
|
||||
QGroupBox* groupBox = new QGroupBox("Exposure", this);
|
||||
QVBoxLayout* layout = new QVBoxLayout();
|
||||
auto* groupBox = new QGroupBox("Exposure", this);
|
||||
auto* layout = new QVBoxLayout();
|
||||
|
||||
QButtonGroup* exposureGroup = new QButtonGroup(this);
|
||||
auto* exposureGroup = new QButtonGroup(this);
|
||||
m_exposureAuto = new QRadioButton("Auto", this);
|
||||
m_exposureManual = new QRadioButton("Manual", this);
|
||||
m_exposureAuto->setChecked(true);
|
||||
@@ -82,7 +79,7 @@ QGroupBox* CameraControlWidget::createExposureGroup()
|
||||
|
||||
connect(m_exposureAuto, &QRadioButton::toggled, this, &CameraControlWidget::onExposureModeChanged);
|
||||
|
||||
QHBoxLayout* modeLayout = new QHBoxLayout();
|
||||
auto* modeLayout = new QHBoxLayout();
|
||||
modeLayout->addWidget(m_exposureAuto);
|
||||
modeLayout->addWidget(m_exposureManual);
|
||||
|
||||
@@ -94,7 +91,7 @@ QGroupBox* CameraControlWidget::createExposureGroup()
|
||||
m_setExposureBtn = new QPushButton("Set Exposure", this);
|
||||
connect(m_setExposureBtn, &QPushButton::clicked, this, &CameraControlWidget::onSetExposure);
|
||||
|
||||
QFormLayout* formLayout = new QFormLayout();
|
||||
auto* formLayout = new QFormLayout();
|
||||
formLayout->addRow("Mode:", modeLayout);
|
||||
formLayout->addRow("Value:", m_exposureValue);
|
||||
|
||||
@@ -107,10 +104,10 @@ QGroupBox* CameraControlWidget::createExposureGroup()
|
||||
|
||||
QGroupBox* CameraControlWidget::createWhiteBalanceGroup()
|
||||
{
|
||||
QGroupBox* groupBox = new QGroupBox("White Balance", this);
|
||||
QVBoxLayout* layout = new QVBoxLayout();
|
||||
auto* groupBox = new QGroupBox("White Balance", this);
|
||||
auto* layout = new QVBoxLayout();
|
||||
|
||||
QButtonGroup* wbGroup = new QButtonGroup(this);
|
||||
auto* wbGroup = new QButtonGroup(this);
|
||||
m_whiteBalanceAuto = new QRadioButton("Auto", this);
|
||||
m_whiteBalanceManual = new QRadioButton("Manual", this);
|
||||
m_whiteBalanceAuto->setChecked(true);
|
||||
@@ -120,7 +117,7 @@ QGroupBox* CameraControlWidget::createWhiteBalanceGroup()
|
||||
|
||||
connect(m_whiteBalanceAuto, &QRadioButton::toggled, this, &CameraControlWidget::onWhiteBalanceModeChanged);
|
||||
|
||||
QHBoxLayout* modeLayout = new QHBoxLayout();
|
||||
auto* modeLayout = new QHBoxLayout();
|
||||
modeLayout->addWidget(m_whiteBalanceAuto);
|
||||
modeLayout->addWidget(m_whiteBalanceManual);
|
||||
|
||||
@@ -133,7 +130,7 @@ QGroupBox* CameraControlWidget::createWhiteBalanceGroup()
|
||||
m_setWhiteBalanceBtn = new QPushButton("Set White Balance", this);
|
||||
connect(m_setWhiteBalanceBtn, &QPushButton::clicked, this, &CameraControlWidget::onSetWhiteBalance);
|
||||
|
||||
QFormLayout* formLayout = new QFormLayout();
|
||||
auto* formLayout = new QFormLayout();
|
||||
formLayout->addRow("Mode:", modeLayout);
|
||||
formLayout->addRow("Temperature:", m_whiteBalanceTemp);
|
||||
|
||||
@@ -146,8 +143,8 @@ QGroupBox* CameraControlWidget::createWhiteBalanceGroup()
|
||||
|
||||
QGroupBox* CameraControlWidget::createImageAdjustmentGroup()
|
||||
{
|
||||
QGroupBox* groupBox = new QGroupBox("Image Adjustments", this);
|
||||
QVBoxLayout* layout = new QVBoxLayout();
|
||||
auto* groupBox = new QGroupBox("Image Adjustments", this);
|
||||
auto* layout = new QVBoxLayout();
|
||||
|
||||
layout->addWidget(createSliderControl("Brightness (0-255):", 0, 255, 128,
|
||||
&m_brightnessSlider, &m_brightnessSpinBox));
|
||||
@@ -180,13 +177,13 @@ QGroupBox* CameraControlWidget::createImageAdjustmentGroup()
|
||||
QWidget* CameraControlWidget::createSliderControl(const QString& label, int min, int max, int defaultValue,
|
||||
QSlider** slider, QSpinBox** spinBox)
|
||||
{
|
||||
QWidget* widget = new QWidget(this);
|
||||
QVBoxLayout* layout = new QVBoxLayout(widget);
|
||||
auto* widget = new QWidget(this);
|
||||
auto* layout = new QVBoxLayout(widget);
|
||||
layout->setContentsMargins(0, 5, 0, 5);
|
||||
|
||||
QLabel* titleLabel = new QLabel(label, this);
|
||||
auto* titleLabel = new QLabel(label, this);
|
||||
|
||||
QHBoxLayout* controlLayout = new QHBoxLayout();
|
||||
auto* controlLayout = new QHBoxLayout();
|
||||
|
||||
*slider = new QSlider(Qt::Horizontal, this);
|
||||
(*slider)->setRange(min, max);
|
||||
@@ -223,9 +220,8 @@ void CameraControlWidget::onGetFormats()
|
||||
int fps = fmt["framerate"].toInt();
|
||||
QString format = fmt["format"].toString();
|
||||
|
||||
QString displayText = QString("%1x%2@%3fps %4")
|
||||
.arg(width).arg(height).arg(fps).arg(format);
|
||||
QString data = QString("%1,%2,%3,%4").arg(width).arg(height).arg(fps).arg(format);
|
||||
QString displayText = QString("%1x%2@%3fps %4").arg(width, height, fps).arg(format);
|
||||
QString data = QString("%1,%2,%3,%4").arg(width, height, fps).arg(format);
|
||||
|
||||
m_formatCombo->addItem(displayText, data);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user