diff --git a/launcher/ui/widgets/InfoFrame.cpp b/launcher/ui/widgets/InfoFrame.cpp index 1e641c4f9..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(); @@ -88,7 +89,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 +104,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 +147,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(); } @@ -181,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()); @@ -269,6 +271,7 @@ void InfoFrame::updateHiddenState() void InfoFrame::setName(QString text) { + resetScroll(); if (text.isEmpty()) { ui->nameLabel->setHidden(true); } else { @@ -418,3 +421,9 @@ void InfoFrame::boxClosed([[maybe_unused]] int result) { m_current_box = nullptr; } + +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 20c54e2e5..b2c867cce 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 resetScroll(); private: Ui::InfoFrame* ui; 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 + + + + +