#include <QSlider>
#include <QFileDialog>
#include <QFontDialog>
+#include <QGroupBox>
#include <vlc_keys.h>
+
+QString formatTooltip(const QString & tooltip)
+{
+ QString formatted =
+ "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">"
+ " p, li { white-space: pre-wrap; } </style></head><body style=\" font-family:'Sans Serif';"
+ " font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;\">"
+ "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; "
+ "-qt-block-indent:0; text-indent:0px;\">" +
+ tooltip +
+ "</p></body></html>";
+ return formatted;
+}
+
ConfigControl *ConfigControl::createControl( vlc_object_t *p_this,
module_config_t *p_item,
QWidget *parent )
void StringConfigControl::finish()
{
text->setText( qfu(p_item->value.psz) );
- text->setToolTip( qfu(p_item->psz_longtext) );
+ text->setToolTip( formatTooltip(qfu(p_item->psz_longtext)) );
if( label )
- label->setToolTip( qfu(p_item->psz_longtext) );
+ label->setToolTip( formatTooltip(qfu(p_item->psz_longtext)) );
}
/*********** File **************/
label = new QLabel( qfu(p_item->psz_text) );
text = new QLineEdit( qfu(p_item->value.psz) );
browse = new QPushButton( qtr( "Browse..." ) );
+ QHBoxLayout *textAndButton = new QHBoxLayout();
+ textAndButton->setMargin( 0 );
+ textAndButton->addWidget( text, 2 );
+ textAndButton->addWidget( browse, 0 );
BUTTONACT( browse, updateField() );
if( !l )
{
QHBoxLayout *layout = new QHBoxLayout();
- layout->addWidget( label, 0 ); layout->addWidget( text, 1 );
- layout->addWidget( browse, 2 );
+ layout->addWidget( label, 0 );
+ layout->addLayout( textAndButton, 1 );
widget->setLayout( layout );
}
else
{
- l->addWidget( label, line, 0 ); l->addWidget( text, line, 1 );
- l->addWidget( browse, line, 2 );
+ l->addWidget( label, line, 0 );
+ l->addLayout( textAndButton, line, 1 );
}
}
void FileConfigControl::finish()
{
text->setText( qfu(p_item->value.psz) );
- text->setToolTip( qfu(p_item->psz_longtext) );
+ text->setToolTip( formatTooltip(qfu(p_item->psz_longtext)) );
if( label )
- label->setToolTip( qfu(p_item->psz_longtext) );
+ label->setToolTip( formatTooltip(qfu(p_item->psz_longtext)) );
}
/********* String / Directory **********/
p_item->ppsz_list[i_index] ) )
combo->setCurrentIndex( combo->count() - 1 );
}
- combo->setToolTip( qfu(p_item->psz_longtext) );
+ combo->setToolTip( formatTooltip(qfu(p_item->psz_longtext)) );
if( label )
- label->setToolTip( qfu(p_item->psz_longtext) );
+ label->setToolTip( formatTooltip(qfu(p_item->psz_longtext)) );
}
QString StringListConfigControl::getValue()
}
}
vlc_list_release( p_list );
- combo->setToolTip( qfu(p_item->psz_longtext) );
+ combo->setToolTip( formatTooltip(qfu(p_item->psz_longtext)) );
if( label )
- label->setToolTip( qfu(p_item->psz_longtext) );
+ label->setToolTip( formatTooltip(qfu(p_item->psz_longtext)) );
}
QString ModuleConfigControl::getValue()
/********* Module list **********/
ModuleListConfigControl::ModuleListConfigControl( vlc_object_t *_p_this,
- module_config_t *_p_item, QWidget *_parent, bool bycat,
- QGridLayout *l, int &line) :
- VStringConfigControl( _p_this, _p_item, _parent )
+ module_config_t *_p_item, QWidget *_parent, bool bycat,
+ QGridLayout *l, int &line) :
+ VStringConfigControl( _p_this, _p_item, _parent )
{
- label = new QLabel( qfu(p_item->psz_text) );
+ groupBox = new QGroupBox ( qfu(p_item->psz_text) );
text = new QLineEdit();
+ QGridLayout *layoutGroupBox = new QGridLayout( groupBox );
+
finish( bycat );
- bool pom = false;
+ int boxline = 0;
+ for( QVector<checkBoxListItem*>::iterator it = modules.begin();
+ it != modules.end(); it++ )
+ {
+ layoutGroupBox->addWidget( (*it)->checkBox, boxline++, 0 );
+ }
+ layoutGroupBox->addWidget( text, boxline, 0 );
+
if( !l )
{
- l = new QGridLayout();
- line = 0;
- pom = true;
+ QVBoxLayout *layout = new QVBoxLayout();
+ layout->addWidget( groupBox, line, 0 );
+ widget->setLayout( layout );
}
- for( QVector<QCheckBox*>::iterator it = modules.begin();
- it != modules.end(); it++ )
+ else
{
- l->addWidget( *it, line++, 1 );
+ l->addWidget( groupBox, line, 0, 1, -1 );
}
- l->addWidget( label, line, 0 );
- l->addWidget( text, line, 1 );
- if( pom )
- widget->setLayout( l );
+
+ text->setToolTip( formatTooltip( qfu( p_item->psz_longtext) ) );
}
#if 0
ModuleConfigControl::ModuleConfigControl( vlc_object_t *_p_this,
- module_config_t *_p_item, QLabel *_label, QComboBox *_combo,
- bool bycat ) : VStringConfigControl( _p_this, _p_item )
+ module_config_t *_p_item, QLabel *_label, QComboBox *_combo,
+ bool bycat ) : VStringConfigControl( _p_this, _p_item )
{
combo = _combo;
label = _label;
ModuleListConfigControl::~ModuleListConfigControl()
{
- for( QVector<QCheckBox*>::iterator it = modules.begin();
- it != modules.end(); it++ )
+ for( QVector<checkBoxListItem*>::iterator it = modules.begin();
+ it != modules.end(); it++ )
{
delete *it;
}
- delete label;
+ delete groupBox;
delete text;
}
+#define CHECKBOX_LISTS \
+{ \
+ QCheckBox *cb = new QCheckBox( qfu( p_parser->psz_longname ) );\
+ checkBoxListItem *cbl = new checkBoxListItem; \
+\
+ CONNECT( cb, stateChanged( int ), this, onUpdate( int ) );\
+ cb->setToolTip( formatTooltip( qfu(p_parser->psz_longname)) );\
+ cbl->checkBox = cb; \
+\
+ int i = -1; \
+ while( p_parser->pp_shortcuts[++i] != NULL); \
+ i--; \
+\
+ cbl->psz_module = strdup( i>=0?p_parser->pp_shortcuts[i] \
+ : p_parser->psz_object_name ); \
+ modules.push_back( cbl ); \
+}
+
+
void ModuleListConfigControl::finish( bool bycat )
{
vlc_list_t *p_list;
module_config_t *p_config = p_parser->p_config + i;
/* Hack: required subcategory is stored in i_min */
if( p_config->i_type == CONFIG_SUBCATEGORY &&
- p_config->value.i == p_item->min.i )
+ p_config->value.i == p_item->min.i )
{
- QCheckBox *cb =
- new QCheckBox( qfu( p_parser->psz_object_name ) );
- cb->setToolTip( qfu(p_parser->psz_longname) );
- modules.push_back( cb );
+ CHECKBOX_LISTS;
}
}
}
else if( !strcmp( p_parser->psz_capability, p_item->psz_type ) )
{
- QCheckBox *cb =
- new QCheckBox( qfu( p_parser->psz_object_name ) );
- cb->setToolTip( qfu(p_parser->psz_longname) );
- modules.push_back( cb );
+ CHECKBOX_LISTS;
}
}
vlc_list_release( p_list );
- text->setToolTip( qfu(p_item->psz_longtext) );
- if( label )
- label->setToolTip( qfu(p_item->psz_longtext) );
+ text->setToolTip( formatTooltip(qfu(p_item->psz_longtext)) );
+ if( groupBox )
+ groupBox->setToolTip( formatTooltip(qfu(p_item->psz_longtext)) );
}
+#undef CHECKBOX_LISTS
QString ModuleListConfigControl::getValue()
{
void ModuleListConfigControl::hide()
{
- for( QVector<QCheckBox*>::iterator it = modules.begin();
+ for( QVector<checkBoxListItem*>::iterator it = modules.begin();
it != modules.end(); it++ )
{
- (*it)->hide();
+ (*it)->checkBox->hide();
}
- text->hide();
- label->hide();
+ groupBox->hide();
}
void ModuleListConfigControl::show()
{
- for( QVector<QCheckBox*>::iterator it = modules.begin();
+ for( QVector<checkBoxListItem*>::iterator it = modules.begin();
it != modules.end(); it++ )
{
- (*it)->show();
+ (*it)->checkBox->show();
}
- text->show();
- label->show();
+ groupBox->show();
}
-void ModuleListConfigControl::wakeUp_TheUserJustClickedOnSomething( int value )
+void ModuleListConfigControl::onUpdate( int value )
{
text->clear();
- for( QVector<QCheckBox*>::iterator it = modules.begin();
+ bool first = true;
+
+ for( QVector<checkBoxListItem*>::iterator it = modules.begin();
it != modules.end(); it++ )
{
+ if( (*it)->checkBox->isChecked() )
+ {
+ if( first )
+ {
+ text->setText( text->text() + (*it)->psz_module );
+ first = false;
+ }
+ else
+ {
+ text->setText( text->text() + ":" + (*it)->psz_module );
+ }
+ }
}
}
{
label = new QLabel( qfu(p_item->psz_text) );
spin = new QSpinBox; spin->setMinimumWidth( 80 );
+ spin->setAlignment( Qt::AlignRight );
spin->setMaximumWidth( 90 );
finish();
spin->setMaximum( 2000000000 );
spin->setMinimum( -2000000000 );
spin->setValue( p_item->value.i );
- spin->setToolTip( qfu(p_item->psz_longtext) );
+ spin->setToolTip( formatTooltip(qfu(p_item->psz_longtext)) );
if( label )
- label->setToolTip( qfu(p_item->psz_longtext) );
+ label->setToolTip( formatTooltip(qfu(p_item->psz_longtext)) );
}
int IntegerConfigControl::getValue()
slider->setMaximum( p_item->max.i );
slider->setMinimum( p_item->min.i );
slider->setValue( p_item->value.i );
- slider->setToolTip( qfu(p_item->psz_longtext) );
+ slider->setToolTip( formatTooltip(qfu(p_item->psz_longtext)) );
if( label )
- label->setToolTip( qfu(p_item->psz_longtext) );
+ label->setToolTip( formatTooltip(qfu(p_item->psz_longtext)) );
}
int IntegerRangeSliderConfigControl::getValue()
if( p_item->value.i == p_item->pi_list[i_index] )
combo->setCurrentIndex( combo->count() - 1 );
}
- combo->setToolTip( qfu(p_item->psz_longtext) );
+ combo->setToolTip( formatTooltip(qfu(p_item->psz_longtext)) );
if( label )
- label->setToolTip( qfu(p_item->psz_longtext) );
+ label->setToolTip( formatTooltip(qfu(p_item->psz_longtext)) );
}
int IntegerListConfigControl::getValue()
{
checkbox->setCheckState( p_item->value.i == VLC_TRUE ? Qt::Checked
: Qt::Unchecked );
- checkbox->setToolTip( qfu(p_item->psz_longtext) );
+ checkbox->setToolTip( formatTooltip(qfu(p_item->psz_longtext)) );
}
int BoolConfigControl::getValue()
label = new QLabel( qfu(p_item->psz_text) );
spin = new QDoubleSpinBox; spin->setMinimumWidth( 80 );
spin->setMaximumWidth( 90 );
+ spin->setAlignment( Qt::AlignRight );
finish();
if( !l )
spin->setMinimum( -2000000000. );
spin->setSingleStep( 0.1 );
spin->setValue( (double)p_item->value.f );
- spin->setToolTip( qfu(p_item->psz_longtext) );
+ spin->setToolTip( formatTooltip(qfu(p_item->psz_longtext)) );
if( label )
- label->setToolTip( qfu(p_item->psz_longtext) );
+ label->setToolTip( formatTooltip(qfu(p_item->psz_longtext)) );
}
float FloatConfigControl::getValue()
void KeySelectorControl::finish()
{
if( label )
- label->setToolTip( qfu(p_item->psz_longtext) );
+ label->setToolTip( formatTooltip(qfu(p_item->psz_longtext)) );
/* Fill the table */
table->setColumnCount( 2 );