Browse Source

frontend: Move idian widgets to shared/qt

Sebastian Beckmann 6 months ago
parent
commit
9e0c3219ff

+ 0 - 18
frontend/cmake/ui-components.cmake

@@ -81,22 +81,4 @@ target_sources(
     components/VolumeSlider.hpp
     components/WindowCaptureToolbar.cpp
     components/WindowCaptureToolbar.hpp
-    components/idian/OBSActionRow.cpp
-    components/idian/OBSActionRow.hpp
-    components/idian/OBSCheckBox.cpp
-    components/idian/OBSCheckBox.hpp
-    components/idian/OBSComboBox.cpp
-    components/idian/OBSComboBox.hpp
-    components/idian/OBSDoubleSpinBox.cpp
-    components/idian/OBSDoubleSpinBox.hpp
-    components/idian/OBSGroupBox.cpp
-    components/idian/OBSGroupBox.hpp
-    components/idian/OBSIdianWidget.hpp
-    components/idian/OBSPropertiesList.cpp
-    components/idian/OBSPropertiesList.hpp
-    components/idian/OBSSpinBox.cpp
-    components/idian/OBSSpinBox.hpp
-    components/idian/OBSToggleSwitch.cpp
-    components/idian/OBSToggleSwitch.hpp
-    components/idian/obs-widgets.hpp
 )

+ 6 - 0
frontend/cmake/ui-dialogs.cmake

@@ -1,3 +1,9 @@
+if(NOT TARGET OBS::idian)
+  add_subdirectory("${CMAKE_SOURCE_DIR}/shared/qt/idian" "${CMAKE_BINARY_DIR}/shared/qt/idian")
+endif()
+
+target_link_libraries(obs-studio PRIVATE OBS::idian)
+
 if(NOT TARGET OBS::properties-view)
   add_subdirectory("${CMAKE_SOURCE_DIR}/shared/properties-view" "${CMAKE_BINARY_DIR}/shared/properties-view")
 endif()

+ 1 - 1
frontend/dialogs/OBSIdianPlayground.cpp

@@ -17,7 +17,7 @@
 
 #include "OBSIdianPlayground.hpp"
 
-#include "components/idian/obs-widgets.hpp"
+#include <Idian/obs-widgets.hpp>
 
 #include <QTimer>
 

+ 0 - 2
frontend/dialogs/OBSIdianPlayground.hpp

@@ -17,8 +17,6 @@
 
 #pragma once
 
-#include "components/idian/obs-widgets.hpp"
-
 #include <QDialog>
 
 #include <memory>

+ 35 - 0
shared/qt/idian/CMakeLists.txt

@@ -0,0 +1,35 @@
+cmake_minimum_required(VERSION 3.28...3.30)
+
+find_package(Qt6 REQUIRED Core Widgets Svg)
+
+add_library(idian STATIC)
+add_library(OBS::idian ALIAS idian)
+
+target_sources(
+  idian
+  PRIVATE
+    OBSActionRow.cpp
+    OBSActionRow.hpp
+    OBSCheckBox.cpp
+    OBSCheckBox.hpp
+    OBSComboBox.cpp
+    OBSComboBox.hpp
+    OBSDoubleSpinBox.cpp
+    OBSDoubleSpinBox.hpp
+    OBSIdianWidget.hpp
+    OBSGroupBox.cpp
+    OBSGroupBox.hpp
+    OBSPropertiesList.cpp
+    OBSPropertiesList.hpp
+    OBSSpinBox.cpp
+    OBSSpinBox.hpp
+    OBSToggleSwitch.cpp
+    OBSToggleSwitch.hpp
+)
+target_sources(idian PUBLIC include/Idian/obs-widgets.hpp)
+
+set_target_properties(idian PROPERTIES AUTOMOC ON FOLDER "frontend")
+
+target_include_directories(idian PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
+
+target_link_libraries(idian PUBLIC Qt::Core Qt::Widgets Qt::Svg)

+ 1 - 4
frontend/components/idian/OBSActionRow.cpp → shared/qt/idian/OBSActionRow.cpp

@@ -20,7 +20,6 @@
 #include <QSizePolicy>
 
 #include "OBSActionRow.hpp"
-#include <util/base.h>
 #include <QSvgRenderer>
 
 OBSActionRowWidget::OBSActionRowWidget(QWidget *parent) : OBSActionRow(parent)
@@ -240,10 +239,8 @@ OBSActionRowExpandButton::OBSActionRowExpandButton(QWidget *parent) : QAbstractB
 	setCheckable(true);
 }
 
