Skip to content

Commit 8ce55fb

Browse files
committed
ui: Update imported obs property-view widget
Upstream OBS has made is much easier to integrate the property-view widget. It is now an inclueable cmake subdirectory that builds cleanly, which means this project can use a pristine copy with no local modifications. It does however require moving the source to the shared/ directory so that the build scripts don't need to be modified. Signed-off-by: Grant Likely <[email protected]>
1 parent 0060ff2 commit 8ce55fb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+898
-2713
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
!/cmake
88
!/data
99
!/src
10+
!/shared
1011
!.clang-format
1112
!.gersemirc
1213
!.gitignore

CMakeLists.txt

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ if(ENABLE_FRONTEND_API)
2929
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE OBS::obs-frontend-api)
3030
endif()
3131

32+
add_subdirectory("${CMAKE_SOURCE_DIR}/shared/properties-view" "${CMAKE_BINARY_DIR}/shared/properties-view")
33+
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE OBS::properties-view)
34+
3235
if(ENABLE_QT)
3336
find_package(Qt6 COMPONENTS Widgets Core Svg Network Xml)
3437
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE Qt6::Core Qt6::Widgets Qt6::Svg Qt6::Network Qt6::Xml)
@@ -59,13 +62,6 @@ target_sources(
5962
src/ptz-action-source.c
6063
src/circularlistview.cpp
6164
src/touch-control.cpp
62-
src/imported/qt-wrappers.cpp
63-
src/imported/obs-app.cpp
64-
src/imported/properties-view.cpp
65-
src/imported/vertical-scroll-area.cpp
66-
src/imported/double-slider.cpp
67-
src/imported/slider-ignorewheel.cpp
68-
src/imported/spinbox-ignorewheel.cpp
6965
src/ptz.h
7066
src/ptz-controls.hpp
7167
src/ptz-device.hpp
@@ -75,15 +71,7 @@ target_sources(
7571
src/ptz-visca-tcp.hpp
7672
src/protocol-helpers.hpp
7773
src/circularlistview.hpp
78-
src/touch-control.hpp
79-
src/imported/qt-wrappers.hpp
80-
src/imported/obs-app.hpp
81-
src/imported/properties-view.hpp
82-
src/imported/properties-view.moc.hpp
83-
src/imported/vertical-scroll-area.hpp
84-
src/imported/double-slider.hpp
85-
src/imported/slider-ignorewheel.hpp
86-
src/imported/spinbox-ignorewheel.hpp)
74+
src/touch-control.hpp)
8775

8876
option(ENABLE_USB_CAM "Enable USB camera support" OFF)
8977
if(ENABLE_USB_CAM)
16 KB
Binary file not shown.
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
cmake_minimum_required(VERSION 3.28...3.30)
2+
3+
find_package(Qt6 REQUIRED Core Widgets)
4+
5+
if(NOT TARGET OBS::qt-wrappers)
6+
add_subdirectory("${CMAKE_SOURCE_DIR}/shared/qt/wrappers" "${CMAKE_BINARY_DIR}/shared/qt/wrappers")
7+
endif()
8+
9+
if(NOT TARGET OBS::qt-plain-text-edit)
10+
add_subdirectory("${CMAKE_SOURCE_DIR}/shared/qt/plain-text-edit" "${CMAKE_BINARY_DIR}/shared/qt/plain-text-edit")
11+
endif()
12+
13+
if(NOT TARGET OBS::qt-vertical-scroll-area)
14+
add_subdirectory(
15+
"${CMAKE_SOURCE_DIR}/shared/qt/vertical-scroll-area"
16+
"${CMAKE_BINARY_DIR}/shared/qt/vertical-scroll-area"
17+
)
18+
endif()
19+
20+
if(NOT TARGET OBS::qt-slider-ignorewheel)
21+
add_subdirectory(
22+
"${CMAKE_SOURCE_DIR}/shared/qt/slider-ignorewheel"
23+
"${CMAKE_BINARY_DIR}/shared/qt/slider-ignorewheel"
24+
)
25+
endif()
26+
27+
if(NOT TARGET OBS::qt-icon-label)
28+
add_subdirectory("${CMAKE_SOURCE_DIR}/shared/qt/icon-label" "${CMAKE_BINARY_DIR}/shared/qt/icon-label")
29+
endif()
30+
31+
add_library(properties-view INTERFACE)
32+
add_library(OBS::properties-view ALIAS properties-view)
33+
34+
target_sources(
35+
properties-view
36+
INTERFACE
37+
double-slider.cpp
38+
double-slider.hpp
39+
properties-view.cpp
40+
properties-view.hpp
41+
properties-view.moc.hpp
42+
spinbox-ignorewheel.cpp
43+
spinbox-ignorewheel.hpp
44+
)
45+
target_include_directories(properties-view INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}")
46+
47+
target_link_libraries(
48+
properties-view
49+
INTERFACE
50+
OBS::obs-frontend-api
51+
OBS::libobs
52+
OBS::qt-wrappers
53+
OBS::qt-plain-text-edit
54+
OBS::qt-vertical-scroll-area
55+
OBS::qt-slider-ignorewheel
56+
OBS::qt-icon-label
57+
Qt::Core
58+
Qt::Widgets
59+
)
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
#include "double-slider.hpp"
1+
#include "moc_double-slider.cpp"
22

33
#include <cmath>
44

55
DoubleSlider::DoubleSlider(QWidget *parent) : SliderIgnoreScroll(parent)
66
{
7-
connect(this, SIGNAL(valueChanged(int)), this,
8-
SLOT(intValChanged(int)));
7+
connect(this, &DoubleSlider::valueChanged,
8+
[this](int val) { emit doubleValChanged((minVal / minStep + val) * minStep); });
99
}
1010

11-
void DoubleSlider::setDoubleConstraints(double newMin, double newMax,
12-
double newStep, double val)
11+
void DoubleSlider::setDoubleConstraints(double newMin, double newMax, double newStep, double val)
1312
{
1413
minVal = newMin;
1514
maxVal = newMax;
@@ -24,12 +23,7 @@ void DoubleSlider::setDoubleConstraints(double newMin, double newMax,
2423
setDoubleVal(val);
2524
}
2625

27-
void DoubleSlider::intValChanged(int val)
28-
{
29-
emit doubleValChanged((minVal / minStep + val) * minStep);
30-
}
31-
3226
void DoubleSlider::setDoubleVal(double val)
3327
{
34-
setValue((int)lround((val - minVal) / minStep));
28+
setValue(lround((val - minVal) / minStep));
3529
}
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#pragma once
22

33
#include <QSlider>
4-
#include "slider-ignorewheel.hpp"
4+
#include <slider-ignorewheel.hpp>
55

66
class DoubleSlider : public SliderIgnoreScroll {
77
Q_OBJECT
@@ -11,13 +11,11 @@ class DoubleSlider : public SliderIgnoreScroll {
1111
public:
1212
DoubleSlider(QWidget *parent = nullptr);
1313

14-
void setDoubleConstraints(double newMin, double newMax, double newStep,
15-
double val);
14+
void setDoubleConstraints(double newMin, double newMax, double newStep, double val);
1615

1716
signals:
1817
void doubleValChanged(double val);
1918

2019
public slots:
21-
void intValChanged(int val);
2220
void setDoubleVal(double val);
2321
};

0 commit comments

Comments
 (0)