Skip to content

Commit

Permalink
Added shuffling of authors in About dialog.
Browse files Browse the repository at this point in the history
  • Loading branch information
in3otd committed Jun 3, 2015
1 parent 3a5c0da commit b48a6f0
Show file tree
Hide file tree
Showing 2 changed files with 142 additions and 61 deletions.
176 changes: 116 additions & 60 deletions qucs/qucs/dialogs/aboutdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@
* \brief Implementation of the About dialog
*/

#include <array>
#include <algorithm>
#include <random>

#include <iostream>
#include <string>

#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
Expand All @@ -37,27 +44,81 @@
#include <QTextBrowser>
#include <QLabel>
#include <QPushButton>
#include <QDebug>


AboutDialog::AboutDialog(QWidget *parent)
: QDialog(parent)
{
currAuths = {{
tr("Guilherme Brondani Torri - GUI programmer, Verilog-A dynamic loader"),
tr("Mike Brinson - testing, modelling and documentation, tutorial contributor"),
tr("Richard Crozier - testing, modelling, Octave."),
tr("Bastien Roucaries - bondwire and rectangular waveguide model implementation"),
tr("Frans Schreuder - GUI programmer, release"),
tr("Clemens Novak - GUI programmer"),
tr("Vadim Kuznetsov - filter synthesis (qucs-activefilter), SPICE integration (NGSPICE, Xyce)"),
tr("You-Tang Lee (YodaLee) - GUI programmer, Qt4 porter")
}};

prevDevs = {{
tr("Michael Margraf - founder of the project, GUI programmer"),
tr("Stefan Jahn - Programmer of simulator"),
tr("Jens Flucke - webpages and translator"),
tr("Raimund Jacob - tester and applyer of Stefan's patches, author of documentation"),
tr("Vincent Habchi - coplanar line and filter synthesis code, documentation contributor"),
tr("Toyoyuki Ishikawa - some filter synthesis code and attenuator synthesis"),
tr("Gopala Krishna A - GUI programmer, Qt4 porter"),
tr("Helene Parruitte - programmer of the Verilog-AMS interface"),
tr("Gunther Kraut - equation solver contributions, exponential sources, author of documentation"),
tr("Andrea Zonca - temperature model for rectangular waveguide")
}};

trAuths = {{
tr("German by Stefan Jahn"),
tr("Polish by Dariusz Pienkowski"),
tr("Romanian by Radu Circa"),
tr("French by Vincent Habchi, F5RCS"),
tr("Portuguese by Luciano Franca, Helio de Sousa, Guilherme Brondani Torri"),
tr("Spanish by Jose L. Redrejo Rodriguez"),
tr("Japanese by Toyoyuki Ishikawa"),
tr("Italian by Giorgio Luparia and Claudio Girardi"),
tr("Hebrew by Dotan Nahum"),
tr("Swedish by Markus Gothe and Peter Landgren"),
tr("Turkish by Onur and Ozgur Cobanoglu"),
tr("Hungarian by Jozsef Bus"),
tr("Russian by Igor Gorbounov"),
tr("Czech by Marek Straka and Martin Stejskal"),
tr("Catalan by Antoni Subirats"),
tr("Ukrainian by Dystryk"),
tr("Arabic by Chabane Noureddine"),
tr("Kazakh by Erbol Keshubaev")
}};


std::shuffle(currAuths.begin(), currAuths.end(), rng);

QLabel *lbl;

setWindowTitle(tr("About Qucs"));

all = new QVBoxLayout(this);
//all->setContentsMargins(0,0,0,0);
//all->setSpacing(0);

QLabel *iconLabel = new QLabel();
iconLabel->setPixmap(QPixmap(QString(":/bitmaps/hicolor/128x128/apps/qucs.png")));

QWidget *hbox = new QWidget();
QHBoxLayout *hl = new QHBoxLayout(hbox);
hl->setContentsMargins(0,0,0,0);

hl->addWidget(iconLabel);
all->addWidget(hbox);

QWidget *vbox = new QWidget();
QVBoxLayout *vl = new QVBoxLayout(vbox);
//vl->setContentsMargins(0,0,0,0);
hl->addWidget(vbox);

QString versionText;
Expand All @@ -78,72 +139,19 @@ AboutDialog::AboutDialog(QWidget *parent)

lbl = new QLabel("\nThis is free software; see the source for copying conditions."
"\nThere is NO warranty; not even for MERCHANTABILITY or "
"\nFITNESS FOR A PARTICULAR PURPOSE.\n\n");
"\nFITNESS FOR A PARTICULAR PURPOSE.\n");
lbl->setAlignment(Qt::AlignHCenter);
all->addWidget(lbl);

