diff options
author | Yann Bodson <yann.bodson@nokia.com> | 2009-10-30 06:20:45 (GMT) |
---|---|---|
committer | Yann Bodson <yann.bodson@nokia.com> | 2009-10-30 06:20:45 (GMT) |
commit | cc1b25a807e190b1b9fa10653e42e86f19d4bd0f (patch) | |
tree | f522374393bfd7afe24b4bcccf9bdd43e0d39e7a /demos/declarative | |
parent | 9bbc155f0efe4bc873d7da4ac4ad844a6814c4e7 (diff) | |
download | Qt-cc1b25a807e190b1b9fa10653e42e86f19d4bd0f.zip Qt-cc1b25a807e190b1b9fa10653e42e86f19d4bd0f.tar.gz Qt-cc1b25a807e190b1b9fa10653e42e86f19d4bd0f.tar.bz2 |
make twitter not depend on flickr example
Diffstat (limited to 'demos/declarative')
18 files changed, 172 insertions, 20 deletions
diff --git a/demos/declarative/twitter/content/AuthView.qml b/demos/declarative/twitter/content/AuthView.qml index 320eef6..c924649 100644 --- a/demos/declarative/twitter/content/AuthView.qml +++ b/demos/declarative/twitter/content/AuthView.qml @@ -1,6 +1,4 @@ import Qt 4.6 -import "../../flickr/common" -import "../../flickr/mobile" Item { id: wrapper @@ -12,14 +10,14 @@ Item { Text { width: 100 text: "Screen name:" - font.pointSize: 10; font.bold: true; color: "white"; style: Text.Raised; styleColor: "black" + font.pointSize: 14; font.bold: true; color: "white"; style: Text.Raised; styleColor: "black" anchors.verticalCenter: parent.verticalCenter horizontalAlignment: Qt.AlignRight } Item { width: 160 height: 28 - BorderImage { source: "../../flickr/mobile/images/lineedit.sci"; anchors.fill: parent } + BorderImage { source: "images/lineedit.sci"; anchors.fill: parent } TextInput{ id: nameIn width: parent.width - 8 @@ -42,14 +40,14 @@ Item { Text { width: 100 text: "Password:" - font.pointSize: 10; font.bold: true; color: "white"; style: Text.Raised; styleColor: "black" + font.pointSize: 14; font.bold: true; color: "white"; style: Text.Raised; styleColor: "black" anchors.verticalCenter: parent.verticalCenter horizontalAlignment: Qt.AlignRight } Item { width: 160 height: 28 - BorderImage { source: "../../flickr/mobile/images/lineedit.sci"; anchors.fill: parent } + BorderImage { source: "images/lineedit.sci"; anchors.fill: parent } TextInput{ id: passIn width: parent.width - 8 diff --git a/demos/declarative/twitter/content/Button.qml b/demos/declarative/twitter/content/Button.qml new file mode 100644 index 0000000..770330c --- /dev/null +++ b/demos/declarative/twitter/content/Button.qml @@ -0,0 +1,38 @@ +import Qt 4.6 + +Item { + id: container + + signal clicked + + property string text + + BorderImage { + id: buttonImage + source: "images/toolbutton.sci" + width: container.width; height: container.height + } + BorderImage { + id: pressed + opacity: 0 + source: "images/toolbutton.sci" + width: container.width; height: container.height + } + MouseRegion { + id: mouseRegion + anchors.fill: buttonImage + onClicked: { container.clicked(); } + } + Text { + color: "white" + anchors.centerIn: buttonImage; font.bold: true + text: container.text; style: Text.Raised; styleColor: "black" + } + states: [ + State { + name: "Pressed" + when: mouseRegion.pressed == true + PropertyChanges { target: pressed; opacity: 1 } + } + ] +} diff --git a/demos/declarative/twitter/content/FatDelegate.qml b/demos/declarative/twitter/content/FatDelegate.qml index 4df251f..7125746 100644 --- a/demos/declarative/twitter/content/FatDelegate.qml +++ b/demos/declarative/twitter/content/FatDelegate.qml @@ -1,5 +1,4 @@ import Qt 4.6 -import "../../flickr/common" Component { id: ListDelegate diff --git a/demos/declarative/twitter/content/HomeTitleBar.qml b/demos/declarative/twitter/content/HomeTitleBar.qml index b0995f3..f0d6d75 100644 --- a/demos/declarative/twitter/content/HomeTitleBar.qml +++ b/demos/declarative/twitter/content/HomeTitleBar.qml @@ -1,6 +1,4 @@ import Qt 4.6 -import "../../flickr/mobile" -import "../../flickr/common" Item { id: titleBar @@ -8,7 +6,7 @@ Item { signal update() onYChanged: state="" //When switching titlebars - BorderImage { source: "../../flickr/mobile/images/titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 } + BorderImage { source: "images/titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 } Item { id: container width: (parent.width * 2) - 55 ; height: parent.height @@ -73,7 +71,7 @@ Item { id: txtEdit; anchors.left: tagButton.right; anchors.leftMargin: 5; y: 4 anchors.right: parent.right; anchors.rightMargin: 40; height: parent.height - 9 - BorderImage { source: "../../flickr/mobile/images/lineedit.sci"; anchors.fill: parent } + BorderImage { source: "images/lineedit.sci"; anchors.fill: parent } Binding {//TODO: Can this be a function, which also resets the cursor? And flashes? when: editor.text.length > 140 diff --git a/demos/declarative/twitter/content/Loading.qml b/demos/declarative/twitter/content/Loading.qml new file mode 100644 index 0000000..8b22e70 --- /dev/null +++ b/demos/declarative/twitter/content/Loading.qml @@ -0,0 +1,8 @@ +import Qt 4.6 + +Image { + id: loading; source: "images/loading.png"; transformOrigin: "Center" + rotation: NumberAnimation { + id: "RotationAnimation"; from: 0; to: 360; running: loading.visible == true; repeat: true; duration: 900 + } +} diff --git a/demos/declarative/twitter/content/MultiTitleBar.qml b/demos/declarative/twitter/content/MultiTitleBar.qml index da0794d..ef7de65 100644 --- a/demos/declarative/twitter/content/MultiTitleBar.qml +++ b/demos/declarative/twitter/content/MultiTitleBar.qml @@ -1,5 +1,4 @@ import Qt 4.6 -import "../../flickr/mobile" Item { height: homeBar.height diff --git a/demos/declarative/twitter/content/TitleBar.qml b/demos/declarative/twitter/content/TitleBar.qml new file mode 100644 index 0000000..07b9762 --- /dev/null +++ b/demos/declarative/twitter/content/TitleBar.qml @@ -0,0 +1,76 @@ +import Qt 4.6 + +Item { + id: titleBar + property string untaggedString: "Uploads from everyone" + property string taggedString: "Recent uploads tagged " + + BorderImage { source: "images/titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 } + + Item { + id: container + width: (parent.width * 2) - 55 ; height: parent.height + + Script { + function accept() { + titleBar.state = "" + background.state = "" + rssModel.tags = editor.text + } + } + + Text { + id: categoryText + anchors { + left: parent.left; right: tagButton.left; leftMargin: 10; rightMargin: 10 + verticalCenter: parent.verticalCenter + } + elide: Text.ElideLeft + text: (rssModel.tags=="" ? untaggedString : taggedString + rssModel.tags) + font.bold: true; color: "White"; style: Text.Raised; styleColor: "Black" + } + + Button { + id: tagButton; x: titleBar.width - 50; width: 45; height: 32; text: "..." + onClicked: if (titleBar.state == "Tags") accept(); else titleBar.state = "Tags" + anchors.verticalCenter: parent.verticalCenter + } + + Item { + id: lineEdit + y: 4; height: parent.height - 9 + anchors { left: tagButton.right; leftMargin: 5; right: parent.right; rightMargin: 5 } + + BorderImage { source: "images/lineedit.sci"; anchors.fill: parent } + + TextInput { + id: editor + anchors { + left: parent.left; right: parent.right; leftMargin: 10; rightMargin: 10 + verticalCenter: parent.verticalCenter + } + cursorVisible: true; font.bold: true + color: "#151515"; selectionColor: "Green" + } + + Keys.forwardTo: [ (returnKey), (editor)] + + Item { + id: returnKey + Keys.onReturnPressed: accept() + Keys.onEscapePressed: titleBar.state = "" + } + } + } + + states: State { + name: "Tags" + PropertyChanges { target: container; x: -tagButton.x + 5 } + PropertyChanges { target: tagButton; text: "OK" } + PropertyChanges { target: lineEdit; focus: true } + } + + transitions: Transition { + NumberAnimation { properties: "x"; easing: "easeInOutQuad" } + } +} diff --git a/demos/declarative/twitter/content/ToolBar.qml b/demos/declarative/twitter/content/ToolBar.qml new file mode 100644 index 0000000..f96c767 --- /dev/null +++ b/demos/declarative/twitter/content/ToolBar.qml @@ -0,0 +1,24 @@ +import Qt 4.6 + +Item { + id: toolbar + + property alias button1Label: button1.text + property alias button2Label: button2.text + signal button1Clicked + signal button2Clicked + + BorderImage { source: "images/titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 } + + Button { + id: button1 + anchors.left: parent.left; anchors.leftMargin: 5; y: 3; width: 140; height: 32 + onClicked: toolbar.button1Clicked() + } + + Button { + id: button2 + anchors.right: parent.right; anchors.rightMargin: 5; y: 3; width: 140; height: 32 + onClicked: toolbar.button2Clicked() + } +} diff --git a/demos/declarative/twitter/content/images/gloss.png b/demos/declarative/twitter/content/images/gloss.png Binary files differnew file mode 100644 index 0000000..5d370cd --- /dev/null +++ b/demos/declarative/twitter/content/images/gloss.png diff --git a/demos/declarative/twitter/content/images/lineedit.png b/demos/declarative/twitter/content/images/lineedit.png Binary files differnew file mode 100644 index 0000000..2cc38dc --- /dev/null +++ b/demos/declarative/twitter/content/images/lineedit.png diff --git a/demos/declarative/twitter/content/images/lineedit.sci b/demos/declarative/twitter/content/images/lineedit.sci new file mode 100644 index 0000000..054bff7 --- /dev/null +++ b/demos/declarative/twitter/content/images/lineedit.sci @@ -0,0 +1,5 @@ +border.left: 10 +border.top: 10 +border.bottom: 10 +border.right: 10 +source: lineedit.png diff --git a/demos/declarative/twitter/content/images/loading.png b/demos/declarative/twitter/content/images/loading.png Binary files differnew file mode 100644 index 0000000..47a1589 --- /dev/null +++ b/demos/declarative/twitter/content/images/loading.png diff --git a/demos/declarative/twitter/content/images/stripes.png b/demos/declarative/twitter/content/images/stripes.png Binary files differnew file mode 100644 index 0000000..9f36727 --- /dev/null +++ b/demos/declarative/twitter/content/images/stripes.png diff --git a/demos/declarative/twitter/content/images/titlebar.png b/demos/declarative/twitter/content/images/titlebar.png Binary files differnew file mode 100644 index 0000000..51c9008 --- /dev/null +++ b/demos/declarative/twitter/content/images/titlebar.png diff --git a/demos/declarative/twitter/content/images/titlebar.sci b/demos/declarative/twitter/content/images/titlebar.sci new file mode 100644 index 0000000..0418d94 --- /dev/null +++ b/demos/declarative/twitter/content/images/titlebar.sci @@ -0,0 +1,5 @@ +border.left: 10 +border.top: 12 +border.bottom: 12 +border.right: 10 +source: titlebar.png diff --git a/demos/declarative/twitter/content/images/toolbutton.png b/demos/declarative/twitter/content/images/toolbutton.png Binary files differnew file mode 100644 index 0000000..1131001 --- /dev/null +++ b/demos/declarative/twitter/content/images/toolbutton.png diff --git a/demos/declarative/twitter/content/images/toolbutton.sci b/demos/declarative/twitter/content/images/toolbutton.sci new file mode 100644 index 0000000..9e4f965 --- /dev/null +++ b/demos/declarative/twitter/content/images/toolbutton.sci @@ -0,0 +1,5 @@ +border.left: 15 +border.top: 4 +border.bottom: 4 +border.right: 15 +source: toolbutton.png diff --git a/demos/declarative/twitter/twitter.qml b/demos/declarative/twitter/twitter.qml index 23ca774..6cc67a1 100644 --- a/demos/declarative/twitter/twitter.qml +++ b/demos/declarative/twitter/twitter.qml @@ -1,7 +1,5 @@ import Qt 4.6 import "content" as Twitter -import "../flickr/common" as Common -import "../flickr/mobile" as Mobile Item { id: screen; width: 320; height: 480 @@ -20,7 +18,6 @@ Item { //Workaround for bug 260266 Timer{ interval: 1; running: false; repeat: false; onTriggered: reallySetUser(); id:hack } Script { -// var tmpStr; function setUser(str){hack.running = true; tmpStr = str} function reallySetUser(){rssModel.tags = tmpStr;} } @@ -29,10 +26,10 @@ Item { id: background anchors.fill: parent; color: "#343434"; - Image { source: "../flickr/mobile/images/stripes.png"; fillMode: Image.Tile; anchors.fill: parent; opacity: 0.3 } + Image { source: "content/images/stripes.png"; fillMode: Image.Tile; anchors.fill: parent; opacity: 0.3 } Twitter.RssModel { id: rssModel } - Common.Loading { anchors.centerIn: parent; visible: rssModel.status==XmlListModel.Loading && state!='unauthed'} + Twitter.Loading { anchors.centerIn: parent; visible: rssModel.status==XmlListModel.Loading && state!='unauthed'} Text { width: 180 text: "Could not access twitter using this screen name and password pair."; @@ -61,10 +58,10 @@ Item { } Twitter.MultiTitleBar { id: titleBar; width: parent.width } - Mobile.ToolBar { id: toolBar; height: 40; + Twitter.ToolBar { id: toolBar; height: 40; //anchors.bottom: parent.bottom; //TODO: Use anchor changes instead of hard coding - y: 440 + y: screen.height - 40 width: parent.width; opacity: 0.9 button1Label: "Update" button2Label: "View others" @@ -86,7 +83,7 @@ Item { PropertyChanges { target: authView; x: 0 } PropertyChanges { target: mainView; x: -(parent.width * 1.5) } PropertyChanges { target: titleBar; y: -80 } - PropertyChanges { target: toolBar; y: screen.height + 80 } + PropertyChanges { target: toolBar; y: screen.height } } ] transitions: [ |