Update about

This commit is contained in:
Jonas Kvinge 2018-09-14 23:58:58 +02:00
parent 1a7465ba94
commit a0f07a7a67
3 changed files with 105 additions and 85 deletions

View File

@ -37,17 +37,20 @@
#include "ui_about.h"
About::About(QWidget *parent):QDialog(parent) {
authors_ \
ui_.setupUi(this);
setWindowFlags(this->windowFlags()|Qt::WindowStaysOnTopHint);
strawberry_authors_ \
<< Person("Jonas Kvinge", "jonas@strawbs.net");
clementine_authors_
<< Person("David Sansome", "me@davidsansome.com")
<< Person("John Maguire", "john.maguire@gmail.com")
<< Person(QString::fromUtf8("Paweł Bara"), "keirangtp@gmail.com")
<< Person("Arnaud Bienner", "arnaud.bienner@gmail.com");
thanks_to_ \
constributors_ \
<< Person("Mark Kretschmann", "kretschmann@kde.org")
<< Person("Max Howell", "max.howell@methylblue.com")
<< Person("Jakub Stachowski", "qbast@go2.pl")
@ -67,68 +70,83 @@ About::About(QWidget *parent):QDialog(parent) {
<< Person("Santiago Gil")
<< Person("Tyler Rhodes", "tyler.s.rhodes@gmail.com");
QString Title = "";
ui_.setupUi(this);
setWindowFlags(this->windowFlags()|Qt::WindowStaysOnTopHint);
setWindowTitle(tr("About Strawberry"));
QString Title("About Strawberry");
Title = QString("About Strawberry");
ui_.title->setText(Title);
QFont title_font;
title_font.setBold(true);
title_font.setPointSize(title_font.pointSize() + 4);
ui_.title->setFont(title_font);
ui_.text->setWordWrap(true);
ui_.text->setText(MakeHtml());
setWindowTitle(Title);
ui_.label_title->setFont(title_font);
ui_.label_title->setText(Title);
ui_.label_text->setText(MainHtml());
ui_.text_constributors->setText(ContributorsHtml());
ui_.buttonBox->button(QDialogButtonBox::Close)->setShortcut(QKeySequence::Close);
}
QString About::MakeHtml() const {
QString About::MainHtml() const {
QString ret = "";
QString ret;
ret = tr("<p>Version %1</p>").arg(QCoreApplication::applicationVersion());
ret = QString("<p>Version %1</p>").arg(QCoreApplication::applicationVersion());
ret += tr("<p>");
ret += tr("Strawberry is a audio player and music collection organizer.<br />");
ret += tr("It's based on Clementine and Amarok 1.4, especially aimed at audiophiles.<br />");
ret += tr("The name is inspired by the band Strawbs.</p>");
//ret += tr("<p><a href=\"%1\">%2</a></p><p><b>%3:</b>").arg(kUrl, kUrl, tr("Authors"));
ret += QString("<p><b>%1</b>").arg(tr("Strawberry Authors"));
for (const Person &person : authors_) {
ret += "<br />" + MakeHtml(person);
}
ret += QString("</p><p><b>%3:</b>").arg(tr("Clementine Authors"));
for (const Person &person : clementine_authors_) {
ret += "<br />" + MakeHtml(person);
}
ret += QString("</p><p><b>%3:</b>").arg(tr("Thanks to"));
for (const Person &person : thanks_to_) {
ret += "<br />" + MakeHtml(person);
}
ret += QString("<br />%1</p>").arg(tr("... and all the Amarok and Clementine contributors"));
ret += QString("<p>");
ret += QString("Strawberry is a audio player and music collection organizer.<br />");
ret += QString("It's based on Clementine and Amarok 1.4, especially aimed at audiophiles.<br />");
ret += QString("The name is inspired by the band Strawbs.");
ret += QString("</p>");
//ret += QString("<p>Website: <a href=\"http://www.strawbs.org/licenses/\">http://www.strawbs.org/</a></p>");
ret += QString("<p>");
ret += QString("Strawberry is free software: you can redistribute it and/or modify<br />");
ret += QString("it under the terms of the GNU General Public License as published by<br />");
ret += QString("the Free Software Foundation, either version 3 of the License, or<br />");
ret += QString("(at your option) any later version.<br />");
ret += QString("<br />");
ret += QString("Strawberry is distributed in the hope that it will be useful,<br />");
ret += QString("but WITHOUT ANY WARRANTY; without even the implied warranty of<br />");
ret += QString("MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br />");
ret += QString("GNU General Public License for more details.<br />");
ret += QString("<br />");
ret += QString("You should have received a copy of the GNU General Public License<br />");
ret += QString("along with Strawberry. If not, see <a href=\"http://www.gnu.org/licenses/\">http://www.gnu.org/licenses/</a>.");
ret += QString("</p>");
return ret;
}
QString About::MakeHtml(const Person &person) const {
QString About::ContributorsHtml() const {
QString ret;
ret += QString("<p><b>Strawberry Authors</b>");
for (const Person &person : strawberry_authors_) {
ret += "<br />" + PersonToHtml(person);
}
ret += QString("</p>");
ret += QString("<p><b>Clementine Authors</b>");
for (const Person &person : clementine_authors_) {
ret += "<br />" + PersonToHtml(person);
}
ret += QString("</p>");
ret += QString("<p><b>Contributors</b>");
for (const Person &person : constributors_) {
ret += "<br />" + PersonToHtml(person);
}
ret += QString("</p>");
ret += QString("<p>... and all the Amarok and Clementine contributors</p>");
return ret;
}
QString About::PersonToHtml(const Person &person) const {
if (person.email.isNull())
return person.name;

View File

@ -41,23 +41,22 @@ class About : public QDialog {
struct Person {
Person(const QString &n, const QString &e = QString()) : name(n), email(e) {}
bool operator<(const Person &other) const { return name < other.name; }
QString name;
QString email;
};
private:
QString MakeHtml() const;
QString MakeHtml(const Person& person) const;
QString MainHtml() const;
QString ContributorsHtml() const;
QString PersonToHtml(const Person& person) const;
private:
Ui::About ui_;
QList<Person> authors_;
QList<Person> strawberry_authors_;
QList<Person> clementine_authors_;
QList<Person> thanks_to_;
QList<Person> constributors_;
};
#endif // ABOUT_H

View File

@ -2,32 +2,12 @@
<ui version="4.0">
<class>About</class>
<widget class="QDialog" name="About">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>700</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<property name="maximumSize">
<size>
<width>600</width>
<height>700</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
@ -50,7 +30,7 @@
<item>
<layout class="QVBoxLayout" name="verticalLayout_logo">
<item>
<widget class="QLabel" name="label">
<widget class="QLabel" name="label_icon">
<property name="pixmap">
<pixmap resource="../../data/data.qrc">:/icons/64x64/strawberry.png</pixmap>
</property>
@ -60,7 +40,7 @@
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<spacer name="spacer_left">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
@ -99,31 +79,54 @@
<item>
<layout class="QVBoxLayout" name="verticalLayout_text">
<item>
<widget class="QLabel" name="title">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>25</height>
</size>
</property>
<widget class="QLabel" name="label_title">
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="text">
<widget class="QLabel" name="label_text">
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QTextBrowser" name="text_constributors">
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="spacer_bottom">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">