comparison src/AboutDialog.cpp @ 749:65171b865963

A first step toward reducing compile dependencies. git-svn-id: svn://svn.code.sf.net/p/universalindent/code/trunk@1026 59b1889a-e5ac-428c-b0c7-476e01d41282
author thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
date Sat, 02 Oct 2010 12:15:20 +0000
parents ab871460c300
children ac165b6ae67e
comparison
equal deleted inserted replaced
748:8fa147439b3c 749:65171b865963
16 * Free Software Foundation, Inc., * 16 * Free Software Foundation, Inc., *
17 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 17 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
18 ***************************************************************************/ 18 ***************************************************************************/
19 19
20 #include "AboutDialog.h" 20 #include "AboutDialog.h"
21 21 #include "ui_AboutDialog.h"
22 #include "UiGuiVersion.h" 22 #include "UiGuiVersion.h"
23 23
24 #include <QUrl>
25 #include <QDesktopServices>
26 #include <QScrollBar>
27 #include <QTimer>
28
29 #include <QLocale>
24 /*! 30 /*!
25 \class AboutDialog 31 \class AboutDialog
26 \brief Displays a dialog window with information about UniversalIndentGUI 32 \brief Displays a dialog window with information about UniversalIndentGUI
27 */ 33 */
28 34
30 \brief The constructor calls the setup function for the ui created by uic and adds 36 \brief The constructor calls the setup function for the ui created by uic and adds
31 the GPL text to the text edit. 37 the GPL text to the text edit.
32 */ 38 */
33 AboutDialog::AboutDialog(QWidget *parent, Qt::WindowFlags flags) : QDialog(parent, flags) { 39 AboutDialog::AboutDialog(QWidget *parent, Qt::WindowFlags flags) : QDialog(parent, flags) {
34 this->parent = parent; 40 this->parent = parent;
35 setupUi(this); 41 dialogForm = new Ui::AboutDialog();
42 dialogForm->setupUi(this);
36 43
37 authorTextBrowser->setOpenExternalLinks( true ); 44 dialogForm->authorTextBrowser->setOpenExternalLinks( true );
38 creditsTextBrowser->setOpenExternalLinks( true ); 45 dialogForm->creditsTextBrowser->setOpenExternalLinks( true );
39 46
40 QString versionString = versionTextBrowser->toHtml(); 47 QString versionString = dialogForm->versionTextBrowser->toHtml();
41 versionString = versionString.arg(PROGRAM_VERSION_STRING).arg( UiGuiVersion::getBuildRevision() ).arg( UiGuiVersion::getBuildDate() ); 48 versionString = versionString.arg(PROGRAM_VERSION_STRING).arg( UiGuiVersion::getBuildRevision() ).arg( UiGuiVersion::getBuildDate() );
42 versionTextBrowser->setHtml(versionString); 49 dialogForm->versionTextBrowser->setHtml(versionString);
43 50
44 creditsTextBrowser->setHtml("<html><head></head><body>" 51 dialogForm->creditsTextBrowser->setHtml("<html><head></head><body>"
45 "<pre> </br></pre>" 52 "<pre> </br></pre>"
46 "<h3 align='center'>Thanks go out to</h3>" 53 "<h3 align='center'>Thanks go out to</h3>"
47 "<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>" 54 "<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>"
48 "<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>" 55 "<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>"
49 "<p align='center'><a href=\"http://korytskyy.lviv.ua/\"><b>Oleksandr</b></a> for Ukrainian and Russian translation.</p></br>" 56 "<p align='center'><a href=\"http://korytskyy.lviv.ua/\"><b>Oleksandr</b></a> for Ukrainian and Russian translation.</p></br>"
92 /*! 99 /*!
93 \brief Catches language change events and retranslates all needed widgets. 100 \brief Catches language change events and retranslates all needed widgets.
94 */ 101 */
95 void AboutDialog::changeEvent(QEvent *event) { 102 void AboutDialog::changeEvent(QEvent *event) {
96 if (event->type() == QEvent::LanguageChange) { 103 if (event->type() == QEvent::LanguageChange) {
97 retranslateUi(this); 104 dialogForm->retranslateUi(this);
98 105
99 QString versionString = versionTextBrowser->toHtml(); 106 QString versionString = dialogForm->versionTextBrowser->toHtml();
100 versionString = versionString.arg(PROGRAM_VERSION_STRING).arg( UiGuiVersion::getBuildRevision() ).arg( UiGuiVersion::getBuildDate() ); 107 versionString = versionString.arg(PROGRAM_VERSION_STRING).arg( UiGuiVersion::getBuildRevision() ).arg( UiGuiVersion::getBuildDate() );
101 versionTextBrowser->setHtml(versionString); 108 dialogForm->versionTextBrowser->setHtml(versionString);
102 } 109 }
103 else { 110 else {
104 QWidget::changeEvent(event); 111 QWidget::changeEvent(event);
105 } 112 }
106 } 113 }
119 /*! 126 /*!
120 \brief This slot is called each timer timeout to scroll the credits textbrowser. 127 \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. 128 Also changes the scroll direction and speed when reaching the start or end.
122 */ 129 */
123 void AboutDialog::scroll() { 130 void AboutDialog::scroll() {
124 QScrollBar *scrollBar = creditsTextBrowser->verticalScrollBar(); 131 QScrollBar *scrollBar = dialogForm->creditsTextBrowser->verticalScrollBar();
125 scrollBar->setValue( scrollBar->value()+scrollDirection ); 132 scrollBar->setValue( scrollBar->value()+scrollDirection );
126 133
127 if ( scrollBar->value() == scrollBar->maximum() ) { 134 if ( scrollBar->value() == scrollBar->maximum() ) {
128 // Toggle scroll direction and change scroll speed; 135 // Toggle scroll direction and change scroll speed;
129 scrollDirection = -1; 136 scrollDirection = -1;
137 scrollSpeed = 100; 144 scrollSpeed = 100;
138 timer->stop(); 145 timer->stop();
139 timer->start(scrollSpeed); 146 timer->start(scrollSpeed);
140 } 147 }
141 148
142 creditsTextBrowser->update(); 149 dialogForm->creditsTextBrowser->update();
143 } 150 }
144 151
145 152
146 /*! 153 /*!
147 \brief Shows the about dialog and also starts the credits scroller. 154 \brief Shows the about dialog and also starts the credits scroller.