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>
40 #include <QDialogButtonBox>
42 HelpDialog *HelpDialog::instance = NULL;
44 HelpDialog::HelpDialog( intf_thread_t *_p_intf) : QVLCFrame( _p_intf )
46 setWindowTitle( qtr( "Help" ) );
49 QGridLayout *layout = new QGridLayout( this );
50 QTextBrowser *helpBrowser = new QTextBrowser( this );
51 helpBrowser->setOpenExternalLinks( true );
52 helpBrowser->setHtml( I_LONGHELP );
53 QPushButton *closeButton = new QPushButton( qtr( "&Close" ) );
54 closeButton->setDefault( true );
56 layout->addWidget( helpBrowser, 0, 0, 1, 0 );
57 layout->addWidget( closeButton, 1, 3 );
59 BUTTONACT( closeButton, close() );
62 HelpDialog::~HelpDialog()
65 void HelpDialog::close()
67 this->toggleVisible();
70 AboutDialog *AboutDialog::instance = NULL;
72 AboutDialog::AboutDialog( intf_thread_t *_p_intf) : QVLCFrame( _p_intf )
74 setWindowTitle( qtr( "About" ) );
77 QGridLayout *layout = new QGridLayout( this );
78 QTabWidget *tab = new QTabWidget( this );
80 QPushButton *closeButton = new QPushButton( qtr( "&Close" ) );
81 closeButton->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
82 closeButton->setDefault( true );
84 QLabel *introduction = new QLabel(
85 qtr( "Information about VLC media player." ) );
86 QLabel *iconVLC = new QLabel;
87 iconVLC->setPixmap( QPixmap( ":/vlc48.png" ) );
88 layout->addWidget( iconVLC, 0, 0, 1, 1 );
89 layout->addWidget( introduction, 0, 1, 1, 7 );
90 layout->addWidget( tab, 1, 0, 1, 8 );
91 layout->addWidget( closeButton, 2, 6, 1, 2 );
93 /* Main Introduction */
94 QWidget *infoWidget = new QWidget( this );
95 QHBoxLayout *infoLayout = new QHBoxLayout( infoWidget );
96 QLabel *infoLabel = new QLabel( "VLC media player " PACKAGE_VERSION "\n\n"
97 "(c) 1996-2007 - the VideoLAN Team\n\n" +
98 qtr( "VLC media player is a free media player, made by the "
99 "VideoLAN Team.\nIt is a standalone multimedia player, "
100 "encoder and streamer, that can read from many supports "
101 "(files, CDs, DVDs, networks, capture cards...) and that "
102 "works on many platforms.\n\n" )
103 + qtr( "You are using the new Qt4 Interface.\n" )
104 + qtr( "Compiled by " ) + qfu( VLC_CompileBy() )+ "@"
105 + qfu( VLC_CompileDomain() ) + ".\n"
106 + "Compiler: " + qfu( VLC_Compiler() ) +".\n"
107 + qtr( "Based on SVN revision: " ) + qfu( VLC_Changeset() )
109 + qtr( "This program comes with NO WARRANTY, to the extent "
110 "permitted by the law; read the distribution tab.\n\n" )
111 + "The VideoLAN team <videolan@videolan.org> \n"
112 "http://www.videolan.org/\n") ;
113 infoLabel->setWordWrap( infoLabel );
115 QLabel *iconVLC2 = new QLabel;
116 iconVLC2->setPixmap( QPixmap( ":/vlc128.png" ) );
117 infoLayout->addWidget( iconVLC2 );
118 infoLayout->addWidget( infoLabel );
121 QTextEdit *licenseEdit = new QTextEdit( this );
122 licenseEdit->setFontFamily( "Monospace" );
123 licenseEdit->setText( qfu( psz_license ) );
124 licenseEdit->setReadOnly( true );
126 /* People who helped */
127 QWidget *thanksWidget = new QWidget( this );
128 QVBoxLayout *thanksLayout = new QVBoxLayout( thanksWidget );
130 QLabel *thanksLabel = new QLabel( qtr("We would like to thank the whole "
131 "community, the testers, our users and the following people "
132 "(and the missing ones...) for their collaboration to "
133 "provide the best software." ) );
134 thanksLabel->setWordWrap( true );
135 thanksLayout->addWidget( thanksLabel );
136 QTextEdit *thanksEdit = new QTextEdit( this );
137 thanksEdit->setText( qfu( psz_thanks ) );
138 thanksEdit->setReadOnly( true );
139 thanksLayout->addWidget( thanksEdit );
141 /* People who wrote the software */
142 QTextEdit *authorsEdit = new QTextEdit( this );
143 authorsEdit->setText( qfu( psz_authors ) );
144 authorsEdit->setReadOnly( true );
146 /* add the tabs to the Tabwidget */
147 tab->addTab( infoWidget, qtr( "General Info" ) );
148 tab->addTab( authorsEdit, qtr( "Authors" ) );
149 tab->addTab( thanksWidget, qtr("Thanks") );
150 tab->addTab( licenseEdit, qtr("Distribution License") );
152 BUTTONACT( closeButton, close() );
155 AboutDialog::~AboutDialog()
158 void AboutDialog::close()
160 this->toggleVisible();
164 UpdateDialog *UpdateDialog::instance = NULL;
166 UpdateDialog::UpdateDialog( intf_thread_t *_p_intf) : QVLCFrame( _p_intf )
168 setWindowTitle( qtr( "Update" ) );
171 QGridLayout *layout = new QGridLayout( this );
173 QPushButton *closeButton = new QPushButton( qtr( "&Close" ) );
174 QPushButton *updateButton = new QPushButton( qtr( "&Update List" ) );
175 updateButton->setDefault( true );
176 QDialogButtonBox *buttonBox = new QDialogButtonBox(Qt::Horizontal);
177 buttonBox->addButton( updateButton, QDialogButtonBox::ActionRole );
178 buttonBox->addButton( closeButton, QDialogButtonBox::AcceptRole );
180 QGroupBox *checkGroup = new QGroupBox( qtr( "Select Package" ) );
181 QGridLayout *checkLayout = new QGridLayout( checkGroup );
182 checkInfo = new QCheckBox( qtr( "Information" ) );
183 checkSource = new QCheckBox( qtr( "Sources" ) );
184 checkBinary = new QCheckBox( qtr( "Binary" ) );
185 checkPlugin = new QCheckBox( qtr( "Plugin" ) );
187 checkInfo->setDisabled( true );
188 checkSource->setDisabled( true );
189 checkBinary->setDisabled( true );
190 checkPlugin->setDisabled( true );
192 checkLayout->addWidget( checkInfo, 0, 0 );
193 checkLayout->addWidget( checkSource, 1, 0 );
194 checkLayout->addWidget( checkBinary, 2, 0 );
195 checkLayout->addWidget( checkPlugin, 3, 0 );
197 layout->addWidget( checkGroup, 0, 0 );
198 layout->addWidget( buttonBox, 1, 0 );
200 BUTTONACT( updateButton, update() );
201 BUTTONACT( closeButton, close() );
203 p_update = update_New( _p_intf );
206 UpdateDialog::~UpdateDialog()
208 update_Delete( p_update );
211 void UpdateDialog::close()
216 void UpdateDialog::update()
218 update_Check( p_update, VLC_FALSE );
219 update_iterator_t *p_uit = update_iterator_New( p_update );
222 p_uit->i_rs = UPDATE_RELEASE_STATUS_NEWER;
223 p_uit->i_t = UPDATE_FILE_TYPE_ALL;
224 update_iterator_Action( p_uit, UPDATE_MIRROR );
225 while( update_iterator_Action( p_uit, UPDATE_FILE ) != UPDATE_FAIL )
227 switch( p_uit->file.i_type )
229 case UPDATE_FILE_TYPE_INFO:
230 checkInfo->setDisabled( false );
231 checkInfo->setCheckState( Qt::Checked );
233 case UPDATE_FILE_TYPE_SOURCE:
234 checkSource->setDisabled( false );
235 checkSource->setCheckState( Qt::Checked );
237 case UPDATE_FILE_TYPE_BINARY:
238 checkBinary->setDisabled( false );
239 checkBinary->setCheckState( Qt::Checked );
241 case UPDATE_FILE_TYPE_PLUGIN:
242 checkPlugin->setDisabled( false );
243 checkPlugin->setCheckState( Qt::Checked );
250 update_iterator_Delete( p_uit );