From 5767479c217a5e33d4b00d10519fe59f69d849fd Mon Sep 17 00:00:00 2001 From: Trial97 Date: Sun, 21 Dec 2025 23:04:13 +0200 Subject: [PATCH 1/3] handle mod formatting codes fixes #4535 this changes the info frame to be an actuall scrollbar so if the description is too long the text is not directly cut off, and let's the user to view it all. This is may not be the best ui decssion but feel free to pick this issue up yourself or suggest changes to this PR(the important bit is in the cpp file). Signed-off-by: Trial97 --- launcher/ui/widgets/InfoFrame.cpp | 9 +- launcher/ui/widgets/InfoFrame.ui | 203 +++++++++++++++++------------- 2 files changed, 119 insertions(+), 93 deletions(-) diff --git a/launcher/ui/widgets/InfoFrame.cpp b/launcher/ui/widgets/InfoFrame.cpp index 1e641c4f9..4a71b6650 100644 --- a/launcher/ui/widgets/InfoFrame.cpp +++ b/launcher/ui/widgets/InfoFrame.cpp @@ -88,7 +88,7 @@ void InfoFrame::updateWithMod(Mod const& m) if (m.name().isEmpty()) name = m.internal_id(); else - name = m.name(); + name = renderColorCodes(m.name()); if (link.isEmpty()) text = name; @@ -103,7 +103,7 @@ void InfoFrame::updateWithMod(Mod const& m) if (m.description().isEmpty()) { setDescription(QString()); } else { - setDescription(m.description()); + setDescription(renderColorCodes(m.description())); } setImage(m.icon({ 64, 64 })); @@ -146,11 +146,12 @@ void InfoFrame::updateWithMod(Mod const& m) void InfoFrame::updateWithResource(const Resource& resource) { const QString homepage = resource.homepage(); + auto name = renderColorCodes(resource.name()); if (!homepage.isEmpty()) - setName("" + resource.name() + ""); + setName("" + name + ""); else - setName(resource.name()); + setName(name); setImage(); } diff --git a/launcher/ui/widgets/InfoFrame.ui b/launcher/ui/widgets/InfoFrame.ui index c4d8c83d3..58abcffde 100644 --- a/launcher/ui/widgets/InfoFrame.ui +++ b/launcher/ui/widgets/InfoFrame.ui @@ -7,7 +7,7 @@ 0 0 527 - 113 + 120 @@ -22,7 +22,7 @@ 120 - + 0 @@ -35,7 +35,7 @@ 0 - + @@ -60,95 +60,120 @@ - - - - + + + + + 0 + 0 + - - - - - Qt::RichText - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - + true - - true - - - Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - - - Qt::RichText - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - true - - - true - - - Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - - - Qt::RichText - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - true - - - true - - - Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - - - Qt::RichText - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - true - - - true - - - Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - + + + + 0 + 0 + 455 + 118 + + + + + + + + + + Qt::RichText + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + true + + + Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + + + + + + + Qt::RichText + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + true + + + Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + + + + Qt::RichText + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + true + + + Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + + + + Qt::RichText + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + true + + + Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + From eb15897b1a7f7e05a3e125968365904eef069041 Mon Sep 17 00:00:00 2001 From: Trial97 Date: Sat, 3 Jan 2026 23:44:09 +0200 Subject: [PATCH 2/3] reset scroll on resource change Signed-off-by: Trial97 --- launcher/ui/widgets/InfoFrame.cpp | 7 +++++++ launcher/ui/widgets/InfoFrame.h | 1 + 2 files changed, 8 insertions(+) diff --git a/launcher/ui/widgets/InfoFrame.cpp b/launcher/ui/widgets/InfoFrame.cpp index 4a71b6650..fcc5e817c 100644 --- a/launcher/ui/widgets/InfoFrame.cpp +++ b/launcher/ui/widgets/InfoFrame.cpp @@ -270,6 +270,7 @@ void InfoFrame::updateHiddenState() void InfoFrame::setName(QString text) { + resetScrolll(); if (text.isEmpty()) { ui->nameLabel->setHidden(true); } else { @@ -419,3 +420,9 @@ void InfoFrame::boxClosed([[maybe_unused]] int result) { m_current_box = nullptr; } + +void InfoFrame::resetScrolll() +{ + ui->scrollArea->horizontalScrollBar()->setValue(0); + ui->scrollArea->verticalScrollBar()->setValue(0); +} diff --git a/launcher/ui/widgets/InfoFrame.h b/launcher/ui/widgets/InfoFrame.h index 20c54e2e5..8d010c678 100644 --- a/launcher/ui/widgets/InfoFrame.h +++ b/launcher/ui/widgets/InfoFrame.h @@ -76,6 +76,7 @@ class InfoFrame : public QFrame { private: void updateHiddenState(); + void resetScrolll(); private: Ui::InfoFrame* ui; From 48eade763a5800e4a8c664ee44b551a6141a40a9 Mon Sep 17 00:00:00 2001 From: Alexandru Ionut Tripon Date: Tue, 3 Feb 2026 12:44:11 +0200 Subject: [PATCH 3/3] Apply suggestions from code review Co-authored-by: Octol1ttle Signed-off-by: Alexandru Ionut Tripon --- launcher/ui/widgets/InfoFrame.cpp | 13 +++++++------ launcher/ui/widgets/InfoFrame.h | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/launcher/ui/widgets/InfoFrame.cpp b/launcher/ui/widgets/InfoFrame.cpp index fcc5e817c..354211439 100644 --- a/launcher/ui/widgets/InfoFrame.cpp +++ b/launcher/ui/widgets/InfoFrame.cpp @@ -36,6 +36,7 @@ #include #include +#include #include #include #include @@ -75,7 +76,7 @@ InfoFrame::~InfoFrame() delete ui; } -void InfoFrame::updateWithMod(Mod const& m) +void InfoFrame::updateWithMod(const Mod& m) { if (m.type() == ResourceType::FOLDER) { clear(); @@ -182,10 +183,10 @@ QString InfoFrame::renderColorCodes(QString input) while (it != input.constEnd()) { // is current char § and is there a following char if (*it == u'§' && (it + 1) != input.constEnd()) { - auto const& code = *(++it); // incrementing here! + const auto& code = *(++it); // incrementing here! - auto const color_entry = color_codes_map.constFind(code); - auto const tag_entry = formatting_codes_map.constFind(code); + const auto color_entry = color_codes_map.constFind(code); + const auto tag_entry = formatting_codes_map.constFind(code); if (color_entry != color_codes_map.constEnd()) { // color code html += QString("").arg(color_entry.value()); @@ -270,7 +271,7 @@ void InfoFrame::updateHiddenState() void InfoFrame::setName(QString text) { - resetScrolll(); + resetScroll(); if (text.isEmpty()) { ui->nameLabel->setHidden(true); } else { @@ -421,7 +422,7 @@ void InfoFrame::boxClosed([[maybe_unused]] int result) m_current_box = nullptr; } -void InfoFrame::resetScrolll() +void InfoFrame::resetScroll() { ui->scrollArea->horizontalScrollBar()->setValue(0); ui->scrollArea->verticalScrollBar()->setValue(0); diff --git a/launcher/ui/widgets/InfoFrame.h b/launcher/ui/widgets/InfoFrame.h index 8d010c678..b2c867cce 100644 --- a/launcher/ui/widgets/InfoFrame.h +++ b/launcher/ui/widgets/InfoFrame.h @@ -76,7 +76,7 @@ class InfoFrame : public QFrame { private: void updateHiddenState(); - void resetScrolll(); + void resetScroll(); private: Ui::InfoFrame* ui;