Files
obs-studio/frontend/utility/QuickTransition.cpp
cg2121 d7cce79d7e frontend: Use static_cast when casting from void pointers
Using static_cast is preferred here, as it is safer to use than
reinterpret_cast.
2025-05-05 20:47:10 -04:00

46 lines
1.5 KiB
C++

/******************************************************************************
Copyright (C) 2023 by Lain Bailey <lain@obsproject.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 "QuickTransition.hpp"
#include <OBSApp.hpp>
#include <qt-wrappers.hpp>
static inline QString MakeQuickTransitionText(QuickTransition *qt)
{
QString name;
if (!qt->fadeToBlack)
name = QT_UTF8(obs_source_get_name(qt->source));
else
name = QTStr("FadeToBlack");
if (!obs_transition_fixed(qt->source))
name += QString(" (%1ms)").arg(QString::number(qt->duration));
return name;
}
void QuickTransition::SourceRenamed(void *param, calldata_t *)
{
QuickTransition *qt = static_cast<QuickTransition *>(param);
QString hotkeyName = QTStr("QuickTransitions.HotkeyName").arg(MakeQuickTransitionText(qt));
obs_hotkey_set_description(qt->hotkey, QT_TO_UTF8(hotkeyName));
}