]> git.sesse.net Git - vlc/blob - modules/gui/qt4/dialogs/firstrun.cpp
Qt: EPGItem: add parental rating
[vlc] / modules / gui / qt4 / dialogs / firstrun.cpp
1 /*****************************************************************************
2  * firstrun.cpp : First Run dialogs
3  ****************************************************************************
4  * Copyright © 2009 VideoLAN
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 Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22  *****************************************************************************/
23
24 #include "dialogs/firstrun.hpp"
25
26 #include <QGridLayout>
27 #include <QGroupBox>
28 #include <QCheckBox>
29 #include <QLabel>
30 #include <QDialogButtonBox>
31
32 FirstRun::FirstRun( QWidget *_p, intf_thread_t *_p_intf  )
33          : QWidget( _p ), p_intf( _p_intf )
34 {
35     msg_Dbg( p_intf, "Boring first Run Wizard" );
36     buildPrivDialog();
37     setVisible( true );
38 }
39
40 #define ALBUM_ART_WHEN_ASKED 0
41 #define ALBUM_ART_ALL 2
42
43 void FirstRun::save()
44 {
45     config_PutInt( p_intf,  "album-art", checkbox->isChecked() ? ALBUM_ART_ALL: ALBUM_ART_WHEN_ASKED );
46 #ifdef UPDATE_CHECK
47     config_PutInt( p_intf,  "qt-updates-notif", checkbox2->isChecked() );
48 #endif
49     config_PutInt( p_intf,  "qt-privacy-ask", 0 );
50
51     /* FIXME Should not save here. This will not work as expected if another
52      * plugin overwrote items of its own. */
53 #warning FIXME
54     /* We have to save here because the user may not launch Prefs */
55     config_SaveConfigFile( p_intf );
56     close();
57 }
58
59 void FirstRun::buildPrivDialog()
60 {
61     setWindowTitle( qtr( "Privacy and Network Access Policy" ) );
62     setWindowRole( "vlc-privacy" );
63     setWindowModality( Qt::ApplicationModal );
64     setWindowFlags( Qt::Dialog );
65     setAttribute( Qt::WA_DeleteOnClose );
66
67     QGridLayout *gLayout = new QGridLayout( this );
68
69     QGroupBox *blabla = new QGroupBox( qtr( "Privacy and Network Access Policy" ) );
70     QGridLayout *blablaLayout = new QGridLayout( blabla );
71     QLabel *text = new QLabel( qtr(
72         "<p>In order to protect your privacy, the <i>VLC media player</i> "
73         "does <b>not</b> collect personal data or transmit them, "
74         "not even in anonymized form, to anyone."
75         "</p>\n"
76         "<p>Nevertheless, <i>VLC</i> is able to automatically retrieve "
77         "information about the media in your playlist from third party "
78         "Internet-based services. That includes covert arts, track names, "
79         "authoring and other meta-data."
80         "</p>\n"
81         "That may entail identifying some of your media files to third party "
82         "entities. Therefore the <i>VLC</i> developers require your express "
83         "consent for the media player to access the Internet automatically."
84         "</p>\n"
85         ) );
86     text->setWordWrap( true );
87     text->setTextFormat( Qt::RichText );
88
89     blablaLayout->addWidget( text, 0, 0 ) ;
90
91     QGroupBox *options = new QGroupBox( qtr( "Network Access Policy" ) );
92     QGridLayout *optionsLayout = new QGridLayout( options );
93
94     gLayout->addWidget( blabla, 0, 0, 1, 3 );
95     gLayout->addWidget( options, 1, 0, 1, 3 );
96     int line = 0;
97
98     checkbox = new QCheckBox( qtr( "Automatically retrieve media infos" ) );
99     checkbox->setChecked( true );
100     optionsLayout->addWidget( checkbox, line++, 0 );
101
102 #ifdef UPDATE_CHECK
103     checkbox2 = new QCheckBox( qtr( "Regularly check for VLC updates" ) );
104     checkbox2->setChecked( true );
105     optionsLayout->addWidget( checkbox2, line++, 0 );
106 #endif
107
108     QDialogButtonBox *buttonsBox = new QDialogButtonBox( this );
109     buttonsBox->addButton( qtr( "Continue" ), QDialogButtonBox::AcceptRole );
110
111     gLayout->addWidget( buttonsBox, 2, 0, 2, 3 );
112
113     CONNECT( buttonsBox, accepted(), this, save() );
114     buttonsBox->setFocus();
115 }