1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-02 10:24:11 +01:00

Merge pull request #31 from skarlsso/skarlsso/LP-26_update_welcome_page_plugin

skarlsso/LP-26_update_welcome_page_plugin
This commit is contained in:
a*morale 2015-07-19 14:08:31 +02:00
commit 1d0ac6667f
3 changed files with 29 additions and 38 deletions

View File

@ -54,24 +54,19 @@ Item {
XmlListModel { XmlListModel {
id: xmlModel id: xmlModel
source: "http://progress.openpilot.org/activity?maxResults=30&streams=key+IS+OP" source: "https://github.com/librepilot/LibrePilot/commits/next.atom"
query: "/feed/entry" query: "/feed/entry"
namespaceDeclarations: "declare default element namespace 'http://www.w3.org/2005/Atom'; namespaceDeclarations: "declare default element namespace 'http://www.w3.org/2005/Atom';
declare namespace activity='http://activitystrea.ms/spec/1.0/'; declare namespace media='http://search.yahoo.com/mrss/';"
declare namespace media='http://purl.org/syndication/atommedia';"
XmlRole { name: "author"; query: "author/name/string()" } XmlRole { name: "author"; query: "author/name/string()" }
XmlRole { name: "authorEmail"; query: "author/email/string()" }
XmlRole { name: "authorLink"; query: "author/uri/string()" } XmlRole { name: "authorLink"; query: "author/uri/string()" }
XmlRole { name: "authorPhoto"; query: "author/link[@rel = 'photo' and @media:height='16']/@href/string()" } XmlRole { name: "authorPhoto"; query: "media:thumbnail/@url/string()" }
XmlRole { name: "action"; query: "category/@term/string()" } XmlRole { name: "action"; query: "substring-before(substring-after(id/string(),'::'),'/')" }
XmlRole { name: "actionLink"; query: "link[@rel = 'alternate']/@href/string()" } XmlRole { name: "actionLink"; query: "link[@rel = 'alternate']/@href/string()" }
XmlRole { name: "actionTitle"; query: "activity:object/title/string()" } XmlRole { name: "actionTitle"; query: "title/string()" }
XmlRole { name: "actionSummary"; query: "activity:object/summary/string()" }
XmlRole { name: "actionTargetTitle"; query: "activity:target/summary/string()" }
XmlRole { name: "actionTargetSummary"; query: "activity:target/summary/string()" }
XmlRole { name: "applicationIcon"; query: "link[@rel = 'http://streams.atlassian.com/syndication/icon']/@href/string()" }
} }
Component { Component {
@ -101,7 +96,15 @@ Item {
} }
Text { Text {
id: name id: name
text: author text: {
if (author != "") {
author
} else if (authorEmail != "") {
authorEmail
} else {
"Unknown Author"
}
}
width: container.width - photo.width - icon.width - 24 width: container.width - photo.width - icon.width - 24
color: mouseArea2.containsMouse ? "#224d81" : "black" color: mouseArea2.containsMouse ? "#224d81" : "black"
wrapMode: Text.WrapAtWordBoundaryOrAnywhere wrapMode: Text.WrapAtWordBoundaryOrAnywhere
@ -124,7 +127,8 @@ Item {
id: icon id: icon
width: 16 width: 16
height: 16 height: 16
source: applicationIcon // No image for GitHub commits.
// source: applicationIcon
} }
} }
Row { Row {
@ -150,6 +154,7 @@ Item {
case "closed": prefix = qsTr("Closed "); break; case "closed": prefix = qsTr("Closed "); break;
case "abandon": prefix = qsTr("Abandoned "); break; case "abandon": prefix = qsTr("Abandoned "); break;
case "commit": prefix = qsTr("Committed "); break; case "commit": prefix = qsTr("Committed "); break;
case "Commit": prefix = qsTr("Committed "); break;
case "resolved": prefix = qsTr("Resolved "); break; case "resolved": prefix = qsTr("Resolved "); break;
case "start": prefix = qsTr("Started "); break; case "start": prefix = qsTr("Started "); break;
case "started": prefix = qsTr("Started working on "); break; case "started": prefix = qsTr("Started working on "); break;
@ -160,20 +165,7 @@ Item {
default: prefix = action.substr(0, 1).toUpperCase() + action.substr(1) + " " ; break; default: prefix = action.substr(0, 1).toUpperCase() + action.substr(1) + " " ; break;
} }
prefix = "<font color='#224d81'>" + prefix + "</font>" prefix = "<font color='#224d81'>" + prefix + "</font>"
if(action == "commented" || action == "comment" || (action == "" && actionSummary == "")) { prefix + actionTitle
if(actionTargetTitle != actionTargetSummary) {
prefix + actionTargetTitle + ": " + actionTargetSummary
} else {
prefix + actionTargetTitle
}
}
else {
if(actionSummary == "") {
prefix + actionTitle
} else {
prefix + actionTitle + ": " + actionSummary
}
}
} }
color: mouseArea3.containsMouse ? "#224d81" : "black" color: mouseArea3.containsMouse ? "#224d81" : "black"
MouseArea { MouseArea {

View File

@ -35,12 +35,13 @@ Item {
XmlListModel { XmlListModel {
id: xmlModel id: xmlModel
source: "http://www.openpilot.org/feed/" source: "http://forum.librepilot.org/index.php?board=11.0&amp;action=.xml&amp;type=atom&amp;sa=news"
query: "/rss/channel/item" query: "/feed/entry"
namespaceDeclarations: "declare default element namespace 'http://www.w3.org/2005/Atom';"
XmlRole { name: "title"; query: "title/string()" } XmlRole { name: "title"; query: "title/string()" }
XmlRole { name: "description"; query: "description/string()" } XmlRole { name: "description"; query: "summary/string()" }
XmlRole { name: "link"; query: "link/string()" } XmlRole { name: "link"; query: "link/@href/string()" }
} }
Component { Component {
@ -64,7 +65,7 @@ Item {
Text { Text {
text: description text: description
width: view.width - 4 width: view.width - 4
textFormat: text.indexOf("&") > 0 ? Text.StyledText : Text.PlainText textFormat: Text.RichText
maximumLineCount: 3 maximumLineCount: 3
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
elide: Text.ElideRight elide: Text.ElideRight

View File

@ -10,7 +10,7 @@ Item {
Text { Text {
id: header id: header
text: qsTr("OpenPilot Websites") text: qsTr("Websites")
width: parent.width width: parent.width
color: "#44515c" color: "#44515c"
font { font {
@ -23,19 +23,17 @@ Item {
id: sitesModel id: sitesModel
ListElement { link: "http://www.librepilot.org" } ListElement { link: "http://www.librepilot.org" }
ListElement { link: "http://wiki.openpilot.org" } ListElement { link: "http://wiki.openpilot.org" }
ListElement { link: "http://www.openpilot.org/hardware/get-hardware/" }
ListElement { link: "http://forum.librepilot.org" } ListElement { link: "http://forum.librepilot.org" }
ListElement { link: "http://github.com/librepilot" } ListElement { link: "http://github.com/librepilot/LibrePilot/pulls" }
ListElement { link: "http://github.com/librepilot/LibrePilot/issues" } ListElement { link: "http://github.com/librepilot/LibrePilot/issues" }
function title(index){ function title(index){
if (title["text"] === undefined) { if (title["text"] === undefined) {
title.text = [ title.text = [
qsTr("Home"), qsTr("Home"),
qsTr("Wiki"), qsTr("Wiki"),
qsTr("Store"),
qsTr("Forums"), qsTr("Forums"),
qsTr("Code Reviews"), qsTr("Pull Requests"),
qsTr("Progress Tracker") qsTr("Progress")
] ]
} }
return title.text[index] return title.text[index]