Skip to content

Commit

Permalink
UI: update hotkey label on quick transition rename
Browse files Browse the repository at this point in the history
  • Loading branch information
vokama committed May 29, 2018
1 parent 70b5b63 commit 356c481
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
12 changes: 12 additions & 0 deletions UI/window-basic-main-transitions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
#include "menu-button.hpp"
#include "qt-wrappers.hpp"

#include "obs-hotkey.h"

using namespace std;

Q_DECLARE_METATYPE(OBSScene);
Expand Down Expand Up @@ -98,6 +100,16 @@ void OBSBasic::AddQuickTransitionHotkey(QuickTransition *qt)
(void*)(uintptr_t)qt->id);
}

void QuickTransition::SourceRenamed(void *param, calldata_t *data)
{
QuickTransition *qt = reinterpret_cast<QuickTransition*>(param);

QString hotkeyName = QTStr("QuickTransitions.HotkeyName")
.arg(MakeQuickTransitionText(qt));

obs_hotkey_set_description(qt->hotkey, QT_TO_UTF8(hotkeyName));
}

void OBSBasic::TriggerQuickTransition(int id)
{
QuickTransition *qt = GetQuickTransition(id);
Expand Down
13 changes: 10 additions & 3 deletions UI/window-basic-main.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,17 @@ struct QuickTransition {

inline QuickTransition() {}
inline QuickTransition(OBSSource source_, int duration_, int id_)
: source (source_),
duration (duration_),
id (id_)
: source (source_),
duration (duration_),
id (id_),
renamedSignal (std::make_shared<OBSSignal>(
obs_source_get_signal_handler(source),
"rename", SourceRenamed, this))
{}

private:
static void SourceRenamed(void *param, calldata_t *data);
std::shared_ptr<OBSSignal> renamedSignal;
};

class OBSBasic : public OBSMainWindow {
Expand Down

0 comments on commit 356c481

Please sign in to comment.