Contributor dialog fixed

This commit is contained in:
Romolo Manfredini
2014-01-12 10:14:55 +01:00
parent 00779bc33a
commit a025d325dd
3 changed files with 75 additions and 38 deletions
+2 -1
View File
@@ -1,7 +1,7 @@
PROJECT( companion9x ) PROJECT( companion9x )
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 )
@@ -39,6 +39,7 @@ ENDIF()
FIND_PACKAGE( Qt4 REQUIRED ) FIND_PACKAGE( Qt4 REQUIRED )
SET( QT_USE_QTNETWORK True ) SET( QT_USE_QTNETWORK True )
SET( QT_USE_QTXML True ) SET( QT_USE_QTXML True )
SET( QT_USE_QTWEBKIT True )
INCLUDE( ${QT_USE_FILE} ) INCLUDE( ${QT_USE_FILE} )
IF ( APPLE ) IF ( APPLE )
+59 -36
View File
@@ -10,54 +10,77 @@ contributorsDialog::contributorsDialog(QWidget *parent, int contest, QString rnu
switch (contest) { switch (contest) {
case 0: { case 0: {
QFile file(":/DONATIONS.txt"); QFile file(":/DONATIONS.txt");
QString htmlString = "<table>"; QString str;
htmlString += "<tr><td colspan=\"5\"><h3>People who have contributed to this project</h3></td></tr><tr>"; str.append("<html><head>");
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 ) ) {
int i = 0; int columns=6;
while (!file.atEnd()) { float cwidth=100.0/columns;
QByteArray line = file.readLine(); while (!file.atEnd()) {
htmlString += QString("<td>") + line + QString("</td>"); str.append("<tr>");
i++; for (int i=0; i<columns; i++) {
if (!(i%5)){ str.append(QString("<td width=\"%1%\" ").arg(cwidth));
htmlString += "</tr><tr>"; 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>");
} }
htmlString += "</tr>"; }
str.append("</tr>");
}
} }
str.append("</table>");
htmlString += "<tr></tr><tr><td colspan=\"5\"><h3>Coders</h3></td></tr><tr>";
QFile file2(":/CREDITS.txt"); QFile file2(":/CREDITS.txt");
str.append("<table width=\"100%\" border=0 cellspacing=0 cellpadding=2>");
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 ) ) {
int i = 0; while (!file2.atEnd()) {
while (!file2.atEnd()) { str.append("<tr>");
QByteArray line = file2.readLine(); for (int i=0; i<3; i++) {
htmlString += QString("<td>") + line + QString("</td>"); str.append("<td width=\"33.33%\" class=\"mycss\">");
i++; if (!file2.atEnd()) {
if (!(i%5)){ QByteArray line = file2.readLine();
htmlString += "</tr><tr>"; str.append(line.trimmed());
} } else {
str.append("&nbsp;");
} }
} str.append("</td>");
htmlString += "</tr></table>"; }
ui->textBrowser->insertHtml(htmlString); str.append("</tr>");
}
ui->textBrowser->insertPlainText("\n\n"); 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>");
ui->textBrowser->insertPlainText(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.")); 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->textBrowser->verticalScrollBar()->setValue(0); ui->webBrowser->setHtml(str,QUrl(""));
ui->webBrowser->scroll(0,0);
this->setWindowTitle(tr("Contributors")); this->setWindowTitle(tr("Contributors"));
} }
break; break;
case 1:{ case 1:{
QFile file(":/releasenotes.txt"); QFile file(":/releasenotes");
if(file.open( QIODevice::ReadOnly | QIODevice::Text ) ) { if(file.open( QIODevice::ReadOnly | QIODevice::Text ) ) {
ui->textBrowser->insertHtml(file.readAll()); ui->webBrowser->setHtml(file.readAll(),QUrl(""));
} }
ui->textBrowser->setReadOnly(true); ui->webBrowser->scroll(0,0);
ui->textBrowser->verticalScrollBar()->setValue(0);
this->setWindowTitle(tr("Companion9x Release Notes")); this->setWindowTitle(tr("Companion9x Release Notes"));
} }
break; break;
@@ -80,7 +103,7 @@ contributorsDialog::contributorsDialog(QWidget *parent, int contest, QString rnu
void contributorsDialog::showEvent ( QShowEvent * ) void contributorsDialog::showEvent ( QShowEvent * )
{ {
ui->textBrowser->verticalScrollBar()->setValue(0); ui->webBrowser->scroll(0,0);
} }
contributorsDialog::~contributorsDialog() contributorsDialog::~contributorsDialog()
@@ -90,7 +113,7 @@ contributorsDialog::~contributorsDialog()
void contributorsDialog::replyFinished(QNetworkReply * reply) void contributorsDialog::replyFinished(QNetworkReply * reply)
{ {
ui->textBrowser->insertHtml(reply->readAll()); ui->webBrowser->setHtml(reply->readAll(),QUrl(""));
} }
void contributorsDialog::forceClose() { void contributorsDialog::forceClose() {
+14 -1
View File
@@ -19,10 +19,23 @@
</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="QWebView" name="webBrowser">
<property name="url">
<url>
<string>about:blank</string>
</url>
</property>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>
<customwidgets>
<customwidget>
<class>QWebView</class>
<extends>QWidget</extends>
<header>QtWebKit/QWebView</header>
</customwidget>
</customwidgets>
<resources> <resources>
<include location="companion9x.qrc"/> <include location="companion9x.qrc"/>
</resources> </resources>