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" #include "ui_about.h"
About::About(QWidget *parent):QDialog(parent) { About::About(QWidget *parent):QDialog(parent) {
authors_ \ ui_.setupUi(this);
setWindowFlags(this->windowFlags()|Qt::WindowStaysOnTopHint);
strawberry_authors_ \
<< Person("Jonas Kvinge", "jonas@strawbs.net"); << Person("Jonas Kvinge", "jonas@strawbs.net");
clementine_authors_ clementine_authors_
<< Person("David Sansome", "me@davidsansome.com") << Person("David Sansome", "me@davidsansome.com")
<< Person("John Maguire", "john.maguire@gmail.com") << Person("John Maguire", "john.maguire@gmail.com")
<< Person(QString::fromUtf8("Paweł Bara"), "keirangtp@gmail.com") << Person(QString::fromUtf8("Paweł Bara"), "keirangtp@gmail.com")
<< Person("Arnaud Bienner", "arnaud.bienner@gmail.com"); << Person("Arnaud Bienner", "arnaud.bienner@gmail.com");
thanks_to_ \ constributors_ \
<< Person("Mark Kretschmann", "kretschmann@kde.org") << Person("Mark Kretschmann", "kretschmann@kde.org")
<< Person("Max Howell", "max.howell@methylblue.com") << Person("Max Howell", "max.howell@methylblue.com")
<< Person("Jakub Stachowski", "qbast@go2.pl") << Person("Jakub Stachowski", "qbast@go2.pl")
@ -67,68 +70,83 @@ About::About(QWidget *parent):QDialog(parent) {
<< Person("Santiago Gil") << Person("Santiago Gil")
<< Person("Tyler Rhodes", "tyler.s.rhodes@gmail.com"); << Person("Tyler Rhodes", "tyler.s.rhodes@gmail.com");
QString Title("About Strawberry");
QString Title = "";
ui_.setupUi(this);
setWindowFlags(this->windowFlags()|Qt::WindowStaysOnTopHint);
setWindowTitle(tr("About Strawberry"));
Title = QString("About Strawberry");
ui_.title->setText(Title);
QFont title_font; QFont title_font;
title_font.setBold(true); title_font.setBold(true);
title_font.setPointSize(title_font.pointSize() + 4); title_font.setPointSize(title_font.pointSize() + 4);
ui_.title->setFont(title_font);
ui_.text->setWordWrap(true); setWindowTitle(Title);
ui_.text->setText(MakeHtml());
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); 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 += QString("<p>");
ret += QString("Strawberry is a audio player and music collection organizer.<br />");
ret += tr("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 += tr("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 += tr("The name is inspired by the band Strawbs.</p>"); ret += QString("</p>");
//ret += QString("<p>Website: <a href=\"http://www.strawbs.org/licenses/\">http://www.strawbs.org/</a></p>");
//ret += tr("<p><a href=\"%1\">%2</a></p><p><b>%3:</b>").arg(kUrl, kUrl, tr("Authors")); ret += QString("<p>");
ret += QString("Strawberry is free software: you can redistribute it and/or modify<br />");
ret += QString("<p><b>%1</b>").arg(tr("Strawberry Authors")); 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 />");
for (const Person &person : authors_) { ret += QString("(at your option) any later version.<br />");
ret += "<br />" + MakeHtml(person); 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("</p><p><b>%3:</b>").arg(tr("Clementine Authors")); ret += QString("MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br />");
ret += QString("GNU General Public License for more details.<br />");
for (const Person &person : clementine_authors_) { ret += QString("<br />");
ret += "<br />" + MakeHtml(person); 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>");
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"));
return ret; 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()) if (person.email.isNull())
return person.name; return person.name;

View File

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

View File

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