Add a list of contributors to the about page

This commit is contained in:
Rasmus Karlsson 2018-07-04 16:48:53 +00:00
parent e76871c09c
commit a66a2f2e8d
5 changed files with 100 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View file

@ -0,0 +1,34 @@
# To add yourself to this list, or to update one of your fields, send a PR with this file updated
# This list is displayed in the About section of the preferences window
# TODO: Parse this into a CONTRIBUTORS.md too
fourtf | https://fourtf.com | avatars/fourtf.png | Author, main developer
pajlada | https://pajlada.se | avatars/pajlada.png | Collaborator, co-developer
Cranken | https://github.com/Cranken | | Contributor
hemirt | https://github.com/hemirt | | Contributor
LajamerrMittisdine | https://github.com/LajamerrMittisdine | | Contributor
coral | https://github.com/coral | | Contributor, design
apa420 | https://github.com/apa420 | | Contributor
DatGuy1 | https://github.com/DatGuy1 | | Contributor
Confuseh | https://github.com/Confuseh | | Contributor
ch-ems | https://github.com/ch-ems | | Contributor
Bur0k | https://github.com/Bur0k | | Contributor
nuuls | https://github.com/nuuls | | Contributor
Chronophylos | https://github.com/Chronophylos | | Contributor
Ckath | https://github.com/Ckath | | Contributor
matijakevic | https://github.com/matijakevic | | Contributor
nforro | https://github.com/nforro | | Contributor
vanolpfan | https://github.com/vanolpfan | | Contributor
Defman21 | https://github.com/Defman21 | | Documentation
Jarel1337 | https://github.com/Jarel1337 | | Documentation
Ian321 | https://github.com/Ian321 | | Documentation
Yardanico | https://github.com/Yardanico | | Documentation
huti26 | https://github.com/huti26 | | Documentation
chrisduerr | https://github.com/chrisduerr | | Documentation
23rd | https://github.com/23rd | | Documentation
TranRed | https://github.com/TranRed | | Documentation
# Template
# Name | Link | Avatar (Loaded as a resource) | Title (description of work done). Contributor is what we use for someone who has contributed in general (like sent a programming-related PR)

View file

@ -69,6 +69,9 @@
<file>tlds.txt</file> <file>tlds.txt</file>
<file>images/menu_black.png</file> <file>images/menu_black.png</file>
<file>images/menu_white.png</file> <file>images/menu_white.png</file>
<file>contributors.txt</file>
<file>avatars/fourtf.png</file>
<file>avatars/pajlada.png</file>
</qresource> </qresource>
<qresource prefix="/qt/etc"> <qresource prefix="/qt/etc">
<file>qt.conf</file> <file>qt.conf</file>

View file

@ -1,5 +1,6 @@
#include "AboutPage.hpp" #include "AboutPage.hpp"
#include "debug/Log.hpp"
#include "util/LayoutCreator.hpp" #include "util/LayoutCreator.hpp"
#include "util/RemoveScrollAreaBackground.hpp" #include "util/RemoveScrollAreaBackground.hpp"
#include "widgets/helper/SignalLabel.hpp" #include "widgets/helper/SignalLabel.hpp"
@ -8,6 +9,7 @@
#include <QGroupBox> #include <QGroupBox>
#include <QLabel> #include <QLabel>
#include <QTextEdit> #include <QTextEdit>
#include <QTextStream>
#include <QVBoxLayout> #include <QVBoxLayout>
#define PIXMAP_WIDTH 500 #define PIXMAP_WIDTH 500
@ -104,6 +106,67 @@ AboutPage::AboutPage()
l.emplace<QLabel>("Emoji datasource provided by <a href=\"https://www.iamcal.com/\">Cal Henderson</a>"); l.emplace<QLabel>("Emoji datasource provided by <a href=\"https://www.iamcal.com/\">Cal Henderson</a>");
// clang-format on // clang-format on
} }
// Contributors
auto contributors = layout.emplace<QGroupBox>("Contributors");
{
auto l = contributors.emplace<QVBoxLayout>();
QFile contributorsFile(":/contributors.txt");
contributorsFile.open(QFile::ReadOnly);
QTextStream stream(&contributorsFile);
stream.setCodec("UTF-8");
QString line;
while (stream.readLineInto(&line)) {
if (line.isEmpty() || line.startsWith('#')) {
continue;
}
QStringList contributorParts = line.split("|");
if (contributorParts.size() != 4) {
Log("Missing parts in line '{}'", line);
continue;
}
QString username = contributorParts[0].trimmed();
QString url = contributorParts[1].trimmed();
QString avatarUrl = contributorParts[2].trimmed();
QString role = contributorParts[3].trimmed();
auto *usernameLabel = new QLabel("<a href=\"" + url + "\">" + username + "</a>");
usernameLabel->setOpenExternalLinks(true);
auto *roleLabel = new QLabel(role);
auto contributorBox2 = l.emplace<QHBoxLayout>();
const auto addAvatar = [&avatarUrl, &contributorBox2] {
if (!avatarUrl.isEmpty()) {
QPixmap avatarPixmap;
avatarPixmap.load(avatarUrl);
auto avatar = contributorBox2.emplace<QLabel>();
avatar->setPixmap(avatarPixmap);
avatar->setFixedSize(64, 64);
avatar->setScaledContents(true);
}
};
const auto addLabels = [&contributorBox2, &usernameLabel, &roleLabel] {
auto labelBox = new QVBoxLayout();
contributorBox2->addLayout(labelBox);
labelBox->addWidget(usernameLabel);
labelBox->addWidget(roleLabel);
};
addLabels();
addAvatar();
}
}
} }
layout->addStretch(1); layout->addStretch(1);