-void OBSActionRowExpandButton::paintEvent(QPaintEvent *event)
+void OBSActionRowExpandButton::paintEvent(QPaintEvent *)
 {
-	UNUSED_PARAMETER(event);
-
 	QStyleOptionButton opt;
 	opt.initFrom(this);
 	QPainter p(this);

+ 0 - 0
frontend/components/idian/OBSActionRow.hpp → shared/qt/idian/OBSActionRow.hpp


+ 0 - 0
frontend/components/idian/OBSCheckBox.cpp → shared/qt/idian/OBSCheckBox.cpp


+ 0 - 0
frontend/components/idian/OBSCheckBox.hpp → shared/qt/idian/OBSCheckBox.hpp


+ 0 - 4
frontend/components/idian/OBSComboBox.cpp → shared/qt/idian/OBSComboBox.cpp

@@ -18,9 +18,6 @@
 #include "OBSActionRow.hpp"
 #include "OBSComboBox.hpp"
 #include <QTimer>
-#include <util/base.h>
-
-#define UNUSED_PARAMETER(param) (void)param
 
 OBSComboBox::OBSComboBox(QWidget *parent) : QComboBox(parent), OBSIdianUtils(this) {}
 
@@ -51,7 +48,6 @@ void OBSComboBox::hidePopup()
 
 void OBSComboBox::mousePressEvent(QMouseEvent *event)
 {
-	blog(LOG_INFO, "OBSComboBox::mousePressEvent");
 	QComboBox::mousePressEvent(event);
 }
 

+ 0 - 0
frontend/components/idian/OBSComboBox.hpp → shared/qt/idian/OBSComboBox.hpp


+ 0 - 0
frontend/components/idian/OBSDoubleSpinBox.cpp → shared/qt/idian/OBSDoubleSpinBox.cpp


+ 0 - 0
frontend/components/idian/OBSDoubleSpinBox.hpp → shared/qt/idian/OBSDoubleSpinBox.hpp


+ 0 - 0
frontend/components/idian/OBSGroupBox.cpp → shared/qt/idian/OBSGroupBox.cpp


+ 0 - 0
frontend/components/idian/OBSGroupBox.hpp → shared/qt/idian/OBSGroupBox.hpp


+ 0 - 0
frontend/components/idian/OBSIdianWidget.hpp → shared/qt/idian/OBSIdianWidget.hpp


+ 0 - 0
frontend/components/idian/OBSPropertiesList.cpp → shared/qt/idian/OBSPropertiesList.cpp


+ 0 - 0
frontend/components/idian/OBSPropertiesList.hpp → shared/qt/idian/OBSPropertiesList.hpp


+ 0 - 0
frontend/components/idian/OBSSpinBox.cpp → shared/qt/idian/OBSSpinBox.cpp


+ 0 - 0
frontend/components/idian/OBSSpinBox.hpp → shared/qt/idian/OBSSpinBox.hpp


+ 1 - 6
frontend/components/idian/OBSToggleSwitch.cpp → shared/qt/idian/OBSToggleSwitch.cpp

@@ -16,9 +16,6 @@
 ******************************************************************************/
 
 #include "OBSToggleSwitch.hpp"
-#include <util/base.h>
-
-#define UNUSED_PARAMETER(param) (void)param
 
 static QColor blendColors(const QColor &color1, const QColor &color2, float ratio)
 {
@@ -100,10 +97,8 @@ void OBSToggleSwitch::changeEvent(QEvent *event)
 	}
 }
 
-void OBSToggleSwitch::paintEvent(QPaintEvent *e)
+void OBSToggleSwitch::paintEvent(QPaintEvent *)
 {
-	UNUSED_PARAMETER(e);
-
 	QStyleOptionButton opt;
 	opt.initFrom(this);
 	QPainter p(this);

+ 0 - 0
frontend/components/idian/OBSToggleSwitch.hpp → shared/qt/idian/OBSToggleSwitch.hpp


+ 8 - 8
frontend/components/idian/obs-widgets.hpp → shared/qt/idian/include/Idian/obs-widgets.hpp

@@ -21,14 +21,14 @@
 //
 // (OBS Idian, get it?)
 
-#include "OBSActionRow.hpp"
-#include "OBSCheckBox.hpp"
-#include "OBSComboBox.hpp"
-#include "OBSDoubleSpinBox.hpp"
-#include "OBSGroupBox.hpp"
-#include "OBSPropertiesList.hpp"
-#include "OBSSpinBox.hpp"
-#include "OBSToggleSwitch.hpp"
+#include "../../OBSActionRow.hpp"
+#include "../../OBSCheckBox.hpp"
+#include "../../OBSComboBox.hpp"
+#include "../../OBSDoubleSpinBox.hpp"
+#include "../../OBSGroupBox.hpp"
+#include "../../OBSPropertiesList.hpp"
+#include "../../OBSSpinBox.hpp"
+#include "../../OBSToggleSwitch.hpp"
 
 /// Note: This file serves as an all-in-one include for custom OBS widgets.
 ///       It is not intended to define any widgets by itself.