]> git.sesse.net Git - vlc/blob - modules/gui/qt4/dialogs/help.cpp
Qt4 - adding a '...' in the description... Cosmetic
[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/about.hpp"
25 #include "dialogs/help.hpp"
26
27 #include "dialogs_provider.hpp"
28 #include "util/qvlcframe.hpp"
29 #include "qt4.hpp"
30
31 #include <QTextBrowser>
32 #include <QTabWidget>
33 #include <QFile>
34 #include <QLabel>
35 #include <QString>
36
37 HelpDialog *HelpDialog::instance = NULL;
38
39 HelpDialog::HelpDialog( intf_thread_t *_p_intf) :  QVLCFrame( _p_intf )
40 {
41     setWindowTitle( qtr( "Help" ) );
42     resize( 600, 560 );
43
44     QGridLayout *layout = new QGridLayout( this );
45     QTextBrowser *helpBrowser = new QTextBrowser( this );
46     helpBrowser->setOpenExternalLinks( true );
47     helpBrowser->setHtml( _("<html>"
48     "<h2>Welcome to VLC media player help</h2>"
49         "<h3>Documentation</h3>"
50             "<p>You can find VLC documentation on VideoLAN's <a href=\"http://wiki.videolan.org\">wiki</a> website.</p>"
51             "<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>"
52             "<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>"
53             "<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>"
54             "<p>If you are unsure about terminology, please consult the <a href=\"http://wiki.videolan.org/Knowledge_Base\">knowledge base</a>.</p>"
55             "<p>To understand the main keyboard shortcuts, read the <a href=\"http://wiki.videolan.org/Hotkeys\">shortcuts</a> page.</p>"
56         "<h3>Help</h3>"
57             "<p>Before asking any question, please refer yourself to the <a href=\"http://wiki.videolan.org/Frequently_Asked_Questions\">FAQ</a>.</p>"
58             "<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>"
59         "<h3>Contribute to the project</h3>"
60             "<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>"
61     "</html>") );
62     QPushButton *closeButton = new QPushButton( qtr( "&Close" ) );
63     closeButton->setDefault( true );
64
65     layout->addWidget( helpBrowser, 0, 0, 1, 0 );
66     layout->addWidget( closeButton, 1, 3 );
67
68     BUTTONACT( closeButton, close() );
69 }
70
71 HelpDialog::~HelpDialog()
72 {
73 }
74 void HelpDialog::close()
75 {
76     this->toggleVisible();
77 }
78
79 AboutDialog *AboutDialog::instance = NULL;
80
81 AboutDialog::AboutDialog( intf_thread_t *_p_intf) :  QVLCFrame( _p_intf )
82 {
83     setWindowTitle( qtr( "About" ) );
84     resize( 600, 500 );
85
86     QGridLayout *layout = new QGridLayout( this );
87     QTabWidget *tab = new QTabWidget( this );
88
89     QPushButton *closeButton = new QPushButton( qtr( "&Close" ) );
90     closeButton->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
91     closeButton->setDefault( true );
92
93     QLabel *introduction = new QLabel(
94             qtr( "Information about VLC media player." ) );
95     QLabel *iconVLC = new QLabel;
96     iconVLC->setPixmap( QPixmap( ":/vlc48.png" ) );
97     layout->addWidget( iconVLC, 0, 0, 1, 1 );
98     layout->addWidget( introduction, 0, 1, 1, 7 );
99     layout->addWidget( tab, 1, 0, 1, 8 );
100     layout->addWidget( closeButton, 2, 6, 1, 2 );
101
102     /* Main Introduction */
103     QWidget *infoWidget = new QWidget( this );
104     QHBoxLayout *infoLayout = new QHBoxLayout( infoWidget );
105     QLabel *infoLabel = new QLabel( "VLC media player " PACKAGE_VERSION "\n\n"
106             "(c) 1996-2007 - the VideoLAN Team\n\n" +
107             qtr( "VLC media player is a free media player, made by the "
108                 "VideoLAN Team.\nIt is a standalone multimedia player, "
109                 "encoder and streamer, that can read from many supports "
110                 "(files, CDs, DVDs, networks, capture cards...) and that "
111                 " works on many platforms.\n\n" )
112             + qtr( "You are using the new Qt4 Interface.\n" )
113             + qtr( "Compiled by " ) + qfu( VLC_CompileBy() )+ "@"
114             + qfu( VLC_CompileDomain() ) + ".\n"
115             + "Compiler: " + qfu( VLC_Compiler() ) +".\n"
116             + qtr( "Based on SVN revision: " ) + qfu( VLC_Changeset() )
117             + ".\n\n"
118             + qtr( "This program comes with NO WARRANTY, to the extent "
119                 "permitted by the law; read the distribution tab.\n\n" )
120             + "The VideoLAN team <videolan@videolan.org> \n"
121               "http://www.videolan.org/\n") ;
122     infoLabel->setWordWrap( infoLabel );
123
124     QLabel *iconVLC2 = new QLabel;
125     iconVLC2->setPixmap( QPixmap( ":/vlc128.png" ) );
126     infoLayout->addWidget( iconVLC2 );
127     infoLayout->addWidget( infoLabel );
128
129     /* GPL License */
130     QTextEdit *licenseEdit = new QTextEdit( this );
131     licenseEdit->setText( qfu( psz_license ) );
132     licenseEdit->setReadOnly( true );
133
134     /* People who helped */
135     QWidget *thanksWidget = new QWidget( this );
136     QVBoxLayout *thanksLayout = new QVBoxLayout( thanksWidget );
137
138     QLabel *thanksLabel = new QLabel( qtr("We would like to thanks the whole "
139                 "community, the testers, our users and the following people "
140                 "(and the missing ones...) for their collaboration to "
141                 "provide the best software." ) );
142     thanksLabel->setWordWrap( true );
143     thanksLayout->addWidget( thanksLabel );
144     QTextEdit *thanksEdit = new QTextEdit( this );
145     thanksEdit->setText( qfu( psz_thanks ) );
146     thanksEdit->setReadOnly( true );
147     thanksLayout->addWidget( thanksEdit );
148
149     /* People who wrote the software */
150     QTextEdit *authorsEdit = new QTextEdit( this );
151     authorsEdit->setText( qfu( psz_authors ) );
152     authorsEdit->setReadOnly( true );
153
154     /* add the tabs to the Tabwidget */
155     tab->addTab( infoWidget, qtr( "General Info" ) );
156     tab->addTab( authorsEdit, qtr( "Authors" ) );
157     tab->addTab( thanksWidget, qtr("Thanks") );
158     tab->addTab( licenseEdit, qtr("Distribution License") );
159
160     BUTTONACT( closeButton, close() );
161 }
162
163 AboutDialog::~AboutDialog()
164 {
165 }
166 void AboutDialog::close()
167 {
168     this->toggleVisible();
169 }