Version 0.003
This commit is contained in:
parent
9f9a9f618c
commit
10dccdcdbb
572 changed files with 3711 additions and 13631 deletions
327
source-android/qml/configqml/ConfigTab.qml
Normal file
327
source-android/qml/configqml/ConfigTab.qml
Normal file
|
@ -0,0 +1,327 @@
|
|||
import QtQuick 2.0
|
||||
import QtQuick.Dialogs 1.2
|
||||
import QtQuick.Controls 1.2
|
||||
import "qrc:/js/service.js" as Service
|
||||
import "qrc:/js/layout.js" as Layoutjs
|
||||
import "qrc:/js/helper.js" as Helperjs
|
||||
import "qrc:/qml/configqml"
|
||||
import "qrc:/qml/genericqml"
|
||||
|
||||
StackView{
|
||||
id: configStack
|
||||
anchors.fill:parent
|
||||
initialItem: Flickable{
|
||||
width:root.width-5*mm
|
||||
height:root.height-12*mm
|
||||
contentHeight: configBackground.height
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
Rectangle{
|
||||
id:configBackground
|
||||
color: "white"
|
||||
width:parent.width
|
||||
height:Math.max(90*mm,root.height-12*mm)
|
||||
property var users:[]
|
||||
|
||||
BlueButton{
|
||||
id:userButton
|
||||
text:qsTr("User")
|
||||
y:mm
|
||||
width: root.width/2
|
||||
onClicked:{
|
||||
var useritems="";
|
||||
for (var i=0;i<configBackground.users.length;i++){
|
||||
|
||||
useritems=useritems+"MenuItem{text:'"+configBackground.users[i].username+
|
||||
"'; onTriggered: {Service.readConfig(db,function(obj){
|
||||
userButton.text=obj.username;
|
||||
servername.text=obj.server;
|
||||
username.text= obj.username;
|
||||
password.text=Qt.atob(obj.password);
|
||||
imagestore.text=obj.imagestore;
|
||||
maxNews.value=obj.maxnews;
|
||||
newsTypeField.text=obj.newsViewType;
|
||||
if( obj.isActive==0){userButton.fontColor='black'} else {userButton.fontColor='grey'}
|
||||
},'username','"+configBackground.users[i].username+"')}}"
|
||||
}
|
||||
var menuString="import QtQuick.Controls 1.4;import 'qrc:/js/service.js' as Service; Menu {"+useritems+"}";
|
||||
var userlistObject=Qt.createQmlObject(menuString,configBackground,"usermenuOutput")
|
||||
userlistObject.popup() }
|
||||
}
|
||||
|
||||
Text {
|
||||
text: "Server"
|
||||
x: 4*mm; y: 10*mm
|
||||
}
|
||||
Text {
|
||||
text: "User"
|
||||
x: 4*mm; y: 20*mm
|
||||
}
|
||||
|
||||
Text {
|
||||
text: "Password"
|
||||
x: 4*mm; y: 30*mm
|
||||
}
|
||||
Text {
|
||||
text: "Image dir."
|
||||
x: 4*mm; y: 40*mm
|
||||
}
|
||||
|
||||
Text {
|
||||
text: "Max. News"
|
||||
x: 4*mm; y: 50*mm
|
||||
}
|
||||
Text {
|
||||
text: "News as"
|
||||
x: 4*mm; y: 60*mm
|
||||
}
|
||||
Text {
|
||||
text: "Interval (0=None)"
|
||||
visible: false
|
||||
x: 4*mm; y: 70*mm; width:20*mm;wrapMode: Text.Wrap
|
||||
}
|
||||
|
||||
Rectangle{color: "light grey"; x: 25*mm; y: 10*mm; width: root.width/2; height: 5*mm;}
|
||||
Flickable {
|
||||
id: servernameFlickable
|
||||
x: 25*mm; y: 10*mm; width: root.width/2; height: 5*mm;
|
||||
contentWidth: servername.paintedWidth
|
||||
contentHeight: servername.paintedHeight
|
||||
clip: true
|
||||
TextEdit {
|
||||
id: servername
|
||||
width: servernameFlickable.width
|
||||
height: servernameFlickable.height
|
||||
focus: true
|
||||
text:"https://..."
|
||||
//wrapMode: TextEdit.NoWrap
|
||||
//validator: RegExpValidator { regExp: /^(((http|https|ftp):\/\/)?([[a-zA-Z0-9]\-\.])+(\.)([[a-zA-Z0-9]]){2,4}([[a-zA-Z0-9]\/+=%&_\.~?\-]*))*$/}
|
||||
// onEditingFinished:{}
|
||||
onCursorRectangleChanged: Layoutjs.ensureVisibility(cursorRectangle,servernameFlickable)
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle{
|
||||
color: "light grey"
|
||||
x: 25*mm; y: 20*mm; width: root.width/2; height: 5*mm;
|
||||
TextInput {
|
||||
id: username
|
||||
anchors.fill: parent
|
||||
selectByMouse: true
|
||||
}
|
||||
}
|
||||
Rectangle{
|
||||
color: "light grey"
|
||||
x: 25*mm; y: 30*mm; width: root.width/2; height: 5*mm;
|
||||
TextInput {
|
||||
id: password
|
||||
anchors.fill: parent
|
||||
selectByMouse: true
|
||||
echoMode: TextInput.PasswordEchoOnEdit
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle{color: "light grey"; x: 25*mm; y: 40*mm; width: root.width/2-9*mm; height: 5*mm;}
|
||||
Flickable {
|
||||
id: imagestoreFlickable
|
||||
x: 25*mm; y: 40*mm; width: root.width/2-9*mm; height: 5*mm;
|
||||
clip: true
|
||||
TextInput {
|
||||
id: imagestore
|
||||
width: imagestoreFlickable.width
|
||||
height: imagestoreFlickable.height
|
||||
wrapMode: TextEdit.NoWrap
|
||||
onCursorRectangleChanged: Layoutjs.ensureVisibility(cursorRectangle,imagestoreFlickable)
|
||||
}
|
||||
}
|
||||
Slider{ id: maxNews
|
||||
x:37*mm; y: 50*mm;width: root.width/3;height:5*mm
|
||||
minimumValue: 0;maximumValue:100000; stepSize: 1000
|
||||
}
|
||||
Rectangle{color: "light grey"; x: 25*mm; y: 50*mm; width: 9*mm; height: 5*mm;
|
||||
TextEdit{id:maxNewsText;
|
||||
anchors.fill: parent
|
||||
verticalAlignment:TextEdit.AlignRight
|
||||
text:maxNews.value
|
||||
focus: true
|
||||
selectByMouse: true
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle{
|
||||
x: 25*mm; y: 60*mm; width: root.width/2; height: 5*mm;
|
||||
color:"light grey"
|
||||
Text{
|
||||
id: newsTypeField
|
||||
anchors.fill: parent
|
||||
text:"Timeline"
|
||||
}
|
||||
MouseArea{
|
||||
anchors.fill:parent
|
||||
onClicked:newstypemenu.popup()
|
||||
}
|
||||
}
|
||||
Slider{ id: messageIntervalSlider
|
||||
visible: false
|
||||
x:37*mm; y: 70*mm;width: root.width/3;height:5*mm
|
||||
minimumValue: 0;maximumValue:24; stepSize: 0.5
|
||||
}
|
||||
Rectangle{
|
||||
visible:false
|
||||
x: 25*mm; y: 70*mm; width: 9*mm; height: 5*mm;
|
||||
TextEdit{
|
||||
id: messageIntervalField
|
||||
anchors.fill: parent
|
||||
verticalAlignment:TextEdit.AlignRight
|
||||
text:messageIntervalSlider.value
|
||||
focus: true
|
||||
selectByMouse: true
|
||||
}
|
||||
}
|
||||
|
||||
FileDialog {
|
||||
id: imagestoreDialog
|
||||
title: "Please choose a directory"
|
||||
folder: shortcuts.pictures
|
||||
selectFolder: true
|
||||
onAccepted: {
|
||||
var imagestoreString=imagestoreDialog.folder.toString();
|
||||
imagestoreString=imagestoreString.replace(/^(file:\/{2})/,"")+"/"
|
||||
imagestore.text=imagestoreString
|
||||
}
|
||||
}
|
||||
|
||||
BlueButton {
|
||||
x: root.width/2+18*mm; y: 40*mm; width: 7*mm; height: 5*mm;
|
||||
text: "..."
|
||||
onClicked:
|
||||
{imagestoreDialog.open()}
|
||||
}
|
||||
|
||||
|
||||
BlueButton {
|
||||
x: 25*mm; y: 80*mm
|
||||
text: "Confirm"
|
||||
onClicked:{
|
||||
var userconfig={server: servername.text, username: username.text, password:Qt.btoa(password.text), imagestore:imagestore.text,maxnews:maxNewsText.text,interval: messageIntervalField.text, newsViewType:newsTypeField.text};
|
||||
var errormessage="";
|
||||
if (servername.text==""){errormessage=qsTr("No server given! ")}
|
||||
//if (!servername.acceptableInput){errormessage+=qsTr("Server name not valid! ")}
|
||||
else if (username.text==""){errormessage+=qsTr("No username given! ")}
|
||||
else if (password.text=="") {errormessage+=qsTr("No password given! ")}
|
||||
else if (imagestore.text=="") {errormessage+=qsTr("No image directory given!")}
|
||||
else if (maxNewsText.text=="") {errormessage+=qsTr("No maximum news number given!")}
|
||||
else {errormessage=""}
|
||||
if (errormessage=="") {
|
||||
filesystem.Directory=userconfig.imagestore;
|
||||
filesystem.makeDir("contacts");
|
||||
filesystem.makeDir("albums");
|
||||
Service.storeConfig(db,userconfig);
|
||||
Service.readConfig(db,function(userconfig){
|
||||
Service.getServerConfig(db,userconfig,root, function(obj){
|
||||
var serverString=obj;
|
||||
var serverconfigObject=Qt.createQmlObject(serverString,configBackground,"serverconfigOutput");
|
||||
Helperjs.readData(db,"config","",function(storedUsers){
|
||||
storedUsers.sort(function(obj1, obj2) {
|
||||
return obj1.isActive - obj2.isActive;
|
||||
});
|
||||
configBackground.users=storedUsers});
|
||||
userButton.color="black"
|
||||
//reset values
|
||||
root.login=userconfig;
|
||||
// root.contactlist=[];
|
||||
// root.news=[];
|
||||
// root.newContacts=[];
|
||||
// root.currentContact= 0;
|
||||
// root.contactLoadType= "";
|
||||
newstab.newstabstatus=userconfig.newsViewType;
|
||||
root.currentIndex=0;
|
||||
newstab.active=true;
|
||||
})},"isActive",0);
|
||||
}
|
||||
else {Helperjs.show("Error", errormessage,root)}
|
||||
}}
|
||||
|
||||
BlueButton {
|
||||
x: root.width/2+2*mm; y: mm; width: 5*mm; height: 5*mm;
|
||||
text: "-"
|
||||
onClicked:{
|
||||
var userconfig={server: servername.text, username: username.text, password: Qt.btoa(password.text)};
|
||||
Service.deleteConfig(db,userconfig,function(){
|
||||
filesystem.Directory=imagestore.text+"contacts";
|
||||
filesystem.rmDir();
|
||||
filesystem.Directory=imagestore.text+"albums";
|
||||
filesystem.rmDir();
|
||||
servername.text="https://...";
|
||||
username.text="";
|
||||
password.text="";
|
||||
imagestore.text="";
|
||||
maxNews.value=0;
|
||||
newsTypeField.text="Timeline";
|
||||
messageIntervalSlider.value=0;
|
||||
userButton.text=qsTr("User");
|
||||
Helperjs.readData(db,"config","",function(storedUsers){
|
||||
storedUsers.sort(function(obj1, obj2) {
|
||||
return obj1.isActive - obj2.isActive;
|
||||
})
|
||||
configBackground.users=storedUsers;})
|
||||
})
|
||||
}}
|
||||
|
||||
BlueButton {
|
||||
x: root.width/2+8*mm; y: mm; width: 5*mm; height: 5*mm;
|
||||
text: "+"
|
||||
onClicked:{
|
||||
servername.text="https://..."
|
||||
username.text=""
|
||||
password.text=""
|
||||
imagestore.text=""
|
||||
maxNews.value=0
|
||||
newsTypeField.text="Timeline"
|
||||
messageIntervalSlider.value=0
|
||||
userButton.text=qsTr("User")
|
||||
}
|
||||
}
|
||||
|
||||
BlueButton {
|
||||
x: root.width/2+14*mm; y: mm; width: 5*mm; height: 5*mm;
|
||||
text: "?"
|
||||
onClicked:{
|
||||
configStack.push({item:"qrc:/qml/configqml/InfoBox.qml"});
|
||||
}
|
||||
}
|
||||
|
||||
Menu {
|
||||
id:newstypemenu
|
||||
MenuItem {
|
||||
text: qsTr("Timeline")
|
||||
onTriggered: {newsTypeField.text="Timeline"}
|
||||
}
|
||||
MenuItem {
|
||||
text: qsTr("Tree")
|
||||
onTriggered: {newsTypeField.text="Tree"}
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
try{Helperjs.readData(db,"config","",function(storedUsers){
|
||||
storedUsers.sort(function(obj1, obj2) {
|
||||
return obj1.isActive - obj2.isActive;
|
||||
})
|
||||
configBackground.users=storedUsers;
|
||||
Service.readConfig(db,function(obj){
|
||||
userButton.text=obj.username;
|
||||
servername.text=obj.server;
|
||||
username.text= obj.username;
|
||||
password.text=Qt.atob(obj.password);
|
||||
imagestore.text=obj.imagestore;
|
||||
maxNews.value=obj.maxnews;
|
||||
newsTypeField.text=obj.newsViewType;
|
||||
messageIntervalSlider.value=obj.timerInterval;
|
||||
if( obj.isActive==0){userButton.fontColor='black'} else {userButton.fontColor='grey'}},"isActive",0
|
||||
)
|
||||
})}
|
||||
catch (e){print(e)}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
34
source-android/qml/configqml/InfoBox.qml
Normal file
34
source-android/qml/configqml/InfoBox.qml
Normal file
|
@ -0,0 +1,34 @@
|
|||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.2
|
||||
import "qrc:/qml/genericqml"
|
||||
|
||||
Rectangle{
|
||||
color:"white"
|
||||
width:infoBoxText.contentWidth
|
||||
height:infoBoxText.contentHeight
|
||||
Text{id:infoBoxText
|
||||
anchors.top:closeButton.bottom
|
||||
anchors.topMargin: mm
|
||||
textFormat: Text.RichText
|
||||
wrapMode: Text.Wrap
|
||||
text: "<b>Friendiqa v0.003 </b><br>Licensed under GPL 3<br> "+
|
||||
"Profile <a href='https://freunde.ma-nic.de/profile/friendiqa'>https://freunde.ma-nic.de/profile/friendiqa</a><br>"+
|
||||
"Sourcecode: <a href='https://github.com/LubuWest/Friendiqa'>https://github.com/LubuWest/Friendica</a><br>"+
|
||||
"C++ code by <a href='https://kirgroup.com/profile/fabrixxm'>Fabio</a><br>"+
|
||||
"QML and Javascript code by <a href='https://freunde.ma-nic.de/profile/marco'>Marco</a><br>"+
|
||||
"Qt Framework <a href='https://www.qt.io'>www.qt.io</a><br>"+
|
||||
"Icons by <a href='http://fontawesome.io'>FontAwesome</a><br>"+
|
||||
"Folder Icon by <a href='https://github.com/KDE/breeze-icons'>KDE Breeze Icons</a>"
|
||||
onLinkActivated:{
|
||||
Qt.openUrlExternally(link)}
|
||||
}
|
||||
BlueButton{
|
||||
id:closeButton
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 1*mm
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 1*mm
|
||||
text: "\uf057" //qsTr("Close")
|
||||
onClicked:{configStack.pop()}
|
||||
}
|
||||
}
|
8
source-android/qml/configqml/OSSettingsAndroid.qml
Normal file
8
source-android/qml/configqml/OSSettingsAndroid.qml
Normal file
|
@ -0,0 +1,8 @@
|
|||
import QtQuick.Window 2.0
|
||||
import QtQuick 2.0
|
||||
QtObject{
|
||||
property int appWidth: Screen.desktopAvailableWidth
|
||||
property int appHeight: Screen.desktopAvailableHeight
|
||||
property int backKey: Qt.Key_Back
|
||||
property string attachImageDir:filesystem.cameraPath+"/"
|
||||
}
|
7
source-android/qml/configqml/OSSettingsLinux.qml
Normal file
7
source-android/qml/configqml/OSSettingsLinux.qml
Normal file
|
@ -0,0 +1,7 @@
|
|||
import QtQuick 2.0
|
||||
QtObject{
|
||||
property real appWidth: 500
|
||||
property real appHeight: 500
|
||||
property int backKey: Qt.Key_Escape
|
||||
property string attachImageDir:filesystem.homePath+"/Pictures/"
|
||||
}
|
84
source-android/qml/contactqml/ContactComponent.qml
Normal file
84
source-android/qml/contactqml/ContactComponent.qml
Normal file
|
@ -0,0 +1,84 @@
|
|||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.3
|
||||
import "qrc:/qml/genericqml"
|
||||
|
||||
Item {
|
||||
id: contactComponent
|
||||
property var createdAtDate: new Date(contact.created_at)
|
||||
property string connectUrl: (contact.network!=="dfrn")||(contact.isFriend==1)?"":( "<a href='"+contact.url.replace("profile","dfrn_request") +"'>"+qsTr("Connect")+"</a><br>")
|
||||
|
||||
Rectangle {
|
||||
id: wrapper
|
||||
width: 16*mm
|
||||
height: 15*mm
|
||||
border.color: "grey"
|
||||
color:"white"
|
||||
Image {
|
||||
id: photoImage
|
||||
x:1
|
||||
y:1
|
||||
width: 10*mm
|
||||
height:10*mm
|
||||
source:(contact.profile_image!="")? "file://"+contact.profile_image : contact.profile_image_url
|
||||
onStatusChanged: if (photoImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
|
||||
}
|
||||
|
||||
Label {
|
||||
id: namelabel
|
||||
x: 1
|
||||
width: wrapper.width-4
|
||||
height: 3*mm
|
||||
text: contact.screen_name
|
||||
elide:Text.ElideRight
|
||||
anchors.topMargin: 0
|
||||
anchors.left: photoImage.left
|
||||
color: "#303030"
|
||||
font.pixelSize: 3*mm
|
||||
anchors.top: photoImage.bottom
|
||||
}
|
||||
BlueButton{
|
||||
id:infobutton
|
||||
width: 5*mm
|
||||
height: 5*mm
|
||||
color:"transparent"
|
||||
text:"?"
|
||||
anchors.left: photoImage.right
|
||||
anchors.leftMargin: 0.5*mm
|
||||
anchors.topMargin: mm
|
||||
anchors.top: parent.top
|
||||
onClicked:{
|
||||
contactComponent.state="large";
|
||||
var component = Qt.createComponent("qrc:/qml/contactqml/ContactDetailsComponent.qml");
|
||||
if (component.status== Component.Ready){
|
||||
var contactDetails = component.createObject(wrapper,{"contact": contact})}
|
||||
}
|
||||
}
|
||||
}
|
||||
Timer{id:selectiontimer; //weird behaviour when state set to "large" onCompleted
|
||||
interval: 200; running: false; repeat: false
|
||||
onTriggered: {
|
||||
|
||||
contactComponent.state="large";
|
||||
var component = Qt.createComponent("qrc:/qml/contactqml/ContactDetailsComponent.qml");
|
||||
if (component.status== Component.Ready){
|
||||
var contactDetails = component.createObject(wrapper,{"contact": contact})}
|
||||
}
|
||||
}
|
||||
Component.onCompleted: {
|
||||
if(status=="large"){selectiontimer.start()}
|
||||
else{contactComponent.state=""}
|
||||
}
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "large"
|
||||
PropertyChanges { target: namelabel; font.pixelSize: 4*mm; x:mm; width:friendsTabView.width-4*mm; text:Qt.atob(contact.name)+" (@"+contact.screen_name+")"}
|
||||
ParentChange{target:contactComponent;parent:root; x:mm;y:2*mm}
|
||||
//PropertyChanges { target: contactComponent; z: 2; x:0;y:0}
|
||||
PropertyChanges { target: wrapper; width:friendsTabView.width;height:friendsTabView.height-15*mm}
|
||||
PropertyChanges { target: photoImage; width:15*mm;height:15*mm;x:mm;y:mm }
|
||||
PropertyChanges { target: contactComponent.GridView.view; interactive:false}
|
||||
|
||||
}
|
||||
]
|
||||
}
|
78
source-android/qml/contactqml/ContactDetailsComponent.qml
Normal file
78
source-android/qml/contactqml/ContactDetailsComponent.qml
Normal file
|
@ -0,0 +1,78 @@
|
|||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.3
|
||||
import "qrc:/qml/genericqml"
|
||||
|
||||
Rectangle{
|
||||
id: detailsrectangle
|
||||
anchors.top: namelabel.bottom
|
||||
anchors.topMargin: 2*mm
|
||||
|
||||
ScrollView{
|
||||
horizontalScrollBarPolicy:Qt.ScrollBarAlwaysOff
|
||||
frameVisible: true
|
||||
id:namelabelflickable
|
||||
width: root.width-10*mm
|
||||
height:friendsTabView.height-45*mm
|
||||
x: mm
|
||||
clip:true
|
||||
Text{
|
||||
id:namelabeltext
|
||||
width: namelabelflickable.width
|
||||
height: implicitHeight
|
||||
font.pixelSize: 3*mm
|
||||
textFormat:Text.RichText
|
||||
wrapMode: Text.Wrap
|
||||
text:"<b>"+qsTr("Description")+": </b> "+Qt.atob(contact.description)+"<br> <b>"+qsTr("Location")+":</b> "+contact.location+"<br> <b>"+qsTr("Posts")+":</b> "+contact.statuses_count+
|
||||
"<br> <b>"+qsTr("URL")+":</b> <a href='"+ contact.url+"'>"+contact.url+"</a><br>"+
|
||||
connectUrl+ "<b>"+qsTr("Created at")+":</b> "+createdAtDate.toLocaleString(Qt.locale())
|
||||
onLinkActivated: {
|
||||
Qt.openUrlExternally(link)}
|
||||
}
|
||||
}
|
||||
|
||||
Row{
|
||||
anchors.top: namelabelflickable.bottom
|
||||
anchors.topMargin: 2*mm
|
||||
x: mm
|
||||
spacing:4
|
||||
|
||||
BlueButton{
|
||||
id:photobutton
|
||||
text: "\uf03e" // "Photos"
|
||||
visible:(contact.network=="dfrn")
|
||||
onClicked:{
|
||||
fotostab.phototabstatus="Contact";
|
||||
root.currentIndex=2;
|
||||
fotostab.active=true;
|
||||
root.fotoSignal(contact) ;
|
||||
}
|
||||
}
|
||||
|
||||
BlueButton{
|
||||
id:messagebutton
|
||||
text: "\uf0e6" //"Messages"
|
||||
onClicked:{
|
||||
root.currentIndex=0;
|
||||
newstab.active=true;
|
||||
root.messageSignal(contact.id) ;
|
||||
}
|
||||
}
|
||||
|
||||
BlueButton{
|
||||
id:dmbutton
|
||||
visible: (contact.following=="true")
|
||||
text: "\uf040" //"DM"
|
||||
onClicked:{
|
||||
root.currentIndex=0;
|
||||
newstab.active=true;
|
||||
root.directmessageSignal(contact.screen_name);
|
||||
}
|
||||
}
|
||||
|
||||
BlueButton{
|
||||
id: closeButton
|
||||
text: "\uf057" //"close"
|
||||
onClicked:{detailsrectangle.destroy();contactComponent.state="";friendsTabView.contactSignal}
|
||||
}
|
||||
}
|
||||
}
|
220
source-android/qml/contactqml/FriendsTab.qml
Normal file
220
source-android/qml/contactqml/FriendsTab.qml
Normal file
|
@ -0,0 +1,220 @@
|
|||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.2
|
||||
import QtQuick.Controls.Styles 1.4
|
||||
import "qrc:/js/helper.js" as Helperjs
|
||||
import "qrc:/js/news.js" as Newsjs
|
||||
import "qrc:/qml/contactqml"
|
||||
import "qrc:/qml/genericqml"
|
||||
|
||||
Rectangle {
|
||||
y:1
|
||||
color: "white"
|
||||
|
||||
function showContactdetails(contact){
|
||||
if(contact.isFriend){
|
||||
friendsTabView.currentIndex=0;
|
||||
friendsTabView.contactsSignal(contact)
|
||||
}
|
||||
else{friendsTabView.currentIndex=1;
|
||||
friendsTabView.contactsSignal(contact)
|
||||
}
|
||||
}
|
||||
TabView{
|
||||
id:friendsTabView
|
||||
tabPosition: Qt.TopEdge
|
||||
x:mm
|
||||
y:mm
|
||||
width: root.width-2*mm
|
||||
height: root.height-10*mm
|
||||
currentIndex: 0
|
||||
signal contactsSignal(var contact)
|
||||
signal groupsSignal(var username)
|
||||
onCurrentIndexChanged:{
|
||||
if (currentIndex==0){//print("currentindex 0");
|
||||
contactsSignal("")
|
||||
}
|
||||
else if (currentIndex==1){
|
||||
contactsSignal("")
|
||||
}
|
||||
else if (currentIndex==2){groupsSignal(root.login.username)}
|
||||
}
|
||||
style: TabViewStyle {
|
||||
frameOverlap: 1
|
||||
tab: Rectangle {
|
||||
color: "white"
|
||||
implicitWidth: root.width/3-2*mm
|
||||
implicitHeight: 4*mm
|
||||
Text { id: text
|
||||
anchors.centerIn: parent
|
||||
text: styleData.title
|
||||
color: "dark grey"
|
||||
font.pixelSize:2.5*mm
|
||||
font.bold: styleData.selected
|
||||
}
|
||||
}
|
||||
frame: Rectangle { color: "light grey" }
|
||||
tabsAlignment:Qt.AlignHCenter
|
||||
}
|
||||
|
||||
Tab{
|
||||
title: qsTr("Friends")
|
||||
Rectangle{
|
||||
id: friendsGridTab
|
||||
function makebig(friendindex){print("friendindex"+friendindex);if (friendindex){friendsModel.set(friendindex,{"status":"large"})}}
|
||||
function showFriends(contact,callback){//print("contact"+JSON.stringify(contact));
|
||||
try {friendsModel.clear()} catch(e){print(e)};
|
||||
var friendindex;
|
||||
Helperjs.readData(db,"contacts",root.login.username,function(friendsobject){
|
||||
for (var i=0;i<friendsobject.length;i++){
|
||||
var status="";
|
||||
if(Helperjs.getCount(db,login,"contacts","screen_name",friendsobject[i].screen_name)>1){
|
||||
friendsobject[i].screen_name=friendsobject[i].screen_name+"+"+friendsobject[i].cid
|
||||
}
|
||||
if(contact){if (contact.cid==friendsobject[i].cid){status="large"}}
|
||||
friendsModel.append({"contact":friendsobject[i],"status":status});
|
||||
}
|
||||
|
||||
|
||||
},"isFriend",1,"screen_name ASC");
|
||||
}
|
||||
|
||||
BlueButton {
|
||||
id: updateFriendsButton
|
||||
text: "\uf021"
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: mm
|
||||
anchors.right: parent.right
|
||||
onClicked: {
|
||||
try {friendsModel.clear()} catch(e){print(e)};
|
||||
root.contactLoadType="friends";
|
||||
Newsjs.requestFriends(root.login,db,root,function(nc){
|
||||
root.newContacts=nc
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
ProgressBar{
|
||||
id: newContactsProgress
|
||||
width: 15*mm
|
||||
height: updateFriendsButton.height
|
||||
anchors.top: parent.top
|
||||
anchors.right:updateFriendsButton.left
|
||||
anchors.rightMargin:mm
|
||||
visible: (root.currentContact!=root.newContacts.length)?true:false
|
||||
value: root.currentContact/root.newContacts.length
|
||||
}
|
||||
|
||||
GridView {
|
||||
id: friendsView
|
||||
x:mm
|
||||
y:updateFriendsButton.height+2*mm
|
||||
width:friendsGridTab.width-2*mm
|
||||
height:friendsGridTab.height-updateFriendsButton.height-2*mm
|
||||
clip: true
|
||||
cellHeight: 16*mm
|
||||
cellWidth: 17*mm
|
||||
add: Transition {
|
||||
NumberAnimation { properties: "x,y"; from: 300; duration: 1000 }
|
||||
}
|
||||
model: friendsModel
|
||||
delegate: ContactComponent { }
|
||||
Component.onCompleted: positionViewAtBeginning()
|
||||
}
|
||||
|
||||
ListModel{id:friendsModel}
|
||||
|
||||
Component.onCompleted: {
|
||||
root.friendsSignal.connect(showFriends);
|
||||
friendsTabView.contactsSignal.connect(showFriends);
|
||||
showFriends(root.login.username)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Tab{
|
||||
title: qsTr("Other Contacts")
|
||||
|
||||
Rectangle{
|
||||
id: contactsGridTab
|
||||
function showContacts(contact){
|
||||
try {contactsModel.clear()} catch(e){print(e)};
|
||||
Helperjs.readData(db, "contacts",root.login.username,function(contactsobject){
|
||||
for (var j=0;j<contactsobject.length;j++){
|
||||
var status="";
|
||||
if(contact){if (contact.id==contactsobject[j].id){status="large"}}
|
||||
contactsModel.append({"contact":contactsobject[j],"status":status});
|
||||
}
|
||||
},"isFriend",0,"screen_name ASC");
|
||||
}
|
||||
|
||||
GridView {
|
||||
id: contactsView
|
||||
x:mm
|
||||
y:2*mm
|
||||
width:contactsGridTab.width-2*mm
|
||||
height:contactsGridTab.height-2*mm
|
||||
clip: true
|
||||
cellHeight: 16*mm
|
||||
cellWidth: 17*mm
|
||||
add: Transition {
|
||||
NumberAnimation { properties: "x,y"; from: 300; duration: 1000 }
|
||||
}
|
||||
model: contactsModel
|
||||
delegate: ContactComponent { }
|
||||
Component.onCompleted: positionViewAtBeginning()
|
||||
}
|
||||
|
||||
ListModel{id: contactsModel}
|
||||
Component.onCompleted: {
|
||||
friendsTabView.contactsSignal.connect(showContacts);
|
||||
}
|
||||
}
|
||||
}
|
||||
Tab{
|
||||
title: qsTr("Groups")
|
||||
Rectangle{
|
||||
id: groupsGridTab
|
||||
function showGroups(username){
|
||||
try {groupsModel.clear()} catch(e){print(e)};
|
||||
Helperjs.readData(db, "groups",root.login.username,function(groupsobject){
|
||||
for (var j=0;j<groupsobject.length;j++){
|
||||
groupsModel.append({"group":groupsobject[j]});
|
||||
}})}
|
||||
BlueButton {
|
||||
id: updateGroupsButton
|
||||
text: "\uf021"
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: mm
|
||||
anchors.right: parent.right
|
||||
onClicked: {
|
||||
Newsjs.requestGroups(root.login,root.db,root,function(){
|
||||
showGroups(root.login.username)})}
|
||||
}
|
||||
GridView {
|
||||
id: groupsView
|
||||
x:mm
|
||||
y:updateGroupsButton.height+2*mm
|
||||
width:groupsGridTab.width-2*mm
|
||||
height:groupsGridTab.height-updateGroupsButton.height-2*mm
|
||||
clip: true
|
||||
cellHeight: 16*mm
|
||||
cellWidth: 17*mm
|
||||
add: Transition {
|
||||
NumberAnimation { properties: "x,y"; from: 300; duration: 1000 }
|
||||
}
|
||||
model: groupsModel
|
||||
delegate: GroupComponent { }
|
||||
}
|
||||
ListModel{
|
||||
id: groupsModel
|
||||
}
|
||||
Component.onCompleted: {
|
||||
friendsTabView.groupsSignal.connect(showGroups);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Component.onCompleted: {
|
||||
root.contactdetailsSignal.connect(showContactdetails);
|
||||
}
|
||||
}
|
128
source-android/qml/contactqml/GroupComponent.qml
Normal file
128
source-android/qml/contactqml/GroupComponent.qml
Normal file
|
@ -0,0 +1,128 @@
|
|||
import QtQuick 2.0
|
||||
import "qrc:/js/helper.js" as Helperjs
|
||||
import "qrc:/qml/genericqml"
|
||||
|
||||
Item {
|
||||
id: groupComponent
|
||||
Rectangle {
|
||||
id: wrapper
|
||||
width: 16*mm
|
||||
height: 15*mm
|
||||
border.color: "grey"
|
||||
color:"white"
|
||||
|
||||
Image {
|
||||
id: photoImage
|
||||
x:1
|
||||
y:1
|
||||
width: 10*mm
|
||||
height:10*mm
|
||||
source:"qrc:/images/defaultcontact.jpg"
|
||||
}
|
||||
Text {
|
||||
id: namelabel
|
||||
x: 1
|
||||
width: wrapper.width-2
|
||||
height: 3*mm
|
||||
text: group.groupname
|
||||
|
||||
color: "#303030"
|
||||
font.pixelSize: 3*mm
|
||||
anchors.top: photoImage.bottom
|
||||
}
|
||||
BlueButton{
|
||||
id:infobutton
|
||||
width: 5*mm
|
||||
height: 5*mm
|
||||
color:"transparent"
|
||||
text:"?"
|
||||
anchors.left: photoImage.right
|
||||
anchors.leftMargin: 3
|
||||
anchors.topMargin: 3
|
||||
anchors.top: parent.top
|
||||
onClicked:{
|
||||
Helperjs.readField("members",root.db,"groups",root.login.username,function(groups){
|
||||
try {groupModel.clear()}catch (e){print(e)}
|
||||
var groupmembers=JSON.parse(groups);
|
||||
for (var user in groupmembers){
|
||||
Helperjs.readData(root.db,"contacts",root.login.username,function(userdata){
|
||||
if (userdata[0]){groupModel.append({"groupmember":userdata[0]})}
|
||||
},"id",groupmembers[user])}
|
||||
},"groupname",group.groupname);
|
||||
groupComponent.state="large"}
|
||||
}
|
||||
|
||||
|
||||
Rectangle{
|
||||
id: detailsrectangle
|
||||
anchors.top: namelabel.bottom
|
||||
anchors.topMargin: 2*mm
|
||||
opacity: 0
|
||||
|
||||
Component { id:groupMember
|
||||
Rectangle{
|
||||
border.color: "#EEEEEE"
|
||||
border.width: 1
|
||||
width:parent.width
|
||||
height:6*mm
|
||||
Image {
|
||||
id: memberImage
|
||||
x:1
|
||||
y:1
|
||||
width: 5*mm
|
||||
height:5*mm
|
||||
source:(groupmember.isFriend==1)? "file://"+groupmember.profile_image :groupmember.profile_image_url
|
||||
onStatusChanged: if (photoImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
|
||||
}
|
||||
Text{
|
||||
font.pixelSize: 3*mm
|
||||
anchors.left: memberImage.right
|
||||
anchors.margins: 1*mm
|
||||
text:Qt.atob(groupmember.name)
|
||||
}
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked:{
|
||||
root.currentIndex=1;
|
||||
friendstab.active=true;
|
||||
root.contactdetailsSignal(groupmember)
|
||||
}
|
||||
}
|
||||
}}
|
||||
|
||||
ListView{
|
||||
id: groupListView
|
||||
x:1
|
||||
//anchors.top: parent.top
|
||||
width: root.width-10*mm
|
||||
height:groupsView.height -29*mm
|
||||
clip: true
|
||||
spacing: 2
|
||||
model: groupModel
|
||||
delegate: groupMember
|
||||
}
|
||||
|
||||
ListModel{id: groupModel}
|
||||
|
||||
BlueButton{
|
||||
id: closeButton
|
||||
anchors.top: groupListView.bottom
|
||||
anchors.topMargin: mm
|
||||
text: "\uf057"
|
||||
onClicked:{groupComponent.state=""}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "large"
|
||||
PropertyChanges { target: namelabel; font.pixelSize: 4*mm; width:groupsView.width}
|
||||
PropertyChanges { target: groupComponent; z: 2 }
|
||||
PropertyChanges { target: wrapper; width:groupsView.width;height:groupsView.height -2*mm-1}
|
||||
PropertyChanges { target: photoImage; width:15*mm;height:15*mm }
|
||||
PropertyChanges { target:groupComponent.GridView.view ;contentY:groupComponent.y;contentX:groupComponent.x;interactive:false}
|
||||
PropertyChanges { target: detailsrectangle; opacity:1 }
|
||||
}
|
||||
]
|
||||
}
|
153
source-android/qml/friendiqa.qml
Normal file
153
source-android/qml/friendiqa.qml
Normal file
|
@ -0,0 +1,153 @@
|
|||
import QtQuick 2.0
|
||||
import QtQuick.LocalStorage 2.0
|
||||
import QtQuick.Window 2.0
|
||||
import QtQuick.Controls 1.2
|
||||
import QtQuick.Controls.Styles 1.4
|
||||
import "qrc:/js/news.js" as Newsjs
|
||||
import "qrc:/js/service.js" as Service
|
||||
|
||||
|
||||
TabView{
|
||||
id:root
|
||||
property QtObject osSettings: {var tmp=Qt.createComponent("qrc:/qml/configqml/OSSettingsAndroid.qml");return tmp.createObject(root)}
|
||||
tabPosition: Qt.BottomEdge
|
||||
width: osSettings.appWidth
|
||||
height:osSettings.appHeight
|
||||
focus:true
|
||||
property var db: ["Friendiqa", "1.0", "Stores Friendica data", 100000000]
|
||||
property var login: Service.readActiveConfig(db)
|
||||
property var contactlist: []
|
||||
property real mm: Screen.pixelDensity
|
||||
signal messageSignal(var friend)
|
||||
signal fotoSignal(var friend)
|
||||
signal directmessageSignal(var friend)
|
||||
signal newsSignal(var news)
|
||||
signal friendsSignal(var username)
|
||||
signal contactdetailsSignal(var contact)
|
||||
//currentIndex: (login=="")? 3:0
|
||||
|
||||
property var news:[]
|
||||
property var newContacts:[]
|
||||
property int currentContact: 0
|
||||
property string contactLoadType: ""
|
||||
|
||||
onLoginChanged:{
|
||||
if(login==""){root.currentIndex=3}
|
||||
else{
|
||||
newstab.newstabstatus=login.newsViewType;
|
||||
Newsjs.getCurrentContacts(login,db,function(contacts){
|
||||
contactlist=contacts})}
|
||||
}
|
||||
onNewContactsChanged:{
|
||||
if(newContacts.length>0){// download first contact image and update db
|
||||
Service.updateContactInDB(login,db,newContacts[currentContact].isFriend,newContacts[currentContact])}
|
||||
else if (contactLoadType!=""){
|
||||
Service.processNews(function(){
|
||||
root.contactLoadType="";
|
||||
root.news=[];
|
||||
})}
|
||||
}
|
||||
|
||||
onCurrentContactChanged:{// download next contact image after photoplaceholder is finished saving and update db
|
||||
if(currentContact<newContacts.length){
|
||||
Service.updateContactInDB(login,db,newContacts[currentContact].isFriend,newContacts[currentContact])}
|
||||
else if (contactLoadType!=""){
|
||||
Service.processNews(function(){
|
||||
root.contactLoadType="";
|
||||
root.news=[];
|
||||
root.newContacts=[];
|
||||
root.currentContact=0;
|
||||
})}
|
||||
}
|
||||
|
||||
Connections{
|
||||
target:xhr
|
||||
onDownloaded:{if(data=="contact"){contacttimer.stop();root.currentContact=root.currentContact+1}}
|
||||
}
|
||||
|
||||
Connections{
|
||||
target:xhr
|
||||
onError:{print("Error"+data);
|
||||
if (data=="contact"){
|
||||
var database=LocalStorage.openDatabaseSync(root.db[0],root.db[1],root.db[2],root.db[3]);
|
||||
var result;
|
||||
database.transaction( function(tx) {
|
||||
//print('UPDATE contacts SET profile_image="" where username="'+root.login.username+'" AND id = '+newContacts[currentContact].id);
|
||||
result = tx.executeSql('UPDATE contacts SET profile_image="" where username="'+root.login.username+'" AND id = '+newContacts[currentContact].id);
|
||||
root.currentContact=root.currentContact+1;contacttimer.stop()})}
|
||||
}}
|
||||
|
||||
FontLoader{id: fontAwesome; source: "qrc:/images/fontawesome-webfont.ttf"}
|
||||
|
||||
Timer {id:contacttimer; interval: 5000; running: false; repeat: false
|
||||
onTriggered: {
|
||||
var database=LocalStorage.openDatabaseSync(root.db[0],root.db[1],root.db[2],root.db[3]);
|
||||
database.transaction( function(tx) {
|
||||
var result = tx.executeSql('UPDATE contacts SET profile_image="" where username="'+root.login.username+'" AND id = '+newContacts[currentContact].id);
|
||||
root.currentContact=root.currentContact+1})}
|
||||
}
|
||||
|
||||
Keys.onReleased: {
|
||||
if (event.key === osSettings.backKey) {
|
||||
if (currentIndex==0){
|
||||
newstab.active=true;
|
||||
if (newstab.newstabstatus!=login.newsViewType){
|
||||
newstab.newstabstatus=login.newsViewType;
|
||||
if(login.newsViewType=="Timeline"){Newsjs.newsfromdb(db,login.username,function(dbnews){
|
||||
newsSignal(dbnews)
|
||||
})}
|
||||
else{Newsjs.chatsfromdb(db,login.username,function(dbnews){
|
||||
newsSignal(dbnews)
|
||||
})}
|
||||
}
|
||||
else{Service.cleanNews(root.db,function(){Qt.quit()})}
|
||||
}
|
||||
else if (currentIndex==2){fotoSignal("backButton")}
|
||||
else {currentIndex=0}
|
||||
event.accepted = true
|
||||
}}
|
||||
|
||||
|
||||
style: TabViewStyle {
|
||||
frameOverlap: 1
|
||||
tab: Rectangle {
|
||||
color: styleData.selected?"sky blue":"light blue"
|
||||
border.color: "light grey"
|
||||
implicitWidth: root.width/4-2*mm
|
||||
implicitHeight: 4*mm
|
||||
Text { id: text
|
||||
anchors.centerIn: parent
|
||||
text: styleData.title
|
||||
color: "black"
|
||||
font.family: fontAwesome.name
|
||||
font.pixelSize: 3*mm
|
||||
}
|
||||
}
|
||||
frame: Rectangle { color: "light grey" }
|
||||
tabsAlignment:Qt.AlignHCenter
|
||||
}
|
||||
|
||||
Tab{
|
||||
title: "\uf03a"
|
||||
id: newstab
|
||||
property string newstabstatus
|
||||
property var conversation
|
||||
source:(root.currentIndex==0)? "qrc:/qml/newsqml/NewsTab.qml":""
|
||||
}
|
||||
Tab{
|
||||
title: "\uf0c0"
|
||||
id: friendstab
|
||||
source: (root.currentIndex==1)?"qrc:/qml/contactqml/FriendsTab.qml":""
|
||||
}
|
||||
Tab{
|
||||
title: "\uf03e"
|
||||
id: fotostab
|
||||
property string phototabstatus:"Images"
|
||||
source: (root.currentIndex==2)?"qrc:/qml/photoqml/PhotoTab.qml":""
|
||||
}
|
||||
Tab{
|
||||
title:"\uf085"
|
||||
id: configtab
|
||||
source: (root.currentIndex==3)?"qrc:/qml/configqml/ConfigTab.qml":""
|
||||
}
|
||||
}
|
41
source-android/qml/genericqml/BlueButton.qml
Normal file
41
source-android/qml/genericqml/BlueButton.qml
Normal file
|
@ -0,0 +1,41 @@
|
|||
import QtQuick 2.0
|
||||
Rectangle{
|
||||
id: blueButton
|
||||
width: Math.max(mainText.width+2*mm,8*mm)
|
||||
height: 5*mm
|
||||
color:"light blue"
|
||||
property alias fontColor: mainText.color
|
||||
border.color:"grey"
|
||||
border.width:1
|
||||
radius: mm
|
||||
property alias text: mainText.text
|
||||
signal clicked
|
||||
state:""
|
||||
|
||||
Text{
|
||||
id:mainText
|
||||
color: "black"
|
||||
anchors.centerIn: parent
|
||||
width: contentWidth
|
||||
height: contentHeight
|
||||
font.family:fontAwesome.name
|
||||
font.pixelSize: 3*mm
|
||||
text: ""
|
||||
}
|
||||
MouseArea{
|
||||
id:buttonArea
|
||||
anchors.fill:parent
|
||||
onPressed: blueButton.state="Pressed"
|
||||
onReleased: blueButton.state=""
|
||||
onClicked: {parent.clicked()}
|
||||
}
|
||||
|
||||
states: [
|
||||
State { name: "Pressed"
|
||||
PropertyChanges { target: blueButton; color: "sky blue"} }
|
||||
]
|
||||
transitions: [
|
||||
Transition { to:"*"
|
||||
ColorAnimation { target: blueButton; duration: 100} }
|
||||
]
|
||||
}
|
8
source-android/qml/genericqml/OSSettingsAndroid.qml
Normal file
8
source-android/qml/genericqml/OSSettingsAndroid.qml
Normal file
|
@ -0,0 +1,8 @@
|
|||
import QtQuick 2.0
|
||||
import QtQuick.Window 2.0
|
||||
QtObject{
|
||||
property int appWidth: Screen.desktopAvailableWidth
|
||||
property int appHeight: Screen.desktopAvailableHeight
|
||||
property int backKey: Qt.Key_Back
|
||||
property string attachImageDir:filesystem.cameraPath+"/"
|
||||
}
|
7
source-android/qml/genericqml/OSSettingsLinux.qml
Normal file
7
source-android/qml/genericqml/OSSettingsLinux.qml
Normal file
|
@ -0,0 +1,7 @@
|
|||
import QtQuick 2.0
|
||||
QtObject{
|
||||
property real appWidth: 500
|
||||
property real appHeight: 500
|
||||
property int backKey: Qt.Key_Escape
|
||||
property string attachImageDir:filesystem.homePath+"/Pictures/"
|
||||
}
|
74
source-android/qml/newsqml/AttachmentDialog.qml
Normal file
74
source-android/qml/newsqml/AttachmentDialog.qml
Normal file
|
@ -0,0 +1,74 @@
|
|||
import QtQuick 2.0
|
||||
import Qt.labs.folderlistmodel 2.1
|
||||
import "qrc:/js/service.js" as Service
|
||||
import "qrc:/js/helper.js" as Helperjs
|
||||
import "qrc:/qml/genericqml"
|
||||
|
||||
Rectangle{
|
||||
id:attachmentDialog
|
||||
z:2
|
||||
border.color: "grey"
|
||||
width: parent.width-4*mm
|
||||
height:parent.height-12*mm
|
||||
x:2*mm
|
||||
y:10*mm
|
||||
property var parsedAttachments: JSON.parse(attachedobjects)
|
||||
|
||||
Text{
|
||||
x:0.5*mm
|
||||
y:0.5*mm
|
||||
width: imageDialog-8*mm
|
||||
elide:Text.ElideRight
|
||||
text: "Attachments:"
|
||||
}
|
||||
BlueButton{
|
||||
id:closeButton
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 1*mm
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 1*mm
|
||||
text: "\uf057"
|
||||
onClicked:{attachmentDialog.destroy()}
|
||||
}
|
||||
ListView {
|
||||
id: attachmentView
|
||||
x:0.5*mm
|
||||
y:5.5*mm
|
||||
width: attachmentDialog.width-2*mm
|
||||
height: attachmentDialog.height-14*mm
|
||||
clip: true
|
||||
spacing:0
|
||||
model: attachmentModel
|
||||
delegate: attachmentItem
|
||||
}
|
||||
|
||||
ListModel{id: attachmentModel}
|
||||
|
||||
Component { id:attachmentItem
|
||||
Rectangle{
|
||||
border.color: "#EEEEEE"
|
||||
border.width: 1
|
||||
width:parent.width
|
||||
height:6*mm
|
||||
|
||||
Text{
|
||||
font.pixelSize: 3*mm
|
||||
x: mm
|
||||
text:attachment.name
|
||||
}
|
||||
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked:{
|
||||
Qt.openUrlExternally(attachment.url)
|
||||
}
|
||||
}
|
||||
}}
|
||||
|
||||
}
|
||||
Component.onCompleted: {
|
||||
for (var a in parsedAttachments){
|
||||
attachmentModel.append({"attachment":parsedAttachments[a]})
|
||||
}
|
||||
}
|
||||
}
|
52
source-android/qml/newsqml/Conversation.qml
Normal file
52
source-android/qml/newsqml/Conversation.qml
Normal file
|
@ -0,0 +1,52 @@
|
|||
// ConversationStack with buttons
|
||||
import QtQuick 2.0
|
||||
import "qrc:/js/helper.js" as Helperjs
|
||||
import "qrc:/qml/genericqml"
|
||||
|
||||
Rectangle {
|
||||
id:conversationStack
|
||||
property var news
|
||||
y:1
|
||||
color: "white"
|
||||
width:root.width-2*mm
|
||||
height:root.height-8*mm
|
||||
|
||||
ListView {
|
||||
id: conversationView
|
||||
x:3*mm
|
||||
y:8*mm
|
||||
width: conversationStack.width-4*mm
|
||||
height: conversationStack.height-10*mm
|
||||
clip: true
|
||||
spacing: 0
|
||||
model: conversationModel
|
||||
delegate: Newsitem{}
|
||||
}
|
||||
|
||||
ListModel{id: conversationModel}
|
||||
|
||||
WorkerScript {
|
||||
id: conversationWorker
|
||||
source: "qrc:/js/newsworker.js"
|
||||
}
|
||||
|
||||
BlueButton {
|
||||
id: closeButton
|
||||
width:10*mm
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 1*mm
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 1*mm
|
||||
text: "\uf057"// qsTr("Close")
|
||||
onClicked: {
|
||||
newstab.newstabstatus=login.newsViewType;
|
||||
newsStack.pop()
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
var currentTime= new Date();
|
||||
var msg = {'currentTime': currentTime, 'model': conversationModel,'news':news};
|
||||
conversationWorker.sendMessage(msg)
|
||||
}
|
||||
}
|
81
source-android/qml/newsqml/FriendicaActivities.qml
Normal file
81
source-android/qml/newsqml/FriendicaActivities.qml
Normal file
|
@ -0,0 +1,81 @@
|
|||
// List if people from Friendica Activities
|
||||
import QtQuick 2.0
|
||||
import "qrc:/js/helper.js" as Helperjs
|
||||
import "qrc:/qml/genericqml"
|
||||
|
||||
Rectangle {
|
||||
id:activitiesRectangle
|
||||
property var activitymembers
|
||||
color: "white"
|
||||
border.color: "light grey"
|
||||
radius:0.5*mm
|
||||
width:root.width/2
|
||||
height:Math.min(root.height/2,(10*mm+6*activitymembers.length*mm))
|
||||
|
||||
ListView {
|
||||
id: contactView
|
||||
x:mm
|
||||
y:8*mm
|
||||
width: activitiesRectangle.width-2*mm
|
||||
height: activitiesRectangle.height-10*mm
|
||||
clip: true
|
||||
spacing: 0
|
||||
model: activitiesModel
|
||||
delegate: activitiesContact
|
||||
}
|
||||
|
||||
ListModel{id: activitiesModel}
|
||||
|
||||
Component { id:activitiesContact
|
||||
Rectangle{
|
||||
border.color: "#EEEEEE"
|
||||
border.width: 1
|
||||
radius:0.5*mm
|
||||
width:parent.width
|
||||
height:6*mm
|
||||
Image {
|
||||
id: contactImage
|
||||
x:1
|
||||
y:1
|
||||
width: 5*mm
|
||||
height:5*mm
|
||||
source:(contact.profile_image!="")? "file://"+contact.profile_image : contact.profile_image_url
|
||||
onStatusChanged: if (contactImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
|
||||
}
|
||||
Text{
|
||||
font.pixelSize: 3*mm
|
||||
anchors.left: contactImage.right
|
||||
anchors.margins: 1*mm
|
||||
text:Qt.atob(contact.name)
|
||||
}
|
||||
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked:{
|
||||
try {root.currentIndex=1;
|
||||
friendstab.active=true;
|
||||
root.contactdetailsSignal(contact)
|
||||
} catch(e) {Helperjs.showMessage("Error",e,root)}}
|
||||
}
|
||||
}}
|
||||
|
||||
BlueButton {
|
||||
id: closeButton
|
||||
//width:10*mm
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 1*mm
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 1*mm
|
||||
color:"white"
|
||||
text: "\uf057"// qsTr("Close")
|
||||
onClicked: {
|
||||
activitiesRectangle.destroy()
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
for (var user in activitymembers){
|
||||
activitiesModel.append({"contact":activitymembers[user]})
|
||||
}
|
||||
}
|
||||
}
|
121
source-android/qml/newsqml/ImageDialog.qml
Normal file
121
source-android/qml/newsqml/ImageDialog.qml
Normal file
|
@ -0,0 +1,121 @@
|
|||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.2
|
||||
import Qt.labs.folderlistmodel 2.1
|
||||
import "qrc:/js/service.js" as Service
|
||||
import "qrc:/js/helper.js" as Helperjs
|
||||
import "qrc:/qml/genericqml"
|
||||
|
||||
Rectangle{
|
||||
id:imageDialog
|
||||
z:2
|
||||
border.color: "grey"
|
||||
width: parent.width-4*mm
|
||||
height:parent.height-12*mm
|
||||
x:2*mm
|
||||
y:10*mm
|
||||
property string directory: ""
|
||||
|
||||
Text{
|
||||
id:directoryText
|
||||
x:0.5*mm
|
||||
y:0.5*mm
|
||||
width: imageDialog.width-15*mm
|
||||
height:contentHeight
|
||||
wrapMode: Text.Wrap
|
||||
text: directory
|
||||
}
|
||||
BlueButton{
|
||||
id:closeButton
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 1*mm
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 1*mm
|
||||
text: "\uf057"
|
||||
onClicked:{imageDialog.destroy()}
|
||||
}
|
||||
ListView {
|
||||
id: imageView
|
||||
x:0.5*mm
|
||||
y:directoryText.height+mm
|
||||
width: imageDialog.width-2*mm
|
||||
height: imageDialog.height-directoryText.height-4*mm
|
||||
clip: true
|
||||
model: imageModel
|
||||
delegate: imageItem
|
||||
|
||||
}
|
||||
|
||||
FolderListModel{
|
||||
id: imageModel
|
||||
nameFilters: ["*.png", "*.jpg",".jpeg","*.JPG"]
|
||||
sortField: FolderListModel.Time
|
||||
sortReversed:false
|
||||
showDotAndDotDot: true
|
||||
showDirs: true
|
||||
showDirsFirst: true
|
||||
folder:directory
|
||||
}
|
||||
|
||||
BusyIndicator{
|
||||
id: imageBusy
|
||||
anchors.horizontalCenter: imageView.horizontalCenter
|
||||
anchors.top:imageView.top
|
||||
anchors.topMargin: 2*mm
|
||||
width:10*mm
|
||||
height: 10*mm
|
||||
running:false
|
||||
}
|
||||
|
||||
|
||||
Component{
|
||||
id:imageItem
|
||||
Item{
|
||||
width:imageView.width
|
||||
height:folderImage.height+2*mm
|
||||
Rectangle{
|
||||
id:imagetextRectangle
|
||||
color:"black"
|
||||
x:mm
|
||||
z:3
|
||||
opacity: fileIsDir?0:0.5
|
||||
width:imagetext.contentWidth
|
||||
height: imagetext.contentHeight
|
||||
anchors.bottom: folderImage.bottom
|
||||
}
|
||||
Text {
|
||||
id:imagetext
|
||||
x:fileIsDir?11*mm:mm
|
||||
z:4
|
||||
text: fileName
|
||||
width: fileIsDir?parent.width - 12*mm :imageView.width-mm
|
||||
anchors.bottom: folderImage.bottom
|
||||
color: fileIsDir?"black":"white"
|
||||
font.pixelSize: 3*mm
|
||||
wrapMode:Text.Wrap
|
||||
}
|
||||
Image{id:folderImage
|
||||
width: fileIsDir?10*mm: imageView.width-mm
|
||||
fillMode:Image.PreserveAspectFit
|
||||
source:fileIsDir?"qrc:/images/folder-blue.png":fileURL
|
||||
}
|
||||
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked:{
|
||||
if (fileName==".."){
|
||||
imageModel.folder=imageModel.parentFolder;
|
||||
directory=imageModel.parentFolder
|
||||
}
|
||||
else if (fileIsDir){
|
||||
imageModel.folder=fileURL;
|
||||
directory=fileURL
|
||||
}
|
||||
else{
|
||||
attachImageURL=fileURL;
|
||||
imageDialog.destroy()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
199
source-android/qml/newsqml/MessageSend.qml
Normal file
199
source-android/qml/newsqml/MessageSend.qml
Normal file
|
@ -0,0 +1,199 @@
|
|||
// message.qml
|
||||
// message with buttons
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.3
|
||||
import QtQuick.Dialogs 1.2
|
||||
import "qrc:/js/helper.js" as Helperjs
|
||||
import "qrc:/js/smiley.js" as Smileyjs
|
||||
import "qrc:/qml/genericqml"
|
||||
|
||||
|
||||
Flickable{
|
||||
width:root.width-5*mm
|
||||
height:root.height-12*mm
|
||||
contentHeight: messageColumn.height
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
id:messageSend
|
||||
property string parentId: ""
|
||||
property string reply_to_user:""
|
||||
property string attachImageURL: "";
|
||||
property int directmessage: 0;
|
||||
property var contacts: []
|
||||
property var groups: []
|
||||
property var contact_allow:login.permissions[0]
|
||||
property var contact_deny:login.permissions[1]
|
||||
property var group_allow:login.permissions[2]
|
||||
property var group_deny:login.permissions[3]
|
||||
|
||||
onAttachImageURLChanged: {if(attachImageURL!=""){
|
||||
var imageAttachmentObject=Qt.createQmlObject('import QtQuick 2.0; Image {id:imageAttachment; source:"'+
|
||||
attachImageURL.toString()+'"; width: 15*mm; height: 15*mm;fillMode: Image.PreserveAspectFit;MouseArea{anchors.fill:parent;onClicked:{attachImageURL="";imageAttachment.destroy()}}}',messageColumn,"attachedImage");
|
||||
console.log("You chose: " + attachImageURL)
|
||||
}}
|
||||
function statusUpdate(title,status,in_reply_to_status_id,attachImageURL) {
|
||||
xhr.url= login.server + "/api/statuses/update.json";
|
||||
xhr.setLogin(login.username+":"+Qt.atob(login.password));
|
||||
xhr.clearParams();
|
||||
xhr.setParam("source", "Friendiqa");
|
||||
xhr.setParam("status", status);
|
||||
if (parentId!="") {xhr.setParam("in_reply_to_status_id", parentId)};
|
||||
if (title!=="") {xhr.setParam("title", title)};
|
||||
if (group_allow.length>0) {xhr.setParam("group_allow", Helperjs.cleanArray(group_allow))};
|
||||
if (group_deny.length>0) {xhr.setParam("group_deny", Helperjs.cleanArray(group_deny))};
|
||||
if (contact_allow.length>0) {xhr.setParam("contact_allow", Helperjs.cleanArray(contact_allow))};
|
||||
if (contact_deny.length>0) {xhr.setParam("contact_deny", Helperjs.cleanArray(contact_deny))};
|
||||
if (attachImageURL!=="") {xhr.setImageFileParam("media", attachImageURL )};
|
||||
xhr.post();
|
||||
}
|
||||
|
||||
function dmUpdate(title,text,replyto,screen_name,attachImageURL) {
|
||||
xhr.url= login.server + "/api/direct_messages/new.json";
|
||||
xhr.setLogin(login.username+":"+Qt.atob(login.password));
|
||||
xhr.clearParams();
|
||||
xhr.setParam("text", text);
|
||||
xhr.setParam("screen_name", screen_name);
|
||||
if (parentId!="") {xhr.setParam("replyto", replyto)};
|
||||
if (title!=="") {xhr.setParam("title", title)};
|
||||
xhr.post();
|
||||
}
|
||||
|
||||
Column {
|
||||
id:messageColumn
|
||||
spacing: 2
|
||||
width: parent.width
|
||||
TextField {
|
||||
id: titleField
|
||||
width: parent.width
|
||||
placeholderText: qsTr("Title (optional)")
|
||||
visible: messageSend.parentId === ""
|
||||
}
|
||||
|
||||
TextArea {
|
||||
id: bodyField
|
||||
width: parent.width
|
||||
height: 30*mm
|
||||
wrapMode: TextEdit.Wrap
|
||||
textFormat: TextEdit.PlainText
|
||||
}
|
||||
|
||||
Row{
|
||||
spacing: 2
|
||||
CheckBox{
|
||||
id:dmCheckbox
|
||||
text:"DM"
|
||||
enabled: false
|
||||
checked: (directmessage==1)?true:false
|
||||
onClicked:{
|
||||
if(dmCheckbox.checkedState==Qt.Checked){directmessage=1}
|
||||
else if(dmCheckbox.checkedState==Qt.Unchecked){directmessage=0}
|
||||
}
|
||||
}
|
||||
|
||||
BlueButton{
|
||||
text:"\uf0c1"
|
||||
onClicked: {
|
||||
if(bodyField.selectedText==""){Helperjs.showMessage("Error","No text selected",messageSend)}
|
||||
else{urlTextEdit.text="";
|
||||
urlRectangle.visible=true}}
|
||||
}
|
||||
Rectangle{
|
||||
id:urlRectangle
|
||||
height:parent.height
|
||||
width:37*mm
|
||||
visible:false
|
||||
TextField{
|
||||
id:urlTextEdit
|
||||
width:30*mm
|
||||
height:parent.height
|
||||
}
|
||||
BlueButton{
|
||||
anchors.left:urlTextEdit.right
|
||||
anchors.leftMargin:mm
|
||||
text:"\u2713"
|
||||
onClicked: {if(urlTextEdit.text!=""){
|
||||
var start = bodyField.selectionStart;
|
||||
var end = bodyField.selectionEnd;
|
||||
var text = bodyField.getText(start,end);
|
||||
text = "[url="+urlTextEdit.text+"]" + text + "[/url]";
|
||||
bodyField.remove(start,end);
|
||||
bodyField.insert(start,text);}
|
||||
urlRectangle.visible=false}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Row{
|
||||
spacing:2
|
||||
BlueButton{id:permButton
|
||||
visible: (directmessage==1)?false:true
|
||||
text: ((contact_allow.length==0)&&(contact_deny.length==0)&&(group_allow.length==0)&&(group_deny.length==0))?"\uf09c":"\uf023"//qsTr("Permissions")
|
||||
onClicked: {
|
||||
var component = Qt.createComponent("qrc:/qml/newsqml/PermissionDialog.qml");
|
||||
var permissions = component.createObject(messageColumn);
|
||||
}}
|
||||
BlueButton {
|
||||
id: attachButton
|
||||
text: "\uf0c6"
|
||||
visible:(directmessage==0)
|
||||
onClicked: {
|
||||
if (attachImageURL!=""){
|
||||
Helperjs.showMessage( qsTr("Error"),qsTr("Only one attachment. Remove other attachment first!"), messageColumn)}
|
||||
else{print(filesystem.homePath);
|
||||
var defaultDirectory="file://"+osSettings.attachImageDir;//"file:///storage/emif.open()
|
||||
print(defaultDirectory);
|
||||
var component = Qt.createComponent("qrc:/qml/newsqml/ImageDialog.qml");
|
||||
var imagedialog = component.createObject(messageSend,{"directory": defaultDirectory});
|
||||
}
|
||||
}
|
||||
}
|
||||
BlueButton{
|
||||
id:contactButton
|
||||
text:"\uf234"
|
||||
visible:(directmessage==0)
|
||||
onClicked:{
|
||||
var contactitems="";
|
||||
for (var i=0;i<contacts.length;i++){
|
||||
if(contacts[i].network=="dfrn"){
|
||||
if(Helperjs.getCount(db,login,"contacts","screen_name",contacts[i].screen_name)>1){
|
||||
contacts[i].screen_name=contacts[i].screen_name+"+"+contacts[i].cid
|
||||
}
|
||||
contactitems=contactitems+"MenuItem{text:'"+contacts[i].screen_name+"';iconSource:'"+contacts[i].profile_image+"'; onTriggered: bodyField.insert(0,' @"+contacts[i].screen_name+"+"+contacts[i].cid+" ')}"
|
||||
}}
|
||||
var menuString="import QtQuick.Controls 1.4; Menu {"+contactitems+"}";
|
||||
var contactlistObject=Qt.createQmlObject(menuString,messageSend,"contactmenuOutput")
|
||||
contactlistObject.popup() }
|
||||
}
|
||||
|
||||
BlueButton{
|
||||
id:smileyButton
|
||||
text: "\uf118"
|
||||
onClicked: {
|
||||
var smileyarray=Smileyjs.smileys
|
||||
//print(JSON.stringify(smileyarray[0]))
|
||||
var component = Qt.createComponent("qrc:/qml/newsqml/SmileyDialog.qml");
|
||||
var smileydialog = component.createObject(messageColumn)
|
||||
}}
|
||||
|
||||
BlueButton {
|
||||
id: cancelButton
|
||||
text: "\uf057"
|
||||
onClicked: {newstab.newstabstatus=login.newsViewType;
|
||||
newsStack.pop()}
|
||||
}
|
||||
BlueButton {
|
||||
id: sendButton
|
||||
text: "\uf1d9"
|
||||
onClicked: {
|
||||
var title=titleField.text.replace("\"","\'");
|
||||
var body=bodyField.getText(0,bodyField.length);
|
||||
if (directmessage==0){
|
||||
statusUpdate(title,body,messageSend.parentId,attachImageURL.toString())}
|
||||
else {dmUpdate(title,body,"",messageSend.reply_to_user) }
|
||||
newstab.newstabstatus=login.newsViewType; newsStack.pop()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
362
source-android/qml/newsqml/NewsTab.qml
Normal file
362
source-android/qml/newsqml/NewsTab.qml
Normal file
|
@ -0,0 +1,362 @@
|
|||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.2
|
||||
import "qrc:/qml/genericqml"
|
||||
import "qrc:/js/news.js" as Newsjs
|
||||
import "qrc:/js/helper.js" as Helperjs
|
||||
import "qrc:/js/service.js" as Service
|
||||
|
||||
Item {
|
||||
Connections{
|
||||
target:newstab
|
||||
onNewstabstatusChanged:{
|
||||
newstabstatusButton.text= qsTr(newstab.newstabstatus)
|
||||
}
|
||||
}
|
||||
|
||||
Connections{
|
||||
target:newstab
|
||||
onConversationChanged:{
|
||||
newsBusy.running=false;
|
||||
newstab.newstabstatus="Conversation";
|
||||
//newsStack.push({item:"qrc:/qml/newsqml/Conversation.qml",properties:{"news": conversation}})
|
||||
showNews(conversation);
|
||||
}
|
||||
}
|
||||
|
||||
Connections{
|
||||
target:root
|
||||
onCurrentContactChanged:{
|
||||
if (root.newContacts.length>0){
|
||||
if(root.currentContact<root.newContacts.length){
|
||||
downloadNotice.text= qsTr("Download profile image for ")+ root.newContacts[root.currentContact].name;
|
||||
print(root.newContacts[root.currentContact].name)
|
||||
}
|
||||
}else{downloadNotice.text=""}
|
||||
}
|
||||
}
|
||||
|
||||
Connections{
|
||||
target:xhr
|
||||
onError:{if (data=="contact"){downloadNotice.text=root.newContacts[root.currentContact].name+"... Error!"}}
|
||||
onSuccess:{replytimer.start() //wait 1 second to load new timeline
|
||||
}
|
||||
}
|
||||
|
||||
Timer {id:replytimer; interval: 1000; running: false; repeat: false
|
||||
onTriggered: {if(newstab.newstabstatus=="Conversation"){
|
||||
showConversation(newsStack.timelineIndex-1,newsModel.get(0).newsitemobject)} else{
|
||||
var onlynew=true;
|
||||
Newsjs.getFriendsTimeline(login,db,contactlist,onlynew,newstab,function(rns,rnc){
|
||||
root.contactLoadType="news";
|
||||
root.news=rns;root.newContacts=rnc;root.currentContact=0})
|
||||
}}
|
||||
}
|
||||
|
||||
|
||||
function showNews(newsToShow){
|
||||
try{if (newsStack.depth>1){newsStack.pop()}}catch(e){}
|
||||
newsBusy.running=false;
|
||||
var currentTime= new Date();
|
||||
downloadNotice.text="";
|
||||
var msg = {'currentTime': currentTime, 'model': newsModel,'news':newsToShow};
|
||||
newsWorker.sendMessage(msg);
|
||||
}
|
||||
|
||||
function showConversation(timelineIndex,newsitemobject){
|
||||
|
||||
newsBusy.running=true;
|
||||
root.contactLoadType="conversation";
|
||||
newsStack.timelineIndex= timelineIndex;
|
||||
if(newsitemobject.messagetype==0){
|
||||
Newsjs.requestConversation(root.login,db,newsitemobject.status_id,root.contactlist,root,function(ns,nc){
|
||||
root.news=ns;root.newContacts=nc;root.currentContact=0;
|
||||
})}
|
||||
else{Newsjs.conversationfromdb(root.db,root.login.username,newsitemobject.statusnet_conversation_id, function(newsarray){
|
||||
root.news=newsarray;root.newContacts=[];root.currentContact=1;
|
||||
})}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function onFriendsMessages(friend){
|
||||
newstab.newstabstatus="Contact"
|
||||
Newsjs.newsfromdb(db,root.login.username, function(dbnews){showNews(dbnews)},friend)
|
||||
}
|
||||
|
||||
function onDirectMessage(friend){
|
||||
newstab.newstabstatus="SendMessage"
|
||||
newsStack.push({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{"reply_to_user": friend,"directmessage":1,"login":root.login}});
|
||||
}
|
||||
|
||||
StackView{
|
||||
id: newsStack
|
||||
anchors.fill:parent
|
||||
property int timelineIndex: 0
|
||||
onTimelineIndexChanged:print("timelineindex:"+ timelineIndex)
|
||||
|
||||
initialItem:Rectangle {
|
||||
y:1
|
||||
color: "white"
|
||||
width:root.width-2*mm
|
||||
height:root.height-8*mm
|
||||
|
||||
BlueButton{
|
||||
id:newstabstatusButton
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 0.5*mm
|
||||
text: qsTr(newstab.newstabstatus)
|
||||
onClicked: {newstabmenu.popup()}
|
||||
}
|
||||
|
||||
Row{
|
||||
spacing: mm
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 0.5*mm
|
||||
anchors.right: parent.right
|
||||
|
||||
BlueButton {
|
||||
id: newMessageButton
|
||||
width:10*mm
|
||||
text: "\uf040"
|
||||
onClicked: {
|
||||
var groups=[];
|
||||
Helperjs.readData(root.db,"groups",root.login.username,function(groupobject){
|
||||
groups=groupobject});
|
||||
newstab.newstabstatus="SendMessage";
|
||||
Helperjs.readData(root.db,"contacts",root.login.username,function(friends){
|
||||
newsStack.push({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{"contacts": friends,"login":root.login}})
|
||||
},"isFriend",1);
|
||||
}
|
||||
}
|
||||
BlueButton {
|
||||
id: quitButton
|
||||
width:10*mm
|
||||
text: "\uf08b"
|
||||
onClicked: {Service.cleanNews(root.db,function(){Qt.quit() })}
|
||||
}
|
||||
BlueButton {
|
||||
id: update
|
||||
text: "\uf021"
|
||||
onClicked: {
|
||||
newsBusy.running=true;
|
||||
newstab.newstabstatus=login.newsViewType;
|
||||
root.contactLoadType="news";
|
||||
var onlynew=true;
|
||||
Newsjs.getFriendsTimeline(login,db,contactlist,onlynew,newstab,function(ns,nc){
|
||||
root.news=ns;root.newContacts=nc;root.currentContact=0;
|
||||
if (ns.length==0){// update last 20 existing news for changes and likes
|
||||
onlynew=false;
|
||||
Newsjs.getFriendsTimeline(login,db,contactlist,onlynew,newstab,function(rns,rnc){
|
||||
root.contactLoadType="news";
|
||||
root.news=rns;root.newContacts=rnc;root.currentContact=0})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Component { id:footerComponent
|
||||
Rectangle{
|
||||
border.color: "#EEEEEE"
|
||||
border.width: 1
|
||||
width:newsView.width
|
||||
height:6*mm
|
||||
Text{
|
||||
font.pixelSize: 1.5*mm
|
||||
anchors.centerIn: parent
|
||||
text:qsTr("More")
|
||||
}
|
||||
MouseArea{anchors.fill:parent
|
||||
onClicked:{
|
||||
var currentTime= new Date();
|
||||
if(newstab.newstabstatus=="Timeline"){
|
||||
var lastnews_id=newsModel.get(newsModel.count-1).newsitemobject.created_at;
|
||||
Newsjs.newsfromdb(root.db,root.login.username, function(news){
|
||||
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true};
|
||||
newsWorker.sendMessage(msg);
|
||||
},false,lastnews_id)}
|
||||
if(newstab.newstabstatus=="Tree"){
|
||||
var lastnews_id=newsModel.get(newsModel.count-1).newsitemobject.created_at;
|
||||
Newsjs.chatsfromdb(root.db,root.login.username, function(news){
|
||||
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true};
|
||||
newsWorker.sendMessage(msg);
|
||||
},lastnews_id)}
|
||||
else if(newstab.newstabstatus=="Contact"){
|
||||
Newsjs.newsfromdb(root.db,root.login.username, function(news){
|
||||
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true};
|
||||
newsWorker.sendMessage(msg);
|
||||
},newsModel.get(newsModel.count-1).newsitemobject.uid,newsModel.get(newsModel.count-1).newsitemobject.created_at)}
|
||||
}}
|
||||
}
|
||||
}
|
||||
|
||||
Component { id:footerReply
|
||||
Rectangle{
|
||||
border.color: "#EEEEEE"
|
||||
border.width: 1
|
||||
color:"lightgrey"
|
||||
width:newsView.width
|
||||
height:Math.max(replyText.contentHeight+2*mm,6*mm)
|
||||
Rectangle{
|
||||
color: "white"
|
||||
radius:0.5*mm
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin:mm
|
||||
anchors.top:parent.top
|
||||
anchors.topMargin: 0.5*mm
|
||||
width:parent.width-12*mm
|
||||
height:Math.max( replyText.contentHeight,5*mm)
|
||||
|
||||
TextInput {
|
||||
id: replyText
|
||||
font.pixelSize: 3*mm
|
||||
wrapMode: Text.Wrap
|
||||
//width: parent.width
|
||||
anchors.fill: parent
|
||||
selectByMouse: true
|
||||
}
|
||||
}
|
||||
|
||||
BlueButton {
|
||||
id: sendButton
|
||||
text: "\uf1d9"
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin:mm
|
||||
anchors.top:parent.top
|
||||
anchors.topMargin: 0.5*mm
|
||||
color:"white"
|
||||
onClicked: { try{
|
||||
var body=replyText.getText(0,replyText.length);
|
||||
newsBusy.running=true;
|
||||
replyText.text=""
|
||||
xhr.clearParams();
|
||||
xhr.setLogin(login.username+":"+Qt.atob(login.password));
|
||||
if (newsModel.get(0).newsitemobject.messagetype==0){
|
||||
xhr.setParam("source", "Friendiqa");
|
||||
xhr.url= login.server + "/api/statuses/update.json";
|
||||
xhr.setParam("status", body);
|
||||
xhr.setParam("in_reply_to_status_id", newsModel.get(newsModel.count-1).newsitemobject.status_id)}
|
||||
else {xhr.url= login.server + "/api/direct_messages/new.json";
|
||||
xhr.setParam("text", body);
|
||||
xhr.setParam("screen_name",newsModel.get(newsModel.count-1).newsitemobject.screen_name);
|
||||
xhr.setParam("replyto", newsModel.get(newsModel.count-1).newsitemobject.status_id)
|
||||
}
|
||||
xhr.post();
|
||||
//replyText.text=""
|
||||
} catch(e){Helperjs.showMessage("Error",e.toString(),root)}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ListView {
|
||||
id: newsView
|
||||
anchors.fill: parent
|
||||
anchors.topMargin: 8*root.mm
|
||||
anchors.leftMargin: 3*root.mm; anchors.rightMargin: root.mm
|
||||
anchors.bottomMargin: 1*root.mm
|
||||
clip: true
|
||||
spacing: 0
|
||||
footer: (newstab.newstabstatus=="Conversation")?footerReply:footerComponent
|
||||
model: newsModel
|
||||
delegate: Newsitem{}
|
||||
Component.onCompleted: {//print(newstab.newstabstatus);
|
||||
if(newstab.newstabstatus!="Conversation"){
|
||||
positionViewAtIndex(newsStack.timelineIndex-1, ListView.Beginning)}
|
||||
else {positionViewAtBeginning();
|
||||
newsStack.timelineIndex=0
|
||||
}}
|
||||
}
|
||||
|
||||
ListModel{id: newsModel}
|
||||
|
||||
WorkerScript {
|
||||
id: newsWorker
|
||||
source: "qrc:/js/newsworker.js"
|
||||
}
|
||||
|
||||
BusyIndicator{
|
||||
id: newsBusy
|
||||
anchors.horizontalCenter: newsView.horizontalCenter
|
||||
anchors.top:newsView.top
|
||||
anchors.topMargin: 2*mm
|
||||
width:10*mm
|
||||
height: 10*mm
|
||||
}
|
||||
Rectangle{
|
||||
id:downloadNotice
|
||||
property alias text: noticeText.text
|
||||
color:"white"
|
||||
border.color:"grey"
|
||||
z:1
|
||||
anchors.horizontalCenter: newsView.horizontalCenter
|
||||
anchors.bottom:newsView.bottom
|
||||
anchors.bottomMargin: 2*mm
|
||||
width: noticeText.width+2*mm
|
||||
height: noticeText.height+2*mm
|
||||
visible: (downloadNotice.text!="")
|
||||
|
||||
Text{
|
||||
id:noticeText
|
||||
color: "grey"
|
||||
anchors.centerIn: parent
|
||||
width: contentWidth
|
||||
height: contentHeight
|
||||
font.pixelSize: 2*mm
|
||||
text:""
|
||||
}
|
||||
}
|
||||
Menu {
|
||||
id:newstabmenu
|
||||
MenuItem {
|
||||
text: qsTr("Timeline")
|
||||
onTriggered: {
|
||||
newstab.newstabstatus="Timeline";
|
||||
newsModel.clear();
|
||||
try{ Newsjs.newsfromdb(root.db,root.login.username, function(dbnews){
|
||||
showNews(dbnews)
|
||||
})}catch(e){Helperjs.showMessage("Error",e,root)}}
|
||||
}
|
||||
MenuItem {
|
||||
text: qsTr("Favorites")
|
||||
onTriggered:{
|
||||
newstab.newstabstatus="Favorites";
|
||||
root.contactLoadType="favorites";
|
||||
newsBusy.running=true;
|
||||
Newsjs.requestFavorites(root.login,db,root.contactlist,root,function(ns,nc){
|
||||
root.news=ns; root.newContacts=nc;root.currentContact=0;
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
text: qsTr("Tree")
|
||||
onTriggered:{
|
||||
newsModel.clear();
|
||||
newstab.newstabstatus="Tree";
|
||||
Newsjs.chatsfromdb(db,root.login.username,function(news){showNews(news)})
|
||||
}
|
||||
}
|
||||
MenuItem {
|
||||
text: qsTr("Notifications")
|
||||
onTriggered:{
|
||||
newstab.newstabstatus="Notifications";
|
||||
newsBusy.running=true;
|
||||
Newsjs.getNotifications(root.login,db,root,function(news){
|
||||
showNews(news)}
|
||||
)}
|
||||
}
|
||||
}
|
||||
Component.onCompleted: {
|
||||
root.messageSignal.connect(onFriendsMessages);
|
||||
root.directmessageSignal.connect(onDirectMessage);
|
||||
root.newsSignal.connect(showNews);
|
||||
try{newsModel.clear()} catch(e){}
|
||||
newstab.newstabstatus=login.newsViewType;
|
||||
if(login.newsViewType=="Timeline"){Newsjs.newsfromdb(db,login.username,function(dbnews){showNews(dbnews)})}
|
||||
else{Newsjs.chatsfromdb(db,login.username,function(dbnews){showNews(dbnews)})}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
355
source-android/qml/newsqml/Newsitem.qml
Normal file
355
source-android/qml/newsqml/Newsitem.qml
Normal file
|
@ -0,0 +1,355 @@
|
|||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.4
|
||||
import QtQuick.Controls.Styles 1.4
|
||||
import "qrc:/js/news.js" as Newsjs
|
||||
import "qrc:/js/helper.js" as Helperjs
|
||||
|
||||
|
||||
Item {
|
||||
id: newsitem
|
||||
width: newsView.width
|
||||
height:Math.max((itemMessage.height+topFlow.height+friendicaActivities.height+4*mm),profileImage.height+user_name.height+mm)
|
||||
|
||||
property string attending: ""
|
||||
onAttendingChanged: {attendLabel.visible=true;
|
||||
attendLabel.text= qsTr("attending: ")+ qsTr(attending)}
|
||||
|
||||
signal replyto(string parent_id)
|
||||
|
||||
function showActivityContacts(contacts){
|
||||
var component = Qt.createComponent("qrc:/qml/newsqml/FriendicaActivities.qml");
|
||||
var imagedialog = component.createObject(friendicaActivities,{"activitymembers": contacts});
|
||||
|
||||
}
|
||||
|
||||
Rectangle{width:newsitem.width; height: 1; anchors.bottom: newsitem.bottom; color:"light grey"}
|
||||
|
||||
Rectangle{
|
||||
width:newsitem.width
|
||||
height:newsitem.height-1
|
||||
color: (newsitemobject.messagetype==1)?"#ffe6e6" : "white"
|
||||
|
||||
Column {
|
||||
id: authorcolumn
|
||||
width: 8*mm
|
||||
|
||||
Image {
|
||||
id:profileImage
|
||||
source: (newsitemobject.user.profile_image!="")? "file://"+newsitemobject.user.profile_image : newsitemobject.user.profile_image_url
|
||||
x:1
|
||||
width: 7*mm
|
||||
height: 7*mm
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked:{print(root.currentIndex);
|
||||
try{root.currentIndex=1;
|
||||
friendstab.active=true;
|
||||
root.contactdetailsSignal(newsitemobject.user)} catch (e){Helperjs.showMessage("Error",e,root)}
|
||||
}
|
||||
}
|
||||
onStatusChanged: if (profileImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
|
||||
}
|
||||
Label {
|
||||
id:user_name
|
||||
color: "grey"
|
||||
width:parent.width
|
||||
font.pixelSize: 1.5*mm
|
||||
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
||||
text: Qt.atob(newsitemobject.user.name)//+forumname
|
||||
}
|
||||
}
|
||||
Column {
|
||||
id:newscolumn
|
||||
width: newsitem.width-8*mm
|
||||
anchors.left: authorcolumn.right
|
||||
|
||||
Flow{
|
||||
id:topFlow
|
||||
spacing: mm
|
||||
width:parent.width
|
||||
Label {
|
||||
id:messageTypeLabel
|
||||
color: "grey"
|
||||
text: if (newsitemobject.messagetype==0){qsTr("Source: ")+newsitemobject.source
|
||||
} else if (newsitemobject.messagetype==1){ qsTr("Direct Message")} else {" Notification"}
|
||||
font.pixelSize: 1.5*mm
|
||||
}
|
||||
Label {
|
||||
id:createdAtLabel
|
||||
color: "grey"
|
||||
font.pixelSize: 1.5*mm
|
||||
horizontalAlignment: Label.AlignRight
|
||||
text: dateDiff
|
||||
}
|
||||
Label {
|
||||
id:replytoLabel
|
||||
color: "grey"
|
||||
font.pixelSize: 1.5*mm
|
||||
horizontalAlignment: Label.AlignRight
|
||||
text: try {qsTr("In reply to ")+newsitemobject.reply_user.screen_name
|
||||
}catch(e){" "}
|
||||
}
|
||||
|
||||
Label {
|
||||
id:newscountLabel
|
||||
visible:((newstabstatus=="Tree")&&(newsitemobject.newscount>1))?true:false
|
||||
color: "grey"
|
||||
height:3.5*mm
|
||||
font.pixelSize: 1.5*mm
|
||||
font.bold: true
|
||||
horizontalAlignment: Label.AlignRight
|
||||
text: try {(newsitemobject.newscount-1)+qsTr(" comments") }catch(e){" "}
|
||||
MouseArea{
|
||||
anchors.fill:parent
|
||||
onClicked: {conversationsymbol.color="black";showConversation(index,newsitemobject)}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
color: "#404040"
|
||||
linkColor: "light green"
|
||||
id: itemMessage
|
||||
textFormat: Text.RichText
|
||||
text:Qt.atob(newsitemobject.statusnet_html)
|
||||
width: newsitem.width-8*mm-2
|
||||
height: implicitHeight
|
||||
wrapMode: Text.Wrap
|
||||
onLinkActivated:{
|
||||
Qt.openUrlExternally(link)}
|
||||
}
|
||||
|
||||
Flow{
|
||||
id:friendicaActivities
|
||||
width:parent.width
|
||||
spacing:mm
|
||||
Label{color: "grey"
|
||||
font.pixelSize: 1.5*mm
|
||||
text: friendica_activities.likeText
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked: { showActivityContacts(newsitemobject.like)}
|
||||
}
|
||||
}
|
||||
Label{color: "grey"
|
||||
font.pixelSize: 1.5*mm
|
||||
text: friendica_activities.dislikeText
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked: { showActivityContacts(newsitemobject.dislike)}
|
||||
}
|
||||
}
|
||||
Label{color: "grey"
|
||||
font.pixelSize: 1.5*mm
|
||||
text: friendica_activities.attendyesText
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked: { showActivityContacts(newsitemobject.attendyes)}
|
||||
}}
|
||||
Label{color: "grey"
|
||||
font.pixelSize: 1.5*mm
|
||||
text: friendica_activities.attendnoText
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked: { showActivityContacts(newsitemobject.attendno)}
|
||||
}
|
||||
}
|
||||
Label{color: "grey"
|
||||
font.pixelSize: 1.5*mm
|
||||
text: friendica_activities.attendmaybeText
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked: { showActivityContacts(newsitemobject.attendmaybe)}
|
||||
}
|
||||
}
|
||||
}
|
||||
Row{
|
||||
CheckBox{
|
||||
id:likeCheckbox
|
||||
height:3*mm
|
||||
width:8*mm
|
||||
visible: (newsitemobject.messagetype==0)? true:false
|
||||
checked:(friendica_activities.self.liked==1)?true:false
|
||||
style: CheckBoxStyle {
|
||||
background: Rectangle {
|
||||
implicitWidth: 6*mm
|
||||
implicitHeight: 3*mm
|
||||
color:"white"
|
||||
}
|
||||
indicator: Rectangle{
|
||||
implicitWidth: 3*mm
|
||||
implicitHeight:3*mm
|
||||
color:control.checked?"yellow":"white"
|
||||
x: 4*mm
|
||||
Text{
|
||||
anchors.centerIn: parent
|
||||
font.pixelSize: 2.5*mm
|
||||
font.family:fontAwesome.name
|
||||
color:control.checked?"black": "grey"
|
||||
text:"\uf118"
|
||||
}}
|
||||
}
|
||||
onClicked: {
|
||||
if(likeCheckbox.checked==true){Newsjs.like(root.login,root.db,1,"like",newsitemobject.status_id,root);dislikeCheckbox.checked=false; model.friendica_activities.self.liked=0 }
|
||||
else{Newsjs.like(root.login,root.db,0,"like",newsitemobject.status_id,root); model.friendica_activities.self.liked=1}}
|
||||
}
|
||||
CheckBox{
|
||||
id: dislikeCheckbox
|
||||
height:3*mm
|
||||
width:8*mm
|
||||
visible: (newsitemobject.messagetype==0)? true:false
|
||||
checked: (friendica_activities.self.disliked==1)?true:false
|
||||
style: CheckBoxStyle {
|
||||
background: Rectangle {
|
||||
implicitWidth: 6*mm
|
||||
implicitHeight:3*mm
|
||||
color:"white"
|
||||
}
|
||||
indicator: Rectangle{
|
||||
implicitWidth: 3*mm
|
||||
implicitHeight:3*mm
|
||||
color:control.checked?"yellow":"white"
|
||||
x:4*mm
|
||||
Text{
|
||||
anchors.centerIn: parent
|
||||
font.pixelSize: 2.5*mm
|
||||
font.family:fontAwesome.name
|
||||
color:control.checked?"black": "grey"
|
||||
text: "\uf119"
|
||||
}}
|
||||
}
|
||||
onClicked: {
|
||||
if (dislikeCheckbox.checked==true){Newsjs.like(root.login,root.db,1,"dislike",newsitemobject.status_id,root);likeCheckbox.checked=false; model.friendica_activities.self.disliked=0}
|
||||
else {Newsjs.like(root.login,root.db,0,"dislike",newsitemobject.status_id,root); model.friendica_activities.self.disliked=1}}
|
||||
}
|
||||
CheckBox {
|
||||
id:favoritedCheckbox
|
||||
visible:(newsitemobject.messagetype==0)
|
||||
width: 7*mm
|
||||
style: CheckBoxStyle {
|
||||
background: Rectangle {
|
||||
implicitWidth: 6*mm
|
||||
implicitHeight:3*mm
|
||||
color:"transparent"
|
||||
}
|
||||
indicator:Rectangle{
|
||||
x:3*mm
|
||||
width: 3*mm
|
||||
implicitHeight:3*mm
|
||||
Text{
|
||||
color: control.checked?"black":"grey"
|
||||
font.pixelSize: 2.5*mm
|
||||
text:"\uf005"
|
||||
}}
|
||||
}
|
||||
checked:(newsitemobject.favorited>0)
|
||||
onClicked:{
|
||||
if(favoritedCheckbox.checkedState==Qt.Checked){
|
||||
Newsjs.favorite(login,true,newsitemobject.status_id,root); model.newsitemobject.favorited=1}
|
||||
else if(favoritedCheckbox.checkedState==Qt.Unchecked){
|
||||
Newsjs.favorite(login,false,newsitemobject.status_id,root);model.newsitemobject.favorited=0}
|
||||
}
|
||||
}
|
||||
Rectangle{
|
||||
width: 7*mm
|
||||
height: 3*mm
|
||||
color:"transparent"
|
||||
Text{
|
||||
id:newsmenusymbol
|
||||
color: "grey"
|
||||
anchors.centerIn: parent
|
||||
font.pixelSize: 2*mm
|
||||
font.bold: true
|
||||
text: "\u22EE"
|
||||
}
|
||||
MouseArea{
|
||||
anchors.fill:parent
|
||||
onClicked: {newsmenu.popup()}}
|
||||
}
|
||||
Rectangle{
|
||||
width: 7*mm
|
||||
height: 3*mm
|
||||
visible:newstab.newstabstatus!="Conversation"
|
||||
color:"transparent"
|
||||
Text{
|
||||
id:conversationsymbol
|
||||
color: "grey"
|
||||
anchors.centerIn: parent
|
||||
font.pixelSize: 2.5*mm
|
||||
font.family: fontAwesome.name
|
||||
text: "\uf086"
|
||||
}
|
||||
MouseArea{
|
||||
anchors.fill:parent
|
||||
onClicked: { conversationsymbol.color="black";showConversation(index,newsitemobject)}
|
||||
}
|
||||
}
|
||||
Label{
|
||||
id:attendLabel
|
||||
//visible: false
|
||||
color: "grey"
|
||||
height:3.5*mm
|
||||
font.pixelSize: 1.5*mm
|
||||
horizontalAlignment: Label.AlignRight
|
||||
text: (friendica_activities.self.attending)?(qsTr("Attending: ")+ qsTr(friendica_activities.self.attending)):""
|
||||
}
|
||||
}
|
||||
}
|
||||
Menu {
|
||||
id:newsmenu
|
||||
MenuItem {
|
||||
text: qsTr("Reply")
|
||||
onTriggered: {
|
||||
var directmessage=0;
|
||||
if (newsitemobject.messagetype==1){ directmessage=1}
|
||||
newsStack.push({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{"reply_to_user": newsitemobject.user.screen_name,"parentId":newsitemobject.status_id,"login":root.login,"directmessage":directmessage}});
|
||||
}
|
||||
}
|
||||
MenuItem {
|
||||
text: qsTr("DM")
|
||||
onTriggered: {
|
||||
root.directmessageSignal(newsitemobject.user.screen_name);
|
||||
}
|
||||
}
|
||||
MenuItem {
|
||||
text: qsTr("Repost")
|
||||
onTriggered: {
|
||||
Newsjs.retweetNews(root.login,db,newsitemobject.status_id,root,function(reply){
|
||||
print(reply)})
|
||||
}
|
||||
}
|
||||
MenuItem {
|
||||
text: qsTr("Conversation")
|
||||
onTriggered: showConversation(index,newsitemobject)
|
||||
}
|
||||
|
||||
Menu{
|
||||
title: qsTr("Attending")
|
||||
MenuItem{
|
||||
text:qsTr("yes")
|
||||
onTriggered: {Newsjs.attend(root.login,db,"yes",newsitemobject.status_id,root,function(){
|
||||
model.friendica_activities.self.attending="yes";attending="yes"})
|
||||
}
|
||||
}
|
||||
MenuItem{text:qsTr("maybe")
|
||||
onTriggered: {Newsjs.attend(root.login,db,"maybe",newsitemobject.status_id,root,function(){
|
||||
model.friendica_activities.self.attending="maybe";attending="maybe"})
|
||||
}
|
||||
}
|
||||
MenuItem{text:qsTr("no")
|
||||
onTriggered: {Newsjs.attend(root.login,db,"no",newsitemobject.status_id,root,function(){
|
||||
model.friendica_activities.self.attending="no";attending="no"})}
|
||||
}
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
text: qsTr("Delete")
|
||||
onTriggered: {
|
||||
Newsjs.deleteNews(root.login,root.db,newsitemobject.status_id,newsitemobject.messagetype,root,function(reply){
|
||||
newsModel.remove(index)})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
189
source-android/qml/newsqml/PermissionDialog.qml
Normal file
189
source-android/qml/newsqml/PermissionDialog.qml
Normal file
|
@ -0,0 +1,189 @@
|
|||
import QtQuick 2.0
|
||||
import "qrc:/js/service.js" as Service
|
||||
import "qrc:/js/helper.js" as Helperjs
|
||||
import "qrc:/qml/genericqml"
|
||||
|
||||
Rectangle{
|
||||
id:permissionDialog
|
||||
x: mm
|
||||
width: messageColumn.width-5*mm
|
||||
height:root.height/3
|
||||
function updatePerms(){
|
||||
for (var i=0;i<groupModel.count;i++)
|
||||
{if (groupModel.get(i).groupstatus=="positive"){
|
||||
group_allow.push(groupModel.get(i).group.gid)
|
||||
}
|
||||
if (groupModel.get(i).groupstatus=="negative"){
|
||||
group_deny.push(groupModel.get(i).group.gid)
|
||||
}
|
||||
}
|
||||
for (var j=0;j<contactModel.count;j++){
|
||||
if (contactModel.get(j).contactstatus=="positive"){
|
||||
contact_allow.push(contactModel.get(j).contact.cid)
|
||||
}
|
||||
if (contactModel.get(j).contactstatus=="negative"){
|
||||
contact_deny.push(contactModel.get(j).contact.cid)
|
||||
}
|
||||
if ((contact_allow.length==0)&&(contact_deny.length==0)&&(group_allow.length==0)&&(group_deny.length==0))
|
||||
{permButton.text="\uf09c"}
|
||||
else{permButton.text="\uf023"}
|
||||
}}
|
||||
|
||||
Text{
|
||||
x:0.5*mm
|
||||
y:0.5*mm
|
||||
text: "Contacts"
|
||||
}
|
||||
ListView {
|
||||
id: contactView
|
||||
x:0.5*mm
|
||||
y:5.5*mm
|
||||
width: permissionDialog.width/2-2*mm
|
||||
height: permissionDialog.height-14*mm
|
||||
clip: true
|
||||
spacing: 1
|
||||
model: contactModel
|
||||
delegate: contactItem
|
||||
}
|
||||
|
||||
ListModel{id: contactModel}
|
||||
Component{
|
||||
id:contactItem
|
||||
Rectangle{
|
||||
id:contactitemRect
|
||||
width:contactView.width
|
||||
height: 5*mm
|
||||
radius: 0.5*mm
|
||||
property string contactstatus
|
||||
onContactstatusChanged:{
|
||||
if(contactstatus=="positive"){contactitemRect.color="light green"}
|
||||
else if (contactstatus=="negative"){contactitemRect.color= "ffe6e6"}
|
||||
else{contactitemRect.color= "white"}}
|
||||
color: "white"
|
||||
border.color:"grey"
|
||||
Text{
|
||||
color:"grey"
|
||||
text:contact.screen_name
|
||||
}
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked:{
|
||||
if(contactModel.get(index).contactstatus=="neutral"){
|
||||
contactModel.set(index,{"contactstatus":"positive"});
|
||||
contactstatus="positive"
|
||||
}
|
||||
else if (contactModel.get(index).contactstatus=="positive"){
|
||||
contactModel.set(index,{"contactstatus":"negative"})
|
||||
contactstatus="negative"
|
||||
}
|
||||
else{contactModel.set(index,{"contactstatus":"neutral"});
|
||||
contactstatus="neutral";
|
||||
}
|
||||
}}
|
||||
Component.onCompleted:{
|
||||
if (contactModel.get(index).contactstatus=="positive"){
|
||||
contactstatus="positive"
|
||||
}
|
||||
else if (contactModel.get(index).contactstatus=="negative"){
|
||||
contactstatus="negative"
|
||||
}
|
||||
else {contactstatus="neutral"} }
|
||||
}
|
||||
}
|
||||
Text{
|
||||
x:contactView.width+2*mm
|
||||
y:0.5*mm
|
||||
text: "Groups"
|
||||
}
|
||||
ListView {
|
||||
id: groupView
|
||||
x:contactView.width+2*mm
|
||||
y:5.5*mm
|
||||
width: permissionDialog.width/2-2*mm
|
||||
height: permissionDialog.height-14*mm
|
||||
clip: true
|
||||
spacing: 1
|
||||
model: groupModel
|
||||
delegate: groupItem
|
||||
}
|
||||
|
||||
ListModel{id: groupModel}
|
||||
Component{
|
||||
id:groupItem
|
||||
Rectangle{
|
||||
id:groupitemRect
|
||||
width:groupView.width
|
||||
radius: 0.5*mm
|
||||
height: 5*mm
|
||||
property string groupstatus:"neutral"
|
||||
onGroupstatusChanged:
|
||||
{if(groupstatus=="positive"){groupitemRect.color="light green"}
|
||||
else if (groupstatus=="negative"){groupitemRect.color= "#ffe6e6"}
|
||||
else{groupitemRect.color= "white"}}
|
||||
color: "white"
|
||||
border.color:"grey"
|
||||
Text{
|
||||
color:"grey"
|
||||
text:group.groupname
|
||||
}
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked:{
|
||||
if(groupModel.get(index).groupstatus=="neutral"){
|
||||
groupModel.set(index,{"groupstatus":"positive"});
|
||||
groupstatus="positive"}
|
||||
else if (groupModel.get(index).groupstatus=="positive"){
|
||||
groupModel.set(index,{"groupstatus":"negative"});
|
||||
groupstatus="negative"}
|
||||
else{groupModel.set(index,{"groupstatus":"neutral"})
|
||||
groupstatus="neutral"}
|
||||
}}
|
||||
Component.onCompleted:{ if (groupModel.get(index).groupstatus=="positive"){
|
||||
groupstatus="positive"
|
||||
}
|
||||
else if (groupModel.get(index).groupstatus=="negative"){
|
||||
groupstatus="negative"
|
||||
}
|
||||
else {groupstatus="neutral"} }
|
||||
}
|
||||
}
|
||||
BlueButton{
|
||||
x:0.5*mm
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin:1
|
||||
text:"\uf0c7"
|
||||
onClicked:{
|
||||
updatePerms();
|
||||
var perms=[];
|
||||
perms.push(contact_allow,contact_deny,group_allow,group_deny);
|
||||
Service.savePermissions(db,perms)
|
||||
}
|
||||
}
|
||||
BlueButton{
|
||||
x:contactView.width+2*mm
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin:1
|
||||
text:"\u2713"
|
||||
onClicked:{updatePerms();
|
||||
permissionDialog.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted:{
|
||||
Helperjs.readData(db,"contacts",login.username,function(contacts){
|
||||
for (var name in contacts){
|
||||
var contactstatus="neutral";
|
||||
if (contact_allow.indexOf(contacts[name].cid)>-1){contactstatus="positive";print(contacts[name].cid+" pos")}
|
||||
else if (contact_deny.indexOf(contacts[name].cid)>-1){contactstatus="negative"}
|
||||
contactModel.append({"contact":contacts[name],"contactstatus":contactstatus})
|
||||
}},"isFriend",1);
|
||||
|
||||
Helperjs.readData(db,"groups",login.username,function(owngroups){
|
||||
for (var number in owngroups){
|
||||
var groupstatus= "neutral";
|
||||
if (group_allow.indexOf(owngroups[number].gid)>-1){groupstatus="positive"}
|
||||
else if (group_deny.indexOf(owngroups[number].gid)>-1){groupstatus="negative"}
|
||||
groupModel.append({"group":owngroups[number],"groupstatus":groupstatus})
|
||||
}});
|
||||
}
|
||||
}
|
142
source-android/qml/newsqml/SmileyDialog.qml
Normal file
142
source-android/qml/newsqml/SmileyDialog.qml
Normal file
|
@ -0,0 +1,142 @@
|
|||
import QtQuick 2.7
|
||||
import QtQuick.Controls 1.2
|
||||
import QtQuick.Controls.Styles 1.4
|
||||
import "qrc:/js/smiley.js" as Smileyjs
|
||||
import "qrc:/js/helper.js" as Helperjs
|
||||
import "qrc:/qml/genericqml"
|
||||
|
||||
Rectangle{
|
||||
id:smileyDialog
|
||||
x: mm
|
||||
width: messageColumn.width-5*mm
|
||||
height:root.height/3
|
||||
|
||||
BlueButton{
|
||||
id:closeButton
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 1*mm
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 1*mm
|
||||
text: "\uf057"
|
||||
onClicked:{smileyDialog.destroy()}
|
||||
}
|
||||
|
||||
TabView{
|
||||
id:smileyTabView
|
||||
tabPosition: Qt.BottomEdge
|
||||
anchors.top: closeButton.bottom
|
||||
anchors.topMargin: 1*mm
|
||||
width: smileyDialog.width-2*mm
|
||||
height: smileyDialog.height-7*mm
|
||||
currentIndex: 0
|
||||
style: TabViewStyle {
|
||||
frameOverlap: 1
|
||||
tab: Rectangle {
|
||||
color: "white"
|
||||
implicitWidth: smileyTabView.width/3-2*mm
|
||||
implicitHeight: 4*mm
|
||||
Text { id: text
|
||||
anchors.centerIn: parent
|
||||
text: styleData.title
|
||||
color: "dark grey"
|
||||
font.pixelSize:2.5*mm
|
||||
font.bold: styleData.selected
|
||||
}
|
||||
}
|
||||
frame: Rectangle { color: "light grey" }
|
||||
tabsAlignment:Qt.AlignHCenter
|
||||
}
|
||||
|
||||
Tab{
|
||||
title: qsTr("Standard")
|
||||
Rectangle{
|
||||
id: coreGridTab
|
||||
GridView {
|
||||
id: coreSmileyView
|
||||
anchors.fill: parent
|
||||
cellWidth: 5*mm
|
||||
cellHeight: 5*mm
|
||||
clip: true
|
||||
model: coreSmileyModel
|
||||
delegate: smileyItem
|
||||
}
|
||||
|
||||
ListModel{
|
||||
id: coreSmileyModel
|
||||
}
|
||||
|
||||
Component.onCompleted:{
|
||||
var smileyarray=Smileyjs.core
|
||||
for (var icon in smileyarray){
|
||||
coreSmileyModel.append({"emoji":smileyarray[icon]})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Tab{
|
||||
title: qsTr("Addon")
|
||||
Rectangle{
|
||||
id: addonGridTab
|
||||
GridView {
|
||||
id: addonView
|
||||
anchors.fill: parent
|
||||
cellWidth: 5*mm
|
||||
cellHeight: 5*mm
|
||||
clip: true
|
||||
model: addonModel
|
||||
delegate: smileyItem
|
||||
}
|
||||
|
||||
ListModel{
|
||||
id: addonModel
|
||||
}
|
||||
Component.onCompleted:{
|
||||
for (var icon in Smileyjs.addon){
|
||||
addonModel.append({"emoji":Smileyjs.addon[icon]})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Tab{
|
||||
title: qsTr("Adult")
|
||||
Rectangle{
|
||||
id: adultGridTab
|
||||
GridView {
|
||||
id: adultView
|
||||
anchors.fill: parent
|
||||
cellWidth: 5*mm
|
||||
cellHeight: 5*mm
|
||||
clip: true
|
||||
model: adultModel
|
||||
delegate: smileyItem
|
||||
}
|
||||
|
||||
ListModel{
|
||||
id: adultModel
|
||||
}
|
||||
Component.onCompleted:{
|
||||
for (var icon in Smileyjs.adult){
|
||||
adultModel.append({"emoji":Smileyjs.adult[icon]})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Component{
|
||||
id:smileyItem
|
||||
AnimatedImage{id:smileyImage
|
||||
width:4.5*mm
|
||||
height: 4.5*mm
|
||||
fillMode:Image.PreserveAspectFit
|
||||
source:emoji.url
|
||||
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked:{
|
||||
bodyField.append(emoji.name+" ")
|
||||
smileyDialog.destroy()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
102
source-android/qml/photoqml/PhotoComponent.qml
Normal file
102
source-android/qml/photoqml/PhotoComponent.qml
Normal file
|
@ -0,0 +1,102 @@
|
|||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.2
|
||||
|
||||
Package {
|
||||
Item { id: stackItem; Package.name: 'stack'; z: stackItem.PathView.z;width:16.5*mm;height:16.5*mm}
|
||||
Item { id: listItem; Package.name: 'list'; width: root.width-1*mm; height: root.height-8*mm; }
|
||||
Item { id: gridItem; Package.name: 'grid';}
|
||||
|
||||
Item {
|
||||
id: photoWrapper
|
||||
width: 16.5*mm; height: 16.5*mm
|
||||
z: stackItem.PathView.z
|
||||
property string hqphotolink: photoLink
|
||||
|
||||
Rectangle {
|
||||
id: placeHolder
|
||||
color: 'lightblue'; antialiasing: true
|
||||
anchors.fill:parent
|
||||
}
|
||||
BusyIndicator { anchors.centerIn: parent; running: realImage.status != Image.Ready }
|
||||
Image {
|
||||
id: realImage;
|
||||
width: photoWrapper.width; height: photoWrapper.height
|
||||
antialiasing: true;
|
||||
asynchronous: true
|
||||
cache: false
|
||||
fillMode: Image.PreserveAspectFit;
|
||||
source: imageLocation
|
||||
}
|
||||
Rectangle{
|
||||
id:phototextRectangle
|
||||
color:"black"
|
||||
z:3
|
||||
opacity: 0.5
|
||||
width:phototext.contentWidth
|
||||
height: phototext.contentHeight
|
||||
anchors.bottom: photoWrapper.bottom
|
||||
}
|
||||
Text {
|
||||
id:phototext
|
||||
z:4
|
||||
text: photoDescription.trim()
|
||||
width:15*mm
|
||||
anchors.bottom: photoWrapper.bottom
|
||||
color: "white"
|
||||
font.pixelSize: 2*mm
|
||||
wrapMode:Text.Wrap
|
||||
}
|
||||
MouseArea {
|
||||
width: realImage.paintedWidth; height: realImage.paintedHeight; anchors.centerIn: realImage
|
||||
onClicked: {
|
||||
if (albumWrapper.state == 'inGrid') {
|
||||
gridItem.GridView.view.currentIndex = index;
|
||||
albumWrapper.state = 'fullscreen'
|
||||
} else {
|
||||
gridItem.GridView.view.currentIndex = index;
|
||||
albumWrapper.state = 'inGrid'
|
||||
}
|
||||
}
|
||||
}
|
||||
PinchArea {
|
||||
id:imagePinch
|
||||
pinch.target: realImage
|
||||
anchors.fill: realImage
|
||||
pinch.minimumScale: 0.1
|
||||
pinch.maximumScale: 10
|
||||
enabled: false
|
||||
}
|
||||
|
||||
// onStateChanged: print("State"+photoWrapper.state+index)
|
||||
states: [
|
||||
State {
|
||||
name: 'stacked'; when: albumWrapper.state == ''
|
||||
ParentChange { target: photoWrapper; parent: stackItem; }//x: 1*mm; y: 1*mm }
|
||||
PropertyChanges { target: photoWrapper; opacity: stackItem.PathView.onPath ? 1.0 : 0.0 }
|
||||
PropertyChanges { target: phototext; opacity: 0.0 }
|
||||
PropertyChanges { target: phototextRectangle; opacity: 0.0 }
|
||||
},
|
||||
State {
|
||||
name: 'inGrid'; when: albumWrapper.state == 'inGrid'
|
||||
ParentChange { target: photoWrapper; parent: gridItem; x: 1*mm; y: 1*mm;}
|
||||
PropertyChanges { target: phototext; opacity: 1.0 }
|
||||
PropertyChanges { target: phototextRectangle; opacity: 0.5 }
|
||||
PropertyChanges { target: placeHolder; opacity: 1.0 }
|
||||
},
|
||||
State {
|
||||
name: 'fullscreen'; when: albumWrapper.state == 'fullscreen'
|
||||
ParentChange {
|
||||
target: photoWrapper; parent: listItem; x: 1; y: 1;
|
||||
width: root.width-mm; height: root.height-8*mm
|
||||
}
|
||||
PropertyChanges { target: placeHolder; opacity: 0.0 }
|
||||
PropertyChanges { target: realImage; source: photoWrapper.hqphotolink}
|
||||
PropertyChanges { target: phototext; anchors.bottom: realImage.bottom}
|
||||
PropertyChanges { target: phototext; width:realImage.width }
|
||||
PropertyChanges { target: phototextRectangle; anchors.bottom: realImage.bottom }
|
||||
PropertyChanges { target: imagePinch; enabled:true}
|
||||
// PropertyChanges { target: realImage; width: Math.min(listItem.width,sourceSize.width);height: Math.min(listItem.height,sourceSize.height) }
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
21
source-android/qml/photoqml/PhotoPlaceholder.qml
Normal file
21
source-android/qml/photoqml/PhotoPlaceholder.qml
Normal file
|
@ -0,0 +1,21 @@
|
|||
import QtQuick 2.0
|
||||
import "qrc:/js/helper.js" as Helperjs
|
||||
|
||||
Image {
|
||||
id:photoPlaceholder
|
||||
property string imageName:"x.jpg"
|
||||
property string downloadtype:""
|
||||
fillMode: Image.PreserveAspectFit
|
||||
onStatusChanged: {
|
||||
if (photoPlaceholder.status == Image.Ready) {
|
||||
//print("Source: "+source+"Photo width"+width+" height"+height+" Ratio "+ fillMode);
|
||||
var saveprocess=photoPlaceholder.grabToImage(function(result){
|
||||
var saveresult=result.saveToFile(imageName.toString());
|
||||
if (saveresult){
|
||||
if ((downloadtype=="picture")&&(newImages.length>0)){
|
||||
photoPlaceholder.destroy();
|
||||
currentImageNo=currentImageNo+1
|
||||
}
|
||||
S }});
|
||||
}}}
|
||||
|
183
source-android/qml/photoqml/PhotoTab.qml
Normal file
183
source-android/qml/photoqml/PhotoTab.qml
Normal file
|
@ -0,0 +1,183 @@
|
|||
import QtQuick 2.0
|
||||
//import QtQuick.Dialogs 1.2
|
||||
import QtQuick.Controls 1.4
|
||||
import QtQml.Models 2.1
|
||||
import "qrc:/js/service.js" as Service
|
||||
import "qrc:/js/helper.js" as Helperjs
|
||||
import "qrc:/qml/photoqml"
|
||||
import "qrc:/qml/genericqml"
|
||||
|
||||
Rectangle {
|
||||
id:fotorectangle
|
||||
|
||||
y:1
|
||||
width:root.width-mm
|
||||
height:root.height-5*mm
|
||||
color: '#fff'
|
||||
property var newimages:[]
|
||||
property int currentimageno: 0
|
||||
|
||||
onNewimagesChanged:{
|
||||
if(newimages.length>0){
|
||||
Helperjs.readField("album",root.db,"imageData",root.login.username,function(albums){
|
||||
for (var i=0;i<newimages.length;i++){
|
||||
if(albums.indexOf(newimages[i].album)==-1){
|
||||
filesystem.Directory=root.login.imagestore+"/albums";
|
||||
filesystem.makeDir(newimages[i].album)}}
|
||||
})
|
||||
Service.dataRequest(root.login,newimages[currentimageno].id,root.db,fotostab);
|
||||
newImagesProgress.visible=true //download first image
|
||||
}
|
||||
}
|
||||
|
||||
onCurrentimagenoChanged:{
|
||||
if(currentimageno<newimages.length){Service.dataRequest(root.login,newimages[currentimageno].id,root.db,fotostab)};
|
||||
if(currentimageno==newimages.length){newImagesProgress.visible=false;showFotos("");
|
||||
newimages=[];currentimageno=0}
|
||||
// download next image
|
||||
}
|
||||
|
||||
Connections{
|
||||
target:xhr
|
||||
onDownloaded:{if(data=="picture"){currentimageno=currentimageno+1}}
|
||||
}
|
||||
|
||||
Connections{
|
||||
target:xhr
|
||||
onError:{if(data=="picture"){print("Error"+data);
|
||||
currentimageno=currentimageno+1}}
|
||||
}
|
||||
|
||||
function showFotos(friend){
|
||||
if(friend=="backButton"){
|
||||
if(!albumgridview.currentItem){root.currentIndex=0}
|
||||
if(albumgridview.currentItem.state=='fullscreen'){
|
||||
albumgridview.currentItem.state = 'inGrid'}
|
||||
else if (albumgridview.currentItem.state == 'inGrid'){albumgridview.currentItem.state=''}
|
||||
else{root.currentIndex=0}
|
||||
}
|
||||
else{
|
||||
try {photogroupModel.clear()}catch (e){print(e)}
|
||||
if (friend){
|
||||
Service.requestFriendsAlbumPictures(login,friend,fotostab,function(albums){
|
||||
var msg = {'model': photogroupModel,'albums':albums,'firstalbum':0,'foreignPicture':true}
|
||||
photoWorker.sendMessage(msg);
|
||||
})
|
||||
phototabstatusButton.text=qsTr(friend.screen_name.toString())+qsTr("'s images")
|
||||
|
||||
}
|
||||
else {
|
||||
Helperjs.readField("album", root.db, "imageData",login.username,function(albums){
|
||||
if (albums[0]) {
|
||||
var msg = { 'model': photogroupModel,'albums':albums,'firstalbum':0,'foreignPicture': false};
|
||||
photoWorker.sendMessage(msg);
|
||||
}
|
||||
})
|
||||
}}
|
||||
}
|
||||
|
||||
ProgressBar{
|
||||
id: newImagesProgress
|
||||
width: 15*mm
|
||||
height: updatePhotolist.height
|
||||
anchors.top: parent.top
|
||||
anchors.right:updatePhotolist.left
|
||||
anchors.rightMargin:mm
|
||||
visible: false
|
||||
value: currentimageno/newimages.length
|
||||
}
|
||||
|
||||
BlueButton{
|
||||
id: updatePhotolist
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 0.5*mm
|
||||
anchors.right:phototabstatusButton.left
|
||||
anchors.rightMargin:mm
|
||||
text:"\uf021"
|
||||
onClicked: {
|
||||
Service.requestList(root.login,root.db, fotostab,function(obj){
|
||||
newimages=obj;print("newimages"+JSON.stringify(obj))
|
||||
})}}
|
||||
|
||||
BlueButton{
|
||||
id: phototabstatusButton
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 0.5*mm
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin:2*mm
|
||||
text: qsTr(phototabstatus)
|
||||
onClicked: {phototabmenu.popup()}
|
||||
}
|
||||
Menu {
|
||||
id:phototabmenu
|
||||
MenuItem {
|
||||
text: qsTr("Own Images")
|
||||
onTriggered: {
|
||||
fotostab.phototabstatus="Images";
|
||||
phototabstatusButton.text=qsTr("own images");
|
||||
showFotos("")}
|
||||
}
|
||||
}
|
||||
|
||||
DelegateModel{
|
||||
id: visualphotoModel
|
||||
delegate: PhotogroupComponent{}
|
||||
model: photogroupModel
|
||||
}
|
||||
|
||||
ListModel{
|
||||
id: photogroupModel
|
||||
}
|
||||
|
||||
GridView {
|
||||
id: albumgridview
|
||||
cellWidth: 17*mm
|
||||
cellHeight: 17*mm
|
||||
x: mm;y:8*mm
|
||||
width: parent.width-2*mm; height: parent.height-9*mm
|
||||
clip: true
|
||||
model: visualphotoModel.parts.album
|
||||
footer:Rectangle{
|
||||
border.color: "#EEEEEE"
|
||||
border.width: 1
|
||||
width:12*mm
|
||||
height:6*mm
|
||||
Text{
|
||||
font.pixelSize: 1.5*mm
|
||||
anchors.centerIn: parent
|
||||
text:qsTr("More")
|
||||
}
|
||||
MouseArea{anchors.fill:parent
|
||||
onClicked:{
|
||||
var lastalbum_id=photogroupModel.get(photogroupModel.count-1);
|
||||
if(photogroupModel.get(photogroupModel.count-1).foreignPictures==false){
|
||||
Service.requestFriendsAlbumPictures(friend,fotostab,function(albums){
|
||||
var msg = {'model': photogroupModel,'albums':albums,'firstalbum':lastalbum_id+1,'foreignPicture':true}
|
||||
photoWorker.sendMessage(msg)
|
||||
})}
|
||||
else{Helperjs.readField("album",root.db, "imageData",root.login.username,function(albums){
|
||||
var msg = { 'model': photogroupModel,'albums':albums,'foreignPicture': false,'firstalbum':lastalbum_id+1};
|
||||
photoWorker.sendMessage(msg)})}
|
||||
}}}
|
||||
}
|
||||
|
||||
Rectangle { id: photoBackground; color: 'light grey'; width: parent.width; height: parent.height; opacity: 0; visible: opacity != 0.0 }
|
||||
|
||||
ListView { width: parent.width; height:parent.height; model: visualphotoModel.parts.browser; interactive: false }
|
||||
|
||||
BlueButton {
|
||||
id: backButton
|
||||
text: "\uf057"
|
||||
x: parent.width - backButton.width - 3*mm
|
||||
y: -backButton.height - 4*mm
|
||||
z:2
|
||||
onClicked: {photoBackground.opacity=0}
|
||||
}
|
||||
|
||||
ListView {anchors.fill: parent; model: visualphotoModel.parts.fullscreen; interactive: false }
|
||||
WorkerScript{id: photoWorker;source: "qrc:/js/photoworker.js"}
|
||||
|
||||
Component.onCompleted: { root.fotoSignal.connect(showFotos);
|
||||
if (fotostab.phototabstatus=="Images"){showFotos("")}
|
||||
}
|
||||
}
|
117
source-android/qml/photoqml/PhotogroupComponent.qml
Normal file
117
source-android/qml/photoqml/PhotogroupComponent.qml
Normal file
|
@ -0,0 +1,117 @@
|
|||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.3
|
||||
import QtQml.Models 2.1
|
||||
import "qrc:/js/service.js" as Service
|
||||
import "qrc:/js/helper.js" as Helperjs
|
||||
|
||||
Package {
|
||||
Item {
|
||||
Package.name: 'browser'
|
||||
GridView {
|
||||
id: photosGridView; model: visualModel.parts.grid; width: albumgridview.width; height: albumgridview.height;y:albumgridview.y
|
||||
cellWidth: 16.5*mm; cellHeight: 16.5*mm; interactive: false//anchors.margins:2*mm
|
||||
onCurrentIndexChanged: photosListView.positionViewAtIndex(currentIndex, ListView.Contain)
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
Package.name: 'fullscreen'
|
||||
ListView {
|
||||
id: photosListView; model: visualModel.parts.list; orientation: Qt.Horizontal
|
||||
width: albumgridview.width; height: albumgridview.height; //y:albumgridview.y
|
||||
//width: parent.width; height: parent.height;
|
||||
interactive: false
|
||||
onCurrentIndexChanged: photosGridView.positionViewAtIndex(currentIndex, GridView.Contain)
|
||||
highlightRangeMode: ListView.StrictlyEnforceRange; snapMode: ListView.SnapOneItem
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
Package.name: 'album'
|
||||
id: albumWrapper; width: 16.5*mm; height: 16.5*mm
|
||||
DelegateModel {
|
||||
id: visualModel; delegate: PhotoComponent { }
|
||||
model: photoModel
|
||||
}
|
||||
|
||||
PathView {
|
||||
id: photosPathView;
|
||||
model: visualModel.parts.stack;
|
||||
pathItemCount: 1
|
||||
anchors.centerIn: parent;
|
||||
path: Path {
|
||||
PathAttribute { name: 'z'; value: 9999.0 }
|
||||
PathLine { x: 1; y: 1 }
|
||||
PathAttribute { name: 'z'; value: 0.0 }
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle{
|
||||
color:"black"
|
||||
opacity: 0.5
|
||||
width:albumtext.contentWidth
|
||||
height: albumtext.contentHeight
|
||||
anchors.bottom: albumWrapper.bottom
|
||||
}
|
||||
Text {
|
||||
id:albumtext
|
||||
text: albumname
|
||||
width:albumWrapper.width-1*mm
|
||||
height: albumtext.contentHeight
|
||||
wrapMode:Text.Wrap
|
||||
color: "white"
|
||||
font.family: "Monospace"
|
||||
font.pixelSize: 2*mm
|
||||
anchors.bottom: albumWrapper.bottom
|
||||
}
|
||||
|
||||
ListModel{
|
||||
id: photoModel
|
||||
}
|
||||
|
||||
Component.onCompleted:{
|
||||
try {photoModel.clear()}catch (e){print(e)}
|
||||
if(foreignPicture){
|
||||
Service.requestFriendsPictures(albumlink,fotostab,function(obj){
|
||||
if (obj) {
|
||||
for (var k=0;k<obj.length;k++){
|
||||
photoModel.append({"imageLocation": obj[k].thumb,"photoDescription":obj[k].name,"photoLink":obj[k].link})
|
||||
}
|
||||
}
|
||||
})}
|
||||
else{
|
||||
Helperjs.readData(db,"imageData",root.login.username,function(obj){
|
||||
if (obj) {
|
||||
for (var k=0;k<obj.length;k++){
|
||||
photoModel.append({"imageLocation": obj[k].location+obj[k].filename,"photoDescription":obj[k].filename,"photoLink":obj[k].location+obj[k].filename})
|
||||
}
|
||||
}
|
||||
},"album",albumname)}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: albumWrapper.state = 'inGrid'
|
||||
}
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: 'inGrid'
|
||||
PropertyChanges { target: photosGridView; interactive: true }
|
||||
PropertyChanges { target: photoBackground; opacity: 1 }
|
||||
PropertyChanges { target: backButton; onClicked: albumWrapper.state = ''; y: 6 }
|
||||
},
|
||||
State {
|
||||
name: 'fullscreen'; extend: 'inGrid'
|
||||
PropertyChanges { target: photosGridView; interactive: false }
|
||||
PropertyChanges { target: photosListView; interactive: true }
|
||||
PropertyChanges { target: photoBackground; opacity: 1 }
|
||||
PropertyChanges { target: backButton;onClicked:{
|
||||
albumWrapper.state = 'inGrid'}
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
} //album Ende
|
||||
} //Package Ende
|
||||
//item Ende
|
Loading…
Add table
Add a link
Reference in a new issue