]> git.sesse.net Git - vlc/blob - modules/gui/qt4/dialogs/firstrun.cpp
Remove unused config_SaveConfigFile parameter
[vlc] / modules / gui / qt4 / dialogs / firstrun.cpp
1 /*****************************************************************************
2  * firstrun : 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 <QPushButton>
31 #include <QSettings>
32
33 FirstRun::FirstRun( QWidget *_p, intf_thread_t *_p_intf  )
34          : QWidget( _p ), p_intf( _p_intf )
35 {
36 #ifndef HAVE_MAEMO
37     msg_Dbg( p_intf, "Boring first Run Wizard" );
38     buildPrivDialog();
39     setVisible( true );
40 #endif
41 }
42
43 #define ALBUM_ART_WHEN_ASKED 0
44 #define ALBUM_ART_ALL 2
45
46 void FirstRun::save()
47 {
48     config_PutInt( p_intf,  "album-art", checkbox->isChecked() ? ALBUM_ART_ALL: ALBUM_ART_WHEN_ASKED );
49 #ifdef UPDATE_CHECK
50     config_PutInt( p_intf,  "qt-updates-notif", checkbox2->isChecked() );
51 #endif
52     config_PutInt( p_intf,  "qt-privacy-ask", 0 );
53
54     /* FIXME Should not save here. This will not work as expected if another
55      * plugin overwrote items of its own. */
56 #warning FIXME
57     /* We have to save here because the user may not launch Prefs */
58     config_SaveConfigFile( p_intf );
59     close();
60 }
61
62 void FirstRun::buildPrivDialog()
63 {
64     setWindowTitle( qtr( "Privacy and Network Policies" ) );
65     setWindowRole( "vlc-privacy" );
66     setWindowModality( Qt::ApplicationModal );
67     setWindowFlags( Qt::Dialog );
68     setAttribute( Qt::WA_DeleteOnClose );
69
70     QGridLayout *gLayout = new QGridLayout( this );
71
72     QGroupBox *blabla = new QGroupBox( qtr( "Privacy and Network Warning" ) );
73     QGridLayout *blablaLayout = new QGridLayout( blabla );
74     QLabel *text = new QLabel( qtr(
75         "<p><i>VideoLAN</i> prefers when applications request authorization "
76         "before accessing Internet.</p>\n"
77         "<p><b>VLC media player</b> can get information from the Internet "
78         "in order to get <b>medias information</b> or to check for available <b>updates</b>.</p>\n"
79         "<p><i>VLC media player</i> <b>doesn't</b> send or collect any "
80         "information, even anonymously, about your usage.</p>\n" ) );
81     text->setWordWrap( true );
82     text->setTextFormat( Qt::RichText );
83
84     blablaLayout->addWidget( text, 0, 0 ) ;
85
86     QGroupBox *options = new QGroupBox( qtr( "Options" ) );
87     QGridLayout *optionsLayout = new QGridLayout( options );
88
89     gLayout->addWidget( blabla, 0, 0, 1, 3 );
90     gLayout->addWidget( options, 1, 0, 1, 3 );
91     int line = 0;
92
93     checkbox = new QCheckBox( qtr( "Allow fetching media information from Internet" ) );
94     checkbox->setChecked( true );
95     optionsLayout->addWidget( checkbox, line++, 0 );
96
97 #ifdef UPDATE_CHECK
98     checkbox2 = new QCheckBox( qtr( "Check for updates" ) );
99     checkbox2->setChecked( true );
100     optionsLayout->addWidget( checkbox2, line++, 0 );
101 #endif
102
103     QPushButton *ok = new QPushButton( qtr( "OK" ) );
104
105     gLayout->addWidget( ok, 2, 2 );
106
107     CONNECT( ok, clicked(), this, save() );
108     ok->setFocus();
109 }
110