]> git.sesse.net Git - vlc/blob - modules/gui/qt4/dialogs/help.cpp
Makes THANKS & COPYING built in in qt4 about dialog
[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: Messages.cpp 16024 2006-07-13 13:51:05Z xtophe $
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, 500 );
43
44     QGridLayout *layout = new QGridLayout( this );
45     QTextBrowser *helpBrowser = new QTextBrowser( this );
46     QPushButton *closeButton = new QPushButton( qtr( "&Close" ) );
47     closeButton->setDefault( true );
48
49     layout->addWidget( helpBrowser, 0, 0, 1, 0 );
50     layout->addWidget( closeButton, 1, 3 );
51
52     BUTTONACT( closeButton, close() );
53 }
54
55 HelpDialog::~HelpDialog()
56 {
57 }
58 void HelpDialog::close()
59 {
60     this->toggleVisible();
61 }
62
63 AboutDialog *AboutDialog::instance = NULL;
64
65 AboutDialog::AboutDialog( intf_thread_t *_p_intf) :  QVLCFrame( _p_intf )
66 {
67     setWindowTitle( qtr( "About" ) );
68     resize( 600, 500 );
69
70     QGridLayout *layout = new QGridLayout( this );
71     QTabWidget *tab = new QTabWidget( this );
72
73     QPushButton *closeButton = new QPushButton( qtr( "&Close" ) );
74     closeButton->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
75     closeButton->setDefault( true );
76
77     QLabel *introduction = new QLabel(
78             qtr( "Information about VLC media player" ) );
79
80     layout->addWidget( introduction, 0, 0, 1, 2 );
81     layout->addWidget( tab, 1, 0, 1, 2 );
82     layout->addWidget( closeButton, 2, 1, 1, 1 );
83
84     /* GPL License */
85     QTextEdit *licenseEdit = new QTextEdit( this );
86     QString psz_qlicence = QString::fromUtf8( psz_licence );
87     licenseEdit->setText( psz_qlicence );
88     licenseEdit->setReadOnly( true );
89
90     /* People who helped */
91     QTextEdit *thanksEdit = new QTextEdit( this );
92     QString psz_qthanks = QString::fromUtf8( psz_thanks );
93     thanksEdit->setText( psz_qthanks );
94     thanksEdit->setReadOnly( true );
95
96     /* add the tabs to the Tabwidget */
97     tab->addTab( NULL, qtr( "General Info" ) );
98     tab->addTab( NULL, qtr( "Authors" ) );
99     tab->addTab( thanksEdit, qtr("Thanks") );
100     tab->addTab( licenseEdit, qtr("Distribution License") );
101
102     BUTTONACT( closeButton, close() );
103 }
104
105 AboutDialog::~AboutDialog()
106 {
107 }
108 void AboutDialog::close()
109 {
110     this->toggleVisible();
111 }