diff --git a/UI/cmake/legacy.cmake b/UI/cmake/legacy.cmake index f0f3eb802..073964f19 100644 --- a/UI/cmake/legacy.cmake +++ b/UI/cmake/legacy.cmake @@ -71,6 +71,10 @@ find_package(CURL REQUIRED) add_subdirectory(frontend-plugins) add_executable(obs) +if(NOT TARGET OBS::qt-plain-text-edit) + add_subdirectory("${CMAKE_SOURCE_DIR}/shared/qt/plain-text-edit" "${CMAKE_BINARY_DIR}/shared/qt/plain-text-edit") +endif() + if(NOT TARGET OBS::qt-wrappers) add_subdirectory("${CMAKE_SOURCE_DIR}/shared/qt/wrappers" "${CMAKE_BINARY_DIR}/shared/qt/wrappers") endif() @@ -195,8 +199,6 @@ target_sources( menu-button.hpp mute-checkbox.hpp noncheckable-button.hpp - plain-text-edit.cpp - plain-text-edit.hpp properties-view.cpp properties-view.hpp properties-view.moc.hpp @@ -316,7 +318,8 @@ target_link_libraries( FFmpeg::avformat OBS::libobs OBS::frontend-api - OBS::qt-wrappers) + OBS::qt-wrappers + OBS::qt-plain-text-edit) set_target_properties(obs PROPERTIES FOLDER "frontend") diff --git a/UI/cmake/ui-elements.cmake b/UI/cmake/ui-elements.cmake index fccdf42a0..8d0ed150a 100644 --- a/UI/cmake/ui-elements.cmake +++ b/UI/cmake/ui-elements.cmake @@ -9,8 +9,6 @@ target_sources( double-slider.hpp horizontal-scroll-area.cpp horizontal-scroll-area.hpp - plain-text-edit.cpp - plain-text-edit.hpp properties-view.cpp properties-view.hpp properties-view.moc.hpp @@ -26,6 +24,12 @@ target_compile_options(obs-ui-support INTERFACE $<$:-Wno-erro target_link_libraries(obs-studio PRIVATE OBS::ui-support) +if(NOT TARGET OBS::qt-plain-text-edit) + add_subdirectory("${CMAKE_SOURCE_DIR}/shared/qt/plain-text-edit" "${CMAKE_BINARY_DIR}/shared/qt/plain-text-edit") +endif() + +target_link_libraries(obs-studio PRIVATE OBS::qt-plain-text-edit) + target_sources( obs-studio PRIVATE # cmake-format: sortable diff --git a/UI/frontend-plugins/aja-output-ui/CMakeLists.txt b/UI/frontend-plugins/aja-output-ui/CMakeLists.txt index 9c7e8c9e6..fb55d672f 100644 --- a/UI/frontend-plugins/aja-output-ui/CMakeLists.txt +++ b/UI/frontend-plugins/aja-output-ui/CMakeLists.txt @@ -23,6 +23,10 @@ if(NOT TARGET OBS::aja-support) add_subdirectory("${CMAKE_SOURCE_DIR}/plugins/aja" "${CMAKE_BINARY_DIR}/plugins/aja") endif() +if(NOT TARGET OBS::qt-plain-text-edit) + add_subdirectory("${CMAKE_SOURCE_DIR}/shared/qt/plain-text-edit" "${CMAKE_BINARY_DIR}/shared/qt/plain-text-edit") +endif() + if(NOT TARGET OBS::qt-wrappers) add_subdirectory("${CMAKE_SOURCE_DIR}/shared/qt/wrappers" "${CMAKE_BINARY_DIR}/shared/qt/wrappers") endif() @@ -44,6 +48,7 @@ target_link_libraries( PRIVATE OBS::libobs OBS::aja-support OBS::frontend-api + OBS::qt-plain-text-edit OBS::qt-wrappers OBS::ui-support Qt::Widgets diff --git a/UI/frontend-plugins/aja-output-ui/cmake/legacy.cmake b/UI/frontend-plugins/aja-output-ui/cmake/legacy.cmake index 734683488..3988b5240 100644 --- a/UI/frontend-plugins/aja-output-ui/cmake/legacy.cmake +++ b/UI/frontend-plugins/aja-output-ui/cmake/legacy.cmake @@ -9,6 +9,10 @@ find_package(LibAJANTV2 REQUIRED) add_library(aja-output-ui MODULE) add_library(OBS::aja-output-ui ALIAS aja-output-ui) +if(NOT TARGET OBS::qt-plain-text-edit) + add_subdirectory("${CMAKE_SOURCE_DIR}/shared/qt/plain-text-edit" "${CMAKE_BINARY_DIR}/shared/qt/plain-text-edit") +endif() + if(NOT TARGET OBS::qt-wrappers) add_subdirectory("${CMAKE_SOURCE_DIR}/shared/qt/wrappers" "${CMAKE_BINARY_DIR}/shared/qt/wrappers") endif() @@ -52,8 +56,6 @@ target_sources( ${CMAKE_SOURCE_DIR}/plugins/aja/aja-widget-io.hpp ${CMAKE_SOURCE_DIR}/UI/double-slider.cpp ${CMAKE_SOURCE_DIR}/UI/double-slider.hpp - ${CMAKE_SOURCE_DIR}/UI/plain-text-edit.hpp - ${CMAKE_SOURCE_DIR}/UI/plain-text-edit.cpp ${CMAKE_SOURCE_DIR}/UI/properties-view.hpp ${CMAKE_SOURCE_DIR}/UI/properties-view.cpp ${CMAKE_SOURCE_DIR}/UI/properties-view.moc.hpp @@ -64,7 +66,8 @@ target_sources( ${CMAKE_SOURCE_DIR}/UI/vertical-scroll-area.cpp ${CMAKE_SOURCE_DIR}/UI/vertical-scroll-area.hpp) -target_link_libraries(aja-output-ui PRIVATE OBS::libobs OBS::frontend-api OBS::qt-wrappers Qt::Widgets AJA::LibAJANTV2) +target_link_libraries(aja-output-ui PRIVATE OBS::libobs OBS::frontend-api OBS::qt-wrappers OBS::qt-plain-text-edit + Qt::Widgets AJA::LibAJANTV2) if(OS_MACOS) find_library(IOKIT_FRAMEWORK Iokit) diff --git a/UI/frontend-plugins/decklink-output-ui/CMakeLists.txt b/UI/frontend-plugins/decklink-output-ui/CMakeLists.txt index 7bdd668ec..4bbbf0a43 100644 --- a/UI/frontend-plugins/decklink-output-ui/CMakeLists.txt +++ b/UI/frontend-plugins/decklink-output-ui/CMakeLists.txt @@ -20,6 +20,10 @@ endif() add_library(decklink-output-ui MODULE) add_library(OBS::decklink-output-ui ALIAS decklink-output-ui) +if(NOT TARGET OBS::qt-plain-text-edit) + add_subdirectory("${CMAKE_SOURCE_DIR}/shared/qt/plain-text-edit" "${CMAKE_BINARY_DIR}/shared/qt/plain-text-edit") +endif() + if(NOT TARGET OBS::qt-wrappers) add_subdirectory("${CMAKE_SOURCE_DIR}/shared/qt/wrappers" "${CMAKE_BINARY_DIR}/shared/qt/wrappers") endif() @@ -35,6 +39,7 @@ target_link_libraries( decklink-output-ui PRIVATE OBS::libobs OBS::frontend-api + OBS::qt-plain-text-edit OBS::qt-wrappers OBS::ui-support Qt::Widgets diff --git a/UI/frontend-plugins/decklink-output-ui/cmake/legacy.cmake b/UI/frontend-plugins/decklink-output-ui/cmake/legacy.cmake index 709c04788..43c4010d3 100644 --- a/UI/frontend-plugins/decklink-output-ui/cmake/legacy.cmake +++ b/UI/frontend-plugins/decklink-output-ui/cmake/legacy.cmake @@ -7,6 +7,10 @@ endif() add_library(decklink-output-ui MODULE) add_library(OBS::decklink-output-ui ALIAS decklink-output-ui) +if(NOT TARGET OBS::qt-plain-text-edit) + add_subdirectory("${CMAKE_SOURCE_DIR}/shared/qt/plain-text-edit" "${CMAKE_BINARY_DIR}/shared/qt/plain-text-edit") +endif() + if(NOT TARGET OBS::qt-wrappers) add_subdirectory("${CMAKE_SOURCE_DIR}/shared/qt/wrappers" "${CMAKE_BINARY_DIR}/shared/qt/wrappers") endif() @@ -34,8 +38,6 @@ target_sources( decklink-ui-main.h ${CMAKE_SOURCE_DIR}/UI/double-slider.cpp ${CMAKE_SOURCE_DIR}/UI/double-slider.hpp - ${CMAKE_SOURCE_DIR}/UI/plain-text-edit.hpp - ${CMAKE_SOURCE_DIR}/UI/plain-text-edit.cpp ${CMAKE_SOURCE_DIR}/UI/properties-view.hpp ${CMAKE_SOURCE_DIR}/UI/properties-view.cpp ${CMAKE_SOURCE_DIR}/UI/properties-view.moc.hpp @@ -46,7 +48,8 @@ target_sources( ${CMAKE_SOURCE_DIR}/UI/vertical-scroll-area.hpp ${CMAKE_SOURCE_DIR}/UI/vertical-scroll-area.cpp) -target_link_libraries(decklink-output-ui PRIVATE OBS::libobs OBS::frontend-api OBS::qt-wrappers Qt::Widgets) +target_link_libraries(decklink-output-ui PRIVATE OBS::libobs OBS::frontend-api OBS::qt-wrappers OBS::qt-plain-text-edit + Qt::Widgets) target_compile_features(decklink-output-ui PRIVATE cxx_std_17) diff --git a/UI/frontend-plugins/frontend-tools/CMakeLists.txt b/UI/frontend-plugins/frontend-tools/CMakeLists.txt index 53786eca2..1f69293be 100644 --- a/UI/frontend-plugins/frontend-tools/CMakeLists.txt +++ b/UI/frontend-plugins/frontend-tools/CMakeLists.txt @@ -14,6 +14,10 @@ endif() add_library(frontend-tools MODULE) add_library(OBS::frontend-tools ALIAS frontend-tools) +if(NOT TARGET OBS::qt-plain-text-edit) + add_subdirectory("${CMAKE_SOURCE_DIR}/shared/qt/plain-text-edit" "${CMAKE_BINARY_DIR}/shared/qt/plain-text-edit") +endif() + if(NOT TARGET OBS::qt-wrappers) add_subdirectory("${CMAKE_SOURCE_DIR}/shared/qt/wrappers" "${CMAKE_BINARY_DIR}/shared/qt/wrappers") endif() @@ -49,6 +53,7 @@ target_link_libraries( frontend-tools PRIVATE OBS::frontend-api OBS::libobs + OBS::qt-plain-text-edit OBS::qt-wrappers OBS::ui-support Qt::Widgets diff --git a/UI/frontend-plugins/frontend-tools/cmake/legacy.cmake b/UI/frontend-plugins/frontend-tools/cmake/legacy.cmake index 8eb109023..74bbc88c3 100644 --- a/UI/frontend-plugins/frontend-tools/cmake/legacy.cmake +++ b/UI/frontend-plugins/frontend-tools/cmake/legacy.cmake @@ -3,6 +3,10 @@ project(frontend-tools) add_library(frontend-tools MODULE) add_library(OBS::frontend-tools ALIAS frontend-tools) +if(NOT TARGET OBS::qt-plain-text-edit) + add_subdirectory("${CMAKE_SOURCE_DIR}/shared/qt/plain-text-edit" "${CMAKE_BINARY_DIR}/shared/qt/plain-text-edit") +endif() + if(NOT TARGET OBS::qt-wrappers) add_subdirectory("${CMAKE_SOURCE_DIR}/shared/qt/wrappers" "${CMAKE_BINARY_DIR}/shared/qt/wrappers") endif() @@ -43,13 +47,12 @@ target_sources( ${CMAKE_SOURCE_DIR}/UI/slider-ignorewheel.cpp ${CMAKE_SOURCE_DIR}/UI/slider-ignorewheel.hpp ${CMAKE_SOURCE_DIR}/UI/vertical-scroll-area.hpp - ${CMAKE_SOURCE_DIR}/UI/vertical-scroll-area.cpp - ${CMAKE_SOURCE_DIR}/UI/plain-text-edit.cpp - ${CMAKE_SOURCE_DIR}/UI/plain-text-edit.hpp) + ${CMAKE_SOURCE_DIR}/UI/vertical-scroll-area.cpp) target_compile_features(frontend-tools PRIVATE cxx_std_17) -target_link_libraries(frontend-tools PRIVATE OBS::frontend-api OBS::qt-wrappers OBS::libobs Qt::Widgets) +target_link_libraries(frontend-tools PRIVATE OBS::frontend-api OBS::qt-wrappers OBS::qt-plain-text-edit OBS::libobs + Qt::Widgets) if(OS_POSIX AND NOT OS_MACOS) target_link_libraries(frontend-tools PRIVATE Qt::GuiPrivate) diff --git a/UI/frontend-plugins/frontend-tools/scripts.cpp b/UI/frontend-plugins/frontend-tools/scripts.cpp index 924efdc52..3407fc725 100644 --- a/UI/frontend-plugins/frontend-tools/scripts.cpp +++ b/UI/frontend-plugins/frontend-tools/scripts.cpp @@ -1,7 +1,6 @@ #include "obs-module.h" #include "scripts.hpp" #include "../../properties-view.hpp" -#include "../../plain-text-edit.hpp" #include #include @@ -18,6 +17,7 @@ #include #include #include +#include #include #include diff --git a/UI/properties-view.cpp b/UI/properties-view.cpp index bd0288b17..2a4e031f0 100644 --- a/UI/properties-view.cpp +++ b/UI/properties-view.cpp @@ -29,10 +29,10 @@ #include "spinbox-ignorewheel.hpp" #include "properties-view.hpp" #include "properties-view.moc.hpp" -#include "plain-text-edit.hpp" #include "obs-app.hpp" #include +#include #include #include #include diff --git a/shared/qt/plain-text-edit/CMakeLists.txt b/shared/qt/plain-text-edit/CMakeLists.txt new file mode 100644 index 000000000..0abe0b562 --- /dev/null +++ b/shared/qt/plain-text-edit/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.22...3.25) + +find_package(Qt6 REQUIRED Core Widgets) + +add_library(qt-plain-text-edit INTERFACE) +add_library(OBS::qt-plain-text-edit ALIAS qt-plain-text-edit) + +target_sources(qt-plain-text-edit INTERFACE plain-text-edit.cpp plain-text-edit.hpp) +target_include_directories(qt-plain-text-edit INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}") + +target_link_libraries(qt-plain-text-edit INTERFACE Qt::Core Qt::Widgets) diff --git a/UI/plain-text-edit.cpp b/shared/qt/plain-text-edit/plain-text-edit.cpp similarity index 93% rename from UI/plain-text-edit.cpp rename to shared/qt/plain-text-edit/plain-text-edit.cpp index d8f03b561..89e9ba8a1 100644 --- a/UI/plain-text-edit.cpp +++ b/shared/qt/plain-text-edit/plain-text-edit.cpp @@ -1,4 +1,4 @@ -#include "plain-text-edit.hpp" +#include #include OBSPlainTextEdit::OBSPlainTextEdit(QWidget *parent, bool monospace) diff --git a/UI/plain-text-edit.hpp b/shared/qt/plain-text-edit/plain-text-edit.hpp similarity index 100% rename from UI/plain-text-edit.hpp rename to shared/qt/plain-text-edit/plain-text-edit.hpp