Async loading of our tabs.
authorsl
Wed, 28 May 2014 10:20:32 +0200
changeset 7b3cce7791326
parent 6 b1b049e28772
child 8 9543e1703afb
Async loading of our tabs.
Displaying progress bar during tab loading.
main.qml
     1.1 --- a/main.qml	Wed May 28 08:06:27 2014 +0200
     1.2 +++ b/main.qml	Wed May 28 10:20:32 2014 +0200
     1.3 @@ -16,6 +16,7 @@
     1.4      height: 480
     1.5      title: qsTr("MiniDisplay Manager")
     1.6      SystemPalette { id: palette }
     1.7 +    //Component.onCompleted: progressBar.visible=tabViewMain.getTab(tabViewMain.currentIndex).status !== Loader.Ready
     1.8  
     1.9      Settings {
    1.10          property alias x: appWindow.x
    1.11 @@ -36,6 +37,12 @@
    1.12  
    1.13      }*/
    1.14  
    1.15 +    function trackProgress()
    1.16 +    {
    1.17 +        progressBar.value = tabViewMain.getTab(tabViewMain.currentIndex).progress;
    1.18 +        progressBar.visible = tabViewMain.getTab(tabViewMain.currentIndex).status !== Loader.Ready;
    1.19 +    }
    1.20 +
    1.21      MiniDisplay {
    1.22          id: display
    1.23          onOpened:{ textDisplayStatus.text=qsTr("Connected");}
    1.24 @@ -43,21 +50,40 @@
    1.25          onOpenError:{ textDisplayStatus.text=qsTr("Connection error");}
    1.26      }
    1.27  
    1.28 +
    1.29      TabView {
    1.30 +        id:tabViewMain
    1.31          anchors.fill: parent
    1.32          anchors.margins: 8
    1.33 +        visible: true
    1.34 +
    1.35          Tab {
    1.36 +            //id:tabDisplay
    1.37              title: qsTr("Display")
    1.38 +            asynchronous: true
    1.39 +            //onLoaded: progressBar.visible=false
    1.40 +            onStatusChanged: trackProgress()
    1.41              DisplayTab { anchors.fill: parent }
    1.42          }
    1.43          Tab {
    1.44 +            //id:tabFont
    1.45              title: qsTr("Fonts")
    1.46 +            asynchronous: true
    1.47 +            onStatusChanged: trackProgress()
    1.48              FontsTab { anchors.fill: parent }
    1.49          }
    1.50          Tab {
    1.51              title: qsTr("Tests")
    1.52 +            asynchronous: true
    1.53 +            onStatusChanged: trackProgress()
    1.54              TestsTab { anchors.fill: parent }
    1.55          }
    1.56 +    } //TabView
    1.57  
    1.58 +    ProgressBar {
    1.59 +        id: progressBar
    1.60 +        anchors.centerIn: parent
    1.61      }
    1.62 +
    1.63 +
    1.64  }