import QtQuick 2.0
import Sailfish.Silica 1.0
import QtGraphicalEffects 1.0
//import "../helpers/jsFunctions.js" as JS

Column {
    id: column
    spacing: Theme.paddingMedium
    anchors.centerIn: parent
    Timer {
        id: spTimer
        interval: 10000; running: visible ? true : false; repeat: false
        onTriggered: radioBrowser.getRandom(radioBrowser.serverUrl)
    }

    Image {
        id: logo
        anchors.horizontalCenter: parent.horizontalCenter
        height: Theme.itemSizeHuge * 1.5
        width: height
        smooth: true
        source: "../images/community.png"
        ColorOverlay {
            anchors.fill: parent
            source: parent
            color: Theme.highlightColor
        }
    }

    BusyLabel {
        width: parent.width
        text: radioBrowser.serversModel.count > 0 ? qsTr("Found")+": "+radioBrowser.serversModel.count + " "+qsTr("servers") : qsTr("Searching servers")
        running: radioBrowser.serversModel.count < 1
        anchors.horizontalCenter: parent.horizontalCenter
    }
    BusyLabel {
        width: parent.width
        visible: radioBrowser.serversModel.count > 0
        running: visible
        text: qsTr("Connecting")
        anchors.horizontalCenter: parent.horizontalCenter
    }
    Label {
        visible: radioBrowser.serversModel.count > 0
        text: radioBrowser.server
        font.pixelSize: Theme.fontSizeSmall
        color: Theme.highlightColor
        anchors.horizontalCenter: parent.horizontalCenter
    }
  /*  Button {
        visible: radioBrowser.serversModel.count > 1 && !spTimer.running
        anchors.topMargin: Theme.paddingLarge
        text: qsTr("Try another server")
        onClicked: radioBrowser.getRandom(radioBrowser.serverUrl)
        anchors.horizontalCenter: parent.horizontalCenter
    } */

}