This commit is contained in:
Dusko Angirevic 2018-10-24 13:38:17 +02:00
parent d1f7f2bc75
commit f3814a0cd5
17 changed files with 83 additions and 39 deletions

View file

@ -11,10 +11,14 @@
# The name of your application # The name of your application
TARGET = harbour-tooter TARGET = harbour-tooter
CONFIG += sailfishapp
QT += network dbus sql QT += network dbus sql
CONFIG += sailfishapp link_pkgconfig
PKGCONFIG += sailfishapp nemonotifications-qt5 #CONFIG += sailfishapp_qml
CONFIG += link_pkgconfig
PKGCONFIG += sailfishapp
PKGCONFIG += nemonotifications-qt5
DEFINES += "APPVERSION=\\\"$${SPECVERSION}\\\"" DEFINES += "APPVERSION=\\\"$${SPECVERSION}\\\""
DEFINES += "APPNAME=\\\"$${TARGET}\\\"" DEFINES += "APPNAME=\\\"$${TARGET}\\\""
@ -66,16 +70,6 @@ OTHER_FILES += qml/harbour-tooter.qml \
SAILFISHAPP_ICONS = 86x86 108x108 128x128 256x256 SAILFISHAPP_ICONS = 86x86 108x108 128x128 256x256
# to disable building translations every time, comment out the
# following CONFIG line
# CONFIG += sailfishapp_i18n
# German translation is enabled as an example. If you aren't
# planning to localize your app, remember to comment out the
# following TRANSLATIONS line. And also do not forget to
# modify the localized app name in the the .desktop file.
TRANSLATIONS += \
translations/harbour-tooter.ts
DISTFILES += \ DISTFILES += \
qml/lib/API.js \ qml/lib/API.js \
@ -96,7 +90,11 @@ DISTFILES += \
qml/pages/components/ImageFullScreen.qml \ qml/pages/components/ImageFullScreen.qml \
config/icon-lock-harbour-tooter.png \ config/icon-lock-harbour-tooter.png \
config/x-harbour.tooter.activity.conf \ config/x-harbour.tooter.activity.conf \
rpm/harbour-tooter.changes rpm/harbour-tooter.changes \
rpm/harbour-tooter.spec \
rpm/harbour-tooter.yaml \
translations/*.ts
HEADERS += \ HEADERS += \
src/imageuploader.h \ src/imageuploader.h \
@ -104,3 +102,24 @@ HEADERS += \
src/notifications.h \ src/notifications.h \
src/dbusAdaptor.h \ src/dbusAdaptor.h \
src/dbus.h src/dbus.h
# to disable building translations every time, comment out the
# following CONFIG line
CONFIG += sailfishapp_i18n
CONFIG += sailfishapp_i18n_idbased
# German translation is enabled as an example. If you aren't
# planning to localize your app, remember to comment out the
# following TRANSLATIONS line. And also do not forget to
# modify the localized app name in the the .desktop file.
TRANSLATIONS += translations/harbour-tooter-de.ts
TRANSLATIONS += translations/harbour-tooter-el.ts
TRANSLATIONS += translations/harbour-tooter-es.ts
TRANSLATIONS += translations/harbour-tooter-fi.ts
TRANSLATIONS += translations/harbour-tooter-fr.ts
TRANSLATIONS += translations/harbour-tooter-nl.ts
TRANSLATIONS += translations/harbour-tooter-nl_BE.ts
TRANSLATIONS += translations/harbour-tooter-oc.ts
TRANSLATIONS += translations/harbour-tooter-pl.ts
TRANSLATIONS += translations/harbour-tooter-ru.ts
TRANSLATIONS += translations/harbour-tooter-sr.ts
TRANSLATIONS += translations/harbour-tooter-sv.ts

View file

@ -206,6 +206,7 @@ function getDate(dateStr){
return new Date(ts.getFullYear(), ts.getMonth(), ts.getDate(), 0, 0, 0) return new Date(ts.getFullYear(), ts.getMonth(), ts.getDate(), 0, 0, 0)
} }
function parseToot (data){ function parseToot (data){
var i = 0;
var item = {}; var item = {};
item['type'] = "toot" item['type'] = "toot"
@ -226,11 +227,13 @@ function parseToot (data){
item['status_spoiler_text'] = data["spoiler_text"] item['status_spoiler_text'] = data["spoiler_text"]
item['status_visibility'] = data["visibility"] item['status_visibility'] = data["visibility"]
if(item['status_reblog']){ if(item['status_reblog']){
item['type'] = "reblog"; item['type'] = "reblog";
item['typeIcon'] = "image://theme/icon-s-retweet" item['typeIcon'] = "image://theme/icon-s-retweet"
item['status_id'] = data["reblog"]["id"]; item['status_id'] = data["reblog"]["id"];
item['status_spoiler_text'] = data["reblog"]["spoiler_text"]
item['status_sensitive'] = data["reblog"]["sensitive"]
item['emojis'] = data["reblog"]["emojis"];
item = parseAccounts(item, "", data['reblog']["account"]) item = parseAccounts(item, "", data['reblog']["account"])
item = parseAccounts(item, "reblog_", data["account"]) item = parseAccounts(item, "reblog_", data["account"])
} else { } else {
@ -240,7 +243,9 @@ function parseToot (data){
item['attachments'] = []; item['attachments'] = [];
for(var i = 0; i < data['media_attachments'].length ; i++){
for(i = 0; i < data['media_attachments'].length ; i++){
var attachments = data['media_attachments'][i]; var attachments = data['media_attachments'][i];
item['content'] = item['content'].replaceAll(attachments['text_url'], '') item['content'] = item['content'].replaceAll(attachments['text_url'], '')
var tmp = { var tmp = {
@ -253,7 +258,7 @@ function parseToot (data){
item['attachments'].push(tmp) item['attachments'].push(tmp)
} }
if(item['status_reblog']){ if(item['status_reblog']){
for(var i = 0; i < data['reblog']['media_attachments'].length ; i++){ for(i = 0; i < data['reblog']['media_attachments'].length ; i++){
var attachments = data['reblog']['media_attachments'][i]; var attachments = data['reblog']['media_attachments'][i];
item['content'] = item['content'].replaceAll(attachments['text_url'], '') item['content'] = item['content'].replaceAll(attachments['text_url'], '')
var tmp = { var tmp = {
@ -265,5 +270,21 @@ function parseToot (data){
item['attachments'].push(tmp) item['attachments'].push(tmp)
} }
} }
return addEmojis(item, data);
}
function addEmojis(item, data){
var emoji, i;
for (i = 0; i < data["emojis"].length; i++){
emoji = data["emojis"][i];
item['content'] = item['content'].replaceAll(":"+emoji.shortcode+":", "<img src=\"" + emoji.static_url+"\" align=\"middle\" width=\"24\" height=\"24\">")
//console.log(JSON.stringify(data["emojis"][i]))
}
if (data["reblog"])
for (i = 0; i < data["reblog"]["emojis"].length; i++){
emoji = data["reblog"]["emojis"][i];
item['content'] = item['content'].replaceAll(":"+emoji.shortcode+":", "<img src=\"" + emoji.static_url+"\" align=\"middle\" width=\"24\" height=\"24\">")
}
return item; return item;
} }

View file

@ -107,7 +107,7 @@ BackgroundItem {
right: parent.right right: parent.right
} }
} }
Label { Text {
id: lblContent id: lblContent
anchors { anchors {
left: miniHeader.left left: miniHeader.left
@ -144,9 +144,9 @@ BackgroundItem {
} }
} }
text: content.replace(new RegExp("<a ", 'g'), '<a style="text-decoration: none; color:'+(pressed ? Theme.secondaryColor : Theme.highlightColor)+'" ') text: content.replace(new RegExp("<a ", 'g'), '<a style="text-decoration: none; color:'+(pressed ? Theme.secondaryColor : Theme.highlightColor)+'" ')
textFormat: Text.RichText
linkColor : Theme.highlightColor linkColor : Theme.highlightColor
wrapMode: Text.Wrap wrapMode: Text.WordWrap
textFormat: Text.StyledText
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
color: (pressed ? Theme.highlightColor : (!highlight ? Theme.primaryColor : Theme.secondaryColor)) color: (pressed ? Theme.highlightColor : (!highlight ? Theme.primaryColor : Theme.secondaryColor))
Rectangle { Rectangle {
@ -287,7 +287,7 @@ BackgroundItem {
}) })
} }
onPressAndHold: { onPressAndHold: {
console.log(content) console.log(JSON.stringify(mdl.get(index)))
mnu.show(delegate) mnu.show(delegate)
} }
onDoubleClicked: { onDoubleClicked: {

View file

@ -1,5 +1,6 @@
* Tue Oct 23 2018 Dusko Angirevic <dysko@me.com> 0.2.7-0 * Tue Oct 23 2018 Dusko Angirevic <dysko@me.com> 0.2.7-0
- Minor bugfix - Added emoji custom support
- Bugfix: missing media on boosted toots
* Thu May 24 2018 Dusko Angirevic <dysko@me.com> 0.2.6-0 * Thu May 24 2018 Dusko Angirevic <dysko@me.com> 0.2.6-0
- Minor bugfix - Minor bugfix
@ -25,7 +26,7 @@
- Added Copy URL option - Added Copy URL option
- Privacy option in the conversation is now inherited by toot in the thread - Privacy option in the conversation is now inherited by toot in the thread
* Thu Oct 10 2017 Dusko Angirevic <dysko@me.com> 0.2.1-0 * Tue Oct 10 2017 Dusko Angirevic <dysko@me.com> 0.2.1-0
- Added bugs for later (merging branches and contributions) - Added bugs for later (merging branches and contributions)
* Thu Jul 20 2017 Dusko Angirevic <dysko@me.com> 0.2.0-0 * Thu Jul 20 2017 Dusko Angirevic <dysko@me.com> 0.2.0-0

View file

@ -33,14 +33,17 @@ PkgConfigBR:
# Runtime dependencies which are not automatically detected # Runtime dependencies which are not automatically detected
Requires: Requires:
- sailfishsilica-qt5 >= 0.10.9 - sailfishsilica-qt5 >= 0.10.9
# - libsailfishapp-launcher
# All installed files # All installed files
Files: Files:
- '%{_bindir}' - '%{_bindir}'
- '%{_datadir}/%{name}' - '%{_datadir}/%{name}'
- '%{_datadir}/applications/%{name}.desktop' - '%{_datadir}/applications/%{name}.desktop'
- '%{_datadir}/icons/hicolor/*/apps/%{name}.png' - '%{_datadir}/icons/hicolor/*/apps/%{name}.png'
# For more information about yaml and what's supported in Sailfish OS # For more information about yaml and what's supported in Sailfish OS
# build system, please see https://wiki.merproject.org/wiki/Spectacle # build system, please see https://wiki.merproject.org/wiki/Spectacle

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS> <!DOCTYPE TS>
<TS version="2.1" language="de"> <TS version="2.1">
<context> <context>
<name>API</name> <name>API</name>
<message> <message>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS> <!DOCTYPE TS>
<TS version="2.1" language="el"> <TS version="2.1">
<context> <context>
<name>API</name> <name>API</name>
<message> <message>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS> <!DOCTYPE TS>
<TS version="2.1" language="es"> <TS version="2.1">
<context> <context>
<name>API</name> <name>API</name>
<message> <message>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS> <!DOCTYPE TS>
<TS version="2.1" language="fi"> <TS version="2.1">
<context> <context>
<name>API</name> <name>API</name>
<message> <message>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS> <!DOCTYPE TS>
<TS version="2.1" language="fr"> <TS version="2.1">
<context> <context>
<name>API</name> <name>API</name>
<message> <message>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS> <!DOCTYPE TS>
<TS version="2.1" language="nl"> <TS version="2.1">
<context> <context>
<name>API</name> <name>API</name>
<message> <message>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS> <!DOCTYPE TS>
<TS version="2.1" language="nl_BE"> <TS version="2.1">
<context> <context>
<name>API</name> <name>API</name>
<message> <message>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS> <!DOCTYPE TS>
<TS version="2.1" language="oc"> <TS version="2.1">
<context> <context>
<name>API</name> <name>API</name>
<message> <message>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS> <!DOCTYPE TS>
<TS version="2.1" language="pl_PL"> <TS version="2.1">
<context> <context>
<name>API</name> <name>API</name>
<message> <message>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS> <!DOCTYPE TS>
<TS version="2.1" language="ru"> <TS version="2.1">
<context> <context>
<name>API</name> <name>API</name>
<message> <message>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS> <!DOCTYPE TS>
<TS version="2.1" language="sr"> <TS version="2.1">
<context> <context>
<name>API</name> <name>API</name>
<message> <message>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS> <!DOCTYPE TS>
<TS version="2.1" language="sv"> <TS version="2.1">
<context> <context>
<name>API</name> <name>API</name>
<message> <message>