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.
master
jp9000 2014-05-10 18:47:48 -07:00
parent a9158555b4
commit 345c70138e
14 changed files with 587 additions and 188 deletions

View File

@ -1,76 +1,111 @@
# Language and language region of this file
Language="English" Language="English"
Region="United States"
DesktopDevice1="Desktop Audio" # commonly shared locale
DesktopDevice2="Desktop Audio 2" OK="OK"
AuxDevice1="Mic/Aux" Apply="Apply"
AuxDevice2="Mic/Aux 2" Cancel="Cancel"
AuxDevice3="Mic/Aux 3" Yes="Yes"
AuxDevice4="Mic/Aux 4" No="No"
Add="Add"
Studio.Basic.Scene="Scene" Remove="Remove"
Studio.Basic.DisplayCapture="Display Capture" Properties="Properties"
MoveUp="Move Up"
MainMenu.File="File" MoveDown="Move Down"
MainMenu.File.New="New"
MainMenu.File.Open="Open"
MainMenu.FIle.Save="Save"
MainWindow.AddSceneDlg.Title="Add Scene"
MainWindow.AddSceneDlg.Text="Please enter the name of the scene"
MainWindow.AddSourceDlg.Title="Add Source"
MainWindow.AddSourceDlg.Text="Please enter the name of the source"
MainWindow.NameExists.Title="Name already exists"
MainWindow.NameExists.Text="The name is already in use by another source."
MainWindow.NoNameEntered="Please enter a valid name"
MainWindow.Exit="Exit"
MainWindow.Lock="Lock Preview"
MainWindow.Preview="Enable Preview"
MainWindow.Scenes="Scenes:"
MainWindow.Settings="Settings"
MainWindow.Sources="Sources:"
MainWindow.StartRecording="Start Recording"
MainWindow.StartStream="Start Stream"
MainWindow.StopRecording="Stop Recording"
MainWindow.StopStream="Stop Stream"
MainWindow.Volume="Volume:"
Settings="Settings" Settings="Settings"
Exit="Exit"
Volume="Volume"
Browse="Browse"
Mono="Mono"
Stereo="Stereo"
Settings.ProgramRestart="The program must be restarted for these settings to take effect." # "name already exists" dialog box
Settings.ConfirmTitle="Confirm Changes" NameExists.Title="Name already exists"
Settings.Confirm="You have unsaved changes. Save changes?" NameExists.Text="The name is already in use."
Settings.General="General" NoNameEntered="Please enter a valid name"
Settings.General.Language="Language:"
Settings.Streams="Streams" # audio device names
Settings.Streams.AddName.Title="Add Stream" Basic.DesktopDevice1="Desktop Audio"
Settings.Streams.AddName.Text="Please enter the name of the stream" Basic.DesktopDevice2="Desktop Audio 2"
Settings.Streams.Exists.Title="Stream already exists" Basic.AuxDevice1="Mic/Aux"
Settings.Streams.Exists.Text="The name is already in use by another stream" Basic.AuxDevice2="Mic/Aux 2"
Basic.AuxDevice3="Mic/Aux 3"
Basic.AuxDevice4="Mic/Aux 4"
Settings.Outputs="Outputs" # startup scene/capture
Basic.Scene="Scene"
Basic.DisplayCapture="Display Capture"
Settings.Video="Video" # add scene dialog
Settings.Video.Adapter="Video Adapter:" Basic.Main.AddSceneDlg.Title="Add Scene"
Settings.Video.BaseRes="Base Resolution:" Basic.Main.AddSceneDlg.Text="Please enter the name of the scene"
Settings.Video.OutputRes="Output Resolution:"
Settings.Video.DownscaleFilter="Downscale Filter:"
Settings.Video.DisableAeroWindows="Disable Aero (Windows only)"
Settings.Video.FPS="FPS:"
Settings.Video.FPS.Common="Common FPS Values"
Settings.Video.FPS.Integer="Integer FPS Value"
Settings.Video.FPS.Fraction="Fractional FPS Value"
Settings.Video.FPS.Nanoseconds="Frame Interval (nanoseconds)"
Settings.Video.FPS.Numerator="Numerator:"
Settings.Video.FPS.Denominator="Denominator:"
Settings.Video.Renderer="Renderer:"
Settings.Video.InvalidResolution="Invalid resolution value. Must be [width]x[height] (i.e. 1920x1080)"
Settings.Video.CurrentlyActive="Video output is currently active. Please turn off any outputs to change video settings."
Settings.Audio="Audio" # add source dialog
Basic.SourceSelect.CreateNew="Create new"
Basic.SourceSelect.AddExisting="Add Existing"
# basic mode main window
Basic.Main.Scenes="Scenes"
Basic.Main.Sources="Sources"
Basic.Main.StartRecording="Start Recording"
Basic.Main.StartStreaming="Start Streaming"
Basic.Main.StopRecording="Stop Recording"
Basic.Main.StopStreaming="Stop Streaming"
# basic mode menu
Basic.MainMenu.File="&File"
Basic.MainMenu.File.Export="&Export"
Basic.MainMenu.File.Import="&Import"
Basic.MainMenu.File.Settings="&Settings"
Basic.MainMenu.File.Exit="E&xit"
# basic mode settings dialog
Basic.Settings.ProgramRestart="The program must be restarted for these settings to take effect."
Basic.Settings.ConfirmTitle="Confirm Changes"
Basic.Settings.Confirm="You have unsaved changes. Save changes?"
# basic mode 'general' settings
Basic.Settings.General="General"
Basic.Settings.General.Language="Language:"
# basic mode 'stream' settings
Basic.Settings.Stream="Stream"
Basic.Settings.Stream.StreamType="Stream Type"
# basic mode 'output' settings
Basic.Settings.Output="Output"
Basic.Settings.Output.Mode="Output Mode"
Basic.Settings.Output.Mode.Simple="Simple (Stream and/or record)"
Basic.Settings.Output.Mode.Advanced="Advanced (Custom output type)"
Basic.Settings.Output.Simple.SavePath="Recording Path"
Basic.Settings.Output.Simple.VideoBitrate="Video Bitrate"
Basic.Settings.output.Simple.AudioBitrate="Audio Bitrate"
# basic mode 'video' settings
Basic.Settings.Video="Video"
Basic.Settings.Video.Adapter="Video Adapter:"
Basic.Settings.Video.BaseResolution="Base Resolution:"
Basic.Settings.Video.ScaledResolution="Scaled Resolution:"
Basic.Settings.Video.DownscaleFilter="Downscale Filter:"
Basic.Settings.Video.DisableAeroWindows="Disable Aero (Windows only)"
Basic.Settings.Video.FPS="FPS:"
Basic.Settings.Video.FPSCommon="Common FPS Values"
Basic.Settings.Video.FPSInteger="Integer FPS Value"
Basic.Settings.Video.FPSFraction="Fractional FPS Value"
Basic.Settings.Video.Numerator="Numerator:"
Basic.Settings.Video.Denominator="Denominator:"
Basic.Settings.Video.Renderer="Renderer:"
Basic.Settings.Video.InvalidResolution="Invalid resolution value. Must be [width]x[height] (i.e. 1920x1080)"
Basic.Settings.Video.CurrentlyActive="Video output is currently active. Please turn off any outputs to change video settings."
# basic mode 'audio' settings
Basic.Settings.Audio="Audio"
Basic.Settings.Audio.SampleRate="Sample Rate"
Basic.Settings.Audio.Channels="Channels"
Basic.Settings.Audio.DesktopDevice="Desktop Audio Device"
Basic.Settings.Audio.DesktopDevice2="Desktop Audio Device 2"
Basic.Settings.Audio.AuxDevice="Mic/Auxilary Audio Device"
Basic.Settings.Audio.AuxDevice2="Mic/Auxilary Audio Device 2"
Basic.Settings.Audio.AuxDevice3="Mic/Auxilary Audio Device 3"

