import QtQuick 2.0
import Ubuntu.Components 0.1
import Ubuntu.Components.ListItems 0.1 as ListItem
import "../../GValues.js" as GValues
import Ubuntu.Components.Popups 0.1
//test send qml request =)
PageStack {
id: pageStack
pageStack: clear
Component.onCompleted: {
push(tabs)
GValues.unsetCurentCassID();
}
Tabs {
id: tabs
Tab {
title: "Films"
page: Page {
title: "Films"
id: page1
visible: true
ListModel {
id: dataModel
}
Column {
anchors.margins: 10
anchors.fill: parent
spacing: 10
ListView {
id: view
width: parent.width
height: parent.height
spacing: 10
model: dataModel
clip: true
delegate: Rectangle {
id: element
width: view.width
height: 200
color: "skyblue"
Text {
anchors.centerIn: parent
width: 200
renderType: Text.NativeRendering
text: model.s_name
wrapMode: Text.WordWrap
}
// Text {
// anchors.centerIn: element
// text: "<a href='"+model.download_link+"'>Download</a>"
// MouseArea {
// anchors.fill: parent
// onClicked: {
// showImapAlert('DOWNLOAD');
// }
// }
// }
Image {
parent: element
id: logo
width: 100
height: parent.height
source: model.logo
}
}
}
// Button {
// id: button
// width: 100
// height: 40
// anchors.horizontalCenter: parent.horizontalCenter
// text: "NEXT"
// MouseArea {
// anchors.fill: parent
// onClicked: {
// console.log("Request sentssss");
// }
// }
// }
}
function showImapAlert(message) {
PopupUtils.open(Qt.resolvedUrl("InfoDialog.qml"), appWindow, {
title: qsTr("Server Message"),
text: message
})
}
tools: ToolbarItems {
ToolbarButton {
action: Action {
text: "Update"
iconSource: Qt.resolvedUrl("icon/update.svg")
onTriggered:
{
var doc = new XMLHttpRequest();
doc.onreadystatechange = function() {
if (doc.readyState == XMLHttpRequest.DONE) {
var film = JSON.parse(doc.responseText);
if(film.response == "ACCESS_TOKEN")
{
showImapAlert('Error Access token!');
}
else
{
if(film.response != "CASS_ID_NOT_FOUND")
{
dataModel.append(film);
}
else
{
showImapAlert('Fiml not FOUND!');
}
}
}
}
doc.open("GET", "http://localhost/intermovie/api/film/get/film_info.php?cass_id=1628&user_id=3&access_token=a1d12e387057a3e3cb38475c610d56af");
doc.send();
}
}
}
}
}
}
Tab {
title: "Tab 2"
page: Page {
Label {
anchors.centerIn: parent
text: "Use header to navigate between tabs"
}
}
}
}
Page {
id: page3
visible: false
title: "Page on stack"
Label {
anchors.centerIn: parent
text: "Press back to return to the tabs"
}
}
}