diff --git a/.clang-format b/.clang-format index 78098da..79d0fc1 100644 --- a/.clang-format +++ b/.clang-format @@ -1,11 +1,18 @@ +# Note: if you change any of the settings here, please reformat the entire +# codebase as part of the same commit, that will prevent subsequent commits +# from being flagged as being improperly formatted. + --- -# This configuration requires clang-format 3.8 or higher. +# This configuration requires clang-format 8.0 or higher. BasedOnStyle: Mozilla AlignAfterOpenBracket: DontAlign AlignOperands: false AlwaysBreakAfterReturnType: None AlwaysBreakAfterDefinitionReturnType: None BreakBeforeBraces: Allman +BinPackArguments: true +BinPackParameters: true ColumnLimit: 100 -Standard: Cpp03 +SpaceAfterTemplateKeyword: true +Standard: Cpp11 ... diff --git a/.gitattributes b/.gitattributes index e50dc01..2d91d00 100644 --- a/.gitattributes +++ b/.gitattributes @@ -5,7 +5,7 @@ *.sh.in crlf=input # Custom attribute to mark sources as using our C code style. -[attr]our-c-style whitespace=tab-in-indent,-blank-at-eol format.clang-format +[attr]our-c-style whitespace=tab-in-indent,-blank-at-eol format.clang-format=9 *.c our-c-style *.h our-c-style diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..1ae30e7 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,51 @@ +workflow: + rules: + - if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_REF_NAME == "master" + when: always + - if: $CI_MERGE_REQUEST_ID + when: always + - when: never + +stages: + - build + - test + +.latest: + image: "kitware/paraview-for-ci:latest" + +build_linux: + extends: + - .latest + stage: build + script: + - mkdir -p build + - cd build + - cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON .. + - cmake --build . --parallel 2 + tags: + - docker + - linux-x86_64 + - paraview + artifacts: + expire_in: 1h + when: always + paths: + - build/ + interruptible: true + +test_linux: + extends: + - .latest + stage: test + script: + - cd build + - xvfb-run ctest -j 2 --output-on-failure --no-tests=error || xvfb-run ctest -j 1 --no-tests=error --rerun-failed -VV + tags: + - docker + - linux-x86_64 + - paraview + interruptible: true + dependencies: + - build_linux + needs: + - build_linux diff --git a/CMakeLists.txt b/CMakeLists.txt index 226170c..06ce012 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,394 +1,357 @@ -if (NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) - CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12) -endif () - -PROJECT(QtTesting) - -IF(NOT DEFINED QtTesting_QT_VERSION) - SET(QtTesting_QT_VERSION "4" CACHE STRING "Expected Qt version") - MARK_AS_ADVANCED(QtTesting_QT_VERSION) - SET_PROPERTY(CACHE QtTesting_QT_VERSION PROPERTY STRINGS 4 5) -ENDIF() -IF(NOT (QtTesting_QT_VERSION VERSION_EQUAL "4" OR - QtTesting_QT_VERSION VERSION_EQUAL "5")) - message(FATAL_ERROR "Expected value for QtTesting_QT_VERSION is either '4' or '5'") -ENDIF() +cmake_minimum_required(VERSION 3.12) + +project(QtTesting) + +if(NOT DEFINED QtTesting_QT_VERSION) + set(QtTesting_QT_VERSION "5" CACHE STRING "Expected Qt version") + mark_as_advanced(QtTesting_QT_VERSION) + set_property(CACHE QtTesting_QT_VERSION PROPERTY STRINGS 5 6) +endif() +if( + NOT ( + QtTesting_QT_VERSION VERSION_EQUAL "5" + OR QtTesting_QT_VERSION VERSION_EQUAL "6" + ) +) + message( + FATAL_ERROR + "Expected value for QtTesting_QT_VERSION is either '5' or '6'" + ) +endif() set(qt_imported_targets) -IF(QtTesting_QT_VERSION VERSION_GREATER "4") - FIND_PACKAGE(Qt5 REQUIRED COMPONENTS Core Widgets) - SET(qt_imported_targets Qt5::Core Qt5::Widgets) -ELSE() - FIND_PACKAGE(Qt4 REQUIRED COMPONENTS QtGui) - SET(qt_imported_targets Qt4::QtCore Qt4::QtGui) -ENDIF() - -IF(NOT DEFINED QT_TESTING_WITH_PYTHON) - OPTION(QT_TESTING_WITH_PYTHON "Enable Qt Testing with Python" OFF) -ENDIF() - -IF(NOT DEFINED QtTesting_INSTALL_BIN_DIR) - SET(QtTesting_INSTALL_BIN_DIR bin) -ENDIF() - -IF(NOT DEFINED QtTesting_INSTALL_INCLUDE_DIR) - SET(QtTesting_INSTALL_INCLUDE_DIR include/QtTesting) -ENDIF() - -IF(NOT DEFINED QtTesting_INSTALL_LIB_DIR) - SET(QtTesting_INSTALL_LIB_DIR lib) -ENDIF() - -IF(NOT DEFINED QtTesting_INSTALL_CMAKE_DIR) - SET(QtTesting_INSTALL_CMAKE_DIR lib/cmake/qttesting) -ENDIF() - -IF(NOT DEFINED QT_TESTING_EVENT_PLAYBACK_DELAY) - SET(QT_TESTING_EVENT_PLAYBACK_DELAY "100" CACHE STRING "Delay between invocation of each testing event." FORCE) - MARK_AS_ADVANCED(QT_TESTING_EVENT_PLAYBACK_DELAY) -ENDIF() - -IF(NOT QT_TESTING_INSTALL_EXPORT_NAME) - SET(QT_TESTING_INSTALL_EXPORT_NAME QtTestingTargets) -ENDIF() +find_package(Qt${QtTesting_QT_VERSION} REQUIRED COMPONENTS Core Widgets Gui) +set(qt_imported_targets + Qt${QtTesting_QT_VERSION}::Core + Qt${QtTesting_QT_VERSION}::Widgets + Qt${QtTesting_QT_VERSION}::Gui +) + +if(NOT DEFINED QT_TESTING_WITH_PYTHON) + option(QT_TESTING_WITH_PYTHON "Enable Qt Testing with Python" OFF) +endif() + +if(NOT DEFINED QtTesting_INSTALL_BIN_DIR) + set(QtTesting_INSTALL_BIN_DIR bin) +endif() + +if(NOT DEFINED QtTesting_INSTALL_INCLUDE_DIR) + set(QtTesting_INSTALL_INCLUDE_DIR include/QtTesting) +endif() + +if(NOT DEFINED QtTesting_INSTALL_LIB_DIR) + set(QtTesting_INSTALL_LIB_DIR lib) +endif() + +if(NOT DEFINED QtTesting_INSTALL_CMAKE_DIR) + set(QtTesting_INSTALL_CMAKE_DIR lib/cmake/qttesting) +endif() + +if(NOT DEFINED QT_TESTING_EVENT_PLAYBACK_DELAY) + set(QT_TESTING_EVENT_PLAYBACK_DELAY + "100" + CACHE STRING + "Delay between invocation of each testing event." + FORCE + ) + mark_as_advanced(QT_TESTING_EVENT_PLAYBACK_DELAY) +endif() + +if(NOT DEFINED QT_TESTING_INSTALL_EXPORT_NAME) + set(QT_TESTING_INSTALL_EXPORT_NAME QtTestingTargets) +endif() # One can define QT_TESTING_CUSTOM_LIBRARY_PREFIX and/or # QT_TESTING_CUSTOM_LIBRARY_SUFFIX to add prefix/suffix to libraries # generated by thus project. Default is empty. if(NOT DEFINED QT_TESTING_CUSTOM_LIBRARY_SUFFIX) - set(QT_TESTING_CUSTOM_LIBRARY_SUFFIX) + set(QT_TESTING_CUSTOM_LIBRARY_SUFFIX) endif() if(NOT DEFINED QT_TESTING_CUSTOM_LIBRARY_PREFIX) - set(QT_TESTING_CUSTOM_LIBRARY_PREFIX) + set(QT_TESTING_CUSTOM_LIBRARY_PREFIX) endif() -IF(QT_TESTING_WITH_PYTHON) - - IF(NOT PythonLibs_FOUND) - FIND_PACKAGE(PythonLibs REQUIRED) - ENDIF() - - IF(UNIX) - FIND_LIBRARY(PYTHON_UTIL_LIBRARY - NAMES util - PATHS /usr/lib - DOC "Utility library needed for vtkpython" - ) - MARK_AS_ADVANCED(PYTHON_UTIL_LIBRARY) - IF(PYTHON_UTIL_LIBRARY) - SET(PYTHON_UTIL_LIBRARY_LIB ${PYTHON_UTIL_LIBRARY}) - ENDIF() - ENDIF() - - INCLUDE_DIRECTORIES( - ${PYTHON_INCLUDE_PATH} - ) - SET(PYTHON_MOCS - pqPythonEventObserver.h - pqPythonEventSource.h - ) - SET(PYTHON_SRCS - pqPythonEventObserver.cxx - pqPythonEventObserver.h - pqPythonEventSource.cxx - pqPythonEventSource.h - ) -ENDIF(QT_TESTING_WITH_PYTHON) - -INCLUDE_DIRECTORIES( - ${QtTesting_BINARY_DIR} - ${QtTesting_SOURCE_DIR} +if(QT_TESTING_WITH_PYTHON) + if(NOT PythonLibs_FOUND) + find_package(PythonLibs REQUIRED) + endif() + + if(UNIX) + find_library( + PYTHON_UTIL_LIBRARY + NAMES util + PATHS /usr/lib + DOC "Utility library needed for vtkpython" + ) + mark_as_advanced(PYTHON_UTIL_LIBRARY) + if(PYTHON_UTIL_LIBRARY) + set(PYTHON_UTIL_LIBRARY_LIB ${PYTHON_UTIL_LIBRARY}) + endif() + endif() + + include_directories(${PYTHON_INCLUDE_PATH}) + set(PYTHON_SRCS + pqPythonEventObserver.cxx + pqPythonEventObserver.h + pqPythonEventSource.cxx + pqPythonEventSource.h + ) +endif(QT_TESTING_WITH_PYTHON) + +set(ui_files pqPlayBackEventsDialog.ui pqRecordEventsDialog.ui) +set(rc_files Resources/QtTesting.qrc) + +set(CMAKE_AUTOMOC 1) +set(CMAKE_AUTOUIC 1) +set(CMAKE_AUTORCC 1) + +set(QtTesting_SOURCES + pq3DViewEventPlayer.cxx + pq3DViewEventTranslator.cxx + pqAbstractActivateEventPlayer.cxx + pqAbstractBooleanEventPlayer.cxx + pqAbstractButtonEventTranslator.cxx + pqAbstractDoubleEventPlayer.cxx + pqAbstractIntEventPlayer.cxx + pqAbstractItemViewEventPlayer.cxx + pqAbstractItemViewEventPlayerBase.cxx + pqAbstractItemViewEventTranslator.cxx + pqAbstractItemViewEventTranslatorBase.cxx + pqAbstractMiscellaneousEventPlayer.cxx + pqAbstractSliderEventTranslator.cxx + pqAbstractStringEventPlayer.cxx + pqBasicWidgetEventPlayer.cxx + pqBasicWidgetEventTranslator.cxx + pqCheckEventOverlay.cxx + pqComboBoxEventTranslator.cxx + pqComboBoxEventPlayer.cxx + pqCommentEventPlayer.cxx + pqDoubleSpinBoxEventTranslator.cxx + pqEventComment.cxx + pqEventDispatcher.cxx + pqEventObserver.cxx + pqEventPlayer.cxx + pqEventRecorder.cxx + pqEventTranslator.cxx + pqLineEditEventTranslator.cxx + pqListViewEventPlayer.cxx + pqListViewEventTranslator.cxx + pqMenuEventTranslator.cxx + pqNativeFileDialogEventPlayer.cxx + pqNativeFileDialogEventTranslator.cxx + pqObjectNaming.cxx + pqObjectPlayer.cxx + pqPlayBackEventsDialog.cxx + pqRecordEventsDialog.cxx + pqSpinBoxEventTranslator.cxx + pqStdoutEventObserver.cxx + pqTabBarEventPlayer.cxx + pqTabBarEventTranslator.cxx + pqTableViewEventPlayer.cxx + pqTableViewEventTranslator.cxx + pqTestUtility.cxx + pqThreadedEventSource.cxx + pqTimer.cxx + pqTreeViewEventPlayer.cxx + pqTreeViewEventTranslator.cxx + pqWidgetEventPlayer.cxx + pqWidgetEventTranslator.cxx ) -# Reduce the number of dirs that get included on moc command line -# since it causes issues on Windows 2000. -GET_DIRECTORY_PROPERTY(include_dirs_tmp INCLUDE_DIRECTORIES) -SET_DIRECTORY_PROPERTIES(PROPERTIES INCLUDE_DIRECTORIES "${MOC_INCLUDE_DIRS}") - -SET(MOC_SRCS - pq3DViewEventPlayer.h - pq3DViewEventTranslator.h - pqAbstractActivateEventPlayer.h - pqAbstractBooleanEventPlayer.h - pqAbstractButtonEventTranslator.h - pqAbstractDoubleEventPlayer.h - pqAbstractIntEventPlayer.h - pqAbstractItemViewEventPlayer.h - pqAbstractItemViewEventPlayerBase.h - pqAbstractItemViewEventTranslator.h - pqAbstractItemViewEventTranslatorBase.h - pqAbstractMiscellaneousEventPlayer.h - pqAbstractSliderEventTranslator.h - pqAbstractStringEventPlayer.h - pqBasicWidgetEventPlayer.h - pqBasicWidgetEventTranslator.h - pqCheckEventOverlay.h - pqComboBoxEventTranslator.h - pqComboBoxEventPlayer.h - pqCommentEventPlayer.h - pqDoubleSpinBoxEventTranslator.h - pqEventComment.h - pqEventDispatcher.h - pqEventObserver.h - pqEventPlayer.h - pqEventRecorder.h - pqEventSource.h - pqEventTranslator.h - pqLineEditEventTranslator.h - pqListViewEventPlayer.h - pqListViewEventTranslator.h - pqMenuEventTranslator.h - pqNativeFileDialogEventPlayer.h - pqNativeFileDialogEventTranslator.h - pqPlayBackEventsDialog.h - pqRecordEventsDialog.h - pqSpinBoxEventTranslator.h - pqStdoutEventObserver.h - pqTabBarEventPlayer.h - pqTabBarEventTranslator.h - pqTableViewEventPlayer.h - pqTableViewEventTranslator.h - pqTestUtility.h - pqThreadedEventSource.h - pqTimer.h - pqTreeViewEventPlayer.h - pqTreeViewEventTranslator.h - pqWidgetEventPlayer.h - pqWidgetEventTranslator.h +set(QtTesting_DEVEL_HEADERS + QtTestingExport.h + pq3DViewEventPlayer.h + pq3DViewEventTranslator.h + pqAbstractActivateEventPlayer.h + pqAbstractBooleanEventPlayer.h + pqAbstractButtonEventTranslator.h + pqAbstractDoubleEventPlayer.h + pqAbstractIntEventPlayer.h + pqAbstractItemViewEventPlayer.h + pqAbstractItemViewEventPlayerBase.h + pqAbstractItemViewEventTranslator.h + pqAbstractItemViewEventTranslatorBase.h + pqAbstractMiscellaneousEventPlayer.h + pqAbstractSliderEventTranslator.h + pqAbstractStringEventPlayer.h + pqBasicWidgetEventPlayer.h + pqBasicWidgetEventTranslator.h + pqCheckEventOverlay.h + pqComboBoxEventTranslator.h + pqComboBoxEventPlayer.h + pqCommentEventPlayer.h + pqDoubleSpinBoxEventTranslator.h + pqEventComment.h + pqEventDispatcher.h + pqEventObserver.h + pqEventPlayer.h + pqEventRecorder.h + pqEventSource.h + pqEventTranslator.h + pqEventTypes.h + pqLineEditEventTranslator.h + pqListViewEventPlayer.h + pqListViewEventTranslator.h + pqMenuEventTranslator.h + pqNativeFileDialogEventPlayer.h + pqNativeFileDialogEventTranslator.h + pqObjectNaming.h + pqObjectPlayer.h + pqPlayBackEventsDialog.h + pqRecordEventsDialog.h + pqSpinBoxEventTranslator.h + pqStdoutEventObserver.h + pqTabBarEventPlayer.h + pqTabBarEventTranslator.h + pqTableViewEventPlayer.h + pqTableViewEventTranslator.h + pqTestUtility.h + pqThreadedEventSource.h + pqTimer.h + pqTreeViewEventPlayer.h + pqTreeViewEventTranslator.h + pqWidgetEventPlayer.h + pqWidgetEventTranslator.h + ${QtTesting_BINARY_DIR}/QtTestingConfigure.h ) -IF(QtTesting_QT_VERSION VERSION_GREATER "4") - QT5_WRAP_CPP(MOC_BUILT_SOURCES - ${MOC_SRCS} - ${PYTHON_MOCS} - ) -ELSE() - QT4_WRAP_CPP(MOC_BUILT_SOURCES - ${MOC_SRCS} - ${PYTHON_MOCS} - ) -ENDIF() - -SET_DIRECTORY_PROPERTIES(PROPERTIES INCLUDE_DIRECTORIES "${include_dirs_tmp}") - -IF(QtTesting_QT_VERSION VERSION_GREATER "4") - QT5_WRAP_UI(UI_BUILT_SOURCES - pqPlayBackEventsDialog.ui - pqRecordEventsDialog.ui - ) -ELSE() - QT4_WRAP_UI(UI_BUILT_SOURCES - pqPlayBackEventsDialog.ui - pqRecordEventsDialog.ui - ) -ENDIF() - -IF(QtTesting_QT_VERSION VERSION_GREATER "4") - QT5_ADD_RESOURCES(QRC_BUILT_SOURCES - Resources/QtTesting.qrc - ) -ELSE() - QT4_ADD_RESOURCES(QRC_BUILT_SOURCES - Resources/QtTesting.qrc - ) -ENDIF() - -SET(QtTesting_SOURCES - pq3DViewEventPlayer.cxx - pq3DViewEventTranslator.cxx - pqAbstractActivateEventPlayer.cxx - pqAbstractBooleanEventPlayer.cxx - pqAbstractButtonEventTranslator.cxx - pqAbstractDoubleEventPlayer.cxx - pqAbstractIntEventPlayer.cxx - pqAbstractItemViewEventPlayer.cxx - pqAbstractItemViewEventPlayerBase.cxx - pqAbstractItemViewEventTranslator.cxx - pqAbstractItemViewEventTranslatorBase.cxx - pqAbstractMiscellaneousEventPlayer.cxx - pqAbstractSliderEventTranslator.cxx - pqAbstractStringEventPlayer.cxx - pqBasicWidgetEventPlayer.cxx - pqBasicWidgetEventTranslator.cxx - pqCheckEventOverlay.cxx - pqComboBoxEventTranslator.cxx - pqComboBoxEventPlayer.cxx - pqCommentEventPlayer.cxx - pqDoubleSpinBoxEventTranslator.cxx - pqEventComment.cxx - pqEventDispatcher.cxx - pqEventObserver.cxx - pqEventPlayer.cxx - pqEventRecorder.cxx - pqEventTranslator.cxx - pqLineEditEventTranslator.cxx - pqListViewEventPlayer.cxx - pqListViewEventTranslator.cxx - pqMenuEventTranslator.cxx - pqNativeFileDialogEventPlayer.cxx - pqNativeFileDialogEventTranslator.cxx - pqObjectNaming.cxx - pqPlayBackEventsDialog.cxx - pqRecordEventsDialog.cxx - pqSpinBoxEventTranslator.cxx - pqStdoutEventObserver.cxx - pqTabBarEventPlayer.cxx - pqTabBarEventTranslator.cxx - pqTableViewEventPlayer.cxx - pqTableViewEventTranslator.cxx - pqTestUtility.cxx - pqThreadedEventSource.cxx - pqTimer.cxx - pqTreeViewEventPlayer.cxx - pqTreeViewEventTranslator.cxx - pqWidgetEventPlayer.cxx - pqWidgetEventTranslator.cxx -) +if(NOT DEFINED QTTESTING_BUILD_AS_VTK_MODULE) + option(QTTESTING_BUILD_AS_VTK_MODULE "Build QtTesting as a VTK module" OFF) +endif() -SET(QtTesting_DEVEL_HEADERS - QtTestingExport.h - pq3DViewEventPlayer.h - pq3DViewEventTranslator.h - pqAbstractActivateEventPlayer.h - pqAbstractBooleanEventPlayer.h - pqAbstractButtonEventTranslator.h - pqAbstractDoubleEventPlayer.h - pqAbstractIntEventPlayer.h - pqAbstractItemViewEventPlayer.h - pqAbstractItemViewEventPlayerBase.h - pqAbstractItemViewEventTranslator.h - pqAbstractItemViewEventTranslatorBase.h - pqAbstractMiscellaneousEventPlayer.h - pqAbstractSliderEventTranslator.h - pqAbstractStringEventPlayer.h - pqBasicWidgetEventPlayer.h - pqBasicWidgetEventTranslator.h - pqCheckEventOverlay.h - pqComboBoxEventTranslator.h - pqComboBoxEventPlayer.h - pqCommentEventPlayer.h - pqDoubleSpinBoxEventTranslator.h - pqEventComment.h - pqEventDispatcher.h - pqEventObserver.h - pqEventPlayer.h - pqEventRecorder.h - pqEventSource.h - pqEventTranslator.h - pqEventTypes.h - pqLineEditEventTranslator.h - pqListViewEventPlayer.h - pqListViewEventTranslator.h - pqMenuEventTranslator.h - pqNativeFileDialogEventPlayer.h - pqNativeFileDialogEventTranslator.h - pqObjectNaming.h - pqPlayBackEventsDialog.h - pqRecordEventsDialog.h - pqSpinBoxEventTranslator.h - pqStdoutEventObserver.h - pqTabBarEventPlayer.h - pqTabBarEventTranslator.h - pqTableViewEventPlayer.h - pqTableViewEventTranslator.h - pqTestUtility.h - pqThreadedEventSource.h - pqTimer.h - pqTreeViewEventPlayer.h - pqTreeViewEventTranslator.h - pqWidgetEventPlayer.h - pqWidgetEventTranslator.h - ${QtTesting_BINARY_DIR}/QtTestingConfigure.h -) +if(QTTESTING_BUILD_AS_VTK_MODULE) + # When building as a ThirdParty in ParaView + # or in any vtk module based software + # it can be useful to build qttesting as a VTK Module. + # This macro is defined in VTK cmake macros + vtk_module_add_module(ParaView::qttesting + SOURCES + ${QtTesting_SOURCES} + ${ui_files} + ${rc_files} + ${PYTHON_SRCS} + HEADERS + ${QtTesting_DEVEL_HEADERS} + HEADERS_SUBDIR + "vtkqttesting" + ) + set_target_properties(qttesting PROPERTIES DEFINE_SYMBOL QtTesting_EXPORTS) + add_library(ParaView::qttesting ALIAS qttesting) + target_include_directories( + qttesting + PUBLIC + "$" + "$" + "$" + ) +else() + add_library( + qttesting + ${QtTesting_SOURCES} + ${ui_files} + ${rc_files} + ${PYTHON_SRCS} + ${QtTesting_DEVEL_HEADERS} + ) + add_library(QtTesting ALIAS qttesting) + + target_include_directories( + qttesting + PUBLIC + $ + $ + "$" + ) +endif() -ADD_LIBRARY(QtTesting - ${QtTesting_SOURCES} - ${MOC_BUILT_SOURCES} - ${UI_BUILT_SOURCES} - ${QRC_BUILT_SOURCES} - ${PYTHON_SRCS} -) +target_compile_definitions(qttesting PRIVATE QT_NO_KEYWORDS) # Set library name to include custom prefixes/suffixes. -set_property(TARGET QtTesting - PROPERTY OUTPUT_NAME ${QT_TESTING_CUSTOM_LIBRARY_PREFIX}QtTesting${QT_TESTING_CUSTOM_LIBRARY_SUFFIX}) - -SOURCE_GROUP("Generated" FILES - ${MOC_BUILT_SOURCES} - ${UI_BUILT_SOURCES} -) - -TARGET_LINK_LIBRARIES(QtTesting - ${qt_imported_targets} -) - -TARGET_INCLUDE_DIRECTORIES( - QtTesting - PUBLIC - $ - $ +set_property( + TARGET qttesting + PROPERTY + OUTPUT_NAME + ${QT_TESTING_CUSTOM_LIBRARY_PREFIX}qttesting${QT_TESTING_CUSTOM_LIBRARY_SUFFIX} ) -IF(QT_TESTING_WITH_PYTHON) - TARGET_LINK_LIBRARIES(QtTesting - ${PYTHON_LIBRARIES} - ${PYTHON_UTIL_LIBRARY_LIB} - ) -ENDIF() +target_link_libraries(qttesting PRIVATE ${qt_imported_targets}) -SET(QTTESTING_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS}) -CONFIGURE_FILE(${QtTesting_SOURCE_DIR}/QtTestingConfigure.h.in - ${QtTesting_BINARY_DIR}/QtTestingConfigure.h) +if(QT_TESTING_WITH_PYTHON) + target_link_libraries(qttesting VTK::Python) +endif() -INSTALL(TARGETS QtTesting - EXPORT ${QT_TESTING_INSTALL_EXPORT_NAME} - RUNTIME DESTINATION ${QtTesting_INSTALL_BIN_DIR} COMPONENT Runtime - LIBRARY DESTINATION ${QtTesting_INSTALL_LIB_DIR} COMPONENT Runtime - ARCHIVE DESTINATION ${QtTesting_INSTALL_LIB_DIR} COMPONENT Development) +set(QTTESTING_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS}) +configure_file( + ${QtTesting_SOURCE_DIR}/QtTestingConfigure.h.in + ${QtTesting_BINARY_DIR}/QtTestingConfigure.h +) +if(NOT QTTESTING_BUILD_AS_VTK_MODULE) + install( + TARGETS qttesting + EXPORT ${QT_TESTING_INSTALL_EXPORT_NAME} + RUNTIME DESTINATION ${QtTesting_INSTALL_BIN_DIR} COMPONENT Runtime + LIBRARY DESTINATION ${QtTesting_INSTALL_LIB_DIR} COMPONENT Runtime + ARCHIVE DESTINATION ${QtTesting_INSTALL_LIB_DIR} COMPONENT Development + ) +endif() -if (NOT DEFINED BUILD_EXAMPLES) - option(BUILD_EXAMPLES "Build examples" OFF) -endif () -if (BUILD_EXAMPLES) - add_subdirectory(Examples) -endif () +if(NOT DEFINED BUILD_EXAMPLES) + option(BUILD_EXAMPLES "Build examples" OFF) +endif() +if(BUILD_EXAMPLES) + add_subdirectory(Examples) +endif() include(CTest) -IF(BUILD_TESTING) - add_subdirectory(Testing) -ENDIF() +if(BUILD_TESTING) + add_subdirectory(Testing) +endif() -export(TARGETS QtTesting FILE ${QtTesting_BINARY_DIR}/QtTestingExports.cmake) +export(TARGETS qttesting FILE ${QtTesting_BINARY_DIR}/QtTestingExports.cmake) # Set up the build export configuration set(QtTesting_EXPORT_FILE "${QtTesting_BINARY_DIR}/QtTestingConfig.cmake") configure_file( - "${QtTesting_SOURCE_DIR}/QtTestingConfig.cmake.in" - "${QtTesting_EXPORT_FILE}" - @ONLY + "${QtTesting_SOURCE_DIR}/QtTestingConfig.cmake.in" + "${QtTesting_EXPORT_FILE}" + @ONLY ) # Set up the install export -IF(IS_ABSOLUTE QtTesting_INSTALL_INCLUDE_DIR) - set(QtTesting_INSTALL_INCLUDE_FULL_DIR "${QtTesting_INSTALL_INCLUDE_DIR}") -ELSE() - set(QtTesting_INSTALL_INCLUDE_FULL_DIR "${CMAKE_INSTALL_PREFIX}/${QtTesting_INSTALL_INCLUDE_DIR}") - get_filename_component(QtTesting_INSTALL_INCLUDE_FULL_DIR "${QtTesting_INSTALL_INCLUDE_FULL_DIR}" ABSOLUTE) -ENDIF() - -IF(IS_ABSOLUTE QtTesting_INSTALL_LIB_DIR) - set(QtTesting_INSTALL_LIB_FULL_DIR "${QtTesting_INSTALL_LIB_DIR}") -ELSE() - set(QtTesting_INSTALL_LIB_FULL_DIR "${CMAKE_INSTALL_PREFIX}/${QtTesting_INSTALL_LIB_DIR}") - get_filename_component(QtTesting_INSTALL_LIB_FULL_DIR "${QtTesting_INSTALL_LIB_FULL_DIR}" ABSOLUTE) -ENDIF() - -set(QtTesting_EXPORT_INSTALL_FILE "${QtTesting_BINARY_DIR}/CMakeFiles/QtTestingConfig.cmake") +if(IS_ABSOLUTE QtTesting_INSTALL_INCLUDE_DIR) + set(QtTesting_INSTALL_INCLUDE_FULL_DIR "${QtTesting_INSTALL_INCLUDE_DIR}") +else() + set(QtTesting_INSTALL_INCLUDE_FULL_DIR + "${CMAKE_INSTALL_PREFIX}/${QtTesting_INSTALL_INCLUDE_DIR}" + ) + get_filename_component( + QtTesting_INSTALL_INCLUDE_FULL_DIR + "${QtTesting_INSTALL_INCLUDE_FULL_DIR}" + ABSOLUTE + ) +endif() + +if(IS_ABSOLUTE QtTesting_INSTALL_LIB_DIR) + set(QtTesting_INSTALL_LIB_FULL_DIR "${QtTesting_INSTALL_LIB_DIR}") +else() + set(QtTesting_INSTALL_LIB_FULL_DIR + "${CMAKE_INSTALL_PREFIX}/${QtTesting_INSTALL_LIB_DIR}" + ) + get_filename_component( + QtTesting_INSTALL_LIB_FULL_DIR + "${QtTesting_INSTALL_LIB_FULL_DIR}" + ABSOLUTE + ) +endif() + +set(QtTesting_EXPORT_INSTALL_FILE + "${QtTesting_BINARY_DIR}/CMakeFiles/QtTestingConfig.cmake" +) configure_file( - "${QtTesting_SOURCE_DIR}/QtTestingConfig-install.cmake.in" - "${QtTesting_EXPORT_INSTALL_FILE}" - @ONLY + "${QtTesting_SOURCE_DIR}/QtTestingConfig-install.cmake.in" + "${QtTesting_EXPORT_INSTALL_FILE}" + @ONLY ) include(CMakePackageConfigHelpers) @@ -398,24 +361,25 @@ include(CMakePackageConfigHelpers) # * targets_export_name # * PROJECT_NAME configure_package_config_file( - "${PROJECT_NAME}Config-install.cmake.in" - "${QtTesting_EXPORT_INSTALL_FILE}" - INSTALL_DESTINATION "${QtTesting_INSTALL_CMAKE_DIR}" - NO_CHECK_REQUIRED_COMPONENTS_MACRO + "${PROJECT_NAME}Config-install.cmake.in" + "${QtTesting_EXPORT_INSTALL_FILE}" + INSTALL_DESTINATION "${QtTesting_INSTALL_CMAKE_DIR}" + NO_CHECK_REQUIRED_COMPONENTS_MACRO ) - - -IF(NOT QtTesting_INSTALL_NO_DEVELOPMENT) - install( FILES ${QtTesting_DEVEL_HEADERS} - DESTINATION ${QtTesting_INSTALL_INCLUDE_DIR} - ) - - # Configure the CMake EXPORT file during installation - install( FILES ${QtTesting_BINARY_DIR}/CMakeFiles/QtTestingConfig.cmake - DESTINATION ${QtTesting_INSTALL_CMAKE_DIR} - ) - install( EXPORT ${QT_TESTING_INSTALL_EXPORT_NAME} - DESTINATION ${QtTesting_INSTALL_CMAKE_DIR} - ) -ENDIF() +if(NOT QtTesting_INSTALL_NO_DEVELOPMENT) + install( + FILES ${QtTesting_DEVEL_HEADERS} + DESTINATION ${QtTesting_INSTALL_INCLUDE_DIR} + ) + + # Configure the CMake EXPORT file during installation + install( + FILES ${QtTesting_BINARY_DIR}/CMakeFiles/QtTestingConfig.cmake + DESTINATION ${QtTesting_INSTALL_CMAKE_DIR} + ) + install( + EXPORT ${QT_TESTING_INSTALL_EXPORT_NAME} + DESTINATION ${QtTesting_INSTALL_CMAKE_DIR} + ) +endif() diff --git a/Copyright.txt b/Copyright.txt index 393acd2..9034642 100644 --- a/Copyright.txt +++ b/Copyright.txt @@ -1,34 +1,26 @@ -/*========================================================================= - - Program: QtTesting - Module: Copyright.txt - -Copyright (c) 2005-2022 Kitware, inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names - of any contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +Copyright (c) 2000 Kitware Inc. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this list + of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +* Neither the name of Kitware nor the names of any contributors may be used to + endorse or promote products derived from this software without specific prior + written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/Examples/CMakeLists.txt b/Examples/CMakeLists.txt index c343fe0..8ab16af 100644 --- a/Examples/CMakeLists.txt +++ b/Examples/CMakeLists.txt @@ -1,36 +1,28 @@ +set(UI_FILES TestingDemo.ui) +set(SOURCE_FILES TestingDemo.cxx TestingDemo.h) -SET (UI_FILES - TestingDemo.ui -) - -SET (SOURCE_FILES - TestingDemo.cxx - TestingDemo.h -) - -SET (MOC_FILES - TestingDemo.h -) - +set(MOC_FILES TestingDemo.h) -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) +include_directories(${CMAKE_CURRENT_BINARY_DIR}) -IF(QtTesting_QT_VERSION VERSION_GREATER "4") - QT5_WRAP_UI (EXAMPLE_UI_BUILT_SOURCES ${UI_FILES}) - QT5_WRAP_CPP(EXAMPLE_MOC_BUILT_SOURCES ${MOC_FILES}) -ELSE() - QT4_WRAP_UI (EXAMPLE_UI_BUILT_SOURCES ${UI_FILES}) - QT4_WRAP_CPP(EXAMPLE_MOC_BUILT_SOURCES ${MOC_FILES}) -ENDIF() +if(QtTesting_QT_VERSION VERSION_GREATER "5") + qt6_wrap_ui(EXAMPLE_UI_BUILT_SOURCES ${UI_FILES}) + qt6_wrap_cpp(EXAMPLE_MOC_BUILT_SOURCES ${MOC_FILES}) +else() + qt5_wrap_ui(EXAMPLE_UI_BUILT_SOURCES ${UI_FILES}) + qt5_wrap_cpp(EXAMPLE_MOC_BUILT_SOURCES ${MOC_FILES}) +endif() -add_executable (TestingDemo - ${SOURCE_FILES} - ${EXAMPLE_UI_BUILT_SOURCES} - ${EXAMPLE_MOC_BUILT_SOURCES} - ) +add_executable( + TestingDemo + ${SOURCE_FILES} + ${EXAMPLE_UI_BUILT_SOURCES} + ${EXAMPLE_MOC_BUILT_SOURCES} +) -target_link_libraries(TestingDemo - QtTesting) -set_target_properties(TestingDemo PROPERTIES - COMPILE_FLAGS "${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}") +target_link_libraries(TestingDemo qttesting ${qt_imported_targets}) +set_target_properties( + TestingDemo + PROPERTIES COMPILE_FLAGS "${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}" +) diff --git a/QtTestingConfigure.h.in b/QtTestingConfigure.h.in index e0e2bb8..439fd79 100644 --- a/QtTestingConfigure.h.in +++ b/QtTestingConfigure.h.in @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: QtTestingConfigure.h.in - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef _QtTestingConfigure_h #define _QtTestingConfigure_h diff --git a/QtTestingExport.h b/QtTestingExport.h index c57fb87..4df1248 100644 --- a/QtTestingExport.h +++ b/QtTestingExport.h @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: QtTestingExport.h - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef _QtTestingExport_h #define _QtTestingExport_h diff --git a/Testing/CMake/qtTestingMacroGenerateMocs.cmake b/Testing/CMake/qtTestingMacroGenerateMocs.cmake index 4b1f34a..c832010 100644 --- a/Testing/CMake/qtTestingMacroGenerateMocs.cmake +++ b/Testing/CMake/qtTestingMacroGenerateMocs.cmake @@ -1,21 +1,35 @@ - # QT4_GENERATE_MOCS(inputfile1 [inputfile2 ...]) macro(QT4_GENERATE_MOCS) - foreach(file ${ARGN}) - set(moc_file moc_${file}) - QT4_GENERATE_MOC(${file} ${moc_file}) - macro_add_file_dependencies(${file} ${CMAKE_CURRENT_BINARY_DIR}/${moc_file}) - endforeach() + foreach(file ${ARGN}) + set(moc_file moc_${file}) + qt4_generate_moc(${file} ${moc_file}) + macro_add_file_dependencies(${file} ${CMAKE_CURRENT_BINARY_DIR}/${moc_file}) + endforeach() endmacro() # QT5_GENERATE_MOCS(inputfile1 [inputfile2 ...]) macro(QT5_GENERATE_MOCS) - foreach(file ${ARGN}) - set(moc_file moc_${file}) - QT5_GENERATE_MOC(${file} ${moc_file}) - set_property(SOURCE ${file} APPEND PROPERTY - OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${moc_file}) - endforeach() + foreach(file ${ARGN}) + set(moc_file moc_${file}) + qt5_generate_moc(${file} ${moc_file}) + set_property( + SOURCE ${file} + APPEND + PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${moc_file} + ) + endforeach() +endmacro() + +macro(QT6_GENERATE_MOCS) + foreach(file ${ARGN}) + set(moc_file moc_${file}) + qt_generate_moc(${file} ${moc_file}) + set_property( + SOURCE ${file} + APPEND + PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${moc_file} + ) + endforeach() endmacro() diff --git a/Testing/CMakeLists.txt b/Testing/CMakeLists.txt index c85be4e..2b614b4 100644 --- a/Testing/CMakeLists.txt +++ b/Testing/CMakeLists.txt @@ -1,6 +1,5 @@ if(NOT CMAKE_Cxx_Fortran_COMPILER_ID STREQUAL "Intel") - # QtTest fails to compile on ICC. Hence we don't add these tests on - # Intel compilers. - add_subdirectory(Cpp) + # QtTest fails to compile on ICC. Hence we don't add these tests on + # Intel compilers. + add_subdirectory(Cpp) endif() - diff --git a/Testing/Cpp/CMakeLists.txt b/Testing/Cpp/CMakeLists.txt index fed2444..612ccb5 100644 --- a/Testing/Cpp/CMakeLists.txt +++ b/Testing/Cpp/CMakeLists.txt @@ -1,69 +1,72 @@ include(../CMake/qtTestingMacroGenerateMocs.cmake) -IF(QtTesting_QT_VERSION VERSION_GREATER "4") - FIND_PACKAGE(Qt5 REQUIRED QUIET COMPONENTS Test) - SET(TEST_LIBRARIES Qt5::Test) -ELSE() - FIND_PACKAGE(Qt4 REQUIRED QUIET COMPONENTS QtTest) - SET(TEST_LIBRARIES Qt4::QtTest) -ENDIF() +if(QtTesting_QT_VERSION VERSION_GREATER "5") + find_package(Qt6 REQUIRED QUIET COMPONENTS Core Test Widgets Gui) + set(TEST_LIBRARIES Qt6::Test Qt6::Core Qt6::Widgets Qt6::Gui) +else() + find_package(Qt5 REQUIRED QUIET COMPONENTS Core Test Widgets Gui) + set(TEST_LIBRARIES Qt5::Test Qt5::Core Qt5::Widgets Qt5::Gui) +endif() set(KIT ${PROJECT_NAME}) set(TEST_SOURCES - pqAbstractButtonEventTranslatorTest.cpp - pqEventPlayerTest.cpp - pqEventRecorderTest.cpp - pqEventTranslatorTest.cpp - pqDoubleSpinBoxEventPlayerTest.cpp - pqDoubleSpinBoxEventTranslatorTest.cpp - pqSpinBoxEventPlayerTest.cpp - pqSpinBoxEventTranslatorTest.cpp - pqTestUtilityTest.cpp - ) + pqAbstractButtonEventTranslatorTest.cpp + pqEventPlayerTest.cpp + pqEventRecorderTest.cpp + pqEventTranslatorTest.cpp + pqDoubleSpinBoxEventPlayerTest.cpp + pqDoubleSpinBoxEventTranslatorTest.cpp + pqSpinBoxEventPlayerTest.cpp + pqSpinBoxEventTranslatorTest.cpp + pqTestUtilityTest.cpp +) -set(TEST_MOC_HEADERS - pqTest.h - ) +set(TEST_MOC_HEADERS pqTest.h) -create_test_sourcelist(Tests ${KIT}CppTests.cxx - ${TEST_SOURCES} - ) +create_test_sourcelist(Tests ${KIT}CppTests.cxx ${TEST_SOURCES}) set(TestsToRun ${Tests}) remove(TestsToRun ${KIT}CppTests.cxx) -include_directories( - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_SOURCE_DIR} - ) +include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) -if(QtTesting_QT_VERSION VERSION_GREATER "4") - QT5_GENERATE_MOCS(${TEST_SOURCES}) - QT5_WRAP_CPP( TEST_MOC_SRCS ${TEST_MOC_HEADERS} ) +if(QtTesting_QT_VERSION VERSION_GREATER "5") + qt6_generate_mocs(${TEST_SOURCES}) + qt6_wrap_cpp( TEST_MOC_SRCS ${TEST_MOC_HEADERS} ) else() - QT4_GENERATE_MOCS(${TEST_SOURCES}) - QT4_WRAP_CPP( TEST_MOC_SRCS ${TEST_MOC_HEADERS} ) + qt5_generate_mocs(${TEST_SOURCES}) + qt5_wrap_cpp( TEST_MOC_SRCS ${TEST_MOC_HEADERS} ) endif() add_executable(${KIT}CppTests ${Tests} ${TEST_MOC_SRCS}) -target_link_libraries(${KIT}CppTests ${PROJECT_NAME} ${TEST_LIBRARIES}) -set_target_properties(${KIT}CppTests PROPERTIES - COMPILE_FLAGS "${Qt5Test_EXECUTABLE_COMPILE_FLAGS}") +target_link_libraries( + ${KIT}CppTests + ${PROJECT_NAME} + ${TEST_LIBRARIES} + qttesting +) +set_target_properties( + ${KIT}CppTests + PROPERTIES COMPILE_FLAGS "${Qt5Test_EXECUTABLE_COMPILE_FLAGS}" +) macro(SIMPLE_TEST testname) - add_test(NAME ${testname} COMMAND $ ${testname} ${ARGN}) + add_test( + NAME ${testname} + COMMAND $ ${testname} ${ARGN} + ) endmacro() # # Add Tests # -SIMPLE_TEST( pqAbstractButtonEventTranslatorTest ) -SIMPLE_TEST( pqEventPlayerTest ) -SIMPLE_TEST( pqEventRecorderTest ) -SIMPLE_TEST( pqDoubleSpinBoxEventPlayerTest ) -SIMPLE_TEST( pqDoubleSpinBoxEventTranslatorTest ) -SIMPLE_TEST( pqSpinBoxEventPlayerTest ) -SIMPLE_TEST( pqSpinBoxEventTranslatorTest ) -SIMPLE_TEST( pqEventTranslatorTest ) -SIMPLE_TEST( pqTestUtilityTest ) +simple_test( pqAbstractButtonEventTranslatorTest ) +simple_test( pqEventPlayerTest ) +simple_test( pqEventRecorderTest ) +simple_test( pqDoubleSpinBoxEventPlayerTest ) +simple_test( pqDoubleSpinBoxEventTranslatorTest ) +simple_test( pqSpinBoxEventPlayerTest ) +simple_test( pqSpinBoxEventTranslatorTest ) +simple_test( pqEventTranslatorTest ) +simple_test( pqTestUtilityTest ) diff --git a/Testing/Cpp/pqAbstractButtonEventTranslatorTest.cpp b/Testing/Cpp/pqAbstractButtonEventTranslatorTest.cpp index 65fcfd7..5dd914e 100644 --- a/Testing/Cpp/pqAbstractButtonEventTranslatorTest.cpp +++ b/Testing/Cpp/pqAbstractButtonEventTranslatorTest.cpp @@ -1,33 +1,6 @@ -/*========================================================================= - - Program: ParaView - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause // Qt includes #include @@ -203,8 +176,8 @@ void pqAbstractButtonEventTranslatorTester::testToolButton_data() .arg(longActivate ? "longActivate" : (checkable ? "set_boolean" : "activate")) .arg(checkable && !longActivate ? "true" : ""); - QTest::newRow(testName.toUtf8()) << popup << withDefaultAction << checkable << withMenu - << longClick << recordEmitted; + QTest::newRow(testName.toUtf8()) + << popup << withDefaultAction << checkable << withMenu << longClick << recordEmitted; } } diff --git a/Testing/Cpp/pqDoubleSpinBoxEventPlayerTest.cpp b/Testing/Cpp/pqDoubleSpinBoxEventPlayerTest.cpp index 7367d32..0a0d5fb 100644 --- a/Testing/Cpp/pqDoubleSpinBoxEventPlayerTest.cpp +++ b/Testing/Cpp/pqDoubleSpinBoxEventPlayerTest.cpp @@ -1,33 +1,6 @@ -/*========================================================================= - - Program: ParaView - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause // Qt includes #include diff --git a/Testing/Cpp/pqDoubleSpinBoxEventTranslatorTest.cpp b/Testing/Cpp/pqDoubleSpinBoxEventTranslatorTest.cpp index d668d5b..81fca25 100644 --- a/Testing/Cpp/pqDoubleSpinBoxEventTranslatorTest.cpp +++ b/Testing/Cpp/pqDoubleSpinBoxEventTranslatorTest.cpp @@ -1,33 +1,6 @@ -/*========================================================================= - - Program: ParaView - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause // Qt includes #include diff --git a/Testing/Cpp/pqEventPlayerTest.cpp b/Testing/Cpp/pqEventPlayerTest.cpp index dd82101..8a5b153 100644 --- a/Testing/Cpp/pqEventPlayerTest.cpp +++ b/Testing/Cpp/pqEventPlayerTest.cpp @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqEventPlayer.h - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause // Qt includes #include diff --git a/Testing/Cpp/pqEventRecorderTest.cpp b/Testing/Cpp/pqEventRecorderTest.cpp index d9be98d..b2f65f1 100644 --- a/Testing/Cpp/pqEventRecorderTest.cpp +++ b/Testing/Cpp/pqEventRecorderTest.cpp @@ -1,33 +1,6 @@ -/*========================================================================= - - Program: ParaView - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause // Qt includes #include diff --git a/Testing/Cpp/pqEventTranslatorTest.cpp b/Testing/Cpp/pqEventTranslatorTest.cpp index 51ae16a..c64a34e 100644 --- a/Testing/Cpp/pqEventTranslatorTest.cpp +++ b/Testing/Cpp/pqEventTranslatorTest.cpp @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqEventPlayer.h - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause // Qt includes #include diff --git a/Testing/Cpp/pqSpinBoxEventPlayerTest.cpp b/Testing/Cpp/pqSpinBoxEventPlayerTest.cpp index 33f8fba..b616072 100644 --- a/Testing/Cpp/pqSpinBoxEventPlayerTest.cpp +++ b/Testing/Cpp/pqSpinBoxEventPlayerTest.cpp @@ -1,33 +1,6 @@ -/*========================================================================= - - Program: ParaView - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause // Qt includes #include diff --git a/Testing/Cpp/pqSpinBoxEventTranslatorTest.cpp b/Testing/Cpp/pqSpinBoxEventTranslatorTest.cpp index 3539a47..e09b02f 100644 --- a/Testing/Cpp/pqSpinBoxEventTranslatorTest.cpp +++ b/Testing/Cpp/pqSpinBoxEventTranslatorTest.cpp @@ -1,33 +1,6 @@ -/*========================================================================= - - Program: ParaView - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause // Qt includes #include diff --git a/Testing/Cpp/pqTest.h b/Testing/Cpp/pqTest.h index be694f5..7150f56 100644 --- a/Testing/Cpp/pqTest.h +++ b/Testing/Cpp/pqTest.h @@ -1,52 +1,6 @@ -/*========================================================================= - - Library: CTK - - Copyright (c) Kitware Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0.txt - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -=========================================================================*/ -/*========================================================================= - - Program: ParaView - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause AND Apache-2.0 // Qt includes #include @@ -73,7 +27,7 @@ class pqDummyEventObserver : public pqEventObserver QString Text; -public slots: +public Q_SLOTS: virtual void onRecordEvent( const QString& widget, const QString& command, const QString& arguments, const int& eventType) { @@ -172,9 +126,7 @@ static void mouseEvent(QTest::MouseAction action, QWidget* widget, Qt::MouseButt stateKey &= static_cast(Qt::KeyboardModifierMask); - QMouseEvent me(QEvent::User, QPoint(), Qt::LeftButton, button, stateKey); - - me = QMouseEvent(QEvent::MouseMove, pos, widget->mapToGlobal(pos), button, button, stateKey); + QMouseEvent me(QEvent::MouseMove, pos, widget->mapToGlobal(pos), button, button, stateKey); QSpontaneKeyEvent::setSpontaneous(&me); if (!qApp->notify(widget, &me)) { @@ -187,8 +139,8 @@ static void mouseEvent(QTest::MouseAction action, QWidget* widget, Qt::MouseButt } } -inline void mouseMove(QWidget* widget, Qt::MouseButton button, Qt::KeyboardModifiers stateKey = 0, - QPoint pos = QPoint(), int delay = -1) +inline void mouseMove(QWidget* widget, Qt::MouseButton button, + Qt::KeyboardModifiers stateKey = Qt::NoModifier, QPoint pos = QPoint(), int delay = -1) { ctkTest::mouseEvent(QTest::MouseMove, widget, button, stateKey, pos, delay); } diff --git a/Testing/Cpp/pqTestUtilityTest.cpp b/Testing/Cpp/pqTestUtilityTest.cpp index 1cf1de4..95474df 100644 --- a/Testing/Cpp/pqTestUtilityTest.cpp +++ b/Testing/Cpp/pqTestUtilityTest.cpp @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqEventPlayer.h - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause // Qt includes #include diff --git a/Utilities/TemplatePlayerTest/pqTemplateEventPlayerTest.cpp b/Utilities/TemplatePlayerTest/pqTemplateEventPlayerTest.cpp index 52160d9..436b26e 100644 --- a/Utilities/TemplatePlayerTest/pqTemplateEventPlayerTest.cpp +++ b/Utilities/TemplatePlayerTest/pqTemplateEventPlayerTest.cpp @@ -1,33 +1,6 @@ -/*========================================================================= - - Program: ParaView - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause // Qt includes #include diff --git a/Utilities/TemplateTranslatorPlayer/TemplateEventTranslator.h b/Utilities/TemplateTranslatorPlayer/TemplateEventTranslator.h index 26d2ea2..9fe6c02 100644 --- a/Utilities/TemplateTranslatorPlayer/TemplateEventTranslator.h +++ b/Utilities/TemplateTranslatorPlayer/TemplateEventTranslator.h @@ -14,7 +14,7 @@ class TemplateEventTranslator : public pqWidgetEventTranslator using Superclass::translateEvent; virtual bool translateEvent(QObject* Object, QEvent* Event, bool& Error); -private slots: +private Q_SLOTS: void onDestroyed(); private: diff --git a/Utilities/TemplateTranslatorTest/pqTemplateEventTranslatorTest.cpp b/Utilities/TemplateTranslatorTest/pqTemplateEventTranslatorTest.cpp index 4e9b414..531c2b1 100644 --- a/Utilities/TemplateTranslatorTest/pqTemplateEventTranslatorTest.cpp +++ b/Utilities/TemplateTranslatorTest/pqTemplateEventTranslatorTest.cpp @@ -1,33 +1,6 @@ -/*========================================================================= - - Program: ParaView - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause // Qt includes #include diff --git a/pq3DViewEventPlayer.cxx b/pq3DViewEventPlayer.cxx index 5be26b8..75304e1 100644 --- a/pq3DViewEventPlayer.cxx +++ b/pq3DViewEventPlayer.cxx @@ -1,41 +1,12 @@ -/*========================================================================= - - Program: ParaView - Module: pq3DViewEventPlayer.cxx - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ - +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #include "pq3DViewEventPlayer.h" #include #include #include -#include +#include #include #include @@ -53,23 +24,25 @@ bool pq3DViewEventPlayer::playEvent( { if (Command == "mousePress" || Command == "mouseRelease" || Command == "mouseMove") { - QRegExp mouseRegExp("\\(([^,]*),([^,]*),([^,]),([^,]),([^,]*)\\)"); - if (mouseRegExp.indexIn(Arguments) != -1) + QRegularExpression mouseRegExp("\\(([^,]*),([^,]*),([^,]),([^,]),([^,]*)\\)"); + QRegularExpressionMatch match = mouseRegExp.match(Arguments); + if (match.hasMatch()) { - QVariant v = mouseRegExp.cap(1); + QVariant v = match.captured(1); int x = static_cast(v.toDouble() * widget->size().width()); - v = mouseRegExp.cap(2); + v = match.captured(2); int y = static_cast(v.toDouble() * widget->size().height()); - v = mouseRegExp.cap(3); + v = match.captured(3); Qt::MouseButton button = static_cast(v.toInt()); - v = mouseRegExp.cap(4); + v = match.captured(4); Qt::MouseButtons buttons = static_cast(v.toInt()); - v = mouseRegExp.cap(5); + v = match.captured(5); Qt::KeyboardModifiers keym = static_cast(v.toInt()); QEvent::Type type = (Command == "mousePress") ? QEvent::MouseButtonPress : ((Command == "mouseMove") ? QEvent::MouseMove : QEvent::MouseButtonRelease); - QMouseEvent e(type, QPoint(x, y), button, buttons, keym); + QPoint pos(x, y); + QMouseEvent e(type, pos, widget->mapToGlobal(pos), button, buttons, keym); qApp->notify(Object, &e); } return true; diff --git a/pq3DViewEventPlayer.h b/pq3DViewEventPlayer.h index 6a4d118..959bb9c 100644 --- a/pq3DViewEventPlayer.h +++ b/pq3DViewEventPlayer.h @@ -1,35 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pq3DViewEventPlayer.h - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ - +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef _pq3DViewEventPlayer_h #define _pq3DViewEventPlayer_h diff --git a/pq3DViewEventTranslator.cxx b/pq3DViewEventTranslator.cxx index 4ab60a5..28803c0 100644 --- a/pq3DViewEventTranslator.cxx +++ b/pq3DViewEventTranslator.cxx @@ -1,35 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pq3DViewEventTranslator.cxx - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ - +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #include "pq3DViewEventTranslator.h" #include @@ -40,14 +11,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. pq3DViewEventTranslator::pq3DViewEventTranslator(const QByteArray& classname, QObject* p) : pqWidgetEventTranslator(p) , mClassType(classname) - , lastMoveEvent(QEvent::MouseButtonPress, QPoint(), Qt::MouseButton(), Qt::MouseButtons(), - Qt::KeyboardModifiers()) + , lastMoveEvent(QEvent::MouseButtonPress, QPoint(), QPoint(), Qt::MouseButton(), + Qt::MouseButtons(), Qt::KeyboardModifiers()) { } -pq3DViewEventTranslator::~pq3DViewEventTranslator() -{ -} +pq3DViewEventTranslator::~pq3DViewEventTranslator() {} bool pq3DViewEventTranslator::translateEvent(QObject* Object, QEvent* Event, bool& Error) { @@ -71,24 +40,33 @@ bool pq3DViewEventTranslator::translateEvent(QObject* Object, QEvent* Event, boo if (mouseEvent) { QSize size = widget->size(); - double normalized_x = mouseEvent->x() / static_cast(size.width()); - double normalized_y = mouseEvent->y() / static_cast(size.height()); +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + auto pos = mouseEvent->pos(); +#else + auto pos = mouseEvent->position().toPoint(); +#endif + double normalized_x = pos.x() / static_cast(size.width()); + double normalized_y = pos.y() / static_cast(size.height()); int button = mouseEvent->button(); int buttons = mouseEvent->buttons(); int modifiers = mouseEvent->modifiers(); - emit recordEvent(Object, "mousePress", QString("(%1,%2,%3,%4,%5)") - .arg(normalized_x) - .arg(normalized_y) - .arg(button) - .arg(buttons) - .arg(modifiers)); + Q_EMIT recordEvent(Object, "mousePress", + QString("(%1,%2,%3,%4,%5)") + .arg(normalized_x) + .arg(normalized_y) + .arg(button) + .arg(buttons) + .arg(modifiers)); } // reset lastMoveEvent - QMouseEvent e(QEvent::MouseButtonPress, QPoint(), Qt::MouseButton(), Qt::MouseButtons(), - Qt::KeyboardModifiers()); + QMouseEvent e(QEvent::MouseButtonPress, QPoint(), QPoint(), Qt::MouseButton(), + Qt::MouseButtons(), Qt::KeyboardModifiers()); +#if QT_VERSION < 0x060000 + // FIXME: QMouseEvent copy ctor is private in Qt6 lastMoveEvent = e; +#endif return true; break; } @@ -98,10 +76,18 @@ bool pq3DViewEventTranslator::translateEvent(QObject* Object, QEvent* Event, boo QMouseEvent* mouseEvent = dynamic_cast(Event); if (mouseEvent) { - QMouseEvent e(QEvent::MouseMove, QPoint(mouseEvent->x(), mouseEvent->y()), - mouseEvent->button(), mouseEvent->buttons(), mouseEvent->modifiers()); - +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + auto pos = mouseEvent->pos(); +#else + auto pos = mouseEvent->position().toPoint(); +#endif + QMouseEvent e(QEvent::MouseMove, pos, widget->mapToGlobal(pos), mouseEvent->button(), + mouseEvent->buttons(), mouseEvent->modifiers()); + +#if QT_VERSION < 0x060000 + // FIXME: QMouseEvent copy ctor is private in Qt6 lastMoveEvent = e; +#endif } return true; break; @@ -117,32 +103,44 @@ bool pq3DViewEventTranslator::translateEvent(QObject* Object, QEvent* Event, boo // record last move event if it is valid if (lastMoveEvent.type() == QEvent::MouseMove) { - double normalized_x = lastMoveEvent.x() / static_cast(size.width()); - double normalized_y = lastMoveEvent.y() / static_cast(size.height()); +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + auto pos = lastMoveEvent.pos(); +#else + auto pos = lastMoveEvent.position().toPoint(); +#endif + double normalized_x = pos.x() / static_cast(size.width()); + double normalized_y = pos.y() / static_cast(size.height()); int button = lastMoveEvent.button(); int buttons = lastMoveEvent.buttons(); int modifiers = lastMoveEvent.modifiers(); - emit recordEvent(Object, "mouseMove", QString("(%1,%2,%3,%4,%5)") - .arg(normalized_x) - .arg(normalized_y) - .arg(button) - .arg(buttons) - .arg(modifiers)); + Q_EMIT recordEvent(Object, "mouseMove", + QString("(%1,%2,%3,%4,%5)") + .arg(normalized_x) + .arg(normalized_y) + .arg(button) + .arg(buttons) + .arg(modifiers)); } - double normalized_x = mouseEvent->x() / static_cast(size.width()); - double normalized_y = mouseEvent->y() / static_cast(size.height()); +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + auto pos = mouseEvent->pos(); +#else + auto pos = mouseEvent->position().toPoint(); +#endif + double normalized_x = pos.x() / static_cast(size.width()); + double normalized_y = pos.y() / static_cast(size.height()); int button = mouseEvent->button(); int buttons = mouseEvent->buttons(); int modifiers = mouseEvent->modifiers(); - emit recordEvent(Object, "mouseRelease", QString("(%1,%2,%3,%4,%5)") - .arg(normalized_x) - .arg(normalized_y) - .arg(button) - .arg(buttons) - .arg(modifiers)); + Q_EMIT recordEvent(Object, "mouseRelease", + QString("(%1,%2,%3,%4,%5)") + .arg(normalized_x) + .arg(normalized_y) + .arg(button) + .arg(buttons) + .arg(modifiers)); } return true; break; @@ -159,7 +157,7 @@ bool pq3DViewEventTranslator::translateEvent(QObject* Object, QEvent* Event, boo .arg(ke->text()) .arg(ke->isAutoRepeat()) .arg(ke->count()); - emit recordEvent(Object, "keyEvent", data); + Q_EMIT recordEvent(Object, "keyEvent", data); return true; break; } diff --git a/pq3DViewEventTranslator.h b/pq3DViewEventTranslator.h index 9078859..be10c18 100644 --- a/pq3DViewEventTranslator.h +++ b/pq3DViewEventTranslator.h @@ -1,35 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pq3DViewEventTranslator.h - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ - +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef _pq3DViewEventTranslator_h #define _pq3DViewEventTranslator_h diff --git a/pqAbstractActivateEventPlayer.cxx b/pqAbstractActivateEventPlayer.cxx index 5e9c8b4..12cceff 100644 --- a/pqAbstractActivateEventPlayer.cxx +++ b/pqAbstractActivateEventPlayer.cxx @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqAbstractActivateEventPlayer.cxx - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #include "pqAbstractActivateEventPlayer.h" @@ -163,7 +135,7 @@ QAction* pqAbstractActivateEventPlayer::findAction(QMenuBar* p, const QString& n { QList actions = p->actions(); QAction* action = NULL; - foreach (QAction* a, actions) + Q_FOREACH (QAction* a, actions) { if (a->menu()->objectName() == name) { @@ -174,7 +146,7 @@ QAction* pqAbstractActivateEventPlayer::findAction(QMenuBar* p, const QString& n if (!action) { - foreach (QAction* a, actions) + Q_FOREACH (QAction* a, actions) { if (a->text() == name) { @@ -192,7 +164,7 @@ QAction* pqAbstractActivateEventPlayer::findAction(QMenu* p, const QString& name QStringList checked; QList actions = p->actions(); QAction* action = NULL; - foreach (QAction* a, actions) + Q_FOREACH (QAction* a, actions) { checked.append(a->objectName()); if (checked.back() == name) @@ -204,7 +176,7 @@ QAction* pqAbstractActivateEventPlayer::findAction(QMenu* p, const QString& name if (!action) { - foreach (QAction* a, actions) + Q_FOREACH (QAction* a, actions) { checked.append(a->text()); if (checked.back() == name) diff --git a/pqAbstractActivateEventPlayer.h b/pqAbstractActivateEventPlayer.h index 7be6407..d26bebf 100644 --- a/pqAbstractActivateEventPlayer.h +++ b/pqAbstractActivateEventPlayer.h @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqAbstractActivateEventPlayer.h - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef _pqAbstractActivateEventPlayer_h #define _pqAbstractActivateEventPlayer_h diff --git a/pqAbstractBooleanEventPlayer.cxx b/pqAbstractBooleanEventPlayer.cxx index b90ea19..de37715 100644 --- a/pqAbstractBooleanEventPlayer.cxx +++ b/pqAbstractBooleanEventPlayer.cxx @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqAbstractBooleanEventPlayer.cxx - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #include "pqAbstractBooleanEventPlayer.h" diff --git a/pqAbstractBooleanEventPlayer.h b/pqAbstractBooleanEventPlayer.h index 7362651..90a6fd8 100644 --- a/pqAbstractBooleanEventPlayer.h +++ b/pqAbstractBooleanEventPlayer.h @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqAbstractBooleanEventPlayer.h - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef _pqAbstractBooleanEventPlayer_h #define _pqAbstractBooleanEventPlayer_h diff --git a/pqAbstractButtonEventTranslator.cxx b/pqAbstractButtonEventTranslator.cxx index 6d14ffa..d90eab8 100644 --- a/pqAbstractButtonEventTranslator.cxx +++ b/pqAbstractButtonEventTranslator.cxx @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqAbstractButtonEventTranslator.cxx - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #include "pqAbstractButtonEventTranslator.h" @@ -36,6 +8,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include #include #include #include @@ -53,11 +26,6 @@ bool pqAbstractButtonEventTranslator::translateEvent(QObject* Object, QEvent* Ev { return false; } - QPushButton* pushButton = qobject_cast(object); - QToolButton* toolButton = qobject_cast(object); - bool withMenu = (pushButton && pushButton->menu()) || - (toolButton && (toolButton->menu() || - toolButton->defaultAction() && toolButton->defaultAction()->menu())); switch (Event->type()) { case QEvent::KeyPress: @@ -90,7 +58,7 @@ bool pqAbstractButtonEventTranslator::translateEvent(QObject* Object, QEvent* Ev QToolButton* tButton = qobject_cast(object); if (tButton && tButton->popupMode() == QToolButton::DelayedPopup) { - emit recordEvent(object, "longActivate", ""); + Q_EMIT recordEvent(object, "longActivate", ""); // Tell comming mouse button release to not record activate. this->LastMouseEventType = QEvent::None; } @@ -129,11 +97,11 @@ void pqAbstractButtonEventTranslator::onActivate(QAbstractButton* actualObject) if (actualObject->isCheckable()) { const bool new_value = !actualObject->isChecked(); - emit recordEvent(object, "set_boolean", new_value ? "true" : "false"); + Q_EMIT recordEvent(object, "set_boolean", new_value ? "true" : "false"); } else { - emit recordEvent(object, "activate", ""); + Q_EMIT recordEvent(object, "activate", ""); } } diff --git a/pqAbstractButtonEventTranslator.h b/pqAbstractButtonEventTranslator.h index 9929ec2..f66f57f 100644 --- a/pqAbstractButtonEventTranslator.h +++ b/pqAbstractButtonEventTranslator.h @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqAbstractButtonEventTranslator.h - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef _pqAbstractButtonEventTranslator_h #define _pqAbstractButtonEventTranslator_h diff --git a/pqAbstractDoubleEventPlayer.cxx b/pqAbstractDoubleEventPlayer.cxx index 272b7d7..990ce25 100644 --- a/pqAbstractDoubleEventPlayer.cxx +++ b/pqAbstractDoubleEventPlayer.cxx @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqAbstractDoubleEventPlayer.cxx - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #include "pqAbstractDoubleEventPlayer.h" diff --git a/pqAbstractDoubleEventPlayer.h b/pqAbstractDoubleEventPlayer.h index e149f2f..d699efb 100644 --- a/pqAbstractDoubleEventPlayer.h +++ b/pqAbstractDoubleEventPlayer.h @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqAbstractDoubleEventPlayer.h - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef _pqAbstractDoubleEventPlayer_h #define _pqAbstractDoubleEventPlayer_h diff --git a/pqAbstractIntEventPlayer.cxx b/pqAbstractIntEventPlayer.cxx index d16428f..baebdd1 100644 --- a/pqAbstractIntEventPlayer.cxx +++ b/pqAbstractIntEventPlayer.cxx @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqAbstractIntEventPlayer.cxx - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #include "pqAbstractIntEventPlayer.h" diff --git a/pqAbstractIntEventPlayer.h b/pqAbstractIntEventPlayer.h index 533d940..c0dba1e 100644 --- a/pqAbstractIntEventPlayer.h +++ b/pqAbstractIntEventPlayer.h @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqAbstractIntEventPlayer.h - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef _pqAbstractIntEventPlayer_h #define _pqAbstractIntEventPlayer_h diff --git a/pqAbstractItemViewEventPlayer.cxx b/pqAbstractItemViewEventPlayer.cxx index 95860b0..29c4d8c 100644 --- a/pqAbstractItemViewEventPlayer.cxx +++ b/pqAbstractItemViewEventPlayer.cxx @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqAbstractItemViewEventPlayer.cxx - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #include "pqAbstractItemViewEventPlayer.h" @@ -48,7 +20,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /// Converts a string representation of a model index into the real thing static QModelIndex OldGetIndex(QAbstractItemView& View, const QString& Name) { +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + QStringList rows = Name.split('/', Qt::SkipEmptyParts); +#else QStringList rows = Name.split('/', QString::SkipEmptyParts); +#endif QString column; if (rows.size()) @@ -88,7 +64,11 @@ static QModelIndex GetIndexByItemName(QAbstractItemView& View, const QString& Na static QModelIndex GetIndex(QAbstractItemView* View, const QString& Name) { +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + QStringList idxs = Name.split('/', Qt::SkipEmptyParts); +#else QStringList idxs = Name.split('/', QString::SkipEmptyParts); +#endif QModelIndex index; for (int i = 0; i != idxs.size(); ++i) @@ -200,7 +180,8 @@ bool pqAbstractItemViewEventPlayer::playEvent( if (Command == "mouseWheel") { int delta = args[0].toInt(); - QWheelEvent we(QPoint(x, y), delta, buttons, keym); + QWheelEvent we(QPointF(x, y), QPointF(x, y), QPoint(0, 0), QPoint(0, delta), buttons, keym, + Qt::NoScrollPhase, false); QCoreApplication::sendEvent(Object, &we); return true; } @@ -209,7 +190,7 @@ bool pqAbstractItemViewEventPlayer::playEvent( type = Command == "mouseMove" ? QEvent::MouseMove : type; type = Command == "mouseRelease" ? QEvent::MouseButtonRelease : type; type = Command == "mouseDblClick" ? QEvent::MouseButtonDblClick : type; - QMouseEvent e(type, pt, button, buttons, keym); + QMouseEvent e(type, pt, object->mapToGlobal(pt), button, buttons, keym); qApp->notify(object->viewport(), &e); return true; } diff --git a/pqAbstractItemViewEventPlayer.h b/pqAbstractItemViewEventPlayer.h index f6e2640..dbf0d5b 100644 --- a/pqAbstractItemViewEventPlayer.h +++ b/pqAbstractItemViewEventPlayer.h @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqAbstractItemViewEventPlayer.h - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef _pqAbstractItemViewEventPlayer_h #define _pqAbstractItemViewEventPlayer_h diff --git a/pqAbstractItemViewEventPlayerBase.cxx b/pqAbstractItemViewEventPlayerBase.cxx index 975da39..d3df7bc 100644 --- a/pqAbstractItemViewEventPlayerBase.cxx +++ b/pqAbstractItemViewEventPlayerBase.cxx @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqAbstractItemViewEventPlayerBase.cxx - - Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #include "pqAbstractItemViewEventPlayerBase.h" #include "pqEventTypes.h" @@ -37,6 +9,31 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include + +namespace +{ +int findSection(QAbstractItemModel* model, const QString& label, Qt::Orientation orientation, + int role = Qt::DisplayRole) +{ + QStringList currentHeaders; + const int max = orientation == Qt::Horizontal ? model->columnCount() : model->rowCount(); + for (int section = 0; section < max; ++section) + { + auto data = model->headerData(section, orientation, role).toString(); + currentHeaders.push_back(data); + if (data == label) + { + return section; + } + } + + qCritical() << "No header labeled '" << label << "' was found. " + << "Available values are " << currentHeaders; + return -1; +} + +} // end of namespace //----------------------------------------------------------------------------- pqAbstractItemViewEventPlayerBase::pqAbstractItemViewEventPlayerBase(QObject* parentObject) @@ -45,9 +42,7 @@ pqAbstractItemViewEventPlayerBase::pqAbstractItemViewEventPlayerBase(QObject* pa } //----------------------------------------------------------------------------- -pqAbstractItemViewEventPlayerBase::~pqAbstractItemViewEventPlayerBase() -{ -} +pqAbstractItemViewEventPlayerBase::~pqAbstractItemViewEventPlayerBase() {} //----------------------------------------------------------------------------- QModelIndex pqAbstractItemViewEventPlayerBase::GetIndex( @@ -57,19 +52,45 @@ QModelIndex pqAbstractItemViewEventPlayerBase::GetIndex( int sep = itemStr.indexOf(","); QString strIndex = itemStr.left(sep); - // Recover model index - QStringList indices = strIndex.split(".", QString::SkipEmptyParts); - QModelIndex index; - if (indices.size() < 2) +// Recover model index +#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) + const QStringList indices = strIndex.split(".", Qt::SkipEmptyParts); +#else + const QStringList indices = strIndex.split(".", QString::SkipEmptyParts); +#endif + if (indices.isEmpty() || (indices.size() % 2 != 0)) // indices are in pairs (row, column). { error = true; - return index; + qCritical() << "ERROR: Incorrect number of values in index! Cannot playback."; + return QModelIndex(); + } + + QList iIndices; + auto model = abstractItemView->model(); + + // indices may be simply ints or strings. If not ints, then assume strings that + // represent row or column name. + for (int cc = 0; cc < indices.size(); ++cc) + { + bool ok; + int index = indices[cc].toInt(&ok); + if (!ok) + { + // must be a string that represents the row/column name. determine the index. + index = ::findSection(model, indices[cc], (cc % 2 == 0) ? Qt::Vertical : Qt::Horizontal); + if (index == -1) + { + error = true; + return QModelIndex(); + } + } + iIndices.push_back(index); } - index = abstractItemView->model()->index(indices[0].toInt(), indices[1].toInt(), index); - for (int cc = 2; (cc + 1) < indices.size(); cc += 2) + QModelIndex index; + for (int cc = 0; (cc + 1) < iIndices.size(); cc += 2) { - index = abstractItemView->model()->index(indices[cc].toInt(), indices[cc + 1].toInt(), index); + index = abstractItemView->model()->index(iIndices[cc], iIndices[cc + 1], /*parent=*/index); if (!index.isValid()) { error = true; @@ -84,6 +105,8 @@ QModelIndex pqAbstractItemViewEventPlayerBase::GetIndex( //----------------------------------------------------------------------------- QString pqAbstractItemViewEventPlayerBase::GetDataString(const QString& itemStr, bool& error) { + Q_UNUSED(error); + // Get only the "data" part of the string int sep = itemStr.indexOf(","); return itemStr.mid(sep + 1); @@ -113,11 +136,12 @@ bool pqAbstractItemViewEventPlayerBase::playEvent( return false; } - QRegExp regExp1("^([\\d\\.]+),(\\d+)$"); - if (command == "setCheckState" && regExp1.indexIn(arguments) != -1) + QRegularExpression regExp1("^([\\d\\.]+),(\\d+)$"); + QRegularExpressionMatch match = regExp1.match(arguments); + if (command == "setCheckState" && match.hasMatch()) { - QString strIndex = regExp1.cap(1); - int check_state = regExp1.cap(2).toInt(); + QString strIndex = match.captured(1); + int check_state = match.captured(2).toInt(); QModelIndex index = pqAbstractItemViewEventPlayerBase::GetIndex(strIndex, abstractItemView, error); @@ -221,42 +245,38 @@ bool pqAbstractItemViewEventPlayerBase::playEvent( } // shouldn't have to check selectionMode - single or multi enforced when recorded. auto selMode = abstractItemView->selectionMode(); - if (QAbstractItemView::SingleSelection == selMode || - QAbstractItemView::NoSelection == selMode) + if (QAbstractItemView::NoSelection == selMode) { - qCritical() << "ERROR: Multi-select on ItemView with no- or single-select mode :" - << selMode; + qCritical() << "ERROR: Multi-select on ItemView with no-select mode :" << selMode; return true; } if (strIndexList.isEmpty()) { abstractItemView->clearSelection(); + return true; } - else + + QModelIndex topLeft, bottomRight; + QItemSelection selection; + // don't reset the selection - setCurrent does that, and is always recorded first. + for (int i = 0; i < indexList.size(); i += 2) { - bool first = true; - QModelIndex topLeft, bottomRight; - QItemSelection selection; - // don't reset the selection - setCurrent does that, and is always recorded first. - for (int i = 0; i < indexList.size(); i += 2) + // ranges are recorded in pairs, topLeft -> bottomRight, but to a flat list for + // simplicity. + topLeft = + pqAbstractItemViewEventPlayerBase::GetIndex(indexList.at(i), abstractItemView, error); + bottomRight = + pqAbstractItemViewEventPlayerBase::GetIndex(indexList.at(i + 1), abstractItemView, error); + if (error) { - // ranges are recorded in pairs, topLeft -> bottomRight, but to a flat list for - // simplicity. - topLeft = - pqAbstractItemViewEventPlayerBase::GetIndex(indexList.at(i), abstractItemView, error); - bottomRight = pqAbstractItemViewEventPlayerBase::GetIndex( - indexList.at(i + 1), abstractItemView, error); - if (error) - { - return true; - } - QItemSelection itemSel(topLeft, bottomRight); - // merge allows a single selection to contain multiple ranges. - selection.merge(itemSel, QItemSelectionModel::Select); + return true; } - selModel->select(selection, selFlag); + QItemSelection itemSel(topLeft, bottomRight); + // merge allows a single selection to contain multiple ranges. + selection.merge(itemSel, QItemSelectionModel::Select); } + selModel->select(selection, selFlag); return true; } else if (command == "openContextMenu") diff --git a/pqAbstractItemViewEventPlayerBase.h b/pqAbstractItemViewEventPlayerBase.h index fee3ff4..1bdad8f 100644 --- a/pqAbstractItemViewEventPlayerBase.h +++ b/pqAbstractItemViewEventPlayerBase.h @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqAbstractItemViewEventPlayerBase.h - - Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef __pqAbstractItemViewEventPlayerBase_h #define __pqAbstractItemViewEventPlayerBase_h diff --git a/pqAbstractItemViewEventTranslator.cxx b/pqAbstractItemViewEventTranslator.cxx index 7fbcc7d..31b1d44 100644 --- a/pqAbstractItemViewEventTranslator.cxx +++ b/pqAbstractItemViewEventTranslator.cxx @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqAbstractItemViewEventTranslator.cxx - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #include "pqAbstractItemViewEventTranslator.h" @@ -84,7 +56,7 @@ bool pqAbstractItemViewEventTranslator::translateEvent(QObject* Object, QEvent* .arg(ke->text()) .arg(ke->isAutoRepeat()) .arg(ke->count()); - emit recordEvent(object, "keyEvent", data); + Q_EMIT recordEvent(object, "keyEvent", data); return true; } case QEvent::MouseButtonPress: @@ -125,19 +97,19 @@ bool pqAbstractItemViewEventTranslator::translateEvent(QObject* Object, QEvent* .arg(idxStr); if (Event->type() == QEvent::MouseButtonPress) { - emit recordEvent(object, "mousePress", info); + Q_EMIT recordEvent(object, "mousePress", info); } else if (Event->type() == QEvent::MouseButtonDblClick) { - emit recordEvent(object, "mouseDblClick", info); + Q_EMIT recordEvent(object, "mouseDblClick", info); } else if (Event->type() == QEvent::MouseButtonRelease) { if (this->LastPos != mouseEvent->pos()) { - emit recordEvent(object, "mouseMove", info); + Q_EMIT recordEvent(object, "mouseMove", info); } - emit recordEvent(object, "mouseRelease", info); + Q_EMIT recordEvent(object, "mouseRelease", info); } return true; break; @@ -153,20 +125,29 @@ bool pqAbstractItemViewEventTranslator::translateEvent(QObject* Object, QEvent* if (wheelEvent) { QString idxStr; +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + QModelIndex idx = object->indexAt(wheelEvent->position().toPoint()); +#else QModelIndex idx = object->indexAt(wheelEvent->pos()); +#endif idxStr = toIndexStr(idx); QRect r = object->visualRect(idx); +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + relPt = wheelEvent->position().toPoint() - r.topLeft(); +#else relPt = wheelEvent->pos() - r.topLeft(); - int numStep = wheelEvent->delta() > 0 ? 120 : -120; +#endif + int numStep = wheelEvent->angleDelta().y() > 0 ? 120 : -120; int buttons = wheelEvent->buttons(); int modifiers = wheelEvent->modifiers(); - emit emit recordEvent(Object, "mouseWheel", QString("%1,%2,%3,%4,%5") - .arg(numStep) - .arg(buttons) - .arg(modifiers) - .arg(relPt.x()) - .arg(relPt.y()) - .arg(idxStr)); + Q_EMIT recordEvent(Object, "mouseWheel", + QString("%1,%2,%3,%4,%5") + .arg(numStep) + .arg(buttons) + .arg(modifiers) + .arg(relPt.x()) + .arg(relPt.y()) + .arg(idxStr)); } return true; break; diff --git a/pqAbstractItemViewEventTranslator.h b/pqAbstractItemViewEventTranslator.h index b103d49..7d4e456 100644 --- a/pqAbstractItemViewEventTranslator.h +++ b/pqAbstractItemViewEventTranslator.h @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqAbstractItemViewEventTranslator.h - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef _pqAbstractItemViewEventTranslator_h #define _pqAbstractItemViewEventTranslator_h diff --git a/pqAbstractItemViewEventTranslatorBase.cxx b/pqAbstractItemViewEventTranslatorBase.cxx index 8cd14b7..391acac 100644 --- a/pqAbstractItemViewEventTranslatorBase.cxx +++ b/pqAbstractItemViewEventTranslatorBase.cxx @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqAbstractItemViewEventTranslatorBase.cxx - - Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #include "pqAbstractItemViewEventTranslatorBase.h" #include "pqEventTypes.h" @@ -37,6 +9,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include //----------------------------------------------------------------------------- pqAbstractItemViewEventTranslatorBase::pqAbstractItemViewEventTranslatorBase(QObject* parentObject) @@ -90,7 +63,7 @@ bool pqAbstractItemViewEventTranslatorBase::translateEvent( { QVariant value = abstractItemView->model()->data(index); this->Editing = false; - emit this->recordEvent(abstractItemView, "editAccepted", + Q_EMIT this->recordEvent(abstractItemView, "editAccepted", QString("%1,%2").arg(indexString, value.toString())); return true; break; @@ -98,7 +71,7 @@ bool pqAbstractItemViewEventTranslatorBase::translateEvent( if (ke->key() == Qt::Key_Escape) { this->Editing = false; - emit this->recordEvent(abstractItemView, "editCancel", indexString); + Q_EMIT this->recordEvent(abstractItemView, "editCancel", indexString); return true; break; } @@ -106,7 +79,7 @@ bool pqAbstractItemViewEventTranslatorBase::translateEvent( else if (ke->key() == Qt::Key_F2) { this->Editing = true; - emit this->recordEvent(abstractItemView, "edit", indexString); + Q_EMIT this->recordEvent(abstractItemView, "edit", indexString); return true; break; } @@ -127,7 +100,7 @@ bool pqAbstractItemViewEventTranslatorBase::translateEvent( case QEvent::ContextMenu: { auto contextMenuEvent = dynamic_cast(event); - emit this->recordEvent(abstractItemView, "openContextMenu", + Q_EMIT this->recordEvent(abstractItemView, "openContextMenu", this->getIndexAsString(abstractItemView->indexAt(contextMenuEvent->pos()))); return true; } @@ -179,7 +152,7 @@ bool pqAbstractItemViewEventTranslatorBase::translateEvent( if (this->ModelItemCheck != NULL) { QString indexString = this->getIndexAsString(*this->ModelItemCheck); - emit this->recordEvent(abstractItemView, "modelItemData", + Q_EMIT this->recordEvent(abstractItemView, "modelItemData", QString("%1,%2") .arg(indexString) .arg( @@ -190,7 +163,7 @@ bool pqAbstractItemViewEventTranslatorBase::translateEvent( // Abstract Item View nb row check else { - emit this->recordEvent(abstractItemView, "modelRowCount", + Q_EMIT this->recordEvent(abstractItemView, "modelRowCount", QString::number(abstractItemView->model()->rowCount()), pqEventTypes::CHECK_EVENT); } return true; @@ -220,7 +193,8 @@ void pqAbstractItemViewEventTranslatorBase::monitorSignals(QAbstractItemView* ab } // If no model has been set yet, there will be no selectionModel - if (auto selectionModel = abstractItemView->selectionModel(); selectionModel) + auto selectionModel = abstractItemView->selectionModel(); + if (selectionModel) { if (selectionModel != this->ItemSelectionModel) { @@ -249,7 +223,7 @@ void pqAbstractItemViewEventTranslatorBase::onClicked(const QModelIndex& index) if ((index.model()->flags(index) & Qt::ItemIsUserCheckable) != 0) { // record the check state change if the item is user-checkable. - emit this->recordEvent(abstractItemView, "setCheckState", + Q_EMIT this->recordEvent(abstractItemView, "setCheckState", QString("%1,%3") .arg(indexString) .arg(index.model()->data(index, Qt::CheckStateRole).toInt())); @@ -259,7 +233,7 @@ void pqAbstractItemViewEventTranslatorBase::onClicked(const QModelIndex& index) index == oldIndex) { this->Editing = true; - emit this->recordEvent(abstractItemView, "edit", indexString); + Q_EMIT this->recordEvent(abstractItemView, "edit", indexString); } oldIndex = index; } @@ -269,7 +243,7 @@ void pqAbstractItemViewEventTranslatorBase::onActivated(const QModelIndex& index { QAbstractItemView* abstractItemView = qobject_cast(this->sender()); QString indexString = this->getIndexAsString(index); - emit this->recordEvent(abstractItemView, "activate", indexString); + Q_EMIT this->recordEvent(abstractItemView, "activate", indexString); } //----------------------------------------------------------------------------- @@ -281,8 +255,8 @@ void pqAbstractItemViewEventTranslatorBase::onDoubleClicked(const QModelIndex& i QAbstractItemView::DoubleClicked) { this->Editing = true; - emit this->recordEvent(abstractItemView, "doubleClick", indexString); - emit this->recordEvent(abstractItemView, "edit", indexString); + Q_EMIT this->recordEvent(abstractItemView, "doubleClick", indexString); + Q_EMIT this->recordEvent(abstractItemView, "edit", indexString); } } @@ -316,12 +290,14 @@ QString pqAbstractItemViewEventTranslatorBase::getIndicesAsString( //----------------------------------------------------------------------------- void pqAbstractItemViewEventTranslatorBase::onCurrentChanged(const QModelIndex& index) { - emit this->recordEvent(this->AbstractItemView, "setCurrent", this->getIndexAsString(index)); + Q_EMIT this->recordEvent(this->AbstractItemView, "setCurrent", this->getIndexAsString(index)); } //----------------------------------------------------------------------------- void pqAbstractItemViewEventTranslatorBase::onSelectionChanged(const QItemSelection& selected) { + Q_UNUSED(selected); + // see if the view supports multi-select auto selMode = this->AbstractItemView->selectionMode(); if (!(QAbstractItemView::SingleSelection == selMode || QAbstractItemView::NoSelection == selMode)) @@ -339,7 +315,7 @@ void pqAbstractItemViewEventTranslatorBase::onSelectionChanged(const QItemSelect selectedIndices.push_back(selRange.bottomRight()); } - emit this->recordEvent( + Q_EMIT this->recordEvent( this->AbstractItemView, "setSelection", this->getIndicesAsString(selectedIndices)); } } @@ -348,5 +324,5 @@ void pqAbstractItemViewEventTranslatorBase::onSelectionChanged(const QItemSelect void pqAbstractItemViewEventTranslatorBase::onViewportEnteredCheck() { this->ModelItemCheck = NULL; - emit this->specificOverlay(this->AbstractItemView->rect()); + Q_EMIT this->specificOverlay(this->AbstractItemView->rect()); } diff --git a/pqAbstractItemViewEventTranslatorBase.h b/pqAbstractItemViewEventTranslatorBase.h index a9dc4b2..73c4db6 100644 --- a/pqAbstractItemViewEventTranslatorBase.h +++ b/pqAbstractItemViewEventTranslatorBase.h @@ -1,40 +1,13 @@ -/*========================================================================= - - Program: ParaView - Module: pqAbstractItemViewEventTranslatorBase.h - - Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef __pqAbstractItemViewEventTranslatorBase_h #define __pqAbstractItemViewEventTranslatorBase_h #include "pqWidgetEventTranslator.h" #include // for QModelIndexList #include +#include class QModelIndex; class QAbstractItemView; @@ -60,7 +33,7 @@ class QTTESTING_EXPORT pqAbstractItemViewEventTranslatorBase : public pqWidgetEv /// find and set the corrected abstract item view virtual QAbstractItemView* findCorrectedAbstractItemView(QObject* object) const = 0; -protected slots: +protected Q_SLOTS: virtual void onClicked(const QModelIndex&); virtual void onActivated(const QModelIndex&); virtual void onDoubleClicked(const QModelIndex&); @@ -81,7 +54,10 @@ protected slots: /// Subclasses (pqTreeViewEventTranslator, possibly others) override this to monitor /// additional view specific signals - virtual void monitorSignalsInternal(QAbstractItemView* abstractItemView) {} + virtual void monitorSignalsInternal(QAbstractItemView* abstractItemView) + { + Q_UNUSED(abstractItemView); + } QPointer AbstractItemView; QPointer ItemSelectionModel; diff --git a/pqAbstractMiscellaneousEventPlayer.cxx b/pqAbstractMiscellaneousEventPlayer.cxx index 18eaf53..b7e82fc 100644 --- a/pqAbstractMiscellaneousEventPlayer.cxx +++ b/pqAbstractMiscellaneousEventPlayer.cxx @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqAbstractMiscellaneousEventPlayer.cxx - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #include "pqAbstractMiscellaneousEventPlayer.h" @@ -38,6 +10,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include "pqEventDispatcher.h" +#include "pqTestUtility.h" // Class that encapsulates the protected function QThread::msleep class SleeperThread : public QThread @@ -51,8 +24,10 @@ class SleeperThread : public QThread } }; -pqAbstractMiscellaneousEventPlayer::pqAbstractMiscellaneousEventPlayer(QObject* p) +pqAbstractMiscellaneousEventPlayer::pqAbstractMiscellaneousEventPlayer( + pqTestUtility* util, QObject* p) : pqWidgetEventPlayer(p) + , TestUtility(util) { } @@ -84,5 +59,11 @@ bool pqAbstractMiscellaneousEventPlayer::playEvent( } return true; } + if (Command == "dashboard_mode") + { + bool toggle = QVariant(Arguments).toBool(); + this->TestUtility->setDashboardMode(toggle); + return true; + } return false; } diff --git a/pqAbstractMiscellaneousEventPlayer.h b/pqAbstractMiscellaneousEventPlayer.h index bd1602a..9c2fde2 100644 --- a/pqAbstractMiscellaneousEventPlayer.h +++ b/pqAbstractMiscellaneousEventPlayer.h @@ -1,40 +1,14 @@ -/*========================================================================= - - Program: ParaView - Module: pqAbstractMiscellaneousEventPlayer.h - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef _pqAbstractMiscellaneousEventPlayer_h #define _pqAbstractMiscellaneousEventPlayer_h #include "pqWidgetEventPlayer.h" +class pqTestUtility; + /// Event playback handler for a collection of miscellaneous commands. /// For these events, the "object" on which the event is triggered is generally /// immaterial. @@ -49,13 +23,16 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /// the test playback. Unlike "pause" however, this will continue /// to process all events arising in the application e.g. /// responding to timer events. +/// \li \c dashboard_mode: trigger a call to pqTestUtility::setDashboardMode with the +/// provided argument. + class QTTESTING_EXPORT pqAbstractMiscellaneousEventPlayer : public pqWidgetEventPlayer { Q_OBJECT typedef pqWidgetEventPlayer Superclass; public: - pqAbstractMiscellaneousEventPlayer(QObject* p = 0); + pqAbstractMiscellaneousEventPlayer(pqTestUtility* util, QObject* p = 0); using Superclass::playEvent; bool playEvent( @@ -64,6 +41,8 @@ class QTTESTING_EXPORT pqAbstractMiscellaneousEventPlayer : public pqWidgetEvent private: pqAbstractMiscellaneousEventPlayer(const pqAbstractMiscellaneousEventPlayer&); pqAbstractMiscellaneousEventPlayer& operator=(const pqAbstractMiscellaneousEventPlayer&); + + pqTestUtility* TestUtility = nullptr; }; #endif // !_pqAbstractMiscellaneousEventPlayer_h diff --git a/pqAbstractSliderEventTranslator.cxx b/pqAbstractSliderEventTranslator.cxx index bcee5cf..40e8d59 100644 --- a/pqAbstractSliderEventTranslator.cxx +++ b/pqAbstractSliderEventTranslator.cxx @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqAbstractSliderEventTranslator.cxx - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #include "pqAbstractSliderEventTranslator.h" @@ -68,5 +40,5 @@ bool pqAbstractSliderEventTranslator::translateEvent(QObject* Object, QEvent* Ev void pqAbstractSliderEventTranslator::onValueChanged(int Value) { - emit recordEvent(this->CurrentObject, "set_int", QString().setNum(Value)); + Q_EMIT recordEvent(this->CurrentObject, "set_int", QString().setNum(Value)); } diff --git a/pqAbstractSliderEventTranslator.h b/pqAbstractSliderEventTranslator.h index 5e6d48a..dffffaf 100644 --- a/pqAbstractSliderEventTranslator.h +++ b/pqAbstractSliderEventTranslator.h @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqAbstractSliderEventTranslator.h - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef _pqAbstractSliderEventTranslator_h #define _pqAbstractSliderEventTranslator_h @@ -58,7 +30,7 @@ class QTTESTING_EXPORT pqAbstractSliderEventTranslator : public pqWidgetEventTra QObject* CurrentObject; -private slots: +private Q_SLOTS: void onValueChanged(int); }; diff --git a/pqAbstractStringEventPlayer.cxx b/pqAbstractStringEventPlayer.cxx index 59353d6..51601b7 100644 --- a/pqAbstractStringEventPlayer.cxx +++ b/pqAbstractStringEventPlayer.cxx @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqAbstractStringEventPlayer.cxx - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #include "pqAbstractStringEventPlayer.h" diff --git a/pqAbstractStringEventPlayer.h b/pqAbstractStringEventPlayer.h index 2512948..02cc7e2 100644 --- a/pqAbstractStringEventPlayer.h +++ b/pqAbstractStringEventPlayer.h @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqAbstractStringEventPlayer.h - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef _pqAbstractStringEventPlayer_h #define _pqAbstractStringEventPlayer_h diff --git a/pqBasicWidgetEventPlayer.cxx b/pqBasicWidgetEventPlayer.cxx index caf51b6..dd556d2 100644 --- a/pqBasicWidgetEventPlayer.cxx +++ b/pqBasicWidgetEventPlayer.cxx @@ -1,142 +1,85 @@ -/*========================================================================= - - Program: ParaView - Module: pqBasicWidgetEventPlayer.cxx - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #include "pqBasicWidgetEventPlayer.h" #include #include #include -#include -#include "pqEventTypes.h" - -pqBasicWidgetEventPlayer::pqBasicWidgetEventPlayer(QObject* p) - : pqWidgetEventPlayer(p) +// ---------------------------------------------------------------------------- +pqBasicWidgetEventPlayer::pqBasicWidgetEventPlayer(QObject* parent) + : pqWidgetEventPlayer(parent) { } +// ---------------------------------------------------------------------------- bool pqBasicWidgetEventPlayer::playEvent( - QObject* object, const QString& command, const QString& arguments, int eventType, bool& error) + QObject* object, const QString& command, const QString& arguments, bool& error) { QWidget* widget = qobject_cast(object); if (widget) { - if (eventType == pqEventTypes::ACTION_EVENT) + if (command == "key") { - { - if (command == "key") - { - QKeyEvent kd(QEvent::KeyPress, arguments.toInt(), Qt::NoModifier); - QKeyEvent ku(QEvent::KeyRelease, arguments.toInt(), Qt::NoModifier); - qApp->notify(widget, &kd); - qApp->notify(widget, &ku); - return true; - } - else if (command == "keyEvent") - { - // The double split is for retrocompatibility - QStringList data = arguments.split(','); - if (data.size() != 6) - { - data = arguments.split(':'); - } - - if (data.size() == 6) - { - QKeyEvent ke(static_cast(data[0].toInt()), data[1].toInt(), - static_cast(data[2].toInt()), data[3], !!data[4].toInt(), - data[5].toInt()); - qApp->notify(widget, &ke); - return true; - } - } - else if (command.startsWith("mouse")) - { - QStringList args = arguments.split(','); - if (args.size() == 5) - { - Qt::MouseButtons buttons = static_cast(args[1].toInt()); - Qt::KeyboardModifiers keym = static_cast(args[2].toInt()); - int x = args[3].toInt(); - int y = args[4].toInt(); - QPoint pt(x, y); - if (command == "mouseWheel") - { - int delta = args[0].toInt(); - QWheelEvent we(QPoint(x, y), delta, buttons, keym); - QCoreApplication::sendEvent(object, &we); - return true; - } - Qt::MouseButton button = static_cast(args[0].toInt()); - QEvent::Type type = QEvent::MouseButtonPress; - type = command == "mouseMove" ? QEvent::MouseMove : type; - type = command == "mouseRelease" ? QEvent::MouseButtonRelease : type; - type = command == "mouseDblClick" ? QEvent::MouseButtonDblClick : type; - if (type == QEvent::MouseMove) - { - // We have not been setting mouse move correctly. - buttons = button; - button = Qt::NoButton; - } - QMouseEvent e(type, pt, button, buttons, keym); - qApp->notify(widget, &e); - return true; - } - } - } + QKeyEvent kd(QEvent::KeyPress, arguments.toInt(), Qt::NoModifier); + QKeyEvent ku(QEvent::KeyRelease, arguments.toInt(), Qt::NoModifier); + qApp->notify(widget, &kd); + qApp->notify(widget, &ku); + return true; } - else if (eventType == pqEventTypes::CHECK_EVENT) + else if (command == "keyEvent") { - // Recover QProperty - QVariant propertyValue = object->property(command.toUtf8().data()); + // The double split is for retrocompatibility + QStringList data = arguments.split(','); + if (data.size() != 6) + { + data = arguments.split(':'); + } - // Check it is valid - if (!propertyValue.isValid()) + if (data.size() == 6) { - QString errorMessage = object->objectName() + " has no valid property named:" + command; - qCritical() << errorMessage.toUtf8().data(); - error = true; + QKeyEvent ke(static_cast(data[0].toInt()), data[1].toInt(), + static_cast(data[2].toInt()), data[3], !!data[4].toInt(), + data[5].toInt()); + qApp->notify(widget, &ke); return true; } - - // Check property value - if (propertyValue.toString().replace("\t", " ") != arguments) + } + else if (command.startsWith("mouse")) + { + QStringList args = arguments.split(','); + if (args.size() == 5) { - QString errorMessage = object->objectName() + " property value is: " + - propertyValue.toString() + ". Expecting: " + arguments + "."; - qCritical() << errorMessage.toUtf8().data(); - error = true; + Qt::MouseButtons buttons = static_cast(args[1].toInt()); + Qt::KeyboardModifiers keym = static_cast(args[2].toInt()); + int x = args[3].toInt(); + int y = args[4].toInt(); + QPoint pt(x, y); + if (command == "mouseWheel") + { + int delta = args[0].toInt(); + QWheelEvent we(QPoint(x, y), QPoint(x, y), QPoint(0, 0), QPoint(0, delta), buttons, keym, + Qt::NoScrollPhase, false); + QCoreApplication::sendEvent(object, &we); + return true; + } + Qt::MouseButton button = static_cast(args[0].toInt()); + QEvent::Type type = QEvent::MouseButtonPress; + type = command == "mouseMove" ? QEvent::MouseMove : type; + type = command == "mouseRelease" ? QEvent::MouseButtonRelease : type; + type = command == "mouseDblClick" ? QEvent::MouseButtonDblClick : type; + if (type == QEvent::MouseMove) + { + // We have not been setting mouse move correctly. + buttons = button; + button = Qt::NoButton; + } + QMouseEvent e(type, pt, widget->mapToGlobal(pt), button, buttons, keym); + qApp->notify(widget, &e); + return true; } - return true; } } return this->Superclass::playEvent(object, command, arguments, error); diff --git a/pqBasicWidgetEventPlayer.h b/pqBasicWidgetEventPlayer.h index 0f6ec73..56fc9a4 100644 --- a/pqBasicWidgetEventPlayer.h +++ b/pqBasicWidgetEventPlayer.h @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqBasicWidgetEventPlayer.h - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef _pqBasicWidgetEventPlayer_h #define _pqBasicWidgetEventPlayer_h @@ -36,22 +8,20 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "pqWidgetEventPlayer.h" /** -Concrete implementation of pqWidgetEventPlayer that handles playback of "activate" events for -buttons and menus. - -\sa pqEventPlayer -*/ + * EventPlayer for QWidget to handles mouse and keyboard inputs. + */ class pqBasicWidgetEventPlayer : public pqWidgetEventPlayer { Q_OBJECT typedef pqWidgetEventPlayer Superclass; public: - pqBasicWidgetEventPlayer(QObject* p = 0); + pqBasicWidgetEventPlayer(QObject* parent = nullptr); using Superclass::playEvent; - bool playEvent(QObject* object, const QString& command, const QString& arguments, int eventType, - bool& error) override; + + bool playEvent( + QObject* object, const QString& command, const QString& arguments, bool& error) override; private: pqBasicWidgetEventPlayer(const pqBasicWidgetEventPlayer&); diff --git a/pqBasicWidgetEventTranslator.cxx b/pqBasicWidgetEventTranslator.cxx index 06ce15a..afdd360 100644 --- a/pqBasicWidgetEventTranslator.cxx +++ b/pqBasicWidgetEventTranslator.cxx @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqBasicWidgetEventTranslator.cxx - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #include "pqBasicWidgetEventTranslator.h" @@ -46,9 +18,7 @@ pqBasicWidgetEventTranslator::pqBasicWidgetEventTranslator(QObject* p) { } -pqBasicWidgetEventTranslator::~pqBasicWidgetEventTranslator() -{ -} +pqBasicWidgetEventTranslator::~pqBasicWidgetEventTranslator() {} bool pqBasicWidgetEventTranslator::translateEvent( QObject* object, QEvent* event, int eventType, bool& error) @@ -66,7 +36,7 @@ bool pqBasicWidgetEventTranslator::translateEvent( QKeyEvent* keyEvent = static_cast(event); if (qobject_cast(object)) { - emit recordEvent(widget, "key", QString::number(keyEvent->key())); + Q_EMIT recordEvent(widget, "key", QString::number(keyEvent->key())); } return true; break; @@ -76,12 +46,17 @@ bool pqBasicWidgetEventTranslator::translateEvent( case QEvent::MouseButtonRelease: { QMouseEvent* mouseEvent = static_cast(event); +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + auto pos = mouseEvent->pos(); +#else + auto pos = mouseEvent->position().toPoint(); +#endif QString info = QString("%1,%2,%3,%4,%5") .arg(mouseEvent->button()) .arg(mouseEvent->buttons()) .arg(mouseEvent->modifiers()) - .arg(mouseEvent->x()) - .arg(mouseEvent->y()); + .arg(pos.x()) + .arg(pos.y()); if (event->type() != QEvent::MouseButtonRelease) { @@ -90,19 +65,19 @@ bool pqBasicWidgetEventTranslator::translateEvent( if (event->type() == QEvent::MouseButtonPress) { - emit recordEvent(widget, "mousePress", info); + Q_EMIT recordEvent(widget, "mousePress", info); } if (event->type() == QEvent::MouseButtonDblClick) { - emit recordEvent(widget, "mouseDblClick", info); + Q_EMIT recordEvent(widget, "mouseDblClick", info); } else if (event->type() == QEvent::MouseButtonRelease) { if (this->LastPos != mouseEvent->pos()) { - emit recordEvent(widget, "mouseMove", info); + Q_EMIT recordEvent(widget, "mouseMove", info); } - emit recordEvent(widget, "mouseRelease", info); + Q_EMIT recordEvent(widget, "mouseRelease", info); } return true; break; @@ -116,13 +91,19 @@ bool pqBasicWidgetEventTranslator::translateEvent( { int buttons = wheelEvent->buttons(); int modifiers = wheelEvent->modifiers(); - int numStep = wheelEvent->delta(); - emit recordEvent(object, "mouseWheel", QString("%1,%2,%3,%4,%5") - .arg(numStep) - .arg(buttons) - .arg(modifiers) - .arg(wheelEvent->x()) - .arg(wheelEvent->y())); + int numStep = wheelEvent->angleDelta().y(); + Q_EMIT recordEvent(object, "mouseWheel", + QString("%1,%2,%3,%4,%5") + .arg(numStep) + .arg(buttons) + .arg(modifiers) +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + .arg(wheelEvent->position().x()) + .arg(wheelEvent->position().y())); +#else + .arg(wheelEvent->x()) + .arg(wheelEvent->y())); +#endif } } return true; @@ -137,11 +118,11 @@ bool pqBasicWidgetEventTranslator::translateEvent( if (event->type() == QEvent::MouseMove) { // Check for available meta prop - const QMetaProperty metaProp = widget->metaObject()->userProperty(); + QMetaProperty metaProp = widget->metaObject()->userProperty(); if (!metaProp.isValid() && qobject_cast(widget->parent()) != NULL) { // MouseEvent can be received by the viewport - const QMetaProperty metaProp = widget->parent()->metaObject()->userProperty(); + metaProp = widget->parent()->metaObject()->userProperty(); } if (metaProp.isValid()) { @@ -153,11 +134,11 @@ bool pqBasicWidgetEventTranslator::translateEvent( if (event->type() == QEvent::MouseButtonRelease) { // Generic Meta prop check - const QMetaProperty metaProp = widget->metaObject()->userProperty(); + QMetaProperty metaProp = widget->metaObject()->userProperty(); if (!metaProp.isValid() && widget->parent() != NULL) { // MouseEvent can be received by the viewport, so try the parent widget - const QMetaProperty metaProp = widget->parent()->metaObject()->userProperty(); + metaProp = widget->parent()->metaObject()->userProperty(); widget = qobject_cast(widget->parent()); } @@ -167,7 +148,7 @@ bool pqBasicWidgetEventTranslator::translateEvent( QString propName = metaProp.name(); // Record check event - emit recordEvent(widget, propName, + Q_EMIT recordEvent(widget, propName, widget->property(propName.toUtf8().data()).toString().replace("\t", " "), pqEventTypes::CHECK_EVENT); return true; diff --git a/pqBasicWidgetEventTranslator.h b/pqBasicWidgetEventTranslator.h index e41419d..dc142d5 100644 --- a/pqBasicWidgetEventTranslator.h +++ b/pqBasicWidgetEventTranslator.h @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqBasicWidgetEventTranslator.h - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef _pqBasicWidgetEventTranslator_h #define _pqBasicWidgetEventTranslator_h diff --git a/pqCheckEventOverlay.cxx b/pqCheckEventOverlay.cxx index e46027c..eebcda3 100644 --- a/pqCheckEventOverlay.cxx +++ b/pqCheckEventOverlay.cxx @@ -1,34 +1,6 @@ -/*========================================================================= - -Program: ParaView -Module: pqEventTranslator.cxx - -Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. -All rights reserved. - -ParaView is a free software; you can redistribute it and/or modify it -under the terms of the ParaView license version 1.2. - -See License_v1.2.txt for the full ParaView license. -A copy of this license can be obtained by contacting -Kitware Inc. -28 Corporate Drive -Clifton Park, NY 12065 -USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #include "pqCheckEventOverlay.h" diff --git a/pqCheckEventOverlay.h b/pqCheckEventOverlay.h index 6a8e50c..24c986c 100644 --- a/pqCheckEventOverlay.h +++ b/pqCheckEventOverlay.h @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqEventTranslator.h - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef _pqCheckEventOverlay_h #define _pqCheckEventOverlay_h diff --git a/pqComboBoxEventPlayer.cxx b/pqComboBoxEventPlayer.cxx index 395a2df..5a02149 100644 --- a/pqComboBoxEventPlayer.cxx +++ b/pqComboBoxEventPlayer.cxx @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqComboBoxEventPlayer.cxx - - Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #include "pqComboBoxEventPlayer.h" #include "pqEventTypes.h" #include "pqObjectNaming.h" @@ -43,9 +15,7 @@ pqComboBoxEventPlayer::pqComboBoxEventPlayer(QObject* parentObject) } //----------------------------------------------------------------------------- -pqComboBoxEventPlayer::~pqComboBoxEventPlayer() -{ -} +pqComboBoxEventPlayer::~pqComboBoxEventPlayer() {} //----------------------------------------------------------------------------- bool pqComboBoxEventPlayer::playEvent( @@ -67,7 +37,7 @@ bool pqComboBoxEventPlayer::playEvent( comboBox->setCurrentIndex(index); if (command == "activated") { - emit comboBox->activated(index); + Q_EMIT comboBox->activated(index); } } else if (comboBox->isEditable() && command == "editTextChanged") diff --git a/pqComboBoxEventPlayer.h b/pqComboBoxEventPlayer.h index 8e71f18..8786e35 100644 --- a/pqComboBoxEventPlayer.h +++ b/pqComboBoxEventPlayer.h @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqComboBoxEventPlayer.h - - Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef __pqComboBoxEventPlayer_h #define __pqComboBoxEventPlayer_h @@ -50,7 +22,7 @@ class QTTESTING_EXPORT pqComboBoxEventPlayer : public pqWidgetEventPlayer bool playEvent(QObject* object, const QString& command, const QString& arguments, int eventType, bool& error) override; -signals: +Q_SIGNALS: // Transition signal to call combo box activated signal void activated(int index); diff --git a/pqComboBoxEventTranslator.cxx b/pqComboBoxEventTranslator.cxx index 4074641..6e10e9f 100644 --- a/pqComboBoxEventTranslator.cxx +++ b/pqComboBoxEventTranslator.cxx @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqComboBoxEventTranslator.cxx - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #include "pqComboBoxEventTranslator.h" @@ -82,10 +54,10 @@ void pqComboBoxEventTranslator::onDestroyed(QObject* /*Object*/) void pqComboBoxEventTranslator::onActivated(const QString& text) { - emit recordEvent(this->CurrentObject, "activated", text); + Q_EMIT recordEvent(this->CurrentObject, "activated", text); } void pqComboBoxEventTranslator::onEditTextChanged(const QString& text) { - emit recordEvent(this->CurrentObject, "editTextChanged", text); + Q_EMIT recordEvent(this->CurrentObject, "editTextChanged", text); } diff --git a/pqComboBoxEventTranslator.h b/pqComboBoxEventTranslator.h index 21e9a2c..c22b15f 100644 --- a/pqComboBoxEventTranslator.h +++ b/pqComboBoxEventTranslator.h @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqComboBoxEventTranslator.h - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef _pqComboBoxEventTranslator_h #define _pqComboBoxEventTranslator_h @@ -58,7 +30,7 @@ class QTTESTING_EXPORT pqComboBoxEventTranslator : public pqWidgetEventTranslato QObject* CurrentObject; -private slots: +private Q_SLOTS: void onDestroyed(QObject*); void onActivated(const QString&); void onEditTextChanged(const QString&); diff --git a/pqCommentEventPlayer.cxx b/pqCommentEventPlayer.cxx index fd94a30..13c2395 100644 --- a/pqCommentEventPlayer.cxx +++ b/pqCommentEventPlayer.cxx @@ -1,37 +1,11 @@ -/*========================================================================= - - Program: ParaView - Module: pqNativeFileDialogEventPlayer.h - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #include "pqCommentEventPlayer.h" +#include + // ---------------------------------------------------------------------------- pqCommentEventPlayer::pqCommentEventPlayer(pqTestUtility* testUtility, QObject* parent) : pqWidgetEventPlayer(parent) @@ -49,6 +23,8 @@ pqCommentEventPlayer::~pqCommentEventPlayer() bool pqCommentEventPlayer::playEvent( QObject* Object, const QString& Command, const QString& Arguments, bool& Error) { + Q_UNUSED(Object); + Q_UNUSED(Error); if (!Command.startsWith("comment")) { return false; @@ -56,7 +32,7 @@ bool pqCommentEventPlayer::playEvent( if (!Arguments.isEmpty()) { - emit this->comment(Arguments); + Q_EMIT this->comment(Arguments); } if (Command.split("-").contains("block")) diff --git a/pqCommentEventPlayer.h b/pqCommentEventPlayer.h index f4f2556..8fb77e3 100644 --- a/pqCommentEventPlayer.h +++ b/pqCommentEventPlayer.h @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqNativeFileDialogEventPlayer.h - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef __pqCommentEventPlayer_h #define __pqCommentEventPlayer_h @@ -54,7 +26,7 @@ class QTTESTING_EXPORT pqCommentEventPlayer : public pqWidgetEventPlayer bool playEvent( QObject* Object, const QString& Command, const QString& Arguments, bool& Error) override; -signals: +Q_SIGNALS: void comment(const QString&); private: diff --git a/pqDoubleSpinBoxEventTranslator.cxx b/pqDoubleSpinBoxEventTranslator.cxx index ae60baa..092b030 100644 --- a/pqDoubleSpinBoxEventTranslator.cxx +++ b/pqDoubleSpinBoxEventTranslator.cxx @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqDoubleSpinBoxEventTranslator.cxx - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #include "pqDoubleSpinBoxEventTranslator.h" @@ -82,11 +54,11 @@ bool pqDoubleSpinBoxEventTranslator::translateEvent(QObject* Object, QEvent* Eve QString keyText = ke->text(); if (keyText.length() && keyText.at(0).isPrint()) { - emit recordEvent(object, "set_double", QString("%1").arg(object->value())); + Q_EMIT recordEvent(object, "set_double", QString("%1").arg(object->value())); } else { - emit recordEvent(object, "key", QString("%1").arg(ke->key())); + Q_EMIT recordEvent(object, "key", QString("%1").arg(ke->key())); } return true; } @@ -102,5 +74,5 @@ void pqDoubleSpinBoxEventTranslator::onDestroyed(QObject* /*Object*/) // ---------------------------------------------------------------------------- void pqDoubleSpinBoxEventTranslator::onValueChanged(double number) { - emit recordEvent(this->CurrentObject, "set_double", QString("%1").arg(number)); + Q_EMIT recordEvent(this->CurrentObject, "set_double", QString("%1").arg(number)); } diff --git a/pqDoubleSpinBoxEventTranslator.h b/pqDoubleSpinBoxEventTranslator.h index baa9239..3e82a2d 100644 --- a/pqDoubleSpinBoxEventTranslator.h +++ b/pqDoubleSpinBoxEventTranslator.h @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqDoubleSpinBoxEventTranslator.h - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef _pqDoubleSpinBoxEventTranslator_h #define _pqDoubleSpinBoxEventTranslator_h @@ -59,7 +31,7 @@ class QTTESTING_EXPORT pqDoubleSpinBoxEventTranslator : public pqWidgetEventTran int Value; QObject* CurrentObject; -private slots: +private Q_SLOTS: void onDestroyed(QObject*); void onValueChanged(double number); }; diff --git a/pqEventComment.cxx b/pqEventComment.cxx index a507583..57db17a 100644 --- a/pqEventComment.cxx +++ b/pqEventComment.cxx @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqEventComment.cxx - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause // Qt includes #include @@ -71,5 +43,5 @@ void pqEventComment::recordComment( return; } - emit this->recordComment(object, command, arguments); + Q_EMIT this->recordComment(object, command, arguments); } diff --git a/pqEventComment.h b/pqEventComment.h index 02b21b5..032751f 100644 --- a/pqEventComment.h +++ b/pqEventComment.h @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqEventComment.h - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef __pqEventComment_h #define __pqEventComment_h @@ -62,7 +34,7 @@ class QTTESTING_EXPORT pqEventComment : public QObject /// and then pause the macro during the playback. void recordCommentBlock(const QString& arguments); -signals: +Q_SIGNALS: /// All functions should emit this signal whenever they wish to record comment event void recordComment(QObject* widget, const QString& type, const QString& argument); diff --git a/pqEventDispatcher.cxx b/pqEventDispatcher.cxx index 6fb7122..7c49e20 100644 --- a/pqEventDispatcher.cxx +++ b/pqEventDispatcher.cxx @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqEventDispatcher.cxx - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #include "pqEventDispatcher.h" @@ -52,11 +24,11 @@ using namespace std; //----------------------------------------------------------------------------- namespace { -static QList > RegisteredTimers; +static QList> RegisteredTimers; void processTimers() { - foreach (QTimer* timer, RegisteredTimers) + Q_FOREACH (QTimer* timer, RegisteredTimers) { if (timer && timer->isActive()) { @@ -96,9 +68,7 @@ pqEventDispatcher::pqEventDispatcher(QObject* parentObject) } //----------------------------------------------------------------------------- -pqEventDispatcher::~pqEventDispatcher() -{ -} +pqEventDispatcher::~pqEventDispatcher() {} //----------------------------------------------------------------------------- void pqEventDispatcher::setEventPlaybackDelay(int milliseconds) @@ -163,11 +133,11 @@ void pqEventDispatcher::run(bool value) this->PlayBackPaused = !value; if (value) { - emit this->restarted(); + Q_EMIT this->restarted(); } else { - emit this->paused(); + Q_EMIT this->paused(); } } @@ -330,9 +300,6 @@ void pqEventDispatcher::playEvent(int indent) unsigned long local_counter = counter++; QString pretty_name = object.mid(object.lastIndexOf('/')); bool print_debug = getenv("PV_DEBUG_TEST") != NULL; -#if defined(_WIN32) || defined(__APPLE__) // temporary debugging on both platforms. - print_debug = true; -#endif if (print_debug) { QString eventString = "Event"; diff --git a/pqEventDispatcher.h b/pqEventDispatcher.h index eaa2d3e..a17dba4 100644 --- a/pqEventDispatcher.h +++ b/pqEventDispatcher.h @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqEventDispatcher.h - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef _pqEventDispatcher_h #define _pqEventDispatcher_h @@ -111,14 +83,14 @@ class QTTESTING_EXPORT pqEventDispatcher : public QObject /// Return Dispatcher's status bool status() const; -signals: +Q_SIGNALS: /// signal when playback starts void restarted(); /// signal when playback pauses void paused(); -protected slots: +protected Q_SLOTS: void playEventOnBlocking(); /// Called when the mainThread is about to block. @@ -127,7 +99,7 @@ protected slots: /// Called when the mainThread wakes up. void awake(); -public slots: +public Q_SLOTS: /// Change the TimeStep void setTimeStep(int value); /// Method to be able to stop/pause/play the current playback script diff --git a/pqEventObserver.cxx b/pqEventObserver.cxx index 288c324..dce27c5 100644 --- a/pqEventObserver.cxx +++ b/pqEventObserver.cxx @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqEventObserver.cxx - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #include "pqEventObserver.h" @@ -43,9 +15,7 @@ pqEventObserver::pqEventObserver(QObject* p) { } -pqEventObserver::~pqEventObserver() -{ -} +pqEventObserver::~pqEventObserver() {} void pqEventObserver::setStream(QTextStream* stream) { diff --git a/pqEventObserver.h b/pqEventObserver.h index d656e14..15db090 100644 --- a/pqEventObserver.h +++ b/pqEventObserver.h @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqEventObserver.h - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef _pqEventObserver_h #define _pqEventObserver_h @@ -58,7 +30,7 @@ class QTTESTING_EXPORT pqEventObserver : public QObject public: virtual void setStream(QTextStream* stream); -public slots: +public Q_SLOTS: // Slot called when recording an event // Event Type can be pqEventTypes::ACTION_EVENT or pqEventType::CHECK_EVENT // Widget, Command/Property and Arguments are QString @@ -66,7 +38,7 @@ public slots: virtual void onRecordEvent(const QString& Widget, const QString& Command, const QString& Arguments, const int& eventType) = 0; -signals: +Q_SIGNALS: void eventRecorded( const QString& Widget, const QString& Command, const QString& Arguments, const int& eventType); diff --git a/pqEventPlayer.cxx b/pqEventPlayer.cxx index 09e6246..d318aaf 100644 --- a/pqEventPlayer.cxx +++ b/pqEventPlayer.cxx @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqEventPlayer.cxx - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #include "pqEventPlayer.h" @@ -56,14 +28,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include // ---------------------------------------------------------------------------- -pqEventPlayer::pqEventPlayer() -{ -} +pqEventPlayer::pqEventPlayer() {} // ---------------------------------------------------------------------------- -pqEventPlayer::~pqEventPlayer() -{ -} +pqEventPlayer::~pqEventPlayer() {} // ---------------------------------------------------------------------------- void pqEventPlayer::addDefaultWidgetEventPlayers(pqTestUtility* util) @@ -81,7 +49,7 @@ void pqEventPlayer::addDefaultWidgetEventPlayers(pqTestUtility* util) addWidgetEventPlayer(new pqTreeViewEventPlayer()); addWidgetEventPlayer(new pqTableViewEventPlayer()); addWidgetEventPlayer(new pqListViewEventPlayer()); - addWidgetEventPlayer(new pqAbstractMiscellaneousEventPlayer()); + addWidgetEventPlayer(new pqAbstractMiscellaneousEventPlayer(util)); addWidgetEventPlayer(new pq3DViewEventPlayer("QGLWidget")); addWidgetEventPlayer(new pqNativeFileDialogEventPlayer(util)); } @@ -158,14 +126,14 @@ void pqEventPlayer::playEvent( void pqEventPlayer::playEvent(const QString& objectString, const QString& command, const QString& arguments, int eventType, bool& error) { - emit this->eventAboutToBePlayed(objectString, command, arguments); + Q_EMIT this->eventAboutToBePlayed(objectString, command, arguments); // If we can't find an object with the right name, we're done ... QObject* const object = pqObjectNaming::GetObject(objectString); // Scroll bar depends on monitor's resolution if (!object && objectString.contains(QString("QScrollBar"))) { - emit this->eventPlayed(objectString, command, arguments); + Q_EMIT this->eventPlayed(objectString, command, arguments); error = false; return; } @@ -208,7 +176,7 @@ void pqEventPlayer::playEvent(const QString& objectString, const QString& comman if (!accepted) { QString errorMessage = - QString("In event 'object=%1' 'command=%2' 'arguments=%3':\nUnhandled event.") + QString("In event 'object=%1' 'command=%2' 'arguments=%3':\nUnhandled event.\n%4") .arg(object ? object->objectName() : objectString, command, arguments, pqObjectNaming::lastErrorMessage()); qCritical() << qUtf8Printable(errorMessage); @@ -230,6 +198,6 @@ void pqEventPlayer::playEvent(const QString& objectString, const QString& comman } // The event was handled successfully ... - emit this->eventPlayed(objectString, command, arguments); + Q_EMIT this->eventPlayed(objectString, command, arguments); error = false; } diff --git a/pqEventPlayer.h b/pqEventPlayer.h index 246adb9..6dc3de8 100644 --- a/pqEventPlayer.h +++ b/pqEventPlayer.h @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqEventPlayer.h - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef _pqEventPlayer_h #define _pqEventPlayer_h @@ -104,7 +76,7 @@ class QTTESTING_EXPORT pqEventPlayer : public QObject void playEvent( const QString& object, const QString& command, const QString& arguments, bool& Error); -signals: +Q_SIGNALS: void eventAboutToBePlayed( const QString& Object, const QString& Command, const QString& Arguments); void eventPlayed(const QString& Object, const QString& Command, const QString& Arguments); diff --git a/pqEventRecorder.cxx b/pqEventRecorder.cxx index a903d81..484513c 100644 --- a/pqEventRecorder.cxx +++ b/pqEventRecorder.cxx @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqEventDispatcher.h - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause // Qt includes #include @@ -192,8 +164,10 @@ void pqEventRecorder::start() // Set the device this->Stream.setDevice(this->File); +#if QT_VERSION < 0x060000 // Set UTF8 Codec this->Stream.setCodec("UTF-8"); +#endif // Set the Stream to the Observer this->ActiveObserver->setStream(&this->Stream); @@ -202,7 +176,7 @@ void pqEventRecorder::start() this->ActiveTranslator->start(); this->ActiveTranslator->record(true); - emit this->started(); + Q_EMIT this->started(); } // ---------------------------------------------------------------------------- @@ -222,7 +196,7 @@ void pqEventRecorder::stop(int value) } this->flush(); - emit this->stopped(); + Q_EMIT this->stopped(); } // ---------------------------------------------------------------------------- @@ -235,5 +209,5 @@ void pqEventRecorder::unpause(bool value) void pqEventRecorder::pause(bool value) { this->ActiveTranslator->record(!value); - emit this->paused(value); + Q_EMIT this->paused(value); } diff --git a/pqEventRecorder.h b/pqEventRecorder.h index f013545..8dfd179 100644 --- a/pqEventRecorder.h +++ b/pqEventRecorder.h @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqEventDispatcher.h - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef _pqEventRecorder_h #define _pqEventRecorder_h @@ -80,12 +52,12 @@ class QTTESTING_EXPORT pqEventRecorder : public QObject void recordEvents(pqEventTranslator* translator, pqEventObserver* observer, QIODevice* file, bool continuousFlush); -signals: +Q_SIGNALS: void started(); void stopped(); void paused(bool); -public slots: +public Q_SLOTS: void flush(); void start(); diff --git a/pqEventSource.h b/pqEventSource.h index 81dae8e..31a0d44 100644 --- a/pqEventSource.h +++ b/pqEventSource.h @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqEventSource.h - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef _pqEventSource_h #define _pqEventSource_h diff --git a/pqEventTranslator.cxx b/pqEventTranslator.cxx index df30436..c1ffdf5 100644 --- a/pqEventTranslator.cxx +++ b/pqEventTranslator.cxx @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqEventTranslator.cxx - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #include "pqEventTranslator.h" @@ -92,10 +64,10 @@ struct pqEventTranslator::pqImplementation // Hide the overlay this->CheckOverlay->hide(); - // Nullfied it's parent + // Nullified it's parent this->CheckOverlay->setParent(NULL); - // Set the overlayed widget to null + // Set the overlaid widget to null this->CheckOverlayWidgetOn = NULL; } @@ -103,7 +75,7 @@ struct pqEventTranslator::pqImplementation /// Stores the working set of widget translators QList Translators; /// Stores the set of objects that should be ignored when translating events - QMap IgnoredObjects; + QMap IgnoredObjects; // list of widgets for which mouse propagation will happen // we'll only translate the first and ignore the rest @@ -118,7 +90,7 @@ struct pqEventTranslator::pqImplementation // Pointer to the overlay QPointer CheckOverlay; - // Pointer to the overlayed widget + // Pointer to the overlaid widget QPointer CheckOverlayWidgetOn; // Record interaction timings flag @@ -151,7 +123,7 @@ pqEventTranslator::~pqEventTranslator() void pqEventTranslator::start() { QCoreApplication::instance()->installEventFilter(this); - emit this->started(); + Q_EMIT this->started(); } // ---------------------------------------------------------------------------- @@ -159,13 +131,13 @@ void pqEventTranslator::stop() { QCoreApplication::instance()->removeEventFilter(this); this->check(false); - emit this->stopped(); + Q_EMIT this->stopped(); } // ---------------------------------------------------------------------------- void pqEventTranslator::addDefaultWidgetEventTranslators(pqTestUtility* util) { - // Add generalistic translator first, then specific, in order for this to work + // Add general translator first, then specific, in order for this to work addWidgetEventTranslator(new pqBasicWidgetEventTranslator()); addWidgetEventTranslator(new pqAbstractButtonEventTranslator()); addWidgetEventTranslator(new pqAbstractItemViewEventTranslator()); @@ -272,7 +244,7 @@ pqEventComment* pqEventTranslator::eventComment() const } // ---------------------------------------------------------------------------- -void pqEventTranslator::ignoreObject(QObject* object, QRegExp commandFilter) +void pqEventTranslator::ignoreObject(QObject* object, QRegularExpression commandFilter) { this->Implementation->IgnoredObjects.insert(object, commandFilter); } @@ -282,12 +254,10 @@ bool pqEventTranslator::eventFilter(QObject* object, QEvent* event) { if (this->Implementation->Recording) { -#if QT_VERSION >= 0x050000 if (object->isWindowType()) { return false; } -#endif // Only widgets QWidget* widget = qobject_cast(object); @@ -326,7 +296,7 @@ bool pqEventTranslator::eventFilter(QObject* object, QEvent* event) if (this->Implementation->Checking) { // In Gl Case, parentless widget is not transparent to mouse event - // The event is applied to the overlayed widget or an another top widget + // The event is applied to the overlaid widget or an another top widget // (before ignoredObjects) // TODO : use mask instead @@ -346,23 +316,27 @@ bool pqEventTranslator::eventFilter(QObject* object, QEvent* event) QWidget* topWidget; // recover all top widgets QWidgetList topWidgets = QApplication::topLevelWidgets(); - foreach (topWidget, topWidgets) + Q_FOREACH (topWidget, topWidgets) { // only the visible ones if (!topWidget->isHidden()) { +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + auto pos = static_cast(event)->globalPos(); +#else + auto pos = static_cast(event)->globalPosition().toPoint(); +#endif // Check it is not the overlay, and it contains the mouse cursor if (topWidget != this->Implementation->CheckOverlay && - topWidget->geometry().contains(static_cast(event)->globalPos(), true)) + topWidget->geometry().contains(pos, true)) { - // Recover the child widget onder the cursor, if any - QWidget* childWidget = topWidget->childAt( - topWidget->mapFromGlobal(static_cast(event)->globalPos())); + // Recover the child widget under the cursor, if any + QWidget* childWidget = topWidget->childAt(topWidget->mapFromGlobal(pos)); - // If child exist, check it is not the overlayed widget and indeed a new widget + // If child exist, check it is not the overlaid widget and indeed a new widget if (childWidget == NULL || (childWidget != NULL && - childWidget != this->Implementation->CheckOverlayWidgetOn)) + childWidget != this->Implementation->CheckOverlayWidgetOn)) { // if a child exist, use it if (childWidget != NULL) @@ -379,7 +353,7 @@ bool pqEventTranslator::eventFilter(QObject* object, QEvent* event) } if (foundTop) { - // If we found a top widget behin the cursor, use it + // If we found a top widget behind the cursor, use it widget = topWidget; } else @@ -412,7 +386,7 @@ bool pqEventTranslator::eventFilter(QObject* object, QEvent* event) return false; } - // Mouse Move on a non-previously overlayed widget + // Mouse Move on a non-previously overlaid widget if (event->type() == QEvent::MouseMove && this->Implementation->CheckOverlayWidgetOn != widget) { @@ -443,7 +417,7 @@ bool pqEventTranslator::eventFilter(QObject* object, QEvent* event) // Check if widget is parent to gl widget QList children = widget->findChildren(); - foreach (QWidget* child, children) + Q_FOREACH (QWidget* child, children) { if (child->inherits("QVTKWidget")) { @@ -465,12 +439,12 @@ bool pqEventTranslator::eventFilter(QObject* object, QEvent* event) // Set the validity of the overlay this->Implementation->CheckOverlay->Valid = validTranslator; - // Set parent of the overlay to be parent of the overlayed widget + // Set parent of the overlay to be parent of the overlaid widget this->Implementation->CheckOverlay->setParent(qobject_cast(widget->parent())); if (this->Implementation->CheckOverlay->GlWidget) { - // Cannot draw QPainter directive in openGl context, bust use another context, aka + // Cannot draw QPainter directive in OpenGL context, bust use another context, aka // another window // this->Implementation->CheckOverlay->setWindowFlags(Qt::ToolTip | // Qt::FramelessWindowHint); // ToolTip is always on top @@ -493,7 +467,7 @@ bool pqEventTranslator::eventFilter(QObject* object, QEvent* event) this->Implementation->CheckOverlay->setAttribute(Qt::WA_TranslucentBackground, false); this->Implementation->CheckOverlay->setAttribute(Qt::WA_PaintOnScreen, false); - // Set overlay geometry to be the same as overlayed widget + // Set overlay geometry to be the same as overlaid widget this->setOverlayGeometry(widget->geometry(), false); } @@ -583,37 +557,41 @@ void pqEventTranslator::onRecordEvent( { if (this->Implementation->IgnoredObjects.contains(Object)) { - QRegExp commandFilter = this->Implementation->IgnoredObjects.value(Object); + QRegularExpression commandFilter = this->Implementation->IgnoredObjects.value(Object); if (Command.contains(commandFilter)) { return; } } - if (QVariant blockRecordCommands = Object->property("BlockRecordCommands"); - blockRecordCommands.isValid() && Command.contains(blockRecordCommands.toRegExp())) - { - return; - } - QString name; - if (eventType == pqEventTypes::ACTION_EVENT) + if (Object) { - // When sender is pqEventObject, the Object name can be NULL. - if (!qobject_cast(this->sender()) || Object) + QVariant blockRecordCommands = Object->property("BlockRecordCommands"); + if (blockRecordCommands.isValid() && + Command.contains(blockRecordCommands.toRegularExpression())) + { + return; + } + + if (eventType == pqEventTypes::ACTION_EVENT) + { + // When sender is pqEventObject, the Object name can be NULL. + if (!qobject_cast(this->sender()) || Object) + { + name = pqObjectNaming::GetName(*Object); + if (name.isEmpty()) + return; + } + } + else { + // Check the QObject does have a name name = pqObjectNaming::GetName(*Object); if (name.isEmpty()) + { return; - } - } - else - { - // Check the QObject does have a name - name = pqObjectNaming::GetName(*Object); - if (name.isEmpty()) - { - return; + } } } @@ -622,7 +600,7 @@ void pqEventTranslator::onRecordEvent( { if (this->Implementation->InteractionsTimer.isValid()) { - emit recordEvent(name, "pause", + Q_EMIT recordEvent(name, "pause", QString::number(this->Implementation->InteractionsTimer.restart()), pqEventTypes::ACTION_EVENT); } @@ -633,7 +611,7 @@ void pqEventTranslator::onRecordEvent( } // Record the event - emit recordEvent(name, Command, Arguments, eventType); + Q_EMIT recordEvent(name, Command, Arguments, eventType); } // ---------------------------------------------------------------------------- @@ -685,3 +663,17 @@ void pqEventTranslator::setOverlayGeometry(const QRect& geometry, bool specific) } this->Implementation->CheckOverlay->Specific = specific; } + +// ---------------------------------------------------------------------------- +void pqEventTranslator::recordDashboardModeToggle(QObject* object, bool toggle) +{ + QString name = pqObjectNaming::GetName(*object); + if (name.isEmpty()) + { + qWarning() << "Error recording a dashboard mode event"; + return; + } + + Q_EMIT recordEvent( + name, "dashboard_mode", QVariant(toggle).toString(), pqEventTypes::ACTION_EVENT); +} diff --git a/pqEventTranslator.h b/pqEventTranslator.h index b727d89..7d93095 100644 --- a/pqEventTranslator.h +++ b/pqEventTranslator.h @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqEventTranslator.h - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef _pqEventTranslator_h #define _pqEventTranslator_h @@ -36,7 +8,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "QtTestingExport.h" #include #include -#include +#include class pqEventComment; class pqTestUtility; @@ -98,8 +70,9 @@ class QTTESTING_EXPORT pqEventTranslator : public QObject /// match the commands to block. This is useful for temporarily blocking /// a command when a programatically change will fire a signal that generates /// a command. - void ignoreObject( - QObject* object, QRegExp commandFilter = QRegExp("*", Qt::CaseInsensitive, QRegExp::Wildcard)); + void ignoreObject(QObject* object, + QRegularExpression commandFilter = QRegularExpression( + ".*", QRegularExpression::CaseInsensitiveOption)); /// start listening to the GUI and translating events void start(); @@ -116,7 +89,11 @@ class QTTESTING_EXPORT pqEventTranslator : public QObject /// Set the record interaction timings flag void recordInteractionTimings(bool value); -signals: + + /// Record a dashboard mode toggle event + void recordDashboardModeToggle(QObject* object, bool toggle); + +Q_SIGNALS: /// This signal will be emitted every time a translator generates a /// high-level ParaView event. Observers should connect to this signal /// to serialize high-level events. @@ -129,7 +106,7 @@ class QTTESTING_EXPORT pqEventTranslator : public QObject /// this signals when recording stops void stopped(); -private slots: +private Q_SLOTS: // Slot called when recording an event void onRecordEvent( QObject* Object, const QString& Command, const QString& Arguments, int eventType); diff --git a/pqEventTypes.h b/pqEventTypes.h index 37c8b18..a465d5e 100644 --- a/pqEventTypes.h +++ b/pqEventTypes.h @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqEventTypes.h - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef _pqEventTypes_h #define _pqEventTypes_h diff --git a/pqLineEditEventTranslator.cxx b/pqLineEditEventTranslator.cxx index f051b44..0686178 100644 --- a/pqLineEditEventTranslator.cxx +++ b/pqLineEditEventTranslator.cxx @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqLineEditEventTranslator.cxx - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #include "pqLineEditEventTranslator.h" @@ -87,22 +59,22 @@ bool pqLineEditEventTranslator::translateEvent( { if (leObject) { - emit recordEvent(tmpObject, "set_string", leObject->text()); + Q_EMIT recordEvent(tmpObject, "set_string", leObject->text()); } else if (teObject) { - emit recordEvent(tmpObject, "set_string", teObject->document()->toPlainText()); + Q_EMIT recordEvent(tmpObject, "set_string", teObject->document()->toPlainText()); } else if (pteObject) { - emit recordEvent(tmpObject, "set_string", pteObject->document()->toPlainText()); + Q_EMIT recordEvent(tmpObject, "set_string", pteObject->document()->toPlainText()); } } // if we record F2 event, will cause some issue with the TreeView // Need test to know if we need to record those events else if (ke->key() != Qt::Key_F2) { - emit recordEvent(tmpObject, "key", QString("%1").arg(ke->key())); + Q_EMIT recordEvent(tmpObject, "key", QString("%1").arg(ke->key())); } return true; break; @@ -125,12 +97,12 @@ bool pqLineEditEventTranslator::translateEvent( { if (teObject != NULL) { - emit this->recordEvent(teObject, "plainText", teObject->toPlainText().replace("\t", " "), - pqEventTypes::CHECK_EVENT); + Q_EMIT this->recordEvent(teObject, "plainText", + teObject->toPlainText().replace("\t", " "), pqEventTypes::CHECK_EVENT); } else /* if (pteObject != NULL)*/ { - emit this->recordEvent(pteObject, "plainText", + Q_EMIT this->recordEvent(pteObject, "plainText", pteObject->toPlainText().replace("\t", " "), pqEventTypes::CHECK_EVENT); } return true; diff --git a/pqLineEditEventTranslator.h b/pqLineEditEventTranslator.h index ffe3a23..6ecf95b 100644 --- a/pqLineEditEventTranslator.h +++ b/pqLineEditEventTranslator.h @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqLineEditEventTranslator.h - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef _pqLineEditEventTranslator_h #define _pqLineEditEventTranslator_h diff --git a/pqListViewEventPlayer.cxx b/pqListViewEventPlayer.cxx index 74dcf0a..80624bb 100644 --- a/pqListViewEventPlayer.cxx +++ b/pqListViewEventPlayer.cxx @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqListViewEventPlayer.cxx - - Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #include "pqListViewEventPlayer.h" #include @@ -39,9 +11,7 @@ pqListViewEventPlayer::pqListViewEventPlayer(QObject* parentObject) } //----------------------------------------------------------------------------- -pqListViewEventPlayer::~pqListViewEventPlayer() -{ -} +pqListViewEventPlayer::~pqListViewEventPlayer() {} //-----------------------------------------------------------------------------0000000 bool pqListViewEventPlayer::playEvent( diff --git a/pqListViewEventPlayer.h b/pqListViewEventPlayer.h index cc43f3f..fe2b6d0 100644 --- a/pqListViewEventPlayer.h +++ b/pqListViewEventPlayer.h @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqListViewEventPlayer.h - - Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef __pqListViewEventPlayer_h #define __pqListViewEventPlayer_h diff --git a/pqListViewEventTranslator.cxx b/pqListViewEventTranslator.cxx index 1b87855..35c3f76 100644 --- a/pqListViewEventTranslator.cxx +++ b/pqListViewEventTranslator.cxx @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqListViewEventTranslator.cxx - - Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #include "pqListViewEventTranslator.h" #include @@ -40,9 +12,7 @@ pqListViewEventTranslator::pqListViewEventTranslator(QObject* parentObject) } //----------------------------------------------------------------------------- -pqListViewEventTranslator::~pqListViewEventTranslator() -{ -} +pqListViewEventTranslator::~pqListViewEventTranslator() {} //----------------------------------------------------------------------------- void pqListViewEventTranslator::onEnteredCheck(const QModelIndex& item) @@ -58,7 +28,7 @@ void pqListViewEventTranslator::onEnteredCheck(const QModelIndex& item) // Stor item and signal that a specific overlay is ready to be drawn this->ModelItemCheck = &item; - emit this->specificOverlay(visualRect); + Q_EMIT this->specificOverlay(visualRect); } //----------------------------------------------------------------------------- diff --git a/pqListViewEventTranslator.h b/pqListViewEventTranslator.h index 8e65a89..aa1fd13 100644 --- a/pqListViewEventTranslator.h +++ b/pqListViewEventTranslator.h @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqListViewEventTranslator.h - - Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef __pqListViewEventTranslator_h #define __pqListViewEventTranslator_h @@ -49,7 +21,7 @@ class QTTESTING_EXPORT pqListViewEventTranslator : public pqAbstractItemViewEven /// find and set the corrected abstract item view QAbstractItemView* findCorrectedAbstractItemView(QObject* object) const override; -protected slots: +protected Q_SLOTS: /// Compute a visual rectangle for the item and signal it void onEnteredCheck(const QModelIndex&) override; diff --git a/pqMenuEventTranslator.cxx b/pqMenuEventTranslator.cxx index c35af49..79f0904 100644 --- a/pqMenuEventTranslator.cxx +++ b/pqMenuEventTranslator.cxx @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqMenuEventTranslator.cxx - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #include "pqMenuEventTranslator.h" @@ -44,9 +16,7 @@ pqMenuEventTranslator::pqMenuEventTranslator(QObject* p) { } -pqMenuEventTranslator::~pqMenuEventTranslator() -{ -} +pqMenuEventTranslator::~pqMenuEventTranslator() {} bool pqMenuEventTranslator::translateEvent(QObject* Object, QEvent* Event, bool& Error) { @@ -70,7 +40,7 @@ bool pqMenuEventTranslator::translateEvent(QObject* Object, QEvent* Event, bool& { which = action->text(); } - emit recordEvent(menubar, "activate", which); + Q_EMIT recordEvent(menubar, "activate", which); } } return true; @@ -104,7 +74,7 @@ bool pqMenuEventTranslator::translateEvent(QObject* Object, QEvent* Event, bool& // can be activated without first getting focus. if (this->SubMenuParent.find(menu->menuAction()) != this->SubMenuParent.end()) { // Then a previous menu has recorded this action as a sub-menu - emit recordEvent( + Q_EMIT recordEvent( this->SubMenuParent[menu->menuAction()], "activate", actionArgument(menu->menuAction())); } } @@ -133,7 +103,7 @@ bool pqMenuEventTranslator::translateEvent(QObject* Object, QEvent* Event, bool& QAction* action = menu->activeAction(); if (action) { - emit recordEvent(menu, "activate", actionArgument(action)); + Q_EMIT recordEvent(menu, "activate", actionArgument(action)); } } else if (e->key() == Qt::Key_Right) @@ -141,7 +111,7 @@ bool pqMenuEventTranslator::translateEvent(QObject* Object, QEvent* Event, bool& QAction* action = menu->activeAction(); if (action && action->menu()) { - emit recordEvent(menu, "activate", actionArgument(action)); + Q_EMIT recordEvent(menu, "activate", actionArgument(action)); } } else @@ -151,9 +121,14 @@ bool pqMenuEventTranslator::translateEvent(QObject* Object, QEvent* Event, bool& const QKeySequence mnemonic = QKeySequence::mnemonic(action->text()); if (!mnemonic.isEmpty()) { // Then the action has a keyboard accelerator +#if QT_VERSION >= 0x060000 + if (mnemonic == + QKeySequence(QKeyCombination(e->modifiers(), static_cast(e->key())))) +#else if (mnemonic == QKeySequence(e->modifiers() + e->key())) +#endif { - emit recordEvent(menu, "activate", actionArgument(action)); + Q_EMIT recordEvent(menu, "activate", actionArgument(action)); } } } @@ -168,7 +143,7 @@ bool pqMenuEventTranslator::translateEvent(QObject* Object, QEvent* Event, bool& QAction* action = menu->actionAt(e->pos()); if (action && !action->menu()) { - emit recordEvent(menu, "activate", actionArgument(action)); + Q_EMIT recordEvent(menu, "activate", actionArgument(action)); } } return true; diff --git a/pqMenuEventTranslator.h b/pqMenuEventTranslator.h index e986e94..4f48eab 100644 --- a/pqMenuEventTranslator.h +++ b/pqMenuEventTranslator.h @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqMenuEventTranslator.h - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef _pqMenuEventTranslator_h #define _pqMenuEventTranslator_h diff --git a/pqNativeFileDialogEventPlayer.cxx b/pqNativeFileDialogEventPlayer.cxx index 5fad254..6bfce36 100644 --- a/pqNativeFileDialogEventPlayer.cxx +++ b/pqNativeFileDialogEventPlayer.cxx @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqNativeFileDialogEventPlayer.cxx - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #include "pqNativeFileDialogEventPlayer.h" @@ -159,7 +131,7 @@ bool pqNativeFileDialogEventPlayer::playEvent( QStringList normalized_files = Arguments.split(";"); QStringList files; - foreach (QString file, normalized_files) + Q_FOREACH (QString file, normalized_files) { files.append(mUtil->convertFromDataDirectory(file)); } @@ -186,15 +158,9 @@ pqNativeFileDialogEventPlayer::pqNativeFileDialogEventPlayer(pqTestUtility* util , mUtil(util) { } -pqNativeFileDialogEventPlayer::~pqNativeFileDialogEventPlayer() -{ -} -void pqNativeFileDialogEventPlayer::start() -{ -} -void pqNativeFileDialogEventPlayer::stop() -{ -} +pqNativeFileDialogEventPlayer::~pqNativeFileDialogEventPlayer() {} +void pqNativeFileDialogEventPlayer::start() {} +void pqNativeFileDialogEventPlayer::stop() {} bool pqNativeFileDialogEventPlayer::playEvent( QObject* Object, const QString& Command, const QString& Arguments, bool& Error) diff --git a/pqNativeFileDialogEventPlayer.h b/pqNativeFileDialogEventPlayer.h index 0c9836d..caca2bb 100644 --- a/pqNativeFileDialogEventPlayer.h +++ b/pqNativeFileDialogEventPlayer.h @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqNativeFileDialogEventPlayer.h - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef _pqNativeFileDialogEventPlayer_h #define _pqNativeFileDialogEventPlayer_h @@ -57,7 +29,7 @@ class QTTESTING_EXPORT pqNativeFileDialogEventPlayer : public pqWidgetEventPlaye bool playEvent( QObject* Object, const QString& Command, const QString& Arguments, bool& Error) override; -protected slots: +protected Q_SLOTS: void start(); void stop(); diff --git a/pqNativeFileDialogEventTranslator.cxx b/pqNativeFileDialogEventTranslator.cxx index 9042e7e..cc83d0d 100644 --- a/pqNativeFileDialogEventTranslator.cxx +++ b/pqNativeFileDialogEventTranslator.cxx @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqNativeFileDialogEventTranslator.cxx - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #include "pqNativeFileDialogEventTranslator.h" @@ -125,9 +97,7 @@ pqNativeFileDialogEventTranslator::pqNativeFileDialogEventTranslator( QObject::connect(mUtil->eventTranslator(), SIGNAL(stopped()), this, SLOT(stop())); } -pqNativeFileDialogEventTranslator::~pqNativeFileDialogEventTranslator() -{ -} +pqNativeFileDialogEventTranslator::~pqNativeFileDialogEventTranslator() {} void pqNativeFileDialogEventTranslator::start() { @@ -178,12 +148,12 @@ void pqNativeFileDialogEventTranslator::record(const QString& command, const QSt QStringList files = args.split(";"); QStringList normalized_files; - foreach (QString file, files) + Q_FOREACH (QString file, files) { normalized_files.append(mUtil->convertToDataDirectory(file)); } - emit this->recordEvent(QApplication::instance(), command, normalized_files.join(";")); + Q_EMIT this->recordEvent(QApplication::instance(), command, normalized_files.join(";")); } #else @@ -193,17 +163,11 @@ pqNativeFileDialogEventTranslator::pqNativeFileDialogEventTranslator( , mUtil(util) { } -pqNativeFileDialogEventTranslator::~pqNativeFileDialogEventTranslator() -{ -} +pqNativeFileDialogEventTranslator::~pqNativeFileDialogEventTranslator() {} -void pqNativeFileDialogEventTranslator::start() -{ -} +void pqNativeFileDialogEventTranslator::start() {} -void pqNativeFileDialogEventTranslator::stop() -{ -} +void pqNativeFileDialogEventTranslator::stop() {} bool pqNativeFileDialogEventTranslator::translateEvent( QObject* pqNotUsed(Object), QEvent* pqNotUsed(Event), bool& pqNotUsed(Error)) diff --git a/pqNativeFileDialogEventTranslator.h b/pqNativeFileDialogEventTranslator.h index a905de9..26c54bd 100644 --- a/pqNativeFileDialogEventTranslator.h +++ b/pqNativeFileDialogEventTranslator.h @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqNativeFileDialogEventTranslator.h - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef _pqNativeFileDialogEventTranslator_h #define _pqNativeFileDialogEventTranslator_h @@ -58,7 +30,7 @@ class QTTESTING_EXPORT pqNativeFileDialogEventTranslator : public pqWidgetEventT void record(const QString& command, const QString& args); -protected slots: +protected Q_SLOTS: void start(); void stop(); diff --git a/pqObjectNaming.cxx b/pqObjectNaming.cxx index 2e50de7..5fee26d 100644 --- a/pqObjectNaming.cxx +++ b/pqObjectNaming.cxx @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqObjectNaming.cxx - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #include "pqObjectNaming.h" @@ -249,10 +221,11 @@ QObject* pqObjectNaming::GetObject(const QString& Name) ErrorMessage.clear(); QTextStream stream(&ErrorMessage); - stream << "Couldn't find object `" << Name << "`\n"; + stream << "\n"; // a newline to keep horizontal alignment + stream << "Couldn't find object `" << Name << "`\n"; if (lastObject) { - stream << "Found up to `" << pqObjectNaming::GetName(*lastObject) << "`\n"; + stream << "Found up to `" << pqObjectNaming::GetName(*lastObject) << "`\n"; } // controls how many matches to dump in error message. @@ -262,30 +235,31 @@ QObject* pqObjectNaming::GetObject(const QString& Name) bool foundMatch = false; if (lastObject) { - const QObjectList matches = lastObject->findChildren(names[names.size() - 1]); + QObjectList matches = lastObject->findChildren(names[names.size() - 1]); for (int cc = 0; (matchLimit <= 0 || cc < matchLimit) && cc < matches.size(); ++cc) { - stream << "\tPossible match: `" << pqObjectNaming::GetName(*matches[cc]) << "`\n"; + stream << " Possible match: `" << pqObjectNaming::GetName(*matches[cc]) << "`\n"; + foundMatch = true; } if (matchLimit > 0 && matches.size() > matchLimit) { - stream << "\tPossible match: .... (and " << (matches.size() - matchLimit) << " more!)\n" - << "\tSet PQOBJECTNAMING_MATCH_LIMIT environment var to a +'ve number to limit " + stream << " Possible match: .... (and " << (matches.size() - matchLimit) << " more!)\n" + << " Set PQOBJECTNAMING_MATCH_LIMIT environment var to a +'ve number to limit " "entries (or 0 for unlimited).\n"; } - } - if (!foundMatch) - { - const QObjectList matches = lastObject->findChildren(); - for (int cc = 0; (matchLimit <= 0 || cc < matchLimit) && cc < matches.size(); ++cc) - { - stream << "\tAvailable widget: `" << pqObjectNaming::GetName(*matches[cc]) << "`\n"; - } - if (matchLimit > 0 && matches.size() > matchLimit) + if (!foundMatch) { - stream << "\tAvailable widget: .... (and " << (matches.size() - matchLimit) << " more!)\n" - << "\tSet PQOBJECTNAMING_MATCH_LIMIT environment var to a +'ve number to limit " - "entries (or 0 for unlimited).\n"; + matches = lastObject->findChildren(); + for (int cc = 0; (matchLimit <= 0 || cc < matchLimit) && cc < matches.size(); ++cc) + { + stream << " Available widget: `" << pqObjectNaming::GetName(*matches[cc]) << "`\n"; + } + if (matchLimit > 0 && matches.size() > matchLimit) + { + stream << " Available widget: .... (and " << (matches.size() - matchLimit) << " more!)\n" + << " Set PQOBJECTNAMING_MATCH_LIMIT environment var to a +'ve number to limit " + "entries (or 0 for unlimited).\n"; + } } } return 0; diff --git a/pqObjectNaming.h b/pqObjectNaming.h index d31b28d..3d157ee 100644 --- a/pqObjectNaming.h +++ b/pqObjectNaming.h @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqObjectNaming.h - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef _pqObjectNaming_h #define _pqObjectNaming_h @@ -38,7 +10,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "QtTestingExport.h" class QObject; +#if QT_VERSION < 0x060000 class QStringList; +#endif /// Provides functionality to ensuring that Qt objects can be uniquely identified for recording and /// playback of regression tests diff --git a/pqObjectPlayer.cxx b/pqObjectPlayer.cxx new file mode 100644 index 0000000..79e3c7b --- /dev/null +++ b/pqObjectPlayer.cxx @@ -0,0 +1,56 @@ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-License-Identifier: BSD-3-Clause + +#include "pqObjectPlayer.h" + +#include "pqEventTypes.h" + +#include +#include + +// ---------------------------------------------------------------------------- +pqObjectPlayer::pqObjectPlayer(QObject* parent) + : Superclass(parent) +{ +} + +// ---------------------------------------------------------------------------- +bool pqObjectPlayer::playEvent( + QObject* object, const QString& command, const QString& arguments, int eventType, bool& error) +{ + if (!object) + { + return false; + } + + if (eventType == pqEventTypes::CHECK_EVENT) + { + QVariant propertyValue = object->property(command.toUtf8().data()); + if (!propertyValue.isValid()) + { + return false; + } + + if (propertyValue.toString().replace("\t", " ") != arguments) + { + QString errorMessage = object->objectName() + + " property value is: " + propertyValue.toString() + ". Expecting: " + arguments + "."; + qCritical() << errorMessage.toUtf8().data(); + error = true; + } + return true; + } + + if (eventType == pqEventTypes::ACTION_EVENT) + { + return this->playEvent(object, command, arguments, error); + } + + return false; +} + +// ---------------------------------------------------------------------------- +bool pqObjectPlayer::playEvent(QObject*, const QString&, const QString&, bool&) +{ + return false; +} diff --git a/pqObjectPlayer.h b/pqObjectPlayer.h new file mode 100644 index 0000000..d15c025 --- /dev/null +++ b/pqObjectPlayer.h @@ -0,0 +1,51 @@ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-License-Identifier: BSD-3-Clause + +#ifndef _pqObjectPlayer_h +#define _pqObjectPlayer_h + +#include "QtTestingExport.h" +#include + +class QString; + +/** + * Base Player class. + * It defines the API to play events. + * It handles the playback of "check" events for QObject, looking for QObject::property. + */ +class QTTESTING_EXPORT pqObjectPlayer : public QObject +{ + Q_OBJECT + typedef QObject Superclass; + +public: + pqObjectPlayer(QObject* parent = nullptr); + ~pqObjectPlayer() override = default; + + /** + * Entry point to handle events. + * + * If type is pqEventTypes::CHECK_EVENT, look for a QObject::property + * named as the "command" and test its value against "arguments". + * + * pqEventTypes::ACTION_EVENT is forwarded to playEvent(QObject*, QString, QString, bool&) + * + * Returns true if event was handled. + * Returns false if object is nullptr. + */ + virtual bool playEvent( + QObject* object, const QString& command, const QString& arguments, int eventType, bool& error); + + /** + * Entry point for the pqEventTypes::ACTION_EVENT type only. + * Default implementation is no op and return false. + */ + virtual bool playEvent(QObject*, const QString&, const QString&, bool&); + +private: + pqObjectPlayer(const pqObjectPlayer&); + pqObjectPlayer& operator=(const pqObjectPlayer&); +}; + +#endif // _pqBasicObjectPlayer_h diff --git a/pqPlayBackEventsDialog.cxx b/pqPlayBackEventsDialog.cxx index 4bd569c..e1a3a3e 100644 --- a/pqPlayBackEventsDialog.cxx +++ b/pqPlayBackEventsDialog.cxx @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqPlayBackEventsDialog.cxx - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #include "pqPlayBackEventsDialog.h" #include "pqCommentEventPlayer.h" @@ -95,9 +67,7 @@ pqPlayBackEventsDialog::pqImplementation::pqImplementation( } // ---------------------------------------------------------------------------- -pqPlayBackEventsDialog::pqImplementation::~pqImplementation() -{ -} +pqPlayBackEventsDialog::pqImplementation::~pqImplementation() {} // ---------------------------------------------------------------------------- void pqPlayBackEventsDialog::pqImplementation::init(pqPlayBackEventsDialog* dialog) @@ -263,12 +233,13 @@ void pqPlayBackEventsDialog::insertFiles() // ---------------------------------------------------------------------------- void pqPlayBackEventsDialog::removeFiles() { - if (QMessageBox::Ok == QMessageBox::warning(this, QString("Remove files"), - QString("Are you sure you want to \n" - "remove all checked files ?\n"), - QMessageBox::Ok, QMessageBox::Cancel)) + if (QMessageBox::Ok == + QMessageBox::warning(this, QString("Remove files"), + QString("Are you sure you want to \n" + "remove all checked files ?\n"), + QMessageBox::Ok, QMessageBox::Cancel)) { - foreach (QString file, this->selectedFileNames()) + Q_FOREACH (QString file, this->selectedFileNames()) { int index = this->Implementation->Filenames.indexOf(file); this->Implementation->Ui.tableWidget->removeRow(index); @@ -350,7 +321,9 @@ void pqPlayBackEventsDialog::onStarted(const QString& filename) file.open(QIODevice::ReadOnly); this->Implementation->Ui.logBrowser->append(QString("Start file : %1").arg(infoFile.fileName())); QTextStream stream(&file); +#if QT_VERSION < 0x060000 stream.setCodec("UTF-8"); +#endif this->Implementation->Ui.currentFileLabel->setText(infoFile.fileName()); while (!stream.atEnd()) { @@ -382,7 +355,7 @@ void pqPlayBackEventsDialog::updateUi() // Update Moda/Modeless this->onModal(this->Implementation->TestUtility->playingTest() && !(this->Implementation->TestUtility->playingTest() && - this->Implementation->Dispatcher.isPaused())); + this->Implementation->Dispatcher.isPaused())); // Update player buttons this->Implementation->Ui.playPauseButton->setChecked( @@ -427,7 +400,7 @@ void pqPlayBackEventsDialog::updateUi() this->Implementation->setProgressBarValue(this->Implementation->CurrentFile, static_cast((static_cast(this->Implementation->CurrentLine) / static_cast(this->Implementation->MaxLines - 1)) * - 100)); + 100)); } else { diff --git a/pqPlayBackEventsDialog.h b/pqPlayBackEventsDialog.h index 8e7cc9a..3d7f433 100644 --- a/pqPlayBackEventsDialog.h +++ b/pqPlayBackEventsDialog.h @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqPlayBackEventsDialog.h - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef _pqPlayBackEventsDialog_h #define _pqPlayBackEventsDialog_h @@ -56,7 +28,7 @@ class QTTESTING_EXPORT pqPlayBackEventsDialog : public QDialog pqEventPlayer& Player, pqEventDispatcher& Source, pqTestUtility* TestUtility, QWidget* Parent); ~pqPlayBackEventsDialog() override; -private slots: +private Q_SLOTS: void onEventAboutToBePlayed(const QString&, const QString&, const QString&); void loadFiles(); void insertFiles(); @@ -68,7 +40,7 @@ private slots: void onStopped(); void onModal(bool value); -public slots: +public Q_SLOTS: void done(int) override; void updateUi(); diff --git a/pqPythonEventObserver.cxx b/pqPythonEventObserver.cxx index 93ba5bb..80b4314 100644 --- a/pqPythonEventObserver.cxx +++ b/pqPythonEventObserver.cxx @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqPythonEventObserver.cxx - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #include "pqPythonEventObserver.h" @@ -42,9 +14,7 @@ pqPythonEventObserver::pqPythonEventObserver(QObject* p) { } -pqPythonEventObserver::~pqPythonEventObserver() -{ -} +pqPythonEventObserver::~pqPythonEventObserver() {} void pqPythonEventObserver::setStream(QTextStream* stream) { @@ -62,7 +32,7 @@ void pqPythonEventObserver::onRecordEvent( if (this->Stream) { QString varname = this->Names[Widget]; - if (varname == QString::null) + if (varname.isEmpty()) { varname = QString("object%1").arg(this->Names.count()); this->Names.insert(Widget, varname); @@ -79,6 +49,6 @@ void pqPythonEventObserver::onRecordEvent( pycommand = pycommand.arg(eventType); *this->Stream << pycommand << "\n"; - emit eventRecorded(widget, command, arguments, eventType); + Q_EMIT eventRecorded(widget, command, arguments, eventType); } } diff --git a/pqPythonEventObserver.h b/pqPythonEventObserver.h index 5bf445a..87644ac 100644 --- a/pqPythonEventObserver.h +++ b/pqPythonEventObserver.h @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqPythonEventObserver.h - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef _pqPythonEventObserver_h #define _pqPythonEventObserver_h diff --git a/pqPythonEventSource.cxx b/pqPythonEventSource.cxx index 3782dec..a05d7f7 100644 --- a/pqPythonEventSource.cxx +++ b/pqPythonEventSource.cxx @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqPythonEventSource.cxx - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause /* Use the "documented" trick involving checking for _DEBUG @@ -137,7 +109,7 @@ static PyObject* QtTesting_getProperty(PyObject* /*self*/, PyObject* args) PropertyObject = object; PropertyResult = property; - PropertyValue = QString::null; + PropertyValue = QString(); if (Instance && QThread::currentThread() != QApplication::instance()->thread()) { @@ -158,13 +130,13 @@ static PyObject* QtTesting_getProperty(PyObject* /*self*/, PyObject* args) return NULL; } - if (PropertyObject == QString::null) + if (PropertyObject.isEmpty()) { PyErr_SetString(PyExc_ValueError, "object not found"); return NULL; } - if (PropertyResult == QString::null) + if (PropertyResult.isEmpty()) { PyErr_SetString(PyExc_ValueError, "property not found"); return NULL; @@ -210,13 +182,13 @@ static PyObject* QtTesting_setProperty(PyObject* /*self*/, PyObject* args) return NULL; } - if (PropertyObject == QString::null) + if (PropertyObject.isEmpty()) { PyErr_SetString(PyExc_ValueError, "object not found"); return NULL; } - if (PropertyResult == QString::null) + if (PropertyResult.isEmpty()) { PyErr_SetString(PyExc_ValueError, "property not found"); return NULL; @@ -267,7 +239,7 @@ static PyObject* QtTesting_getChildren(PyObject* /*self*/, PyObject* args) return NULL; } - if (PropertyObject == QString::null) + if (PropertyObject.isEmpty()) { PyErr_SetString(PyExc_ValueError, "object not found"); return NULL; @@ -315,12 +287,12 @@ static PyObject* QtTesting_invokeMethod(PyObject* /*self*/, PyObject* args) return NULL; } - if (PropertyObject == QString::null) + if (PropertyObject.isEmpty()) { PyErr_SetString(PyExc_ValueError, "object not found"); return NULL; } - else if (PropertyValue == QString::null) + else if (PropertyValue.isEmpty()) { PyErr_SetString(PyExc_ValueError, "method not found"); return NULL; @@ -401,13 +373,13 @@ QString pqPythonEventSource::getProperty(QString& object, QString& prop) QObject* qobject = pqObjectNaming::GetObject(object); if (!qobject) { - object = QString::null; + object = QString(); return QString(); } int idx = qobject->metaObject()->indexOfProperty(prop.toUtf8().data()); if (idx == -1) { - prop = QString::null; + prop = QString(); return QString(); } else @@ -438,14 +410,14 @@ void pqPythonEventSource::setProperty(QString& object, QString& prop, const QStr QObject* qobject = pqObjectNaming::GetObject(object); if (!qobject) { - object = QString::null; + object = QString(); return; } int idx = qobject->metaObject()->indexOfProperty(prop.toUtf8().data()); if (idx == -1) { - prop = QString::null; + prop = QString(); return; } else @@ -475,12 +447,12 @@ QStringList pqPythonEventSource::getChildren(QString& object) QObject* qobject = pqObjectNaming::GetObject(object); if (!qobject) { - object = QString::null; + object = QString(); } else { const QObjectList& children = qobject->children(); - foreach (QObject* child, children) + Q_FOREACH (QObject* child, children) { ret.append(pqObjectNaming::GetName(*child)); } @@ -541,13 +513,13 @@ QString pqPythonEventSource::invokeMethod(QString& object, QString& method) QObject* qobject = pqObjectNaming::GetObject(object); if (!qobject) { - object = QString::null; + object = QString(); } else { if (!QMetaObject::invokeMethod(qobject, method.toUtf8().data(), Q_RETURN_ARG(QVariant, ret))) { - method = QString::null; + method = QString(); } } return ret.toString(); diff --git a/pqPythonEventSource.h b/pqPythonEventSource.h index 466d275..dec7e19 100644 --- a/pqPythonEventSource.h +++ b/pqPythonEventSource.h @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqPythonEventSource.h - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef _pqPythonEventSource_h #define _pqPythonEventSource_h @@ -56,7 +28,7 @@ class QTTESTING_EXPORT pqPythonEventSource : public pqThreadedEventSource virtual void run(); virtual void start(); -protected slots: +protected Q_SLOTS: void threadGetProperty(); void threadSetProperty(); void threadGetChildren(); diff --git a/pqRecordEventsDialog.cxx b/pqRecordEventsDialog.cxx index 3ec3326..481a1fe 100644 --- a/pqRecordEventsDialog.cxx +++ b/pqRecordEventsDialog.cxx @@ -1,39 +1,12 @@ -/*========================================================================= - - Program: ParaView - Module: pqRecordEventsDialog.cxx - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause // Qt includes #include #include #include +#include #include #include #include @@ -105,6 +78,16 @@ pqRecordEventsDialog::pqRecordEventsDialog( QObject::connect(this->Implementation->Ui.continuousFlush, SIGNAL(toggled(bool)), this->Implementation->Recorder, SLOT(setContinuousFlush(bool))); + if (this->Implementation->TestUtility->supportsDashboardMode()) + { + QObject::connect(this->Implementation->Ui.dashboardMode, SIGNAL(toggled(bool)), this, + SLOT(onDashboardModeToggled(bool))); + } + else + { + this->Implementation->Ui.dashboardMode->setVisible(false); + } + QObject::connect(this->Implementation->Ui.recordInteractionTimings, SIGNAL(toggled(bool)), this->Implementation->Recorder, SLOT(setRecordInteractionTimings(bool))); @@ -122,7 +105,7 @@ pqRecordEventsDialog::~pqRecordEventsDialog() void pqRecordEventsDialog::ignoreObject(QObject* object) { this->Implementation->TestUtility->eventTranslator()->ignoreObject(object); - foreach (QObject* child, object->children()) + Q_FOREACH (QObject* child, object->children()) { this->ignoreObject(child); } @@ -170,6 +153,25 @@ void pqRecordEventsDialog::addComment() // ---------------------------------------------------------------------------- void pqRecordEventsDialog::updateUi() { - this->Implementation->Ui.recordPauseButton->setChecked( - this->Implementation->Recorder->isRecording()); + bool recording = this->Implementation->Recorder->isRecording(); + this->Implementation->Ui.recordPauseButton->setChecked(recording); + this->Implementation->Ui.dashboardMode->setEnabled(recording); +} + +// ---------------------------------------------------------------------------- +void pqRecordEventsDialog::onDashboardModeToggled(bool toggle) +{ + this->Implementation->TestUtility->setDashboardMode(toggle); + + const QWidgetList& list = QApplication::topLevelWidgets(); + QMainWindow* mainWindow = nullptr; + for (QWidget* widg : list) + { + mainWindow = qobject_cast(widg); + if (mainWindow) + { + break; + } + } + this->Implementation->Recorder->translator()->recordDashboardModeToggle(mainWindow, toggle); } diff --git a/pqRecordEventsDialog.h b/pqRecordEventsDialog.h index 0eb7d2a..c0bce7e 100644 --- a/pqRecordEventsDialog.h +++ b/pqRecordEventsDialog.h @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqRecordEventsDialog.h - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef _pqRecordEventsDialog_h #define _pqRecordEventsDialog_h @@ -51,13 +23,20 @@ class QTTESTING_EXPORT pqRecordEventsDialog : public QDialog */ pqRecordEventsDialog(pqEventRecorder* recorder, pqTestUtility* testUtility, QWidget* Parent); -private slots: +private Q_SLOTS: void done(int) override; void onEventRecorded(const QString&, const QString&, const QString&, int eventType); void addComment(); -public slots: + /** + * Called when dashboard mode is toggled. + * Call setDashboardMode on the test utility + * and record a dashboard mode toggle event on the main window + */ + void onDashboardModeToggled(bool toggle); + +public Q_SLOTS: void updateUi(); private: diff --git a/pqRecordEventsDialog.ui b/pqRecordEventsDialog.ui index 59fa536..ab1e880 100644 --- a/pqRecordEventsDialog.ui +++ b/pqRecordEventsDialog.ui @@ -262,6 +262,19 @@ + + + + Dashboard mode + + + When checked/unchecked, will trigger dashboard mode accordingly and record corresponding event + + + true + + + diff --git a/pqSpinBoxEventTranslator.cxx b/pqSpinBoxEventTranslator.cxx index e353cc2..04f6f85 100644 --- a/pqSpinBoxEventTranslator.cxx +++ b/pqSpinBoxEventTranslator.cxx @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqSpinBoxEventTranslator.cxx - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #include "pqSpinBoxEventTranslator.h" @@ -88,11 +60,11 @@ bool pqSpinBoxEventTranslator::translateEvent(QObject* Object, QEvent* Event, bo QString keyText = ke->text(); if (keyText.length() && keyText.at(0).isPrint()) { - emit recordEvent(object, "set_int", QString("%1").arg(object->value())); + Q_EMIT recordEvent(object, "set_int", QString("%1").arg(object->value())); } else { - emit recordEvent(object, "key", QString("%1").arg(ke->key())); + Q_EMIT recordEvent(object, "key", QString("%1").arg(ke->key())); } return true; } @@ -108,5 +80,5 @@ void pqSpinBoxEventTranslator::onDestroyed(QObject* /*Object*/) // ---------------------------------------------------------------------------- void pqSpinBoxEventTranslator::onValueChanged(int number) { - emit recordEvent(this->CurrentObject, "set_int", QString("%1").arg(number)); + Q_EMIT recordEvent(this->CurrentObject, "set_int", QString("%1").arg(number)); } diff --git a/pqSpinBoxEventTranslator.h b/pqSpinBoxEventTranslator.h index 0d4e369..d16be8f 100644 --- a/pqSpinBoxEventTranslator.h +++ b/pqSpinBoxEventTranslator.h @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqSpinBoxEventTranslator.h - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef _pqSpinBoxEventTranslator_h #define _pqSpinBoxEventTranslator_h @@ -58,7 +30,7 @@ class QTTESTING_EXPORT pqSpinBoxEventTranslator : public pqWidgetEventTranslator QObject* CurrentObject; -private slots: +private Q_SLOTS: void onDestroyed(QObject*); void onValueChanged(int number); }; diff --git a/pqStdoutEventObserver.cxx b/pqStdoutEventObserver.cxx index 50bdf4c..0854d7c 100644 --- a/pqStdoutEventObserver.cxx +++ b/pqStdoutEventObserver.cxx @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqStdoutEventObserver.cxx - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #include "pqStdoutEventObserver.h" #include diff --git a/pqStdoutEventObserver.h b/pqStdoutEventObserver.h index 3be8e20..9dd108e 100644 --- a/pqStdoutEventObserver.h +++ b/pqStdoutEventObserver.h @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqStdoutEventObserver.h - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef _pqStdoutEventObserver_h #define _pqStdoutEventObserver_h @@ -48,7 +20,7 @@ class QTTESTING_EXPORT pqStdoutEventObserver : public QObject { Q_OBJECT -public slots: +public Q_SLOTS: void onRecordEvent( const QString& Widget, const QString& Command, const QString& Arguments, const int& eventType); }; diff --git a/pqTabBarEventPlayer.cxx b/pqTabBarEventPlayer.cxx index 3ca893a..c92113a 100644 --- a/pqTabBarEventPlayer.cxx +++ b/pqTabBarEventPlayer.cxx @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqTabBarEventPlayer.cxx - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #include "pqTabBarEventPlayer.h" diff --git a/pqTabBarEventPlayer.h b/pqTabBarEventPlayer.h index 9deb935..611b197 100644 --- a/pqTabBarEventPlayer.h +++ b/pqTabBarEventPlayer.h @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqTabBarEventPlayer.h - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef _pqTabBarEventPlayer_h #define _pqTabBarEventPlayer_h diff --git a/pqTabBarEventTranslator.cxx b/pqTabBarEventTranslator.cxx index a73d221..7e663ee 100644 --- a/pqTabBarEventTranslator.cxx +++ b/pqTabBarEventTranslator.cxx @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqTabBarEventTranslator.cxx - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #include "pqTabBarEventTranslator.h" @@ -76,8 +48,8 @@ bool pqTabBarEventTranslator::translateEvent(QObject* Object, QEvent* Event, boo void pqTabBarEventTranslator::indexChanged(int which) { QObject* recordedObject = this->CurrentObject; - if (QObject* parent = this->CurrentObject->parent(); - parent && this->CurrentObject->objectName().isEmpty()) + QObject* parent = this->CurrentObject->parent(); + if (parent && this->CurrentObject->objectName().isEmpty()) { QMainWindow* mainWindow = qobject_cast(this->CurrentObject->parent()); if (mainWindow) @@ -86,5 +58,5 @@ void pqTabBarEventTranslator::indexChanged(int which) } } - emit recordEvent(recordedObject, "set_tab_with_text", this->CurrentObject->tabText(which)); + Q_EMIT recordEvent(recordedObject, "set_tab_with_text", this->CurrentObject->tabText(which)); } diff --git a/pqTabBarEventTranslator.h b/pqTabBarEventTranslator.h index eb6a7b2..baac8bd 100644 --- a/pqTabBarEventTranslator.h +++ b/pqTabBarEventTranslator.h @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqTabBarEventTranslator.h - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef _pqTabBarEventTranslator_h #define _pqTabBarEventTranslator_h @@ -67,7 +39,7 @@ class QTTESTING_EXPORT pqTabBarEventTranslator : public pqWidgetEventTranslator using Superclass::translateEvent; bool translateEvent(QObject* Object, QEvent* Event, bool& Error) override; -protected slots: +protected Q_SLOTS: void indexChanged(int); private: diff --git a/pqTableViewEventPlayer.cxx b/pqTableViewEventPlayer.cxx index 64400bd..6344f82 100644 --- a/pqTableViewEventPlayer.cxx +++ b/pqTableViewEventPlayer.cxx @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqTableViewEventPlayer.cxx - - Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #include "pqTableViewEventPlayer.h" #include @@ -39,9 +11,7 @@ pqTableViewEventPlayer::pqTableViewEventPlayer(QObject* parentObject) } //----------------------------------------------------------------------------- -pqTableViewEventPlayer::~pqTableViewEventPlayer() -{ -} +pqTableViewEventPlayer::~pqTableViewEventPlayer() {} //-----------------------------------------------------------------------------0000000 bool pqTableViewEventPlayer::playEvent( diff --git a/pqTableViewEventPlayer.h b/pqTableViewEventPlayer.h index 7e6e0c9..5da924f 100644 --- a/pqTableViewEventPlayer.h +++ b/pqTableViewEventPlayer.h @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqTableViewEventPlayer.h - - Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef __pqTableViewEventPlayer_h #define __pqTableViewEventPlayer_h diff --git a/pqTableViewEventTranslator.cxx b/pqTableViewEventTranslator.cxx index 205561e..a385dae 100644 --- a/pqTableViewEventTranslator.cxx +++ b/pqTableViewEventTranslator.cxx @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqTableViewEventTranslator.cxx - - Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #include "pqTableViewEventTranslator.h" #include @@ -40,9 +12,7 @@ pqTableViewEventTranslator::pqTableViewEventTranslator(QObject* parentObject) } //----------------------------------------------------------------------------- -pqTableViewEventTranslator::~pqTableViewEventTranslator() -{ -} +pqTableViewEventTranslator::~pqTableViewEventTranslator() {} //----------------------------------------------------------------------------- void pqTableViewEventTranslator::onEnteredCheck(const QModelIndex& item) @@ -60,7 +30,7 @@ void pqTableViewEventTranslator::onEnteredCheck(const QModelIndex& item) // Stor item and signal that a specific overlay is ready to be drawn this->ModelItemCheck = &item; - emit this->specificOverlay(visualRect); + Q_EMIT this->specificOverlay(visualRect); } //----------------------------------------------------------------------------- diff --git a/pqTableViewEventTranslator.h b/pqTableViewEventTranslator.h index 9988c24..3dbb9b7 100644 --- a/pqTableViewEventTranslator.h +++ b/pqTableViewEventTranslator.h @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqTableViewEventTranslator.h - - Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef __pqTableViewEventTranslator_h #define __pqTableViewEventTranslator_h @@ -49,7 +21,7 @@ class QTTESTING_EXPORT pqTableViewEventTranslator : public pqAbstractItemViewEve /// find and set the corrected abstract item view QAbstractItemView* findCorrectedAbstractItemView(QObject* object) const override; -protected slots: +protected Q_SLOTS: /// Compute a visual rectangle for the item and signal it void onEnteredCheck(const QModelIndex&) override; diff --git a/pqTestUtility.cxx b/pqTestUtility.cxx index 93477b6..9c36a15 100644 --- a/pqTestUtility.cxx +++ b/pqTestUtility.cxx @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqTestUtility.cxx - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause // Qt includes #include @@ -228,6 +200,9 @@ void pqTestUtility::onRecordStopped() delete dialog; } this->File->close(); + + this->setDashboardMode(false); + this->updateTranslators(); } //----------------------------------------------------------------------------- @@ -247,11 +222,14 @@ bool pqTestUtility::playTests(const QStringList& filenames) return false; } + this->setDashboardMode(true); + this->updatePlayers(); + this->PlayingTest = true; - emit this->playbackStarted(); + Q_EMIT this->playbackStarted(); bool success = true; - foreach (QString filename, filenames) + Q_FOREACH (QString filename, filenames) { this->Filename = filename; if (!this->playingTest()) @@ -266,7 +244,7 @@ bool pqTestUtility::playTests(const QStringList& filenames) return false; } - emit this->playbackStarted(filename); + Q_EMIT this->playbackStarted(filename); QString suffix = info.completeSuffix(); QMap::iterator iter; @@ -284,17 +262,19 @@ bool pqTestUtility::playTests(const QStringList& filenames) // dispatcher returned failure, don't continue with rest of the tests // and flag error. success = false; - emit this->playbackStopped(info.fileName(), success); + Q_EMIT this->playbackStopped(info.fileName(), success); break; } - emit this->playbackStopped(info.fileName(), success); + Q_EMIT this->playbackStopped(info.fileName(), success); qDebug() << "Test " << info.fileName() << "is finished. Success = " << success; } } this->Filename = ""; this->PlayingTest = false; - emit this->playbackStopped(); + this->setDashboardMode(false); + this->updatePlayers(); + Q_EMIT this->playbackStopped(); return success; } @@ -314,6 +294,9 @@ void pqTestUtility::recordTests() } #endif + this->setDashboardMode(true); + this->updateTranslators(); + pqEventObserver* observer = this->EventObservers.value(this->FileSuffix); if (!observer) { @@ -359,7 +342,7 @@ void pqTestUtility::recordTests(const QString& filename) this->Filename = filename; this->File = new QFile(filename); QFileInfo info(filename); - this->FileSuffix = info.completeSuffix(); + this->FileSuffix = info.suffix(); this->recordTests(); } diff --git a/pqTestUtility.h b/pqTestUtility.h index 787a451..f69ad2a 100644 --- a/pqTestUtility.h +++ b/pqTestUtility.h @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqTestUtility.h - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef _pqTestUtility_h #define _pqTestUtility_h @@ -134,7 +106,14 @@ class QTTESTING_EXPORT pqTestUtility : public QObject bool recordWithDialog() const; /// Set whether a dialog is opened when recording. void setRecordWithDialog(bool withDialog); -public slots: + + /** + * Wether a pqTestUtility implementation supports + * dashboard mode. Always return false in this implementation. + */ + virtual bool supportsDashboardMode() { return false; }; + +public Q_SLOTS: bool playTests(const QString& filename); /// @note Dialog is deleted on close. @@ -146,7 +125,28 @@ public slots: void onRecordStopped(); -signals: + /** + * Slot called when the dashboard mode checkbox is changed + * and just before recording / stopping recording events. + * Not implemented in this implementation. + */ + virtual void setDashboardMode(bool){}; + + /** + * Update the players if needed by the environnement + * called before playing events. + * Not implemented in this implementation. + */ + virtual void updatePlayers(){}; + + /** + * Update the translators if needed by the environnement + * called before and after recording events. + * Not implemented in this implementation. + */ + virtual void updateTranslators(){}; + +Q_SIGNALS: void playbackStarted(); void playbackStopped(); void playbackStarted(const QString& filename); diff --git a/pqThreadedEventSource.cxx b/pqThreadedEventSource.cxx index c25f9c1..60f1970 100644 --- a/pqThreadedEventSource.cxx +++ b/pqThreadedEventSource.cxx @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqThreadedEventSource.cxx - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #include "pqThreadedEventSource.h" @@ -100,7 +72,7 @@ int pqThreadedEventSource::getNextEvent(QString& object, QString& command, QStri this->Internal->GotEvent = 0; this->guiAcknowledge(); - if (object == QString::null) + if (object.isEmpty()) { if (arguments == "failure") { diff --git a/pqThreadedEventSource.h b/pqThreadedEventSource.h index f44a0bf..7cc67ca 100644 --- a/pqThreadedEventSource.h +++ b/pqThreadedEventSource.h @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqThreadedEventSource.h - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef _pqThreadedEventSource_h #define _pqThreadedEventSource_h @@ -49,6 +21,7 @@ class QTTESTING_EXPORT pqThreadedEventSource : public pqEventSource pqThreadedEventSource(QObject* p); ~pqThreadedEventSource() override; + using pqEventSource::getNextEvent; /** Called by the dispatcher on the GUI thread. Retrieves the next available event. Returns true if an event was returned, false if there are no more events. @@ -79,7 +52,7 @@ class QTTESTING_EXPORT pqThreadedEventSource : public pqEventSource // helper method to sleep. static void msleep(int msecs); -private slots: +private Q_SLOTS: void relayEvent(QString object, QString command, QString arguments); diff --git a/pqTimer.cxx b/pqTimer.cxx index fc99ed5..9d5ef85 100644 --- a/pqTimer.cxx +++ b/pqTimer.cxx @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: $RCSfile$ - - Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #include "pqTimer.h" #include "pqEventDispatcher.h" @@ -41,9 +13,7 @@ pqTimer::pqTimer(QObject* parentObject) } //----------------------------------------------------------------------------- -pqTimer::~pqTimer() -{ -} +pqTimer::~pqTimer() {} //----------------------------------------------------------------------------- void pqTimer::timerEvent(QTimerEvent* evt) diff --git a/pqTimer.h b/pqTimer.h index 618aad1..92d42a0 100644 --- a/pqTimer.h +++ b/pqTimer.h @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: $RCSfile$ - - Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef __pqTimer_h #define __pqTimer_h diff --git a/pqTreeViewEventPlayer.cxx b/pqTreeViewEventPlayer.cxx index ff45e54..7fe9d88 100644 --- a/pqTreeViewEventPlayer.cxx +++ b/pqTreeViewEventPlayer.cxx @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqTreeViewEventPlayer.cxx - - Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #include "pqTreeViewEventPlayer.h" #include #include @@ -41,11 +13,9 @@ pqTreeViewEventPlayer::pqTreeViewEventPlayer(QObject* parentObject) } //----------------------------------------------------------------------------- -pqTreeViewEventPlayer::~pqTreeViewEventPlayer() -{ -} +pqTreeViewEventPlayer::~pqTreeViewEventPlayer() {} -//-----------------------------------------------------------------------------0000000 +//----------------------------------------------------------------------------- bool pqTreeViewEventPlayer::playEvent( QObject* object, const QString& command, const QString& arguments, int eventType, bool& error) { @@ -63,8 +33,9 @@ bool pqTreeViewEventPlayer::playEvent( return false; } - QRegExp regExp0("^([\\d\\.]+),(\\d+),(\\d+)$"); - if (command == "setTreeItemCheckState" && regExp0.indexIn(arguments) != -1) + QRegularExpression regExp0("^([\\d\\.]+),(\\d+),(\\d+)$"); + QRegularExpressionMatch match = regExp0.match(arguments); + if (command == "setTreeItemCheckState" && match.hasMatch()) { // legacy command recorded from tree widgets. QTreeWidget* treeWidget = qobject_cast(object); @@ -72,13 +43,16 @@ bool pqTreeViewEventPlayer::playEvent( { return false; } - QString str_index = regExp0.cap(1); - int column = regExp0.cap(2).toInt(); - int check_state = regExp0.cap(3).toInt(); - + QString str_index = match.captured(1); + int column = match.captured(2).toInt(); + int check_state = match.captured(3).toInt(); +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + QStringList indices = str_index.split(".", Qt::SkipEmptyParts); +#else QStringList indices = str_index.split(".", QString::SkipEmptyParts); +#endif QTreeWidgetItem* cur_item = NULL; - foreach (QString cur_index, indices) + Q_FOREACH (QString cur_index, indices) { int index = cur_index.toInt(); if (!cur_item) diff --git a/pqTreeViewEventPlayer.h b/pqTreeViewEventPlayer.h index 0b5ab49..d790822 100644 --- a/pqTreeViewEventPlayer.h +++ b/pqTreeViewEventPlayer.h @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqTreeViewEventPlayer.h - - Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef __pqTreeViewEventPlayer_h #define __pqTreeViewEventPlayer_h diff --git a/pqTreeViewEventTranslator.cxx b/pqTreeViewEventTranslator.cxx index 65c8f91..c3ee60d 100644 --- a/pqTreeViewEventTranslator.cxx +++ b/pqTreeViewEventTranslator.cxx @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqTreeViewEventTranslator.cxx - - Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #include "pqTreeViewEventTranslator.h" @@ -42,9 +14,7 @@ pqTreeViewEventTranslator::pqTreeViewEventTranslator(QObject* parentObject) } //----------------------------------------------------------------------------- -pqTreeViewEventTranslator::~pqTreeViewEventTranslator() -{ -} +pqTreeViewEventTranslator::~pqTreeViewEventTranslator() {} //----------------------------------------------------------------------------- void pqTreeViewEventTranslator::monitorSignalsInternal(QAbstractItemView* abstractItemView) @@ -61,7 +31,7 @@ void pqTreeViewEventTranslator::onExpanded(const QModelIndex& index) QTreeView* treeView = qobject_cast(this->sender()); // record the check state change if the item is user-checkable. - emit this->recordEvent(treeView, "expand", this->getIndexAsString(index)); + Q_EMIT this->recordEvent(treeView, "expand", this->getIndexAsString(index)); } //----------------------------------------------------------------------------- @@ -70,7 +40,7 @@ void pqTreeViewEventTranslator::onCollapsed(const QModelIndex& index) QTreeView* treeView = qobject_cast(this->sender()); // record the check state change if the item is user-checkable. - emit this->recordEvent(treeView, "collapse", this->getIndexAsString(index)); + Q_EMIT this->recordEvent(treeView, "collapse", this->getIndexAsString(index)); } //----------------------------------------------------------------------------- @@ -90,7 +60,7 @@ void pqTreeViewEventTranslator::onEnteredCheck(const QModelIndex& item) // store item and signal that a specific overlay is ready to be drawn this->ModelItemCheck = &item; - emit this->specificOverlay(visualRect); + Q_EMIT this->specificOverlay(visualRect); } //----------------------------------------------------------------------------- diff --git a/pqTreeViewEventTranslator.h b/pqTreeViewEventTranslator.h index 0396f83..9d67fbb 100644 --- a/pqTreeViewEventTranslator.h +++ b/pqTreeViewEventTranslator.h @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqTreeViewEventTranslator.h - - Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef __pqTreeViewEventTranslator_h #define __pqTreeViewEventTranslator_h @@ -49,7 +21,7 @@ class QTTESTING_EXPORT pqTreeViewEventTranslator : public pqAbstractItemViewEven /// find and set the corrected abstract item view QAbstractItemView* findCorrectedAbstractItemView(QObject* object) const override; -protected slots: +protected Q_SLOTS: void onExpanded(const QModelIndex&); void onCollapsed(const QModelIndex&); diff --git a/pqWidgetEventPlayer.cxx b/pqWidgetEventPlayer.cxx index 3c44604..da4f9f1 100644 --- a/pqWidgetEventPlayer.cxx +++ b/pqWidgetEventPlayer.cxx @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqWidgetEventPlayer.cxx - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #include "pqWidgetEventPlayer.h" @@ -39,17 +11,13 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include // for std::abs -#include "pqEventTypes.h" - -pqWidgetEventPlayer::pqWidgetEventPlayer(QObject* p) - : QObject(p) -{ -} - -pqWidgetEventPlayer::~pqWidgetEventPlayer() +// ---------------------------------------------------------------------------- +pqWidgetEventPlayer::pqWidgetEventPlayer(QObject* parent) + : Superclass(parent) { } +// ---------------------------------------------------------------------------- bool pqWidgetEventPlayer::playEvent( QObject* object, const QString& command, const QString& arguments, bool& error) { @@ -107,13 +75,3 @@ bool pqWidgetEventPlayer::playEvent( } return false; } - -bool pqWidgetEventPlayer::playEvent( - QObject* object, const QString& command, const QString& arguments, int eventType, bool& error) -{ - if (eventType == pqEventTypes::ACTION_EVENT) - { - return this->playEvent(object, command, arguments, error); - } - return false; -} diff --git a/pqWidgetEventPlayer.h b/pqWidgetEventPlayer.h index 8596ac7..888a55e 100644 --- a/pqWidgetEventPlayer.h +++ b/pqWidgetEventPlayer.h @@ -1,66 +1,38 @@ -/*========================================================================= - - Program: ParaView - Module: pqWidgetEventPlayer.h - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef _pqWidgetEventPlayer_h #define _pqWidgetEventPlayer_h #include "QtTestingExport.h" -#include + +#include "pqObjectPlayer.h" class QString; /** -Abstract interface for an object that can playback high-level -ParaView events by translating them into low-level Qt events, -for test-cases, demos, tutorials, etc. + * Implements pqObjectPlayer for QWidgets. + * + * \sa pqEventPlayer + */ -\sa pqEventPlayer -*/ - -class QTTESTING_EXPORT pqWidgetEventPlayer : public QObject +class QTTESTING_EXPORT pqWidgetEventPlayer : public pqObjectPlayer { Q_OBJECT + typedef pqObjectPlayer Superclass; public: - pqWidgetEventPlayer(QObject* p); - ~pqWidgetEventPlayer() override; + pqWidgetEventPlayer(QObject* parent); + ~pqWidgetEventPlayer() override = default; + + using Superclass::playEvent; - /** Derivatives should implement this and play-back the given command, - returning "true" if they handled the command, and setting Error - to "true" if there were any problems. */ - virtual bool playEvent( - QObject* object, const QString& command, const QString& arguments, bool& error); - virtual bool playEvent( - QObject* object, const QString& command, const QString& arguments, int eventType, bool& error); + /** + * Handle generics command action, like resize and context menu trigger. + */ + bool playEvent( + QObject* object, const QString& command, const QString& arguments, bool& error) override; }; #endif // !_pqWidgetEventPlayer_h diff --git a/pqWidgetEventTranslator.cxx b/pqWidgetEventTranslator.cxx index d75f218..76f0bc0 100644 --- a/pqWidgetEventTranslator.cxx +++ b/pqWidgetEventTranslator.cxx @@ -1,38 +1,11 @@ -/*========================================================================= - - Program: ParaView - Module: pqWidgetEventTranslator.cxx - - Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #include "pqWidgetEventTranslator.h" #include "pqEventTypes.h" #include #include +#include //----------------------------------------------------------------------------- pqWidgetEventTranslator::pqWidgetEventTranslator(QObject* parentObject) @@ -41,12 +14,11 @@ pqWidgetEventTranslator::pqWidgetEventTranslator(QObject* parentObject) } //----------------------------------------------------------------------------- -pqWidgetEventTranslator::~pqWidgetEventTranslator() -{ -} +pqWidgetEventTranslator::~pqWidgetEventTranslator() {} bool pqWidgetEventTranslator::translateEvent(QObject* object, QEvent* event, bool& error) { + Q_UNUSED(error); QWidget* widget = qobject_cast(object); if (!widget) { @@ -57,7 +29,7 @@ bool pqWidgetEventTranslator::translateEvent(QObject* object, QEvent* event, boo { case QEvent::ContextMenu: { - emit recordEvent(widget, "contextMenu", ""); + Q_EMIT recordEvent(widget, "contextMenu", ""); break; } default: diff --git a/pqWidgetEventTranslator.h b/pqWidgetEventTranslator.h index 373dcbc..e81e7f7 100644 --- a/pqWidgetEventTranslator.h +++ b/pqWidgetEventTranslator.h @@ -1,34 +1,6 @@ -/*========================================================================= - - Program: ParaView - Module: pqWidgetEventTranslator.h - - Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc. - All rights reserved. - - ParaView is a free software; you can redistribute it and/or modify it - under the terms of the ParaView license version 1.2. - - See License_v1.2.txt for the full ParaView license. - A copy of this license can be obtained by contacting - Kitware Inc. - 28 Corporate Drive - Clifton Park, NY 12065 - USA - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=========================================================================*/ +// SPDX-FileCopyrightText: Copyright (c) Kitware Inc. +// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation +// SPDX-License-Identifier: BSD-3-Clause #ifndef _pqWidgetEventTranslator_h #define _pqWidgetEventTranslator_h @@ -61,7 +33,7 @@ class QTTESTING_EXPORT pqWidgetEventTranslator : public QObject virtual bool translateEvent(QObject* object, QEvent* event, bool& error); virtual bool translateEvent(QObject* object, QEvent* event, int eventType, bool& error); -signals: +Q_SIGNALS: /// Derivatives should emit this signal whenever they wish to record a high-level event void recordEvent( QObject* Object, const QString& Command, const QString& Arguments, int eventType);