modules/gui/kde/interface.cpp: removed a debug message

modules/gui/kde/preferences.cpp: use sliders for integer and float options
with a range, use combobox for string_from_list options, fixed a layout
issue and removed some debug messages
parent a91ad06c
...@@ -58,7 +58,6 @@ KInterface::KInterface( intf_thread_t *p_intf, QWidget *parent, ...@@ -58,7 +58,6 @@ KInterface::KInterface( intf_thread_t *p_intf, QWidget *parent,
connect( fTimer, SIGNAL( timeout() ), this, SLOT( slotManage() ) ); connect( fTimer, SIGNAL( timeout() ), this, SLOT( slotManage() ) );
resize( 400, 30 ); resize( 400, 30 );
msg_Dbg(p_intf, KStdAction::stdName(KStdAction::Preferences));
/////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////
// call inits to invoke all other construction parts // call inits to invoke all other construction parts
// XXX could we move this up ? // XXX could we move this up ?
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* preferences.cpp: preferences window for the kde gui * preferences.cpp: preferences window for the kde gui
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: preferences.cpp,v 1.13 2003/03/29 14:30:55 sigmunau Exp $ * $Id: preferences.cpp,v 1.14 2003/03/30 11:59:00 sigmunau Exp $
* *
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no> Mon Aug 12 2002 * Authors: Sigmund Augdal <sigmunau@idi.ntnu.no> Mon Aug 12 2002
* *
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <qlistview.h> #include <qlistview.h>
#include <qnamespace.h> #include <qnamespace.h>
#include <qobjectlist.h> #include <qobjectlist.h>
#include <qslider.h>
#include <qspinbox.h> #include <qspinbox.h>
#include <qtooltip.h> #include <qtooltip.h>
#include <qvbox.h> #include <qvbox.h>
...@@ -39,6 +40,7 @@ ...@@ -39,6 +40,7 @@
#include <klocale.h> #include <klocale.h>
#include <knuminput.h> #include <knuminput.h>
#include <kurlrequester.h> #include <kurlrequester.h>
#include <kcombobox.h>
#include "QConfigItem.h" #include "QConfigItem.h"
#include "pluginsbox.h" #include "pluginsbox.h"
...@@ -67,17 +69,20 @@ KPreferences::KPreferences(intf_thread_t *p_intf, const char *psz_module_name, ...@@ -67,17 +69,20 @@ KPreferences::KPreferences(intf_thread_t *p_intf, const char *psz_module_name,
for( i_index = 0; i_index < p_list->i_count; i_index++ ) for( i_index = 0; i_index < p_list->i_count; i_index++ )
{ {
p_parser = (module_t *)p_list->p_values[i_index].p_object ; p_parser = (module_t *)p_list->p_values[i_index].p_object ;
msg_Dbg( p_intf,"adding module: %s", p_parser->psz_object_name );
p_item = p_parser->p_config; p_item = p_parser->p_config;
while( p_item && p_item->i_type != CONFIG_HINT_END ) while( p_item && p_item->i_type != CONFIG_HINT_END )
{ {
msg_Dbg( p_intf, "adding item: %s type: %d", p_item->psz_text,p_item->i_type );
switch( p_item->i_type ) switch( p_item->i_type )
{ {
case CONFIG_HINT_CATEGORY: case CONFIG_HINT_CATEGORY:
case CONFIG_HINT_END: /* force the content to the top of the page */
if ( category_table )
{
QWidget *space = new QWidget( category_table );
category_table->setStretchFactor( space, 10 );
category_table = NULL;
}
/* /*
* Now we can start taking care of the new category * Now we can start taking care of the new category
*/ */
...@@ -148,17 +153,36 @@ KPreferences::KPreferences(intf_thread_t *p_intf, const char *psz_module_name, ...@@ -148,17 +153,36 @@ KPreferences::KPreferences(intf_thread_t *p_intf, const char *psz_module_name,
new QLabel(p_item->psz_text, hb); new QLabel(p_item->psz_text, hb);
/* add input box with default value */ /* add input box with default value */
vlc_mutex_lock( p_item->p_lock ); vlc_mutex_lock( p_item->p_lock );
KLineEdit *kl = new KLineEdit( p_item->psz_value ?
p_item->psz_value : "", hb);
QConfigItem *ci = new QConfigItem(this, p_item->psz_name, QConfigItem *ci = new QConfigItem(this, p_item->psz_name,
p_item->i_type, p_item->i_type,
p_item->psz_value ? p_item->psz_value ?
p_item->psz_value : ""); p_item->psz_value : "");
connect(kl, SIGNAL(textChanged ( const QString & )), if ( p_item->ppsz_list )
ci, SLOT(setValue( const QString &))); {
QToolTip::add(kl, p_item->psz_longtext); char **ppsz_list = p_item->ppsz_list;
kl->setMaxLength(40); KComboBox *p_combobox = new KComboBox( true, hb );
QToolTip::add(p_combobox, p_item->psz_longtext);
connect(p_combobox, SIGNAL(activated ( const QString & )),
ci, SLOT(setValue( const QString &)));
while ( *ppsz_list )
{
p_combobox->insertItem( *ppsz_list );
if ( !strcmp( *ppsz_list, p_item->psz_value?p_item->psz_value: "" ) )
{
p_combobox->setCurrentText( *ppsz_list );
}
ppsz_list++;
}
}
else
{
KLineEdit *kl = new KLineEdit( p_item->psz_value ?
p_item->psz_value : "", hb);
connect(kl, SIGNAL(textChanged ( const QString & )),
ci, SLOT(setValue( const QString &)));
QToolTip::add(kl, p_item->psz_longtext);
kl->setMaxLength(40);
}
vlc_mutex_unlock( p_item->p_lock ); vlc_mutex_unlock( p_item->p_lock );
} }
...@@ -195,14 +219,25 @@ KPreferences::KPreferences(intf_thread_t *p_intf, const char *psz_module_name, ...@@ -195,14 +219,25 @@ KPreferences::KPreferences(intf_thread_t *p_intf, const char *psz_module_name,
QHBox *hb = new QHBox(category_table); QHBox *hb = new QHBox(category_table);
hb->setSpacing(spacingHint()); hb->setSpacing(spacingHint());
new QLabel(p_item->psz_text, hb); new QLabel(p_item->psz_text, hb);
QSpinBox *item_adj = new QSpinBox(-1, 99999, 1, hb);
QConfigItem *ci = new QConfigItem(this, p_item->psz_name, QConfigItem *ci = new QConfigItem(this, p_item->psz_name,
p_item->i_type, p_item->i_type,
p_item->i_value); p_item->i_value);
item_adj->setValue( p_item->i_value ); if ( p_item->i_min == 0 && p_item->i_max == 0 )
connect(item_adj, SIGNAL(valueChanged( int)), {
ci, SLOT(setValue(int))); QSpinBox *item_adj = new QSpinBox(-1, 99999, 1, hb);
QToolTip::add(item_adj, p_item->psz_longtext); item_adj->setValue( p_item->i_value );
connect(item_adj, SIGNAL(valueChanged( int)),
ci, SLOT(setValue(int)));
QToolTip::add(item_adj, p_item->psz_longtext);
}
else
{
KIntNumInput *p_ii = new KIntNumInput( p_item->i_value, hb );
p_ii->setRange( p_item->i_min, p_item->i_max, 1, true );
connect( p_ii, SIGNAL( valueChanged( int ) ),
ci, SLOT( setValue( int ) ) );
QToolTip::add( p_ii, p_item->psz_longtext );
}
} }
break; break;
...@@ -212,7 +247,14 @@ KPreferences::KPreferences(intf_thread_t *p_intf, const char *psz_module_name, ...@@ -212,7 +247,14 @@ KPreferences::KPreferences(intf_thread_t *p_intf, const char *psz_module_name,
hb->setSpacing(spacingHint()); hb->setSpacing(spacingHint());
new QLabel(p_item->psz_text, hb); new QLabel(p_item->psz_text, hb);
KDoubleNumInput *kdi= new KDoubleNumInput(p_item->f_value, hb); KDoubleNumInput *kdi= new KDoubleNumInput(p_item->f_value, hb);
kdi->setRange(-1, 99999, 0.01, false); if ( p_item->f_min == 0 && p_item->f_max == 0 )
{
kdi->setRange(-1, 99999, 0.01, false);
}
else
{
kdi->setRange( p_item->f_min, p_item->f_max, 0.01, true );
}
QConfigItem *ci = new QConfigItem(this, p_item->psz_name, QConfigItem *ci = new QConfigItem(this, p_item->psz_name,
p_item->i_type, p_item->i_type,
p_item->f_value); p_item->f_value);
...@@ -240,10 +282,18 @@ KPreferences::KPreferences(intf_thread_t *p_intf, const char *psz_module_name, ...@@ -240,10 +282,18 @@ KPreferences::KPreferences(intf_thread_t *p_intf, const char *psz_module_name,
break; break;
} }
p_item++; p_item++;
} }
} }
/* force the content to the top of the page, even on the last page */
if ( category_table )
{
QWidget *space = new QWidget( category_table );
category_table->setStretchFactor( space, 10 );
category_table = NULL;
}
vlc_list_release( p_list ); vlc_list_release( p_list );
......
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