]> git.sesse.net Git - vlc/blob - modules/gui/qt4/dialogs/help.cpp
Qt4 - #include cleaning (2)
[vlc] / modules / gui / qt4 / dialogs / help.cpp
1 /*****************************************************************************
2  * Help.cpp : Help and About dialogs
3  ****************************************************************************
4  * Copyright (C) 2007 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Jean-Baptiste Kempf <jb (at) videolan.org>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22  *****************************************************************************/
23
24 #include "dialogs/help.hpp"
25 #include "dialogs/about.hpp"
26
27 #include "dialogs_provider.hpp"
28
29 #include <QTextBrowser>
30 #include <QTabWidget>
31 #include <QFile>
32 #include <QLabel>
33 #include <QString>
34
35 HelpDialog *HelpDialog::instance = NULL;
36
37 HelpDialog::HelpDialog( intf_thread_t *_p_intf) : QVLCFrame( _p_intf )
38 {
39     setWindowTitle( qtr( "Help" ) );
40     resize( 600, 560 );
41
42     QGridLayout *layout = new QGridLayout( this );
43     QTextBrowser *helpBrowser = new QTextBrowser( this );
44     helpBrowser->setOpenExternalLinks( true );
45     helpBrowser->setHtml( _("<html>"
46     "<h2>Welcome to VLC media player help</h2>"
47         "<h3>Documentation</h3>"
48             "<p>You can find VLC documentation on VideoLAN's <a href=\"http://wiki.videolan.org\">wiki</a> website.</p>"
49             "<p>If you are a newcomer to VLC media player, please read the<br><a href=\"http://wiki.videolan.org/Documentation:VLC_for_dummies\"><em>Introduction to VLC media player</em></a>.</p>"
50             "<p>You will find some information on how to use the player in the <br>\"<a href=\"http://wiki.videolan.org/Documentation:Play_HowTo\"><em>How to play files with VLC media player<em></a>\" document.</p>"
51             "<p>For all the saving, converting, transcoding, encoding, muxing and streaming tasks, you should find useful information in the <a href=\"http://wiki.videolan.org/Documentation:Streaming_HowTo\">Streaming Documentation</a>.</p>"
52             "<p>If you are unsure about terminology, please consult the <a href=\"http://wiki.videolan.org/Knowledge_Base\">knowledge base</a>.</p>"
53             "<p>To understand the main keyboard shortcuts, read the <a href=\"http://wiki.videolan.org/Hotkeys\">shortcuts</a> page.</p>"
54         "<h3>Help</h3>"
55             "<p>Before asking any question, please refer yourself to the <a href=\"http://wiki.videolan.org/Frequently_Asked_Questions\">FAQ</a>.</p>"
56             "<p>You might then get (and give) help on the <a href=\"http://forum.videolan.org\">Forums</a>, the <a href=\"http://www.videolan.org/vlc/lists.html\">mailing-lists</a> or our IRC channel ( <a href=\"http://www.videolan.org/webirc/\"><em>#videolan</em></a> on irc.freenode.net ).</p>"
57         "<h3>Contribute to the project</h3>"
58             "<p>You can help the VideoLAN project giving some of your time to help the community, to design skins, to translate the documentation, to test and to code. You can also give funds and material to help us. And of course, you can <b>promote</b> VLC media player.</p>"
59     "</html>") );
60     QPushButton *closeButton = new QPushButton( qtr( "&Close" ) );
61     closeButton->setDefault( true );
62
63     layout->addWidget( helpBrowser, 0, 0, 1, 0 );
64     layout->addWidget( closeButton, 1, 3 );
65
66     BUTTONACT( closeButton, close() );
67 }
68
69 HelpDialog::~HelpDialog()
70 {
71 }
72 void HelpDialog::close()
73 {
74     this->toggleVisible();
75 }
76
77 AboutDialog *AboutDialog::instance = NULL;
78
79 AboutDialog::AboutDialog( intf_thread_t *_p_intf) :  QVLCFrame( _p_intf )
80 {
81     setWindowTitle( qtr( "About" ) );
82     resize( 600, 500 );
83
84     QGridLayout *layout = new QGridLayout( this );
85     QTabWidget *tab = new QTabWidget( this );
86
87     QPushButton *closeButton = new QPushButton( qtr( "&Close" ) );
88     closeButton->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
89     closeButton->setDefault( true );
90
91     QLabel *introduction = new QLabel(
92             qtr( "Information about VLC media player." ) );
93     QLabel *iconVLC = new QLabel;
94     iconVLC->setPixmap( QPixmap( ":/vlc48.png" ) );
95     layout->addWidget( iconVLC, 0, 0, 1, 1 );
96     layout->addWidget( introduction, 0, 1, 1, 7 );
97     layout->addWidget( tab, 1, 0, 1, 8 );
98     layout->addWidget( closeButton, 2, 6, 1, 2 );
99
100     /* Main Introduction */
101     QWidget *infoWidget = new QWidget( this );
102     QHBoxLayout *infoLayout = new QHBoxLayout( infoWidget );
103     QLabel *infoLabel = new QLabel( "VLC media player " PACKAGE_VERSION "\n\n"
104             "(c) 1996-2007 - the VideoLAN Team\n\n" +
105             qtr( "VLC media player is a free media player, made by the "
106                 "VideoLAN Team.\nIt is a standalone multimedia player, "
107                 "encoder and streamer, that can read from many supports "
108                 "(files, CDs, DVDs, networks, capture cards...) and that "
109                 " works on many platforms.\n\n" )
110             + qtr( "You are using the new Qt4 Interface.\n" )
111             + qtr( "Compiled by " ) + qfu( VLC_CompileBy() )+ "@"
112             + qfu( VLC_CompileDomain() ) + ".\n"
113             + "Compiler: " + qfu( VLC_Compiler() ) +".\n"
114             + qtr( "Based on SVN revision: " ) + qfu( VLC_Changeset() )
115             + ".\n\n"
116             + qtr( "This program comes with NO WARRANTY, to the extent "
117                 "permitted by the law; read the distribution tab.\n\n" )
118             + "The VideoLAN team <videolan@videolan.org> \n"
119               "http://www.videolan.org/\n") ;
120     infoLabel->setWordWrap( infoLabel );
121
122     QLabel *iconVLC2 = new QLabel;
123     iconVLC2->setPixmap( QPixmap( ":/vlc128.png" ) );
124     infoLayout->addWidget( iconVLC2 );
125     infoLayout->addWidget( infoLabel );
126
127     /* GPL License */
128     QTextEdit *licenseEdit = new QTextEdit( this );
129     licenseEdit->setText( qfu( psz_license ) );
130     licenseEdit->setReadOnly( true );
131
132     /* People who helped */
133     QWidget *thanksWidget = new QWidget( this );
134     QVBoxLayout *thanksLayout = new QVBoxLayout( thanksWidget );
135
136     QLabel *thanksLabel = new QLabel( qtr("We would like to thanks the whole "
137                 "community, the testers, our users and the following people "
138                 "(and the missing ones...) for their collaboration to "
139                 "provide the best software." ) );
140     thanksLabel->setWordWrap( true );
141     thanksLayout->addWidget( thanksLabel );
142     QTextEdit *thanksEdit = new QTextEdit( this );
143     thanksEdit->setText( qfu( psz_thanks ) );
144     thanksEdit->setReadOnly( true );
145     thanksLayout->addWidget( thanksEdit );
146
147     /* People who wrote the software */
148     QTextEdit *authorsEdit = new QTextEdit( this );
149     authorsEdit->setText( qfu( psz_authors ) );
150     authorsEdit->setReadOnly( true );
151
152     /* add the tabs to the Tabwidget */
153     tab->addTab( infoWidget, qtr( "General Info" ) );
154     tab->addTab( authorsEdit, qtr( "Authors" ) );
155     tab->addTab( thanksWidget, qtr("Thanks") );
156     tab->addTab( licenseEdit, qtr("Distribution License") );
157
158     BUTTONACT( closeButton, close() );
159 }
160
161 AboutDialog::~AboutDialog()
162 {
163 }
164 void AboutDialog::close()
165 {
166     this->toggleVisible();
167 }