Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eb31fc0287 | ||
|
|
ed075fcbd3 | ||
|
|
3581d2787d | ||
|
|
122e8ec990 |
No files matched your search
@@ -1,45 +0,0 @@
|
||||
image: Visual Studio 2017
|
||||
configuration: Release
|
||||
platform:
|
||||
- x64
|
||||
environment:
|
||||
access_token:
|
||||
secure: WAV5LfCSAtwE1JuZh4HrDlxOOClimLoslYAJlf5KRgc3f7WIkX591PrSSua/Zo2C
|
||||
|
||||
clone_folder: C:\Projects\calyp
|
||||
|
||||
init:
|
||||
- ps: Add-Content "$HOME\.git-credentials" "https://$($env:access_token):x-oauth-basic@github.com`n"
|
||||
- git config --global credential.helper store
|
||||
- git config --global user.email "jfmcarreira@gmail.com"
|
||||
- git config --global user.name "AppVeyor"
|
||||
- ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
||||
|
||||
install:
|
||||
- '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x64'
|
||||
#- '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64'
|
||||
- choco install nsis
|
||||
- choco install opencv
|
||||
- 'C:\Tools\opencv\build\setup_vars_opencv4.cmd'
|
||||
- cd C:\Projects
|
||||
- ps: Start-FileDownload 'https://ffmpeg.zeranoe.com/builds/win64/dev/ffmpeg-4.1.1-win64-dev.zip'
|
||||
- 7z x ffmpeg-4.1.1-win64-dev.zip -y
|
||||
- git clone https://github.com/pixlra/calyp-deployment.git
|
||||
|
||||
|
||||
build_script:
|
||||
- mv C:\Projects\calyp C:\Projects\calyp-deployment\cmake-helper\
|
||||
- mkdir C:\Projects\calyp-build
|
||||
- cd C:\Projects\calyp-build
|
||||
- cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DUSE_DYNLOAD=OFF -DOpenCV_DIR="C:/Tools/opencv/build" -DOpenCV_DLL_DIR="C:/Tools/opencv/build/x64/vc15/bin" -DOpenCV_INSTALL_MODULES="world" -DQT_DIR="C:\Qt\latest\msvc2017_64" -DQt5_DIR="C:\Qt\latest\msvc2017_64\lib\cmake\Qt5" -DUSE_QTDBUS=OFF -DAVFORMAT_LIBRARIES=C:/Projects/ffmpeg-4.1.1-win64-dev/lib/avformat.lib -DAVFORMAT_INCLUDE_DIRS=C:/Projects/ffmpeg-4.1.1-win64-dev/include -DAVCODEC_LIBRARIES=C:/Projects/ffmpeg-4.1.1-win64-dev/lib/avcodec.lib -DAVCODEC_INCLUDE_DIRS=C:/Projects/ffmpeg-4.1.1-win64-dev/include -DAVUTIL_LIBRARIES=C:/Projects/ffmpeg-4.1.1-win64-dev/lib/avutil.lib -DAVUTIL_INCLUDE_DIRS=C:/Projects/ffmpeg-4.1.1-win64-dev/include -DSWSCALE_LIBRARIES=C:/Projects/ffmpeg-4.1.1-win64-dev/lib/swscale.lib -DSWSCALE_INCLUDE_DIRS=C:/Projects/ffmpeg-4.1.1-win64-dev/include -G "Visual Studio 15 2017 Win64" C:\Projects\calyp-deployment\cmake-helper
|
||||
- cmake --build . --target ALL_BUILD -- /p:Configuration=Release > log_build
|
||||
- cmake --build . --target INSTALL -- /p:Configuration=Release > log_install
|
||||
- cmake --build . --target PACKAGE -- /p:Configuration=Release > log_pkg
|
||||
|
||||
after_build:
|
||||
- IF "%APPVEYOR_REPO_BRANCH%" == "master" (CALL ..\calyp-deployment\scripts\deploy-to-github.bat)
|
||||
|
||||
|
||||
on_failure:
|
||||
- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
||||
|
||||
+21
-20
@@ -1,7 +1,7 @@
|
||||
---
|
||||
BasedOnStyle: Google
|
||||
Language: Cpp
|
||||
ColumnLimit: 0
|
||||
# BasedOnStyle: Chromium
|
||||
ColumnLimit: 100
|
||||
AccessModifierOffset: -2
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveAssignments: false
|
||||
@@ -15,29 +15,31 @@ AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: Inline
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: false
|
||||
AlwaysBreakBeforeMultilineStrings: true
|
||||
AlwaysBreakTemplateDeclarations: true
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
BinPackParameters: false
|
||||
BraceWrapping:
|
||||
AfterNamespace: true
|
||||
AfterClass: true
|
||||
AfterEnum: true
|
||||
AfterFunction: true
|
||||
AfterStruct: true
|
||||
AfterUnion: true
|
||||
AfterControlStatement: true
|
||||
AfterObjCDeclaration: true
|
||||
BeforeCatch: true
|
||||
BeforeElse: true
|
||||
IndentBraces: false
|
||||
BreakBeforeBraces: Custom
|
||||
AfterClass: false
|
||||
AfterControlStatement: false
|
||||
AfterEnum: false
|
||||
AfterFunction: false
|
||||
AfterNamespace: false
|
||||
AfterObjCDeclaration: false
|
||||
AfterStruct: false
|
||||
AfterUnion: false
|
||||
BeforeCatch: false
|
||||
BeforeElse: false
|
||||
IndentBraces: false
|
||||
BreakBeforeBinaryOperators: None
|
||||
#BreakBeforeBraces: Attach
|
||||
BreakBeforeBraces: Allman
|
||||
BreakBeforeInheritanceComma: false
|
||||
BreakBeforeTernaryOperators: false
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializersBeforeComma: true
|
||||
BreakConstructorInitializersBeforeComma: true
|
||||
BreakConstructorInitializers: BeforeColon
|
||||
BreakAfterJavaFieldAnnotations: false
|
||||
BreakStringLiterals: true
|
||||
CommentPragmas: '^ IWYU pragma:'
|
||||
@@ -87,11 +89,10 @@ SpacesBeforeTrailingComments: 2
|
||||
SpacesInAngles: false
|
||||
SpacesInContainerLiterals: true
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SortIncludes: true
|
||||
SpacesInParentheses: true
|
||||
SpacesInSquareBrackets: false
|
||||
Standard: Auto
|
||||
TabWidth: 2
|
||||
TabWidth: 8
|
||||
UseTab: Never
|
||||
...
|
||||
|
||||
-135
@@ -1,135 +0,0 @@
|
||||
# Created by https://www.gitignore.io/api/c++,clion,linux
|
||||
# Edit at https://www.gitignore.io/?templates=c++,clion,linux
|
||||
|
||||
### C++ ###
|
||||
# Prerequisites
|
||||
*.d
|
||||
|
||||
# Compiled Object files
|
||||
*.slo
|
||||
*.lo
|
||||
*.o
|
||||
*.obj
|
||||
|
||||
# Precompiled Headers
|
||||
*.gch
|
||||
*.pch
|
||||
|
||||
# Compiled Dynamic libraries
|
||||
*.so
|
||||
*.dylib
|
||||
*.dll
|
||||
|
||||
# Fortran module files
|
||||
*.mod
|
||||
*.smod
|
||||
|
||||
# Compiled Static libraries
|
||||
*.lai
|
||||
*.la
|
||||
*.a
|
||||
*.lib
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
|
||||
### CLion ###
|
||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
|
||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||
|
||||
# User-specific stuff
|
||||
.idea/
|
||||
.idea/**/workspace.xml
|
||||
.idea/**/tasks.xml
|
||||
.idea/**/usage.statistics.xml
|
||||
.idea/**/dictionaries
|
||||
.idea/**/shelf
|
||||
|
||||
# Generated files
|
||||
.idea/**/contentModel.xml
|
||||
|
||||
# Sensitive or high-churn files
|
||||
.idea/**/dataSources/
|
||||
.idea/**/dataSources.ids
|
||||
.idea/**/dataSources.local.xml
|
||||
.idea/**/sqlDataSources.xml
|
||||
.idea/**/dynamic.xml
|
||||
.idea/**/uiDesigner.xml
|
||||
.idea/**/dbnavigator.xml
|
||||
|
||||
# Gradle
|
||||
.idea/**/gradle.xml
|
||||
.idea/**/libraries
|
||||
|
||||
# Gradle and Maven with auto-import
|
||||
# When using Gradle or Maven with auto-import, you should exclude module files,
|
||||
# since they will be recreated, and may cause churn. Uncomment if using
|
||||
# auto-import.
|
||||
# .idea/modules.xml
|
||||
# .idea/*.iml
|
||||
# .idea/modules
|
||||
|
||||
# CMake
|
||||
bin/
|
||||
build/
|
||||
cmake-build-*/
|
||||
|
||||
# Mongo Explorer plugin
|
||||
.idea/**/mongoSettings.xml
|
||||
|
||||
# File-based project format
|
||||
*.iws
|
||||
|
||||
# IntelliJ
|
||||
out/
|
||||
|
||||
# mpeltonen/sbt-idea plugin
|
||||
.idea_modules/
|
||||
|
||||
# JIRA plugin
|
||||
atlassian-ide-plugin.xml
|
||||
|
||||
# Cursive Clojure plugin
|
||||
.idea/replstate.xml
|
||||
|
||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||
com_crashlytics_export_strings.xml
|
||||
crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
fabric.properties
|
||||
|
||||
# Editor-based Rest Client
|
||||
.idea/httpRequests
|
||||
|
||||
# Android studio 3.1+ serialized cache file
|
||||
.idea/caches/build_file_checksums.ser
|
||||
|
||||
### CLion Patch ###
|
||||
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
|
||||
|
||||
# *.iml
|
||||
# modules.xml
|
||||
# .idea/misc.xml
|
||||
# *.ipr
|
||||
|
||||
# Sonarlint plugin
|
||||
.idea/sonarlint
|
||||
|
||||
### Linux ###
|
||||
*~
|
||||
|
||||
# temporary files which can be created if a process still has a handle open of a deleted file
|
||||
.fuse_hidden*
|
||||
|
||||
# KDE directory preferences
|
||||
.directory
|
||||
|
||||
# Linux trash folder which might appear on any partition or disk
|
||||
.Trash-*
|
||||
|
||||
# .nfs files are created when an open file is removed but is still being accessed
|
||||
.nfs*
|
||||
|
||||
# End of https://www.gitignore.io/api/c++,clion,linux
|
||||
Generated
-2
@@ -1,2 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module classpath="CMake" type="CPP_MODULE" version="4" />
|
||||
Generated
-4
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding" addBOMForNewFiles="with NO BOM" />
|
||||
</project>
|
||||
Generated
-7
@@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
|
||||
<component name="JavaScriptSettings">
|
||||
<option name="languageLevel" value="ES6" />
|
||||
</component>
|
||||
</project>
|
||||
Generated
-8
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/calyp.iml" filepath="$PROJECT_DIR$/.idea/calyp.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
Generated
-6
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
+2
-3
@@ -2,6 +2,5 @@ language: cpp
|
||||
dist: xenial
|
||||
before_install:
|
||||
- sudo apt-get -qq update
|
||||
- sudo apt-get install build-essential cmake qtbase5-dev libavcodec-dev libavformat-dev libavutil-dev libopencv-dev libopencv-video-dev libopencv-contrib-dev
|
||||
script:
|
||||
- mkdir -p build && cd build && cmake .. && make && cd ..
|
||||
- sudo apt-get install build-essential cmake qtbase5-dev libavcodec-dev libavformat-dev libavutil-dev libopencv-dev libopencv-video-dev
|
||||
script: mkdir -p build && cd build && cmake .. && make && cd ..
|
||||
+31
-78
@@ -1,5 +1,5 @@
|
||||
###
|
||||
### CMakeLists for calyp
|
||||
### CMakeLists for playuver
|
||||
###
|
||||
|
||||
cmake_minimum_required( VERSION 3.2.0 )
|
||||
@@ -16,15 +16,13 @@ INCLUDE(GNUInstallDirs)
|
||||
# Project Definition
|
||||
######################################################################################
|
||||
|
||||
SET( PROJECT_NAME "calyp" CACHE INTERNAL "" FORCE )
|
||||
SET( PROJECT_LIBRARY "Calyp" CACHE INTERNAL "" FORCE )
|
||||
|
||||
set( PROJECT_NAME "playuver" CACHE INTERNAL "" FORCE )
|
||||
|
||||
PROJECT( ${PROJECT_NAME} )
|
||||
SET( CALYP_VERSION_MAJOR "1" )
|
||||
SET( CALYP_VERSION_MINOR "1" )
|
||||
SET( CALYP_VERSION_PATCH "0" )
|
||||
SET( CALYP_VERSION "${CALYP_VERSION_MAJOR}.${CALYP_VERSION_MINOR}.${CALYP_VERSION_PATCH}" CACHE INTERNAL "" FORCE )
|
||||
SET( PLAYUVER_VERSION_MAJOR "0" )
|
||||
SET( PLAYUVER_VERSION_MINOR "14" )
|
||||
SET( PLAYUVER_VERSION_PATCH "1" )
|
||||
SET( PLAYUVER_VERSION "${PLAYUVER_VERSION_MAJOR}.${PLAYUVER_VERSION_MINOR}.${PLAYUVER_VERSION_PATCH}" CACHE INTERNAL "" FORCE )
|
||||
|
||||
######################################################################################
|
||||
# Variables
|
||||
@@ -34,7 +32,7 @@ OPTION( BUILD_APP "Build GUI Application" ON )
|
||||
OPTION( BUILD_TOOLS "Build Command Line Application" ON )
|
||||
OPTION( BUILD_EXAMPLES "Build Examples" OFF )
|
||||
OPTION( BUILD_DOC "Build Documentation" OFF )
|
||||
OPTION( BUILD_TESTS "Build Google Tests" OFF )
|
||||
OPTION( BUILD_TESTS "Build Google Tests" ON )
|
||||
|
||||
OPTION( USE_FERVOR "Add Fervor support" OFF )
|
||||
|
||||
@@ -52,7 +50,7 @@ OPTION( USE_STATIC "Use static libs" OFF )
|
||||
OPTION(RELEASE_BUILD "Remove Git revision from program version (use for stable releases)" ON)
|
||||
|
||||
# Get current version.
|
||||
set(CALYP_VERSION_STRING "${CALYP_VERSION}")
|
||||
set(PLAYUVER_VERSION_STRING "${PLAYUVER_VERSION}")
|
||||
if(NOT RELEASE_BUILD AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
|
||||
# Probably a Git workspace; determine the revision.
|
||||
FIND_PACKAGE(Git QUIET)
|
||||
@@ -60,7 +58,7 @@ if(NOT RELEASE_BUILD AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
|
||||
exec_program(${GIT_EXECUTABLE}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
ARGS "describe --tags"
|
||||
OUTPUT_VARIABLE CALYP_GIT_REVISION
|
||||
OUTPUT_VARIABLE PLAYUVER_GIT_REVISION
|
||||
RETURN_VALUE TAG_RESULT
|
||||
)
|
||||
# git describe --tags failed; maybe the repository was checked with depth=1.
|
||||
@@ -68,18 +66,18 @@ if(NOT RELEASE_BUILD AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
|
||||
exec_program(${GIT_EXECUTABLE}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
ARGS "describe --always"
|
||||
OUTPUT_VARIABLE CALYP_GIT_REVISION
|
||||
OUTPUT_VARIABLE PLAYUVER_GIT_REVISION
|
||||
)
|
||||
endif()
|
||||
message(STATUS "Calyp Git revision: ${CALYP_GIT_REVISION}")
|
||||
set(CALYP_VERSION_STRING "${CALYP_VERSION} (rev. ${CALYP_GIT_REVISION})")
|
||||
message(STATUS "PlaYUVer Git revision: ${PLAYUVER_GIT_REVISION}")
|
||||
set(PLAYUVER_VERSION_STRING "${PLAYUVER_VERSION} (rev. ${PLAYUVER_GIT_REVISION})")
|
||||
else()
|
||||
message(STATUS "Calyp Git revision could not be determined")
|
||||
message(STATUS "PlaYUVer Git revision could not be determined")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
SET(UPDATE_CHANNEL "stable" CACHE STRING "Update channel" )
|
||||
# CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/CalypUpdate.xml.in ${CMAKE_CURRENT_BINARY_DIR}/CalypUpdate-${UPDATE_CHANNEL}.xml )
|
||||
CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/PlaYUVerUpdate.xml.in ${CMAKE_CURRENT_BINARY_DIR}/PlaYUVerUpdate-${UPDATE_CHANNEL}.xml )
|
||||
|
||||
|
||||
######################################################################################
|
||||
@@ -103,43 +101,25 @@ IF( BUILD_TESTS )
|
||||
ENDIF()
|
||||
|
||||
OPTION( USE_OPENCV "Add OpenCV support" ON )
|
||||
SET( OPENCV_OPTFLOW_FOUND OFF )
|
||||
IF( USE_OPENCV )
|
||||
|
||||
FIND_PACKAGE( OpenCV COMPONENTS core highgui imgproc video )
|
||||
IF( ${OpenCV_FOUND} )
|
||||
SET(USE_OPENCV TRUE )
|
||||
LIST(APPEND OPENCV_MODULES core highgui imgproc video )
|
||||
FIND_PACKAGE( OpenCV COMPONENTS videoio photo )
|
||||
IF( ${OPENCV_VIDEOIO_FOUND} )
|
||||
LIST(APPEND OPENCV_MODULES videoio )
|
||||
ENDIF()
|
||||
IF( ${OPENCV_PHOTO_FOUND} )
|
||||
LIST(APPEND OPENCV_MODULES photo )
|
||||
ENDIF()
|
||||
ELSE()
|
||||
SET(USE_OPENCV FALSE )
|
||||
ENDIF()
|
||||
LIST(APPEND OPENCV_MODULES core highgui imgproc video videoio )
|
||||
FIND_PACKAGE( OpenCV COMPONENTS ${OPENCV_MODULES} )
|
||||
SET(USE_OPENCV ${OpenCV_FOUND})
|
||||
ENDIF()
|
||||
SET_PACKAGE_PROPERTIES(OpenCV PROPERTIES URL "http://opencv.willowgarage.com" DESCRIPTION "OpenCV library support in CalypFrame" TYPE OPTIONAL)
|
||||
SET_PACKAGE_PROPERTIES(OpenCV PROPERTIES URL "http://opencv.willowgarage.com" DESCRIPTION "OpenCV library support in PlaYUVerFrame" TYPE OPTIONAL)
|
||||
|
||||
OPTION( USE_FFMPEG "Add FFMPEG support" ON )
|
||||
IF( USE_FFMPEG )
|
||||
FIND_PACKAGE( FFmpeg COMPONENTS AVCODEC AVFORMAT AVUTIL SWSCALE )
|
||||
IF( "${AVCODEC_VERSION}" VERSION_LESS "56.0.0" )
|
||||
SET(FFMPEG_FOUND FALSE )
|
||||
SET(FFmpeg_FOUND FALSE )
|
||||
ENDIF()
|
||||
FIND_PACKAGE( FFmpeg )
|
||||
SET(USE_FFMPEG ${FFMPEG_FOUND})
|
||||
ENDIF()
|
||||
SET_PACKAGE_PROPERTIES(FFmpeg PROPERTIES URL "http://ffmpeg.org/" DESCRIPTION "Libav library support in CalypStream" TYPE OPTIONAL)
|
||||
SET_PACKAGE_PROPERTIES(FFmpeg PROPERTIES URL "http://ffmpeg.org/" DESCRIPTION "Libav library support in PlaYUVerStream" TYPE OPTIONAL)
|
||||
|
||||
ADD_FEATURE_INFO(DynLoad USE_DYNLOAD "Support for dynamic module load" )
|
||||
ADD_FEATURE_INFO(SSE USE_SSE "SSE instructions support" )
|
||||
ADD_FEATURE_INFO(WErrors USE_WERROR "Warnings as errors" )
|
||||
|
||||
OPTION( USE_PYTHON "Add Python support" ON )
|
||||
IF( USE_PYTHON )
|
||||
#FIND_PACKAGE(Python2 REQUIRED COMPONENTS Development NumPy)
|
||||
FIND_PACKAGE(Python3 REQUIRED COMPONENTS Development NumPy)
|
||||
LIST(APPEND PYTHON_LINKER_LIBRARIES Python3::Python Python3::NumPy )
|
||||
ENDIF()
|
||||
SET_PACKAGE_PROPERTIES(Python PROPERTIES URL "http://ffmpeg.org/" DESCRIPTION "Python support in Calyp modules" TYPE OPTIONAL)
|
||||
|
||||
IF( WIN32 )
|
||||
SET( USE_STATIC ON )
|
||||
@@ -161,10 +141,8 @@ IF(DEFINED CMAKE_BUILD_TYPE AND CMAKE_VERSION VERSION_GREATER "2.8")
|
||||
ENDIF()
|
||||
SET( CMAKE_CXX_FLAGS "" )
|
||||
|
||||
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} )
|
||||
|
||||
######################################################################################
|
||||
# Compiler options
|
||||
# Configure targets
|
||||
######################################################################################
|
||||
|
||||
SET(CMAKE_CXX_STANDARD 14)
|
||||
@@ -179,25 +157,6 @@ ENDIF()
|
||||
|
||||
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall" )
|
||||
|
||||
ADD_DEFINITIONS(-DQT_NO_CAST_TO_ASCII
|
||||
#-DQT_NO_CAST_FROM_ASCII
|
||||
-DQT_NO_URL_CAST_FROM_STRING
|
||||
-DQT_NO_CAST_FROM_BYTEARRAY
|
||||
#-DQT_NO_SIGNALS_SLOTS_KEYWORDS
|
||||
#-DQT_USE_QSTRINGBUILDER
|
||||
)
|
||||
|
||||
# if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic")
|
||||
# endif()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.0.0")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wlogical-op" )
|
||||
endif()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations" )
|
||||
endif()
|
||||
|
||||
IF( USE_WERROR )
|
||||
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror" )
|
||||
ENDIF()
|
||||
@@ -206,15 +165,11 @@ SET( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -O0" )
|
||||
SET( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2" )
|
||||
|
||||
|
||||
######################################################################################
|
||||
# Configure targets
|
||||
######################################################################################
|
||||
ADD_FEATURE_INFO(PlaYUVerApp BUILD_APP "Build Graphical Interface")
|
||||
ADD_FEATURE_INFO(PlaYUVerTools BUILD_TOOLS "Build Command line tool" )
|
||||
|
||||
ADD_FEATURE_INFO(CalypApp BUILD_APP "Build Graphical interface")
|
||||
ADD_FEATURE_INFO(CalypTools BUILD_TOOLS "Build Command line tool" )
|
||||
ADD_FEATURE_INFO(DynLoad USE_DYNLOAD "Support for dynamic module load" )
|
||||
ADD_FEATURE_INFO(SSE USE_SSE "SSE instructions support" )
|
||||
ADD_FEATURE_INFO(WErrors USE_WERROR "Warnings as errors" )
|
||||
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} )
|
||||
CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h )
|
||||
|
||||
ADD_SUBDIRECTORY( lib )
|
||||
ADD_SUBDIRECTORY( modules )
|
||||
@@ -232,14 +187,12 @@ IF( ${BUILD_EXAMPLES} )
|
||||
ENDIF()
|
||||
|
||||
|
||||
CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h )
|
||||
|
||||
######################################################################################
|
||||
# Final information dump
|
||||
######################################################################################
|
||||
MESSAGE("")
|
||||
MESSAGE( STATUS "${PROJECT_NAME} INFORMATION" )
|
||||
MESSAGE( STATUS "Version: " "${CALYP_VERSION_STRING}" )
|
||||
MESSAGE( STATUS "Version: " "${PLAYUVER_VERSION_STRING}" )
|
||||
MESSAGE( STATUS "Configuration:" )
|
||||
MESSAGE( STATUS " Static libs: " "${USE_STATIC}" )
|
||||
MESSAGE( STATUS " Build type: " "${CMAKE_BUILD_TYPE}" )
|
||||
|
||||
@@ -32,7 +32,7 @@ DOXYFILE_ENCODING = UTF-8
|
||||
# title of most generated pages and in a few other places.
|
||||
# The default value is: My Project.
|
||||
|
||||
PROJECT_NAME = Calyp
|
||||
PROJECT_NAME = PlaYUVer
|
||||
|
||||
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
|
||||
# could be handy for archiving the generated documentation or if some version
|
||||
@@ -51,7 +51,7 @@ PROJECT_BRIEF =
|
||||
# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
|
||||
# the logo to the output directory.
|
||||
|
||||
PROJECT_LOGO = app/resources/calyp.ico
|
||||
PROJECT_LOGO = /home/joaoc/Programming/PlaYUVerDev/playuver/app/resources/playuver.ico
|
||||
|
||||
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
|
||||
# into which the generated documentation will be written. If a relative path is
|
||||
@@ -793,7 +793,7 @@ WARN_LOGFILE =
|
||||
INPUT =
|
||||
|
||||
# This tag can be used to specify the character encoding of the source files
|
||||
# that doxygen parses. internally doxygen uses the UTF-8 encoding. Doxygen uses
|
||||
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
|
||||
# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
|
||||
# documentation (see: http://www.gnu.org/software/libiconv) for the list of
|
||||
# possible encodings.
|
||||
@@ -2367,7 +2367,7 @@ DOT_IMAGE_FORMAT = png
|
||||
# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
|
||||
# enable generation of interactive SVG images that allow zooming and panning.
|
||||
#
|
||||
# Note that this requires a modern browser other than internet Explorer. Tested
|
||||
# Note that this requires a modern browser other than Internet Explorer. Tested
|
||||
# and working are Firefox, Chrome, Safari, and Opera.
|
||||
# Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml in order to make
|
||||
# the SVG files visible. Older versions of IE do not have SVG support.
|
||||
|
||||
+15
-19
@@ -1,9 +1,9 @@
|
||||
/** @mainpage Calyp Project
|
||||
/** @mainpage PlaYUVer Project
|
||||
|
||||
Description
|
||||
----------------------------------------------------------------
|
||||
|
||||
Calyp is an open-source video player with the following features:
|
||||
PlaYUVer is an open-source video player with the following features:
|
||||
- Support for libavformat and libavcodec;
|
||||
- Support for wide range of raw video formats;
|
||||
- Support up to 16 bits per pixel
|
||||
@@ -12,17 +12,17 @@ Calyp is an open-source video player with the following features:
|
||||
- Synchronized zoom across several videos (perfect for comparison operations)
|
||||
- Useful information in status bar, *e.g.*, pixel information
|
||||
Useful sidebars with frame information, *e.g.*, frame histogram
|
||||
- Constant growing libs for stream and frame processing (CalypStream and CalypFrame)
|
||||
- Constant growing libs for stream and frame processing (PlaYUVerStream and PlaYUVerFrame)
|
||||
- Advanced API for frame/video processing algorithms
|
||||
- Frame level quality measurement API based on the CalypFrame class
|
||||
- Frame level quality measurement API based on the PlaYUVerFrame class
|
||||
- Powefull command-line tool for quality and frame processing algorithms (uses the referred APIs)
|
||||
|
||||
Modules
|
||||
----------------------------------------------------------------
|
||||
- CalypLib: Low level library
|
||||
- CalypModules: Abstract interface for frame processing modules
|
||||
- Calyp: High level graphical interface
|
||||
- CalypTools: High level command line interface
|
||||
- PlaYUVerLib: Low level library
|
||||
- PlaYUVerModules: Abstract interface for frame processing modules
|
||||
- PlaYUVerApp: High level graphical interface
|
||||
- PlaYUVerTools: High level command line interface
|
||||
|
||||
|
||||
Supported Quality Metrics
|
||||
@@ -44,26 +44,22 @@ Frame Processing Modules
|
||||
Supported Formats
|
||||
----------------------------------------------------------------
|
||||
- Supports for the following pixel formats:
|
||||
* YUV: 444, 420, 422
|
||||
* YUV: 420, 44, 422, 400
|
||||
* RGB
|
||||
* Gray
|
||||
- Supported formats:
|
||||
* Raw video:
|
||||
* YUV: 444, 420, 422
|
||||
* RGB
|
||||
* Gray
|
||||
* Joint Photographic Experts Group (jpeg)
|
||||
* Portable Map (ppm, pgm)
|
||||
- Partially supported formats:
|
||||
- Support containers:
|
||||
* Raw video (yuv,rgb,gray)
|
||||
* Portable Network Graphics (png)
|
||||
* Joint Photographic Experts Group (jpeg)
|
||||
* Windows Bitmap (bmp)
|
||||
* Tagged Image File Format (tiff)
|
||||
* Portable Map (ppm,pgm,pbm)
|
||||
|
||||
Developers
|
||||
----------------------------------------------------------------
|
||||
|
||||
- Joao Carreira (jfmcarreira@gmail.com)
|
||||
- Luis Lucas (luisfrlucas@gmail.com)
|
||||
- Luis Lucas (luisfrlucas@gmail.com)
|
||||
|
||||
Builds
|
||||
----------------------------------------------------------------
|
||||
@@ -83,7 +79,7 @@ Build/Install using cmake
|
||||
- OpenCv
|
||||
- FFmpeg
|
||||
|
||||
3. Run the following commands: (this will create an executable named calyp)
|
||||
3. Run the following commands: (this will create an executable named playuver)
|
||||
```
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<rss
|
||||
version="2.0"
|
||||
xmlns:atom="http://www.w3.org/2005/Atom"
|
||||
xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle"
|
||||
xmlns:fervor="https://github.com/pypt/fervor"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/">
|
||||
|
||||
<channel>
|
||||
<title>Your Great App's Changelog</title>
|
||||
<link>http://pypt.github.com/fervor/Appcast.xml</link>
|
||||
<description>Most recent changes with links to updates.</description>
|
||||
<language>en</language>
|
||||
<atom:link href="http://pypt.github.com/fervor/Appcast.xml" rel="self" type="application/rss+xml" />
|
||||
|
||||
<item>
|
||||
<title>Version @PLAYUVER_VERSION_STRING@</title>
|
||||
<pubDate>Mon, 09 Jan 2006 19:20:11 +0000</pubDate>
|
||||
<guid isPermaLink="true">http://192.168.96.201/share/PlaYUVerProject/ReleaseNotes-@UPDATE_CHANNEL@.html</guid>
|
||||
|
||||
<!-- One of those (<link> is preferred by Fervor, <sparkle:releaseNotesLink> is used by Sparkle) -->
|
||||
<link>http://192.168.96.201/share/PlaYUVerProject/ReleaseNotes-@UPDATE_CHANNEL@.html</link> <!-- or -->
|
||||
<sparkle:releaseNotesLink>http://192.168.96.201/share/PlaYUVerProject/ReleaseNotes-@UPDATE_CHANNEL@.html</sparkle:releaseNotesLink>
|
||||
|
||||
<!--
|
||||
See QtGlobal's QT_OS_* constants for valid platform versions.
|
||||
-->
|
||||
|
||||
<!-- Windows version. -->
|
||||
<enclosure
|
||||
url="http://sourceforge.net/projects/playuver/files/playuver-@UPDATE_CHANNEL@-windows-amd64.zip/download "
|
||||
fervor:version="@PLAYUVER_VERSION_STRING@"
|
||||
fervor:platform="Q_OS_WIN32"
|
||||
fervor:dependencies="ALL"
|
||||
type="application/octet-stream" />
|
||||
|
||||
<!-- Linux version. -->
|
||||
<enclosure
|
||||
url="http://sourceforge.net/projects/playuver/files/playuver-@UPDATE_CHANNEL@-linux-amd64.zip/download"
|
||||
fervor:version="@PLAYUVER_VERSION_STRING@"
|
||||
fervor:platform="Q_OS_LINUX"
|
||||
fervor:dependencies="ALL"
|
||||
type="application/octet-stream" />
|
||||
|
||||
|
||||
</item>
|
||||
|
||||
</channel>
|
||||
</rss>
|
||||
@@ -1,12 +1,6 @@
|
||||
# Calyp
|
||||
# [PlaYUVer](https://github.com/pixlra/playuver)
|
||||
## Enhanced YUV video player based on Qt focusing on image/video analysis
|
||||
|
||||
## Build Status
|
||||
|
||||
Master branch | Development branch
|
||||
------------ | -------------
|
||||
[](https://travis-ci.org/pixlra/calyp.svg?branch=master) [](https://ci.appveyor.com/project/jfmcarreira/calyp/branch/master) | Comming soon!
|
||||
|
||||
|
||||
## Features
|
||||
- Support for libavformat and libavcodec;
|
||||
@@ -17,26 +11,25 @@ Master branch | Development branch
|
||||
- Synchronized zoom across several videos (perfect for comparison operations)
|
||||
- Useful information in status bar, *e.g.*, pixel information
|
||||
Useful sidebars with frame information, *e.g.*, frame histogram
|
||||
- Constant growing libs for stream and frame processing (CalypStream and CalypFrame)
|
||||
- Constant growing libs for stream and frame processing (PlaYUVerStream and PlaYUVerFrame)
|
||||
- Advanced API for frame/video processing algorithms
|
||||
- Frame level quality measurement API based on the CalypFrame class
|
||||
- Frame level quality measurement API based on the PlaYUVerFrame class
|
||||
- Powefull command-line tool for quality and frame processing algorithms (uses the referred APIs)
|
||||
|
||||
## Modules
|
||||
- CalypLib: Low level library
|
||||
- CalypModules: Abstract interface for frame processing modules
|
||||
- Calyp: High level graphical interface
|
||||
- CalypTools: High level command line interface
|
||||
- PlaYUVerLib: Low level library
|
||||
- PlaYUVerModules: Abstract interface for frame processing modules
|
||||
- PlaYUVerApp: High level graphical interface
|
||||
- PlaYUVerTools: High level command line interface
|
||||
|
||||
## Supported Quality Metrics
|
||||
- Peak Signal-to-Noise Ratio (PSNR)
|
||||
- Structural SIMilarity (SSIM)
|
||||
- Mean Square Error (MSE)
|
||||
- Weighted Spherical PSNR (WS-PSNR)
|
||||
- PSNR
|
||||
- SSIM
|
||||
- MSE
|
||||
|
||||
## Frame Processing Modules
|
||||
- Component filtering
|
||||
- Frame difference, crop, shift, binarization and rotation
|
||||
- Frame difference, crop, shift, binarization
|
||||
- Sub-sampling operations
|
||||
- Measuring modules
|
||||
- Modules based on opencv:
|
||||
@@ -45,31 +38,24 @@ Master branch | Development branch
|
||||
|
||||
## Supported Formats
|
||||
- Supports for the following pixel formats:
|
||||
* YUV: 444, 420, 422
|
||||
* YUV: 420, 44, 422, 400
|
||||
* RGB
|
||||
* Gray
|
||||
- Supported formats:
|
||||
* Raw video:
|
||||
* YUV: 444, 420, 422
|
||||
* RGB
|
||||
* Gray
|
||||
* Joint Photographic Experts Group (jpeg)
|
||||
* Portable Map (ppm, pgm)
|
||||
- Partially supported formats:
|
||||
- Support containers:
|
||||
* Raw video (yuv,rgb,gray)
|
||||
* Portable Network Graphics (png)
|
||||
* Joint Photographic Experts Group (jpeg)
|
||||
* Windows Bitmap (bmp)
|
||||
* Tagged Image File Format (tiff)
|
||||
* Portable Map (ppm,pgm,pbm)
|
||||
|
||||
## Development Team
|
||||
- [**Joao Carreira**](https://github.com/jfmcarreira) (Founder, Main Developer)
|
||||
- [**Luis Lucas** ](https://github.com/lfrlucas) (Founder, Developer)
|
||||
- [**Joao Santos** ](https://github.com/jpataias) (Contributor)
|
||||
- [**JNSFilipe** ](https://github.com/JNSFilipe) (Contributor)
|
||||
## Developers
|
||||
- **Joao Carreira** (jfmcarreira@gmail.com)
|
||||
- **Luis Lucas** (luisfrlucas@gmail.com)
|
||||
|
||||
|
||||
### Binaries and Build
|
||||
* Packages are available for [Debian](https://launchpad.net/~pixlra/+archive/ubuntu/ppa)
|
||||
* **Daily builds** available for [Windows](https://github.com/pixlra/calyp-releases/blob/master/installers/win/calyp-latest.exe)
|
||||
* **Daily builds** available for Windows and Linux in our [SourceForge page](https://sourceforge.net/projects/playuver/)
|
||||
* **Dependencies**
|
||||
1. an ordinary C++ development environment (g++, make, C++ libraries and headers, ...)
|
||||
2. cmake
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Santos (joaompssantos@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -25,10 +24,9 @@
|
||||
* in KTikZ project
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "AboutDialog.h"
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QLabel>
|
||||
@@ -37,19 +35,21 @@
|
||||
|
||||
#define TAB_FROM_SPACES " "
|
||||
|
||||
AboutDialog::AboutDialog( QWidget* parent )
|
||||
: QDialog( parent )
|
||||
AboutDialog::AboutDialog( QWidget* parent ) : QDialog( parent )
|
||||
{
|
||||
QPixmap logo = QPixmap( ":logos/calyp-logo.png" ).scaledToWidth( 200, Qt::SmoothTransformation );
|
||||
QPixmap logo = QPixmap( ":/images/playuver-backgroud-logo.png" )
|
||||
.scaled( QSize( 500, 350 ), Qt::KeepAspectRatio );
|
||||
QLabel* pixmapLabel = new QLabel;
|
||||
pixmapLabel->setPixmap( logo );
|
||||
|
||||
QLabel* label = new QLabel( QString( "<h2 style='text-align:center'>%1</h2><h3 style='text-align:center'>Version %2</h3>" )
|
||||
.arg( tr( "Enhanced open-source video player" ) )
|
||||
.arg( QApplication::applicationVersion() ) );
|
||||
label->setWordWrap( false );
|
||||
QLabel* label =
|
||||
new QLabel( QString( "<h1 style='text-align:center'>%1 Version %2</h1><h2>%3</h2>" )
|
||||
.arg( QApplication::applicationName() )
|
||||
.arg( QApplication::applicationVersion() )
|
||||
.arg( tr( "Enhanced open-source Qt-based raw video player" ) ) );
|
||||
label->setWordWrap( true );
|
||||
|
||||
QString featuresList = QStringLiteral( "<p><h3><b>Features:</b></h3><ul>" );
|
||||
QString featuresList = QStringLiteral( "<p><b>Features:</b><ul>" );
|
||||
|
||||
#ifdef USE_QTDBUS
|
||||
featuresList.append( QStringLiteral( "<li>Support for Qt DBus messages" ) );
|
||||
@@ -61,13 +61,15 @@ AboutDialog::AboutDialog( QWidget* parent )
|
||||
featuresList.append( QStringLiteral( "<li>Support for OpenCV" ) );
|
||||
#endif
|
||||
featuresList.append( QStringLiteral( "</ul></p>" ) );
|
||||
|
||||
QLabel* labelFeatures = new QLabel( featuresList );
|
||||
|
||||
QLabel* labelCopyright = new QLabel( QStringLiteral( "Copyright © 2014–2018 Joao Carreira and Luis Lucas" ) );
|
||||
QLabel* labelCopyright =
|
||||
new QLabel( QStringLiteral( "Copyright © 2014–2017 Luis Lucas and Joao Carreira" ) );
|
||||
|
||||
QWidget* topWidget = new QWidget;
|
||||
QVBoxLayout* topLayout = new QVBoxLayout;
|
||||
topLayout->addWidget( pixmapLabel, 0, Qt::AlignHCenter );
|
||||
topLayout->addWidget( pixmapLabel );
|
||||
topLayout->addWidget( label );
|
||||
topLayout->addWidget( labelFeatures );
|
||||
topLayout->addWidget( labelCopyright );
|
||||
@@ -94,7 +96,4 @@ AboutDialog::AboutDialog( QWidget* parent )
|
||||
buttonBox->setFocus();
|
||||
|
||||
setWindowTitle( tr( "About %1" ).arg( QApplication::applicationName() ) );
|
||||
|
||||
// Prevent window resize
|
||||
this->layout()->setSizeConstraint( QLayout::SetFixedSize );
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
+84
-48
@@ -1,81 +1,94 @@
|
||||
###
|
||||
### CMakeLists for calyp app component
|
||||
### CMakeLists for playuver app component
|
||||
###
|
||||
|
||||
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/dialog
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/docks
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/widgets )
|
||||
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/external )
|
||||
|
||||
OPTION( USE_QT4 "Build with Qt4" OFF )
|
||||
OPTION( USE_QTDBUS "Build with QtDBus" ON )
|
||||
OPTION( USE_FERVOR "Add Fervor support" OFF )
|
||||
|
||||
ADD_SUBDIRECTORY( external )
|
||||
#####################################################################################
|
||||
# Qt library
|
||||
######################################################################################
|
||||
|
||||
FIND_PACKAGE( Qt5 REQUIRED COMPONENTS Core Gui Widgets Concurrent )
|
||||
LIST(APPEND QT_LINKER_LIBS Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Concurrent )
|
||||
LIST(APPEND QT_MODULES Core Gui Widgets Concurrent )
|
||||
IF( USE_QT4 )
|
||||
|
||||
FIND_PACKAGE( Qt4 REQUIRED COMPONENTS QtCore QtGui QtDBus QtNetwork QtWebKit )
|
||||
SET( USE_QTDBUS TRUE )
|
||||
IF( NOT QT4_FOUND )
|
||||
SET(USE_QT4 FALSE)
|
||||
ELSE()
|
||||
INCLUDE( ${QT_USE_FILE} )
|
||||
ADD_DEFINITIONS( ${QT_DEFINITIONS} )
|
||||
SET( QT_LINKER_LIBS ${QT_LIBRARIES} )
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF( NOT USE_QT4 )
|
||||
FIND_PACKAGE( Qt5 REQUIRED COMPONENTS Core Gui Widgets PrintSupport Concurrent )
|
||||
LIST(APPEND QT_LINKER_LIBS Qt5::Core Qt5::Gui Qt5::Widgets Qt5::PrintSupport Qt5::Concurrent )
|
||||
LIST(APPEND QT_MODULES Core Gui Widgets PrintSupport Concurrent )
|
||||
|
||||
IF( USE_QTDBUS )
|
||||
FIND_PACKAGE( Qt5DBus )
|
||||
SET_PACKAGE_PROPERTIES(Qt5DBus PROPERTIES DESCRIPTION "Support for Qt5 DBus messages between instances" TYPE OPTIONAL )
|
||||
IF( ${Qt5DBus_FOUND} )
|
||||
SET( USE_QTDBUS ${Qt5DBus_FOUND} ) # TODO: fix this stupid variable
|
||||
SET( USE_QTDBUS ${Qt5DBus_FOUND} PARENT_SCOPE)
|
||||
LIST(APPEND QT_LINKER_LIBS Qt5::DBus )
|
||||
LIST(APPEND QT_MODULES DBus )
|
||||
ENDIF()
|
||||
|
||||
ENDIF()
|
||||
|
||||
set(Calyp_App_SRCS
|
||||
set(plaYUVer_App_SRCS
|
||||
# Main
|
||||
main.cpp
|
||||
MainWindow.cpp
|
||||
# Module SubWindow
|
||||
SubWindowHandle.cpp
|
||||
MdiSubWindow.cpp
|
||||
PlaYUVerApp.cpp
|
||||
PlaYUVerSubWindowHandle.cpp
|
||||
PlaYUVerMdiSubWindow.cpp
|
||||
SubWindowAbstract.cpp
|
||||
# Module Video
|
||||
VideoHandle.cpp
|
||||
VideoSubWindow.cpp
|
||||
ViewArea.cpp
|
||||
GridManager.cpp
|
||||
VideoHandle.cpp
|
||||
FramePropertiesDock.cpp
|
||||
# Module Quality
|
||||
QualityHandle.cpp
|
||||
QualityMeasurementSidebar.cpp
|
||||
PlotSubWindow.cpp
|
||||
external/qcustomplot/qcustomplot.cpp
|
||||
external/qcustomplot.cpp
|
||||
# Module Plugins
|
||||
ModulesHandle.cpp
|
||||
CalypAppModuleIf.cpp
|
||||
ModulesHandleOptDialog.cpp
|
||||
ModuleHandleDock.cpp
|
||||
PlaYUVerAppModuleIf.cpp
|
||||
GridManager.cpp
|
||||
# Dialogs
|
||||
dialog/AboutDialog.cpp
|
||||
dialog/ConfigureFormatDialog.cpp
|
||||
dialog/SubWindowSelectorDialog.cpp
|
||||
dialog/ProgressBar.cpp
|
||||
dialog/SeekStreamDialog.cpp
|
||||
dialog/ModulesHandleOptDialog.cpp
|
||||
AboutDialog.cpp
|
||||
ConfigureFormatDialog.cpp
|
||||
DialogSubWindowSelector.cpp
|
||||
ProgressBar.cpp
|
||||
SeekStreamDialog.cpp
|
||||
# Widgets
|
||||
widgets/HistogramWidget.cpp
|
||||
widgets/FrameNumberWidget.cpp
|
||||
# Docks
|
||||
docks/FramePropertiesDock.cpp
|
||||
docks/ModuleHandleDock.cpp
|
||||
docks/QualityMeasurementSidebar.cpp
|
||||
HistogramWidget.cpp
|
||||
WidgetFrameNumber.cpp
|
||||
WidgetFrameNumber.cpp
|
||||
)
|
||||
|
||||
IF( USE_QTDBUS )
|
||||
LIST( APPEND Calyp_App_SRCS DBusAppAdaptor.cpp )
|
||||
LIST( APPEND plaYUVer_App_SRCS PlaYUVerAppAdaptor.cpp )
|
||||
ENDIF()
|
||||
|
||||
|
||||
set(Calyp_App_UI "" )
|
||||
set(PlaYUVer_App_UI "" )
|
||||
|
||||
set(Calyp_App_RCC
|
||||
resources/${PROJECT_NAME}.qrc
|
||||
set(PlaYUVer_App_RCC
|
||||
resources/playuver.qrc
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
IF( USE_FERVOR )
|
||||
|
||||
SET( FERVOR_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/fervor )
|
||||
@@ -83,7 +96,7 @@ IF( USE_FERVOR )
|
||||
IF(EXISTS ${FERVOR_DIR} )
|
||||
|
||||
SET( FERVOR_APP_NAME ${PROJECT_NAME} )
|
||||
SET( FERVOR_APP_VERSION ${CALYP_VERSION_STRING} )
|
||||
SET( FERVOR_APP_VERSION ${PLAYUVER_VERSION_STRING} )
|
||||
|
||||
ADD_SUBDIRECTORY( ${FERVOR_DIR} )
|
||||
|
||||
@@ -102,6 +115,21 @@ IF( USE_FERVOR )
|
||||
SET(QT_USE_QTNETWORK true)
|
||||
SET(QT_USE_QTWEBKIT true)
|
||||
|
||||
IF( WIN32 )
|
||||
INSTALL(FILES ${QT_DIR}/bin/Qt5Network${QT_DLL_POSTFIX}.dll DESTINATION bin )
|
||||
INSTALL(FILES ${QT_DIR}/bin/Qt5WebKit${QT_DLL_POSTFIX}.dll DESTINATION bin )
|
||||
INSTALL(FILES ${QT_DIR}/bin/Qt5WebKitWidgets${QT_DLL_POSTFIX}.dll DESTINATION bin )
|
||||
INSTALL(FILES ${QT_DIR}/bin/Qt5Quick${QT_DLL_POSTFIX}.dll DESTINATION bin )
|
||||
INSTALL(FILES ${QT_DIR}/bin/Qt5Qml${QT_DLL_POSTFIX}.dll DESTINATION bin )
|
||||
INSTALL(FILES ${QT_DIR}/bin/Qt5Multimedia${QT_DLL_POSTFIX}.dll DESTINATION bin )
|
||||
INSTALL(FILES ${QT_DIR}/bin/Qt5Sql${QT_DLL_POSTFIX}.dll DESTINATION bin )
|
||||
INSTALL(FILES ${QT_DIR}/bin/Qt5Positioning${QT_DLL_POSTFIX}.dll DESTINATION bin )
|
||||
INSTALL(FILES ${QT_DIR}/bin/Qt5Sensors${QT_DLL_POSTFIX}.dll DESTINATION bin )
|
||||
INSTALL(FILES ${QT_DIR}/bin/Qt5MultimediaWidgets${QT_DLL_POSTFIX}.dll DESTINATION bin )
|
||||
INSTALL(FILES ${QT_DIR}/bin/Qt5OpenGL${QT_DLL_POSTFIX}.dll DESTINATION bin )
|
||||
INSTALL(FILES ${QT_DIR}/bin/Qt5PrintSupport${QT_DLL_POSTFIX}.dll DESTINATION bin )
|
||||
ENDIF()
|
||||
|
||||
ELSE()
|
||||
MESSAGE( "Fervor lib source code is not find in ${FERVOR_DIR}... Disabling it!" )
|
||||
SET( USE_FERVOR False )
|
||||
@@ -111,8 +139,13 @@ ENDIF()
|
||||
SET_PACKAGE_PROPERTIES(Fervor PROPERTIES URL "https://github.com/pypt/fervor" DESCRIPTION "Fervor lib includes check for updates feature" TYPE OPTIONAL )
|
||||
ADD_FEATURE_INFO(Fervor USE_FERVOR "Fervor lib includes check for updates feature.")
|
||||
|
||||
QT5_WRAP_UI( Calyp_App_UI_Wrap ${Calyp_App_UI} )
|
||||
QT5_ADD_RESOURCES( Calyp_App_RCC ${Calyp_App_RCC} )
|
||||
IF( USE_QT4 )
|
||||
QT4_WRAP_UI( PlaYUVer_App_UI_Wrap ${PlaYUVer_App_UI} )
|
||||
QT4_ADD_RESOURCES( PlaYUVer_App_RCC ${PlaYUVer_App_RCC} )
|
||||
ELSE()
|
||||
QT5_WRAP_UI( PlaYUVer_App_UI_Wrap ${PlaYUVer_App_UI} )
|
||||
QT5_ADD_RESOURCES( PlaYUVer_App_RCC ${PlaYUVer_App_RCC} )
|
||||
ENDIF()
|
||||
|
||||
# Instruct CMake to run moc automatically when needed.
|
||||
SET( CMAKE_AUTOMOC ON )
|
||||
@@ -122,27 +155,30 @@ IF( WIN32 )
|
||||
set(WINDOWS_RES_FILE ${CMAKE_CURRENT_BINARY_DIR}/resources.obj)
|
||||
IF( MSVC )
|
||||
add_custom_command(OUTPUT ${WINDOWS_RES_FILE}
|
||||
COMMAND rc.exe /fo ${WINDOWS_RES_FILE} ${PROJECT_NAME}.rc
|
||||
COMMAND rc.exe /fo ${WINDOWS_RES_FILE} playuver.rc
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/resources
|
||||
)
|
||||
ELSE()
|
||||
add_custom_command(OUTPUT ${WINDOWS_RES_FILE}
|
||||
COMMAND windres.exe ${PROJECT_NAME}.rc ${WINDOWS_RES_FILE}
|
||||
COMMAND windres.exe playuver.rc ${WINDOWS_RES_FILE}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/resources
|
||||
)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
|
||||
ADD_EXECUTABLE( ${PROJECT_NAME} ${Calyp_App_SRCS} ${HEADERS_MOC_FILES} ${Calyp_App_UI_Wrap} ${Calyp_App_RCC} ${WINDOWS_RES_FILE} )
|
||||
TARGET_LINK_LIBRARIES( ${PROJECT_NAME} ${PROJECT_LIBRARY} CalypModules ${APP_LINKER_LIBS} ${QT_LINKER_LIBS} QCustomPlotLib )
|
||||
ADD_EXECUTABLE( ${PROJECT_NAME} ${plaYUVer_App_SRCS} ${HEADERS_MOC_FILES} ${PlaYUVer_App_UI_Wrap} ${PlaYUVer_App_RCC} ${WINDOWS_RES_FILE} )
|
||||
|
||||
# QT5_USE_MODULES( ${PROJECT_NAME} ${QT_MODULES} )
|
||||
TARGET_LINK_LIBRARIES( ${PROJECT_NAME} PlaYUVerLib PlaYUVerModules ${APP_LINKER_LIBS} ${QT_LINKER_LIBS} )
|
||||
|
||||
IF( NOT USE_QT4 )
|
||||
QT5_USE_MODULES( ${PROJECT_NAME} ${QT_MODULES} )
|
||||
ENDIF()
|
||||
|
||||
INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin )
|
||||
INSTALL(FILES resources/calyp.desktop DESTINATION share/applications )
|
||||
INSTALL(FILES resources/calyp.png DESTINATION share/pixmaps )
|
||||
INSTALL(FILES resources/calyp.xml DESTINATION share/mime/packages )
|
||||
INSTALL(FILES resources/playuver.desktop DESTINATION share/applications )
|
||||
INSTALL(FILES resources/playuver.png DESTINATION share/pixmaps )
|
||||
INSTALL(FILES resources/playuver.xml DESTINATION share/mime/packages )
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -22,10 +22,6 @@
|
||||
* \brief Dialog box to set the sequence resolution
|
||||
*/
|
||||
|
||||
#include "ConfigureFormatDialog.h"
|
||||
|
||||
#include "lib/CalypFrame.h"
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QDebug>
|
||||
#include <QDialogButtonBox>
|
||||
@@ -39,13 +35,17 @@
|
||||
#include <QString>
|
||||
#include <QWidget>
|
||||
|
||||
#include "lib/PlaYUVerFrame.h"
|
||||
|
||||
#include "ConfigureFormatDialog.h"
|
||||
|
||||
#define MAX_SUPPORTED_RESOLUTION 99999
|
||||
|
||||
QDataStream& operator<<( QDataStream& out, const CalypStandardResolutionVector& array )
|
||||
QDataStream& operator<<( QDataStream& out, const PlaYUVerStdResolutionVector& array )
|
||||
{
|
||||
CalypStandardResolution d;
|
||||
PlaYUVerStdResolution d;
|
||||
out << array.size();
|
||||
for( int i = 0; i < array.size(); i++ )
|
||||
for( Int i = 0; i < array.size(); i++ )
|
||||
{
|
||||
d = array.at( i );
|
||||
out << QString::fromStdString( d.shortName ) << d.uiWidth << d.uiHeight;
|
||||
@@ -53,13 +53,13 @@ QDataStream& operator<<( QDataStream& out, const CalypStandardResolutionVector&
|
||||
return out;
|
||||
}
|
||||
|
||||
QDataStream& operator>>( QDataStream& in, CalypStandardResolutionVector& array )
|
||||
QDataStream& operator>>( QDataStream& in, PlaYUVerStdResolutionVector& array )
|
||||
{
|
||||
CalypStandardResolution d;
|
||||
PlaYUVerStdResolution d;
|
||||
QString auxName;
|
||||
int array_size;
|
||||
Int array_size;
|
||||
in >> array_size;
|
||||
for( int i = 0; i < array_size; i++ )
|
||||
for( Int i = 0; i < array_size; i++ )
|
||||
{
|
||||
in >> auxName;
|
||||
d.shortName = auxName.toStdString();
|
||||
@@ -73,8 +73,7 @@ QDataStream& operator>>( QDataStream& in, CalypStandardResolutionVector& array )
|
||||
class AddCustomFormat : public QDialog
|
||||
{
|
||||
public:
|
||||
AddCustomFormat( QWidget* parent = NULL )
|
||||
: QDialog( parent, Qt::Dialog | Qt::WindowTitleHint )
|
||||
AddCustomFormat( QWidget* parent = NULL ) : QDialog( parent, Qt::Dialog | Qt::WindowTitleHint )
|
||||
{
|
||||
setWindowModality( Qt::ApplicationModal );
|
||||
setWindowTitle( "Add custom resolution" );
|
||||
@@ -118,9 +117,9 @@ public:
|
||||
connect( dialogButtonOkCancel, SIGNAL( rejected() ), this, SLOT( reject() ) );
|
||||
}
|
||||
|
||||
CalypStandardResolution runDialog()
|
||||
PlaYUVerStdResolution runDialog()
|
||||
{
|
||||
CalypStandardResolution stdResolution;
|
||||
PlaYUVerStdResolution stdResolution;
|
||||
stdResolution.shortName = "";
|
||||
if( exec() == QDialog::Accepted )
|
||||
{
|
||||
@@ -137,29 +136,31 @@ private:
|
||||
QSpinBox* m_spinHeight;
|
||||
};
|
||||
|
||||
ConfigureFormatDialog::ConfigureFormatDialog( QWidget* parent )
|
||||
: QDialog( parent )
|
||||
ConfigureFormatDialog::ConfigureFormatDialog( QWidget* parent ) : QDialog( parent )
|
||||
{
|
||||
QString Name;
|
||||
unsigned int uiWidth, uiHeight;
|
||||
UInt uiWidth, uiHeight;
|
||||
|
||||
readSettings();
|
||||
for( int i = 0; i < aRCustomFileFormats.size(); i++ )
|
||||
for( Int i = 0; i < aRCustomFileFormats.size(); i++ )
|
||||
{
|
||||
Name = QString::fromStdString( aRCustomFileFormats[i].shortName );
|
||||
uiWidth = aRCustomFileFormats[i].uiWidth;
|
||||
uiHeight = aRCustomFileFormats[i].uiHeight;
|
||||
standardResolutionNames.append( QString( "%1 (%2x%3)" ).arg( Name ).arg( uiWidth ).arg( uiHeight ) );
|
||||
standardResolutionNames.append(
|
||||
QString( "%1 (%2x%3)" ).arg( Name ).arg( uiWidth ).arg( uiHeight ) );
|
||||
standardResolutionSizes.append( QSize( uiWidth, uiHeight ) );
|
||||
}
|
||||
|
||||
std::vector<CalypStandardResolution> listCalypStdResolution = CalypStream::stdResolutionSizes();
|
||||
for( unsigned int i = 0; i < listCalypStdResolution.size(); i++ )
|
||||
std::vector<PlaYUVerStdResolution> listPlaYUVerStdResolution =
|
||||
PlaYUVerStream::stdResolutionSizes();
|
||||
for( UInt i = 0; i < listPlaYUVerStdResolution.size(); i++ )
|
||||
{
|
||||
Name = QString::fromStdString( listCalypStdResolution[i].shortName );
|
||||
uiWidth = listCalypStdResolution[i].uiWidth;
|
||||
uiHeight = listCalypStdResolution[i].uiHeight;
|
||||
standardResolutionNames.append( QString( "%1 (%2x%3)" ).arg( Name ).arg( uiWidth ).arg( uiHeight ) );
|
||||
Name = QString::fromStdString( listPlaYUVerStdResolution[i].shortName );
|
||||
uiWidth = listPlaYUVerStdResolution[i].uiWidth;
|
||||
uiHeight = listPlaYUVerStdResolution[i].uiHeight;
|
||||
standardResolutionNames.append(
|
||||
QString( "%1 (%2x%3)" ).arg( Name ).arg( uiWidth ).arg( uiHeight ) );
|
||||
standardResolutionSizes.append( QSize( uiWidth, uiHeight ) );
|
||||
}
|
||||
|
||||
@@ -207,7 +208,8 @@ ConfigureFormatDialog::ConfigureFormatDialog( QWidget* parent )
|
||||
m_labelFilename = new QLabel();
|
||||
m_labelFilename->setFont( titleFont );
|
||||
filenameLayout->addWidget( filenameLabel );
|
||||
filenameLayout->addItem( new QSpacerItem( 20, 10, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
|
||||
filenameLayout->addItem(
|
||||
new QSpacerItem( 20, 10, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
|
||||
filenameLayout->addWidget( m_labelFilename );
|
||||
MainLayout->addLayout( filenameLayout );
|
||||
|
||||
@@ -283,18 +285,21 @@ ConfigureFormatDialog::ConfigureFormatDialog( QWidget* parent )
|
||||
m_comboBoxPixelFormat->setFont( normalFont );
|
||||
m_comboBoxPixelFormat->clear();
|
||||
|
||||
for( unsigned int i = 0; i < CalypFrame::supportedColorSpacesListNames().size(); i++ )
|
||||
for( UInt i = 0; i < PlaYUVerFrame::supportedColorSpacesListNames().size(); i++ )
|
||||
{
|
||||
m_comboBoxColorSpace->insertItem( i, CalypFrame::supportedColorSpacesListNames()[i].c_str() );
|
||||
m_comboBoxColorSpace->insertItem( i,
|
||||
PlaYUVerFrame::supportedColorSpacesListNames()[i].c_str() );
|
||||
}
|
||||
m_comboBoxColorSpace->setCurrentIndex( 1 );
|
||||
|
||||
pixelGridLayout->addWidget( colorSpaceLabel, 0, 0 );
|
||||
pixelGridLayout->addItem( new QSpacerItem( 10, 10, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
|
||||
pixelGridLayout->addItem( new QSpacerItem( 10, 10, QSizePolicy::Expanding, QSizePolicy::Minimum ),
|
||||
0, 1 );
|
||||
pixelGridLayout->addWidget( m_comboBoxColorSpace, 0, 2 );
|
||||
|
||||
pixelGridLayout->addWidget( pixelFormatLabel, 1, 0 );
|
||||
pixelGridLayout->addItem( new QSpacerItem( 10, 10, QSizePolicy::Expanding, QSizePolicy::Minimum ), 1, 1 );
|
||||
pixelGridLayout->addItem( new QSpacerItem( 10, 10, QSizePolicy::Expanding, QSizePolicy::Minimum ),
|
||||
1, 1 );
|
||||
pixelGridLayout->addWidget( m_comboBoxPixelFormat, 1, 2 );
|
||||
|
||||
QLabel* bitsPerPelLabel = new QLabel();
|
||||
@@ -306,7 +311,8 @@ ConfigureFormatDialog::ConfigureFormatDialog( QWidget* parent )
|
||||
m_spinBoxBits->setRange( 0, 16 );
|
||||
m_spinBoxBits->setValue( 8 );
|
||||
pixelGridLayout->addWidget( bitsPerPelLabel, 2, 0 );
|
||||
pixelGridLayout->addItem( new QSpacerItem( 20, 10, QSizePolicy::Expanding, QSizePolicy::Minimum ), 2, 1 );
|
||||
pixelGridLayout->addItem( new QSpacerItem( 20, 10, QSizePolicy::Expanding, QSizePolicy::Minimum ),
|
||||
2, 1 );
|
||||
pixelGridLayout->addWidget( m_spinBoxBits, 2, 2 );
|
||||
|
||||
/*
|
||||
@@ -323,7 +329,8 @@ ConfigureFormatDialog::ConfigureFormatDialog( QWidget* parent )
|
||||
m_comboBoxEndianness->addItem( QStringLiteral( "Big Endian" ) );
|
||||
m_comboBoxEndianness->addItem( QStringLiteral( "Little Endian" ) );
|
||||
endiannessLayout->addWidget( endiannessLabel );
|
||||
endiannessLayout->addItem( new QSpacerItem( 20, 10, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
|
||||
endiannessLayout->addItem(
|
||||
new QSpacerItem( 20, 10, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
|
||||
endiannessLayout->addWidget( m_comboBoxEndianness );
|
||||
m_widgetEndianness = new QWidget();
|
||||
m_widgetEndianness->setContentsMargins( 0, 0, 0, 0 );
|
||||
@@ -343,7 +350,8 @@ ConfigureFormatDialog::ConfigureFormatDialog( QWidget* parent )
|
||||
m_spinBoxFrameRate->setRange( 0, 1000 );
|
||||
m_spinBoxFrameRate->setValue( 30 );
|
||||
framerateFormatLayout->addWidget( framerateFormatLabel );
|
||||
framerateFormatLayout->addItem( new QSpacerItem( 20, 10, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
|
||||
framerateFormatLayout->addItem(
|
||||
new QSpacerItem( 20, 10, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
|
||||
framerateFormatLayout->addWidget( m_spinBoxFrameRate );
|
||||
QWidget* framerateWidget = new QWidget();
|
||||
framerateWidget->setContentsMargins( 0, 0, 0, 0 );
|
||||
@@ -371,7 +379,8 @@ ConfigureFormatDialog::ConfigureFormatDialog( QWidget* parent )
|
||||
SLOT( slotStandardResolutionSelected( int ) ) );
|
||||
connect( m_spinBoxWidth, SIGNAL( valueChanged( int ) ), this, SLOT( slotResolutionChange() ) );
|
||||
connect( m_spinBoxheight, SIGNAL( valueChanged( int ) ), this, SLOT( slotResolutionChange() ) );
|
||||
connect( m_comboBoxColorSpace, SIGNAL( currentIndexChanged( int ) ), this, SLOT( slotColorSpaceChange( int ) ) );
|
||||
connect( m_comboBoxColorSpace, SIGNAL( currentIndexChanged( int ) ), this,
|
||||
SLOT( slotColorSpaceChange( int ) ) );
|
||||
connect( m_spinBoxBits, SIGNAL( valueChanged( int ) ), this, SLOT( slotBitsChange( int ) ) );
|
||||
|
||||
connect( dialogButtonOkCancel, SIGNAL( accepted() ), this, SLOT( accept() ) );
|
||||
@@ -382,8 +391,13 @@ ConfigureFormatDialog::ConfigureFormatDialog( QWidget* parent )
|
||||
setFixedSize( MainLayout->sizeHint() );
|
||||
}
|
||||
|
||||
int ConfigureFormatDialog::runConfigureFormatDialog( const QString& Filename, unsigned int& rWidth, unsigned int& rHeight,
|
||||
int& rInputFormat, unsigned int& rBits, int& rEndianess, unsigned int& rFrameRate )
|
||||
Int ConfigureFormatDialog::runConfigureFormatDialog( const QString& Filename,
|
||||
UInt& rWidth,
|
||||
UInt& rHeight,
|
||||
Int& rInputFormat,
|
||||
UInt& rBits,
|
||||
Int& rEndianess,
|
||||
UInt& rFrameRate )
|
||||
{
|
||||
// Set default values
|
||||
// setWindowTitle( "Configure resolution for " + Filename );
|
||||
@@ -391,16 +405,16 @@ int ConfigureFormatDialog::runConfigureFormatDialog( const QString& Filename, un
|
||||
m_spinBoxWidth->setValue( rWidth );
|
||||
m_spinBoxheight->setValue( rHeight );
|
||||
|
||||
int colorSpace = 0;
|
||||
int sampling = 0;
|
||||
Int colorSpace = 0;
|
||||
Int sampling = 0;
|
||||
if( rInputFormat >= 0 )
|
||||
{
|
||||
ClpString pelFmtName = CalypFrame::supportedPixelFormatListNames()[rInputFormat];
|
||||
for( unsigned int j = 0; j < CalypFrame::supportedColorSpacesListNames().size(); j++ )
|
||||
String pelFmtName = PlaYUVerFrame::supportedPixelFormatListNames()[rInputFormat];
|
||||
for( UInt j = 0; j < PlaYUVerFrame::supportedColorSpacesListNames().size(); j++ )
|
||||
{
|
||||
for( unsigned int i = 0; i < CalypFrame::supportedPixelFormatListNames( j ).size(); i++ )
|
||||
for( UInt i = 0; i < PlaYUVerFrame::supportedPixelFormatListNames( j ).size(); i++ )
|
||||
{
|
||||
if( pelFmtName == CalypFrame::supportedPixelFormatListNames( j )[i] )
|
||||
if( pelFmtName == PlaYUVerFrame::supportedPixelFormatListNames( j )[i] )
|
||||
{
|
||||
colorSpace = j;
|
||||
sampling = i;
|
||||
@@ -423,7 +437,7 @@ int ConfigureFormatDialog::runConfigureFormatDialog( const QString& Filename, un
|
||||
}
|
||||
m_spinBoxFrameRate->setValue( rFrameRate );
|
||||
|
||||
for( int i = 0; i < standardResolutionSizes.size() - 1; i++ )
|
||||
for( Int i = 0; i < standardResolutionSizes.size() - 1; i++ )
|
||||
{
|
||||
if( standardResolutionSizes.at( i ) == QSize( rWidth, rHeight ) )
|
||||
{
|
||||
@@ -442,10 +456,10 @@ int ConfigureFormatDialog::runConfigureFormatDialog( const QString& Filename, un
|
||||
rHeight = m_spinBoxheight->value();
|
||||
colorSpace = m_comboBoxColorSpace->currentIndex();
|
||||
sampling = m_comboBoxPixelFormat->currentIndex();
|
||||
ClpString pelFmtName = CalypFrame::supportedPixelFormatListNames( colorSpace )[sampling];
|
||||
for( unsigned int i = 0; i < CalypFrame::supportedPixelFormatListNames().size(); i++ )
|
||||
String pelFmtName = PlaYUVerFrame::supportedPixelFormatListNames( colorSpace )[sampling];
|
||||
for( UInt i = 0; i < PlaYUVerFrame::supportedPixelFormatListNames().size(); i++ )
|
||||
{
|
||||
if( pelFmtName == CalypFrame::supportedPixelFormatListNames()[i] )
|
||||
if( pelFmtName == PlaYUVerFrame::supportedPixelFormatListNames()[i] )
|
||||
{
|
||||
rInputFormat = i;
|
||||
break;
|
||||
@@ -458,19 +472,21 @@ int ConfigureFormatDialog::runConfigureFormatDialog( const QString& Filename, un
|
||||
return QDialog::Accepted;
|
||||
}
|
||||
|
||||
void ConfigureFormatDialog::slotStandardResolutionSelected( int idx )
|
||||
void ConfigureFormatDialog::slotStandardResolutionSelected( Int idx )
|
||||
{
|
||||
if( idx == standardResolutionSizes.size() - 1 )
|
||||
{
|
||||
AddCustomFormat* pcCustomFmtDialog = new AddCustomFormat;
|
||||
CalypStandardResolution customResolution = pcCustomFmtDialog->runDialog();
|
||||
PlaYUVerStdResolution customResolution = pcCustomFmtDialog->runDialog();
|
||||
aRCustomFileFormats.append( customResolution );
|
||||
if( customResolution.shortName != "" )
|
||||
{
|
||||
QString name = QString::fromStdString( customResolution.shortName );
|
||||
name.append( QString( " (%2x%3)" ).arg( customResolution.uiWidth ).arg( customResolution.uiHeight ) );
|
||||
name.append(
|
||||
QString( " (%2x%3)" ).arg( customResolution.uiWidth ).arg( customResolution.uiHeight ) );
|
||||
standardResolutionNames.insert( 0, name );
|
||||
standardResolutionSizes.insert( 0, QSize( customResolution.uiWidth, customResolution.uiHeight ) );
|
||||
standardResolutionSizes.insert(
|
||||
0, QSize( customResolution.uiWidth, customResolution.uiHeight ) );
|
||||
|
||||
m_comboBoxStandardResolution->blockSignals( true );
|
||||
m_comboBoxStandardResolution->insertItem( 0, name );
|
||||
@@ -493,10 +509,11 @@ void ConfigureFormatDialog::slotStandardResolutionSelected( int idx )
|
||||
void ConfigureFormatDialog::slotResolutionChange()
|
||||
{
|
||||
m_comboBoxStandardResolution->blockSignals( true );
|
||||
int newIdx = -1;
|
||||
for( int i = 0; i < standardResolutionSizes.size(); i++ )
|
||||
Int newIdx = -1;
|
||||
for( Int i = 0; i < standardResolutionSizes.size(); i++ )
|
||||
{
|
||||
if( standardResolutionSizes.at( i ) == QSize( m_spinBoxWidth->value(), m_spinBoxheight->value() ) )
|
||||
if( standardResolutionSizes.at( i ) ==
|
||||
QSize( m_spinBoxWidth->value(), m_spinBoxheight->value() ) )
|
||||
{
|
||||
newIdx = i;
|
||||
break;
|
||||
@@ -506,20 +523,21 @@ void ConfigureFormatDialog::slotResolutionChange()
|
||||
m_comboBoxStandardResolution->blockSignals( false );
|
||||
}
|
||||
|
||||
void ConfigureFormatDialog::slotColorSpaceChange( int idx )
|
||||
Void ConfigureFormatDialog::slotColorSpaceChange( Int idx )
|
||||
{
|
||||
if( idx == -1 )
|
||||
return;
|
||||
|
||||
m_comboBoxPixelFormat->clear();
|
||||
for( unsigned int i = 0; i < CalypFrame::supportedPixelFormatListNames( idx ).size(); i++ )
|
||||
for( UInt i = 0; i < PlaYUVerFrame::supportedPixelFormatListNames( idx ).size(); i++ )
|
||||
{
|
||||
m_comboBoxPixelFormat->insertItem( i, CalypFrame::supportedPixelFormatListNames( idx )[i].c_str() );
|
||||
m_comboBoxPixelFormat->insertItem(
|
||||
i, PlaYUVerFrame::supportedPixelFormatListNames( idx )[i].c_str() );
|
||||
}
|
||||
m_comboBoxPixelFormat->setCurrentIndex( 0 );
|
||||
}
|
||||
|
||||
void ConfigureFormatDialog::slotBitsChange( int idx )
|
||||
Void ConfigureFormatDialog::slotBitsChange( Int idx )
|
||||
{
|
||||
if( idx > 8 )
|
||||
{
|
||||
@@ -531,17 +549,17 @@ void ConfigureFormatDialog::slotBitsChange( int idx )
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigureFormatDialog::readSettings()
|
||||
Void ConfigureFormatDialog::readSettings()
|
||||
{
|
||||
QSettings appSettings;
|
||||
QVariant value = appSettings.value( "ConfigureFormatDialog/CustomFormats" );
|
||||
aRCustomFileFormats = value.value<CalypStandardResolutionVector>();
|
||||
aRCustomFileFormats = value.value<PlaYUVerStdResolutionVector>();
|
||||
}
|
||||
|
||||
void ConfigureFormatDialog::writeSettings()
|
||||
Void ConfigureFormatDialog::writeSettings()
|
||||
{
|
||||
QSettings appSettings;
|
||||
QVariant var;
|
||||
var.setValue<CalypStandardResolutionVector>( aRCustomFileFormats );
|
||||
var.setValue<PlaYUVerStdResolutionVector>( aRCustomFileFormats );
|
||||
appSettings.setValue( "ConfigureFormatDialog/CustomFormats", var );
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -28,8 +28,8 @@
|
||||
#include <QDialog>
|
||||
#include <QVector>
|
||||
|
||||
#include "CommonDefs.h"
|
||||
#include "lib/CalypStream.h"
|
||||
#include "PlaYUVerAppDefs.h"
|
||||
#include "lib/PlaYUVerStream.h"
|
||||
|
||||
class QComboBox;
|
||||
class QHBoxLayout;
|
||||
@@ -38,9 +38,9 @@ class QSpinBox;
|
||||
class QString;
|
||||
class QWidget;
|
||||
|
||||
typedef QVector<CalypStandardResolution> CalypStandardResolutionVector;
|
||||
QDataStream& operator<<( QDataStream& out, const CalypStandardResolutionVector& array );
|
||||
QDataStream& operator>>( QDataStream& in, CalypStandardResolutionVector& array );
|
||||
typedef QVector<PlaYUVerStdResolution> PlaYUVerStdResolutionVector;
|
||||
QDataStream& operator<<( QDataStream& out, const PlaYUVerStdResolutionVector& array );
|
||||
QDataStream& operator>>( QDataStream& in, PlaYUVerStdResolutionVector& array );
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -51,11 +51,16 @@ class ConfigureFormatDialog : public QDialog
|
||||
|
||||
public:
|
||||
ConfigureFormatDialog( QWidget* parent = 0 );
|
||||
int runConfigureFormatDialog( const QString& Filename, unsigned int& rWidth, unsigned int& rHeight, int& rInputFormat, unsigned int& rBits,
|
||||
int& rEndianess, unsigned int& rFrameRate );
|
||||
Int runConfigureFormatDialog( const QString& Filename,
|
||||
UInt& rWidth,
|
||||
UInt& rHeight,
|
||||
Int& rInputFormat,
|
||||
UInt& rBits,
|
||||
Int& rEndianess,
|
||||
UInt& rFrameRate );
|
||||
|
||||
void readSettings();
|
||||
void writeSettings();
|
||||
Void readSettings();
|
||||
Void writeSettings();
|
||||
|
||||
private Q_SLOTS:
|
||||
void slotStandardResolutionSelected( int );
|
||||
@@ -66,7 +71,7 @@ private Q_SLOTS:
|
||||
private:
|
||||
QStringList standardResolutionNames;
|
||||
QVector<QSize> standardResolutionSizes;
|
||||
CalypStandardResolutionVector aRCustomFileFormats;
|
||||
PlaYUVerStdResolutionVector aRCustomFileFormats;
|
||||
|
||||
QLabel* m_labelFilename;
|
||||
QComboBox* m_comboBoxStandardResolution;
|
||||
@@ -81,7 +86,7 @@ private:
|
||||
QSpinBox* m_spinBoxFrameRate;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE( CalypStandardResolution )
|
||||
Q_DECLARE_METATYPE( CalypStandardResolutionVector )
|
||||
Q_DECLARE_METATYPE( PlaYUVerStdResolution );
|
||||
Q_DECLARE_METATYPE( PlaYUVerStdResolutionVector );
|
||||
|
||||
#endif // __CONFIGUREFORMATDIALOG_H__
|
||||
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -22,16 +22,17 @@
|
||||
* \brief Dialog box to select sub windows
|
||||
*/
|
||||
|
||||
#include "SubWindowSelectorDialog.h"
|
||||
|
||||
#include "SubWindowHandle.h"
|
||||
#include "DialogSubWindowSelector.h"
|
||||
#include "PlaYUVerSubWindowHandle.h"
|
||||
#include "VideoSubWindow.h"
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QGroupBox>
|
||||
|
||||
SubWindowSelectorDialog::SubWindowSelectorDialog( QWidget* parent, SubWindowHandle* windowManager,
|
||||
unsigned int uiCategory, int minWindowsSelected, int maxWindowsSelected )
|
||||
DialogSubWindowSelector::DialogSubWindowSelector( QWidget* parent,
|
||||
PlaYUVerSubWindowHandle* windowManager,
|
||||
UInt uiCategory,
|
||||
Int minWindowsSelected,
|
||||
Int maxWindowsSelected )
|
||||
: QDialog( parent )
|
||||
, m_uiCategory( uiCategory )
|
||||
, m_iMinSelectedWindows( minWindowsSelected )
|
||||
@@ -86,7 +87,7 @@ SubWindowSelectorDialog::SubWindowSelectorDialog( QWidget* parent, SubWindowHand
|
||||
QString currSubWindowName;
|
||||
QCheckBox* windowCheckBox;
|
||||
m_apcSubWindowList = m_pcMainWindowManager->findSubWindow( m_uiCategory );
|
||||
for( int i = 0; i < m_apcSubWindowList.size(); i++ )
|
||||
for( Int i = 0; i < m_apcSubWindowList.size(); i++ )
|
||||
{
|
||||
subWindow = m_apcSubWindowList.at( i );
|
||||
currSubWindowName = subWindow->getWindowName();
|
||||
@@ -101,17 +102,17 @@ SubWindowSelectorDialog::SubWindowSelectorDialog( QWidget* parent, SubWindowHand
|
||||
setFixedSize( mainLayout->sizeHint() );
|
||||
}
|
||||
|
||||
void SubWindowSelectorDialog::updateSubWindowList()
|
||||
Void DialogSubWindowSelector::updateSubWindowList()
|
||||
{
|
||||
QLayout* pcLayout = m_pcGroupCheckBox->layout();
|
||||
QLayoutItem* pcLayoutItem;
|
||||
QCheckBox* windowCheckBox;
|
||||
int iIdx;
|
||||
Int iIdx;
|
||||
|
||||
/**
|
||||
* Remove all check boxes
|
||||
*/
|
||||
for( int i = 0; i < pcLayout->count(); i++ )
|
||||
for( Int i = 0; i < pcLayout->count(); i++ )
|
||||
{
|
||||
pcLayoutItem = pcLayout->itemAt( i );
|
||||
if( pcLayoutItem )
|
||||
@@ -121,7 +122,7 @@ void SubWindowSelectorDialog::updateSubWindowList()
|
||||
}
|
||||
}
|
||||
|
||||
for( int i = 0; i < m_apcSelectedSubWindowList.size(); i++ )
|
||||
for( Int i = 0; i < m_apcSelectedSubWindowList.size(); i++ )
|
||||
{
|
||||
iIdx = m_apcSubWindowList.indexOf( m_apcSelectedSubWindowList.at( i ) );
|
||||
if( iIdx >= 0 )
|
||||
@@ -130,23 +131,23 @@ void SubWindowSelectorDialog::updateSubWindowList()
|
||||
m_pcGroupCheckBox->layout()->addWidget( windowCheckBox );
|
||||
}
|
||||
}
|
||||
for( int i = 0; i < m_apcWindowsListCheckBox.size(); i++ )
|
||||
for( Int i = 0; i < m_apcWindowsListCheckBox.size(); i++ )
|
||||
{
|
||||
if( !m_apcSelectedSubWindowList.contains( m_apcSubWindowList.at( i ) ) )
|
||||
m_pcGroupCheckBox->layout()->addWidget( m_apcWindowsListCheckBox.at( i ) );
|
||||
}
|
||||
}
|
||||
|
||||
void SubWindowSelectorDialog::selectSubWindow( SubWindowAbstract* subWindow )
|
||||
Void DialogSubWindowSelector::selectSubWindow( SubWindowAbstract* subWindow )
|
||||
{
|
||||
int iIdx = m_apcSubWindowList.indexOf( subWindow );
|
||||
Int iIdx = m_apcSubWindowList.indexOf( subWindow );
|
||||
if( iIdx >= 0 )
|
||||
{
|
||||
m_apcWindowsListCheckBox.at( iIdx )->setChecked( true );
|
||||
}
|
||||
}
|
||||
|
||||
void SubWindowSelectorDialog::update()
|
||||
Void DialogSubWindowSelector::update()
|
||||
{
|
||||
if( m_apcSelectedSubWindowList.size() > 0 )
|
||||
{
|
||||
@@ -178,7 +179,7 @@ void SubWindowSelectorDialog::update()
|
||||
}
|
||||
if( m_apcSelectedSubWindowList.size() >= m_iMaxSlectedWindows )
|
||||
{
|
||||
for( int i = 0; i < m_apcWindowsListCheckBox.size(); i++ )
|
||||
for( Int i = 0; i < m_apcWindowsListCheckBox.size(); i++ )
|
||||
{
|
||||
if( m_apcSelectedSubWindowList.contains( m_apcSubWindowList.at( i ) ) )
|
||||
{
|
||||
@@ -192,7 +193,7 @@ void SubWindowSelectorDialog::update()
|
||||
}
|
||||
else
|
||||
{
|
||||
for( int i = 0; i < m_apcWindowsListCheckBox.size(); i++ )
|
||||
for( Int i = 0; i < m_apcWindowsListCheckBox.size(); i++ )
|
||||
{
|
||||
m_apcWindowsListCheckBox.at( i )->setEnabled( true );
|
||||
}
|
||||
@@ -203,9 +204,9 @@ void SubWindowSelectorDialog::update()
|
||||
|
||||
// ----------------------- Slot Functions -----------------------
|
||||
|
||||
void SubWindowSelectorDialog::toggleSubWindow( int idx )
|
||||
Void DialogSubWindowSelector::toggleSubWindow( Int idx )
|
||||
{
|
||||
bool isChecked = m_apcWindowsListCheckBox.at( idx )->isChecked();
|
||||
Bool isChecked = m_apcWindowsListCheckBox.at( idx )->isChecked();
|
||||
|
||||
if( isChecked )
|
||||
{
|
||||
@@ -218,19 +219,19 @@ void SubWindowSelectorDialog::toggleSubWindow( int idx )
|
||||
update();
|
||||
}
|
||||
|
||||
void SubWindowSelectorDialog::addAllSubWindow()
|
||||
Void DialogSubWindowSelector::addAllSubWindow()
|
||||
{
|
||||
m_apcSelectedSubWindowList.clear();
|
||||
for( int i = 0; i < m_apcWindowsListCheckBox.size(); i++ )
|
||||
for( Int i = 0; i < m_apcWindowsListCheckBox.size(); i++ )
|
||||
{
|
||||
m_apcWindowsListCheckBox.at( i )->setChecked( true );
|
||||
}
|
||||
update();
|
||||
}
|
||||
|
||||
void SubWindowSelectorDialog::removeAllSubWindow()
|
||||
Void DialogSubWindowSelector::removeAllSubWindow()
|
||||
{
|
||||
for( int i = 0; i < m_apcWindowsListCheckBox.size(); i++ )
|
||||
for( Int i = 0; i < m_apcWindowsListCheckBox.size(); i++ )
|
||||
{
|
||||
m_apcWindowsListCheckBox.at( i )->setChecked( false );
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -25,11 +25,14 @@
|
||||
#ifndef __DIALOGSUBWINDOWSELECTOR_H__
|
||||
#define __DIALOGSUBWINDOWSELECTOR_H__
|
||||
|
||||
#include "CommonDefs.h"
|
||||
#include "PlaYUVerAppDefs.h"
|
||||
#include "config.h"
|
||||
|
||||
#include <QtCore>
|
||||
#if( QT_VERSION_PLAYUVER == 5 )
|
||||
#include <QtWidgets>
|
||||
#elif( QT_VERSION_PLAYUVER == 4 )
|
||||
#include <QtGui>
|
||||
#endif
|
||||
#include <QtCore>
|
||||
|
||||
#include <QVector>
|
||||
|
||||
@@ -38,29 +41,32 @@ class QColor;
|
||||
class QCheckBox;
|
||||
class QGroupBox;
|
||||
|
||||
class SubWindowHandle;
|
||||
class PlaYUVerSubWindowHandle;
|
||||
class SubWindowAbstract;
|
||||
|
||||
/**
|
||||
* Class to define the dialog box to select sub windows
|
||||
* This class enable the selection of several group of windows
|
||||
*/
|
||||
class SubWindowSelectorDialog : public QDialog
|
||||
class DialogSubWindowSelector : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SubWindowSelectorDialog( QWidget* parent, SubWindowHandle* windowManager, unsigned int uiCategory,
|
||||
int minWindowsSelected = 1, int maxWindowsSelected = -1 );
|
||||
DialogSubWindowSelector( QWidget* parent,
|
||||
PlaYUVerSubWindowHandle* windowManager,
|
||||
UInt uiCategory,
|
||||
Int minWindowsSelected = 1,
|
||||
Int maxWindowsSelected = -1 );
|
||||
|
||||
void selectSubWindow( SubWindowAbstract* subWindow );
|
||||
Void selectSubWindow( SubWindowAbstract* subWindow );
|
||||
QList<SubWindowAbstract*> getSelectedWindows() { return m_apcSelectedSubWindowList; }
|
||||
|
||||
private:
|
||||
unsigned int m_uiCategory;
|
||||
int m_iMinSelectedWindows;
|
||||
int m_iMaxSlectedWindows;
|
||||
SubWindowHandle* m_pcMainWindowManager;
|
||||
UInt m_uiCategory;
|
||||
Int m_iMinSelectedWindows;
|
||||
Int m_iMaxSlectedWindows;
|
||||
PlaYUVerSubWindowHandle* m_pcMainWindowManager;
|
||||
|
||||
QList<SubWindowAbstract*> m_apcSubWindowList;
|
||||
QList<SubWindowAbstract*> m_apcSelectedSubWindowList;
|
||||
@@ -74,8 +80,8 @@ private:
|
||||
QPushButton* m_pushButtonAddAll;
|
||||
QPushButton* m_pushButtonRemoveAll;
|
||||
|
||||
void updateSubWindowList();
|
||||
void update();
|
||||
Void updateSubWindowList();
|
||||
Void update();
|
||||
|
||||
private Q_SLOTS:
|
||||
void toggleSubWindow( int );
|
||||
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -23,12 +23,11 @@
|
||||
*/
|
||||
|
||||
#include "FramePropertiesDock.h"
|
||||
|
||||
#include <QtDebug>
|
||||
#include <QtGui>
|
||||
#include <cmath>
|
||||
|
||||
FramePropertiesDock::FramePropertiesDock( QWidget* parent, bool* pbMainPlaySwitch )
|
||||
FramePropertiesDock::FramePropertiesDock( QWidget* parent, Bool* pbMainPlaySwitch )
|
||||
: QWidget( parent ), m_pbIsPlaying( pbMainPlaySwitch )
|
||||
{
|
||||
// -------------- Variables definition --------------
|
||||
@@ -42,25 +41,27 @@ FramePropertiesDock::FramePropertiesDock( QWidget* parent, bool* pbMainPlaySwitc
|
||||
channelLabel->setAlignment( Qt::AlignVCenter | Qt::AlignRight );
|
||||
|
||||
channelCB = new QComboBox;
|
||||
//channelCB->addItem( tr( "Luminance" ) );
|
||||
//channelCB->setItemIcon( 0, QIcon( ":/images/channel-luma.png" ) );
|
||||
channelCB->addItem( tr( "Luminance" ) );
|
||||
channelCB->setItemIcon( 0, QIcon( ":/images/channel-luma.png" ) );
|
||||
|
||||
channelCB->setWhatsThis( tr( "<p>Select here the histogram channel to display:<p>"
|
||||
"<b>Luminance</b>: Display luminance (perceived brightness).<p>"
|
||||
"<b>Red</b>: Display the red image channel.<p>"
|
||||
"<b>Green</b>: Display the green image channel.<p>"
|
||||
"<b>Blue</b>: Display the blue image channel.<p>"
|
||||
"<b>Alpha</b>: Display the alpha image channel. "
|
||||
"This channel corresponds to the transparency value and "
|
||||
"is supported by some image formats such as PNG or TIFF.<p>"
|
||||
"<b>Colors</b>: Display all color channel values at "
|
||||
"the same time." ) );
|
||||
channelCB->setWhatsThis(
|
||||
tr( "<p>Select here the histogram channel to display:<p>"
|
||||
"<b>Luminance</b>: Display luminance (perceived brightness).<p>"
|
||||
"<b>Red</b>: Display the red image channel.<p>"
|
||||
"<b>Green</b>: Display the green image channel.<p>"
|
||||
"<b>Blue</b>: Display the blue image channel.<p>"
|
||||
"<b>Alpha</b>: Display the alpha image channel. "
|
||||
"This channel corresponds to the transparency value and "
|
||||
"is supported by some image formats such as PNG or TIFF.<p>"
|
||||
"<b>Colors</b>: Display all color channel values at "
|
||||
"the same time." ) );
|
||||
|
||||
QString scaleWhatsThis( tr( "<p>Select here the histogram scale.<p>"
|
||||
"If the image's maximal values are small, you can use the "
|
||||
"linear scale.<p>Logarithmic scale can be used when the maximal"
|
||||
" values are big; if it is used, all values (small and large) "
|
||||
"will be visible on the graph." ) );
|
||||
QString scaleWhatsThis(
|
||||
tr( "<p>Select here the histogram scale.<p>"
|
||||
"If the image's maximal values are small, you can use the "
|
||||
"linear scale.<p>Logarithmic scale can be used when the maximal"
|
||||
" values are big; if it is used, all values (small and large) "
|
||||
"will be visible on the graph." ) );
|
||||
|
||||
linHistoButton = new QPushButton;
|
||||
linHistoButton->setToolTip( tr( "Linear" ) );
|
||||
@@ -92,10 +93,11 @@ FramePropertiesDock::FramePropertiesDock( QWidget* parent, bool* pbMainPlaySwitc
|
||||
colorsCB->hide();
|
||||
colorsLabel->hide();
|
||||
|
||||
QString regionWhatsThis( tr( "<p>Select here from which region the histogram will be computed:"
|
||||
"<p><b>Full Image</b>: Compute histogram using the full image."
|
||||
"<p><b>Selection</b>: Compute histogram using the current image "
|
||||
"selection." ) );
|
||||
QString regionWhatsThis(
|
||||
tr( "<p>Select here from which region the histogram will be computed:"
|
||||
"<p><b>Full Image</b>: Compute histogram using the full image."
|
||||
"<p><b>Selection</b>: Compute histogram using the current image "
|
||||
"selection." ) );
|
||||
|
||||
fullImageButton = new QPushButton;
|
||||
fullImageButton->setToolTip( tr( "Full Image" ) );
|
||||
@@ -132,8 +134,9 @@ FramePropertiesDock::FramePropertiesDock( QWidget* parent, bool* pbMainPlaySwitc
|
||||
// -------------------------------------------------------------
|
||||
|
||||
histogramWidget = new HistogramWidget( 100, 100 );
|
||||
histogramWidget->setWhatsThis( tr( "<p>This is the histogram drawing of "
|
||||
"the selected image channel" ) );
|
||||
histogramWidget->setWhatsThis(
|
||||
tr( "<p>This is the histogram drawing of "
|
||||
"the selected image channel" ) );
|
||||
|
||||
QVBoxLayout* histogramLayout = new QVBoxLayout;
|
||||
histogramLayout->setSpacing( 1 );
|
||||
@@ -146,24 +149,26 @@ FramePropertiesDock::FramePropertiesDock( QWidget* parent, bool* pbMainPlaySwitc
|
||||
QLabel* rangeSelectionLabel = new QLabel( tr( "Range:" ) );
|
||||
rangeSelectionLabel->setAlignment( Qt::AlignLeft | Qt::AlignVCenter );
|
||||
|
||||
mininterv = new QSpinBox;
|
||||
mininterv->setRange( 0, 255 );
|
||||
mininterv->setSingleStep( 1 );
|
||||
mininterv->setValue( 0 );
|
||||
mininterv->setWhatsThis( tr( "<p>Select here the minimal intensity "
|
||||
"value of the histogram selection." ) );
|
||||
minInterv = new QSpinBox;
|
||||
minInterv->setRange( 0, 255 );
|
||||
minInterv->setSingleStep( 1 );
|
||||
minInterv->setValue( 0 );
|
||||
minInterv->setWhatsThis(
|
||||
tr( "<p>Select here the minimal intensity "
|
||||
"value of the histogram selection." ) );
|
||||
|
||||
maxinterv = new QSpinBox;
|
||||
maxinterv->setRange( 0, 255 );
|
||||
maxinterv->setSingleStep( 1 );
|
||||
maxinterv->setValue( 0 );
|
||||
mininterv->setWhatsThis( tr( "<p>Select here the maximal intensity value"
|
||||
" of the histogram selection." ) );
|
||||
maxInterv = new QSpinBox;
|
||||
maxInterv->setRange( 0, 255 );
|
||||
maxInterv->setSingleStep( 1 );
|
||||
maxInterv->setValue( 0 );
|
||||
minInterv->setWhatsThis(
|
||||
tr( "<p>Select here the maximal intensity value"
|
||||
" of the histogram selection." ) );
|
||||
|
||||
QHBoxLayout* rangeLayout = new QHBoxLayout;
|
||||
rangeLayout->addWidget( rangeSelectionLabel );
|
||||
rangeLayout->addWidget( mininterv );
|
||||
rangeLayout->addWidget( maxinterv );
|
||||
rangeLayout->addWidget( minInterv );
|
||||
rangeLayout->addWidget( maxInterv );
|
||||
|
||||
mainLayout->addLayout( rangeLayout, 4, 0, 1, 4 );
|
||||
|
||||
@@ -184,11 +189,6 @@ FramePropertiesDock::FramePropertiesDock( QWidget* parent, bool* pbMainPlaySwitc
|
||||
labelRangeValue = new QLabel;
|
||||
labelRangeValue->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
|
||||
|
||||
QLabel* nEBinsLabel = new QLabel( tr( "Non empty bins:" ) );
|
||||
nEBinsLabel->setAlignment( Qt::AlignLeft | Qt::AlignVCenter );
|
||||
labelNEBinsValue = new QLabel;
|
||||
labelNEBinsValue->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
|
||||
|
||||
QLabel* meanLabel = new QLabel( tr( "Mean:" ) );
|
||||
meanLabel->setAlignment( Qt::AlignLeft | Qt::AlignVCenter );
|
||||
labelMeanValue = new QLabel;
|
||||
@@ -209,7 +209,7 @@ FramePropertiesDock::FramePropertiesDock( QWidget* parent, bool* pbMainPlaySwitc
|
||||
labelPercentileValue = new QLabel;
|
||||
labelPercentileValue->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
|
||||
|
||||
int gridRow = 0;
|
||||
Int gridRow = 0;
|
||||
QGridLayout* statisticsLayout = new QGridLayout;
|
||||
statisticsLayout->addWidget( pixelsLabel, gridRow, 0 );
|
||||
statisticsLayout->addWidget( labelPixelsValue, gridRow++, 1 );
|
||||
@@ -217,20 +217,21 @@ FramePropertiesDock::FramePropertiesDock( QWidget* parent, bool* pbMainPlaySwitc
|
||||
statisticsLayout->addWidget( labelCountValue, gridRow++, 1 );
|
||||
statisticsLayout->addWidget( rangeLabel, gridRow, 0 );
|
||||
statisticsLayout->addWidget( labelRangeValue, gridRow++, 1 );
|
||||
statisticsLayout->addWidget( nEBinsLabel, gridRow, 0 );
|
||||
statisticsLayout->addWidget( labelNEBinsValue, gridRow++, 1 );
|
||||
statisticsLayout->addWidget( meanLabel, gridRow, 0 );
|
||||
statisticsLayout->addWidget( labelMeanValue, gridRow++, 1 );
|
||||
statisticsLayout->addWidget( stdDevLabel, gridRow, 0 );
|
||||
statisticsLayout->addWidget( labelStdDevValue, gridRow++, 1 );
|
||||
statisticsLayout->addWidget( medianLabel, gridRow, 0 );
|
||||
statisticsLayout->addWidget( labelMedianValue, gridRow++, 1 );
|
||||
// statisticsLayout->addWidget( percentileLabel, 5, 0 );
|
||||
// statisticsLayout->addWidget( labelPercentileValue, 5, 1 );
|
||||
|
||||
QGroupBox* statisticsGroup = new QGroupBox( tr( "Statistics" ) );
|
||||
statisticsGroup->setLayout( statisticsLayout );
|
||||
statisticsGroup->setWhatsThis( tr( "<p>Here you can see the statistical results calculated from the "
|
||||
"selected histogram part. These values are available for all "
|
||||
"channels." ) );
|
||||
statisticsGroup->setWhatsThis(
|
||||
tr( "<p>Here you can see the statistical results calculated from the "
|
||||
"selected histogram part. These values are available for all "
|
||||
"channels." ) );
|
||||
|
||||
mainLayout->addWidget( statisticsGroup, 5, 0, 1, 4 );
|
||||
|
||||
@@ -239,16 +240,21 @@ FramePropertiesDock::FramePropertiesDock( QWidget* parent, bool* pbMainPlaySwitc
|
||||
setEnabled( false );
|
||||
|
||||
connect( channelCB, SIGNAL( activated( int ) ), this, SLOT( slotChannelChanged( int ) ) );
|
||||
connect( scaleButtonGroup, SIGNAL( buttonClicked( int ) ), this, SLOT( slotScaleChanged( int ) ) );
|
||||
connect( scaleButtonGroup, SIGNAL( buttonClicked( int ) ), this,
|
||||
SLOT( slotScaleChanged( int ) ) );
|
||||
connect( colorsCB, SIGNAL( activated( int ) ), this, SLOT( slotColorsChanged( int ) ) );
|
||||
connect( renderingButtonGroup, SIGNAL( buttonClicked( int ) ), this, SLOT( slotRenderingChanged( int ) ) );
|
||||
connect( histogramWidget, SIGNAL( signalintervalChanged( int, int ) ), this, SLOT( slotUpdateinterval( int, int ) ) );
|
||||
connect( histogramWidget, SIGNAL( signalMaximumValueChanged( int ) ), this, SLOT( slotUpdateintervRange( int ) ) );
|
||||
connect( histogramWidget, SIGNAL( signalHistogramComputationDone( int ) ), this, SLOT( slotRefreshOptions( int ) ) );
|
||||
connect( renderingButtonGroup, SIGNAL( buttonClicked( int ) ), this,
|
||||
SLOT( slotRenderingChanged( int ) ) );
|
||||
connect( histogramWidget, SIGNAL( signalIntervalChanged( int, int ) ), this,
|
||||
SLOT( slotUpdateInterval( int, int ) ) );
|
||||
connect( histogramWidget, SIGNAL( signalMaximumValueChanged( int ) ), this,
|
||||
SLOT( slotUpdateIntervRange( int ) ) );
|
||||
connect( histogramWidget, SIGNAL( signalHistogramComputationDone( int ) ), this,
|
||||
SLOT( slotRefreshOptions( int ) ) );
|
||||
connect( histogramWidget, SIGNAL( signalHistogramComputationFailed( void ) ), this,
|
||||
SLOT( slotHistogramComputationFailed( void ) ) );
|
||||
connect( mininterv, SIGNAL( valueChanged( int ) ), this, SLOT( slotMinValueChanged( int ) ) );
|
||||
connect( maxinterv, SIGNAL( valueChanged( int ) ), this, SLOT( slotMaxValueChanged( int ) ) );
|
||||
connect( minInterv, SIGNAL( valueChanged( int ) ), this, SLOT( slotMinValueChanged( int ) ) );
|
||||
connect( maxInterv, SIGNAL( valueChanged( int ) ), this, SLOT( slotMaxValueChanged( int ) ) );
|
||||
}
|
||||
|
||||
FramePropertiesDock::~FramePropertiesDock()
|
||||
@@ -269,7 +275,7 @@ QSize FramePropertiesDock::sizeHint() const
|
||||
return currSize;
|
||||
}
|
||||
|
||||
void FramePropertiesDock::reset()
|
||||
Void FramePropertiesDock::reset()
|
||||
{
|
||||
m_pcFrame = NULL;
|
||||
m_cSelectionArea = QRect();
|
||||
@@ -281,7 +287,6 @@ void FramePropertiesDock::reset()
|
||||
|
||||
m_iLastFrameType = -1;
|
||||
|
||||
labelNEBinsValue->clear();
|
||||
labelMeanValue->clear();
|
||||
labelPixelsValue->clear();
|
||||
labelStdDevValue->clear();
|
||||
@@ -295,63 +300,66 @@ void FramePropertiesDock::reset()
|
||||
setEnabled( false );
|
||||
}
|
||||
|
||||
void FramePropertiesDock::setFrame( CalypFrame* pcFrame )
|
||||
Void FramePropertiesDock::setFrame( PlaYUVerFrame* pcFrame )
|
||||
{
|
||||
int colorSpace = pcFrame->getColorSpace();
|
||||
Int colorSpace = pcFrame->getColorSpace();
|
||||
if( m_iLastFrameType != colorSpace )
|
||||
{
|
||||
m_iLastFrameType = colorSpace;
|
||||
if( colorSpace == CLP_COLOR_RGB || colorSpace == CLP_COLOR_RGBA )
|
||||
if( colorSpace == PlaYUVerPixel::COLOR_RGB || colorSpace == PlaYUVerPixel::COLOR_ARGB )
|
||||
{
|
||||
channelCB->clear();
|
||||
channelCB->addItem( QIcon( ":/images/channel-luma.png" ), "Luminance", CalypFrame::HIST_LUMA );
|
||||
channelCB->addItem( QIcon( ":/images/channel-red.png" ), "Red", CalypFrame::HIST_COLOR_R );
|
||||
channelCB->addItem( QIcon( ":/images/channel-green.png" ), "Green", CalypFrame::HIST_COLOR_G );
|
||||
channelCB->addItem( QIcon( ":/images/channel-blue.png" ), "Blue", CalypFrame::HIST_COLOR_B );
|
||||
if( colorSpace == CLP_COLOR_RGBA )
|
||||
channelCB->clear();
|
||||
channelCB->insertItem( LuminosityChannel, QIcon( ":/images/channel-luma.png" ), "Luminance" );
|
||||
channelCB->insertItem( FirstChannel, QIcon( ":/images/channel-red.png" ), "Red" );
|
||||
channelCB->insertItem( SecondChannel, QIcon( ":/images/channel-green.png" ), "Green" );
|
||||
channelCB->insertItem( ThirdChannel, QIcon( ":/images/channel-blue.png" ), "Blue" );
|
||||
if( colorSpace == PlaYUVerPixel::COLOR_ARGB )
|
||||
{
|
||||
channelCB->addItem( QIcon( ":/images/channel-alpha.png" ), "Alpha", CalypFrame::HIST_COLOR_A );
|
||||
channelCB->insertItem( AlphaChannel, QIcon( ":/images/channel-alpha.png" ), "Alpha" );
|
||||
}
|
||||
channelCB->addItem( QIcon( ":/images/channel-all.png" ), "Colors", CalypFrame::HIST_ALL_CHANNELS );
|
||||
channelCB->insertItem( ColorChannels, QIcon( ":/images/channel-all.png" ), "Colors" );
|
||||
|
||||
colorsCB->clear();
|
||||
colorsCB->addItem( "Red", CalypFrame::HIST_COLOR_R );
|
||||
colorsCB->addItem( "Green", CalypFrame::HIST_COLOR_G );
|
||||
colorsCB->addItem( "Blue", CalypFrame::HIST_COLOR_B );
|
||||
colorsCB->addItem( "Red" );
|
||||
colorsCB->addItem( "Green" );
|
||||
colorsCB->addItem( "Blue" );
|
||||
colorsCB->setEnabled( false );
|
||||
colorsCB->setWhatsThis( tr( "<p>Select here the main color displayed with Colors Channel mode:"
|
||||
"<p><b>Red</b>: Draw the Red image channel in the foreground.<p>"
|
||||
"<b>Green</b>: Draw the Green image channel in the foreground.<p>"
|
||||
"<b>Blue</b>: Draw the Blue image channel in the foreground.<p>" ) );
|
||||
colorsCB->setWhatsThis(
|
||||
tr( "<p>Select here the main color displayed with Colors Channel mode:"
|
||||
"<p><b>Red</b>: Draw the Red image channel in the foreground.<p>"
|
||||
"<b>Green</b>: Draw the Green image channel in the foreground.<p>"
|
||||
"<b>Blue</b>: Draw the Blue image channel in the foreground.<p>" ) );
|
||||
colorsCB->show();
|
||||
colorsLabel->show();
|
||||
}
|
||||
else if( colorSpace == CLP_COLOR_YUV )
|
||||
else if( colorSpace == PlaYUVerPixel::COLOR_YUV )
|
||||
{
|
||||
channelCB->clear();
|
||||
channelCB->addItem( QIcon( ":/images/channel-luma.png" ), "Luminance", CalypFrame::HIST_LUMA );
|
||||
channelCB->addItem( QIcon( ":/images/channel-red.png" ), "Chroma U", CalypFrame::HIST_CHROMA_U );
|
||||
channelCB->addItem( QIcon( ":/images/channel-green.png" ), "Chroma V", CalypFrame::HIST_CHROMA_V );
|
||||
channelCB->addItem( QIcon( ":/images/channel-all.png" ), "All Channels", CalypFrame::HIST_ALL_CHANNELS );
|
||||
channelCB->insertItem( FirstChannel, QIcon( ":/images/channel-luma.png" ), "Luminance" );
|
||||
channelCB->insertItem( SecondChannel, QIcon( ":/images/channel-red.png" ), "Chroma U" );
|
||||
channelCB->insertItem( ThirdChannel, QIcon( ":/images/channel-green.png" ), "Chroma V" );
|
||||
channelCB->insertItem( ColorChannels, QIcon( ":/images/channel-all.png" ), "All Channels" );
|
||||
|
||||
colorsCB->clear();
|
||||
colorsCB->addItem( "Luminance", CalypFrame::HIST_LUMA );
|
||||
colorsCB->addItem( "Chroma U", CalypFrame::HIST_CHROMA_U );
|
||||
colorsCB->addItem( "Chroma V", CalypFrame::HIST_CHROMA_V );
|
||||
colorsCB->addItem( "Luminance" );
|
||||
colorsCB->addItem( "Chroma U" );
|
||||
colorsCB->addItem( "Chroma V" );
|
||||
colorsCB->setEnabled( false );
|
||||
colorsCB->setWhatsThis( tr( "<p>Select here the main color displayed with Colors Channel mode:"
|
||||
"<p><b>Luminance</b>: DraupdateDataw the Luminance channel in the "
|
||||
"foreground.<p>"
|
||||
"<b>Chroma U</b>: Draw the Chroma U channel in the foreground.<p>"
|
||||
"<b>Chroma V</b>: Draw the Chroma V channel in the "
|
||||
"foreground.<p>" ) );
|
||||
colorsCB->setWhatsThis(
|
||||
tr( "<p>Select here the main color displayed with Colors Channel mode:"
|
||||
"<p><b>Luminance</b>: DraupdateDataw the Luminance channel in the "
|
||||
"foreground.<p>"
|
||||
"<b>Chroma U</b>: Draw the Chroma U channel in the foreground.<p>"
|
||||
"<b>Chroma V</b>: Draw the Chroma V channel in the foreground.<p>" ) );
|
||||
colorsCB->show();
|
||||
colorsLabel->show();
|
||||
}
|
||||
else
|
||||
{
|
||||
channelCB->clear();
|
||||
channelCB->addItem( QIcon( ":/images/channel-luma.png" ), "Luminance", CalypFrame::HIST_LUMA );
|
||||
channelCB->addItem( tr( "Luminance" ) );
|
||||
channelCB->setItemIcon( 0, QIcon( ":/images/channel-luma.png" ) );
|
||||
colorsCB->hide();
|
||||
colorsLabel->hide();
|
||||
}
|
||||
@@ -364,11 +372,11 @@ void FramePropertiesDock::setFrame( CalypFrame* pcFrame )
|
||||
}
|
||||
}
|
||||
|
||||
void FramePropertiesDock::setSelection( const QRect& selectionArea )
|
||||
Void FramePropertiesDock::setSelection( const QRect& selectionArea )
|
||||
{
|
||||
if( m_pcFrame )
|
||||
{
|
||||
bool bSelectionChanged = !( selectionArea.size() == m_cSelectionArea.size() );
|
||||
Bool bSelectionChanged = !( selectionArea.size() == m_cSelectionArea.size() );
|
||||
m_cSelectionArea = selectionArea;
|
||||
if( selectionArea.isValid() )
|
||||
{
|
||||
@@ -384,8 +392,8 @@ void FramePropertiesDock::setSelection( const QRect& selectionArea )
|
||||
{
|
||||
delete m_pcSelectedFrame;
|
||||
}
|
||||
m_pcSelectedFrame = new CalypFrame( m_pcFrame, selectionArea.x(), selectionArea.y(), selectionArea.width(),
|
||||
selectionArea.height() );
|
||||
m_pcSelectedFrame = new PlaYUVerFrame( m_pcFrame, selectionArea.x(), selectionArea.y(),
|
||||
selectionArea.width(), selectionArea.height() );
|
||||
}
|
||||
updateDataHistogram();
|
||||
selectionImageButton->click();
|
||||
@@ -400,7 +408,7 @@ void FramePropertiesDock::setSelection( const QRect& selectionArea )
|
||||
}
|
||||
}
|
||||
|
||||
void FramePropertiesDock::updateDataHistogram()
|
||||
Void FramePropertiesDock::updateDataHistogram()
|
||||
{
|
||||
if( m_pcFrame && isVisible() )
|
||||
{
|
||||
@@ -432,18 +440,18 @@ void FramePropertiesDock::updateDataHistogram()
|
||||
}
|
||||
}
|
||||
|
||||
void FramePropertiesDock::updateStatistiques()
|
||||
Void FramePropertiesDock::updateStatistiques()
|
||||
{
|
||||
QString value;
|
||||
|
||||
int min = mininterv->value();
|
||||
int max = maxinterv->value();
|
||||
int channel = histogramWidget->m_channelType;
|
||||
Int min = minInterv->value();
|
||||
Int max = maxInterv->value();
|
||||
Int channel = histogramWidget->m_channelType;
|
||||
|
||||
if( channel == CalypFrame::HIST_ALL_CHANNELS )
|
||||
channel = colorsCB->itemData( colorsCB->currentIndex() ).toInt();
|
||||
if( channel == HistogramWidget::ColorChannelsHistogram )
|
||||
channel = colorsCB->currentIndex();
|
||||
|
||||
CalypFrame* frame;
|
||||
PlaYUVerFrame* frame;
|
||||
|
||||
if( histogramWidget->m_renderingType == HistogramWidget::FullImageHistogram )
|
||||
frame = histogramWidget->m_fullImage;
|
||||
@@ -452,11 +460,8 @@ void FramePropertiesDock::updateStatistiques()
|
||||
|
||||
if( frame )
|
||||
{
|
||||
double numBins = frame->getNEBins( channel );
|
||||
labelNEBinsValue->setText( value.setNum( (float)numBins, 'f', 0 ) );
|
||||
|
||||
QString rangeText =
|
||||
"[" + QString::number( frame->getMinimumPelValue( channel ) ) + ":" + QString::number( frame->getMaximumPelValue( channel ) ) + "]";
|
||||
QString rangeText = "[" + QString::number( frame->getMin( channel ) ) + ":" +
|
||||
QString::number( frame->getMax( channel ) ) + "]";
|
||||
labelRangeValue->setText( rangeText );
|
||||
|
||||
double mean = frame->getMean( channel, min, max );
|
||||
@@ -468,7 +473,7 @@ void FramePropertiesDock::updateStatistiques()
|
||||
double stddev = frame->getStdDev( channel, min, max );
|
||||
labelStdDevValue->setText( value.setNum( stddev, 'f', 1 ) );
|
||||
|
||||
double counts = frame->getNumPixelsRange( channel, min, max );
|
||||
double counts = frame->getCount( channel, min, max );
|
||||
labelCountValue->setText( value.setNum( (float)counts, 'f', 0 ) );
|
||||
|
||||
double median = frame->getMedian( channel, min, max );
|
||||
@@ -479,7 +484,7 @@ void FramePropertiesDock::updateStatistiques()
|
||||
}
|
||||
}
|
||||
|
||||
void FramePropertiesDock::stopHistogram()
|
||||
Void FramePropertiesDock::stopHistogram()
|
||||
{
|
||||
histogramWidget->stopHistogramComputation();
|
||||
}
|
||||
@@ -488,7 +493,7 @@ void FramePropertiesDock::stopHistogram()
|
||||
// SLOTS
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void FramePropertiesDock::slotRefreshOptions( int range )
|
||||
Void FramePropertiesDock::slotRefreshOptions( int range )
|
||||
{
|
||||
if( !isVisible() )
|
||||
return;
|
||||
@@ -511,90 +516,127 @@ void FramePropertiesDock::slotRefreshOptions( int range )
|
||||
}
|
||||
}
|
||||
|
||||
void FramePropertiesDock::slotHistogramComputationFailed()
|
||||
Void FramePropertiesDock::slotHistogramComputationFailed()
|
||||
{
|
||||
m_pcFrame = NULL;
|
||||
}
|
||||
|
||||
void FramePropertiesDock::slotChannelChanged( int index )
|
||||
Void FramePropertiesDock::slotChannelChanged( Int channel )
|
||||
{
|
||||
int channel = channelCB->itemData( index ).toInt();
|
||||
if( m_pcFrame->getColorSpace() == PlaYUVerPixel::COLOR_YUV )
|
||||
channel += 1;
|
||||
if( channel == AlphaChannel && m_pcFrame->getColorSpace() != PlaYUVerPixel::COLOR_ARGB )
|
||||
channel = ColorChannels;
|
||||
|
||||
histogramWidget->m_channelType = channel;
|
||||
if( channel == CalypFrame::HIST_ALL_CHANNELS )
|
||||
colorsCB->setEnabled( true );
|
||||
else
|
||||
switch( channel )
|
||||
{
|
||||
case FirstChannel:
|
||||
histogramWidget->m_channelType = HistogramWidget::FirstChannelHistogram;
|
||||
colorsCB->setEnabled( false );
|
||||
break;
|
||||
case SecondChannel:
|
||||
histogramWidget->m_channelType = HistogramWidget::SecondChannelHistogram;
|
||||
colorsCB->setEnabled( false );
|
||||
break;
|
||||
case ThirdChannel:
|
||||
histogramWidget->m_channelType = HistogramWidget::ThirdChannelHistogram;
|
||||
colorsCB->setEnabled( false );
|
||||
break;
|
||||
case AlphaChannel:
|
||||
histogramWidget->m_channelType = HistogramWidget::AlphaChannelHistogram;
|
||||
colorsCB->setEnabled( false );
|
||||
break;
|
||||
case ColorChannels:
|
||||
histogramWidget->m_channelType = HistogramWidget::ColorChannelsHistogram;
|
||||
colorsCB->setEnabled( true );
|
||||
break;
|
||||
default: // Luminance.
|
||||
// histogramWidget->m_channelType = HistogramWidget::LumaHistogram;
|
||||
histogramWidget->m_channelType = HistogramWidget::FirstChannelHistogram;
|
||||
colorsCB->setEnabled( false );
|
||||
break;
|
||||
}
|
||||
histogramWidget->update();
|
||||
updateStatistiques();
|
||||
}
|
||||
|
||||
void FramePropertiesDock::slotScaleChanged( int scale )
|
||||
Void FramePropertiesDock::slotScaleChanged( Int scale )
|
||||
{
|
||||
histogramWidget->m_scaleType = scale;
|
||||
histogramWidget->update();
|
||||
}
|
||||
|
||||
void FramePropertiesDock::slotColorsChanged( int index )
|
||||
Void FramePropertiesDock::slotColorsChanged( Int color )
|
||||
{
|
||||
int color = colorsCB->itemData( index ).toInt();
|
||||
histogramWidget->m_colorType = color;
|
||||
switch( color )
|
||||
{
|
||||
case AllColorsGreen:
|
||||
histogramWidget->m_colorType = HistogramWidget::SecondChannelColor;
|
||||
break;
|
||||
case AllColorsBlue:
|
||||
histogramWidget->m_colorType = HistogramWidget::ThirdChannelColor;
|
||||
break;
|
||||
default: // Red.
|
||||
histogramWidget->m_colorType = HistogramWidget::FirstChannelColor;
|
||||
break;
|
||||
}
|
||||
|
||||
histogramWidget->update();
|
||||
updateStatistiques();
|
||||
}
|
||||
|
||||
void FramePropertiesDock::slotRenderingChanged( int rendering )
|
||||
Void FramePropertiesDock::slotRenderingChanged( Int rendering )
|
||||
{
|
||||
histogramWidget->m_renderingType = rendering;
|
||||
histogramWidget->update();
|
||||
updateStatistiques();
|
||||
}
|
||||
|
||||
void FramePropertiesDock::slotMinValueChanged( int min )
|
||||
Void FramePropertiesDock::slotMinValueChanged( Int min )
|
||||
{
|
||||
// Called when user changes values of spin box.
|
||||
// Communicate the change to histogram widget.
|
||||
|
||||
// make the one control "push" the other
|
||||
if( min == maxinterv->value() + 1 )
|
||||
maxinterv->setValue( min );
|
||||
if( min == maxInterv->value() + 1 )
|
||||
maxInterv->setValue( min );
|
||||
|
||||
maxinterv->setMinimum( min - 1 );
|
||||
maxInterv->setMinimum( min - 1 );
|
||||
histogramWidget->slotMinValueChanged( min );
|
||||
updateStatistiques();
|
||||
}
|
||||
|
||||
void FramePropertiesDock::slotMaxValueChanged( int max )
|
||||
Void FramePropertiesDock::slotMaxValueChanged( Int max )
|
||||
{
|
||||
if( max == mininterv->value() - 1 )
|
||||
mininterv->setValue( max );
|
||||
if( max == minInterv->value() - 1 )
|
||||
minInterv->setValue( max );
|
||||
|
||||
mininterv->setMaximum( max + 1 );
|
||||
minInterv->setMaximum( max + 1 );
|
||||
histogramWidget->slotMaxValueChanged( max );
|
||||
updateStatistiques();
|
||||
}
|
||||
|
||||
void FramePropertiesDock::slotUpdateinterval( int min, int max )
|
||||
Void FramePropertiesDock::slotUpdateInterval( Int min, Int max )
|
||||
{
|
||||
// Called when value is set from within histogram widget.
|
||||
// Block signals to prevent slotMinValueChanged and
|
||||
// slotMaxValueChanged being called.
|
||||
mininterv->blockSignals( true );
|
||||
mininterv->setMaximum( max + 1 );
|
||||
mininterv->setValue( min );
|
||||
mininterv->blockSignals( false );
|
||||
minInterv->blockSignals( true );
|
||||
minInterv->setMaximum( max + 1 );
|
||||
minInterv->setValue( min );
|
||||
minInterv->blockSignals( false );
|
||||
|
||||
maxinterv->blockSignals( true );
|
||||
maxinterv->setMinimum( min - 1 );
|
||||
maxinterv->setValue( max );
|
||||
maxinterv->blockSignals( false );
|
||||
maxInterv->blockSignals( true );
|
||||
maxInterv->setMinimum( min - 1 );
|
||||
maxInterv->setValue( max );
|
||||
maxInterv->blockSignals( false );
|
||||
|
||||
updateStatistiques();
|
||||
}
|
||||
|
||||
void FramePropertiesDock::slotUpdateintervRange( int range )
|
||||
Void FramePropertiesDock::slotUpdateIntervRange( Int range )
|
||||
{
|
||||
maxinterv->blockSignals( true );
|
||||
maxinterv->setMaximum( range );
|
||||
maxinterv->blockSignals( false );
|
||||
maxInterv->blockSignals( true );
|
||||
maxInterv->setMaximum( range );
|
||||
maxInterv->blockSignals( false );
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -25,34 +25,55 @@
|
||||
#ifndef __FRAMEPROPERTIESDOCK_H__
|
||||
#define __FRAMEPROPERTIESDOCK_H__
|
||||
|
||||
#include "CommonDefs.h"
|
||||
#include "HistogramWidget.h"
|
||||
#include "PlaYUVerAppDefs.h"
|
||||
#include "config.h"
|
||||
#include "lib/CalypFrame.h"
|
||||
#include "lib/CalypStream.h"
|
||||
|
||||
#if( QT_VERSION_PLAYUVER == 5 )
|
||||
#include <QtWidgets>
|
||||
#elif( QT_VERSION_PLAYUVER == 4 )
|
||||
#include <QWidget>
|
||||
#include <QtGui>
|
||||
#endif
|
||||
#include "HistogramWidget.h"
|
||||
#include "lib/PlaYUVerFrame.h"
|
||||
#include "lib/PlaYUVerStream.h"
|
||||
|
||||
class FramePropertiesDock : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
FramePropertiesDock( QWidget* parent, bool* pbMainPlaySwitch );
|
||||
FramePropertiesDock( QWidget* parent, Bool* pbMainPlaySwitch );
|
||||
~FramePropertiesDock();
|
||||
|
||||
QSize sizeHint() const;
|
||||
|
||||
void setFrame( CalypFrame* m_pcFrame );
|
||||
void setSelection( const QRect& selectionArea );
|
||||
void reset();
|
||||
void stopHistogram();
|
||||
Void setFrame( PlaYUVerFrame* m_pcFrame );
|
||||
Void setSelection( const QRect& selectionArea );
|
||||
Void reset();
|
||||
Void stopHistogram();
|
||||
|
||||
private:
|
||||
CalypFrame* m_pcFrame;
|
||||
CalypFrame* m_pcSelectedFrame;
|
||||
int m_iLastFrameType;
|
||||
enum ColorChannel
|
||||
{
|
||||
LuminosityChannel = 0,
|
||||
FirstChannel = 1,
|
||||
SecondChannel = 2,
|
||||
ThirdChannel = 3,
|
||||
ColorChannels = 4,
|
||||
AlphaChannel = 5,
|
||||
};
|
||||
|
||||
bool* m_pbIsPlaying;
|
||||
enum AllColorsColorType
|
||||
{
|
||||
AllColorsRed = 0,
|
||||
AllColorsGreen,
|
||||
AllColorsBlue
|
||||
};
|
||||
|
||||
PlaYUVerFrame* m_pcFrame;
|
||||
PlaYUVerFrame* m_pcSelectedFrame;
|
||||
Int m_iLastFrameType;
|
||||
|
||||
Bool* m_pbIsPlaying;
|
||||
|
||||
QComboBox* channelCB;
|
||||
QComboBox* colorsCB;
|
||||
@@ -66,13 +87,12 @@ private:
|
||||
QButtonGroup* scaleButtonGroup;
|
||||
QButtonGroup* renderingButtonGroup;
|
||||
|
||||
QSpinBox* mininterv;
|
||||
QSpinBox* maxinterv;
|
||||
QSpinBox* minInterv;
|
||||
QSpinBox* maxInterv;
|
||||
|
||||
QLabel* labelPixelsValue;
|
||||
QLabel* labelCountValue;
|
||||
QLabel* labelRangeValue;
|
||||
QLabel* labelNEBinsValue;
|
||||
QLabel* labelMeanValue;
|
||||
QLabel* labelStdDevValue;
|
||||
QLabel* labelMedianValue;
|
||||
@@ -84,21 +104,21 @@ private:
|
||||
|
||||
HistogramWidget* histogramWidget;
|
||||
|
||||
void updateStatistiques();
|
||||
void updateDataHistogram();
|
||||
Void updateStatistiques();
|
||||
Void updateDataHistogram();
|
||||
|
||||
private Q_SLOTS:
|
||||
void slotRefreshOptions( int range );
|
||||
void slotHistogramComputationFailed( void );
|
||||
void slotChannelChanged( int index );
|
||||
void slotChannelChanged( int channel );
|
||||
void slotScaleChanged( int scale );
|
||||
void slotColorsChanged( int index );
|
||||
void slotColorsChanged( int color );
|
||||
void slotRenderingChanged( int rendering );
|
||||
void slotMinValueChanged( int );
|
||||
void slotMaxValueChanged( int );
|
||||
|
||||
void slotUpdateinterval( int min, int max );
|
||||
void slotUpdateintervRange( int range );
|
||||
void slotUpdateInterval( int min, int max );
|
||||
void slotUpdateIntervRange( int range );
|
||||
};
|
||||
|
||||
#endif // __FRAMEPROPERTIESDOCK_H__
|
||||
+8
-13
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -23,8 +23,6 @@
|
||||
* Based on the work of Ricardo N. Rocha Sardo in SCode project
|
||||
*/
|
||||
|
||||
#include "GridManager.h"
|
||||
|
||||
#include <QBitmap>
|
||||
#include <QColor>
|
||||
#include <QDebug>
|
||||
@@ -34,6 +32,8 @@
|
||||
#include <QRect>
|
||||
#include <QRectF>
|
||||
|
||||
#include "GridManager.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Constructor
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -44,11 +44,6 @@ GridManager::GridManager()
|
||||
m_cGridColor = QColor( Qt::white );
|
||||
}
|
||||
|
||||
void GridManager::setGridSize( int newsize )
|
||||
{
|
||||
m_uiHSpace = m_uiVSpace = newsize;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Grid Drawer
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -70,8 +65,8 @@ void GridManager::drawGrid( QPixmap& image, const QRect& area, QPainter* painter
|
||||
style = Solid;
|
||||
switch( style )
|
||||
{
|
||||
case intersectionDot:
|
||||
case intersectionCross:
|
||||
case IntersectionDot:
|
||||
case IntersectionCross:
|
||||
{
|
||||
painter->setPen( mainPen );
|
||||
// Draw crosses or dots on intersections
|
||||
@@ -87,7 +82,7 @@ void GridManager::drawGrid( QPixmap& image, const QRect& area, QPainter* painter
|
||||
|
||||
if( x >= area.x() && y >= area.y() )
|
||||
{
|
||||
if( style == intersectionDot )
|
||||
if( style == IntersectionDot )
|
||||
painter->drawPoint( x, y ); // Dot
|
||||
else
|
||||
{ // Crosses:
|
||||
|
||||
+9
-11
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -26,11 +26,11 @@
|
||||
#ifndef __GRIDMANAGER_H__
|
||||
#define __GRIDMANAGER_H__
|
||||
|
||||
#include "PlaYUVerAppDefs.h"
|
||||
#include "config.h"
|
||||
#include <QColor>
|
||||
#include <QPen>
|
||||
#include <QRect>
|
||||
#include "CommonDefs.h"
|
||||
#include "config.h"
|
||||
|
||||
class QPoint;
|
||||
class QBitmap;
|
||||
@@ -44,16 +44,14 @@ class GridManager
|
||||
public:
|
||||
enum Style
|
||||
{
|
||||
intersectionDot = 0,
|
||||
intersectionCross,
|
||||
IntersectionDot = 0,
|
||||
IntersectionCross,
|
||||
Dashed,
|
||||
Solid
|
||||
};
|
||||
|
||||
GridManager();
|
||||
|
||||
void setGridSize( int newsize );
|
||||
|
||||
void drawGrid( QPixmap& image, const QRect& area, QPainter* painter );
|
||||
|
||||
/**
|
||||
@@ -95,8 +93,8 @@ public:
|
||||
QPoint nearPos( int x = -1, int y = -1 );
|
||||
|
||||
private:
|
||||
unsigned int m_uiHSpace;
|
||||
unsigned int m_uiVSpace;
|
||||
UInt m_uiHSpace;
|
||||
UInt m_uiVSpace;
|
||||
QColor m_cGridColor;
|
||||
Style m_eGridStyle;
|
||||
QPoint m_nearPos;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -25,23 +25,17 @@
|
||||
|
||||
// TODO:
|
||||
// - Optimizar paintEvent. Parece haver codigo redundante !!
|
||||
|
||||
#include "HistogramWidget.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QEvent>
|
||||
#include <QMouseEvent>
|
||||
#include <QPainter>
|
||||
#include <QThread>
|
||||
#include <QTimer>
|
||||
#include "config.h"
|
||||
#include <QtDebug>
|
||||
#include <QtGui>
|
||||
#include <cmath>
|
||||
|
||||
class HistogramWorker : public QThread
|
||||
{
|
||||
private:
|
||||
QObject* m_parent;
|
||||
CalypFrame* m_pcFrame;
|
||||
PlaYUVerFrame* m_pcFrame;
|
||||
|
||||
public:
|
||||
HistogramWorker( QObject* parent )
|
||||
@@ -50,13 +44,12 @@ public:
|
||||
m_parent = parent;
|
||||
}
|
||||
|
||||
void setup( CalypFrame* frame )
|
||||
Void setup( PlaYUVerFrame* frame )
|
||||
{
|
||||
m_pcFrame = frame;
|
||||
// run();
|
||||
start();
|
||||
run();
|
||||
}
|
||||
void run()
|
||||
Void run()
|
||||
{
|
||||
if( m_pcFrame && m_parent )
|
||||
{
|
||||
@@ -79,13 +72,12 @@ public:
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom Event
|
||||
*/
|
||||
* Custom Event
|
||||
*/
|
||||
class EventData : public QEvent
|
||||
{
|
||||
public:
|
||||
EventData()
|
||||
: QEvent( QEvent::User )
|
||||
EventData() : QEvent( QEvent::User )
|
||||
{
|
||||
starting = false;
|
||||
success = false;
|
||||
@@ -94,7 +86,7 @@ public:
|
||||
|
||||
bool starting;
|
||||
bool success;
|
||||
CalypFrame* frame;
|
||||
PlaYUVerFrame* frame;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -142,25 +134,25 @@ public:
|
||||
double xmin;
|
||||
double xminOrg;
|
||||
double xmax;
|
||||
int range;
|
||||
int clearFlag; // Clear drawing zone with message.
|
||||
Int range;
|
||||
Int clearFlag; // Clear drawing zone with message.
|
||||
|
||||
// Image informations
|
||||
int imageChannels;
|
||||
int imageColorSpace;
|
||||
int imageBits;
|
||||
Int imageChannels;
|
||||
Int imageColorSpace;
|
||||
Int imageBits;
|
||||
|
||||
bool guideVisible; // Display color guide.
|
||||
bool statisticsVisible; // Display tooltip histogram statistics.
|
||||
bool inSelected;
|
||||
bool selectMode; // If true, a part of the histogram can be
|
||||
// selected !
|
||||
// selected !
|
||||
bool blinkFlag;
|
||||
bool blinkComputation; // If true, a message will be displayed during
|
||||
// histogram computation, else nothing (limit
|
||||
// flicker effect in widget especially for small
|
||||
// image/computation time).
|
||||
bool lumaChannel; // Compute luminance channel if true.
|
||||
// histogram computation, else nothing (limit
|
||||
// flicker effect in widget especially for small
|
||||
// image/computation time).
|
||||
bool lumaChannel; // Compute luminance channel if true.
|
||||
bool inInitialRepaintWait;
|
||||
|
||||
QTimer* blinkTimer;
|
||||
@@ -173,19 +165,20 @@ public:
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Constructor without image data
|
||||
HistogramWidget::HistogramWidget( int width, int height, QWidget* parent )
|
||||
: QWidget( parent )
|
||||
HistogramWidget::HistogramWidget( Int width, Int height, QWidget* parent ) : QWidget( parent )
|
||||
{
|
||||
setAttribute( Qt::WA_DeleteOnClose );
|
||||
|
||||
d = new HistogramWidgetPrivate;
|
||||
|
||||
m_channelType = CalypFrame::HIST_LUMA;
|
||||
// m_channelType = LumaHistogram;
|
||||
m_channelType = FirstChannelHistogram;
|
||||
m_scaleType = LogScaleHistogram;
|
||||
m_colorType = -1;
|
||||
m_colorType = FirstChannelColor;
|
||||
m_renderingType = FullImageHistogram;
|
||||
|
||||
setOptions( HistogramWidget::BlinkComputation | HistogramWidget::SelectMode | HistogramWidget::ShowLumaChannel );
|
||||
setOptions( HistogramWidget::BlinkComputation | HistogramWidget::SelectMode |
|
||||
HistogramWidget::ShowLumaChannel );
|
||||
|
||||
setMouseTracking( true );
|
||||
setMinimumSize( width, height );
|
||||
@@ -210,6 +203,12 @@ HistogramWidget::~HistogramWidget()
|
||||
{
|
||||
d->blinkTimer->stop();
|
||||
|
||||
// if( m_imageHistogram )
|
||||
// delete m_imageHistogram;
|
||||
//
|
||||
// if( m_selectionHistogram )
|
||||
// delete m_selectionHistogram;
|
||||
|
||||
delete m_imageWorker;
|
||||
delete m_selectionWorker;
|
||||
|
||||
@@ -219,7 +218,7 @@ HistogramWidget::~HistogramWidget()
|
||||
// Setup Functions
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void HistogramWidget::setOptions( HistogramOptions options )
|
||||
Void HistogramWidget::setOptions( HistogramOptions options )
|
||||
{
|
||||
d->statisticsVisible = (bool)( options & ShowStatistics );
|
||||
d->selectMode = (bool)( options & SelectMode );
|
||||
@@ -227,14 +226,14 @@ void HistogramWidget::setOptions( HistogramOptions options )
|
||||
d->lumaChannel = (bool)( options & ShowLumaChannel );
|
||||
}
|
||||
|
||||
void HistogramWidget::setHistogramGuideByColor( QColor color )
|
||||
Void HistogramWidget::setHistogramGuideByColor( QColor color )
|
||||
{
|
||||
d->guideVisible = true;
|
||||
d->colorGuide = color;
|
||||
update();
|
||||
}
|
||||
|
||||
void HistogramWidget::reset()
|
||||
Void HistogramWidget::reset()
|
||||
{
|
||||
d->guideVisible = false;
|
||||
d->clearFlag = HistogramWidgetPrivate::HistogramNone;
|
||||
@@ -248,7 +247,7 @@ void HistogramWidget::reset()
|
||||
// Custom Event Handler
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void HistogramWidget::customEvent( QEvent* event )
|
||||
Void HistogramWidget::customEvent( QEvent* event )
|
||||
{
|
||||
if( !event )
|
||||
{
|
||||
@@ -300,7 +299,7 @@ void HistogramWidget::customEvent( QEvent* event )
|
||||
unsetCursor();
|
||||
|
||||
// Send signals to refresh information if necessary.
|
||||
// The signals may trigger multiple repaints, avoid this,
|
||||
// The signals may trigger multiple repaints, aVoid this,
|
||||
// we repaint once afterwards.
|
||||
setUpdatesEnabled( false );
|
||||
|
||||
@@ -320,6 +319,16 @@ void HistogramWidget::customEvent( QEvent* event )
|
||||
// Remove old histogram data from memory.
|
||||
m_fullImage = NULL;
|
||||
m_selectionImage = NULL;
|
||||
// if( m_imageHistogram )
|
||||
// {
|
||||
// delete m_imageHistogram;
|
||||
// m_imageHistogram = 0;
|
||||
// }
|
||||
// if( m_selectionHistogram )
|
||||
// {
|
||||
// delete m_selectionHistogram;
|
||||
// m_selectionHistogram = 0;
|
||||
// }
|
||||
emit signalHistogramComputationFailed();
|
||||
}
|
||||
}
|
||||
@@ -330,7 +339,7 @@ void HistogramWidget::customEvent( QEvent* event )
|
||||
// Data Loading Functions
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void HistogramWidget::setDataLoading()
|
||||
Void HistogramWidget::setDataLoading()
|
||||
{
|
||||
if( d->clearFlag != HistogramWidgetPrivate::HistogramDataLoading )
|
||||
{
|
||||
@@ -344,7 +353,7 @@ void HistogramWidget::setDataLoading()
|
||||
}
|
||||
}
|
||||
|
||||
void HistogramWidget::setLoadingSkipped()
|
||||
Void HistogramWidget::setLoadingSkipped()
|
||||
{
|
||||
d->clearFlag = HistogramWidgetPrivate::HistogramSkipped;
|
||||
d->blinkTimer->stop();
|
||||
@@ -353,7 +362,7 @@ void HistogramWidget::setLoadingSkipped()
|
||||
unsetCursor();
|
||||
}
|
||||
|
||||
void HistogramWidget::setLoadingFailed()
|
||||
Void HistogramWidget::setLoadingFailed()
|
||||
{
|
||||
d->clearFlag = HistogramWidgetPrivate::HistogramFailed;
|
||||
d->blinkTimer->stop();
|
||||
@@ -364,7 +373,7 @@ void HistogramWidget::setLoadingFailed()
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void HistogramWidget::stopHistogramComputation()
|
||||
Void HistogramWidget::stopHistogramComputation()
|
||||
{
|
||||
// if( m_imageHistogram )
|
||||
// m_imageHistogram->setRunningFlag( false );
|
||||
@@ -379,29 +388,17 @@ void HistogramWidget::stopHistogramComputation()
|
||||
// Update Data Methods
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void HistogramWidget::updateData( CalypFrame* pcFrame, CalypFrame* pcFrameSelection )
|
||||
Void HistogramWidget::updateData( PlaYUVerFrame* pcFrame, PlaYUVerFrame* pcFrameSelection )
|
||||
{
|
||||
d->imageBits = pcFrame->getBitsPel();
|
||||
switch( pcFrame->getColorSpace() )
|
||||
{
|
||||
case CLP_COLOR_YUV:
|
||||
case CLP_COLOR_GRAY:
|
||||
d->imageColorSpace = 0;
|
||||
break;
|
||||
case CLP_COLOR_RGB:
|
||||
case CLP_COLOR_RGBA:
|
||||
d->imageColorSpace = 0;
|
||||
break;
|
||||
default:
|
||||
d->imageColorSpace = 0;
|
||||
}
|
||||
d->imageColorSpace = pcFrame->getColorSpace();
|
||||
d->imageChannels = pcFrame->getNumberChannels();
|
||||
|
||||
// We are deleting the histogram data,
|
||||
// so we must not use it to draw any more.
|
||||
d->clearFlag = HistogramWidgetPrivate::HistogramNone;
|
||||
|
||||
// Do not using CalypFrameStatistics::getHistogramSegment()
|
||||
// Do not using PlaYUVerFrameStatistics::getHistogramSegment()
|
||||
// method here because histogram hasn't yet been computed.
|
||||
|
||||
d->range = ( 1 << d->imageBits ) - 1;
|
||||
@@ -416,7 +413,7 @@ void HistogramWidget::updateData( CalypFrame* pcFrame, CalypFrame* pcFrameSelect
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void HistogramWidget::slotBlinkTimerDone()
|
||||
Void HistogramWidget::slotBlinkTimerDone()
|
||||
{
|
||||
d->blinkFlag = !d->blinkFlag;
|
||||
d->inInitialRepaintWait = false;
|
||||
@@ -428,7 +425,7 @@ void HistogramWidget::slotBlinkTimerDone()
|
||||
// Paint Event
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void HistogramWidget::paintEvent( QPaintEvent* )
|
||||
Void HistogramWidget::paintEvent( QPaintEvent* )
|
||||
{
|
||||
int maxX = size().width() - 1;
|
||||
int maxY = size().height() - 1;
|
||||
@@ -443,7 +440,8 @@ void HistogramWidget::paintEvent( QPaintEvent* )
|
||||
QPainter p1( this );
|
||||
|
||||
p1.fillRect( 0, 0, maxX, maxY, palette().color( QPalette::Disabled, QPalette::Window ) );
|
||||
p1.setPen( QPen( palette().color( QPalette::Disabled, QPalette::WindowText ), 1, Qt::SolidLine ) );
|
||||
p1.setPen(
|
||||
QPen( palette().color( QPalette::Disabled, QPalette::WindowText ), 1, Qt::SolidLine ) );
|
||||
p1.drawRect( 0, 0, maxX, maxY );
|
||||
|
||||
return;
|
||||
@@ -465,7 +463,8 @@ void HistogramWidget::paintEvent( QPaintEvent* )
|
||||
if( d->clearFlag == HistogramWidgetPrivate::HistogramDataLoading )
|
||||
p1.drawText( 0, 0, maxX, maxY, Qt::AlignCenter, tr( "Loading image..." ) );
|
||||
else
|
||||
p1.drawText( 0, 0, maxX, maxY, Qt::AlignCenter, tr( "Histogram\ncalculation\nin progress..." ) );
|
||||
p1.drawText( 0, 0, maxX, maxY, Qt::AlignCenter,
|
||||
tr( "Histogram\ncalculation\nin progress..." ) );
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -497,7 +496,7 @@ void HistogramWidget::paintEvent( QPaintEvent* )
|
||||
int wWidth = width() - 1;
|
||||
int wHeight = height() - 1;
|
||||
double max;
|
||||
CalypFrame* frame;
|
||||
PlaYUVerFrame* frame;
|
||||
|
||||
if( m_renderingType == ImageSelectionHistogram && m_selectionImage )
|
||||
frame = m_selectionImage;
|
||||
@@ -514,12 +513,35 @@ void HistogramWidget::paintEvent( QPaintEvent* )
|
||||
yb = 0;
|
||||
max = 0.0;
|
||||
|
||||
max = frame->getMaximum( m_channelType );
|
||||
switch( m_channelType )
|
||||
{
|
||||
case HistogramWidget::FirstChannelHistogram: // Y channel.
|
||||
max = frame->getMaximum( LUMA );
|
||||
break;
|
||||
case HistogramWidget::SecondChannelHistogram: // Cb channel.
|
||||
max = frame->getMaximum( CHROMA_U );
|
||||
break;
|
||||
case HistogramWidget::ThirdChannelHistogram: // Cr channel.
|
||||
max = frame->getMaximum( CHROMA_V );
|
||||
break;
|
||||
case HistogramWidget::AlphaChannelHistogram: // Alpha channel.
|
||||
max = frame->getMaximum( COLOR_A );
|
||||
break;
|
||||
|
||||
case HistogramWidget::ColorChannelsHistogram: // All color channels.
|
||||
max = qMax( qMax( frame->getMaximum( LUMA ), frame->getMaximum( CHROMA_U ) ),
|
||||
frame->getMaximum( CHROMA_V ) );
|
||||
break;
|
||||
// case HistogramWidget::LumaHistogram: // Luminance.
|
||||
// max = frame->getMaximum( LUMA );
|
||||
// break;
|
||||
}
|
||||
|
||||
switch( m_scaleType )
|
||||
{
|
||||
case HistogramWidget::LinScaleHistogram:
|
||||
break;
|
||||
|
||||
case HistogramWidget::LogScaleHistogram:
|
||||
if( max > 0.0 )
|
||||
max = log( max );
|
||||
@@ -530,9 +552,9 @@ void HistogramWidget::paintEvent( QPaintEvent* )
|
||||
|
||||
// From Qt 4.0, QWidget automatically double-buffers its painting,
|
||||
// so there's no need to write double-buffering code in paintEvent()
|
||||
// to avoid flicker.
|
||||
// to aVoid flicker.
|
||||
QPainter p1( this );
|
||||
int pallet = d->imageColorSpace;
|
||||
Int pallet = d->imageColorSpace;
|
||||
|
||||
// Drawing selection or all histogram values.
|
||||
|
||||
@@ -542,8 +564,8 @@ void HistogramWidget::paintEvent( QPaintEvent* )
|
||||
double value_r = 0.0, value_g = 0.0, value_b = 0.0; // For all channels.
|
||||
int i, j;
|
||||
|
||||
i = ( x * frame->getNumHistogramSegment() ) / wWidth;
|
||||
j = ( ( x + 1 ) * frame->getNumHistogramSegment() ) / wWidth;
|
||||
i = ( x * frame->getHistogramSegment() ) / wWidth;
|
||||
j = ( ( x + 1 ) * frame->getHistogramSegment() ) / wWidth;
|
||||
|
||||
do
|
||||
{
|
||||
@@ -555,12 +577,37 @@ void HistogramWidget::paintEvent( QPaintEvent* )
|
||||
vg = 0.0;
|
||||
vb = 0.0;
|
||||
|
||||
if( m_channelType == CalypFrame::HIST_ALL_CHANNELS )
|
||||
switch( m_channelType )
|
||||
{
|
||||
vr = frame->getHistogramValue( CalypFrame::HIST_CHAN_ONE, i );
|
||||
vg = frame->getHistogramValue( CalypFrame::HIST_CHAN_TWO, i );
|
||||
vb = frame->getHistogramValue( CalypFrame::HIST_CHAN_THREE, i );
|
||||
case HistogramWidget::FirstChannelHistogram: // Y channel.
|
||||
v = frame->getHistogramValue( LUMA, i++ );
|
||||
break;
|
||||
case HistogramWidget::SecondChannelHistogram: // Cb channel.
|
||||
v = frame->getHistogramValue( CHROMA_U, i++ );
|
||||
break;
|
||||
case HistogramWidget::ThirdChannelHistogram: // Cr channel.
|
||||
v = frame->getHistogramValue( CHROMA_V, i++ );
|
||||
break;
|
||||
case HistogramWidget::AlphaChannelHistogram: // Alpha channel.
|
||||
v = frame->getHistogramValue( COLOR_A, i++ );
|
||||
break;
|
||||
case HistogramWidget::ColorChannelsHistogram: // All color.
|
||||
vr = frame->getHistogramValue( LUMA, i );
|
||||
vg = frame->getHistogramValue( CHROMA_U, i );
|
||||
vb = frame->getHistogramValue( CHROMA_V, i++ );
|
||||
break;
|
||||
// case HistogramWidget::LumaHistogram: // Luminance.
|
||||
// v = frame->getHistogramValue( LUMA, i++ );
|
||||
// break;
|
||||
}
|
||||
|
||||
if( m_channelType != HistogramWidget::ColorChannelsHistogram )
|
||||
{
|
||||
if( v > value )
|
||||
value = v;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( vr > value_r )
|
||||
value_r = vr;
|
||||
if( vg > value_g )
|
||||
@@ -568,16 +615,9 @@ void HistogramWidget::paintEvent( QPaintEvent* )
|
||||
if( vb > value_b )
|
||||
value_b = vb;
|
||||
}
|
||||
else
|
||||
{
|
||||
v = frame->getHistogramValue( m_channelType, i );
|
||||
if( v > value )
|
||||
value = v;
|
||||
}
|
||||
i++;
|
||||
} while( i < j );
|
||||
|
||||
if( m_channelType != CalypFrame::HIST_ALL_CHANNELS )
|
||||
if( m_channelType != HistogramWidget::ColorChannelsHistogram )
|
||||
{
|
||||
switch( m_scaleType )
|
||||
{
|
||||
@@ -628,7 +668,7 @@ void HistogramWidget::paintEvent( QPaintEvent* )
|
||||
|
||||
// Drawing the histogram + selection or only the histogram.
|
||||
|
||||
if( m_channelType != CalypFrame::HIST_ALL_CHANNELS )
|
||||
if( m_channelType != HistogramWidget::ColorChannelsHistogram )
|
||||
{
|
||||
if( d->selectMode == true ) // Selection mode enable ?
|
||||
{
|
||||
@@ -681,23 +721,17 @@ void HistogramWidget::paintEvent( QPaintEvent* )
|
||||
// colors channel mode?
|
||||
switch( m_colorType )
|
||||
{
|
||||
case CalypFrame::HIST_LUMA:
|
||||
case CalypFrame::HIST_COLOR_R:
|
||||
case HistogramWidget::FirstChannelColor:
|
||||
p1.drawLine( x, wHeight, x, wHeight - yr );
|
||||
break;
|
||||
|
||||
case CalypFrame::HIST_CHROMA_U:
|
||||
case CalypFrame::HIST_COLOR_G:
|
||||
case HistogramWidget::SecondChannelColor:
|
||||
p1.drawLine( x, wHeight, x, wHeight - yg );
|
||||
break;
|
||||
|
||||
case CalypFrame::HIST_CHROMA_V:
|
||||
case CalypFrame::HIST_COLOR_B:
|
||||
default:
|
||||
p1.drawLine( x, wHeight, x, wHeight - yb );
|
||||
break;
|
||||
|
||||
default:
|
||||
Q_ASSERT( 0 );
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -706,13 +740,12 @@ void HistogramWidget::paintEvent( QPaintEvent* )
|
||||
// colors channel mode?
|
||||
switch( m_colorType )
|
||||
{
|
||||
case CalypFrame::HIST_LUMA:
|
||||
case CalypFrame::HIST_COLOR_R:
|
||||
p1.setPen( QPen( g_eColorPallet[pallet][1], 1, Qt::SolidLine ) );
|
||||
case HistogramWidget::FirstChannelColor:
|
||||
p1.setPen( QPen( g_eColorPallet[pallet][SecondChannelColor], 1, Qt::SolidLine ) );
|
||||
p1.drawLine( x, wHeight, x, wHeight - yg );
|
||||
p1.setPen( QPen( g_eColorPallet[pallet][2], 1, Qt::SolidLine ) );
|
||||
p1.setPen( QPen( g_eColorPallet[pallet][ThirdChannelColor], 1, Qt::SolidLine ) );
|
||||
p1.drawLine( x, wHeight, x, wHeight - yb );
|
||||
p1.setPen( QPen( g_eColorPallet[pallet][0], 1, Qt::SolidLine ) );
|
||||
p1.setPen( QPen( g_eColorPallet[pallet][FirstChannelColor], 1, Qt::SolidLine ) );
|
||||
p1.drawLine( x, wHeight, x, wHeight - yr );
|
||||
|
||||
p1.setPen( QPen( Qt::white, 1, Qt::SolidLine ) );
|
||||
@@ -724,13 +757,12 @@ void HistogramWidget::paintEvent( QPaintEvent* )
|
||||
|
||||
break;
|
||||
|
||||
case CalypFrame::HIST_CHROMA_U:
|
||||
case CalypFrame::HIST_COLOR_G:
|
||||
p1.setPen( QPen( g_eColorPallet[pallet][2], 1, Qt::SolidLine ) );
|
||||
case HistogramWidget::SecondChannelColor:
|
||||
p1.setPen( QPen( g_eColorPallet[pallet][ThirdChannelColor], 1, Qt::SolidLine ) );
|
||||
p1.drawLine( x, wHeight, x, wHeight - yb );
|
||||
p1.setPen( QPen( g_eColorPallet[pallet][0], 1, Qt::SolidLine ) );
|
||||
p1.setPen( QPen( g_eColorPallet[pallet][FirstChannelColor], 1, Qt::SolidLine ) );
|
||||
p1.drawLine( x, wHeight, x, wHeight - yr );
|
||||
p1.setPen( QPen( g_eColorPallet[pallet][1], 1, Qt::SolidLine ) );
|
||||
p1.setPen( QPen( g_eColorPallet[pallet][SecondChannelColor], 1, Qt::SolidLine ) );
|
||||
p1.drawLine( x, wHeight, x, wHeight - yg );
|
||||
|
||||
p1.setPen( QPen( Qt::white, 1, Qt::SolidLine ) );
|
||||
@@ -741,25 +773,23 @@ void HistogramWidget::paintEvent( QPaintEvent* )
|
||||
p1.drawLine( x, wHeight - yg - 1, x, wHeight - yg );
|
||||
|
||||
break;
|
||||
case CalypFrame::HIST_CHROMA_V:
|
||||
case CalypFrame::HIST_COLOR_B:
|
||||
p1.setPen( QPen( g_eColorPallet[pallet][0], 1, Qt::SolidLine ) );
|
||||
p1.drawLine( x, wHeight, x, wHeight - yr );
|
||||
p1.setPen( QPen( g_eColorPallet[pallet][1], 1, Qt::SolidLine ) );
|
||||
p1.drawLine( x, wHeight, x, wHeight - yg );
|
||||
p1.setPen( QPen( g_eColorPallet[pallet][2], 1, Qt::SolidLine ) );
|
||||
p1.drawLine( x, wHeight, x, wHeight - yb );
|
||||
|
||||
p1.setPen( QPen( Qt::white, 1, Qt::SolidLine ) );
|
||||
p1.drawLine( x, wHeight - qMax( qMax( yr, yg ), yb ), x, 0 );
|
||||
p1.setPen( QPen( Qt::gray, 1, Qt::SolidLine ) );
|
||||
p1.drawLine( x, wHeight - yr - 1, x, wHeight - yr );
|
||||
p1.drawLine( x, wHeight - yg - 1, x, wHeight - yg );
|
||||
p1.drawLine( x, wHeight - yb - 1, x, wHeight - yb );
|
||||
|
||||
break;
|
||||
default:
|
||||
Q_ASSERT( 0 );
|
||||
p1.setPen( QPen( g_eColorPallet[pallet][FirstChannelColor], 1, Qt::SolidLine ) );
|
||||
p1.drawLine( x, wHeight, x, wHeight - yr );
|
||||
p1.setPen( QPen( g_eColorPallet[pallet][SecondChannelColor], 1, Qt::SolidLine ) );
|
||||
p1.drawLine( x, wHeight, x, wHeight - yg );
|
||||
p1.setPen( QPen( g_eColorPallet[pallet][ThirdChannelColor], 1, Qt::SolidLine ) );
|
||||
p1.drawLine( x, wHeight, x, wHeight - yb );
|
||||
|
||||
p1.setPen( QPen( Qt::white, 1, Qt::SolidLine ) );
|
||||
p1.drawLine( x, wHeight - qMax( qMax( yr, yg ), yb ), x, 0 );
|
||||
p1.setPen( QPen( Qt::gray, 1, Qt::SolidLine ) );
|
||||
p1.drawLine( x, wHeight - yr - 1, x, wHeight - yr );
|
||||
p1.drawLine( x, wHeight - yg - 1, x, wHeight - yg );
|
||||
p1.drawLine( x, wHeight - yb - 1, x, wHeight - yb );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if( x == wWidth / 4 || x == wWidth / 2 || x == 3 * wWidth / 4 )
|
||||
@@ -775,16 +805,15 @@ void HistogramWidget::paintEvent( QPaintEvent* )
|
||||
// colors channel mode?
|
||||
switch( m_colorType )
|
||||
{
|
||||
case CalypFrame::HIST_LUMA:
|
||||
case CalypFrame::HIST_COLOR_R:
|
||||
case HistogramWidget::FirstChannelColor:
|
||||
p1.setPen( QPen( Qt::green, 1, Qt::SolidLine ) );
|
||||
p1.setPen( QPen( g_eColorPallet[pallet][1], 1, Qt::SolidLine ) );
|
||||
p1.setPen( QPen( g_eColorPallet[pallet][SecondChannelColor], 1, Qt::SolidLine ) );
|
||||
p1.drawLine( x, wHeight, x, wHeight - yg );
|
||||
p1.setPen( QPen( Qt::blue, 1, Qt::SolidLine ) );
|
||||
p1.setPen( QPen( g_eColorPallet[pallet][2], 1, Qt::SolidLine ) );
|
||||
p1.setPen( QPen( g_eColorPallet[pallet][ThirdChannelColor], 1, Qt::SolidLine ) );
|
||||
p1.drawLine( x, wHeight, x, wHeight - yb );
|
||||
p1.setPen( QPen( Qt::red, 1, Qt::SolidLine ) );
|
||||
p1.setPen( QPen( g_eColorPallet[pallet][0], 1, Qt::SolidLine ) );
|
||||
p1.setPen( QPen( g_eColorPallet[pallet][FirstChannelColor], 1, Qt::SolidLine ) );
|
||||
p1.drawLine( x, wHeight, x, wHeight - yr );
|
||||
|
||||
p1.setPen( QPen( Qt::white, 1, Qt::SolidLine ) );
|
||||
@@ -796,16 +825,15 @@ void HistogramWidget::paintEvent( QPaintEvent* )
|
||||
|
||||
break;
|
||||
|
||||
case CalypFrame::HIST_CHROMA_U:
|
||||
case CalypFrame::HIST_COLOR_G:
|
||||
case HistogramWidget::SecondChannelColor:
|
||||
p1.setPen( QPen( Qt::blue, 1, Qt::SolidLine ) );
|
||||
p1.setPen( QPen( g_eColorPallet[pallet][2], 1, Qt::SolidLine ) );
|
||||
p1.setPen( QPen( g_eColorPallet[pallet][ThirdChannelColor], 1, Qt::SolidLine ) );
|
||||
p1.drawLine( x, wHeight, x, wHeight - yb );
|
||||
p1.setPen( QPen( Qt::red, 1, Qt::SolidLine ) );
|
||||
p1.setPen( QPen( g_eColorPallet[pallet][0], 1, Qt::SolidLine ) );
|
||||
p1.setPen( QPen( g_eColorPallet[pallet][FirstChannelColor], 1, Qt::SolidLine ) );
|
||||
p1.drawLine( x, wHeight, x, wHeight - yr );
|
||||
p1.setPen( QPen( Qt::green, 1, Qt::SolidLine ) );
|
||||
p1.setPen( QPen( g_eColorPallet[pallet][1], 1, Qt::SolidLine ) );
|
||||
p1.setPen( QPen( g_eColorPallet[pallet][SecondChannelColor], 1, Qt::SolidLine ) );
|
||||
p1.drawLine( x, wHeight, x, wHeight - yg );
|
||||
|
||||
p1.setPen( QPen( Qt::white, 1, Qt::SolidLine ) );
|
||||
@@ -817,28 +845,25 @@ void HistogramWidget::paintEvent( QPaintEvent* )
|
||||
|
||||
break;
|
||||
|
||||
case CalypFrame::HIST_CHROMA_V:
|
||||
case CalypFrame::HIST_COLOR_B:
|
||||
p1.setPen( QPen( Qt::red, 1, Qt::SolidLine ) );
|
||||
p1.setPen( QPen( g_eColorPallet[pallet][0], 1, Qt::SolidLine ) );
|
||||
p1.drawLine( x, wHeight, x, wHeight - yr );
|
||||
p1.setPen( QPen( Qt::green, 1, Qt::SolidLine ) );
|
||||
p1.setPen( QPen( g_eColorPallet[pallet][1], 1, Qt::SolidLine ) );
|
||||
p1.drawLine( x, wHeight, x, wHeight - yg );
|
||||
p1.setPen( QPen( Qt::blue, 1, Qt::SolidLine ) );
|
||||
p1.setPen( QPen( g_eColorPallet[pallet][2], 1, Qt::SolidLine ) );
|
||||
p1.drawLine( x, wHeight, x, wHeight - yb );
|
||||
|
||||
p1.setPen( QPen( Qt::white, 1, Qt::SolidLine ) );
|
||||
p1.drawLine( x, wHeight - qMax( qMax( yr, yg ), yb ), x, 0 );
|
||||
p1.setPen( QPen( Qt::gray, 1, Qt::SolidLine ) );
|
||||
p1.drawLine( x, wHeight - yr - 1, x, wHeight - yr );
|
||||
p1.drawLine( x, wHeight - yg - 1, x, wHeight - yg );
|
||||
p1.drawLine( x, wHeight - yb - 1, x, wHeight - yb );
|
||||
|
||||
break;
|
||||
default:
|
||||
Q_ASSERT( 0 );
|
||||
p1.setPen( QPen( Qt::red, 1, Qt::SolidLine ) );
|
||||
p1.setPen( QPen( g_eColorPallet[pallet][FirstChannelColor], 1, Qt::SolidLine ) );
|
||||
p1.drawLine( x, wHeight, x, wHeight - yr );
|
||||
p1.setPen( QPen( Qt::green, 1, Qt::SolidLine ) );
|
||||
p1.setPen( QPen( g_eColorPallet[pallet][SecondChannelColor], 1, Qt::SolidLine ) );
|
||||
p1.drawLine( x, wHeight, x, wHeight - yg );
|
||||
p1.setPen( QPen( Qt::blue, 1, Qt::SolidLine ) );
|
||||
p1.setPen( QPen( g_eColorPallet[pallet][ThirdChannelColor], 1, Qt::SolidLine ) );
|
||||
p1.drawLine( x, wHeight, x, wHeight - yb );
|
||||
|
||||
p1.setPen( QPen( Qt::white, 1, Qt::SolidLine ) );
|
||||
p1.drawLine( x, wHeight - qMax( qMax( yr, yg ), yb ), x, 0 );
|
||||
p1.setPen( QPen( Qt::gray, 1, Qt::SolidLine ) );
|
||||
p1.drawLine( x, wHeight - yr - 1, x, wHeight - yr );
|
||||
p1.drawLine( x, wHeight - yg - 1, x, wHeight - yg );
|
||||
p1.drawLine( x, wHeight - yb - 1, x, wHeight - yb );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if( x == wWidth / 4 || x == wWidth / 2 || x == 3 * wWidth / 4 )
|
||||
@@ -859,23 +884,22 @@ void HistogramWidget::paintEvent( QPaintEvent* )
|
||||
{
|
||||
switch( m_channelType )
|
||||
{
|
||||
case CalypFrame::HIST_CHROMA_V:
|
||||
case CalypFrame::HIST_COLOR_R:
|
||||
case HistogramWidget::FirstChannelHistogram:
|
||||
guidePos = d->colorGuide.red();
|
||||
break;
|
||||
|
||||
case CalypFrame::HIST_COLOR_G:
|
||||
case HistogramWidget::SecondChannelHistogram:
|
||||
guidePos = d->colorGuide.green();
|
||||
break;
|
||||
|
||||
case CalypFrame::HIST_CHROMA_U:
|
||||
case CalypFrame::HIST_COLOR_B:
|
||||
case HistogramWidget::ThirdChannelHistogram:
|
||||
guidePos = d->colorGuide.blue();
|
||||
break;
|
||||
|
||||
case CalypFrame::HIST_LUMA:
|
||||
guidePos = qMax( qMax( d->colorGuide.red(), d->colorGuide.green() ), d->colorGuide.blue() );
|
||||
break;
|
||||
// case HistogramWidget::LumaHistogram:
|
||||
// guidePos = qMax( qMax( d->colorGuide.red(), d->colorGuide.green()
|
||||
// ), d->colorGuide.blue() );
|
||||
// break;
|
||||
|
||||
default: // Alpha.
|
||||
guidePos = -1;
|
||||
@@ -884,7 +908,7 @@ void HistogramWidget::paintEvent( QPaintEvent* )
|
||||
|
||||
if( guidePos != -1 )
|
||||
{
|
||||
int xGuide = ( guidePos * wWidth ) / frame->getNumHistogramSegment();
|
||||
int xGuide = ( guidePos * wWidth ) / frame->getHistogramSegment();
|
||||
p1.drawLine( xGuide, 0, xGuide, wHeight );
|
||||
|
||||
QString string = tr( "x:%1" ).arg( guidePos );
|
||||
@@ -921,7 +945,7 @@ void HistogramWidget::paintEvent( QPaintEvent* )
|
||||
tipText = "<table cellspacing=0 cellpadding=0>";
|
||||
|
||||
tipText += cellBeg + tr( "Mean:" ) + cellMid;
|
||||
double mean = frame->getMean( m_channelType, 0, frame->getNumHistogramSegment() - 1 );
|
||||
double mean = frame->getMean( m_channelType, 0, frame->getHistogramSegment() - 1 );
|
||||
tipText += value.setNum( mean, 'f', 1 ) + cellEnd;
|
||||
|
||||
tipText += cellBeg + tr( "Pixels:" ) + cellMid;
|
||||
@@ -929,15 +953,15 @@ void HistogramWidget::paintEvent( QPaintEvent* )
|
||||
tipText += value.setNum( (float)pixels, 'f', 0 ) + cellEnd;
|
||||
|
||||
tipText += cellBeg + tr( "Std dev.:" ) + cellMid;
|
||||
double stddev = frame->getStdDev( m_channelType, 0, frame->getNumHistogramSegment() - 1 );
|
||||
double stddev = frame->getStdDev( m_channelType, 0, frame->getHistogramSegment() - 1 );
|
||||
tipText += value.setNum( stddev, 'f', 1 ) + cellEnd;
|
||||
|
||||
tipText += cellBeg + tr( "Selected:" ) + cellMid;
|
||||
double counts = frame->getNumPixelsRange( m_channelType, 0, frame->getNumHistogramSegment() - 1 );
|
||||
double counts = frame->getCount( m_channelType, 0, frame->getHistogramSegment() - 1 );
|
||||
tipText += value.setNum( (float)counts, 'f', 0 ) + cellEnd;
|
||||
|
||||
tipText += cellBeg + tr( "Median:" ) + cellMid;
|
||||
double median = frame->getMedian( m_channelType, 0, frame->getNumHistogramSegment() - 1 );
|
||||
double median = frame->getMedian( m_channelType, 0, frame->getHistogramSegment() - 1 );
|
||||
tipText += value.setNum( median, 'f', 1 ) + cellEnd;
|
||||
|
||||
tipText += cellBeg + tr( "Percent:" ) + cellMid;
|
||||
@@ -961,7 +985,7 @@ void HistogramWidget::paintEvent( QPaintEvent* )
|
||||
// Mouse Events
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void HistogramWidget::mousePressEvent( QMouseEvent* e )
|
||||
Void HistogramWidget::mousePressEvent( QMouseEvent* e )
|
||||
{
|
||||
if( d->selectMode == true && d->clearFlag == HistogramWidgetPrivate::HistogramCompleted )
|
||||
{
|
||||
@@ -979,7 +1003,7 @@ void HistogramWidget::mousePressEvent( QMouseEvent* e )
|
||||
}
|
||||
}
|
||||
|
||||
void HistogramWidget::mouseReleaseEvent( QMouseEvent* )
|
||||
Void HistogramWidget::mouseReleaseEvent( QMouseEvent* )
|
||||
{
|
||||
if( d->selectMode == true && d->clearFlag == HistogramWidgetPrivate::HistogramCompleted )
|
||||
|
||||
@@ -997,7 +1021,7 @@ void HistogramWidget::mouseReleaseEvent( QMouseEvent* )
|
||||
}
|
||||
}
|
||||
|
||||
void HistogramWidget::mouseMoveEvent( QMouseEvent* e )
|
||||
Void HistogramWidget::mouseMoveEvent( QMouseEvent* e )
|
||||
{
|
||||
if( d->selectMode == true && d->clearFlag == HistogramWidgetPrivate::HistogramCompleted )
|
||||
{
|
||||
@@ -1032,12 +1056,13 @@ void HistogramWidget::mouseMoveEvent( QMouseEvent* e )
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void HistogramWidget::notifyValuesChanged()
|
||||
Void HistogramWidget::notifyValuesChanged()
|
||||
{
|
||||
emit signalintervalChanged( (int)( d->xmin * d->range ), d->xmax == 0.0 ? d->range : (int)( d->xmax * d->range ) );
|
||||
emit signalIntervalChanged( (int)( d->xmin * d->range ),
|
||||
d->xmax == 0.0 ? d->range : (int)( d->xmax * d->range ) );
|
||||
}
|
||||
|
||||
void HistogramWidget::slotMinValueChanged( int min )
|
||||
Void HistogramWidget::slotMinValueChanged( int min )
|
||||
{
|
||||
if( d->selectMode == true && d->clearFlag == HistogramWidgetPrivate::HistogramCompleted )
|
||||
{
|
||||
@@ -1055,7 +1080,7 @@ void HistogramWidget::slotMinValueChanged( int min )
|
||||
}
|
||||
}
|
||||
|
||||
void HistogramWidget::slotMaxValueChanged( int max )
|
||||
Void HistogramWidget::slotMaxValueChanged( int max )
|
||||
{
|
||||
if( d->selectMode == true && d->clearFlag == HistogramWidgetPrivate::HistogramCompleted )
|
||||
{
|
||||
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -26,10 +26,9 @@
|
||||
#ifndef __HISTOGRAMWIDGET_H__
|
||||
#define __HISTOGRAMWIDGET_H__
|
||||
|
||||
#include "CommonDefs.h"
|
||||
#include "PlaYUVerAppDefs.h"
|
||||
#include "config.h"
|
||||
#include "lib/CalypFrame.h"
|
||||
|
||||
#include "lib/PlaYUVerFrame.h"
|
||||
#include <QColor>
|
||||
#include <QWidget>
|
||||
|
||||
@@ -43,6 +42,20 @@ class HistogramWidget : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum HistogramChannel
|
||||
{
|
||||
/** Luminance */
|
||||
// LumaHistogram = 0,
|
||||
/** Channels */
|
||||
FirstChannelHistogram = 0,
|
||||
SecondChannelHistogram,
|
||||
ThirdChannelHistogram,
|
||||
/** Alpha channel */
|
||||
AlphaChannelHistogram,
|
||||
/** All color channels */
|
||||
ColorChannelsHistogram,
|
||||
};
|
||||
|
||||
enum HistogramScale
|
||||
{
|
||||
/** Linear scale */
|
||||
@@ -51,6 +64,14 @@ public:
|
||||
LogScaleHistogram
|
||||
};
|
||||
|
||||
enum HistogramAllColorMode
|
||||
{
|
||||
// Select wich component is shown in foreground
|
||||
FirstChannelColor,
|
||||
SecondChannelColor,
|
||||
ThirdChannelColor,
|
||||
};
|
||||
|
||||
enum HistogramRendering
|
||||
{
|
||||
/** Full image histogram rendering */
|
||||
@@ -82,46 +103,46 @@ public:
|
||||
* @param height of the widget
|
||||
* @param parent the histogram widget parent
|
||||
*/
|
||||
HistogramWidget( int width, int height, QWidget* parent = 0 );
|
||||
HistogramWidget( Int width, Int height, QWidget* parent = 0 );
|
||||
|
||||
~HistogramWidget();
|
||||
|
||||
/** Stop current histogram computations.*/
|
||||
void stopHistogramComputation();
|
||||
Void stopHistogramComputation();
|
||||
|
||||
/** Update full image histogram data. */
|
||||
void updateData( CalypFrame* pcFrame, CalypFrame* pcFrameSelection );
|
||||
Void updateData( PlaYUVerFrame* pcFrame, PlaYUVerFrame* pcFrameSelection );
|
||||
|
||||
/** @see @p HistogramOption */
|
||||
void setOptions( HistogramOptions options = AllOptions );
|
||||
void setDataLoading();
|
||||
void setLoadingSkipped();
|
||||
void setLoadingFailed();
|
||||
void setHistogramGuideByColor( QColor color );
|
||||
Void setOptions( HistogramOptions options = AllOptions );
|
||||
Void setDataLoading();
|
||||
Void setLoadingSkipped();
|
||||
Void setLoadingFailed();
|
||||
Void setHistogramGuideByColor( QColor color );
|
||||
|
||||
void reset();
|
||||
Void reset();
|
||||
|
||||
public:
|
||||
/** Channel type to draw */
|
||||
int m_channelType;
|
||||
Int m_channelType;
|
||||
/** Scale to use for drawing */
|
||||
int m_scaleType;
|
||||
Int m_scaleType;
|
||||
/** Color to use for drawing in All Colors Channel mode */
|
||||
int m_colorType;
|
||||
Int m_colorType;
|
||||
/** Using full image or image selection for histogram rendering */
|
||||
int m_renderingType;
|
||||
Int m_renderingType;
|
||||
|
||||
/** Full image */
|
||||
HistogramWorker* m_imageWorker;
|
||||
// CalypFrameStats* m_imageHistogram;
|
||||
CalypFrame* m_fullImage;
|
||||
// PlaYUVerFrameStats* m_imageHistogram;
|
||||
PlaYUVerFrame* m_fullImage;
|
||||
/** Histogram area selection */
|
||||
HistogramWorker* m_selectionWorker;
|
||||
// CalypFrameStats* m_selectionHistogram;
|
||||
CalypFrame* m_selectionImage;
|
||||
// PlaYUVerFrameStats* m_selectionHistogram;
|
||||
PlaYUVerFrame* m_selectionImage;
|
||||
|
||||
Q_SIGNALS:
|
||||
void signalintervalChanged( int min, int max );
|
||||
void signalIntervalChanged( int min, int max );
|
||||
void signalMaximumValueChanged( int );
|
||||
void signalHistogramComputationDone( int );
|
||||
void signalHistogramComputationFailed( void );
|
||||
@@ -134,14 +155,14 @@ protected slots:
|
||||
void slotBlinkTimerDone( void );
|
||||
|
||||
protected:
|
||||
void paintEvent( QPaintEvent* );
|
||||
void mousePressEvent( QMouseEvent* e );
|
||||
void mouseReleaseEvent( QMouseEvent* e );
|
||||
void mouseMoveEvent( QMouseEvent* e );
|
||||
Void paintEvent( QPaintEvent* );
|
||||
Void mousePressEvent( QMouseEvent* e );
|
||||
Void mouseReleaseEvent( QMouseEvent* e );
|
||||
Void mouseMoveEvent( QMouseEvent* e );
|
||||
|
||||
private:
|
||||
void customEvent( QEvent* event );
|
||||
void notifyValuesChanged();
|
||||
Void customEvent( QEvent* event );
|
||||
Void notifyValuesChanged();
|
||||
|
||||
private:
|
||||
HistogramWidgetPrivate* d;
|
||||
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -23,22 +23,17 @@
|
||||
*/
|
||||
|
||||
#include "ModuleHandleDock.h"
|
||||
|
||||
#include "CalypAppModuleIf.h"
|
||||
#include "ModulesHandle.h"
|
||||
|
||||
#include <QGridLayout>
|
||||
#include <QLabel>
|
||||
#include <QString>
|
||||
#include "PlaYUVerAppModuleIf.h"
|
||||
#include <QtGui>
|
||||
|
||||
ModuleHandleDock::ModuleHandleDock( QWidget* parent, CalypAppModuleIf* moduleIf )
|
||||
ModuleHandleDock::ModuleHandleDock( QWidget* parent, PlaYUVerAppModuleIf* moduleIf )
|
||||
: QWidget( parent ), m_pcCurrModuleIf( moduleIf )
|
||||
{
|
||||
// ----------------- Dock definition -----------------
|
||||
|
||||
QString labelStr;
|
||||
labelStr.append( moduleIf->m_pcModule->getModuleLongName() );
|
||||
labelStr.append( moduleIf->m_pcModule->m_pchModuleName );
|
||||
labelStr.append( " Result:" );
|
||||
labelModulueValueLabel = new QLabel( labelStr );
|
||||
labelModulueValueLabel->setAlignment( Qt::AlignLeft | Qt::AlignVCenter );
|
||||
@@ -47,7 +42,7 @@ ModuleHandleDock::ModuleHandleDock( QWidget* parent, CalypAppModuleIf* moduleIf
|
||||
labelModulueReturnValue->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
|
||||
|
||||
QGridLayout* modulesPropertiesLayout = new QGridLayout;
|
||||
int layout_line = 0;
|
||||
Int layout_line = 0;
|
||||
modulesPropertiesLayout->addWidget( labelModulueValueLabel, layout_line, 0 );
|
||||
modulesPropertiesLayout->addWidget( labelModulueReturnValue, layout_line, 1 );
|
||||
layout_line++;
|
||||
@@ -60,18 +55,18 @@ ModuleHandleDock::ModuleHandleDock( QWidget* parent, CalypAppModuleIf* moduleIf
|
||||
|
||||
ModuleHandleDock::~ModuleHandleDock() {}
|
||||
|
||||
void ModuleHandleDock::setModulueReturnValue( double value )
|
||||
Void ModuleHandleDock::setModulueReturnValue( Double value )
|
||||
{
|
||||
labelModulueReturnValue->clear();
|
||||
QString strValue = QString( "%1" ).arg( value );
|
||||
labelModulueReturnValue->setText( strValue );
|
||||
}
|
||||
|
||||
void ModuleHandleDock::visibilityChangedSlot( bool visiblity )
|
||||
Void ModuleHandleDock::visibilityChangedSlot( bool visiblity )
|
||||
{
|
||||
if( !visiblity && m_pcCurrModuleIf )
|
||||
{
|
||||
CalypAppModuleIf* pcCurrentModule = m_pcCurrModuleIf;
|
||||
PlaYUVerAppModuleIf* pcCurrentModule = m_pcCurrModuleIf;
|
||||
m_pcCurrModuleIf = NULL;
|
||||
ModulesHandle::destroyModuleIf( pcCurrentModule );
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -25,31 +25,32 @@
|
||||
#ifndef __MODULEHANDLEDOCK_H__
|
||||
#define __MODULEHANDLEDOCK_H__
|
||||
|
||||
#include "CommonDefs.h"
|
||||
#include "PlaYUVerAppDefs.h"
|
||||
#include "config.h"
|
||||
|
||||
#include <QSize>
|
||||
#if( QT_VERSION_PLAYUVER == 5 )
|
||||
#include <QtWidgets>
|
||||
#elif( QT_VERSION_PLAYUVER == 4 )
|
||||
#include <QWidget>
|
||||
#include <QtGui>
|
||||
#endif
|
||||
|
||||
class QLabel;
|
||||
|
||||
class CalypAppModuleIf;
|
||||
class PlaYUVerAppModuleIf;
|
||||
|
||||
class ModuleHandleDock : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ModuleHandleDock( QWidget* parent, CalypAppModuleIf* moduleIf );
|
||||
ModuleHandleDock( QWidget* parent, PlaYUVerAppModuleIf* moduleIf );
|
||||
~ModuleHandleDock();
|
||||
|
||||
void setModulueReturnValue( double value );
|
||||
Void setModulueReturnValue( Double value );
|
||||
|
||||
QSize sizeHint() const;
|
||||
|
||||
private:
|
||||
CalypAppModuleIf* m_pcCurrModuleIf;
|
||||
PlaYUVerAppModuleIf* m_pcCurrModuleIf;
|
||||
|
||||
bool m_bIsVisible;
|
||||
Bool m_bIsVisible;
|
||||
QLabel* labelModulueValueLabel;
|
||||
QLabel* labelModulueReturnValue;
|
||||
|
||||
+184
-171
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -19,30 +19,33 @@
|
||||
|
||||
/**
|
||||
* \file ModulesHandle.cpp
|
||||
* \brief Calyp modules handle
|
||||
* \brief PlaYUVer modules handle
|
||||
*/
|
||||
|
||||
#include "ModulesHandle.h"
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
#include "MainWindow.h"
|
||||
#include "DialogSubWindowSelector.h"
|
||||
#include "ModulesHandleOptDialog.h"
|
||||
#include "SubWindowHandle.h"
|
||||
#include "SubWindowSelectorDialog.h"
|
||||
#include "PlaYUVerApp.h"
|
||||
#include "PlaYUVerSubWindowHandle.h"
|
||||
#include "VideoHandle.h"
|
||||
#include "VideoSubWindow.h"
|
||||
#include "modules/CalypModulesFactory.h"
|
||||
#include "modules/PlaYUVerModuleFactory.h"
|
||||
#include <cstdio>
|
||||
|
||||
ModulesHandle::ModulesHandle( QWidget* parent, SubWindowHandle* windowManager, VideoHandle* moduleVideo )
|
||||
: QWidget( parent ), m_pcParent( parent ), m_pcMainWindowManager( windowManager ), m_appModuleVideo( moduleVideo )
|
||||
ModulesHandle::ModulesHandle( QWidget* parent,
|
||||
PlaYUVerSubWindowHandle* windowManager,
|
||||
VideoHandle* moduleVideo )
|
||||
: QWidget( parent )
|
||||
, m_pcParent( parent )
|
||||
, m_pcMainWindowManager( windowManager )
|
||||
, m_appModuleVideo( moduleVideo )
|
||||
{
|
||||
setParent( m_pcParent );
|
||||
}
|
||||
|
||||
ModulesHandle::~ModulesHandle() {}
|
||||
|
||||
void ModulesHandle::createActions()
|
||||
Void ModulesHandle::createActions()
|
||||
{
|
||||
m_arrayActions.resize( MODULES_TOTAL_ACT );
|
||||
|
||||
@@ -57,7 +60,8 @@ void ModulesHandle::createActions()
|
||||
|
||||
m_arrayActions[LOAD_EXTERNAL_ACT] = new QAction( "Load external module", parent() );
|
||||
m_arrayActions[LOAD_EXTERNAL_ACT]->setStatusTip( "Load an externally build module" );
|
||||
connect( m_arrayActions[LOAD_EXTERNAL_ACT], SIGNAL( triggered() ), this, SLOT( loadExternalModule() ) );
|
||||
connect( m_arrayActions[LOAD_EXTERNAL_ACT], SIGNAL( triggered() ), this,
|
||||
SLOT( loadExternalModule() ) );
|
||||
|
||||
m_arrayActions[APPLY_ALL_ACT] = new QAction( "Apply to All", parent() );
|
||||
m_arrayActions[APPLY_ALL_ACT]->setStatusTip( "Apply module to all frames and save the result" );
|
||||
@@ -66,14 +70,17 @@ void ModulesHandle::createActions()
|
||||
|
||||
m_arrayActions[SWAP_FRAMES_ACT] = new QAction( "Swap frames", parent() );
|
||||
m_arrayActions[SWAP_FRAMES_ACT]->setStatusTip( "Swap Sub Window order" );
|
||||
connect( m_arrayActions[SWAP_FRAMES_ACT], SIGNAL( triggered() ), m_pcActionMapper, SLOT( map() ) );
|
||||
connect( m_arrayActions[SWAP_FRAMES_ACT], SIGNAL( triggered() ), m_pcActionMapper,
|
||||
SLOT( map() ) );
|
||||
m_pcActionMapper->setMapping( m_arrayActions[SWAP_FRAMES_ACT], SWAP_FRAMES_ACT );
|
||||
|
||||
m_arrayActions[DISABLE_ACT] = new QAction( "Disable Modules", parent() );
|
||||
connect( m_arrayActions[DISABLE_ACT], SIGNAL( triggered() ), this, SLOT( destroyWindowModules() ) );
|
||||
connect( m_arrayActions[DISABLE_ACT], SIGNAL( triggered() ), this,
|
||||
SLOT( destroyWindowModules() ) );
|
||||
|
||||
m_arrayActions[DISABLE_ALL_ACT] = new QAction( "Disable All Modules", parent() );
|
||||
connect( m_arrayActions[DISABLE_ALL_ACT], SIGNAL( triggered() ), this, SLOT( destroyAllModulesIf() ) );
|
||||
connect( m_arrayActions[DISABLE_ALL_ACT], SIGNAL( triggered() ), this,
|
||||
SLOT( destroyAllModulesIf() ) );
|
||||
|
||||
m_arrayActions[FORCE_NEW_WINDOW_ACT] = new QAction( "Use New Window", parent() );
|
||||
m_arrayActions[FORCE_NEW_WINDOW_ACT]->setStatusTip(
|
||||
@@ -89,14 +96,14 @@ QMenu* ModulesHandle::createMenu()
|
||||
return m_pcModulesMenu;
|
||||
}
|
||||
|
||||
void ModulesHandle::buildMenu()
|
||||
Void ModulesHandle::buildMenu()
|
||||
{
|
||||
CalypModuleIf* pcCurrModuleIf;
|
||||
QString ModuleIfinternalName;
|
||||
PlaYUVerModuleIf* pcCurrModuleIf;
|
||||
QString ModuleIfInternalName;
|
||||
QAction* currAction;
|
||||
QMenu* currSubMenu;
|
||||
|
||||
for( int i = 0; i < m_arrayModulesActions.size(); i++ )
|
||||
for( Int i = 0; i < m_arrayModulesActions.size(); i++ )
|
||||
{
|
||||
delete m_arrayModulesActions.at( i );
|
||||
}
|
||||
@@ -104,41 +111,35 @@ void ModulesHandle::buildMenu()
|
||||
m_pcModulesMenu->clear();
|
||||
m_pcModulesSubMenuList.clear();
|
||||
|
||||
CalypModulesFactoryMap& moduleFactoryMap = CalypModulesFactory::Get()->getMap();
|
||||
CalypModulesFactoryMap::iterator it = moduleFactoryMap.begin();
|
||||
for( ; it != moduleFactoryMap.end(); ++it )
|
||||
PlaYUVerModuleFactoryMap& PlaYUVerModuleFactoryMap = PlaYUVerModuleFactory::Get()->getMap();
|
||||
PlaYUVerModuleFactoryMap::iterator it = PlaYUVerModuleFactoryMap.begin();
|
||||
for( ; it != PlaYUVerModuleFactoryMap.end(); ++it )
|
||||
{
|
||||
pcCurrModuleIf = it->second();
|
||||
ModuleIfinternalName = QString::fromLocal8Bit( it->first );
|
||||
ModuleIfInternalName = QString::fromLocal8Bit( it->first );
|
||||
|
||||
currSubMenu = NULL;
|
||||
if( pcCurrModuleIf->m_iModuleAPI <= CLP_MODULE_API_2 )
|
||||
if( pcCurrModuleIf->m_pchModuleCategory )
|
||||
{
|
||||
if( pcCurrModuleIf->m_pchModuleCategory )
|
||||
for( Int j = 0; j < m_pcModulesSubMenuList.size(); j++ )
|
||||
{
|
||||
for( int j = 0; j < m_pcModulesSubMenuList.size(); j++ )
|
||||
if( m_pcModulesSubMenuList.at( j )->title() ==
|
||||
QString( pcCurrModuleIf->m_pchModuleCategory ) )
|
||||
{
|
||||
if( m_pcModulesSubMenuList.at( j )->title() == QString( pcCurrModuleIf->m_pchModuleCategory ) )
|
||||
{
|
||||
currSubMenu = m_pcModulesSubMenuList.at( j );
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( !currSubMenu )
|
||||
{
|
||||
currSubMenu = m_pcModulesMenu->addMenu( pcCurrModuleIf->m_pchModuleCategory );
|
||||
m_pcModulesSubMenuList.append( currSubMenu );
|
||||
currSubMenu = m_pcModulesSubMenuList.at( j );
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( !currSubMenu )
|
||||
{
|
||||
currSubMenu = m_pcModulesMenu->addMenu( pcCurrModuleIf->m_pchModuleCategory );
|
||||
m_pcModulesSubMenuList.append( currSubMenu );
|
||||
}
|
||||
}
|
||||
|
||||
currAction = new QAction( pcCurrModuleIf->getModuleLongName(), parent() );
|
||||
QString moduleTooltip = pcCurrModuleIf->m_pchModuleTooltip;
|
||||
if( pcCurrModuleIf->m_uiNumberOfFrames > 1 )
|
||||
moduleTooltip += QString( " | Requires %1 frames" ).arg( pcCurrModuleIf->m_uiNumberOfFrames );
|
||||
|
||||
currAction->setStatusTip( moduleTooltip );
|
||||
currAction->setData( ModuleIfinternalName );
|
||||
currAction = new QAction( pcCurrModuleIf->m_pchModuleName, parent() );
|
||||
currAction->setStatusTip( pcCurrModuleIf->m_pchModuleTooltip );
|
||||
currAction->setData( ModuleIfInternalName );
|
||||
currAction->setCheckable( false );
|
||||
connect( currAction, SIGNAL( triggered() ), this, SLOT( activateModule() ) );
|
||||
m_arrayModulesActions.append( currAction );
|
||||
@@ -160,41 +161,42 @@ void ModulesHandle::buildMenu()
|
||||
m_pcModulesMenu->addAction( m_arrayActions[FORCE_NEW_WINDOW_ACT] );
|
||||
}
|
||||
|
||||
void ModulesHandle::updateMenus()
|
||||
Void ModulesHandle::updateMenus()
|
||||
{
|
||||
VideoSubWindow* pcSubWindow = qobject_cast<VideoSubWindow*>( m_pcMainWindowManager->activeSubWindow() );
|
||||
bool hasSubWindow = pcSubWindow ? true : false;
|
||||
VideoSubWindow* pcSubWindow =
|
||||
qobject_cast<VideoSubWindow*>( m_pcMainWindowManager->activeSubWindow() );
|
||||
Bool hasSubWindow = pcSubWindow ? true : false;
|
||||
QAction* currModuleAction;
|
||||
|
||||
for( int i = 0; i < m_arrayModulesActions.size(); i++ )
|
||||
for( Int i = 0; i < m_arrayModulesActions.size(); i++ )
|
||||
{
|
||||
currModuleAction = m_arrayModulesActions.at( i );
|
||||
//currModuleAction->setEnabled( hasSubWindow );
|
||||
currModuleAction->setEnabled( hasSubWindow );
|
||||
currModuleAction->setChecked( false );
|
||||
}
|
||||
//for( int i = 0; i < m_pcModulesSubMenuList.size(); i++ )
|
||||
//{
|
||||
// m_pcModulesSubMenuList.at( i )->setEnabled( hasSubWindow );
|
||||
//}
|
||||
for( Int i = 0; i < m_pcModulesSubMenuList.size(); i++ )
|
||||
{
|
||||
m_pcModulesSubMenuList.at( i )->setEnabled( hasSubWindow );
|
||||
}
|
||||
|
||||
for( int i = 0; i < m_arrayActions.size(); i++ )
|
||||
for( Int i = 0; i < m_arrayActions.size(); i++ )
|
||||
{
|
||||
m_arrayActions.at( i )->setEnabled( false );
|
||||
}
|
||||
m_arrayActions[LOAD_EXTERNAL_ACT]->setEnabled( true );
|
||||
m_arrayActions[FORCE_NEW_WINDOW_ACT]->setEnabled( hasSubWindow );
|
||||
m_arrayActions[DISABLE_ALL_ACT]->setEnabled( m_pcCalypAppModuleIfList.size() > 0 );
|
||||
m_arrayActions[DISABLE_ALL_ACT]->setEnabled( m_pcPlaYUVerAppModuleIfList.size() > 0 );
|
||||
|
||||
if( pcSubWindow )
|
||||
{
|
||||
QList<CalypAppModuleIf*> apcCurrentModule = pcSubWindow->getModuleArray();
|
||||
QList<PlaYUVerAppModuleIf*> apcCurrentModule = pcSubWindow->getModuleArray();
|
||||
m_arrayActions[DISABLE_ACT]->setEnabled( apcCurrentModule.size() > 0 );
|
||||
if( pcSubWindow->getDisplayModule() )
|
||||
{
|
||||
m_arrayActions[APPLY_ALL_ACT]->setEnabled( true );
|
||||
m_arrayActions[SWAP_FRAMES_ACT]->setEnabled( true );
|
||||
}
|
||||
for( int i = 0; i < apcCurrentModule.size(); i++ )
|
||||
for( Int i = 0; i < apcCurrentModule.size(); i++ )
|
||||
{
|
||||
currModuleAction = apcCurrentModule.at( i )->m_pcModuleAction;
|
||||
currModuleAction->setChecked( true );
|
||||
@@ -202,27 +204,30 @@ void ModulesHandle::updateMenus()
|
||||
}
|
||||
}
|
||||
|
||||
void ModulesHandle::readSettings()
|
||||
Void ModulesHandle::readSettings()
|
||||
{
|
||||
QSettings appSettings;
|
||||
m_arrayActions[FORCE_NEW_WINDOW_ACT]->setChecked( appSettings.value( "ModulesHandle/UseNewWindow", false ).toBool() );
|
||||
m_arrayActions[FORCE_NEW_WINDOW_ACT]->setChecked(
|
||||
appSettings.value( "ModulesHandle/UseNewWindow", false ).toBool() );
|
||||
}
|
||||
|
||||
void ModulesHandle::writeSettings()
|
||||
Void ModulesHandle::writeSettings()
|
||||
{
|
||||
QSettings appSettings;
|
||||
appSettings.setValue( "ModulesHandle/UseNewWindow", m_arrayActions[FORCE_NEW_WINDOW_ACT]->isChecked() );
|
||||
appSettings.setValue( "ModulesHandle/UseNewWindow",
|
||||
m_arrayActions[FORCE_NEW_WINDOW_ACT]->isChecked() );
|
||||
}
|
||||
|
||||
void ModulesHandle::processOpt( int index )
|
||||
Void ModulesHandle::processOpt( Int index )
|
||||
{
|
||||
VideoSubWindow* pcSubWindow = qobject_cast<VideoSubWindow*>( m_pcMainWindowManager->activeSubWindow() );
|
||||
VideoSubWindow* pcSubWindow =
|
||||
qobject_cast<VideoSubWindow*>( m_pcMainWindowManager->activeSubWindow() );
|
||||
if( pcSubWindow )
|
||||
{
|
||||
CalypAppModuleIf* pcCurrentModule = pcSubWindow->getDisplayModule();
|
||||
PlaYUVerAppModuleIf* pcCurrentModule = pcSubWindow->getDisplayModule();
|
||||
if( pcCurrentModule )
|
||||
{
|
||||
CalypAppModuleIf* pcCurrModule = pcCurrentModule;
|
||||
PlaYUVerAppModuleIf* pcCurrModule = pcCurrentModule;
|
||||
switch( index )
|
||||
{
|
||||
case INVALID_OPT:
|
||||
@@ -241,65 +246,70 @@ void ModulesHandle::processOpt( int index )
|
||||
}
|
||||
}
|
||||
|
||||
void ModulesHandle::loadExternalModule()
|
||||
Void ModulesHandle::loadExternalModule()
|
||||
{
|
||||
bool bUpdate = false;
|
||||
Bool bUpdate = false;
|
||||
QString supported = tr( "Supported Files (*.so)" );
|
||||
QStringList formatsList;
|
||||
formatsList << "Shared Libraries (*.so)";
|
||||
QStringList filter;
|
||||
filter << supported << formatsList << tr( "All Files (*)" );
|
||||
QStringList fileNames =
|
||||
QFileDialog::getOpenFileNames( m_pcParent, tr( "Open File" ), QString(), filter.join( ";;" ) );
|
||||
QStringList fileNames = QFileDialog::getOpenFileNames( m_pcParent, tr( "Open File" ), QString(),
|
||||
filter.join( ";;" ) );
|
||||
|
||||
for( int i = 0; i < fileNames.size(); i++ )
|
||||
for( Int i = 0; i < fileNames.size(); i++ )
|
||||
{
|
||||
bUpdate |= CalypModulesFactory::Get()->RegisterDl( fileNames.at( i ).toStdString().data() );
|
||||
bUpdate |= PlaYUVerModuleFactory::Get()->RegisterDl( fileNames.at( i ).toStdString().data() );
|
||||
}
|
||||
if( bUpdate )
|
||||
buildMenu();
|
||||
}
|
||||
|
||||
void ModulesHandle::activateModule()
|
||||
Void ModulesHandle::activateModule()
|
||||
{
|
||||
QAction* pcAction = qobject_cast<QAction*>( sender() );
|
||||
Qt::KeyboardModifiers keyModifiers = QApplication::keyboardModifiers();
|
||||
bool bTmpForceNewWindow = false;
|
||||
Bool bTmpForceNewWindow = false;
|
||||
|
||||
VideoSubWindow* pcVideoSubWindow = qobject_cast<VideoSubWindow*>( m_pcMainWindowManager->activeSubWindow() );
|
||||
VideoSubWindow* pcVideoSubWindow =
|
||||
qobject_cast<VideoSubWindow*>( m_pcMainWindowManager->activeSubWindow() );
|
||||
if( !pcVideoSubWindow )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if( ( keyModifiers & Qt::ControlModifier ) || pcVideoSubWindow->checkCategory( VideoSubWindow::MODULE_SUBWINDOW ) )
|
||||
if( ( keyModifiers & Qt::ControlModifier ) ||
|
||||
pcVideoSubWindow->checkCategory( VideoSubWindow::MODULE_SUBWINDOW ) )
|
||||
{
|
||||
bTmpForceNewWindow = true;
|
||||
}
|
||||
|
||||
QString ModuleIfName = pcAction->data().toString();
|
||||
CalypModuleIf* pcCurrModuleIf =
|
||||
CalypModulesFactory::Get()->CreateModule( ModuleIfName.toLocal8Bit().constData() );
|
||||
CalypAppModuleIf* pcCurrAppModuleIf = new CalypAppModuleIf( this, pcAction, pcCurrModuleIf );
|
||||
PlaYUVerModuleIf* pcCurrModuleIf =
|
||||
PlaYUVerModuleFactory::Get()->CreateModule( ModuleIfName.toLocal8Bit().constData() );
|
||||
PlaYUVerAppModuleIf* pcCurrAppModuleIf =
|
||||
new PlaYUVerAppModuleIf( this, pcAction, pcCurrModuleIf );
|
||||
|
||||
QList<VideoSubWindow*> videoSubWindowList;
|
||||
int numberOfFrames = pcCurrAppModuleIf->m_pcModule->m_uiNumberOfFrames;
|
||||
if( numberOfFrames > 1 ) // Show dialog to select sub windows
|
||||
Int numberOfFrames = pcCurrAppModuleIf->m_pcModule->m_uiNumberOfFrames;
|
||||
if( numberOfFrames > MODULE_REQUIRES_ONE_FRAME ) // Show dialog to select sub windows
|
||||
{
|
||||
int minNumFrames = numberOfFrames;
|
||||
int maxNumFrames = numberOfFrames;
|
||||
if( pcCurrAppModuleIf->m_pcModule->m_uiModuleRequirements & CLP_MODULES_VARIABLE_NUM_FRAMES )
|
||||
Int minNumFrames = numberOfFrames;
|
||||
Int maxNumFrames = numberOfFrames;
|
||||
if( numberOfFrames == MODULE_REQUIRES_SEVERAL_FRAMES )
|
||||
{
|
||||
minNumFrames = numberOfFrames;
|
||||
minNumFrames = 0;
|
||||
maxNumFrames = 255;
|
||||
}
|
||||
SubWindowSelectorDialog dialogWindowsSelection( m_pcParent, m_pcMainWindowManager,
|
||||
SubWindowAbstract::VIDEO_SUBWINDOW, minNumFrames, maxNumFrames );
|
||||
QList<SubWindowAbstract*> windowsList = m_pcMainWindowManager->findSubWindow( SubWindowAbstract::VIDEO_SUBWINDOW );
|
||||
DialogSubWindowSelector dialogWindowsSelection( m_pcParent, m_pcMainWindowManager,
|
||||
SubWindowAbstract::VIDEO_SUBWINDOW,
|
||||
minNumFrames, maxNumFrames );
|
||||
QList<SubWindowAbstract*> windowsList =
|
||||
m_pcMainWindowManager->findSubWindow( SubWindowAbstract::VIDEO_SUBWINDOW );
|
||||
|
||||
if( windowsList.size() == minNumFrames && windowsList.size() == maxNumFrames )
|
||||
{
|
||||
for( int i = 0; i < windowsList.size(); i++ )
|
||||
for( Int i = 0; i < windowsList.size(); i++ )
|
||||
{
|
||||
videoSubWindowList.append( qobject_cast<VideoSubWindow*>( windowsList.at( i ) ) );
|
||||
}
|
||||
@@ -308,7 +318,7 @@ void ModulesHandle::activateModule()
|
||||
{
|
||||
if( windowsList.size() <= minNumFrames )
|
||||
{
|
||||
for( int i = 0; i < windowsList.size(); i++ )
|
||||
for( Int i = 0; i < windowsList.size(); i++ )
|
||||
{
|
||||
dialogWindowsSelection.selectSubWindow( windowsList.at( i ) );
|
||||
}
|
||||
@@ -321,22 +331,24 @@ void ModulesHandle::activateModule()
|
||||
{
|
||||
VideoSubWindow* videoSubWindow;
|
||||
QList<SubWindowAbstract*> subWindowList = dialogWindowsSelection.getSelectedWindows();
|
||||
for( int i = 0; i < subWindowList.size(); i++ )
|
||||
for( Int i = 0; i < subWindowList.size(); i++ )
|
||||
{
|
||||
videoSubWindow = qobject_cast<VideoSubWindow*>( subWindowList.at( i ) );
|
||||
videoSubWindowList.append( videoSubWindow );
|
||||
}
|
||||
}
|
||||
}
|
||||
if( pcCurrAppModuleIf->m_pcModule->m_iModuleAPI == CLP_MODULE_API_1 )
|
||||
if( pcCurrAppModuleIf->m_pcModule->m_iModuleAPI == MODULE_API_1 )
|
||||
{
|
||||
// Check for same fmt in more than one frame modules
|
||||
for( int i = 1; i < videoSubWindowList.size(); i++ )
|
||||
for( Int i = 1; i < videoSubWindowList.size(); i++ )
|
||||
{
|
||||
if( !videoSubWindowList.at( i )->getCurrFrame()->haveSameFmt( videoSubWindowList.at( 0 )->getCurrFrame() ) )
|
||||
if( !videoSubWindowList.at( i )->getCurrFrame()->haveSameFmt(
|
||||
videoSubWindowList.at( 0 )->getCurrFrame() ) )
|
||||
{
|
||||
videoSubWindowList.clear();
|
||||
qobject_cast<MainWindow*>( m_pcParent )->printMessage( "Error! Incompatible frames", CLP_LOG_ERROR );
|
||||
qobject_cast<PlaYUVerApp*>( m_pcParent )
|
||||
->printMessage( "Error! Incompatible frames", LOG_ERROR );
|
||||
destroyModuleIf( pcCurrAppModuleIf );
|
||||
return;
|
||||
}
|
||||
@@ -350,50 +362,55 @@ void ModulesHandle::activateModule()
|
||||
|
||||
if( videoSubWindowList.size() == 0 )
|
||||
{
|
||||
qobject_cast<MainWindow*>( m_pcParent )
|
||||
->printMessage( "Error! There is no windows to apply the module", CLP_LOG_ERROR );
|
||||
qobject_cast<PlaYUVerApp*>( m_pcParent )
|
||||
->printMessage( "Error! There is no windows to apply the module", LOG_ERROR );
|
||||
destroyModuleIf( pcCurrAppModuleIf );
|
||||
return;
|
||||
}
|
||||
|
||||
for( int i = 0; i < videoSubWindowList.size(); i++ )
|
||||
for( Int i = 0; i < videoSubWindowList.size(); i++ )
|
||||
{
|
||||
pcCurrAppModuleIf->m_pcSubWindow[i] = videoSubWindowList.at( i );
|
||||
}
|
||||
|
||||
if( pcCurrAppModuleIf->m_pcModule->m_uiModuleRequirements & CLP_MODULE_REQUIRES_OPTIONS )
|
||||
if( pcCurrAppModuleIf->m_pcModule->m_uiModuleRequirements & MODULE_REQUIRES_OPTIONS )
|
||||
{
|
||||
ModulesHandleOptDialog moduleOptDialog( m_pcParent, pcCurrAppModuleIf );
|
||||
if( moduleOptDialog.runConfiguration() == QDialog::Rejected )
|
||||
{
|
||||
qobject_cast<MainWindow*>( m_pcParent )->printMessage( "Module canceled by user!", CLP_LOG_WARNINGS );
|
||||
qobject_cast<PlaYUVerApp*>( m_pcParent )
|
||||
->printMessage( "Module canceled by user!", LOG_WARNINGS );
|
||||
destroyModuleIf( pcCurrAppModuleIf );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
bool bShowModulesNewWindow = m_arrayActions[FORCE_NEW_WINDOW_ACT]->isChecked() | bTmpForceNewWindow;
|
||||
Bool bShowModulesNewWindow =
|
||||
m_arrayActions[FORCE_NEW_WINDOW_ACT]->isChecked() | bTmpForceNewWindow;
|
||||
|
||||
QString windowName;
|
||||
|
||||
VideoSubWindow* pcModuleSubWindow = NULL;
|
||||
if( pcCurrAppModuleIf->m_pcModule->m_iModuleType == CLP_FRAME_PROCESSING_MODULE )
|
||||
if( pcCurrAppModuleIf->m_pcModule->m_iModuleType == FRAME_PROCESSING_MODULE )
|
||||
{
|
||||
if( ( pcCurrAppModuleIf->m_pcModule->m_uiModuleRequirements & CLP_MODULE_REQUIRES_NEW_WINDOW ) || bShowModulesNewWindow )
|
||||
if( ( pcCurrAppModuleIf->m_pcModule->m_uiModuleRequirements & MODULE_REQUIRES_NEW_WINDOW ) ||
|
||||
bShowModulesNewWindow )
|
||||
{
|
||||
pcModuleSubWindow = new VideoSubWindow( VideoSubWindow::MODULE_SUBWINDOW );
|
||||
windowName.append( QStringLiteral( "Module " ) );
|
||||
windowName.append( pcCurrAppModuleIf->m_pcModule->m_pchModuleLongName );
|
||||
windowName.append( pcCurrAppModuleIf->m_pcModule->m_pchModuleName );
|
||||
|
||||
connect( pcModuleSubWindow->getViewArea(), SIGNAL( selectionChanged( QRect ) ),
|
||||
m_appModuleVideo, SLOT( updateSelectionArea( QRect ) ) );
|
||||
connect( pcModuleSubWindow, SIGNAL( zoomFactorChanged_SWindow( const double, const QPoint ) ),
|
||||
m_appModuleVideo, SLOT( zoomToFactorAll( double, QPoint ) ) );
|
||||
connect( pcModuleSubWindow, SIGNAL( scrollBarMoved_SWindow( const QPoint ) ),
|
||||
m_appModuleVideo, SLOT( moveAllScrollBars( const QPoint ) ) );
|
||||
|
||||
pcCurrAppModuleIf->m_pcDisplaySubWindow = pcModuleSubWindow;
|
||||
// connect( pcModuleSubWindow->getViewArea(), SIGNAL( selectionChanged( QRect ) ), m_appModuleVideo,
|
||||
// SLOT( updateSelectionArea( QRect ) ) );
|
||||
// connect( pcModuleSubWindow, SIGNAL( zoomFactorChanged_SWindow( const double, const QPoint ) ), m_appModuleVideo,
|
||||
// SLOT( zoomToFactorAll( double, QPoint ) ) );
|
||||
// connect( pcModuleSubWindow, SIGNAL( scrollBarMoved_SWindow( const QPoint ) ), m_appModuleVideo,
|
||||
// SLOT( moveAllScrollBars( const QPoint ) ) );
|
||||
}
|
||||
}
|
||||
else if( pcCurrAppModuleIf->m_pcModule->m_iModuleType == CLP_FRAME_MEASUREMENT_MODULE )
|
||||
else if( pcCurrAppModuleIf->m_pcModule->m_iModuleType == FRAME_MEASUREMENT_MODULE )
|
||||
{
|
||||
pcCurrAppModuleIf->m_pcDisplaySubWindow = NULL;
|
||||
pcCurrAppModuleIf->m_pcModuleDock = new ModuleHandleDock( m_pcParent, pcCurrAppModuleIf );
|
||||
@@ -401,8 +418,10 @@ void ModulesHandle::activateModule()
|
||||
titleDockWidget.append( pcCurrAppModuleIf->m_pcModule->m_pchModuleName );
|
||||
titleDockWidget.append( " Information" );
|
||||
pcCurrAppModuleIf->m_pcDockWidget = new QDockWidget( titleDockWidget, m_pcParent );
|
||||
pcCurrAppModuleIf->m_pcDockWidget->setFeatures( QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable );
|
||||
pcCurrAppModuleIf->m_pcDockWidget->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea );
|
||||
pcCurrAppModuleIf->m_pcDockWidget->setFeatures( QDockWidget::DockWidgetMovable |
|
||||
QDockWidget::DockWidgetFloatable );
|
||||
pcCurrAppModuleIf->m_pcDockWidget->setAllowedAreas( Qt::LeftDockWidgetArea |
|
||||
Qt::RightDockWidgetArea );
|
||||
pcCurrAppModuleIf->m_pcDockWidget->setWidget( pcCurrAppModuleIf->m_pcModuleDock );
|
||||
qobject_cast<QMainWindow*>( m_pcParent )
|
||||
->addDockWidget( Qt::RightDockWidgetArea, pcCurrAppModuleIf->m_pcDockWidget );
|
||||
@@ -417,24 +436,24 @@ void ModulesHandle::activateModule()
|
||||
{
|
||||
if( pcCurrAppModuleIf->m_pcDisplaySubWindow )
|
||||
pcCurrAppModuleIf->m_pcDisplaySubWindow->enableModule( pcCurrAppModuleIf );
|
||||
for( int i = 0; i < videoSubWindowList.size(); i++ )
|
||||
for( Int i = 0; i < videoSubWindowList.size(); i++ )
|
||||
{
|
||||
pcCurrAppModuleIf->m_pcSubWindow[i]->associateModule( pcCurrAppModuleIf );
|
||||
}
|
||||
}
|
||||
|
||||
// Create Module
|
||||
bool moduleCreated = false;
|
||||
if( pcCurrAppModuleIf->m_pcModule->m_iModuleAPI >= CLP_MODULE_API_2 )
|
||||
Bool moduleCreated = false;
|
||||
if( pcCurrAppModuleIf->m_pcModule->m_iModuleAPI == MODULE_API_2 )
|
||||
{
|
||||
std::vector<CalypFrame*> apcFrameList;
|
||||
for( int i = 0; i < videoSubWindowList.size(); i++ )
|
||||
std::vector<PlaYUVerFrame*> apcFrameList;
|
||||
for( Int i = 0; i < videoSubWindowList.size(); i++ )
|
||||
{
|
||||
apcFrameList.push_back( pcCurrAppModuleIf->m_pcSubWindow[i]->getCurrFrame() );
|
||||
}
|
||||
moduleCreated = pcCurrAppModuleIf->m_pcModule->create( apcFrameList );
|
||||
}
|
||||
else if( pcCurrAppModuleIf->m_pcModule->m_iModuleAPI == CLP_MODULE_API_1 )
|
||||
else if( pcCurrAppModuleIf->m_pcModule->m_iModuleAPI == MODULE_API_1 )
|
||||
{
|
||||
pcCurrAppModuleIf->m_pcModule->create( pcCurrAppModuleIf->m_pcSubWindow[0]->getCurrFrame() );
|
||||
moduleCreated = true;
|
||||
@@ -442,7 +461,8 @@ void ModulesHandle::activateModule()
|
||||
|
||||
if( !moduleCreated )
|
||||
{
|
||||
qobject_cast<MainWindow*>( m_pcParent )->printMessage( "Error! Module cannot be created", CLP_LOG_ERROR );
|
||||
qobject_cast<PlaYUVerApp*>( m_pcParent )
|
||||
->printMessage( "Error! Module cannot be created", LOG_ERROR );
|
||||
destroyModuleIf( pcCurrAppModuleIf );
|
||||
return;
|
||||
}
|
||||
@@ -455,7 +475,6 @@ void ModulesHandle::activateModule()
|
||||
pcModuleSubWindow->setWindowName( windowName );
|
||||
m_pcMainWindowManager->addSubWindow( pcModuleSubWindow );
|
||||
pcModuleSubWindow->show();
|
||||
m_appModuleVideo->addSubWindow( pcModuleSubWindow );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -465,12 +484,12 @@ void ModulesHandle::activateModule()
|
||||
videoSubWindowList.at( 0 )->setWindowName( windowName );
|
||||
}
|
||||
|
||||
m_pcCalypAppModuleIfList.append( pcCurrAppModuleIf );
|
||||
m_pcPlaYUVerAppModuleIfList.append( pcCurrAppModuleIf );
|
||||
|
||||
emit changed();
|
||||
}
|
||||
|
||||
void ModulesHandle::destroyModuleIf( CalypAppModuleIf* pcCurrModuleIf )
|
||||
Void ModulesHandle::destroyModuleIf( PlaYUVerAppModuleIf* pcCurrModuleIf )
|
||||
{
|
||||
if( pcCurrModuleIf )
|
||||
{
|
||||
@@ -478,9 +497,10 @@ void ModulesHandle::destroyModuleIf( CalypAppModuleIf* pcCurrModuleIf )
|
||||
}
|
||||
}
|
||||
|
||||
void ModulesHandle::destroyWindowModules()
|
||||
Void ModulesHandle::destroyWindowModules()
|
||||
{
|
||||
VideoSubWindow* pcVideoSubWindow = qobject_cast<VideoSubWindow*>( m_pcMainWindowManager->activeSubWindow() );
|
||||
VideoSubWindow* pcVideoSubWindow =
|
||||
qobject_cast<VideoSubWindow*>( m_pcMainWindowManager->activeSubWindow() );
|
||||
if( pcVideoSubWindow )
|
||||
{
|
||||
pcVideoSubWindow->disableModule();
|
||||
@@ -488,73 +508,67 @@ void ModulesHandle::destroyWindowModules()
|
||||
}
|
||||
}
|
||||
|
||||
void ModulesHandle::destroyAllModulesIf()
|
||||
Void ModulesHandle::destroyAllModulesIf()
|
||||
{
|
||||
for( int i = 0; i < m_pcCalypAppModuleIfList.size(); i++ )
|
||||
for( Int i = 0; i < m_pcPlaYUVerAppModuleIfList.size(); i++ )
|
||||
{
|
||||
destroyModuleIf( m_pcCalypAppModuleIfList.at( i ) );
|
||||
destroyModuleIf( m_pcPlaYUVerAppModuleIfList.at( i ) );
|
||||
}
|
||||
emit changed();
|
||||
}
|
||||
|
||||
void ModulesHandle::applyModuleIf( QList<CalypAppModuleIf*> pcCurrModuleIfList, bool isPlaying, bool disableThreads )
|
||||
Void ModulesHandle::applyModuleIf( QList<PlaYUVerAppModuleIf*> pcCurrModuleIfList,
|
||||
Bool isPlaying,
|
||||
Bool disableThreads )
|
||||
{
|
||||
for( int i = 0; i < pcCurrModuleIfList.size() && !isPlaying; i++ )
|
||||
for( Int i = 0; i < pcCurrModuleIfList.size() && !isPlaying; i++ )
|
||||
{
|
||||
pcCurrModuleIfList.at( i )->apply( isPlaying, disableThreads );
|
||||
}
|
||||
}
|
||||
|
||||
void ModulesHandle::applyAllModuleIf( CalypAppModuleIf* pcCurrModuleIf )
|
||||
Void ModulesHandle::applyAllModuleIf( PlaYUVerAppModuleIf* pcCurrModuleIf )
|
||||
{
|
||||
if( pcCurrModuleIf )
|
||||
{
|
||||
if( !pcCurrModuleIf->m_pcModuleStream )
|
||||
{
|
||||
unsigned int Width = 0, Height = 0, FrameRate = 30;
|
||||
int BitsPixel, InputFormat = -1;
|
||||
UInt Width = 0, Height = 0, FrameRate = 30;
|
||||
Int BitsPixel, InputFormat = -1;
|
||||
|
||||
QString supported = tr( "Supported Files (" );
|
||||
QStringList formatsList;
|
||||
std::vector<CalypStreamFormat> supportedFmts = CalypStream::supportedWriteFormats();
|
||||
|
||||
for( unsigned int i = 0; i < supportedFmts.size(); i++ )
|
||||
std::vector<PlaYUVerSupportedFormat> supportedFmts = PlaYUVerStream::supportedWriteFormats();
|
||||
for( UInt i = 0; i < supportedFmts.size(); i++ )
|
||||
{
|
||||
std::vector<ClpString> arrayExt = supportedFmts[i].getExts();
|
||||
if( arrayExt.size() > 0 )
|
||||
{
|
||||
QString currFmt( QString::fromStdString( supportedFmts[i].formatName ) );
|
||||
currFmt.append( " (" );
|
||||
for( std::vector<ClpString>::iterator e = arrayExt.begin(); e != arrayExt.end(); ++e )
|
||||
{
|
||||
supported.append( " *." );
|
||||
currFmt.append( "*." );
|
||||
supported.append( QString::fromStdString( *e ) );
|
||||
currFmt.append( QString::fromStdString( *e ) );
|
||||
}
|
||||
currFmt.append( ")" );
|
||||
formatsList << currFmt;
|
||||
}
|
||||
QString currFmt;
|
||||
supported.append( " *." );
|
||||
supported.append( QString::fromStdString( supportedFmts[i].formatExt ) );
|
||||
currFmt.append( QString::fromStdString( supportedFmts[i].formatName ) );
|
||||
currFmt.append( " (*." );
|
||||
currFmt.append( QString::fromStdString( supportedFmts[i].formatExt ) );
|
||||
currFmt.append( ")" );
|
||||
formatsList << currFmt;
|
||||
}
|
||||
supported.append( " )" );
|
||||
|
||||
QStringList filter;
|
||||
filter << supported << formatsList << tr( "All Files (*)" );
|
||||
|
||||
QString fileName = QFileDialog::getSaveFileName( m_pcParent, tr( "Open File" ), QString(), filter.join( ";;" ) );
|
||||
if( fileName.isEmpty() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
QString fileName = QFileDialog::getSaveFileName( m_pcParent, tr( "Open File" ), QString(),
|
||||
filter.join( ";;" ) );
|
||||
|
||||
Width = pcCurrModuleIf->m_pcProcessedFrame->getWidth();
|
||||
Height = pcCurrModuleIf->m_pcProcessedFrame->getHeight();
|
||||
InputFormat = pcCurrModuleIf->m_pcProcessedFrame->getPelFormat();
|
||||
BitsPixel = pcCurrModuleIf->m_pcProcessedFrame->getBitsPel();
|
||||
FrameRate = pcCurrModuleIf->m_pcSubWindow[0]->getInputStream()->getFrameRate();
|
||||
|
||||
pcCurrModuleIf->m_pcModuleStream = new CalypStream;
|
||||
if( !pcCurrModuleIf->m_pcModuleStream->open( fileName.toStdString(), Width, Height, InputFormat, BitsPixel,
|
||||
CLP_LITTLE_ENDIAN, FrameRate, false ) )
|
||||
pcCurrModuleIf->m_pcModuleStream = new PlaYUVerStream;
|
||||
if( !pcCurrModuleIf->m_pcModuleStream->open( fileName.toStdString(), Width, Height,
|
||||
InputFormat, BitsPixel, PLAYUVER_LITTLE_ENDIAN,
|
||||
FrameRate, false ) )
|
||||
{
|
||||
delete pcCurrModuleIf->m_pcModuleStream;
|
||||
pcCurrModuleIf->m_pcModuleStream = NULL;
|
||||
@@ -564,10 +578,10 @@ void ModulesHandle::applyAllModuleIf( CalypAppModuleIf* pcCurrModuleIf )
|
||||
}
|
||||
if( pcCurrModuleIf->m_pcModuleStream )
|
||||
{
|
||||
unsigned int numberOfWindows = pcCurrModuleIf->m_pcModule->m_uiNumberOfFrames;
|
||||
ClpULong currFrames = 0;
|
||||
ClpULong numberOfFrames = -1;
|
||||
for( unsigned int i = 0; i < numberOfWindows; i++ )
|
||||
UInt numberOfWindows = pcCurrModuleIf->m_pcModule->m_uiNumberOfFrames;
|
||||
UInt64 currFrames = 0;
|
||||
UInt64 numberOfFrames = INT_MAX;
|
||||
for( UInt i = 0; i < numberOfWindows; i++ )
|
||||
{
|
||||
currFrames = pcCurrModuleIf->m_pcSubWindow[i]->getInputStream()->getFrameNum();
|
||||
if( currFrames < numberOfFrames )
|
||||
@@ -575,18 +589,18 @@ void ModulesHandle::applyAllModuleIf( CalypAppModuleIf* pcCurrModuleIf )
|
||||
pcCurrModuleIf->m_pcSubWindow[i]->stop();
|
||||
}
|
||||
QApplication::setOverrideCursor( Qt::WaitCursor );
|
||||
for( unsigned int f = 1; f < numberOfFrames; f++ )
|
||||
for( UInt f = 1; f < numberOfFrames; f++ )
|
||||
{
|
||||
pcCurrModuleIf->apply( false, true );
|
||||
QCoreApplication::processEvents();
|
||||
pcCurrModuleIf->m_pcModuleStream->writeFrame( pcCurrModuleIf->m_pcProcessedFrame );
|
||||
for( unsigned int i = 0; i < numberOfWindows; i++ )
|
||||
for( UInt i = 0; i < numberOfWindows; i++ )
|
||||
{
|
||||
pcCurrModuleIf->m_pcSubWindow[i]->play();
|
||||
pcCurrModuleIf->m_pcSubWindow[i]->playEvent();
|
||||
}
|
||||
}
|
||||
for( unsigned int i = 0; i < numberOfWindows; i++ )
|
||||
for( UInt i = 0; i < numberOfWindows; i++ )
|
||||
{
|
||||
pcCurrModuleIf->m_pcSubWindow[i]->stop();
|
||||
}
|
||||
@@ -594,25 +608,24 @@ void ModulesHandle::applyAllModuleIf( CalypAppModuleIf* pcCurrModuleIf )
|
||||
}
|
||||
}
|
||||
|
||||
void ModulesHandle::swapModulesWindowsIf( CalypAppModuleIf* pcCurrModuleIf )
|
||||
Void ModulesHandle::swapModulesWindowsIf( PlaYUVerAppModuleIf* pcCurrModuleIf )
|
||||
{
|
||||
if( pcCurrModuleIf->m_pcModule->m_uiNumberOfFrames == 2 )
|
||||
if( pcCurrModuleIf->m_pcModule->m_uiNumberOfFrames == MODULE_REQUIRES_TWO_FRAMES )
|
||||
{
|
||||
VideoSubWindow* auxWindowHandle = pcCurrModuleIf->m_pcSubWindow[0];
|
||||
pcCurrModuleIf->m_pcSubWindow[0] = pcCurrModuleIf->m_pcSubWindow[1];
|
||||
pcCurrModuleIf->m_pcSubWindow[1] = auxWindowHandle;
|
||||
pcCurrModuleIf->m_pcDisplaySubWindow->updateVideoWindowInfo();
|
||||
pcCurrModuleIf->apply();
|
||||
}
|
||||
}
|
||||
|
||||
void ModulesHandle::customEvent( QEvent* event )
|
||||
Void ModulesHandle::customEvent( QEvent* event )
|
||||
{
|
||||
if( !event )
|
||||
{
|
||||
return;
|
||||
}
|
||||
CalypAppModuleIf::EventData* eventData = (CalypAppModuleIf::EventData*)event;
|
||||
PlaYUVerAppModuleIf::EventData* eventData = (PlaYUVerAppModuleIf::EventData*)event;
|
||||
if( eventData->m_bSuccess )
|
||||
{
|
||||
eventData->m_pcModule->show();
|
||||
|
||||
+29
-24
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
/**
|
||||
* \file ModulesHandle.h
|
||||
* \brief Calyp modules handle
|
||||
* \brief PlaYUVer modules handle
|
||||
*/
|
||||
|
||||
#ifndef __MODULESHANDLE_H__
|
||||
@@ -30,39 +30,44 @@
|
||||
#include <iostream>
|
||||
|
||||
#include <QtCore>
|
||||
#if( QT_VERSION_PLAYUVER == 5 )
|
||||
#include <QtWidgets>
|
||||
#include "CalypAppModuleIf.h"
|
||||
#include "CommonDefs.h"
|
||||
#include "lib/CalypFrame.h"
|
||||
#elif( QT_VERSION_PLAYUVER == 4 )
|
||||
#include <QtGui>
|
||||
#endif
|
||||
#include "PlaYUVerAppDefs.h"
|
||||
#include "PlaYUVerAppModuleIf.h"
|
||||
#include "lib/PlaYUVerFrame.h"
|
||||
|
||||
class VideoHandle;
|
||||
class SubWindowHandle;
|
||||
class CalypAppModuleIf;
|
||||
class PlaYUVerSubWindowHandle;
|
||||
class PlaYUVerAppModuleIf;
|
||||
class SubWindowHandle;
|
||||
|
||||
class ModulesHandle : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ModulesHandle( QWidget*, SubWindowHandle*, VideoHandle* );
|
||||
ModulesHandle( QWidget*, PlaYUVerSubWindowHandle*, VideoHandle* );
|
||||
~ModulesHandle();
|
||||
|
||||
void createActions();
|
||||
Void createActions();
|
||||
QMenu* createMenu();
|
||||
// QDockWidget* createDock();
|
||||
void buildMenu();
|
||||
void updateMenus();
|
||||
Void buildMenu();
|
||||
Void updateMenus();
|
||||
|
||||
void readSettings();
|
||||
void writeSettings();
|
||||
Void readSettings();
|
||||
Void writeSettings();
|
||||
|
||||
static void destroyModuleIf( CalypAppModuleIf* pcCurrModuleIf );
|
||||
static void applyModuleIf( QList<CalypAppModuleIf*> pcCurrModuleIfList, bool isPlaying = false,
|
||||
bool disableThreads = false );
|
||||
static Void destroyModuleIf( PlaYUVerAppModuleIf* pcCurrModuleIf );
|
||||
static Void applyModuleIf( QList<PlaYUVerAppModuleIf*> pcCurrModuleIfList,
|
||||
Bool isPlaying = false,
|
||||
Bool disableThreads = false );
|
||||
|
||||
private:
|
||||
QWidget* m_pcParent;
|
||||
SubWindowHandle* m_pcMainWindowManager;
|
||||
PlaYUVerSubWindowHandle* m_pcMainWindowManager;
|
||||
VideoHandle* m_appModuleVideo;
|
||||
|
||||
enum
|
||||
@@ -74,7 +79,7 @@ private:
|
||||
|
||||
QMenu* m_pcModulesMenu;
|
||||
QList<QMenu*> m_pcModulesSubMenuList;
|
||||
QList<CalypAppModuleIf*> m_pcCalypAppModuleIfList;
|
||||
QList<PlaYUVerAppModuleIf*> m_pcPlaYUVerAppModuleIfList;
|
||||
|
||||
QVector<QAction*> m_arrayModulesActions;
|
||||
|
||||
@@ -92,11 +97,11 @@ private:
|
||||
QVector<QAction*> m_arrayActions;
|
||||
QSignalMapper* m_pcActionMapper;
|
||||
|
||||
void enableModuleIf( CalypAppModuleIf* pcCurrModuleIf );
|
||||
void applyAllModuleIf( CalypAppModuleIf* pcCurrModuleIf );
|
||||
void swapModulesWindowsIf( CalypAppModuleIf* pcCurrModuleIf );
|
||||
Void enableModuleIf( PlaYUVerAppModuleIf* pcCurrModuleIf );
|
||||
Void applyAllModuleIf( PlaYUVerAppModuleIf* pcCurrModuleIf );
|
||||
Void swapModulesWindowsIf( PlaYUVerAppModuleIf* pcCurrModuleIf );
|
||||
|
||||
void customEvent( QEvent* event );
|
||||
Void customEvent( QEvent* event );
|
||||
|
||||
Q_SIGNALS:
|
||||
void changed();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -24,17 +24,13 @@
|
||||
|
||||
#include "ModulesHandleOptDialog.h"
|
||||
|
||||
#include "lib/CalypOptions.h"
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QVBoxLayout>
|
||||
#include <QVector>
|
||||
#include <QWidget>
|
||||
|
||||
class QLineEdit;
|
||||
#include "lib/PlaYUVerOptions.h"
|
||||
|
||||
class OpionConfiguration : public QWidget
|
||||
{
|
||||
@@ -44,8 +40,7 @@ public:
|
||||
m_pcChecked = NULL;
|
||||
m_cName = option->opt_string;
|
||||
m_pcDescription = new QLabel;
|
||||
QString desc = QString::fromStdString( option->opt_desc );
|
||||
m_pcDescription->setText( desc );
|
||||
m_pcDescription->setText( QString::fromStdString( option->opt_desc ) );
|
||||
QHBoxLayout* layout = new QHBoxLayout;
|
||||
layout->addWidget( m_pcDescription, 0, Qt::AlignLeft );
|
||||
if( !option->isBinary() )
|
||||
@@ -72,26 +67,29 @@ public:
|
||||
}
|
||||
return m_pcValue->text();
|
||||
}
|
||||
const ClpString& getName() { return m_cName; }
|
||||
const String& getName() { return m_cName; }
|
||||
|
||||
private:
|
||||
QLineEdit* m_pcValue;
|
||||
QCheckBox* m_pcChecked;
|
||||
QLabel* m_pcDescription;
|
||||
ClpString m_cName;
|
||||
String m_cName;
|
||||
};
|
||||
|
||||
ModulesHandleOptDialog::ModulesHandleOptDialog( QWidget* parent, CalypAppModuleIf* pcCurrModuleIf )
|
||||
ModulesHandleOptDialog::ModulesHandleOptDialog( QWidget* parent,
|
||||
PlaYUVerAppModuleIf* pcCurrModuleIf )
|
||||
: QDialog( parent ), m_pcCurrModuleIf( pcCurrModuleIf )
|
||||
{
|
||||
resize( 400, 10 );
|
||||
setWindowTitle( "Select module parameters" );
|
||||
|
||||
const CalypOptions::OptionsList& moduleOptions = m_pcCurrModuleIf->m_pcModule->m_cModuleOptions.getOptionList();
|
||||
const PlaYUVerOptions::OptionsList& moduleOptions =
|
||||
m_pcCurrModuleIf->m_pcModule->m_cModuleOptions.getOptionList();
|
||||
|
||||
QVBoxLayout* optionsLayout = new QVBoxLayout;
|
||||
OpionConfiguration* pcOption;
|
||||
for( CalypOptions::OptionsList::const_iterator it = moduleOptions.begin(); it != moduleOptions.end(); ++it )
|
||||
for( PlaYUVerOptions::OptionsList::const_iterator it = moduleOptions.begin();
|
||||
it != moduleOptions.end(); ++it )
|
||||
{
|
||||
pcOption = new OpionConfiguration( ( *it )->opt );
|
||||
m_apcOptionList.append( pcOption );
|
||||
@@ -114,18 +112,18 @@ ModulesHandleOptDialog::ModulesHandleOptDialog( QWidget* parent, CalypAppModuleI
|
||||
connect( dialogButtonOkCancel, SIGNAL( rejected() ), this, SLOT( reject() ) );
|
||||
}
|
||||
|
||||
int ModulesHandleOptDialog::runConfiguration()
|
||||
Int ModulesHandleOptDialog::runConfiguration()
|
||||
{
|
||||
if( exec() == QDialog::Rejected )
|
||||
{
|
||||
return QDialog::Rejected;
|
||||
}
|
||||
|
||||
std::vector<ClpString> argsArray;
|
||||
ClpString optionString;
|
||||
std::vector<String> argsArray;
|
||||
String optionString;
|
||||
QString valueString( "" );
|
||||
|
||||
for( int i = 0; i < m_apcOptionList.size(); i++ )
|
||||
for( Int i = 0; i < m_apcOptionList.size(); i++ )
|
||||
{
|
||||
valueString = m_apcOptionList.at( i )->getValue();
|
||||
if( !valueString.isEmpty() )
|
||||
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -25,10 +25,9 @@
|
||||
#ifndef __MODULEHANDLEOPTDIALOG_H__
|
||||
#define __MODULEHANDLEOPTDIALOG_H__
|
||||
|
||||
#include "CalypAppModuleIf.h"
|
||||
#include "CommonDefs.h"
|
||||
#include "PlaYUVerAppDefs.h"
|
||||
#include "PlaYUVerAppModuleIf.h"
|
||||
#include "config.h"
|
||||
|
||||
#include <QDialog>
|
||||
#include <QVector>
|
||||
|
||||
@@ -42,11 +41,11 @@ class ModulesHandleOptDialog : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ModulesHandleOptDialog( QWidget* parent, CalypAppModuleIf* pcCurrModuleIf );
|
||||
int runConfiguration();
|
||||
ModulesHandleOptDialog( QWidget* parent, PlaYUVerAppModuleIf* pcCurrModuleIf );
|
||||
Int runConfiguration();
|
||||
|
||||
private:
|
||||
CalypAppModuleIf* m_pcCurrModuleIf;
|
||||
PlaYUVerAppModuleIf* m_pcCurrModuleIf;
|
||||
QVector<OpionConfiguration*> m_apcOptionList;
|
||||
};
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Santos (joaompssantos@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -19,22 +18,11 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file MainWindow.cpp
|
||||
* \brief Definition of the main window
|
||||
* \file PlaYUVerApp.cpp
|
||||
* \brief Main definition of the PlaYUVerApp app
|
||||
*/
|
||||
|
||||
#include "MainWindow.h"
|
||||
|
||||
#include "AboutDialog.h"
|
||||
#include "ModulesHandle.h"
|
||||
#include "QualityHandle.h"
|
||||
#include "SubWindowAbstract.h"
|
||||
#include "SubWindowHandle.h"
|
||||
#include "SubWindowSelectorDialog.h"
|
||||
#include "VideoHandle.h"
|
||||
#include "VideoSubWindow.h"
|
||||
#include "lib/CalypOptions.h"
|
||||
|
||||
#include "PlaYUVerApp.h"
|
||||
#include <QAction>
|
||||
#include <QActionGroup>
|
||||
#include <QCloseEvent>
|
||||
@@ -46,19 +34,30 @@
|
||||
#ifdef USE_FERVOR
|
||||
#include "fvupdater.h"
|
||||
#endif
|
||||
#include "AboutDialog.h"
|
||||
#include "DialogSubWindowSelector.h"
|
||||
#include "ModulesHandle.h"
|
||||
#include "PlaYUVerSubWindowHandle.h"
|
||||
#include "QualityHandle.h"
|
||||
#include "SubWindowAbstract.h"
|
||||
#include "VideoHandle.h"
|
||||
#include "VideoSubWindow.h"
|
||||
#include "lib/PlaYUVerOptions.h"
|
||||
|
||||
MainWindow::MainWindow()
|
||||
#define SYNCHRONISED_ZOON 1
|
||||
|
||||
PlaYUVerApp::PlaYUVerApp()
|
||||
: m_pcCurrentSubWindow( NULL ), m_pcCurrentVideoSubWindow( NULL ), m_pcAboutDialog( NULL )
|
||||
{
|
||||
setWindowModality( Qt::ApplicationModal );
|
||||
setWindowModality( Qt::NonModal );
|
||||
|
||||
// DBus
|
||||
// DBus
|
||||
#ifdef USE_QTDBUS
|
||||
m_pDBusAdaptor = new DBusAppAdaptor( this );
|
||||
m_pDBusAdaptor = new PlaYUVerAppAdaptor( this );
|
||||
#endif
|
||||
|
||||
m_pcWindowHandle = new SubWindowHandle( this );
|
||||
m_pcWindowHandle = new PlaYUVerSubWindowHandle( this );
|
||||
|
||||
m_appModuleVideo = new VideoHandle( this, m_pcWindowHandle );
|
||||
m_appModuleQuality = new QualityHandle( this, m_pcWindowHandle );
|
||||
@@ -74,7 +73,7 @@ MainWindow::MainWindow()
|
||||
readSettings();
|
||||
|
||||
setWindowTitle( QApplication::applicationName() );
|
||||
setWindowIcon( QIcon( ":logos/calyp-icon.png" ) );
|
||||
setWindowIcon( QIcon( ":/images/playuver.png" ) );
|
||||
setUnifiedTitleAndToolBarOnMac( true );
|
||||
setCentralWidget( m_pcWindowHandle );
|
||||
setAcceptDrops( true );
|
||||
@@ -87,14 +86,14 @@ MainWindow::MainWindow()
|
||||
connect( m_appModuleExtensions, SIGNAL( changed() ), this, SLOT( update() ) );
|
||||
}
|
||||
|
||||
bool MainWindow::parseArgs( int argc, char* argv[] )
|
||||
Bool PlaYUVerApp::parseArgs( Int argc, Char* argv[] )
|
||||
{
|
||||
bool bRet = false;
|
||||
CalypOptions pcCmdParser;
|
||||
Bool bRet = false;
|
||||
PlaYUVerOptions pcCmdParser;
|
||||
|
||||
std::vector<ClpString> m_apcInputs;
|
||||
ClpString strResolution( "" );
|
||||
ClpString strPelFmt( "" );
|
||||
std::vector<String> m_apcInputs;
|
||||
String strResolution( "" );
|
||||
String strPelFmt( "" );
|
||||
|
||||
pcCmdParser.addOptions() /**/
|
||||
( "input,i", m_apcInputs, "input file" ) /**/
|
||||
@@ -114,13 +113,14 @@ bool MainWindow::parseArgs( int argc, char* argv[] )
|
||||
}
|
||||
if( pcCmdParser.hasOpt( "input" ) )
|
||||
{
|
||||
for( unsigned int i = 1; i < m_apcInputs.size(); i++ )
|
||||
for( UInt i = 1; i < m_apcInputs.size(); i++ )
|
||||
{
|
||||
loadFile( QString::fromStdString( m_apcInputs[i] ) );
|
||||
}
|
||||
}
|
||||
std::list<const char*>& argv_unhandled = pcCmdParser.getUnhandledArgs();
|
||||
for( std::list<const char*>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++ )
|
||||
std::list<const Char*>& argv_unhandled = pcCmdParser.getUnhandledArgs();
|
||||
for( std::list<const Char*>::const_iterator it = argv_unhandled.begin();
|
||||
it != argv_unhandled.end(); it++ )
|
||||
{
|
||||
loadFile( QString::fromStdString( *it ) );
|
||||
}
|
||||
@@ -129,22 +129,22 @@ bool MainWindow::parseArgs( int argc, char* argv[] )
|
||||
return bRet;
|
||||
}
|
||||
|
||||
void MainWindow::about()
|
||||
Void PlaYUVerApp::about()
|
||||
{
|
||||
if( !m_pcAboutDialog )
|
||||
m_pcAboutDialog = new AboutDialog( this );
|
||||
m_pcAboutDialog->exec();
|
||||
}
|
||||
|
||||
void MainWindow::closeEvent( QCloseEvent* event )
|
||||
Void PlaYUVerApp::closeEvent( QCloseEvent* event )
|
||||
{
|
||||
int mayCloseAll = true;
|
||||
int msgBoxCloseRet = QMessageBox::Yes;
|
||||
Int mayCloseAll = true;
|
||||
Int msgBoxCloseRet = QMessageBox::Yes;
|
||||
|
||||
QList<SubWindowAbstract*> subWindowList = m_pcWindowHandle->findSubWindow();
|
||||
if( subWindowList.size() >= 1 )
|
||||
{
|
||||
QMessageBox msgBoxClose( QMessageBox::Question, "Calyp", "There are open files!",
|
||||
QMessageBox msgBoxClose( QMessageBox::Question, "PlaYUVer", "There are open files!",
|
||||
QMessageBox::Yes | QMessageBox::No, this );
|
||||
msgBoxClose.setDefaultButton( QMessageBox::No );
|
||||
msgBoxClose.setInformativeText( "Close all?" );
|
||||
@@ -154,7 +154,7 @@ void MainWindow::closeEvent( QCloseEvent* event )
|
||||
{
|
||||
case QMessageBox::Yes:
|
||||
mayCloseAll = true;
|
||||
for( int i = 0; i < subWindowList.size(); i++ )
|
||||
for( Int i = 0; i < subWindowList.size(); i++ )
|
||||
{
|
||||
mayCloseAll &= subWindowList.at( i )->mayClose();
|
||||
}
|
||||
@@ -177,34 +177,37 @@ void MainWindow::closeEvent( QCloseEvent* event )
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::closeAll()
|
||||
Void PlaYUVerApp::closeAll()
|
||||
{
|
||||
m_pcWindowHandle->removeAllSubWindow();
|
||||
}
|
||||
|
||||
void MainWindow::loadFile( QString fileName, CalypFileInfo* pStreamInfo )
|
||||
Void PlaYUVerApp::loadFile( QString fileName, PlaYUVerStreamInfo* pStreamInfo )
|
||||
{
|
||||
if( !QFileInfo( fileName ).exists() )
|
||||
{
|
||||
printMessage( "File " + fileName + " do not exist!", CLP_LOG_ERROR );
|
||||
printMessage( "File " + fileName + " do not exist!", LOG_ERROR );
|
||||
return;
|
||||
}
|
||||
VideoSubWindow* videoSubWindow = MainWindow::findVideoStreamSubWindow( m_pcWindowHandle, fileName );
|
||||
VideoSubWindow* videoSubWindow =
|
||||
PlaYUVerApp::findVideoStreamSubWindow( m_pcWindowHandle, fileName );
|
||||
if( videoSubWindow )
|
||||
{
|
||||
m_pcWindowHandle->setActiveSubWindow( videoSubWindow );
|
||||
return;
|
||||
}
|
||||
videoSubWindow = new VideoSubWindow( VideoSubWindow::VIDEO_STREAM_SUBWINDOW ); // createSubWindow();
|
||||
videoSubWindow =
|
||||
new VideoSubWindow( VideoSubWindow::VIDEO_STREAM_SUBWINDOW ); // createSubWindow();
|
||||
SubWindowAbstract* subWindow = videoSubWindow;
|
||||
if( !pStreamInfo )
|
||||
{
|
||||
int idx = findCalypStreamInfo( m_aRecentFileStreamInfo, fileName );
|
||||
pStreamInfo = (CalypFileInfo*)( idx >= 0 ? &m_aRecentFileStreamInfo.at( idx ) : NULL );
|
||||
Int idx = findPlaYUVerStreamInfo( m_aRecentFileStreamInfo, fileName );
|
||||
pStreamInfo = (PlaYUVerStreamInfo*)( idx >= 0 ? &m_aRecentFileStreamInfo.at( idx ) : NULL );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
bool opened = false;
|
||||
Bool opened = false;
|
||||
|
||||
if( !pStreamInfo )
|
||||
opened = videoSubWindow->loadFile( fileName );
|
||||
@@ -213,17 +216,25 @@ void MainWindow::loadFile( QString fileName, CalypFileInfo* pStreamInfo )
|
||||
|
||||
if( opened )
|
||||
{
|
||||
printMessage( "Loading file...", CLP_LOG_INFO );
|
||||
printMessage( "Loading file...", LOG_INFO );
|
||||
m_pcWindowHandle->addSubWindow( videoSubWindow );
|
||||
videoSubWindow->show();
|
||||
|
||||
m_appModuleVideo->addSubWindow( videoSubWindow );
|
||||
connect( subWindow, SIGNAL( aboutToClose( SubWindowAbstract* ) ), m_appModuleVideo,
|
||||
SLOT( closeSubWindow( SubWindowAbstract* ) ) );
|
||||
connect( subWindow, SIGNAL( zoomFactorChanged_SWindow( const double, const QPoint ) ),
|
||||
m_appModuleVideo, SLOT( zoomToFactorAll( double, QPoint ) ) );
|
||||
connect( subWindow, SIGNAL( scrollBarMoved_SWindow( const QPoint ) ), m_appModuleVideo,
|
||||
SLOT( moveAllScrollBars( const QPoint ) ) );
|
||||
|
||||
videoSubWindow->zoomToFit();
|
||||
updateZoomFactorSBox();
|
||||
|
||||
m_appModuleVideo->openSubWindow( videoSubWindow );
|
||||
|
||||
addStreamInfoToRecentList( videoSubWindow->getStreamInfo() );
|
||||
|
||||
printMessage( "File loaded", CLP_LOG_INFO );
|
||||
printMessage( "File loaded", LOG_INFO );
|
||||
m_cLastOpenPath = QFileInfo( fileName ).path();
|
||||
}
|
||||
else
|
||||
@@ -231,43 +242,34 @@ void MainWindow::loadFile( QString fileName, CalypFileInfo* pStreamInfo )
|
||||
videoSubWindow->close();
|
||||
}
|
||||
}
|
||||
catch( CalypFailure& e )
|
||||
catch( PlaYUVerFailure& e )
|
||||
{
|
||||
videoSubWindow->close();
|
||||
QString warningMsg =
|
||||
"Cannot open file " + QFileInfo( fileName ).fileName() + " with the following error: \n" + e.what();
|
||||
QString warningMsg = "Cannot open file " + QFileInfo( fileName ).fileName() +
|
||||
" with the following error: \n" + e.what();
|
||||
QMessageBox::warning( this, QApplication::applicationName(), warningMsg );
|
||||
printMessage( warningMsg, CLP_LOG_ERROR );
|
||||
printMessage( warningMsg, LOG_ERROR );
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------- File Functions -----------------------
|
||||
|
||||
QStringList MainWindow::showFileDialog( bool bRead )
|
||||
Void PlaYUVerApp::open()
|
||||
{
|
||||
QString supported = tr( "Supported Files (" );
|
||||
QStringList formatsList;
|
||||
std::vector<CalypStreamFormat> supportedFmts;
|
||||
std::vector<PlaYUVerSupportedFormat> supportedFmts = PlaYUVerStream::supportedReadFormats();
|
||||
|
||||
if( bRead )
|
||||
supportedFmts = CalypStream::supportedReadFormats();
|
||||
else
|
||||
supportedFmts = CalypStream::supportedWriteFormats();
|
||||
|
||||
for( unsigned int i = 0; i < supportedFmts.size(); i++ )
|
||||
for( UInt i = 0; i < supportedFmts.size(); i++ )
|
||||
{
|
||||
std::vector<ClpString> arrayExt = supportedFmts[i].getExts();
|
||||
if( arrayExt.size() > 0 )
|
||||
if( supportedFmts[i].formatExt != "" )
|
||||
{
|
||||
QString currFmt( QString::fromStdString( supportedFmts[i].formatName ) );
|
||||
currFmt.append( " (" );
|
||||
for( std::vector<ClpString>::iterator e = arrayExt.begin(); e != arrayExt.end(); ++e )
|
||||
{
|
||||
supported.append( " *." );
|
||||
currFmt.append( "*." );
|
||||
supported.append( QString::fromStdString( *e ) );
|
||||
currFmt.append( QString::fromStdString( *e ) );
|
||||
}
|
||||
QString currFmt;
|
||||
supported.append( " *." );
|
||||
supported.append( QString::fromStdString( supportedFmts[i].formatExt ) );
|
||||
currFmt.append( QString::fromStdString( supportedFmts[i].formatName ) );
|
||||
currFmt.append( " (*." );
|
||||
currFmt.append( QString::fromStdString( supportedFmts[i].formatExt ) );
|
||||
currFmt.append( ")" );
|
||||
formatsList << currFmt;
|
||||
}
|
||||
@@ -277,25 +279,10 @@ QStringList MainWindow::showFileDialog( bool bRead )
|
||||
QStringList filter;
|
||||
filter << supported << formatsList << tr( "All Files (*)" );
|
||||
|
||||
QStringList fileNameList;
|
||||
fileNameList.clear();
|
||||
if( bRead )
|
||||
{
|
||||
fileNameList = QFileDialog::getOpenFileNames( this, tr( "Open File" ), m_cLastOpenPath, filter.join( ";;" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
QString fileName = QFileDialog::getSaveFileName( this, tr( "Save File" ), m_cLastOpenPath, filter.join( ";;" ) );
|
||||
if( !fileName.isEmpty() )
|
||||
fileNameList.append( fileName );
|
||||
}
|
||||
return fileNameList;
|
||||
}
|
||||
QStringList fileNameList = QFileDialog::getOpenFileNames( this, tr( "Open File" ),
|
||||
m_cLastOpenPath, filter.join( ";;" ) );
|
||||
|
||||
void MainWindow::open()
|
||||
{
|
||||
QStringList fileNameList = showFileDialog( true );
|
||||
for( int i = 0; i < fileNameList.size(); i++ )
|
||||
for( Int i = 0; i < fileNameList.size(); i++ )
|
||||
{
|
||||
if( !fileNameList.at( i ).isEmpty() )
|
||||
{
|
||||
@@ -304,76 +291,68 @@ void MainWindow::open()
|
||||
}
|
||||
}
|
||||
|
||||
// void CalypApp::openDevice()
|
||||
// Void PlaYUVerApp::openDevice()
|
||||
//{
|
||||
// loadFile( "/dev/video0", NULL );
|
||||
//}
|
||||
|
||||
void MainWindow::openRecent()
|
||||
Void PlaYUVerApp::openRecent()
|
||||
{
|
||||
QAction* action = qobject_cast<QAction*>( sender() );
|
||||
CalypFileInfo recentFile = action->data().value<CalypFileInfo>();
|
||||
PlaYUVerStreamInfo recentFile = action->data().value<PlaYUVerStreamInfo>();
|
||||
if( action )
|
||||
loadFile( recentFile.m_cFilename, &recentFile );
|
||||
}
|
||||
|
||||
void MainWindow::saveFrame()
|
||||
Void PlaYUVerApp::save()
|
||||
{
|
||||
if( m_pcCurrentVideoSubWindow )
|
||||
{
|
||||
VideoSubWindow* saveWindow = m_pcCurrentVideoSubWindow;
|
||||
QString supported = tr( "Supported Files (" );
|
||||
QStringList formatsList;
|
||||
|
||||
QStringList fileNameList = showFileDialog( false );
|
||||
if( fileNameList.size() == 1 )
|
||||
std::vector<PlaYUVerSupportedFormat> supportedFmts = PlaYUVerStream::supportedWriteFormats();
|
||||
for( UInt i = 0; i < supportedFmts.size(); i++ )
|
||||
{
|
||||
QString currFmt;
|
||||
supported.append( " *." );
|
||||
supported.append( QString::fromStdString( supportedFmts[i].formatExt ) );
|
||||
currFmt.append( QString::fromStdString( supportedFmts[i].formatName ) );
|
||||
currFmt.append( " (*." );
|
||||
currFmt.append( QString::fromStdString( supportedFmts[i].formatExt ) );
|
||||
currFmt.append( ")" );
|
||||
formatsList << currFmt;
|
||||
}
|
||||
supported.append( " )" );
|
||||
|
||||
QStringList filter;
|
||||
filter << supported << formatsList << tr( "All Files (*)" );
|
||||
|
||||
QString fileName = QFileDialog::getSaveFileName( this, tr( "Open File" ), m_cLastOpenPath,
|
||||
filter.join( ";;" ) );
|
||||
|
||||
if( !fileName.isEmpty() )
|
||||
{
|
||||
QString fileName = fileNameList[0];
|
||||
m_cLastOpenPath = QFileInfo( fileName ).path();
|
||||
try
|
||||
{
|
||||
saveWindow->save( fileName );
|
||||
}
|
||||
catch( CalypFailure& e )
|
||||
catch( PlaYUVerFailure& e )
|
||||
{
|
||||
QApplication::restoreOverrideCursor();
|
||||
QString warningMsg =
|
||||
"Cannot save file " + QFileInfo( fileName ).fileName() + " with the following error: \n" + e.what();
|
||||
QString warningMsg = "Cannot save file " + QFileInfo( fileName ).fileName() +
|
||||
" with the following error: \n" + e.what();
|
||||
QMessageBox::warning( this, QApplication::applicationName(), warningMsg );
|
||||
printMessage( warningMsg, CLP_LOG_ERROR );
|
||||
printMessage( warningMsg, LOG_ERROR );
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::saveStream()
|
||||
{
|
||||
if( m_pcCurrentVideoSubWindow )
|
||||
{
|
||||
VideoSubWindow* saveWindow = m_pcCurrentVideoSubWindow;
|
||||
|
||||
QStringList fileNameList = showFileDialog( false );
|
||||
if( fileNameList.size() == 1 )
|
||||
{
|
||||
QString fileName = fileNameList[0];
|
||||
m_cLastOpenPath = QFileInfo( fileName ).path();
|
||||
try
|
||||
{
|
||||
saveWindow->save( fileName );
|
||||
}
|
||||
catch( CalypFailure& e )
|
||||
{
|
||||
QApplication::restoreOverrideCursor();
|
||||
QString warningMsg =
|
||||
"Cannot save file " + QFileInfo( fileName ).fileName() + " with the following error: \n" + e.what();
|
||||
QMessageBox::warning( this, QApplication::applicationName(), warningMsg );
|
||||
printMessage( warningMsg, CLP_LOG_ERROR );
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::format()
|
||||
Void PlaYUVerApp::format()
|
||||
{
|
||||
if( m_pcCurrentVideoSubWindow )
|
||||
{
|
||||
@@ -385,12 +364,13 @@ void MainWindow::format()
|
||||
addStreamInfoToRecentList( pcVideoSubWindow->getStreamInfo() );
|
||||
}
|
||||
}
|
||||
catch( CalypFailure& e )
|
||||
catch( PlaYUVerFailure& e )
|
||||
{
|
||||
QString warningMsg = "Cannot change format of " + QFileInfo( pcVideoSubWindow->getCurrentFileName() ).fileName() +
|
||||
QString warningMsg = "Cannot change format of " +
|
||||
QFileInfo( pcVideoSubWindow->getCurrentFileName() ).fileName() +
|
||||
" with the following error: \n" + e.what();
|
||||
QMessageBox::warning( this, QApplication::applicationName(), warningMsg );
|
||||
printMessage( warningMsg, CLP_LOG_ERROR );
|
||||
printMessage( warningMsg, LOG_ERROR );
|
||||
qDebug() << warningMsg;
|
||||
m_pcCurrentSubWindow->close();
|
||||
}
|
||||
@@ -399,7 +379,7 @@ void MainWindow::format()
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::reload()
|
||||
Void PlaYUVerApp::reload()
|
||||
{
|
||||
if( m_pcCurrentSubWindow )
|
||||
{
|
||||
@@ -409,18 +389,19 @@ void MainWindow::reload()
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::reloadAll()
|
||||
Void PlaYUVerApp::reloadAll()
|
||||
{
|
||||
unsigned int windowCategoryOrder[] = {
|
||||
UInt windowCategoryOrder[] = {
|
||||
SubWindowAbstract::VIDEO_STREAM_SUBWINDOW,
|
||||
SubWindowAbstract::MODULE_SUBWINDOW,
|
||||
SubWindowAbstract::MODULE_SUBWINDOW,
|
||||
};
|
||||
|
||||
for( unsigned int c = 0; c < 3; c++ )
|
||||
for( UInt c = 0; c < 3; c++ )
|
||||
{
|
||||
QList<SubWindowAbstract*> subWindowList = m_pcWindowHandle->findSubWindow( windowCategoryOrder[c] );
|
||||
for( int i = 0; i < subWindowList.size(); i++ )
|
||||
QList<SubWindowAbstract*> subWindowList =
|
||||
m_pcWindowHandle->findSubWindow( windowCategoryOrder[c] );
|
||||
for( Int i = 0; i < subWindowList.size(); i++ )
|
||||
{
|
||||
subWindowList.at( i )->refreshSubWindow();
|
||||
}
|
||||
@@ -429,19 +410,19 @@ void MainWindow::reloadAll()
|
||||
update();
|
||||
}
|
||||
|
||||
void MainWindow::loadAll()
|
||||
Void PlaYUVerApp::loadAll()
|
||||
{
|
||||
if( m_pcCurrentVideoSubWindow )
|
||||
{
|
||||
printMessage( "Loading file into memory...", CLP_LOG_INFO );
|
||||
printMessage( "Loading file into memory...", LOG_INFO );
|
||||
m_pcCurrentVideoSubWindow->loadAll();
|
||||
printMessage( "File loaded", CLP_LOG_INFO );
|
||||
printMessage( "File loaded", LOG_INFO );
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------- Zoom Functions -----------------------
|
||||
|
||||
void MainWindow::normalSize()
|
||||
Void PlaYUVerApp::normalSize()
|
||||
{
|
||||
if( m_pcCurrentSubWindow )
|
||||
{
|
||||
@@ -450,7 +431,7 @@ void MainWindow::normalSize()
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::zoomToFit()
|
||||
Void PlaYUVerApp::zoomToFit()
|
||||
{
|
||||
if( m_pcCurrentSubWindow )
|
||||
{
|
||||
@@ -459,11 +440,12 @@ void MainWindow::zoomToFit()
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::zoomToFitAll()
|
||||
Void PlaYUVerApp::zoomToFitAll()
|
||||
{
|
||||
VideoSubWindow* videoSubWindow;
|
||||
QList<SubWindowAbstract*> subWindowList = m_pcWindowHandle->findSubWindow( SubWindowAbstract::VIDEO_SUBWINDOW );
|
||||
for( int i = 0; i < subWindowList.size(); i++ )
|
||||
QList<SubWindowAbstract*> subWindowList =
|
||||
m_pcWindowHandle->findSubWindow( SubWindowAbstract::VIDEO_SUBWINDOW );
|
||||
for( Int i = 0; i < subWindowList.size(); i++ )
|
||||
{
|
||||
videoSubWindow = qobject_cast<VideoSubWindow*>( subWindowList.at( i ) );
|
||||
videoSubWindow->zoomToFit();
|
||||
@@ -472,28 +454,28 @@ void MainWindow::zoomToFitAll()
|
||||
updateZoomFactorSBox();
|
||||
}
|
||||
|
||||
void MainWindow::scaleFrame( int ratio )
|
||||
Void PlaYUVerApp::scaleFrame( int ratio )
|
||||
{
|
||||
if( m_pcCurrentSubWindow )
|
||||
{
|
||||
m_pcCurrentSubWindow->scaleView( (double)( ratio ) / 100.0 );
|
||||
m_pcCurrentSubWindow->scaleView( ( Double )( ratio ) / 100.0 );
|
||||
updateZoomFactorSBox();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::zoomFromSBox( double zoom )
|
||||
Void PlaYUVerApp::zoomFromSBox( double zoom )
|
||||
{
|
||||
SubWindowAbstract* activeSubWindow = m_pcWindowHandle->activeSubWindow();
|
||||
double factor = zoom / 100;
|
||||
Double factor = zoom / 100;
|
||||
if( activeSubWindow )
|
||||
{
|
||||
activeSubWindow->zoomToFactor( factor );
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::updateZoomFactorSBox()
|
||||
Void PlaYUVerApp::updateZoomFactorSBox()
|
||||
{
|
||||
double factor;
|
||||
Double factor;
|
||||
if( m_pcCurrentSubWindow )
|
||||
{
|
||||
factor = m_pcCurrentSubWindow->getScaleFactor();
|
||||
@@ -503,14 +485,14 @@ void MainWindow::updateZoomFactorSBox()
|
||||
|
||||
// ----------------------- Drag and drop functions ----------------------
|
||||
|
||||
void MainWindow::dragEnterEvent( QDragEnterEvent* event )
|
||||
Void PlaYUVerApp::dragEnterEvent( QDragEnterEvent* event )
|
||||
{
|
||||
// setText(tr("<drop content>"));
|
||||
// mdiArea->setBackgroundRole( QPalette::Highlight );
|
||||
event->acceptProposedAction();
|
||||
}
|
||||
|
||||
void MainWindow::dropEvent( QDropEvent* event )
|
||||
Void PlaYUVerApp::dropEvent( QDropEvent* event )
|
||||
{
|
||||
const QMimeData* mimeData = event->mimeData();
|
||||
QList<QUrl> urlList = mimeData->urls();
|
||||
@@ -524,13 +506,14 @@ void MainWindow::dropEvent( QDropEvent* event )
|
||||
|
||||
// ----------------------- Sub Window Functions -----------------------
|
||||
|
||||
VideoSubWindow* MainWindow::findVideoStreamSubWindow( const SubWindowHandle* windowManager,
|
||||
const QString& fileName )
|
||||
VideoSubWindow* PlaYUVerApp::findVideoStreamSubWindow( const PlaYUVerSubWindowHandle* windowManager,
|
||||
const QString& fileName )
|
||||
{
|
||||
QString canonicalFilePath = QFileInfo( fileName ).canonicalFilePath();
|
||||
VideoSubWindow* pcSubWindow;
|
||||
QList<SubWindowAbstract*> subWindowList = windowManager->findSubWindow( SubWindowAbstract::VIDEO_STREAM_SUBWINDOW );
|
||||
for( int i = 0; i < subWindowList.size(); i++ )
|
||||
QList<SubWindowAbstract*> subWindowList =
|
||||
windowManager->findSubWindow( SubWindowAbstract::VIDEO_STREAM_SUBWINDOW );
|
||||
for( Int i = 0; i < subWindowList.size(); i++ )
|
||||
{
|
||||
pcSubWindow = qobject_cast<VideoSubWindow*>( subWindowList.at( i ) );
|
||||
if( pcSubWindow->getCurrentFileName() == canonicalFilePath )
|
||||
@@ -541,7 +524,7 @@ VideoSubWindow* MainWindow::findVideoStreamSubWindow( const SubWindowHandle* win
|
||||
|
||||
// ----------------------- Update Functions -----------------------
|
||||
|
||||
void MainWindow::update()
|
||||
Void PlaYUVerApp::update()
|
||||
{
|
||||
SubWindowAbstract* activeSubWindow = m_pcWindowHandle->activeSubWindow();
|
||||
QCoreApplication::processEvents();
|
||||
@@ -574,28 +557,28 @@ void MainWindow::update()
|
||||
updateMenus();
|
||||
}
|
||||
|
||||
void MainWindow::printMessage( const QString& msg )
|
||||
Void PlaYUVerApp::printMessage( const QString& msg )
|
||||
{
|
||||
printMessage( msg, 0 );
|
||||
}
|
||||
|
||||
void MainWindow::printMessage( const QString& msg, unsigned int logLevel )
|
||||
Void PlaYUVerApp::printMessage( const QString& msg, UInt logLevel )
|
||||
{
|
||||
if( !msg.isEmpty() )
|
||||
{
|
||||
statusBar()->showMessage( msg, 10000 );
|
||||
if( logLevel >= CLP_LOG_INFO )
|
||||
if( logLevel >= LOG_INFO )
|
||||
{
|
||||
m_pcWindowHandle->processLogMsg( msg );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::updateMenus()
|
||||
Void PlaYUVerApp::updateMenus()
|
||||
{
|
||||
bool hasSubWindow = ( m_pcWindowHandle->activeSubWindow() != 0 );
|
||||
Bool hasSubWindow = ( m_pcWindowHandle->activeSubWindow() != 0 );
|
||||
|
||||
bool hasVideoStreamSubWindow = false;
|
||||
Bool hasVideoStreamSubWindow = false;
|
||||
if( m_pcCurrentSubWindow )
|
||||
if( m_pcCurrentSubWindow->getCategory() & SubWindowAbstract::VIDEO_STREAM_SUBWINDOW )
|
||||
hasVideoStreamSubWindow = true;
|
||||
@@ -625,44 +608,38 @@ void MainWindow::updateMenus()
|
||||
|
||||
// ----------------------- Create Functions -----------------------
|
||||
|
||||
void MainWindow::createActions()
|
||||
Void PlaYUVerApp::createActions()
|
||||
{
|
||||
m_arrayActions.resize( TOTAL_ACT );
|
||||
|
||||
// ------------ File ------------
|
||||
m_arrayActions[OPEN_ACT] = new QAction( tr( "&Open" ), this );
|
||||
m_arrayActions[OPEN_ACT] = new QAction( QIcon( ":/images/open.png" ), tr( "&Open" ), this );
|
||||
m_arrayActions[OPEN_ACT]->setIcon( style()->standardIcon( QStyle::SP_DialogOpenButton ) );
|
||||
m_arrayActions[OPEN_ACT]->setShortcuts( QKeySequence::Open );
|
||||
m_arrayActions[OPEN_ACT]->setStatusTip( tr( "Open stream" ) );
|
||||
connect( m_arrayActions[OPEN_ACT], SIGNAL( triggered() ), this, SLOT( open() ) );
|
||||
|
||||
// m_arrayActions[OPEN_DEVICE_ACT] = new QAction( tr( "&Open Capture Device"
|
||||
// ), this ); m_arrayActions[OPEN_DEVICE_ACT]->setStatusTip( tr( "Open
|
||||
// capture device (webcam)" ) ); connect( m_arrayActions[OPEN_DEVICE_ACT],
|
||||
// SIGNAL( triggered() ), this, SLOT( openDevice() ) );
|
||||
// m_arrayActions[OPEN_DEVICE_ACT] = new QAction( tr( "&Open Capture Device" ), this );
|
||||
// m_arrayActions[OPEN_DEVICE_ACT]->setStatusTip( tr( "Open capture device (webcam)" ) );
|
||||
// connect( m_arrayActions[OPEN_DEVICE_ACT], SIGNAL( triggered() ), this, SLOT( openDevice() ) );
|
||||
|
||||
m_arrayRecentFilesActions.resize( MAX_RECENT_FILES );
|
||||
for( int i = 0; i < MAX_RECENT_FILES; i++ )
|
||||
for( Int i = 0; i < MAX_RECENT_FILES; i++ )
|
||||
{
|
||||
m_arrayRecentFilesActions[i] = new QAction( this );
|
||||
m_arrayRecentFilesActions[i]->setVisible( false );
|
||||
connect( m_arrayRecentFilesActions[i], SIGNAL( triggered() ), this, SLOT( openRecent() ) );
|
||||
}
|
||||
|
||||
m_arrayActions[SAVE_ACT] = new QAction( tr( "&Save Frame" ), this );
|
||||
m_arrayActions[SAVE_ACT] = new QAction( QIcon( ":/images/save.png" ), tr( "&Save Frame" ), this );
|
||||
m_arrayActions[SAVE_ACT]->setIcon( style()->standardIcon( QStyle::SP_DialogSaveButton ) );
|
||||
m_arrayActions[SAVE_ACT]->setShortcuts( QKeySequence::SaveAs );
|
||||
m_arrayActions[SAVE_ACT]->setStatusTip( tr( "Save current frame" ) );
|
||||
connect( m_arrayActions[SAVE_ACT], SIGNAL( triggered() ), this, SLOT( saveFrame() ) );
|
||||
|
||||
m_arrayActions[SAVE_STREAM_ACT] = new QAction( tr( "&Save Stream" ), this );
|
||||
m_arrayActions[SAVE_STREAM_ACT]->setIcon( style()->standardIcon( QStyle::SP_DialogSaveButton ) );
|
||||
m_arrayActions[SAVE_STREAM_ACT]->setShortcuts( QKeySequence::SaveAs );
|
||||
m_arrayActions[SAVE_STREAM_ACT]->setStatusTip( tr( "Save current stream" ) );
|
||||
connect( m_arrayActions[SAVE_STREAM_ACT], SIGNAL( triggered() ), this, SLOT( saveStream() ) );
|
||||
connect( m_arrayActions[SAVE_ACT], SIGNAL( triggered() ), this, SLOT( save() ) );
|
||||
|
||||
m_arrayActions[FORMAT_ACT] = new QAction( tr( "&Format" ), this );
|
||||
m_arrayActions[FORMAT_ACT]->setIcon( QIcon::fromTheme( "transform-scale" ) );
|
||||
m_arrayActions[FORMAT_ACT]->setIcon(
|
||||
QIcon::fromTheme( "transform-scale", QIcon( ":/images/configuredialog.png" ) ) );
|
||||
m_arrayActions[FORMAT_ACT]->setShortcut( Qt::CTRL + Qt::Key_F );
|
||||
m_arrayActions[FORMAT_ACT]->setStatusTip( tr( "Open format dialog" ) );
|
||||
connect( m_arrayActions[FORMAT_ACT], SIGNAL( triggered() ), this, SLOT( format() ) );
|
||||
@@ -686,11 +663,13 @@ void MainWindow::createActions()
|
||||
m_arrayActions[CLOSE_ACT] = new QAction( tr( "&Close" ), this );
|
||||
m_arrayActions[CLOSE_ACT]->setIcon( style()->standardIcon( QStyle::SP_DialogCloseButton ) );
|
||||
m_arrayActions[CLOSE_ACT]->setStatusTip( tr( "Close the active window" ) );
|
||||
connect( m_arrayActions[CLOSE_ACT], SIGNAL( triggered() ), m_pcWindowHandle, SLOT( removeActiveSubWindow() ) );
|
||||
connect( m_arrayActions[CLOSE_ACT], SIGNAL( triggered() ), m_pcWindowHandle,
|
||||
SLOT( removeActiveSubWindow() ) );
|
||||
|
||||
m_arrayActions[CLOSEALL_ACT] = new QAction( tr( "Close &All" ), this );
|
||||
m_arrayActions[CLOSEALL_ACT]->setStatusTip( tr( "Close all the windows" ) );
|
||||
connect( m_arrayActions[CLOSEALL_ACT], SIGNAL( triggered() ), m_pcWindowHandle, SLOT( removeAllSubWindow() ) );
|
||||
connect( m_arrayActions[CLOSEALL_ACT], SIGNAL( triggered() ), m_pcWindowHandle,
|
||||
SLOT( removeAllSubWindow() ) );
|
||||
|
||||
m_arrayActions[EXIT_ACT] = new QAction( tr( "E&xit" ), this );
|
||||
m_arrayActions[EXIT_ACT]->setShortcuts( QKeySequence::Quit );
|
||||
@@ -702,27 +681,31 @@ void MainWindow::createActions()
|
||||
connect( mapperZoom, SIGNAL( mapped( int ) ), this, SLOT( scaleFrame( int ) ) );
|
||||
|
||||
m_arrayActions[ZOOM_IN_ACT] = new QAction( tr( "Zoom &In (+25%)" ), this );
|
||||
m_arrayActions[ZOOM_IN_ACT]->setIcon( QIcon::fromTheme( "zoom-in" ) );
|
||||
m_arrayActions[ZOOM_IN_ACT]->setIcon(
|
||||
QIcon::fromTheme( "zoom-in", QIcon( ":/images/zoomin.png" ) ) );
|
||||
m_arrayActions[ZOOM_IN_ACT]->setShortcut( tr( "Ctrl++" ) );
|
||||
m_arrayActions[ZOOM_IN_ACT]->setStatusTip( tr( "Scale the image up by 25%" ) );
|
||||
connect( m_arrayActions[ZOOM_IN_ACT], SIGNAL( triggered() ), mapperZoom, SLOT( map() ) );
|
||||
mapperZoom->setMapping( m_arrayActions[ZOOM_IN_ACT], 125 );
|
||||
|
||||
m_arrayActions[ZOOM_OUT_ACT] = new QAction( tr( "Zoom &Out (-25%)" ), this );
|
||||
m_arrayActions[ZOOM_OUT_ACT]->setIcon( QIcon::fromTheme( "zoom-out" ) );
|
||||
m_arrayActions[ZOOM_OUT_ACT]->setIcon(
|
||||
QIcon::fromTheme( "zoom-out", QIcon( ":/images/zoomout.png" ) ) );
|
||||
m_arrayActions[ZOOM_OUT_ACT]->setShortcut( tr( "Ctrl+-" ) );
|
||||
m_arrayActions[ZOOM_OUT_ACT]->setStatusTip( tr( "Scale the image down by 25%" ) );
|
||||
connect( m_arrayActions[ZOOM_OUT_ACT], SIGNAL( triggered() ), mapperZoom, SLOT( map() ) );
|
||||
mapperZoom->setMapping( m_arrayActions[ZOOM_OUT_ACT], 80 );
|
||||
|
||||
m_arrayActions[ZOOM_NORMAL_ACT] = new QAction( tr( "&Normal Size" ), this );
|
||||
m_arrayActions[ZOOM_NORMAL_ACT]->setIcon( QIcon::fromTheme( "zoom-original" ) );
|
||||
m_arrayActions[ZOOM_NORMAL_ACT]->setIcon(
|
||||
QIcon::fromTheme( "zoom-original", QIcon( ":/images/zoomtonormal.png" ) ) );
|
||||
m_arrayActions[ZOOM_NORMAL_ACT]->setShortcut( tr( "Ctrl+N" ) );
|
||||
m_arrayActions[ZOOM_NORMAL_ACT]->setStatusTip( tr( "Show the image at its original size" ) );
|
||||
connect( m_arrayActions[ZOOM_NORMAL_ACT], SIGNAL( triggered() ), this, SLOT( normalSize() ) );
|
||||
|
||||
m_arrayActions[ZOOM_FIT_ACT] = new QAction( tr( "Zoom to &Fit" ), this );
|
||||
m_arrayActions[ZOOM_FIT_ACT]->setIcon( QIcon::fromTheme( "zoom-fit-best" ) );
|
||||
m_arrayActions[ZOOM_FIT_ACT]->setIcon(
|
||||
QIcon::fromTheme( "zoom-fit-best", QIcon( ":/images/fittowindow.png" ) ) );
|
||||
m_arrayActions[ZOOM_FIT_ACT]->setStatusTip( tr( "Zoom in or out to fit on the window." ) );
|
||||
connect( m_arrayActions[ZOOM_FIT_ACT], SIGNAL( triggered() ), this, SLOT( zoomToFit() ) );
|
||||
|
||||
@@ -748,7 +731,6 @@ void MainWindow::createActions()
|
||||
#endif
|
||||
|
||||
m_arrayActions[ABOUT_ACT] = new QAction( tr( "&About" ), this );
|
||||
m_arrayActions[ABOUT_ACT]->setIcon( QIcon( ":logos/calyp-icon.png" ) );
|
||||
m_arrayActions[ABOUT_ACT]->setStatusTip( tr( "Show the application's About box" ) );
|
||||
connect( m_arrayActions[ABOUT_ACT], SIGNAL( triggered() ), this, SLOT( about() ) );
|
||||
|
||||
@@ -758,7 +740,7 @@ void MainWindow::createActions()
|
||||
connect( m_arrayActions[ABOUTQT_ACT], SIGNAL( triggered() ), qApp, SLOT( aboutQt() ) );
|
||||
}
|
||||
|
||||
void MainWindow::createMenus()
|
||||
Void PlaYUVerApp::createMenus()
|
||||
{
|
||||
m_arrayMenu.resize( TOTAL_MENUS );
|
||||
|
||||
@@ -766,13 +748,12 @@ void MainWindow::createMenus()
|
||||
m_arrayMenu[FILE_MENU]->addAction( m_arrayActions[OPEN_ACT] );
|
||||
// m_arrayMenu[FILE_MENU]->addAction( m_arrayActions[OPEN_DEVICE_ACT] );
|
||||
m_arrayMenu[RECENT_MENU] = m_arrayMenu[FILE_MENU]->addMenu( tr( "Open Recent" ) );
|
||||
for( int i = 0; i < MAX_RECENT_FILES; ++i )
|
||||
for( Int i = 0; i < MAX_RECENT_FILES; ++i )
|
||||
{
|
||||
m_arrayMenu[RECENT_MENU]->addAction( m_arrayRecentFilesActions[i] );
|
||||
}
|
||||
|
||||
m_arrayMenu[FILE_MENU]->addAction( m_arrayActions[SAVE_ACT] );
|
||||
// m_arrayMenu[FILE_MENU]->addAction( m_arrayActions[SAVE_STREAM_ACT] );
|
||||
m_arrayMenu[FILE_MENU]->addSeparator();
|
||||
m_arrayMenu[FILE_MENU]->addAction( m_arrayActions[FORMAT_ACT] );
|
||||
m_arrayMenu[FILE_MENU]->addAction( m_arrayActions[RELOAD_ACT] );
|
||||
@@ -820,7 +801,7 @@ void MainWindow::createMenus()
|
||||
m_arrayMenu[ABOUT_MENU]->addAction( m_arrayActions[ABOUTQT_ACT] );
|
||||
}
|
||||
|
||||
void MainWindow::createToolBars()
|
||||
Void PlaYUVerApp::createToolBars()
|
||||
{
|
||||
m_arrayToolBars.resize( TOTAL_TOOLBAR );
|
||||
|
||||
@@ -841,7 +822,8 @@ void MainWindow::createToolBars()
|
||||
m_pcZoomFactorSBox->setSingleStep( 10.0 );
|
||||
m_pcZoomFactorSBox->setValue( 100.0 );
|
||||
m_pcZoomFactorSBox->setSuffix( "%" );
|
||||
connect( m_pcZoomFactorSBox, SIGNAL( valueChanged( double ) ), this, SLOT( zoomFromSBox( double ) ) );
|
||||
connect( m_pcZoomFactorSBox, SIGNAL( valueChanged( double ) ), this,
|
||||
SLOT( zoomFromSBox( double ) ) );
|
||||
m_arrayToolBars[VIEW_TOOLBAR]->addWidget( m_pcZoomFactorSBox );
|
||||
m_arrayToolBars[VIEW_TOOLBAR]->addAction( m_arrayActions[ZOOM_IN_ACT] );
|
||||
m_arrayToolBars[VIEW_TOOLBAR]->addAction( m_arrayActions[ZOOM_OUT_ACT] );
|
||||
@@ -854,7 +836,7 @@ void MainWindow::createToolBars()
|
||||
addToolBar( Qt::TopToolBarArea, m_appModuleVideo->createToolBar() );
|
||||
}
|
||||
|
||||
void MainWindow::createDockWidgets()
|
||||
Void PlaYUVerApp::createDockWidgets()
|
||||
{
|
||||
// Properties Dock Window
|
||||
m_arraySideBars.resize( TOTAL_DOCK );
|
||||
@@ -862,16 +844,16 @@ void MainWindow::createDockWidgets()
|
||||
addDockWidget( Qt::RightDockWidgetArea, m_appModuleQuality->createDock() );
|
||||
}
|
||||
|
||||
void MainWindow::createStatusBar()
|
||||
Void PlaYUVerApp::createStatusBar()
|
||||
{
|
||||
//! Warning: the following widget cannot change size too much
|
||||
statusBar()->addPermanentWidget( m_appModuleVideo->createStatusBarMessage() );
|
||||
printMessage( "Ready!", CLP_LOG_INFO );
|
||||
printMessage( "Ready!", LOG_INFO );
|
||||
}
|
||||
|
||||
void MainWindow::addStreamInfoToRecentList( CalypFileInfo streamInfo )
|
||||
Void PlaYUVerApp::addStreamInfoToRecentList( PlaYUVerStreamInfo streamInfo )
|
||||
{
|
||||
int idx = findCalypStreamInfo( m_aRecentFileStreamInfo, streamInfo.m_cFilename );
|
||||
Int idx = findPlaYUVerStreamInfo( m_aRecentFileStreamInfo, streamInfo.m_cFilename );
|
||||
if( idx >= 0 )
|
||||
m_aRecentFileStreamInfo.remove( idx );
|
||||
m_aRecentFileStreamInfo.prepend( streamInfo );
|
||||
@@ -880,11 +862,11 @@ void MainWindow::addStreamInfoToRecentList( CalypFileInfo streamInfo )
|
||||
updateRecentFileActions();
|
||||
}
|
||||
|
||||
void MainWindow::updateRecentFileActions()
|
||||
Void PlaYUVerApp::updateRecentFileActions()
|
||||
{
|
||||
int numRecentFiles = m_aRecentFileStreamInfo.size();
|
||||
Int numRecentFiles = m_aRecentFileStreamInfo.size();
|
||||
numRecentFiles = qMin( numRecentFiles, MAX_RECENT_FILES );
|
||||
int actionIdx = 0;
|
||||
Int actionIdx = 0;
|
||||
while( actionIdx < numRecentFiles )
|
||||
{
|
||||
QString text = m_aRecentFileStreamInfo.at( actionIdx ).m_cFilename;
|
||||
@@ -904,9 +886,9 @@ void MainWindow::updateRecentFileActions()
|
||||
m_arrayMenu[RECENT_MENU]->setEnabled( m_aRecentFileStreamInfo.size() > 0 ? true : false );
|
||||
}
|
||||
|
||||
void MainWindow::checkRecentFileActions()
|
||||
Void PlaYUVerApp::checkRecentFileActions()
|
||||
{
|
||||
int i = 0;
|
||||
Int i = 0;
|
||||
while( i < m_aRecentFileStreamInfo.size() )
|
||||
{
|
||||
if( !QFileInfo( m_aRecentFileStreamInfo.at( i ).m_cFilename ).exists() )
|
||||
@@ -916,7 +898,7 @@ void MainWindow::checkRecentFileActions()
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned long long int fileSize = QFileInfo( m_aRecentFileStreamInfo.at( i ).m_cFilename ).size();
|
||||
UInt64 fileSize = QFileInfo( m_aRecentFileStreamInfo.at( i ).m_cFilename ).size();
|
||||
if( m_aRecentFileStreamInfo.at( i ).m_uiFileSize != fileSize )
|
||||
{
|
||||
m_aRecentFileStreamInfo.remove( i );
|
||||
@@ -927,7 +909,7 @@ void MainWindow::checkRecentFileActions()
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::readSettings()
|
||||
Void PlaYUVerApp::readSettings()
|
||||
{
|
||||
QSettings appSettings;
|
||||
|
||||
@@ -939,7 +921,7 @@ void MainWindow::readSettings()
|
||||
m_cLastOpenPath = appSettings.value( "MainWindow/LastOpenPath", QDir::homePath() ).toString();
|
||||
|
||||
QVariant value = appSettings.value( "MainWindow/RecentFileList" );
|
||||
m_aRecentFileStreamInfo = value.value<CalypFileInfoVector>();
|
||||
m_aRecentFileStreamInfo = value.value<PlaYUVerStreamInfoVector>();
|
||||
checkRecentFileActions();
|
||||
updateRecentFileActions();
|
||||
|
||||
@@ -949,7 +931,7 @@ void MainWindow::readSettings()
|
||||
m_pcWindowHandle->readSettings();
|
||||
}
|
||||
|
||||
void MainWindow::writeSettings()
|
||||
Void PlaYUVerApp::writeSettings()
|
||||
{
|
||||
QSettings appSettings;
|
||||
|
||||
@@ -958,7 +940,7 @@ void MainWindow::writeSettings()
|
||||
appSettings.setValue( "MainWindow/LastOpenPath", m_cLastOpenPath );
|
||||
|
||||
QVariant var;
|
||||
var.setValue<CalypFileInfoVector>( m_aRecentFileStreamInfo );
|
||||
var.setValue<PlaYUVerStreamInfoVector>( m_aRecentFileStreamInfo );
|
||||
appSettings.setValue( "MainWindow/RecentFileList", var );
|
||||
|
||||
m_appModuleVideo->writeSettings();
|
||||
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,14 +18,14 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file MainWindow.cpp
|
||||
* \brief Definition of the main window
|
||||
* \ingroup CalypApp
|
||||
* \file PlaYUVerApp.h
|
||||
* \ingroup PlaYUVerApp
|
||||
* \brief Main definition of the PlaYUVerApp app
|
||||
*
|
||||
* @defgroup CalypApp Calyp App (GUI)
|
||||
* @defgroup PlaYUVerApp PlaYUVer App (GUI)
|
||||
* @{
|
||||
*
|
||||
* CalypApp is an high level interface providing a GUI
|
||||
* PlaYUVerApp is an high level interface providing a GUI
|
||||
* based on the Qt libs in order to display provide important
|
||||
* information about video streams.
|
||||
*
|
||||
@@ -33,19 +33,18 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __MAINWINDOW_H__
|
||||
#define __MAINWINDOW_H__
|
||||
#ifndef __PLAYUVERAPP_H__
|
||||
#define __PLAYUVERAPP_H__
|
||||
|
||||
#include "CommonDefs.h"
|
||||
#include "VideoSubWindow.h"
|
||||
#include "PlaYUVerAppDefs.h"
|
||||
#include "config.h"
|
||||
#ifdef USE_QTDBUS
|
||||
#include "DBusAppAdaptor.h"
|
||||
#endif
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
#ifdef USE_QTDBUS
|
||||
#include "PlaYUVerAppAdaptor.h"
|
||||
#endif
|
||||
#include "VideoSubWindow.h"
|
||||
|
||||
class QCloseEvent;
|
||||
class QDragEnterEvent;
|
||||
@@ -55,32 +54,32 @@ class QActionGroup;
|
||||
class QAction;
|
||||
class QSignalMapper;
|
||||
|
||||
class CalypOptions;
|
||||
class CalypStream;
|
||||
class SubWindowHandle;
|
||||
class PlaYUVerOptions;
|
||||
class PlaYUVerStream;
|
||||
class PlaYUVerSubWindowHandle;
|
||||
class VideoHandle;
|
||||
class QualityHandle;
|
||||
class ModulesHandle;
|
||||
class DBusAppAdaptor;
|
||||
class PlaYUVerAppAdaptor;
|
||||
class VideoSubWindow;
|
||||
class SubWindowAbstract;
|
||||
class AboutDialog;
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
class PlaYUVerApp : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MainWindow();
|
||||
bool parseArgs( int argc, char* argv[] );
|
||||
void loadFile( QString fileName, CalypFileInfo* pStreamInfo = NULL );
|
||||
PlaYUVerApp();
|
||||
Bool parseArgs( Int argc, Char* argv[] );
|
||||
Void loadFile( QString fileName, PlaYUVerStreamInfo* pStreamInfo = NULL );
|
||||
|
||||
public Q_SLOTS:
|
||||
void printMessage( const QString& msg );
|
||||
void printMessage( const QString& msg, unsigned int logLevel );
|
||||
void printMessage( const QString& msg, UInt logLevel );
|
||||
|
||||
protected:
|
||||
void closeEvent( QCloseEvent* event );
|
||||
Void closeEvent( QCloseEvent* event );
|
||||
|
||||
private Q_SLOTS:
|
||||
|
||||
@@ -92,8 +91,7 @@ private Q_SLOTS:
|
||||
void open();
|
||||
// void openDevice();
|
||||
void openRecent();
|
||||
void saveFrame();
|
||||
void saveStream();
|
||||
void save();
|
||||
void format();
|
||||
void reload();
|
||||
void reloadAll();
|
||||
@@ -118,8 +116,8 @@ private Q_SLOTS:
|
||||
void updateZoomFactorSBox();
|
||||
|
||||
private:
|
||||
DBusAppAdaptor* m_pDBusAdaptor;
|
||||
CalypOptions* m_pcCmdParser;
|
||||
PlaYUVerAppAdaptor* m_pDBusAdaptor;
|
||||
PlaYUVerOptions* m_pcCmdParser;
|
||||
/**
|
||||
* Save the current subwindow for every category
|
||||
*/
|
||||
@@ -127,25 +125,24 @@ private:
|
||||
VideoSubWindow* m_pcCurrentVideoSubWindow;
|
||||
|
||||
QString m_cLastOpenPath;
|
||||
QStringList showFileDialog( bool bRead );
|
||||
|
||||
static VideoSubWindow* findVideoStreamSubWindow( const SubWindowHandle* windowManager,
|
||||
static VideoSubWindow* findVideoStreamSubWindow( const PlaYUVerSubWindowHandle* windowManager,
|
||||
const QString& fileName );
|
||||
|
||||
void updateMenus();
|
||||
Void updateMenus();
|
||||
|
||||
void createActions();
|
||||
void createMenus();
|
||||
void createToolBars();
|
||||
void createDockWidgets();
|
||||
void createStatusBar();
|
||||
Void createActions();
|
||||
Void createMenus();
|
||||
Void createToolBars();
|
||||
Void createDockWidgets();
|
||||
Void createStatusBar();
|
||||
|
||||
void addStreamInfoToRecentList( CalypFileInfo streamInfo );
|
||||
void updateRecentFileActions();
|
||||
void checkRecentFileActions();
|
||||
Void addStreamInfoToRecentList( PlaYUVerStreamInfo streamInfo );
|
||||
Void updateRecentFileActions();
|
||||
Void checkRecentFileActions();
|
||||
|
||||
void readSettings();
|
||||
void writeSettings();
|
||||
Void readSettings();
|
||||
Void writeSettings();
|
||||
|
||||
QDoubleSpinBox* m_pcZoomFactorSBox;
|
||||
|
||||
@@ -161,7 +158,7 @@ private:
|
||||
VideoHandle* m_appModuleVideo;
|
||||
QualityHandle* m_appModuleQuality;
|
||||
ModulesHandle* m_appModuleExtensions;
|
||||
SubWindowHandle* m_pcWindowHandle;
|
||||
PlaYUVerSubWindowHandle* m_pcWindowHandle;
|
||||
|
||||
/**
|
||||
* Array of menus for the main app
|
||||
@@ -213,7 +210,6 @@ private:
|
||||
OPEN_ACT = 0,
|
||||
OPEN_DEVICE_ACT,
|
||||
SAVE_ACT,
|
||||
SAVE_STREAM_ACT,
|
||||
FORMAT_ACT,
|
||||
RELOAD_ACT,
|
||||
RELOAD_ALL_ACT,
|
||||
@@ -235,9 +231,9 @@ private:
|
||||
|
||||
#define MAX_RECENT_FILES 20
|
||||
QVector<QAction*> m_arrayRecentFilesActions;
|
||||
CalypFileInfoVector m_aRecentFileStreamInfo;
|
||||
PlaYUVerStreamInfoVector m_aRecentFileStreamInfo;
|
||||
|
||||
AboutDialog* m_pcAboutDialog;
|
||||
};
|
||||
|
||||
#endif // __MAINWINDOW_H__
|
||||
#endif // __PLAYUVERAPP_H__
|
||||
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,35 +18,30 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file DBusAppAdaptor.cpp
|
||||
* \file PlaYUVerAppAdaptor.h
|
||||
* \brief Define function to manage the interface in DBus
|
||||
*/
|
||||
|
||||
#include "DBusAppAdaptor.h"
|
||||
#include "PlaYUVerAppAdaptor.h"
|
||||
#include "PlaYUVerApp.h"
|
||||
#include <QDBusAbstractAdaptor>
|
||||
|
||||
#include "MainWindow.h"
|
||||
|
||||
//#include <QDBusConnectioninterface>
|
||||
//#include <QDBusinterface>
|
||||
#include <QDBusMessage>
|
||||
#include <QDBusReply>
|
||||
|
||||
DBusAppAdaptor::DBusAppAdaptor( MainWindow* app )
|
||||
PlaYUVerAppAdaptor::PlaYUVerAppAdaptor( PlaYUVerApp* app )
|
||||
: QDBusAbstractAdaptor( app ), m_app( app )
|
||||
{
|
||||
// application dbus interface
|
||||
bool isRegistered = QDBusConnection::sessionBus().registerObject( QStringLiteral( CALYP_DBUS_PATH ), QStringLiteral( CALYP_DBUS_SESSION_NAME ),
|
||||
this, QDBusConnection::ExportAllSlots );
|
||||
Bool isRegistered = QDBusConnection::sessionBus().registerObject(
|
||||
QStringLiteral( PLAYUVER_DBUS_PATH ), this, QDBusConnection::ExportAllSlots );
|
||||
|
||||
Q_ASSERT( isRegistered == true );
|
||||
}
|
||||
|
||||
DBusAppAdaptor::~DBusAppAdaptor()
|
||||
PlaYUVerAppAdaptor::~PlaYUVerAppAdaptor()
|
||||
{
|
||||
QDBusConnection::sessionBus().unregisterObject( QStringLiteral( CALYP_DBUS_PATH ) );
|
||||
QDBusConnection::sessionBus().unregisterObject( QStringLiteral( PLAYUVER_DBUS_PATH ) );
|
||||
}
|
||||
|
||||
void DBusAppAdaptor::activate()
|
||||
void PlaYUVerAppAdaptor::activate()
|
||||
{
|
||||
if( !m_app )
|
||||
{
|
||||
@@ -55,13 +50,13 @@ void DBusAppAdaptor::activate()
|
||||
m_app->raise();
|
||||
}
|
||||
|
||||
QString DBusAppAdaptor::activeSession()
|
||||
QString PlaYUVerAppAdaptor::activeSession()
|
||||
{
|
||||
// return m_app->sessionManager()->activeSession()->name();
|
||||
return QString( "Calyp" );
|
||||
return QString( "PlaYUVer" );
|
||||
}
|
||||
|
||||
bool DBusAppAdaptor::loadFile( const QString& filename )
|
||||
bool PlaYUVerAppAdaptor::loadFile( const QString& filename )
|
||||
{
|
||||
m_app->loadFile( filename );
|
||||
return true;
|
||||
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,31 +18,33 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file DBusAppAdaptor.h
|
||||
* \file PlaYUVerAppAdaptor.h
|
||||
* \brief Define function to manage the interface in DBus
|
||||
*/
|
||||
|
||||
#ifndef __DBUSAPPADAPTOR_H__
|
||||
#define __DBUSAPPADAPTOR_H__
|
||||
#ifndef __PlaYUVerAppAdaptor_H__
|
||||
#define __PlaYUVerAppAdaptor_H__
|
||||
|
||||
#include <QDBusAbstractAdaptor>
|
||||
#include <QDBusConnectionInterface>
|
||||
#include <QDBusInterface>
|
||||
#include <QDBusMessage>
|
||||
#include <QDBusReply>
|
||||
#include <QtCore>
|
||||
#include <QtDBus>
|
||||
|
||||
#define CALYP_DBUS_SESSION_NAME "org.pixlra.Calyp.application"
|
||||
#define CALYP_DBUS_PATH "/"
|
||||
#define PLAYUVER_DBUS_SESSION_NAME "org.pixlra.PlaYUVer.application"
|
||||
#define PLAYUVER_DBUS_PATH "/"
|
||||
|
||||
class MainWindow;
|
||||
class PlaYUVerApp;
|
||||
|
||||
class DBusAppAdaptor : public QDBusAbstractAdaptor
|
||||
class PlaYUVerAppAdaptor : public QDBusAbstractAdaptor
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_CLASSINFO( "D-Bus interface", CALYP_DBUS_SESSION_NAME )
|
||||
Q_CLASSINFO( "D-Bus Interface", PLAYUVER_DBUS_SESSION_NAME )
|
||||
Q_PROPERTY( QString activeSession READ activeSession )
|
||||
public:
|
||||
DBusAppAdaptor( MainWindow* app );
|
||||
~DBusAppAdaptor();
|
||||
PlaYUVerAppAdaptor( PlaYUVerApp* app );
|
||||
~PlaYUVerAppAdaptor();
|
||||
/**
|
||||
* emit the exiting signal
|
||||
*/
|
||||
@@ -75,7 +77,7 @@ public:
|
||||
QString activeSession();
|
||||
|
||||
private:
|
||||
MainWindow* m_app;
|
||||
PlaYUVerApp* m_app;
|
||||
};
|
||||
|
||||
#endif // __DBUSAPPADAPTOR_H__
|
||||
#endif // __PlaYUVerAppAdaptor_H__
|
||||
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,14 +18,14 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file CommonDefs.h
|
||||
* \brief Define common types
|
||||
* \file PlaYUVerAppDefs.h
|
||||
* \brief Define types for PlaYUVerApp
|
||||
*/
|
||||
|
||||
#ifndef __COMMONDEFS_H__
|
||||
#define __COMMONDEFS_H__
|
||||
#ifndef __PLAYUVERAPPDEFS_H__
|
||||
#define __PLAYUVERAPPDEFS_H__
|
||||
|
||||
#include "lib/CalypDefs.h"
|
||||
#include "lib/PlaYUVerDefs.h"
|
||||
|
||||
// ====================================================================================================================
|
||||
// Qt compatibility redefinition
|
||||
@@ -38,4 +38,4 @@
|
||||
#define QStringLiteral( str ) QString::fromUtf8( "" str "", sizeof( str ) - 1 )
|
||||
#endif
|
||||
|
||||
#endif // __COMMONDEFS_H__
|
||||
#endif // __PLAYUVERAPPDEFS_H__
|
||||
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,19 +18,17 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file CalypAppModuleIf.cpp
|
||||
* \brief Calyp modules interface
|
||||
* \file PlaYUVerAppModuleIf.cpp
|
||||
* \brief PlaYUVer modules interface
|
||||
*/
|
||||
|
||||
#include "CalypAppModuleIf.h"
|
||||
|
||||
#include "PlaYUVerAppModuleIf.h"
|
||||
#include "VideoSubWindow.h"
|
||||
#include "VideoSubWindow.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QApplication>
|
||||
#include <QDockWidget>
|
||||
|
||||
CalypAppModuleIf::CalypAppModuleIf( QObject* parent, QAction* action, CalypModuleIf* module )
|
||||
PlaYUVerAppModuleIf::PlaYUVerAppModuleIf( QObject* parent,
|
||||
QAction* action,
|
||||
PlaYUVerModuleIf* module )
|
||||
: m_bIsRunning( false )
|
||||
, m_pcModuleAction( action )
|
||||
, m_pcModule( module )
|
||||
@@ -42,17 +40,17 @@ CalypAppModuleIf::CalypAppModuleIf( QObject* parent, QAction* action, CalypModul
|
||||
, m_dMeasurementResult( 0 )
|
||||
{
|
||||
setParent( parent );
|
||||
for( int i = 0; i < CLP_MODULE_MAX_NUM_FRAMES; i++ )
|
||||
for( Int i = 0; i < MODULE_REQUIRES_MAX_NUM_FRAMES; i++ )
|
||||
{
|
||||
m_pcSubWindow[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void CalypAppModuleIf::update()
|
||||
Void PlaYUVerAppModuleIf::update()
|
||||
{
|
||||
if( m_pcDisplaySubWindow )
|
||||
{
|
||||
m_pcDisplaySubWindow->refreshFrame();
|
||||
m_pcDisplaySubWindow->refreshFrame( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -60,21 +58,12 @@ void CalypAppModuleIf::update()
|
||||
}
|
||||
}
|
||||
|
||||
bool CalypAppModuleIf::isRunning()
|
||||
Bool PlaYUVerAppModuleIf::apply( Bool isPlaying, Bool disableThreads )
|
||||
{
|
||||
#ifdef CALYP_THREADED_MODULES
|
||||
return QThread::isRunning();
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool CalypAppModuleIf::apply( bool isPlaying, bool disableThreads )
|
||||
{
|
||||
bool bRet = false;
|
||||
Bool bRet = false;
|
||||
|
||||
QApplication::setOverrideCursor( Qt::WaitCursor );
|
||||
if( m_pcModule->m_iModuleType == CLP_FRAME_PROCESSING_MODULE )
|
||||
if( m_pcModule->m_iModuleType == FRAME_PROCESSING_MODULE )
|
||||
{
|
||||
if( m_pcDisplaySubWindow )
|
||||
{
|
||||
@@ -85,9 +74,9 @@ bool CalypAppModuleIf::apply( bool isPlaying, bool disableThreads )
|
||||
m_pcSubWindow[0]->setFillWindow( true );
|
||||
}
|
||||
}
|
||||
if( !( isPlaying && ( m_pcModule->m_uiModuleRequirements & CLP_MODULE_REQUIRES_SKIP_WHILE_PLAY ) ) )
|
||||
if( !( isPlaying && ( m_pcModule->m_uiModuleRequirements & MODULE_REQUIRES_SKIP_WHILE_PLAY ) ) )
|
||||
{
|
||||
#ifdef CALYP_THREADED_MODULES
|
||||
#ifdef PLAYUVER_THREADED_MODULES
|
||||
if( !disableThreads )
|
||||
{
|
||||
wait();
|
||||
@@ -100,7 +89,7 @@ bool CalypAppModuleIf::apply( bool isPlaying, bool disableThreads )
|
||||
show();
|
||||
}
|
||||
|
||||
if( m_pcDisplaySubWindow || m_pcModule->m_iModuleType == CLP_FRAME_MEASUREMENT_MODULE )
|
||||
if( m_pcDisplaySubWindow || m_pcModule->m_iModuleType == FRAME_MEASUREMENT_MODULE )
|
||||
{
|
||||
bRet = true;
|
||||
}
|
||||
@@ -113,19 +102,19 @@ bool CalypAppModuleIf::apply( bool isPlaying, bool disableThreads )
|
||||
return bRet;
|
||||
}
|
||||
|
||||
void CalypAppModuleIf::run()
|
||||
Void PlaYUVerAppModuleIf::run()
|
||||
{
|
||||
m_bIsRunning = true;
|
||||
m_bSuccess = false;
|
||||
std::vector<CalypFrame*> apcFrameList;
|
||||
for( unsigned int i = 0; i < m_pcModule->m_uiNumberOfFrames; i++ )
|
||||
std::vector<PlaYUVerFrame*> apcFrameList;
|
||||
for( UInt i = 0; i < m_pcModule->m_uiNumberOfFrames; i++ )
|
||||
{
|
||||
apcFrameList.push_back( m_pcSubWindow[i]->getCurrFrame() );
|
||||
}
|
||||
|
||||
if( m_pcModule->m_iModuleType == CLP_FRAME_PROCESSING_MODULE )
|
||||
if( m_pcModule->m_iModuleType == FRAME_PROCESSING_MODULE )
|
||||
{
|
||||
if( m_pcModule->m_iModuleAPI >= CLP_MODULE_API_2 )
|
||||
if( m_pcModule->m_iModuleAPI == MODULE_API_2 )
|
||||
{
|
||||
m_pcProcessedFrame = m_pcModule->process( apcFrameList );
|
||||
}
|
||||
@@ -134,9 +123,9 @@ void CalypAppModuleIf::run()
|
||||
m_pcProcessedFrame = m_pcModule->process( m_pcSubWindow[0]->getCurrFrame() );
|
||||
}
|
||||
}
|
||||
else if( m_pcModule->m_iModuleType == CLP_FRAME_MEASUREMENT_MODULE )
|
||||
else if( m_pcModule->m_iModuleType == FRAME_MEASUREMENT_MODULE )
|
||||
{
|
||||
if( m_pcModule->m_iModuleAPI >= CLP_MODULE_API_2 )
|
||||
if( m_pcModule->m_iModuleAPI == MODULE_API_2 )
|
||||
{
|
||||
m_dMeasurementResult = m_pcModule->measure( apcFrameList );
|
||||
}
|
||||
@@ -151,7 +140,7 @@ void CalypAppModuleIf::run()
|
||||
}
|
||||
m_bSuccess = true;
|
||||
m_bIsRunning = false;
|
||||
#ifdef CALYP_THREADED_MODULES
|
||||
#ifdef PLAYUVER_THREADED_MODULES
|
||||
EventData* eventData = new EventData( m_bSuccess, this );
|
||||
if( parent() )
|
||||
QCoreApplication::postEvent( parent(), eventData );
|
||||
@@ -159,11 +148,11 @@ void CalypAppModuleIf::run()
|
||||
return;
|
||||
}
|
||||
|
||||
void CalypAppModuleIf::show()
|
||||
Void PlaYUVerAppModuleIf::show()
|
||||
{
|
||||
switch( m_pcModule->m_iModuleType )
|
||||
{
|
||||
case CLP_FRAME_PROCESSING_MODULE:
|
||||
case FRAME_PROCESSING_MODULE:
|
||||
if( m_pcDisplaySubWindow )
|
||||
{
|
||||
m_pcDisplaySubWindow->setCurrFrame( m_pcProcessedFrame );
|
||||
@@ -177,13 +166,13 @@ void CalypAppModuleIf::show()
|
||||
m_pcSubWindow[0]->clearWindowBusy();
|
||||
}
|
||||
break;
|
||||
case CLP_FRAME_MEASUREMENT_MODULE:
|
||||
case FRAME_MEASUREMENT_MODULE:
|
||||
m_pcModuleDock->setModulueReturnValue( m_dMeasurementResult );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CalypAppModuleIf::destroy()
|
||||
Void PlaYUVerAppModuleIf::destroy()
|
||||
{
|
||||
if( m_bIsRunning )
|
||||
{
|
||||
@@ -207,7 +196,7 @@ void CalypAppModuleIf::destroy()
|
||||
m_pcDisplaySubWindow->closeSubWindow();
|
||||
m_pcDisplaySubWindow = NULL;
|
||||
|
||||
for( int i = 0; i < CLP_MODULE_MAX_NUM_FRAMES; i++ )
|
||||
for( Int i = 0; i < MODULE_REQUIRES_MAX_NUM_FRAMES; i++ )
|
||||
{
|
||||
if( m_pcSubWindow[i] )
|
||||
{
|
||||
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,34 +18,31 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file CalypAppModuleIf.h
|
||||
* \brief Calyp App modules interface
|
||||
* \file PlaYUVerAppModuleIf.h
|
||||
* \brief PlaYUVer App modules interface
|
||||
*/
|
||||
|
||||
#ifndef __CALYPAPPMODULESIF_H__
|
||||
#define __CALYPAPPMODULESIF_H__
|
||||
#ifndef __PLAYUVERAPPMODULESIF_H__
|
||||
#define __PLAYUVERAPPMODULESIF_H__
|
||||
|
||||
#include "CommonDefs.h"
|
||||
#include "ModuleHandleDock.h"
|
||||
#include "PlaYUVerAppDefs.h"
|
||||
#include "config.h"
|
||||
#include "lib/CalypFrame.h"
|
||||
#include "lib/CalypModuleIf.h"
|
||||
#include "lib/CalypStream.h"
|
||||
|
||||
#include <QEvent>
|
||||
#include "lib/PlaYUVerFrame.h"
|
||||
#include "lib/PlaYUVerModuleIf.h"
|
||||
#include "lib/PlaYUVerStream.h"
|
||||
#include <QVector>
|
||||
#include <cstdio>
|
||||
#include <iostream>
|
||||
|
||||
class QAction;
|
||||
class QDockWidget;
|
||||
|
||||
#define CLP_MODULE_MAX_NUM_FRAMES 5
|
||||
//#define PLAYUVER_THREADED_MODULES
|
||||
|
||||
class VideoSubWindow;
|
||||
|
||||
class CalypAppModuleIf
|
||||
#ifdef CALYP_THREADED_MODULES
|
||||
class PlaYUVerAppModuleIf
|
||||
#ifdef PLAYUVER_THREADED_MODULES
|
||||
: public QThread
|
||||
#else
|
||||
: public QObject
|
||||
@@ -56,59 +53,56 @@ class CalypAppModuleIf
|
||||
friend class ModulesHandleOptDialog;
|
||||
|
||||
private:
|
||||
bool m_bIsRunning;
|
||||
bool m_bSuccess;
|
||||
Bool m_bIsRunning;
|
||||
Bool m_bSuccess;
|
||||
|
||||
QAction* m_pcModuleAction;
|
||||
CalypModuleIf* m_pcModule;
|
||||
PlaYUVerModuleIf* m_pcModule;
|
||||
|
||||
VideoSubWindow* m_pcSubWindow[CLP_MODULE_MAX_NUM_FRAMES];
|
||||
VideoSubWindow* m_pcSubWindow[MODULE_REQUIRES_MAX_NUM_FRAMES];
|
||||
|
||||
VideoSubWindow* m_pcDisplaySubWindow;
|
||||
|
||||
QDockWidget* m_pcDockWidget;
|
||||
ModuleHandleDock* m_pcModuleDock;
|
||||
|
||||
CalypStream* m_pcModuleStream;
|
||||
CalypFrame* m_pcProcessedFrame;
|
||||
double m_dMeasurementResult;
|
||||
PlaYUVerStream* m_pcModuleStream;
|
||||
PlaYUVerFrame* m_pcProcessedFrame;
|
||||
Double m_dMeasurementResult;
|
||||
|
||||
public:
|
||||
class EventData : public QEvent
|
||||
{
|
||||
public:
|
||||
EventData( bool success, CalypAppModuleIf* module )
|
||||
: QEvent( QEvent::User )
|
||||
EventData( bool success, PlaYUVerAppModuleIf* module ) : QEvent( QEvent::User )
|
||||
{
|
||||
m_bSuccess = success;
|
||||
m_pcModule = module;
|
||||
}
|
||||
bool m_bSuccess;
|
||||
CalypAppModuleIf* m_pcModule;
|
||||
Bool m_bSuccess;
|
||||
PlaYUVerAppModuleIf* m_pcModule;
|
||||
};
|
||||
|
||||
CalypAppModuleIf( QObject* parent, QAction* action, CalypModuleIf* module );
|
||||
virtual ~CalypAppModuleIf() {}
|
||||
PlaYUVerAppModuleIf( QObject* parent, QAction* action, PlaYUVerModuleIf* module );
|
||||
virtual ~PlaYUVerAppModuleIf() {}
|
||||
QList<VideoSubWindow*> getSubWindowList()
|
||||
{
|
||||
QList<VideoSubWindow*> arraySubWindows;
|
||||
for( int i = 0; i < CLP_MODULE_MAX_NUM_FRAMES; i++ )
|
||||
for( Int i = 0; i < MODULE_REQUIRES_MAX_NUM_FRAMES; i++ )
|
||||
if( m_pcSubWindow[i] )
|
||||
arraySubWindows.append( m_pcSubWindow[i] );
|
||||
return arraySubWindows;
|
||||
}
|
||||
|
||||
CalypModuleIf* getModule() { return m_pcModule; }
|
||||
unsigned int getModuleRequirements() { return m_pcModule->m_uiModuleRequirements; }
|
||||
ClpString moduleInfo() { return m_pcModule->moduleInfo(); }
|
||||
void update();
|
||||
bool apply( bool isPlaying = false, bool disableThreads = false );
|
||||
bool isRunning();
|
||||
void show();
|
||||
void destroy();
|
||||
PlaYUVerModuleIf* getModule() { return m_pcModule; }
|
||||
UInt getModuleRequirements() { return m_pcModule->m_uiModuleRequirements; }
|
||||
Void update();
|
||||
Bool apply( Bool isPlaying = false, Bool disableThreads = false );
|
||||
Void show();
|
||||
Void destroy();
|
||||
|
||||
protected:
|
||||
virtual void run();
|
||||
};
|
||||
|
||||
#endif // __CALYPAPPMODULESIF_H__
|
||||
#endif // __PLAYUVERAPPMODULESIF_H__
|
||||
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,24 +18,21 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file MdiSubWindow.cpp
|
||||
* \file PlaYUVerMdiSubWindow.cpp
|
||||
* \brief Re-implementation QMdiSubWindow
|
||||
*/
|
||||
|
||||
#include "MdiSubWindow.h"
|
||||
|
||||
#include "PlaYUVerMdiSubWindow.h"
|
||||
#include "SubWindowAbstract.h"
|
||||
|
||||
#include <QCloseEvent>
|
||||
|
||||
MdiSubWindow::MdiSubWindow( QWidget* parent )
|
||||
: QMdiSubWindow( parent )
|
||||
PlaYUVerMdiSubWindow::PlaYUVerMdiSubWindow( QWidget* parent ) : QMdiSubWindow( parent )
|
||||
{
|
||||
setAttribute( Qt::WA_DeleteOnClose );
|
||||
setBackgroundRole( QPalette::Background );
|
||||
}
|
||||
|
||||
QSize MdiSubWindow::sizeHint() const
|
||||
QSize PlaYUVerMdiSubWindow::sizeHint() const
|
||||
{
|
||||
QSize maxSize;
|
||||
if( parent() )
|
||||
@@ -44,7 +41,7 @@ QSize MdiSubWindow::sizeHint() const
|
||||
return sizeHint;
|
||||
}
|
||||
|
||||
void MdiSubWindow::closeEvent( QCloseEvent* event )
|
||||
Void PlaYUVerMdiSubWindow::closeEvent( QCloseEvent* event )
|
||||
{
|
||||
emit aboutToClose( this );
|
||||
event->accept();
|
||||
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,30 +18,30 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file MdiSubWindow.h
|
||||
* \file PlaYUVerMdiSubWindow.h
|
||||
* \brief Re-implementation QMdiSubWindow
|
||||
*/
|
||||
|
||||
#ifndef __MDISUBWINDOW_H_
|
||||
#define __MDISUBWINDOW_H_
|
||||
#ifndef __PLAYUVERMDISUBWINDOW_H__
|
||||
#define __PLAYUVERMDISUBWINDOW_H__
|
||||
|
||||
#include <QMdiSubWindow>
|
||||
#include "CommonDefs.h"
|
||||
#include "PlaYUVerAppDefs.h"
|
||||
#include "config.h"
|
||||
#include <QMdiSubWindow>
|
||||
|
||||
class MdiSubWindow : public QMdiSubWindow
|
||||
class PlaYUVerMdiSubWindow : public QMdiSubWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MdiSubWindow( QWidget* parent = 0 );
|
||||
PlaYUVerMdiSubWindow( QWidget* parent = 0 );
|
||||
|
||||
Q_SIGNALS:
|
||||
void aboutToClose( MdiSubWindow* );
|
||||
void aboutToClose( PlaYUVerMdiSubWindow* );
|
||||
|
||||
protected:
|
||||
QSize sizeHint() const;
|
||||
void closeEvent( QCloseEvent* event );
|
||||
};
|
||||
|
||||
#endif // __MDISUBWINDOW_H_
|
||||
#endif // __PLAYUVERMDISUBWINDOW_H__
|
||||
@@ -1,7 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Santos (joaompssantos@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -19,16 +18,10 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file SubWindowHandle.cpp
|
||||
* \file PlaYUVerSubWindowHandle.cpp
|
||||
* \brief Handle multiple sub-windows
|
||||
*/
|
||||
|
||||
#include "SubWindowHandle.h"
|
||||
|
||||
#include "MainWindow.h"
|
||||
#include "MdiSubWindow.h"
|
||||
#include "SubWindowAbstract.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QActionGroup>
|
||||
#include <QApplication>
|
||||
@@ -41,16 +34,22 @@
|
||||
#include <QSignalMapper>
|
||||
#include <QStyle>
|
||||
|
||||
class MdiArea : public QMdiArea
|
||||
#include "PlaYUVerSubWindowHandle.h"
|
||||
|
||||
#include "PlaYUVerApp.h"
|
||||
#include "PlaYUVerMdiSubWindow.h"
|
||||
#include "SubWindowAbstract.h"
|
||||
|
||||
class PlaYUVerMdiArea : public QMdiArea
|
||||
{
|
||||
public:
|
||||
MdiArea( QWidget* parent = 0 )
|
||||
: QMdiArea( parent ), m_pixmapLogo( ":/logos/calyp-logo.png" )
|
||||
PlaYUVerMdiArea( QWidget* parent = 0 )
|
||||
: QMdiArea( parent ), m_pixmapLogo( ":/images/playuver-backgroud-logo.png" )
|
||||
{
|
||||
setBackgroundRole( QPalette::Background );
|
||||
}
|
||||
|
||||
void appendLogMessage( const QString& msg )
|
||||
Void appendLogMessage( const QString& msg )
|
||||
{
|
||||
m_acLogMessages.push_front( msg );
|
||||
if( m_acLogMessages.size() > 5 )
|
||||
@@ -63,13 +62,13 @@ protected:
|
||||
{
|
||||
QMdiArea::paintEvent( event );
|
||||
QPainter painter( viewport() );
|
||||
QPixmap pixFinalLogo = m_pixmapLogo.scaled( 2 * size() / 5, Qt::KeepAspectRatio );
|
||||
QPixmap pixFinalLogo = m_pixmapLogo.scaled( 2 * size() / 3, Qt::KeepAspectRatio );
|
||||
// Calculate the logo position - the bottom right corner of the mdi area.
|
||||
int x = width() / 2 - pixFinalLogo.width() / 2;
|
||||
int y = height() / 2 - pixFinalLogo.height() / 2;
|
||||
painter.drawPixmap( x, y, pixFinalLogo );
|
||||
|
||||
// for( int i = 0; i < m_acLogMessages.size(); i++ )
|
||||
// for( Int i = 0; i < m_acLogMessages.size(); i++ )
|
||||
// {
|
||||
// painter.drawText( 5, height() - 5 - i * 15, m_acLogMessages.at( i )
|
||||
// );
|
||||
@@ -82,8 +81,7 @@ private:
|
||||
QPixmap m_pixmapLogo;
|
||||
};
|
||||
|
||||
SubWindowHandle::SubWindowHandle( QWidget* parent )
|
||||
: QWidget( parent )
|
||||
PlaYUVerSubWindowHandle::PlaYUVerSubWindowHandle( QWidget* parent ) : QWidget( parent )
|
||||
{
|
||||
m_iWindowMode = -1;
|
||||
m_pcWindowManagerLayout = NULL;
|
||||
@@ -92,12 +90,12 @@ SubWindowHandle::SubWindowHandle( QWidget* parent )
|
||||
m_apcSubWindowList.clear();
|
||||
m_apcMdiSubWindowList.clear();
|
||||
|
||||
m_pcApp = qobject_cast<MainWindow*>( parentWidget() );
|
||||
m_pcApp = qobject_cast<PlaYUVerApp*>( parentWidget() );
|
||||
// setWindowMode( DETACHEDSUBWINDOWMODE );
|
||||
setWindowMode( MDISUBWINDOWMODE );
|
||||
}
|
||||
|
||||
void SubWindowHandle::processLogMsg( const QString& msg )
|
||||
Void PlaYUVerSubWindowHandle::processLogMsg( const QString& msg )
|
||||
{
|
||||
if( m_pcMdiArea )
|
||||
{
|
||||
@@ -105,7 +103,7 @@ void SubWindowHandle::processLogMsg( const QString& msg )
|
||||
}
|
||||
}
|
||||
|
||||
void SubWindowHandle::resetWindowMode()
|
||||
Void PlaYUVerSubWindowHandle::resetWindowMode()
|
||||
{
|
||||
QList<SubWindowAbstract*> apcSubWindowList = m_apcSubWindowList;
|
||||
|
||||
@@ -116,14 +114,14 @@ void SubWindowHandle::resetWindowMode()
|
||||
{
|
||||
m_cMdiModeWindowPosition = m_pcApp->pos();
|
||||
m_cMdiModeWindowSize = m_pcApp->size();
|
||||
for( int i = 0; i < m_apcSubWindowList.size(); i++ )
|
||||
for( Int i = 0; i < m_apcSubWindowList.size(); i++ )
|
||||
{
|
||||
m_apcSubWindowList.at( i )->setParent( NULL );
|
||||
}
|
||||
for( int i = 0; i < m_apcMdiSubWindowList.size(); i++ )
|
||||
for( Int i = 0; i < m_apcMdiSubWindowList.size(); i++ )
|
||||
{
|
||||
disconnect( m_apcMdiSubWindowList.at( i ), SIGNAL( aboutToClose( MdiSubWindow* ) ), this,
|
||||
SLOT( removeMdiSubWindow( MdiSubWindow* ) ) );
|
||||
disconnect( m_apcMdiSubWindowList.at( i ), SIGNAL( aboutToClose( PlaYUVerMdiSubWindow* ) ),
|
||||
this, SLOT( removeMdiSubWindow( PlaYUVerMdiSubWindow* ) ) );
|
||||
m_apcMdiSubWindowList.at( i )->close();
|
||||
}
|
||||
m_apcMdiSubWindowList.clear();
|
||||
@@ -135,7 +133,7 @@ void SubWindowHandle::resetWindowMode()
|
||||
}
|
||||
}
|
||||
|
||||
void SubWindowHandle::setWindowMode( int iWindowMode )
|
||||
Void PlaYUVerSubWindowHandle::setWindowMode( Int iWindowMode )
|
||||
{
|
||||
if( m_iWindowMode == iWindowMode )
|
||||
return;
|
||||
@@ -144,7 +142,7 @@ void SubWindowHandle::setWindowMode( int iWindowMode )
|
||||
|
||||
if( iWindowMode == DETACHEDSUBWINDOWMODE )
|
||||
{
|
||||
for( int i = 0; i < m_apcSubWindowList.size(); i++ )
|
||||
for( Int i = 0; i < m_apcSubWindowList.size(); i++ )
|
||||
{
|
||||
m_apcSubWindowList.at( i )->setParent( NULL );
|
||||
m_apcSubWindowList.at( i )->resize( m_apcSubWindowList.at( i )->sizeHint() );
|
||||
@@ -163,13 +161,14 @@ void SubWindowHandle::setWindowMode( int iWindowMode )
|
||||
if( iWindowMode == MDISUBWINDOWMODE )
|
||||
{
|
||||
setVisible( true );
|
||||
m_pcMdiArea = new MdiArea;
|
||||
m_pcMdiArea = new PlaYUVerMdiArea;
|
||||
m_pcMdiArea->setActivationOrder( QMdiArea::ActivationHistoryOrder );
|
||||
connect( m_pcMdiArea, SIGNAL( subWindowActivated( QMdiSubWindow* ) ), this, SLOT( updateActiveSubWindow() ) );
|
||||
connect( m_pcMdiArea, SIGNAL( subWindowActivated( QMdiSubWindow* ) ), this,
|
||||
SLOT( updateActiveSubWindow() ) );
|
||||
m_pcWindowManagerLayout = new QHBoxLayout( this );
|
||||
m_pcWindowManagerLayout->addWidget( m_pcMdiArea );
|
||||
setLayout( m_pcWindowManagerLayout );
|
||||
for( int i = 0; i < m_apcSubWindowList.size(); i++ )
|
||||
for( Int i = 0; i < m_apcSubWindowList.size(); i++ )
|
||||
{
|
||||
addMdiSubWindow( m_apcSubWindowList.at( i ) );
|
||||
m_apcSubWindowList.at( i )->resize( m_apcSubWindowList.at( i )->sizeHint() );
|
||||
@@ -178,7 +177,8 @@ void SubWindowHandle::setWindowMode( int iWindowMode )
|
||||
// m_pcApp->resize( m_cMdiModeWindowSize );
|
||||
if( m_pcActiveWindow )
|
||||
{
|
||||
m_pcApp->setWindowTitle( QApplication::applicationName() + " :: " + m_pcActiveWindow->getWindowName() );
|
||||
m_pcApp->setWindowTitle( QApplication::applicationName() +
|
||||
" :: " + m_pcActiveWindow->getWindowName() );
|
||||
}
|
||||
}
|
||||
m_iWindowMode = iWindowMode;
|
||||
@@ -187,7 +187,7 @@ void SubWindowHandle::setWindowMode( int iWindowMode )
|
||||
// qApp->processEvents();
|
||||
}
|
||||
|
||||
void SubWindowHandle::updateActiveSubWindow( SubWindowAbstract* window )
|
||||
Void PlaYUVerSubWindowHandle::updateActiveSubWindow( SubWindowAbstract* window )
|
||||
{
|
||||
if( m_iWindowMode == DETACHEDSUBWINDOWMODE )
|
||||
{
|
||||
@@ -205,7 +205,8 @@ void SubWindowHandle::updateActiveSubWindow( SubWindowAbstract* window )
|
||||
if( mdiSubWindow )
|
||||
{
|
||||
QWidget* activeWidget = m_pcMdiArea->activeSubWindow()->widget();
|
||||
int windowIdx = m_apcSubWindowList.indexOf( qobject_cast<SubWindowAbstract*>( activeWidget ) );
|
||||
Int windowIdx =
|
||||
m_apcSubWindowList.indexOf( qobject_cast<SubWindowAbstract*>( activeWidget ) );
|
||||
if( windowIdx >= 0 )
|
||||
{
|
||||
m_pcActiveWindow = m_apcSubWindowList.at( windowIdx );
|
||||
@@ -214,28 +215,31 @@ void SubWindowHandle::updateActiveSubWindow( SubWindowAbstract* window )
|
||||
}
|
||||
if( m_pcActiveWindow )
|
||||
{
|
||||
m_pcApp->setWindowTitle( QApplication::applicationName() + " :: " + m_pcActiveWindow->getWindowName() );
|
||||
m_pcApp->setWindowTitle( QApplication::applicationName() +
|
||||
" :: " + m_pcActiveWindow->getWindowName() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SubWindowHandle::addMdiSubWindow( SubWindowAbstract* window )
|
||||
Void PlaYUVerSubWindowHandle::addMdiSubWindow( SubWindowAbstract* window )
|
||||
{
|
||||
MdiSubWindow* mdiSubWindow = new MdiSubWindow;
|
||||
PlaYUVerMdiSubWindow* mdiSubWindow = new PlaYUVerMdiSubWindow;
|
||||
mdiSubWindow->setWidget( window );
|
||||
m_pcMdiArea->addSubWindow( mdiSubWindow );
|
||||
m_apcMdiSubWindowList.append( mdiSubWindow );
|
||||
window->setSubWindow( mdiSubWindow );
|
||||
connect( mdiSubWindow, SIGNAL( aboutToClose( MdiSubWindow* ) ), this,
|
||||
SLOT( removeMdiSubWindow( MdiSubWindow* ) ) );
|
||||
connect( mdiSubWindow, SIGNAL( aboutToClose( PlaYUVerMdiSubWindow* ) ), this,
|
||||
SLOT( removeMdiSubWindow( PlaYUVerMdiSubWindow* ) ) );
|
||||
}
|
||||
|
||||
void SubWindowHandle::addSubWindow( SubWindowAbstract* window, Qt::WindowFlags flags )
|
||||
Void PlaYUVerSubWindowHandle::addSubWindow( SubWindowAbstract* window, Qt::WindowFlags flags )
|
||||
{
|
||||
if( window )
|
||||
{
|
||||
connect( window, SIGNAL( updateStatusBar( const QString& ) ), m_pcApp, SLOT( printMessage( const QString& ) ) );
|
||||
connect( window, SIGNAL( zoomFactorChanged( const double, const QPoint ) ), m_pcApp, SLOT( updateZoomFactorSBox() ) );
|
||||
connect( window, SIGNAL( updateStatusBar( const QString& ) ), m_pcApp,
|
||||
SLOT( printMessage( const QString& ) ) );
|
||||
connect( window, SIGNAL( zoomFactorChanged_SWindow( const double, const QPoint ) ), m_pcApp,
|
||||
SLOT( updateZoomFactorSBox() ) );
|
||||
if( m_iWindowMode == DETACHEDSUBWINDOWMODE )
|
||||
{
|
||||
connect( window, SIGNAL( aboutToActivate( SubWindowAbstract* ) ), this,
|
||||
@@ -251,7 +255,7 @@ void SubWindowHandle::addSubWindow( SubWindowAbstract* window, Qt::WindowFlags f
|
||||
}
|
||||
}
|
||||
|
||||
void SubWindowHandle::removeSubWindow( int windowIdx )
|
||||
Void PlaYUVerSubWindowHandle::removeSubWindow( Int windowIdx )
|
||||
{
|
||||
if( windowIdx >= 0 )
|
||||
{
|
||||
@@ -263,7 +267,7 @@ void SubWindowHandle::removeSubWindow( int windowIdx )
|
||||
}
|
||||
if( m_iWindowMode == MDISUBWINDOWMODE )
|
||||
{
|
||||
MdiSubWindow* mdiSubWindow = m_apcMdiSubWindowList.at( windowIdx );
|
||||
PlaYUVerMdiSubWindow* mdiSubWindow = m_apcMdiSubWindowList.at( windowIdx );
|
||||
m_apcMdiSubWindowList.removeAt( windowIdx );
|
||||
m_pcMdiArea->removeSubWindow( m_apcSubWindowList.at( windowIdx ) );
|
||||
m_apcSubWindowList.at( windowIdx )->close();
|
||||
@@ -280,17 +284,17 @@ void SubWindowHandle::removeSubWindow( int windowIdx )
|
||||
}
|
||||
}
|
||||
|
||||
void SubWindowHandle::removeSubWindow( SubWindowAbstract* window )
|
||||
Void PlaYUVerSubWindowHandle::removeSubWindow( SubWindowAbstract* window )
|
||||
{
|
||||
removeSubWindow( m_apcSubWindowList.indexOf( window ) );
|
||||
}
|
||||
|
||||
void SubWindowHandle::removeMdiSubWindow( MdiSubWindow* window )
|
||||
Void PlaYUVerSubWindowHandle::removeMdiSubWindow( PlaYUVerMdiSubWindow* window )
|
||||
{
|
||||
removeSubWindow( m_apcMdiSubWindowList.indexOf( window ) );
|
||||
}
|
||||
|
||||
void SubWindowHandle::removeAllSubWindow()
|
||||
Void PlaYUVerSubWindowHandle::removeAllSubWindow()
|
||||
{
|
||||
while( m_apcSubWindowList.size() > 0 )
|
||||
{
|
||||
@@ -298,17 +302,17 @@ void SubWindowHandle::removeAllSubWindow()
|
||||
}
|
||||
}
|
||||
|
||||
void SubWindowHandle::removeActiveSubWindow()
|
||||
Void PlaYUVerSubWindowHandle::removeActiveSubWindow()
|
||||
{
|
||||
removeSubWindow( m_pcActiveWindow );
|
||||
}
|
||||
|
||||
SubWindowAbstract* SubWindowHandle::activeSubWindow() const
|
||||
SubWindowAbstract* PlaYUVerSubWindowHandle::activeSubWindow() const
|
||||
{
|
||||
return m_pcActiveWindow;
|
||||
}
|
||||
|
||||
QList<SubWindowAbstract*> SubWindowHandle::findSubWindow( const unsigned int uiCategory ) const
|
||||
QList<SubWindowAbstract*> PlaYUVerSubWindowHandle::findSubWindow( const UInt uiCategory ) const
|
||||
{
|
||||
QList<SubWindowAbstract*> apcSubWindowList;
|
||||
if( uiCategory == 0 )
|
||||
@@ -317,7 +321,7 @@ QList<SubWindowAbstract*> SubWindowHandle::findSubWindow( const unsigned int uiC
|
||||
}
|
||||
else
|
||||
{
|
||||
for( int i = 0; i < m_apcSubWindowList.size(); i++ )
|
||||
for( Int i = 0; i < m_apcSubWindowList.size(); i++ )
|
||||
{
|
||||
if( m_apcSubWindowList.at( i )->getCategory() & uiCategory )
|
||||
apcSubWindowList.append( m_apcSubWindowList.at( i ) );
|
||||
@@ -326,14 +330,14 @@ QList<SubWindowAbstract*> SubWindowHandle::findSubWindow( const unsigned int uiC
|
||||
return apcSubWindowList;
|
||||
}
|
||||
|
||||
QList<SubWindowAbstract*> SubWindowHandle::findSubWindow( const QString& windowName,
|
||||
const unsigned int uiCategory ) const
|
||||
QList<SubWindowAbstract*> PlaYUVerSubWindowHandle::findSubWindow( const QString& windowName,
|
||||
const UInt uiCategory ) const
|
||||
{
|
||||
QList<SubWindowAbstract*> subWindowList = findSubWindow( uiCategory );
|
||||
QList<SubWindowAbstract*> apcSubWindowList;
|
||||
if( !windowName.isEmpty() )
|
||||
{
|
||||
for( int i = 0; i < subWindowList.size(); i++ )
|
||||
for( Int i = 0; i < subWindowList.size(); i++ )
|
||||
{
|
||||
if( subWindowList.at( i )->getWindowName() == windowName )
|
||||
apcSubWindowList.append( subWindowList.at( i ) );
|
||||
@@ -342,10 +346,11 @@ QList<SubWindowAbstract*> SubWindowHandle::findSubWindow( const QString& windowN
|
||||
return apcSubWindowList;
|
||||
}
|
||||
|
||||
SubWindowAbstract* SubWindowHandle::findSubWindow( const SubWindowAbstract* subWindow ) const
|
||||
SubWindowAbstract* PlaYUVerSubWindowHandle::findSubWindow(
|
||||
const SubWindowAbstract* subWindow ) const
|
||||
{
|
||||
QList<SubWindowAbstract*> subWindowList = findSubWindow();
|
||||
for( int i = 0; i < subWindowList.size(); i++ )
|
||||
for( Int i = 0; i < subWindowList.size(); i++ )
|
||||
{
|
||||
if( subWindow == subWindowList.at( i ) )
|
||||
return subWindowList.at( i );
|
||||
@@ -353,7 +358,7 @@ SubWindowAbstract* SubWindowHandle::findSubWindow( const SubWindowAbstract* subW
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SubWindowHandle::setActiveSubWindow( QWidget* window )
|
||||
Void PlaYUVerSubWindowHandle::setActiveSubWindow( QWidget* window )
|
||||
{
|
||||
if( !window )
|
||||
return;
|
||||
@@ -370,16 +375,16 @@ void SubWindowHandle::setActiveSubWindow( QWidget* window )
|
||||
}
|
||||
}
|
||||
|
||||
void SubWindowHandle::tileSubWindows()
|
||||
Void PlaYUVerSubWindowHandle::tileSubWindows()
|
||||
{
|
||||
unsigned int numberOfWindows = m_apcSubWindowList.size();
|
||||
UInt numberOfWindows = m_apcSubWindowList.size();
|
||||
if( numberOfWindows == 0 )
|
||||
return;
|
||||
|
||||
if( m_iWindowMode == DETACHEDSUBWINDOWMODE )
|
||||
{
|
||||
QSize screenSize = QApplication::desktop()->availableGeometry().size();
|
||||
unsigned int minWindowsInRow = 1;
|
||||
UInt minWindowsInRow = 1;
|
||||
while( ( screenSize.width() / minWindowsInRow ) > 500 )
|
||||
{
|
||||
minWindowsInRow++;
|
||||
@@ -396,12 +401,12 @@ void SubWindowHandle::tileSubWindows()
|
||||
{
|
||||
numberOfWindows++;
|
||||
}
|
||||
unsigned int numberTillingRows = 1;
|
||||
unsigned int numberTillingColumns;
|
||||
UInt numberTillingRows = 1;
|
||||
UInt numberTillingColumns;
|
||||
if( numberOfWindows > minWindowsInRow )
|
||||
{
|
||||
numberTillingColumns = minWindowsInRow;
|
||||
for( int i = numberOfWindows; i > 0; )
|
||||
for( Int i = numberOfWindows; i > 0; )
|
||||
{
|
||||
numberTillingRows = ( numberOfWindows + numberTillingColumns - 1 ) / numberTillingColumns;
|
||||
if( numberTillingColumns > numberTillingRows )
|
||||
@@ -421,9 +426,10 @@ void SubWindowHandle::tileSubWindows()
|
||||
}
|
||||
|
||||
QSize totalWindowsSize( screenSize.width(), screenSize.height() - topLeftCornerWindow.y() );
|
||||
QSize windowsSize( totalWindowsSize.width() / numberTillingColumns, totalWindowsSize.height() / numberTillingRows );
|
||||
QSize windowsSize( totalWindowsSize.width() / numberTillingColumns,
|
||||
totalWindowsSize.height() / numberTillingRows );
|
||||
QPoint windowRelativePos;
|
||||
for( int i = 0; i < m_apcSubWindowList.size(); i++ )
|
||||
for( Int i = 0; i < m_apcSubWindowList.size(); i++ )
|
||||
{
|
||||
windowRelativePos.setY( ( i / numberTillingColumns ) * windowsSize.height() );
|
||||
windowRelativePos.setX( ( i % numberTillingColumns ) * windowsSize.width() );
|
||||
@@ -437,7 +443,7 @@ void SubWindowHandle::tileSubWindows()
|
||||
}
|
||||
}
|
||||
|
||||
void SubWindowHandle::cascadeSubWindows()
|
||||
Void PlaYUVerSubWindowHandle::cascadeSubWindows()
|
||||
{
|
||||
if( m_iWindowMode == MDISUBWINDOWMODE )
|
||||
{
|
||||
@@ -445,10 +451,11 @@ void SubWindowHandle::cascadeSubWindows()
|
||||
}
|
||||
}
|
||||
|
||||
void SubWindowHandle::createActions()
|
||||
Void PlaYUVerSubWindowHandle::createActions()
|
||||
{
|
||||
m_mapperWindow = new QSignalMapper( this );
|
||||
connect( m_mapperWindow, SIGNAL( mapped( QWidget* ) ), this, SLOT( setActiveSubWindow( QWidget* ) ) );
|
||||
connect( m_mapperWindow, SIGNAL( mapped( QWidget* ) ), this,
|
||||
SLOT( setActiveSubWindow( QWidget* ) ) );
|
||||
|
||||
m_arrayActions.resize( TOTAL_ACT );
|
||||
|
||||
@@ -462,13 +469,16 @@ void SubWindowHandle::createActions()
|
||||
m_arrayActions[NORMAL_SUBWINDOW_MODE_ACT] = new QAction( tr( "&Detached SubWindows" ), this );
|
||||
m_arrayActions[NORMAL_SUBWINDOW_MODE_ACT]->setCheckable( true );
|
||||
m_actionGroupWindowMode->addAction( m_arrayActions[NORMAL_SUBWINDOW_MODE_ACT] );
|
||||
connect( m_arrayActions[NORMAL_SUBWINDOW_MODE_ACT], SIGNAL( triggered() ), m_mapperWindowMode, SLOT( map() ) );
|
||||
m_mapperWindowMode->setMapping( m_arrayActions[NORMAL_SUBWINDOW_MODE_ACT], DETACHEDSUBWINDOWMODE );
|
||||
connect( m_arrayActions[NORMAL_SUBWINDOW_MODE_ACT], SIGNAL( triggered() ), m_mapperWindowMode,
|
||||
SLOT( map() ) );
|
||||
m_mapperWindowMode->setMapping( m_arrayActions[NORMAL_SUBWINDOW_MODE_ACT],
|
||||
DETACHEDSUBWINDOWMODE );
|
||||
|
||||
m_arrayActions[MDI_SUBWINDOW_MODE_ACT] = new QAction( "&MDI SubWindows", this );
|
||||
m_arrayActions[MDI_SUBWINDOW_MODE_ACT]->setCheckable( true );
|
||||
m_actionGroupWindowMode->addAction( m_arrayActions[MDI_SUBWINDOW_MODE_ACT] );
|
||||
connect( m_arrayActions[MDI_SUBWINDOW_MODE_ACT], SIGNAL( triggered() ), m_mapperWindowMode, SLOT( map() ) );
|
||||
connect( m_arrayActions[MDI_SUBWINDOW_MODE_ACT], SIGNAL( triggered() ), m_mapperWindowMode,
|
||||
SLOT( map() ) );
|
||||
m_mapperWindowMode->setMapping( m_arrayActions[MDI_SUBWINDOW_MODE_ACT], MDISUBWINDOWMODE );
|
||||
|
||||
m_actionGroupWindowMode->actions().at( m_iWindowMode )->setChecked( true );
|
||||
@@ -476,16 +486,19 @@ void SubWindowHandle::createActions()
|
||||
m_arrayActions[CLOSE_ACT] = new QAction( tr( "&Close" ), this );
|
||||
m_arrayActions[CLOSE_ACT]->setIcon( style()->standardIcon( QStyle::SP_DialogCloseButton ) );
|
||||
m_arrayActions[CLOSE_ACT]->setStatusTip( tr( "Close the active window" ) );
|
||||
connect( m_arrayActions[CLOSE_ACT], SIGNAL( triggered() ), this, SLOT( removeActiveSubWindow() ) );
|
||||
connect( m_arrayActions[CLOSE_ACT], SIGNAL( triggered() ), this,
|
||||
SLOT( removeActiveSubWindow() ) );
|
||||
|
||||
m_arrayActions[CLOSE_ACT] = new QAction( tr( "&Close" ), this );
|
||||
m_arrayActions[CLOSE_ACT]->setIcon( style()->standardIcon( QStyle::SP_DialogCloseButton ) );
|
||||
m_arrayActions[CLOSE_ACT]->setStatusTip( tr( "Close the active window" ) );
|
||||
connect( m_arrayActions[CLOSE_ACT], SIGNAL( triggered() ), this, SLOT( removeActiveSubWindow() ) );
|
||||
connect( m_arrayActions[CLOSE_ACT], SIGNAL( triggered() ), this,
|
||||
SLOT( removeActiveSubWindow() ) );
|
||||
|
||||
m_arrayActions[CLOSE_ALL_ACT] = new QAction( tr( "Close &All" ), this );
|
||||
m_arrayActions[CLOSE_ALL_ACT]->setStatusTip( tr( "Close all the windows" ) );
|
||||
connect( m_arrayActions[CLOSE_ALL_ACT], SIGNAL( triggered() ), this, SLOT( removeAllSubWindow() ) );
|
||||
connect( m_arrayActions[CLOSE_ALL_ACT], SIGNAL( triggered() ), this,
|
||||
SLOT( removeAllSubWindow() ) );
|
||||
|
||||
m_arrayActions[TILE_WINDOWS_ACT] = new QAction( tr( "Tile" ), this );
|
||||
m_arrayActions[TILE_WINDOWS_ACT]->setIcon( QIcon( ":images/windowstile.png" ) );
|
||||
@@ -493,24 +506,29 @@ void SubWindowHandle::createActions()
|
||||
m_arrayActions[TILE_WINDOWS_ACT]->setShortcut( tr( "Ctrl+T" ) );
|
||||
// connect( m_arrayActions[TILE_WINDOWS_ACT], SIGNAL( triggered() ), mdiArea,
|
||||
// SLOT( tileSubWindows() ) );
|
||||
connect( m_arrayActions[TILE_WINDOWS_ACT], SIGNAL( triggered() ), this, SLOT( tileSubWindows() ) );
|
||||
connect( m_arrayActions[TILE_WINDOWS_ACT], SIGNAL( triggered() ), this,
|
||||
SLOT( tileSubWindows() ) );
|
||||
|
||||
m_arrayActions[CASCADE_WINDOWS_ACT] = new QAction( tr( "Cascade" ), this );
|
||||
m_arrayActions[CASCADE_WINDOWS_ACT]->setIcon( QIcon( ":images/windowscascade.png" ) );
|
||||
m_arrayActions[CASCADE_WINDOWS_ACT]->setStatusTip( tr( "Cascade the windows" ) );
|
||||
connect( m_arrayActions[CASCADE_WINDOWS_ACT], SIGNAL( triggered() ), this, SLOT( cascadeSubWindows() ) );
|
||||
connect( m_arrayActions[CASCADE_WINDOWS_ACT], SIGNAL( triggered() ), this,
|
||||
SLOT( cascadeSubWindows() ) );
|
||||
|
||||
m_arrayActions[NEXT_WINDOWS_ACT] = new QAction( tr( "Ne&xt" ), this );
|
||||
m_arrayActions[NEXT_WINDOWS_ACT]->setShortcuts( QKeySequence::NextChild );
|
||||
m_arrayActions[NEXT_WINDOWS_ACT]->setIcon( QIcon( style()->standardIcon( QStyle::SP_ArrowRight ) ) );
|
||||
m_arrayActions[NEXT_WINDOWS_ACT]->setIcon(
|
||||
QIcon( style()->standardIcon( QStyle::SP_ArrowRight ) ) );
|
||||
m_arrayActions[NEXT_WINDOWS_ACT]->setStatusTip( tr( "Move the focus to the next window" ) );
|
||||
// connect( m_arrayActions[NEXT_WINDOWS_ACT], SIGNAL( triggered() ), this,
|
||||
// SLOT( activateNextSubWindow() ) );
|
||||
|
||||
m_arrayActions[PREVIOUS_WINDOWS_ACT] = new QAction( tr( "Pre&vious" ), this );
|
||||
m_arrayActions[PREVIOUS_WINDOWS_ACT]->setShortcuts( QKeySequence::PreviousChild );
|
||||
m_arrayActions[PREVIOUS_WINDOWS_ACT]->setIcon( QIcon( style()->standardIcon( QStyle::SP_ArrowLeft ) ) );
|
||||
m_arrayActions[PREVIOUS_WINDOWS_ACT]->setStatusTip( tr( "Move the focus to the previous window" ) );
|
||||
m_arrayActions[PREVIOUS_WINDOWS_ACT]->setIcon(
|
||||
QIcon( style()->standardIcon( QStyle::SP_ArrowLeft ) ) );
|
||||
m_arrayActions[PREVIOUS_WINDOWS_ACT]->setStatusTip(
|
||||
tr( "Move the focus to the previous window" ) );
|
||||
// connect( m_arrayActions[PREVIOUS_WINDOWS_ACT], SIGNAL( triggered() ),
|
||||
// this, SLOT( activatePreviousSubWindow() ) );
|
||||
|
||||
@@ -518,7 +536,7 @@ void SubWindowHandle::createActions()
|
||||
m_arrayActions[SEPARATOR_ACT]->setSeparator( true );
|
||||
}
|
||||
|
||||
QMenu* SubWindowHandle::createMenu()
|
||||
QMenu* PlaYUVerSubWindowHandle::createMenu()
|
||||
{
|
||||
m_pcMenuWindow = new QMenu( "&Window", this );
|
||||
updateMenu();
|
||||
@@ -526,7 +544,7 @@ QMenu* SubWindowHandle::createMenu()
|
||||
return m_pcMenuWindow;
|
||||
}
|
||||
|
||||
void SubWindowHandle::updateMenu()
|
||||
Void PlaYUVerSubWindowHandle::updateMenu()
|
||||
{
|
||||
m_pcMenuWindow->clear();
|
||||
m_pcMenuWindow->addAction( m_arrayActions[NORMAL_SUBWINDOW_MODE_ACT] );
|
||||
@@ -542,7 +560,7 @@ void SubWindowHandle::updateMenu()
|
||||
// m_pcMenuWindow->addAction( m_arrayActions[PREVIOUS_WINDOWS_ACT] );
|
||||
// m_pcMenuWindow->addSeparator();
|
||||
|
||||
int number_windows = m_apcSubWindowList.size();
|
||||
Int number_windows = m_apcSubWindowList.size();
|
||||
if( number_windows > 1 )
|
||||
{
|
||||
m_arrayActions[NEXT_WINDOWS_ACT]->setEnabled( true );
|
||||
@@ -556,7 +574,7 @@ void SubWindowHandle::updateMenu()
|
||||
|
||||
m_arrayActions[SEPARATOR_ACT]->setVisible( number_windows > 0 );
|
||||
|
||||
for( int i = 0; i < number_windows; ++i )
|
||||
for( Int i = 0; i < number_windows; ++i )
|
||||
{
|
||||
SubWindowAbstract* subWindow = m_apcSubWindowList.at( i );
|
||||
|
||||
@@ -577,17 +595,19 @@ void SubWindowHandle::updateMenu()
|
||||
}
|
||||
}
|
||||
|
||||
void SubWindowHandle::readSettings()
|
||||
Void PlaYUVerSubWindowHandle::readSettings()
|
||||
{
|
||||
QSettings appSettings;
|
||||
m_cMdiModeWindowPosition = appSettings.value( "SubWindowManager/LastMdiPosition", QPoint( 200, 200 ) ).toPoint();
|
||||
m_cMdiModeWindowSize = appSettings.value( "SubWindowManager/LastMdiSize", QSize( 500, 400 ) ).toSize();
|
||||
int iWindowMode = appSettings.value( "SubWindowManager/SubWindowMode", MDISUBWINDOWMODE ).toInt();
|
||||
m_cMdiModeWindowPosition =
|
||||
appSettings.value( "SubWindowManager/LastMdiPosition", QPoint( 200, 200 ) ).toPoint();
|
||||
m_cMdiModeWindowSize =
|
||||
appSettings.value( "SubWindowManager/LastMdiSize", QSize( 500, 400 ) ).toSize();
|
||||
Int iWindowMode = appSettings.value( "SubWindowManager/SubWindowMode", MDISUBWINDOWMODE ).toInt();
|
||||
setWindowMode( iWindowMode );
|
||||
m_actionGroupWindowMode->actions().at( iWindowMode )->setChecked( true );
|
||||
}
|
||||
|
||||
void SubWindowHandle::writeSettings()
|
||||
Void PlaYUVerSubWindowHandle::writeSettings()
|
||||
{
|
||||
QSettings appSettings;
|
||||
appSettings.setValue( "SubWindowManager/LastMdiPosition", m_cMdiModeWindowPosition );
|
||||
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,52 +18,52 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file SubWindowHandle.h
|
||||
* \file PlaYUVerSubWindowHandle.h
|
||||
* \brief Handle multiple sub-windows
|
||||
*/
|
||||
|
||||
#ifndef __SUBWINDOWHANDLE_H__
|
||||
#define __SUBWINDOWHANDLE_H__
|
||||
|
||||
#include "CommonDefs.h"
|
||||
#ifndef __PLAYUVERSUBWINDOWHANDLE_H__
|
||||
#define __PLAYUVERSUBWINDOWHANDLE_H__
|
||||
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
#include <QWidget>
|
||||
|
||||
#include "PlaYUVerAppDefs.h"
|
||||
|
||||
class QAction;
|
||||
class QActionGroup;
|
||||
class QHBoxLayout;
|
||||
class QMenu;
|
||||
class QSignalMapper;
|
||||
|
||||
class MainWindow;
|
||||
class PlaYUVerApp;
|
||||
class SubWindowAbstract;
|
||||
class MdiArea;
|
||||
class MdiSubWindow;
|
||||
class PlaYUVerMdiArea;
|
||||
class PlaYUVerMdiSubWindow;
|
||||
|
||||
class SubWindowHandle : public QWidget
|
||||
class PlaYUVerSubWindowHandle : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SubWindowHandle( QWidget* parent );
|
||||
PlaYUVerSubWindowHandle( QWidget* parent );
|
||||
|
||||
void processLogMsg( const QString& msg );
|
||||
Void processLogMsg( const QString& msg );
|
||||
|
||||
void addSubWindow( SubWindowAbstract* widget, Qt::WindowFlags flags = 0 );
|
||||
Void addSubWindow( SubWindowAbstract* widget, Qt::WindowFlags flags = 0 );
|
||||
|
||||
SubWindowAbstract* activeSubWindow() const;
|
||||
|
||||
QList<SubWindowAbstract*> findSubWindow( const unsigned int uiCategory = 0 ) const;
|
||||
QList<SubWindowAbstract*> findSubWindow( const QString& aName, const unsigned int uiCategory = 0 ) const;
|
||||
QList<SubWindowAbstract*> findSubWindow( const UInt uiCategory = 0 ) const;
|
||||
QList<SubWindowAbstract*> findSubWindow( const QString& aName, const UInt uiCategory = 0 ) const;
|
||||
SubWindowAbstract* findSubWindow( const SubWindowAbstract* subWindow ) const;
|
||||
|
||||
void createActions();
|
||||
Void createActions();
|
||||
QMenu* createMenu();
|
||||
|
||||
void readSettings();
|
||||
void writeSettings();
|
||||
Void readSettings();
|
||||
Void writeSettings();
|
||||
|
||||
enum WindowMode
|
||||
{
|
||||
@@ -72,13 +72,13 @@ public:
|
||||
};
|
||||
|
||||
private:
|
||||
MainWindow* m_pcApp;
|
||||
int m_iWindowMode;
|
||||
PlaYUVerApp* m_pcApp;
|
||||
Int m_iWindowMode;
|
||||
QList<SubWindowAbstract*> m_apcSubWindowList;
|
||||
|
||||
QHBoxLayout* m_pcWindowManagerLayout;
|
||||
MdiArea* m_pcMdiArea;
|
||||
QList<MdiSubWindow*> m_apcMdiSubWindowList;
|
||||
PlaYUVerMdiArea* m_pcMdiArea;
|
||||
QList<PlaYUVerMdiSubWindow*> m_apcMdiSubWindowList;
|
||||
|
||||
SubWindowAbstract* m_pcActiveWindow;
|
||||
|
||||
@@ -105,18 +105,18 @@ private:
|
||||
QMenu* m_pcMenuWindow;
|
||||
|
||||
/**
|
||||
* internal functions
|
||||
* Internal functions
|
||||
*/
|
||||
void addMdiSubWindow( SubWindowAbstract* window );
|
||||
void resetWindowMode();
|
||||
void removeSubWindow( int windowIdx );
|
||||
Void addMdiSubWindow( SubWindowAbstract* window );
|
||||
Void resetWindowMode();
|
||||
Void removeSubWindow( Int windowIdx );
|
||||
|
||||
public Q_SLOTS:
|
||||
void setWindowMode( int iWindowMode );
|
||||
void updateActiveSubWindow( SubWindowAbstract* window = 0 );
|
||||
void setActiveSubWindow( QWidget* window );
|
||||
void removeSubWindow( SubWindowAbstract* window );
|
||||
void removeMdiSubWindow( MdiSubWindow* window );
|
||||
void removeMdiSubWindow( PlaYUVerMdiSubWindow* window );
|
||||
void removeActiveSubWindow();
|
||||
void removeAllSubWindow();
|
||||
void tileSubWindows();
|
||||
@@ -128,4 +128,4 @@ Q_SIGNALS:
|
||||
void windowActivated();
|
||||
};
|
||||
|
||||
#endif // __SUBWINDOWHANDLE_H__
|
||||
#endif // __PLAYUVERSUBWINDOWHANDLE_H__
|
||||
+39
-51
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -23,11 +23,9 @@
|
||||
*/
|
||||
|
||||
#include "PlotSubWindow.h"
|
||||
|
||||
#include "qcustomplot.h"
|
||||
//#include "external/qcustomplot/qcustomplot.h"
|
||||
|
||||
void PlotSubWindow::definePlotColors()
|
||||
Void PlotSubWindow::definePlotColors()
|
||||
{
|
||||
m_arrayColorList.append( Qt::blue );
|
||||
m_arrayColorList.append( Qt::red );
|
||||
@@ -96,15 +94,18 @@ PlotSubWindow::PlotSubWindow( const QString& windowTitle, QWidget* parent )
|
||||
m_cPlotArea->yAxis2->setTickLabels( false );
|
||||
// make left and bottom axes always transfer their ranges to right and top
|
||||
// axes:
|
||||
connect( m_cPlotArea->xAxis, SIGNAL( rangeChanged( QCPRange ) ), m_cPlotArea->xAxis2, SLOT( setRange( QCPRange ) ) );
|
||||
connect( m_cPlotArea->yAxis, SIGNAL( rangeChanged( QCPRange ) ), m_cPlotArea->yAxis2, SLOT( setRange( QCPRange ) ) );
|
||||
connect( m_cPlotArea->xAxis, SIGNAL( rangeChanged( QCPRange ) ), m_cPlotArea->xAxis2,
|
||||
SLOT( setRange( QCPRange ) ) );
|
||||
connect( m_cPlotArea->yAxis, SIGNAL( rangeChanged( QCPRange ) ), m_cPlotArea->yAxis2,
|
||||
SLOT( setRange( QCPRange ) ) );
|
||||
|
||||
QFont legendFont = font(); // start out with MainWindow's font..
|
||||
legendFont.setPointSize( 9 ); // and make a bit smaller for legend
|
||||
m_cPlotArea->legend->setFont( legendFont );
|
||||
m_cPlotArea->legend->setBrush( backgroundBrush );
|
||||
m_cPlotArea->legend->setTextColor( palette().text().color() );
|
||||
m_cPlotArea->legend->setBorderPen( QPen( palette().brush( QPalette::Active, QPalette::Shadow ), 1 ) );
|
||||
m_cPlotArea->legend->setBorderPen(
|
||||
QPen( palette().brush( QPalette::Active, QPalette::Shadow ), 1 ) );
|
||||
m_cPlotArea->legend->setVisible( false );
|
||||
|
||||
m_cPlotArea->setInteractions( QCP::iRangeZoom | QCP::iRangeDrag ); // QCP::iSelectPlottables
|
||||
@@ -114,11 +115,6 @@ PlotSubWindow::PlotSubWindow( const QString& windowTitle, QWidget* parent )
|
||||
m_cPlotPen.setWidthF( 2 );
|
||||
|
||||
setWidget( m_cPlotArea );
|
||||
|
||||
m_aAxisRange[AXIS_HORIZONTAL][0] = 99999;
|
||||
m_aAxisRange[AXIS_HORIZONTAL][1] = 0;
|
||||
m_aAxisRange[AXIS_VERTICAL][0] = 99999;
|
||||
m_aAxisRange[AXIS_VERTICAL][1] = 0;
|
||||
}
|
||||
|
||||
PlotSubWindow::~PlotSubWindow()
|
||||
@@ -126,22 +122,22 @@ PlotSubWindow::~PlotSubWindow()
|
||||
delete m_cPlotArea;
|
||||
}
|
||||
|
||||
void PlotSubWindow::normalSize()
|
||||
Void PlotSubWindow::normalSize()
|
||||
{
|
||||
m_cPlotArea->xAxis->setRange( m_aAxisRange[AXIS_HORIZONTAL][0], m_aAxisRange[AXIS_HORIZONTAL][1] );
|
||||
m_cPlotArea->yAxis->setRange( m_aAxisRange[AXIS_VERTICAL][0], m_aAxisRange[AXIS_VERTICAL][1] );
|
||||
m_cPlotArea->xAxis->setRange( m_aAxisRange[HORIZONTAL][0], m_aAxisRange[HORIZONTAL][1] );
|
||||
m_cPlotArea->yAxis->setRange( m_aAxisRange[VERTICAL][0], m_aAxisRange[VERTICAL][1] );
|
||||
m_cPlotArea->replot();
|
||||
m_dScaleFactor = 1;
|
||||
}
|
||||
|
||||
void PlotSubWindow::zoomToFit()
|
||||
Void PlotSubWindow::zoomToFit()
|
||||
{
|
||||
normalSize();
|
||||
}
|
||||
|
||||
void PlotSubWindow::zoomToFactor( double factor, QPoint center ) {}
|
||||
Void PlotSubWindow::zoomToFactor( Double factor, QPoint center ) {}
|
||||
|
||||
void PlotSubWindow::scaleView( double scale, QPoint center )
|
||||
Void PlotSubWindow::scaleView( Double scale, QPoint center )
|
||||
{
|
||||
scale -= 1;
|
||||
scale /= 10;
|
||||
@@ -149,9 +145,9 @@ void PlotSubWindow::scaleView( double scale, QPoint center )
|
||||
|
||||
m_dScaleFactor *= scale;
|
||||
//
|
||||
// unsigned int aNewAxisRange[2][2];
|
||||
// for( unsigned int axis = 0; axis < 2; axis++ )
|
||||
// for( unsigned int dim = 0; dim < 2; dim++ )
|
||||
// UInt aNewAxisRange[2][2];
|
||||
// for( UInt axis = 0; axis < 2; axis++ )
|
||||
// for( UInt dim = 0; dim < 2; dim++ )
|
||||
// aNewAxisRange[axis][dim] = m_aAxisRange[axis][dim] / m_dScaleFactor;
|
||||
//
|
||||
// m_cPlotArea->xAxis->setRange( aNewAxisRange[HORIZONTAL][0],
|
||||
@@ -184,52 +180,42 @@ QSize PlotSubWindow::sizeHint( const QSize& maxSize ) const
|
||||
return maxSize * 2 / 3;
|
||||
}
|
||||
|
||||
void PlotSubWindow::setAxisName( const QString& nameAxisX, const QString& nameAxisY )
|
||||
Void PlotSubWindow::setAxisName( const QString& nameAxisX, const QString& nameAxisY )
|
||||
{
|
||||
m_cPlotArea->xAxis->setLabel( nameAxisX );
|
||||
m_cPlotArea->yAxis->setLabel( nameAxisY );
|
||||
}
|
||||
|
||||
void PlotSubWindow::setAxisRange( const QLine& axisLimits )
|
||||
Void PlotSubWindow::setAxisRange( const QLine& axisLimits )
|
||||
{
|
||||
setAxisRange( AXIS_HORIZONTAL, axisLimits.x1(), axisLimits.x2() );
|
||||
setAxisRange( AXIS_VERTICAL, axisLimits.y1(), axisLimits.y2() );
|
||||
setAxisRange( HORIZONTAL, axisLimits.x1(), axisLimits.x2() );
|
||||
setAxisRange( VERTICAL, axisLimits.y1(), axisLimits.y2() );
|
||||
}
|
||||
|
||||
void PlotSubWindow::setAxisRange( PlotSubWindow::Axis eAxis, const int& axisStart, const int& axisEnd )
|
||||
Void PlotSubWindow::setAxisRange( PlotSubWindow::Axis eAxis,
|
||||
const Int& axisStart,
|
||||
const Int& axisEnd )
|
||||
{
|
||||
if( eAxis == AXIS_HORIZONTAL )
|
||||
if( eAxis == HORIZONTAL )
|
||||
{
|
||||
m_cPlotArea->xAxis->setRange( axisStart, axisEnd );
|
||||
// horizontalScrollBar()->setRange( axisStart * 100, axisEnd * 100 );
|
||||
m_aAxisRange[AXIS_HORIZONTAL][0] = axisStart;
|
||||
m_aAxisRange[AXIS_HORIZONTAL][1] = axisEnd;
|
||||
m_aAxisRange[HORIZONTAL][0] = axisStart;
|
||||
m_aAxisRange[HORIZONTAL][1] = axisEnd;
|
||||
}
|
||||
if( eAxis == AXIS_VERTICAL )
|
||||
if( eAxis == VERTICAL )
|
||||
{
|
||||
m_cPlotArea->yAxis->setRange( axisStart, axisEnd );
|
||||
// verticalScrollBar()->setRange( axisStart * 100, axisEnd * 100 );
|
||||
m_aAxisRange[AXIS_VERTICAL][0] = axisStart;
|
||||
m_aAxisRange[AXIS_VERTICAL][1] = axisEnd;
|
||||
m_aAxisRange[VERTICAL][0] = axisStart;
|
||||
m_aAxisRange[VERTICAL][1] = axisEnd;
|
||||
}
|
||||
m_cPlotArea->replot();
|
||||
}
|
||||
|
||||
void PlotSubWindow::appendAxisLimit( PlotSubWindow::Axis eAxis, const int& axisStart, const int& axisEnd )
|
||||
{
|
||||
m_aAxisRange[eAxis][0] = std::min<double>( m_aAxisRange[eAxis][0], axisStart );
|
||||
m_aAxisRange[eAxis][1] = std::max<double>( m_aAxisRange[eAxis][1], axisEnd );
|
||||
|
||||
if( eAxis == AXIS_HORIZONTAL )
|
||||
m_cPlotArea->xAxis->setRange( m_aAxisRange[AXIS_HORIZONTAL][0], m_aAxisRange[AXIS_HORIZONTAL][1] );
|
||||
|
||||
if( eAxis == AXIS_VERTICAL )
|
||||
m_cPlotArea->xAxis->setRange( m_aAxisRange[AXIS_VERTICAL][0], m_aAxisRange[AXIS_VERTICAL][1] );
|
||||
|
||||
m_cPlotArea->replot();
|
||||
}
|
||||
|
||||
void PlotSubWindow::addPlot( const QVector<double>& arrayX, const QVector<double>& arrayY, const QString& key )
|
||||
Void PlotSubWindow::addPlot( const QVector<Double>& arrayX,
|
||||
const QVector<Double>& arrayY,
|
||||
const QString& key )
|
||||
{
|
||||
QCPGraph* newPlot = m_cPlotArea->addGraph();
|
||||
QColor plotColor = m_arrayColorList.at( 0 );
|
||||
@@ -251,8 +237,10 @@ void PlotSubWindow::addPlot( const QVector<double>& arrayX, const QVector<double
|
||||
newPlot->setName( key );
|
||||
}
|
||||
|
||||
appendAxisLimit( AXIS_HORIZONTAL, m_cPlotArea->xAxis->range().lower, m_cPlotArea->xAxis->range().upper );
|
||||
appendAxisLimit( AXIS_VERTICAL, m_cPlotArea->yAxis->range().lower, m_cPlotArea->yAxis->range().upper );
|
||||
m_aAxisRange[HORIZONTAL][0] = m_cPlotArea->xAxis->range().lower;
|
||||
m_aAxisRange[HORIZONTAL][1] = m_cPlotArea->xAxis->range().upper;
|
||||
m_aAxisRange[VERTICAL][0] = m_cPlotArea->yAxis->range().lower;
|
||||
m_aAxisRange[VERTICAL][1] = m_cPlotArea->yAxis->range().upper;
|
||||
|
||||
m_iNumberPlots++;
|
||||
}
|
||||
+28
-24
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -25,11 +25,14 @@
|
||||
#ifndef __PLOTWINDOWHANDLE_H__
|
||||
#define __PLOTWINDOWHANDLE_H__
|
||||
|
||||
#include "CommonDefs.h"
|
||||
#include "SubWindowAbstract.h"
|
||||
#include "PlaYUVerAppDefs.h"
|
||||
#include "config.h"
|
||||
|
||||
#if( QT_VERSION_PLAYUVER == 5 )
|
||||
#include <QtWidgets>
|
||||
#elif( QT_VERSION_PLAYUVER == 4 )
|
||||
#include <QtGui>
|
||||
#endif
|
||||
#include "SubWindowAbstract.h"
|
||||
|
||||
class QCustomPlot;
|
||||
|
||||
@@ -45,44 +48,45 @@ private:
|
||||
|
||||
enum Axis
|
||||
{
|
||||
AXIS_HORIZONTAL,
|
||||
AXIS_VERTICAL,
|
||||
HORIZONTAL,
|
||||
VERTICAL,
|
||||
};
|
||||
double m_aAxisRange[2][2];
|
||||
double m_dScaleFactor;
|
||||
int m_iNumberPlots;
|
||||
Double m_aAxisRange[2][2];
|
||||
Double m_dScaleFactor;
|
||||
Int m_iNumberPlots;
|
||||
|
||||
public:
|
||||
PlotSubWindow( const QString& windowTitle, QWidget* parent = NULL );
|
||||
~PlotSubWindow();
|
||||
|
||||
void definePlotColors();
|
||||
Void definePlotColors();
|
||||
|
||||
void refreshSubWindow() {}
|
||||
Void refreshSubWindow() {}
|
||||
/**
|
||||
* Virtual functions from SubWindowAbstract
|
||||
*/
|
||||
void normalSize();
|
||||
void zoomToFit();
|
||||
void zoomToFactor( double factor, QPoint center = QPoint() );
|
||||
void scaleView( double scale, QPoint center = QPoint() );
|
||||
Void normalSize();
|
||||
Void zoomToFit();
|
||||
Void zoomToFactor( Double factor, QPoint center = QPoint() );
|
||||
Void scaleView( Double scale, QPoint center = QPoint() );
|
||||
|
||||
double getScaleFactor() { return m_dScaleFactor; }
|
||||
Double getScaleFactor() { return m_dScaleFactor; }
|
||||
/**
|
||||
* Size related functions
|
||||
*/
|
||||
QSize sizeHint() const;
|
||||
QSize sizeHint( const QSize& ) const;
|
||||
|
||||
void setAxisName( const QString& nameAxisX, const QString& nameAxisY );
|
||||
Void setAxisName( const QString& nameAxisX, const QString& nameAxisY );
|
||||
|
||||
void setAxisRange( const QLine& axisLimits );
|
||||
void setAxisRange( PlotSubWindow::Axis eAxis, const int& axisStart, const int& axisEnd );
|
||||
void appendAxisLimit( PlotSubWindow::Axis eAxis, const int& axisStart, const int& axisEnd );
|
||||
Void setAxisRange( const QLine& axisLimits );
|
||||
Void setAxisRange( PlotSubWindow::Axis eAxis, const Int& axisStart, const Int& axisEnd );
|
||||
|
||||
void setKey( const QString& key );
|
||||
Void setKey( const QString& key );
|
||||
|
||||
void addPlot( const QVector<double>& arrayX, const QVector<double>& arrayY, const QString& key = QString() );
|
||||
Void addPlot( const QVector<Double>& arrayX,
|
||||
const QVector<Double>& arrayY,
|
||||
const QString& key = QString() );
|
||||
};
|
||||
|
||||
#endif // __PLOTWINDOWHANDLE_H__
|
||||
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -23,14 +23,13 @@
|
||||
*/
|
||||
|
||||
#include "ProgressBar.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
#include <QLabel>
|
||||
#include <QProgressBar>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
ProgressBar::ProgressBar( QWidget* parent, unsigned long long int maxValue )
|
||||
ProgressBar::ProgressBar( QWidget* parent, UInt maxValue )
|
||||
: QWidget( parent ), m_uiTotalProgress( maxValue ), m_uiProgress( 0 )
|
||||
{
|
||||
QVBoxLayout* mainLayout = new QVBoxLayout( this );
|
||||
@@ -51,7 +50,7 @@ ProgressBar::ProgressBar( QWidget* parent, unsigned long long int maxValue )
|
||||
show();
|
||||
}
|
||||
|
||||
void ProgressBar::incrementProgress( unsigned int increment )
|
||||
Void ProgressBar::incrementProgress( UInt increment )
|
||||
{
|
||||
m_uiProgress += increment;
|
||||
m_pcProgressBar->setValue( m_uiProgress );
|
||||
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -25,8 +25,7 @@
|
||||
#ifndef __PROGRESSBAR_H__
|
||||
#define __PROGRESSBAR_H__
|
||||
|
||||
#include "CommonDefs.h"
|
||||
|
||||
#include "PlaYUVerAppDefs.h"
|
||||
#include <QDialog>
|
||||
#include <QWidget>
|
||||
|
||||
@@ -37,13 +36,13 @@ class ProgressBar : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ProgressBar( QWidget* parent, unsigned long long int maxValue );
|
||||
ProgressBar( QWidget* parent, UInt maxValue );
|
||||
|
||||
void incrementProgress( unsigned int );
|
||||
Void incrementProgress( UInt );
|
||||
|
||||
private:
|
||||
unsigned int m_uiTotalProgress;
|
||||
unsigned int m_uiProgress;
|
||||
UInt m_uiTotalProgress;
|
||||
UInt m_uiProgress;
|
||||
QProgressBar* m_pcProgressBar;
|
||||
};
|
||||
|
||||
+71
-65
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -23,25 +23,25 @@
|
||||
*/
|
||||
|
||||
#include "QualityHandle.h"
|
||||
|
||||
#include "DialogSubWindowSelector.h"
|
||||
#include "PlaYUVerSubWindowHandle.h"
|
||||
#include "PlotSubWindow.h"
|
||||
#include "ProgressBar.h"
|
||||
#include "SubWindowHandle.h"
|
||||
#include "SubWindowSelectorDialog.h"
|
||||
#include "VideoSubWindow.h"
|
||||
#include "lib/LibMemory.h"
|
||||
|
||||
#include <QtGui>
|
||||
#if( QT_VERSION_PLAYUVER == 5 )
|
||||
#include "QtConcurrent/qtconcurrentrun.h"
|
||||
#endif
|
||||
|
||||
QualityHandle::QualityHandle( QWidget* parent, SubWindowHandle* windowManager )
|
||||
QualityHandle::QualityHandle( QWidget* parent, PlaYUVerSubWindowHandle* windowManager )
|
||||
: m_pcParet( parent ), m_pcMainWindowManager( windowManager )
|
||||
{
|
||||
}
|
||||
|
||||
QualityHandle::~QualityHandle() {}
|
||||
|
||||
void QualityHandle::createActions()
|
||||
Void QualityHandle::createActions()
|
||||
{
|
||||
m_actionGroupQualityMetric = new QActionGroup( this );
|
||||
m_actionGroupQualityMetric->setExclusive( true );
|
||||
@@ -49,9 +49,9 @@ void QualityHandle::createActions()
|
||||
m_mapperQualityMetric = new QSignalMapper( this );
|
||||
|
||||
QAction* currAction;
|
||||
for( unsigned int i = 0; i < CalypFrame::supportedQualityMetricsList().size(); i++ )
|
||||
for( UInt i = 0; i < PlaYUVerFrame::supportedQualityMetricsList().size(); i++ )
|
||||
{
|
||||
currAction = new QAction( CalypFrame::supportedQualityMetricsList()[i].c_str(), this );
|
||||
currAction = new QAction( PlaYUVerFrame::supportedQualityMetricsList()[i].c_str(), this );
|
||||
currAction->setCheckable( true );
|
||||
m_actionGroupQualityMetric->addAction( currAction );
|
||||
connect( currAction, SIGNAL( triggered() ), m_mapperQualityMetric, SLOT( map() ) );
|
||||
@@ -61,12 +61,15 @@ void QualityHandle::createActions()
|
||||
m_arrayActions.resize( TOTAL_ACT );
|
||||
|
||||
m_arrayActions[SELECT_CURR_REF_ACT] = new QAction( "Mark as Reference", this );
|
||||
connect( m_arrayActions[SELECT_CURR_REF_ACT], SIGNAL( triggered() ), this, SLOT( slotSelectCurrentAsReference() ) );
|
||||
connect( m_arrayActions[SELECT_CURR_REF_ACT], SIGNAL( triggered() ), this,
|
||||
SLOT( slotSelectCurrentAsReference() ) );
|
||||
|
||||
m_arrayActions[PLOT_QUALITY] = new QAction( "Plot Window's Quality", this );
|
||||
connect( m_arrayActions[PLOT_QUALITY], SIGNAL( triggered() ), this, SLOT( slotPlotQualitySingle() ) );
|
||||
connect( m_arrayActions[PLOT_QUALITY], SIGNAL( triggered() ), this,
|
||||
SLOT( slotPlotQualitySingle() ) );
|
||||
m_arrayActions[PLOT_SEVERAL_QUALITY] = new QAction( "Plot Several Quality", this );
|
||||
connect( m_arrayActions[PLOT_SEVERAL_QUALITY], SIGNAL( triggered() ), this, SLOT( slotPlotQualitySeveral() ) );
|
||||
connect( m_arrayActions[PLOT_SEVERAL_QUALITY], SIGNAL( triggered() ), this,
|
||||
SLOT( slotPlotQualitySeveral() ) );
|
||||
}
|
||||
|
||||
QMenu* QualityHandle::createMenu()
|
||||
@@ -90,19 +93,21 @@ QDockWidget* QualityHandle::createDock()
|
||||
|
||||
connect( m_pcQualityHandleSideBar, SIGNAL( signalQualityMetricChanged( int ) ), this,
|
||||
SLOT( slotQualityMetricChanged( int ) ) );
|
||||
connect( m_mapperQualityMetric, SIGNAL( mapped( int ) ), this, SLOT( slotQualityMetricChanged( int ) ) );
|
||||
connect( m_mapperQualityMetric, SIGNAL( mapped( int ) ), this,
|
||||
SLOT( slotQualityMetricChanged( int ) ) );
|
||||
|
||||
slotQualityMetricChanged( 0 );
|
||||
|
||||
return m_pcQualityHandleDock;
|
||||
}
|
||||
|
||||
void QualityHandle::updateMenus()
|
||||
Void QualityHandle::updateMenus()
|
||||
{
|
||||
VideoSubWindow* pcCurrentVideoSubWindow = qobject_cast<VideoSubWindow*>( m_pcMainWindowManager->activeSubWindow() );
|
||||
bool hasSubWindow = pcCurrentVideoSubWindow ? true : false;
|
||||
bool hasReference = false;
|
||||
bool isReference = false;
|
||||
VideoSubWindow* pcCurrentVideoSubWindow =
|
||||
qobject_cast<VideoSubWindow*>( m_pcMainWindowManager->activeSubWindow() );
|
||||
Bool hasSubWindow = pcCurrentVideoSubWindow ? true : false;
|
||||
Bool hasReference = false;
|
||||
Bool isReference = false;
|
||||
|
||||
if( hasSubWindow )
|
||||
{
|
||||
@@ -112,7 +117,7 @@ void QualityHandle::updateMenus()
|
||||
VideoSubWindow* pcVideoSubWindow;
|
||||
QList<SubWindowAbstract*> subWindowList =
|
||||
m_pcMainWindowManager->findSubWindow( SubWindowAbstract::VIDEO_STREAM_SUBWINDOW );
|
||||
for( int i = 0; i < subWindowList.size(); i++ )
|
||||
for( Int i = 0; i < subWindowList.size(); i++ )
|
||||
{
|
||||
pcVideoSubWindow = qobject_cast<VideoSubWindow*>( subWindowList.at( i ) );
|
||||
if( pcVideoSubWindow->getRefSubWindow() == pcCurrentVideoSubWindow )
|
||||
@@ -133,35 +138,36 @@ void QualityHandle::updateMenus()
|
||||
m_pcQualityHandleSideBar->updateSideBar( hasSubWindow );
|
||||
}
|
||||
|
||||
void QualityHandle::readSettings()
|
||||
Void QualityHandle::readSettings()
|
||||
{
|
||||
QSettings appSettings;
|
||||
int metric = appSettings.value( "QualityHandle/Metric", 0 ).toInt();
|
||||
Int metric = appSettings.value( "QualityHandle/Metric", 0 ).toInt();
|
||||
slotQualityMetricChanged( metric );
|
||||
if( !appSettings.value( "QualityHandle/QualitySideBar", true ).toBool() )
|
||||
m_pcQualityHandleDock->close();
|
||||
}
|
||||
|
||||
void QualityHandle::writeSettings()
|
||||
Void QualityHandle::writeSettings()
|
||||
{
|
||||
QSettings appSettings;
|
||||
appSettings.setValue( "QualityHandle/Metric", m_iQualityMetricIdx );
|
||||
appSettings.setValue( "QualityHandle/QualitySideBar", m_pcQualityHandleDock->isVisible() );
|
||||
}
|
||||
|
||||
void QualityHandle::update( VideoSubWindow* currSubWindow )
|
||||
Void QualityHandle::update( VideoSubWindow* currSubWindow )
|
||||
{
|
||||
m_pcQualityHandleSideBar->updateCurrentWindow( currSubWindow );
|
||||
}
|
||||
|
||||
void QualityHandle::measureQuality( QVector<VideoSubWindow*> apcWindowList )
|
||||
Void QualityHandle::measureQuality( QVector<VideoSubWindow*> apcWindowList )
|
||||
{
|
||||
unsigned numberOfWindows = apcWindowList.size();
|
||||
ClpULong currFrames = 0;
|
||||
ClpULong numberOfFrames = -1;
|
||||
QVector<Double>* padQualityValues;
|
||||
UInt numberOfWindows = apcWindowList.size();
|
||||
UInt64 currFrames = 0;
|
||||
UInt64 numberOfFrames = INT_MAX;
|
||||
|
||||
//! Check reference window
|
||||
for( unsigned i = 0; i < numberOfWindows; i++ )
|
||||
for( UInt i = 0; i < numberOfWindows; i++ )
|
||||
{
|
||||
if( !apcWindowList.at( i )->getRefSubWindow() )
|
||||
{
|
||||
@@ -171,7 +177,7 @@ void QualityHandle::measureQuality( QVector<VideoSubWindow*> apcWindowList )
|
||||
VideoSubWindow* pcReferenceWindow = apcWindowList.at( 0 )->getRefSubWindow();
|
||||
|
||||
numberOfFrames = pcReferenceWindow->getInputStream()->getFrameNum();
|
||||
for( unsigned i = 0; i < numberOfWindows; i++ )
|
||||
for( UInt i = 0; i < numberOfWindows; i++ )
|
||||
{
|
||||
currFrames = apcWindowList.at( i )->getInputStream()->getFrameNum();
|
||||
if( currFrames < numberOfFrames )
|
||||
@@ -182,55 +188,52 @@ void QualityHandle::measureQuality( QVector<VideoSubWindow*> apcWindowList )
|
||||
|
||||
ProgressBar* pcProgressBar = new ProgressBar( m_pcParet, numberOfFrames );
|
||||
|
||||
QVector<double>* padQualityValues = new QVector<double>[numberOfWindows + 1];
|
||||
double* padAverageQuality = new double[numberOfWindows + 1];
|
||||
double dCurrentQuality;
|
||||
padQualityValues = new QVector<Double>[numberOfWindows + 1];
|
||||
|
||||
for( unsigned i = 0; i < numberOfWindows + 1; i++ )
|
||||
{
|
||||
padAverageQuality[i] = 0;
|
||||
}
|
||||
|
||||
CalypFrame* pcReferenceFrame;
|
||||
CalypFrame* pcCurrFrame;
|
||||
for( unsigned int f = 0; f < numberOfFrames; f++ )
|
||||
PlaYUVerFrame* pcReferenceFrame;
|
||||
PlaYUVerFrame* pcCurrFrame;
|
||||
for( UInt f = 0; f < numberOfFrames; f++ )
|
||||
{
|
||||
padQualityValues[0].append( f );
|
||||
pcReferenceFrame = pcReferenceWindow->getCurrFrame();
|
||||
for( unsigned int i = 0; i < numberOfWindows; i++ )
|
||||
for( UInt i = 0; i < numberOfWindows; i++ )
|
||||
{
|
||||
pcCurrFrame = apcWindowList.at( i )->getCurrFrame();
|
||||
dCurrentQuality = pcCurrFrame->getQuality( m_iQualityMetricIdx, pcReferenceFrame, CLP_LUMA );
|
||||
padAverageQuality[i + 1] = ( padAverageQuality[i + 1] * double( f ) + dCurrentQuality ) / double( f + 1 );
|
||||
padQualityValues[i + 1].append( dCurrentQuality );
|
||||
padQualityValues[i + 1].append(
|
||||
pcCurrFrame->getQuality( m_iQualityMetricIdx, pcReferenceFrame, LUMA ) );
|
||||
apcWindowList.at( i )->seekRelativeEvent( true );
|
||||
}
|
||||
pcReferenceWindow->seekRelativeEvent( true );
|
||||
pcProgressBar->incrementProgress( 1 );
|
||||
}
|
||||
for( unsigned int i = 0; i < numberOfWindows; i++ )
|
||||
for( UInt i = 0; i < numberOfWindows; i++ )
|
||||
{
|
||||
apcWindowList.at( i )->stop();
|
||||
}
|
||||
pcReferenceWindow->stop();
|
||||
|
||||
QString qualityName = QString::fromStdString( CalypFrame::supportedQualityMetricsList()[m_iQualityMetricIdx] );
|
||||
QString qualityUnits = QString::fromStdString( CalypFrame::supportedQualityMetricsUnitsList()[m_iQualityMetricIdx] );
|
||||
|
||||
QString plotWindowTitle( QStringLiteral( "Quality" ) );
|
||||
if( apcWindowList.size() == 1 )
|
||||
{
|
||||
plotWindowTitle += " - " + apcWindowList.at( 0 )->getWindowName();
|
||||
}
|
||||
PlotSubWindow* pcPlotWindow = new PlotSubWindow( plotWindowTitle );
|
||||
pcPlotWindow->setAxisName( "Frame Number", QString( "%1 [%2]" ).arg( qualityName ).arg( qualityUnits ) );
|
||||
pcPlotWindow->setAxisName(
|
||||
"Frame Number",
|
||||
QString::fromStdString( PlaYUVerFrame::supportedQualityMetricsList()[m_iQualityMetricIdx] ) );
|
||||
|
||||
QString key;
|
||||
for( unsigned int i = 0; i < numberOfWindows; i++ )
|
||||
if( apcWindowList.size() > 1 )
|
||||
{
|
||||
key = apcWindowList.at( i )->getWindowName();
|
||||
key = QString( "[%1 %2] " ).arg( padAverageQuality[i + 1] ).arg( qualityUnits ) + key;
|
||||
pcPlotWindow->addPlot( padQualityValues[0], padQualityValues[i + 1], key );
|
||||
QString key;
|
||||
for( UInt i = 0; i < numberOfWindows; i++ )
|
||||
{
|
||||
key = apcWindowList.at( i )->getWindowName();
|
||||
pcPlotWindow->addPlot( padQualityValues[0], padQualityValues[i + 1], key );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pcPlotWindow->addPlot( padQualityValues[0], padQualityValues[1] );
|
||||
}
|
||||
|
||||
m_pcMainWindowManager->addSubWindow( pcPlotWindow );
|
||||
@@ -239,7 +242,7 @@ void QualityHandle::measureQuality( QVector<VideoSubWindow*> apcWindowList )
|
||||
pcProgressBar->close();
|
||||
}
|
||||
|
||||
void QualityHandle::slotQualityMetricChanged( int idx )
|
||||
Void QualityHandle::slotQualityMetricChanged( Int idx )
|
||||
{
|
||||
m_actionGroupQualityMetric->actions().at( idx )->setChecked( true );
|
||||
m_pcQualityHandleSideBar->updateQualityMetric( idx );
|
||||
@@ -247,15 +250,16 @@ void QualityHandle::slotQualityMetricChanged( int idx )
|
||||
m_iQualityMetricIdx = idx;
|
||||
}
|
||||
|
||||
void QualityHandle::slotSelectCurrentAsReference()
|
||||
Void QualityHandle::slotSelectCurrentAsReference()
|
||||
{
|
||||
VideoSubWindow* pcRefSubWindow = qobject_cast<VideoSubWindow*>( m_pcMainWindowManager->activeSubWindow() );
|
||||
VideoSubWindow* pcRefSubWindow =
|
||||
qobject_cast<VideoSubWindow*>( m_pcMainWindowManager->activeSubWindow() );
|
||||
if( pcRefSubWindow )
|
||||
{
|
||||
VideoSubWindow* pcVideoSubWindow;
|
||||
QList<SubWindowAbstract*> subWindowList =
|
||||
m_pcMainWindowManager->findSubWindow( SubWindowAbstract::VIDEO_SUBWINDOW );
|
||||
for( int i = 0; i < subWindowList.size(); i++ )
|
||||
for( Int i = 0; i < subWindowList.size(); i++ )
|
||||
{
|
||||
pcVideoSubWindow = qobject_cast<VideoSubWindow*>( subWindowList.at( i ) );
|
||||
if( pcVideoSubWindow != pcRefSubWindow )
|
||||
@@ -267,9 +271,10 @@ void QualityHandle::slotSelectCurrentAsReference()
|
||||
}
|
||||
}
|
||||
|
||||
void QualityHandle::slotPlotQualitySingle()
|
||||
Void QualityHandle::slotPlotQualitySingle()
|
||||
{
|
||||
VideoSubWindow* pcSubWindow = qobject_cast<VideoSubWindow*>( m_pcMainWindowManager->activeSubWindow() );
|
||||
VideoSubWindow* pcSubWindow =
|
||||
qobject_cast<VideoSubWindow*>( m_pcMainWindowManager->activeSubWindow() );
|
||||
if( pcSubWindow )
|
||||
{
|
||||
if( pcSubWindow->getRefSubWindow() )
|
||||
@@ -291,9 +296,10 @@ void QualityHandle::slotPlotQualitySingle()
|
||||
}
|
||||
}
|
||||
|
||||
void QualityHandle::slotPlotQualitySeveral()
|
||||
Void QualityHandle::slotPlotQualitySeveral()
|
||||
{
|
||||
VideoSubWindow* pcSubWindow = qobject_cast<VideoSubWindow*>( m_pcMainWindowManager->activeSubWindow() );
|
||||
VideoSubWindow* pcSubWindow =
|
||||
qobject_cast<VideoSubWindow*>( m_pcMainWindowManager->activeSubWindow() );
|
||||
if( pcSubWindow )
|
||||
{
|
||||
QVector<VideoSubWindow*> apcWindowList;
|
||||
@@ -307,7 +313,7 @@ void QualityHandle::slotPlotQualitySeveral()
|
||||
VideoSubWindow* pcVideoSubWindow;
|
||||
QList<SubWindowAbstract*> subWindowList =
|
||||
m_pcMainWindowManager->findSubWindow( SubWindowAbstract::VIDEO_STREAM_SUBWINDOW );
|
||||
for( int i = 0; i < subWindowList.size(); i++ )
|
||||
for( Int i = 0; i < subWindowList.size(); i++ )
|
||||
{
|
||||
pcVideoSubWindow = qobject_cast<VideoSubWindow*>( subWindowList.at( i ) );
|
||||
if( pcVideoSubWindow->getRefSubWindow() == pcRefSubWindow )
|
||||
|
||||
+20
-16
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -25,36 +25,40 @@
|
||||
#ifndef __QUALITYMEASUREMENT_H__
|
||||
#define __QUALITYMEASUREMENT_H__
|
||||
|
||||
#include "PlaYUVerAppDefs.h"
|
||||
#include "config.h"
|
||||
#include <QtCore>
|
||||
#if( QT_VERSION_PLAYUVER == 5 )
|
||||
#include <QtWidgets>
|
||||
#include "CommonDefs.h"
|
||||
#elif( QT_VERSION_PLAYUVER == 4 )
|
||||
#include <QtGui>
|
||||
#endif
|
||||
#include "QFuture"
|
||||
#include "QualityMeasurementSidebar.h"
|
||||
#include "config.h"
|
||||
|
||||
class SubWindowHandle;
|
||||
class PlaYUVerSubWindowHandle;
|
||||
class VideoSubWindow;
|
||||
|
||||
class QualityHandle : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QualityHandle( QWidget*, SubWindowHandle* );
|
||||
QualityHandle( QWidget*, PlaYUVerSubWindowHandle* );
|
||||
~QualityHandle();
|
||||
|
||||
void createActions();
|
||||
Void createActions();
|
||||
QMenu* createMenu();
|
||||
QDockWidget* createDock();
|
||||
void updateMenus();
|
||||
Void updateMenus();
|
||||
|
||||
void readSettings();
|
||||
void writeSettings();
|
||||
Void readSettings();
|
||||
Void writeSettings();
|
||||
|
||||
void update( VideoSubWindow* currSubWindow );
|
||||
Void update( VideoSubWindow* currSubWindow );
|
||||
|
||||
private:
|
||||
QWidget* m_pcParet;
|
||||
SubWindowHandle* m_pcMainWindowManager;
|
||||
PlaYUVerSubWindowHandle* m_pcMainWindowManager;
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -66,7 +70,7 @@ private:
|
||||
QVector<QAction*> m_arrayActions;
|
||||
QActionGroup* m_actionGroupQualityMetric;
|
||||
QSignalMapper* m_mapperQualityMetric;
|
||||
int m_iQualityMetricIdx;
|
||||
Int m_iQualityMetricIdx;
|
||||
|
||||
QMenu* m_pcMenuQuality;
|
||||
QMenu* m_pcSubMenuQualityMetrics;
|
||||
@@ -74,8 +78,8 @@ private:
|
||||
QDockWidget* m_pcQualityHandleDock;
|
||||
QualityMeasurementSidebar* m_pcQualityHandleSideBar;
|
||||
|
||||
QFuture<void> m_cMeasurementResult;
|
||||
void measureQuality( QVector<VideoSubWindow*> apcWindowList );
|
||||
QFuture<Void> m_cMeasurementResult;
|
||||
Void measureQuality( QVector<VideoSubWindow*> apcWindowList );
|
||||
|
||||
Q_SIGNALS:
|
||||
void changed();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -23,13 +23,12 @@
|
||||
*/
|
||||
|
||||
#include "QualityMeasurementSidebar.h"
|
||||
|
||||
#include "SubWindowHandle.h"
|
||||
#include "PlaYUVerSubWindowHandle.h"
|
||||
#include "VideoSubWindow.h"
|
||||
|
||||
#include <QtGui>
|
||||
|
||||
QualityMeasurementSidebar::QualityMeasurementSidebar( QWidget* parent, SubWindowHandle* windowManager )
|
||||
QualityMeasurementSidebar::QualityMeasurementSidebar( QWidget* parent,
|
||||
PlaYUVerSubWindowHandle* windowManager )
|
||||
: QWidget( parent ), m_pcMainWindowManager( windowManager ), m_pcCurrentVideoSubWindow( NULL )
|
||||
{
|
||||
// Side bar area -----------------------------------------------------
|
||||
@@ -44,9 +43,9 @@ QualityMeasurementSidebar::QualityMeasurementSidebar( QWidget* parent, SubWindow
|
||||
RecLabel->setAlignment( Qt::AlignVCenter | Qt::AlignRight );
|
||||
|
||||
m_comboBoxMetric = new QComboBox;
|
||||
for( unsigned int i = 0; i < CalypFrame::supportedQualityMetricsList().size(); i++ )
|
||||
for( UInt i = 0; i < PlaYUVerFrame::supportedQualityMetricsList().size(); i++ )
|
||||
{
|
||||
m_comboBoxMetric->insertItem( i, CalypFrame::supportedQualityMetricsList()[i].c_str() );
|
||||
m_comboBoxMetric->insertItem( i, PlaYUVerFrame::supportedQualityMetricsList()[i].c_str() );
|
||||
}
|
||||
m_comboBoxMetric->setSizeAdjustPolicy( QComboBox::AdjustToContents );
|
||||
m_comboBoxMetric->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
|
||||
@@ -64,34 +63,35 @@ QualityMeasurementSidebar::QualityMeasurementSidebar( QWidget* parent, SubWindow
|
||||
mainLayout->addWidget( RefLabel, 1, 0, Qt::AlignLeft );
|
||||
mainLayout->addWidget( m_comboBoxRef, 1, 1, 1, 2, Qt::AlignLeft );
|
||||
|
||||
m_ppcLabelQualityLabel[CLP_LUMA] = new QLabel( "PSNR Y:" );
|
||||
m_ppcLabelQualityLabel[CLP_LUMA]->setAlignment( Qt::AlignLeft | Qt::AlignVCenter );
|
||||
m_ppcLabelQualityValue[CLP_LUMA] = new QLabel;
|
||||
m_ppcLabelQualityValue[CLP_LUMA]->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
|
||||
m_ppcLabelQualityLabel[LUMA] = new QLabel( "PSNR Y:" );
|
||||
m_ppcLabelQualityLabel[LUMA]->setAlignment( Qt::AlignLeft | Qt::AlignVCenter );
|
||||
m_ppcLabelQualityValue[LUMA] = new QLabel;
|
||||
m_ppcLabelQualityValue[LUMA]->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
|
||||
|
||||
m_ppcLabelQualityLabel[CLP_CHROMA_U] = new QLabel( "PSNR U:" );
|
||||
m_ppcLabelQualityLabel[CLP_CHROMA_U]->setAlignment( Qt::AlignLeft | Qt::AlignVCenter );
|
||||
m_ppcLabelQualityValue[CLP_CHROMA_U] = new QLabel;
|
||||
m_ppcLabelQualityValue[CLP_CHROMA_U]->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
|
||||
m_ppcLabelQualityLabel[CHROMA_U] = new QLabel( "PSNR U:" );
|
||||
m_ppcLabelQualityLabel[CHROMA_U]->setAlignment( Qt::AlignLeft | Qt::AlignVCenter );
|
||||
m_ppcLabelQualityValue[CHROMA_U] = new QLabel;
|
||||
m_ppcLabelQualityValue[CHROMA_U]->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
|
||||
|
||||
m_ppcLabelQualityLabel[CLP_CHROMA_V] = new QLabel( "PSNR V:" );
|
||||
m_ppcLabelQualityLabel[CLP_CHROMA_V]->setAlignment( Qt::AlignLeft | Qt::AlignVCenter );
|
||||
m_ppcLabelQualityValue[CLP_CHROMA_V] = new QLabel;
|
||||
m_ppcLabelQualityValue[CLP_CHROMA_V]->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
|
||||
m_ppcLabelQualityLabel[CHROMA_V] = new QLabel( "PSNR V:" );
|
||||
m_ppcLabelQualityLabel[CHROMA_V]->setAlignment( Qt::AlignLeft | Qt::AlignVCenter );
|
||||
m_ppcLabelQualityValue[CHROMA_V] = new QLabel;
|
||||
m_ppcLabelQualityValue[CHROMA_V]->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
|
||||
|
||||
QGridLayout* qualityResultsLayout = new QGridLayout;
|
||||
qualityResultsLayout->addWidget( m_ppcLabelQualityLabel[CLP_LUMA], 0, 0 );
|
||||
qualityResultsLayout->addWidget( m_ppcLabelQualityValue[CLP_LUMA], 0, 1 );
|
||||
qualityResultsLayout->addWidget( m_ppcLabelQualityLabel[CLP_CHROMA_U], 1, 0 );
|
||||
qualityResultsLayout->addWidget( m_ppcLabelQualityValue[CLP_CHROMA_U], 1, 1 );
|
||||
qualityResultsLayout->addWidget( m_ppcLabelQualityLabel[CLP_CHROMA_V], 2, 0 );
|
||||
qualityResultsLayout->addWidget( m_ppcLabelQualityValue[CLP_CHROMA_V], 2, 1 );
|
||||
qualityResultsLayout->addWidget( m_ppcLabelQualityLabel[LUMA], 0, 0 );
|
||||
qualityResultsLayout->addWidget( m_ppcLabelQualityValue[LUMA], 0, 1 );
|
||||
qualityResultsLayout->addWidget( m_ppcLabelQualityLabel[CHROMA_U], 1, 0 );
|
||||
qualityResultsLayout->addWidget( m_ppcLabelQualityValue[CHROMA_U], 1, 1 );
|
||||
qualityResultsLayout->addWidget( m_ppcLabelQualityLabel[CHROMA_V], 2, 0 );
|
||||
qualityResultsLayout->addWidget( m_ppcLabelQualityValue[CHROMA_V], 2, 1 );
|
||||
|
||||
// QGroupBox *statisticsGroup = new QGroupBox( tr( "Quality" ) );
|
||||
QGroupBox* statisticsGroup = new QGroupBox;
|
||||
statisticsGroup->setLayout( qualityResultsLayout );
|
||||
statisticsGroup->setWhatsThis( tr( "<p>Here you can see the quality results calculated for the "
|
||||
"selected windows." ) );
|
||||
statisticsGroup->setWhatsThis(
|
||||
tr( "<p>Here you can see the quality results calculated for the "
|
||||
"selected windows." ) );
|
||||
|
||||
mainLayout->addWidget( statisticsGroup, 4, 0, 3, 3 );
|
||||
|
||||
@@ -99,7 +99,8 @@ QualityMeasurementSidebar::QualityMeasurementSidebar( QWidget* parent, SubWindow
|
||||
setLayout( mainLayout );
|
||||
|
||||
connect( m_comboBoxRef, SIGNAL( activated( int ) ), this, SLOT( slotReferenceChanged( int ) ) );
|
||||
connect( m_comboBoxMetric, SIGNAL( currentIndexChanged( int ) ), this, SLOT( slotQualityMetricChanged( int ) ) );
|
||||
connect( m_comboBoxMetric, SIGNAL( currentIndexChanged( int ) ), this,
|
||||
SLOT( slotQualityMetricChanged( int ) ) );
|
||||
}
|
||||
|
||||
QualityMeasurementSidebar::~QualityMeasurementSidebar() {}
|
||||
@@ -114,22 +115,23 @@ QSize QualityMeasurementSidebar::sizeHint() const
|
||||
return currSize;
|
||||
}
|
||||
|
||||
void QualityMeasurementSidebar::updateSideBar( bool hasSubWindow )
|
||||
Void QualityMeasurementSidebar::updateSideBar( Bool hasSubWindow )
|
||||
{
|
||||
if( !hasSubWindow )
|
||||
m_comboBoxRef->clear();
|
||||
setEnabled( hasSubWindow );
|
||||
}
|
||||
|
||||
void QualityMeasurementSidebar::updateSubWindowList()
|
||||
Void QualityMeasurementSidebar::updateSubWindowList()
|
||||
{
|
||||
QString currSubWindowName;
|
||||
m_pcWindowListNames.clear();
|
||||
m_pcVideoWindowList.clear();
|
||||
|
||||
VideoSubWindow* pcVideoSubWindow;
|
||||
QList<SubWindowAbstract*> subWindowList = m_pcMainWindowManager->findSubWindow( SubWindowAbstract::VIDEO_SUBWINDOW );
|
||||
for( int i = 0; i < subWindowList.size(); i++ )
|
||||
QList<SubWindowAbstract*> subWindowList =
|
||||
m_pcMainWindowManager->findSubWindow( SubWindowAbstract::VIDEO_SUBWINDOW );
|
||||
for( Int i = 0; i < subWindowList.size(); i++ )
|
||||
{
|
||||
pcVideoSubWindow = qobject_cast<VideoSubWindow*>( subWindowList.at( i ) );
|
||||
if( m_pcCurrentVideoSubWindow == pcVideoSubWindow )
|
||||
@@ -138,7 +140,8 @@ void QualityMeasurementSidebar::updateSubWindowList()
|
||||
}
|
||||
if( m_pcCurrentVideoSubWindow )
|
||||
{
|
||||
if( !m_pcCurrentVideoSubWindow->getCurrFrame()->haveSameFmt( pcVideoSubWindow->getCurrFrame() ) )
|
||||
if( !m_pcCurrentVideoSubWindow->getCurrFrame()->haveSameFmt(
|
||||
pcVideoSubWindow->getCurrFrame() ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -154,19 +157,19 @@ void QualityMeasurementSidebar::updateSubWindowList()
|
||||
{
|
||||
if( VideoSubWindow* refSubWindow = m_pcCurrentVideoSubWindow->getRefSubWindow() )
|
||||
{
|
||||
int index = m_pcVideoWindowList.indexOf( refSubWindow );
|
||||
Int index = m_pcVideoWindowList.indexOf( refSubWindow );
|
||||
m_comboBoxRef->setCurrentIndex( index );
|
||||
}
|
||||
}
|
||||
// m_comboBoxRef->setSizeAdjustPolicy( QComboBox::AdjustToContents );
|
||||
}
|
||||
|
||||
void QualityMeasurementSidebar::updateCurrentWindow( VideoSubWindow* subWindow )
|
||||
Void QualityMeasurementSidebar::updateCurrentWindow( VideoSubWindow* subWindow )
|
||||
{
|
||||
m_pcCurrentVideoSubWindow = subWindow;
|
||||
if( m_pcCurrentVideoSubWindow )
|
||||
{
|
||||
int index = -1;
|
||||
Int index = -1;
|
||||
if( VideoSubWindow* refSubWindow = m_pcCurrentVideoSubWindow->getRefSubWindow() )
|
||||
{
|
||||
index = m_pcVideoWindowList.indexOf( refSubWindow );
|
||||
@@ -177,7 +180,7 @@ void QualityMeasurementSidebar::updateCurrentWindow( VideoSubWindow* subWindow )
|
||||
}
|
||||
}
|
||||
|
||||
void QualityMeasurementSidebar::updateSidebarData()
|
||||
Void QualityMeasurementSidebar::updateSidebarData()
|
||||
{
|
||||
QString zeroValue( "0.0000" );
|
||||
if( m_pcCurrentVideoSubWindow )
|
||||
@@ -185,13 +188,11 @@ void QualityMeasurementSidebar::updateSidebarData()
|
||||
VideoSubWindow* refSubWindow = m_pcCurrentVideoSubWindow->getRefSubWindow();
|
||||
if( refSubWindow )
|
||||
{
|
||||
QApplication::setOverrideCursor( Qt::WaitCursor );
|
||||
|
||||
CalypFrame* currFrame = m_pcCurrentVideoSubWindow->getCurrFrame();
|
||||
CalypFrame* refFrame = refSubWindow->getCurrFrame();
|
||||
double quality;
|
||||
PlaYUVerFrame* currFrame = m_pcCurrentVideoSubWindow->getCurrFrame();
|
||||
PlaYUVerFrame* refFrame = refSubWindow->getCurrFrame();
|
||||
Double quality;
|
||||
QString value;
|
||||
unsigned int component = 0;
|
||||
UInt component = 0;
|
||||
for( ; component < currFrame->getNumberChannels(); component++ )
|
||||
{
|
||||
quality = currFrame->getQuality( m_comboBoxMetric->currentIndex(), refFrame, component );
|
||||
@@ -199,9 +200,9 @@ void QualityMeasurementSidebar::updateSidebarData()
|
||||
}
|
||||
for( ; component < 3; component++ )
|
||||
{
|
||||
quality = currFrame->getQuality( m_comboBoxMetric->currentIndex(), refFrame, component );
|
||||
m_ppcLabelQualityValue[component]->setText( zeroValue );
|
||||
}
|
||||
QApplication::restoreOverrideCursor();
|
||||
return;
|
||||
}
|
||||
else
|
||||
@@ -209,23 +210,23 @@ void QualityMeasurementSidebar::updateSidebarData()
|
||||
m_comboBoxRef->setCurrentIndex( -1 );
|
||||
}
|
||||
}
|
||||
for( int component = 0; component < 3; component++ )
|
||||
for( Int component = 0; component < 3; component++ )
|
||||
{
|
||||
m_ppcLabelQualityValue[component]->setText( zeroValue );
|
||||
}
|
||||
}
|
||||
|
||||
void QualityMeasurementSidebar::updateQualityMetric( int idx )
|
||||
Void QualityMeasurementSidebar::updateQualityMetric( Int idx )
|
||||
{
|
||||
m_comboBoxMetric->setCurrentIndex( idx );
|
||||
QString labelQuality( CalypFrame::supportedQualityMetricsList()[idx].c_str() );
|
||||
m_ppcLabelQualityLabel[CLP_LUMA]->setText( labelQuality + " Y" );
|
||||
m_ppcLabelQualityLabel[CLP_CHROMA_U]->setText( labelQuality + " U" );
|
||||
m_ppcLabelQualityLabel[CLP_CHROMA_V]->setText( labelQuality + " V" );
|
||||
QString labelQuality( PlaYUVerFrame::supportedQualityMetricsList()[idx].c_str() );
|
||||
m_ppcLabelQualityLabel[LUMA]->setText( labelQuality + " Y" );
|
||||
m_ppcLabelQualityLabel[CHROMA_U]->setText( labelQuality + " U" );
|
||||
m_ppcLabelQualityLabel[CHROMA_V]->setText( labelQuality + " V" );
|
||||
updateSidebarData();
|
||||
}
|
||||
|
||||
void QualityMeasurementSidebar::slotReferenceChanged( int index )
|
||||
Void QualityMeasurementSidebar::slotReferenceChanged( Int index )
|
||||
{
|
||||
if( index > -1 && m_pcCurrentVideoSubWindow )
|
||||
{
|
||||
@@ -247,7 +248,7 @@ void QualityMeasurementSidebar::slotReferenceChanged( int index )
|
||||
}
|
||||
}
|
||||
|
||||
void QualityMeasurementSidebar::slotQualityMetricChanged( int idx )
|
||||
Void QualityMeasurementSidebar::slotQualityMetricChanged( Int idx )
|
||||
{
|
||||
emit signalQualityMetricChanged( idx );
|
||||
// updateQualityMetric( idx );
|
||||
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -25,35 +25,39 @@
|
||||
#ifndef __QUALITYMEASUREMENTSIDEBAR_H__
|
||||
#define __QUALITYMEASUREMENTSIDEBAR_H__
|
||||
|
||||
#include "CommonDefs.h"
|
||||
#include "HistogramWidget.h"
|
||||
#include "PlaYUVerAppDefs.h"
|
||||
#include "config.h"
|
||||
#include "lib/CalypFrame.h"
|
||||
#include "lib/CalypStream.h"
|
||||
|
||||
#if( QT_VERSION_PLAYUVER == 5 )
|
||||
#include <QtWidgets>
|
||||
#elif( QT_VERSION_PLAYUVER == 4 )
|
||||
#include <QWidget>
|
||||
#include <QtGui>
|
||||
#endif
|
||||
#include "HistogramWidget.h"
|
||||
#include "lib/PlaYUVerFrame.h"
|
||||
#include "lib/PlaYUVerStream.h"
|
||||
|
||||
class SubWindowHandle;
|
||||
class PlaYUVerSubWindowHandle;
|
||||
class VideoSubWindow;
|
||||
|
||||
class QualityMeasurementSidebar : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QualityMeasurementSidebar( QWidget*, SubWindowHandle* );
|
||||
QualityMeasurementSidebar( QWidget*, PlaYUVerSubWindowHandle* );
|
||||
~QualityMeasurementSidebar();
|
||||
|
||||
QSize sizeHint() const;
|
||||
|
||||
void updateSideBar( bool hasSubWindow );
|
||||
Void updateSideBar( Bool hasSubWindow );
|
||||
|
||||
void updateSubWindowList();
|
||||
void updateCurrentWindow( VideoSubWindow* );
|
||||
void updateSidebarData();
|
||||
void updateQualityMetric( int );
|
||||
Void updateSubWindowList();
|
||||
Void updateCurrentWindow( VideoSubWindow* );
|
||||
Void updateSidebarData();
|
||||
Void updateQualityMetric( Int );
|
||||
|
||||
private:
|
||||
SubWindowHandle* m_pcMainWindowManager;
|
||||
PlaYUVerSubWindowHandle* m_pcMainWindowManager;
|
||||
|
||||
QVector<VideoSubWindow*> m_pcVideoWindowList;
|
||||
QStringList m_pcWindowListNames;
|
||||
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -23,17 +23,14 @@
|
||||
*/
|
||||
|
||||
#include "SeekStreamDialog.h"
|
||||
|
||||
#include "lib/CalypStream.h"
|
||||
|
||||
#include <QDialogButtonBox>
|
||||
#include "lib/PlaYUVerStream.h"
|
||||
#include <QGridLayout>
|
||||
#include <QLabel>
|
||||
#include <QSpinBox>
|
||||
#include <QVector>
|
||||
#include <QWidget>
|
||||
|
||||
SeekStreamDialog::SeekStreamDialog( CalypStream* pcCurrStream, QWidget* parent )
|
||||
SeekStreamDialog::SeekStreamDialog( PlaYUVerStream* pcCurrStream, QWidget* parent )
|
||||
: QDialog( parent, Qt::Dialog | Qt::WindowTitleHint ), m_iSelectedFrameNum()
|
||||
{
|
||||
m_iSelectedFrameNum = pcCurrStream->getCurrFrameNum();
|
||||
@@ -60,7 +57,8 @@ SeekStreamDialog::SeekStreamDialog( CalypStream* pcCurrStream, QWidget* parent )
|
||||
QVBoxLayout* verticalLayout = new QVBoxLayout;
|
||||
QHBoxLayout* horizontalLayout = new QHBoxLayout;
|
||||
horizontalLayout->addWidget( pcLabel );
|
||||
horizontalLayout->addItem( new QSpacerItem( 20, 10, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
|
||||
horizontalLayout->addItem(
|
||||
new QSpacerItem( 20, 10, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
|
||||
horizontalLayout->addWidget( m_spinFrameNum );
|
||||
verticalLayout->addLayout( horizontalLayout );
|
||||
verticalLayout->addWidget( dialogButtonOkCancel, Qt::AlignRight );
|
||||
@@ -70,7 +68,7 @@ SeekStreamDialog::SeekStreamDialog( CalypStream* pcCurrStream, QWidget* parent )
|
||||
connect( dialogButtonOkCancel, SIGNAL( rejected() ), this, SLOT( reject() ) );
|
||||
}
|
||||
|
||||
int SeekStreamDialog::runDialog()
|
||||
Int SeekStreamDialog::runDialog()
|
||||
{
|
||||
m_spinFrameNum->selectAll();
|
||||
if( exec() == QDialog::Rejected )
|
||||
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -25,15 +25,12 @@
|
||||
#ifndef __SEEKSTREAMDIALOG_H__
|
||||
#define __SEEKSTREAMDIALOG_H__
|
||||
|
||||
#include "CalypAppModuleIf.h"
|
||||
#include "CommonDefs.h"
|
||||
#include "PlaYUVerAppDefs.h"
|
||||
#include "PlaYUVerAppModuleIf.h"
|
||||
#include "config.h"
|
||||
|
||||
#include <QDialog>
|
||||
#include <QVector>
|
||||
|
||||
class QSpinBox;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -42,12 +39,12 @@ class SeekStreamDialog : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SeekStreamDialog( CalypStream* pcCurrStream, QWidget* parent = 0 );
|
||||
int runDialog();
|
||||
SeekStreamDialog( PlaYUVerStream* pcCurrStream, QWidget* parent = 0 );
|
||||
Int runDialog();
|
||||
|
||||
private:
|
||||
QSpinBox* m_spinFrameNum;
|
||||
int m_iSelectedFrameNum;
|
||||
Int m_iSelectedFrameNum;
|
||||
};
|
||||
|
||||
#endif // __MODULEHANDLEOPTDIALOG_H__
|
||||
+12
-14
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -23,16 +23,14 @@
|
||||
*/
|
||||
|
||||
#include "SubWindowAbstract.h"
|
||||
|
||||
#include "MdiSubWindow.h"
|
||||
|
||||
#include "PlaYUVerMdiSubWindow.h"
|
||||
#include <QCloseEvent>
|
||||
#include <QFocusEvent>
|
||||
#include <QHBoxLayout>
|
||||
#include <QIcon>
|
||||
#include <QScrollBar>
|
||||
|
||||
SubWindowAbstract::SubWindowAbstract( QWidget* parent, unsigned int category )
|
||||
SubWindowAbstract::SubWindowAbstract( QWidget* parent, UInt category )
|
||||
: QWidget( parent ), m_cSubWindow( NULL )
|
||||
{
|
||||
setParent( parent );
|
||||
@@ -42,7 +40,7 @@ SubWindowAbstract::SubWindowAbstract( QWidget* parent, unsigned int category )
|
||||
setAttribute( Qt::WA_DeleteOnClose );
|
||||
setBackgroundRole( QPalette::Background );
|
||||
|
||||
setWindowIcon( QIcon( ":/logos/calyp-icon.png" ) );
|
||||
setWindowIcon( QIcon( ":/images/playuver.png" ) );
|
||||
|
||||
// setWidgetResizable( true );
|
||||
m_pcLayout = NULL;
|
||||
@@ -57,7 +55,7 @@ SubWindowAbstract::~SubWindowAbstract()
|
||||
return;
|
||||
}
|
||||
|
||||
void SubWindowAbstract::setWidget( QWidget* widget )
|
||||
Void SubWindowAbstract::setWidget( QWidget* widget )
|
||||
{
|
||||
QGridLayout* layout = new QGridLayout( this );
|
||||
layout->setContentsMargins( 0, 0, 0, 0 );
|
||||
@@ -69,7 +67,7 @@ void SubWindowAbstract::onDestroyed()
|
||||
return;
|
||||
}
|
||||
|
||||
void SubWindowAbstract::setWindowName( QString name )
|
||||
Void SubWindowAbstract::setWindowName( QString name )
|
||||
{
|
||||
m_cWindowName = name;
|
||||
setWindowTitle( m_cWindowName );
|
||||
@@ -80,7 +78,7 @@ QString SubWindowAbstract::getWindowName()
|
||||
return m_cWindowName;
|
||||
}
|
||||
|
||||
bool SubWindowAbstract::mayClose()
|
||||
Bool SubWindowAbstract::mayClose()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -95,18 +93,18 @@ QSize SubWindowAbstract::sizeHint( const QSize& ) const
|
||||
return QSize();
|
||||
}
|
||||
|
||||
void SubWindowAbstract::focusInEvent( QFocusEvent* event )
|
||||
Void SubWindowAbstract::focusInEvent( QFocusEvent* event )
|
||||
{
|
||||
emit aboutToActivate( this );
|
||||
}
|
||||
|
||||
void SubWindowAbstract::closeEvent( QCloseEvent* event )
|
||||
Void SubWindowAbstract::closeEvent( QCloseEvent* event )
|
||||
{
|
||||
emit aboutToClose( this );
|
||||
event->accept();
|
||||
}
|
||||
|
||||
void SubWindowAbstract::closeSubWindow()
|
||||
Void SubWindowAbstract::closeSubWindow()
|
||||
{
|
||||
close();
|
||||
if( m_cSubWindow )
|
||||
|
||||
+29
-29
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -19,14 +19,14 @@
|
||||
|
||||
/**
|
||||
* \file SubWindowAbstract.h
|
||||
* \ingroup CalypApp CalypApp_Subwindow
|
||||
* \ingroup PlaYUVerApp PlaYUVerApp_Subwindow
|
||||
* \brief Abstract class to handle subwindows
|
||||
*
|
||||
* @defgroup CalypApp_Subwindow SubWindow definition
|
||||
* @defgroup PlaYUVerApp_Subwindow SubWindow definition
|
||||
* @{
|
||||
* \ingroup CalypApp
|
||||
* \ingroup PlaYUVerApp
|
||||
*
|
||||
* Different SubWindow may be found in the CalypApp
|
||||
* Different SubWindow may be found in the PlaYUVerApp
|
||||
* Each one provide different functionality and serve
|
||||
* different purposes, ( e.g., displaying a video stream
|
||||
* or displaying a quality plot)
|
||||
@@ -37,18 +37,18 @@
|
||||
#ifndef __SUBWINDOWABSTRACT_H__
|
||||
#define __SUBWINDOWABSTRACT_H__
|
||||
|
||||
#include "PlaYUVerAppDefs.h"
|
||||
#include "config.h"
|
||||
#include <QPoint>
|
||||
#include <QSize>
|
||||
#include <QString>
|
||||
#include <QWidget>
|
||||
#include "CommonDefs.h"
|
||||
#include "config.h"
|
||||
|
||||
class QHBoxLayout;
|
||||
class QFocusEvent;
|
||||
class QCloseEvent;
|
||||
|
||||
class MdiSubWindow;
|
||||
class PlaYUVerMdiSubWindow;
|
||||
|
||||
class SubWindowAbstract : public QWidget
|
||||
{
|
||||
@@ -56,10 +56,10 @@ class SubWindowAbstract : public QWidget
|
||||
|
||||
private:
|
||||
QHBoxLayout* m_pcLayout;
|
||||
unsigned int m_uiCategory;
|
||||
UInt m_uiCategory;
|
||||
QString m_cWindowName;
|
||||
|
||||
MdiSubWindow* m_cSubWindow;
|
||||
PlaYUVerMdiSubWindow* m_cSubWindow;
|
||||
|
||||
public:
|
||||
enum SubWindowCategory
|
||||
@@ -72,35 +72,35 @@ public:
|
||||
};
|
||||
Q_DECLARE_FLAGS( SubWindowCategories, SubWindowCategory )
|
||||
|
||||
SubWindowAbstract( QWidget*, unsigned int );
|
||||
SubWindowAbstract( QWidget*, UInt );
|
||||
~SubWindowAbstract();
|
||||
|
||||
/**
|
||||
* Show the image at its original size
|
||||
*/
|
||||
virtual void refreshSubWindow() = 0;
|
||||
virtual Void refreshSubWindow() = 0;
|
||||
|
||||
/**
|
||||
* Show the image at its original size
|
||||
*/
|
||||
virtual void normalSize() = 0;
|
||||
virtual Void normalSize() = 0;
|
||||
/**
|
||||
* Scale the image (zoomed in or out) to fit on the window.
|
||||
*/
|
||||
virtual void zoomToFit() = 0;
|
||||
virtual Void zoomToFit() = 0;
|
||||
/**
|
||||
* Scale the image (zoomed in or out) to speficied absolute zoom value (1.0 =
|
||||
* original size).
|
||||
*/
|
||||
virtual void zoomToFactor( double factor, QPoint center = QPoint() ) = 0;
|
||||
virtual Void zoomToFactor( Double factor, QPoint center = QPoint() ) = 0;
|
||||
/**
|
||||
* Scale the image by a given factor
|
||||
* @param factor factor of scale. Ex: 1.2 scale the image up by 20% and
|
||||
* 0.8 scale the image down by 25%
|
||||
*/
|
||||
virtual void scaleView( double, QPoint center = QPoint() ) = 0;
|
||||
virtual Void scaleView( Double, QPoint center = QPoint() ) = 0;
|
||||
|
||||
virtual double getScaleFactor() = 0;
|
||||
virtual Double getScaleFactor() = 0;
|
||||
|
||||
/**
|
||||
* Size related functions
|
||||
@@ -112,10 +112,10 @@ public:
|
||||
* Window name
|
||||
*/
|
||||
|
||||
void setWindowName( QString );
|
||||
Void setWindowName( QString );
|
||||
QString getWindowName();
|
||||
|
||||
virtual bool mayClose();
|
||||
virtual Bool mayClose();
|
||||
|
||||
/**
|
||||
* Get category of the SubWindow
|
||||
@@ -123,33 +123,33 @@ public:
|
||||
* @note This function should be used with enum SubWindowCategories
|
||||
* with an & operation and it may belong to several categories
|
||||
*/
|
||||
unsigned int getCategory() { return m_uiCategory; }
|
||||
UInt getCategory() { return m_uiCategory; }
|
||||
/**
|
||||
* Check category of the SubWindow
|
||||
* @param checkCateory SubWindow category to check against;
|
||||
* it should be enum SubWindowCategories type
|
||||
* @return true when SubWindow belong to checkCateory
|
||||
*/
|
||||
bool checkCategory( unsigned int checkCateory ) { return m_uiCategory & checkCateory; }
|
||||
void setSubWindow( MdiSubWindow* subWindow ) { m_cSubWindow = subWindow; }
|
||||
void closeSubWindow();
|
||||
Bool checkCategory( UInt checkCateory ) { return m_uiCategory & checkCateory; }
|
||||
Void setSubWindow( PlaYUVerMdiSubWindow* subWindow ) { m_cSubWindow = subWindow; }
|
||||
Void closeSubWindow();
|
||||
|
||||
protected:
|
||||
void focusInEvent( QFocusEvent* event );
|
||||
virtual void closeEvent( QCloseEvent* event );
|
||||
void closeEvent( QCloseEvent* event );
|
||||
|
||||
void setWidget( QWidget* widget );
|
||||
Void setWidget( QWidget* widget );
|
||||
|
||||
Q_SIGNALS:
|
||||
/**
|
||||
* Notify that zoom factor was changed by internal event (e.g. by mouse wheel)
|
||||
*/
|
||||
void zoomFactorChanged( const double, const QPoint );
|
||||
void zoomFactorChanged_SWindow( const double, const QPoint );
|
||||
/**
|
||||
* Notify that scrollbar position was changed by internal event (e.g. by mouse
|
||||
* panning )
|
||||
*/
|
||||
void scrollBarMoved( const double&, const double& );
|
||||
void scrollBarMoved_SWindow( const QPoint );
|
||||
/**
|
||||
* Update stauts bars
|
||||
*/
|
||||
|
||||
+141
-176
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -23,15 +23,13 @@
|
||||
*/
|
||||
|
||||
#include "VideoHandle.h"
|
||||
|
||||
#include "FrameNumberWidget.h"
|
||||
#include "DialogSubWindowSelector.h"
|
||||
#include "FramePropertiesDock.h"
|
||||
#include "MainWindow.h"
|
||||
#include "PlaYUVerApp.h"
|
||||
#include "PlaYUVerSubWindowHandle.h"
|
||||
#include "SeekStreamDialog.h"
|
||||
#include "SubWindowHandle.h"
|
||||
#include "SubWindowSelectorDialog.h"
|
||||
#include "VideoSubWindow.h"
|
||||
|
||||
#include "WidgetFrameNumber.h"
|
||||
#include <QDockWidget>
|
||||
#include <QElapsedTimer>
|
||||
#include <QLabel>
|
||||
@@ -43,31 +41,35 @@
|
||||
#include <QElapsedTimer>
|
||||
#endif
|
||||
|
||||
VideoHandle::VideoHandle( QWidget* parent, SubWindowHandle* windowManager )
|
||||
VideoHandle::VideoHandle( QWidget* parent, PlaYUVerSubWindowHandle* windowManager )
|
||||
: m_pcParet( parent ), m_pcMainWindowManager( windowManager )
|
||||
{
|
||||
m_pcCurrentVideoSubWindow = NULL;
|
||||
m_bIsPlaying = false;
|
||||
m_pcPlayingTimer = new QTimer;
|
||||
m_pcPlayingTimer->setTimerType( Qt::PreciseTimer );
|
||||
#if( QT_VERSION_PLAYUVER == 5 )
|
||||
m_pcPlayingTimer->setTimerType( Qt::CoarseTimer );
|
||||
#endif
|
||||
connect( m_pcPlayingTimer, SIGNAL( timeout() ), this, SLOT( playEvent() ) );
|
||||
m_acPlayingSubWindows.clear();
|
||||
}
|
||||
|
||||
VideoHandle::~VideoHandle() {}
|
||||
|
||||
void VideoHandle::createActions()
|
||||
Void VideoHandle::createActions()
|
||||
{
|
||||
m_arrayActions.resize( TOTAL_ACT );
|
||||
m_arrayActions[PLAY_ACT] = new QAction( "Play", this );
|
||||
m_arrayActions[PLAY_ACT]->setStatusTip( "Play/Pause" );
|
||||
m_arrayActions[PLAY_ACT]->setIcon( QIcon( m_pcParet->style()->standardIcon( QStyle::SP_MediaPlay ) ) );
|
||||
m_arrayActions[PLAY_ACT]->setIcon(
|
||||
QIcon( m_pcParet->style()->standardIcon( QStyle::SP_MediaPlay ) ) );
|
||||
m_arrayActions[PLAY_ACT]->setShortcut( Qt::Key_Space );
|
||||
connect( m_arrayActions[PLAY_ACT], SIGNAL( triggered() ), this, SLOT( play() ) );
|
||||
|
||||
m_arrayActions[STOP_ACT] = new QAction( "Stop", this );
|
||||
m_arrayActions[STOP_ACT]->setStatusTip( "Stop" );
|
||||
m_arrayActions[STOP_ACT]->setIcon( QIcon( m_pcParet->style()->standardIcon( QStyle::SP_MediaStop ) ) );
|
||||
m_arrayActions[STOP_ACT]->setIcon(
|
||||
QIcon( m_pcParet->style()->standardIcon( QStyle::SP_MediaStop ) ) );
|
||||
connect( m_arrayActions[STOP_ACT], SIGNAL( triggered() ), this, SLOT( stop() ) );
|
||||
|
||||
m_mapperVideoSeek = new QSignalMapper( this );
|
||||
@@ -78,7 +80,8 @@ void VideoHandle::createActions()
|
||||
m_arrayActions[VIDEO_BACKWARD_ACT]->setIcon(
|
||||
QIcon( m_pcParet->style()->standardIcon( QStyle::SP_MediaSeekBackward ) ) );
|
||||
m_arrayActions[VIDEO_BACKWARD_ACT]->setShortcut( Qt::Key_Left );
|
||||
connect( m_arrayActions[VIDEO_BACKWARD_ACT], SIGNAL( triggered() ), m_mapperVideoSeek, SLOT( map() ) );
|
||||
connect( m_arrayActions[VIDEO_BACKWARD_ACT], SIGNAL( triggered() ), m_mapperVideoSeek,
|
||||
SLOT( map() ) );
|
||||
m_mapperVideoSeek->setMapping( m_arrayActions[VIDEO_BACKWARD_ACT], 0 );
|
||||
|
||||
m_arrayActions[VIDEO_FORWARD_ACT] = new QAction( "Video Forward", this );
|
||||
@@ -86,7 +89,8 @@ void VideoHandle::createActions()
|
||||
m_arrayActions[VIDEO_FORWARD_ACT]->setIcon(
|
||||
QIcon( m_pcParet->style()->standardIcon( QStyle::SP_MediaSeekForward ) ) );
|
||||
m_arrayActions[VIDEO_FORWARD_ACT]->setShortcut( Qt::Key_Right );
|
||||
connect( m_arrayActions[VIDEO_FORWARD_ACT], SIGNAL( triggered() ), m_mapperVideoSeek, SLOT( map() ) );
|
||||
connect( m_arrayActions[VIDEO_FORWARD_ACT], SIGNAL( triggered() ), m_mapperVideoSeek,
|
||||
SLOT( map() ) );
|
||||
m_mapperVideoSeek->setMapping( m_arrayActions[VIDEO_FORWARD_ACT], 1 );
|
||||
|
||||
m_arrayActions[VIDEO_GOTO_ACT] = new QAction( "Go to", this );
|
||||
@@ -110,19 +114,21 @@ void VideoHandle::createActions()
|
||||
m_arrayActions[VIDEO_LOCK_SELECTION_ACT]->setStatusTip(
|
||||
"Select which windows should be played synchronized. Press Ctrl while "
|
||||
"click to quickly to select all!" );
|
||||
connect( m_arrayActions[VIDEO_LOCK_SELECTION_ACT], SIGNAL( triggered() ), this, SLOT( videoSelectionButtonEvent() ) );
|
||||
connect( m_arrayActions[VIDEO_LOCK_SELECTION_ACT], SIGNAL( triggered() ), this,
|
||||
SLOT( videoSelectionButtonEvent() ) );
|
||||
|
||||
m_pcFrameSlider = new QSlider;
|
||||
m_pcFrameSlider->setOrientation( Qt::Horizontal );
|
||||
m_pcFrameSlider->setMaximumWidth( 2000 );
|
||||
m_pcFrameSlider->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Fixed ) );
|
||||
m_pcFrameSlider->setSizePolicy(
|
||||
QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Fixed ) );
|
||||
m_pcFrameSlider->setEnabled( false );
|
||||
m_pcFrameSlider->setTracking( false );
|
||||
connect( m_pcFrameSlider, SIGNAL( valueChanged( int ) ), this, SLOT( seekSliderEvent( int ) ) );
|
||||
|
||||
// ------------ Image ------------
|
||||
m_actionGroupTools = new QActionGroup( this );
|
||||
m_actionGroupTools->setExclusive( true );
|
||||
// ------------ Tools ------------
|
||||
actionGroupTools = new QActionGroup( this );
|
||||
actionGroupTools->setExclusive( true );
|
||||
|
||||
m_mapperTools = new QSignalMapper( this );
|
||||
connect( m_mapperTools, SIGNAL( mapped( int ) ), this, SLOT( setTool( int ) ) );
|
||||
@@ -133,45 +139,35 @@ void VideoHandle::createActions()
|
||||
m_arrayActions[NAVIGATION_TOOL_ACT]->setCheckable( true );
|
||||
m_arrayActions[NAVIGATION_TOOL_ACT]->setChecked( true );
|
||||
m_arrayActions[NAVIGATION_TOOL_ACT]->setShortcut( Qt::CTRL + Qt::Key_1 );
|
||||
m_actionGroupTools->addAction( m_arrayActions[NAVIGATION_TOOL_ACT] );
|
||||
connect( m_arrayActions[NAVIGATION_TOOL_ACT], SIGNAL( triggered() ), m_mapperTools, SLOT( map() ) );
|
||||
actionGroupTools->addAction( m_arrayActions[NAVIGATION_TOOL_ACT] );
|
||||
connect( m_arrayActions[NAVIGATION_TOOL_ACT], SIGNAL( triggered() ), m_mapperTools,
|
||||
SLOT( map() ) );
|
||||
m_mapperTools->setMapping( m_arrayActions[NAVIGATION_TOOL_ACT], ViewArea::NavigationView );
|
||||
|
||||
m_arrayActions[SELECTION_TOOL_ACT] = new QAction( "Selection Tool", this );
|
||||
m_arrayActions[SELECTION_TOOL_ACT]->setCheckable( true );
|
||||
m_arrayActions[SELECTION_TOOL_ACT]->setChecked( false );
|
||||
m_arrayActions[SELECTION_TOOL_ACT]->setShortcut( Qt::CTRL + Qt::Key_2 );
|
||||
m_actionGroupTools->addAction( m_arrayActions[SELECTION_TOOL_ACT] );
|
||||
connect( m_arrayActions[SELECTION_TOOL_ACT], SIGNAL( triggered() ), m_mapperTools, SLOT( map() ) );
|
||||
actionGroupTools->addAction( m_arrayActions[SELECTION_TOOL_ACT] );
|
||||
connect( m_arrayActions[SELECTION_TOOL_ACT], SIGNAL( triggered() ), m_mapperTools,
|
||||
SLOT( map() ) );
|
||||
m_mapperTools->setMapping( m_arrayActions[SELECTION_TOOL_ACT], ViewArea::NormalSelectionView );
|
||||
|
||||
m_arrayActions[BLOCK_SELECTION_TOOL_ACT] = new QAction( "Block Selection Tool", this );
|
||||
m_arrayActions[BLOCK_SELECTION_TOOL_ACT]->setCheckable( true );
|
||||
m_arrayActions[BLOCK_SELECTION_TOOL_ACT]->setChecked( false );
|
||||
m_arrayActions[BLOCK_SELECTION_TOOL_ACT]->setShortcut( Qt::CTRL + Qt::Key_3 );
|
||||
m_actionGroupTools->addAction( m_arrayActions[BLOCK_SELECTION_TOOL_ACT] );
|
||||
connect( m_arrayActions[BLOCK_SELECTION_TOOL_ACT], SIGNAL( triggered() ), m_mapperTools, SLOT( map() ) );
|
||||
m_mapperTools->setMapping( m_arrayActions[BLOCK_SELECTION_TOOL_ACT], ViewArea::BlockSelectionView );
|
||||
|
||||
m_mapperGrid = new QSignalMapper( this );
|
||||
m_actionGroupGrid = new QActionGroup( this );
|
||||
m_actionGroupGrid->setExclusive( true );
|
||||
m_mapperGrid->setMapping( m_actionGroupGrid->addAction( "8x8" ), 8 );
|
||||
m_mapperGrid->setMapping( m_actionGroupGrid->addAction( "16x16" ), 16 );
|
||||
m_mapperGrid->setMapping( m_actionGroupGrid->addAction( "64x64" ), 64 );
|
||||
|
||||
for( int i = 0; i < m_actionGroupGrid->actions().size(); i++ )
|
||||
{
|
||||
m_actionGroupGrid->actions().at( i )->setCheckable( true );
|
||||
connect( m_actionGroupGrid->actions().at( i ), SIGNAL( triggered() ), m_mapperGrid, SLOT( map() ) );
|
||||
}
|
||||
m_actionGroupGrid->actions().at( 2 )->setChecked( true );
|
||||
connect( m_mapperGrid, SIGNAL( mapped( int ) ), this, SLOT( setGridSize( int ) ) );
|
||||
actionGroupTools->addAction( m_arrayActions[BLOCK_SELECTION_TOOL_ACT] );
|
||||
connect( m_arrayActions[BLOCK_SELECTION_TOOL_ACT], SIGNAL( triggered() ), m_mapperTools,
|
||||
SLOT( map() ) );
|
||||
m_mapperTools->setMapping( m_arrayActions[BLOCK_SELECTION_TOOL_ACT],
|
||||
ViewArea::BlockSelectionView );
|
||||
|
||||
m_arrayActions[SHOW_GRID_ACT] = new QAction( "Show grid", this );
|
||||
m_arrayActions[SHOW_GRID_ACT]->setCheckable( true );
|
||||
m_arrayActions[SHOW_GRID_ACT]->setChecked( false );
|
||||
connect( m_arrayActions[SHOW_GRID_ACT], SIGNAL( toggled( bool ) ), this, SLOT( toggleGrid( bool ) ) );
|
||||
connect( m_arrayActions[SHOW_GRID_ACT], SIGNAL( toggled( bool ) ), this,
|
||||
SLOT( toggleGrid( bool ) ) );
|
||||
}
|
||||
|
||||
QMenu* VideoHandle::createVideoMenu()
|
||||
@@ -197,8 +193,6 @@ QMenu* VideoHandle::createImageMenu()
|
||||
m_pcMenuImage->addAction( m_arrayActions[BLOCK_SELECTION_TOOL_ACT] );
|
||||
m_pcMenuImage->addSeparator();
|
||||
m_pcMenuImage->addAction( m_arrayActions[SHOW_GRID_ACT] );
|
||||
QMenu* gridSizeMenu = m_pcMenuImage->addMenu( "Grid size" );
|
||||
gridSizeMenu->addActions( m_actionGroupGrid->actions() );
|
||||
return m_pcMenuImage;
|
||||
}
|
||||
|
||||
@@ -218,7 +212,7 @@ QToolBar* VideoHandle::createToolBar()
|
||||
m_toolbarVideo->addWidget( m_pcFrameSlider );
|
||||
m_toolbarVideo->addAction( m_arrayActions[VIDEO_FORWARD_ACT] );
|
||||
m_toolbarVideo->addWidget( new QLabel );
|
||||
m_pcFrameNumInfo = new FrameNumberWidget;
|
||||
m_pcFrameNumInfo = new WidgetFrameNumber;
|
||||
m_toolbarVideo->addWidget( m_pcFrameNumInfo );
|
||||
|
||||
return m_toolbarVideo;
|
||||
@@ -259,22 +253,26 @@ QWidget* VideoHandle::createStatusBarMessage()
|
||||
return pcStatusBarWidget;
|
||||
}
|
||||
|
||||
void VideoHandle::updateMenus()
|
||||
Void VideoHandle::updateMenus()
|
||||
{
|
||||
VideoSubWindow* pcSubWindow = qobject_cast<VideoSubWindow*>( m_pcMainWindowManager->activeSubWindow() );
|
||||
bool hasSubWindow = pcSubWindow ? true : false;
|
||||
VideoSubWindow* pcSubWindow =
|
||||
qobject_cast<VideoSubWindow*>( m_pcMainWindowManager->activeSubWindow() );
|
||||
Bool hasSubWindow = pcSubWindow ? true : false;
|
||||
|
||||
m_arrayActions[PLAY_ACT]->setEnabled( hasSubWindow );
|
||||
// m_arrayActions[PAUSE_ACT]->setEnabled( hasSubWindow );
|
||||
m_arrayActions[STOP_ACT]->setEnabled( hasSubWindow );
|
||||
m_arrayActions[VIDEO_BACKWARD_ACT]->setEnabled( hasSubWindow );
|
||||
m_arrayActions[VIDEO_FORWARD_ACT]->setEnabled( hasSubWindow );
|
||||
m_arrayActions[VIDEO_REPEAT_ACT]->setEnabled( hasSubWindow );
|
||||
m_arrayActions[VIDEO_GOTO_ACT]->setEnabled( hasSubWindow );
|
||||
m_arrayActions[VIDEO_ZOOM_LOCK_ACT]->setEnabled( hasSubWindow );
|
||||
m_arrayActions[VIDEO_LOCK_SELECTION_ACT]->setEnabled( hasSubWindow );
|
||||
m_pcFrameSlider->setEnabled( hasSubWindow );
|
||||
if( !hasSubWindow )
|
||||
{
|
||||
disconnect( m_pcFrameSlider, SIGNAL( valueChanged( int ) ), this, SLOT( seekSliderEvent( int ) ) );
|
||||
disconnect( m_pcFrameSlider, SIGNAL( valueChanged( int ) ), this,
|
||||
SLOT( seekSliderEvent( int ) ) );
|
||||
m_pcFrameSlider->setValue( 0 );
|
||||
m_pcFrameNumInfo->clear();
|
||||
}
|
||||
@@ -289,46 +287,47 @@ void VideoHandle::updateMenus()
|
||||
m_arrayActions[SHOW_GRID_ACT]->setEnabled( hasSubWindow );
|
||||
}
|
||||
|
||||
void VideoHandle::readSettings()
|
||||
Void VideoHandle::readSettings()
|
||||
{
|
||||
QSettings appSettings;
|
||||
m_arrayActions[VIDEO_REPEAT_ACT]->setChecked( appSettings.value( "VideoHandle/Repeat", false ).toBool() );
|
||||
m_arrayActions[VIDEO_ZOOM_LOCK_ACT]->setChecked( appSettings.value( "VideoHandle/VideoZoomLock", false ).toBool() );
|
||||
m_arrayActions[VIDEO_REPEAT_ACT]->setChecked(
|
||||
appSettings.value( "VideoHandle/Repeat", false ).toBool() );
|
||||
m_arrayActions[VIDEO_ZOOM_LOCK_ACT]->setChecked(
|
||||
appSettings.value( "VideoHandle/VideoZoomLock", false ).toBool() );
|
||||
if( !appSettings.value( "VideoHandle/FrameProperties", true ).toBool() )
|
||||
m_pcFramePropertiesDock->close();
|
||||
|
||||
m_uiViewTool = appSettings.value( "VideoHandle/SelectedTool", ViewArea::NavigationView ).toUInt();
|
||||
setTool( m_uiViewTool );
|
||||
|
||||
m_arrayActions[SHOW_GRID_ACT]->setChecked( appSettings.value( "VideoHandle/ShowGrid", false ).toBool() );
|
||||
}
|
||||
|
||||
void VideoHandle::writeSettings()
|
||||
Void VideoHandle::writeSettings()
|
||||
{
|
||||
QSettings appSettings;
|
||||
appSettings.setValue( "VideoHandle/Repeat", m_arrayActions[VIDEO_REPEAT_ACT]->isChecked() );
|
||||
appSettings.setValue( "VideoHandle/VideoZoomLock", m_arrayActions[VIDEO_ZOOM_LOCK_ACT]->isChecked() );
|
||||
appSettings.setValue( "VideoHandle/VideoZoomLock",
|
||||
m_arrayActions[VIDEO_ZOOM_LOCK_ACT]->isChecked() );
|
||||
appSettings.setValue( "VideoHandle/FrameProperties", m_pcFramePropertiesSideBar->isVisible() );
|
||||
appSettings.setValue( "VideoHandle/SelectedTool", m_uiViewTool );
|
||||
appSettings.setValue( "VideoHandle/ShowGrid", m_arrayActions[SHOW_GRID_ACT]->isChecked() );
|
||||
}
|
||||
|
||||
void VideoHandle::update()
|
||||
Void VideoHandle::update()
|
||||
{
|
||||
if( m_pcCurrentVideoSubWindow )
|
||||
{
|
||||
CalypStream* pcStream = m_pcCurrentVideoSubWindow->getInputStream();
|
||||
CalypFrame* pcFrame = m_pcCurrentVideoSubWindow->getCurrFrame();
|
||||
PlaYUVerStream* pcStream = m_pcCurrentVideoSubWindow->getInputStream();
|
||||
PlaYUVerFrame* pcFrame = m_pcCurrentVideoSubWindow->getCurrFrame();
|
||||
|
||||
unsigned long frame_num = 0;
|
||||
unsigned long total_frame_num = 1;
|
||||
Int frame_num = 0;
|
||||
UInt64 total_frame_num = 1;
|
||||
|
||||
m_pcVideoFormatLabel->setText( m_pcCurrentVideoSubWindow->getStreamInformation() );
|
||||
|
||||
QString resolution;
|
||||
if( pcFrame )
|
||||
{
|
||||
resolution.append( QString( "%1x%2" ).arg( pcFrame->getWidth() ).arg( pcFrame->getHeight() ) );
|
||||
resolution.append(
|
||||
QString( "%1x%2" ).arg( pcFrame->getWidth() ).arg( pcFrame->getHeight() ) );
|
||||
}
|
||||
|
||||
if( pcStream )
|
||||
@@ -345,7 +344,7 @@ void VideoHandle::update()
|
||||
}
|
||||
if( pcStream && pcFrame->getBitsPel() > 8 )
|
||||
{
|
||||
if( pcStream->getEndianess() == CLP_BIG_ENDIAN )
|
||||
if( pcStream->getEndianess() == PLAYUVER_BIG_ENDIAN )
|
||||
{
|
||||
resolution.append( QStringLiteral( " (BE)" ) );
|
||||
}
|
||||
@@ -359,17 +358,16 @@ void VideoHandle::update()
|
||||
m_pcFramePropertiesSideBar->setFrame( pcFrame );
|
||||
|
||||
m_pcFrameNumInfo->setTotalFrameNum( total_frame_num );
|
||||
m_pcFrameNumInfo->setCurrFrameNum( frame_num );
|
||||
|
||||
m_pcFrameSlider->blockSignals( true ); // Disable signals otherwise it will loop this function
|
||||
m_pcFrameSlider->setMaximum( total_frame_num - 1 );
|
||||
|
||||
m_pcFrameNumInfo->setCurrFrameNum( frame_num );
|
||||
m_pcFrameSlider->setValue( frame_num );
|
||||
m_pcFrameSlider->blockSignals( false );
|
||||
|
||||
if( m_pcCurrentVideoSubWindow->isPlaying() )
|
||||
{
|
||||
m_arrayActions[PLAY_ACT]->setText( "Pause" );
|
||||
m_arrayActions[PLAY_ACT]->setIcon( m_pcParet->style()->standardIcon( QStyle::SP_MediaPause ) );
|
||||
m_arrayActions[PLAY_ACT]->setIcon(
|
||||
m_pcParet->style()->standardIcon( QStyle::SP_MediaPause ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -387,13 +385,13 @@ void VideoHandle::update()
|
||||
}
|
||||
}
|
||||
|
||||
void VideoHandle::update( VideoSubWindow* currSubWindow )
|
||||
Void VideoHandle::update( VideoSubWindow* currSubWindow )
|
||||
{
|
||||
m_pcCurrentVideoSubWindow = currSubWindow;
|
||||
update();
|
||||
}
|
||||
|
||||
void VideoHandle::updateSelectionArea( QRect area )
|
||||
Void VideoHandle::updateSelectionArea( QRect area )
|
||||
{
|
||||
if( m_pcCurrentVideoSubWindow )
|
||||
{
|
||||
@@ -401,31 +399,21 @@ void VideoHandle::updateSelectionArea( QRect area )
|
||||
}
|
||||
}
|
||||
|
||||
void VideoHandle::addSubWindow( VideoSubWindow* window )
|
||||
Void VideoHandle::openSubWindow( VideoSubWindow* subWindow )
|
||||
{
|
||||
window->zoomToFit();
|
||||
window->getViewArea()->setTool( m_uiViewTool );
|
||||
window->getViewArea()->setGridVisible( m_arrayActions[SHOW_GRID_ACT]->isChecked() );
|
||||
|
||||
connect( window, &SubWindowAbstract::aboutToClose,
|
||||
this, &VideoHandle::closeSubWindow );
|
||||
|
||||
connect( window, &SubWindowAbstract::zoomFactorChanged,
|
||||
this, &VideoHandle::zoomToFactorAll );
|
||||
|
||||
connect( window, &SubWindowAbstract::scrollBarMoved,
|
||||
this, &VideoHandle::moveAllScrollBars );
|
||||
|
||||
connect( window->getViewArea(), SIGNAL( selectionChanged( QRect ) ), this, SLOT( updateSelectionArea( QRect ) ) );
|
||||
connect( subWindow->getViewArea(), SIGNAL( selectionChanged( QRect ) ), this,
|
||||
SLOT( updateSelectionArea( QRect ) ) );
|
||||
subWindow->getViewArea()->setTool( m_uiViewTool );
|
||||
subWindow->getViewArea()->setGridVisible( m_arrayActions[SHOW_GRID_ACT]->isChecked() );
|
||||
}
|
||||
|
||||
void VideoHandle::closeSubWindow( SubWindowAbstract* subWindow )
|
||||
Void VideoHandle::closeSubWindow( SubWindowAbstract* subWindow )
|
||||
{
|
||||
VideoSubWindow* videoSubWindow = qobject_cast<VideoSubWindow*>( subWindow );
|
||||
|
||||
if( m_acPlayingSubWindows.contains( videoSubWindow ) )
|
||||
{
|
||||
int pos = m_acPlayingSubWindows.indexOf( videoSubWindow );
|
||||
Int pos = m_acPlayingSubWindows.indexOf( videoSubWindow );
|
||||
m_acPlayingSubWindows.at( pos )->stop();
|
||||
m_acPlayingSubWindows.remove( pos );
|
||||
if( m_acPlayingSubWindows.size() < 2 )
|
||||
@@ -435,9 +423,9 @@ void VideoHandle::closeSubWindow( SubWindowAbstract* subWindow )
|
||||
}
|
||||
}
|
||||
|
||||
void VideoHandle::zoomToFactorAll( const double scale, const QPoint center )
|
||||
Void VideoHandle::zoomToFactorAll( const Double scale, const QPoint center )
|
||||
{
|
||||
double factor;
|
||||
Double factor;
|
||||
|
||||
if( m_arrayActions[VIDEO_ZOOM_LOCK_ACT]->isChecked() )
|
||||
{
|
||||
@@ -446,7 +434,7 @@ void VideoHandle::zoomToFactorAll( const double scale, const QPoint center )
|
||||
SubWindowAbstract* subWindow;
|
||||
QList<SubWindowAbstract*> subWindowList =
|
||||
m_pcMainWindowManager->findSubWindow( SubWindowAbstract::VIDEO_SUBWINDOW );
|
||||
for( int i = 0; i < subWindowList.size(); i++ )
|
||||
for( Int i = 0; i < subWindowList.size(); i++ )
|
||||
{
|
||||
subWindow = subWindowList.at( i );
|
||||
if( m_pcCurrentVideoSubWindow == subWindow )
|
||||
@@ -459,8 +447,7 @@ void VideoHandle::zoomToFactorAll( const double scale, const QPoint center )
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
void VideoHandle::moveAllScrollBars( const QPoint& offset )
|
||||
Void VideoHandle::moveAllScrollBars( const QPoint offset )
|
||||
{
|
||||
QPoint newOffset = offset;
|
||||
if( m_arrayActions[VIDEO_ZOOM_LOCK_ACT]->isChecked() && m_pcCurrentVideoSubWindow )
|
||||
@@ -485,7 +472,7 @@ void VideoHandle::moveAllScrollBars( const QPoint& offset )
|
||||
if( scrollBar->value() == scrollBar->minimum() && offset.y() < 0 )
|
||||
newOffset.setY( 0 );
|
||||
|
||||
for( int i = 0; i < subWindowList.size(); i++ )
|
||||
for( Int i = 0; i < subWindowList.size(); i++ )
|
||||
{
|
||||
videoSubWindow = qobject_cast<VideoSubWindow*>( subWindowList.at( i ) );
|
||||
if( m_pcCurrentVideoSubWindow == videoSubWindow )
|
||||
@@ -497,37 +484,16 @@ void VideoHandle::moveAllScrollBars( const QPoint& offset )
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
void VideoHandle::moveAllScrollBars( const double& horRatio, const double& verRatio )
|
||||
{
|
||||
if( m_arrayActions[VIDEO_ZOOM_LOCK_ACT]->isChecked() && m_pcCurrentVideoSubWindow )
|
||||
{
|
||||
VideoSubWindow* videoSubWindow;
|
||||
QList<SubWindowAbstract*> subWindowList = m_pcMainWindowManager->findSubWindow( SubWindowAbstract::VIDEO_SUBWINDOW );
|
||||
|
||||
for( int i = 0; i < subWindowList.size(); i++ )
|
||||
{
|
||||
videoSubWindow = qobject_cast<VideoSubWindow*>( subWindowList.at( i ) );
|
||||
if( m_pcCurrentVideoSubWindow == videoSubWindow )
|
||||
continue;
|
||||
else
|
||||
{
|
||||
videoSubWindow->adjustScrollBarToRatio( horRatio, verRatio );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
unsigned long VideoHandle::getMaxFrameNumber()
|
||||
UInt64 VideoHandle::getMaxFrameNumber()
|
||||
{
|
||||
unsigned long currFrames;
|
||||
unsigned long maxFrames = INT_MAX;
|
||||
UInt currFrames;
|
||||
UInt64 maxFrames = INT_MAX;
|
||||
if( m_pcCurrentVideoSubWindow )
|
||||
{
|
||||
if( m_acPlayingSubWindows.contains( m_pcCurrentVideoSubWindow ) )
|
||||
{
|
||||
for( int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
||||
for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
||||
{
|
||||
currFrames = m_acPlayingSubWindows.at( i )->getInputStream()->getFrameNum();
|
||||
if( currFrames < maxFrames )
|
||||
@@ -542,10 +508,10 @@ unsigned long VideoHandle::getMaxFrameNumber()
|
||||
return maxFrames;
|
||||
}
|
||||
|
||||
void VideoHandle::setTimerStatus()
|
||||
Void VideoHandle::setTimerStatus()
|
||||
{
|
||||
bool status = false;
|
||||
for( int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
||||
Bool status = false;
|
||||
for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
||||
{
|
||||
status |= m_acPlayingSubWindows.at( i )->isPlaying();
|
||||
}
|
||||
@@ -572,7 +538,8 @@ void VideoHandle::setTimerStatus()
|
||||
#if( _CONTROL_PLAYING_TIME_ == 1 )
|
||||
if( m_pcPlayControlTimer && m_pcPlayingTimer->interval() > 0 )
|
||||
{
|
||||
qDebug() << "Desired Fps: " << 1000 / m_pcPlayingTimer->interval() << "Real Fps: " << 1000 / m_dAverageFps;
|
||||
qDebug() << "Desired Fps: " << 1000 / m_pcPlayingTimer->interval()
|
||||
<< "Real Fps: " << 1000 / m_dAverageFps;
|
||||
|
||||
delete m_pcPlayControlTimer;
|
||||
m_pcPlayControlTimer = NULL;
|
||||
@@ -583,7 +550,7 @@ void VideoHandle::setTimerStatus()
|
||||
}
|
||||
}
|
||||
|
||||
void VideoHandle::play()
|
||||
Void VideoHandle::play()
|
||||
{
|
||||
if( !m_pcCurrentVideoSubWindow )
|
||||
return;
|
||||
@@ -593,11 +560,11 @@ void VideoHandle::play()
|
||||
|
||||
if( !m_pcCurrentVideoSubWindow->isPlaying() ) // Not playing
|
||||
{
|
||||
double frameRate;
|
||||
unsigned int timeinterval;
|
||||
Double frameRate;
|
||||
UInt timeInterval;
|
||||
if( m_acPlayingSubWindows.size() < 2 )
|
||||
{
|
||||
for( int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
||||
for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
||||
{
|
||||
m_acPlayingSubWindows.at( i )->pause();
|
||||
}
|
||||
@@ -606,20 +573,20 @@ void VideoHandle::play()
|
||||
}
|
||||
if( m_acPlayingSubWindows.contains( m_pcCurrentVideoSubWindow ) )
|
||||
{
|
||||
for( int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
||||
for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
||||
{
|
||||
m_acPlayingSubWindows.at( i )->play();
|
||||
}
|
||||
frameRate = m_acPlayingSubWindows.at( 0 )->getInputStream()->getFrameRate();
|
||||
timeinterval = (unsigned int)( 1000.0 / frameRate + 0.5 );
|
||||
m_pcPlayingTimer->setInterval( timeinterval );
|
||||
timeInterval = ( UInt )( 1000.0 / frameRate + 0.5 );
|
||||
m_pcPlayingTimer->setInterval( timeInterval );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( m_acPlayingSubWindows.contains( m_pcCurrentVideoSubWindow ) )
|
||||
{
|
||||
for( int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
||||
for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
||||
{
|
||||
m_acPlayingSubWindows.at( i )->pause();
|
||||
}
|
||||
@@ -634,11 +601,11 @@ void VideoHandle::play()
|
||||
// update();
|
||||
}
|
||||
|
||||
void VideoHandle::stop()
|
||||
Void VideoHandle::stop()
|
||||
{
|
||||
if( m_acPlayingSubWindows.size() > 0 )
|
||||
{
|
||||
for( int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
||||
for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
||||
{
|
||||
m_acPlayingSubWindows.at( i )->stop();
|
||||
}
|
||||
@@ -656,18 +623,19 @@ void VideoHandle::stop()
|
||||
m_arrayActions[VIDEO_LOCK_ACT]->setVisible( false );
|
||||
}
|
||||
|
||||
void VideoHandle::playEvent()
|
||||
Void VideoHandle::playEvent()
|
||||
{
|
||||
bool bEndOfSequence = false;
|
||||
Bool bEndOfSequence = false;
|
||||
#if( _CONTROL_PLAYING_TIME_ == 1 )
|
||||
m_dAverageFps = double( m_dAverageFps * m_uiNumberPlayedFrames + m_pcPlayControlTimer->elapsed() ) /
|
||||
double( m_uiNumberPlayedFrames + 1 );
|
||||
m_dAverageFps =
|
||||
Double( m_dAverageFps * m_uiNumberPlayedFrames + m_pcPlayControlTimer->elapsed() ) /
|
||||
Double( m_uiNumberPlayedFrames + 1 );
|
||||
m_uiNumberPlayedFrames++;
|
||||
m_pcPlayControlTimer->restart();
|
||||
#endif
|
||||
try
|
||||
{
|
||||
for( int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
||||
for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
||||
{
|
||||
bEndOfSequence |= m_acPlayingSubWindows.at( i )->playEvent();
|
||||
}
|
||||
@@ -676,7 +644,7 @@ void VideoHandle::playEvent()
|
||||
if( !m_arrayActions[VIDEO_REPEAT_ACT]->isChecked() )
|
||||
stop();
|
||||
else
|
||||
for( int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
||||
for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
||||
m_acPlayingSubWindows.at( i )->seekAbsoluteEvent( 0 );
|
||||
}
|
||||
}
|
||||
@@ -693,16 +661,17 @@ void VideoHandle::playEvent()
|
||||
emit changed();
|
||||
}
|
||||
|
||||
void VideoHandle::seekEvent( int direction )
|
||||
Void VideoHandle::seekEvent( Int direction )
|
||||
{
|
||||
if( m_pcCurrentVideoSubWindow )
|
||||
{
|
||||
if( m_acPlayingSubWindows.contains( m_pcCurrentVideoSubWindow ) )
|
||||
{
|
||||
if( !( (unsigned int)( m_pcCurrentVideoSubWindow->getInputStream()->getCurrFrameNum() + 1 ) >= getMaxFrameNumber() &&
|
||||
if( !( ( UInt )( m_pcCurrentVideoSubWindow->getInputStream()->getCurrFrameNum() + 1 ) >=
|
||||
getMaxFrameNumber() &&
|
||||
direction > 0 ) )
|
||||
{
|
||||
for( int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
||||
for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
||||
{
|
||||
m_acPlayingSubWindows.at( i )->seekRelativeEvent( direction > 0 ? true : false );
|
||||
}
|
||||
@@ -717,7 +686,7 @@ void VideoHandle::seekEvent( int direction )
|
||||
}
|
||||
}
|
||||
|
||||
void VideoHandle::seekVideo()
|
||||
Void VideoHandle::seekVideo()
|
||||
{
|
||||
if( m_pcCurrentVideoSubWindow )
|
||||
{
|
||||
@@ -725,19 +694,19 @@ void VideoHandle::seekVideo()
|
||||
{
|
||||
SeekStreamDialog* dialogSeekVideo =
|
||||
new SeekStreamDialog( m_pcCurrentVideoSubWindow->getInputStream(), m_pcParet );
|
||||
int newFrameNum = dialogSeekVideo->runDialog();
|
||||
Int newFrameNum = dialogSeekVideo->runDialog();
|
||||
if( newFrameNum >= 0 )
|
||||
{
|
||||
if( m_acPlayingSubWindows.contains( m_pcCurrentVideoSubWindow ) )
|
||||
{
|
||||
for( int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
||||
for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
||||
{
|
||||
m_acPlayingSubWindows.at( i )->seekAbsoluteEvent( (unsigned int)newFrameNum );
|
||||
m_acPlayingSubWindows.at( i )->seekAbsoluteEvent( (UInt)newFrameNum );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pcCurrentVideoSubWindow->seekAbsoluteEvent( (unsigned int)newFrameNum );
|
||||
m_pcCurrentVideoSubWindow->seekAbsoluteEvent( (UInt)newFrameNum );
|
||||
}
|
||||
emit changed();
|
||||
}
|
||||
@@ -745,26 +714,27 @@ void VideoHandle::seekVideo()
|
||||
}
|
||||
}
|
||||
|
||||
void VideoHandle::seekSliderEvent( int new_frame_num )
|
||||
Void VideoHandle::seekSliderEvent( Int new_frame_num )
|
||||
{
|
||||
if( m_pcCurrentVideoSubWindow && !m_bIsPlaying ) // TODO: Fix this slot
|
||||
{
|
||||
if( m_acPlayingSubWindows.contains( m_pcCurrentVideoSubWindow ) )
|
||||
{
|
||||
for( int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
||||
for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
||||
{
|
||||
m_acPlayingSubWindows.at( i )->seekAbsoluteEvent( (unsigned int)new_frame_num );
|
||||
m_acPlayingSubWindows.at( i )->seekAbsoluteEvent( (UInt)new_frame_num );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pcCurrentVideoSubWindow->seekAbsoluteEvent( (unsigned int)new_frame_num );
|
||||
m_pcCurrentVideoSubWindow->seekAbsoluteEvent( (UInt)new_frame_num );
|
||||
}
|
||||
emit changed();
|
||||
// update();
|
||||
}
|
||||
}
|
||||
|
||||
void VideoHandle::videoSelectionButtonEvent()
|
||||
Void VideoHandle::videoSelectionButtonEvent()
|
||||
{
|
||||
VideoSubWindow* videoSubWindow;
|
||||
|
||||
@@ -773,7 +743,7 @@ void VideoHandle::videoSelectionButtonEvent()
|
||||
{
|
||||
QList<SubWindowAbstract*> subWindowList =
|
||||
m_pcMainWindowManager->findSubWindow( SubWindowAbstract::VIDEO_STREAM_SUBWINDOW );
|
||||
for( int i = 0; i < subWindowList.size(); i++ )
|
||||
for( Int i = 0; i < subWindowList.size(); i++ )
|
||||
{
|
||||
videoSubWindow = qobject_cast<VideoSubWindow*>( subWindowList.at( i ) );
|
||||
m_acPlayingSubWindows.append( videoSubWindow );
|
||||
@@ -781,10 +751,10 @@ void VideoHandle::videoSelectionButtonEvent()
|
||||
}
|
||||
else
|
||||
{
|
||||
SubWindowSelectorDialog dialogWindowsSelection( m_pcParet, m_pcMainWindowManager,
|
||||
DialogSubWindowSelector dialogWindowsSelection( m_pcParet, m_pcMainWindowManager,
|
||||
SubWindowAbstract::VIDEO_STREAM_SUBWINDOW );
|
||||
QStringList cWindowListNames;
|
||||
for( int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
||||
for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
||||
{
|
||||
dialogWindowsSelection.selectSubWindow( m_acPlayingSubWindows.at( i ) );
|
||||
}
|
||||
@@ -793,7 +763,7 @@ void VideoHandle::videoSelectionButtonEvent()
|
||||
m_acPlayingSubWindows.clear();
|
||||
|
||||
QList<SubWindowAbstract*> selectedSubWindowList = dialogWindowsSelection.getSelectedWindows();
|
||||
for( int i = 0; i < selectedSubWindowList.size(); i++ )
|
||||
for( Int i = 0; i < selectedSubWindowList.size(); i++ )
|
||||
{
|
||||
videoSubWindow = qobject_cast<VideoSubWindow*>( selectedSubWindowList.at( i ) );
|
||||
m_acPlayingSubWindows.append( videoSubWindow );
|
||||
@@ -814,7 +784,7 @@ void VideoHandle::videoSelectionButtonEvent()
|
||||
}
|
||||
if( m_bIsPlaying )
|
||||
{
|
||||
for( int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
||||
for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
||||
{
|
||||
m_acPlayingSubWindows.at( i )->play();
|
||||
}
|
||||
@@ -826,31 +796,26 @@ void VideoHandle::videoSelectionButtonEvent()
|
||||
}
|
||||
}
|
||||
|
||||
void VideoHandle::setTool( int tool )
|
||||
Void VideoHandle::setTool( Int tool )
|
||||
{
|
||||
m_uiViewTool = tool;
|
||||
m_actionGroupTools->actions().at( m_uiViewTool )->setChecked( true );
|
||||
QList<SubWindowAbstract*> subWindowList = m_pcMainWindowManager->findSubWindow( SubWindowAbstract::VIDEO_SUBWINDOW );
|
||||
for( int i = 0; i < subWindowList.size(); i++ )
|
||||
actionGroupTools->actions().at( m_uiViewTool )->setChecked( true );
|
||||
QList<SubWindowAbstract*> subWindowList =
|
||||
m_pcMainWindowManager->findSubWindow( SubWindowAbstract::VIDEO_SUBWINDOW );
|
||||
for( Int i = 0; i < subWindowList.size(); i++ )
|
||||
{
|
||||
qobject_cast<VideoSubWindow*>( subWindowList.at( i ) )->getViewArea()->setTool( m_uiViewTool );
|
||||
}
|
||||
}
|
||||
|
||||
void VideoHandle::toggleGrid( bool checked )
|
||||
Void VideoHandle::toggleGrid( Bool checked )
|
||||
{
|
||||
QList<SubWindowAbstract*> subWindowList = m_pcMainWindowManager->findSubWindow( SubWindowAbstract::VIDEO_SUBWINDOW );
|
||||
for( int i = 0; i < subWindowList.size(); i++ )
|
||||
QList<SubWindowAbstract*> subWindowList =
|
||||
m_pcMainWindowManager->findSubWindow( SubWindowAbstract::VIDEO_SUBWINDOW );
|
||||
for( Int i = 0; i < subWindowList.size(); i++ )
|
||||
{
|
||||
qobject_cast<VideoSubWindow*>( subWindowList.at( i ) )->getViewArea()->setGridVisible( checked );
|
||||
}
|
||||
}
|
||||
|
||||
void VideoHandle::setGridSize( int size )
|
||||
{
|
||||
QList<SubWindowAbstract*> subWindowList = m_pcMainWindowManager->findSubWindow( SubWindowAbstract::VIDEO_SUBWINDOW );
|
||||
for( int i = 0; i < subWindowList.size(); i++ )
|
||||
{
|
||||
qobject_cast<VideoSubWindow*>( subWindowList.at( i ) )->getViewArea()->setGridSize( size );
|
||||
qobject_cast<VideoSubWindow*>( subWindowList.at( i ) )
|
||||
->getViewArea()
|
||||
->setGridVisible( checked );
|
||||
}
|
||||
}
|
||||
+26
-31
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -25,16 +25,16 @@
|
||||
#ifndef __VIDEOHANDLE_H__
|
||||
#define __VIDEOHANDLE_H__
|
||||
|
||||
#include "CommonDefs.h"
|
||||
#include "PlaYUVerAppDefs.h"
|
||||
#include "config.h"
|
||||
|
||||
#include <QMenu>
|
||||
#include <QPoint>
|
||||
#include <QThread>
|
||||
#include <QVector>
|
||||
#include <QThread>
|
||||
#include <QWidget>
|
||||
|
||||
//#define _CONTROL_PLAYING_TIME_ 1
|
||||
#define _CONTROL_PLAYING_TIME_ 0
|
||||
|
||||
class QToolBar;
|
||||
class QDockWidget;
|
||||
@@ -43,37 +43,37 @@ class QLabel;
|
||||
class QSlider;
|
||||
class QElapsedTimer;
|
||||
|
||||
class SubWindowHandle;
|
||||
class PlaYUVerSubWindowHandle;
|
||||
class SubWindowAbstract;
|
||||
class VideoSubWindow;
|
||||
class FramePropertiesDock;
|
||||
class FrameNumberWidget;
|
||||
class WidgetFrameNumber;
|
||||
|
||||
class VideoHandle : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
VideoHandle( QWidget*, SubWindowHandle* );
|
||||
VideoHandle( QWidget*, PlaYUVerSubWindowHandle* );
|
||||
~VideoHandle();
|
||||
|
||||
void createActions();
|
||||
Void createActions();
|
||||
QMenu* createVideoMenu();
|
||||
QMenu* createImageMenu();
|
||||
QToolBar* createToolBar();
|
||||
QDockWidget* createDock();
|
||||
QWidget* createStatusBarMessage();
|
||||
void updateMenus();
|
||||
Void updateMenus();
|
||||
|
||||
void readSettings();
|
||||
void writeSettings();
|
||||
Void readSettings();
|
||||
Void writeSettings();
|
||||
|
||||
void update( VideoSubWindow* currSubWindow );
|
||||
Void update( VideoSubWindow* currSubWindow );
|
||||
|
||||
void addSubWindow( VideoSubWindow* subWindow );
|
||||
Void openSubWindow( VideoSubWindow* subWindow );
|
||||
|
||||
private:
|
||||
QWidget* m_pcParet;
|
||||
SubWindowHandle* m_pcMainWindowManager;
|
||||
PlaYUVerSubWindowHandle* m_pcMainWindowManager;
|
||||
enum
|
||||
{
|
||||
PLAY_ACT,
|
||||
@@ -95,16 +95,12 @@ private:
|
||||
QSignalMapper* m_mapperVideoSeek;
|
||||
|
||||
QSlider* m_pcFrameSlider;
|
||||
FrameNumberWidget* m_pcFrameNumInfo;
|
||||
WidgetFrameNumber* m_pcFrameNumInfo;
|
||||
|
||||
// Tools Actions
|
||||
QActionGroup* m_actionGroupTools;
|
||||
// Tools Actions;
|
||||
QActionGroup* actionGroupTools;
|
||||
QSignalMapper* m_mapperTools;
|
||||
unsigned int m_uiViewTool;
|
||||
|
||||
// Grid Actions
|
||||
QSignalMapper* m_mapperGrid;
|
||||
QActionGroup* m_actionGroupGrid;
|
||||
UInt m_uiViewTool;
|
||||
|
||||
QMenu* m_pcMenuVideo;
|
||||
QMenu* m_pcMenuImage;
|
||||
@@ -120,16 +116,16 @@ private:
|
||||
QVector<VideoSubWindow*> m_acPlayingSubWindows;
|
||||
|
||||
QTimer* m_pcPlayingTimer;
|
||||
bool m_bIsPlaying;
|
||||
Bool m_bIsPlaying;
|
||||
|
||||
#if( _CONTROL_PLAYING_TIME_ == 1 )
|
||||
unsigned int m_uiNumberPlayedFrames;
|
||||
double m_dAverageFps;
|
||||
UInt m_uiNumberPlayedFrames;
|
||||
Double m_dAverageFps;
|
||||
QElapsedTimer* m_pcPlayControlTimer;
|
||||
#endif
|
||||
|
||||
unsigned long getMaxFrameNumber();
|
||||
void setTimerStatus();
|
||||
UInt64 getMaxFrameNumber();
|
||||
Void setTimerStatus();
|
||||
|
||||
Q_SIGNALS:
|
||||
void changed();
|
||||
@@ -139,7 +135,7 @@ private Q_SLOTS:
|
||||
void updateSelectionArea( QRect area );
|
||||
void closeSubWindow( SubWindowAbstract* subWindow );
|
||||
void zoomToFactorAll( const double factor, const QPoint center = QPoint() );
|
||||
void moveAllScrollBars( const double&, const double& );
|
||||
void moveAllScrollBars( const QPoint offset );
|
||||
void play();
|
||||
void stop();
|
||||
void playEvent();
|
||||
@@ -149,7 +145,6 @@ private Q_SLOTS:
|
||||
void videoSelectionButtonEvent();
|
||||
void setTool( int tool );
|
||||
void toggleGrid( bool checked );
|
||||
void setGridSize( int size );
|
||||
};
|
||||
|
||||
#endif // __VIDEOHANDLE_H__
|
||||
+254
-307
File diff suppressed because it is too large.
Load diff
+91
-93
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -25,51 +25,50 @@
|
||||
#ifndef __VIDEOSUBWINDOW_H__
|
||||
#define __VIDEOSUBWINDOW_H__
|
||||
|
||||
#include "PlaYUVerAppDefs.h"
|
||||
#include "SubWindowAbstract.h"
|
||||
#include "ViewArea.h"
|
||||
#include "config.h"
|
||||
#include "lib/PlaYUVerStream.h"
|
||||
#include <QDataStream>
|
||||
#include <QFuture>
|
||||
#include <QRect>
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
#include "CommonDefs.h"
|
||||
#include "SubWindowAbstract.h"
|
||||
#include "ViewArea.h"
|
||||
#include "config.h"
|
||||
#include "lib/CalypStream.h"
|
||||
|
||||
class QScrollArea;
|
||||
|
||||
class VideoInformation;
|
||||
class VideoSubWindow;
|
||||
class CalypAppModuleIf;
|
||||
class PlaYUVerAppModuleIf;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
QString m_cFilename;
|
||||
unsigned int m_uiWidth;
|
||||
unsigned int m_uiHeight;
|
||||
int m_iPelFormat;
|
||||
unsigned int m_uiBitsPelPixel;
|
||||
unsigned int m_iEndianness;
|
||||
unsigned int m_uiFrameRate;
|
||||
unsigned long long int m_uiFileSize;
|
||||
} CalypFileInfo;
|
||||
typedef QVector<CalypFileInfo> CalypFileInfoVector;
|
||||
UInt m_uiWidth;
|
||||
UInt m_uiHeight;
|
||||
Int m_iPelFormat;
|
||||
UInt m_uiBitsPelPixel;
|
||||
UInt m_iEndianness;
|
||||
UInt m_uiFrameRate;
|
||||
UInt64 m_uiFileSize;
|
||||
} PlaYUVerStreamInfo;
|
||||
typedef QVector<PlaYUVerStreamInfo> PlaYUVerStreamInfoVector;
|
||||
|
||||
QDataStream& operator<<( QDataStream& out, const CalypFileInfoVector& d );
|
||||
QDataStream& operator>>( QDataStream& in, CalypFileInfoVector& d );
|
||||
int findCalypStreamInfo( CalypFileInfoVector array, QString filename );
|
||||
QDataStream& operator<<( QDataStream& out, const PlaYUVerStreamInfoVector& d );
|
||||
QDataStream& operator>>( QDataStream& in, PlaYUVerStreamInfoVector& d );
|
||||
Int findPlaYUVerStreamInfo( PlaYUVerStreamInfoVector array, QString filename );
|
||||
|
||||
class VideoSubWindow : public SubWindowAbstract
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
bool m_bWindowBusy;
|
||||
Bool m_bWindowBusy;
|
||||
|
||||
QScrollArea* m_pcScrollArea;
|
||||
QPoint m_cLastScroll;
|
||||
QPoint m_cCurrScroll;
|
||||
double m_dHorScroll;
|
||||
double m_dVerScroll;
|
||||
|
||||
ViewArea* m_cViewArea;
|
||||
|
||||
@@ -77,29 +76,48 @@ private:
|
||||
|
||||
QString m_cFilename;
|
||||
QString m_cStreamInformation;
|
||||
CalypFileInfo m_sStreamInfo;
|
||||
CalypStream* m_pCurrStream;
|
||||
PlaYUVerStreamInfo m_sStreamInfo;
|
||||
PlaYUVerStream* m_pCurrStream;
|
||||
|
||||
CalypFrame* m_pcCurrFrame;
|
||||
PlaYUVerFrame* m_pcCurrFrame;
|
||||
QRect m_cSelectedArea;
|
||||
|
||||
CalypAppModuleIf* m_pcCurrentDisplayModule;
|
||||
QList<CalypAppModuleIf*> m_apcCurrentModule;
|
||||
PlaYUVerAppModuleIf* m_pcCurrentDisplayModule;
|
||||
QList<PlaYUVerAppModuleIf*> m_apcCurrentModule;
|
||||
|
||||
VideoSubWindow* m_pcReferenceSubWindow;
|
||||
|
||||
// QString m_cWindowShortName;
|
||||
QString m_cCurrFileName;
|
||||
|
||||
bool m_bIsPlaying;
|
||||
Bool m_bIsPlaying;
|
||||
|
||||
QTimer* m_pcUpdateTimer;
|
||||
/**
|
||||
* Threads variables
|
||||
* QtConcurrent
|
||||
*/
|
||||
QFuture<void> m_cRefreshResult;
|
||||
QFuture<void> m_cReadResult;
|
||||
QFuture<Void> m_cRefreshResult;
|
||||
QFuture<Void> m_cReadResult;
|
||||
|
||||
Void refreshFrameOperation();
|
||||
Bool goToNextFrame( Bool bThreaded = false );
|
||||
|
||||
static Bool guessFormat( QString filename,
|
||||
UInt& rWidth,
|
||||
UInt& rHeight,
|
||||
Int& rInputFormat,
|
||||
UInt& rBitsPerPixel,
|
||||
Int& rEndianness );
|
||||
|
||||
/**
|
||||
* Private zoom function to handle
|
||||
* zoom to fit
|
||||
*/
|
||||
Void scaleView( const QSize& size, QPoint center = QPoint() );
|
||||
Void updateVideoWindowInfo();
|
||||
|
||||
QSize getScrollSize();
|
||||
|
||||
public:
|
||||
enum VideoSubWindowCategories
|
||||
@@ -110,35 +128,33 @@ public:
|
||||
VideoSubWindow( enum VideoSubWindowCategories category, QWidget* parent = 0 );
|
||||
~VideoSubWindow();
|
||||
|
||||
void updateVideoWindowInfo();
|
||||
Bool loadFile( QString cFilename, Bool bForceDialog = false );
|
||||
Bool loadFile( PlaYUVerStreamInfo* streamInfo );
|
||||
Void loadAll();
|
||||
Bool save( QString filename );
|
||||
|
||||
bool loadFile( QString cFilename, bool bForceDialog = false );
|
||||
bool loadFile( CalypFileInfo* streamInfo );
|
||||
void loadAll();
|
||||
bool save( QString filename );
|
||||
bool saveStream( QString filename );
|
||||
Void refreshSubWindow();
|
||||
Void refreshFrame( Bool bThreaded = false );
|
||||
|
||||
void refreshSubWindow();
|
||||
void refreshFrame( bool bThreaded = false );
|
||||
Bool play();
|
||||
Void pause();
|
||||
Bool playEvent();
|
||||
Void stop();
|
||||
|
||||
bool play();
|
||||
void pause();
|
||||
bool playEvent();
|
||||
void stop();
|
||||
Bool isPlaying() { return m_bIsPlaying; }
|
||||
Void seekAbsoluteEvent( UInt new_frame_num );
|
||||
Void seekRelativeEvent( Bool bIsFoward );
|
||||
|
||||
bool isPlaying() { return m_bIsPlaying; }
|
||||
void seekAbsoluteEvent( unsigned int new_frame_num );
|
||||
void seekRelativeEvent( bool bIsFoward );
|
||||
Void setCurrFrame( PlaYUVerFrame* pcCurrFrame );
|
||||
|
||||
void setCurrFrame( CalypFrame* pcCurrFrame );
|
||||
|
||||
CalypFileInfo getStreamInfo() { return m_sStreamInfo; }
|
||||
QScrollArea* getScroll() { return m_pcScrollArea; }
|
||||
PlaYUVerStreamInfo getStreamInfo() { return m_sStreamInfo; }
|
||||
QString getStreamInformation() { return m_cStreamInformation; }
|
||||
CalypStream* getInputStream() { return m_pCurrStream; }
|
||||
CalypStream* getCurrStream() { return m_pCurrStream; }
|
||||
CalypFrame* getCurrFrame() { return m_pcCurrFrame; }
|
||||
PlaYUVerStream* getInputStream() { return m_pCurrStream; }
|
||||
PlaYUVerStream* getCurrStream() { return m_pCurrStream; }
|
||||
PlaYUVerFrame* getCurrFrame() { return m_pcCurrFrame; }
|
||||
ViewArea* getViewArea() { return m_cViewArea; }
|
||||
void setRefSubWindow( VideoSubWindow* subWindow )
|
||||
Void setRefSubWindow( VideoSubWindow* subWindow )
|
||||
{
|
||||
m_pcReferenceSubWindow = NULL;
|
||||
if( subWindow )
|
||||
@@ -151,14 +167,14 @@ public:
|
||||
* Functions to enable a module in the
|
||||
* current SubWindow
|
||||
*/
|
||||
void enableModule( CalypAppModuleIf* pcModule );
|
||||
void disableModule( CalypAppModuleIf* pcModule = NULL );
|
||||
void associateModule( CalypAppModuleIf* pcModule );
|
||||
Void enableModule( PlaYUVerAppModuleIf* pcModule );
|
||||
Void disableModule( PlaYUVerAppModuleIf* pcModule = NULL );
|
||||
Void associateModule( PlaYUVerAppModuleIf* pcModule );
|
||||
|
||||
CalypAppModuleIf* getDisplayModule() { return m_pcCurrentDisplayModule; }
|
||||
QList<CalypAppModuleIf*> getModuleArray()
|
||||
PlaYUVerAppModuleIf* getDisplayModule() { return m_pcCurrentDisplayModule; }
|
||||
QList<PlaYUVerAppModuleIf*> getModuleArray()
|
||||
{
|
||||
QList<CalypAppModuleIf*> apcModulesArray;
|
||||
QList<PlaYUVerAppModuleIf*> apcModulesArray;
|
||||
if( m_pcCurrentDisplayModule )
|
||||
apcModulesArray.append( m_pcCurrentDisplayModule );
|
||||
apcModulesArray.append( m_apcCurrentModule );
|
||||
@@ -168,12 +184,12 @@ public:
|
||||
/**
|
||||
* Virtual functions from SubWindowAbstract
|
||||
*/
|
||||
void normalSize();
|
||||
void zoomToFit();
|
||||
void scaleView( double scale, QPoint center = QPoint() );
|
||||
void zoomToFactor( double factor, QPoint center = QPoint() );
|
||||
Void normalSize();
|
||||
Void zoomToFit();
|
||||
Void scaleView( Double scale, QPoint center = QPoint() );
|
||||
Void zoomToFactor( Double factor, QPoint center = QPoint() );
|
||||
|
||||
double getScaleFactor() { return m_cViewArea->getZoomFactor(); }
|
||||
Double getScaleFactor() { return m_cViewArea->getZoomFactor(); }
|
||||
/**
|
||||
* Size related functions
|
||||
*/
|
||||
@@ -181,44 +197,26 @@ public:
|
||||
QSize sizeHint( const QSize& ) const;
|
||||
|
||||
QString getCurrentFileName() { return m_cFilename; }
|
||||
bool getIsModule() { return getCategory() | SubWindowAbstract::MODULE_SUBWINDOW; }
|
||||
void clearWindowBusy() { m_bWindowBusy = false; }
|
||||
void setFillWindow( bool bFlag );
|
||||
|
||||
void adjustScrollBarToRatio( const double& horRatio, const double& verRatio );
|
||||
|
||||
private:
|
||||
void refreshFrameOperation();
|
||||
bool goToNextFrame( bool bThreaded = false );
|
||||
|
||||
static bool guessFormat( QString filename, unsigned int& rWidth, unsigned int& rHeight, int& rInputFormat, unsigned int& rBitsPerPixel,
|
||||
int& rEndianness, unsigned int& rFrameRate );
|
||||
|
||||
bool hasRunningModule();
|
||||
|
||||
/**
|
||||
* Private zoom function to handle
|
||||
* zoom to fit
|
||||
*/
|
||||
void scaleView( const QSize& size, QPoint center = QPoint() );
|
||||
|
||||
QSize getScrollSize();
|
||||
Bool getIsModule() { return getCategory() | SubWindowAbstract::MODULE_SUBWINDOW; }
|
||||
Void clearWindowBusy() { m_bWindowBusy = false; }
|
||||
Void setFillWindow( Bool bFlag );
|
||||
|
||||
protected:
|
||||
void keyPressEvent( QKeyEvent* event );
|
||||
void resizeEvent( QResizeEvent* event );
|
||||
void closeEvent( QCloseEvent* event );
|
||||
Void keyPressEvent( QKeyEvent* event );
|
||||
Void resizeEvent( QResizeEvent* event );
|
||||
// void closeEvent( QCloseEvent *event );
|
||||
|
||||
public Q_SLOTS:
|
||||
void updateWindowOnTimeout();
|
||||
void adjustScrollBarByScale( double scale, QPoint center );
|
||||
void adjustScrollBarByOffset( QPoint Offset );
|
||||
void updateScrollValues();
|
||||
void updateCurScrollValues();
|
||||
void setCurScrollValues();
|
||||
void updateSelectedArea( QRect area );
|
||||
void updatePixelValueStatusBar( const QPoint& pos );
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE( CalypFileInfo )
|
||||
Q_DECLARE_METATYPE( CalypFileInfoVector )
|
||||
Q_DECLARE_METATYPE( PlaYUVerStreamInfo );
|
||||
Q_DECLARE_METATYPE( PlaYUVerStreamInfoVector );
|
||||
|
||||
#endif // __VIDEOSUBWINDOW_H__
|
||||
+239
-237
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -23,10 +23,10 @@
|
||||
* Based on the work of Ricardo N. Rocha Sardo in SCode project
|
||||
*/
|
||||
|
||||
#include "ViewArea.h"
|
||||
#include <cmath>
|
||||
|
||||
#include "GridManager.h"
|
||||
|
||||
#include "ViewArea.h"
|
||||
#include <QColor>
|
||||
#include <QCoreApplication>
|
||||
#include <QDebug>
|
||||
@@ -39,14 +39,11 @@
|
||||
#include <QString>
|
||||
#include <QWidget>
|
||||
|
||||
#include <cmath>
|
||||
|
||||
static const QColor selectionColor = Qt::cyan;
|
||||
static const QColor imageMaskColor = Qt::green;
|
||||
static const QColor eraserColor = Qt::red;
|
||||
|
||||
ViewArea::ViewArea( QWidget* parent )
|
||||
: QWidget( parent )
|
||||
ViewArea::ViewArea( QWidget* parent ) : QWidget( parent )
|
||||
{
|
||||
setMouseTracking( true );
|
||||
|
||||
@@ -70,17 +67,17 @@ ViewArea::ViewArea( QWidget* parent )
|
||||
connect( &m_zoomWinTimer, SIGNAL( timeout() ), this, SLOT( update() ) );
|
||||
}
|
||||
|
||||
void ViewArea::setImage( CalypFrame* pcFrame )
|
||||
Void ViewArea::setImage( PlaYUVerFrame* pcFrame )
|
||||
{
|
||||
m_pcCurrFrame = pcFrame;
|
||||
m_uiPixelHalfScale = 1 << ( m_pcCurrFrame->getBitsPel() - 1 );
|
||||
m_pcCurrFrame->fillRGBBuffer();
|
||||
QImage qimg = QImage( m_pcCurrFrame->getRGBBuffer(), m_pcCurrFrame->getWidth(), m_pcCurrFrame->getHeight(),
|
||||
QImage::Format_ARGB32 );
|
||||
QImage qimg = QImage( m_pcCurrFrame->getRGBBuffer(), m_pcCurrFrame->getWidth(),
|
||||
m_pcCurrFrame->getHeight(), QImage::Format_RGB32 );
|
||||
setImage( QPixmap::fromImage( qimg ) );
|
||||
}
|
||||
|
||||
void ViewArea::setImage( const QPixmap& pixmap )
|
||||
Void ViewArea::setImage( const QPixmap& pixmap )
|
||||
{
|
||||
m_pixmap = pixmap;
|
||||
m_mask = QBitmap( pixmap.width(), pixmap.height() );
|
||||
@@ -92,7 +89,7 @@ void ViewArea::setImage( const QPixmap& pixmap )
|
||||
initZoomWinRect();
|
||||
}
|
||||
|
||||
void ViewArea::clear()
|
||||
Void ViewArea::clear()
|
||||
{
|
||||
m_pixmap = QPixmap();
|
||||
m_mask = QBitmap();
|
||||
@@ -102,7 +99,7 @@ void ViewArea::clear()
|
||||
updateGeometry();
|
||||
}
|
||||
|
||||
void ViewArea::setTool( unsigned int view )
|
||||
Void ViewArea::setTool( UInt view )
|
||||
{
|
||||
switch( view )
|
||||
{
|
||||
@@ -131,19 +128,13 @@ void ViewArea::setTool( unsigned int view )
|
||||
update();
|
||||
}
|
||||
|
||||
void ViewArea::setGridVisible( bool enable )
|
||||
Void ViewArea::setGridVisible( Bool enable )
|
||||
{
|
||||
m_bGridVisible = enable;
|
||||
update();
|
||||
}
|
||||
|
||||
void ViewArea::setGridSize( int size )
|
||||
{
|
||||
m_grid.setGridSize( size );
|
||||
update();
|
||||
}
|
||||
|
||||
void ViewArea::clearMask()
|
||||
Void ViewArea::clearMask()
|
||||
{
|
||||
m_mask.clear();
|
||||
}
|
||||
@@ -151,12 +142,12 @@ void ViewArea::clearMask()
|
||||
/**
|
||||
* Zoom related function
|
||||
*/
|
||||
void ViewArea::startZoomWinTimer()
|
||||
Void ViewArea::startZoomWinTimer()
|
||||
{
|
||||
m_zoomWinTimer.start();
|
||||
}
|
||||
|
||||
void ViewArea::setZoomFactor( double f )
|
||||
Void ViewArea::setZoomFactor( Double f )
|
||||
{
|
||||
m_dZoomFactor = f;
|
||||
|
||||
@@ -165,11 +156,11 @@ void ViewArea::setZoomFactor( double f )
|
||||
update();
|
||||
}
|
||||
|
||||
double ViewArea::scaleZoomFactor( double scale, QPoint center, QSize minimumSize )
|
||||
Double ViewArea::scaleZoomFactor( Double scale, QPoint center, QSize minimumSize )
|
||||
{
|
||||
double maxZoom = 100.0;
|
||||
double minZoom = 0.01; //( 1.0 / m_pixmap.width() );
|
||||
double new_scale = 1.0;
|
||||
Double maxZoom = 100.0;
|
||||
Double minZoom = 0.01; //( 1.0 / m_pixmap.width() );
|
||||
Double new_scale = 1.0;
|
||||
|
||||
if( ( m_dZoomFactor == minZoom ) && ( scale < 1 ) )
|
||||
return new_scale;
|
||||
@@ -177,19 +168,19 @@ double ViewArea::scaleZoomFactor( double scale, QPoint center, QSize minimumSize
|
||||
if( ( m_dZoomFactor == maxZoom ) && ( scale > 1 ) )
|
||||
return new_scale;
|
||||
|
||||
double newZoomFactor = m_dZoomFactor * scale * 100.0;
|
||||
newZoomFactor = round( newZoomFactor );
|
||||
newZoomFactor = newZoomFactor / 100.0;
|
||||
scale = newZoomFactor / m_dZoomFactor;
|
||||
Double zoomFactor = m_dZoomFactor * scale * 100.0;
|
||||
zoomFactor = round( zoomFactor );
|
||||
zoomFactor = zoomFactor / 100.0;
|
||||
scale = zoomFactor / m_dZoomFactor;
|
||||
|
||||
if( !minimumSize.isNull() )
|
||||
{
|
||||
double cw = m_pixmap.width() * m_dZoomFactor;
|
||||
double ch = m_pixmap.height() * m_dZoomFactor;
|
||||
double fw = m_pixmap.width() * newZoomFactor;
|
||||
double fh = m_pixmap.height() * newZoomFactor;
|
||||
double mw = minimumSize.width();
|
||||
double mh = minimumSize.height();
|
||||
Double cw = m_pixmap.width() * m_dZoomFactor;
|
||||
Double ch = m_pixmap.height() * m_dZoomFactor;
|
||||
Double fw = m_pixmap.width() * zoomFactor;
|
||||
Double fh = m_pixmap.height() * zoomFactor;
|
||||
Double mw = minimumSize.width();
|
||||
Double mh = minimumSize.height();
|
||||
|
||||
if( ( cw < mw ) && ( ch < mh ) && ( scale < 1 ) )
|
||||
{
|
||||
@@ -198,43 +189,43 @@ double ViewArea::scaleZoomFactor( double scale, QPoint center, QSize minimumSize
|
||||
|
||||
if( ( fw < mw ) && ( fh < mh ) && ( scale < 1 ) )
|
||||
{
|
||||
double wfactor = mw / fw;
|
||||
double hfactor = mh / fh;
|
||||
Double wfactor = mw / fw;
|
||||
Double hfactor = mh / fh;
|
||||
|
||||
if( wfactor < hfactor )
|
||||
scale = wfactor;
|
||||
else
|
||||
scale = hfactor;
|
||||
|
||||
newZoomFactor = newZoomFactor * scale * 100.0;
|
||||
newZoomFactor = floor( newZoomFactor );
|
||||
newZoomFactor = newZoomFactor / 100.0;
|
||||
scale = newZoomFactor / m_dZoomFactor;
|
||||
zoomFactor = zoomFactor * scale * 100.0;
|
||||
zoomFactor = floor( zoomFactor );
|
||||
zoomFactor = zoomFactor / 100.0;
|
||||
scale = zoomFactor / m_dZoomFactor;
|
||||
}
|
||||
}
|
||||
|
||||
new_scale = scale;
|
||||
|
||||
if( newZoomFactor < minZoom )
|
||||
if( zoomFactor < minZoom )
|
||||
{
|
||||
newZoomFactor = minZoom;
|
||||
new_scale = newZoomFactor / m_dZoomFactor;
|
||||
zoomFactor = minZoom;
|
||||
new_scale = zoomFactor / m_dZoomFactor;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( newZoomFactor > maxZoom )
|
||||
if( zoomFactor > maxZoom )
|
||||
{
|
||||
newZoomFactor = maxZoom;
|
||||
new_scale = newZoomFactor / m_dZoomFactor;
|
||||
zoomFactor = maxZoom;
|
||||
new_scale = zoomFactor / m_dZoomFactor;
|
||||
}
|
||||
}
|
||||
|
||||
setZoomFactor( newZoomFactor );
|
||||
setZoomFactor( zoomFactor );
|
||||
|
||||
return new_scale;
|
||||
}
|
||||
|
||||
// void ViewArea::setMode( int mode )
|
||||
// Void ViewArea::setMode( Int mode )
|
||||
//{
|
||||
// if( m_mode == mode )
|
||||
// return;
|
||||
@@ -243,56 +234,56 @@ double ViewArea::scaleZoomFactor( double scale, QPoint center, QSize minimumSize
|
||||
// update();
|
||||
//}
|
||||
//
|
||||
// void ViewArea::setNormalMode()
|
||||
// Void ViewArea::setNormalMode()
|
||||
//{
|
||||
// setMode( NormalMode );
|
||||
//}
|
||||
//
|
||||
// void ViewArea::setMaskMode()
|
||||
// Void ViewArea::setMaskMode()
|
||||
//{
|
||||
// setMode( MaskMode );
|
||||
//}
|
||||
//
|
||||
// void ViewArea::setMaskColor( const QColor &color )
|
||||
// Void ViewArea::setMaskColor( const QColor &color )
|
||||
//{
|
||||
// m_maskColor = color;
|
||||
// update();
|
||||
//}
|
||||
//
|
||||
// void ViewArea::setMaskTool()
|
||||
// Void ViewArea::setMaskTool()
|
||||
//{
|
||||
// setMode( MaskMode );
|
||||
// setTool( MaskTool );
|
||||
// m_blockTrackEnable = true;
|
||||
//}
|
||||
//
|
||||
// void ViewArea::setEraserTool()
|
||||
// Void ViewArea::setEraserTool()
|
||||
//{
|
||||
// setMode( MaskMode );
|
||||
// setTool( EraserTool );
|
||||
// m_blockTrackEnable = true;
|
||||
//}
|
||||
//
|
||||
// void ViewArea::setSelectionTool()
|
||||
// Void ViewArea::setSelectionTool()
|
||||
//{
|
||||
// setMode( NormalMode );
|
||||
// setTool( SelectionTool );
|
||||
// m_blockTrackEnable = false;
|
||||
//}
|
||||
//
|
||||
// void ViewArea::setBlockSelectionTool()
|
||||
// Void ViewArea::setBlockSelectionTool()
|
||||
//{
|
||||
// setMode( NormalMode );
|
||||
// setTool( BlockSelectionTool );
|
||||
// m_blockTrackEnable = true;
|
||||
//}
|
||||
|
||||
void ViewArea::setSnapToGrid( bool enable )
|
||||
Void ViewArea::setSnapToGrid( Bool enable )
|
||||
{
|
||||
m_snapToGrid = enable;
|
||||
}
|
||||
|
||||
// void ViewArea::setSelectedArea( QRect &rect )
|
||||
// Void ViewArea::setSelectedArea( QRect &rect )
|
||||
//{
|
||||
// if( rect.isNull() )
|
||||
// {
|
||||
@@ -318,17 +309,17 @@ void ViewArea::setSnapToGrid( bool enable )
|
||||
// update( updateRect.normalized() );
|
||||
//}
|
||||
|
||||
void ViewArea::initZoomWinRect()
|
||||
Void ViewArea::initZoomWinRect()
|
||||
{
|
||||
int iMinX = 80;
|
||||
int iMinY = 80;
|
||||
Int iMinX = 80;
|
||||
Int iMinY = 80;
|
||||
|
||||
int iMaxX = iMinX * 5;
|
||||
int iMaxY = iMinY * 5;
|
||||
Int iMaxX = iMinX * 5;
|
||||
Int iMaxY = iMinY * 5;
|
||||
|
||||
double dSizeRatio, dWinZoomRatio;
|
||||
|
||||
int iHorizontalImg = ( m_pixmap.width() > m_pixmap.height() ) ? 1 : 0;
|
||||
Int iHorizontalImg = ( m_pixmap.width() > m_pixmap.height() ) ? 1 : 0;
|
||||
|
||||
if( iHorizontalImg )
|
||||
{
|
||||
@@ -368,10 +359,10 @@ void ViewArea::initZoomWinRect()
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Geometry Updates
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void ViewArea::updateSize()
|
||||
Void ViewArea::updateSize()
|
||||
{
|
||||
int w = m_pixmap.width() * m_dZoomFactor;
|
||||
int h = m_pixmap.height() * m_dZoomFactor;
|
||||
Int w = m_pixmap.width() * m_dZoomFactor;
|
||||
Int h = m_pixmap.height() * m_dZoomFactor;
|
||||
setMinimumSize( w, h );
|
||||
|
||||
QWidget* p = parentWidget();
|
||||
@@ -387,7 +378,7 @@ void ViewArea::updateSize()
|
||||
updateOffset();
|
||||
}
|
||||
|
||||
void ViewArea::updateOffset()
|
||||
Void ViewArea::updateOffset()
|
||||
{
|
||||
if( width() > m_pixmap.width() * m_dZoomFactor )
|
||||
{
|
||||
@@ -410,7 +401,7 @@ void ViewArea::updateOffset()
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Resize Event
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void ViewArea::resizeEvent( QResizeEvent* event )
|
||||
Void ViewArea::resizeEvent( QResizeEvent* event )
|
||||
{
|
||||
if( size().isEmpty() || m_pixmap.isNull() )
|
||||
return;
|
||||
@@ -420,10 +411,10 @@ void ViewArea::resizeEvent( QResizeEvent* event )
|
||||
update();
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Paint Event
|
||||
// PaInt Event
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void ViewArea::paintEvent( QPaintEvent* event )
|
||||
Void ViewArea::paintEvent( QPaintEvent* event )
|
||||
{
|
||||
QRect winRect = event->rect();
|
||||
|
||||
@@ -433,32 +424,32 @@ void ViewArea::paintEvent( QPaintEvent* event )
|
||||
if( size().isEmpty() || m_pixmap.isNull() )
|
||||
return;
|
||||
|
||||
QSize windowSize = parentWidget()->size();
|
||||
QPainter painter( this );
|
||||
QPainter paInter( this );
|
||||
|
||||
// Save the actual painter properties and scales the coordinate system.
|
||||
painter.save();
|
||||
painter.translate( m_xOffset, m_yOffset );
|
||||
painter.scale( m_dZoomFactor, m_dZoomFactor );
|
||||
// Save the actual paInter properties and scales the coordinate system.
|
||||
paInter.save();
|
||||
paInter.translate( m_xOffset, m_yOffset );
|
||||
paInter.scale( m_dZoomFactor, m_dZoomFactor );
|
||||
|
||||
// This line is for fast paiting. Only visible area of the image is painted.
|
||||
// This line is for fast paiting. Only visible area of the image is paInted.
|
||||
// We take the exposed rect from the event (that gives us scroll/expose
|
||||
// optimizations for free – no need
|
||||
// to draw the whole pixmap if your widget is only partially exposed), and
|
||||
// reverse map it with the painter matrix.
|
||||
// reverse map it with the paInter matrix.
|
||||
// That gives us the part of the pixmap that has actually been exposed.
|
||||
// See:
|
||||
// http://blog.qt.digia.com/blog/2006/05/13/fast-transformed-pixmapimage-drawing/
|
||||
QRect exposedRect = painter.worldTransform().inverted().mapRect( event->rect() ).adjusted( -1, -1, 1, 1 );
|
||||
QRect exposedRect =
|
||||
paInter.worldTransform().inverted().mapRect( event->rect() ).adjusted( -1, -1, 1, 1 );
|
||||
// Draw the pixmap.
|
||||
painter.drawPixmap( exposedRect, m_pixmap, exposedRect );
|
||||
paInter.drawPixmap( exposedRect, m_pixmap, exposedRect );
|
||||
|
||||
// Draw the Grid if it's visible.
|
||||
if( m_bGridVisible )
|
||||
{
|
||||
// Do we need to draw the whole grid?
|
||||
// To know that, we need to perform a transformation of the rectangle
|
||||
// area that the painter needs to update - transform the windows
|
||||
// area that the paInter needs to update - transform the windows
|
||||
// coordinates (origin at the top-left corner of the widget), to the
|
||||
// relatives coordinates of the image at it's original size (origin at
|
||||
// the top-left corner of the image).
|
||||
@@ -467,148 +458,161 @@ void ViewArea::paintEvent( QPaintEvent* event )
|
||||
// Now we have the (to update) rectangle area on a coordinates system
|
||||
// that has it's origin at the top-left corner of the image. That
|
||||
// is, is referenced to the not scaled image.
|
||||
// To know what image area we need to update, just intersects the
|
||||
// To know what image area we need to update, just Intersects the
|
||||
// rectangle area with the image area.
|
||||
vr &= QRect( 0, 0, m_pixmap.width(), m_pixmap.height() );
|
||||
|
||||
// Set up for the grid drawer.
|
||||
painter.setRenderHint( QPainter::Antialiasing );
|
||||
paInter.setRenderHint( QPainter::Antialiasing );
|
||||
|
||||
// Draw grid.
|
||||
m_grid.drawGrid( m_pixmap, vr, &painter );
|
||||
m_grid.drawGrid( m_pixmap, vr, &paInter );
|
||||
}
|
||||
|
||||
painter.restore();
|
||||
paInter.restore();
|
||||
|
||||
// Draw a border around the image.
|
||||
/* if( m_xOffset || m_yOffset )
|
||||
{
|
||||
painter.setPen( Qt::black );
|
||||
painter.drawRect( m_xOffset - 1, m_yOffset - 1, m_pixmap.width() *
|
||||
m_dZoomFactor + 1, m_pixmap.height() *
|
||||
m_dZoomFactor + 1 );
|
||||
}*/
|
||||
|
||||
int frFormat = m_pcCurrFrame->getColorSpace();
|
||||
{
|
||||
paInter.setPen( Qt::black );
|
||||
paInter.drawRect( m_xOffset - 1, m_yOffset - 1, m_pixmap.width() *
|
||||
m_dZoomFactor + 1, m_pixmap.height() *
|
||||
m_dZoomFactor + 1 );
|
||||
}*/
|
||||
|
||||
// Draw pixel values in grid
|
||||
if( m_dZoomFactor >= 60.0 || ( frFormat != CLP_COLOR_RGBA && m_dZoomFactor >= 50.0 ) )
|
||||
if( m_dZoomFactor >= 50.0 )
|
||||
{
|
||||
int imageWidth = m_pixmap.width();
|
||||
int imageHeight = m_pixmap.height();
|
||||
;
|
||||
Int imageWidth = m_pixmap.width();
|
||||
Int imageHeight = m_pixmap.height();
|
||||
PlaYUVerPixel sPixelValue;
|
||||
|
||||
QFont font( "Helvetica" );
|
||||
font.setPixelSize( 12 );
|
||||
painter.setFont( font );
|
||||
paInter.setFont( font );
|
||||
|
||||
QRect vr = windowToView( winRect );
|
||||
vr &= QRect( 0, 0, imageWidth, imageHeight );
|
||||
|
||||
for( int i = vr.x(); i <= vr.right(); i++ )
|
||||
for( Int i = vr.x(); i <= vr.right(); i++ )
|
||||
{
|
||||
for( int j = vr.y(); j <= vr.bottom(); j++ )
|
||||
for( Int j = vr.y(); j <= vr.bottom(); j++ )
|
||||
{
|
||||
QPoint pixelTopLeft( i, j );
|
||||
|
||||
QRect pixelRect( viewToWindow( pixelTopLeft ), QSize( m_dZoomFactor, m_dZoomFactor ) );
|
||||
QString pixelValue;
|
||||
CalypPixel pixel = m_pcCurrFrame->getPixel( pixelTopLeft.x(), pixelTopLeft.y() );
|
||||
|
||||
if( frFormat == CLP_COLOR_YUV || frFormat == CLP_COLOR_GRAY )
|
||||
Int frFormat = m_pcCurrFrame->getColorSpace();
|
||||
|
||||
if( frFormat == PlaYUVerPixel::COLOR_YUV )
|
||||
{
|
||||
if( pixel[0] < m_uiPixelHalfScale )
|
||||
painter.setPen( QColor( Qt::white ) );
|
||||
else
|
||||
painter.setPen( QColor( Qt::black ) );
|
||||
sPixelValue = m_pcCurrFrame->getPixelValue( pixelTopLeft.x(), pixelTopLeft.y() );
|
||||
|
||||
pixelValue = QString( "Y: %1" ).arg( pixel[0] );
|
||||
if( frFormat == CLP_COLOR_YUV )
|
||||
pixelValue += QString( "\nU: %1\nV: %2" ).arg( pixel[1] ).arg( pixel[2] );
|
||||
if( sPixelValue.Y() < m_uiPixelHalfScale )
|
||||
paInter.setPen( QColor( Qt::white ) );
|
||||
else
|
||||
paInter.setPen( QColor( Qt::black ) );
|
||||
|
||||
paInter.drawText( pixelRect, Qt::AlignCenter,
|
||||
"Y: " + QString::number( sPixelValue.Y() ) + "\n" +
|
||||
"U: " + QString::number( sPixelValue.Cb() ) + "\n" +
|
||||
"V: " + QString::number( sPixelValue.Cr() ) );
|
||||
}
|
||||
if( frFormat == PlaYUVerPixel::COLOR_GRAY )
|
||||
{
|
||||
sPixelValue = m_pcCurrFrame->getPixelValue( pixelTopLeft.x(), pixelTopLeft.y() );
|
||||
|
||||
if( sPixelValue.Y() < m_uiPixelHalfScale )
|
||||
paInter.setPen( QColor( Qt::white ) );
|
||||
else
|
||||
paInter.setPen( QColor( Qt::black ) );
|
||||
|
||||
paInter.drawText( pixelRect, Qt::AlignCenter,
|
||||
"Y: " + QString::number( sPixelValue.Y() ) );
|
||||
}
|
||||
|
||||
if( frFormat == CLP_COLOR_RGB || frFormat == CLP_COLOR_RGBA )
|
||||
if( ( frFormat == PlaYUVerPixel::COLOR_RGB ) )
|
||||
{
|
||||
if( ( pixel[0] + pixel[1] + pixel[2] ) < ( m_uiPixelHalfScale * 3 ) )
|
||||
painter.setPen( QColor( Qt::white ) );
|
||||
else
|
||||
painter.setPen( QColor( Qt::black ) );
|
||||
sPixelValue = m_pcCurrFrame->getPixelValue( pixelTopLeft.x(), pixelTopLeft.y() );
|
||||
|
||||
pixelValue = QString( "R: %1\nG: %2\nB: %3" ).arg( pixel[0] ).arg( pixel[1] ).arg( pixel[2] );
|
||||
if( frFormat == CLP_COLOR_RGBA )
|
||||
pixelValue += QString( "\nA: %1" ).arg( pixel[3] );
|
||||
if( ( sPixelValue.R() + sPixelValue.G() + sPixelValue.B() ) < ( m_uiPixelHalfScale * 3 ) )
|
||||
paInter.setPen( QColor( Qt::white ) );
|
||||
else
|
||||
paInter.setPen( QColor( Qt::black ) );
|
||||
|
||||
paInter.drawText( pixelRect, Qt::AlignCenter,
|
||||
"R: " + QString::number( sPixelValue.R() ) + "\n" +
|
||||
"G: " + QString::number( sPixelValue.G() ) + "\n" +
|
||||
"B: " + QString::number( sPixelValue.B() ) );
|
||||
}
|
||||
painter.drawText( pixelRect, Qt::AlignCenter, pixelValue );
|
||||
}
|
||||
}
|
||||
|
||||
QColor color( Qt::white );
|
||||
QPen mainPen = QPen( color, 1, Qt::SolidLine );
|
||||
painter.setPen( mainPen );
|
||||
paInter.setPen( mainPen );
|
||||
|
||||
// Draw vertical line
|
||||
for( int x = vr.x(); x <= ( vr.right() + 1 ); x++ )
|
||||
for( Int x = vr.x(); x <= ( vr.right() + 1 ); x++ )
|
||||
{
|
||||
// Always draw the full line otherwise the line stippling
|
||||
// varies with the location of view area and we get glitchy
|
||||
// patterns.
|
||||
painter.drawLine( viewToWindow( QPoint( x, 0 ) ), viewToWindow( QPoint( x, imageHeight ) ) );
|
||||
paInter.drawLine( viewToWindow( QPoint( x, 0 ) ), viewToWindow( QPoint( x, imageHeight ) ) );
|
||||
}
|
||||
// Draw horizontal line
|
||||
for( int y = vr.y(); y <= ( vr.bottom() + 1 ); y++ )
|
||||
for( Int y = vr.y(); y <= ( vr.bottom() + 1 ); y++ )
|
||||
{
|
||||
painter.drawLine( viewToWindow( QPoint( 0, y ) ), viewToWindow( QPoint( imageWidth, y ) ) );
|
||||
paInter.drawLine( viewToWindow( QPoint( 0, y ) ), viewToWindow( QPoint( imageWidth, y ) ) );
|
||||
}
|
||||
}
|
||||
bool showZoomRect = m_pixmap.width() * m_dZoomFactor > windowSize.width() ||
|
||||
m_pixmap.height() * m_dZoomFactor > windowSize.height();
|
||||
|
||||
// VISIBLE ZOOM RECT
|
||||
if( m_visibleZoomRect && m_zoomWinTimer.isActive() && showZoomRect )
|
||||
// VISIBLE ZOOM RECT
|
||||
#if 0
|
||||
if( m_visibleZoomRect && m_zoomWinTimer.isActive() )
|
||||
{
|
||||
double dRatio = m_dZoomWinRatio;
|
||||
|
||||
QRect cImg = QRect( 0, 0, m_pixmap.width(), m_pixmap.height() );
|
||||
QPoint cZWinRBpos = QPoint( winRect.bottomRight() ) - QPoint( 15, 15 );
|
||||
QRect cImgWinRect( 0, 0, round( (double)cImg.width() / dRatio ), round( (double)cImg.height() / dRatio ) );
|
||||
cImgWinRect.moveBottomRight( cZWinRBpos );
|
||||
QRect cImg = QRect(0, 0, m_pixmap.width(), m_pixmap.height() );
|
||||
QPoint cZWinRBpos = QPoint(winRect.bottomRight()) - QPoint(15,15);
|
||||
QRect cImgWinRect(0, 0, round((double)cImg.width()/dRatio), round((double)cImg.height()/dRatio) );
|
||||
cImgWinRect.moveBottomRight(cZWinRBpos);
|
||||
|
||||
QRect vr = windowToView( winRect );
|
||||
QRect cVisibleImg = vr & cImg;
|
||||
//cVisibleImg.moveTopLeft(vr.topLeft());
|
||||
QRect cVisibleWinRect;
|
||||
cVisibleWinRect.setLeft( floor( (double)cVisibleImg.x() / dRatio ) );
|
||||
cVisibleWinRect.setTop( floor( (double)cVisibleImg.y() / dRatio ) );
|
||||
cVisibleWinRect.setRight( round( (double)cVisibleImg.right() / dRatio ) );
|
||||
cVisibleWinRect.setBottom( round( (double)cVisibleImg.bottom() / dRatio ) );
|
||||
cVisibleWinRect.setLeft(floor((double)cVisibleImg.x()/dRatio));
|
||||
cVisibleWinRect.setTop(floor((double)cVisibleImg.y()/dRatio));
|
||||
cVisibleWinRect.setRight(round((double)cVisibleImg.right()/dRatio));
|
||||
cVisibleWinRect.setBottom(round((double)cVisibleImg.bottom()/dRatio));
|
||||
|
||||
//painter.fillRect( cImgWinRect, QBrush( QColor( 128, 128, 128, 128 ) ) );
|
||||
painter.setPen( QColor( 50, 50, 50, 128 ) );
|
||||
//painter.drawRect( cImgWinRect );
|
||||
painter.setOpacity( 0.7 );
|
||||
painter.drawPixmap( cImgWinRect, m_pixmap );
|
||||
painter.setOpacity( 1 );
|
||||
paInter.fillRect(cImgWinRect, QBrush(QColor(128, 128, 128, 128)));
|
||||
paInter.setPen(QColor(50, 50, 50, 128));
|
||||
paInter.drawRect(cImgWinRect);
|
||||
|
||||
cVisibleWinRect.moveTopLeft( cImgWinRect.topLeft() + cVisibleWinRect.topLeft() );
|
||||
|
||||
cVisibleWinRect = cVisibleWinRect & cImgWinRect;
|
||||
|
||||
if( cVisibleWinRect.left() < 0 )
|
||||
cVisibleWinRect.moveLeft( 0 );
|
||||
if( cVisibleWinRect.top() < 0 )
|
||||
cVisibleWinRect.moveTop( 0 );
|
||||
if(cVisibleWinRect.left()<0)
|
||||
cVisibleWinRect.moveLeft(0);
|
||||
if(cVisibleWinRect.top()<0)
|
||||
cVisibleWinRect.moveTop(0);
|
||||
|
||||
if( cVisibleWinRect.width() <= 0 )
|
||||
cVisibleWinRect.setWidth( 1 );
|
||||
if( cVisibleWinRect.height() <= 0 )
|
||||
cVisibleWinRect.setHeight( 1 );
|
||||
if(cVisibleWinRect.width()<=0)
|
||||
cVisibleWinRect.setWidth(1);
|
||||
if(cVisibleWinRect.height()<=0)
|
||||
cVisibleWinRect.setHeight(1);
|
||||
|
||||
painter.fillRect( cVisibleWinRect, QBrush( QColor( 200, 200, 200, 128 ) ) );
|
||||
painter.setPen( QColor( 255, 255, 255, 128 ) );
|
||||
painter.drawRect( cVisibleWinRect );
|
||||
paInter.fillRect(cVisibleWinRect, QBrush(QColor(200, 200, 200, 128)));
|
||||
paInter.setPen(QColor(255, 255, 255, 128));
|
||||
paInter.drawRect(cVisibleWinRect);
|
||||
|
||||
//qDebug() << "Debug VisibleZoomRect: " << winRect << vr << cImgWinRect << cVisibleWinRect << cVisibleImg << dRatio;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
QRect sr = viewToWindow( m_selectedArea );
|
||||
QRect ir = sr & winRect;
|
||||
@@ -625,13 +629,13 @@ void ViewArea::paintEvent( QPaintEvent* event )
|
||||
QBrush brush( selectColor );
|
||||
|
||||
if( m_blockTrackEnable )
|
||||
painter.setBrush( Qt::NoBrush );
|
||||
paInter.setBrush( Qt::NoBrush );
|
||||
else
|
||||
painter.setBrush( brush );
|
||||
paInter.setBrush( brush );
|
||||
|
||||
painter.setPen( Qt::darkCyan );
|
||||
paInter.setPen( Qt::darkCyan );
|
||||
|
||||
// painter.drawRect( sr/*m_selectedArea*/ );
|
||||
// paInter.drawRect( sr/*m_selectedArea*/ );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -640,23 +644,23 @@ void ViewArea::paintEvent( QPaintEvent* event )
|
||||
fill.setAlpha( 150 );
|
||||
|
||||
QBrush brush( fill );
|
||||
painter.setBrush( fill );
|
||||
painter.setPen( Qt::NoPen );
|
||||
paInter.setBrush( fill );
|
||||
paInter.setPen( Qt::NoPen );
|
||||
QPainterPath myPath;
|
||||
QRect imgr = viewToWindow( QRect( 0, 0, m_pixmap.width(), m_pixmap.height() ) );
|
||||
|
||||
myPath.addRect( imgr );
|
||||
myPath.addRect( sr ); // m_selectedArea
|
||||
painter.drawPath( myPath );
|
||||
paInter.drawPath( myPath );
|
||||
|
||||
// 2) Draw the selection rectangle
|
||||
painter.setBrush( Qt::NoBrush );
|
||||
painter.setPen( Qt::darkCyan );
|
||||
// painter.drawRect( sr/*m_selectedArea*/ );
|
||||
paInter.setBrush( Qt::NoBrush );
|
||||
paInter.setPen( Qt::darkCyan );
|
||||
// paInter.drawRect( sr/*m_selectedArea*/ );
|
||||
}
|
||||
|
||||
if( !ir.isNull() )
|
||||
painter.drawRect( sr /*m_selectedArea*/ );
|
||||
paInter.drawRect( sr /*m_selectedArea*/ );
|
||||
}
|
||||
|
||||
// Mask Mode ----------------------------------------------------------
|
||||
@@ -675,12 +679,12 @@ void ViewArea::paintEvent( QPaintEvent* event )
|
||||
color = imageMaskColor;
|
||||
|
||||
color.setAlpha( 120 );
|
||||
painter.setPen( color );
|
||||
painter.save();
|
||||
painter.translate( m_xOffset, m_yOffset );
|
||||
painter.scale( m_dZoomFactor, m_dZoomFactor );
|
||||
painter.drawPixmap( QPoint( 0, 0 ), m_mask );
|
||||
painter.restore();
|
||||
paInter.setPen( color );
|
||||
paInter.save();
|
||||
paInter.translate( m_xOffset, m_yOffset );
|
||||
paInter.scale( m_dZoomFactor, m_dZoomFactor );
|
||||
paInter.drawPixmap( QPoint( 0, 0 ), m_mask );
|
||||
paInter.restore();
|
||||
|
||||
if( !m_selectedArea.isNull() )
|
||||
{
|
||||
@@ -710,13 +714,13 @@ void ViewArea::paintEvent( QPaintEvent* event )
|
||||
brush = QBrush( color );
|
||||
|
||||
if( m_blockTrackEnable )
|
||||
painter.setBrush( Qt::NoBrush );
|
||||
paInter.setBrush( Qt::NoBrush );
|
||||
else
|
||||
painter.setBrush( brush );
|
||||
paInter.setBrush( brush );
|
||||
|
||||
painter.setPen( color );
|
||||
paInter.setPen( color );
|
||||
if( !ir.isNull() )
|
||||
painter.drawRect( sr );
|
||||
paInter.drawRect( sr );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -724,12 +728,10 @@ void ViewArea::paintEvent( QPaintEvent* event )
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Mouse Events
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void ViewArea::wheelEvent( QWheelEvent* event )
|
||||
Void ViewArea::wheelEvent( QWheelEvent* event )
|
||||
{
|
||||
double scale;
|
||||
double usedScale;
|
||||
|
||||
event->accept();
|
||||
Double scale;
|
||||
Double usedScale;
|
||||
|
||||
if( event->modifiers() & Qt::ControlModifier )
|
||||
{
|
||||
@@ -749,7 +751,7 @@ void ViewArea::wheelEvent( QWheelEvent* event )
|
||||
}
|
||||
}
|
||||
|
||||
void ViewArea::mousePressEvent( QMouseEvent* event )
|
||||
Void ViewArea::mousePressEvent( QMouseEvent* event )
|
||||
{
|
||||
event->accept();
|
||||
|
||||
@@ -782,12 +784,12 @@ void ViewArea::mousePressEvent( QMouseEvent* event )
|
||||
// If grid tracking
|
||||
if( m_snapToGrid )
|
||||
{
|
||||
// Find if the cursor is near a grid intersection
|
||||
bool isNear = m_grid.isNear( m_lastPos );
|
||||
// Find if the cursor is near a grid Intersection
|
||||
Bool isNear = m_grid.isNear( m_lastPos );
|
||||
isNear = true;
|
||||
if( isNear )
|
||||
{
|
||||
// The grid 'near intersection' found when used isNear()
|
||||
// The grid 'near Intersection' found when used isNear()
|
||||
m_lastPos = m_grid.nearPos();
|
||||
}
|
||||
}
|
||||
@@ -815,16 +817,16 @@ void ViewArea::mousePressEvent( QMouseEvent* event )
|
||||
}
|
||||
}
|
||||
|
||||
void ViewArea::mouseMoveEvent( QMouseEvent* event )
|
||||
Void ViewArea::mouseMoveEvent( QMouseEvent* event )
|
||||
{
|
||||
event->accept();
|
||||
|
||||
//#ifndef _MSC_VER
|
||||
// // Add this code line to avoid slow navigation with some specific mouses
|
||||
// // This seems to always appear on windows
|
||||
// if( qApp->hasPendingEvents() )
|
||||
// return;
|
||||
//#endif
|
||||
#ifndef _MSC_VER
|
||||
// Add this code line to aVoid slow navigation with some specific mouses
|
||||
// This seems to always appear on windows
|
||||
if( qApp->hasPendingEvents() )
|
||||
return;
|
||||
#endif
|
||||
|
||||
QPoint actualPos = windowToView( event->pos() );
|
||||
QRect updateRect;
|
||||
@@ -837,12 +839,12 @@ void ViewArea::mouseMoveEvent( QMouseEvent* event )
|
||||
// Grid tracking
|
||||
if( m_snapToGrid )
|
||||
{
|
||||
// Find if the cursor is near a grid intersection
|
||||
bool isNear = m_grid.isNear( actualPos );
|
||||
// Find if the cursor is near a grid Intersection
|
||||
Bool isNear = m_grid.isNear( actualPos );
|
||||
|
||||
if( isNear )
|
||||
{
|
||||
// Return the last grid near intersection found
|
||||
// Return the last grid near Intersection found
|
||||
actualPos = m_grid.nearPos();
|
||||
}
|
||||
}
|
||||
@@ -902,21 +904,21 @@ void ViewArea::mouseMoveEvent( QMouseEvent* event )
|
||||
}
|
||||
}
|
||||
/* else // if tool() == BlockSelectionTool || MaskTool || EraserTool
|
||||
{
|
||||
m_blockTrackEnable = false;
|
||||
// If cursor is inside the selected area, we most redraw
|
||||
// the selection rect because it may be smaller.
|
||||
if( m_selectedArea.contains( actualPos ) )
|
||||
{
|
||||
m_selectedArea = m_grid.rectContains( m_lastPos );
|
||||
}
|
||||
{
|
||||
m_blockTrackEnable = false;
|
||||
// If cursor is inside the selected area, we most redraw
|
||||
// the selection rect because it may be smaller.
|
||||
if( m_selectedArea.contains( actualPos ) )
|
||||
{
|
||||
m_selectedArea = m_grid.rectContains( m_lastPos );
|
||||
}
|
||||
|
||||
m_selectedArea = m_selectedArea.united( m_grid.rectContains( actualPos ) );
|
||||
}
|
||||
*/
|
||||
m_selectedArea = m_selectedArea.united( m_grid.rectContains( actualPos ) );
|
||||
}
|
||||
*/
|
||||
if( tool() == SelectionTool )
|
||||
{
|
||||
// intercept the selected area with the image area to limit the
|
||||
// Intercept the selected area with the image area to limit the
|
||||
// selection only to the image area, preventing it to come outside
|
||||
// the image.
|
||||
m_selectedArea &= QRect( 0, 0, m_pixmap.width(), m_pixmap.height() );
|
||||
@@ -957,7 +959,7 @@ void ViewArea::mouseMoveEvent( QMouseEvent* event )
|
||||
}
|
||||
}
|
||||
|
||||
void ViewArea::mouseReleaseEvent( QMouseEvent* event )
|
||||
Void ViewArea::mouseReleaseEvent( QMouseEvent* event )
|
||||
{
|
||||
event->accept();
|
||||
|
||||
@@ -1001,7 +1003,7 @@ void ViewArea::mouseReleaseEvent( QMouseEvent* event )
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool ViewArea::isPosValid( const QPoint& pos ) const
|
||||
Bool ViewArea::isPosValid( const QPoint& pos ) const
|
||||
{
|
||||
if( pos.x() < 0 || pos.y() < 0 || pos.x() >= m_pixmap.width() || pos.y() >= m_pixmap.height() )
|
||||
return false;
|
||||
@@ -1014,8 +1016,8 @@ bool ViewArea::isPosValid( const QPoint& pos ) const
|
||||
QPoint ViewArea::windowToView( const QPoint& pt ) const
|
||||
{
|
||||
QPoint p;
|
||||
p.setX( static_cast<int>( ( pt.x() - m_xOffset ) / m_dZoomFactor ) );
|
||||
p.setY( static_cast<int>( ( pt.y() - m_yOffset ) / m_dZoomFactor ) );
|
||||
p.setX( static_cast<Int>( ( pt.x() - m_xOffset ) / m_dZoomFactor ) );
|
||||
p.setY( static_cast<Int>( ( pt.y() - m_yOffset ) / m_dZoomFactor ) );
|
||||
|
||||
return p;
|
||||
}
|
||||
@@ -1025,11 +1027,11 @@ QRect ViewArea::windowToView( const QRect& rc ) const
|
||||
QRect r;
|
||||
|
||||
r.setTopLeft( windowToView( rc.topLeft() ) );
|
||||
// r.setRight ( (int)( ceil(( rc.right() - m_xOffset)/m_dZoomFactor )));
|
||||
// r.setBottom( (int)( ceil(( rc.bottom()- m_yOffset)/m_dZoomFactor )));
|
||||
// r.setRight ( static_cast<int>(( rc.right() - m_xOffset ) /
|
||||
// r.setRight ( (Int)( ceil(( rc.right() - m_xOffset)/m_dZoomFactor )));
|
||||
// r.setBottom( (Int)( ceil(( rc.bottom()- m_yOffset)/m_dZoomFactor )));
|
||||
// r.setRight ( static_cast<Int>(( rc.right() - m_xOffset ) /
|
||||
// m_dZoomFactor +1));
|
||||
// r.setBottom( static_cast<int>(( rc.bottom() - m_xOffset ) /
|
||||
// r.setBottom( static_cast<Int>(( rc.bottom() - m_xOffset ) /
|
||||
// m_dZoomFactor+1));
|
||||
r.setBottomRight( windowToView( rc.bottomRight() ) );
|
||||
return r;
|
||||
@@ -1039,8 +1041,8 @@ QPoint ViewArea::viewToWindow( const QPoint& pt ) const
|
||||
{
|
||||
QPoint p;
|
||||
|
||||
p.setX( static_cast<int>( pt.x() * m_dZoomFactor + m_xOffset ) );
|
||||
p.setY( static_cast<int>( pt.y() * m_dZoomFactor + m_yOffset ) );
|
||||
p.setX( static_cast<Int>( pt.x() * m_dZoomFactor + m_xOffset ) );
|
||||
p.setY( static_cast<Int>( pt.y() * m_dZoomFactor + m_yOffset ) );
|
||||
|
||||
return p;
|
||||
}
|
||||
@@ -1050,18 +1052,18 @@ QRect ViewArea::viewToWindow( const QRect& rc ) const
|
||||
QRect r;
|
||||
|
||||
r.setTopLeft( viewToWindow( rc.topLeft() ) );
|
||||
// r.setRight ( (int)( ceil(( rc.right() +1+m_xOffset )*m_dZoomFactor ) -
|
||||
// r.setRight ( (Int)( ceil(( rc.right() +1+m_xOffset )*m_dZoomFactor ) -
|
||||
// 1 ));
|
||||
// r.setBottom( (int)( ceil(( rc.bottom()+1+m_yOffset )*m_dZoomFactor ) -
|
||||
// r.setBottom( (Int)( ceil(( rc.bottom()+1+m_yOffset )*m_dZoomFactor ) -
|
||||
// 1 ));
|
||||
// r.setRight ( (int)( ceil(( rc.right()+0.5)*m_dZoomFactor )+ m_xOffset
|
||||
// r.setRight ( (Int)( ceil(( rc.right()+0.5)*m_dZoomFactor )+ m_xOffset
|
||||
// )-1);
|
||||
// r.setBottom( (int)( ceil(( rc.bottom()+0.5)*m_dZoomFactor ) +m_yOffset
|
||||
// r.setBottom( (Int)( ceil(( rc.bottom()+0.5)*m_dZoomFactor ) +m_yOffset
|
||||
// )-1);
|
||||
// qDebug()<<"Right = "<< r.right();
|
||||
// r.setRight ( static_cast<int>(( rc.right()+1) * m_dZoomFactor +
|
||||
// r.setRight ( static_cast<Int>(( rc.right()+1) * m_dZoomFactor +
|
||||
// m_xOffset -1) );
|
||||
// r.setBottom( static_cast<int>(( rc.bottom()+1) * m_dZoomFactor +
|
||||
// r.setBottom( static_cast<Int>(( rc.bottom()+1) * m_dZoomFactor +
|
||||
// m_yOffset -1));
|
||||
r.setBottomRight( viewToWindow( rc.bottomRight() ) );
|
||||
|
||||
@@ -1071,28 +1073,28 @@ QRect ViewArea::viewToWindow( const QRect& rc ) const
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Masks Management
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void ViewArea::updateMask( const QRect& rect )
|
||||
Void ViewArea::updateMask( const QRect& rect )
|
||||
{
|
||||
switch( tool() )
|
||||
{
|
||||
case MaskTool:
|
||||
{
|
||||
// Add rect to the mask
|
||||
QPainter painter( &m_mask );
|
||||
painter.setBrush( Qt::color1 );
|
||||
painter.setPen( Qt::NoPen );
|
||||
painter.drawRect( rect );
|
||||
painter.end();
|
||||
QPainter paInter( &m_mask );
|
||||
paInter.setBrush( Qt::color1 );
|
||||
paInter.setPen( Qt::NoPen );
|
||||
paInter.drawRect( rect );
|
||||
paInter.end();
|
||||
break;
|
||||
}
|
||||
case EraserTool:
|
||||
{
|
||||
// Clears rect area in the mask
|
||||
QPainter painter( &m_mask );
|
||||
painter.setBrush( Qt::color0 );
|
||||
painter.setPen( Qt::NoPen );
|
||||
painter.drawRect( rect );
|
||||
painter.end();
|
||||
QPainter paInter( &m_mask );
|
||||
paInter.setBrush( Qt::color0 );
|
||||
paInter.setPen( Qt::NoPen );
|
||||
paInter.drawRect( rect );
|
||||
paInter.end();
|
||||
break;
|
||||
}
|
||||
default: /* Do Nothing */
|
||||
|
||||
+47
-52
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -26,18 +26,17 @@
|
||||
#ifndef __VIEWAREA_H__
|
||||
#define __VIEWAREA_H__
|
||||
|
||||
#include "CommonDefs.h"
|
||||
#include "GridManager.h"
|
||||
#include "PlaYUVerAppDefs.h"
|
||||
#include "config.h"
|
||||
#include "lib/CalypFrame.h"
|
||||
|
||||
#include "lib/PlaYUVerFrame.h"
|
||||
#include <QBitmap>
|
||||
#include <QColor>
|
||||
#include <QPixmap>
|
||||
#include <QTimer>
|
||||
#include <QWidget>
|
||||
|
||||
class CalypStream;
|
||||
class PlaYUVerStream;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -56,42 +55,38 @@ public:
|
||||
|
||||
ViewArea( QWidget* parent = 0 );
|
||||
|
||||
void setImage( CalypFrame* pcFrame );
|
||||
void setImage( const QPixmap& pixmap );
|
||||
Void setImage( PlaYUVerFrame* pcFrame );
|
||||
Void setImage( const QPixmap& pixmap );
|
||||
|
||||
void setMode( int mode );
|
||||
void setMaskColor( const QColor& color = QColor() );
|
||||
Void setMode( Int mode );
|
||||
Void setMaskColor( const QColor& color = QColor() );
|
||||
|
||||
/**
|
||||
* Clears any contents.
|
||||
*/
|
||||
void clear();
|
||||
Void clear();
|
||||
|
||||
/**
|
||||
* Select tool from the menu
|
||||
*/
|
||||
void setTool( unsigned int view );
|
||||
Void setTool( UInt view );
|
||||
|
||||
/**
|
||||
* Grid options
|
||||
*/
|
||||
void setGridVisible( bool enable );
|
||||
void setGridSize( int size );
|
||||
Void setGridVisible( Bool enable );
|
||||
|
||||
/**
|
||||
* Clears any mask content.
|
||||
*/
|
||||
void clearMask();
|
||||
Void clearMask();
|
||||
|
||||
QPixmap image() const { return m_pixmap; }
|
||||
QBitmap mask() const { return m_mask; }
|
||||
QRect selectedArea() const { return m_selectedArea; }
|
||||
GridManager gridManager() const { return m_grid; }
|
||||
QColor maskColor() const { return m_maskColor; }
|
||||
double getZoomFactor() { return m_dZoomFactor; }
|
||||
Double getZoomFactor() { return m_dZoomFactor; }
|
||||
// Scale function. Return used scale value (it may change when it touches the
|
||||
// min or max zoom value)
|
||||
double scaleZoomFactor( double scale, QPoint center, QSize minimumSize );
|
||||
Double scaleZoomFactor( Double scale, QPoint center, QSize minimumSize );
|
||||
|
||||
Q_SIGNALS:
|
||||
void selectionChanged( const QRect& rect );
|
||||
@@ -100,25 +95,25 @@ Q_SIGNALS:
|
||||
void zoomFactorChanged_byWheel( const double factor, const QPoint center );
|
||||
|
||||
public Q_SLOTS:
|
||||
// void setNormalMode();
|
||||
// void setMaskMode();
|
||||
// void setMaskTool();
|
||||
// void setEraserTool();
|
||||
// void setNormalSelectionTool();
|
||||
// void setBlockSelectionTool();
|
||||
// Void setNormalMode();
|
||||
// Void setMaskMode();
|
||||
// Void setMaskTool();
|
||||
// Void setEraserTool();
|
||||
// Void setNormalSelectionTool();
|
||||
// Void setBlockSelectionTool();
|
||||
void setSnapToGrid( bool enable );
|
||||
// void setSelectedArea( QRect &rect );
|
||||
|
||||
protected:
|
||||
void paintEvent( QPaintEvent* event );
|
||||
void resizeEvent( QResizeEvent* event );
|
||||
void mousePressEvent( QMouseEvent* event );
|
||||
void mouseMoveEvent( QMouseEvent* event );
|
||||
void mouseReleaseEvent( QMouseEvent* event );
|
||||
void wheelEvent( QWheelEvent* event );
|
||||
Void paintEvent( QPaintEvent* event );
|
||||
Void resizeEvent( QResizeEvent* event );
|
||||
Void mousePressEvent( QMouseEvent* event );
|
||||
Void mouseMoveEvent( QMouseEvent* event );
|
||||
Void mouseReleaseEvent( QMouseEvent* event );
|
||||
Void wheelEvent( QWheelEvent* event );
|
||||
|
||||
void updateSize();
|
||||
void updateOffset();
|
||||
Void updateSize();
|
||||
Void updateOffset();
|
||||
|
||||
private:
|
||||
enum ViewMode
|
||||
@@ -137,12 +132,12 @@ private:
|
||||
|
||||
ViewMode mode() const { return m_mode; }
|
||||
Tool tool() const { return m_eTool; }
|
||||
void initZoomWinRect();
|
||||
void startZoomWinTimer();
|
||||
void setZoomFactor( double );
|
||||
Void initZoomWinRect();
|
||||
Void startZoomWinTimer();
|
||||
Void setZoomFactor( Double );
|
||||
|
||||
bool isPosValid( const QPoint& pos ) const;
|
||||
void updateMask( const QRect& rect );
|
||||
Bool isPosValid( const QPoint& pos ) const;
|
||||
Void updateMask( const QRect& rect );
|
||||
|
||||
QPoint windowToView( const QPoint& pt ) const;
|
||||
QRect windowToView( const QRect& rc ) const;
|
||||
@@ -150,16 +145,16 @@ private:
|
||||
QPoint viewToWindow( const QPoint& pt ) const;
|
||||
QRect viewToWindow( const QRect& rc ) const;
|
||||
|
||||
CalypFrame* m_pcCurrFrame;
|
||||
PlaYUVerFrame* m_pcCurrFrame;
|
||||
|
||||
ClpPel m_uiPixelHalfScale;
|
||||
Pel m_uiPixelHalfScale;
|
||||
|
||||
Tool m_eTool;
|
||||
bool m_bGridVisible;
|
||||
Bool m_bGridVisible;
|
||||
|
||||
QTimer m_zoomWinTimer;
|
||||
double m_dZoomWinRatio;
|
||||
double m_dZoomFactor;
|
||||
Double m_dZoomWinRatio;
|
||||
Double m_dZoomFactor;
|
||||
|
||||
QPixmap m_pixmap;
|
||||
QBitmap m_mask;
|
||||
@@ -170,13 +165,13 @@ private:
|
||||
ViewMode m_mode;
|
||||
|
||||
QColor m_maskColor;
|
||||
int m_xOffset;
|
||||
int m_yOffset;
|
||||
bool m_blockTrackEnable;
|
||||
bool m_newShape;
|
||||
bool m_snapToGrid;
|
||||
bool m_cursorInGrid;
|
||||
bool m_visibleZoomRect;
|
||||
Int m_xOffset;
|
||||
Int m_yOffset;
|
||||
Bool m_blockTrackEnable;
|
||||
Bool m_newShape;
|
||||
Bool m_snapToGrid;
|
||||
Bool m_cursorInGrid;
|
||||
Bool m_visibleZoomRect;
|
||||
};
|
||||
|
||||
#endif // __VIEWAREA_H__
|
||||
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -22,14 +22,16 @@
|
||||
* \brief Frame number widget
|
||||
*/
|
||||
|
||||
#include "FrameNumberWidget.h"
|
||||
#include "config.h"
|
||||
#include <QtCore>
|
||||
#if( QT_VERSION_PLAYUVER == 5 )
|
||||
#include <QtWidgets>
|
||||
#elif( QT_VERSION_PLAYUVER == 4 )
|
||||
#include <QtGui>
|
||||
#endif
|
||||
#include "WidgetFrameNumber.h"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QString>
|
||||
|
||||
FrameNumberWidget::FrameNumberWidget( QWidget* parent )
|
||||
: QWidget( parent )
|
||||
WidgetFrameNumber::WidgetFrameNumber( QWidget* parent ) : QWidget( parent )
|
||||
{
|
||||
QHBoxLayout* mainlayout = new QHBoxLayout;
|
||||
m_pcCurrFrameNumLabel = new QLabel;
|
||||
@@ -49,15 +51,15 @@ FrameNumberWidget::FrameNumberWidget( QWidget* parent )
|
||||
mainlayout->addWidget( m_pcTotalFrameNumLabel );
|
||||
setLayout( mainlayout );
|
||||
}
|
||||
void FrameNumberWidget::setCurrFrameNum( int number )
|
||||
Void WidgetFrameNumber::setCurrFrameNum( Int number )
|
||||
{
|
||||
m_pcCurrFrameNumLabel->setText( QString( tr( "%1" ) ).arg( number ) );
|
||||
}
|
||||
void FrameNumberWidget::setTotalFrameNum( int number )
|
||||
Void WidgetFrameNumber::setTotalFrameNum( Int number )
|
||||
{
|
||||
m_pcTotalFrameNumLabel->setText( QString( tr( "%1" ) ).arg( number ) );
|
||||
}
|
||||
void FrameNumberWidget::clear()
|
||||
Void WidgetFrameNumber::clear()
|
||||
{
|
||||
m_pcCurrFrameNumLabel->setText( "-" );
|
||||
m_pcTotalFrameNumLabel->setText( "-" );
|
||||
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -25,20 +25,22 @@
|
||||
#ifndef __WIDGETFRAMENUMBER_H__
|
||||
#define __WIDGETFRAMENUMBER_H__
|
||||
|
||||
#include "CommonDefs.h"
|
||||
#include "PlaYUVerAppDefs.h"
|
||||
#include "config.h"
|
||||
#include <QtCore>
|
||||
#if( QT_VERSION_PLAYUVER == 5 )
|
||||
#include <QtWidgets>
|
||||
#elif( QT_VERSION_PLAYUVER == 4 )
|
||||
#include <QtGui>
|
||||
#endif
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class QLabel;
|
||||
|
||||
class FrameNumberWidget : public QWidget
|
||||
class WidgetFrameNumber : public QWidget
|
||||
{
|
||||
public:
|
||||
FrameNumberWidget( QWidget* parent = 0 );
|
||||
void setCurrFrameNum( int number );
|
||||
void setTotalFrameNum( int number );
|
||||
void clear();
|
||||
WidgetFrameNumber( QWidget* parent = 0 );
|
||||
Void setCurrFrameNum( Int number );
|
||||
Void setTotalFrameNum( Int number );
|
||||
Void clear();
|
||||
|
||||
private:
|
||||
QLabel* m_pcCurrFrameNumLabel;
|
||||
Vendored
-5
@@ -1,5 +0,0 @@
|
||||
###
|
||||
### CMakeLists for calyp external components
|
||||
###
|
||||
|
||||
ADD_SUBDIRECTORY( qcustomplot )
|
||||
Vendored
+25331
File diff suppressed because it is too large.
Load diff
Vendored
+3958
File diff suppressed because it is too large.
Load diff
-20
@@ -1,20 +0,0 @@
|
||||
###
|
||||
### CMakeLists for qcustomplot
|
||||
###
|
||||
|
||||
FIND_PACKAGE( Qt5 REQUIRED COMPONENTS Core Gui Widgets PrintSupport )
|
||||
|
||||
set(qcustomplot_SRCS
|
||||
qcustomplot.cpp
|
||||
qcustomplot.h
|
||||
)
|
||||
|
||||
ADD_LIBRARY( QCustomPlotLib STATIC ${qcustomplot_SRCS} )
|
||||
TARGET_LINK_LIBRARIES( QCustomPlotLib
|
||||
Qt5::Core
|
||||
Qt5::Gui
|
||||
Qt5::Widgets
|
||||
Qt5::PrintSupport
|
||||
)
|
||||
|
||||
TARGET_INCLUDE_DIRECTORIES(QCustomPlotLib PUBLIC . )
|
||||
-577
@@ -1,577 +0,0 @@
|
||||
#### Version 2.0.1 released on 25.06.18 ####
|
||||
|
||||
Bugfixes:
|
||||
- Default filling order of QCPLayoutGrid is now foColumnsFirst instead of foRowsFirst, as intended and consistent with QCP1.
|
||||
Note that this also changes the indexing order of e.g. QCustomPlot::axisRect(int index), compared with 2.0.0. You can change
|
||||
the filling and thus indexing order yourself by calling QCPLayoutGrid::setFillOrder.
|
||||
- fixed bug in QCPColorMap, when using alpha in the gradient color stops. Used to draw falsely black data points when the associated data value is exactly
|
||||
on the first or last color stop.
|
||||
- QCPDataSelection::enforceType(stDataRange) would erroneously add an empty data range to the selection, if the selection was already empty.
|
||||
This in turn would cause isEmpty() to erroneously return false.
|
||||
- fixed hypothetical crash when selectTest is called on a QCPItemCurve which has all of its points at the same position
|
||||
|
||||
Other:
|
||||
- Various documentation improvements and clarifications
|
||||
- Prevent conflict with windows.h min/max macros if user forgets to define NOMINMAX
|
||||
- compiling QCP shared libraries with static Qt is now easier
|
||||
- added defines QCUSTOMPLOT_VERSION and QCUSTOMPLOT_VERSION_STR (the same way Qt does) to provide the used QCP version number
|
||||
- added missing Q_DECL_OVERRIDE declarations, thus preventing warnings some compiler settings
|
||||
- QCPAxisTicker and subclasses are no longer copyable by value, as intended
|
||||
- QCPBarsGroup constructor is now explicit, as intended
|
||||
- Qt 5.11 compatibility
|
||||
|
||||
#### Version 2.0.0 released on 04.09.17 ####
|
||||
|
||||
Added major features:
|
||||
- Axis tick and tick label generation was completely refactored and is now handled in the QCPAxisTicker class (also see QCPAxis::setTicker). Available ticker subclasses for special uses cases:
|
||||
QCPAxisTicker, QCPAxisTickerFixed, QCPAxisTickerLog, QCPAxisTickerPi, QCPAxisTickerTime, QCPAxisTickerDateTime, QCPAxisTickerText
|
||||
- Data container is now based on QCPDataContainer template for unified data interface and significantly improved memory footprint and better performance for common use-cases, especially data adding/removing.
|
||||
- New data selection mechanism allows selection of single data points and data ranges for plottables. See special documentation page "data selection mechanism".
|
||||
- Rubber band/selection rect for data point selection and axis zooming is now available, see documentation of QCustomPlot::setSelectionRectMode and QCPSelectionRect. For this purpose, the new default
|
||||
layer "overlay" was introduced, which is now the top layer, and holds the QCustomPlot's QCPSelectionRect instance.
|
||||
- Data sharing between plottables of the same type (see setData methods taking a QSharedPointer)
|
||||
- OpenGL hardware acceleration is now available across all Qt versions (including Qt4) in a unified, simple interface, with QCustomPlot::setOpenGl (experimental)
|
||||
- QCPStatisticalBox can now display a series of statistical boxes instead of only a single one
|
||||
- New QCPErrorBars plottable allows attaching error bars to any one-dimensional plottable (QCPGraph has thus lost its own error-bar capability)
|
||||
- QCPColorMap now supports transparency via alpha in its color gradient stops, and via a dedicated cell-wise alpha map (see QCPColorMapData::setAlpha)
|
||||
- Layers may now be individually replotted (QCPLayer::replot), if the mode (QCPLayer::setMode) is set to lmBuffered. Mutually adjacent lmLogical layers share a single paint buffer to save resources.
|
||||
By default, the new topmost "overlay" layer which contains the selection rect is an lmBuffered layer. Updating the selection rect is thus very fast, independent of the plot contents.
|
||||
- QCPLayerable (and thus practically all objects in QCP) now have virtual methods to receive mouse press/move/release/doubleclick/wheel events. Before, only QCPLayoutElement provided them.
|
||||
this makes it much easier to subclass e.g. items and plottables to provide custom mouse interactions that were cumbersome and awkward with the simpler signal-based interface
|
||||
|
||||
Added minor features:
|
||||
- High-DPI support for Qt versions 5.0 and up, using device pixel ratio detected by Qt (can be changed manually via QCustomPlot::setBufferDevicePixelRatio).
|
||||
- QCPGraph and QCPCurve can now be configured to only display every n'th scatter symbol, see ::setScatterSkip() method
|
||||
- QCPFinancial allows to define bar width in absolute pixels and axis rect ratio, instead of only in plot key coordinates (see QCPFinancial::setWidthType)
|
||||
- Range dragging/zooming can now be configured to affect more than one axis per orientation (see new overloads of QCPAxisRect::setRangeDragAxes/setRangeZoomAxes)
|
||||
- Added QCPTextElement (replaces QCPPlotTitle) for general texts in layouts. Provides clicked and doubleClicked signals, as replacement for the removed QCustomPlot::titleClicked/titleDoubleClicked
|
||||
- Export functions (QCustomPlot::savePng etc.) now support specifying the resolution that will be written to the image file header. This improves operability with other tools which respect metadata.
|
||||
- Replots can now be queued to the next event loop iteration with replot(QCP::rpQueuedReplot). This way you can successively ask for a replot at multiple code locations without causing redundant replots
|
||||
- QCPAxisRect::zoom(...) allows to zoom to a specific rectangular region given in pixel coordinates, either affecting all axes or a specified subset of axes.
|
||||
- QCPRange::bounded returns a bounded range, trying to preserve its size. Works with rangeChanged signal to limit the allowed range (see rangeChanged doc)
|
||||
- Plottable rescaleValueAxis method (and getValueRange) now take parameter inKeyRange, which allows rescaling of the value axis only with respect to data in the currently visible key range
|
||||
- plottableClick and plottableDoubleClick signals now carry the clicked data point index as second parameter
|
||||
- Added QCPAxis::scaleRange overload without "center" argument, which scales around the current axis range center
|
||||
- Added QCPRange::expand/expanded overloads which take only one double parameter
|
||||
- Plottables addToLegend/removeFromLegend methods now have overloads that take any QCPLegend, to make working with non-default legends easier (legends that are not QCustomPlot::legend)
|
||||
- Added QCPStatisticalBox::setWhiskerAntialiased to allow controlling antialiasing state of whiskers independently of quartile box/median line
|
||||
- The virtual method QCPLayoutElement::layoutChanged() now allows subclasses to react on a move of the layout element between logical positions in the parent layout, or between layouts
|
||||
- QCPMarginGroup::commonMargin is now virtual, to facilitate subclassing of QCPMarginGroup
|
||||
- QCPGraph::getPreparedData is now virtual, and thus allows subclasses to easily generate own plotted data, e.g. on-the-fly.
|
||||
- Added QCPRange qDebug stream operator
|
||||
- QCPLayoutGrid (and thus QCPLegend) can now wrap rows or columns at specified row/column counts, see setFillOrder, setWrap and the new addElement overload which doesn't have row/column index
|
||||
Added minor features after beta:
|
||||
- QCPGraph fill now renders separate fill segments when there are gaps in the graph data (created by inserting NaN values)
|
||||
- fractional device pixel ratios are now used, if Qt version >= 5.6
|
||||
- Axes may now be dragged/zoomed individually by starting the drag/zoom on top of the axis (previously, this required additional code)
|
||||
- Manual minimum and maximum layout element sizes (setMinimumSize/setMaximumSize) can now affect the inner or the outer rect, see QCPLayoutElement::setSizeConstraintRect
|
||||
|
||||
Bugfixes [Also backported to 1.3.2]:
|
||||
- Fixed possible crash when having a QCPGraph with scatters only and a non-transparent main/fill brush of the graph
|
||||
- Fixed QCPItemPixmap not updating internally cached scaled pixmap if new pixmap set with same scaled dimensions
|
||||
- When using log axis scale and zooming out as far as possible (~1e-280..1e280), axis doesn't end up in (via mouse) unrecoverable range with strange axis ticks anymore
|
||||
- Axis tick label algorithm for beautifully typeset powers now checks whether "e" in tick label is actually part of a number before converting the exponent to superscript
|
||||
- Fixed QCustomPlot::moveLayer performing incorrect move and possible crash in certain situations
|
||||
- Fixed possible crash on QCustomPlot destruction due to wrong QObject-hierarchy. Only occurs if a QCPAxisRect is removed from the normal QCustomPlot destruction hierarchy by taking it out of its layout
|
||||
- Fixed possible freeze when data values become infinity after coord-to-pixel transformation (e.g. maximally zoomed out log axis), and line style is not solid (e.g. dashed) or phFastPolylines is disabled
|
||||
- Fixed a few missing enums in meta type system, by unifying usage of Q_ENUMS, Q_FLAGS and Q_DECLARE_METATYPE
|
||||
Bugfixes [Not in 1.3.2]:
|
||||
- Fixed QCPItemLine/QCPItemStraightLine not being selectable when defining coords are many orders of magnitude (>1e8) larger than currently viewed range
|
||||
- Fixed/worked around crash due to bug in QPainter::drawPixmap with very large negative x/y pixel coordinates, when drawing sparse pixmap scatters
|
||||
- Fixed possible (but unlikely) int overflow in adaptive sampling algorithm, that could cause plot artifacts when using extremely sparse data (with respect to current key axis range).
|
||||
- Fixed QCPBarsGroup bug which caused stPlotCoords spacing to be wrong with vertical key axes
|
||||
- A QCPBars axis rescale in the main window constructor (i.e. without well-defined plot size) now falls back to a datapoint-tight rescaling instead of doing nothing (because bar width can't be determined)
|
||||
- Improved QCPBars stacking when using bars with very large keys and key separation at limit of double precision
|
||||
Bugfixes after beta:
|
||||
- fixed QCPCurve vertex optimization algorithm not handling log axes correctly
|
||||
- upon removing the inner most axis, the offset of the new inner most axis (previously second axis) is now set to the value of the removed axis, instead of leaving a gap
|
||||
- QCPColorMap now has a default gradient (gpCold) again, instead of an empty and thus black gradient
|
||||
- doc: black QCPColorMap/QCPColorGradient documentation images fixed
|
||||
- scatter styles ssDiamond, ssTriangle and ssTriangleInverted now get proper filling with the specified brush
|
||||
- fixed click signals of plottable/axes/etc. not being emitted properly
|
||||
- fixed uninitialized scatterSkip on QCPCurve, leading to irregular default appearance of scatter skips
|
||||
- fixed device pixel ratio not being implemented correctly in cached tick labels
|
||||
- QCPLayoutElement::setMaximum/setMinimum now is with respect to the inner rect as intended (and documented), instead of the outer rect (and this can now be changed via setSizeConstraintRect)
|
||||
- fixed dllimport issue on template classes when compiling as shared library with MSVC
|
||||
|
||||
|
||||
Summary of backward incompatible changes:
|
||||
Plottable related:
|
||||
- Removed QCustomPlot::addPlottable, not needed anymore as plottables now automatically register in their constructor
|
||||
- Removed QCustomPlot::addItem, not needed anymore as items now automatically register in their constructor
|
||||
- QCPAbstractPlottable::addToLegend/removeFromLegend are not virtual anymore. If your plottable requires a custom legend item, add it to the legend manually.
|
||||
- setData/addData method overloads of plottables have changed to facilitate data sharing and new data container (see documentation)
|
||||
- plottableClick and plottableDoubleClick signals now carry the clicked data point index as second parameter, and the QMouseEvent parameter has moved to third.
|
||||
Check all your usages of those signals, because Qt's connect method only reports problems during runtime!
|
||||
- setSelectable now not only limits what can be selected by the user, but limits also any programmatic selection changes via setSelected.
|
||||
- enum QCPAbstractPlottable::SignDomain has changed namespace to QCP::SignDomain
|
||||
Axis related:
|
||||
- Removed QCPAxis::setAutoTicks, setAutoTickCount, setAutoTickLabels, setAutoTickStep, setAutoSubTicks, setTickLabelType, setDateTimeFormat, setDateTimeSpec,
|
||||
setTickStep, setTickVector, setTickVectorLabels, setSubTickCount in favor of new QCPAxisTicker-based interface
|
||||
- Added QCPAxis::setSubTicks to enable/disable subticks (manually controlling the subtick count needs subclassing of QCPAxisTicker, e.g. QCPAxisTickerText and QCPAxisTickerLog provide setSubTickCount)
|
||||
Item related:
|
||||
- Renamed QCPAbstractItem::rectSelectTest to rectDistance, to prevent confusion with new QCPAbstractPlottable1D::selectTestRect
|
||||
- Renamed QCPItemAnchor::pixelPoint to QCPItemAnchor::pixelPosition (also affects subclass QCPItemPosition)
|
||||
General:
|
||||
- Renamed QCustomPlot::RefreshPriority enums (parameter of the replot() method): rpImmediate to rpImmediateRefresh, rpQueued to rpQueuedRefresh, rpHint to rpRefreshHint
|
||||
- Renamed QCustomPlot::PlottingHint enum phForceRepaint to phImmediateRefresh
|
||||
- Removed QCPPlotTitle layout element (See new QCPTextElement for almost drop-in replacement)
|
||||
- Removed signals QCustomPlot::titleClicked/titleDoubleClicked, replaced by QCPTextElement signals clicked/doubleClicked.
|
||||
- QCustomPlot::savePdf has changed parameters from (fileName, bool noCosmeticPen, width, height,...) to (fileName, width, height, QCP::ExportPen exportPen,...)
|
||||
- Virtual methods QCPLayoutElement::mouseMoveEvent/mouseReleaseEvent (which are now introduced already in the superclass QCPLayerable) have gained an additional parameter const QPointF &startPos.
|
||||
If you have reimplemented these methods, make sure to update your function signatures, otherwise your reimplementations will likely be ignored by the compiler without warning
|
||||
- Creating a new QCPColorGradient without supplying a preset parameter in the constructor now creates an empty gradient, instead of loading the gpCold preset
|
||||
|
||||
Other:
|
||||
- Replaced usage of Qt's QVector2D with own QCPVector2D which uses double precision and offers some convenience functions
|
||||
- Extended relative range to which QCPItemLine/QCPItemStraightLine can be zoomed before vanishing from ~1e9 to ~1e16
|
||||
- Removed QCPItemStraightLine::distToStraightLine (replaced by QCPVector2D::distanceToStraightLine)
|
||||
- Removed QCPAbstractPlottable::distSqrToLine and QCPAbstractItem::distSqrToLine (replaced by QCPVector2D::distanceSquaredToLine)
|
||||
- Qt5.5 compatibility (If you use PDF export, test your outputs, as output dimensions might change when switching Qt versions -- QCP does not try to emulate previous Qt version behaviour here)
|
||||
- QCP now includes <QtPrintSupport/QtPrintSupport> instead of just <QtPrintSupport> because some users had problems with the latter. Please report if you now experience issues due to the new include.
|
||||
- QCPGraph can now use a brush (filled polygon under the graph data) without having a graph line (line style lsNone)
|
||||
- QCPFinancial is now two-colored (setTwoColored(true)) by default, and has green/red as default two-colored brushes and pens
|
||||
- Plottable pixelsToCoords/coordsToPixels methods are now public, and offer transformations from pixel to plot coordinates and vice versa, using the plottable's axes
|
||||
- Plottable getKeyRange/getValueRange methods are now public
|
||||
- QCPBarsGroup now always places the QCPBars that was added to the group first towards lower keys, independent of axis orientation or direction (the ordering used to flip with axis orientation)
|
||||
- Default focus policy for QCustomPlot is now Qt::ClickFocus, instead of Qt::NoFocus.
|
||||
- tweaked QCPLegend and QCPAbstractLegendItem margins: The items have by default zero own margins, and QCPLegend row- and column spacing was increased to compensate. Legend was made slightly denser by default.
|
||||
- Used doxygen version is now 1.8.12, and documentation/postprocessing-scripts were adapted accordingly. Expect minor issues and some warnings when using older doxygen.
|
||||
Other after beta:
|
||||
- Integrated OpenGL support (QCustomPlot::setOpenGl) is experimental for now, due the strong dependency on the system/graphics driver of the current implementation
|
||||
- fixed some plot title font sizes in the example projects that were too small due to switch to QCPTextElement
|
||||
- added missing override specifiers on reimplemented virtual methods
|
||||
- changed to more intuitive defaults for QCPSelectionDecorator scatter style (now doesn't define an own scatter pen by default)
|
||||
|
||||
#### Version 1.3.2 released on 22.12.15 ####
|
||||
|
||||
Bugfixes [Backported from 2.0.0 branch]:
|
||||
- Fixed possible crash when having a QCPGraph with scatters only and a non-transparent main/fill brush of the graph
|
||||
- Fixed QCPItemPixmap not updating internally cached scaled pixmap if new pixmap set with same scaled dimensions
|
||||
- When using log axis scale and zooming out as far as possible (~1e-280..1e280), axis doesn't end up in (via mouse) unrecoverable range with strange axis ticks anymore
|
||||
- Axis tick label algorithm for beautifully typeset powers now checks whether "e" in tick label is actually part of a number before converting the exponent to superscript
|
||||
- Fixed QCustomPlot::moveLayer performing incorrect move and possible crash in certain situations
|
||||
- Fixed possible crash on QCustomPlot destruction due to wrong QObject-hierarchy. Only occurs if a QCPAxisRect is removed from the normal QCustomPlot destruction hierarchy by taking it out of its layout
|
||||
- Fixed possible freeze when data values become infinity after coord-to-pixel transformation (e.g. maximally zoomed out log axis), and line style is not solid (e.g. dashed) or phFastPolylines is disabled
|
||||
|
||||
Other [Backported from 2.0.0 branch]:
|
||||
- A few documentation fixes/improvements
|
||||
- Qt5.5 compatibility (If you use PDF export, test your outputs, as output dimensions might change when switching Qt versions -- QCP does not try to emulate previous Qt version behaviour here)
|
||||
- QCP now includes <QtPrintSupport/QtPrintSupport> instead of just <QtPrintSupport> because some users had problems with the latter. Please report if you now experience issues due to the new include.
|
||||
|
||||
#### Version 1.3.1 released on 25.04.15 ####
|
||||
|
||||
Bugfixes:
|
||||
- Fixed bug that prevented automatic axis rescaling when some graphs/curves had only NaN data points
|
||||
- Improved QCPItemBracket selection boundaries, especially bsCurly and bsCalligraphic
|
||||
- Fixed bug of axis rect and colorscale background shifted downward by one logical pixel (visible in scaled png and pdf export)
|
||||
- Replot upon mouse release is now only performed if a selection change has actually happened (improves responsivity on particularly complex plots)
|
||||
- Fixed bug that allowed scatter-only graphs to be selected by clicking the non-existent line between scatters
|
||||
- Fixed crash when trying to select a scatter-only QCPGraph whose only points in the visible key range are at identical key coordinates and vertically off-screen, with adaptive sampling enabled
|
||||
- Fixed pdf export of QCPColorMap with enabled interpolation (didn't appear interpolated in pdf)
|
||||
- Reduced QCPColorMap jitter of internal cell boundaries for small sized maps when viewed with high zoom, by applying oversampling factors dependant on map size
|
||||
- Fixed bug of QCPColorMap::fill() not causing the buffered internal image map to be updated, and thus the change didn't become visible immediately
|
||||
- Axis labels with size set in pixels (setPixelSize) instead of points now correctly calculate the exponent's font size if beautifully typeset powers are enabled
|
||||
- Fixed QCPColorMap appearing at the wrong position for logarithmic axes and color map spanning larger ranges
|
||||
|
||||
Other:
|
||||
- Pdf export used to embed entire QCPColorMaps, potentially leading to large files. Now only the visible portion of the map is embedded in the pdf
|
||||
- Many documentation fixes and extensions, style modernization
|
||||
- Reduced documentation file size (and thus full package size) by automatically reducing image palettes during package build
|
||||
- Fixed MSVC warning message (at warning level 4) due to temporary QLists in some foreach statements
|
||||
|
||||
#### Version 1.3.0 released on 27.12.14 ####
|
||||
|
||||
Added features:
|
||||
- New plottable class QCPFinancial allows display of candlestick/ohlc data
|
||||
- New class QCPBarsGroup allows horizontal grouping of multiple QCPBars plottables
|
||||
- Added QCPBars feature allowing non-zero base values (see property QCPBars::setBaseValue)
|
||||
- Added QCPBars width type, for more flexible bar widths (see property QCPBars::setWidthType)
|
||||
- New QCPCurve optimization algorithm, fixes bug which caused line flicker at deep zoom into curve segment
|
||||
- Item positions can now have different position types and anchors for their x and y coordinates (QCPItemPosition::setTypeX/Y, setParentAnchorX/Y)
|
||||
- QCPGraph and QCPCurve can now display gaps in their lines, when inserting quiet NaNs as values (std::numeric_limits<double>::quiet_NaN())
|
||||
- QCPAxis now supports placing the tick labels inside the axis rect, for particularly space saving plots (QCPAxis::setTickLabelSide)
|
||||
Added features after beta:
|
||||
- Made code compatible with QT_NO_CAST_FROM_ASCII, QT_NO_CAST_TO_ASCII
|
||||
- Added compatibility with QT_NO_KEYWORDS after sending code files through a simple reg-ex script
|
||||
- Added possibility to inject own QCPAxis(-subclasses) via second, optional QCPAxisRect::addAxis parameter
|
||||
- Added parameter to QCPItemPixmap::setScaled to specify transformation mode
|
||||
|
||||
Bugfixes:
|
||||
- Fixed bug in QCPCurve rendering of very zoomed-in curves (via new optimization algorithm)
|
||||
- Fixed conflict with MSVC-specific keyword "interface" in text-document-integration example
|
||||
- Fixed QCPScatterStyle bug ignoring the specified pen in the custom scatter shape constructor
|
||||
- Fixed bug (possible crash) during QCustomPlot teardown, when a QCPLegend that has no parent layout (i.e. was removed from layout manually) gets deleted
|
||||
Bugfixes after beta:
|
||||
- Fixed bug of QCPColorMap/QCPColorGradient colors being off by one color sampling step (only noticeable in special cases)
|
||||
- Fixed bug of QCPGraph adaptive sampling on vertical key axis, causing staggered look
|
||||
- Fixed low (float) precision in QCPCurve optimization algorithm, by not using QVector2D anymore
|
||||
|
||||
Other:
|
||||
- Qt 5.3 and Qt 5.4 compatibility
|
||||
|
||||
#### Version 1.2.1 released on 07.04.14 ####
|
||||
|
||||
Bugfixes:
|
||||
- Fixed regression which garbled date-time tick labels on axes, if setTickLabelType is ltDateTime and setNumberFormat contains the "b" option
|
||||
|
||||
#### Version 1.2.0 released on 14.03.14 ####
|
||||
|
||||
Added features:
|
||||
- Adaptive Sampling for QCPGraph greatly improves performance for high data densities (see QCPGraph::setAdaptiveSampling)
|
||||
- QCPColorMap plottable with QCPColorScale layout element allows plotting of 2D color maps
|
||||
- QCustomPlot::savePdf now has additional optional parameters pdfCreator and pdfTitle to set according PDF metadata fields
|
||||
- QCustomPlot::replot now allows specifying whether the widget update is immediate (repaint) or queued (update)
|
||||
- QCPRange operators +, -, *, / with double operand for range shifting and scaling, and ==, != for range comparison
|
||||
- Layers now have a visibility property (QCPLayer::setVisible)
|
||||
- static functions QCPAxis::opposite and QCPAxis::orientation now offer more convenience when handling axis types
|
||||
- added notification signals for selectability change (selectableChanged) on all objects that have a selected/selectable property
|
||||
- added notification signal for QCPAxis scaleType property
|
||||
- added notification signal QCPLayerable::layerChanged
|
||||
|
||||
Bugfixes:
|
||||
- Fixed assert halt, when QCPAxis auto tick labels not disabled but nevertheless a custom non-number tick label ending in "e" given
|
||||
- Fixed painting glitches when QCustomPlot resized inside a QMdiArea or under certain conditions inside a QLayout
|
||||
- If changing QCPAxis::scaleType and thus causing range sanitizing and a range modification, rangeChanged wouldn't be emitted
|
||||
- Fixed documentation bug that caused indentation to be lost in code examples
|
||||
Bugfixes after beta:
|
||||
- Fixed bug that caused crash if clicked-on legend item is removed in mousePressEvent.
|
||||
- On some systems, font size defaults to -1, which used to cause a debug output in QCPAxisPainterPrivate::TickLabelDataQCP. Now it's checked before setting values based on the default font size.
|
||||
- When using multiple axes on one side, setting one to invisible didn't properly compress the freed space.
|
||||
- Fixed bug that allowed selection of plottables when clicking in the bottom or top margin of a QCPAxisRect (outside the inner rect)
|
||||
|
||||
Other:
|
||||
- In method QCPAbstractPlottable::getKeyRange/getValueRange, renamed parameter "validRange" to "foundRange", to better reflect its meaning (and contrast it from QCPRange::validRange)
|
||||
- QCPAxis low-level axis painting methods exported to QCPAxisPainterPrivate
|
||||
|
||||
#### Version 1.1.1 released on 09.12.13 ####
|
||||
|
||||
Bugfixes:
|
||||
- Fixed bug causing legends blocking input events from reaching underlying axis rect even if legend is invisible
|
||||
- Added missing Q_PROPERTY for QCPAxis::setDateTimeSpec
|
||||
- Fixed behaviour of QCPAxisRect::setupFullAxesBox (now transfers more properties from bottom/left to top/right axes and sets visibility of bottom/left axes to true)
|
||||
- Made sure PDF export doesn't default to grayscale output on some systems
|
||||
|
||||
Other:
|
||||
- Plotting hint QCP::phForceRepaint is now enabled on all systems (and not only on windows) by default
|
||||
- Documentation improvements
|
||||
|
||||
#### Version 1.1.0 released on 04.11.13 ####
|
||||
|
||||
Added features:
|
||||
- Added QCPRange::expand and QCPRange::expanded
|
||||
- Added QCPAxis::rescale to rescale axis to all associated plottables
|
||||
- Added QCPAxis::setDateTimeSpec/dateTimeSpec to allow axis labels either in UTC or local time
|
||||
- QCPAxis now additionally emits a rangeChanged signal overload that provides the old range as second parameter
|
||||
|
||||
Bugfixes:
|
||||
- Fixed QCustomPlot::rescaleAxes not rescaling properly if first plottable has an empty range
|
||||
- QCPGraph::rescaleAxes/rescaleKeyAxis/rescaleValueAxis are no longer virtual (never were in base class, was a mistake)
|
||||
- Fixed bugs in QCPAxis::items and QCPAxisRect::items not properly returning associated items and potentially stalling
|
||||
|
||||
Other:
|
||||
- Internal change from QWeakPointer to QPointer, thus got rid of deprecated Qt functionality
|
||||
- Qt5.1 and Qt5.2 (beta1) compatibility
|
||||
- Release packages now extract to single subdirectory and don't place multiple files in current working directory
|
||||
|
||||
#### Version 1.0.1 released on 05.09.13 ####
|
||||
|
||||
Bugfixes:
|
||||
- using define flag QCUSTOMPLOT_CHECK_DATA caused debug output when data was correct, instead of invalid (fixed QCP::isInvalidData)
|
||||
- documentation images are now properly shown when viewed with Qt Assistant
|
||||
- fixed various documentation mistakes
|
||||
|
||||
Other:
|
||||
- Adapted documentation style sheet to better match Qt5 documentation
|
||||
|
||||
#### Version 1.0.0 released on 01.08.13 ####
|
||||
|
||||
Quick Summary:
|
||||
- Layout system for multiple axis rects in one plot
|
||||
- Multiple axes per side
|
||||
- Qt5 compatibility
|
||||
- More flexible and consistent scatter configuration with QCPScatterStyle
|
||||
- Various interface cleanups/refactoring
|
||||
- Pixmap-cached axis labels for improved replot performance
|
||||
|
||||
Changes that break backward compatibility:
|
||||
- QCustomPlot::axisRect() changed meaning due to the extensive changes to how axes and axis rects are handled
|
||||
it now returns a pointer to a QCPAxisRect and takes an integer index as parameter.
|
||||
- QCPAxis constructor changed to now take QCPAxisRect* as parent
|
||||
- setAutoMargin, setMarginLeft/Right/Top/Bottom removed due to the axis rect changes (see QCPAxisRect::setMargins/setAutoMargins)
|
||||
- setAxisRect removed due to the axis rect changes
|
||||
- setAxisBackground(-Scaled/-ScaledMode) now moved to QCPAxisRect as setBackground(-Scaled/ScaledMode) (access via QCustomPlot::axisRects())
|
||||
- QCPLegend now is a QCPLayoutElement
|
||||
- QCPAbstractPlottable::drawLegendIcon parameter "rect" changed from QRect to QRectF
|
||||
- QCPAbstractLegendItem::draw second parameter removed (position/size now handled via QCPLayoutElement base class)
|
||||
- removed QCPLegend::setMargin/setMarginLeft/Right/Top/Bottom (now inherits the capability from QCPLayoutElement::setMargins)
|
||||
- removed QCPLegend::setMinimumSize (now inherits the capability from QCPLayoutElement::setMinimumSize)
|
||||
- removed enum QCPLegend::PositionStyle, QCPLegend::positionStyle/setPositionStyle/position/setPosition (replaced by capabilities of QCPLayoutInset)
|
||||
- QCPLegend transformed to work with new layout system (almost everything changed)
|
||||
- removed entire title interface: QCustomPlot::setTitle/setTitleFont/setTitleColor/setTitleSelected/setTitleSelectedFont/setTitleSelectedColor and
|
||||
the QCustomPlot::iSelectTitle interaction flag (all functionality is now given by the layout element "QCPPlotTitle" which can be added to the plot layout)
|
||||
- selectTest functions now take two additional parameters: bool onlySelectable and QVariant *details=0
|
||||
- selectTest functions now ignores visibility of objects and (if parameter onlySelectable is true) does not anymore ignore selectability of the object
|
||||
- moved QCustomPlot::Interaction/Interactions to QCP namespace as QCP::Interaction/Interactions
|
||||
- moved QCustomPlot::setupFullAxesBox() to QCPAxisRect::setupFullAxesBox. Now also accepts parameter to decide whether to connect opposite axis ranges
|
||||
- moved range dragging/zooming interface from QCustomPlot to QCPAxisRect (setRangeDrag, setRangeZoom, setRangeDragAxes, setRangeZoomAxes,...)
|
||||
- rangeDrag/Zoom is now set to Qt::Horizontal|Qt::Vertical instead of 0 by default, on the other hand, iRangeDrag/Zoom is unset in interactions by
|
||||
default (this makes enabling dragging/zooming easier by just adding the interaction flags)
|
||||
- QCPScatterStyle takes over everything related to handling scatters in all plottables
|
||||
- removed setScatterPen/Size on QCPGraph and QCPCurve, removed setOutlierPen/Size on QCPStatisticalBox (now handled via QCPScatterStyle)
|
||||
- modified setScatterStyle on QCPGraph and QCPCurve, and setOutlierStyle on QCPStatisticalBox, to take QCPScatterStyle
|
||||
- axis grid and subgrid are now reachable via the QCPGrid *QCPAxis::grid() method. (e.g. instead of xAxis->setGrid(true), write xAxis->grid()->setVisible(true))
|
||||
|
||||
Added features:
|
||||
- Axis tick labels are now pixmap-cached, thus increasing replot performance (in usual setups by about 24%). See plotting hint phCacheLabels which is set by default
|
||||
- Advanced layout system, including the classes QCPLayoutElement, QCPLayout, QCPLayoutGrid, QCPLayoutInset, QCPAxisRect
|
||||
- QCustomPlot::axisRects() returns all the axis rects in the QCustomPlot.
|
||||
- QCustomPlot::plotLayout() returns the top level layout (initially a QCPLayoutGrid with one QCPAxisRect inside)
|
||||
- QCPAxis now may have an offset to the axis rect (setOffset)
|
||||
- Multiple axes per QCPAxisRect side are now supported (see QCPAxisRect::addAxis)
|
||||
- QCustomPlot::toPixmap renders the plot into a pixmap and returns it
|
||||
- When setting tick label rotation to +90 or -90 degrees on a vertical axis, the labels are now centered vertically on the tick height
|
||||
(This allows space saving vertical tick labels by having the text direction parallel to the axis)
|
||||
- Substantially increased replot performance when using very large manual tick vectors (> 10000 ticks) via QCPAxis::setTickVector
|
||||
- QCPAxis and QCPAxisRect now allow easy access to all plottables(), graphs() and items() that are associated with them
|
||||
- Added QCustomPlot::hasItem method for consistency with plottable interface, hasPlottable
|
||||
- Added QCPAxisRect::setMinimumMargins as replacement for hardcoded minimum axis margin (15 px) when auto margin is enabled
|
||||
- Added Flags type QCPAxis::AxisTypes (from QCPAxis::AxisType), used in QCPAxisRect interface
|
||||
- Automatic margin calculation can now be enabled/disabled on a per-side basis, see QCPAxisRect::setAutoMargins
|
||||
- QCPAxisRect margins of multiple axis rects can be coupled via QCPMarginGroup
|
||||
- Added new default layers "background" and "legend" (QCPAxisRect draws its background on the "background" layer, QCPLegend is on the "legend" layer by default)
|
||||
- Custom scatter style via QCP::ssCustom and respective setCustomScatter functions that take a QPainterPath
|
||||
- Filled scatters via QCPScatterStyle::setBrush
|
||||
Added features after beta:
|
||||
- Added QCustomPlot::toPainter method, to allow rendering with existing painter
|
||||
- QCPItemEllipse now provides a center anchor
|
||||
|
||||
Bugfixes:
|
||||
- Fixed compile error on ARM
|
||||
- Wrong legend icons were displayed if using pixmaps for scatters that are smaller than the legend icon rect
|
||||
- Fixed clipping inaccuracy for rotated tick labels (were hidden too early, because the non-rotated bounding box was used)
|
||||
- Fixed bug that caused wrong clipping of axis ticks and subticks when the ticks were given manually by QCPAxis::setTickVector
|
||||
- Fixed Qt5 crash when dragging graph out of view (iterator out of bounds in QCPGraph::getVisibleDataBounds)
|
||||
- Fixed QCPItemText not scaling properly when using scaled raster export
|
||||
Bugfixes after beta:
|
||||
- Fixed bug that clipped the rightmost pixel column of tick labels when caching activated (only visible on windows for superscript exponents)
|
||||
- Restored compatibility to Qt4.6
|
||||
- Restored support for -no-RTTI compilation
|
||||
- Empty manual tick labels are handled more gracefully (no QPainter qDebug messages anymore)
|
||||
- Fixed type ambiguity in QCPLineEnding::draw causing compile error on ARM
|
||||
- Fixed bug of grid layouts not propagating the minimum size from their child elements to the parent layout correctly
|
||||
- Fixed bug of child elements (e.g. axis rects) of inset layouts not properly receiving mouse events
|
||||
|
||||
Other:
|
||||
- Opened up non-amalgamated project structure to public via git repository
|
||||
|
||||
#### Version released on 09.06.12 ####
|
||||
|
||||
Quick Summary:
|
||||
- Items (arrows, text,...)
|
||||
- Layers (easier control over rendering order)
|
||||
- New antialiasing system (Each objects controls own antialiasing with setAntialiased)
|
||||
- Performance Improvements
|
||||
- improved pixel-precise drawing
|
||||
- easier shared library creation/usage
|
||||
|
||||
Changes that (might) break backward compatibility:
|
||||
- enum QCPGraph::ScatterSymbol was moved to QCP namespace (now QCP::ScatterSymbol).
|
||||
This replace should fix your code: "QCPGraph::ss" -> "QCP::ss"
|
||||
- enum QCustomPlot::AntialiasedElement and flag QCustomPlot::AntialiasedElements was moved to QCP namespace
|
||||
This replace should fix your code: "QCustomPlot::ae" -> "QCP::ae"
|
||||
- the meaning of QCustomPlot::setAntialiasedElements has changed slightly: It is now an override to force elements to be antialiased. If you want to force
|
||||
elements to not be drawn antialiased, use the new setNotAntialiasedElements. If an element is mentioned in neither of those functions, it now controls
|
||||
its antialiasing itself via its "setAntialiased" function(s). (e.g. QCPAxis::setAntialiased(bool), QCPAbstractPlottable::setAntialiased(bool),
|
||||
QCPAbstractPlottable::setAntialiasedScatters(bool), etc.)
|
||||
- QCPAxis::setTickVector and QCPAxis::setTickVectorLabels no longer take a pointer but a const reference of the respective QVector as parameter.
|
||||
(handing over a pointer didn't give any noticeable performance benefits but was inconsistent with the rest of the interface)
|
||||
- Equally QCPAxis::tickVector and QCPAxis::tickVectorLabels don't return by pointer but by value now
|
||||
- QCustomPlot::savePngScaled was removed, its purpose is now included as optional parameter "scale" of savePng.
|
||||
- If you have derived from QCPAbstractPlottable: all selectTest functions now consistently take the argument "const QPointF &pos" which is the test point in pixel coordinates.
|
||||
(the argument there was "double key, double value" in plot coordinates, before).
|
||||
- QCPAbstractPlottable, QCPAxis and QCPLegend now inherit from QCPLayerable
|
||||
- If you have derived from QCPAbstractPlottable: the draw method signature has changed from "draw (..) const" to "draw (..)", i.e. the method
|
||||
is not const anymore. This allows the draw function of your plottable to perform buffering/caching operations, if necessary.
|
||||
|
||||
Added features:
|
||||
- Item system: QCPAbstractItem, QCPItemAnchor, QCPItemPosition, QCPLineEnding. Allows placing of lines, arrows, text, pixmaps etc.
|
||||
- New Items: QCPItemStraightLine, QCPItemLine, QCPItemCurve, QCPItemEllipse, QCPItemRect, QCPItemPixmap, QCPItemText, QCPItemBracket, QCPItemTracer
|
||||
- QCustomPlot::addItem/itemCount/item/removeItem/selectedItems
|
||||
- signals QCustomPlot::itemClicked/itemDoubleClicked
|
||||
- the QCustomPlot interactions property now includes iSelectItems (for selection of QCPAbstractItem)
|
||||
- QCPLineEnding. Represents the different styles a line/curve can end (e.g. different arrows, circle, square, bar, etc.), see e.g. QCPItemCurve::setHead
|
||||
- Layer system: QCPLayerable, QCPLayer. Allows more sophisticated control over drawing order and a kind of grouping.
|
||||
- QCPAbstractPlottable, QCPAbstractItem, QCPAxis, QCPGrid, QCPLegend are layerables and derive from QCPLayerable
|
||||
- QCustomPlot::addLayer/moveLayer/removeLayer/setCurrentLayer/layer/currentLayer/layerCount
|
||||
- Initially there are three layers: "grid", "main", and "axes". The "main" layer is initially empty and set as current layer, so new plottables/items are put there.
|
||||
- QCustomPlot::viewport now makes the previously inaccessible viewport rect read-only-accessible (needed that for item-interface)
|
||||
- PNG export now allows transparent background by calling QCustomPlot::setColor(Qt::transparent) before savePng
|
||||
- QCPStatisticalBox outlier symbols may now be all scatter symbols, not only hardcoded circles.
|
||||
- perfect precision of scatter symbol/error bar drawing and clipping in both antialiased and non-antialiased mode, by introducing QCPPainter
|
||||
that works around some QPainter bugs/inconveniences. Further, more complex symbols like ssCrossSquare used to look crooked, now they look good.
|
||||
- new antialiasing control system: Each drawing element now has its own "setAntialiased" function to control whether it is drawn antialiased.
|
||||
- QCustomPlot::setAntialiasedElements and QCustomPlot::setNotAntialiasedElements can be used to override the individual settings.
|
||||
- Subclasses of QCPAbstractPlottable can now use the convenience functions like applyFillAntialiasingHint or applyScattersAntialiasingHint to
|
||||
easily make their drawing code comply with the overall antialiasing system.
|
||||
- QCustomPlot::setNoAntialiasingOnDrag allows greatly improved performance and responsiveness by temporarily disabling all antialiasing while
|
||||
the user is dragging axis ranges
|
||||
- QCPGraph can now show scatter symbols at data points and hide its line (see QCPGraph::setScatterStyle, setScatterSize, setScatterPixmap, setLineStyle)
|
||||
- Grid drawing code was sourced out from QCPAxis to QCPGrid. QCPGrid is mainly an internal class and every QCPAxis owns one. The grid interface still
|
||||
works through QCPAxis and hasn't changed. The separation allows the grid to be drawn on a different layer as the axes, such that e.g. a graph can
|
||||
be above the grid but below the axes.
|
||||
- QCustomPlot::hasPlottable(plottable), returns whether the QCustomPlot contains the plottable
|
||||
- QCustomPlot::setPlottingHint/setPlottingHints, plotting hints control details about the plotting quality/speed
|
||||
- export to jpg and bmp added (QCustomPlot::saveJpg/saveBmp), as well as control over compression quality for png and jpg
|
||||
- multi-select-modifier may now be specified with QCustomPlot::setMultiSelectModifier and is not fixed to Ctrl anymore
|
||||
|
||||
Bugfixes:
|
||||
- fixed QCustomPlot ignores replot after it had size (0,0) even if size becomes valid again
|
||||
- on Windows, a repaint used to be delayed during dragging/zooming of a complex plot, until the drag operation was done.
|
||||
This was fixed, i.e. repaints are forced after a replot() call. See QCP::phForceRepaint and setPlottingHints.
|
||||
- when using the raster paintengine and exporting to scaled PNG, pen widths are now scaled correctly (QPainter bug workaround via QCPPainter)
|
||||
- PDF export now respects QCustomPlot background color (QCustomPlot::setColor), also Qt::transparent
|
||||
- fixed a bug on QCPBars and QCPStatisticalBox where auto-rescaling of axis would fail when all data is very small (< 1e-11)
|
||||
- fixed mouse event propagation bug that prevented range dragging from working on KDE (GNU/Linux)
|
||||
- fixed a compiler warning on 64-bit systems due to pointer cast to int instead of quintptr in a qDebug output
|
||||
|
||||
Other:
|
||||
- Added support for easier shared library creation (including examples for compiling and using QCustomPlot as shared library)
|
||||
- QCustomPlot now has the Qt::WA_OpaquePaintEvent widget attribute (gives slightly improved performance).
|
||||
- QCP::aeGraphs (enum QCP::AntialiasedElement, previously QCustomPlot::aeGraphs) has been marked deprecated since version 02.02.12 and
|
||||
was now removed. Use QCP::aePlottables instead.
|
||||
- optional performance-quality-tradeoff for solid graph lines (see QCustomPlot::setPlottingHints).
|
||||
- marked data classes and QCPRange as Q_MOVABLE_TYPE
|
||||
- replaced usage of own macro FUNCNAME with Qt macro Q_FUNC_INFO
|
||||
- QCustomPlot now returns a minimum size hint of 50*50
|
||||
|
||||
#### Version released on 31.03.12 ####
|
||||
|
||||
Changes that (might) break backward compatibility:
|
||||
- QCPAbstractLegendItem now inherits from QObject
|
||||
- mousePress, mouseMove and mouseRelease signals are now emitted before and not after any QCustomPlot processing (range dragging, selecting, etc.)
|
||||
|
||||
Added features:
|
||||
- Interaction system: now allows selecting of objects like plottables, axes, legend and plot title, see QCustomPlot::setInteractions documentation
|
||||
- Interaction system for plottables:
|
||||
- setSelectable, setSelected, setSelectedPen, setSelectedBrush, selectTest on QCPAbstractPlottable and all derived plottables
|
||||
- setSelectionTolerance on QCustomPlot
|
||||
- selectedPlottables and selectedGraphs on QCustomPlot (returns the list of currently selected plottables/graphs)
|
||||
- Interaction system for axes:
|
||||
- setSelectable, setSelected, setSelectedBasePen, setSelectedTickPen, setSelectedSubTickPen, setSelectedLabelFont, setSelectedTickLabelFont,
|
||||
setSelectedLabelColor, setSelectedTickLabelColor, selectTest on QCPAxis
|
||||
- selectedAxes on QCustomPlot (returns a list of the axes that currently have selected parts)
|
||||
- Interaction system for legend:
|
||||
- setSelectable, setSelected, setSelectedBorderPen, setSelectedIconBorderPen, setSelectedBrush, setSelectedFont, setSelectedTextColor, selectedItems on QCPLegend
|
||||
- setSelectedFont, setSelectedTextColor, setSelectable, setSelected on QCPAbstractLegendItem
|
||||
- selectedLegends on QCustomPlot
|
||||
- Interaction system for title:
|
||||
- setSelectedTitleFont, setSelectedTitleColor, setTitleSelected on QCustomPlot
|
||||
- new signals in accordance with the interaction system:
|
||||
- selectionChangedByUser on QCustomPlot
|
||||
- selectionChanged on QCPAbstractPlottable
|
||||
- selectionChanged on QCPAxis
|
||||
- selectionChanged on QCPLegend and QCPAbstractLegendItem
|
||||
- plottableClick, legendClick, axisClick, titleClick, plottableDoubleClick, legendDoubleClick, axisDoubleClick, titleDoubleClick on QCustomPlot
|
||||
- QCustomPlot::deselectAll (deselects everything, i.e. axes and plottables)
|
||||
- QCPAbstractPlottable::pixelsToCoords (inverse function to the already existing coordsToPixels function)
|
||||
- QCPRange::contains(double value)
|
||||
- QCPAxis::setLabelColor and setTickLabelColor
|
||||
- QCustomPlot::setTitleColor
|
||||
- QCustomPlot now emits beforeReplot and afterReplot signals. Note that it is safe to make two customPlots mutually call eachothers replot functions
|
||||
in one of these slots, it will not cause an infinite loop. (usefull for synchronizing axes ranges between two customPlots, because setRange alone doesn't replot)
|
||||
- If the Qt version is 4.7 or greater, the tick label strings in date-time-mode now support sub-second accuracy (e.g. with format like "hh:mm:ss.zzz").
|
||||
|
||||
Bugfixes:
|
||||
- tick labels/margins should no longer oscillate by one pixel when dragging range or replotting repeatedly while changing e.g. data. This
|
||||
was caused by a bug in Qt's QFontMetrics::boundingRect function when the font has an integer point size (probably some rounding problem).
|
||||
The fix hence consists of creating a temporary font (only for bounding-box calculation) which is 0.05pt larger and thus avoiding the
|
||||
jittering rounding outcome.
|
||||
- tick label, axis label and plot title colors used to be undefined. This was fixed by providing explicit color properties.
|
||||
|
||||
Other:
|
||||
- fixed some glitches in the documentation
|
||||
- QCustomPlot::replot and QCustomPlot::rescaleAxes are now slots
|
||||
|
||||
#### Version released on 02.02.12 ####
|
||||
|
||||
Changes that break backward compatibility:
|
||||
- renamed all secondary classes from QCustomPlot[...] to QCP[...]:
|
||||
QCustomPlotAxis -> QCPAxis
|
||||
QCustomPlotGraph -> QCPGraph
|
||||
QCustomPlotRange -> QCPRange
|
||||
QCustomPlotData -> QCPData
|
||||
QCustomPlotDataMap -> QCPDataMap
|
||||
QCustomPlotLegend -> QCPLegend
|
||||
QCustomPlotDataMapIterator -> QCPDataMapIterator
|
||||
QCustomPlotDataMutableMapIterator -> QCPDataMutableMapIterator
|
||||
A simple search and replace on all code files should make your code run again, e.g. consider the regex "QCustomPlot(?=[AGRDL])" -> "QCP".
|
||||
Make sure not to just replace "QCustomPlot" with "QCP" because the main class QCustomPlot hasn't changed to QCP.
|
||||
This change was necessary because class names became unhandy, pardon my bad naming decision in the beginning.
|
||||
- QCPAxis::tickLength() and QCPAxis::subTickLength() now each split into two functions for inward and outward ticks (tickLengthIn/tickLengthOut).
|
||||
- QCPLegend now uses QCPAbstractLegendItem to carry item data (before, the legend was passed QCPGraphs directly)
|
||||
- QCustomPlot::addGraph() now doesn't return the index of the created graph anymore, but a pointer to the created QCPGraph.
|
||||
- QCustomPlot::setAutoAddGraphToLegend is replaced by setAutoAddPlottableToLegend
|
||||
|
||||
Added features:
|
||||
- Reversed axis range with QCPAxis::setRangeReversed(bool)
|
||||
- Tick labels are now only drawn if not clipped by the viewport (widget border) on the sides (e.g. left and right on a horizontal axis).
|
||||
- Zerolines. Like grid lines only with a separate pen (QCPAxis::setZeroLinePen), at tick position zero.
|
||||
- Outward ticks. QCPAxis::setTickLength/setSubTickLength now accepts two arguments for inward and outward tick length. This doesn't break
|
||||
backward compatibility because the second argument (outward) has default value zero and thereby a call with one argument hasn't changed its meaning.
|
||||
- QCPGraph now inherits from QCPAbstractPlottable
|
||||
- QCustomPlot::addPlottable/plottable/removePlottable/clearPlottables added to interface with the new QCPAbstractPlottable-based system. The simpler interface
|
||||
which only acts on QCPGraphs (addGraph, graph, removeGraph, etc.) was adapted internally and is kept for backward compatibility and ease of use.
|
||||
- QCPLegend items for plottables (e.g. graphs) can automatically wrap their texts to fit the widths, see QCPLegend::setMinimumSize and QCPPlottableLegendItem::setTextWrap.
|
||||
- QCustomPlot::rescaleAxes. Adapts axis ranges to show all plottables/graphs, by calling QCPAbstractPlottable::rescaleAxes on all plottables in the plot.
|
||||
- QCPCurve. For plotting of parametric curves.
|
||||
- QCPBars. For plotting of bar charts.
|
||||
- QCPStatisticalBox. For statistical box plots.
|
||||
|
||||
Bugfixes:
|
||||
- Fixed QCustomPlot::removeGraph(int) not being able to remove graph index 0
|
||||
- made QCustomPlot::replot() abort painting when painter initialization fails (e.g. because width/height of QCustomPlot is zero)
|
||||
- The distance of the axis label from the axis ignored the tick label padding, this could have caused overlapping axis labels and tick labels
|
||||
- fixed memory leak in QCustomPlot (dtor didn't delete legend)
|
||||
- fixed bug that prevented QCPAxis::setRangeLower/Upper from setting the value to exactly 0.
|
||||
|
||||
Other:
|
||||
- Changed default error bar handle size (QCustomPlotGraph::setErrorBarSize) from 4 to 6.
|
||||
- Removed QCustomPlotDataFetcher. Was deprecated and not used class.
|
||||
- Extended documentation, especially class descriptions.
|
||||
|
||||
#### Version released on 15.01.12 ####
|
||||
|
||||
Changes that (might) break backward compatibility:
|
||||
- QCustomPlotGraph now inherits from QObject
|
||||
|
||||
Added features:
|
||||
- Added axis background pixmap (QCustomPlot::setAxisBackground, setAxisBackgroundScaled, setAxisBackgroundScaledMode)
|
||||
- Added width and height parameter on PDF export function QCustomPlot::savePdf(). This now allows PDF export to
|
||||
have arbitrary dimensions, independent of the current geometry of the QCustomPlot.
|
||||
- Added overload of QCustomPlot::removeGraph that takes QCustomPlotGraph* as parameter, instead the index of the graph
|
||||
- Added all enums to the Qt meta system via Q_ENUMS(). The enums can now be transformed
|
||||
to QString values easily with the Qt meta system, which makes saving state e.g. as XML
|
||||
significantly nicer.
|
||||
- added typedef QMapIterator<double,QCustomPlotData> QCustomPlotDataMapIterator
|
||||
and typedef QMutableMapIterator<double,QCustomPlotData> QCustomPlotDataMutableMapIterator
|
||||
for improved information hiding, when using iterators outside QCustomPlot code
|
||||
|
||||
Bugfixes:
|
||||
- Fixed savePngScaled. Axis/label drawing functions used to reset the painter transform
|
||||
and thereby break savePngScaled. Now they buffer the current transform and restore it afterwards.
|
||||
- Fixed some glitches in the doxygen comments (affects documentation only)
|
||||
|
||||
Other:
|
||||
- Changed the default tickLabelPadding of top axis from 3 to 6 pixels. Looks better.
|
||||
- Changed the default QCustomPlot::setAntialiasedElements setting: Graph fills are now antialiased
|
||||
by default. That's a bit slower, but makes fill borders look better.
|
||||
|
||||
#### Version released on 19.11.11 ####
|
||||
|
||||
Changes that break backward compatibility:
|
||||
- QCustomPlotAxis: tickFont and setTickFont renamed to tickLabelFont and setTickLabelFont (for naming consistency)
|
||||
|
||||
Other:
|
||||
- QCustomPlotAxis: Added rotated tick labels, see setTickLabelRotation
|
||||
|
||||
-30214
File diff suppressed because it is too large.
Load diff
-6673
File diff suppressed because it is too large.
Load diff
+62
-61
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -22,15 +22,15 @@
|
||||
* \brief main file
|
||||
*/
|
||||
|
||||
#include "CommonDefs.h"
|
||||
#include "ConfigureFormatDialog.h"
|
||||
#include "MainWindow.h"
|
||||
#include "PlaYUVerApp.h"
|
||||
#include "PlaYUVerAppDefs.h"
|
||||
#include "VideoSubWindow.h"
|
||||
#include "config.h"
|
||||
#ifdef USE_QTDBUS
|
||||
#include "DBusAppAdaptor.h"
|
||||
#endif
|
||||
#include <QApplication>
|
||||
#ifdef USE_QTDBUS
|
||||
#include "PlaYUVerAppAdaptor.h"
|
||||
#endif
|
||||
#ifdef USE_FERVOR
|
||||
#include "fvupdater.h"
|
||||
#endif
|
||||
@@ -41,28 +41,29 @@
|
||||
|
||||
int main( int argc, char* argv[] )
|
||||
{
|
||||
qRegisterMetaType<CalypFileInfoVector>();
|
||||
qRegisterMetaTypeStreamOperators<CalypFileInfoVector>();
|
||||
qRegisterMetaType<CalypStandardResolutionVector>();
|
||||
qRegisterMetaTypeStreamOperators<CalypStandardResolutionVector>();
|
||||
qRegisterMetaType<PlaYUVerStreamInfoVector>();
|
||||
qRegisterMetaTypeStreamOperators<PlaYUVerStreamInfoVector>();
|
||||
qRegisterMetaType<PlaYUVerStdResolutionVector>();
|
||||
qRegisterMetaTypeStreamOperators<PlaYUVerStdResolutionVector>();
|
||||
|
||||
QApplication application( argc, argv );
|
||||
QApplication::setApplicationName( QStringLiteral( "Calyp" ) );
|
||||
QApplication::setApplicationVersion( QStringLiteral( CALYP_VERSION_STRING ) );
|
||||
QApplication::setOrganizationName( QStringLiteral( "PixLRA" ) );
|
||||
QApplication::setApplicationName( "PlaYUVer" );
|
||||
QApplication::setApplicationVersion( PLAYUVER_VERSION_STRING );
|
||||
QApplication::setOrganizationName( "PixLRA" );
|
||||
|
||||
#ifdef USE_QTDBUS
|
||||
/**
|
||||
* use dbus, if available
|
||||
* allows for resuse of running Calyp instances
|
||||
* allows for resuse of running Kate instances
|
||||
*/
|
||||
if( QDBusConnectionInterface* const sessionBusinterface = QDBusConnection::sessionBus().interface() )
|
||||
if( QDBusConnectionInterface* const sessionBusInterface =
|
||||
QDBusConnection::sessionBus().interface() )
|
||||
{
|
||||
bool force_new = false;
|
||||
Bool force_new = false;
|
||||
QStringList filenameList;
|
||||
for( int i = 1; i < argc; i++ )
|
||||
for( Int i = 1; i < argc; i++ )
|
||||
{
|
||||
filenameList.append( QFileInfo( QLatin1String( argv[i] ) ).absoluteFilePath() );
|
||||
filenameList.append( QFileInfo( QString( argv[i] ) ).absoluteFilePath() );
|
||||
}
|
||||
if( filenameList.isEmpty() )
|
||||
{
|
||||
@@ -73,66 +74,65 @@ int main( int argc, char* argv[] )
|
||||
bool foundRunningService = false;
|
||||
if( !force_new )
|
||||
{
|
||||
QDBusReply<bool> there = sessionBusinterface->isServiceRegistered( QStringLiteral( CALYP_DBUS_SESSION_NAME ) );
|
||||
QDBusReply<bool> there =
|
||||
sessionBusInterface->isServiceRegistered( PLAYUVER_DBUS_SESSION_NAME );
|
||||
foundRunningService = there.isValid() && there.value();
|
||||
}
|
||||
|
||||
if( foundRunningService )
|
||||
if( foundRunningService )
|
||||
{
|
||||
// open given session
|
||||
QDBusMessage m = QDBusMessage::createMethodCall(
|
||||
PLAYUVER_DBUS_SESSION_NAME, QStringLiteral( PLAYUVER_DBUS_PATH ),
|
||||
QStringLiteral( PLAYUVER_DBUS_SESSION_NAME ), QStringLiteral( "activate" ) );
|
||||
|
||||
QDBusConnection::sessionBus().call( m );
|
||||
|
||||
// only block, if files to open there....
|
||||
bool needToBlock = false;
|
||||
|
||||
QStringList tokens;
|
||||
|
||||
// open given files...
|
||||
foreach( const QString& file, filenameList )
|
||||
{
|
||||
qInfo() << "Found running instance... Re-using";
|
||||
|
||||
// open given session
|
||||
QDBusMessage m = QDBusMessage::createMethodCall(
|
||||
QStringLiteral( CALYP_DBUS_SESSION_NAME ), QStringLiteral( CALYP_DBUS_PATH ),
|
||||
QStringLiteral( CALYP_DBUS_SESSION_NAME ), QStringLiteral( "activate" ) );
|
||||
PLAYUVER_DBUS_SESSION_NAME, QStringLiteral( PLAYUVER_DBUS_PATH ),
|
||||
QStringLiteral( PLAYUVER_DBUS_SESSION_NAME ), QStringLiteral( "loadFile" ) );
|
||||
|
||||
QDBusConnection::sessionBus().call( m );
|
||||
QList<QVariant> dbusargs;
|
||||
dbusargs.append( file );
|
||||
m.setArguments( dbusargs );
|
||||
|
||||
// only block, if files to open there....
|
||||
bool needToBlock = false;
|
||||
|
||||
QStringList tokens;
|
||||
|
||||
// open given files...
|
||||
foreach( const QString& file, filenameList )
|
||||
QDBusMessage res = QDBusConnection::sessionBus().call( m );
|
||||
if( res.type() == QDBusMessage::ReplyMessage )
|
||||
{
|
||||
QDBusMessage m = QDBusMessage::createMethodCall(
|
||||
QStringLiteral( CALYP_DBUS_SESSION_NAME ), QStringLiteral( CALYP_DBUS_PATH ),
|
||||
QStringLiteral( CALYP_DBUS_SESSION_NAME ), QStringLiteral( "loadFile" ) );
|
||||
|
||||
QList<QVariant> dbusargs;
|
||||
dbusargs.append( file );
|
||||
m.setArguments( dbusargs );
|
||||
|
||||
QDBusMessage res = QDBusConnection::sessionBus().call( m );
|
||||
if( res.type() == QDBusMessage::ReplyMessage )
|
||||
if( res.arguments().count() == 1 )
|
||||
{
|
||||
if( res.arguments().count() == 1 )
|
||||
QVariant v = res.arguments()[0];
|
||||
if( v.isValid() )
|
||||
{
|
||||
QVariant v = res.arguments()[0];
|
||||
if( v.isValid() )
|
||||
QString s = v.toString();
|
||||
if( ( !s.isEmpty() ) && ( s != QStringLiteral( "ERROR" ) ) )
|
||||
{
|
||||
QString s = v.toString();
|
||||
if( ( !s.isEmpty() ) && ( s != QStringLiteral( "ERROR" ) ) )
|
||||
{
|
||||
tokens << s;
|
||||
}
|
||||
tokens << s;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// this will wait until exiting is emitted by the used instance, if
|
||||
// wanted...
|
||||
return needToBlock ? application.exec() : 0;
|
||||
}
|
||||
// this will wait until exiting is emitted by the used instance, if
|
||||
// wanted...
|
||||
return needToBlock ? application.exec() : 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* if we arrive here, we need to start a new calyp instance!
|
||||
* if we arrive here, we need to start a new playuver instance!
|
||||
*/
|
||||
QDBusConnection::sessionBus().registerService( QStringLiteral( CALYP_DBUS_SESSION_NAME ) );
|
||||
QDBusConnection::sessionBus().registerService( PLAYUVER_DBUS_SESSION_NAME );
|
||||
#endif
|
||||
MainWindow mainwindow;
|
||||
PlaYUVerApp mainwindow;
|
||||
mainwindow.show();
|
||||
if( mainwindow.parseArgs( argc, argv ) )
|
||||
{
|
||||
@@ -140,8 +140,9 @@ int main( int argc, char* argv[] )
|
||||
}
|
||||
|
||||
#ifdef USE_FERVOR
|
||||
FvUpdater::sharedUpdater()->SetFeedURL( "http://192.168.96.201/share/CalypProject/"
|
||||
"CalypUpdate-" UPDATE_CHANNEL ".xml" );
|
||||
FvUpdater::sharedUpdater()->SetFeedURL(
|
||||
"http://192.168.96.201/share/PlaYUVerProject/"
|
||||
"PlaYUVerUpdate-" UPDATE_CHANNEL ".xml" );
|
||||
FvUpdater::sharedUpdater()->SetDependencies( "ALL" );
|
||||
#endif
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 125 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 91 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 179 KiB |
@@ -1 +0,0 @@
|
||||
IDI_ICON1 ICON DISCARDABLE "calyp.ico"
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.1 MiB |
@@ -1,9 +1,9 @@
|
||||
#!/usr/bin/env xdg-open
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=Calyp
|
||||
Exec=calyp %U
|
||||
Icon=calyp
|
||||
Name=PlaYUVer
|
||||
Exec=playuver %U
|
||||
Icon=playuver
|
||||
Terminal=false
|
||||
MimeType=video/x-raw;image/jpeg;image/png;image/bmp;image/x-portable-bitmap;image/x-portable-graymap;image/x-portable-pixmap
|
||||
Categories=AudioVideo;Video;Player;
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 170 KiB |
Executable
BIN
Binary file not shown.
|
After Width: | Height: | Size: 106 KiB |
@@ -1,7 +1,7 @@
|
||||
<RCC>
|
||||
<qresource>
|
||||
<file alias="logos/calyp-logo.png">calyp-logo.png</file>
|
||||
<file alias="logos/calyp-icon.png">calyp.png</file>
|
||||
<file alias="images/playuver.png">playuver.png</file>
|
||||
<file alias="images/playuver-backgroud-logo.png">playuver-background-logo.png</file>
|
||||
|
||||
<file alias="images/open.png">icons/open.png</file>
|
||||
<file alias="images/save.png">icons/save.png</file>
|
||||
Executable
+1
@@ -0,0 +1 @@
|
||||
IDI_ICON1 ICON DISCARDABLE "playuver.ico"
|
||||
File renamed without changes.
+11
-19
@@ -1,31 +1,18 @@
|
||||
|
||||
MACRO(ADD_EXTRA_MODULES dir)
|
||||
SET( MODULE_LOCATION "${dir}/" )
|
||||
ADD_SUBDIRECTORY( ${dir} ${CMAKE_CURRENT_BINARY_DIR}/extra-modules )
|
||||
INCLUDE_DIRECTORIES( ${dir} )
|
||||
SET( MODULE_LOCATION "${dir}/" PARENT_SCOPE )
|
||||
ENDMACRO()
|
||||
|
||||
MACRO(ADD_MODULE name file )
|
||||
SET(__modulename "Module${name}")
|
||||
set(__modulename "Module${name}")
|
||||
OPTION(MODULE_${name} "Use module ${name}" ON )
|
||||
ADD_FEATURE_INFO(${name} MODULE_${name} "Module ${name}" )
|
||||
IF( MODULE_${name} )
|
||||
list(APPEND Calyp_Mod_SRCS ${MODULE_LOCATION}${file} )
|
||||
if( MODULE_${name} )
|
||||
list(APPEND plaYUver_Mod_SRCS ${file} )
|
||||
LIST(APPEND MODULES_LIST_NAME ${name} )
|
||||
LIST(APPEND MODULES_LIST_FILES ${file} )
|
||||
SET( Calyp_Mod_SRCS "${Calyp_Mod_SRCS}" PARENT_SCOPE )
|
||||
SET( MODULES_LIST_NAME "${MODULES_LIST_NAME}" PARENT_SCOPE )
|
||||
SET( MODULES_LIST_FILES "${MODULES_LIST_FILES}" PARENT_SCOPE )
|
||||
ENDIF()
|
||||
UNSET(__modulename)
|
||||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/ModulesListHeader.h "#include \"${file}.h\"\n")
|
||||
endif()
|
||||
unset(__modulename)
|
||||
ENDMACRO()
|
||||
|
||||
MACRO(ADD_PYTHON_MODULE name file )
|
||||
IF( ${Python3_FOUND} )
|
||||
ADD_MODULE( ${name} ${file} )
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
MACRO(ADD_MODULE_USE_OPENCV name file )
|
||||
IF( USE_OPENCV )
|
||||
@@ -56,9 +43,13 @@ ENDMACRO()
|
||||
#
|
||||
# Create header
|
||||
#
|
||||
|
||||
MACRO(CREATE_MODULE_MACROS )
|
||||
|
||||
file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/ModulesListHeader.h "// This files add the header files of each module\n"
|
||||
|
||||
"#ifndef __MODULESLISTHEADER_H__\n#define __MODULESLISTHEADER_H__\n" )
|
||||
|
||||
foreach(module ${MODULES_LIST_FILES})
|
||||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/ModulesListHeader.h "#include \"${module}.h\"\n")
|
||||
endforeach(module ${MODULES_LIST_FILES})
|
||||
@@ -69,4 +60,5 @@ MACRO(CREATE_MODULE_MACROS )
|
||||
endforeach(module ${MODULES_LIST_NAME})
|
||||
|
||||
file( APPEND ${CMAKE_CURRENT_BINARY_DIR}/ModulesListHeader.h "\n#endif // __MODULESLISTHEADER_H__\n" )
|
||||
|
||||
ENDMACRO()
|
||||
+12
-24
@@ -10,8 +10,8 @@ foreach( OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES} )
|
||||
endforeach( OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES )
|
||||
|
||||
SET(MSVC_DLL_DIR "MSVC_DLL_DIR" CACHE PATH "Where to find MSVC dlls")
|
||||
#INSTALL(FILES ${MSVC_DLL_DIR}/msvcr120.dll DESTINATION bin )
|
||||
#INSTALL(FILES ${MSVC_DLL_DIR}/msvcp120.dll DESTINATION bin )
|
||||
INSTALL(FILES ${MSVC_DLL_DIR}/msvcr120.dll DESTINATION bin )
|
||||
INSTALL(FILES ${MSVC_DLL_DIR}/msvcp120.dll DESTINATION bin )
|
||||
|
||||
SET(QT_DIR "QT-Dir" CACHE PATH "Where to find QT Lib on Windows")
|
||||
SET(QT_ICU_VERSION "" CACHE STRING "Qt ICU version of dll's" )
|
||||
@@ -25,30 +25,19 @@ IF( NOT USE_QT4 )
|
||||
INSTALL(FILES ${QT_DIR}/bin/Qt5Core${QT_DLL_POSTFIX}.dll DESTINATION bin )
|
||||
INSTALL(FILES ${QT_DIR}/bin/Qt5Gui${QT_DLL_POSTFIX}.dll DESTINATION bin )
|
||||
INSTALL(FILES ${QT_DIR}/bin/Qt5Widgets${QT_DLL_POSTFIX}.dll DESTINATION bin )
|
||||
INSTALL(FILES ${QT_DIR}/bin/Qt5PrintSupport${QT_DLL_POSTFIX}.dll DESTINATION bin )
|
||||
INSTALL(FILES ${QT_DIR}/plugins/platforms/qwindows${QT_DLL_POSTFIX}.dll DESTINATION bin/platforms )
|
||||
INSTALL(FILES ${QT_DIR}/plugins/platforms/qminimal${QT_DLL_POSTFIX}.dll DESTINATION bin/platforms )
|
||||
INSTALL(FILES ${QT_DIR}/plugins/platforms/qoffscreen${QT_DLL_POSTFIX}.dll DESTINATION bin/platforms )
|
||||
|
||||
IF( USE_FERVOR )
|
||||
INSTALL(FILES ${QT_DIR}/bin/Qt5Network${QT_DLL_POSTFIX}.dll DESTINATION bin )
|
||||
INSTALL(FILES ${QT_DIR}/bin/Qt5WebKit${QT_DLL_POSTFIX}.dll DESTINATION bin )
|
||||
INSTALL(FILES ${QT_DIR}/bin/Qt5WebKitWidgets${QT_DLL_POSTFIX}.dll DESTINATION bin )
|
||||
INSTALL(FILES ${QT_DIR}/bin/Qt5Quick${QT_DLL_POSTFIX}.dll DESTINATION bin )
|
||||
INSTALL(FILES ${QT_DIR}/bin/Qt5Qml${QT_DLL_POSTFIX}.dll DESTINATION bin )
|
||||
INSTALL(FILES ${QT_DIR}/bin/Qt5Multimedia${QT_DLL_POSTFIX}.dll DESTINATION bin )
|
||||
INSTALL(FILES ${QT_DIR}/bin/Qt5Sql${QT_DLL_POSTFIX}.dll DESTINATION bin )
|
||||
INSTALL(FILES ${QT_DIR}/bin/Qt5Positioning${QT_DLL_POSTFIX}.dll DESTINATION bin )
|
||||
INSTALL(FILES ${QT_DIR}/bin/Qt5Sensors${QT_DLL_POSTFIX}.dll DESTINATION bin )
|
||||
INSTALL(FILES ${QT_DIR}/bin/Qt5MultimediaWidgets${QT_DLL_POSTFIX}.dll DESTINATION bin )
|
||||
INSTALL(FILES ${QT_DIR}/bin/Qt5OpenGL${QT_DLL_POSTFIX}.dll DESTINATION bin )
|
||||
ENDIF()
|
||||
INSTALL(FILES ${QT_DIR}/bin/libGLESv2${QT_DLL_POSTFIX}.dll DESTINATION bin )
|
||||
INSTALL(FILES ${QT_DIR}/bin/libEGL${QT_DLL_POSTFIX}.dll DESTINATION bin )
|
||||
INSTALL(FILES ${QT_DIR}/bin/icudt${QT_ICU_VERSION}.dll DESTINATION bin )
|
||||
INSTALL(FILES ${QT_DIR}/bin/icuin${QT_ICU_VERSION}.dll DESTINATION bin )
|
||||
INSTALL(FILES ${QT_DIR}/bin/icuuc${QT_ICU_VERSION}.dll DESTINATION bin )
|
||||
INSTALL(FILES ${QT_DIR}/plugins/platforms/qminimal.dll DESTINATION bin/platforms )
|
||||
INSTALL(FILES ${QT_DIR}/plugins/platforms/qoffscreen.dll DESTINATION bin/platforms )
|
||||
INSTALL(FILES ${QT_DIR}/plugins/platforms/qwindows.dll DESTINATION bin/platforms )
|
||||
ENDIF()
|
||||
|
||||
IF( USE_OPENCV )
|
||||
SET(OpenCV_DLL_DIR "${OpenCV_DIR}/bin" CACHE PATH "Where to find OpenCV dlls")
|
||||
SET(OpenCV_INSTALL_MODULES ${OPENCV_MODULES} CACHE STRING "List of OpenCV modules")
|
||||
FOREACH(opencv_module IN LISTS OpenCV_INSTALL_MODULES )
|
||||
FOREACH(opencv_module IN LISTS OPENCV_MODULES )
|
||||
INSTALL(FILES ${OpenCV_DLL_DIR}/opencv_${opencv_module}${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH}.dll DESTINATION bin )
|
||||
ENDFOREACH()
|
||||
ENDIF()
|
||||
@@ -58,6 +47,5 @@ IF( USE_FFMPEG )
|
||||
INSTALL(FILES ${FFMPEG_DIR}/bin/avcodec-${AVCODEC_VERSION}.dll DESTINATION bin )
|
||||
INSTALL(FILES ${FFMPEG_DIR}/bin/avformat-${AVFORMAT_VERSION}.dll DESTINATION bin )
|
||||
INSTALL(FILES ${FFMPEG_DIR}/bin/avutil-${AVUTIL_VERSION}.dll DESTINATION bin )
|
||||
INSTALL(FILES ${FFMPEG_DIR}/bin/swscale-${SWSCALE_VERSION}.dll DESTINATION bin )
|
||||
INSTALL(FILES ${FFMPEG_DIR}/bin/swresample-${SWRESAMPLE_VERSION}.dll DESTINATION bin )
|
||||
INSTALL(FILES ${FFMPEG_DIR}/bin/swresample-1.dll DESTINATION bin )
|
||||
ENDIF()
|
||||
+25
-13
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -17,26 +17,37 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
/**
|
||||
* \file config.h.in
|
||||
* \brief definition of the building options
|
||||
*/
|
||||
|
||||
#ifndef __CONFIG_CALYP_H__
|
||||
#define __CONFIG_CALYP_H__
|
||||
|
||||
#ifndef __CONFIG_PLAYUVER_H__
|
||||
#define __CONFIG_PLAYUVER_H__
|
||||
|
||||
/* Version definition */
|
||||
#define CALYP_VERSION_MAJOR @CALYP_VERSION_MAJOR@
|
||||
#define CALYP_VERSION_MINOR @CALYP_VERSION_MINOR@
|
||||
#define CALYP_VERSION_PATCH @CALYP_VERSION_PATCH@
|
||||
#define CALYP_VERSION @CALYP_VERSION@
|
||||
#define CALYP_VERSION_STRING "@CALYP_VERSION_STRING@"
|
||||
#define PLAYUVER_VERSION_MAJOR @PLAYUVER_VERSION_MAJOR@
|
||||
#define PLAYUVER_VERSION_MINOR @PLAYUVER_VERSION_MINOR@
|
||||
#define PLAYUVER_VERSION_PATCH @PLAYUVER_VERSION_PATCH@
|
||||
#define PLAYUVER_VERSION @PLAYUVER_VERSION@
|
||||
#define PLAYUVER_VERSION_STRING "@PLAYUVER_VERSION_STRING@"
|
||||
|
||||
#define UPDATE_CHANNEL "@UPDATE_CHANNEL@"
|
||||
|
||||
/* CPU features */
|
||||
#cmakedefine USE_SSE
|
||||
|
||||
/* QT definition */
|
||||
#cmakedefine USE_QT4
|
||||
|
||||
#undef QT_VERSION_PLAYUVER
|
||||
#ifndef USE_QT4
|
||||
#define QT_VERSION_PLAYUVER 5
|
||||
#else
|
||||
#define QT_VERSION_PLAYUVER 4
|
||||
#endif
|
||||
|
||||
/* QtDBus */
|
||||
#cmakedefine USE_QTDBUS
|
||||
|
||||
@@ -44,7 +55,7 @@
|
||||
#cmakedefine USE_DYNLOAD
|
||||
|
||||
/* Use modules in a different thread */
|
||||
#cmakedefine CALYP_THREADED_MODULES
|
||||
#cmakedefine PLAYUVER_THREADED_MODULES
|
||||
|
||||
/* OpenCV */
|
||||
#cmakedefine USE_OPENCV
|
||||
@@ -55,4 +66,5 @@
|
||||
/* Fervor update lib */
|
||||
#cmakedefine USE_FERVOR
|
||||
|
||||
#endif // __CONFIG_CALYP_H__
|
||||
|
||||
#endif // __CONFIG_PLAYUVER_H__
|
||||
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -30,46 +30,46 @@ REGISTER_CLASS_MAKER( AbsoluteFrameDifferenceExample )
|
||||
AbsoluteFrameDifferenceExample::AbsoluteFrameDifferenceExample()
|
||||
{
|
||||
/* Module Definition */
|
||||
m_iModuleAPI = CLP_MODULE_API_2; // Use API version 2 (recommended).
|
||||
// See this example for details on the functions prototype
|
||||
m_iModuleType = CLP_FRAME_PROCESSING_MODULE; // Apply module to the frames or to the whole sequence.
|
||||
m_pchModuleCategory = "Measurements"; // Category (sub-menu)
|
||||
m_pchModuleName = "AbsoluteDifferenceExample"; // Name
|
||||
m_pchModuleLongName = "Absolute Difference Example"; // Name
|
||||
m_pchModuleTooltip = "Measure the absolute difference " // Description
|
||||
"between two images (Y plane), e. g., abs( Y1 - Y2 )";
|
||||
m_uiNumberOfFrames = 2; // Number of Frames required (ONE_FRAME, TWO_FRAMES, THREE_FRAMES)
|
||||
m_uiModuleRequirements = CLP_MODULE_REQUIRES_NEW_WINDOW; // Module requirements (check CalypModulesIf.h).
|
||||
// Several requirements should be "or" between each others.
|
||||
m_iModuleAPI = MODULE_API_2; // Use API version 2 (recommended).
|
||||
// See this example for details on the functions prototype
|
||||
m_iModuleType = FRAME_PROCESSING_MODULE; // Apply module to the frames or to the whole sequence.
|
||||
m_pchModuleCategory = "Measurements"; // Category (sub-menu)
|
||||
m_pchModuleName = "AbsoluteFrameDifferenceExampleExample"; // Name
|
||||
m_pchModuleTooltip =
|
||||
"Measure the absolute difference " // Description
|
||||
"between two images (Y plane), e. g., abs( Y1 - Y2 )";
|
||||
m_uiNumberOfFrames = MODULE_REQUIRES_TWO_FRAMES; // Number of Frames required (ONE_FRAME, TWO_FRAMES, THREE_FRAMES)
|
||||
m_uiModuleRequirements = MODULE_REQUIRES_NEW_WINDOW; // Module requirements (check PlaYUVerModulesIf.h).
|
||||
// Several requirements should be "or" between each others.
|
||||
m_pcFrameDifference = NULL;
|
||||
}
|
||||
|
||||
bool AbsoluteFrameDifferenceExample::create( std::vector<CalypFrame*> apcFrameList )
|
||||
Bool AbsoluteFrameDifferenceExample::create( std::vector<PlaYUVerFrame*> apcFrameList )
|
||||
{
|
||||
_BASIC_MODULE_API_2_CHECK_
|
||||
|
||||
for( unsigned int i = 1; i < apcFrameList.size(); i++ )
|
||||
if( !apcFrameList[i]->haveSameFmt( apcFrameList[0], CalypFrame::MATCH_COLOR_SPACE |
|
||||
CalypFrame::MATCH_RESOLUTION |
|
||||
CalypFrame::MATCH_BITS ) )
|
||||
for( UInt i = 1; i < apcFrameList.size(); i++ )
|
||||
if( !apcFrameList[i]->haveSameFmt( apcFrameList[0], PlaYUVerFrame::MATCH_COLOR_SPACE |
|
||||
PlaYUVerFrame::MATCH_RESOLUTION |
|
||||
PlaYUVerFrame::MATCH_BITS ) )
|
||||
return false;
|
||||
|
||||
m_pcFrameDifference =
|
||||
new CalypFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), CLP_GRAY );
|
||||
new PlaYUVerFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), PlaYUVerFrame::GRAY );
|
||||
return true;
|
||||
}
|
||||
|
||||
CalypFrame* AbsoluteFrameDifferenceExample::process( std::vector<CalypFrame*> apcFrameList )
|
||||
PlaYUVerFrame* AbsoluteFrameDifferenceExample::process( std::vector<PlaYUVerFrame*> apcFrameList )
|
||||
{
|
||||
CalypFrame* Input1 = apcFrameList[0];
|
||||
CalypFrame* Input2 = apcFrameList[1];
|
||||
ClpPel* pInput1PelYUV = Input1->getPelBufferYUV()[0][0];
|
||||
ClpPel* pInput2PelYUV = Input2->getPelBufferYUV()[0][0];
|
||||
ClpPel* pOutputPelYUV = m_pcFrameDifference->getPelBufferYUV()[0][0];
|
||||
int aux_pel_1, aux_pel_2;
|
||||
PlaYUVerFrame* Input1 = apcFrameList[0];
|
||||
PlaYUVerFrame* Input2 = apcFrameList[1];
|
||||
Pel* pInput1PelYUV = Input1->getPelBufferYUV()[0][0];
|
||||
Pel* pInput2PelYUV = Input2->getPelBufferYUV()[0][0];
|
||||
Pel* pOutputPelYUV = m_pcFrameDifference->getPelBufferYUV()[0][0];
|
||||
Int aux_pel_1, aux_pel_2;
|
||||
|
||||
for( unsigned int y = 0; y < m_pcFrameDifference->getHeight(); y++ )
|
||||
for( unsigned int x = 0; x < m_pcFrameDifference->getWidth(); x++ )
|
||||
for( UInt y = 0; y < m_pcFrameDifference->getHeight(); y++ )
|
||||
for( UInt x = 0; x < m_pcFrameDifference->getWidth(); x++ )
|
||||
{
|
||||
aux_pel_1 = *pInput1PelYUV++;
|
||||
aux_pel_2 = *pInput2PelYUV++;
|
||||
@@ -78,7 +78,7 @@ CalypFrame* AbsoluteFrameDifferenceExample::process( std::vector<CalypFrame*> ap
|
||||
return m_pcFrameDifference;
|
||||
}
|
||||
|
||||
void AbsoluteFrameDifferenceExample::destroy()
|
||||
Void AbsoluteFrameDifferenceExample::destroy()
|
||||
{
|
||||
if( m_pcFrameDifference )
|
||||
delete m_pcFrameDifference;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -25,23 +25,23 @@
|
||||
#ifndef __ABSOLUTEFRAMEDIFFERENCEEXAMPLE_H__
|
||||
#define __ABSOLUTEFRAMEDIFFERENCEEXAMPLE_H__
|
||||
|
||||
#include "CalypModuleIf.h"
|
||||
#include "PlaYUVerModuleIf.h"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
class AbsoluteFrameDifferenceExample : public CalypModuleIf
|
||||
class AbsoluteFrameDifferenceExample : public PlaYUVerModuleIf
|
||||
{
|
||||
REGISTER_CLASS_FACTORY( AbsoluteFrameDifferenceExample )
|
||||
|
||||
private:
|
||||
CalypFrame* m_pcFrameDifference;
|
||||
private:
|
||||
PlaYUVerFrame* m_pcFrameDifference;
|
||||
|
||||
public:
|
||||
public:
|
||||
AbsoluteFrameDifferenceExample();
|
||||
virtual ~AbsoluteFrameDifferenceExample() {}
|
||||
bool create( std::vector<CalypFrame*> apcFrameList );
|
||||
CalypFrame* process( std::vector<CalypFrame*> apcFrameList );
|
||||
void destroy();
|
||||
Bool create( std::vector<PlaYUVerFrame*> apcFrameList );
|
||||
PlaYUVerFrame* process( std::vector<PlaYUVerFrame*> apcFrameList );
|
||||
Void destroy();
|
||||
};
|
||||
|
||||
#endif // __ABSOLUTEFRAMEDIFFERENCEEXAMPLE_H__
|
||||
@@ -7,15 +7,13 @@ CMAKE_MINIMUM_REQUIRED( VERSION 2.8.9 )
|
||||
|
||||
PROJECT( "modules_example" )
|
||||
|
||||
# THIS
|
||||
# FIND_PACKAGE( Calyp )
|
||||
#INCLUDE_DIRECTORIES( ${CALYP_INCLUDE_DIRS} )
|
||||
# OR
|
||||
INCLUDE_DIRECTORIES( ../../lib )
|
||||
# FIND_PACKAGE( PlaYUVer )
|
||||
|
||||
INCLUDE_DIRECTORIES( ${PLAYUVER_INCLUDE_DIRS} )
|
||||
|
||||
ADD_LIBRARY(FrameBinarization SHARED FrameBinarization_APIv1.cpp)
|
||||
TARGET_LINK_LIBRARIES( FrameBinarization ${CALYP_LINKER_LIBS} )
|
||||
TARGET_LINK_LIBRARIES( FrameBinarization ${PLAYUVER_LINKER_LIBS} )
|
||||
|
||||
ADD_LIBRARY(AbsoluteFrameDifferenceExample SHARED AbsoluteFrameDifferenceExample.cpp)
|
||||
TARGET_LINK_LIBRARIES( AbsoluteFrameDifferenceExample ${PROJECT_LIBRARY} ${CALYP_LINKER_LIBS} )
|
||||
TARGET_LINK_LIBRARIES( AbsoluteFrameDifferenceExample ${PLAYUVER_LINKER_LIBS} )
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -29,13 +29,12 @@ REGISTER_CLASS_MAKER( FrameBinarization_APIv1 )
|
||||
FrameBinarization_APIv1::FrameBinarization_APIv1()
|
||||
{
|
||||
/* Module Definition */
|
||||
m_iModuleType = CLP_FRAME_PROCESSING_MODULE;
|
||||
m_iModuleType = FRAME_PROCESSING_MODULE;
|
||||
m_pchModuleCategory = "Utilities";
|
||||
m_pchModuleName = "FrameBinarization_APIv1";
|
||||
m_pchModuleLongName = "Frame Binarization API v1";
|
||||
m_pchModuleTooltip = "Binarize frame";
|
||||
m_uiNumberOfFrames = 1;
|
||||
m_uiModuleRequirements = CLP_MODULE_REQUIRES_OPTIONS;
|
||||
m_uiNumberOfFrames = MODULE_REQUIRES_ONE_FRAME;
|
||||
m_uiModuleRequirements = MODULE_REQUIRES_OPTIONS;
|
||||
|
||||
m_cModuleOptions.addOptions() /**/
|
||||
( "threshold", m_uiThreshold, "Threshold level for binarization (0-255) [128]" );
|
||||
@@ -44,25 +43,25 @@ FrameBinarization_APIv1::FrameBinarization_APIv1()
|
||||
m_uiThreshold = 128;
|
||||
}
|
||||
|
||||
void FrameBinarization_APIv1::create( CalypFrame* frame )
|
||||
Void FrameBinarization_APIv1::create( PlaYUVerFrame* frame )
|
||||
{
|
||||
m_pcBinFrame = NULL;
|
||||
m_pcBinFrame = new CalypFrame( frame->getWidth(), frame->getHeight(), CLP_GRAY, 8 );
|
||||
m_pcBinFrame = new PlaYUVerFrame( frame->getWidth(), frame->getHeight(), PlaYUVerFrame::GRAY, 8 );
|
||||
}
|
||||
|
||||
CalypFrame* FrameBinarization_APIv1::process( CalypFrame* frame )
|
||||
PlaYUVerFrame* FrameBinarization_APIv1::process( PlaYUVerFrame* frame )
|
||||
{
|
||||
const ClpPel* pPelInput = frame->getPelBufferYUV()[0][0];
|
||||
ClpPel* pPelBin = m_pcBinFrame->getPelBufferYUV()[0][0];
|
||||
for( unsigned int y = 0; y < frame->getHeight(); y++ )
|
||||
for( unsigned int x = 0; x < frame->getWidth(); x++ )
|
||||
Pel* pPelInput = frame->getPelBufferYUV()[0][0];
|
||||
Pel* pPelBin = m_pcBinFrame->getPelBufferYUV()[0][0];
|
||||
for( UInt y = 0; y < frame->getHeight(); y++ )
|
||||
for( UInt x = 0; x < frame->getWidth(); x++ )
|
||||
{
|
||||
*pPelBin++ = *pPelInput++ >= m_uiThreshold ? 255 : 0;
|
||||
}
|
||||
return m_pcBinFrame;
|
||||
}
|
||||
|
||||
void FrameBinarization_APIv1::destroy()
|
||||
Void FrameBinarization_APIv1::destroy()
|
||||
{
|
||||
if( m_pcBinFrame )
|
||||
delete m_pcBinFrame;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -25,22 +25,22 @@
|
||||
#ifndef __FRAMEBINARIZATION_APIV1_H__
|
||||
#define __FRAMEBINARIZATION_APIV1_H__
|
||||
|
||||
#include "CalypModuleIf.h"
|
||||
#include "PlaYUVerModuleIf.h"
|
||||
|
||||
class FrameBinarization_APIv1 : public CalypModuleIf
|
||||
class FrameBinarization_APIv1 : public PlaYUVerModuleIf
|
||||
{
|
||||
REGISTER_CLASS_FACTORY( FrameBinarization_APIv1 )
|
||||
|
||||
private:
|
||||
CalypFrame* m_pcBinFrame;
|
||||
unsigned int m_uiThreshold;
|
||||
private:
|
||||
PlaYUVerFrame* m_pcBinFrame;
|
||||
UInt m_uiThreshold;
|
||||
|
||||
public:
|
||||
FrameBinarization_APIv1();
|
||||
virtual ~FrameBinarization_APIv1() {}
|
||||
void create( CalypFrame* );
|
||||
CalypFrame* process( CalypFrame* );
|
||||
void destroy();
|
||||
public:
|
||||
FrameBinarization_APIv1();
|
||||
virtual ~FrameBinarization_APIv1() {}
|
||||
Void create( PlaYUVerFrame* );
|
||||
PlaYUVerFrame* process( PlaYUVerFrame* );
|
||||
Void destroy();
|
||||
};
|
||||
|
||||
#endif // __FRAMEBINARIZATION_APIV1_H__
|
||||
@@ -1,127 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
export LC_ALL=en_GB.utf8
|
||||
export LANG=C
|
||||
CLANG_FORMAT="clang-format"
|
||||
MY_NAME="$(basename "$0")"
|
||||
|
||||
SET_VERBOSE=0
|
||||
ALL_FILES=0
|
||||
|
||||
function parsearguments() {
|
||||
local ARGS=$(getopt -o "h" -l "verbose,all,help" -n "${MY_NAME}" -- "$@")
|
||||
local PRINT_HELP=0
|
||||
|
||||
#Bad arguments
|
||||
if [ $? -ne 0 ] ; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# A little magic
|
||||
eval set -- "$ARGS"
|
||||
|
||||
while true ; do
|
||||
case "$1" in
|
||||
-h|--help)
|
||||
PRINT_HELP=1
|
||||
shift
|
||||
;;
|
||||
--verbose )
|
||||
SET_VERBOSE=1
|
||||
shift
|
||||
;;
|
||||
--all )
|
||||
ALL_FILES=1
|
||||
shift
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ ${PRINT_HELP} -ne 0 ]] ; then
|
||||
echo "Usage: ${MY_NAME} [--all] [--verbose]" >&2
|
||||
echo "Format C++ source code and headers in a git-controlled directory structure." >&2
|
||||
echo >&2
|
||||
echo "Options:" >&2
|
||||
echo " --help" >&2
|
||||
echo " Show this help" >&2
|
||||
echo " --verbose" >&2
|
||||
echo " Show verbose (more) output" >&2
|
||||
echo " --all" >&2
|
||||
echo " Format all .cpp/.h files, not just those marked by git as added or modified">&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
parsearguments "$@"
|
||||
|
||||
git_branch=$(git status | head -1 | awk '{print $3}')
|
||||
|
||||
if [[ ${ALL_FILES} -eq 0 ]] ; then
|
||||
# Format only files seen by git as added or modified,
|
||||
# filter for .cpp or .h files.
|
||||
# Trying to handle filenames with spaces correctly (not tested)
|
||||
git status --untracked-files=no --porcelain | awk '/^\s*[AM]+\s+.*[.](cpp|h)$/ {for(i=2;i<NF;++i){printf $i" "};printf $NF"\n"}'
|
||||
else
|
||||
# Format all .cpp or .h files; using "find" to located those files
|
||||
# find . -type f -name '*.cpp' -o -name '*.h'
|
||||
git ls-tree -r $(git status | head -1 | awk '{print $3}') --name-only | grep "\.cpp\|\.h"
|
||||
fi | \
|
||||
# Sort files alphabetically, omit duplicates
|
||||
sort -u | \
|
||||
while read filename ; do
|
||||
if [[ ! -s "${filename}" ]] ; then
|
||||
echo "${MY_NAME}: File not found: \"${filename}\"" >&2
|
||||
continue
|
||||
fi
|
||||
|
||||
if [[ ! -z $( echo ${filename} | grep "\/external\/" ) ]]; then
|
||||
echo "${MY_NAME}: Skip external source: \"${filename}\"" >&2
|
||||
continue
|
||||
fi
|
||||
|
||||
TEMPFILE=$(mktemp -t 'calyp_formatted_source_XXXXXXXXXXX.cpp')
|
||||
|
||||
echo "Processing \"${filename}\""
|
||||
# astyle -n --align-reference=name --align-pointer=name --indent=spaces=4 --indent-labels --pad-oper --unpad-paren --pad-header --keep-one-line-statements --convert-tabs --indent-preprocessor <"${filename}" >${TEMPFILE}
|
||||
$CLANG_FORMAT -style=file ${filename} > ${TEMPFILE}
|
||||
|
||||
# # Astyle has problem with 'foreach' statements
|
||||
# sed -i -e 's/\bforeach(/foreach (/g' ${TEMPFILE}
|
||||
|
||||
# normalize SIGNAL statements as recommended at
|
||||
# http://marcmutz.wordpress.com/effective-qt/prefer-to-use-normalised-signalslot-signatures/
|
||||
# astyle would insert spaces etc
|
||||
grep -Po '(SIGNAL|SLOT)\([^(]+\([^)]*\)\)' "${TEMPFILE}" | while read original ; do
|
||||
normalized="$(sed -e 's/const //g;s/&//g;s/ //g;s/\//\\\//g' <<<${original})"
|
||||
originalregexpized="$(sed -e 's/\*/\\*/g;s/\//\\\//g' <<<${original})"
|
||||
sed -i -e 's/'"${originalregexpized}"'/'"${normalized}"'/g' ${TEMPFILE}
|
||||
done
|
||||
|
||||
# # correct some astyle mis-formattings
|
||||
# if [[ "${filename}" != "${filename/%.h/}" ]] ; then
|
||||
# sed -i -e 's/^\([ ]*\)\(:[ ][a-zA-Z]\)/\1 \2/g' ${TEMPFILE}
|
||||
# elif [[ "${filename}" != "${filename/%.cpp/}" ]] ; then
|
||||
# sed -i -e 's/^\([ ]*\)\(:[ ][a-zA-Z]\)/\1 \2/g;s/\(foreach([^)]*\) \([&*]\) /\1 \2/g' ${TEMPFILE}
|
||||
# fi
|
||||
|
||||
# In const_cast operations, ensure space before ampersand
|
||||
sed -i -r 's!( : const_cast<[^(;]+[^ ])&>[(]!\1 \&>(!g' ${TEMPFILE}
|
||||
|
||||
# Remove superfluous empty lines at file's end
|
||||
# http://unix.stackexchange.com/a/81687
|
||||
# http://sed.sourceforge.net/sed1line.txt
|
||||
sed -i -e :a -e '/^\n*$/{$d;N;};/\n$/ba' ${TEMPFILE}
|
||||
|
||||
# Check if copyright year is up to date
|
||||
head -n 5 ${TEMPFILE} | grep -Eo --color=NEVER '20[0-9][0-9] by ' | head -n 1 | while read year rest ; do
|
||||
[ "${year}" = $(date '+%Y') ] || echo "File '${filename}' has an outdated copyright year: ${year}"
|
||||
done
|
||||
|
||||
# only change/touch original file if it has been changed
|
||||
diff -q ${TEMPFILE} "${filename}" >/dev/null || { echo "Updating \"${filename}\"" ; cp -p ${TEMPFILE} "${filename}" || echo "Cannot copy \"${TEMPFILE}\" \"${filename}\"" ; }
|
||||
|
||||
# rm -f ${TEMPFILE}
|
||||
done
|
||||
+26
-79
@@ -1,111 +1,58 @@
|
||||
###
|
||||
### CMakeLists for calyp lib component
|
||||
### CMakeLists for playuver lib component
|
||||
###
|
||||
|
||||
INCLUDE(GNUInstallDirs)
|
||||
|
||||
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR} )
|
||||
|
||||
set(Calyp_Lib_SRCS
|
||||
set(PlaYUVer_Lib_SRCS
|
||||
LibMemory.h
|
||||
CalypLib.h
|
||||
CalypDefs.h
|
||||
PlaYUVerLib.h
|
||||
# Frame
|
||||
CalypFrame.h
|
||||
CalypFrame.cpp
|
||||
CalypPixel.cpp
|
||||
PixelFormats.h
|
||||
PixelFormats.cpp
|
||||
PlaYUVerPixel.cpp
|
||||
PlaYUVerFrame.cpp
|
||||
PlaYUVerFramePixelFormats.cpp
|
||||
# Stream
|
||||
CalypStream.h
|
||||
CalypStream.cpp
|
||||
CalypStreamHandlerIf.h
|
||||
StreamHandlerRaw.h
|
||||
PlaYUVerStream.cpp
|
||||
StreamHandlerRaw.cpp
|
||||
StreamHandlerPortableMap.h
|
||||
StreamHandlerPortableMap.cpp
|
||||
# Options Parser
|
||||
CalypOptions.h
|
||||
CalypOptions.cpp
|
||||
PlaYUVerOptions.cpp
|
||||
# Modules
|
||||
CalypModuleIf.h
|
||||
CalypOpenCVModuleIf.h
|
||||
PlaYUVerModuleIf.h
|
||||
)
|
||||
|
||||
LIST(APPEND CMAKE_CFG_LINKER_LIBSS ${PROJECT_LIBRARY} )
|
||||
LIST(APPEND CMAKE_CFG_INCLUDE_DIRS ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR} )
|
||||
|
||||
IF( USE_FFMPEG )
|
||||
LIST( APPEND Calyp_Lib_SRCS StreamHandlerLibav.h )
|
||||
LIST( APPEND Calyp_Lib_SRCS StreamHandlerLibav.cpp )
|
||||
|
||||
LIST(APPEND CMAKE_CFG_LINKER_LIBSS ${FFMPEG_LIBRARIES} )
|
||||
LIST(APPEND CMAKE_CFG_INCLUDE_DIRS ${FFMPEG_INCLUDE_DIRS} )
|
||||
LIST( APPEND PlaYUVer_Lib_SRCS StreamHandlerLibav.cpp )
|
||||
ENDIF()
|
||||
|
||||
IF( USE_OPENCV )
|
||||
LIST( APPEND Calyp_Lib_SRCS StreamHandlerOpenCV.h )
|
||||
LIST( APPEND Calyp_Lib_SRCS StreamHandlerOpenCV.cpp )
|
||||
|
||||
LIST( APPEND Calyp_Lib_SRCS CalypOpenCVModuleIf.cpp )
|
||||
|
||||
LIST(APPEND CMAKE_CFG_LINKER_LIBSS ${OpenCV_LIBRARIES} )
|
||||
LIST(APPEND CMAKE_CFG_INCLUDE_DIRS ${OpenCV_INCLUDE_DIRS} )
|
||||
LIST( APPEND PlaYUVer_Lib_SRCS StreamHandlerOpenCV.cpp )
|
||||
ENDIF()
|
||||
|
||||
IF( USE_PYTHON )
|
||||
LIST( APPEND Calyp_Lib_SRCS CalypPythonModuleIf.h )
|
||||
LIST( APPEND Calyp_Lib_SRCS CalypPythonModuleIf.cpp )
|
||||
LIST(APPEND CMAKE_CFG_LINKER_LIBSS ${PYTHON_LINKER_LIBRARIES} )
|
||||
ENDIF()
|
||||
|
||||
set(Calyp_Lib_HEADERS
|
||||
CalypDefs.h
|
||||
CalypFrame.h
|
||||
CalypStream.h
|
||||
CalypOptions.h
|
||||
CalypModuleIf.h
|
||||
CalypOpenCVModuleIf.h
|
||||
set(PlaYUVer_Lib_HEADERS
|
||||
PlaYUVerDefs.h
|
||||
PlaYUVerPixel.h
|
||||
PlaYUVerFrame.h
|
||||
PlaYUVerStream.h
|
||||
PlaYUVerOptions.h
|
||||
PlaYUVerModuleIf.h
|
||||
)
|
||||
|
||||
CONFIGURE_FILE( CalypConfig.cmake.in CalypConfig.cmake @ONLY)
|
||||
|
||||
INCLUDE_DIRECTORIES( ${FFMPEG_INCLUDE_DIRS} ${OpenCV_INCLUDE_DIRS} )
|
||||
CONFIGURE_FILE( PlaYUVerConfig.cmake.in PlaYUVerConfig.cmake @ONLY)
|
||||
|
||||
IF( USE_STATIC )
|
||||
ADD_LIBRARY( ${PROJECT_LIBRARY} STATIC ${Calyp_Lib_SRCS} )
|
||||
ADD_LIBRARY( PlaYUVerLib STATIC ${PlaYUVer_Lib_SRCS} )
|
||||
ELSE()
|
||||
ADD_LIBRARY( ${PROJECT_LIBRARY} SHARED ${Calyp_Lib_SRCS} )
|
||||
ADD_LIBRARY( PlaYUVerLib SHARED ${PlaYUVer_Lib_SRCS} )
|
||||
ENDIF()
|
||||
|
||||
|
||||
TARGET_LINK_LIBRARIES( ${PROJECT_LIBRARY}
|
||||
${FFMPEG_LIBRARIES}
|
||||
${OpenCV_LIBRARIES}
|
||||
${PYTHON_LINKER_LIBRARIES}
|
||||
)
|
||||
|
||||
TARGET_INCLUDE_DIRECTORIES(${PROJECT_LIBRARY}
|
||||
PUBLIC
|
||||
$<INSTALL_INTERFACE:include>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
|
||||
)
|
||||
|
||||
SET_TARGET_PROPERTIES( ${PROJECT_LIBRARY}
|
||||
PROPERTIES VERSION ${CALYP_VERSION}
|
||||
SOVERSION ${CALYP_VERSION_MAJOR}
|
||||
)
|
||||
INCLUDE_DIRECTORIES( ${FFMPEG_INCLUDE_DIRS} ${OpenCV_INCLUDE_DIRS} )
|
||||
TARGET_LINK_LIBRARIES( PlaYUVerLib ${FFMPEG_LIBRARIES} ${OpenCV_LIBRARIES} )
|
||||
|
||||
IF( NOT USE_STATIC )
|
||||
INSTALL( TARGETS ${PROJECT_LIBRARY}
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
)
|
||||
INSTALL(FILES ${Calyp_Lib_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" )
|
||||
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/CalypConfig.cmake DESTINATION share/calyp )
|
||||
ENDIF()
|
||||
|
||||
IF( BUILD_TESTS )
|
||||
ADD_SUBDIRECTORY( tests )
|
||||
INSTALL(FILES ${PlaYUVer_Lib_HEADERS} DESTINATION include )
|
||||
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/PlaYUVerConfig.cmake DESTINATION share/playuver )
|
||||
INSTALL(TARGETS PlaYUVerLib DESTINATION ${CMAKE_INSTALL_LIBDIR} )
|
||||
ENDIF()
|
||||
@@ -1,36 +0,0 @@
|
||||
# ===================================================================================================================
|
||||
# The Calyp Libs CMake configuration file
|
||||
#
|
||||
# ** File generated automatically, do not modify **
|
||||
#
|
||||
# Usage from an external project:
|
||||
# In your CMakeLists.txt, add these lines:
|
||||
#
|
||||
# find_package(Calyp REQUIRED)
|
||||
# include_directories(${CALYP_INCLUDE_DIRS})
|
||||
# target_link_libraries(MY_TARGET_NAME ${CALYP_LINKER_LIBS})
|
||||
#
|
||||
#
|
||||
# This file will define the following variables:
|
||||
# - CALYP_LINKER_LIBS : The list of all imported targets for OpenCV modules.
|
||||
# - CALYP_CXX_FLAGS
|
||||
# - CALYP_INCLUDE_DIRS : The Calyp include directories.
|
||||
# - CALYP_VERSION : The version of this Calyp build: "@CALYP_VERSION@"
|
||||
# - CALYP_VERSION_MAJOR : Major version part of CALYP_VERSION: "@CALYP_VERSION_MAJOR@"
|
||||
# - CALYP_VERSION_MINOR : Minor version part of CALYP_VERSION: "@CALYP_VERSION_MINOR@"
|
||||
# - CALYP_VERSION_PATCH : Patch version part of CALYP_VERSION: "@CALYP_VERSION_PATCH@"
|
||||
#
|
||||
# ===================================================================================================================
|
||||
|
||||
|
||||
# ======================================================
|
||||
# Variables:
|
||||
# ======================================================
|
||||
SET(CALYP_VERSION @CALYP_VERSION@)
|
||||
SET(CALYP_VERSION_MAJOR @CALYP_VERSION_MAJOR@)
|
||||
SET(CALYP_VERSION_MINOR @CALYP_VERSION_MINOR@)
|
||||
SET(CALYP_VERSION_PATCH @CALYP_VERSION_PATCH@)
|
||||
|
||||
SET( CALYP_CXX_FLAGS "" )
|
||||
SET( CALYP_INCLUDE_DIRS "@CMAKE_CFG_INCLUDE_DIRS@" )
|
||||
SET( CALYP_LINKER_LIBS "@CMAKE_CFG_LINKER_LIBSS@" )
|
||||
-140
@@ -1,140 +0,0 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file CalypDefs.h
|
||||
* \ingroup CalypLibGrp
|
||||
* \brief Define basic types, new types and enumerations
|
||||
*/
|
||||
|
||||
#ifndef __CALYPDEFS_H__
|
||||
#define __CALYPDEFS_H__
|
||||
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <iterator>
|
||||
|
||||
typedef unsigned short ClpPel; ///< 16-bit pixel type
|
||||
typedef unsigned char ClpByte;
|
||||
typedef unsigned long long ClpULong;
|
||||
|
||||
typedef std::string ClpString;
|
||||
|
||||
enum CLP_LOG_LEVEL
|
||||
{
|
||||
CLP_LOG_INFO = 1,
|
||||
CLP_LOG_WARNINGS = 2,
|
||||
CLP_LOG_RESULT = 3,
|
||||
CLP_LOG_ERROR = 4,
|
||||
};
|
||||
|
||||
/**
|
||||
* \enum CalypColorSpace
|
||||
* \brief List of supported color spaces
|
||||
* \ingroup CalypLibGrp
|
||||
*/
|
||||
enum CalypColorSpace
|
||||
{
|
||||
CLP_COLOR_INVALID = -1, //!< Invalid
|
||||
CLP_COLOR_YUV = 0, //!< YUV
|
||||
CLP_COLOR_RGB = 1, //!< RGB
|
||||
CLP_COLOR_GRAY = 2, //!< Grayscale
|
||||
CLP_COLOR_RGBA = 3, //!< RGB + Alpha
|
||||
CLP_COLOR_MAX = 255, //!< Account for future formats
|
||||
};
|
||||
|
||||
/**
|
||||
* \enum CalypPixelFormats
|
||||
* \brief List of supported pixel formats
|
||||
* \ingroup CalypLibGrp
|
||||
*/
|
||||
enum CalypPixelFormats
|
||||
{
|
||||
CLP_INVALID_FMT = -1, //!< Invalid
|
||||
CLP_YUV420P = 0, //!< YUV 420 progressive
|
||||
CLP_YUV422P, //!< YUV 422 progressive
|
||||
CLP_YUV444P, //!< YUV 444 progressive
|
||||
CLP_YUYV422, //!< YUV 422 interleaved
|
||||
CLP_GRAY, //!< Grayscale
|
||||
CLP_RGB24P, //!< RGB 32 bpp progressive
|
||||
CLP_RGB24, //!< RGB 32 bpp
|
||||
CLP_BGR24, //!< BGR 32 bpp
|
||||
CLP_RGBA32, //!< RGBA 32 bpp
|
||||
CLP_BGRA32, //!< BGRA 32 bpp
|
||||
CLP_MAX_FMT = 255, //!< Account for future formats
|
||||
};
|
||||
|
||||
enum CLP_YUV_Components
|
||||
{
|
||||
CLP_LUMA = 0,
|
||||
CLP_CHROMA_U,
|
||||
CLP_CHROMA_V,
|
||||
};
|
||||
|
||||
enum CLP_RGB_Components
|
||||
{
|
||||
CLP_COLOR_R = 0,
|
||||
CLP_COLOR_G,
|
||||
CLP_COLOR_B,
|
||||
CLP_COLOR_A,
|
||||
};
|
||||
|
||||
enum CLP_Endianness
|
||||
{
|
||||
CLP_BIG_ENDIAN = 0,
|
||||
CLP_LITTLE_ENDIAN = 1,
|
||||
};
|
||||
|
||||
static const double S_PI = 3.14159265358979323846;
|
||||
static const double S_PI_2 = 1.57079632679489661923;
|
||||
|
||||
inline ClpString clpLowercase( const ClpString& in )
|
||||
{
|
||||
ClpString out;
|
||||
transform( in.begin(), in.end(), std::back_inserter( out ), tolower );
|
||||
return out;
|
||||
}
|
||||
|
||||
inline ClpString clpUppercase( const ClpString& in )
|
||||
{
|
||||
ClpString out;
|
||||
transform( in.begin(), in.end(), std::back_inserter( out ), toupper );
|
||||
return out;
|
||||
}
|
||||
|
||||
struct CalypFailure : public std::exception
|
||||
{
|
||||
ClpString m_class_name;
|
||||
ClpString m_error_msg;
|
||||
CalypFailure( ClpString error_msg ) throw()
|
||||
: m_error_msg( error_msg ) {}
|
||||
CalypFailure( ClpString class_name, ClpString error_msg ) throw()
|
||||
: m_class_name( class_name ), m_error_msg( error_msg )
|
||||
{
|
||||
}
|
||||
~CalypFailure() throw() {}
|
||||
const char* what() const throw()
|
||||
{
|
||||
ClpString* msg = new ClpString( "[" + m_class_name + "] " + m_error_msg );
|
||||
return msg->c_str();
|
||||
}
|
||||
};
|
||||
|
||||
#endif // __CALYPDEFS_H__
|
||||
-1476
File diff suppressed because it is too large.
Load diff
@@ -1,404 +0,0 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file CalypFrame.h
|
||||
* \ingroup CalypFrameGrp
|
||||
* \brief Video Frame handling
|
||||
*/
|
||||
|
||||
#ifndef __CALYPFRAME_H__
|
||||
#define __CALYPFRAME_H__
|
||||
|
||||
#include "CalypDefs.h"
|
||||
|
||||
namespace cv
|
||||
{
|
||||
class Mat;
|
||||
}
|
||||
|
||||
#define CHROMASHIFT( SIZE, SHIFT ) (unsigned int)( -( ( -( (int)( SIZE ) ) ) >> ( SHIFT ) ) )
|
||||
|
||||
/**
|
||||
* \class CalypPixel
|
||||
* \ingroup CalypLibGrp CalypFrameGrp
|
||||
* \brief Pixel handling class
|
||||
*/
|
||||
class CalypPixel
|
||||
{
|
||||
public:
|
||||
static int getMaxNumberOfComponents();
|
||||
|
||||
CalypPixel( const int& CalypColorSpace = CLP_COLOR_INVALID );
|
||||
CalypPixel( const int& CalypColorSpace, const ClpPel& c0 );
|
||||
CalypPixel( const int& CalypColorSpace, const ClpPel& c0, const ClpPel& c1, const ClpPel& c2 );
|
||||
CalypPixel( const int& CalypColorSpace, const ClpPel& c0, const ClpPel& c1, const ClpPel& c2, const ClpPel& c3 );
|
||||
CalypPixel( const CalypPixel& other );
|
||||
~CalypPixel();
|
||||
|
||||
int colorSpace() const;
|
||||
|
||||
ClpPel operator[]( const int& channel ) const;
|
||||
ClpPel& operator[]( const int& channel );
|
||||
|
||||
CalypPixel operator=( const CalypPixel& );
|
||||
CalypPixel operator+( const CalypPixel& );
|
||||
CalypPixel operator+=( const CalypPixel& );
|
||||
CalypPixel operator-( const CalypPixel& );
|
||||
CalypPixel operator-=( const CalypPixel& );
|
||||
CalypPixel operator*( const double& );
|
||||
|
||||
/**
|
||||
* Convert a Pixel to a new color space
|
||||
* @param inputPixel input pixel (CalypPixel)
|
||||
* @param eOutputSpace output color space
|
||||
* @return converted pixel
|
||||
*/
|
||||
CalypPixel convertPixel( CalypColorSpace eOutputSpace );
|
||||
|
||||
private:
|
||||
struct CalypPixelPrivate* d;
|
||||
};
|
||||
|
||||
/**
|
||||
* \class CalypFrame
|
||||
* \ingroup CalypLibGrp CalypFrameGrp
|
||||
* \brief Frame handling class
|
||||
*/
|
||||
class CalypFrame
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Function that handles the supported color space
|
||||
* of CalypFrame
|
||||
* @return vector of strings with pixel formats names
|
||||
*/
|
||||
static std::vector<ClpString> supportedColorSpacesListNames();
|
||||
|
||||
/**
|
||||
* Function that handles the supported pixel formats
|
||||
* of CalypFrame
|
||||
* @return vector of strings with pixel formats names
|
||||
*/
|
||||
static std::vector<ClpString> supportedPixelFormatListNames();
|
||||
static std::vector<ClpString> supportedPixelFormatListNames( int colorSpace );
|
||||
static int numberOfFormats();
|
||||
static int findPixelFormat( const ClpString& name );
|
||||
static int pelformatColorSpace( const int idx );
|
||||
|
||||
/**
|
||||
* Creates a new frame using the following configuration
|
||||
*
|
||||
* @param width width of the frame
|
||||
* @param height height of the frame
|
||||
* @param pel_format pixel format index (always use PixelFormats enum)
|
||||
*
|
||||
* @note this function might misbehave if the pixel format enum is not correct
|
||||
*/
|
||||
CalypFrame( unsigned int width, unsigned int height, int pelFormat, unsigned bitsPixel = 8 );
|
||||
|
||||
/**
|
||||
* Copy contructor
|
||||
*
|
||||
* @param other existing frame to copy from
|
||||
*/
|
||||
CalypFrame( const CalypFrame& other );
|
||||
CalypFrame( const CalypFrame* other );
|
||||
|
||||
/**
|
||||
* Creates and new frame with the configuration of an existing one and copy
|
||||
* its contents. This function only copies a specific region from the existing
|
||||
* frame
|
||||
*
|
||||
* @param other existing frame to copy from
|
||||
* @param posX position X to crop from
|
||||
* @param posY position Y to crop from
|
||||
* @param areaWidth crop width
|
||||
* @param areaHeight crop height
|
||||
*/
|
||||
CalypFrame( const CalypFrame& other, unsigned int x, unsigned int y, unsigned int width, unsigned int height );
|
||||
CalypFrame( const CalypFrame* other, unsigned int x, unsigned int y, unsigned int width, unsigned int height );
|
||||
|
||||
~CalypFrame();
|
||||
|
||||
/** Format match opts
|
||||
*/
|
||||
enum FormatMatching
|
||||
{
|
||||
MATCH_COLOR_SPACE = 1,
|
||||
MATCH_RESOLUTION = 2,
|
||||
MATCH_PEL_FMT = 4,
|
||||
MATCH_BITS = 8,
|
||||
MATCH_COLOR_SPACE_IGNORE_GRAY = 16,
|
||||
MATCH_BYTES_PER_FRAME = 32,
|
||||
MATCH_ALL = 0xFFFF,
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if two CalypFrames have the same fmt
|
||||
* @param other frame to compare with
|
||||
* @param match matching conditions (use enum FormatMatching)
|
||||
* @return true if format matches
|
||||
*/
|
||||
bool haveSameFmt( const CalypFrame& other, unsigned int match = MATCH_ALL ) const;
|
||||
bool haveSameFmt( const CalypFrame* other, unsigned int match = MATCH_ALL ) const;
|
||||
|
||||
/**
|
||||
* Get pixel format information
|
||||
* @return pixel format index
|
||||
*/
|
||||
int getPelFormat() const;
|
||||
|
||||
/**
|
||||
* Get pixel format information
|
||||
* @return pixel format name
|
||||
*/
|
||||
ClpString getPelFmtName();
|
||||
|
||||
/**
|
||||
* Get color space information
|
||||
* @return get color space index
|
||||
*/
|
||||
int getColorSpace() const;
|
||||
|
||||
/**
|
||||
* Get the number of channels
|
||||
* @return number of channels
|
||||
*/
|
||||
unsigned getNumberChannels() const;
|
||||
|
||||
/**
|
||||
* Get width of the frame
|
||||
* @param channel/component
|
||||
* @return number of pixels
|
||||
*/
|
||||
unsigned int getWidth( unsigned channel = 0 ) const;
|
||||
|
||||
/**
|
||||
* Get height of the frame
|
||||
* @param channel/component
|
||||
* @return number of pixels
|
||||
*/
|
||||
unsigned int getHeight( unsigned channel = 0 ) const;
|
||||
|
||||
/**
|
||||
* Get number of pixels of the frame
|
||||
* @param channel/component
|
||||
* @return number of pixels
|
||||
*/
|
||||
ClpULong getPixels( unsigned channel = 0 ) const;
|
||||
|
||||
/**
|
||||
* Get the total number of pixels of the frame
|
||||
* @return number of pixels
|
||||
*/
|
||||
ClpULong getTotalNumberOfPixels() const;
|
||||
|
||||
/**
|
||||
* Get chroma width ratio
|
||||
* @return ratio multiple of 2
|
||||
*/
|
||||
unsigned getChromaWidthRatio() const;
|
||||
|
||||
/**
|
||||
* Get chroma height ratio
|
||||
* @return ratio multiple of 2
|
||||
*/
|
||||
unsigned getChromaHeightRatio() const;
|
||||
|
||||
/**
|
||||
* Get number of pixels in each chroma channel
|
||||
* @return number of pixels
|
||||
*/
|
||||
ClpULong getChromaLength() const;
|
||||
|
||||
/**
|
||||
* Get number of bits per pixel
|
||||
* @return number of bits
|
||||
*/
|
||||
unsigned int getBitsPel() const;
|
||||
|
||||
/**
|
||||
* Get number of bytes per frame of an existing frame
|
||||
* @return number of bytes per frame
|
||||
*/
|
||||
ClpULong getBytesPerFrame() const;
|
||||
|
||||
/**
|
||||
* Get number of bytes per frame of a specific pixel format
|
||||
* @return number of bytes per frame
|
||||
*/
|
||||
static ClpULong getBytesPerFrame( unsigned int uiWidth, unsigned int uiHeight, int iPixelFormat, unsigned int bitsPixel );
|
||||
|
||||
/**
|
||||
* Reset frame pixels to zero
|
||||
*/
|
||||
void reset();
|
||||
|
||||
ClpPel*** getPelBufferYUV() const;
|
||||
ClpPel*** getPelBufferYUV();
|
||||
|
||||
unsigned char* getRGBBuffer() const;
|
||||
|
||||
/**
|
||||
* Get pixel value at coordinates
|
||||
* @param ch frame channel
|
||||
* @param xPos position in X axis
|
||||
* @param yPos position in Y axis
|
||||
* @return pixel value
|
||||
*/
|
||||
ClpPel operator()( unsigned int ch, unsigned int xPos, unsigned int yPos );
|
||||
|
||||
/**
|
||||
* Get pixel value at coordinates
|
||||
* @param xPos position in X axis
|
||||
* @param yPos position in Y axis
|
||||
* @return pixel value
|
||||
*/
|
||||
CalypPixel operator()( unsigned int xPos, unsigned int yPos );
|
||||
|
||||
/**
|
||||
* Get pixel value at coordinates
|
||||
* @param xPos position in X axis
|
||||
* @param yPos position in Y axis
|
||||
* @return pixel value
|
||||
*/
|
||||
CalypPixel getPixel( unsigned int xPos, unsigned int yPos );
|
||||
|
||||
/**
|
||||
* Get pixel value at coordinates
|
||||
* in the desired color space
|
||||
* @param xPos position in X axis
|
||||
* @param yPos position in Y axis
|
||||
* @param eColorSpace desired color space
|
||||
* @return pixel value
|
||||
*/
|
||||
CalypPixel getPixel( unsigned int xPos, unsigned int yPos, CalypColorSpace eColorSpace );
|
||||
|
||||
/**
|
||||
* Set pixel value at coordinates to a given value
|
||||
* @param xPos position in X axis
|
||||
* @param yPos position in Y axis
|
||||
*/
|
||||
void setPixel( unsigned int xPos, unsigned int yPos, CalypPixel pixel );
|
||||
|
||||
/**
|
||||
* Copy a frame into the current buffer
|
||||
* @param other frame to be copied
|
||||
*/
|
||||
void copyFrom( const CalypFrame& other );
|
||||
void copyFrom( const CalypFrame* other );
|
||||
|
||||
/**
|
||||
* Copy a region from a reference corresponding to the size
|
||||
* of the size of the current frame
|
||||
* @param other frame to be copied
|
||||
* @param x x position on the reference frame
|
||||
* @param y y position on the reference frame
|
||||
*/
|
||||
void copyFrom( const CalypFrame& other, unsigned x, unsigned y );
|
||||
void copyFrom( const CalypFrame* other, unsigned x, unsigned y );
|
||||
|
||||
/**
|
||||
* Copy a reference frame to a specific location on the current frame
|
||||
* The whole reference frame is copied
|
||||
* @param other frame to be copied
|
||||
* @param x x position on the current frame
|
||||
* @param y y position on the current frame
|
||||
*/
|
||||
void copyTo( const CalypFrame& other, unsigned x, unsigned y );
|
||||
void copyTo( const CalypFrame* other, unsigned x, unsigned y );
|
||||
|
||||
void frameFromBuffer( ClpByte*, int, unsigned long );
|
||||
void frameFromBuffer( ClpByte*, int );
|
||||
void frameToBuffer( ClpByte*, int );
|
||||
|
||||
void fillRGBBuffer();
|
||||
|
||||
/**
|
||||
* Histogram
|
||||
*/
|
||||
enum HistogramChannels
|
||||
{
|
||||
HIST_CHAN_ONE = 0,
|
||||
HIST_CHAN_TWO,
|
||||
HIST_CHAN_THREE,
|
||||
HIST_CHAN_FOUR,
|
||||
HIST_LUMA = 10,
|
||||
HIST_CHROMA_U,
|
||||
HIST_CHROMA_V,
|
||||
HIST_COLOR_R = 20,
|
||||
HIST_COLOR_G,
|
||||
HIST_COLOR_B,
|
||||
HIST_COLOR_A,
|
||||
HIST_ALL_CHANNELS = 254,
|
||||
HISTOGRAM_MAX = 255,
|
||||
};
|
||||
void calcHistogram();
|
||||
|
||||
unsigned int getMinimumPelValue( unsigned channel );
|
||||
unsigned int getMaximumPelValue( unsigned channel );
|
||||
|
||||
unsigned int getMaximum( unsigned channel );
|
||||
unsigned int getNumPixelsRange( unsigned channel, unsigned int start, unsigned int end );
|
||||
double getMean( unsigned channel, unsigned int start, unsigned int end );
|
||||
int getMedian( unsigned channel, unsigned int start, unsigned int end );
|
||||
double getStdDev( unsigned channel, unsigned int start, unsigned int end );
|
||||
double getHistogramValue( unsigned channel, unsigned int bin );
|
||||
unsigned int getNEBins( unsigned channel );
|
||||
int getNumHistogramSegment();
|
||||
|
||||
/**
|
||||
* interface with OpenCV lib
|
||||
*/
|
||||
bool toMat( cv::Mat& cvMat, bool convertToGray = false, bool scale = true, unsigned channel = 0 );
|
||||
bool fromMat( cv::Mat& cvMat, int iChannel = -1 );
|
||||
|
||||
/**
|
||||
* \ingroup CalypFrameGrp
|
||||
* @defgroup CalypFrameQualityMetricsGrp Calyp Frame Quality Metrics interface
|
||||
* @{
|
||||
* Quality metrics interface
|
||||
*
|
||||
*/
|
||||
|
||||
enum QualityMetrics
|
||||
{
|
||||
NO_METRIC = -1,
|
||||
PSNR_METRIC = 0,
|
||||
MSE_METRIC,
|
||||
SSIM_METRIC,
|
||||
WSPSNR_METRIC,
|
||||
NUMBER_METRICS,
|
||||
};
|
||||
|
||||
static std::vector<ClpString> supportedQualityMetricsList();
|
||||
static std::vector<ClpString> supportedQualityMetricsUnitsList();
|
||||
double getQuality( int Metric, CalypFrame* Org, unsigned int component );
|
||||
double getMSE( CalypFrame* Org, unsigned int component );
|
||||
double getPSNR( CalypFrame* Org, unsigned int component );
|
||||
double getSSIM( CalypFrame* Org, unsigned int component );
|
||||
double getWSPNR( CalypFrame* Org, unsigned int component );
|
||||
/** @} */
|
||||
|
||||
private:
|
||||
struct CalypFramePrivate* d;
|
||||
};
|
||||
|
||||
#endif // __CALYPFRAME_H__
|
||||
@@ -1,175 +0,0 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file CalypModuleIf.h
|
||||
* \ingroup CalypLibGrp
|
||||
* \brief Calyp modules interface
|
||||
*/
|
||||
|
||||
#ifndef __CALYPMODULESIF_H__
|
||||
#define __CALYPMODULESIF_H__
|
||||
|
||||
/**
|
||||
* @defgroup Calyp_Modules Calyp Modules
|
||||
* @{
|
||||
* CalypLib supports the creation of independent
|
||||
* frame processing modules
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include "CalypFrame.h"
|
||||
#include "CalypOptions.h"
|
||||
|
||||
#define REGISTER_CLASS_MAKER( X ) \
|
||||
extern "C" CalypModuleIf* Maker() { return new X; }
|
||||
#define REGISTER_CLASS_FACTORY( X ) \
|
||||
public: \
|
||||
static CalypModuleIf* Create() { return new X(); } \
|
||||
void Delete() { delete this; }
|
||||
#define _BASIC_MODULE_API_2_CHECK_ \
|
||||
if( apcFrameList.size() != m_uiNumberOfFrames ) \
|
||||
return false; \
|
||||
for( unsigned int i = 0; i < apcFrameList.size(); i++ ) \
|
||||
if( !apcFrameList[i] ) \
|
||||
return false;
|
||||
|
||||
#define _BASIC_MODULE_API_3_BREAK_CONDITION_ \
|
||||
if( m_iFrameBufferCount == 0 ) \
|
||||
if( apcFrameList.size() <= 0 ) \
|
||||
return NULL;
|
||||
|
||||
/** Module_API_Version Enum
|
||||
* \ingroup Calyp_Modules
|
||||
* Version of the modules API required
|
||||
* @see m_iModuleAPI
|
||||
*/
|
||||
enum Module_API_Version
|
||||
{
|
||||
CLP_MODULE_API_1,
|
||||
CLP_MODULE_API_2,
|
||||
CLP_MODULE_API_3,
|
||||
};
|
||||
|
||||
/** Module_Type Enum
|
||||
* \ingroup Calyp_Modules
|
||||
* Type of module
|
||||
* @see m_iModuleType
|
||||
*/
|
||||
enum Module_Type
|
||||
{
|
||||
CLP_FRAME_PROCESSING_MODULE,
|
||||
CLP_FRAME_MEASUREMENT_MODULE,
|
||||
CLP_MODULE_TYPE_MAX = 255,
|
||||
};
|
||||
|
||||
/** Module_Features Enum
|
||||
* \ingroup Calyp_Modules
|
||||
* Features/Requirements of a module
|
||||
* @see m_uiModuleRequirements
|
||||
*/
|
||||
enum Module_Features
|
||||
{
|
||||
CLP_MODULE_REQUIRES_NOTHING = 0,
|
||||
CLP_MODULE_REQUIRES_SKIP_WHILE_PLAY = 1,
|
||||
CLP_MODULE_REQUIRES_OPTIONS = 2,
|
||||
CLP_MODULE_REQUIRES_NEW_WINDOW = 4,
|
||||
CLP_MODULE_USES_KEYS = 8,
|
||||
CLP_MODULES_VARIABLE_NUM_FRAMES = 16,
|
||||
CLP_MODULES_HAS_INFO = 32,
|
||||
CLP_MODULE_REQURES_MAX = 1024,
|
||||
};
|
||||
|
||||
enum Module_Key_Supported
|
||||
{
|
||||
MODULE_KEY_LEFT,
|
||||
MODULE_KEY_RIGHT,
|
||||
MODULE_KEY_UP,
|
||||
MODULE_KEY_DOWN,
|
||||
};
|
||||
|
||||
/**
|
||||
* \class CalypModuleIf
|
||||
* \ingroup CalypLib Calyp_Modules
|
||||
* \brief Abstract class for modules
|
||||
*/
|
||||
class CalypModuleIf
|
||||
{
|
||||
public:
|
||||
int m_iModuleAPI;
|
||||
int m_iModuleType;
|
||||
const char* m_pchModuleCategory;
|
||||
const char* m_pchModuleName;
|
||||
const char* m_pchModuleTooltip;
|
||||
const char* m_pchModuleLongName;
|
||||
|
||||
//! Number of frames
|
||||
unsigned int m_uiNumberOfFrames;
|
||||
//! Features/Requirements
|
||||
unsigned int m_uiModuleRequirements;
|
||||
|
||||
unsigned int m_iFrameBufferCount;
|
||||
CalypFrame* m_pcOutputFrame;
|
||||
|
||||
CalypOptions m_cModuleOptions;
|
||||
|
||||
CalypModuleIf()
|
||||
{
|
||||
m_iModuleAPI = CLP_MODULE_API_1;
|
||||
m_uiModuleRequirements = CLP_MODULE_REQUIRES_NOTHING;
|
||||
m_pchModuleLongName = NULL;
|
||||
m_pcOutputFrame = NULL;
|
||||
m_iFrameBufferCount = 0;
|
||||
}
|
||||
virtual ~CalypModuleIf() {}
|
||||
virtual void Delete() = 0;
|
||||
virtual void destroy() = 0;
|
||||
|
||||
const char* getModuleLongName()
|
||||
{
|
||||
return m_pchModuleLongName ? m_pchModuleLongName : m_pchModuleName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Module API version 1
|
||||
*/
|
||||
virtual void create( CalypFrame* ) {}
|
||||
virtual CalypFrame* process( CalypFrame* ) { return NULL; }
|
||||
virtual double measure( CalypFrame* ) { return 0; }
|
||||
/**
|
||||
* Module API version 2
|
||||
*/
|
||||
virtual bool create( std::vector<CalypFrame*> apcFrameList ) { return false; }
|
||||
virtual CalypFrame* process( std::vector<CalypFrame*> ) { return NULL; }
|
||||
virtual double measure( std::vector<CalypFrame*> ) { return 0; }
|
||||
virtual bool keyPressed( enum Module_Key_Supported ) { return false; }
|
||||
virtual ClpString moduleInfo() { return ClpString(); }
|
||||
/**
|
||||
* Module API version 3
|
||||
*/
|
||||
virtual CalypFrame* getProcessedFrame() { return m_pcOutputFrame; }
|
||||
virtual bool needFrame() { return m_iFrameBufferCount == 0? true : false; };
|
||||
virtual bool flush()
|
||||
{
|
||||
m_iFrameBufferCount = 0;
|
||||
return true;
|
||||
};
|
||||
};
|
||||
|
||||
#endif // __CALYPMODULESIF_H__
|
||||
@@ -1,83 +0,0 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file CalypOpenCVModuleIf.cpp
|
||||
* \brief Calyp modules interface for OpenCV
|
||||
*/
|
||||
|
||||
#include "CalypOpenCVModuleIf.h"
|
||||
|
||||
// OpenCV
|
||||
#include <opencv2/opencv.hpp>
|
||||
|
||||
using cv::Mat;
|
||||
|
||||
bool CalypOpenCVModuleIf::create( std::vector<CalypFrame*> apcFrameList )
|
||||
{
|
||||
_BASIC_MODULE_API_2_CHECK_
|
||||
bool bRet = false;
|
||||
std::vector<Mat*> acMatList( apcFrameList.size() );
|
||||
for( unsigned i = 0; i < apcFrameList.size(); i++ )
|
||||
{
|
||||
acMatList[i] = new Mat;
|
||||
apcFrameList[i]->toMat( *acMatList[i], m_bConvertToGray );
|
||||
}
|
||||
Mat* outputMat = create_using_opencv( acMatList );
|
||||
if( outputMat )
|
||||
{
|
||||
unsigned pelFormat = m_bConvertToGray ? CalypFrame::findPixelFormat( "GRAY" ) : apcFrameList[0]->getPelFormat();
|
||||
m_pcOutputFrame = new CalypFrame( outputMat->cols, outputMat->rows, pelFormat, apcFrameList[0]->getBitsPel() );
|
||||
bRet = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for( unsigned i = 0; i < apcFrameList.size(); i++ )
|
||||
{
|
||||
delete acMatList[i];
|
||||
}
|
||||
return bRet;
|
||||
}
|
||||
|
||||
CalypFrame* CalypOpenCVModuleIf::process( std::vector<CalypFrame*> apcFrameList )
|
||||
{
|
||||
m_pcOutputFrame->reset();
|
||||
std::vector<Mat*> acMatList( apcFrameList.size() );
|
||||
for( unsigned i = 0; i < apcFrameList.size(); i++ )
|
||||
{
|
||||
acMatList[i] = new Mat;
|
||||
apcFrameList[i]->toMat( *acMatList[i], m_bConvertToGray );
|
||||
}
|
||||
Mat* cvOutput = process_using_opencv( acMatList );
|
||||
m_pcOutputFrame->fromMat( *cvOutput );
|
||||
for( unsigned i = 0; i < apcFrameList.size(); i++ )
|
||||
{
|
||||
delete acMatList[i];
|
||||
}
|
||||
return m_pcOutputFrame;
|
||||
}
|
||||
|
||||
void CalypOpenCVModuleIf::destroy()
|
||||
{
|
||||
if( m_pcOutputFrame )
|
||||
delete m_pcOutputFrame;
|
||||
m_pcOutputFrame = NULL;
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file CalypOpenCVModuleIf.h
|
||||
* \ingroup CalypLibGroup
|
||||
* \brief Calyp modules interface for OpenCV
|
||||
*/
|
||||
|
||||
#ifndef __CALYPOPENCVMODULEIF_H__
|
||||
#define __CALYPOPENCVMODULEIF_H__
|
||||
|
||||
#include "CalypModuleIf.h"
|
||||
|
||||
namespace cv
|
||||
{
|
||||
class Mat;
|
||||
}
|
||||
|
||||
/**
|
||||
* \class CalypOpenCVModuleIf
|
||||
* \ingroup CalypLib Calyp_Modules
|
||||
* \brief Abstract class for modules using OpenCV library
|
||||
*/
|
||||
class CalypOpenCVModuleIf : public CalypModuleIf
|
||||
{
|
||||
protected:
|
||||
const char* m_pchPythonFunctionName;
|
||||
bool m_bConvertToGray;
|
||||
|
||||
public:
|
||||
CalypOpenCVModuleIf()
|
||||
{
|
||||
m_bConvertToGray = false;
|
||||
};
|
||||
virtual ~CalypOpenCVModuleIf() {}
|
||||
|
||||
// Common API
|
||||
bool create( std::vector<CalypFrame*> apcFrameList );
|
||||
CalypFrame* process( std::vector<CalypFrame*> apcFrameList );
|
||||
void destroy();
|
||||
|
||||
// API using OpenCV
|
||||
virtual cv::Mat* create_using_opencv( std::vector<cv::Mat*> apcFrameList ) { return NULL; };
|
||||
virtual cv::Mat* process_using_opencv( std::vector<cv::Mat*> apcFrameList ) = 0;
|
||||
virtual void destroy_using_opencv(){};
|
||||
};
|
||||
|
||||
#endif // __CALYPOPENCVMODULEIF_H__
|
||||
Loaded 100 of 204 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user