[mythtv-commits] Ticket #4853: Fix default value for StyleSetting

MythTV mythtv at cvs.mythtv.org
Tue Mar 4 00:18:09 UTC 2008


#4853: Fix default value for StyleSetting
----------------------------------------------+-----------------------------
 Reporter:  sphery <mtdean at thirdcontact.com>  |       Owner:  ijr       
     Type:  patch                             |      Status:  new       
 Priority:  minor                             |   Milestone:  unknown   
Component:  mythtv                            |     Version:  0.21-fixes
 Severity:  medium                            |     Mlocked:  0         
----------------------------------------------+-----------------------------
 The attached patch, mythtv-StyleSetting_default.patch , fixes the default
 value used for the StyleSetting ("Qt Style" in the UI, "Style" in the DB)
 to work with changes introduced in [14405].  In [14405],
 SelectSetting::addSelection() was modified to duplicate the label as the
 value if value.isEmpty().  Prior to this changeset, the label was only
 used as a value if (value == QString::null).  Therefore, it is now
 impossible to use the empty string ("") as a default value for a checkbox,
 so the default value for "Style" is changed to
 "UseSystemDefaultDesktopStyle" (which is unlikely to match the name of any
 QT Style that's ever created in the future).

 The use of "" results in writing the translated label to the DB since
 ComboBoxSetting::addSelection() (via SelectSetting::addSelection()) copies
 label to value.  As the issue is a minor one (and only trunk/0.21-fixes
 users could be affected), rather than attempt to fix the "broken" data in
 the settings table of existing databases (which now may contain the
 translated string "Desktop Style") with a dbcheck update, I felt having
 the user fix invalid values within the Appearance settings screen would be
 sufficient.  After this patch, the only benefit of fixing the database
 value is that it will clean up the list of values in the combobox.

 According to the QT docs, the call to setStyle() should not be harmful if
 the provided style name is invalid (
 http://doc.trolltech.com/3.3/qapplication.html#setStyle-2 ), though it
 probably doesn't hurt to check just in case of QT version differences or
 whatever.  Because we actually inserted "" into the database before
 [14405], and a translated version of "Desktop Style" after [14405], and
 will insert "UseSystemDefaultDesktopStyle" after this change, we could end
 up with any of a number of invalid style names.  Therefore, I modified the
 check which determines whether to call qApp->setStyle(style) to check
 whether QStyleFactory::keys().contains(style) to ensure we only attempt to
 set the style using valid names (and ignore all invalid data).  If we have
 invalid data, the QT default style will be used (which is what "Desktop
 Style" was meant to allow in the first place).

 Thanks to Cardoe on IRC for helping to find the issue.

-- 
Ticket URL: <http://svn.mythtv.org/trac/ticket/4853>
MythTV <http://svn.mythtv.org/trac>
MythTV


More information about the mythtv-commits mailing list