From 3b31453221dfca1c479b9c6009f6c9d7bb2a4e7e Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Sun, 10 Oct 2021 22:25:32 +0100 Subject: [PATCH] Add support to signall if the format supports user configuration --- app/MainWindow.cpp | 17 ++++++++++++----- app/VideoStreamSubWindow.h | 2 ++ lib/CalypStream.cpp | 4 ++-- lib/CalypStream.h | 3 +-- lib/CalypStreamHandlerIf.h | 1 + 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/app/MainWindow.cpp b/app/MainWindow.cpp index 7f3a79d..a432994 100644 --- a/app/MainWindow.cpp +++ b/app/MainWindow.cpp @@ -598,10 +598,17 @@ void MainWindow::updateMenus() { bool hasSubWindow = ( m_pcWindowHandle->activeSubWindow() != 0 ); - bool hasVideoStreamSubWindow = false; - if( m_pcCurrentSubWindow ) - if( m_pcCurrentSubWindow->getCategory() & SubWindowAbstract::VIDEO_STREAM_SUBWINDOW ) - hasVideoStreamSubWindow = true; + bool hasVideoStreamSubWindow{ false }; + bool supportsFormat{ false }; + if( m_pcCurrentSubWindow && m_pcCurrentSubWindow->getCategory() & SubWindowAbstract::VIDEO_STREAM_SUBWINDOW ) + { + hasVideoStreamSubWindow = true; + + if( auto* pcVideoSubWindow = qobject_cast( m_pcCurrentVideoSubWindow ) ) + { + supportsFormat = pcVideoSubWindow->supportsFormatConfiguration(); + } + } m_arrayMenu[RECENT_MENU]->setEnabled( m_aRecentFileStreamInfo.size() > 0 ? true : false ); @@ -611,7 +618,7 @@ void MainWindow::updateMenus() m_arrayActions[RELOAD_ACT]->setEnabled( hasSubWindow ); m_arrayActions[RELOAD_ALL_ACT]->setEnabled( hasSubWindow ); - m_arrayActions[FORMAT_ACT]->setEnabled( hasVideoStreamSubWindow ); + m_arrayActions[FORMAT_ACT]->setEnabled( supportsFormat ); m_arrayActions[LOAD_ALL_ACT]->setEnabled( hasVideoStreamSubWindow ); m_arrayActions[ZOOM_IN_ACT]->setEnabled( hasSubWindow ); diff --git a/app/VideoStreamSubWindow.h b/app/VideoStreamSubWindow.h index f54173b..8624c6c 100644 --- a/app/VideoStreamSubWindow.h +++ b/app/VideoStreamSubWindow.h @@ -79,6 +79,8 @@ public: void setResourceManaget( ResourceHandle* resourceManager ) { m_pcResourceManager = resourceManager; } + bool supportsFormatConfiguration() const { return m_pCurrStream->supportsFormatConfiguration(); }; + bool loadFile( QString cFilename, bool bForceDialog = false ); bool loadFile( CalypFileInfo* streamInfo ); void loadAll(); diff --git a/lib/CalypStream.cpp b/lib/CalypStream.cpp index 7e6f54a..57d3a9a 100644 --- a/lib/CalypStream.cpp +++ b/lib/CalypStream.cpp @@ -396,9 +396,9 @@ bool CalypStream::open( std::string filename, unsigned int width, unsigned int h return d->isInit; } -bool CalypStream::supportsFormating() +bool CalypStream::supportsFormatConfiguration() { - if( d->handler != nullptr ) + if( d->handler == nullptr ) return false; return d->handler->m_bSupportsFormat; } diff --git a/lib/CalypStream.h b/lib/CalypStream.h index e82bec1..7492e5d 100644 --- a/lib/CalypStream.h +++ b/lib/CalypStream.h @@ -29,7 +29,6 @@ #include #include -#include "CalypDefs.h" #include "CalypFrame.h" class CalypStreamHandlerIf; @@ -90,7 +89,7 @@ public: bool open( std::string filename, unsigned int width, unsigned int height, int input_format, unsigned int bitsPel, int endianness, bool hasNegative, unsigned int frame_rate, bool bInput ); - bool supportsFormating(); + bool supportsFormatConfiguration(); bool reload(); bool isNative() const; diff --git a/lib/CalypStreamHandlerIf.h b/lib/CalypStreamHandlerIf.h index 60cb809..ff4b518 100644 --- a/lib/CalypStreamHandlerIf.h +++ b/lib/CalypStreamHandlerIf.h @@ -27,6 +27,7 @@ #include +#include "CalypDefs.h" #include "CalypStream.h" #define INI_REGIST_CALYP_SUPPORTED_FMT \