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 *****************************************************************************/
25 #include "dialogs/help.hpp"
26 #include <vlc_about.h>
27 #include <vlc_update.h>
29 #include "dialogs_provider.hpp"
31 #include <vlc_intf_strings.h>
33 #include <QTextBrowser>
38 #include <QDialogButtonBox>
41 HelpDialog *HelpDialog::instance = NULL;
43 HelpDialog::HelpDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
45 setWindowTitle( qtr( "Help" ) );
48 QGridLayout *layout = new QGridLayout( this );
49 QTextBrowser *helpBrowser = new QTextBrowser( this );
50 helpBrowser->setOpenExternalLinks( true );
51 helpBrowser->setHtml( I_LONGHELP );
52 QPushButton *closeButton = new QPushButton( qtr( "&Close" ) );
53 closeButton->setDefault( true );
55 layout->addWidget( helpBrowser, 0, 0, 1, 0 );
56 layout->addWidget( closeButton, 1, 3 );
58 BUTTONACT( closeButton, close() );
61 HelpDialog::~HelpDialog()
64 void HelpDialog::close()
66 this->toggleVisible();
69 AboutDialog *AboutDialog::instance = NULL;
71 AboutDialog::AboutDialog( intf_thread_t *_p_intf) : QVLCFrame( _p_intf )
73 setWindowTitle( qtr( "About" ) );
76 QGridLayout *layout = new QGridLayout( this );
77 QTabWidget *tab = new QTabWidget( this );
79 QPushButton *closeButton = new QPushButton( qtr( "&Close" ) );
80 closeButton->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
81 closeButton->setDefault( true );
83 QLabel *introduction = new QLabel(
84 qtr( "Information about VLC media player." ) );
85 QLabel *iconVLC = new QLabel;
86 iconVLC->setPixmap( QPixmap( ":/vlc48.png" ) );
87 layout->addWidget( iconVLC, 0, 0, 1, 1 );
88 layout->addWidget( introduction, 0, 1, 1, 7 );
89 layout->addWidget( tab, 1, 0, 1, 8 );
90 layout->addWidget( closeButton, 2, 6, 1, 2 );
92 /* Main Introduction */
93 QWidget *infoWidget = new QWidget( this );
94 QHBoxLayout *infoLayout = new QHBoxLayout( infoWidget );
95 QLabel *infoLabel = new QLabel( "VLC media player " PACKAGE_VERSION "\n\n"
96 "(c) 1996-2007 - the VideoLAN Team\n\n" +
97 qtr( "VLC media player is a free media player, made by the "
98 "VideoLAN Team.\nIt is a standalone multimedia player, "
99 "encoder and streamer, that can read from many supports "
100 "(files, CDs, DVDs, networks, capture cards...) and that "
101 "works on many platforms.\n\n" )
102 + qtr( "You are using the new Qt4 Interface.\n" )
103 + qtr( "Compiled by " ) + qfu( VLC_CompileBy() )+ "@"
104 + qfu( VLC_CompileDomain() ) + ".\n"
105 + "Compiler: " + qfu( VLC_Compiler() ) + ".\n"
106 + qtr( "Based on SVN revision: " ) + qfu( VLC_Changeset() )
108 + qtr( "This program comes with NO WARRANTY, to the extent "
109 "permitted by the law; read the distribution tab.\n\n" )
110 + "The VideoLAN team <videolan@videolan.org> \n"
111 "http://www.videolan.org/\n" );
112 infoLabel->setWordWrap( infoLabel );
114 QLabel *iconVLC2 = new QLabel;
115 iconVLC2->setPixmap( QPixmap( ":/vlc128.png" ) );
116 infoLayout->addWidget( iconVLC2 );
117 infoLayout->addWidget( infoLabel );
120 QTextEdit *licenseEdit = new QTextEdit( this );
121 licenseEdit->setFontFamily( "Monospace" );
122 licenseEdit->setText( qfu( psz_license ) );
123 licenseEdit->setReadOnly( true );
125 /* People who helped */
126 QWidget *thanksWidget = new QWidget( this );
127 QVBoxLayout *thanksLayout = new QVBoxLayout( thanksWidget );
129 QLabel *thanksLabel = new QLabel( qtr( "We would like to thank the whole "
130 "community, the testers, our users and the following people "
131 "(and the missing ones...) for their collaboration to "
132 "provide the best software." ) );
133 thanksLabel->setWordWrap( true );
134 thanksLayout->addWidget( thanksLabel );
135 QTextEdit *thanksEdit = new QTextEdit( this );
136 thanksEdit->setText( qfu( psz_thanks ) );
137 thanksEdit->setReadOnly( true );
138 thanksLayout->addWidget( thanksEdit );
140 /* People who wrote the software */
141 QTextEdit *authorsEdit = new QTextEdit( this );
142 authorsEdit->setText( qfu( psz_authors ) );
143 authorsEdit->setReadOnly( true );
145 /* add the tabs to the Tabwidget */
146 tab->addTab( infoWidget, qtr( "General Info" ) );
147 tab->addTab( authorsEdit, qtr( "Authors" ) );
148 tab->addTab( thanksWidget, qtr("Thanks") );
149 tab->addTab( licenseEdit, qtr("Distribution License") );
151 BUTTONACT( closeButton, close() );
154 AboutDialog::~AboutDialog()
157 void AboutDialog::close()
159 this->toggleVisible();
163 UpdateDialog *UpdateDialog::instance = NULL;
165 UpdateDialog::UpdateDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
167 setWindowTitle( qtr( "Update" ) );
170 QGridLayout *layout = new QGridLayout( this );
172 updateBrowser = new QTextBrowser( this );
173 updateBrowser->setOpenExternalLinks( true );
174 updateBrowser->setHtml( qtr( "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=\"utf-8\" /></head> \
175 <body><center>Push the update button to get the updates</center></body></html>" ) );
177 QPushButton *closeButton = new QPushButton( qtr( "&Close" ) );
178 QPushButton *updateButton = new QPushButton( qtr( "&Update List" ) );
179 updateButton->setDefault( true );
180 QDialogButtonBox *buttonBox = new QDialogButtonBox( Qt::Horizontal );
181 buttonBox->addButton( updateButton, QDialogButtonBox::ActionRole );
182 buttonBox->addButton( closeButton, QDialogButtonBox::AcceptRole );
184 layout->addWidget( updateBrowser, 0, 0 );
185 layout->addWidget( buttonBox, 1, 0 );
187 BUTTONACT( updateButton, updateOrUpload() );
188 BUTTONACT( closeButton, close() );
190 p_update = update_New( _p_intf );
193 UpdateDialog::~UpdateDialog()
195 update_Delete( p_update );
198 void UpdateDialog::close()
203 void UpdateDialog::updateOrUpload()
205 update_Check( p_update );
207 if( update_CompareReleaseToCurrent( p_update ) == UpdateReleaseStatusNewer )
209 updateBrowser->setHtml( qtr( "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=\"utf-8\" /></head> \
210 <body><center><p>" ) + qtu( (QString)p_update->release.psz_desc ) +
211 qtr( "</p>You can download the latest version of VLC <a href=\"" ) +
212 qtu( (QString)p_update->release.psz_url ) + qtr( "\">here</a></center></body></html>" ) );
216 updateBrowser->setHtml( "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=\"utf-8\" /></head> \
217 <body><center>You have the latest version of VLC.</center></body></html>" );