Commit d45fa422 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Qt4: do not create pref tooltip if there is no text

By the way, it seems like we should always use NULL rather than "" for
longtext. Not only this avoids the recurrent gettext("") translation
problem, but an empty tool tip makes no sense. There should be no tool
tip at all if there is no text.
parent 61bbf16f
...@@ -280,12 +280,15 @@ StringConfigControl::StringConfigControl( vlc_object_t *_p_this, ...@@ -280,12 +280,15 @@ StringConfigControl::StringConfigControl( vlc_object_t *_p_this,
void StringConfigControl::finish() void StringConfigControl::finish()
{ {
text->setText( qfu(p_item->value.psz) ); text->setText( qfu(p_item->value.psz) );
text->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) ); if( p_item->psz_longtext )
if( label )
{ {
label->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) ); QString tipText = qtr(p_item->psz_longtext);
label->setBuddy( text ); text->setToolTip( formatTooltip(tipText) );
if( label )
label->setToolTip( formatTooltip(tipText) );
} }
if( label )
label->setBuddy( text );
} }
/*********** File **************/ /*********** File **************/
...@@ -350,12 +353,15 @@ void FileConfigControl::updateField() ...@@ -350,12 +353,15 @@ void FileConfigControl::updateField()
void FileConfigControl::finish() void FileConfigControl::finish()
{ {
text->setText( qfu(p_item->value.psz) ); text->setText( qfu(p_item->value.psz) );
text->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) ); if( p_item->psz_longtext )
if( label )
{ {
label->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) ); QString tipText = qtr(p_item->psz_longtext);
label->setBuddy( text ); text->setToolTip( formatTooltip(tipText) );
if( label )
label->setToolTip( formatTooltip(tipText) );
} }
if( label )
label->setBuddy( text );
} }
/********* String / Directory **********/ /********* String / Directory **********/
...@@ -533,12 +539,16 @@ void StringListConfigControl::finish(module_config_t *p_module_config, bool byca ...@@ -533,12 +539,16 @@ void StringListConfigControl::finish(module_config_t *p_module_config, bool byca
p_module_config->ppsz_list[i_index] ) ) p_module_config->ppsz_list[i_index] ) )
combo->setCurrentIndex( combo->count() - 1 ); combo->setCurrentIndex( combo->count() - 1 );
} }
combo->setToolTip( formatTooltip(qtr(p_module_config->psz_longtext)) );
if( label ) if( p_module_config->psz_longtext )
{ {
label->setToolTip( formatTooltip(qtr(p_module_config->psz_longtext)) ); QString tipText = qtr(p_module_config->psz_longtext);
label->setBuddy( combo ); combo->setToolTip( formatTooltip(tipText) );
if( label )
label->setToolTip( formatTooltip(tipText) );
} }
if( label )
label->setBuddy( combo );
} }
QString StringListConfigControl::getValue() QString StringListConfigControl::getValue()
...@@ -573,6 +583,8 @@ void setfillVLCConfigCombo( const char *configname, intf_thread_t *p_intf, ...@@ -573,6 +583,8 @@ void setfillVLCConfigCombo( const char *configname, intf_thread_t *p_intf,
combo->setCurrentIndex( i_index ); combo->setCurrentIndex( i_index );
} }
} }
if( p_config->psz_longtext )
combo->setToolTip( qfu( p_config->psz_longtext ) ); combo->setToolTip( qfu( p_config->psz_longtext ) );
} }
} }
...@@ -652,12 +664,16 @@ void ModuleConfigControl::finish( bool bycat ) ...@@ -652,12 +664,16 @@ void ModuleConfigControl::finish( bool bycat )
} }
} }
module_list_free( p_list ); module_list_free( p_list );
combo->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) );
if( label ) if( p_item->psz_longtext )
{ {
label->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) ); QString tipText = qtr(p_item->psz_longtext);
label->setBuddy( combo ); combo->setToolTip( formatTooltip(tipText) );
if( label )
label->setToolTip( formatTooltip(tipText) );
} }
if( label )
label->setBuddy( combo );
} }
QString ModuleConfigControl::getValue() QString ModuleConfigControl::getValue()
...@@ -700,6 +716,7 @@ ModuleListConfigControl::ModuleListConfigControl( vlc_object_t *_p_this, ...@@ -700,6 +716,7 @@ ModuleListConfigControl::ModuleListConfigControl( vlc_object_t *_p_this,
l->addWidget( groupBox, line, 0, 1, -1 ); l->addWidget( groupBox, line, 0, 1, -1 );
} }
if( p_item->psz_longtext )
text->setToolTip( formatTooltip( qtr( p_item->psz_longtext) ) ); text->setToolTip( formatTooltip( qtr( p_item->psz_longtext) ) );
} }
...@@ -763,9 +780,15 @@ void ModuleListConfigControl::finish( bool bycat ) ...@@ -763,9 +780,15 @@ void ModuleListConfigControl::finish( bool bycat )
} }
} }
module_list_free( p_list ); module_list_free( p_list );
text->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) );
if( p_item->psz_longtext )
{
QString tipText = qtr(p_item->psz_longtext);
text->setToolTip( formatTooltip(tipText) );
assert( groupBox ); assert( groupBox );
groupBox->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) ); groupBox->setToolTip( formatTooltip(tipText) );
}
} }
#undef CHECKBOX_LISTS #undef CHECKBOX_LISTS
...@@ -863,12 +886,16 @@ void IntegerConfigControl::finish() ...@@ -863,12 +886,16 @@ void IntegerConfigControl::finish()
spin->setMaximum( 2000000000 ); spin->setMaximum( 2000000000 );
spin->setMinimum( -2000000000 ); spin->setMinimum( -2000000000 );
spin->setValue( p_item->value.i ); spin->setValue( p_item->value.i );
spin->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) );
if( label ) if( p_item->psz_longtext )
{ {
label->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) ); QString tipText = qtr(p_item->psz_longtext);
label->setBuddy( spin ); spin->setToolTip( formatTooltip(tipText) );
if( label )
label->setToolTip( formatTooltip(tipText) );
} }
if( label )
label->setBuddy( spin );
} }
int IntegerConfigControl::getValue() int IntegerConfigControl::getValue()
...@@ -911,12 +938,15 @@ IntegerRangeSliderConfigControl::IntegerRangeSliderConfigControl( ...@@ -911,12 +938,15 @@ IntegerRangeSliderConfigControl::IntegerRangeSliderConfigControl(
slider->setMaximum( p_item->max.i ); slider->setMaximum( p_item->max.i );
slider->setMinimum( p_item->min.i ); slider->setMinimum( p_item->min.i );
slider->setValue( p_item->value.i ); slider->setValue( p_item->value.i );
slider->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) ); if( p_item->psz_longtext )
if( label )
{ {
label->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) ); QString tipText = qtr(p_item->psz_longtext);
label->setBuddy( slider ); slider->setToolTip( formatTooltip(tipText) );
if( label )
label->setToolTip( formatTooltip(tipText) );
} }
if( label )
label->setBuddy( slider );
} }
int IntegerRangeSliderConfigControl::getValue() int IntegerRangeSliderConfigControl::getValue()
...@@ -1007,12 +1037,15 @@ void IntegerListConfigControl::finish(module_config_t *p_module_config, bool byc ...@@ -1007,12 +1037,15 @@ void IntegerListConfigControl::finish(module_config_t *p_module_config, bool byc
if( p_module_config->value.i == p_module_config->pi_list[i_index] ) if( p_module_config->value.i == p_module_config->pi_list[i_index] )
combo->setCurrentIndex( combo->count() - 1 ); combo->setCurrentIndex( combo->count() - 1 );
} }
combo->setToolTip( formatTooltip(qtr(p_module_config->psz_longtext)) ); if( p_item->psz_longtext )
if( label )
{ {
label->setToolTip( formatTooltip(qtr(p_module_config->psz_longtext)) ); QString tipText = qtr(p_item->psz_longtext );
label->setBuddy( combo ); combo->setToolTip( formatTooltip(tipText) );
if( label )
label->setToolTip( formatTooltip(tipText) );
} }
if( label )
label->setBuddy( combo );
} }
void IntegerListConfigControl::actionRequested( int i_action ) void IntegerListConfigControl::actionRequested( int i_action )
...@@ -1079,6 +1112,7 @@ BoolConfigControl::BoolConfigControl( vlc_object_t *_p_this, ...@@ -1079,6 +1112,7 @@ BoolConfigControl::BoolConfigControl( vlc_object_t *_p_this,
void BoolConfigControl::finish() void BoolConfigControl::finish()
{ {
checkbox->setChecked( p_item->value.i == true ); checkbox->setChecked( p_item->value.i == true );
if( p_item->psz_longtext )
checkbox->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) ); checkbox->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) );
} }
...@@ -1135,12 +1169,15 @@ void FloatConfigControl::finish() ...@@ -1135,12 +1169,15 @@ void FloatConfigControl::finish()
spin->setMinimum( -2000000000. ); spin->setMinimum( -2000000000. );
spin->setSingleStep( 0.1 ); spin->setSingleStep( 0.1 );
spin->setValue( (double)p_item->value.f ); spin->setValue( (double)p_item->value.f );
spin->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) ); if( p_item->psz_longtext )
if( label )
{ {
label->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) ); QString tipText = qtr(p_item->psz_longtext);
label->setBuddy( spin ); spin->setToolTip( formatTooltip(tipText) );
if( label )
label->setToolTip( formatTooltip(tipText) );
} }
if( label )
label->setBuddy( spin );
} }
float FloatConfigControl::getValue() float FloatConfigControl::getValue()
...@@ -1228,7 +1265,7 @@ KeySelectorControl::KeySelectorControl( vlc_object_t *_p_this, ...@@ -1228,7 +1265,7 @@ KeySelectorControl::KeySelectorControl( vlc_object_t *_p_this,
void KeySelectorControl::finish() void KeySelectorControl::finish()
{ {
if( label ) if( label && p_item->psz_longtext )
label->setToolTip( formatTooltip( qtr( p_item->psz_longtext ) ) ); label->setToolTip( formatTooltip( qtr( p_item->psz_longtext ) ) );
/* Fill the table */ /* Fill the table */
......
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