#include <QGridLayout>
#include <QPushButton>
#include <QSlider>
+#include <QFileDialog>
#include <vlc_keys.h>
l, line );
break;
case CONFIG_ITEM_FILE:
- fprintf( stderr, "Todo (CONFIG_ITEM_FILE)\n" );
+ p_control = new FileConfigControl( p_this, p_item, parent, l,
+ line, false );
break;
case CONFIG_ITEM_DIRECTORY:
fprintf( stderr, "Todo (CONFIG_ITEM_DIRECTORY)\n" );
label->setToolTip( qfu(p_item->psz_longtext) );
}
+/*********** File **************/
+FileConfigControl::FileConfigControl( vlc_object_t *_p_this,
+ module_config_t *_p_item,
+ QWidget *_parent, QGridLayout *l,
+ int &line, bool pwd ) :
+ VStringConfigControl( _p_this, _p_item, _parent )
+{
+ label = new QLabel( qfu(p_item->psz_text) );
+ text = new QLineEdit( qfu(p_item->value.psz) );
+ browse = new QPushButton( qtr( "Browse" ) );
+
+ BUTTONACT( browse, updateField() );
+
+ finish();
+
+ if( !l )
+ {
+ QHBoxLayout *layout = new QHBoxLayout();
+ layout->addWidget( label, 0 ); layout->addWidget( text, 1 );
+ layout->addWidget( browse, 2 );
+ widget->setLayout( layout );
+ }
+ else
+ {
+ l->addWidget( label, line, 0 ); l->addWidget( text, line, 1 );
+ l->addWidget( browse, line, 2 );
+ }
+}
+
+
+FileConfigControl::FileConfigControl( vlc_object_t *_p_this,
+ module_config_t *_p_item,
+ QLabel *_label, QLineEdit *_text, bool pwd ):
+ VStringConfigControl( _p_this, _p_item )
+{
+ text = _text;
+ label = _label;
+ finish( );
+}
+
+void FileConfigControl::updateField()
+{
+ text->setText( QFileDialog::getOpenFileName( NULL,
+ qtr( "Select File" ), qfu( p_this->p_libvlc->psz_homedir ) ) );
+}
+
+void FileConfigControl::finish()
+{
+ text->setText( qfu(p_item->value.psz) );
+ text->setToolTip( qfu(p_item->psz_longtext) );
+ if( label )
+ label->setToolTip( qfu(p_item->psz_longtext) );
+}
+
/********* String / choice list **********/
StringListConfigControl::StringListConfigControl( vlc_object_t *_p_this,
module_config_t *_p_item, QWidget *_parent, bool bycat,
#include <QVector>
#include <QDialog>
#include <QLabel>
+#include <QFile>
#include "qt4.hpp"
#include <assert.h>
QLabel *label;
};
+class FileConfigControl : public VStringConfigControl
+{
+ Q_OBJECT;
+public:
+ FileConfigControl( vlc_object_t *, module_config_t *, QWidget *,
+ QGridLayout *, int&, bool pwd );
+ FileConfigControl( vlc_object_t *, module_config_t *, QLabel *,
+ QLineEdit*, bool pwd );
+ virtual ~FileConfigControl() {};
+ virtual QString getValue() { return text->text(); };
+ virtual void show() { text->show(); label->show(); }
+ virtual void hide() { text->hide(); label->hide(); }
+public slots:
+ void updateField();
+private:
+ void finish();
+ QLineEdit *text;
+ QLabel *label;
+ QPushButton *browse;
+};
+
+
class ModuleConfigControl : public VStringConfigControl
{
public:
dXdisplayDevice );
#endif
- CONFIG_GENERIC( "snapshot-path", String, NULL,
+ CONFIG_GENERIC( "snapshot-path", File, NULL,
snapshotsDirectory ); /* FIXME -> use file instead of string */
CONFIG_GENERIC( "snapshot-prefix", String, NULL, snapshotsPrefix );
CONFIG_GENERIC( "snapshot-sequential", Bool, NULL,
CONFIG_GENERIC( "aout" , Module , NULL, outputModule );
#ifndef WIN32
CONFIG_GENERIC( "alsadev" , StringList , NULL, alsaDevice );
- CONFIG_GENERIC( "dspdev" , String , NULL, OSSDevice );
+ CONFIG_GENERIC( "dspdev" , File , NULL, OSSDevice );
//FIXME File
#else
CONFIG_GENERIC( "directx-audio-device" , IntegerList, NULL,
DirectXDevice );
#endif
- CONFIG_GENERIC( "audiofile-file" , String , NULL, FileName );
+ CONFIG_GENERIC( "audiofile-file" , File , NULL, FileName );
//Fixme File
CONFIG_GENERIC( "headphone-dolby" , Bool , NULL, headphoneEffect );
ui.skins->setChecked( true );*/
/* CONFIG_GENERIC( "intf", Module, NULL, ??? ); */ //FIXME interface choice
CONFIG_GENERIC( "qt-always-video", Bool, NULL, qtAlwaysVideo );
- CONFIG_GENERIC( "skins2-last", String, NULL, fileSkin);
+ CONFIG_GENERIC( "skins2-last", File, NULL, fileSkin);
//FIXME File
#if defined( WIN32 ) || defined(HAVE_DBUS_3)
CONFIG_GENERIC( "one-instance", Bool, NULL, OneInterfaceMode );
CONFIG_GENERIC( "subsdec-encoding", StringList, NULL, encoding );
CONFIG_GENERIC( "sub-language", String, NULL, preferredLanguage );
- CONFIG_GENERIC( "freetype-font", String, 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-rel-fontsize", IntegerList, NULL,