~ubuntu-branches/debian/sid/universalindentgui/sid

« back to all changes in this revision

Viewing changes to src/AboutDialog.cpp~

  • Committer: Bazaar Package Importer
  • Author(s): Fathi Boudra
  • Date: 2009-08-20 13:41:45 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20090820134145-g5wu2b87qz1i9sy9
Tags: 1.1.0-1
* New upstream release.
* Update debian/control:
  - Bump quilt and debhelper build-dependency versions.
  - Bump Standards-Version to 3.8.3 (no changes needed).
* Convert debian/rules to dh usage.
* Rename debian/universalindentgui.lintian to
  debian/universalindentgui.lintian-overrides for dh_lintian usage.
* Add debian/README.source file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
 *   Copyright (C) 2006-2008 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
/*!
 
23
    \class AboutDialog
 
24
    \brief Displays a dialog window with information about UniversalIndentGUI
 
25
*/
 
26
 
 
27
/*!
 
28
    \brief The constructor calls the setup function for the ui created by uic and adds
 
29
    the GPL text to the text edit.
 
30
 */
 
31
AboutDialog::AboutDialog(QWidget *parent, Qt::WindowFlags flags, QString version, QString revision, QString buildDate) : QDialog(parent, flags) {
 
32
    this->parent = parent;
 
33
    qApp->setStyleSheet("QTextBrowser{background-color:transparent}");
 
34
    setupUi(this);
 
35
    creditsTextBrowser->setStyleSheet("QTextBrowser#creditsTextBrowser{background-color:white}");
 
36
 
 
37
    authorTextBrowser->setOpenExternalLinks( true );
 
38
    creditsTextBrowser->setOpenExternalLinks( true );
 
39
 
 
40
    this->version = version;
 
41
    this->revision = revision;
 
42
    this->buildDate = buildDate;
 
43
    QString versionString = versionTextBrowser->toHtml();
 
44
    versionString = versionString.arg(version).arg(revision).arg(buildDate);
 
45
    versionTextBrowser->setHtml(versionString);
 
46
 
 
47
    creditsTextBrowser->setHtml("<html><head></head><body>"
 
48
        "<pre> </br></pre>"
 
49
        "<h3 align='center'>Thanks go out to</h3>"
 
50
        "<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>"
 
51
        "<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>"
 
52
        "<p align='center'><a href=\"http://korytskyy.lviv.ua/\"><b>Oleksandr</b></a> for Ukrainian and Russian translation.</p></br>"
 
53
        "<p align='center'><b>Erwan &quot;leg&quot;</b> for French translation and the new icon logo.</p></br>"
 
54
        "<p align='center'>The <a href=\"http://www.scintilla.org/\"><b>Scintilla</b></a> project for their great text editing component.</p></br>"
 
55
        "<p align='center'><a href=\"http://www.riverbankcomputing.co.uk/software/qscintilla/\"><b>Riverbank</b></a> for their Scintlla Qt wrapper QScintilla.</p></br>"
 
56
        "<p align='center'>The <a href=\"http://astyle.sourceforge.net/\"><b>Artistic Style</b></a> project.</p></br>"
 
57
        "<p align='center'>The <a href=\"http://invisible-island.net/bcpp/\"><b>BCPP</b></a> project.</p></br>"
 
58
        "<p align='center'>The <a href=\"http://www.siber.com/sct/tools/cbl-beau.html\"><b>Cobol Beautifier</b></a> project.</p></br>"
 
59
        "<p align='center'>The <a href=\"http://csstidy.sourceforge.net/\"><b>CSSTidy</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://www.arachnoid.com/ruby/rubyBeautifier.html\"><b>Ruby Beautifier</b></a> project.</p></br>"
 
72
        "<p align='center'>The <a href=\"http://raa.ruby-lang.org/project/ruby_formatter/\"><b>Ruby Formatter</b></a> project.</p></br>"
 
73
        "<p align='center'>The <a href=\"http://www.bolthole.com/AWK.html\"><b>Shell Indent</b></a> project.</p></br>"
 
74
        "<p align='center'>The <a href=\"http://uncrustify.sourceforge.net/\"><b>Uncrustify</b></a> project, specially <b>Ben Gardner</b>.</p></br>"
 
75
        "<p align='center'>The <a href=\"http://xmlindent.sourceforge.net/\"><b>XML Indent</b></a> project.</p></br>"
 
76
        "<p align='center'><b>Nirvash</b> for the initial Japanese translation.</p></br>"
 
77
        "<p align='center'>The <a href=\"http://tango.freedesktop.org/Tango_Desktop_Project/\"><b>Tango Project</b></a> for their icons.</p></br>"
 
78
        "<p align='center'><a href=\"http://www.famfamfam.com/\"><b>famfamfam</b></a> for the flag icons.</p></br>"
 
79
        "<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>"
 
80
        "<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>"
 
81
        "</body></html>");
 
82
 
 
83
    scrollDirection = 1;
 
84
    scrollSpeed = 100;
 
85
    timer = new QTimer(this);
 
86
    connect( timer, SIGNAL(timeout()), this, SLOT(scroll()) );
 
87
    connect( this, SIGNAL(accepted()), timer, SLOT(stop()) );
 
88
}
 
89
 
 
90
 
 
91
/*!
 
92
    \brief Catches language change events and retranslates all needed widgets.
 
93
 */
 
94
void AboutDialog::changeEvent(QEvent *event) {
 
95
    if (event->type() == QEvent::LanguageChange) {
 
96
        retranslateUi(this);
 
97
 
 
98
        QString versionString = versionTextBrowser->toHtml();
 
99
        versionString = versionString.arg(version).arg(revision).arg(buildDate);
 
100
        versionTextBrowser->setHtml(versionString);
 
101
    }
 
102
    else {
 
103
        QWidget::changeEvent(event);
 
104
    }
 
105
}
 
106
 
 
107
 
 
108
/*!
 
109
    \brief Reimplements the dialog execution function to init the credits scroller.
 
110
 */
 
111
int AboutDialog::exec() {
 
112
    //creditsTextBrowser->verticalScrollBar()->setValue(0);
 
113
    timer->start(scrollSpeed);
 
114
    return QDialog::exec();
 
115
}
 
116
 
 
117
 
 
118
/*!
 
119
    \brief This slot is called each timer timeout to scroll the credits textbrowser.
 
120
    Also changes the scroll direction and speed when reaching the start or end.
 
121
 */
 
122
void AboutDialog::scroll() {
 
123
    QScrollBar *scrollBar = creditsTextBrowser->verticalScrollBar();
 
124
    scrollBar->setValue( scrollBar->value()+scrollDirection );
 
125
 
 
126
    if ( scrollBar->value() == scrollBar->maximum() ) {
 
127
        // Toggle scroll direction and change scroll speed;
 
128
        scrollDirection = -1;
 
129
        scrollSpeed = 5;
 
130
        timer->stop();
 
131
        timer->start(scrollSpeed);
 
132
    }
 
133
    else if ( scrollBar->value() == scrollBar->minimum() ) {
 
134
        // Toggle scroll direction and change scroll speed;
 
135
        scrollDirection = 1;
 
136
        scrollSpeed = 100;
 
137
        timer->stop();
 
138
        timer->start(scrollSpeed);
 
139
    }
 
140
 
 
141
    creditsTextBrowser->update();
 
142
}
 
143
 
 
144
 
 
145
/*!
 
146
    \brief Shows the about dialog and also starts the credits scroller.
 
147
 */
 
148
void AboutDialog::show() {
 
149
    timer->start(scrollSpeed);
 
150
    QDialog::show();
 
151
}