Add 'source selection' dialog
Add a 'source selection' dialog to replace the 'enter a name' dialog. This new dialog allows you to make new instances of pre-existing sources so that you can add a pre-existing source to a different scene, or in to the same scene more than once. Also started implementing locale. Comtemplating switching to JSON-based locale later, so we can add things like descriptions/disambiguation, and so we can use jansson's built-in hash table when doing the string lookup.
This commit is contained in:
@@ -57,6 +57,7 @@ set(obs_SOURCES
|
||||
window-basic-main.cpp
|
||||
window-basic-settings.cpp
|
||||
window-basic-properties.cpp
|
||||
window-basic-source-select.cpp
|
||||
window-namedialog.cpp
|
||||
properties-view.cpp
|
||||
volume-control.cpp
|
||||
@@ -69,6 +70,7 @@ set(obs_HEADERS
|
||||
window-basic-main.hpp
|
||||
window-basic-settings.hpp
|
||||
window-basic-properties.hpp
|
||||
window-basic-source-select.hpp
|
||||
window-namedialog.hpp
|
||||
properties-view.hpp
|
||||
display-helpers.hpp
|
||||
@@ -80,6 +82,7 @@ set(obs_UI
|
||||
forms/NameDialog.ui
|
||||
forms/OBSBasic.ui
|
||||
forms/OBSBasicSettings.ui
|
||||
forms/OBSBasicSourceSelect.ui
|
||||
forms/OBSBasicProperties.ui)
|
||||
|
||||
set(obs_QRC
|
||||
|
@@ -24,7 +24,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>MainWindow</string>
|
||||
<string>.MainWindow</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
@@ -107,7 +107,7 @@
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Scenes</string>
|
||||
<string>Basic.Main.Scenes</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -215,7 +215,7 @@
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Sources</string>
|
||||
<string>Basic.Main.Sources</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -322,7 +322,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>233</width>
|
||||
<width>148</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -391,7 +391,7 @@
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Start Streaming</string>
|
||||
<string>Basic.Main.StartStreaming</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
@@ -404,7 +404,7 @@
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Start Recording</string>
|
||||
<string>Basic.Main.StartRecording</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -436,16 +436,15 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>927</width>
|
||||
<height>24</height>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menu_File">
|
||||
<property name="title">
|
||||
<string>&File</string>
|
||||
<string>Basic.MainMenu.File</string>
|
||||
</property>
|
||||
<addaction name="action_New"/>
|
||||
<addaction name="action_Open"/>
|
||||
<addaction name="action_Save"/>
|
||||
<addaction name="action_Open"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="action_Settings"/>
|
||||
<addaction name="separator"/>
|
||||
@@ -460,7 +459,7 @@
|
||||
<normaloff>:/res/images/add.ico</normaloff>:/res/images/add.ico</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>AddScene</string>
|
||||
<string>Add</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAddSource">
|
||||
@@ -469,7 +468,7 @@
|
||||
<normaloff>:/res/images/add.ico</normaloff>:/res/images/add.ico</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>AddSource</string>
|
||||
<string>Add</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionRemoveScene">
|
||||
@@ -478,7 +477,7 @@
|
||||
<normaloff>:/res/images/list_remove.png</normaloff>:/res/images/list_remove.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>RemoveScene</string>
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionRemoveSource">
|
||||
@@ -487,7 +486,7 @@
|
||||
<normaloff>:/res/images/list_remove.png</normaloff>:/res/images/list_remove.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>RemoveSource</string>
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSceneProperties">
|
||||
@@ -499,7 +498,7 @@
|
||||
<normaloff>:/res/images/properties.ico</normaloff>:/res/images/properties.ico</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>SceneProperties</string>
|
||||
<string>Properties</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSourceProperties">
|
||||
@@ -511,7 +510,7 @@
|
||||
<normaloff>:/res/images/properties.ico</normaloff>:/res/images/properties.ico</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>SourceProperties</string>
|
||||
<string>Properties</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSceneUp">
|
||||
@@ -523,7 +522,7 @@
|
||||
<normaloff>:/res/images/up.ico</normaloff>:/res/images/up.ico</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>SceneMoveUp</string>
|
||||
<string>Basic.Main.MoveUp</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSourceUp">
|
||||
@@ -535,7 +534,7 @@
|
||||
<normaloff>:/res/images/up.ico</normaloff>:/res/images/up.ico</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>SourceMoveUp</string>
|
||||
<string>MoveUp</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSceneDown">
|
||||
@@ -547,7 +546,7 @@
|
||||
<normaloff>:/res/images/down.ico</normaloff>:/res/images/down.ico</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>SceneMoveDown</string>
|
||||
<string>Basic.Main.MoveDown</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSourceDown">
|
||||
@@ -559,32 +558,32 @@
|
||||
<normaloff>:/res/images/down.ico</normaloff>:/res/images/down.ico</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>SourceMoveDown</string>
|
||||
<string>MoveDown</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_New">
|
||||
<property name="text">
|
||||
<string>&New</string>
|
||||
<string>Basic.MainMenu.SwitchMode</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_Open">
|
||||
<property name="text">
|
||||
<string>&Open</string>
|
||||
<string>Basic.MainMenu.File.Export</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_Save">
|
||||
<property name="text">
|
||||
<string>&Save</string>
|
||||
<string>Basic.MainMenu.File.Import</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_Settings">
|
||||
<property name="text">
|
||||
<string>Settings</string>
|
||||
<string>Basic.MainMenu.File.Settings</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionE_xit">
|
||||
<property name="text">
|
||||
<string>E&xit</string>
|
||||
<string>Basic.MainMenu.File.Exit</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
|
@@ -6,7 +6,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>752</width>
|
||||
<width>770</width>
|
||||
<height>602</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -17,7 +17,7 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Settings</string>
|
||||
<string>Basic.Settings</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
@@ -44,7 +44,7 @@
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>General</string>
|
||||
<string>Basic.Settings.General</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="obs.qrc">
|
||||
@@ -53,7 +53,7 @@
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Stream</string>
|
||||
<string>Basic.Settings.Stream</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="obs.qrc">
|
||||
@@ -62,7 +62,7 @@
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Output</string>
|
||||
<string>Basic.Settings.Output</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="obs.qrc">
|
||||
@@ -71,7 +71,7 @@
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Audio</string>
|
||||
<string>Basic.Settings.Audio</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="obs.qrc">
|
||||
@@ -80,7 +80,7 @@
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Video</string>
|
||||
<string>Basic.Settings.Video</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="obs.qrc">
|
||||
@@ -92,10 +92,13 @@
|
||||
<item>
|
||||
<widget class="QStackedWidget" name="settingsPages">
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="generalPage">
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<property name="labelAlignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
@@ -119,12 +122,12 @@
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<width>170</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Language:</string>
|
||||
<string>Basic.Settings.General.Language</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
@@ -204,7 +207,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Stream Type</string>
|
||||
<string>Basic.Settings.Stream.StreamType</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
@@ -267,7 +270,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Mode</string>
|
||||
<string>Basic.Settings.Output.Mode</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
@@ -290,12 +293,12 @@
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Simple</string>
|
||||
<string>Basic.Settings.Output.Mode.Simple</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Custom</string>
|
||||
<string>Basic.Settings.Output.Mode.Custom</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
@@ -368,7 +371,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save Path</string>
|
||||
<string>Basic.Settings.Output.Simple.SavePath</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
@@ -399,7 +402,7 @@
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_19">
|
||||
<property name="text">
|
||||
<string>Video Bitrate</string>
|
||||
<string>Basic.Settings.Output.Simple.VideoBitrate</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -419,7 +422,7 @@
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_20">
|
||||
<property name="text">
|
||||
<string>Audio Bitrate</string>
|
||||
<string>Basic.Settings.Output.Simple.AudioBitrate</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -485,13 +488,16 @@
|
||||
</widget>
|
||||
<widget class="QWidget" name="audioPage">
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<property name="labelAlignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_14">
|
||||
<property name="text">
|
||||
<string>Sample Rate:</string>
|
||||
<string>Basic.Settings.Audio.SampleRate</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -523,17 +529,17 @@
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_15">
|
||||
<property name="text">
|
||||
<string>Channels:</string>
|
||||
<string>Basic.Settings.Audio.Channels</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="channelSetup">
|
||||
<property name="currentText">
|
||||
<string>Stereo</string>
|
||||
<string>Mono</string>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
@@ -556,7 +562,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Desktop Audio Device 1:</string>
|
||||
<string>Basic.Settings.Audio.DesktopDevice</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
@@ -573,7 +579,7 @@
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Desktop Audio Device 2:</string>
|
||||
<string>Basic.Settings.Audio.DesktopDevice2</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
@@ -590,7 +596,7 @@
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Mic/Aux Audio Device 1:</string>
|
||||
<string>Basic.Settings.Audio.AuxDevice</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -604,7 +610,7 @@
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Mic/Aux Audio Device 2:</string>
|
||||
<string>Basic.Settings.Audio.AuxDevice2</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -618,7 +624,7 @@
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Mic/Aux Audio Device 3:</string>
|
||||
<string>Basic.Settings.Audio.AuxDevice3</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -646,13 +652,16 @@
|
||||
</widget>
|
||||
<widget class="QWidget" name="videoPage">
|
||||
<layout class="QFormLayout" name="formLayout_3">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<property name="labelAlignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Renderer:</string>
|
||||
<string>Basic.Settings.Video.Renderer</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -672,7 +681,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Video Adapter:</string>
|
||||
<string>Basic.Settings.Video.Adapter</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
@@ -692,7 +701,7 @@
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Base Resolution:</string>
|
||||
<string>Basic.Settings.Video.BaseResolution</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -715,7 +724,7 @@
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>Output Resolution:</string>
|
||||
<string>Basic.Settings.Video.ScaledResolution</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -739,7 +748,7 @@
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>Downscale Filter:</string>
|
||||
<string>Basic.Settings.Video.DownscaleFilter</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -752,24 +761,24 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="currentText">
|
||||
<string>FPS (Common)</string>
|
||||
<string>Basic.Settings.Video.FPSCommon</string>
|
||||
</property>
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QComboBox::AdjustToContents</enum>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>FPS (Common)</string>
|
||||
<string>Basic.Settings.Video.FPSCommon</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>FPS (Integer)</string>
|
||||
<string>Basic.Settings.Video.FPSInteger</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>FPS (Fractional)</string>
|
||||
<string>Basic.Settings.Video.FPSFraction</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
@@ -777,7 +786,7 @@
|
||||
<item row="5" column="1">
|
||||
<widget class="QStackedWidget" name="fpsTypes">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
@@ -871,6 +880,9 @@
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_2">
|
||||
<layout class="QFormLayout" name="formLayout_4">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<property name="labelAlignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
@@ -912,14 +924,14 @@
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string>Numerator:</string>
|
||||
<string>Basic.Settings.Video.Numerator</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="text">
|
||||
<string>Denomniator:</string>
|
||||
<string>Basic.Settings.Video.Denominator</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
98
obs/forms/OBSBasicSourceSelect.ui
Normal file
98
obs/forms/OBSBasicSourceSelect.ui
Normal file
@@ -0,0 +1,98 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>OBSBasicSourceSelect</class>
|
||||
<widget class="QDialog" name="OBSBasicSourceSelect">
|
||||
<property name="windowModality">
|
||||
<enum>Qt::WindowModal</enum>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>352</width>
|
||||
<height>314</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Basic.SourceSelect</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButton">
|
||||
<property name="text">
|
||||
<string>Basic.SourceSelect.CreateNew</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="sourceName"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="selectExisting">
|
||||
<property name="text">
|
||||
<string>Basic.SourceSelect.AddExisting</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="sourceList">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sortingEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>radioButton</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>sourceName</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>79</x>
|
||||
<y>29</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>108</x>
|
||||
<y>53</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>selectExisting</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>sourceList</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>51</x>
|
||||
<y>80</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>65</x>
|
||||
<y>128</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
@@ -163,8 +163,6 @@ OBSApp::OBSApp(int &argc, char **argv)
|
||||
throw "Failed to initialize global config";
|
||||
if (!InitLocale())
|
||||
throw "Failed to load locale";
|
||||
|
||||
mainWindow = move(unique_ptr<OBSBasic>(new OBSBasic()));
|
||||
}
|
||||
|
||||
const char *OBSApp::GetRenderModule() const
|
||||
@@ -180,6 +178,7 @@ const char *OBSApp::GetRenderModule() const
|
||||
|
||||
void OBSApp::OBSInit()
|
||||
{
|
||||
mainWindow = move(unique_ptr<OBSBasic>(new OBSBasic()));
|
||||
mainWindow->OBSInit();
|
||||
}
|
||||
|
||||
@@ -204,6 +203,19 @@ const char *OBSApp::OutputAudioSource() const
|
||||
return OUTPUT_AUDIO_SOURCE;
|
||||
}
|
||||
|
||||
QString OBSTranslator::translate(const char *context, const char *sourceText,
|
||||
const char *disambiguation, int n) const
|
||||
{
|
||||
const char *out = nullptr;
|
||||
if (!text_lookup_getstr(App()->GetTextLookup(), sourceText, &out))
|
||||
return QString();
|
||||
|
||||
UNUSED_PARAMETER(context);
|
||||
UNUSED_PARAMETER(disambiguation);
|
||||
UNUSED_PARAMETER(n);
|
||||
return QT_UTF8(out);
|
||||
}
|
||||
|
||||
struct NoFocusFrameStyle : QProxyStyle
|
||||
{
|
||||
void drawControl(ControlElement element, const QStyleOption *option,
|
||||
@@ -239,6 +251,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
try {
|
||||
OBSApp program(argc, argv);
|
||||
OBSTranslator test;
|
||||
program.installTranslator(&test);
|
||||
program.setStyle(new NoFocusFrameStyle);
|
||||
program.OBSInit();
|
||||
ret = program.exec();
|
||||
|
@@ -18,12 +18,23 @@
|
||||
#pragma once
|
||||
|
||||
#include <QApplication>
|
||||
#include <QTranslator>
|
||||
#include <util/util.hpp>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
|
||||
#include "window-main.hpp"
|
||||
|
||||
class OBSTranslator : public QTranslator {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
virtual bool isEmpty() const override {return false;}
|
||||
|
||||
virtual QString translate(const char *context, const char *sourceText,
|
||||
const char *disambiguation, int n) const override;
|
||||
};
|
||||
|
||||
class OBSApp : public QApplication {
|
||||
Q_OBJECT
|
||||
|
||||
@@ -51,6 +62,8 @@ public:
|
||||
return locale.c_str();
|
||||
}
|
||||
|
||||
inline lookup_t GetTextLookup() const {return textLookup;}
|
||||
|
||||
inline const char *GetString(const char *lookupVal) const
|
||||
{
|
||||
return textLookup.GetString(lookupVal);
|
||||
|
@@ -28,6 +28,7 @@
|
||||
#include "platform.hpp"
|
||||
#include "window-basic-settings.hpp"
|
||||
#include "window-namedialog.hpp"
|
||||
#include "window-basic-source-select.hpp"
|
||||
#include "window-basic-main.hpp"
|
||||
#include "window-basic-properties.hpp"
|
||||
#include "qt-wrappers.hpp"
|
||||
@@ -153,8 +154,6 @@ void OBSBasic::CreateDefaultScene()
|
||||
Str("Studio.Basic.DisplayCapture"), NULL);
|
||||
|
||||
if (source) {
|
||||
sourceSceneRefs[source] = 0;
|
||||
|
||||
obs_scene_add(scene, source);
|
||||
obs_add_source(source);
|
||||
obs_source_release(source);
|
||||
@@ -652,12 +651,15 @@ void OBSBasic::SceneItemRemoved(void *data, calldata_t params)
|
||||
|
||||
void OBSBasic::SourceAdded(void *data, calldata_t params)
|
||||
{
|
||||
OBSBasic *window = static_cast<OBSBasic*>(data);
|
||||
obs_source_t source = (obs_source_t)calldata_ptr(params, "source");
|
||||
|
||||
if (obs_scene_fromsource(source) != NULL)
|
||||
QMetaObject::invokeMethod(static_cast<OBSBasic*>(data),
|
||||
QMetaObject::invokeMethod(window,
|
||||
"AddScene",
|
||||
Q_ARG(OBSSource, OBSSource(source)));
|
||||
else
|
||||
window->sourceSceneRefs[source] = 0;
|
||||
}
|
||||
|
||||
void OBSBasic::SourceRemoved(void *data, calldata_t params)
|
||||
@@ -1029,59 +1031,19 @@ void OBSBasic::on_sources_customContextMenuRequested(const QPoint &pos)
|
||||
UNUSED_PARAMETER(pos);
|
||||
}
|
||||
|
||||
void OBSBasic::AddSource(obs_scene_t scene, const char *id)
|
||||
void OBSBasic::AddSource(const char *id)
|
||||
{
|
||||
string name;
|
||||
|
||||
bool success = false;
|
||||
while (!success) {
|
||||
bool accepted = NameDialog::AskForName(this,
|
||||
Str("MainWindow.AddSourceDlg.Title"),
|
||||
Str("MainWindow.AddSourceDlg.Text"),
|
||||
name);
|
||||
|
||||
if (!accepted)
|
||||
break;
|
||||
|
||||
if (name.empty()) {
|
||||
QMessageBox::information(this,
|
||||
QTStr("MainWindow.NoNameEntered"),
|
||||
QTStr("MainWindow.NoNameEntered"));
|
||||
continue;
|
||||
}
|
||||
|
||||
obs_source_t source = obs_get_source_by_name(name.c_str());
|
||||
if (!source) {
|
||||
success = true;
|
||||
break;
|
||||
} else {
|
||||
QMessageBox::information(this,
|
||||
QTStr("MainWindow.NameExists.Title"),
|
||||
QTStr("MainWindow.NameExists.Text"));
|
||||
obs_source_release(source);
|
||||
}
|
||||
}
|
||||
|
||||
if (success) {
|
||||
obs_source_t source = obs_source_create(OBS_SOURCE_TYPE_INPUT,
|
||||
id, name.c_str(), NULL);
|
||||
|
||||
sourceSceneRefs[source] = 0;
|
||||
|
||||
obs_add_source(source);
|
||||
obs_scene_add(scene, source);
|
||||
obs_source_release(source);
|
||||
}
|
||||
OBSBasicSourceSelect sourceSelect(this, id);
|
||||
sourceSelect.exec();
|
||||
}
|
||||
|
||||
void OBSBasic::AddSourcePopupMenu(const QPoint &pos)
|
||||
{
|
||||
OBSScene scene = GetCurrentScene();
|
||||
const char *type;
|
||||
bool foundValues = false;
|
||||
size_t idx = 0;
|
||||
|
||||
if (!scene)
|
||||
if (!GetCurrentScene())
|
||||
return;
|
||||
|
||||
QMenu popup;
|
||||
@@ -1103,7 +1065,7 @@ void OBSBasic::AddSourcePopupMenu(const QPoint &pos)
|
||||
if (foundValues) {
|
||||
QAction *ret = popup.exec(pos);
|
||||
if (ret)
|
||||
AddSource(scene, ret->data().toString().toUtf8());
|
||||
AddSource(ret->data().toString().toUtf8());
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -124,7 +124,7 @@ private:
|
||||
|
||||
void ResizePreview(uint32_t cx, uint32_t cy);
|
||||
|
||||
void AddSource(obs_scene_t scene, const char *id);
|
||||
void AddSource(const char *id);
|
||||
void AddSourcePopupMenu(const QPoint &pos);
|
||||
|
||||
public:
|
||||
|
@@ -363,7 +363,8 @@ void OBSBasicSettings::LoadVideoSettings()
|
||||
|
||||
if (video_output_active(obs_video())) {
|
||||
ui->videoPage->setEnabled(false);
|
||||
ui->videoMsg->setText(QTStr("Settings.Video.CurrentlyActive"));
|
||||
ui->videoMsg->setText(
|
||||
QTStr("Basic.Settings.Video.CurrentlyActive"));
|
||||
}
|
||||
|
||||
LoadRendererList();
|
||||
@@ -634,8 +635,8 @@ bool OBSBasicSettings::QueryChanges()
|
||||
QMessageBox::StandardButton button;
|
||||
|
||||
button = QMessageBox::question(this,
|
||||
QTStr("Settings.ConfirmTitle"),
|
||||
QTStr("Settings.Confirm"),
|
||||
QTStr("Basic.Settings.ConfirmTitle"),
|
||||
QTStr("Basic.Settings.Confirm"),
|
||||
QMessageBox::Yes | QMessageBox::No |
|
||||
QMessageBox::Cancel);
|
||||
|
||||
@@ -711,6 +712,8 @@ static inline bool StreamExists(const char *name)
|
||||
return obs_get_service_by_name(name) != nullptr;
|
||||
}
|
||||
|
||||
#define INVALID_RES_STR "Basic.Settings.Video.InvalidResolution"
|
||||
|
||||
static bool ValidResolutions(Ui::OBSBasicSettings *ui)
|
||||
{
|
||||
QString baseRes = ui->baseResolution->lineEdit()->text();
|
||||
@@ -720,8 +723,7 @@ static bool ValidResolutions(Ui::OBSBasicSettings *ui)
|
||||
if (!ConvertResText(QT_TO_UTF8(baseRes), cx, cy) ||
|
||||
!ConvertResText(QT_TO_UTF8(outputRes), cx, cy)) {
|
||||
|
||||
ui->videoMsg->setText(
|
||||
QTStr("Settings.Video.InvalidResolution"));
|
||||
ui->videoMsg->setText(QTStr(INVALID_RES_STR));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -762,7 +764,7 @@ void OBSBasicSettings::AudioChangedRestart()
|
||||
{
|
||||
if (!loading) {
|
||||
audioChanged = true;
|
||||
ui->audioMsg->setText(QTStr("Settings.ProgramRestart"));
|
||||
ui->audioMsg->setText(QTStr("Basic.Settings.ProgramRestart"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -770,7 +772,7 @@ void OBSBasicSettings::VideoChangedRestart()
|
||||
{
|
||||
if (!loading) {
|
||||
videoChanged = true;
|
||||
ui->videoMsg->setText(QTStr("Settings.ProgramRestart"));
|
||||
ui->videoMsg->setText(QTStr("Basic.Settings.ProgramRestart"));
|
||||
}
|
||||
}
|
||||
|
||||
|
147
obs/window-basic-source-select.cpp
Normal file
147
obs/window-basic-source-select.cpp
Normal file
@@ -0,0 +1,147 @@
|
||||
/******************************************************************************
|
||||
Copyright (C) 2014 by Hugh Bailey <obs.jim@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
|
||||
#include "window-basic-main.hpp"
|
||||
#include "window-basic-source-select.hpp"
|
||||
#include "qt-wrappers.hpp"
|
||||
|
||||
bool OBSBasicSourceSelect::EnumSources(void *data, obs_source_t source)
|
||||
{
|
||||
OBSBasicSourceSelect *window = static_cast<OBSBasicSourceSelect*>(data);
|
||||
const char *name = obs_source_getname(source);
|
||||
const char *type;
|
||||
|
||||
obs_source_gettype(source, nullptr, &type);
|
||||
|
||||
if (strcmp(type, window->type) == 0)
|
||||
window->ui->sourceList->addItem(QT_UTF8(name));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void OBSBasicSourceSelect::OBSSourceAdded(void *data, calldata_t calldata)
|
||||
{
|
||||
OBSBasicSourceSelect *window = static_cast<OBSBasicSourceSelect*>(data);
|
||||
obs_source_t source = (obs_source_t)calldata_ptr(calldata, "source");
|
||||
|
||||
QMetaObject::invokeMethod(window, "SourceAdded",
|
||||
Q_ARG(OBSSource, source));
|
||||
}
|
||||
|
||||
void OBSBasicSourceSelect::OBSSourceRemoved(void *data, calldata_t calldata)
|
||||
{
|
||||
OBSBasicSourceSelect *window = static_cast<OBSBasicSourceSelect*>(data);
|
||||
obs_source_t source = (obs_source_t)calldata_ptr(calldata, "source");
|
||||
|
||||
QMetaObject::invokeMethod(window, "SourceRemoved",
|
||||
Q_ARG(OBSSource, source));
|
||||
}
|
||||
|
||||
void OBSBasicSourceSelect::SourceAdded(OBSSource source)
|
||||
{
|
||||
const char *name = obs_source_getname(source);
|
||||
const char *sourceType;
|
||||
|
||||
obs_source_gettype(source, nullptr, &sourceType);
|
||||
if (strcmp(sourceType, type) != 0)
|
||||
return;
|
||||
|
||||
ui->sourceList->addItem(name);
|
||||
}
|
||||
|
||||
void OBSBasicSourceSelect::SourceRemoved(OBSSource source)
|
||||
{
|
||||
const char *name = obs_source_getname(source);
|
||||
const char *sourceType;
|
||||
|
||||
obs_source_gettype(source, nullptr, &sourceType);
|
||||
if (strcmp(sourceType, type) != 0)
|
||||
return;
|
||||
|
||||
QList<QListWidgetItem*> items =
|
||||
ui->sourceList->findItems(name, Qt::MatchFixedString);
|
||||
|
||||
if (!items.count())
|
||||
return;
|
||||
|
||||
delete items[0];
|
||||
}
|
||||
|
||||
static void AddExisting(const char *name)
|
||||
{
|
||||
obs_source_t source = obs_get_output_source(0);
|
||||
obs_scene_t scene = obs_scene_fromsource(source);
|
||||
if (!scene)
|
||||
return;
|
||||
|
||||
source = obs_get_source_by_name(name);
|
||||
if (source) {
|
||||
obs_scene_add(scene, source);
|
||||
obs_source_release(source);
|
||||
}
|
||||
|
||||
obs_scene_release(scene);
|
||||
}
|
||||
|
||||
void AddNew(const char *id, const char *name)
|
||||
{
|
||||
obs_source_t source = obs_get_output_source(0);
|
||||
obs_scene_t scene = obs_scene_fromsource(source);
|
||||
if (!scene)
|
||||
return;
|
||||
|
||||
source = obs_source_create(OBS_SOURCE_TYPE_INPUT,
|
||||
id, name, NULL);
|
||||
|
||||
obs_add_source(source);
|
||||
obs_scene_add(scene, source);
|
||||
obs_source_release(source);
|
||||
|
||||
obs_scene_release(scene);
|
||||
}
|
||||
|
||||
void OBSBasicSourceSelect::on_buttonBox_accepted()
|
||||
{
|
||||
bool useExisting = ui->selectExisting->isChecked();
|
||||
|
||||
if (useExisting) {
|
||||
QListWidgetItem *item = ui->sourceList->currentItem();
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
AddExisting(QT_TO_UTF8(item->text()));
|
||||
} else {
|
||||
AddNew(type, QT_TO_UTF8(ui->sourceName->text()));
|
||||
}
|
||||
|
||||
done(DialogCode::Accepted);
|
||||
}
|
||||
|
||||
void OBSBasicSourceSelect::on_buttonBox_rejected()
|
||||
{
|
||||
done(DialogCode::Rejected);
|
||||
}
|
||||
|
||||
OBSBasicSourceSelect::OBSBasicSourceSelect(OBSBasic *parent, const char *type_)
|
||||
: QDialog (parent),
|
||||
ui (new Ui::OBSBasicSourceSelect),
|
||||
type (type_)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
obs_enum_sources(EnumSources, this);
|
||||
}
|
48
obs/window-basic-source-select.hpp
Normal file
48
obs/window-basic-source-select.hpp
Normal file
@@ -0,0 +1,48 @@
|
||||
/******************************************************************************
|
||||
Copyright (C) 2014 by Hugh Bailey <obs.jim@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <obs.hpp>
|
||||
#include <memory>
|
||||
|
||||
#include "ui_OBSBasicSourceSelect.h"
|
||||
|
||||
class OBSBasic;
|
||||
|
||||
class OBSBasicSourceSelect : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
std::unique_ptr<Ui::OBSBasicSourceSelect> ui;
|
||||
const char *type;
|
||||
|
||||
static bool EnumSources(void *data, obs_source_t source);
|
||||
|
||||
static void OBSSourceRemoved(void *data, calldata_t calldata);
|
||||
static void OBSSourceAdded(void *data, calldata_t calldata);
|
||||
|
||||
private slots:
|
||||
void on_buttonBox_accepted();
|
||||
void on_buttonBox_rejected();
|
||||
|
||||
void SourceAdded(OBSSource source);
|
||||
void SourceRemoved(OBSSource source);
|
||||
|
||||
public:
|
||||
OBSBasicSourceSelect(OBSBasic *parent, const char *type);
|
||||
};
|
Reference in New Issue
Block a user