2023-02-28 01:15:26 +00:00
|
|
|
// AUTOGENERATED COPYRIGHT HEADER START
|
|
|
|
// Copyright (C) 2020-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
|
|
|
|
// AUTOGENERATED COPYRIGHT HEADER END
|
2020-04-05 16:52:06 +00:00
|
|
|
|
|
|
|
#include "ui-about-entry.hpp"
|
|
|
|
|
2021-04-20 11:15:08 +00:00
|
|
|
constexpr std::string_view i18n_role_contributor = "UI.About.Role.Contributor";
|
|
|
|
constexpr std::string_view i18n_role_translator = "UI.About.Role.Translator";
|
|
|
|
constexpr std::string_view i18n_role_supporter = "UI.About.Role.Supporter";
|
2020-04-05 16:52:06 +00:00
|
|
|
|
2023-05-13 12:35:46 +00:00
|
|
|
streamfx::ui::about_entry::about_entry(QWidget* parent, const streamfx::ui::about::entry& entry) : QWidget(parent), _link()
|
2020-04-05 16:52:06 +00:00
|
|
|
{
|
|
|
|
setupUi(this);
|
|
|
|
|
|
|
|
name->setText(QString::fromStdString(entry.name));
|
|
|
|
switch (entry.role) {
|
|
|
|
case streamfx::ui::about::role_type::NONE:
|
|
|
|
title->setText(QString::fromStdString(entry.role_custom));
|
|
|
|
break;
|
|
|
|
case streamfx::ui::about::role_type::CONTRIBUTOR:
|
|
|
|
title->setText(D_TRANSLATE(i18n_role_contributor.data()));
|
|
|
|
break;
|
|
|
|
case streamfx::ui::about::role_type::TRANSLATOR:
|
|
|
|
title->setText(D_TRANSLATE(i18n_role_translator.data()));
|
|
|
|
break;
|
2021-04-20 11:15:08 +00:00
|
|
|
case streamfx::ui::about::role_type::SUPPORTER:
|
|
|
|
title->setText(D_TRANSLATE(i18n_role_supporter.data()));
|
2020-04-05 16:52:06 +00:00
|
|
|
break;
|
2020-07-12 16:41:50 +00:00
|
|
|
default:
|
|
|
|
break;
|
2020-04-05 16:52:06 +00:00
|
|
|
}
|
|
|
|
|
2021-04-19 15:28:38 +00:00
|
|
|
if (!entry.link.empty()) {
|
|
|
|
this->setCursor(Qt::PointingHandCursor);
|
|
|
|
_link = QUrl(QString::fromUtf8(entry.link.c_str()));
|
2020-04-05 16:52:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
streamfx::ui::about_entry::~about_entry() {}
|
|
|
|
|
2021-04-19 15:28:38 +00:00
|
|
|
void streamfx::ui::about_entry::mousePressEvent(QMouseEvent* event)
|
2020-04-05 16:52:06 +00:00
|
|
|
{
|
2021-04-19 15:28:38 +00:00
|
|
|
if (_link.isEmpty())
|
|
|
|
return;
|
2020-04-05 16:52:06 +00:00
|
|
|
|
2021-04-19 15:28:38 +00:00
|
|
|
if (event->button() == Qt::LeftButton) {
|
|
|
|
QDesktopServices::openUrl(_link);
|
2020-04-05 16:52:06 +00:00
|
|
|
}
|
|
|
|
}
|