parent
6b287dbcc1
commit
78bdd4cb01
|
@ -1158,21 +1158,107 @@
|
|||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</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>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<property name="spacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QComboBox" name="transitions">
|
||||
<property name="minimumSize">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>0</height>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</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">
|
||||
<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>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -51,7 +51,6 @@ static inline QString MakeQuickTransitionText(QuickTransition *qt)
|
|||
|
||||
void OBSBasic::InitDefaultTransitions()
|
||||
{
|
||||
ui->transitions->blockSignals(true);
|
||||
std::vector<OBSSource> transitions;
|
||||
size_t idx = 0;
|
||||
const char *id;
|
||||
|
@ -59,9 +58,9 @@ void OBSBasic::InitDefaultTransitions()
|
|||
/* automatically add transitions that have no configuration (things
|
||||
* such as cut/fade/etc) */
|
||||
while (obs_enum_transition_types(idx++, &id)) {
|
||||
const char *name = obs_source_get_display_name(id);
|
||||
|
||||
if (!obs_is_source_configurable(id)) {
|
||||
const char *name = obs_source_get_display_name(id);
|
||||
|
||||
OBSSourceAutoRelease tr =
|
||||
obs_source_create_private(id, name, NULL);
|
||||
InitTransition(tr);
|
||||
|
@ -69,23 +68,13 @@ void OBSBasic::InitDefaultTransitions()
|
|||
|
||||
if (strcmp(id, "fade_transition") == 0)
|
||||
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) {
|
||||
ui->transitions->addItem(QT_UTF8(obs_source_get_name(tr)),
|
||||
QVariant::fromValue(OBSSource(tr)));
|
||||
}
|
||||
ui->transitions->blockSignals(false);
|
||||
}
|
||||
|
||||
void OBSBasic::AddQuickTransitionHotkey(QuickTransition *qt)
|
||||
|
@ -252,7 +241,7 @@ obs_source_t *OBSBasic::FindTransition(const char *name)
|
|||
continue;
|
||||
|
||||
const char *trName = obs_source_get_name(tr);
|
||||
if (trName && *trName && strcmp(trName, name) == 0)
|
||||
if (strcmp(trName, name) == 0)
|
||||
return tr;
|
||||
}
|
||||
|
||||
|
@ -414,9 +403,6 @@ void OBSBasic::SetTransition(OBSSource transition)
|
|||
{
|
||||
OBSSourceAutoRelease oldTransition = obs_get_output_source(0);
|
||||
|
||||
if (transition == oldTransition)
|
||||
return;
|
||||
|
||||
if (oldTransition && transition) {
|
||||
obs_transition_swap_begin(transition, oldTransition);
|
||||
if (transition != GetCurrentTransition())
|
||||
|
@ -432,10 +418,9 @@ void OBSBasic::SetTransition(OBSSource transition)
|
|||
ui->transitionDuration->setVisible(!fixed);
|
||||
|
||||
bool configurable = obs_source_configurable(transition);
|
||||
ui->transitionRemove->setEnabled(configurable);
|
||||
ui->transitionProps->setEnabled(configurable);
|
||||
|
||||
SetComboTransition(ui->transitions, transition);
|
||||
|
||||
if (api)
|
||||
api->on_event(OBS_FRONTEND_EVENT_TRANSITION_CHANGED);
|
||||
}
|
||||
|
@ -448,21 +433,17 @@ OBSSource OBSBasic::GetCurrentTransition()
|
|||
void OBSBasic::on_transitions_currentIndexChanged(int)
|
||||
{
|
||||
OBSSource transition = GetCurrentTransition();
|
||||
|
||||
if (transition)
|
||||
SetTransition(transition);
|
||||
else
|
||||
AddTransition(ui->transitions->currentData().value<QString>());
|
||||
SetTransition(transition);
|
||||
}
|
||||
|
||||
void OBSBasic::AddTransition(QString id)
|
||||
void OBSBasic::AddTransition()
|
||||
{
|
||||
if (id.isEmpty())
|
||||
return;
|
||||
QAction *action = reinterpret_cast<QAction *>(sender());
|
||||
QString idStr = action->property("id").toString();
|
||||
|
||||
string name;
|
||||
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)";
|
||||
obs_source_t *source = nullptr;
|
||||
int i = 1;
|
||||
|
@ -481,7 +462,7 @@ void OBSBasic::AddTransition(QString id)
|
|||
OBSMessageBox::warning(this,
|
||||
QTStr("NoNameEntered.Title"),
|
||||
QTStr("NoNameEntered.Text"));
|
||||
AddTransition(id);
|
||||
AddTransition();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -490,12 +471,12 @@ void OBSBasic::AddTransition(QString id)
|
|||
OBSMessageBox::warning(this, QTStr("NameExists.Title"),
|
||||
QTStr("NameExists.Text"));
|
||||
|
||||
AddTransition(id);
|
||||
AddTransition();
|
||||
return;
|
||||
}
|
||||
|
||||
source = obs_source_create_private(QT_TO_UTF8(id), name.c_str(),
|
||||
NULL);
|
||||
source = obs_source_create_private(QT_TO_UTF8(idStr),
|
||||
name.c_str(), NULL);
|
||||
InitTransition(source);
|
||||
ui->transitions->addItem(
|
||||
QT_UTF8(name.c_str()),
|
||||
|
@ -510,12 +491,34 @@ void OBSBasic::AddTransition(QString id)
|
|||
|
||||
ClearQuickTransitionWidgets();
|
||||
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()
|
||||
{
|
||||
OBSSource tr = GetCurrentTransition();
|
||||
|
@ -610,11 +613,6 @@ void OBSBasic::on_transitionProps_clicked()
|
|||
action->setProperty("transition", QVariant::fromValue(source));
|
||||
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);
|
||||
connect(action, &QAction::triggered, properties);
|
||||
menu.addAction(action);
|
||||
|
@ -1789,6 +1787,8 @@ void OBSBasic::LoadTransitions(obs_data_array_t *transitions,
|
|||
ui->transitions->addItem(
|
||||
QT_UTF8(name),
|
||||
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 AddTransition(QString id);
|
||||
void AddTransition();
|
||||
void RenameTransition();
|
||||
void TransitionClicked();
|
||||
void TransitionStopped();
|
||||
|
@ -1063,6 +1063,7 @@ private slots:
|
|||
void on_toggleSourceIcons_toggled(bool visible);
|
||||
|
||||
void on_transitions_currentIndexChanged(int index);
|
||||
void on_transitionAdd_clicked();
|
||||
void on_transitionRemove_clicked();
|
||||
void on_transitionProps_clicked();
|
||||
void on_transitionDuration_valueChanged(int value);
|
||||
|
|
Loading…
Reference in New Issue