diff options
author | Anton Arbring <aarbring@cisco.com> | 2014-08-04 11:24:51 +0200 |
---|---|---|
committer | Hans Verkuil <hans.verkuil@cisco.com> | 2014-08-04 13:16:36 +0200 |
commit | 9b92086a9351a2b90ec2dfad3e3d9fc27810877d (patch) | |
tree | 9f4ea86e788e3d34c3433e29f581fa45b8224720 | |
parent | 6daaf3258cbaee3046f0411b90299cc325696a83 (diff) |
qv4l2: Removed bottom layout from capturewin
The information shown can be seen in the status bar
of the main window. The eventfilter that shows the bottom
layout can also be percieved as annoying.
Signed-off-by: Anton Arbring <aarbring@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
-rw-r--r-- | utils/qv4l2/capture-win.cpp | 56 | ||||
-rw-r--r-- | utils/qv4l2/capture-win.h | 13 | ||||
-rw-r--r-- | utils/qv4l2/qv4l2.cpp | 12 |
3 files changed, 9 insertions, 72 deletions
diff --git a/utils/qv4l2/capture-win.cpp b/utils/qv4l2/capture-win.cpp index 080ed091..3437cf1a 100644 --- a/utils/qv4l2/capture-win.cpp +++ b/utils/qv4l2/capture-win.cpp @@ -67,7 +67,6 @@ CaptureWin::CaptureWin(ApplicationWindow *aw) : m_origFrameSize.setHeight(0); m_windowSize.setWidth(0); m_windowSize.setHeight(0); - m_information = new QLabel(this); } CaptureWin::~CaptureWin() @@ -82,11 +81,10 @@ CaptureWin::~CaptureWin() } void CaptureWin::setFrame(int width, int height, __u32 format, - unsigned char *data, unsigned char *data2, const QString &info) + unsigned char *data, unsigned char *data2) { m_frame.planeData[0] = data; m_frame.planeData[1] = data2; - m_frame.info = info; m_frame.updated = false; if (width != m_frame.size.width() || height != m_frame.size.height() @@ -97,7 +95,6 @@ void CaptureWin::setFrame(int width, int height, __u32 format, m_frame.updated = true; updateSize(); } - m_information->setText(m_frame.info); setRenderFrame(); } @@ -106,25 +103,10 @@ void CaptureWin::buildWindow(QWidget *videoSurface) { int l, t, r, b; m_vboxLayout = new QVBoxLayout(this); - m_information->setText("No Frame"); m_vboxLayout->getContentsMargins(&l, &t, &r, &b); - m_vboxSpacing = t + b; m_vboxLayout->setMargin(0); m_vboxLayout->addWidget(videoSurface, 1000, Qt::AlignCenter); - m_bottom = new QWidget(parentWidget()); - m_bottom->installEventFilter(this); - - QHBoxLayout *hbox = new QHBoxLayout(m_bottom); - hbox->addWidget(m_information, 1, Qt::AlignLeft); - - m_fullscreenButton = new QPushButton("Show Fullscreen", m_bottom); - m_fullscreenButton->setMaximumWidth(200); - m_fullscreenButton->setMinimumWidth(100); - hbox->addWidget(m_fullscreenButton, 0, Qt::AlignRight); - connect(m_fullscreenButton, SIGNAL(clicked()), m_appWin->m_makeFullScreenAct, SLOT(toggle())); - m_vboxLayout->addWidget(m_bottom, 0, Qt::AlignBottom); - m_vboxLayout->setSpacing(m_vboxSpacing); - + setContextMenuPolicy(Qt::CustomContextMenu); connect(this, SIGNAL(customContextMenuRequested(QPoint)), SLOT(customMenuRequested(QPoint))); } @@ -221,8 +203,6 @@ QSize CaptureWin::getMargins() { int l, t, r, b; layout()->getContentsMargins(&l, &t, &r, &b); - if (m_information->isVisible()) - return QSize(l + r, t + b + m_information->minimumSizeHint().height() + layout()->spacing()); return QSize(l + r, t + b); } @@ -306,27 +286,6 @@ void CaptureWin::mouseDoubleClickEvent(QMouseEvent *e) m_appWin->m_makeFullScreenAct->toggle(); } -bool CaptureWin::eventFilter(QObject *target, QEvent *event) -{ - if (target == m_bottom && isFullScreen()) { - if (event->type() == QEvent::Enter) { - m_bottom->setStyleSheet("background-color:#bebebe;"); - m_bottom->setFixedHeight(75); - m_fullscreenButton->show(); - m_information->show(); - return true; - } - if (event->type() == QEvent::Leave && m_bottom->geometry().bottom() >= QCursor::pos().y()) { - m_bottom->setMinimumHeight(0); - m_bottom->setStyleSheet("background-color:#000000;"); - m_fullscreenButton->hide(); - m_information->hide(); - return true; - } - } - return false; -} - void CaptureWin::escape() { m_appWin->m_makeFullScreenAct->setChecked(false); @@ -341,21 +300,10 @@ void CaptureWin::makeFullScreen(bool enable) { if (enable) { showFullScreen(); - m_fullscreenButton->setText("Exit Fullscreen"); setStyleSheet("background-color:#000000;"); - m_vboxLayout->setSpacing(0); - m_fullscreenButton->hide(); - m_information->hide(); } else { showNormal(); - m_vboxLayout->setSpacing(m_vboxSpacing); - m_bottom->setMinimumHeight(0); - m_bottom->setMaximumHeight(height()); - m_fullscreenButton->setText("Show Fullscreen"); setStyleSheet("background-color:none;"); - m_bottom->setStyleSheet("background-color:none;"); - m_fullscreenButton->show(); - m_information->show(); } QSize resetFrameSize = m_origFrameSize; m_origFrameSize.setWidth(0); diff --git a/utils/qv4l2/capture-win.h b/utils/qv4l2/capture-win.h index 4d1db69b..618f4d6a 100644 --- a/utils/qv4l2/capture-win.h +++ b/utils/qv4l2/capture-win.h @@ -45,7 +45,6 @@ struct frame { __u32 format; QSize size; // int frameHeight; int frameWidth; unsigned char *planeData[2]; - QString info; bool updated; }; @@ -90,7 +89,7 @@ public: * @param info A string containing capture information. */ void setFrame(int width, int height, __u32 format, - unsigned char *data, unsigned char *data2, const QString &info); + unsigned char *data, unsigned char *data2); /** * @brief Called when the capture stream is stopped. @@ -161,7 +160,6 @@ private slots: protected: void closeEvent(QCloseEvent *event); void mouseDoubleClickEvent(QMouseEvent *e); - bool eventFilter(QObject *target, QEvent *event); /** * @brief Get the amount of space outside the video frame. @@ -188,13 +186,6 @@ protected: void updateSize(); /** - * @brief A label that can is used to display capture information. - * - * @note This must be set in the derived class' setFrame() function. - */ - QLabel *m_information; - - /** * @brief Frame information. * * @note Set and accessed from derived render dependent classes. @@ -228,8 +219,6 @@ private: QShortcut *m_hotkeyScaleReset; QShortcut *m_hotkeyExitFullscreen; QShortcut *m_hotkeyToggleFullscreen; - QPushButton *m_fullscreenButton; - QWidget *m_bottom; QVBoxLayout *m_vboxLayout; unsigned m_vboxSpacing; }; diff --git a/utils/qv4l2/qv4l2.cpp b/utils/qv4l2/qv4l2.cpp index 2023dbab..7a346835 100644 --- a/utils/qv4l2/qv4l2.cpp +++ b/utils/qv4l2/qv4l2.cpp @@ -611,7 +611,7 @@ void ApplicationWindow::capVbiFrame() status = QString("Frame: %1 Fps: %2").arg(++m_frame).arg(m_fps); if (showFrames() && g_type() == V4L2_BUF_TYPE_VBI_CAPTURE) m_capture->setFrame(m_capImage->width(), m_capImage->height(), - m_capDestFormat.fmt.pix.pixelformat, m_capImage->bits(), NULL, status); + m_capDestFormat.fmt.pix.pixelformat, m_capImage->bits(), NULL); curStatus = statusBar()->currentMessage(); if (curStatus.isEmpty() || curStatus.startsWith("Frame: ")) @@ -712,7 +712,7 @@ void ApplicationWindow::capSdrFrame() status = QString("Frame: %1 Fps: %2").arg(++m_frame).arg(m_fps); if (showFrames()) m_capture->setFrame(m_capImage->width(), m_capImage->height(), - m_capDestFormat.fmt.pix.pixelformat, m_capImage->bits(), NULL, status); + m_capDestFormat.fmt.pix.pixelformat, m_capImage->bits(), NULL); curStatus = statusBar()->currentMessage(); if (curStatus.isEmpty() || curStatus.startsWith("Frame: ")) @@ -914,7 +914,7 @@ void ApplicationWindow::capFrame() if (showFrames()) m_capture->setFrame(m_capImage->width(), m_capImage->height(), - m_capDestFormat.g_pixelformat(), plane[0], plane[1], status); + m_capDestFormat.g_pixelformat(), plane[0], plane[1]); if (m_capMethod == methodMmap || m_capMethod == methodUser) { if (m_clear[buf.g_index()]) { @@ -1237,7 +1237,7 @@ void ApplicationWindow::capStart(bool start) m_capImage->fill(0); m_capture->setWindowSize(QSize(m_vbiWidth, m_vbiHeight)); m_capture->setFrame(m_capImage->width(), m_capImage->height(), - m_capDestFormat.fmt.pix.pixelformat, m_capImage->bits(), NULL, "No frame"); + m_capDestFormat.fmt.pix.pixelformat, m_capImage->bits(), NULL); if (showFrames()) m_capture->show(); @@ -1266,7 +1266,7 @@ void ApplicationWindow::capStart(bool start) m_capImage->fill(0); m_capture->setWindowSize(QSize(SDR_WIDTH, SDR_HEIGHT)); m_capture->setFrame(m_capImage->width(), m_capImage->height(), - m_capDestFormat.fmt.pix.pixelformat, m_capImage->bits(), NULL, "No frame"); + m_capDestFormat.fmt.pix.pixelformat, m_capImage->bits(), NULL); if (showFrames()) m_capture->show(); @@ -1344,7 +1344,7 @@ void ApplicationWindow::capStart(bool start) m_capture->setWindowSize(QSize(width, height)); m_capture->setFrame(m_capImage->width(), m_capImage->height(), - pixfmt, m_capImage->bits(), NULL, "No frame"); + pixfmt, m_capImage->bits(), NULL); m_capture->makeFullScreen(m_makeFullScreenAct->isChecked()); if (showFrames()) m_capture->show(); |