import QtQuick 1.0

Item {

    Rectangle {
        anchors.fill: parent
        opacity: 0.4
        color: "black"
    }

    Flickable {
        id: infoViewFlickable

        property bool copyrightNoticeVisible: false

        width: parent.width * 0.5
        height: parent.height
        anchors.centerIn: parent
        contentHeight:
            infoViewFlickable.copyrightNoticeVisible ? 2000 :
                infoText.height
                + copyrightText.height
                + 1.5 * exitButton.height;

        Text {
            id: infoText

            y: screen.height * 0.1
            anchors { left: parent.left }
            visible: infoViewFlickable.copyrightNoticeVisible ? 0 : 1;
            color: textColor
            width: parent.width
            wrapMode: Text.Wrap
            textFormat: Text.RichText
            font.pixelSize: screen.height * 0.05

            text: "<b><h2>Moto Trial Racer 1.2.1</h2></b>" +
                  "Moto Trial Racer is a Nokia example that " +
                  "demonstrates:"+
                  "<ul><li>integrating QML to Box2D</li>"+
                  "<li>Use of In-application Purchase API</li>"+
                  "<li>Use of audio features of Qt GameEnabler project</li></ul>" +
                  "For more information " +
                  "about the project see <a href=\"http://projects." +
                  "developer.nokia.com/mototrialracer\">http://projects." +
                  "developer.nokia.com/motortrialracer</a>." +
                  "<h3>Playing Moto Trial Racer</h3>" +
                  "<p>The Goal is to get the motorcycle and the driver " +
                  "to the chequered flag as fast as possible." +
                  "The game ends if any part of the motorcycle or player " +
                  "touches the spikes or the player's head touches " +
                  "any other object. When the player gets to the " +
                  "chequered flag fast enough, he/she gets his/her " +
                  "name and time to the high scores list. " +
                  "The game can be paused, restarted and exited at any time " +
                  "via the options menu. </p>" +
                  "<h3>Controls</h3>" +
                  "<p>The motorcycle is accelerated by leaning the device " +
                  "towards the player and braked by leaning the device away " +
                  "from the player. The center of mass can be moved " +
                  "backwards/forwards by tilting the device left/right.</p>";
            onLinkActivated: Qt.openUrlExternally(link)
        }

        Text {
            id: copyrightText

            anchors {
                topMargin: 20
                top: infoText.bottom
                left: parent.left
            }

            visible: infoViewFlickable.copyrightNoticeVisible ? 0 : 1;
            color: textColor
            width: parent.width
            wrapMode: Text.WordWrap
            textFormat: Text.RichText
            font.pixelSize: screen.height * 0.05

            text: "<h3>Copyright Notices</h3>" +
                  "<p>This software includes certain parts under the GNU " +
                  "Lesser General Public License, version 2.1 (LGPL) and " +
                  "other licenses. <b>Please tap here for applicable " +
                  "copyright- and other notices, permissions, and " +
                  "acknowledgements.</b></p>";

            MouseArea {
                anchors.fill: parent

                onClicked: {
                    infoViewFlickable.copyrightNoticeVisible = true;
                    infoViewFlickable.contentY = 0;
                }
            }
        }

        CopyrightNotice {
            id: copyrightNotice

            y: screen.height * 0.1
            width: parent.width
            visible: infoViewFlickable.copyrightNoticeVisible ? 1 : 0;
            onBackPressed: infoViewFlickable.copyrightNoticeVisible = false;
            onTextChanged: infoViewFlickable.contentY = 0;
        }
    }
}
