Opened 13 years ago

Closed 12 years ago

#4853 closed patch (fixed)

Fix default value for StyleSetting

Reported by: sphery <mtdean@…> Owned by: paulh
Priority: minor Milestone: 0.22
Component: mythtv Version: head
Severity: medium Keywords:
Cc: Ticket locked: no


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 ( ), 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.

Attachments (4)

mythtv-StyleSetting_default.patch (1.3 KB) - added by sphery <mtdean@…> 13 years ago.
mythtv-4853-StyleSetting_default.patch (1.3 KB) - added by sphery <mtdean@…> 13 years ago.
Updated patch for post-Qt4 trunk
mythtv-4853-StyleSetting_default-20080703.patch (1.4 KB) - added by sphery <mtdean@…> 13 years ago.
Updated patch.
mythtv-4853-StyleSetting_default.2.patch (1.5 KB) - added by sphery <mtdean@…> 13 years ago.
Updated patch for recent changes in trunk.

Download all attachments as: .zip

Change History (8)

Changed 13 years ago by sphery <mtdean@…>

Changed 13 years ago by sphery <mtdean@…>

Updated patch for post-Qt4 trunk

comment:1 Changed 13 years ago by sphery <mtdean@…>

mythtv-4853-StyleSetting_default.patch is an updated patch, tested with post-Qt4 trunk. The new patch accounts for changes to the includes since the original patch was made.

Changed 13 years ago by sphery <mtdean@…>

Updated patch.

comment:2 Changed 13 years ago by sphery <mtdean@…>

mythtv-4853-StyleSetting_default-20080703.patch is an updated patch that works with the recent changes to the MythTV libraries--specifically, the moving of the Qt style selection to MythUIHelper::LoadQtConfig?() .

Changed 13 years ago by sphery <mtdean@…>

Updated patch for recent changes in trunk.

comment:3 Changed 12 years ago by paulh

Milestone: unknown0.22
Owner: changed from Isaac Richards to paulh
Status: newassigned
Version: 0.21-fixeshead

comment:4 Changed 12 years ago by paulh

Resolution: fixed
Status: assignedclosed

(In [20553]) Fix default value for StyleSetting?. Patch from sphery. Fixes #4853.

Note: See TracTickets for help on using tickets.