~aacid/ubuntu-ui-toolkit/nonsquareicons

« back to all changes in this revision

Viewing changes to modules/Ubuntu/Components/MainView.qml

  • Committer: Tarmac
  • Author(s): Zsombor Egri
  • Date: 2014-12-05 16:36:12 UTC
  • mfrom: (1363.1.2 app-theming-to-staging)
  • Revision ID: tarmac-20141205163612-7yub32shpe3zm1e2
Theming fixes: application theming, binding loop fix, auto-theming moved into MainView and it is applicable only on Ambiance and SuruDark, SuruGradient is no longer auto-themed. Fixes: https://bugs.launchpad.net/bugs/1213043, https://bugs.launchpad.net/bugs/1277647, https://bugs.launchpad.net/bugs/1330510, https://bugs.launchpad.net/bugs/1356779, https://bugs.launchpad.net/bugs/1389792.

Approved by PS Jenkins bot, Christian Dywan.

Show diffs side-by-side

added added

removed removed

Lines of Context:
205
205
        property color headerColor: backgroundColor
206
206
        property color backgroundColor: Theme.palette.normal.background
207
207
        property color footerColor: backgroundColor
 
208
 
 
209
        /*
 
210
          As we don't know the order the property bindings and onXXXChanged signals are evaluated
 
211
          we should rely only on one property when changing the theme to avoid intermediate
 
212
          theme changes due to properties being evaluated separately.
 
213
 
 
214
          Qt bug: https://bugreports.qt-project.org/browse/QTBUG-11712
 
215
          */
 
216
        property string theme: (ColorUtils.luminance(backgroundColor) >= 0.85) ?
 
217
                                   "Ambiance" : "SuruDark"
 
218
        onThemeChanged: {
 
219
            // only change the theme if the current one is a system one.
 
220
            if (theme !== "" && (Theme.name.search("Ubuntu.Components.Themes") >= 0)) {
 
221
                Theme.name = "Ubuntu.Components.Themes.%1".arg(theme);
 
222
            }
 
223
        }
208
224
    }
209
225
 
210
226
    /*!