From a025d325dd63dc789006adc071d0eaf44c5b9f47 Mon Sep 17 00:00:00 2001 From: Romolo Manfredini Date: Sun, 12 Jan 2014 10:14:55 +0100 Subject: [PATCH] Contributor dialog fixed --- companion/src/CMakeLists.txt | 3 +- companion/src/contributorsdialog.cpp | 95 +++++++++++++++++----------- companion/src/contributorsdialog.ui | 15 ++++- 3 files changed, 75 insertions(+), 38 deletions(-) diff --git a/companion/src/CMakeLists.txt b/companion/src/CMakeLists.txt index 318a65524..593443103 100644 --- a/companion/src/CMakeLists.txt +++ b/companion/src/CMakeLists.txt @@ -1,7 +1,7 @@ PROJECT( companion9x ) SET( C9X_VERSION_MAJOR "1" ) -SET( C9X_VERSION_MINOR "51" ) +SET( C9X_VERSION_MINOR "52" ) SET( C9X_VERSION ${C9X_VERSION_MAJOR}.${C9X_VERSION_MINOR} ) CMAKE_MINIMUM_REQUIRED( VERSION 2.8 ) @@ -39,6 +39,7 @@ ENDIF() FIND_PACKAGE( Qt4 REQUIRED ) SET( QT_USE_QTNETWORK True ) SET( QT_USE_QTXML True ) +SET( QT_USE_QTWEBKIT True ) INCLUDE( ${QT_USE_FILE} ) IF ( APPLE ) diff --git a/companion/src/contributorsdialog.cpp b/companion/src/contributorsdialog.cpp index f72685a76..a555c294a 100644 --- a/companion/src/contributorsdialog.cpp +++ b/companion/src/contributorsdialog.cpp @@ -10,54 +10,77 @@ contributorsDialog::contributorsDialog(QWidget *parent, int contest, QString rnu switch (contest) { case 0: { QFile file(":/DONATIONS.txt"); - QString htmlString = ""; - htmlString += ""; + QString str; + str.append(""); + str.append("\n

People who have contributed to this project

"); + str.append(""); + str.append("
"+tr("People who have contributed to this project")+"
"); + str.append(""); if(file.open( QIODevice::ReadOnly | QIODevice::Text ) ) { - int i = 0; - while (!file.atEnd()) { - QByteArray line = file.readLine(); - htmlString += QString(""); - i++; - if (!(i%5)){ - htmlString += ""; - } + int columns=6; + float cwidth=100.0/columns; + while (!file.atEnd()) { + str.append(""); + for (int i=0; i"); + } else { + str.append("class=\"mycss\">"); + } + str.append(line.trimmed()+""); + } else { + str.append("class=\"mycss\"> "); } - htmlString += ""; + } + str.append(""); + } } - - htmlString += ""; + str.append("
") + line + QString("

Coders

"); QFile file2(":/CREDITS.txt"); + str.append(""); + str.append(""); + str.append("
"+tr("Coders")+"
"); + str.append(""); if(file2.open( QIODevice::ReadOnly | QIODevice::Text ) ) { - int i = 0; - while (!file2.atEnd()) { - QByteArray line = file2.readLine(); - htmlString += QString(""); - i++; - if (!(i%5)){ - htmlString += ""; - } + while (!file2.atEnd()) { + str.append(""); + for (int i=0; i<3; i++) { + str.append(""); + } + str.append(""); + } + + str.append(""); + str.append(""); + str.append("
") + line + QString("
"); + if (!file2.atEnd()) { + QByteArray line = file2.readLine(); + str.append(line.trimmed()); + } else { + str.append(" "); } + str.append("
"+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.")+"
"+tr("Thank you all !!!")+"
"); + str.append(""); } - htmlString += ""; - ui->textBrowser->insertHtml(htmlString); - - ui->textBrowser->insertPlainText("\n\n"); - 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.")); - ui->textBrowser->insertPlainText("\n\n"); - ui->textBrowser->insertPlainText(tr("Thank you all !!!")); - ui->textBrowser->setReadOnly(true); - ui->textBrowser->verticalScrollBar()->setValue(0); + ui->webBrowser->setHtml(str,QUrl("")); + ui->webBrowser->scroll(0,0); this->setWindowTitle(tr("Contributors")); } break; case 1:{ - QFile file(":/releasenotes.txt"); + QFile file(":/releasenotes"); if(file.open( QIODevice::ReadOnly | QIODevice::Text ) ) { - ui->textBrowser->insertHtml(file.readAll()); + ui->webBrowser->setHtml(file.readAll(),QUrl("")); } - ui->textBrowser->setReadOnly(true); - ui->textBrowser->verticalScrollBar()->setValue(0); + ui->webBrowser->scroll(0,0); this->setWindowTitle(tr("Companion9x Release Notes")); } break; @@ -80,7 +103,7 @@ contributorsDialog::contributorsDialog(QWidget *parent, int contest, QString rnu void contributorsDialog::showEvent ( QShowEvent * ) { - ui->textBrowser->verticalScrollBar()->setValue(0); + ui->webBrowser->scroll(0,0); } contributorsDialog::~contributorsDialog() @@ -90,7 +113,7 @@ contributorsDialog::~contributorsDialog() void contributorsDialog::replyFinished(QNetworkReply * reply) { - ui->textBrowser->insertHtml(reply->readAll()); + ui->webBrowser->setHtml(reply->readAll(),QUrl("")); } void contributorsDialog::forceClose() { diff --git a/companion/src/contributorsdialog.ui b/companion/src/contributorsdialog.ui index 1c09ba66d..28fc29060 100644 --- a/companion/src/contributorsdialog.ui +++ b/companion/src/contributorsdialog.ui @@ -19,10 +19,23 @@ - + + + + about:blank + + + + + + QWebView + QWidget +
QtWebKit/QWebView
+
+