Explorar el Código

UI: Add interact button to source toolbar

This adds a interact button to the source toolbar. It is only
shown when source is interactable.
Clayton Groeneveld hace 4 años
padre
commit
968a1a6ff0

+ 4 - 0
UI/data/themes/Dark.qss

@@ -234,6 +234,10 @@ QScrollBar::left-arrow:horizontal, QScrollBar::right-arrow:horizontal, QScrollBa
     qproperty-icon: url(./Dark/filter.svg);
 }
 
+#contextContainer QPushButton#sourceInteractButton {
+    qproperty-icon: url(./Dark/interact.svg);
+}
+
 /* Scenes and Sources toolbar */
 
 QToolBar {

+ 3 - 0
UI/data/themes/Dark/interact.svg

@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="#d2d2d2" class="bi bi-hand-index-thumb-fill" viewBox="0 0 16 16">
+  <path d="M8.5 1.75v2.716l.048-.002c.311-.012.74-.016 1.05.046.28.056.543.18.738.288.274.152.456.385.56.642l.132-.012c.312-.024.794-.038 1.158.108.37.148.689.487.88.716.075.09.141.175.195.248h.582a2 2 0 0 1 1.99 2.199l-.272 2.715a3.5 3.5 0 0 1-.444 1.389l-1.395 2.441A1.5 1.5 0 0 1 12.42 16H6.118a1.5 1.5 0 0 1-1.342-.83l-1.215-2.43L1.07 8.589a1.517 1.517 0 0 1 2.373-1.852L5 8.293V1.75a1.75 1.75 0 0 1 3.5 0z"/>
+</svg>

+ 29 - 0
UI/forms/OBSBasic.ui

@@ -366,6 +366,35 @@
             </property>
            </widget>
           </item>
+          <item>
+           <widget class="QPushButton" name="sourceInteractButton">
+            <property name="minimumSize">
+             <size>
+              <width>0</width>
+              <height>22</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>16777215</width>
+              <height>22</height>
+             </size>
+            </property>
+            <property name="text">
+             <string>Interact</string>
+            </property>
+            <property name="icon">
+             <iconset resource="obs.qrc">
+              <normaloff>:/res/images/interact.svg</normaloff>:/res/images/interact.svg</iconset>
+            </property>
+            <property name="flat">
+             <bool>true</bool>
+            </property>
+            <property name="themeID2" stdset="0">
+             <string notr="true">contextBarButton</string>
+            </property>
+           </widget>
+          </item>
           <item>
            <widget class="Line" name="line">
             <property name="orientation">

+ 3 - 0
UI/forms/images/interact.svg

@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="#000000" class="bi bi-hand-index-thumb-fill" viewBox="0 0 16 16">
+  <path d="M8.5 1.75v2.716l.048-.002c.311-.012.74-.016 1.05.046.28.056.543.18.738.288.274.152.456.385.56.642l.132-.012c.312-.024.794-.038 1.158.108.37.148.689.487.88.716.075.09.141.175.195.248h.582a2 2 0 0 1 1.99 2.199l-.272 2.715a3.5 3.5 0 0 1-.444 1.389l-1.395 2.441A1.5 1.5 0 0 1 12.42 16H6.118a1.5 1.5 0 0 1-1.342-.83l-1.215-2.43L1.07 8.589a1.517 1.517 0 0 1 2.373-1.852L5 8.293V1.75a1.75 1.75 0 0 1 3.5 0z"/>
+</svg>

+ 1 - 0
UI/forms/obs.qrc

@@ -51,6 +51,7 @@
     <file>images/media/media_previous.svg</file>
     <file>images/media/media_restart.svg</file>
     <file>images/media/media_stop.svg</file>
+    <file>images/interact.svg</file>
   </qresource>
   <qresource prefix="/settings">
     <file>images/settings/output.svg</file>

+ 9 - 0
UI/window-basic-main.cpp

@@ -2986,6 +2986,9 @@ void OBSBasic::UpdateContextBar(bool force)
 		const char *id = obs_source_get_unversioned_id(source);
 		uint32_t flags = obs_source_get_output_flags(source);
 
+		ui->sourceInteractButton->setVisible(flags &
+						     OBS_SOURCE_INTERACTION);
+
 		if (flags & OBS_SOURCE_CONTROLLABLE_MEDIA) {
 			if (!is_network_media_source(source, id)) {
 				MediaControls *mediaControls =
@@ -3066,6 +3069,7 @@ void OBSBasic::UpdateContextBar(bool force)
 
 		ui->sourceFiltersButton->setEnabled(false);
 		ui->sourcePropertiesButton->setEnabled(false);
+		ui->sourceInteractButton->setVisible(false);
 	}
 }
 
@@ -8483,3 +8487,8 @@ void OBSBasic::on_sourceFiltersButton_clicked()
 {
 	OpenFilters();
 }
+
+void OBSBasic::on_sourceInteractButton_clicked()
+{
+	on_actionInteract_triggered();
+}

+ 1 - 0
UI/window-basic-main.hpp

@@ -961,6 +961,7 @@ private slots:
 	// Source Context Buttons
 	void on_sourcePropertiesButton_clicked();
 	void on_sourceFiltersButton_clicked();
+	void on_sourceInteractButton_clicked();
 
 	void on_autoConfigure_triggered();
 	void on_stats_triggered();