aboutsummaryrefslogtreecommitdiff
path: root/src-qt5
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5')
-rw-r--r--src-qt5/core/libLumina/LuminaOS-FreeBSD.cpp2
-rw-r--r--src-qt5/core/lumina-desktop-unified/extrafiles/screensavers/qml_scripts/Grav.qml47
-rw-r--r--src-qt5/core/lumina-desktop-unified/extrafiles/screensavers/qml_scripts/Video.qml6
-rw-r--r--src-qt5/core/lumina-desktop/desktop-plugins/rssreader/RSSFeedPlugin.cpp6
-rw-r--r--src-qt5/core/lumina-desktop/desktop-plugins/rssreader/RSSObjects.cpp87
-rw-r--r--src-qt5/core/lumina-desktop/desktop-plugins/rssreader/RSSObjects.h6
6 files changed, 120 insertions, 34 deletions
diff --git a/src-qt5/core/libLumina/LuminaOS-FreeBSD.cpp b/src-qt5/core/libLumina/LuminaOS-FreeBSD.cpp
index dc7de37f..1ee8fb8a 100644
--- a/src-qt5/core/libLumina/LuminaOS-FreeBSD.cpp
+++ b/src-qt5/core/libLumina/LuminaOS-FreeBSD.cpp
@@ -30,7 +30,7 @@ QString LOS::AppStoreShortcut(){ return "/usr/local/share/applications/appcafe.d
QStringList LOS::RSSFeeds(){
QStringList feeds;
feeds << "FreeBSD News Feed::::https://www.freebsd.org/news/rss.xml";
- feeds << "TrueOS News Feed::::http://www.trueos.org/?feed=rss2";
+ feeds << "TrueOS News Feed::::http://www.trueos.org/feed/";
return feeds;
}
diff --git a/src-qt5/core/lumina-desktop-unified/extrafiles/screensavers/qml_scripts/Grav.qml b/src-qt5/core/lumina-desktop-unified/extrafiles/screensavers/qml_scripts/Grav.qml
index 7a3c33cd..d1e5d3c9 100644
--- a/src-qt5/core/lumina-desktop-unified/extrafiles/screensavers/qml_scripts/Grav.qml
+++ b/src-qt5/core/lumina-desktop-unified/extrafiles/screensavers/qml_scripts/Grav.qml
@@ -4,11 +4,13 @@ import QtGraphicalEffects 1.0
Rectangle {
id : canvas
anchors.fill: parent
- width: 800
- height: 600
+ width: Screen.width
+ height: Screen.height
color: "black"
//TODO Add orbital trails option
+ //TODO Fix jitteryness and start position
+ //TODO Make orbits more extreme
//Between 5 and 15 planets, read from settings
property int planets: Math.round(( Math.random() * 10 ) + 5 )
@@ -30,6 +32,7 @@ Rectangle {
property double a: Math.sqrt(b*b+c*c)
//Random angle of rotation
property double th: Math.random() * Math.PI
+ property var path: []
//Calculates starting position
x: Math.round(cx + a * Math.cos(th))
@@ -45,34 +48,40 @@ Rectangle {
//Give each planet a random color, semi-transparent
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 0.5)
- Timer {
+ /*Timer {
//Each planet updates between 1ms and 51ms (smaller times=faster)
interval: Math.round(Math.random() * 50 ) + 1
repeat: true
running: true
- property bool starting: true
property int time: 0
onTriggered: {
- //Move a planet 80 pixels away from the sun if the planet is too close
- if(starting) {
- if(x > cx && Math.abs(cx-x) < 80) {
- x+=80
- }else if(x < cx && Math.abs(cx-x) < 80) {
- x-=80
- }
-
- if(y > cy && Math.abs(cy-y) < 80) {
- y+=80
- }else if(y < cy && Math.abs(cy-y) < 80) {
- y-=80
- }
- starting = false;
- }
//Parametric equation that calculates the position of the general ellipse. Completes a loop ever 314 cycles. Credit to
x = cx+a*Math.cos(2*Math.PI*(time/314.0))*Math.cos(th) - b*Math.sin(2*Math.PI*(time/314.0))*Math.sin(th)
y = cy+a*Math.cos(2*Math.PI*(time/314.0))*Math.sin(th) + b*Math.sin(2*Math.PI*(time/314.0))*Math.cos(th)
time++;
+
+ //Move a planet 80 pixels away from the sun if the planet is too close
+ if(x > cx && Math.abs(cx-x) < 80) {
+ x+=80
+ }else if(x < cx && Math.abs(cx-x) < 80) {
+ x-=80
+ }
+
+ if(y > cy && Math.abs(cy-y) < 80) {
+ y+=80
+ }else if(y < cy && Math.abs(cy-y) < 80) {
+ y-=80
+ }
+ }
+ }*/
+
+ Component.onCompleted: {
+ pahtX[0] = x
+ pahtY[0] = y
+ for(int i = 1; i <= 200; i++) {
+ pathX[i] = cx+a*Math.cos(2*Math.PI*(i/200.0)*Math.cos(th) - b*Math.sin(2*Math.PI*(i/200.0)*Math.sin(th)
+ pathY[i] = cy+a*Math.cos(2*Math.PI*(i/200.0)*Math.sin(th) + b*Math.sin(2*Math.PI*(i/200.0)*Math.cos(th)
}
}
}
diff --git a/src-qt5/core/lumina-desktop-unified/extrafiles/screensavers/qml_scripts/Video.qml b/src-qt5/core/lumina-desktop-unified/extrafiles/screensavers/qml_scripts/Video.qml
index e7d0626d..9948537b 100644
--- a/src-qt5/core/lumina-desktop-unified/extrafiles/screensavers/qml_scripts/Video.qml
+++ b/src-qt5/core/lumina-desktop-unified/extrafiles/screensavers/qml_scripts/Video.qml
@@ -4,10 +4,8 @@ import QtQuick.Window 2.2
import Qt.labs.folderlistmodel 2.1
Rectangle {
- //width: Screen.width
- //height: Screen.height
- width: 800
- height: 600
+ width: Screen.width
+ height: Screen.height
color: "black"
FolderListModel {
diff --git a/src-qt5/core/lumina-desktop/desktop-plugins/rssreader/RSSFeedPlugin.cpp b/src-qt5/core/lumina-desktop/desktop-plugins/rssreader/RSSFeedPlugin.cpp
index c330d6c0..e8e5adb4 100644
--- a/src-qt5/core/lumina-desktop/desktop-plugins/rssreader/RSSFeedPlugin.cpp
+++ b/src-qt5/core/lumina-desktop/desktop-plugins/rssreader/RSSFeedPlugin.cpp
@@ -119,11 +119,13 @@ void RSSFeedPlugin::updateFeed(QString ID){
if(!data.items[i].author_email.isEmpty()){ html.append("<a href=\"mailto:"+data.items[i].author_email+"\" style=\"color: "+color+";\">"+data.items[i].author+"</a>"); }
else{ html.append(data.items[i].author); }
}
- html.append(")</i><br>");
+ html.append(")</i>");
+ if(data.rss)
+ html.append("<br>");
}
html.append(data.items[i].description);
//html.append("</li>\n");
- if(i+1 < data.items.length()){ html.append("<br>"); }
+ if(i+1 < data.items.length() && data.rss){ html.append("<br>"); }
}
//html.append("</ul>\n");
// - load that html into the viewer
diff --git a/src-qt5/core/lumina-desktop/desktop-plugins/rssreader/RSSObjects.cpp b/src-qt5/core/lumina-desktop/desktop-plugins/rssreader/RSSObjects.cpp
index cd29d5f0..5f62f99f 100644
--- a/src-qt5/core/lumina-desktop/desktop-plugins/rssreader/RSSObjects.cpp
+++ b/src-qt5/core/lumina-desktop/desktop-plugins/rssreader/RSSObjects.cpp
@@ -10,6 +10,8 @@
#include "LSession.h"
+#define DEBUG 0
+
//============
// PUBLIC
//============
@@ -116,18 +118,51 @@ RSSchannel RSSReader::readRSS(QByteArray bytes){
RSSchannel rssinfo;
//qDebug() << "Can Read XML Stream:" << !xml.hasError();
if(xml.readNextStartElement()){
- //qDebug() << " - RSS Element:" << xml.name();
- if(xml.name() == "rss" && (xml.attributes().value("version") =="2.0" || xml.attributes().value("version") =="0.91") ){
+ if(DEBUG) qDebug() << " - RSS Element:" << xml.name();
+ if(xml.name() == "rss" && (xml.attributes().value("version") =="2.0" || xml.attributes().value("version") =="0.91")) {
+ rssinfo.rss = true;
while(xml.readNextStartElement()){
//qDebug() << " - RSS Element:" << xml.name();
if(xml.name()=="channel"){ rssinfo = readRSSChannel(&xml); }
else{ xml.skipCurrentElement(); }
}
+ }else if(xml.name() == "feed") {
+ rssinfo.timetolive = -1;
+ rssinfo.rss = false;
+ while(xml.readNextStartElement()){
+ if(DEBUG) qDebug() << " - ATOM Element (channel):" << xml.name();
+ if(xml.name()=="entry") {
+ rssinfo.items << readRSSItemAtom(&xml);
+ }else if(xml.name()=="title"){
+ rssinfo.title = xml.readElementText();
+ if(DEBUG) qDebug() << "title" << rssinfo.link;
+ }else if(xml.name()=="link"){
+ QXmlStreamAttributes att = xml.attributes();
+ for(int i = 0; i < att.size(); i++) {
+ if(att[i].name() == "href") {
+ rssinfo.link = att[i].value().toString();
+ }
+ }
+ xml.readElementText();
+ if(DEBUG) qDebug() << "link" << rssinfo.link;
+ }else if(xml.name()=="subtitle"){
+ rssinfo.description = xml.readElementText();
+ }else if(xml.name()=="updated"){
+ rssinfo.lastBuildDate = ATOMDateTime(xml.readElementText());
+ }else if(xml.name()=="icon"){
+ rssinfo.icon_url = xml.readElementText();
+ if(DEBUG) qDebug() << "icon" << rssinfo.icon_url;
+ requestRSS(rssinfo.icon_url);
+ }else{
+ xml.skipCurrentElement();
+ }
+ }
}
}
- if(xml.hasError()){ qDebug() << " - XML Read Error:" << xml.errorString() << "\n" << bytes; }
+ //if(xml.hasError()){ qDebug() << " - XML Read Error:" << xml.errorString() << "\n" << bytes; }
return rssinfo;
}
+
RSSchannel RSSReader::readRSSChannel(QXmlStreamReader *rss){
RSSchannel info;
info.timetolive = -1;
@@ -151,6 +186,40 @@ RSSchannel RSSReader::readRSSChannel(QXmlStreamReader *rss){
return info;
}
+RSSitem RSSReader::readRSSItemAtom(QXmlStreamReader *rss){
+ RSSitem item;
+ while(rss->readNextStartElement()){
+ if(rss->name()=="title"){
+ item.title = rss->readElementText();
+ if(DEBUG) qDebug() << rss->name() << item.title;
+ }else if(rss->name()=="link"){
+ QXmlStreamAttributes att = rss->attributes();
+ for(int i = 0; i < att.size(); i++) {
+ if(att[i].name() == "href") {
+ item.link = att[i].value().toString();
+ }
+ }
+ rss->readElementText();
+ if(DEBUG) qDebug() << rss->name() << item.link;
+ }else if(rss->name()=="summary"){
+ item.description = rss->readElementText();
+ if(DEBUG) qDebug() << rss->name() << item.description;
+ } else if(rss->name()=="comments"){
+ item.comments_url = rss->readElementText();
+ if(DEBUG) qDebug() << rss->name() << item.comments_url;
+ } else if(rss->name()=="author"){
+ rss->readNextStartElement();
+ item.author = rss->readElementText();
+ if(DEBUG) qDebug() << "author" << item.author;
+ rss->skipCurrentElement();
+ }else if(rss->name()=="updated"){
+ item.pubdate = ATOMDateTime(rss->readElementText());
+ if(DEBUG) qDebug() << rss->name() << item.pubdate;
+ } else{ rss->skipCurrentElement(); }
+ }
+ return item;
+}
+
RSSitem RSSReader::readRSSItem(QXmlStreamReader *rss){
RSSitem item;
while(rss->readNextStartElement()){
@@ -192,17 +261,21 @@ QDateTime RSSReader::RSSDateTime(QString datetime){
return QDateTime::fromString(datetime, Qt::RFC2822Date);
}
+QDateTime RSSReader::ATOMDateTime(QString datetime){
+ return QDateTime::fromString(datetime, Qt::ISODate);
+}
+
//=================
// PRIVATE SLOTS
//=================
void RSSReader::replyFinished(QNetworkReply *reply){
QString url = reply->request().url().toString();
- //qDebug() << "Got Reply:" << url;
+ qDebug() << "Got Reply:" << url;
QString key = keyForUrl(url); //current hash key for this URL
QByteArray data = reply->readAll();
outstandingURLS.removeAll(url);
if(data.isEmpty()){
- //qDebug() << "No data returned:" << url;
+ qDebug() << "No data returned:" << url;
//see if the URL can be adjusted for known issues
bool handled = false;
QUrl redirecturl = reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl();
@@ -229,13 +302,13 @@ void RSSReader::replyFinished(QNetworkReply *reply){
//Could also be an icon fetch response
QStringList keys = hash.keys();
for(int i=0; i<keys.length(); i++){
- //qDebug() << " - Check for icon URL:" << hash[keys[i]].icon_url;
+ qDebug() << " - Check for icon URL:" << hash[keys[i]].icon_url;
if(hash[keys[i]].icon_url.toLower() == url.toLower()){ //needs to be case-insensitive
//Icon fetch response
RSSchannel info = hash[keys[i]];
QImage img = QImage::fromData(data);
info.icon = QIcon( QPixmap::fromImage(img) );
- //qDebug() << "Got Icon response:" << url << info.icon;
+ qDebug() << "Got Icon response:" << url << info.icon;
hash.insert(keys[i], info); //insert back into the hash
emit rssChanged( hash[keys[i]].originalURL );
break;
diff --git a/src-qt5/core/lumina-desktop/desktop-plugins/rssreader/RSSObjects.h b/src-qt5/core/lumina-desktop/desktop-plugins/rssreader/RSSObjects.h
index 3069bf8d..9d65ee57 100644
--- a/src-qt5/core/lumina-desktop/desktop-plugins/rssreader/RSSObjects.h
+++ b/src-qt5/core/lumina-desktop/desktop-plugins/rssreader/RSSObjects.h
@@ -51,6 +51,7 @@ struct RSSchannel{
//Internal data for bookkeeping
QDateTime lastsync, nextsync;
QString originalURL; //in case it was redirected to some "fixed" url later
+ bool rss;
};
class RSSReader : public QObject{
@@ -88,9 +89,12 @@ private:
//RSS parsing functions
RSSchannel readRSS(QByteArray bytes);
RSSchannel readRSSChannel(QXmlStreamReader *rss);
+ RSSchannel readRSSChannelAtom(QXmlStreamReader *rss);
RSSitem readRSSItem(QXmlStreamReader *rss);
- void readRSSImage(RSSchannel *item, QXmlStreamReader *rss);
+ RSSitem readRSSItemAtom(QXmlStreamReader *rss);
+ void readRSSImage(RSSchannel *item, QXmlStreamReader *rss);
QDateTime RSSDateTime(QString datetime);
+ QDateTime ATOMDateTime(QString datetime);
private slots:
void replyFinished(QNetworkReply *reply);
bgstack15