From e374022ea8ec372a2bb29d531d794c4f1b94f4c0 Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Thu, 3 Oct 2024 01:06:54 +0100 Subject: [PATCH] fix: build errors --- .github/workflows/build.yml | 3 --- app/CMakeLists.txt | 19 +--------------- app/MainWindow.cpp | 5 ++++- app/catch2/CMakeLists.txt | 2 +- app/catch2/CalypAppTests.cpp | 2 +- app/catch2/CalypResourcesTests.cpp | 2 +- app/models/CalypResource.h | 8 +++---- app/models/VideostreamResource.cpp | 35 +++++++++++++++--------------- app/models/VideostreamResource.h | 7 +++--- 9 files changed, 33 insertions(+), 50 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 27f2141..ef447c1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,9 +20,6 @@ jobs: # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix runs-on: ubuntu-latest name: Build (Linux) - env: - CC: gcc-13 - CXX: g++-13 steps: - name: Install dependencies run: sudo apt-get update && sudo apt-get install cmake qtbase5-dev libavcodec-dev libavformat-dev libavutil-dev libopencv-dev libopencv-video-dev libopencv-contrib-dev diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 773280f..4776076 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -197,22 +197,5 @@ INSTALL(FILES resources/calyp.png DESTINATION share/pixmaps) INSTALL(FILES resources/calyp.xml DESTINATION share/mime/packages) IF(BUILD_TESTS) - FETCHCONTENT_MAKEAVAILABLE(Catch2) - - SET(Calyp_App_Catch2_Tests_SRCS ${Calyp_App_Module_SRCS} catch2/CalypAppTests.cpp catch2/CalypResourcesTests.cpp) - - ADD_DEFINITIONS(-DCALYP_TEST_DATA_DIR=\"${CALYP_TEST_DATA_DIR}\") - - ADD_EXECUTABLE(CalypAppCatch2Tests ${Calyp_App_Catch2_Tests_SRCS}) - TARGET_LINK_LIBRARIES( - CalypAppCatch2Tests - ${PROJECT_LIBRARY} - CalypModules - ${APP_LINKER_LIBS} - ${QT_LINKER_LIBS} - QCustomPlotLib - Catch2::Catch2 - ) - CATCH_DISCOVER_TESTS(CalypAppCatch2Tests) - + ADD_SUBDIRECTORY(catch2) ENDIF() diff --git a/app/MainWindow.cpp b/app/MainWindow.cpp index e1def6f..a82d923 100644 --- a/app/MainWindow.cpp +++ b/app/MainWindow.cpp @@ -45,6 +45,7 @@ #include "VideoHandle.h" #include "VideoSubWindow.h" #include "lib/CalypOptions.h" +#include "models/VideostreamResource.h" #ifdef USE_FERVOR #include "fvupdater.h" #endif @@ -908,11 +909,13 @@ void MainWindow::addStreamInfoToRecentList( CalypFileInfo streamInfo ) if( idx >= 0 ) m_aRecentFileStreamInfo.remove( idx ); m_aRecentFileStreamInfo.prepend( streamInfo ); while( m_aRecentFileStreamInfo.size() > MAX_RECENT_FILES ) + { m_aRecentFileStreamInfo.remove( m_aRecentFileStreamInfo.size() - 1 ); + } updateRecentFileActions(); QSettings appSettings; QVariant var; - var.setValue( m_aRecentFileStreamInfo ); + var.setValue( m_aRecentFileStreamInfo ); appSettings.setValue( "MainWindow/RecentFileList", var ); } diff --git a/app/catch2/CMakeLists.txt b/app/catch2/CMakeLists.txt index a79c31c..e5bacc6 100644 --- a/app/catch2/CMakeLists.txt +++ b/app/catch2/CMakeLists.txt @@ -16,6 +16,6 @@ TARGET_LINK_LIBRARIES( ${APP_LINKER_LIBS} ${QT_LINKER_LIBS} QCustomPlotLib - Catch2::Catch2 + Catch2::Catch2WithMain ) CATCH_DISCOVER_TESTS(CalypAppCatch2Tests) diff --git a/app/catch2/CalypAppTests.cpp b/app/catch2/CalypAppTests.cpp index 7bff40f..2893178 100644 --- a/app/catch2/CalypAppTests.cpp +++ b/app/catch2/CalypAppTests.cpp @@ -23,4 +23,4 @@ */ #define CATCH_CONFIG_MAIN -#include +#include diff --git a/app/catch2/CalypResourcesTests.cpp b/app/catch2/CalypResourcesTests.cpp index b34f52a..96f46fb 100644 --- a/app/catch2/CalypResourcesTests.cpp +++ b/app/catch2/CalypResourcesTests.cpp @@ -23,7 +23,7 @@ */ #include -#include +#include #include #include #include diff --git a/app/models/CalypResource.h b/app/models/CalypResource.h index 3e739f0..276a7eb 100644 --- a/app/models/CalypResource.h +++ b/app/models/CalypResource.h @@ -42,10 +42,10 @@ public: protected: CalypResource() = default; - CalypResource( CalypResource&& other ) noexcept = delete; - CalypResource& operator=( CalypResource&& other ) noexcept = delete; - CalypResource( const CalypResource& other ) = delete; - CalypResource& operator=( const CalypResource& other ) = delete; + CalypResource( CalypResource&& other ) noexcept = default; + CalypResource& operator=( CalypResource&& other ) noexcept = default; + CalypResource( const CalypResource& other ) = default; + CalypResource& operator=( const CalypResource& other ) = default; }; #endif // __CALYPRESOURCE_H__ diff --git a/app/models/VideostreamResource.cpp b/app/models/VideostreamResource.cpp index 7e0b392..8d78d18 100644 --- a/app/models/VideostreamResource.cpp +++ b/app/models/VideostreamResource.cpp @@ -38,27 +38,25 @@ * \brief Functions to control data stream from stream information */ -QDataStream& operator<<( QDataStream& out, const CalypFileInfoVector& array ) +auto operator<<( QDataStream& out, const CalypFileInfoVector& infos ) -> QDataStream& { - CalypFileInfo d; - out << array.size(); - for( int i = 0; i < array.size(); i++ ) + out << infos.size(); + for( const auto& info : infos ) { - d = array.at( i ); - out << d.m_cFilename << d.m_uiWidth << d.m_uiHeight << static_cast( d.m_iPelFormat ) << d.m_uiBitsPelPixel - << d.m_iEndianness << d.m_uiFrameRate << d.m_uiFileSize << d.m_bForceRaw; + out << info.m_cFilename << info.m_uiWidth << info.m_uiHeight << static_cast( info.m_iPelFormat ) + << info.m_uiBitsPelPixel << info.m_iEndianness << info.m_uiFrameRate << info.m_uiFileSize << info.m_bForceRaw; } return out; } -QDataStream& operator>>( QDataStream& in, CalypFileInfoVector& array ) +auto operator>>( QDataStream& in, CalypFileInfoVector& infos ) -> QDataStream& { - int array_size{ 0 }; + auto array_size = infos.size(); in >> array_size; for( int i = 0; i < array_size; i++ ) { CalypFileInfo d; - int pelFormat; + int pelFormat{ 0 }; in >> d.m_cFilename; in >> d.m_uiWidth; in >> d.m_uiHeight; @@ -69,7 +67,7 @@ QDataStream& operator>>( QDataStream& in, CalypFileInfoVector& array ) in >> d.m_uiFileSize; in >> d.m_bForceRaw; d.m_iPelFormat = static_cast( pelFormat ); - array.append( d ); + infos.append( d ); } return in; } @@ -77,8 +75,9 @@ QDataStream& operator>>( QDataStream& in, CalypFileInfoVector& array ) auto findCalypStreamInfo( const CalypFileInfoVector& array, const QString& filename ) -> int { for( int i = 0; i < array.size(); i++ ) - if( array.at( i ).m_cFilename == filename ) - return i; + { + if( array.at( i ).m_cFilename == filename ) return i; + } return -1; } @@ -160,8 +159,7 @@ void VideostreamResource::pause() void VideostreamResource::seekAbsoluteEvent( unsigned int new_frame_num ) { - if( m_currStream.seekInput( new_frame_num ) ) - triggerRefresh(); + if( m_currStream.seekInput( new_frame_num ) ) triggerRefresh(); } void VideostreamResource::seekRelativeEvent( bool bIsForward ) @@ -186,7 +184,9 @@ void VideostreamResource::stop() auto VideostreamResource::goToNextFrame( bool bThreaded ) -> bool { - while( !m_currStream.hasNextFrame() && !m_currStream.isEof() ) {} + while( !m_currStream.hasNextFrame() && !m_currStream.isEof() ) + { + } bool bEndOfSeq = m_currStream.setNextFrame(); if( !bEndOfSeq ) { @@ -345,8 +345,7 @@ auto video_resource_guess_format( const QString& filename, unsigned int& rWidth, rEndianness = CLP_LITTLE_ENDIAN; } - if( rWidth > 0 && rHeight > 0 && rInputFormat != ClpPixelFormats::Invalid ) - bGuessed = true && !bGuessedByFilesize; + if( rWidth > 0 && rHeight > 0 && rInputFormat != ClpPixelFormats::Invalid ) bGuessed = true && !bGuessedByFilesize; } return bGuessed; } \ No newline at end of file diff --git a/app/models/VideostreamResource.h b/app/models/VideostreamResource.h index def1440..4347f76 100644 --- a/app/models/VideostreamResource.h +++ b/app/models/VideostreamResource.h @@ -45,10 +45,11 @@ struct CalypFileInfo unsigned long long int m_uiFileSize; bool m_bForceRaw{ false }; }; + using CalypFileInfoVector = QVector; -QDataStream& operator<<( QDataStream& out, const CalypFileInfoVector& d ); -QDataStream& operator>>( QDataStream& in, CalypFileInfoVector& d ); +auto operator<<( QDataStream& out, const CalypFileInfoVector& infos ) -> QDataStream&; +auto operator>>( QDataStream& in, CalypFileInfoVector& infos ) -> QDataStream&; auto findCalypStreamInfo( const CalypFileInfoVector& array, const QString& filename ) -> int; class VideostreamResource : public QObject, public CalypResource @@ -88,7 +89,7 @@ private: // Q_SIGNALS: // private Q_SLOTS: -private: +private: // NOLINT CalypStream m_currStream; CalypFileInfo m_sStreamInfo;