main.qml Example File
httptest/assets/main.qml
import bb.cascades 1.0
TabbedPane {
Tab {
title: qsTr("GET")
imageSource: "asset:///images/get.png"
NavigationPane {
id: httpGetNavPane
onPopTransitionEnded: page.destroy()
Page {
Container {
layout: DockLayout {}
ImageView {
horizontalAlignment: HorizontalAlignment.Fill
verticalAlignment: VerticalAlignment.Fill
imageSource: "asset:///images/background.png"
}
Container {
horizontalAlignment: HorizontalAlignment.Fill
verticalAlignment: VerticalAlignment.Top
background: Color.Black
Label {
horizontalAlignment: HorizontalAlignment.Center
text: qsTr("GET REQUESTS")
textStyle {
base: SystemDefaults.TextStyles.BigText;
color: Color.White
fontStyle: FontStyle.Italic
fontWeight: FontWeight.Bold
textAlign: TextAlign.Center
}
}
}
Container {
horizontalAlignment: HorizontalAlignment.Fill
verticalAlignment: VerticalAlignment.Center
Button {
horizontalAlignment: HorizontalAlignment.Center
text: qsTr("External IP")
onClicked: {
httpGetNavPane.push(ipInfoPageDefinition.createObject());
}
attachedObjects: ComponentDefinition {
id: ipInfoPageDefinition
source: "ipinfo.qml"
}
}
Button {
horizontalAlignment: HorizontalAlignment.Center
text: qsTr("Get Request Headers")
onClicked: {
httpGetNavPane.push(requestinfoPageDefinition.createObject());
}
attachedObjects: ComponentDefinition {
id: requestinfoPageDefinition
source: "requestinfo.qml"
}
}
}
}
}
}
}
Tab {
title: qsTr("POST")
imageSource: "asset:///images/post.png"
NavigationPane {
id: httpPostNavPane
onPopTransitionEnded: page.destroy()
Page {
Container {
layout: DockLayout {}
ImageView {
horizontalAlignment: HorizontalAlignment.Fill
verticalAlignment: VerticalAlignment.Fill
imageSource: "asset:///images/background.png"
}
Container {
horizontalAlignment: HorizontalAlignment.Fill
verticalAlignment: VerticalAlignment.Top
background: Color.Black
Label {
horizontalAlignment: HorizontalAlignment.Center
text: qsTr("POST REQUESTS")
textStyle {
base: SystemDefaults.TextStyles.BigText;
color: Color.White
fontStyle: FontStyle.Italic
fontWeight: FontWeight.Bold
textAlign: TextAlign.Center
}
}
}
Container {
verticalAlignment: VerticalAlignment.Center
leftPadding: 30
rightPadding: 30
TextArea {
id: postBody
preferredHeight: 350
hintText: qsTr("Enter post body")
}
Button {
horizontalAlignment: HorizontalAlignment.Center
text: qsTr("Post!")
onClicked: {
_httpsample.postBody = postBody.text
httpPostNavPane.push(postPageDefinition.createObject());
}
attachedObjects: ComponentDefinition {
id: postPageDefinition
source: "post.qml"
}
}
}
}
}
}
}
Tab {
title: qsTr("Settings")
NavigationPane {
id: settingsGetNavPane
Page {
id: settingspage
Container {
layout: DockLayout {}
ImageView {
horizontalAlignment: HorizontalAlignment.Fill
verticalAlignment: VerticalAlignment.Fill
imageSource: "asset:///images/background.png"
}
Container {
horizontalAlignment: HorizontalAlignment.Fill
verticalAlignment: VerticalAlignment.Top
background: Color.Black
Label {
horizontalAlignment: HorizontalAlignment.Center
text: qsTr("CHANGE SETTINGS")
textStyle {
base: SystemDefaults.TextStyles.BigText;
color: Color.White
fontStyle: FontStyle.Italic
fontWeight: FontWeight.Bold
textAlign: TextAlign.Center
}
}
}
Container {
verticalAlignment: VerticalAlignment.Center
horizontalAlignment: HorizontalAlignment.Center
preferredWidth: 500
RadioGroup {
Option {
text: qsTr("HTTP (normal)")
selected: !_httpsample.useHttps
}
Option {
text: qsTr("HTTPS (secure)")
selected: _httpsample.useHttps
}
onSelectedIndexChanged: {
_httpsample.useHttps = (selectedIndex == 1)
}
}
}
}
}
}
}
}