View File

@ -57,6 +57,7 @@ set(obs_SOURCES
window-basic-main.cpp window-basic-main.cpp
window-basic-settings.cpp window-basic-settings.cpp
window-basic-properties.cpp window-basic-properties.cpp
window-basic-source-select.cpp
window-namedialog.cpp window-namedialog.cpp
properties-view.cpp properties-view.cpp
volume-control.cpp volume-control.cpp
@ -69,6 +70,7 @@ set(obs_HEADERS
window-basic-main.hpp window-basic-main.hpp
window-basic-settings.hpp window-basic-settings.hpp
window-basic-properties.hpp window-basic-properties.hpp
window-basic-source-select.hpp
window-namedialog.hpp window-namedialog.hpp
properties-view.hpp properties-view.hpp
display-helpers.hpp display-helpers.hpp
@ -80,6 +82,7 @@ set(obs_UI
forms/NameDialog.ui forms/NameDialog.ui
forms/OBSBasic.ui forms/OBSBasic.ui
forms/OBSBasicSettings.ui forms/OBSBasicSettings.ui
forms/OBSBasicSourceSelect.ui
forms/OBSBasicProperties.ui) forms/OBSBasicProperties.ui)
set(obs_QRC set(obs_QRC

View File

@ -24,7 +24,7 @@
</size> </size>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>MainWindow</string> <string>.MainWindow</string>
</property> </property>
<widget class="QWidget" name="centralwidget"> <widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
@ -107,7 +107,7 @@
<item> <item>
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="text"> <property name="text">
<string>Scenes</string> <string>Basic.Main.Scenes</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -215,7 +215,7 @@
<item> <item>
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="label_2">
<property name="text"> <property name="text">
<string>Sources</string> <string>Basic.Main.Sources</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -322,7 +322,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>233</width> <width>148</width>
<height>16</height> <height>16</height>
</rect> </rect>
</property> </property>
@ -391,7 +391,7 @@
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="text"> <property name="text">
<string>Start Streaming</string> <string>Basic.Main.StartStreaming</string>
</property> </property>
<property name="checkable"> <property name="checkable">
<bool>false</bool> <bool>false</bool>
@ -404,7 +404,7 @@
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="text"> <property name="text">
<string>Start Recording</string> <string>Basic.Main.StartRecording</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -436,16 +436,15 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>927</width> <width>927</width>
<height>24</height> <height>22</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menu_File"> <widget class="QMenu" name="menu_File">
<property name="title"> <property name="title">
<string>&amp;File</string> <string>Basic.MainMenu.File</string>
</property> </property>
<addaction name="action_New"/>
<addaction name="action_Open"/>
<addaction name="action_Save"/> <addaction name="action_Save"/>
<addaction name="action_Open"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="action_Settings"/> <addaction name="action_Settings"/>
<addaction name="separator"/> <addaction name="separator"/>
@ -460,7 +459,7 @@
<normaloff>:/res/images/add.ico</normaloff>:/res/images/add.ico</iconset> <normaloff>:/res/images/add.ico</normaloff>:/res/images/add.ico</iconset>
</property> </property>
<property name="text"> <property name="text">
<string>AddScene</string> <string>Add</string>
</property> </property>
</action> </action>
<action name="actionAddSource"> <action name="actionAddSource">
@ -469,7 +468,7 @@
<normaloff>:/res/images/add.ico</normaloff>:/res/images/add.ico</iconset> <normaloff>:/res/images/add.ico</normaloff>:/res/images/add.ico</iconset>
</property> </property>
<property name="text"> <property name="text">
<string>AddSource</string> <string>Add</string>
</property> </property>
</action> </action>
<action name="actionRemoveScene"> <action name="actionRemoveScene">
@ -478,7 +477,7 @@
<normaloff>:/res/images/list_remove.png</normaloff>:/res/images/list_remove.png</iconset> <normaloff>:/res/images/list_remove.png</normaloff>:/res/images/list_remove.png</iconset>
</property> </property>
<property name="text"> <property name="text">
<string>RemoveScene</string> <string>Remove</string>
</property> </property>
</action> </action>
<action name="actionRemoveSource"> <action name="actionRemoveSource">
@ -487,7 +486,7 @@
<normaloff>:/res/images/list_remove.png</normaloff>:/res/images/list_remove.png</iconset> <normaloff>:/res/images/list_remove.png</normaloff>:/res/images/list_remove.png</iconset>
</property> </property>
<property name="text"> <property name="text">
<string>RemoveSource</string> <string>Remove</string>
</property> </property>
</action> </action>
<action name="actionSceneProperties"> <action name="actionSceneProperties">
@ -499,7 +498,7 @@
<normaloff>:/res/images/properties.ico</normaloff>:/res/images/properties.ico</iconset> <normaloff>:/res/images/properties.ico</normaloff>:/res/images/properties.ico</iconset>
</property> </property>
<property name="text"> <property name="text">
<string>SceneProperties</string> <string>Properties</string>
</property> </property>
</action> </action>
<action name="actionSourceProperties"> <action name="actionSourceProperties">
@ -511,7 +510,7 @@
<normaloff>:/res/images/properties.ico</normaloff>:/res/images/properties.ico</iconset> <normaloff>:/res/images/properties.ico</normaloff>:/res/images/properties.ico</iconset>
</property> </property>
<property name="text"> <property name="text">
<string>SourceProperties</string> <string>Properties</string>
</property> </property>
</action> </action>
<action name="actionSceneUp"> <action name="actionSceneUp">
@ -523,7 +522,7 @@
<normaloff>:/res/images/up.ico</normaloff>:/res/images/up.ico</iconset> <normaloff>:/res/images/up.ico</normaloff>:/res/images/up.ico</iconset>
</property> </property>
<property name="text"> <property name="text">
<string>SceneMoveUp</string> <string>Basic.Main.MoveUp</string>
</property> </property>
</action> </action>
<action name="actionSourceUp"> <action name="actionSourceUp">
@ -535,7 +534,7 @@
<normaloff>:/res/images/up.ico</normaloff>:/res/images/up.ico</iconset> <normaloff>:/res/images/up.ico</normaloff>:/res/images/up.ico</iconset>
</property> </property>
<property name="text"> <property name="text">
<string>SourceMoveUp</string> <string>MoveUp</string>
</property> </property>
</action> </action>
<action name="actionSceneDown"> <action name="actionSceneDown">
@ -547,7 +546,7 @@
<normaloff>:/res/images/down.ico</normaloff>:/res/images/down.ico</iconset> <normaloff>:/res/images/down.ico</normaloff>:/res/images/down.ico</iconset>
</property> </property>
<property name="text"> <property name="text">
<string>SceneMoveDown</string> <string>Basic.Main.MoveDown</string>
</property> </property>
</action> </action>
<action name="actionSourceDown"> <action name="actionSourceDown">
@ -559,32 +558,32 @@
<normaloff>:/res/images/down.ico</normaloff>:/res/images/down.ico</iconset> <normaloff>:/res/images/down.ico</normaloff>:/res/images/down.ico</iconset>
</property> </property>
<property name="text"> <property name="text">
<string>SourceMoveDown</string> <string>MoveDown</string>
</property> </property>
</action> </action>
<action name="action_New"> <action name="action_New">
<property name="text"> <property name="text">
<string>&amp;New</string> <string>Basic.MainMenu.SwitchMode</string>
</property> </property>
</action> </action>
<action name="action_Open"> <action name="action_Open">
<property name="text"> <property name="text">
<string>&amp;Open</string> <string>Basic.MainMenu.File.Export</string>
</property> </property>
</action> </action>
<action name="action_Save"> <action name="action_Save">
<property name="text"> <property name="text">
<string>&amp;Save</string> <string>Basic.MainMenu.File.Import</string>
</property> </property>
</action> </action>
<action name="action_Settings"> <action name="action_Settings">
<property name="text"> <property name="text">
<string>Settings</string> <string>Basic.MainMenu.File.Settings</string>
</property> </property>
</action> </action>
<action name="actionE_xit"> <action name="actionE_xit">
<property name="text"> <property name="text">
<string>E&amp;xit</string> <string>Basic.MainMenu.File.Exit</string>
</property> </property>
</action> </action>
</widget> </widget>

View File

@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>752</width> <width>770</width>
<height>602</height> <height>602</height>
</rect> </rect>
</property> </property>
@ -17,7 +17,7 @@
</sizepolicy> </sizepolicy>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Settings</string> <string>Basic.Settings</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
@ -44,7 +44,7 @@
</property> </property>
<item> <item>
<property name="text"> <property name="text">
<string>General</string> <string>Basic.Settings.General</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="obs.qrc"> <iconset resource="obs.qrc">
@ -53,7 +53,7 @@
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Stream</string> <string>Basic.Settings.Stream</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="obs.qrc"> <iconset resource="obs.qrc">
@ -62,7 +62,7 @@
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Output</string> <string>Basic.Settings.Output</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="obs.qrc"> <iconset resource="obs.qrc">
@ -71,7 +71,7 @@
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Audio</string> <string>Basic.Settings.Audio</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="obs.qrc"> <iconset resource="obs.qrc">
@ -80,7 +80,7 @@
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Video</string> <string>Basic.Settings.Video</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="obs.qrc"> <iconset resource="obs.qrc">
@ -92,10 +92,13 @@
<item> <item>
<widget class="QStackedWidget" name="settingsPages"> <widget class="QStackedWidget" name="settingsPages">
<property name="currentIndex"> <property name="currentIndex">
<number>2</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="generalPage"> <widget class="QWidget" name="generalPage">
<layout class="QFormLayout" name="formLayout_2"> <layout class="QFormLayout" name="formLayout_2">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<property name="labelAlignment"> <property name="labelAlignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property> </property>
@ -119,12 +122,12 @@
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>150</width> <width>170</width>
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<property name="text"> <property name="text">
<string>Language:</string> <string>Basic.Settings.General.Language</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -204,7 +207,7 @@
</size> </size>
</property> </property>
<property name="text"> <property name="text">
<string>Stream Type</string> <string>Basic.Settings.Stream.StreamType</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -267,7 +270,7 @@
</size> </size>
</property> </property>
<property name="text"> <property name="text">
<string>Mode</string> <string>Basic.Settings.Output.Mode</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -290,12 +293,12 @@
</property> </property>
<item> <item>
<property name="text"> <property name="text">
<string>Simple</string> <string>Basic.Settings.Output.Mode.Simple</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Custom</string> <string>Basic.Settings.Output.Mode.Custom</string>
</property> </property>
</item> </item>
</widget> </widget>
@ -368,7 +371,7 @@
</size> </size>
</property> </property>
<property name="text"> <property name="text">
<string>Save Path</string> <string>Basic.Settings.Output.Simple.SavePath</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -399,7 +402,7 @@
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="label_19"> <widget class="QLabel" name="label_19">
<property name="text"> <property name="text">
<string>Video Bitrate</string> <string>Basic.Settings.Output.Simple.VideoBitrate</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -419,7 +422,7 @@
<item row="2" column="0"> <item row="2" column="0">
<widget class="QLabel" name="label_20"> <widget class="QLabel" name="label_20">
<property name="text"> <property name="text">
<string>Audio Bitrate</string> <string>Basic.Settings.Output.Simple.AudioBitrate</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -485,13 +488,16 @@
</widget> </widget>
<widget class="QWidget" name="audioPage"> <widget class="QWidget" name="audioPage">
<layout class="QFormLayout" name="formLayout"> <layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<property name="labelAlignment"> <property name="labelAlignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property> </property>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="label_14"> <widget class="QLabel" name="label_14">
<property name="text"> <property name="text">
<string>Sample Rate:</string> <string>Basic.Settings.Audio.SampleRate</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -523,17 +529,17 @@
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="label_15"> <widget class="QLabel" name="label_15">
<property name="text"> <property name="text">
<string>Channels:</string> <string>Basic.Settings.Audio.Channels</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="QComboBox" name="channelSetup"> <widget class="QComboBox" name="channelSetup">
<property name="currentText"> <property name="currentText">
<string>Stereo</string> <string>Mono</string>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>1</number> <number>0</number>
</property> </property>
<item> <item>
<property name="text"> <property name="text">
@ -556,7 +562,7 @@
</size> </size>
</property> </property>
<property name="text"> <property name="text">
<string>Desktop Audio Device 1:</string> <string>Basic.Settings.Audio.DesktopDevice</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -573,7 +579,7 @@
<item row="3" column="0"> <item row="3" column="0">
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="label_3">
<property name="text"> <property name="text">
<string>Desktop Audio Device 2:</string> <string>Basic.Settings.Audio.DesktopDevice2</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -590,7 +596,7 @@
<item row="4" column="0"> <item row="4" column="0">
<widget class="QLabel" name="label_4"> <widget class="QLabel" name="label_4">
<property name="text"> <property name="text">
<string>Mic/Aux Audio Device 1:</string> <string>Basic.Settings.Audio.AuxDevice</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -604,7 +610,7 @@
<item row="5" column="0"> <item row="5" column="0">
<widget class="QLabel" name="label_5"> <widget class="QLabel" name="label_5">
<property name="text"> <property name="text">
<string>Mic/Aux Audio Device 2:</string> <string>Basic.Settings.Audio.AuxDevice2</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -618,7 +624,7 @@
<item row="6" column="0"> <item row="6" column="0">
<widget class="QLabel" name="label_6"> <widget class="QLabel" name="label_6">
<property name="text"> <property name="text">
<string>Mic/Aux Audio Device 3:</string> <string>Basic.Settings.Audio.AuxDevice3</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -646,13 +652,16 @@
</widget> </widget>
<widget class="QWidget" name="videoPage"> <widget class="QWidget" name="videoPage">
<layout class="QFormLayout" name="formLayout_3"> <layout class="QFormLayout" name="formLayout_3">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<property name="labelAlignment"> <property name="labelAlignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property> </property>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="label_9"> <widget class="QLabel" name="label_9">
<property name="text"> <property name="text">
<string>Renderer:</string> <string>Basic.Settings.Video.Renderer</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -672,7 +681,7 @@
</size> </size>
</property> </property>
<property name="text"> <property name="text">
<string>Video Adapter:</string> <string>Basic.Settings.Video.Adapter</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -692,7 +701,7 @@
<item row="2" column="0"> <item row="2" column="0">
<widget class="QLabel" name="label_8"> <widget class="QLabel" name="label_8">
<property name="text"> <property name="text">
<string>Base Resolution:</string> <string>Basic.Settings.Video.BaseResolution</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -715,7 +724,7 @@
<item row="3" column="0"> <item row="3" column="0">
<widget class="QLabel" name="label_10"> <widget class="QLabel" name="label_10">
<property name="text"> <property name="text">
<string>Output Resolution:</string> <string>Basic.Settings.Video.ScaledResolution</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -739,7 +748,7 @@
<item row="4" column="0"> <item row="4" column="0">
<widget class="QLabel" name="label_11"> <widget class="QLabel" name="label_11">
<property name="text"> <property name="text">
<string>Downscale Filter:</string> <string>Basic.Settings.Video.DownscaleFilter</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -752,24 +761,24 @@
</sizepolicy> </sizepolicy>
</property> </property>
<property name="currentText"> <property name="currentText">
<string>FPS (Common)</string> <string>Basic.Settings.Video.FPSCommon</string>
</property> </property>
<property name="sizeAdjustPolicy"> <property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContents</enum> <enum>QComboBox::AdjustToContents</enum>
</property> </property>
<item> <item>
<property name="text"> <property name="text">
<string>FPS (Common)</string> <string>Basic.Settings.Video.FPSCommon</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>FPS (Integer)</string> <string>Basic.Settings.Video.FPSInteger</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>FPS (Fractional)</string> <string>Basic.Settings.Video.FPSFraction</string>
</property> </property>
</item> </item>
</widget> </widget>
@ -777,7 +786,7 @@
<item row="5" column="1"> <item row="5" column="1">
<widget class="QStackedWidget" name="fpsTypes"> <widget class="QStackedWidget" name="fpsTypes">
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>2</number>
</property> </property>
<widget class="QWidget" name="page"> <widget class="QWidget" name="page">
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
@ -871,6 +880,9 @@
</widget> </widget>
<widget class="QWidget" name="page_2"> <widget class="QWidget" name="page_2">
<layout class="QFormLayout" name="formLayout_4"> <layout class="QFormLayout" name="formLayout_4">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<property name="labelAlignment"> <property name="labelAlignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property> </property>
@ -912,14 +924,14 @@
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="label_12"> <widget class="QLabel" name="label_12">
<property name="text"> <property name="text">
<string>Numerator:</string> <string>Basic.Settings.Video.Numerator</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="label_13"> <widget class="QLabel" name="label_13">
<property name="text"> <property name="text">
<string>Denomniator:</string> <string>Basic.Settings.Video.Denominator</string>
</property> </property>
</widget> </widget>
</item> </item>

View 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>

View File

@ -163,8 +163,6 @@ OBSApp::OBSApp(int &argc, char **argv)
throw "Failed to initialize global config"; throw "Failed to initialize global config";
if (!InitLocale()) if (!InitLocale())
throw "Failed to load locale"; throw "Failed to load locale";
mainWindow = move(unique_ptr<OBSBasic>(new OBSBasic()));
} }
const char *OBSApp::GetRenderModule() const const char *OBSApp::GetRenderModule() const
@ -180,6 +178,7 @@ const char *OBSApp::GetRenderModule() const
void OBSApp::OBSInit() void OBSApp::OBSInit()
{ {
mainWindow = move(unique_ptr<OBSBasic>(new OBSBasic()));
mainWindow->OBSInit(); mainWindow->OBSInit();
} }
@ -204,6 +203,19 @@ const char *OBSApp::OutputAudioSource() const
return OUTPUT_AUDIO_SOURCE; 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 struct NoFocusFrameStyle : QProxyStyle
{ {
void drawControl(ControlElement element, const QStyleOption *option, void drawControl(ControlElement element, const QStyleOption *option,
@ -239,6 +251,8 @@ int main(int argc, char *argv[])
try { try {
OBSApp program(argc, argv); OBSApp program(argc, argv);
OBSTranslator test;
program.installTranslator(&test);
program.setStyle(new NoFocusFrameStyle); program.setStyle(new NoFocusFrameStyle);
program.OBSInit(); program.OBSInit();
ret = program.exec(); ret = program.exec();

View File

@ -18,12 +18,23 @@
#pragma once #pragma once
#include <QApplication> #include <QApplication>
#include <QTranslator>
#include <util/util.hpp> #include <util/util.hpp>
#include <string> #include <string>
#include <memory> #include <memory>
#include "window-main.hpp" #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 { class OBSApp : public QApplication {
Q_OBJECT Q_OBJECT
@ -51,6 +62,8 @@ public:
return locale.c_str(); return locale.c_str();
} }
inline lookup_t GetTextLookup() const {return textLookup;}
inline const char *GetString(const char *lookupVal) const inline const char *GetString(const char *lookupVal) const
{ {
return textLookup.GetString(lookupVal); return textLookup.GetString(lookupVal);

View File

@ -28,6 +28,7 @@
#include "platform.hpp" #include "platform.hpp"
#include "window-basic-settings.hpp" #include "window-basic-settings.hpp"
#include "window-namedialog.hpp" #include "window-namedialog.hpp"
#include "window-basic-source-select.hpp"
#include "window-basic-main.hpp" #include "window-basic-main.hpp"
#include "window-basic-properties.hpp" #include "window-basic-properties.hpp"
#include "qt-wrappers.hpp" #include "qt-wrappers.hpp"
@ -153,8 +154,6 @@ void OBSBasic::CreateDefaultScene()
Str("Studio.Basic.DisplayCapture"), NULL); Str("Studio.Basic.DisplayCapture"), NULL);
if (source) { if (source) {
sourceSceneRefs[source] = 0;
obs_scene_add(scene, source); obs_scene_add(scene, source);
obs_add_source(source); obs_add_source(source);
obs_source_release(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) 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"); obs_source_t source = (obs_source_t)calldata_ptr(params, "source");
if (obs_scene_fromsource(source) != NULL) if (obs_scene_fromsource(source) != NULL)
QMetaObject::invokeMethod(static_cast<OBSBasic*>(data), QMetaObject::invokeMethod(window,
"AddScene", "AddScene",
Q_ARG(OBSSource, OBSSource(source))); Q_ARG(OBSSource, OBSSource(source)));
else
window->sourceSceneRefs[source] = 0;
} }
void OBSBasic::SourceRemoved(void *data, calldata_t params) void OBSBasic::SourceRemoved(void *data, calldata_t params)
@ -1029,59 +1031,19 @@ void OBSBasic::on_sources_customContextMenuRequested(const QPoint &pos)
UNUSED_PARAMETER(pos); UNUSED_PARAMETER(pos);
} }
void OBSBasic::AddSource(obs_scene_t scene, const char *id) void OBSBasic::AddSource(const char *id)
{ {
string name; OBSBasicSourceSelect sourceSelect(this, id);
sourceSelect.exec();
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);
}
} }
void OBSBasic::AddSourcePopupMenu(const QPoint &pos) void OBSBasic::AddSourcePopupMenu(const QPoint &pos)
{ {
OBSScene scene = GetCurrentScene();
const char *type; const char *type;
bool foundValues = false; bool foundValues = false;
size_t idx = 0; size_t idx = 0;
if (!scene) if (!GetCurrentScene())
return; return;
QMenu popup; QMenu popup;
@ -1103,7 +1065,7 @@ void OBSBasic::AddSourcePopupMenu(const QPoint &pos)
if (foundValues) { if (foundValues) {
QAction *ret = popup.exec(pos); QAction *ret = popup.exec(pos);
if (ret) if (ret)
AddSource(scene, ret->data().toString().toUtf8()); AddSource(ret->data().toString().toUtf8());
} }
} }

View File

@ -124,7 +124,7 @@ private:
void ResizePreview(uint32_t cx, uint32_t cy); 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); void AddSourcePopupMenu(const QPoint &pos);
public: public:

