/*
Copyright 2006-2014 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech 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 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see .
*/
#include
#include "qettabwidget.h"
#include "aboutqet.h"
#include "qet.h"
#include "qeticons.h"
/**
Constructeur
@param parent The parent of the dialog QWidget
*/
AboutQET::AboutQET(QWidget *parent) : QDialog(parent) {
// Titre, taille, comportement...
setWindowTitle(tr("\300 propos de QElectrotech", "window title"));
setMinimumWidth(680);
setMinimumHeight(690);
setModal(true);
// Trois onglets
QETTabWidget *tabs = new QETTabWidget(this);
tabs -> addTab(aboutTab(), tr("\300 &propos", "tab title"));
tabs -> addTab(authorsTab(), tr("A&uteurs", "tab title"));
tabs -> addTab(translatorsTab(), tr("&Traducteurs", "tab title"));
tabs -> addTab(contributorsTab(), tr("&Contributeurs", "tab title"));
tabs -> addTab(licenseTab(), tr("&Accord de licence", "tab title"));
// Un bouton pour fermer la boite de dialogue
QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Close);
connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
connect(buttons, SIGNAL(rejected()), this, SLOT(accept()));
// Le tout dans une disposition verticale
QVBoxLayout *vlayout = new QVBoxLayout();
vlayout -> addWidget(title());
vlayout -> addWidget(tabs);
vlayout -> addWidget(buttons);
setLayout(vlayout);
}
/**
Destructeur
*/
AboutQET::~AboutQET() {
}
/**
@return The title QElectroTech with its icon
*/
QWidget *AboutQET::title() const {
QWidget *icon_and_title = new QWidget();
// icone
QLabel *icon = new QLabel();
icon -> setPixmap(QET::Icons::QETOxygenLogo.pixmap(48, 48));
// label "QElectroTech"
QLabel *title = new QLabel("QElectroTech v" + QET::displayedVersion + "");
QString compilation_info = "
" + tr("Compilation : ") + __DATE__ + " " + __TIME__;
#ifdef __GNUC__
compilation_info += " - GCC " + QString(__VERSION__);
compilation_info += " - built with Qt " + QString(QT_VERSION_STR);
compilation_info += " - run with Qt "+ QString(qVersion());
#endif
title -> setText(title->text() + compilation_info);
title -> setTextFormat(Qt::RichText);
QHBoxLayout *hlayout = new QHBoxLayout();
hlayout -> addWidget(icon);
hlayout -> addWidget(title);
hlayout -> addStretch();
icon_and_title -> setLayout(hlayout);
return(icon_and_title);
}
/**
@return The widget content tab "About"
*/
QWidget *AboutQET::aboutTab() const {
QLabel *about = new QLabel(
tr("QElectroTech, une application de r\351alisation de sch\351mas \351lectriques.", "about tab, description line") +
"
" +
tr("\251 2006-2014 Les d\351veloppeurs de QElectroTech", "about tab, developers line") +
"
"
"http://qelectrotech.org/"
"
" +
tr("Contact\240: qet@lists.tuxfamily.org", "about tab, contact line")
);
about -> setAlignment(Qt::AlignCenter);
about -> setOpenExternalLinks(true);
about -> setTextFormat(Qt::RichText);
return(about);
}
/**
@return The widget content by "Authors" tab
*/
QWidget *AboutQET::authorsTab() const {
QLabel *authors = new QLabel();
addAuthor(authors, "Beno\356t Ansieau", "benoit@qelectrotech.org", tr("Id\351e originale"));
addAuthor(authors, "Laurent Trinques", "scorpio@qelectrotech.org", tr("D\351veloppement"));
addAuthor(authors, "Cyril Frausti", "cyril@qelectrotech.org", tr("D\351veloppement"));
addAuthor(authors, "Joshua Claveau", "Joshua@qelectrotech.org", tr("D\351veloppement"));
addAuthor(authors, "Abhishek Bansal", "abhishek@qelectrotech.org", tr("D\351veloppement"));
authors -> setOpenExternalLinks(true);
authors -> setTextFormat(Qt::RichText);
QWidget *authors_widget = new QWidget();
QHBoxLayout *authors_layout = new QHBoxLayout(authors_widget);
authors_layout -> addWidget(authors, 0, Qt::AlignCenter);
return(authors_widget);
}
/**
@return The widget content via the "Translators" tab
*/
QWidget *AboutQET::translatorsTab() const {
QLabel *translators = new QLabel();
addAuthor(translators, "Alfredo Carreto", "electronicos_mx@yahoo.com.mx",tr("Traduction en espagnol"));
addAuthor(translators, "Yuriy Litkevich", "yuriy@qelectrotech.org", tr("Traduction en russe"));
addAuthor(translators, "Jos\351 Carlos Martins", "jose@qelectrotech.org", tr("Traduction en portugais"));
addAuthor(translators, "Pavel Fric", "pavelfric@seznam.cz", tr("Traduction en tch\350que"));
addAuthor(translators, "Paweł Śmiech", "pawel32640@gmail.com", tr("Traduction en polonais"));
addAuthor(translators, "Markus Budde", "markus.budde@msn.com", tr("Traduction en allemand"));
addAuthor(translators, "Jonas Stein", "news@jonasstein.de", tr("Traduction en allemand"));
addAuthor(translators, "Noah Braden", "", tr("Traduction en allemand"));
addAuthor(translators, "Gabi Mandoc", "gabriel.mandoc@gic.ro", tr("Traduction en roumain"));
addAuthor(translators, "Alessandro Conti", "dr.slump@alexconti.it", tr("Traduction en italien"));
addAuthor(translators, "Silvio", "silvio@qelectrotech.org", tr("Traduction en italien"));
addAuthor(translators, "Mohamed Souabni", "souabnimohamed@yahoo.fr", tr("Traduction en arabe"));
addAuthor(translators, "Antun Maraković", "antun.marakovic@lolaribar.hr",tr("Traduction en croate"));
addAuthor(translators, "Eduard Amor\363s", "amoros@marmenuda.com", tr("Traduction en catalan"));
addAuthor(translators, "Nikos Papadopoylos", "231036448@freemail.gr", tr("Traduction en grec"));
addAuthor(translators, "Yannis Gyftomitros", "yang@hellug.gr", tr("Traduction en grec"));
addAuthor(translators, "Eduard Amoros", "", tr("Traduction en catalan"));
translators -> setOpenExternalLinks(true);
translators -> setTextFormat(Qt::RichText);
QWidget *translators_widget = new QWidget();
QHBoxLayout *translators_layout = new QHBoxLayout(translators_widget);
translators_layout -> addWidget(translators, 0, Qt::AlignCenter);
return(translators_widget);
}
/**
@return The widget content via the "Contributors" tab
*/
QWidget *AboutQET::contributorsTab() const {
QLabel *contributors = new QLabel();
addAuthor(contributors, "Remi Collet", "remi@fedoraproject.org", tr("Paquets Fedora et Red Hat"));
addAuthor(contributors, "Trem", "trem@mageia.org", tr("Paquets Mageia"));
addAuthor(contributors, "Laurent Trinques", "scorpio@qelectrotech.org", tr("Paquets Debian"));
addAuthor(contributors, "Markos Chandras", "hwoarang@gentoo.org.", tr("Paquets Gentoo"));
addAuthor(contributors, "Mbit", "", tr("Paquets Gentoo"));
addAuthor(contributors, "Elbert", "", tr("Paquets OS/2"));
addAuthor(contributors, "zloidemon", "", tr("Paquets FreeBSD"));
addAuthor(contributors, "Chipsterjulien", "", tr("Paquets Archlinux AUR"));
addAuthor(contributors, "Nuno Pinheiro", "nuno@nuno-icons.com", tr("Ic\364nes"));
contributors -> setOpenExternalLinks(true);
contributors -> setTextFormat(Qt::RichText);
QWidget *contributors_widget = new QWidget();
QHBoxLayout *contributors_layout = new QHBoxLayout(contributors_widget);
contributors_layout -> addWidget(contributors, 0, Qt::AlignCenter);
return(contributors_widget);
}
/**
@return The widget content via the "License Agreement" tab
*/
QWidget *AboutQET::licenseTab() const {
QWidget *license = new QWidget();
// label
QLabel *title_license = new QLabel(tr("Ce programme est sous licence GNU/GPL."));
// texte de la GNU/GPL dans une zone de texte scrollable non editable
QTextEdit *text_license = new QTextEdit();
text_license -> setPlainText(QET::license());
text_license -> setReadOnly(true);
// le tout dans une disposition verticale
QVBoxLayout *license_layout = new QVBoxLayout();
license_layout -> addWidget(title_license);
license_layout -> addWidget(text_license);
license -> setLayout(license_layout);
return(license);
}
/**
Adds a person to the list of authors
@param label QLabel which will add the person
@param name Name of person
@param email E-mail address of the person
@param work Function / work done by the person
*/
void AboutQET::addAuthor(QLabel *label, const QString &name, const QString &email, const QString &work) const {
QString new_text = label -> text();
QString author_template = "%1 : %2 <%3>
";
// ajoute la fonction de la personne
new_text += author_template.arg(work).arg(name).arg(email);
label -> setText(new_text);
}