2022-08-29 02:31:48 +01:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
/*
|
2023-06-15 09:40:39 +01:00
|
|
|
* Prism Launcher - Minecraft Launcher
|
|
|
|
* Copyright (c) 2022 flowln <flowlnlnln@gmail.com>
|
|
|
|
* Copyright (c) 2023 Trial97 <alexandru.tripon97@gmail.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, version 3.
|
|
|
|
*
|
|
|
|
* 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 <https://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following copyright and
|
|
|
|
* permission notice:
|
|
|
|
*
|
|
|
|
* Copyright 2013-2021 MultiMC Contributors
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
2013-10-08 22:11:24 +01:00
|
|
|
|
2023-06-25 09:36:37 +01:00
|
|
|
#include <QLabel>
|
2013-10-12 14:19:49 +01:00
|
|
|
#include <QMessageBox>
|
2023-06-25 09:36:37 +01:00
|
|
|
#include <QToolTip>
|
2023-09-16 01:41:21 +01:00
|
|
|
#include <QTextCursor>
|
2013-11-04 01:53:05 +00:00
|
|
|
|
2022-08-10 18:48:34 +01:00
|
|
|
#include "InfoFrame.h"
|
|
|
|
#include "ui_InfoFrame.h"
|
2021-11-22 02:55:16 +00:00
|
|
|
|
|
|
|
#include "ui/dialogs/CustomMessageBox.h"
|
2013-11-04 01:53:05 +00:00
|
|
|
|
2023-07-03 13:09:35 +01:00
|
|
|
void setupLinkToolTip(QLabel* label)
|
2023-06-25 09:36:37 +01:00
|
|
|
{
|
|
|
|
QObject::connect(label, &QLabel::linkHovered, [label](const QString& link) {
|
2023-07-06 16:46:59 +01:00
|
|
|
if (auto url = QUrl(link); !url.isValid() || (url.scheme() != "http" && url.scheme() != "https"))
|
2023-06-25 09:36:37 +01:00
|
|
|
return;
|
|
|
|
label->setToolTip(link);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2023-06-25 08:41:29 +01:00
|
|
|
InfoFrame::InfoFrame(QWidget* parent) : QFrame(parent), ui(new Ui::InfoFrame)
|
2022-08-10 18:48:34 +01:00
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
|
|
|
ui->descriptionLabel->setHidden(true);
|
|
|
|
ui->nameLabel->setHidden(true);
|
2023-05-05 21:46:38 +01:00
|
|
|
ui->licenseLabel->setHidden(true);
|
|
|
|
ui->issueTrackerLabel->setHidden(true);
|
2023-06-25 09:36:37 +01:00
|
|
|
|
2023-07-03 13:09:35 +01:00
|
|
|
setupLinkToolTip(ui->iconLabel);
|
|
|
|
setupLinkToolTip(ui->descriptionLabel);
|
|
|
|
setupLinkToolTip(ui->nameLabel);
|
|
|
|
setupLinkToolTip(ui->licenseLabel);
|
|
|
|
setupLinkToolTip(ui->issueTrackerLabel);
|
2022-08-10 18:48:34 +01:00
|
|
|
updateHiddenState();
|
|
|
|
}
|
|
|
|
|
|
|
|
InfoFrame::~InfoFrame()
|
|
|
|
{
|
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
|
|
|
void InfoFrame::updateWithMod(Mod const& m)
|
2013-10-08 21:45:48 +01:00
|
|
|
{
|
2023-06-15 09:40:39 +01:00
|
|
|
if (m.type() == ResourceType::FOLDER) {
|
2018-07-15 13:51:05 +01:00
|
|
|
clear();
|
|
|
|
return;
|
|
|
|
}
|
2013-10-08 22:25:56 +01:00
|
|
|
|
2018-07-15 13:51:05 +01:00
|
|
|
QString text = "";
|
|
|
|
QString name = "";
|
2023-06-25 08:41:29 +01:00
|
|
|
QString link = m.metaurl();
|
2018-07-15 13:51:05 +01:00
|
|
|
if (m.name().isEmpty())
|
2022-04-16 02:07:35 +01:00
|
|
|
name = m.internal_id();
|
2018-07-15 13:51:05 +01:00
|
|
|
else
|
|
|
|
name = m.name();
|
2013-10-09 03:10:56 +01:00
|
|
|
|
2023-06-15 09:40:39 +01:00
|
|
|
if (link.isEmpty())
|
2018-07-15 13:51:05 +01:00
|
|
|
text = name;
|
2023-06-15 09:40:39 +01:00
|
|
|
else {
|
|
|
|
text = "<a href=\"" + link + "\">" + name + "</a>";
|
|
|
|
}
|
2018-07-15 13:51:05 +01:00
|
|
|
if (!m.authors().isEmpty())
|
2019-08-03 04:30:46 +01:00
|
|
|
text += " by " + m.authors().join(", ");
|
2013-10-08 21:45:48 +01:00
|
|
|
|
2022-08-10 18:48:34 +01:00
|
|
|
setName(text);
|
2013-10-08 21:45:48 +01:00
|
|
|
|
2023-06-15 09:40:39 +01:00
|
|
|
if (m.description().isEmpty()) {
|
2022-08-10 18:48:34 +01:00
|
|
|
setDescription(QString());
|
2023-06-15 09:40:39 +01:00
|
|
|
} else {
|
2022-08-10 18:48:34 +01:00
|
|
|
setDescription(m.description());
|
2018-07-15 13:51:05 +01:00
|
|
|
}
|
2022-08-29 13:14:15 +01:00
|
|
|
|
2023-06-25 09:36:37 +01:00
|
|
|
setImage(m.icon({ 64, 64 }));
|
2023-05-05 21:46:38 +01:00
|
|
|
|
|
|
|
auto licenses = m.licenses();
|
|
|
|
QString licenseText = "";
|
|
|
|
if (!licenses.empty()) {
|
|
|
|
for (auto l : licenses) {
|
|
|
|
if (!licenseText.isEmpty()) {
|
2023-06-25 09:36:37 +01:00
|
|
|
licenseText += "\n"; // add newline between licenses
|
2023-05-05 21:46:38 +01:00
|
|
|
}
|
|
|
|
if (!l.name.isEmpty()) {
|
|
|
|
if (l.url.isEmpty()) {
|
|
|
|
licenseText += l.name;
|
|
|
|
} else {
|
|
|
|
licenseText += "<a href=\"" + l.url + "\">" + l.name + "</a>";
|
|
|
|
}
|
|
|
|
} else if (!l.url.isEmpty()) {
|
|
|
|
licenseText += "<a href=\"" + l.url + "\">" + l.url + "</a>";
|
|
|
|
}
|
|
|
|
if (!l.description.isEmpty() && l.description != l.name) {
|
2023-07-03 13:09:35 +01:00
|
|
|
licenseText += " " + l.description;
|
2023-05-05 21:46:38 +01:00
|
|
|
}
|
2023-07-03 13:09:35 +01:00
|
|
|
}
|
2023-05-05 21:46:38 +01:00
|
|
|
}
|
|
|
|
if (!licenseText.isEmpty()) {
|
|
|
|
setLicense(tr("License: %1").arg(licenseText));
|
|
|
|
} else {
|
|
|
|
setLicense();
|
|
|
|
}
|
|
|
|
|
|
|
|
QString issueTracker = "";
|
|
|
|
if (!m.issueTracker().isEmpty()) {
|
|
|
|
issueTracker += tr("Report issues to: ");
|
|
|
|
issueTracker += "<a href=\"" + m.issueTracker() + "\">" + m.issueTracker() + "</a>";
|
2023-07-03 13:09:35 +01:00
|
|
|
}
|
2023-05-05 21:46:38 +01:00
|
|
|
setIssueTracker(issueTracker);
|
2013-10-09 01:03:02 +01:00
|
|
|
}
|
|
|
|
|
2022-08-10 18:48:34 +01:00
|
|
|
void InfoFrame::updateWithResource(const Resource& resource)
|
2013-10-08 21:45:48 +01:00
|
|
|
{
|
2022-08-10 18:48:34 +01:00
|
|
|
setName(resource.name());
|
2022-08-29 13:14:15 +01:00
|
|
|
setImage();
|
2013-10-08 21:45:48 +01:00
|
|
|
}
|
|
|
|
|
2023-07-03 13:09:35 +01:00
|
|
|
QString InfoFrame::renderColorCodes(QString input)
|
|
|
|
{
|
2022-08-29 02:31:48 +01:00
|
|
|
// We have to manually set the colors for use.
|
|
|
|
//
|
|
|
|
// A color is set using §x, with x = a hex number from 0 to f.
|
|
|
|
//
|
|
|
|
// We traverse the description and, when one of those is found, we create
|
|
|
|
// a span element with that color set.
|
|
|
|
//
|
|
|
|
// TODO: Wrap links inside <a> tags
|
|
|
|
|
2022-09-20 16:38:07 +01:00
|
|
|
// https://minecraft.fandom.com/wiki/Formatting_codes#Color_codes
|
2023-07-03 13:09:35 +01:00
|
|
|
const QMap<QChar, QString> color_codes_map = { { '0', "#000000" }, { '1', "#0000AA" }, { '2', "#00AA00" }, { '3', "#00AAAA" },
|
|
|
|
{ '4', "#AA0000" }, { '5', "#AA00AA" }, { '6', "#FFAA00" }, { '7', "#AAAAAA" },
|
|
|
|
{ '8', "#555555" }, { '9', "#5555FF" }, { 'a', "#55FF55" }, { 'b', "#55FFFF" },
|
|
|
|
{ 'c', "#FF5555" }, { 'd', "#FF55FF" }, { 'e', "#FFFF55" }, { 'f', "#FFFFFF" } };
|
2022-09-20 16:38:07 +01:00
|
|
|
// https://minecraft.fandom.com/wiki/Formatting_codes#Formatting_codes
|
2023-07-03 13:09:35 +01:00
|
|
|
const QMap<QChar, QString> formatting_codes_map = { { 'l', "b" }, { 'm', "s" }, { 'n', "u" }, { 'o', "i" } };
|
2022-09-20 16:38:07 +01:00
|
|
|
|
2022-09-04 13:45:09 +01:00
|
|
|
QString html("<html>");
|
2022-09-20 16:38:07 +01:00
|
|
|
QList<QString> tags{};
|
2022-08-29 02:31:48 +01:00
|
|
|
|
2022-09-04 13:45:09 +01:00
|
|
|
auto it = input.constBegin();
|
|
|
|
while (it != input.constEnd()) {
|
2022-09-20 16:38:07 +01:00
|
|
|
// is current char § and is there a following char
|
|
|
|
if (*it == u'§' && (it + 1) != input.constEnd()) {
|
|
|
|
auto const& code = *(++it); // incrementing here!
|
|
|
|
|
|
|
|
auto const color_entry = color_codes_map.constFind(code);
|
|
|
|
auto const tag_entry = formatting_codes_map.constFind(code);
|
|
|
|
|
|
|
|
if (color_entry != color_codes_map.constEnd()) { // color code
|
|
|
|
html += QString("<span style=\"color: %1;\">").arg(color_entry.value());
|
|
|
|
tags << "span";
|
|
|
|
} else if (tag_entry != formatting_codes_map.constEnd()) { // formatting code
|
|
|
|
html += QString("<%1>").arg(tag_entry.value());
|
|
|
|
tags << tag_entry.value();
|
|
|
|
} else if (code == 'r') { // reset all formatting
|
|
|
|
while (!tags.isEmpty()) {
|
|
|
|
html += QString("</%1>").arg(tags.takeLast());
|
|
|
|
}
|
|
|
|
} else { // pass unknown codes through
|
|
|
|
html += QString("§%1").arg(code);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
html += *it;
|
2022-08-29 02:31:48 +01:00
|
|
|
}
|
2022-09-04 13:45:09 +01:00
|
|
|
it++;
|
2022-08-29 02:31:48 +01:00
|
|
|
}
|
2022-09-20 16:38:07 +01:00
|
|
|
while (!tags.isEmpty()) {
|
|
|
|
html += QString("</%1>").arg(tags.takeLast());
|
|
|
|
}
|
2022-09-04 13:45:09 +01:00
|
|
|
html += "</html>";
|
2022-08-29 02:31:48 +01:00
|
|
|
|
2022-09-04 13:45:09 +01:00
|
|
|
html.replace("\n", "<br>");
|
|
|
|
return html;
|
|
|
|
}
|
2022-08-29 02:31:48 +01:00
|
|
|
|
2022-09-04 13:45:09 +01:00
|
|
|
void InfoFrame::updateWithResourcePack(ResourcePack& resource_pack)
|
|
|
|
{
|
2022-09-20 17:01:43 +01:00
|
|
|
setName(renderColorCodes(resource_pack.name()));
|
2022-09-04 13:45:09 +01:00
|
|
|
setDescription(renderColorCodes(resource_pack.description()));
|
2023-07-03 13:09:35 +01:00
|
|
|
setImage(resource_pack.image({ 64, 64 }));
|
2022-08-29 02:31:48 +01:00
|
|
|
}
|
|
|
|
|
2022-09-04 13:45:09 +01:00
|
|
|
void InfoFrame::updateWithTexturePack(TexturePack& texture_pack)
|
|
|
|
{
|
2022-09-20 17:01:43 +01:00
|
|
|
setName(renderColorCodes(texture_pack.name()));
|
2022-09-08 10:54:04 +01:00
|
|
|
setDescription(renderColorCodes(texture_pack.description()));
|
2023-07-03 13:09:35 +01:00
|
|
|
setImage(texture_pack.image({ 64, 64 }));
|
2022-09-04 13:45:09 +01:00
|
|
|
}
|
|
|
|
|
2022-08-10 18:48:34 +01:00
|
|
|
void InfoFrame::clear()
|
2013-10-08 21:45:48 +01:00
|
|
|
{
|
2022-08-10 18:48:34 +01:00
|
|
|
setName();
|
|
|
|
setDescription();
|
2022-08-29 13:14:15 +01:00
|
|
|
setImage();
|
2023-05-05 21:46:38 +01:00
|
|
|
setLicense();
|
|
|
|
setIssueTracker();
|
2013-10-08 21:45:48 +01:00
|
|
|
}
|
|
|
|
|
2022-08-10 18:48:34 +01:00
|
|
|
void InfoFrame::updateHiddenState()
|
2016-01-02 03:01:00 +00:00
|
|
|
{
|
2023-05-05 21:46:38 +01:00
|
|
|
if (ui->descriptionLabel->isHidden() && ui->nameLabel->isHidden() && ui->licenseLabel->isHidden() &&
|
|
|
|
ui->issueTrackerLabel->isHidden()) {
|
2018-07-15 13:51:05 +01:00
|
|
|
setHidden(true);
|
2023-05-05 21:46:38 +01:00
|
|
|
} else {
|
2018-07-15 13:51:05 +01:00
|
|
|
setHidden(false);
|
|
|
|
}
|
2016-01-02 03:01:00 +00:00
|
|
|
}
|
|
|
|
|
2022-08-10 18:48:34 +01:00
|
|
|
void InfoFrame::setName(QString text)
|
2013-10-08 21:45:48 +01:00
|
|
|
{
|
2023-06-15 09:40:39 +01:00
|
|
|
if (text.isEmpty()) {
|
2022-08-10 18:48:34 +01:00
|
|
|
ui->nameLabel->setHidden(true);
|
2023-06-15 09:40:39 +01:00
|
|
|
} else {
|
2022-08-10 18:48:34 +01:00
|
|
|
ui->nameLabel->setText(text);
|
|
|
|
ui->nameLabel->setHidden(false);
|
2018-07-15 13:51:05 +01:00
|
|
|
}
|
|
|
|
updateHiddenState();
|
2013-10-08 21:45:48 +01:00
|
|
|
}
|
|
|
|
|
2022-08-10 18:48:34 +01:00
|
|
|
void InfoFrame::setDescription(QString text)
|
2013-10-08 21:45:48 +01:00
|
|
|
{
|
2023-06-25 09:36:37 +01:00
|
|
|
if (text.isEmpty()) {
|
2022-08-10 18:48:34 +01:00
|
|
|
ui->descriptionLabel->setHidden(true);
|
2018-07-15 13:51:05 +01:00
|
|
|
updateHiddenState();
|
|
|
|
return;
|
2023-06-25 09:36:37 +01:00
|
|
|
} else {
|
2022-08-10 18:48:34 +01:00
|
|
|
ui->descriptionLabel->setHidden(false);
|
2018-07-15 13:51:05 +01:00
|
|
|
updateHiddenState();
|
|
|
|
}
|
2022-08-10 18:48:34 +01:00
|
|
|
ui->descriptionLabel->setToolTip("");
|
2018-07-15 13:51:05 +01:00
|
|
|
QString intermediatetext = text.trimmed();
|
|
|
|
bool prev(false);
|
|
|
|
QChar rem('\n');
|
|
|
|
QString finaltext;
|
|
|
|
finaltext.reserve(intermediatetext.size());
|
2023-07-03 13:09:35 +01:00
|
|
|
foreach (const QChar& c, intermediatetext) {
|
|
|
|
if (c == rem && prev) {
|
2018-07-15 13:51:05 +01:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
prev = c == rem;
|
|
|
|
finaltext += c;
|
|
|
|
}
|
|
|
|
QString labeltext;
|
|
|
|
labeltext.reserve(300);
|
2023-09-16 01:41:21 +01:00
|
|
|
|
|
|
|
|
|
|
|
// elide rich text by getting characters without formatting
|
|
|
|
const int maxCharacterElide = 290;
|
|
|
|
QTextDocument doc;
|
|
|
|
doc.setHtml(text);
|
|
|
|
|
|
|
|
if (doc.characterCount() > maxCharacterElide) {
|
|
|
|
|
2022-08-10 18:48:34 +01:00
|
|
|
ui->descriptionLabel->setOpenExternalLinks(false);
|
2023-09-16 01:41:21 +01:00
|
|
|
ui->descriptionLabel->setTextFormat(Qt::TextFormat::RichText); // This allows injecting HTML here.
|
2022-08-10 18:48:34 +01:00
|
|
|
m_description = text;
|
2023-09-16 01:41:21 +01:00
|
|
|
|
|
|
|
const QString elidedPostfix = "<a href=\"#mod_desc\">...</a>";
|
|
|
|
|
|
|
|
// move the cursor to the character elide, doesn't see html
|
|
|
|
QTextCursor cursor(&doc);
|
|
|
|
cursor.movePosition(QTextCursor::End);
|
|
|
|
cursor.setPosition(maxCharacterElide, QTextCursor::KeepAnchor);
|
|
|
|
cursor.removeSelectedText();
|
|
|
|
|
|
|
|
// insert the post fix at the cursor
|
|
|
|
cursor.insertHtml(elidedPostfix);
|
|
|
|
|
|
|
|
labeltext.append(doc.toHtml());
|
2022-08-10 18:48:34 +01:00
|
|
|
QObject::connect(ui->descriptionLabel, &QLabel::linkActivated, this, &InfoFrame::descriptionEllipsisHandler);
|
2023-07-03 13:09:35 +01:00
|
|
|
} else {
|
2022-08-29 02:31:48 +01:00
|
|
|
ui->descriptionLabel->setTextFormat(Qt::TextFormat::AutoText);
|
2018-07-15 13:51:05 +01:00
|
|
|
labeltext.append(finaltext);
|
|
|
|
}
|
2022-08-10 18:48:34 +01:00
|
|
|
ui->descriptionLabel->setText(labeltext);
|
2013-10-08 21:45:48 +01:00
|
|
|
}
|
2015-11-12 23:50:38 +00:00
|
|
|
|
2023-05-05 21:46:38 +01:00
|
|
|
void InfoFrame::setLicense(QString text)
|
|
|
|
{
|
2023-07-03 13:09:35 +01:00
|
|
|
if (text.isEmpty()) {
|
2023-05-05 21:46:38 +01:00
|
|
|
ui->licenseLabel->setHidden(true);
|
|
|
|
updateHiddenState();
|
|
|
|
return;
|
2023-07-03 13:09:35 +01:00
|
|
|
} else {
|
2023-05-05 21:46:38 +01:00
|
|
|
ui->licenseLabel->setHidden(false);
|
|
|
|
updateHiddenState();
|
|
|
|
}
|
|
|
|
ui->licenseLabel->setToolTip("");
|
|
|
|
QString intermediatetext = text.trimmed();
|
|
|
|
bool prev(false);
|
|
|
|
QChar rem('\n');
|
|
|
|
QString finaltext;
|
|
|
|
finaltext.reserve(intermediatetext.size());
|
2023-07-03 13:09:35 +01:00
|
|
|
foreach (const QChar& c, intermediatetext) {
|
|
|
|
if (c == rem && prev) {
|
2023-05-05 21:46:38 +01:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
prev = c == rem;
|
|
|
|
finaltext += c;
|
|
|
|
}
|
|
|
|
QString labeltext;
|
|
|
|
labeltext.reserve(300);
|
2023-07-03 13:09:35 +01:00
|
|
|
if (finaltext.length() > 290) {
|
2023-05-05 21:46:38 +01:00
|
|
|
ui->licenseLabel->setOpenExternalLinks(false);
|
|
|
|
ui->licenseLabel->setTextFormat(Qt::TextFormat::RichText);
|
|
|
|
m_description = text;
|
|
|
|
// This allows injecting HTML here.
|
|
|
|
labeltext.append("<html><body>" + finaltext.left(287) + "<a href=\"#mod_desc\">...</a></body></html>");
|
|
|
|
QObject::connect(ui->licenseLabel, &QLabel::linkActivated, this, &InfoFrame::licenseEllipsisHandler);
|
2023-07-03 13:09:35 +01:00
|
|
|
} else {
|
2023-05-05 21:46:38 +01:00
|
|
|
ui->licenseLabel->setTextFormat(Qt::TextFormat::AutoText);
|
|
|
|
labeltext.append(finaltext);
|
|
|
|
}
|
|
|
|
ui->licenseLabel->setText(labeltext);
|
|
|
|
}
|
|
|
|
|
|
|
|
void InfoFrame::setIssueTracker(QString text)
|
|
|
|
{
|
2023-07-03 13:09:35 +01:00
|
|
|
if (text.isEmpty()) {
|
2023-05-05 21:46:38 +01:00
|
|
|
ui->issueTrackerLabel->setHidden(true);
|
2023-07-03 13:09:35 +01:00
|
|
|
} else {
|
2023-05-05 21:46:38 +01:00
|
|
|
ui->issueTrackerLabel->setText(text);
|
|
|
|
ui->issueTrackerLabel->setHidden(false);
|
|
|
|
}
|
|
|
|
updateHiddenState();
|
|
|
|
}
|
|
|
|
|
2022-08-29 13:14:15 +01:00
|
|
|
void InfoFrame::setImage(QPixmap img)
|
|
|
|
{
|
|
|
|
if (img.isNull()) {
|
|
|
|
ui->iconLabel->setHidden(true);
|
|
|
|
} else {
|
|
|
|
ui->iconLabel->setHidden(false);
|
|
|
|
ui->iconLabel->setPixmap(img);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-07-01 07:51:15 +01:00
|
|
|
void InfoFrame::descriptionEllipsisHandler([[maybe_unused]] QString link)
|
2013-10-12 14:19:49 +01:00
|
|
|
{
|
2023-07-03 13:09:35 +01:00
|
|
|
if (!m_current_box) {
|
2022-08-10 18:48:34 +01:00
|
|
|
m_current_box = CustomMessageBox::selectable(this, "", m_description);
|
|
|
|
connect(m_current_box, &QMessageBox::finished, this, &InfoFrame::boxClosed);
|
|
|
|
m_current_box->show();
|
2023-07-03 13:09:35 +01:00
|
|
|
} else {
|
2022-08-10 18:48:34 +01:00
|
|
|
m_current_box->setText(m_description);
|
2018-07-15 13:51:05 +01:00
|
|
|
}
|
2015-11-12 23:50:38 +00:00
|
|
|
}
|
|
|
|
|
2023-07-01 07:51:15 +01:00
|
|
|
void InfoFrame::licenseEllipsisHandler([[maybe_unused]] QString link)
|
2023-05-05 21:46:38 +01:00
|
|
|
{
|
2023-07-03 13:09:35 +01:00
|
|
|
if (!m_current_box) {
|
2023-05-05 21:46:38 +01:00
|
|
|
m_current_box = CustomMessageBox::selectable(this, "", m_license);
|
|
|
|
connect(m_current_box, &QMessageBox::finished, this, &InfoFrame::boxClosed);
|
|
|
|
m_current_box->show();
|
2023-07-03 13:09:35 +01:00
|
|
|
} else {
|
2023-05-05 21:46:38 +01:00
|
|
|
m_current_box->setText(m_license);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-07-01 07:51:15 +01:00
|
|
|
void InfoFrame::boxClosed([[maybe_unused]] int result)
|
2015-11-12 23:50:38 +00:00
|
|
|
{
|
2022-08-10 18:48:34 +01:00
|
|
|
m_current_box = nullptr;
|
2013-10-12 14:19:49 +01:00
|
|
|
}
|