View File

@ -363,7 +363,8 @@ void OBSBasicSettings::LoadVideoSettings()
if (video_output_active(obs_video())) { if (video_output_active(obs_video())) {
ui->videoPage->setEnabled(false); ui->videoPage->setEnabled(false);
ui->videoMsg->setText(QTStr("Settings.Video.CurrentlyActive")); ui->videoMsg->setText(
QTStr("Basic.Settings.Video.CurrentlyActive"));
} }
LoadRendererList(); LoadRendererList();
@ -634,8 +635,8 @@ bool OBSBasicSettings::QueryChanges()
QMessageBox::StandardButton button; QMessageBox::StandardButton button;
button = QMessageBox::question(this, button = QMessageBox::question(this,
QTStr("Settings.ConfirmTitle"), QTStr("Basic.Settings.ConfirmTitle"),
QTStr("Settings.Confirm"), QTStr("Basic.Settings.Confirm"),
QMessageBox::Yes | QMessageBox::No | QMessageBox::Yes | QMessageBox::No |
QMessageBox::Cancel); QMessageBox::Cancel);
@ -711,6 +712,8 @@ static inline bool StreamExists(const char *name)
return obs_get_service_by_name(name) != nullptr; return obs_get_service_by_name(name) != nullptr;
} }
#define INVALID_RES_STR "Basic.Settings.Video.InvalidResolution"
static bool ValidResolutions(Ui::OBSBasicSettings *ui) static bool ValidResolutions(Ui::OBSBasicSettings *ui)
{ {
QString baseRes = ui->baseResolution->lineEdit()->text(); QString baseRes = ui->baseResolution->lineEdit()->text();
@ -720,8 +723,7 @@ static bool ValidResolutions(Ui::OBSBasicSettings *ui)
if (!ConvertResText(QT_TO_UTF8(baseRes), cx, cy) || if (!ConvertResText(QT_TO_UTF8(baseRes), cx, cy) ||
!ConvertResText(QT_TO_UTF8(outputRes), cx, cy)) { !ConvertResText(QT_TO_UTF8(outputRes), cx, cy)) {
ui->videoMsg->setText( ui->videoMsg->setText(QTStr(INVALID_RES_STR));
QTStr("Settings.Video.InvalidResolution"));
return false; return false;
} }
@ -762,7 +764,7 @@ void OBSBasicSettings::AudioChangedRestart()
{ {
if (!loading) { if (!loading) {
audioChanged = true; audioChanged = true;
ui->audioMsg->setText(QTStr("Settings.ProgramRestart")); ui->audioMsg->setText(QTStr("Basic.Settings.ProgramRestart"));
} }
} }
@ -770,7 +772,7 @@ void OBSBasicSettings::VideoChangedRestart()
{ {
if (!loading) { if (!loading) {
videoChanged = true; videoChanged = true;
ui->videoMsg->setText(QTStr("Settings.ProgramRestart")); ui->videoMsg->setText(QTStr("Basic.Settings.ProgramRestart"));
} }
} }

View 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);
}

