parent
6b287dbcc1
commit
78bdd4cb01
|
@ -1158,21 +1158,107 @@
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="transitions">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>120</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="accessibleName">
|
||||||
|
<string>Transition</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>4</number>
|
<number>4</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="transitions">
|
<spacer name="horizontalSpacer">
|
||||||
<property name="minimumSize">
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Expanding</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>120</width>
|
<width>40</width>
|
||||||
<height>0</height>
|
<height>20</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="transitionAdd">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>22</width>
|
||||||
|
<height>22</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Basic.AddTransition</string>
|
||||||
|
</property>
|
||||||
<property name="accessibleName">
|
<property name="accessibleName">
|
||||||
<string>Transition</string>
|
<string>Basic.AddTransition</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset>
|
||||||
|
<normaloff>:/res/images/add.png</normaloff>:/res/images/add.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="themeID" stdset="0">
|
||||||
|
<string notr="true">addIconSmall</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="transitionRemove">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>22</width>
|
||||||
|
<height>22</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Basic.RemoveTransition</string>
|
||||||
|
</property>
|
||||||
|
<property name="accessibleName">
|
||||||
|
<string>Basic.RemoveTransition</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset>
|
||||||
|
<normaloff>:/res/images/list_remove.png</normaloff>:/res/images/list_remove.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="themeID" stdset="0">
|
||||||
|
<string notr="true">removeIconSmall</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -51,7 +51,6 @@ static inline QString MakeQuickTransitionText(QuickTransition *qt)
|
||||||
|
|
||||||
void OBSBasic::InitDefaultTransitions()
|
void OBSBasic::InitDefaultTransitions()
|
||||||
{
|
{
|
||||||
ui->transitions->blockSignals(true);
|
|
||||||
std::vector<OBSSource> transitions;
|
std::vector<OBSSource> transitions;
|
||||||
size_t idx = 0;
|
size_t idx = 0;
|
||||||
const char *id;
|
const char *id;
|
||||||
|
@ -59,9 +58,9 @@ void OBSBasic::InitDefaultTransitions()
|
||||||
/* automatically add transitions that have no configuration (things
|
/* automatically add transitions that have no configuration (things
|
||||||
* such as cut/fade/etc) */
|
* such as cut/fade/etc) */
|
||||||
while (obs_enum_transition_types(idx++, &id)) {
|
while (obs_enum_transition_types(idx++, &id)) {
|
||||||
const char *name = obs_source_get_display_name(id);
|
|
||||||
|
|
||||||
if (!obs_is_source_configurable(id)) {
|
if (!obs_is_source_configurable(id)) {
|
||||||
|
const char *name = obs_source_get_display_name(id);
|
||||||
|
|
||||||
OBSSourceAutoRelease tr =
|
OBSSourceAutoRelease tr =
|
||||||
obs_source_create_private(id, name, NULL);
|
obs_source_create_private(id, name, NULL);
|
||||||
InitTransition(tr);
|
InitTransition(tr);
|
||||||
|
@ -69,23 +68,13 @@ void OBSBasic::InitDefaultTransitions()
|
||||||
|
|
||||||
if (strcmp(id, "fade_transition") == 0)
|
if (strcmp(id, "fade_transition") == 0)
|
||||||
fadeTransition = tr;
|
fadeTransition = tr;
|
||||||
else if (strcmp(id, "cut_transition") == 0)
|
|
||||||
cutTransition = tr;
|
|
||||||
} else {
|
|
||||||
ui->transitions->addItem(
|
|
||||||
QTStr("Add ") + QT_UTF8(name),
|
|
||||||
QVariant::fromValue(QString(QT_UTF8(id))));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ui->transitions->count())
|
|
||||||
ui->transitions->insertSeparator(ui->transitions->count());
|
|
||||||
|
|
||||||
for (OBSSource &tr : transitions) {
|
for (OBSSource &tr : transitions) {
|
||||||
ui->transitions->addItem(QT_UTF8(obs_source_get_name(tr)),
|
ui->transitions->addItem(QT_UTF8(obs_source_get_name(tr)),
|
||||||
QVariant::fromValue(OBSSource(tr)));
|
QVariant::fromValue(OBSSource(tr)));
|
||||||
}
|
}
|
||||||
ui->transitions->blockSignals(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OBSBasic::AddQuickTransitionHotkey(QuickTransition *qt)
|
void OBSBasic::AddQuickTransitionHotkey(QuickTransition *qt)
|
||||||
|
@ -252,7 +241,7 @@ obs_source_t *OBSBasic::FindTransition(const char *name)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const char *trName = obs_source_get_name(tr);
|
const char *trName = obs_source_get_name(tr);
|
||||||
if (trName && *trName && strcmp(trName, name) == 0)
|
if (strcmp(trName, name) == 0)
|
||||||
return tr;
|
return tr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -414,9 +403,6 @@ void OBSBasic::SetTransition(OBSSource transition)
|
||||||
{
|
{
|
||||||
OBSSourceAutoRelease oldTransition = obs_get_output_source(0);
|
OBSSourceAutoRelease oldTransition = obs_get_output_source(0);
|
||||||
|
|
||||||
if (transition == oldTransition)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (oldTransition && transition) {
|
if (oldTransition && transition) {
|
||||||
obs_transition_swap_begin(transition, oldTransition);
|
obs_transition_swap_begin(transition, oldTransition);
|
||||||
if (transition != GetCurrentTransition())
|
if (transition != GetCurrentTransition())
|
||||||
|
@ -432,10 +418,9 @@ void OBSBasic::SetTransition(OBSSource transition)
|
||||||
ui->transitionDuration->setVisible(!fixed);
|
ui->transitionDuration->setVisible(!fixed);
|
||||||
|
|
||||||
bool configurable = obs_source_configurable(transition);
|
bool configurable = obs_source_configurable(transition);
|
||||||
|
ui->transitionRemove->setEnabled(configurable);
|
||||||
ui->transitionProps->setEnabled(configurable);
|
ui->transitionProps->setEnabled(configurable);
|
||||||
|
|
||||||
SetComboTransition(ui->transitions, transition);
|
|
||||||
|
|
||||||
if (api)
|
if (api)
|
||||||
api->on_event(OBS_FRONTEND_EVENT_TRANSITION_CHANGED);
|
api->on_event(OBS_FRONTEND_EVENT_TRANSITION_CHANGED);
|
||||||
}
|
}
|
||||||
|
@ -448,21 +433,17 @@ OBSSource OBSBasic::GetCurrentTransition()
|
||||||
void OBSBasic::on_transitions_currentIndexChanged(int)
|
void OBSBasic::on_transitions_currentIndexChanged(int)
|
||||||
{
|
{
|
||||||
OBSSource transition = GetCurrentTransition();
|
OBSSource transition = GetCurrentTransition();
|
||||||
|
SetTransition(transition);
|
||||||
if (transition)
|
|
||||||
SetTransition(transition);
|
|
||||||
else
|
|
||||||
AddTransition(ui->transitions->currentData().value<QString>());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OBSBasic::AddTransition(QString id)
|
void OBSBasic::AddTransition()
|
||||||
{
|
{
|
||||||
if (id.isEmpty())
|
QAction *action = reinterpret_cast<QAction *>(sender());
|
||||||
return;
|
QString idStr = action->property("id").toString();
|
||||||
|
|
||||||
string name;
|
string name;
|
||||||
QString placeHolderText =
|
QString placeHolderText =
|
||||||
QT_UTF8(obs_source_get_display_name(QT_TO_UTF8(id)));
|
QT_UTF8(obs_source_get_display_name(QT_TO_UTF8(idStr)));
|
||||||
QString format = placeHolderText + " (%1)";
|
QString format = placeHolderText + " (%1)";
|
||||||
obs_source_t *source = nullptr;
|
obs_source_t *source = nullptr;
|
||||||
int i = 1;
|
int i = 1;
|
||||||
|
@ -481,7 +462,7 @@ void OBSBasic::AddTransition(QString id)
|
||||||
OBSMessageBox::warning(this,
|
OBSMessageBox::warning(this,
|
||||||
QTStr("NoNameEntered.Title"),
|
QTStr("NoNameEntered.Title"),
|
||||||
QTStr("NoNameEntered.Text"));
|
QTStr("NoNameEntered.Text"));
|
||||||
AddTransition(id);
|
AddTransition();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -490,12 +471,12 @@ void OBSBasic::AddTransition(QString id)
|
||||||
OBSMessageBox::warning(this, QTStr("NameExists.Title"),
|
OBSMessageBox::warning(this, QTStr("NameExists.Title"),
|
||||||
QTStr("NameExists.Text"));
|
QTStr("NameExists.Text"));
|
||||||
|
|
||||||
AddTransition(id);
|
AddTransition();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
source = obs_source_create_private(QT_TO_UTF8(id), name.c_str(),
|
source = obs_source_create_private(QT_TO_UTF8(idStr),
|
||||||
NULL);
|
name.c_str(), NULL);
|
||||||
InitTransition(source);
|
InitTransition(source);
|
||||||
ui->transitions->addItem(
|
ui->transitions->addItem(
|
||||||
QT_UTF8(name.c_str()),
|
QT_UTF8(name.c_str()),
|
||||||
|
@ -510,12 +491,34 @@ void OBSBasic::AddTransition(QString id)
|
||||||
|
|
||||||
ClearQuickTransitionWidgets();
|
ClearQuickTransitionWidgets();
|
||||||
RefreshQuickTransitions();
|
RefreshQuickTransitions();
|
||||||
} else {
|
|
||||||
OBSSourceAutoRelease transition = obs_get_output_source(0);
|
|
||||||
SetComboTransition(ui->transitions, transition);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OBSBasic::on_transitionAdd_clicked()
|
||||||
|
{
|
||||||
|
bool foundConfigurableTransitions = false;
|
||||||
|
QMenu menu(this);
|
||||||
|
size_t idx = 0;
|
||||||
|
const char *id;
|
||||||
|
|
||||||
|
while (obs_enum_transition_types(idx++, &id)) {
|
||||||
|
if (obs_is_source_configurable(id)) {
|
||||||
|
const char *name = obs_source_get_display_name(id);
|
||||||
|
QAction *action = new QAction(name, this);
|
||||||
|
action->setProperty("id", id);
|
||||||
|
|
||||||
|
connect(action, SIGNAL(triggered()), this,
|
||||||
|
SLOT(AddTransition()));
|
||||||
|
|
||||||
|
menu.addAction(action);
|
||||||
|
foundConfigurableTransitions = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (foundConfigurableTransitions)
|
||||||
|
menu.exec(QCursor::pos());
|
||||||
|
}
|
||||||
|
|
||||||
void OBSBasic::on_transitionRemove_clicked()
|
void OBSBasic::on_transitionRemove_clicked()
|
||||||
{
|
{
|
||||||
OBSSource tr = GetCurrentTransition();
|
OBSSource tr = GetCurrentTransition();
|
||||||
|
@ -610,11 +613,6 @@ void OBSBasic::on_transitionProps_clicked()
|
||||||
action->setProperty("transition", QVariant::fromValue(source));
|
action->setProperty("transition", QVariant::fromValue(source));
|
||||||
menu.addAction(action);
|
menu.addAction(action);
|
||||||
|
|
||||||
action = new QAction(QTStr("Remove"), &menu);
|
|
||||||
connect(action, SIGNAL(triggered()), this,
|
|
||||||
SLOT(on_transitionRemove_clicked()));
|
|
||||||
menu.addAction(action);
|
|
||||||
|
|
||||||
action = new QAction(QTStr("Properties"), &menu);
|
action = new QAction(QTStr("Properties"), &menu);
|
||||||
connect(action, &QAction::triggered, properties);
|
connect(action, &QAction::triggered, properties);
|
||||||
menu.addAction(action);
|
menu.addAction(action);
|
||||||
|
@ -1789,6 +1787,8 @@ void OBSBasic::LoadTransitions(obs_data_array_t *transitions,
|
||||||
ui->transitions->addItem(
|
ui->transitions->addItem(
|
||||||
QT_UTF8(name),
|
QT_UTF8(name),
|
||||||
QVariant::fromValue(OBSSource(source)));
|
QVariant::fromValue(OBSSource(source)));
|
||||||
|
ui->transitions->setCurrentIndex(
|
||||||
|
ui->transitions->count() - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -701,7 +701,7 @@ private slots:
|
||||||
|
|
||||||
void ProcessHotkey(obs_hotkey_id id, bool pressed);
|
void ProcessHotkey(obs_hotkey_id id, bool pressed);
|
||||||
|
|
||||||
void AddTransition(QString id);
|
void AddTransition();
|
||||||
void RenameTransition();
|
void RenameTransition();
|
||||||
void TransitionClicked();
|
void TransitionClicked();
|
||||||
void TransitionStopped();
|
void TransitionStopped();
|
||||||
|
@ -1063,6 +1063,7 @@ private slots:
|
||||||
void on_toggleSourceIcons_toggled(bool visible);
|
void on_toggleSourceIcons_toggled(bool visible);
|
||||||
|
|
||||||
void on_transitions_currentIndexChanged(int index);
|
void on_transitions_currentIndexChanged(int index);
|
||||||
|
void on_transitionAdd_clicked();
|
||||||
void on_transitionRemove_clicked();
|
void on_transitionRemove_clicked();
|
||||||
void on_transitionProps_clicked();
|
void on_transitionProps_clicked();
|
||||||
void on_transitionDuration_valueChanged(int value);
|
void on_transitionDuration_valueChanged(int value);
|
||||||
|
|
Loading…
Reference in New Issue