summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiels Weber <niels.weber@digia.com>2014-09-15 13:02:22 +0200
committerCaroline Chao <caroline.chao@digia.com>2014-09-16 13:19:23 +0200
commita41b3b83b996086762232666fe1f1d9a08ef4f27 (patch)
tree87e2e6f2f52c329cdb7102e59a99b5e824f3da7b
parent40a67c211db626e9a502cb187de7567e54b4aa22 (diff)
HomeScreen Layout changes
Add some missing Tweet parts Change-Id: I7f3402ea1590283cab10b308d9a389f92b982c5c Reviewed-by: Caroline Chao <caroline.chao@digia.com>
-rw-r--r--qml/components/HomeScreen.qml124
-rw-r--r--qml/components/images/Twitter.svg17
-rw-r--r--qml/main.qml2
-rw-r--r--resource.qrc1
-rw-r--r--src/theme.cpp7
5 files changed, 124 insertions, 27 deletions
diff --git a/qml/components/HomeScreen.qml b/qml/components/HomeScreen.qml
index 1459009..857b539 100644
--- a/qml/components/HomeScreen.qml
+++ b/qml/components/HomeScreen.qml
@@ -40,7 +40,6 @@
import QtQuick 2.2
import QtQuick.Layouts 1.1
-import QtQuick.XmlListModel 2.0
import TalkSchedule 1.0
Rectangle {
@@ -56,12 +55,15 @@ Rectangle {
function linkForEntity(entity)
{
- return (entity.url ? entity.url : entity.expanded_url)
+ return (entity.url ? entity.url :
+ (entity.screen_name ? 'https://twitter.com/' + entity.screen_name :
+ 'https://twitter.com/search?q=%23' + entity.text))
}
function textForEntity(entity)
{
- return (entity.display_url ? entity.display_url : entity.expanded_url)
+ return (entity.display_url ? entity.display_url :
+ (entity.screen_name ? entity.screen_name : entity.text))
}
function insertLinks(text, entities)
@@ -72,8 +74,12 @@ Rectangle {
if (!entities)
return text;
+ if (entities.retweeted_status)
+ return "";
+
var links = []
- links = entities.media ? entities.urls.concat(entities.media) : entities.urls
+ entities.urls = entities.media ? entities.urls.concat(entities.media) : entities.urls
+ links = entities.urls.concat(entities.hashtags, entities.user_mentions)
links.sort(function(a, b) { return b.indices[0] - a.indices[0] })
@@ -152,7 +158,7 @@ Rectangle {
upcomingItem.visibleDate = Qt.formatDate(sortModelNextEvents.get(0, "start"), upcomingItem.formatDate)
}
}
- spacing: Theme.margins.ten
+ spacing: Theme.margins.twenty
delegate: RowLayout {
id: upcomingEventDelegate
width: parent.width
@@ -209,7 +215,7 @@ Rectangle {
}
}
Item {
- // news
+ // twitter news
width: window.width
height: (homeScreenWindow.height - homeScreenWindow.usefulItemHeight)/2
@@ -217,21 +223,36 @@ Rectangle {
id: tweetModel
}
- Text {
+ Rectangle {
id: labelNews
- z: 1
- text: Theme.text.news
width: parent.width
height: Theme.sizes.homeTitleHeight
- font.pointSize: Theme.fonts.seven_pt
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- font.capitalization: Font.AllUppercase
- Rectangle {
- anchors.fill: parent
- z: -1
- color: Theme.colors.smokewhite
+ color: Theme.colors.smokewhite
+
+ Text {
+ id: labelNewsText
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.horizontalCenter: parent.horizontalCenter
+
+ text: Theme.text.news
+ font.pointSize: Theme.fonts.seven_pt
+ font.capitalization: Font.AllUppercase
+ }
+
+ Image {
+ source: Theme.images.twitter
+ sourceSize.height: labelNewsText.height
+ sourceSize.width: labelNewsText.height
+ anchors.right: labelNewsText.left
+ anchors.rightMargin: Theme.margins.five
+ anchors.verticalCenter: parent.verticalCenter
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: Qt.openUrlExternally(Theme.text.twitterLink)
+ }
}
+
Image {
id: reloadNews
anchors.verticalCenter: parent.verticalCenter
@@ -251,7 +272,7 @@ Rectangle {
id: tweetDelegate
Rectangle {
- color: Theme.colors.smokewhite
+ color: Theme.colors.white
height: Math.max(tweetArea.height, Theme.sizes.twitterAvatarSize)
width: window.width
@@ -271,20 +292,69 @@ Rectangle {
source: model.user.profile_image_url
sourceSize.height: Theme.sizes.twitterAvatarSize
sourceSize.width: Theme.sizes.twitterAvatarSize
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: Qt.openUrlExternally(Theme.text.twitterLink + model.user.screen_name)
+ }
}
Column {
id: tweetArea
- width: parent.width - placeHolder.width
+ width: parent.width - placeHolder.width - Theme.margins.twenty
height: userName.implicitHeight + tweetContent.implicitHeight
anchors.left: placeHolder.right
anchors.leftMargin: Theme.margins.ten
anchors.rightMargin: Theme.margins.ten
- Text {
- id: userName
+ Item {
width: parent.width
- text: Theme.text.tweet_title.arg(model.user.name).arg(model.user.screen_name)
+ height: userName.implicitHeight
+ Text {
+ id: userName
+ anchors.left: parent.left
+ text: model.user.name
+ font.pointSize: Theme.fonts.eight_pt
+ color: Theme.colors.black
+ textFormat: Text.StyledText
+ MouseArea {
+ anchors.fill: parent
+ onClicked: Qt.openUrlExternally(Theme.text.twitterLink
+ + model.user.screen_name)
+ }
+ }
+
+ Text {
+ id: screenName
+ anchors.left: userName.right
+ anchors.leftMargin: Theme.margins.ten
+ anchors.bottom: parent.bottom
+ text: "@" + model.user.screen_name
+ font.pointSize: Theme.fonts.seven_pt
+ color: Theme.colors.gray
+ textFormat: Text.StyledText
+ MouseArea {
+ anchors.fill: parent
+ onClicked: Qt.openUrlExternally(Theme.text.twitterLink
+ + model.user.screen_name)
+ }
+ }
+ Text {
+ id: timeStamp
+ anchors.right: parent.right
+ anchors.rightMargin: Theme.margins.ten
+ anchors.bottom: parent.bottom
+ text: model.created_at
+ font.pointSize: Theme.fonts.seven_pt
+ color: Theme.colors.gray
+ textFormat: Text.StyledText
+ MouseArea {
+ anchors.fill: parent
+ onClicked: Qt.openUrlExternally(Theme.text.twitterLink
+ + model.user.screen_name
+ + "/status/" + model.id_str)
+ }
+ }
}
Text {
@@ -293,7 +363,15 @@ Rectangle {
text: insertLinks(model.text, model.entities)
wrapMode: Text.WordWrap
textFormat: Text.RichText
+ font.pointSize: Theme.fonts.seven_pt
+ color: Theme.colors.gray
onLinkActivated: Qt.openUrlExternally(link)
+ MouseArea {
+ anchors.fill: parent
+ onClicked: Qt.openUrlExternally(Theme.text.twitterLink
+ + model.user.screen_name
+ + "/status/" + model.id_str)
+ }
}
}
}
@@ -307,7 +385,7 @@ Rectangle {
anchors.bottom: parent.bottom
anchors.margins: Theme.margins.ten
clip: true
- spacing: Theme.margins.fifteen
+ spacing: Theme.margins.twenty
model: tweetModel.model
delegate: tweetDelegate
}
diff --git a/qml/components/images/Twitter.svg b/qml/components/images/Twitter.svg
new file mode 100644
index 0000000..449d7b4
--- /dev/null
+++ b/qml/components/images/Twitter.svg
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="56px" height="46px" viewBox="0 0 56 46" enable-background="new 0 0 56 46" xml:space="preserve">
+<g>
+ <rect fill="none" width="56" height="46"/>
+ <path fill="#808080" d="M56,5.387c-2.061,0.914-4.274,1.532-6.599,1.809c2.372-1.422,4.193-3.673,5.052-6.356
+ c-2.221,1.316-4.679,2.272-7.296,2.788C45.062,1.395,42.075,0,38.771,0c-6.346,0-11.489,5.144-11.489,11.489
+ c0,0.9,0.102,1.777,0.297,2.618C18.03,13.628,9.565,9.054,3.898,2.103C2.91,3.8,2.343,5.773,2.343,7.879
+ c0,3.986,2.028,7.502,5.111,9.563c-1.883-0.06-3.654-0.577-5.204-1.437c0,0.048-0.001,0.096-0.001,0.145
+ c0,5.566,3.96,10.21,9.217,11.265c-0.965,0.264-1.979,0.403-3.027,0.403c-0.74,0-1.46-0.071-2.161-0.206
+ c1.462,4.564,5.705,7.887,10.732,7.979c-3.933,3.082-8.887,4.919-14.269,4.919c-0.928,0-1.843-0.055-2.741-0.161
+ c5.084,3.26,11.123,5.162,17.611,5.162c21.133,0,32.688-17.506,32.688-32.689c0-0.498-0.011-0.994-0.033-1.486
+ C52.512,9.715,54.46,7.691,56,5.387z"/>
+</g>
+</svg>
diff --git a/qml/main.qml b/qml/main.qml
index cea2476..6997bf7 100644
--- a/qml/main.qml
+++ b/qml/main.qml
@@ -47,7 +47,7 @@ import "components"
ApplicationWindow {
id: window
visible: true
- height: 800
+ height: 1080
width: 1080
property bool busy
diff --git a/resource.qrc b/resource.qrc
index e8528b9..324c947 100644
--- a/resource.qrc
+++ b/resource.qrc
@@ -31,5 +31,6 @@
<file alias="images/Btn_Restaurants.svg">qml/components/images/Btn_Restaurants.svg</file>
<file alias="images/Btn_VenueMap.svg">qml/components/images/Btn_VenueMap.svg</file>
<file alias="images/Location.svg">qml/components/images/Location.svg</file>
+ <file alias="images/Twitter.svg">qml/components/images/Twitter.svg</file>
</qresource>
</RCC>
diff --git a/src/theme.cpp b/src/theme.cpp
index 0e69d2d..feaa503 100644
--- a/src/theme.cpp
+++ b/src/theme.cpp
@@ -77,13 +77,13 @@ Theme::Theme(QObject *parent)
m_text->insert(QLatin1String("favorites"), tr("Favorites"));
m_text->insert(QLatin1String("feedback"), tr("Send Feedback"));
m_text->insert(QLatin1String("upcoming"), tr("Upcoming: %1 %2"));
- m_text->insert(QLatin1String("news"), tr("News"));
+ m_text->insert(QLatin1String("news"), tr("Tweets"));
m_text->insert(QLatin1String("info"), tr("Useful Information"));
m_text->insert(QLatin1String("writeYourCommentHere"), tr("Write your comments here"));
m_text->insert(QLatin1String("by"), tr("by %1"));
m_text->insert(QLatin1String("room"), tr("Room %1"));
m_text->insert(QLatin1String("room_space"), tr(" - Room %1"));
- m_text->insert(QLatin1String("tweet_title"), "<b>%1</b> @%2");
+ m_text->insert(QLatin1String("twitterLink"), tr("https://twitter.com/"));
m_colors = new QQmlPropertyMap(this);
m_colors->insert(QLatin1String("white"), QVariant("#ffffff"));
@@ -113,7 +113,7 @@ Theme::Theme(QObject *parent)
m_sizes->insert(QLatin1String("menuWidth"), QVariant(applyRatio(78)));
m_sizes->insert(QLatin1String("dayLabelHeight"), QVariant(applyRatio(70)));
m_sizes->insert(QLatin1String("upcomingEventHeight"), QVariant(applyRatio(90)));
- m_sizes->insert(QLatin1String("homeTitleHeight"), QVariant(applyRatio(50)));
+ m_sizes->insert(QLatin1String("homeTitleHeight"), QVariant(applyRatio(100)));
m_sizes->insert(QLatin1String("upcomingEventTimeWidth"), QVariant(applyRatio(200)));
m_sizes->insert(QLatin1String("trackFieldHeight"), QVariant(applyRatio(50)));
m_sizes->insert(QLatin1String("buttonHeight"), QVariant(applyRatio(78)));
@@ -137,6 +137,7 @@ Theme::Theme(QObject *parent)
m_images->insert(QLatin1String("btnRestaurants"), QVariant("qrc:/images/Btn_Restaurants.svg"));
m_images->insert(QLatin1String("btnVenueMap"), QVariant("qrc:/images/Btn_VenueMap.svg"));
m_images->insert(QLatin1String("location"), QVariant("qrc:/images/Location.svg"));
+ m_images->insert(QLatin1String("twitter"), QVariant("qrc:/images/Twitter.svg"));
m_fonts = new QQmlPropertyMap(this);
m_fonts->insert(QLatin1String("six_pt"), QVariant(applyFontRatio(8)));