QTabWidget *t = new QTabWidget();
all->addWidget(t);
connect(t, SIGNAL(currentChanged(int)), this, SLOT(currentChangedSlot(int)));


authorsBrowser = new QTextBrowser;
trBrowser = new QTextBrowser;

QString authorsText;
authorsText =
tr("Current Qucs Team:") +
"<ul>" +
"<li>" + tr("Guilherme Brondani Torri - GUI programmer, Verilog-A dynamic loader") + "</li>" +
"<li>" + tr("Mike Brinson - testing, modelling and documentation, tutorial contributor") + "</li>" +
"<li>" + tr("Richard Crozier - testing, modelling, Octave.") + "</li>" +
"<li>" + tr("Bastien Roucaries - bondwire and rectangular waveguide model implementation") + "</li>" +
"<li>" + tr("Frans Schreuder - GUI programmer, release") + "</li>" +
"<li>" + tr("Clemens Novak - GUI programmer") + "</li>" +
"<li>" + tr("Vadim Kuznetsov - filter synthesis (qucs-activefilter), SPICE integration (NGSPICE, Xyce)") + "</li>" +
"<li>" + tr("You-Tang Lee (YodaLee) - GUI programmer, Qt4 porter") + "</li>" +
"</ul>" +
tr("Previous Developers") +
"<ul>" +
"<li>" + tr("Michael Margraf - founder of the project, GUI programmer") + "</li>" +
"<li>" + tr("Stefan Jahn - Programmer of simulator") + "</li>" +
"<li>" + tr("Jens Flucke - webpages and translator") + "</li>" +
"<li>" + tr("Raimund Jacob - tester and applyer of Stefan's patches, author of documentation") + "</li>" +
"<li>" + tr("Vincent Habchi - coplanar line and filter synthesis code, documentation contributor") + "</li>" +
"<li>" + tr("Toyoyuki Ishikawa - some filter synthesis code and attenuator synthesis") + "</li>" +
"<li>" + tr("Gopala Krishna A - GUI programmer, Qt4 porter") + "</li>" +
"<li>" + tr("Helene Parruitte - programmer of the Verilog-AMS interface") + "</li>" +
"<li>" + tr("Gunther Kraut - equation solver contributions, exponential sources, author of documentation") + "</li>" +
"<li>" + tr("Andrea Zonca - temperature model for rectangular waveguide") + "</li>" +
"</ul>";

QTextBrowser *authorsBrowser = new QTextBrowser;

authorsBrowser->setHtml(authorsText);

QString thanksText;
thanksText = "TBD";

