1 /*
2 	Copyright 2006-2019 The QElectroTech Team
3 	This file is part of QElectroTech.
4 
5 	QElectroTech 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) any later version.
9 
10 	QElectroTech 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 QElectroTech.  If not, see <http://www.gnu.org/licenses/>.
17 */
18 #include "aboutqet.h"
19 #include "qet.h"
20 #include "qeticons.h"
21 
22 #include <QTabWidget>
23 #include <QDialogButtonBox>
24 #include <QVBoxLayout>
25 #include <QLabel>
26 #include <QTextEdit>
27 #include <QScrollArea>
28 
29 /**
30  * @brief AboutQET::AboutQET
31  * @param parent
32  */
AboutQET(QWidget * parent)33 AboutQET::AboutQET(QWidget *parent) :
34 	QDialog(parent)
35 {
36 	setWindowTitle(tr("À propos de QElectrotech", "window title"));
37 	setFixedSize (1200, 600);
38 	//setMinimumHeight(600);
39 	//setMinimumWidth(600);
40 	setModal(true);
41 
42 
43 	QTabWidget *tabs = new QTabWidget();
44 	tabs -> addTab(aboutTab(),        tr("À &propos",          "tab title"));
45 	tabs -> addTab(authorsTab(),      tr("A&uteurs",           "tab title"));
46 	tabs -> addTab(translatorsTab(),  tr("&Traducteurs",       "tab title"));
47 	tabs -> addTab(contributorsTab(), tr("&Contributeurs",     "tab title"));
48 	tabs -> addTab(titleTab(),        tr("&Version",           "tab title"));
49 	tabs -> addTab(licenseTab(),      tr("&Accord de licence", "tab title"));
50 
51 	QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Close);
52 	connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
53 	connect(buttons, SIGNAL(rejected()), this, SLOT(accept()));
54 
55 	QVBoxLayout *vlayout = new QVBoxLayout(this);
56 	vlayout->addWidget(tabs);
57 	vlayout->addWidget(buttons);
58 
59 	QScrollArea* scrollArea = new QScrollArea(this);
60 		scrollArea->setWidgetResizable(true);
61 		scrollArea->setFixedSize (1090, 590);
62 		scrollArea->setWidget(tabs);
63 }
64 
65 /**
66 	Destructeur
67 */
~AboutQET()68 AboutQET::~AboutQET() {
69 }
70 
71 /**
72 	@return The title QElectroTech with its icon
73 */
titleTab() const74 QWidget *AboutQET::titleTab() const {
75 	// label "QElectroTech"
76 	QLabel *title = new QLabel("<span style=\"font-weight:0;font-size:16pt;\">QElectroTech V " + QET::displayedVersion + "</span>");
77 	QString compilation_info = "<br />" + tr("Compilation : ");
78 #ifdef __GNUC__
79 #ifdef __APPLE_CC__
80 	compilation_info += "  CLANG " + QString(__clang_version__ );
81 	compilation_info += " - built with Qt " + QString(QT_VERSION_STR);
82 	compilation_info += " - Date : " + QString(__DATE__);
83 	compilation_info += " : " + QString(__TIME__);
84 	compilation_info += " - run with Qt "+ QString(qVersion());
85 	compilation_info += " using" + QString(" %1 thread(s)").arg(QThread::idealThreadCount());
86 	compilation_info += "<br>" "  OS : " +  QString(QSysInfo::kernelType());
87 	compilation_info += "  -   " + QString(QSysInfo::currentCpuArchitecture());
88 	compilation_info += " -  Version :    " + QString(QSysInfo::prettyProductName());
89 	compilation_info += "</br>" " -  Kernel :     " + QString(QSysInfo::kernelVersion());
90 #else
91 	compilation_info += "  GCC " + QString(__VERSION__);
92 	compilation_info += " - built with Qt " + QString(QT_VERSION_STR);
93 	compilation_info += " - Date : " + QString(__DATE__);
94 	compilation_info += " : " + QString(__TIME__);
95 	compilation_info += " - run with Qt "+ QString(qVersion());
96 	compilation_info += " using" + QString(" %1 thread(s)").arg(QThread::idealThreadCount());
97 	compilation_info += "<br>" "  OS : " +  QString(QSysInfo::kernelType());
98 	compilation_info += "  -   " + QString(QSysInfo::currentCpuArchitecture());
99 	compilation_info += " -  Version :    " + QString(QSysInfo::prettyProductName());
100 	compilation_info += "</br>" " -  Kernel :     " + QString(QSysInfo::kernelVersion());
101 #endif
102 #endif
103 	title -> setAlignment(Qt::AlignCenter);
104 	title -> setText(title->text() + compilation_info);
105 	title -> setTextFormat(Qt::RichText);
106 	title ->setTextInteractionFlags(Qt::TextSelectableByMouse);
107 	return(title);
108 }
109 
110 /**
111 	@return The widget content tab "About"
112 */
aboutTab() const113 QWidget *AboutQET::aboutTab() const {
114 	QLabel *about = new QLabel(
115 		tr("QElectroTech, une application de réalisation de schémas électriques.", "about tab, description line") +
116 		"<br><br>" +
117 		tr("2006-2017 Les développeurs de QElectroTech", "about tab, developers line") +
118 		"<br><br>"
119 		"<a href=\"https://qelectrotech.org/\">https://qelectrotech.org/</a>"
120 		"<br><br>" +
121 		tr("Contact : <a href=\"mailto:qet@lists.tuxfamily.org\">qet@lists.tuxfamily.org</a>", "about tab, contact line")
122 	);
123 	about -> setAlignment(Qt::AlignCenter);
124 	about -> setOpenExternalLinks(true);
125 	about -> setTextFormat(Qt::RichText);
126 	//about -> setFixedSize (690, 610);
127 	return(about);
128 }
129 
130 /**
131 	@return The widget content by "Authors" tab
132 */
authorsTab() const133 QWidget *AboutQET::authorsTab() const {
134 	QLabel *authors = new QLabel();
135 	addAuthor(authors, "Benoît Ansieau",     "benoit@qelectrotech.org",     tr("Idée originale"));
136 	addAuthor(authors, "Laurent Trinques",   "scorpio@qelectrotech.org",    tr("Développement"));
137 	addAuthor(authors, "Joshua Claveau",     "Joshua@qelectrotech.org",     tr("Développement"));
138 	addAuthor(authors, "Davi Fochi",         "davi@fochi.com.br",           tr("Développement"));
139 	addAuthor(authors, "Ronny Desmedt",      "r.desmedt@live.be",           tr("Convertisseur DXF"));
140 	addAuthor(authors, "Raul Roda",          "raulroda8@gmail.com",         tr("Plugin Bornier"));
141 	addAuthor(authors, "Abhishek Bansal",    "abhishek@qelectrotech.org",   tr("Développement"));
142 
143 
144 
145 
146 	authors -> setOpenExternalLinks(true);
147 	authors -> setTextFormat(Qt::RichText);
148 
149 	QWidget *authors_widget = new QWidget();
150 	QHBoxLayout *authors_layout = new QHBoxLayout(authors_widget);
151 	authors_layout -> addWidget(authors, 0, Qt::AlignCenter);
152 	return(authors_widget);
153 }
154 
155 /**
156 	@return The widget content via the "Translators" tab
157 */
translatorsTab() const158 QWidget *AboutQET::translatorsTab() const {
159 	QLabel *translators = new QLabel();
160 
161 	addAuthor(translators, "Alfredo Carreto",                           "electronicos_mx@yahoo.com.mx",   tr("Traduction en espagnol"));
162 	addAuthor(translators, "Edgar Robles Najar",                        "tgo.edrobles@gmail.com",         tr("Traduction en espagnol"));
163 	addAuthor(translators, "Yuriy Litkevich",                           "yuriy@qelectrotech.org",         tr("Traduction en russe"));
164 	addAuthor(translators, "Evgeny Kozlov",                             "Evgeny.Kozlov.mailbox@gmail.com",tr("Traduction en russe"));
165 	addAuthor(translators, "José Carlos Martins",                       "jose@qelectrotech.org",          tr("Traduction en portugais"));
166 	addAuthor(translators, "Pavel Fric",                                "pavelfric@seznam.cz",            tr("Traduction en tchèque"));
167 	addAuthor(translators, "Pawe&#x0142; &#x015A;miech",                "pawel32640@gmail.com",           tr("Traduction en polonais"));
168 	addAuthor(translators, "Markus Budde & Jonas Stein & Noah Braden",  "news@jonasstein.de",             tr("Traduction en allemand"));
169 	addAuthor(translators, "Nuri",                                      "nuri@qelectrotech.org",          tr("Traduction en allemand"));
170 	addAuthor(translators, "Gabi Mandoc",                               "gabriel.mandoc@gic.ro",          tr("Traduction en roumain"));
171 	addAuthor(translators, "Alessandro Conti & Silvio",                 "silvio@qelectrotech.org",        tr("Traduction en italien"));
172 	addAuthor(translators, "Mohamed Souabni",                           "souabnimohamed@yahoo.fr",        tr("Traduction en arabe"));
173 	addAuthor(translators, "Antun Marakovi&#x0107;",                    "antun.marakovic@lolaribar.hr",   tr("Traduction en croate"));
174 	addAuthor(translators, "Eduard Amorós",                             "amoros@marmenuda.com",           tr("Traduction en catalan"));
175 	addAuthor(translators, "Nikos Papadopoylos",                        "231036448@freemail.gr",          tr("Traduction en grec"));
176 	addAuthor(translators, "Yannis Gyftomitros",                        "yang@hellug.gr",                 tr("Traduction en grec"));
177 	addAuthor(translators, "Paul Van Deelen",                           "shooter@home.nl",                tr("Traduction en néerlandais"));
178 	addAuthor(translators, "Dik Leenheer",                              "dleenheer@suzerein.nl",          tr("Traduction en néerlandais"));
179 	addAuthor(translators, "Ronny Desmedt",                             "r.desmedt@live.be",              tr("Traduction en flamand"));
180 	addAuthor(translators, "OSS au2mation",                             "OSSau2mation@OSSau2mation.dk",   tr("Traduction en danois"));
181 	addAuthor(translators, "Hilario Silveira",                          "hilario@soliton.com.br",         tr("Traduction en brézilien"));
182 	addAuthor(translators, "Aziz Karabudak",                            "aziz.karabudak@argevi.com",      tr("Traduction en Turc"));
183 	addAuthor(translators, "Gábor Gubányi",                             "gubanyig@gmail.com",             tr("Traduction en hongrois"));
184 
185 
186 
187 
188 	translators -> setOpenExternalLinks(true);
189 	translators -> setTextFormat(Qt::RichText);
190 
191 	QWidget *translators_widget = new QWidget();
192 	QHBoxLayout *translators_layout = new QHBoxLayout(translators_widget);
193 	translators_layout -> addWidget(translators, 0, Qt::AlignCenter);
194 	return(translators_widget);
195 }
196 
197 /**
198 	@return The widget content via the "Contributors" tab
199 */
contributorsTab() const200 QWidget *AboutQET::contributorsTab() const {
201 	QLabel *contributors = new QLabel();
202 
203 	addAuthor(contributors, "Remi Collet",         "remi@fedoraproject.org",              tr("Paquets Fedora et Red Hat"));
204 	addAuthor(contributors, "David Geiger",        "david.david@mageialinux-online.org",  tr("Paquets Mageia"));
205 	addAuthor(contributors, "Laurent Trinques",    "scorpio@qelectrotech.org",            tr("Paquets Debian"));
206 	addAuthor(contributors, "Denis Briand",        "debian@denis-briand.fr",              tr("Paquets Debian"));
207 	addAuthor(contributors, "W. Martin Borgert",   "debacle@debian.org",                  tr("Paquets Debian"));
208 	addAuthor(contributors, "Markos Chandras",     "hwoarang@gentoo.org.",                tr("Paquets Gentoo"));
209 	addAuthor(contributors, "Mbit",                "",                                    tr("Paquets Gentoo"));
210 	addAuthor(contributors, "Elbert",              "",                                    tr("Paquets OS/2"));
211 	addAuthor(contributors, "zloidemon",           "",                                    tr("Paquets FreeBSD"));
212 	addAuthor(contributors, "Yoann Varenne",       "yoann@tuxfamily.org",                 tr("Paquets MAC OS X"));
213 	addAuthor(contributors, "Chipsterjulien",      "",                                    tr("Paquets Archlinux AUR"));
214 	addAuthor(contributors, "Nuno Pinheiro",       "nuno@nuno-icons.com",                 tr("Icônes"));
215 	addAuthor(contributors, "Cyril Frausti",       "cyril@qelectrotech.org",              tr("Développement"));
216 	addAuthor(contributors, "Fernando Mateu Palou de Comasema", "fdomateu@gmail.com",     tr("Documentation"));
217 	addAuthor(contributors, "Arun Kishore Eswara", "eswara.arun@gmail.com",               tr("Documentation"));
218 	addAuthor(contributors, "René Negre",          "runsys@qelectrotech.org",             tr("Développement"));
219 	addAuthor(contributors, "Nuri",                "nuri@qelectrotech.org",               tr("Collection d'éléments"));
220 	addAuthor(contributors, "Raul Roda",           "",                                    tr("Python plugin qet-tb-generator"));
221 
222 	contributors -> setOpenExternalLinks(true);
223 	contributors -> setTextFormat(Qt::RichText);
224 
225 	QWidget *contributors_widget = new QWidget();
226 	QHBoxLayout *contributors_layout = new QHBoxLayout(contributors_widget);
227 	contributors_layout -> addWidget(contributors, 0, Qt::AlignCenter);
228 	return(contributors_widget);
229 }
230 
231 /**
232 	@return The widget content via the "License Agreement" tab
233 */
licenseTab() const234 QWidget *AboutQET::licenseTab() const {
235 	QWidget *license = new QWidget();
236 	// label
237 	QLabel *title_license = new QLabel(tr("Ce programme est sous licence GNU/GPL."));
238 
239 	// Text of the GNU/GPL in a scrollable text box not editable
240 	QTextEdit *text_license = new QTextEdit();
241 	text_license -> setPlainText(QET::license());
242 	text_license -> setReadOnly(true);
243 
244 	// All in a vertical arrangement
245 	QVBoxLayout *license_layout = new QVBoxLayout();
246 	license_layout -> addWidget(title_license);
247 	license_layout -> addWidget(text_license);
248 	license -> setLayout(license_layout);
249 	return(license);
250 }
251 
252 /**
253 	Adds a person to the list of authors
254 	@param label QLabel which will add the person
255 	@param name  Name of person
256 	@param email E-mail address of the person
257 	@param work  Function / work done by the person
258 */
addAuthor(QLabel * label,const QString & name,const QString & email,const QString & work) const259 void AboutQET::addAuthor(QLabel *label, const QString &name, const QString &email, const QString &work) const {
260 	QString new_text = label -> text();
261 
262 	QString author_template = "<span style=\"text-decoration: underline;\">%1</span> : %2 &lt;<a href=\"mailto:%3\">%3</a>&gt;&lrm;<br/><br/>";
263 
264 	// Add the function of the person
265 	new_text += author_template.arg(work).arg(name).arg(email);
266 	label -> setText(new_text);
267 }
268