Commit 317dd0af authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt4 - Preferences. Add CONFIG_DIRECTORY_ITEM. Does not work, but does not...

Qt4 - Preferences. Add CONFIG_DIRECTORY_ITEM. Does not work, but does not harm. Why ? can a C++ guru explain me? thks!

parent 0e081263
/***************************************************************************** /*****************************************************************************
* preferences_widgets.cpp : Widgets for preferences displays * preferences_widgets.cpp : Widgets for preferences displays
**************************************************************************** ****************************************************************************
* Copyright (C) 2006 the VideoLAN team * Copyright (C) 2006-2007 the VideoLAN team
* $Id$ * $Id$
* *
* Authors: Clément Stenac <zorglub@videolan.org> * Authors: Clément Stenac <zorglub@videolan.org>
* Antoine Cellerier <dionoea@videolan.org> * Antoine Cellerier <dionoea@videolan.org>
* Jean-Baptiste Kempf <jb@videolan.org>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
...@@ -106,7 +107,8 @@ ConfigControl *ConfigControl::createControl( vlc_object_t *p_this, ...@@ -106,7 +107,8 @@ ConfigControl *ConfigControl::createControl( vlc_object_t *p_this,
line, false ); line, false );
break; break;
case CONFIG_ITEM_DIRECTORY: case CONFIG_ITEM_DIRECTORY:
fprintf( stderr, "Todo (CONFIG_ITEM_DIRECTORY)\n" ); p_control = new DirectoryConfigControl( p_this, p_item, parent, l,
line, false );
break; break;
case CONFIG_ITEM_KEY: case CONFIG_ITEM_KEY:
p_control = new KeySelectorControl( p_this, p_item, parent, l, line ); p_control = new KeySelectorControl( p_this, p_item, parent, l, line );
...@@ -263,6 +265,28 @@ void FileConfigControl::finish() ...@@ -263,6 +265,28 @@ void FileConfigControl::finish()
label->setToolTip( qfu(p_item->psz_longtext) ); label->setToolTip( qfu(p_item->psz_longtext) );
} }
/********* String / Directory **********/
DirectoryConfigControl::DirectoryConfigControl( vlc_object_t *_p_this,
module_config_t *_p_item, QWidget *_p_widget,
QGridLayout *_p_layout, int& _int, bool _pwd ) :
FileConfigControl( _p_this, _p_item, _p_widget, _p_layout, _int, _pwd)
{}
DirectoryConfigControl::DirectoryConfigControl( vlc_object_t *_p_this,
module_config_t *_p_item, QLabel *_p_label,
QLineEdit *_p_line, bool _pwd ) :
FileConfigControl( _p_this, _p_item, _p_label, _p_line, _pwd)
{}
void DirectoryConfigControl::updateField()
{
text->setText( QFileDialog::getOpenFileName( NULL,
qtr( "Select File" ), qfu( p_this->p_libvlc->psz_homedir ),
NULL, 0, QFileDialog::ShowDirsOnly ) );
}
/********* String / choice list **********/ /********* String / choice list **********/
StringListConfigControl::StringListConfigControl( vlc_object_t *_p_this, StringListConfigControl::StringListConfigControl( vlc_object_t *_p_this,
module_config_t *_p_item, QWidget *_parent, bool bycat, module_config_t *_p_item, QWidget *_parent, bool bycat,
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
* *
* Authors: Clément Stenac <zorglub@videolan.org> * Authors: Clément Stenac <zorglub@videolan.org>
* Antoine Cellerier <dionoea@videolan.org> * Antoine Cellerier <dionoea@videolan.org>
* Jean-Baptiste Kempf <jb@videolan.org>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
...@@ -36,6 +37,7 @@ ...@@ -36,6 +37,7 @@
#include <QDialog> #include <QDialog>
#include <QLabel> #include <QLabel>
#include <QFile> #include <QFile>
#include <QPushButton>
#include "qt4.hpp" #include "qt4.hpp"
#include <assert.h> #include <assert.h>
...@@ -262,17 +264,37 @@ public: ...@@ -262,17 +264,37 @@ public:
QLineEdit*, bool pwd ); QLineEdit*, bool pwd );
virtual ~FileConfigControl() {}; virtual ~FileConfigControl() {};
virtual QString getValue() { return text->text(); }; virtual QString getValue() { return text->text(); };
virtual void show() { text->show(); label->show(); } virtual void show() { text->show(); label->show(); browse->show(); }
virtual void hide() { text->hide(); label->hide(); } virtual void hide() { text->hide(); label->hide(); browse->hide(); }
public slots: public slots:
void updateField(); void updateField();
private: protected:
void finish(); void finish();
private:
QLineEdit *text; QLineEdit *text;
QLabel *label; QLabel *label;
QPushButton *browse; QPushButton *browse;
}; };
class DirectoryConfigControl : public FileConfigControl
{
Q_OBJECT;
public:
DirectoryConfigControl( vlc_object_t *, module_config_t *, QWidget *,
QGridLayout *, int&, bool pwd );
DirectoryConfigControl( vlc_object_t *, module_config_t *, QLabel *,
QLineEdit*, bool pwd );
virtual ~DirectoryConfigControl() {};
virtual QString getValue() { return text->text(); };
virtual void show() { text->show(); label->show(); browse->show(); }
virtual void hide() { text->hide(); label->hide(); browse->hide(); }
public slots:
void updateField();
private:
QLineEdit *text;
QLabel *label;
QPushButton *browse;
};
class ModuleConfigControl : public VStringConfigControl class ModuleConfigControl : public VStringConfigControl
{ {
......
...@@ -157,8 +157,8 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -157,8 +157,8 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
dXdisplayDevice ); dXdisplayDevice );
#endif #endif
CONFIG_GENERIC( "snapshot-path", File, NULL, CONFIG_GENERIC( "snapshot-path", Directory, NULL,
snapshotsDirectory ); /* FIXME -> use file instead of string */ snapshotsDirectory );
CONFIG_GENERIC( "snapshot-prefix", String, NULL, snapshotsPrefix ); CONFIG_GENERIC( "snapshot-prefix", String, NULL, snapshotsPrefix );
CONFIG_GENERIC( "snapshot-sequential", Bool, NULL, CONFIG_GENERIC( "snapshot-sequential", Bool, NULL,
snapshotsSequentialNumbering ); snapshotsSequentialNumbering );
...@@ -192,13 +192,11 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -192,13 +192,11 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
#ifndef WIN32 #ifndef WIN32
CONFIG_GENERIC( "alsadev" , StringList , NULL, alsaDevice ); CONFIG_GENERIC( "alsadev" , StringList , NULL, alsaDevice );
CONFIG_GENERIC( "dspdev" , File , NULL, OSSDevice ); CONFIG_GENERIC( "dspdev" , File , NULL, OSSDevice );
//FIXME File
#else #else
CONFIG_GENERIC( "directx-audio-device" , IntegerList, NULL, CONFIG_GENERIC( "directx-audio-device" , IntegerList, NULL,
DirectXDevice ); DirectXDevice );
#endif #endif
CONFIG_GENERIC( "audiofile-file" , File , NULL, FileName ); CONFIG_GENERIC( "audiofile-file" , File , NULL, FileName );
//Fixme File
CONFIG_GENERIC( "headphone-dolby" , Bool , NULL, headphoneEffect ); CONFIG_GENERIC( "headphone-dolby" , Bool , NULL, headphoneEffect );
// CONFIG_GENERIC( "" , Bool, NULL, ); activation of normalizer // CONFIG_GENERIC( "" , Bool, NULL, ); activation of normalizer
...@@ -243,7 +241,6 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -243,7 +241,6 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
/* CONFIG_GENERIC( "intf", Module, NULL, ??? ); */ //FIXME interface choice /* CONFIG_GENERIC( "intf", Module, NULL, ??? ); */ //FIXME interface choice
CONFIG_GENERIC( "qt-always-video", Bool, NULL, qtAlwaysVideo ); CONFIG_GENERIC( "qt-always-video", Bool, NULL, qtAlwaysVideo );
CONFIG_GENERIC( "skins2-last", File, NULL, fileSkin); CONFIG_GENERIC( "skins2-last", File, NULL, fileSkin);
//FIXME File
#if defined( WIN32 ) || defined(HAVE_DBUS_3) #if defined( WIN32 ) || defined(HAVE_DBUS_3)
CONFIG_GENERIC( "one-instance", Bool, NULL, OneInterfaceMode ); CONFIG_GENERIC( "one-instance", Bool, NULL, OneInterfaceMode );
CONFIG_GENERIC( "playlist-enqueue", Bool, NULL, CONFIG_GENERIC( "playlist-enqueue", Bool, NULL,
...@@ -258,7 +255,6 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -258,7 +255,6 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
CONFIG_GENERIC( "sub-language", String, NULL, preferredLanguage ); CONFIG_GENERIC( "sub-language", String, NULL, preferredLanguage );
CONFIG_GENERIC( "freetype-font", File, NULL, font ); CONFIG_GENERIC( "freetype-font", File, NULL, font );
/* FIXME -> use file instead of string */
CONFIG_GENERIC( "freetype-color", IntegerList, NULL, fontColor ); CONFIG_GENERIC( "freetype-color", IntegerList, NULL, fontColor );
CONFIG_GENERIC( "freetype-rel-fontsize", IntegerList, NULL, CONFIG_GENERIC( "freetype-rel-fontsize", IntegerList, NULL,
fontSize ); fontSize );
......
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