View 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);
};

View File

@ -22,6 +22,25 @@
<ClInclude Include="..\..\..\libobs\obs-ui.h" /> <ClInclude Include="..\..\..\libobs\obs-ui.h" />
<ClInclude Include="..\..\..\obs\display-helpers.hpp" /> <ClInclude Include="..\..\..\obs\display-helpers.hpp" />
<ClInclude Include="..\..\..\obs\platform.hpp" /> <ClInclude Include="..\..\..\obs\platform.hpp" />
<CustomBuild Include="..\..\..\obs\window-basic-source-select.hpp">
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Moc%27ing window-basic-source-select.hpp...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB "-I.\..\..\..\libobs" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I.\..\..\..\obs"</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Moc%27ing window-basic-source-select.hpp...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB "-I.\..\..\..\libobs" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I.\..\..\..\obs"</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Moc%27ing window-basic-source-select.hpp...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB "-I.\..\..\..\libobs" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I.\..\..\..\obs"</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Moc%27ing window-basic-source-select.hpp...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB "-I.\..\..\..\libobs" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I.\..\..\..\obs"</Command>
</CustomBuild>
<ClInclude Include="GeneratedFiles\ui_OBSBasicSourceSelect.h" />
<CustomBuild Include="..\..\..\obs\qt-display.hpp"> <CustomBuild Include="..\..\..\obs\qt-display.hpp">
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs> <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Moc%27ing qt-display.hpp...</Message> <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Moc%27ing qt-display.hpp...</Message>
@ -199,6 +218,7 @@
<ClCompile Include="..\..\..\obs\window-basic-main.cpp" /> <ClCompile Include="..\..\..\obs\window-basic-main.cpp" />
<ClCompile Include="..\..\..\obs\window-basic-properties.cpp" /> <ClCompile Include="..\..\..\obs\window-basic-properties.cpp" />
<ClCompile Include="..\..\..\obs\window-basic-settings.cpp" /> <ClCompile Include="..\..\..\obs\window-basic-settings.cpp" />
<ClCompile Include="..\..\..\obs\window-basic-source-select.cpp" />
<ClCompile Include="..\..\..\obs\window-namedialog.cpp" /> <ClCompile Include="..\..\..\obs\window-namedialog.cpp" />
<ClCompile Include="GeneratedFiles\Debug\moc_obs-app.cpp"> <ClCompile Include="GeneratedFiles\Debug\moc_obs-app.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
@ -228,6 +248,10 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClCompile Include="GeneratedFiles\Debug\moc_window-basic-source-select.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="GeneratedFiles\Debug\moc_window-main.cpp"> <ClCompile Include="GeneratedFiles\Debug\moc_window-main.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
@ -274,6 +298,10 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClCompile Include="GeneratedFiles\Release\moc_window-basic-source-select.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="GeneratedFiles\Release\moc_window-main.cpp"> <ClCompile Include="GeneratedFiles\Release\moc_window-main.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
@ -457,6 +485,26 @@
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">"$(QTDIR)\bin\uic.exe" -o ".\GeneratedFiles\ui_%(Filename).h" "%(FullPath)"</Command> <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">"$(QTDIR)\bin\uic.exe" -o ".\GeneratedFiles\ui_%(Filename).h" "%(FullPath)"</Command>
</CustomBuild> </CustomBuild>
</ItemGroup> </ItemGroup>
<ItemGroup>
<CustomBuild Include="..\..\..\obs\forms\OBSBasicSourceSelect.ui">
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(QTDIR)\bin\uic.exe;%(AdditionalInputs)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Uic%27ing %(Identity)...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\GeneratedFiles\ui_%(Filename).h;%(Outputs)</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\uic.exe" -o ".\GeneratedFiles\ui_%(Filename).h" "%(FullPath)"</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(QTDIR)\bin\uic.exe;%(AdditionalInputs)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Uic%27ing %(Identity)...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.\GeneratedFiles\ui_%(Filename).h;%(Outputs)</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">"$(QTDIR)\bin\uic.exe" -o ".\GeneratedFiles\ui_%(Filename).h" "%(FullPath)"</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(QTDIR)\bin\uic.exe;%(AdditionalInputs)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Uic%27ing %(Identity)...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\GeneratedFiles\ui_%(Filename).h;%(Outputs)</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\uic.exe" -o ".\GeneratedFiles\ui_%(Filename).h" "%(FullPath)"</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(QTDIR)\bin\uic.exe;%(AdditionalInputs)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Uic%27ing %(Identity)...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\GeneratedFiles\ui_%(Filename).h;%(Outputs)</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">"$(QTDIR)\bin\uic.exe" -o ".\GeneratedFiles\ui_%(Filename).h" "%(FullPath)"</Command>
</CustomBuild>
</ItemGroup>
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<ProjectGuid>{B12702AD-ABFB-343A-A199-8E24837244A3}</ProjectGuid> <ProjectGuid>{B12702AD-ABFB-343A-A199-8E24837244A3}</ProjectGuid>
<Keyword>Qt4VSv1.0</Keyword> <Keyword>Qt4VSv1.0</Keyword>

