From 3fbc7031b5066e95fa383b80c6843db486325d81 Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Sat, 16 May 2020 00:45:15 +0200 Subject: [PATCH] Update about dialog --- src/dialogs/about.cpp | 67 +++++++++++++++++++++++++++---------------- src/dialogs/about.h | 6 +++- src/dialogs/about.ui | 38 ++++++++++++++++++------ 3 files changed, 78 insertions(+), 33 deletions(-) diff --git a/src/dialogs/about.cpp b/src/dialogs/about.cpp index bcb267100..d582b62c3 100644 --- a/src/dialogs/about.cpp +++ b/src/dialogs/about.cpp @@ -49,11 +49,6 @@ About::About(QWidget *parent):QDialog(parent) { << Person("Gavin D. Howard", "yzena.tech@gmail.com") << Person("Martin Delille", "martin@delille.org"); - strawberry_thanks_ \ - << Person("Robert-André Mauchin", "eclipseo@fedoraproject.org") - << Person("Thomas Pierson", "contact@thomaspierson.fr") - << Person("Fabio Loli", "fabio.lolix@gmail.com"); - clementine_authors_ << Person("David Sansome", "me@davidsansome.com") << Person("John Maguire", "john.maguire@gmail.com") @@ -61,13 +56,10 @@ About::About(QWidget *parent):QDialog(parent) { << Person("Arnaud Bienner", "arnaud.bienner@gmail.com"); clementine_contributors_ \ - << Person("Mark Kretschmann", "kretschmann@kde.org") - << Person("Max Howell", "max.howell@methylblue.com") << Person("Jakub Stachowski", "qbast@go2.pl") << Person("Paul Cifarelli", "paul@cifarelli.net") << Person("Felipe Rivera", "liebremx@users.sourceforge.net") << Person("Alexander Peitz") - << Person("Artur Rona", "artur.rona@gmail.com") << Person("Andreas Muttscheller", "asfa194@gmail.com") << Person("Mark Furneaux", "mark@furneaux.ca") << Person("Florian Bigard", "florian.bigard@gmail.com") @@ -85,6 +77,14 @@ About::About(QWidget *parent):QDialog(parent) { << Person("Valeriy Malov", "jazzvoid@gmail.com") << Person("Nick Lanham", "nick@afternight.org"); + strawberry_thanks_ \ + << Person("Mark Kretschmann", "kretschmann@kde.org") + << Person("Max Howell", "max.howell@methylblue.com") + << Person("Artur Rona", "artur.rona@gmail.com") + << Person("Robert-André Mauchin", "eclipseo@fedoraproject.org") + << Person("Thomas Pierson", "contact@thomaspierson.fr") + << Person("Fabio Loli", "fabio.lolix@gmail.com"); + QString Title(tr("About Strawberry")); QFont title_font; @@ -95,16 +95,28 @@ About::About(QWidget *parent):QDialog(parent) { ui_.label_title->setFont(title_font); ui_.label_title->setText(Title); + ui_.label_title->adjustSize(); ui_.label_text->setText(MainHtml()); + ui_.label_text->adjustSize(); + ui_.text_contributors->setText(ContributorsHtml()); - ui_.text_contributors->updateGeometry(); - updateGeometry(); ui_.buttonBox->button(QDialogButtonBox::Close)->setShortcut(QKeySequence::Close); } +void About::showEvent(QShowEvent*) { + + setMinimumHeight(0); + setMaximumHeight(9000); + adjustSize(); + // Set fixed height and workaround bottom spacer taking up to much space. + setFixedHeight(height() - ui_.spacer_bottom->geometry().height() + 15); + adjustSize(); + +} + QString About::MainHtml() const { QString ret; @@ -116,12 +128,19 @@ QString About::MainHtml() const { ret += "

"; ret += tr("Strawberry is a music player and music collection organizer."); ret += "
"; - ret += tr("It is a fork of Clementine released in 2018 aimed at music collectors, audio enthusiasts and audiophiles."); - ret += "
"; - ret += tr("The name is inspired by the band Strawbs. It's based on a heavily modified version of Clementine created in 2012-2013. It's written in C++ and Qt 5."); + ret += tr("It is a fork of Clementine released in 2018 aimed at music collectors and audiophiles."); ret += "

"; + ret += "

"; - ret += tr("Strawberry is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version."); + ret += tr("Strawberry is free software released under GPL. The source code is available on %1").arg("GitHub."); + ret += "
"; + ret += tr("You should have received a copy of the GNU General Public License along with this program. If not, see %1").arg("http://www.gnu.org/licenses/"); + ret += "

"; + + ret += "

"; + ret += tr("If you like this Strawberry and can make use of it, consider sponsoring or donating."); + ret += "
"; + ret += tr("You can sponsor the author on %1. You can also make a one-time payment through %2.").arg("GitHub sponsors.").arg("paypal.me/jonaskvinge"); ret += "

"; return ret; @@ -134,7 +153,7 @@ QString About::ContributorsHtml() const { ret += "

"; ret += ""; - ret += tr("Maintainer"); + ret += tr("Author and maintainer"); ret += ""; for (const Person &person : strawberry_authors_) { ret += "
" + PersonToHtml(person); @@ -150,15 +169,6 @@ QString About::ContributorsHtml() const { } ret += "

"; - ret += "

"; - ret += ""; - ret += tr("Thanks to"); - ret += ""; - for (const Person &person : strawberry_thanks_) { - ret += "
" + PersonToHtml(person); - } - ret += "

"; - ret += "

"; ret += ""; ret += tr("Clementine authors"); @@ -177,6 +187,15 @@ QString About::ContributorsHtml() const { } ret += "

"; + ret += "

"; + ret += ""; + ret += tr("Thanks to"); + ret += ""; + for (const Person &person : strawberry_thanks_) { + ret += "
" + PersonToHtml(person); + } + ret += "

"; + ret += "

"; ret += tr("Thanks to all the other Amarok and Clementine contributors."); ret += "

"; diff --git a/src/dialogs/about.h b/src/dialogs/about.h index 65f10da20..d91250ee9 100644 --- a/src/dialogs/about.h +++ b/src/dialogs/about.h @@ -32,6 +32,7 @@ #include "ui_about.h" class QWidget; +class QShowEvent; class About : public QDialog { Q_OBJECT @@ -39,6 +40,10 @@ class About : public QDialog { public: explicit About(QWidget *parent = nullptr); + protected: + void showEvent(QShowEvent*); + + private: struct Person { Person(const QString &n, const QString &e = QString()) : name(n), email(e) {} bool operator<(const Person &other) const { return name < other.name; } @@ -46,7 +51,6 @@ class About : public QDialog { QString email; }; - private: QString MainHtml() const; QString ContributorsHtml() const; QString PersonToHtml(const Person& person) const; diff --git a/src/dialogs/about.ui b/src/dialogs/about.ui index 0ff7e0660..48b628b99 100644 --- a/src/dialogs/about.ui +++ b/src/dialogs/about.ui @@ -7,13 +7,19 @@ 0 0 500 - 600 + 500 + + + 500 + 0 + + - 600 - 700 + 500 + 16777215 @@ -118,13 +124,29 @@ + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 10 + + + + - - - 0 - 0 - + + + 0 + 200 + true