#include "AboutPage.hpp" #include "util/LayoutCreator.hpp" #include "util/RemoveScrollAreaBackground.hpp" #include "widgets/helper/SignalLabel.hpp" #include #include #include #include #include #define PIXMAP_WIDTH 500 namespace chatterino { AboutPage::AboutPage() : SettingsPage("About", ":/images/about.svg") { util::LayoutCreator layoutCreator(this); auto scroll = layoutCreator.emplace(); auto widget = scroll.emplaceScrollAreaWidget(); util::removeScrollAreaBackground(scroll.getElement(), widget.getElement()); auto layout = widget.setLayoutType(); { QPixmap pixmap; pixmap.load(":/images/aboutlogo.png"); auto logo = layout.emplace().assign(&this->logo); logo->setPixmap(pixmap); logo->setFixedSize(PIXMAP_WIDTH, PIXMAP_WIDTH * pixmap.height() / pixmap.width()); logo->setScaledContents(true); // this does nothing // QPalette palette; // palette.setColor(QPalette::Text, Qt::white); // palette.setColor(QPalette::Link, "#a5cdff"); // palette.setColor(QPalette::LinkVisited, "#a5cdff"); /*auto xd = layout.emplace("Created by..."); { auto created = xd.emplace(); { created->setText("Created by fourtf
" "with big help from pajlada."); created->setTextFormat(Qt::RichText); created->setTextInteractionFlags(Qt::TextBrowserInteraction | Qt::LinksAccessibleByKeyboard | Qt::LinksAccessibleByKeyboard); created->setOpenExternalLinks(true); // created->setPalette(palette); } // auto github = xd.emplace(); // { // github->setText( // "Chatterino on // Github"); // github->setTextFormat(Qt::RichText); // github->setTextInteractionFlags(Qt::TextBrowserInteraction | // Qt::LinksAccessibleByKeyboard | // Qt::LinksAccessibleByKeyboard); // github->setOpenExternalLinks(true); // // github->setPalette(palette); // } }*/ auto licenses = layout.emplace("Open source software used..."); { auto form = licenses.emplace(); addLicense(form.getElement(), "Qt Framework", "https://www.qt.io", ":/licenses/qt_lgpl-3.0.txt"); addLicense(form.getElement(), "Boost", "https://www.boost.org/", ":/licenses/boost_boost.txt"); addLicense(form.getElement(), "Fmt", "http://fmtlib.net/", ":/licenses/fmt_bsd2.txt"); addLicense(form.getElement(), "LibCommuni", "https://github.com/communi/libcommuni", ":/licenses/libcommuni_BSD3.txt"); addLicense(form.getElement(), "OpenSSL", "https://www.openssl.org/", ":/licenses/openssl.txt"); addLicense(form.getElement(), "RapidJson", "http://rapidjson.org/", ":/licenses/rapidjson.txt"); addLicense(form.getElement(), "Pajlada/Settings", "https://github.com/pajlada/settings", ":/licenses/pajlada_settings.txt"); addLicense(form.getElement(), "Pajlada/Signals", "https://github.com/pajlada/signals", ":/licenses/pajlada_signals.txt"); addLicense(form.getElement(), "Websocketpp", "https://www.zaphoyd.com/websocketpp/", ":/licenses/websocketpp.txt"); } auto attributions = layout.emplace("Attributions..."); { auto l = attributions.emplace(); // clang-format off l.emplace("EmojiOne 2 and 3 emojis provided by EmojiOne"); l.emplace("Twemoji emojis provided by Twitter's Twemoji"); l.emplace("Facebook emojis provided by Facebook"); l.emplace("Apple emojis provided by Apple"); l.emplace("Google emojis provided by Google"); l.emplace("Messenger emojis provided by Facebook"); l.emplace("Emoji datasource provided by Cal Henderson"); // clang-format on } } layout->addStretch(1); } void AboutPage::addLicense(QFormLayout *form, const QString &name, const QString &website, const QString &licenseLink) { auto *a = new QLabel("" + name + ""); a->setOpenExternalLinks(true); auto *b = new SignalLabel(); b->setText("show license"); b->setCursor(Qt::PointingHandCursor); QObject::connect(b, &SignalLabel::mouseUp, [licenseLink] { auto *edit = new QTextEdit; QFile file(licenseLink); file.open(QIODevice::ReadOnly); edit->setText(file.readAll()); edit->setReadOnly(true); edit->show(); }); form->addRow(a, b); } } // namespace chatterino