import QtQuick 1.0
Rectangle {
id: searchPage
anchors.fill: parent
signal stopSpinner()
Rectangle {
id: topbar
width: parent.width
height: 61
color: "#1e1e1e"
anchors.top: parent.top
z: 2
Image {
id: inputsearch
anchors.centerIn: parent
source: "../images/searchin.png"
onStatusChanged: {
input.forceActiveFocus()
input.openSoftwareInputPanel()
}
Image {
anchors.left: parent.left
anchors.leftMargin: 9
anchors.verticalCenter: parent.verticalCenter
source: "../images/lupa.png"
}
Image {
id: closesearch
anchors.right: parent.right
anchors.rightMargin: 6
anchors.verticalCenter: parent.verticalCenter
source: "../images/closesearch.png"
}
TextInput {
id: input
anchors {
left: parent.left
leftMargin: 30
right: parent.right
rightMargin: 10
verticalCenter: parent.verticalCenter
}
font.pixelSize: 22
cursorVisible: true
color: "#1e1e1e"
maximumLength:31
onTextChanged: {
if (input.text.length >=2){
searchMovie(input.text)
}
}
onFocusChanged: {
//if(activeFocus){
SplitView.enableSplitView()
//}
}
MouseArea {
anchors.fill: parent
onClicked: {
input.focus = false
input.forceActiveFocus()
input.openSoftwareInputPanel()
}
}
}
MouseArea {
anchors.fill: closesearch
onClicked: {
searchModel.clear()
popularModel.clear()
input.text = ""
}
}
}
}
Component {
id: searchDelegate
Item {
width: searchView.width; height: 80 + search_title.height
clip: true
MouseArea {
anchors.fill: parent
onClicked: {
input.closeSoftwareInputPanel()
clickMovie(ids)
pageModel.pageRequested("MovieCard/MovieCard.qml")
showSpinner()
}
}
Row {
anchors.verticalCenter: parent.verticalCenter
spacing: 22
Column {
y: 2
Text {
id: search_title
text: title
color: "#e60040"
font.family: mainFont.name
font.pointSize: 7.0
font.weight: Font.Bold
anchors.left: parent.left
anchors.leftMargin: 21
width: searchPage.width-40
wrapMode: Text.WordWrap
}
Text {
text: country
color: "#000000"
font.family: mainFont.name
font.pointSize: 5.0
anchors.left: parent.left
anchors.leftMargin: 21
width: searchPage.width-40
wrapMode: Text.WordWrap
}
Text {
text: desc
color: "#000000"
font.family: mainFont.name
font.pointSize: 5.0
anchors.left: parent.left
anchors.leftMargin: 21
width: searchPage.width-40
wrapMode: Text.WordWrap
}
Text {
text: year
color: "#000000"
font.family: mainFont.name
font.pointSize: 5.0
anchors.left: parent.left
anchors.leftMargin: 21
width: searchPage.width-40
wrapMode: Text.WordWrap
}
}
}
Rectangle {
width: parent.width
height: 1
color: "#ededed"
anchors.top: parent.top
anchors.topMargin: 79 + search_title.height
}
}
}
Component {
id: popularDelegate
Item {
width: searchPage.width; height: 162
clip: true
MouseArea {
anchors.fill: parent
onClicked: {
clickMovie(id)
pageModel.pageRequested("MovieCard/MovieCard.qml")
showSpinner()
}
}
Row {
anchors.verticalCenter: parent.verticalCenter
spacing: 20
Column {
Image {
source: img_path
width: 100
height: 152
fillMode: Image.PreserveAspectCrop
x: 7
onStatusChanged: {
if(status==Image.Ready)
stopSpinner()
else if(status==Image.Error)
stopSpinner()
}
}
}
Column {
Text {
text: title
color: "#e60040"
font.family: mainFont.name
font.pointSize: 6.0
font.weight: Font.Bold
width: searchPage.width-150
wrapMode: Text.WordWrap
}
Text {
text: desc
color: "#000000"
font.family: mainFont.name
font.pointSize: 5.0
}
Text {
id: point_desc
text: country+", "+year
color: "#000000"
font.family: mainFont.name
font.pointSize: 5.0
}
Text {
id: point_ivi
opacity: vsblivi
text: "ivi.ru "+ivi_rating
color: "#000000"
font.family: mainFont.name
font.pointSize: 5.0
anchors.top: point_desc.top
anchors.topMargin: 25
}
Rectangle{
id: star
opacity: vsblivi
anchors.left: parent.left
anchors.top: point_ivi.top
anchors.topMargin: 4
anchors.leftMargin: 65
width: 73
height: 13
color: "#bcbcbc"
Rectangle{
width: ivi_rating*12+((ivi_ratingint-1)*3)
height: 12
color: "#e60040"
}
Image {
source: "../images/star4.png"
smooth: true
}
}
Text {
id: point_imdb
opacity: vsblimdb
text: "IMDb "+imdb_rating+"/10"
color: "#000000"
font.family: mainFont.name
font.pointSize: 5.0
anchors.left: parent.left
anchors.top: point_ivi.top
anchors.topMargin: anchorsimdb
anchors.leftMargin: 0
}
Text {
text: "Кинопоиск.ру "+kp_rating+"/10"
opacity: vsblkp
color: "#000000"
font.family: mainFont.name
font.pointSize: 5.0
anchors.left: parent.left
anchors.top: point_imdb.top
anchors.topMargin: anchorskp
anchors.leftMargin: 0
}
}
}
Image {
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: 9
source: "../images/pop_arrow.png"
smooth: true
MouseArea {
anchors.fill: parent
onClicked: {
clickMovie(id)
pageModel.pageRequested("MovieCard/MovieCard.qml")
showSpinner()
}
}
}
Rectangle {
width: searchPage.width
height: 1
color: "#ededed"
anchors.top: parent.top
anchors.topMargin: 161
}
}
}
ListView {
id: searchView
width: parent.width
height: parent.height-(tabbar.height+n_search.height+topbar.height)
anchors.top: topbar.bottom
anchors.topMargin: n_search.height
model: search_m()
delegate: search_d()
}
Rectangle {
id: n_search
anchors.top: parent.top
anchors.topMargin: topbar.height
width: searchPage.width
height: publicModel.n_search_height
opacity: publicModel.n_search_opacity
color: "#ffffff"
z: 2
Text {
text: "По вашему запросу мы ничего не нашли.
Может, вам понравятся популярные фильмы?"
color: "#e60040"
font.family: mainFont.name
font.pointSize: 6.0
font.weight: Font.Bold
anchors.top: parent.top
anchors.topMargin: 2
anchors.left: parent.left
anchors.leftMargin: 10
width: searchPage.width-20
wrapMode: Text.WordWrap
}
}
Component {
id: header_s
Rectangle {
width: searchPage.width
height: 20
color: "#ffffff"
}
}
Component {
id: header_p
Text {
text: "По вашему запросу мы ничего не нашли.
Может, вам понравятся популярные фильмы?"
color: "#e60040"
font.family: mainFont.name
font.pointSize: 6.0
font.weight: Font.Bold
anchors.left: parent.left
anchors.leftMargin: 10
width: searchPage.width-20
wrapMode: Text.WordWrap
}
}
function search_d()
{
if(publicModel.search_m == "popularModel"){return popularDelegate}
return searchDelegate
}
}