update layout to better fit
This commit is contained in:
@@ -244,7 +244,7 @@ void GStreamerPipelineWidget::onQuickStart()
|
|||||||
// Step 3: Start stream
|
// Step 3: Start stream
|
||||||
m_socketClient->sendCommand("start_stream", QJsonObject(),
|
m_socketClient->sendCommand("start_stream", QJsonObject(),
|
||||||
[this](const QJsonObject& response) {
|
[this](const QJsonObject& response) {
|
||||||
updateStatus("Streaming started - Switch to Video Viewer tab and click 'Start Viewer'", true);
|
updateStatus("Streaming started - Click 'Start Viewer' on the left to view", true);
|
||||||
m_quickStartBtn->setEnabled(true);
|
m_quickStartBtn->setEnabled(true);
|
||||||
m_quickStartBtn->setText("⚡ Quick Start (Auto Configure & Stream)");
|
m_quickStartBtn->setText("⚡ Quick Start (Auto Configure & Stream)");
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -32,17 +32,17 @@ void MainWindow::setupUI()
|
|||||||
m_pipelineWidget = new GStreamerPipelineWidget(m_socketClient, this);
|
m_pipelineWidget = new GStreamerPipelineWidget(m_socketClient, this);
|
||||||
m_cameraWidget = new CameraControlWidget(m_socketClient, this);
|
m_cameraWidget = new CameraControlWidget(m_socketClient, this);
|
||||||
|
|
||||||
// Create tab widget for controls
|
// Create tab widget for controls on the right
|
||||||
QTabWidget* controlTabs = new QTabWidget(this);
|
QTabWidget* controlTabs = new QTabWidget(this);
|
||||||
controlTabs->addTab(m_pipelineWidget, "Pipeline Control");
|
controlTabs->addTab(m_pipelineWidget, "Pipeline Control");
|
||||||
controlTabs->addTab(m_cameraWidget, "Camera Control");
|
controlTabs->addTab(m_cameraWidget, "Camera Control");
|
||||||
|
|
||||||
// Create vertical splitter: video on top, controls on bottom
|
// Create horizontal splitter: video on left (full height), controls on right
|
||||||
QSplitter* mainSplitter = new QSplitter(Qt::Vertical, this);
|
QSplitter* mainSplitter = new QSplitter(Qt::Horizontal, this);
|
||||||
mainSplitter->addWidget(m_videoWidget);
|
mainSplitter->addWidget(m_videoWidget);
|
||||||
mainSplitter->addWidget(controlTabs);
|
mainSplitter->addWidget(controlTabs);
|
||||||
mainSplitter->setStretchFactor(0, 3); // Video gets more space
|
mainSplitter->setStretchFactor(0, 2); // Video gets more space (2/3)
|
||||||
mainSplitter->setStretchFactor(1, 1); // Controls get less space
|
mainSplitter->setStretchFactor(1, 1); // Controls get less space (1/3)
|
||||||
|
|
||||||
// Set as central widget
|
// Set as central widget
|
||||||
setCentralWidget(mainSplitter);
|
setCentralWidget(mainSplitter);
|
||||||
|
|||||||
@@ -35,19 +35,15 @@ void VideoViewerWidget::initGStreamer()
|
|||||||
void VideoViewerWidget::setupUI()
|
void VideoViewerWidget::setupUI()
|
||||||
{
|
{
|
||||||
QVBoxLayout* mainLayout = new QVBoxLayout(this);
|
QVBoxLayout* mainLayout = new QVBoxLayout(this);
|
||||||
|
mainLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
mainLayout->setSpacing(5);
|
||||||
|
|
||||||
// Video display container
|
// Video display - no GroupBox for maximum space
|
||||||
QGroupBox* videoGroup = new QGroupBox("Video Display", this);
|
|
||||||
QVBoxLayout* videoLayout = new QVBoxLayout();
|
|
||||||
|
|
||||||
m_videoDisplay = new QLabel(this);
|
m_videoDisplay = new QLabel(this);
|
||||||
m_videoDisplay->setMinimumSize(640, 480);
|
m_videoDisplay->setMinimumSize(640, 480);
|
||||||
m_videoDisplay->setStyleSheet("background-color: black;");
|
m_videoDisplay->setStyleSheet("background-color: black; border: 1px solid #666;");
|
||||||
m_videoDisplay->setAlignment(Qt::AlignCenter);
|
m_videoDisplay->setAlignment(Qt::AlignCenter);
|
||||||
m_videoDisplay->setScaledContents(true); // Enable scaling for zoom later
|
m_videoDisplay->setScaledContents(false); // Disable for better aspect ratio control
|
||||||
|
|
||||||
videoLayout->addWidget(m_videoDisplay);
|
|
||||||
videoGroup->setLayout(videoLayout);
|
|
||||||
|
|
||||||
// Controls
|
// Controls
|
||||||
QGroupBox* controlGroup = new QGroupBox("Viewer Controls", this);
|
QGroupBox* controlGroup = new QGroupBox("Viewer Controls", this);
|
||||||
@@ -95,7 +91,8 @@ void VideoViewerWidget::setupUI()
|
|||||||
controlLayout->addWidget(m_statusLabel);
|
controlLayout->addWidget(m_statusLabel);
|
||||||
controlGroup->setLayout(controlLayout);
|
controlGroup->setLayout(controlLayout);
|
||||||
|
|
||||||
mainLayout->addWidget(videoGroup, 1);
|
// Add to main layout: video takes most space, controls at bottom
|
||||||
|
mainLayout->addWidget(m_videoDisplay, 1);
|
||||||
mainLayout->addWidget(controlGroup);
|
mainLayout->addWidget(controlGroup);
|
||||||
|
|
||||||
setLayout(mainLayout);
|
setLayout(mainLayout);
|
||||||
@@ -413,7 +410,10 @@ void VideoViewerWidget::displayFrame(const QImage& frame)
|
|||||||
firstFrame = false;
|
firstFrame = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert QImage to QPixmap and display in label
|
// Convert QImage to QPixmap and scale to fit label while keeping aspect ratio
|
||||||
QPixmap pixmap = QPixmap::fromImage(frame);
|
QPixmap pixmap = QPixmap::fromImage(frame);
|
||||||
m_videoDisplay->setPixmap(pixmap.scaled(m_videoDisplay->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
QPixmap scaledPixmap = pixmap.scaled(m_videoDisplay->size(),
|
||||||
|
Qt::KeepAspectRatio,
|
||||||
|
Qt::SmoothTransformation);
|
||||||
|
m_videoDisplay->setPixmap(scaledPixmap);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user