View File

@ -77,6 +77,12 @@
<CustomBuild Include="..\..\..\obs\volume-control.hpp"> <CustomBuild Include="..\..\..\obs\volume-control.hpp">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</CustomBuild> </CustomBuild>
<CustomBuild Include="..\..\..\obs\forms\OBSBasicSourceSelect.ui">
<Filter>Form Files</Filter>
</CustomBuild>
<CustomBuild Include="..\..\..\obs\window-basic-source-select.hpp">
<Filter>Header Files</Filter>
</CustomBuild>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\..\..\obs\platform.hpp"> <ClInclude Include="..\..\..\obs\platform.hpp">
@ -103,6 +109,9 @@
<ClInclude Include="GeneratedFiles\ui_OBSBasicProperties.h"> <ClInclude Include="GeneratedFiles\ui_OBSBasicProperties.h">
<Filter>Generated Files</Filter> <Filter>Generated Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="GeneratedFiles\ui_OBSBasicSourceSelect.h">
<Filter>Generated Files</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\..\..\obs\obs-app.cpp"> <ClCompile Include="..\..\..\obs\obs-app.cpp">
@ -189,6 +198,15 @@
<ClCompile Include="..\..\..\obs\volume-control.cpp"> <ClCompile Include="..\..\..\obs\volume-control.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\..\obs\window-basic-source-select.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Debug\moc_window-basic-source-select.cpp">
<Filter>Generated Files\Debug</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Release\moc_window-basic-source-select.cpp">
<Filter>Generated Files\Release</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Image Include="..\..\..\obs\forms\images\add.ico"> <Image Include="..\..\..\obs\forms\images\add.ico">