cmake: avoid de-duplication of user's CXXFLAGS
[quassel.git] / src / qtui / aboutdlg.cpp
1 /***************************************************************************
2  *   Copyright (C) 2005-2020 by the Quassel Project                        *
3  *   devel@quassel-irc.org                                                 *
4  *                                                                         *
5  *   This program is free software; you can redistribute it and/or modify  *
6  *   it under the terms of the GNU General Public License as published by  *
7  *   the Free Software Foundation; either version 2 of the License, or     *
8  *   (at your option) version 3.                                           *
9  *                                                                         *
10  *   This program is distributed in the hope that it will be useful,       *
11  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
12  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
13  *   GNU General Public License for more details.                          *
14  *                                                                         *
15  *   You should have received a copy of the GNU General Public License     *
16  *   along with this program; if not, write to the                         *
17  *   Free Software Foundation, Inc.,                                       *
18  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
19  ***************************************************************************/
20
21 #include "aboutdlg.h"
22
23 #include <QDateTime>
24 #include <QPixmap>
25
26 #include "aboutdata.h"
27 #include "icon.h"
28 #include "quassel.h"
29 #include "util.h"
30
31 AboutDlg::AboutDlg(QWidget* parent)
32     : QDialog(parent)
33     , _aboutData(new AboutData(this))
34 {
35     AboutData::setQuasselPersons(_aboutData);
36
37     ui.setupUi(this);
38     ui.quasselLogo->setPixmap(QPixmap{":/pics/quassel-64.svg"});  // don't let the icon theme affect our logo here
39
40     QString versionDate;
41     if (Quassel::buildInfo().commitDate.isEmpty()) {
42         // This shouldn't happen, but sometimes the packaging environment cannot set a proper
43         // date/time.  Add a fallback just in case.
44         versionDate = QString("<i>%1</i>").arg(tr("Unknown date"));
45     }
46     else {
47         versionDate = tryFormatUnixEpoch(Quassel::buildInfo().commitDate, Qt::DateFormat::DefaultLocaleShortDate);
48     }
49     ui.versionLabel->setText(QString(tr("<b>Version:</b> %1<br>"
50                                         "<b>Version date:</b> %2<br>"
51                                         "<b>Protocol version:</b> %3"))
52                                  .arg(Quassel::buildInfo().fancyVersionString)
53                                  .arg(versionDate)
54                                  .arg(Quassel::buildInfo().protocolVersion));
55     ui.aboutTextBrowser->setHtml(about());
56     ui.authorTextBrowser->setHtml(authors());
57     ui.contributorTextBrowser->setHtml(contributors());
58     ui.thanksToTextBrowser->setHtml(thanksTo());
59
60     setWindowIcon(icon::get("quassel"));
61 }
62
63 QString AboutDlg::about() const
64 {
65     QString res{tr("<b>A modern, distributed IRC Client</b><br><br>"
66                    "&copy;%1 by the Quassel Project<br>"
67                    "<a href=\"https://quassel-irc.org\">https://quassel-irc.org</a><br>"
68                    "<a href=\"irc://irc.freenode.net/quassel\">#quassel</a> on <a href=\"https://www.freenode.net\">Freenode</a><br><br>"
69                    "Quassel IRC is dual-licensed under <a href=\"https://www.gnu.org/licenses/gpl-2.0.txt\">GPLv2</a> and "
70                    "<a href=\"https://www.gnu.org/licenses/gpl-3.0.txt\">GPLv3</a>.<br>"
71                    "<a href=\"https://api.kde.org/frameworks/breeze-icons/html\">Breeze icon theme</a> &copy; Uri Herrera and others, "
72                    "licensed under the "
73                    "<a href=\"https://github.com/KDE/breeze-icons/blob/21ffd9b/COPYING-ICONS\">LGPLv3</a>.<br>"
74                    "<a href=\"https://api.kde.org/frameworks/oxygen-icons5/html\">Oxygen icon theme</a> &copy; Nuno Pinheiro and others, "
75                    "licensed under the "
76                    "<a href=\"https://github.com/KDE/oxygen-icons/blob/master/COPYING\">LGPLv3</a>.<br><br>"
77                    "Please use <a href=\"https://bugs.quassel-irc.org\">https://bugs.quassel-irc.org</a> to report bugs.")
78                     .arg("2005-2020")};
79
80     return res;
81 }
82
83 QString AboutDlg::authors() const
84 {
85     QString res{tr("Quassel IRC is mainly developed by:") + "<dl>"};
86     for (auto&& person : _aboutData->authors()) {
87         res.append("<dt><b>" + person.prettyName() + "</b></dt><dd>");
88         if (!person.emailAddress().isEmpty())
89             res.append("<a href=\"mailto:" + person.emailAddress() + "\">" + person.emailAddress() + "</a><br>");
90         res.append("<i>" + person.task() + "</i><br></dd>");
91     }
92     res.append("</dl>");
93     return res;
94 }
95
96 QString AboutDlg::contributors() const
97 {
98     QString res{tr("We would like to thank the following contributors (in alphabetical order) and everybody we forgot to mention here:")
99                 + "<br><dl>"};
100     for (auto&& person : _aboutData->credits()) {
101         res.append("<dt><b>" + person.prettyName() + "</b></dt><dd><i>" + person.task() + "</i><br></dd>");
102     }
103     res.append("</dl>"
104                + tr("...and anybody else finding and reporting bugs, giving feedback, helping others and being part of the community!"));
105     return res;
106 }
107
108 QString AboutDlg::thanksTo() const
109 {
110     QString res{tr("Special thanks goes to:")
111                 + "<br>"
112                   "<table>"
113                   "<tr><td rowspan='2' valign='middle'><img src=':/pics/quassel-eye.png'>&nbsp;</td>"
114                   "<td><b>John \"nox\" Hand</b></td></tr>"
115                   "<tr><td><i>"
116                 + tr("for the original Quassel logo - The All-Seeing Eye")
117                 + "</i></td></tr>"
118                   "<tr/>"
119                   "<tr><td rowspan='2' valign='middle'><img src=':/pics/quassel-oxygen-32.png'></td>"
120                   "<td><b>Nuno Pinheiro</b></td></tr>"
121                   "<tr><td><i>"
122                 + tr("for the Oxygen Quassel logo")
123                 + "</i></td></tr>"
124                   "<tr/>"
125                   "<tr><td rowspan='2' valign='middle'><img src=':/pics/kde-vdg.png'></td>"
126                   "<td><b><a href='https://vdesign.kde.org'>The KDE Visual Design Group</a></b></td></tr>"
127                   "<tr><td><i>"
128                 + tr("for the amazing Breeze and Oxygen icon themes")
129                 + "</i></td></tr>"
130                   "<tr/>"
131                   "<tr><td rowspan='2' valign='middle'><img src=':/pics/qt-logo-32.png'></td>"
132                   "<td><b><a href='https://www.qt.io/'>The Qt Company</a></b> (formerly known as Qt Software, Nokia, Trolltech)</td></tr>"
133                   "<tr><td><i>"
134                 + tr("for creating an awesome framework, and for sponsoring development with Greenphones, N810s, N950s and more")
135                 + "</i></td></tr>"
136                   "</table>"};
137
138     return res;
139 }