From e40a6be031ad3ababfebdec6299b379c1741f414 Mon Sep 17 00:00:00 2001 From: Clayton Groeneveld Date: Tue, 31 May 2022 04:25:48 -0500 Subject: [PATCH] UI: Use new truncate function with hotkeys This updates the hotkeys to use the new truncate label function in qt-wrappers.cpp --- UI/window-basic-settings.cpp | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/UI/window-basic-settings.cpp b/UI/window-basic-settings.cpp index 3289f1937..57f5eeb10 100644 --- a/UI/window-basic-settings.cpp +++ b/UI/window-basic-settings.cpp @@ -2728,8 +2728,6 @@ void OBSBasicSettings::LoadAdvancedSettings() loading = false; } -#define TRUNCATE_TEXT_LENGTH 80 - template static inline void LayoutHotkey(OBSBasicSettings *settings, obs_hotkey_id id, obs_hotkey_t *key, @@ -2740,13 +2738,7 @@ LayoutHotkey(OBSBasicSettings *settings, obs_hotkey_id id, obs_hotkey_t *key, QString text = QT_UTF8(obs_hotkey_get_description(key)); label->setProperty("fullName", text); - - if (text.length() > TRUNCATE_TEXT_LENGTH) { - text = text.left(TRUNCATE_TEXT_LENGTH); - text += "...'"; - } - - label->setText(text); + TruncateLabel(label, text); OBSHotkeyWidget *hw = nullptr; @@ -2778,14 +2770,7 @@ static QLabel *makeLabel(const OBSSource &source, Func &&) OBSSourceLabel *label = new OBSSourceLabel(source); label->setStyleSheet("font-weight: bold;"); QString name = QT_UTF8(obs_source_get_name(source)); - - if (name.length() > TRUNCATE_TEXT_LENGTH) { - label->setToolTip(name); - name = name.left(TRUNCATE_TEXT_LENGTH); - name += "..."; - } - - label->setText(name); + TruncateLabel(label, name); return label; }