Add source properties window (very preliminary)

- Add a properties window for sources so that you can now actually edit
   the settings for sources.  Also, display the source by itself in the
   window (Note: not working on mac, and possibly not working on linux).

   When changing the settings for a source, it will call
   obs_source_update on that source when you have modified any values
   automatically.

 - Add a properties 'widget', eventually I want to turn this in to a
   regular nice properties view like you'd see in the designer, but
   right now it just uses a form layout in a QScrollArea with regular
   controls to display the properties.  It's clunky but works for the
   time being.

 - Make it so that swap chains and the main graphics subsystem will
   automatically use at least one backbuffer if none was specified

 - Fix bug where displays weren't added to the main display array

 - Make it so that you can get the properties of a source via the actual
   pointer of a source/encoder/output in addition to being able to look
   up properties via identifier.

 - When registering source types, check for required functions (wasn't
   doing it before).  getheight/getwidth should not be optional if it's
   a video source as well.

 - Add an RAII OBSObj wrapper to obs.hpp for non-reference-counted
   libobs pointers

 - Add an RAII OBSSignal wrapper to obs.hpp for libobs signals to
   automatically disconnect them on destruction

 - Move the "scale and center" calculation in window-basic-main.cpp to
   its own function and in its own source file

 - Add an 'update' callback to WASAPI audio sources
This commit is contained in:
jp9000 committed 2014-03-23 01:07:54 -07:00
1 parent 6c904650b3
commit d9251f9e87
26 files changed
+991 -74

No files matched your search

+24 -18
View File
@@ -29,7 +29,9 @@
#include "window-basic-settings.hpp"
#include "window-namedialog.hpp"
#include "window-basic-main.hpp"
#include "window-basic-properties.hpp"
#include "qt-wrappers.hpp"
#include "display-helpers.hpp"
#include "ui_OBSBasic.h"
@@ -43,6 +45,7 @@ OBSBasic::OBSBasic(QWidget *parent)
outputTest (NULL),
sceneChanging (false),
resizeTimer (0),
properties (nullptr),
ui (new Ui::OBSBasic)
{
ui->setupUi(this);
@@ -51,7 +54,7 @@ OBSBasic::OBSBasic(QWidget *parent)
static inline bool HasAudioDevices(const char *source_id)
{
const char *output_id = source_id;
obs_properties_t props = obs_source_properties(
obs_properties_t props = obs_get_source_properties(
OBS_SOURCE_TYPE_INPUT, output_id, App()->GetLocale());
size_t count = 0;
@@ -182,6 +185,9 @@ void OBSBasic::OBSInit()
OBSBasic::~OBSBasic()
{
if (properties)
delete properties;
/* free the lists before shutting down to remove the scene/item
* references */
ui->sources->clear();
@@ -499,26 +505,13 @@ void OBSBasic::ResetAudioDevices()
void OBSBasic::ResizePreview(uint32_t cx, uint32_t cy)
{
double targetAspect, baseAspect;
QSize targetSize;
/* resize preview panel to fix to the top section of the window */
targetSize = ui->preview->size();
targetAspect = double(targetSize.width()) / double(targetSize.height());
baseAspect = double(cx) / double(cy);
if (targetAspect > baseAspect) {
previewScale = float(targetSize.height()) / float(cy);
cx = targetSize.height() * baseAspect;
cy = targetSize.height();
} else {
previewScale = float(targetSize.width()) / float(cx);
cx = targetSize.width();
cy = targetSize.width() / baseAspect;
}
previewX = targetSize.width() /2 - cx/2;
previewY = targetSize.height()/2 - cy/2;
targetSize = ui->preview->size();
GetScaleAndCenterPos(int(cx), int(cy),
targetSize.width(), targetSize.height(),
previewX, previewY, previewScale);
if (isVisible()) {
if (resizeTimer)
@@ -769,6 +762,14 @@ void OBSBasic::on_actionRemoveSource_triggered()
void OBSBasic::on_actionSourceProperties_triggered()
{
OBSSceneItem item = GetCurrentSceneItem();
OBSSource source = obs_sceneitem_getsource(item);
if (source) {
delete properties;
properties = new OBSBasicProperties(this, source);
properties->Init();
}
}
void OBSBasic::on_actionSourceUp_triggered()
@@ -915,3 +916,8 @@ config_t OBSBasic::Config() const
{
return basicConfig;
}
void OBSBasic::UnloadProperties()
{
properties = nullptr;
}