firstrun.cpp 4.21 KB
Newer Older
1
/*****************************************************************************
Pere Orga's avatar
Pere Orga committed
2
 * firstrun.cpp : First Run dialogs
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 ****************************************************************************
 * Copyright © 2009 VideoLAN
 * $Id$
 *
 * Authors: Jean-Baptiste Kempf <jb (at) videolan.org>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 *****************************************************************************/

#include "dialogs/firstrun.hpp"

#include <QGridLayout>
#include <QGroupBox>
28
29
#include <QCheckBox>
#include <QLabel>
30
#include <QDialogButtonBox>
31

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
32
FirstRun::FirstRun( QWidget *_p, intf_thread_t *_p_intf  )
33
34
         : QWidget( _p ), p_intf( _p_intf )
{
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
35
36
37
    msg_Dbg( p_intf, "Boring first Run Wizard" );
    buildPrivDialog();
    setVisible( true );
38
39
}

40
41
#define ALBUM_ART_WHEN_ASKED 0
#define ALBUM_ART_ALL 2
42

43
44
void FirstRun::save()
{
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
52
53
    /* FIXME Should not save here. This will not work as expected if another
     * plugin overwrote items of its own. */
#warning FIXME
54
    /* We have to save here because the user may not launch Prefs */
55
    config_SaveConfigFile( p_intf );
56
57
58
59
60
    close();
}

void FirstRun::buildPrivDialog()
{
61
    setWindowTitle( qtr( "Privacy and Network Access Policy" ) );
62
63
64
65
66
67
68
    setWindowRole( "vlc-privacy" );
    setWindowModality( Qt::ApplicationModal );
    setWindowFlags( Qt::Dialog );
    setAttribute( Qt::WA_DeleteOnClose );

    QGridLayout *gLayout = new QGridLayout( this );

69
    QGroupBox *blabla = new QGroupBox( qtr( "Privacy and Network Access Policy" ) );
70
71
    QGridLayout *blablaLayout = new QGridLayout( blabla );
    QLabel *text = new QLabel( qtr(
72
73
74
75
76
77
78
79
80
81
82
83
84
        "<p>In order to protect your privacy, the <i>VLC media player</i> "
        "does <b>not</b> collect personal informations or transmit them, "
        "not even in anonymized form, to anyone."
        "</p>\n"
        "<p>Nevertheless, <i>VLC</i> is able to automatically retrieve "
        "informations about the media in your playlist from third party "
        "Internet-based services. These informations include covert arts, "
        "track names, authoring and other meta-data."
        "</p>\n"
        "That may entail identifying some of your media files to third party "
        "entities. Therefore the <i>VLC</i> developers require your express "
        "consent for the media player to access the Internet automatically."
        "</p>\n"
85
        ) );
86
87
88
89
90
    text->setWordWrap( true );
    text->setTextFormat( Qt::RichText );

    blablaLayout->addWidget( text, 0, 0 ) ;

91
    QGroupBox *options = new QGroupBox( qtr( "Network Access Policy" ) );
92
93
94
95
96
97
    QGridLayout *optionsLayout = new QGridLayout( options );

    gLayout->addWidget( blabla, 0, 0, 1, 3 );
    gLayout->addWidget( options, 1, 0, 1, 3 );
    int line = 0;

98
    checkbox = new QCheckBox( qtr( "Automatically retrieve media infos" ) );
99
100
101
    checkbox->setChecked( true );
    optionsLayout->addWidget( checkbox, line++, 0 );

102
#ifdef UPDATE_CHECK
103
    checkbox2 = new QCheckBox( qtr( "Regularly check for VLC updates" ) );
104
105
    checkbox2->setChecked( true );
    optionsLayout->addWidget( checkbox2, line++, 0 );
106
107
#endif

108
    QDialogButtonBox *buttonsBox = new QDialogButtonBox( this );
109
    buttonsBox->addButton( qtr( "Continue" ), QDialogButtonBox::AcceptRole );
110

111
    gLayout->addWidget( buttonsBox, 2, 0, 2, 3 );
112

113
114
    CONNECT( buttonsBox, accepted(), this, save() );
    buttonsBox->setFocus();
115
}