Commit b90119f4 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt4: firstRun dialog is now separated

parent 6629593f
......@@ -40,6 +40,7 @@ nodist_SOURCES_qt4 = \
dialogs/openurl.moc.cpp \
dialogs/podcast_configuration.moc.cpp \
dialogs/vlm.moc.cpp \
dialogs/firstrun.moc.cpp \
components/extended_panels.moc.cpp \
components/info_panels.moc.cpp \
components/preferences_widgets.moc.cpp \
......@@ -228,6 +229,7 @@ SOURCES_qt4 = qt4.cpp \
dialogs/open.cpp \
dialogs/openurl.cpp \
dialogs/vlm.cpp \
dialogs/firstrun.cpp \
dialogs/podcast_configuration.cpp \
components/extended_panels.cpp \
components/info_panels.cpp \
......@@ -275,6 +277,7 @@ noinst_HEADERS = \
dialogs/open.hpp \
dialogs/openurl.hpp \
dialogs/vlm.hpp \
dialogs/firstrun.hpp \
dialogs/podcast_configuration.hpp \
components/extended_panels.hpp \
components/info_panels.hpp \
......
/*****************************************************************************
* firstrun : First Run dialogs
****************************************************************************
* 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 "components/preferences_widgets.hpp"
#include <QGridLayout>
#include <QGroupBox>
FirstRun::FirstRun( QWidget *_p, intf_thread_t *_p_intf )
: QWidget( _p ), p_intf( _p_intf )
{
#ifndef HAVE_MAEMO
/**
* Ask for the network policy on FIRST STARTUP
**/
if( config_GetInt( p_intf, "qt-privacy-ask") )
{
buildPrivDialog();
setVisible( true );
}
else
close();
#endif
}
void FirstRun::save()
{
QList<ConfigControl *>::Iterator i;
for( i = controlsList.begin() ; i != controlsList.end() ; i++ )
{
ConfigControl *c = qobject_cast<ConfigControl *>(*i);
c->doApply( p_intf );
}
config_PutInt( p_intf, "qt-privacy-ask", 0 );
/* We have to save here because the user may not launch Prefs */
config_SaveConfigFile( p_intf, NULL );
close();
}
void FirstRun::buildPrivDialog()
{
setWindowTitle( qtr( "Privacy and Network Policies" ) );
setWindowRole( "vlc-privacy" );
setWindowModality( Qt::ApplicationModal );
setWindowFlags( Qt::Dialog );
setAttribute( Qt::WA_DeleteOnClose );
QGridLayout *gLayout = new QGridLayout( this );
QGroupBox *blabla = new QGroupBox( qtr( "Privacy and Network Warning" ) );
QGridLayout *blablaLayout = new QGridLayout( blabla );
QLabel *text = new QLabel( qtr(
"<p>The <i>VideoLAN Team</i> doesn't like when an application goes "
"online without authorization.</p>\n "
"<p><i>VLC media player</i> can retreive limited information from "
"the Internet in order to get CD covers or to check "
"for available updates.</p>\n"
"<p><i>VLC media player</i> <b>DOES NOT</b> send or collect <b>ANY</b> "
"information, even anonymously, about your usage.</p>\n"
"<p>Therefore please select from the following options, the default being "
"almost no access to the web.</p>\n") );
text->setWordWrap( true );
text->setTextFormat( Qt::RichText );
blablaLayout->addWidget( text, 0, 0 ) ;
QGroupBox *options = new QGroupBox;
QGridLayout *optionsLayout = new QGridLayout( options );
gLayout->addWidget( blabla, 0, 0, 1, 3 );
gLayout->addWidget( options, 1, 0, 1, 3 );
module_config_t *p_config;
ConfigControl *control;
int line = 0;
#define CONFIG_GENERIC( option, type ) \
p_config = config_FindConfig( VLC_OBJECT(p_intf), option ); \
if( p_config ) \
{ \
control = new type ## ConfigControl( VLC_OBJECT(p_intf), \
p_config, options, false, optionsLayout, line ); \
controlsList.append( control ); \
}
#define CONFIG_GENERIC_NOBOOL( option, type ) \
p_config = config_FindConfig( VLC_OBJECT(p_intf), option ); \
if( p_config ) \
{ \
control = new type ## ConfigControl( VLC_OBJECT(p_intf), \
p_config, options, optionsLayout, line ); \
controlsList.append( control ); \
}
CONFIG_GENERIC( "album-art", IntegerList ); line++;
#ifdef UPDATE_CHECK
CONFIG_GENERIC_NOBOOL( "qt-updates-notif", Bool ); line++;
#endif
QPushButton *ok = new QPushButton( qtr( "OK" ) );
gLayout->addWidget( ok, 2, 2 );
CONNECT( ok, clicked(), this, save() );
}
/*****************************************************************************
* firstrun : First Run dialogs
****************************************************************************
* 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 "qt4.hpp"
#include <QWidget>
class ConfigControl;
class FirstRun : public QWidget
{
Q_OBJECT
public:
FirstRun( QWidget *, intf_thread_t * );
private:
QList<ConfigControl *> controlsList;
intf_thread_t *p_intf;
void buildPrivDialog();
private slots:
void save();
};
......@@ -40,6 +40,7 @@
#include "components/controller.hpp"
#include "components/playlist/playlist.hpp"
#include "dialogs/external.hpp"
#include "dialogs/firstrun.hpp"
#include "menus.hpp"
#include "recents.hpp"
......@@ -98,8 +99,8 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
stackCentralOldState = HIDDEN_TAB;
i_bg_height = 0;
/* Ask for privacy */
askForPrivacy();
/* Ask for Privacy */
new FirstRun( this, p_intf );
/**
* Configuration and settings
......@@ -592,98 +593,6 @@ inline void MainInterface::initSystray()
#endif
}
inline void MainInterface::askForPrivacy()
{
#ifndef HAVE_MAEMO
/**
* Ask for the network policy on FIRST STARTUP
**/
if( config_GetInt( p_intf, "qt-privacy-ask") )
{
QList<ConfigControl *> controls;
if( privacyDialog( &controls ) == QDialog::Accepted )
{
QList<ConfigControl *>::Iterator i;
for( i = controls.begin() ; i != controls.end() ; i++ )
{
ConfigControl *c = qobject_cast<ConfigControl *>(*i);
c->doApply( p_intf );
}
config_PutInt( p_intf, "qt-privacy-ask" , 0 );
/* We have to save here because the user may not launch Prefs */
config_SaveConfigFile( p_intf, NULL );
}
}
#endif
}
int MainInterface::privacyDialog( QList<ConfigControl *> *controls )
{
QDialog *privacy = new QDialog( this );
privacy->setWindowTitle( qtr( "Privacy and Network Policies" ) );
privacy->setWindowRole( "vlc-privacy" );
QGridLayout *gLayout = new QGridLayout( privacy );
QGroupBox *blabla = new QGroupBox( qtr( "Privacy and Network Warning" ) );
QGridLayout *blablaLayout = new QGridLayout( blabla );
QLabel *text = new QLabel( qtr(
"<p>The <i>VideoLAN Team</i> doesn't like when an application goes "
"online without authorization.</p>\n "
"<p><i>VLC media player</i> can retreive limited information from "
"the Internet in order to get CD covers or to check "
"for available updates.</p>\n"
"<p><i>VLC media player</i> <b>DOES NOT</b> send or collect <b>ANY</b> "
"information, even anonymously, about your usage.</p>\n"
"<p>Therefore please select from the following options, the default being "
"almost no access to the web.</p>\n") );
text->setWordWrap( true );
text->setTextFormat( Qt::RichText );
blablaLayout->addWidget( text, 0, 0 ) ;
QGroupBox *options = new QGroupBox;
QGridLayout *optionsLayout = new QGridLayout( options );
gLayout->addWidget( blabla, 0, 0, 1, 3 );
gLayout->addWidget( options, 1, 0, 1, 3 );
module_config_t *p_config;
ConfigControl *control;
int line = 0;
#define CONFIG_GENERIC( option, type ) \
p_config = config_FindConfig( VLC_OBJECT(p_intf), option ); \
if( p_config ) \
{ \
control = new type ## ConfigControl( VLC_OBJECT(p_intf), \
p_config, options, false, optionsLayout, line ); \
controls->append( control ); \
}
#define CONFIG_GENERIC_NOBOOL( option, type ) \
p_config = config_FindConfig( VLC_OBJECT(p_intf), option ); \
if( p_config ) \
{ \
control = new type ## ConfigControl( VLC_OBJECT(p_intf), \
p_config, options, optionsLayout, line ); \
controls->append( control ); \
}
CONFIG_GENERIC( "album-art", IntegerList ); line++;
#ifdef UPDATE_CHECK
CONFIG_GENERIC_NOBOOL( "qt-updates-notif", Bool ); line++;
#endif
QPushButton *ok = new QPushButton( qtr( "OK" ) );
gLayout->addWidget( ok, 2, 2 );
CONNECT( ok, clicked(), privacy, accept() );
return privacy->exec();
}
/**********************************************************************
* Handling of sizing of the components
......
......@@ -111,9 +111,6 @@ private:
void createMainWidget( QSettings* );
void createStatusBar();
void askForPrivacy();
int privacyDialog( QList<ConfigControl *> *controls );
/* Systray */
void handleSystray();
void createSystray();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment