UniversalIndentGUI 1.2.0
AboutDialog.cpp
Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2006-2012 by Thomas Schweitzer                          *
00003  *   thomas-schweitzer(at)arcor.de                                         *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License version 2.0 as   *
00007  *   published by the Free Software Foundation.                            *
00008  *                                                                         *
00009  *   This program is distributed in the hope that it will be useful,       *
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00012  *   GNU General Public License for more details.                          *
00013  *                                                                         *
00014  *   You should have received a copy of the GNU General Public License     *
00015  *   along with this program in the file LICENSE.GPL; if not, write to the *
00016  *   Free Software Foundation, Inc.,                                       *
00017  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00018  ***************************************************************************/
00019 
00020 #include "AboutDialog.h"
00021 #include "ui_AboutDialog.h"
00022 
00023 #include "UiGuiVersion.h"
00024 
00025 #include <QUrl>
00026 #include <QDesktopServices>
00027 #include <QScrollBar>
00028 #include <QTimer>
00029 #include <QLocale>
00030 
00040 AboutDialog::AboutDialog(QWidget *parent, Qt::WindowFlags flags) : QDialog(parent, flags)
00041     , _dialogForm(NULL)
00042     , _timer(NULL)
00043  {
00044     _dialogForm = new Ui::AboutDialog();
00045     _dialogForm->setupUi(this);
00046 
00047     _dialogForm->authorTextBrowser->setOpenExternalLinks( true );
00048     _dialogForm->creditsTextBrowser->setOpenExternalLinks( true );
00049 
00050     QString versionString = _dialogForm->versionTextBrowser->toHtml();
00051     versionString = versionString.arg(PROGRAM_VERSION_STRING).arg( UiGuiVersion::getBuildRevision() ).arg( UiGuiVersion::getBuildDate() );
00052     _dialogForm->versionTextBrowser->setHtml(versionString);
00053 
00054     _dialogForm->creditsTextBrowser->setHtml("<html><head></head><body>"
00055         "<pre> </br></pre>"
00056         "<h3 align='center'>Thanks go out to</h3>"
00057         "<p align='center'><a href=\"http://www.csie.nctu.edu.tw/~chtai/\"><b>Nelson Tai</b></a> for Chinese translation, good ideas and always fast answers.</p></br>"
00058         "<p align='center'><a href=\"http://www.hartwork.org/\"><b>Sebastian Pipping</b></a> for helping me bring UiGUI into the Debian repository and other good ideas.</p></br>"
00059         "<p align='center'><a href=\"http://korytskyy.lviv.ua/\"><b>Oleksandr</b></a> for Ukrainian and Russian translation.</p></br>"
00060         "<p align='center'><b>Erwan &quot;leg&quot;</b> for French translation and the icon logo.</p></br>"
00061         "<p align='center'>The <a href=\"http://www.scintilla.org/\"><b>Scintilla</b></a> project for their great text editing component.</p></br>"
00062         "<p align='center'><a href=\"http://www.riverbankcomputing.co.uk/software/qscintilla/\"><b>Riverbank</b></a> for their Scintilla Qt wrapper QScintilla.</p></br>"
00063         "<p align='center'>The <a href=\"http://astyle.sourceforge.net/\"><b>Artistic Style</b></a> project.</p></br>"
00064         "<p align='center'>The <a href=\"http://invisible-island.net/bcpp/\"><b>BCPP</b></a> project.</p></br>"
00065         "<p align='center'>The <a href=\"http://www.siber.com/sct/tools/cbl-beau.html\"><b>Cobol Beautifier</b></a> project.</p></br>"
00066         "<p align='center'>The <a href=\"http://csstidy.sourceforge.net/\"><b>CSSTidy</b></a> project.</p></br>"
00067         "<p align='center'>The <a href=\"ftp://ftp.ifremer.fr/ifremer/ditigo/fortran90/\"><b>Fortran 90 PPR</b></a> project.</p></br>"
00068         "<p align='center'>The <a href=\"http://www.gnu.org/software/indent/\"><b>GNU Indent</b></a> project.</p></br>"
00069         "<p align='center'>The <a href=\"http://sourceforge.net/projects/gcgreatcode/\"><b>GreatCode</b></a> project.</p></br>"
00070         "<p align='center'>The <a href=\"http://linux.com.hk/penguin/man/1/hindent.html\"><b>hindent</b></a> project.</p></br>"
00071         "<p align='center'>The <a href=\"http://www.digital-mines.com/htb/\"><b>HTB</b></a> project.</p></br>"
00072         "<p align='center'>The <a href=\"http://tidy.sourceforge.net/\"><b>HTML Tidy</b></a> project.</p></br>"
00073         "<p align='center'>The <a href=\"http://code.gosu.pl/\"><b>JsDecoder</b></a> project.</p></br>"
00074         "<p align='center'>The <a href=\"http://jsppp.sourceforge.net/\"><b>JSPPP</b></a> project.</p></br>"
00075         "<p align='center'>The <a href=\"http://perltidy.sourceforge.net/\"><b>Perltidy</b></a> project.</p></br>"
00076         "<p align='center'>The <a href=\"http://beautifyphp.sourceforge.net/\"><b>PHP_Beautifier</b></a> project.</p></br>"
00077         "<p align='center'>The <a href=\"http://www.waterproof.fr/products/phpCodeBeautifier/\"><b>phpCB</b></a> project.</p></br>"
00078         "<p align='center'>The <a href=\"http://sourceforge.net/projects/phpstylist/\"><b>PHP Stylist</b></a> project.</p></br>"
00079         "<p align='center'>The <a href=\"http://coverage.livinglogic.de/Tools/scripts/pindent.py.html\"><b>pindent</b></a> project.</p></br>"
00080         "<p align='center'>The <a href=\"http://psti.equinoxbase.com/\"><b>Pl/Sql tidy</b></a> project.</p></br>"
00081         "<p align='center'>The <a href=\"http://www.arachnoid.com/ruby/rubyBeautifier.html\"><b>Ruby Beautifier</b></a> project.</p></br>"
00082         "<p align='center'>The <a href=\"http://raa.ruby-lang.org/project/ruby_formatter/\"><b>Ruby Formatter</b></a> project.</p></br>"
00083         "<p align='center'>The <a href=\"http://www.bolthole.com/AWK.html\"><b>Shell Indent</b></a> project.</p></br>"
00084         "<p align='center'>The <a href=\"http://uncrustify.sourceforge.net/\"><b>Uncrustify</b></a> project, specially <b>Ben Gardner</b>.</p></br>"
00085         "<p align='center'>The <a href=\"http://www.daansystems.com/vbsbeaut/\"><b>VBSBeautifier</b></a> project.</p></br>"
00086         "<p align='center'>The <a href=\"http://xmlindent.sourceforge.net/\"><b>XML Indent</b></a> project.</p></br>"
00087         "<p align='center'><b>Nirvash</b> for the initial Japanese translation.</p></br>"
00088         "<p align='center'>The <a href=\"http://tango.freedesktop.org/Tango_Desktop_Project/\"><b>Tango Project</b></a> for their icons.</p></br>"
00089         "<p align='center'><a href=\"http://www.famfamfam.com/\"><b>famfamfam</b></a> for the flag icons.</p></br>"
00090         "<p align='center'><a href=\"http://trolltech.com/\"><b>Trolltech</b></a> for their really great GUI framework <img src=\":/aboutDialog/qt_logo.png\"/>.</p></br>"
00091         "<h3 align='center'>My girlfriend (meanwhile also wife) for putting my head right and not sit all the time in front of my computer ;-)</h3>"
00092         "</body></html>");
00093 
00094     _scrollDirection = 1;
00095     _scrollSpeed = 100;
00096     _timer = new QTimer(this);
00097     connect( _timer, SIGNAL(timeout()), this, SLOT(scroll()) );
00098     connect( this, SIGNAL(accepted()), _timer, SLOT(stop()) );
00099 }
00100 
00101 
00105 void AboutDialog::changeEvent(QEvent *event) {
00106     if (event->type() == QEvent::LanguageChange) {
00107         _dialogForm->retranslateUi(this);
00108 
00109         QString versionString = _dialogForm->versionTextBrowser->toHtml();
00110         versionString = versionString.arg(PROGRAM_VERSION_STRING).arg( UiGuiVersion::getBuildRevision() ).arg( UiGuiVersion::getBuildDate() );
00111         _dialogForm->versionTextBrowser->setHtml(versionString);
00112     }
00113     else {
00114         QWidget::changeEvent(event);
00115     }
00116 }
00117 
00118 
00122 int AboutDialog::exec() {
00123     //creditsTextBrowser->verticalScrollBar()->setValue(0);
00124     _timer->start(_scrollSpeed);
00125     return QDialog::exec();
00126 }
00127 
00128 
00133 void AboutDialog::scroll() {
00134     QScrollBar *scrollBar = _dialogForm->creditsTextBrowser->verticalScrollBar();
00135     scrollBar->setValue( scrollBar->value()+_scrollDirection );
00136 
00137     if ( scrollBar->value() == scrollBar->maximum() ) {
00138         // Toggle scroll direction and change scroll speed;
00139         _scrollDirection = -1;
00140         _scrollSpeed = 5;
00141         _timer->stop();
00142         _timer->start(_scrollSpeed);
00143     }
00144     else if ( scrollBar->value() == scrollBar->minimum() ) {
00145         // Toggle scroll direction and change scroll speed;
00146         _scrollDirection = 1;
00147         _scrollSpeed = 100;
00148         _timer->stop();
00149         _timer->start(_scrollSpeed);
00150     }
00151 
00152     _dialogForm->creditsTextBrowser->update();
00153 }
00154 
00155 
00159 void AboutDialog::show() {
00160     _timer->start(_scrollSpeed);
00161     QDialog::show();
00162 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines