aboutdialog.cpp
1 //------------------------------------------------------------------------------
2 // aboutdialog.cpp
3 //------------------------------------------------------------------------------
4 //
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
9 //
10 // This library 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 GNU
13 // Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with this library; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 // 02110-1301 USA
19 //
20 //------------------------------------------------------------------------------
21 // Copyright (C) 2009 Braden "Blzut3" Obrzut <admin@maniacsvault.net>
22 //------------------------------------------------------------------------------
23 #include "aboutdialog.h"
24 
25 #include "gui/commongui.h"
26 #include "gui/copytextdlg.h"
27 #include "plugins/engineplugin.h"
28 #include "plugins/pluginloader.h"
29 #include "ui_aboutdialog.h"
30 #include "version.h"
31 #include "wadseeker/wadseekerversioninfo.h"
32 #include <QPixmap>
33 #include <QResource>
34 #include <QString>
35 
36 DClass<AboutDialog> : public Ui::AboutDialog
37 {
38 };
39 
40 DPointered(AboutDialog)
41 
42 AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent)
43 {
44  d->setupUi(this);
46 
47  connect(d->buttonBox, SIGNAL(clicked(QAbstractButton*)), SLOT(close()));
48 
49  // Doomseeker
50  d->versionChangeset->setText(Version::changeset());
51  d->versionNumber->setText(Version::versionRevision());
52  d->versionAbi->setText(QString("(ABI: %1)").arg(DOOMSEEKER_ABI_VERSION));
53  d->lblRevision->setText(QString::number(Version::revisionNumber()));
54  d->logo->setPixmap(QPixmap(":/logo.png"));
55  d->pteCopyrightNotice->setPlainText(copyrightVerboseNotice());
56 
57  // Wadseeker
58  d->wadseekerAuthor->setText(WadseekerVersionInfo::author());
59  d->wadseekerDescription->setText(WadseekerVersionInfo::description());
60  d->wadseekerVersion->setText(WadseekerVersionInfo::version());
61  d->wadseekerYearSpan->setText(WadseekerVersionInfo::yearSpan());
62 
63  // Populate plugins dialog
64  for (unsigned i = 0; i < gPlugins->numPlugins(); ++i)
65  d->pluginBox->addItem( gPlugins->plugin(i)->info()->data()->name);
66  connect(d->pluginBox, SIGNAL(currentIndexChanged(int)), SLOT(changePlugin(int)));
67  changePlugin(0);
68 
69  adjustSize();
70 }
71 
72 AboutDialog::~AboutDialog()
73 {
74 }
75 
76 void AboutDialog::changePlugin(int pluginIndex)
77 {
78  if (static_cast<unsigned>(pluginIndex) >= gPlugins->numPlugins())
79  return; // Invalid plugin.
80 
81  const EnginePlugin *plug = gPlugins->plugin(pluginIndex)->info();
82 
83  if (plug->data()->aboutProvider.isNull())
84  d->pluginDescription->setPlainText("");
85  else
86  d->pluginDescription->setPlainText(plug->data()->aboutProvider->provide());
87  d->pluginAuthor->setText(plug->data()->author);
88  d->pluginVersion->setText(QString("Version: %1").arg(plug->data()->version));
89  d->pluginAbiVersion->setText(QString("(ABI: %1)").arg(plug->data()->abiVersion));
90 }
91 
92 QString AboutDialog::copyrightVerboseNotice() const
93 {
94  // This text is split into separate strings to simplify translation.
95  // Whenever a single paragraph needs to be changed or a new text needs
96  // to be added, it won't invalidate all existing translations.
97  QStringList paragraphs;
98 
99  // Unicode chars
100  QChar copyrightChar(0x00a9);
101  QChar smallAGraveChar(0x00e0);
102 
103  // License
104  paragraphs << tr("Copyright %1 %2 The Doomseeker Team")
105  .arg(copyrightChar).arg(Version::yearSpan());
106  paragraphs << tr("This program is distributed under the terms of the LGPL v2.1 or later.");
107 
108  // Translations
109  paragraphs << tr("Doomseeker translations contributed by:\n")
110  + tr("- Polish: Zalewa") + "\n"
111  + tr("- Spanish: Pol Marcet Sard%1").arg(smallAGraveChar) + "\n"
112  + tr("- Catalan: Pol Marcet Sard%1").arg(smallAGraveChar);
113 
114  // GeoLite2
115  paragraphs << tr("This program uses GeoLite2 data for IP-to-Country (IP2C) purposes, "
116  "available from https://www.maxmind.com") + "\n" +
117  tr("Database and Contents Copyright (c) 2018 MaxMind, Inc.");
118  paragraphs << tr("GeoLite2 License:\n"
119  "This work is licensed under the Creative Commons Attribution - ShareAlike 4.0 Unported License. "
120  "To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/4.0/.");
121  paragraphs << tr("GeoLite2 available at:\n"
122  "https://dev.maxmind.com/geoip/geoip2/geolite2/");
123 
124  // Icons
125  QStringList icons;
126  icons << tr("- Aha-Soft");
127  icons << tr("- Crystal Clear by Everaldo Coelho");
128  icons << tr("- Fugue Icons (C) 2013 Yusuke Kamiyamane. All rights reserved.");
129  icons << tr("- Nuvola 1.0 (KDE 3.x icon set)");
130  icons << tr("- Oxygen Icons 4.3.1 (KDE)");
131  icons << tr("- Silk Icon Set (C) Mark James (famfamfam.com)");
132  icons << tr("- Tango Icon Library / Tango Desktop Project");
133  paragraphs << tr("This program uses icons (or derivates of) from following sources:\n") + icons.join("\n");
134 
135  return paragraphs.join("\n\n");
136 }