QString trText;
trText = tr("GUI translations :") +
"<ul>" +
"<li>" + tr("German by Stefan Jahn") + "</li>"+
"<li>" + tr("Polish by Dariusz Pienkowski") + "</li>" +
"<li>" + tr("Romanian by Radu Circa") + "</li>" +
"<li>" + tr("French by Vincent Habchi, F5RCS") + "</li>" +
"<li>" + tr("Portuguese by Luciano Franca, Helio de Sousa, Guilherme Brondani Torri") + "</li>" +
"<li>" + tr("Spanish by Jose L. Redrejo Rodriguez") + "</li>" +
"<li>" + tr("Japanese by Toyoyuki Ishikawa") + "</li>" +
"<li>" + tr("Italian by Giorgio Luparia and Claudio Girardi") + "</li>" +
"<li>" + tr("Hebrew by Dotan Nahum") + "</li>" +
"<li>" + tr("Swedish by Markus Gothe and Peter Landgren") + "</li>" +
"<li>" + tr("Turkish by Onur and Ozgur Cobanoglu") + "</li>" +
"<li>" + tr("Hungarian by Jozsef Bus") + "</li>" +
"<li>" + tr("Russian by Igor Gorbounov") + "</li>" +
"<li>" + tr("Czech by Marek Straka and Martin Stejskal") + "</li>" +
"<li>" + tr("Catalan by Antoni Subirats") + "</li>" +
"<li>" + tr("Ukrainian by Dystryk") + "</li>" +
"<li>" + tr("Arabic by Chabane Noureddine") + "</li>" +
"<li>" + tr("Kazakh by Erbol Keshubaev") + "</li>" +
"</ul>";

QTextBrowser *trBrowser = new QTextBrowser;
trBrowser->setHtml(trText);

QString supportText;
// link to home page, help mailing list, IRC ?
Expand All @@ -170,11 +178,59 @@ AboutDialog::AboutDialog(QWidget *parent)

QWidget *hbBtn = new QWidget();
QHBoxLayout *hlBtn = new QHBoxLayout(hbBtn);
hlBtn->setContentsMargins(0,0,0,0);
all->addWidget(hbBtn);

QPushButton *okButton = new QPushButton(tr("&OK"), parent);
okButton->setFocus();
connect(okButton, SIGNAL(clicked()), this, SLOT(close()));
hlBtn->addStretch();
hlBtn->addWidget(okButton);

setAuthorsText();
setTrText();
prevTab = 0; // first Tab is selected by default
}

void AboutDialog::currentChangedSlot(int index) {
if (prevTab == 0) { // deselected tab with current and previous authors
// shuffle them
std::shuffle(currAuths.begin(), currAuths.end(), rng);
std::shuffle(prevDevs.begin(), prevDevs.end(), rng);
setAuthorsText();
} else if (prevTab == 1) {// deselected tab with translators
std::shuffle(trAuths.begin(), trAuths.end(), rng);
setTrText();
}

prevTab = index;
}

void AboutDialog::setAuthorsText() {

QString authorsText;
authorsText = tr("Current Qucs Team:") + "<ul>";

for(QString& tStr : currAuths) {
authorsText += ("<li>" + tStr + "</li>");
}
authorsText += "</ul>";
authorsText += tr("Previous Developers") + "<ul>";
for(QString& tStr : prevDevs) {
authorsText += ("<li>" + tStr + "</li>");
}
authorsText += "</ul>";

authorsBrowser->setHtml(authorsText);
}

void AboutDialog::setTrText() {
QString trText;
trText = tr("GUI translations :") + "<ul>";
for(QString& tStr : trAuths) {
trText += ("<li>" + tStr + "</li>");
}
trText += "</ul>";

trBrowser->setHtml(trText);
}
27 changes: 26 additions & 1 deletion qucs/qucs/dialogs/aboutdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,40 @@
#ifndef ABOUTDIALOG_H
#define ABOUTDIALOG_H

#include <random>
#include <array>

#include <QDialog>
#include <QVBoxLayout>

class QString;
class QTextBrowser;

class AboutDialog : public QDialog {
Q_OBJECT

public:
AboutDialog(QWidget *parent = 0);
private:

private:
void setAuthorsText(void);
void setTrText(void);

std::array<QString, 8> currAuths; // current Qucs authors
std::array<QString, 10> prevDevs; // previous Qucs developers
std::array<QString, 18> trAuths; // Qucs translators

QVBoxLayout *all;
QTextBrowser *authorsBrowser; // to show authors
QTextBrowser *trBrowser; // to show translators

int prevTab; // previously selected tab

std::mt19937 rng {std::random_device{}()}; // random number generator

public slots:
void currentChangedSlot(int index); // tab selection changed

};

#endif

0 comments on commit b48a6f0

Please sign in to comment.