1 /*****************************************************************************
2 * Help.cpp : Help and About dialogs
3 ****************************************************************************
4 * Copyright (C) 2007 the VideoLAN team
7 * Authors: Jean-Baptiste Kempf <jb (at) videolan.org>
8 * RĂ©mi Duraffort <ivoire (at) via.ecp.fr>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
27 #include "dialogs/help.hpp"
28 #include <vlc_about.h>
31 #include <vlc_update.h>
34 #include "dialogs_provider.hpp"
36 #include <vlc_intf_strings.h>
38 #include <QTextBrowser>
43 #include <QDialogButtonBox>
46 HelpDialog *HelpDialog::instance = NULL;
48 HelpDialog::HelpDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
50 setWindowTitle( qtr( "Help" ) );
53 QGridLayout *layout = new QGridLayout( this );
54 QTextBrowser *helpBrowser = new QTextBrowser( this );
55 helpBrowser->setOpenExternalLinks( true );
56 helpBrowser->setHtml( I_LONGHELP );
57 QPushButton *closeButton = new QPushButton( qtr( "&Close" ) );
58 closeButton->setDefault( true );
60 layout->addWidget( helpBrowser, 0, 0, 1, 0 );
61 layout->addWidget( closeButton, 1, 3 );
63 BUTTONACT( closeButton, close() );
66 HelpDialog::~HelpDialog()
69 void HelpDialog::close()
71 this->toggleVisible();
74 AboutDialog *AboutDialog::instance = NULL;
76 AboutDialog::AboutDialog( intf_thread_t *_p_intf) : QVLCFrame( _p_intf )
78 setWindowTitle( qtr( "About" ) );
81 QGridLayout *layout = new QGridLayout( this );
82 QTabWidget *tab = new QTabWidget( this );
84 QPushButton *closeButton = new QPushButton( qtr( "&Close" ) );
85 closeButton->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
86 closeButton->setDefault( true );
88 QLabel *introduction = new QLabel(
89 qtr( "Information about VLC media player." ) );
90 QLabel *iconVLC = new QLabel;
91 iconVLC->setPixmap( QPixmap( ":/vlc48.png" ) );
92 layout->addWidget( iconVLC, 0, 0, 1, 1 );
93 layout->addWidget( introduction, 0, 1, 1, 7 );
94 layout->addWidget( tab, 1, 0, 1, 8 );
95 layout->addWidget( closeButton, 2, 6, 1, 2 );
97 /* Main Introduction */
98 QWidget *infoWidget = new QWidget( this );
99 QHBoxLayout *infoLayout = new QHBoxLayout( infoWidget );
100 QLabel *infoLabel = new QLabel( "VLC media player " PACKAGE_VERSION "\n\n"
101 "(c) 1996-2007 - the VideoLAN Team\n\n" +
102 qtr( "VLC media player is a free media player, made by the "
103 "VideoLAN Team.\nIt is a standalone multimedia player, "
104 "encoder and streamer, that can read from many supports "
105 "(files, CDs, DVDs, networks, capture cards...) and that "
106 "works on many platforms.\n\n" )
107 + qtr( "You are using the new Qt4 Interface.\n" )
108 + qtr( "Compiled by " ) + qfu( VLC_CompileBy() )+ "@"
109 + qfu( VLC_CompileDomain() ) + ".\n"
110 + "Compiler: " + qfu( VLC_Compiler() ) + ".\n"
111 + qtr( "Based on SVN revision: " ) + qfu( VLC_Changeset() )
113 + qtr( "This program comes with NO WARRANTY, to the extent "
114 "permitted by the law; read the distribution tab.\n\n" )
115 + "The VideoLAN team <videolan@videolan.org> \n"
116 "http://www.videolan.org/\n" );
117 infoLabel->setWordWrap( infoLabel );
119 QLabel *iconVLC2 = new QLabel;
120 iconVLC2->setPixmap( QPixmap( ":/vlc128.png" ) );
121 infoLayout->addWidget( iconVLC2 );
122 infoLayout->addWidget( infoLabel );
125 QTextEdit *licenseEdit = new QTextEdit( this );
126 licenseEdit->setFontFamily( "Monospace" );
127 licenseEdit->setText( qfu( psz_license ) );
128 licenseEdit->setReadOnly( true );
130 /* People who helped */
131 QWidget *thanksWidget = new QWidget( this );
132 QVBoxLayout *thanksLayout = new QVBoxLayout( thanksWidget );
134 QLabel *thanksLabel = new QLabel( qtr( "We would like to thank the whole "
135 "community, the testers, our users and the following people "
136 "(and the missing ones...) for their collaboration to "
137 "provide the best software." ) );
138 thanksLabel->setWordWrap( true );
139 thanksLayout->addWidget( thanksLabel );
140 QTextEdit *thanksEdit = new QTextEdit( this );
141 thanksEdit->setText( qfu( psz_thanks ) );
142 thanksEdit->setReadOnly( true );
143 thanksLayout->addWidget( thanksEdit );
145 /* People who wrote the software */
146 QTextEdit *authorsEdit = new QTextEdit( this );
147 authorsEdit->setText( qfu( psz_authors ) );
148 authorsEdit->setReadOnly( true );
150 /* add the tabs to the Tabwidget */
151 tab->addTab( infoWidget, qtr( "General Info" ) );
152 tab->addTab( authorsEdit, qtr( "Authors" ) );
153 tab->addTab( thanksWidget, qtr("Thanks") );
154 tab->addTab( licenseEdit, qtr("Distribution License") );
156 BUTTONACT( closeButton, close() );
159 AboutDialog::~AboutDialog()
162 void AboutDialog::close()
164 this->toggleVisible();
168 UpdateDialog *UpdateDialog::instance = NULL;
170 UpdateDialog::UpdateDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
172 setWindowTitle( qtr( "Update" ) );
175 QGridLayout *layout = new QGridLayout( this );
177 updateBrowser = new QTextBrowser( this );
178 updateBrowser->setOpenExternalLinks( true );
179 updateBrowser->setHtml( qtr( "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=\"utf-8\" /></head> \
180 <body><center>Push the update button to get the updates</center></body></html>" ) );
182 QPushButton *closeButton = new QPushButton( qtr( "&Close" ) );
183 QPushButton *updateButton = new QPushButton( qtr( "&Update List" ) );
184 updateButton->setDefault( true );
185 QDialogButtonBox *buttonBox = new QDialogButtonBox( Qt::Horizontal );
186 buttonBox->addButton( updateButton, QDialogButtonBox::ActionRole );
187 buttonBox->addButton( closeButton, QDialogButtonBox::AcceptRole );
189 layout->addWidget( updateBrowser, 0, 0 );
190 layout->addWidget( buttonBox, 1, 0 );
192 BUTTONACT( updateButton, updateOrUpload() );
193 BUTTONACT( closeButton, close() );
195 p_update = update_New( _p_intf );
198 UpdateDialog::~UpdateDialog()
200 update_Delete( p_update );
203 void UpdateDialog::close()
208 void UpdateDialog::updateOrUpload()
210 update_Check( p_update );
212 if( update_CompareReleaseToCurrent( p_update ) == UpdateReleaseStatusNewer )
214 updateBrowser->setHtml( qtr( "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=\"utf-8\" /></head> \
215 <body><center><p>" ) + qtu( (QString)p_update->release.psz_desc ) +
216 qtr( "</p>You can download the latest version of VLC <a href=\"" ) +
217 qtu( (QString)p_update->release.psz_url ) + qtr( "\">here</a></center></body></html>" ) );
221 updateBrowser->setHtml( "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=\"utf-8\" /></head> \
222 <body><center>You have the latest version of VLC.</center></body></html>" );