Merge pull request #564 from opentx/romolo/fix_and_improve_contributors_dialog_506

Fixes #506
This commit is contained in:
Bertrand Songis
2014-01-19 13:07:35 -08:00
4 changed files with 72 additions and 33 deletions
+3 -3
View File
@@ -95,8 +95,8 @@ Heinrich Illig
Michael Collins Michael Collins
Michael Manning Michael Manning
Craig Lorentz Craig Lorentz
Jonathan Modellismo - http://jonathan.it Jonathan Modellismo - jonathan.it
Aviomotive - http://www.aviomotive.com Aviomotive - www.aviomotive.com
André Lasseret André Lasseret
Felipe Alexandre de Oliveira Felipe Alexandre de Oliveira
Brian Harris Brian Harris
@@ -126,7 +126,7 @@ Larisa Filocamo
Alex Calderhead Alex Calderhead
Hartmut Sahm Hartmut Sahm
Åke Brodin Åke Brodin
Aloft Hobbies - http://www.alofthobbies.com Aloft Hobbies - www.alofthobbies.com
Ted Moss Ted Moss
Filippos Tigarakis Filippos Tigarakis
Chewytm Chewytm
+1 -1
View File
@@ -1,7 +1,7 @@
PROJECT( companion ) PROJECT( companion )
SET( C9X_VERSION_MAJOR "1" ) SET( C9X_VERSION_MAJOR "1" )
SET( C9X_VERSION_MINOR "51" ) SET( C9X_VERSION_MINOR "52" )
SET( C9X_VERSION ${C9X_VERSION_MAJOR}.${C9X_VERSION_MINOR} ) SET( C9X_VERSION ${C9X_VERSION_MAJOR}.${C9X_VERSION_MINOR} )
CMAKE_MINIMUM_REQUIRED( VERSION 2.8 ) CMAKE_MINIMUM_REQUIRED( VERSION 2.8 )
+65 -26
View File
@@ -1,7 +1,6 @@
#include "contributorsdialog.h" #include "contributorsdialog.h"
#include "ui_contributorsdialog.h" #include "ui_contributorsdialog.h"
#include <QtGui> #include <QtGui>
#define CLINESEP "=====================================================\n"
contributorsDialog::contributorsDialog(QWidget *parent, int contest, QString rnurl) : contributorsDialog::contributorsDialog(QWidget *parent, int contest, QString rnurl) :
QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint), QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
@@ -10,40 +9,80 @@ contributorsDialog::contributorsDialog(QWidget *parent, int contest, QString rnu
ui->setupUi(this); ui->setupUi(this);
switch (contest) { switch (contest) {
case 0: { case 0: {
ui->textBrowser->insertPlainText(CLINESEP); QFile file(":/DONATIONS.txt");
ui->textBrowser->insertPlainText(tr("People who have contributed to this project")+"\n"); QString str;
ui->textBrowser->insertPlainText(CLINESEP); str.append("<html><head>");
QFile file(":/contributors"); str.append("<style type=\"text/css\">\n");
str.append(".mycss\n{\nfont-weight:normal;\ncolor:#000000;vertical-align: top;font-size:10px;text-align:left;font-family:arial, helvetica, sans-serif;\n}\n");
str.append(".mycssb\n{\nfont-weight:bold;\ncolor:#C00000;vertical-align: top;font-size:10px;text-align:left;font-family:arial, helvetica, sans-serif;\n}\n");
str.append(".myhead\n{\nfont-weight:bold;\ncolor:#000000;font-size:14px;text-align:left;font-family:arial, helvetica, sans-serif;\n}\n");
str.append("</style>\n</head><body class=\"mycss\"><table width=\"100%\" border=0 cellspacing=0 cellpadding=2>");
str.append("<tr><td class=\"myhead\">"+tr("People who have contributed to this project")+"</td></tr>");
str.append("</table>");
str.append("<table width=\"100%\" border=0 cellspacing=0 cellpadding=2>");
if(file.open( QIODevice::ReadOnly | QIODevice::Text ) ) { if(file.open( QIODevice::ReadOnly | QIODevice::Text ) ) {
ui->textBrowser->insertPlainText(file.readAll()); int columns=6;
float cwidth=100.0/columns;
while (!file.atEnd()) {
str.append("<tr>");
for (int i=0; i<columns; i++) {
str.append(QString("<td width=\"%1%\" ").arg(cwidth));
if (!file.atEnd()) {
QByteArray line = file.readLine();
if (line.contains("monthly") || line.contains("mensual")) {
str.append("class=\"mycssb\">");
} else {
str.append("class=\"mycss\">");
}
str.append(line.trimmed()+"</td>");
} else {
str.append("class=\"mycss\">&nbsp;</td>");
}
}
str.append("</tr>");
}
} }
ui->textBrowser->insertPlainText("\n"); str.append("</table>");
ui->textBrowser->insertPlainText(CLINESEP); QFile file2(":/CREDITS.txt");
ui->textBrowser->insertPlainText(tr("Coders")+"\n"); str.append("<table width=\"100%\" border=0 cellspacing=0 cellpadding=2>");
ui->textBrowser->insertPlainText(CLINESEP); str.append("<tr><td class=\"mycss\">&nbsp;</td></tr>");
QFile file2(":/coders"); str.append("<tr><td class=\"myhead\">"+tr("Coders")+"</td></tr>");
str.append("</table>");
str.append("<table width=\"100%\" border=0 cellspacing=0 cellpadding=2>");
if(file2.open( QIODevice::ReadOnly | QIODevice::Text ) ) { if(file2.open( QIODevice::ReadOnly | QIODevice::Text ) ) {
ui->textBrowser->insertPlainText(file2.readAll()); while (!file2.atEnd()) {
str.append("<tr>");
for (int i=0; i<3; i++) {
str.append("<td width=\"33.33%\" class=\"mycss\">");
if (!file2.atEnd()) {
QByteArray line = file2.readLine();
str.append(line.trimmed());
} else {
str.append("&nbsp;");
}
str.append("</td>");
}
str.append("</tr>");
}
} }
ui->textBrowser->insertPlainText("\n\n\n"); str.append("<tr><td class=\"mycss\">&nbsp;</td></tr>");
ui->textBrowser->insertPlainText(tr( str.append("<tr><td colspan=3 class=\"mycss\">"+tr("Honors go to Rafal Tomczak (RadioClone) and Thomas Husterer (th9x) \nof course. Also to Erez Raviv (er9x) and it's fantastic eePe, from which\ncompanion9x was forked out.")+"</td></tr>");
"Honors go to Rafal Tomczak (RadioClone) and Thomas Husterer (th9x) \nof course. Also to Erez Raviv (er9x) and the fantastic eePe program \nwhich was the staring point for OpenTX Companion.")); str.append("<tr><td colspan=3 class=\"mycss\">"+tr("Thank you all !!!")+"</td></tr>");
ui->textBrowser->insertPlainText("\n\n"); str.append("</table>");
ui->textBrowser->insertPlainText(tr("Thank you all !!!")); str.append("</body></html>");
ui->textBrowser->setReadOnly(true); ui->textEditor->setHtml(str);
ui->textBrowser->verticalScrollBar()->setValue(0); ui->textEditor->scroll(0,0);
this->setWindowTitle(tr("Contributors")); this->setWindowTitle(tr("Contributors"));
} }
break; break;
case 1:{ case 1:{
QFile file(":/releasenotes"); QFile file(":/releasenotes.txt");
if(file.open( QIODevice::ReadOnly | QIODevice::Text ) ) { if(file.open( QIODevice::ReadOnly | QIODevice::Text ) ) {
ui->textBrowser->insertHtml(file.readAll()); ui->textEditor->setHtml(file.readAll());
} }
ui->textBrowser->setReadOnly(true); ui->textEditor->scroll(0,0);
ui->textBrowser->verticalScrollBar()->setValue(0); this->setWindowTitle(tr("Companion9x Release Notes"));
this->setWindowTitle(tr("Companion Release Notes"));
} }
break; break;
case 2:{ case 2:{
@@ -65,7 +104,7 @@ contributorsDialog::contributorsDialog(QWidget *parent, int contest, QString rnu
void contributorsDialog::showEvent ( QShowEvent * ) void contributorsDialog::showEvent ( QShowEvent * )
{ {
ui->textBrowser->verticalScrollBar()->setValue(0); ui->textEditor->scroll(0,0);
} }
contributorsDialog::~contributorsDialog() contributorsDialog::~contributorsDialog()
@@ -75,7 +114,7 @@ contributorsDialog::~contributorsDialog()
void contributorsDialog::replyFinished(QNetworkReply * reply) void contributorsDialog::replyFinished(QNetworkReply * reply)
{ {
ui->textBrowser->insertHtml(reply->readAll()); ui->textEditor->setHtml(reply->readAll());
} }
void contributorsDialog::forceClose() { void contributorsDialog::forceClose() {
+3 -3
View File
@@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>926</width> <width>788</width>
<height>333</height> <height>528</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@@ -19,7 +19,7 @@
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0"> <item row="0" column="0">
<widget class="QTextBrowser" name="textBrowser"/> <widget class="QTextEdit" name="textEditor"/>
</item> </item>
</layout> </layout>
</widget> </widget>