diff --git a/dive_core/CMakeLists.txt b/dive_core/CMakeLists.txt index b7159e839..6ea2b2a7c 100644 --- a/dive_core/CMakeLists.txt +++ b/dive_core/CMakeLists.txt @@ -176,7 +176,6 @@ add_library( command_hierarchy.h common.cpp common.h - context.h conversions.h cross_ref.h data_core.cpp diff --git a/src/dive/CMakeLists.txt b/src/dive/CMakeLists.txt index aa058563a..229d42ecf 100644 --- a/src/dive/CMakeLists.txt +++ b/src/dive/CMakeLists.txt @@ -19,3 +19,7 @@ add_subdirectory(os) add_subdirectory(plugin) add_subdirectory(utils) add_subdirectory(common) + +if(NOT ANDROID) + add_subdirectory(ui) +endif() diff --git a/dive_core/context.h b/src/dive/types/context.h similarity index 100% rename from dive_core/context.h rename to src/dive/types/context.h diff --git a/src/dive/ui/CMakeLists.txt b/src/dive/ui/CMakeLists.txt new file mode 100644 index 000000000..22df89816 --- /dev/null +++ b/src/dive/ui/CMakeLists.txt @@ -0,0 +1,46 @@ +# +# Copyright 2025 Google LLC +# +# 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 +# +# 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. +# + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTORCC ON) + +find_package(Qt5 COMPONENTS Core Gui Widgets REQUIRED) + +add_library( + dive_lib_ui + # Header Only: + forward.h + types/context.h + types/file_path.h + types/impl_pointer.h + utils/debug_utils.h + # Sources: + components/overlay/overlay.cpp + components/overlay/overlay.h + components/settings/settings.cpp + components/settings/settings.h +) + +target_link_libraries( + dive_lib_ui + PUBLIC + # Dive dependencies + dive_src_includes + # External dependencies + absl::core_headers + Qt5::Widgets +) diff --git a/ui/overlay.cpp b/src/dive/ui/components/overlay/overlay.cpp similarity index 99% rename from ui/overlay.cpp rename to src/dive/ui/components/overlay/overlay.cpp index dec85db26..e48d24209 100644 --- a/ui/overlay.cpp +++ b/src/dive/ui/components/overlay/overlay.cpp @@ -14,7 +14,7 @@ limitations under the License. */ -#include "overlay.h" +#include "dive/ui/components/overlay/overlay.h" #include #include diff --git a/ui/overlay.h b/src/dive/ui/components/overlay/overlay.h similarity index 100% rename from ui/overlay.h rename to src/dive/ui/components/overlay/overlay.h diff --git a/ui/settings.cpp b/src/dive/ui/components/settings/settings.cpp similarity index 98% rename from ui/settings.cpp rename to src/dive/ui/components/settings/settings.cpp index 6d7f46a2a..a98867a62 100644 --- a/ui/settings.cpp +++ b/src/dive/ui/components/settings/settings.cpp @@ -13,13 +13,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -#include "settings.h" +#include "dive/ui/components/settings/settings.h" #include #include #include -#include "dive_core/common.h" +#include "dive/ui/macros.h" //-------------------------------------------------------------------------------------------------- Settings* Settings::Get() @@ -115,4 +115,4 @@ void Settings::WriteEventListDisplayUnit(DisplayUnit display_unit) { QSettings settings; settings.setValue("eventListDisplayUnit", display_unit); -} \ No newline at end of file +} diff --git a/ui/settings.h b/src/dive/ui/components/settings/settings.h similarity index 99% rename from ui/settings.h rename to src/dive/ui/components/settings/settings.h index 203078543..6e589da31 100644 --- a/ui/settings.h +++ b/src/dive/ui/components/settings/settings.h @@ -15,6 +15,7 @@ */ #pragma once + #include #include diff --git a/src/dive/ui/macros.h b/src/dive/ui/macros.h new file mode 100644 index 000000000..98f4815f2 --- /dev/null +++ b/src/dive/ui/macros.h @@ -0,0 +1,23 @@ +/* + Copyright 2025 Google LLC + + 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 + + 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. +*/ + +#pragma once + +#include "absl/base/macros.h" + +#ifndef DIVE_ASSERT +#define DIVE_ASSERT(x) ABSL_ASSERT(x) +#endif diff --git a/ui/context.h b/src/dive/ui/types/context.h similarity index 92% rename from ui/context.h rename to src/dive/ui/types/context.h index dd475b511..1e4d10be5 100644 --- a/ui/context.h +++ b/src/dive/ui/types/context.h @@ -18,7 +18,7 @@ #include -#include "dive_core/context.h" // IWYU pragma: export +#include "dive/types/context.h" // IWYU pragma: export // qRegisterMetaType in custom_metatypes.cpp Q_DECLARE_METATYPE(Dive::Context) diff --git a/ui/file_path.h b/src/dive/ui/types/file_path.h similarity index 96% rename from ui/file_path.h rename to src/dive/ui/types/file_path.h index f46fa781a..430ce282c 100644 --- a/ui/file_path.h +++ b/src/dive/ui/types/file_path.h @@ -20,7 +20,7 @@ #include #include -#include "utils/component_files.h" +#include "dive/utils/component_files.h" namespace Dive { diff --git a/ui/impl_pointer.h b/src/dive/ui/types/impl_pointer.h similarity index 100% rename from ui/impl_pointer.h rename to src/dive/ui/types/impl_pointer.h diff --git a/ui/debug_utils.h b/src/dive/ui/utils/debug_utils.h similarity index 100% rename from ui/debug_utils.h rename to src/dive/ui/utils/debug_utils.h diff --git a/trace_stats/CMakeLists.txt b/trace_stats/CMakeLists.txt index 3e94d25dc..d7220424d 100644 --- a/trace_stats/CMakeLists.txt +++ b/trace_stats/CMakeLists.txt @@ -34,7 +34,7 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) add_library(dive_lib_trace_stats "trace_stats.cpp" "trace_stats.h") -target_link_libraries(dive_lib_trace_stats PUBLIC dive_core) +target_link_libraries(dive_lib_trace_stats PUBLIC dive_core dive_src_includes) target_include_directories( dive_lib_trace_stats PUBLIC ${THIRDPARTY_DIRECTORY}/Vulkan-Headers/include ${CMAKE_SOURCE_DIR} diff --git a/trace_stats/main.cpp b/trace_stats/main.cpp index 31e0221a8..a65bba739 100644 --- a/trace_stats/main.cpp +++ b/trace_stats/main.cpp @@ -21,7 +21,7 @@ #include #include -#include "dive_core/context.h" +#include "dive/types/context.h" #include "dive_core/data_core.h" #include "pm4_info.h" #include "trace_stats.h" diff --git a/trace_stats/trace_stats.h b/trace_stats/trace_stats.h index dba1e6814..3edcd462e 100644 --- a/trace_stats/trace_stats.h +++ b/trace_stats/trace_stats.h @@ -21,8 +21,8 @@ #include #include +#include "dive/types/context.h" #include "dive_core/capture_event_info.h" -#include "dive_core/context.h" #include "dive_core/data_core.h" #include "vulkan/vulkan_core.h" diff --git a/ui/CMakeLists.txt b/ui/CMakeLists.txt index c9db43a73..c1db721ad 100644 --- a/ui/CMakeLists.txt +++ b/ui/CMakeLists.txt @@ -86,10 +86,8 @@ add_executable( command_model.h command_tab_view.cpp command_tab_view.h - context.h custom_metatypes.cpp custom_metatypes.h - debug_utils.h dive_tree_view.cpp dive_tree_view.h draw_dispatch_stats_model.cpp @@ -102,7 +100,6 @@ add_executable( event_selection_model.h event_state_view.cpp event_state_view.h - file_path.h frame_tab_view.cpp frame_tab_view.h gfxr_capture_worker.cpp @@ -124,7 +121,6 @@ add_executable( gui_constants.h hover_help_model.cpp hover_help_model.h - impl_pointer.h main_window.cpp main_window.h misc_stats_model.cpp @@ -134,8 +130,6 @@ add_executable( most_expensive_events_view.cpp most_expensive_events_view.h object_names.h - overlay.cpp - overlay.h overview_tab_view.cpp overview_tab_view.h package_filter.cpp @@ -154,8 +148,6 @@ add_executable( search_bar.h search_dialog.cpp search_dialog.h - settings.cpp - settings.h shader_text_view.cpp shader_text_view.h shader_view.cpp @@ -233,6 +225,7 @@ target_link_libraries( network dive_core dive_lib_os + dive_lib_ui device_mgr dive_plugin_loader component_files diff --git a/ui/analyze_window.cpp b/ui/analyze_window.cpp index 469444054..49bdee46e 100644 --- a/ui/analyze_window.cpp +++ b/ui/analyze_window.cpp @@ -16,9 +16,7 @@ #include "analyze_window.h" -#include -#include - +#include #include #include #include @@ -34,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -46,9 +45,10 @@ #include "application_controller.h" #include "capture_service/constants.h" #include "capture_service/device_mgr.h" -#include "common/macros.h" -#include "overlay.h" -#include "settings.h" +#include "dive/common/macros.h" +#include "dive/ui/components/overlay/overlay.h" +#include "dive/ui/components/settings/settings.h" +#include "ui/application_controller.h" //-------------------------------------------------------------------------------------------------- void AttemptDeletingTemporaryLocalFile(const std::filesystem::path& file_path) diff --git a/ui/application_controller.h b/ui/application_controller.h index de9af39d3..bce02cb07 100644 --- a/ui/application_controller.h +++ b/ui/application_controller.h @@ -18,7 +18,7 @@ #include -#include "impl_pointer.h" +#include "dive/ui/types/impl_pointer.h" class MainWindow; diff --git a/ui/capture_file_manager.cpp b/ui/capture_file_manager.cpp index b65c0c152..d9260d06e 100644 --- a/ui/capture_file_manager.cpp +++ b/ui/capture_file_manager.cpp @@ -24,10 +24,10 @@ #include #include -#include "debug_utils.h" -#include "dive_core/context.h" +#include "dive/ui/types/context.h" +#include "dive/ui/types/file_path.h" +#include "dive/ui/utils/debug_utils.h" #include "dive_core/data_core.h" -#include "file_path.h" #include "trace_stats/trace_stats.h" namespace diff --git a/ui/capture_file_manager.h b/ui/capture_file_manager.h index f0e8f3460..92ff39ca8 100644 --- a/ui/capture_file_manager.h +++ b/ui/capture_file_manager.h @@ -21,8 +21,8 @@ #include #include -#include "context.h" -#include "file_path.h" +#include "dive/ui/types/context.h" +#include "dive/ui/types/file_path.h" class QThread; namespace Dive diff --git a/ui/custom_metatypes.cpp b/ui/custom_metatypes.cpp index bdcbfc68a..48f828ea1 100644 --- a/ui/custom_metatypes.cpp +++ b/ui/custom_metatypes.cpp @@ -18,9 +18,9 @@ #include -#include "capture_file_manager.h" -#include "context.h" -#include "file_path.h" +#include "dive/ui/types/context.h" +#include "dive/ui/types/file_path.h" +#include "ui/capture_file_manager.h" namespace Dive { diff --git a/ui/main_window.cpp b/ui/main_window.cpp index 0f941dde7..d1eabb28a 100644 --- a/ui/main_window.cpp +++ b/ui/main_window.cpp @@ -54,6 +54,9 @@ #include "absl/status/statusor.h" #include "absl/types/span.h" #include "capture_service/constants.h" +#include "dive/ui/components/overlay/overlay.h" +#include "dive/ui/components/settings/settings.h" +#include "dive/ui/types/file_path.h" #include "dive/utils/device_resources.h" #include "dive/utils/device_resources_constants.h" #include "dive_core/command_hierarchy.h" @@ -74,7 +77,6 @@ #include "ui/error_dialog.h" #include "ui/event_selection_model.h" #include "ui/event_state_view.h" -#include "ui/file_path.h" #include "ui/frame_tab_view.h" #include "ui/gfxr_vulkan_command_arguments_filter_proxy_model.h" #include "ui/gfxr_vulkan_command_arguments_tab_view.h" @@ -85,13 +87,11 @@ #include "ui/gpu_timing_tab_view.h" #include "ui/hover_help_model.h" #include "ui/object_names.h" -#include "ui/overlay.h" #include "ui/overview_tab_view.h" #include "ui/perf_counter_model.h" #include "ui/perf_counter_tab_view.h" #include "ui/property_panel.h" #include "ui/search_bar.h" -#include "ui/settings.h" #include "ui/shader_view.h" #include "ui/shortcuts.h" #include "ui/shortcuts_window.h" diff --git a/ui/most_expensive_events_view.cpp b/ui/most_expensive_events_view.cpp index ad79f1e2a..9bb24bdfc 100644 --- a/ui/most_expensive_events_view.cpp +++ b/ui/most_expensive_events_view.cpp @@ -13,7 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -#include "most_expensive_events_view.h" +#include "ui/most_expensive_events_view.h" #include #include @@ -25,11 +25,11 @@ #include #include +#include "dive/ui/components/settings/settings.h" #include "dive_core/conversions.h" #include "dive_core/data_core.h" -#include "gui_constants.h" -#include "hover_help_model.h" -#include "settings.h" +#include "ui/gui_constants.h" +#include "ui/hover_help_model.h" const uint32_t kDurationColumn = 2; const uint32_t kOccupancyDurationColumn = 3; diff --git a/ui/sqtt/ruler_graphics_item.cpp b/ui/sqtt/ruler_graphics_item.cpp index 498bd3b99..ef3cc16f7 100644 --- a/ui/sqtt/ruler_graphics_item.cpp +++ b/ui/sqtt/ruler_graphics_item.cpp @@ -14,7 +14,7 @@ limitations under the License. */ -#include "ruler_graphics_item.h" +#include "ui/sqtt/ruler_graphics_item.h" #include #include @@ -22,6 +22,7 @@ #include #include +#include "dive/ui/components/settings/settings.h" #include "dive_core/common.h" #include "dive_core/conversions.h" diff --git a/ui/sqtt/ruler_graphics_item.h b/ui/sqtt/ruler_graphics_item.h index f0564f9e2..3250c2400 100644 --- a/ui/sqtt/ruler_graphics_item.h +++ b/ui/sqtt/ruler_graphics_item.h @@ -22,8 +22,6 @@ #pragma once #include -#include "settings.h" - #define RULER_FONT_HEIGHT 9 class RulerGraphicsItem : public QGraphicsItem @@ -73,4 +71,4 @@ class RulerGraphicsItem : public QGraphicsItem // Each major tick step, in whatever unit is enabled double m_text_step; -}; \ No newline at end of file +};