~ubuntu-branches/ubuntu/maverick/universalindentgui/maverick-proposed

« back to all changes in this revision

Viewing changes to src/AboutDialog.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Fathi Boudra
  • Date: 2009-04-29 10:50:58 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090429105058-7xj26rwxxnir1tr7
Tags: 1.0.2-1
* New upstream release:
  - The default editor font type is now Monospace instead of Courier.
    (Closes: #483873)
* Add 01_disable_check_for_update.diff patch:
  Automatic check for update is disabled by default. (Closes: #514999)
* Bump debian/compat to 7.
* Update debian/control:
  - Set Thomas Schweitzer as maintainer and myself as uploader.
    (Closes: #483068)
  - Bump debhelper build-dependency to 7.
  - Bump Standards-Version to 3.8.1. No changes needed.
  - Update recommended beautifier list.
  - Update description to list all supported beautifiers.
* Update debian/copyright:
  - Add PerlTidy.pm and JsDecoder.js missing copyrights.
* Cleanup debian/rules.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
 *   Copyright (C) 2006-2009 by Thomas Schweitzer                          *
 
3
 *   thomas-schweitzer(at)arcor.de                                         *
 
4
 *                                                                         *
 
5
 *   This program is free software; you can redistribute it and/or modify  *
 
6
 *   it under the terms of the GNU General Public License version 2.0 as   *
 
7
 *   published by the Free Software Foundation.                            *
 
8
 *                                                                         *
 
9
 *   This program is distributed in the hope that it will be useful,       *
 
10
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 
11
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 
12
 *   GNU General Public License for more details.                          *
 
13
 *                                                                         *
 
14
 *   You should have received a copy of the GNU General Public License     *
 
15
 *   along with this program in the file LICENSE.GPL; if not, write to the *
 
16
 *   Free Software Foundation, Inc.,                                       *
 
17
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 
18
 ***************************************************************************/
 
19
 
 
20
#include "AboutDialog.h"
 
21
 
 
22
#include "UiGuiVersion.h"
 
23
 
 
24
/*!
 
25
    \class AboutDialog
 
26
    \brief Displays a dialog window with information about UniversalIndentGUI
 
27
*/
 
28
 
 
29
/*!
 
30
    \brief The constructor calls the setup function for the ui created by uic and adds
 
31
    the GPL text to the text edit.
 
32
 */
 
33
AboutDialog::AboutDialog(QWidget *parent, Qt::WindowFlags flags) : QDialog(parent, flags) {
 
34
    this->parent = parent;
 
35
    qApp->setStyleSheet("QTextBrowser{background-color:transparent}");
 
36
    setupUi(this);
 
37
    creditsTextBrowser->setStyleSheet("QTextBrowser#creditsTextBrowser{background-color:white}");
 
38
 
 
39
    authorTextBrowser->setOpenExternalLinks( true );
 
40
    creditsTextBrowser->setOpenExternalLinks( true );
 
41
 
 
42
    QString versionString = versionTextBrowser->toHtml();
 
43
    versionString = versionString.arg(PROGRAM_VERSION_STRING).arg( UiGuiVersion::getBuildRevision() ).arg( UiGuiVersion::getBuildDate() );
 
44
    versionTextBrowser->setHtml(versionString);
 
45
 
 
46
    creditsTextBrowser->setHtml("<html><head></head><body>"
 
47
        "<pre> </br></pre>"
 
48
        "<h3 align='center'>Thanks go out to</h3>"
 
49
        "<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>"
 
50
        "<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>"
 
51
        "<p align='center'><a href=\"http://korytskyy.lviv.ua/\"><b>Oleksandr</b></a> for Ukrainian and Russian translation.</p></br>"
 
52
        "<p align='center'><b>Erwan &quot;leg&quot;</b> for French translation and the new icon logo.</p></br>"
 
53
        "<p align='center'>The <a href=\"http://www.scintilla.org/\"><b>Scintilla</b></a> project for their great text editing component.</p></br>"
 
54
        "<p align='center'><a href=\"http://www.riverbankcomputing.co.uk/software/qscintilla/\"><b>Riverbank</b></a> for their Scintlla Qt wrapper QScintilla.</p></br>"
 
55
        "<p align='center'>The <a href=\"http://astyle.sourceforge.net/\"><b>Artistic Style</b></a> project.</p></br>"
 
56
        "<p align='center'>The <a href=\"http://invisible-island.net/bcpp/\"><b>BCPP</b></a> project.</p></br>"
 
57
        "<p align='center'>The <a href=\"http://www.siber.com/sct/tools/cbl-beau.html\"><b>Cobol Beautifier</b></a> project.</p></br>"
 
58
        "<p align='center'>The <a href=\"http://csstidy.sourceforge.net/\"><b>CSSTidy</b></a> project.</p></br>"
 
59
        "<p align='center'>The <a href=\"ftp://ftp.ifremer.fr/ifremer/ditigo/fortran90/\"><b>Fortran 90 PPR</b></a> project.</p></br>"
 
60
        "<p align='center'>The <a href=\"http://www.gnu.org/software/indent/\"><b>GNU Indent</b></a> project.</p></br>"
 
61
        "<p align='center'>The <a href=\"http://sourceforge.net/projects/gcgreatcode/\"><b>GreatCode</b></a> project.</p></br>"
 
62
        "<p align='center'>The <a href=\"http://linux.com.hk/penguin/man/1/hindent.html\"><b>hindent</b></a> project.</p></br>"
 
63
        "<p align='center'>The <a href=\"http://www.digital-mines.com/htb/\"><b>HTB</b></a> project.</p></br>"
 
64
        "<p align='center'>The <a href=\"http://tidy.sourceforge.net/\"><b>HTML Tidy</b></a> project.</p></br>"
 
65
        "<p align='center'>The <a href=\"http://code.gosu.pl/\"><b>JsDecoder</b></a> project.</p></br>"
 
66
        "<p align='center'>The <a href=\"http://jsppp.sourceforge.net/\"><b>JSPPP</b></a> project.</p></br>"
 
67
        "<p align='center'>The <a href=\"http://perltidy.sourceforge.net/\"><b>Perltidy</b></a> project.</p></br>"
 
68
        "<p align='center'>The <a href=\"http://beautifyphp.sourceforge.net/\"><b>PHP_Beautifier</b></a> project.</p></br>"
 
69
        "<p align='center'>The <a href=\"http://www.waterproof.fr/products/phpCodeBeautifier/\"><b>phpCB</b></a> project.</p></br>"
 
70
        "<p align='center'>The <a href=\"http://sourceforge.net/projects/phpstylist/\"><b>PHP Stylist</b></a> project.</p></br>"
 
71
        "<p align='center'>The <a href=\"http://coverage.livinglogic.de/Tools/scripts/pindent.py.html\"><b>pindent</b></a> project.</p></br>"
 
72
        "<p align='center'>The <a href=\"http://www.arachnoid.com/ruby/rubyBeautifier.html\"><b>Ruby Beautifier</b></a> project.</p></br>"
 
73
        "<p align='center'>The <a href=\"http://raa.ruby-lang.org/project/ruby_formatter/\"><b>Ruby Formatter</b></a> project.</p></br>"
 
74
        "<p align='center'>The <a href=\"http://www.bolthole.com/AWK.html\"><b>Shell Indent</b></a> project.</p></br>"
 
75
        "<p align='center'>The <a href=\"http://uncrustify.sourceforge.net/\"><b>Uncrustify</b></a> project, specially <b>Ben Gardner</b>.</p></br>"
 
76
        "<p align='center'>The <a href=\"http://xmlindent.sourceforge.net/\"><b>XML Indent</b></a> project.</p></br>"
 
77
        "<p align='center'><b>Nirvash</b> for the initial Japanese translation.</p></br>"
 
78
        "<p align='center'>The <a href=\"http://tango.freedesktop.org/Tango_Desktop_Project/\"><b>Tango Project</b></a> for their icons.</p></br>"
 
79
        "<p align='center'><a href=\"http://www.famfamfam.com/\"><b>famfamfam</b></a> for the flag icons.</p></br>"
 
80
        "<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>"
 
81
        "<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>"
 
82
        "</body></html>");
 
83
 
 
84
    scrollDirection = 1;
 
85
    scrollSpeed = 100;
 
86
    timer = new QTimer(this);
 
87
    connect( timer, SIGNAL(timeout()), this, SLOT(scroll()) );
 
88
    connect( this, SIGNAL(accepted()), timer, SLOT(stop()) );
 
89
}
 
90
 
 
91
 
 
92
/*!
 
93
    \brief Catches language change events and retranslates all needed widgets.
 
94
 */
 
95
void AboutDialog::changeEvent(QEvent *event) {
 
96
    if (event->type() == QEvent::LanguageChange) {
 
97
        retranslateUi(this);
 
98
 
 
99
        QString versionString = versionTextBrowser->toHtml();
 
100
        versionString = versionString.arg(PROGRAM_VERSION_STRING).arg( UiGuiVersion::getBuildRevision() ).arg( UiGuiVersion::getBuildDate() );
 
101
        versionTextBrowser->setHtml(versionString);
 
102
    }
 
103
    else {
 
104
        QWidget::changeEvent(event);
 
105
    }
 
106
}
 
107
 
 
108
 
 
109
/*!
 
110
    \brief Reimplements the dialog execution function to init the credits scroller.
 
111
 */
 
112
int AboutDialog::exec() {
 
113
    //creditsTextBrowser->verticalScrollBar()->setValue(0);
 
114
    timer->start(scrollSpeed);
 
115
    return QDialog::exec();
 
116
}
 
117
 
 
118
 
 
119
/*!
 
120
    \brief This slot is called each timer timeout to scroll the credits textbrowser.
 
121
    Also changes the scroll direction and speed when reaching the start or end.
 
122
 */
 
123
void AboutDialog::scroll() {
 
124
    QScrollBar *scrollBar = creditsTextBrowser->verticalScrollBar();
 
125
    scrollBar->setValue( scrollBar->value()+scrollDirection );
 
126
 
 
127
    if ( scrollBar->value() == scrollBar->maximum() ) {
 
128
        // Toggle scroll direction and change scroll speed;
 
129
        scrollDirection = -1;
 
130
        scrollSpeed = 5;
 
131
        timer->stop();
 
132
        timer->start(scrollSpeed);
 
133
    }
 
134
    else if ( scrollBar->value() == scrollBar->minimum() ) {
 
135
        // Toggle scroll direction and change scroll speed;
 
136
        scrollDirection = 1;
 
137
        scrollSpeed = 100;
 
138
        timer->stop();
 
139
        timer->start(scrollSpeed);
 
140
    }
 
141
 
 
142
    creditsTextBrowser->update();
 
143
}
 
144
 
 
145
 
 
146
/*!
 
147
    \brief Shows the about dialog and also starts the credits scroller.
 
148
 */
 
149
void AboutDialog::show() {
 
150
    timer->start(scrollSpeed);
 
151
    QDialog::show();
 
152
}