Friendiqa v0.3.2

This commit is contained in:
LubuWest 2018-08-25 16:17:09 +02:00
commit 99ae53f624
54 changed files with 2771 additions and 437 deletions

View file

@ -181,15 +181,15 @@ StackView{
id: username
anchors.fill: parent
selectByMouse: true
onEditingFinished:{
Helperjs.friendicaWebRequest(servername.text+'/api/users/show?screen_name='+username.text,configBackground,function(obj){
var screennametest=JSON.parse(obj);
if (screennametest.hasOwnProperty('status')){
Helperjs.showMessage(qsTr("Error"),qsTr("Nickname not registered at given server!"),configBackground);
configBackground.registeredUser=false;
}else{configBackground.registeredUser=true}
});
}
//onEditingFinished:{
// Helperjs.friendicaWebRequest(servername.text+'/api/users/show?screen_name='+username.text,configBackground,function(obj){
// var screennametest=JSON.parse(obj);
// if (screennametest.hasOwnProperty('status')){
// Helperjs.showMessage(qsTr("Error"),qsTr("Nickname not registered at given server!"),configBackground);
// configBackground.registeredUser=false;
// }else{configBackground.registeredUser=true}
// });
// }
}
}

View file

@ -43,7 +43,7 @@ Rectangle{
textFormat: Text.RichText
width: parent.width
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
text: "<b>Friendiqa v0.3.1 </b><br>Licensed under GPL 3 with the exception of OpenSSL <br> "+
text: "<b>Friendiqa v0.3.2 </b><br>Licensed under GPL 3 with the exception of OpenSSL <br> "+
"Profile <a href='https://freunde.ma-nic.de/profile/friendiqa'>https://freunde.ma-nic.de/profile/friendiqa</a><br>"+
"Sourcecode: <a href='https://git.friendi.ca/LubuWest/Friendiqa'>https://git.friendi.ca/LubuWest/Friendiqa</a><br>"+
"Most of C++ code by <a href='https://kirgroup.com/profile/fabrixxm'>Fabio</a><br>"+

View file

@ -29,14 +29,20 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0
import QtQuick 2.5
import QtQuick.LocalStorage 2.0
import QtQuick.Window 2.0
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.4
//import QtQuick.Controls 2.3
import "qrc:/js/news.js" as Newsjs
import "qrc:/js/service.js" as Service
import "qrc:/qml/genericqml"
import "qrc:/qml/newsqml"
import "qrc:/qml/contactqml"
import "qrc:/qml/photoqml"
import "qrc:/qml/calendarqml"
import "qrc:/qml/configqml"
TabView{
@ -61,10 +67,11 @@ TabView{
signal eventSignal(var contact)
signal uploadSignal(var urls)
signal sendtextSignal(var intenttext)
signal changeimage(var method, var type, var id)
property var news:[]
property var newContacts:[]
property string contactLoadType: ""
property bool imagePicking: false
onLoginChanged:{
if(login==""){root.currentIndex=4}
@ -186,13 +193,13 @@ TabView{
source: (root.currentIndex==3)?"qrc:/qml/calendarqml/CalendarTab.qml":""
}
Tab{
title:"\uf085"
id: configtab
source: (root.currentIndex==4)?"qrc:/qml/configqml/ConfigTab.qml":""
}
Component.onCompleted: {
//print(xhr.networktype);
if(osSettings.imagePickQml=="ImagePicker"){var component = Qt.createComponent("qrc:/qml/genericqml/IntentReceiver.qml");
var IntentReceiverQml = component.createObject(root)
}

View file

@ -46,13 +46,13 @@ Item {
imageUrls=h;
imageUrl=h[0];
ready();
root.imagePicking=false
}
}
}
Component.onCompleted: {
SystemDispatcher.loadClass("androidnative.ImagePicker");
if (root.currentIndex==0){SystemDispatcher.setInitialized();}
}
}

View file

@ -2,7 +2,7 @@ import QtQuick 2.0
import AndroidNative 1.0
Item {
id:intent
/// The URL of the image chosen. If multiple images are picked, it will be equal to the first image.
property string imageUrl: ""
@ -16,7 +16,7 @@ Item {
Connections {
target: SystemDispatcher
onDispatched: {
if (type === m_IMAGE_MESSAGE) {
if ((type === m_IMAGE_MESSAGE)&& (root.imagePicking==false)) {
var h=[];
for (var n in message.imageUrls){
h.push("file://"+ decodeURIComponent(message.imageUrls[n]).substring(5))

View file

@ -32,17 +32,18 @@
import QtQuick 2.7
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
//import "qrc:/js/news.js" as Newsjs
//import "qrc:/js/helper.js" as Helperjs
//import "qrc:/js/service.js" as Service
Item {
Rectangle {
id:searchComponent
onVisibleChanged: if (visible) searchText.forceActiveFocus()
//onActiveFocusChanged: searchText.forceActiveFocus()
//onVisibleChanged: if (visible) searchText.forceActiveFocus()
// border.color: "#EEEEEE"
// border.width: 1
// color:"lightgrey"
color:"lightgrey"
// width:conversationView.width
// height:Math.max(replyText.contentHeight+2*mm,6*mm)
Rectangle{
@ -53,19 +54,21 @@ Item {
anchors.top:parent.top
anchors.topMargin: 0.5*mm
width:parent.width-2*mm
height:Math.max( searchText.contentHeight,5*mm)
height: 7*mm //Math.max( searchText.contentHeight,5*mm)
TextInput {
id: searchText
focus: true
font.pixelSize: 3*mm
wrapMode: Text.Wrap
anchors.fill: parent
selectByMouse: true
cursorVisible: false
onEditingFinished: search(displayText)
onEditingFinished:{ if (displayText!=""){search(displayText)};searchComponent.destroy()}
//onHeightChanged: newsView.contentY+=4.5*mm
}
}
Component.onCompleted: searchText.forceActiveFocus()
// BlueButton {
// id: sendButton
// text: "\uf002"
@ -80,4 +83,5 @@ Item {
// }
// }
}
}

View file

@ -148,7 +148,7 @@ Rectangle{
else{urlTextEdit.text="";
urlRectangle.visible=true}}
}
}
}
Rectangle{
id:urlRectangle
height: 7*mm //parent.height
@ -189,9 +189,10 @@ Rectangle{
Helperjs.showMessage( qsTr("Error"),qsTr("Only one attachment supported at the moment.\n Remove other attachment first!"), messageColumn)
}
else{
// root.imagePicking=true;
var imagePicker = Qt.createQmlObject('import QtQuick 2.0; import "qrc:/qml/genericqml";'+
osSettings.imagePickQml+'{multiple : false;onReady: {attachImageURLs.push(imageUrl);'+
'attachImage(imageUrl)}}',messageSend,"imagePicker");
'attachImage(imageUrl)}}',root,"imagePicker");
imagePicker.pickImage()
}
}

View file

@ -29,7 +29,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0
import QtQuick 2.9
AnimatedImage {id:gif;
width:newscolumn.width;
property string mimetype:""

View file

@ -29,8 +29,9 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0
import QtQuick.Controls 2.3
import QtQuick 2.7
import QtQuick.Controls 1.4
import QtQuick.Controls 2.3 as QC2
//import QtQuick.Controls.Styles 2.3
import QtQuick.Dialogs 1.3
import "qrc:/qml/genericqml"
@ -50,7 +51,7 @@ Item {
Connections{
target:xhr
onError:{
Helperjs.showMessage(qsTr("Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root);
Helperjs.showMessage(qsTr("Network Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root);
}
onSuccess:{
// downloadNotice.text=downloadNotice.text+ "\n xhr finished "+Date.now();
@ -85,9 +86,9 @@ Item {
var currentTime= new Date();
// downloadNotice.text=downloadNotice.text + "\n shownews start "+ Date.now();
//print("appendnews "+newsStack.appendNews +JSON.stringify(newsToShow))
var msg = {'currentTime': currentTime, 'model': newsModel,'news':newsToShow,'appendnews':newsStack.appendNews};
var msg = {'currentTime': currentTime, 'model': newsModel,'news':newsToShow,'method':newsStack.updateMethodNews};
newsWorker.sendMessage(msg);
newsStack.appendNews=false
//newsStack.appendNews=false
}
@ -126,13 +127,14 @@ Item {
if (term!=""){
newstab.newstabstatus="Search";
newsBusy.running=true;
newsStack.updateMethodNews="refresh";
xhr.setLogin(login.username+":"+Qt.atob(login.password));
xhr.setUrl(login.server);
xhr.setApi("/api/search");
xhr.clearParams();
xhr.setParam("q",term)
xhr.get();}
newsSearch.visible=false;
//newsSearch.visible=false;
newsView.anchors.topMargin=7*mm
}
@ -151,21 +153,21 @@ Item {
function onDirectMessage(friend){
newstab.newstabstatus="SendMessage"
newsStack.push("qrc:/qml/newsqml/MessageSend.qml",{"reply_to_user": friend,"directmessage":1,"login":root.login});
newsStack.push({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{"reply_to_user": friend,"directmessage":1,"login":root.login}});
}
function sendUrls(urls){
function sendUrls(urls){print(root.currentIndex==0);
if((urls.length==1)&&(newsStack.depth<2)){
newsStack.push("qrc:/qml/newsqml/MessageSend.qml",{"attachImageURLs":urls})
newsStack.push({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{"attachImageURLs":urls}})
}
}
function sendtext(text){
if(text&&(newsStack.depth<2)){
if (text.subject=="undefined"){text.subject=""}
if(text.plaintext.lastIndexOf(".jpg")>-1 || text.plaintext.lastIndexOf(".jpeg")>-1 || text.plaintext.lastIndexOf(".png")>-1 || text.plaintext.lastIndexOf(".jpeg")>-1){
if(text.plaintext.lastIndexOf(".jpg")>-1 || text.plaintext.lastIndexOf(".jpeg")>-1 || text.plaintext.lastIndexOf(".png")>-1 || text.plaintext.lastIndexOf(".gif")>-1){
text.plaintext="<a href="+text.plaintext+"><img src="+text.plaintext+"></a>"}
newsStack.push("qrc:/qml/newsqml/MessageSend.qml",{"bodyMessage":text.subject+"\n"+text.plaintext})
newsStack.push({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{"bodyMessage":text.subject+"\n"+text.plaintext}})
}
}
@ -173,7 +175,7 @@ Item {
id: newsStack
anchors.fill:parent
property int conversationIndex: 0
property bool appendNews: false
property string updateMethodNews: "refresh"
property var allchats: ({})
initialItem:Rectangle {
id:newslistRectangle
@ -187,10 +189,10 @@ Item {
text: qsTr(newstab.newstabstatus)
onClicked: {newstabmenu.popup(2*mm,6*mm)}
Menu{id:newstabmenu
QC2.Menu{id:newstabmenu
width: 40*mm
delegate:MenuItem{
delegate:QC2.MenuItem{
contentItem: Text{
font.pixelSize: 3.5*mm
text:parent.text
@ -201,57 +203,66 @@ Item {
border.color: "grey"
}
}
Action {
QC2.Action {
text: qsTr("Timeline")
onTriggered: {
newstab.newstabstatus="Timeline";
newsModel.clear();
//newsModel.clear();
try{ Newsjs.newsfromdb(root.db,root.login.username, function(dbnews){
showNews(dbnews)
})}catch(e){Helperjs.showMessage("Error",e,root)}}
}
Action {
QC2.Action {
text: qsTr("Conversations")
onTriggered:{
newsModel.clear();
//newsModel.clear();
newstab.newstabstatus="Conversations";
Newsjs.chatsfromdb(db,root.login.username,function(news){showNews(news)})
}
}
Action {
QC2.Action {
text: qsTr("Favorites")
onTriggered:{
newsStack.updateMethodNews="refresh";
newstab.newstabstatus="Favorites";
Service.updateView("Favorites")
}
}
Action {
QC2.Action {
text: qsTr("Public timeline")
onTriggered:{
newsStack.updateMethodNews="refresh";
newstab.newstabstatus="Public Timeline";
Service.updateView("Public Timeline")
}
}
Action {
QC2.Action {
text: qsTr("Direct Messages")
onTriggered:{
newsStack.updateMethodNews="refresh";
newstab.newstabstatus="Direct Messages";
Service.updateView("Direct Messages")
}
}
Action {
QC2.Action {
text: qsTr("Notifications")
onTriggered:{
newsStack.updateMethodNews="refresh";
newstab.newstabstatus="Notifications";
Service.updateView("Notifications")
}
}
Action {
QC2.Action {
text: qsTr("Group news")
onTriggered:Service.showGroups();
onTriggered:
{
newsStack.updateMethodNews="refresh";
Service.showGroups();
}
}
Action {
QC2.Action {
text: qsTr("Quit")
onTriggered:{
Service.cleanNews(root.db,function(){
@ -273,13 +284,17 @@ Item {
id: searchButton
text: "\uf002"
onClicked: {
if (newsSearch.visible==false){
//if (newsSearch.visible==false){
newsView.anchors.topMargin=18*mm;
newsSearch.visible=true}
else{
newsSearch.visible=false;
newsView.anchors.topMargin=7*mm;
}
var component = Qt.createComponent("qrc:/qml/genericqml/Search.qml");
var searchItem = component.createObject(newsStack,{y:8*mm,width:root.width,height: 8*mm});
//searchItem.forceActiveFocus()
// newsSearch.visible=true}
//else{
// newsSearch.visible=false;
// newsView.anchors.topMargin=7*mm;
//}
}
}
@ -309,6 +324,9 @@ Item {
id: update
text: "\uf021"
onClicked: {
if (newstab.newstabstatus=="Timeline"){
newsStack.updateMethodNews="append"
} else {newsStack.updateMethodNews="refresh"}
root.contactLoadType="news";
Service.updateView(newstab.newstabstatus)
}
@ -354,18 +372,19 @@ Item {
}
}
}
Rectangle{
id: newsSearch
color: "#FFFAFA"
y:8*mm
width:root.width
height: 8*mm
visible:false
Search{
anchors.fill: parent
anchors.margins: mm
}
}
// Rectangle{
// id: newsSearch
// color: "#FFFAFA"
// y:8*mm
// width:root.width
// height: 8*mm
// //visible:false
// Search{
// anchors.fill: parent
// anchors.margins: mm
// }
// }
ListView {
id: newsView
anchors.fill: parent
@ -378,11 +397,12 @@ Item {
model: newsModel
delegate: Newsitem{}
//onContentYChanged:{if(contentY<-8*mm&&contentY>(-8*mm-1)){print("refreshing");
onDragEnded:{if(contentY<-5*mm){//print("refreshing");
onDragEnded:{if(contentY<-5*mm){
root.contactLoadType="news";
var onlynew=true;
Service.updateView(newstab.newstabstatus)
}}
//Component.onCompleted: currentIndex=count
}
ListModel{id: newsModel}
@ -436,7 +456,9 @@ Item {
if(root.news.length>0){showNews(root.news)}
else{ 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)})}
else{Newsjs.chatsfromdb(db,login.username,function(dbnews){
showNews(dbnews);
})}
}
}
}

View file

@ -0,0 +1,97 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtMultimedia 5.8
import QtQuick 2.9
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
Rectangle{
color:"black"
//border.color: "light grey"
width:newscolumn.width;
height:video.hasVideo?newscolumn.width/4*3:10*mm
property alias source:video.source
Text{
id:noticeText
text:"\uf144";
color:"light grey"
width:parent.width
font.pixelSize: parent.height/2
x:parent.width/2-parent.height/4
y:parent.height/5
visible: video.playbackState!=MediaPlayer.PlayingState
}
Video {id:video;
anchors.fill:parent
property string mimetype:""
onErrorChanged:{noticeText.font.pixelSize=3*mm;noticeText.text=errorString}
fillMode: Image.PreserveAspectFit;
autoLoad: false
audioRole: MediaPlayer.VideoRole
MouseArea {anchors.fill:parent;
onClicked:{if(video.playbackState!=MediaPlayer.PlayingState){
video.play()} else{video.pause()}
}
}
}
ProgressBar{
id: videoProgress
width: parent.width
height: 2*mm
anchors.top: video.bottom
z:2
visible:video.playbackState!=MediaPlayer.StoppedState
value: video.position/video.duration
}
ProgressBar{
id: videoBuffer
width: parent.width
height: 2*mm
anchors.top: video.bottom
visible:video.playbackState!=MediaPlayer.StoppedState
value: video.bufferProgress
style:ProgressBarStyle{
progress: Rectangle{
color:"light grey"
}
}
}
// Slider{ id: videoSlider
// width: parent.width
// height: 3*mm
// anchors.top: video.bottom
// visible:video.playbackState!=MediaPlayer.StoppedState && video.seekable
// value: video.position/video.duration
// onPressed:video.seek(value*video.duration)
// }
}

View file

@ -163,7 +163,7 @@ Item {
linkColor: "light green"
id: itemMessage
textFormat: Text.RichText
text: newsitemobject.attachmentList.length>0?newsitemobject.text : newsitemobject.statusnet_html
text: newsitemobject.statusnet_html//newsitemobject.attachmentList.length>0?newsitemobject.text : newsitemobject.statusnet_html
width: newsitem.width-8*mm-2
height: implicitHeight
wrapMode: Text.Wrap
@ -181,10 +181,17 @@ Item {
}}
if (newsitemobject.attachmentList.length>0){
var component = Qt.createComponent("qrc:/qml/newsqml/NewsImage.qml");
for(var attachments in newsitemobject.attachmentList){// (newsitemobject.attachmentList[attachments].url);
var imageQml = component.createObject(messageColumn,{"source":newsitemobject.attachmentList[attachments].url,"mimetype":newsitemobject.attachmentList[attachments].mimetype});
}
if(newsitemobject.attachmentList[attachments].mimetype.substring(0,5)=="image"){
var component = Qt.createComponent("qrc:/qml/newsqml/NewsImage.qml");
var imageQml = component.createObject(messageColumn,{"source":newsitemobject.attachmentList[attachments].url,"mimetype":newsitemobject.attachmentList[attachments].mimetype});
} else {//print(newsitemobject.attachmentList[attachments].url+" Type: "+newsitemobject.attachmentList[attachments].mimetype)
var component = Qt.createComponent("qrc:/qml/newsqml/NewsVideo.qml");
var videoQml = component.createObject(messageColumn,{"source":newsitemobject.attachmentList[attachments].url,"mimetype":newsitemobject.attachmentList[attachments].mimetype});
}
}
}
}
}}

View file

@ -29,15 +29,17 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.7
import QtQuick 2.5
import QtQuick.Controls 1.4
import "qrc:/js/service.js" as Service
import "qrc:/js/helper.js" as Helperjs
import "qrc:/js/image.js" as Imagejs
import "qrc:/qml/genericqml"
Rectangle{
id:imageDialog
property var attachImageURLs: []
property string imageId: ""
property string currentAlbum:""
property var contacts: []
property var groups: []
property var contact_allow:login.permissions[0]
@ -60,6 +62,19 @@ Rectangle{
xhr.post();
}
function updateImage(){
xhr.url= login.server + "/api/friendica/photo/update.json";
xhr.setLogin(login.username+":"+Qt.atob(login.password));
xhr.clearParams();
xhr.setParam("desc",imageUploadModel.get(0).description);
xhr.setParam("album", currentAlbum);
xhr.setParam("album_new", album.currentText);
xhr.setParam("photo_id", imageId);
xhr.post();
}
function attachImage(url){
imageUploadModel.append({"imageUrl":url,"description":""})
}
@ -74,15 +89,24 @@ Rectangle{
target:xhr
onError:{print(data)}//if (data=="image"){Helperjs.showMessage()}}
onSuccess:{
imageNo=imageNo+1;
if(imageNo<imageUploadModel.count){
uploadSelectedImage(imageNo);
}else{
Service.requestList(root.login,root.db, fotostab,function(obj){
fotorectangle.newimages=obj;
imageDialog.destroy()
})
if (imageId==""){
imageNo=imageNo+1;
if(imageNo<imageUploadModel.count){
uploadSelectedImage(imageNo);
}else{
Imagejs.requestList(login,db, true,root,function(obj){
fotorectangle.newimages=obj;
imageDialog.destroy()
})
}} else{
Imagejs.updateImage(db,login,"image",filesystem,imageId,root,function(){
Imagejs.requestList(login,db, true,root,function(obj){
fotorectangle.newimages=obj;
fotoSignal(login,"backButton");
//photoStack.pop()
})
})
}
}
}
@ -117,35 +141,43 @@ Rectangle{
}
}
Text {
text: qsTr("Album")
x: 4*mm; y: 10*mm
}
// Text {
// text: qsTr("Album")
// x: 4*mm; y: 10*mm
// }
Text {
text: qsTr("Image")
x: 4*mm; y: 17*mm
}
// Text {
// text: qsTr("Image")
// x: 4*mm; y: 17*mm
// }
Text {
text: qsTr("Description")
x: 4*mm; y: 33*mm
}
// Text {
// text: qsTr("Description")
// x: 4*mm; y: 33*mm
// }
ListView{
id: imageUploadView
x:23*mm
x:3*mm //23*mm
y:17*mm
width: imageDialog.width-25*mm
height: 25*mm
width: imageDialog.width-5*mm //25*mm
height: root.width/2 //25*mm
model: imageUploadModel
delegate: imageDelegate
footer: imageFooter
footer: imageId==""?imageFooter:null
clip:true
orientation: ListView.Horizontal
spacing: mm
}
BusyIndicator{
id: uploadBusy
running: false
anchors.horizontalCenter: imageUploadView.horizontalCenter
anchors.top:imageUploadView.top
anchors.topMargin: 2*mm
width:10*mm
height: 10*mm
}
ListModel{
id: imageUploadModel
}
@ -153,14 +185,15 @@ Rectangle{
Component{
id: imageDelegate
Rectangle{
width:Math.max(20*mm,descriptionInput.contentWidth)
height:20*mm
width:root.width/2 //Math.max(20*mm,descriptionInput.contentWidth)
height:imageUploadView.height-5*mm // 20*mm
Image{
id: uploadImage
width: 20*mm
height: 14*mm
width: root.width/2-mm //20*mm
height: imageUploadView.height-6*mm//height: 14*mm
fillMode: Image.PreserveAspectFit
source:imageUrl
onVisibleChanged: descriptionInput.focus=true;
MouseArea{
anchors.fill: parent
onClicked:{
@ -174,13 +207,19 @@ Rectangle{
Rectangle{
color: "light grey"
border.color: "grey"
x: mm; y: 15*mm; width:Math.max(20*mm, descriptionInput.contentWidth);
anchors.top: uploadImage.bottom
anchors.topMargin: mm
//x: mm; y: 15*mm;
width: root.width/2-mm //Math.max(root.width/2-mm, descriptionInput.contentWidth);
height: 5*mm;
TextInput {
TextField{
//TextInput {
id: descriptionInput
anchors.fill: parent
font.pixelSize: 3*mm
selectByMouse: true
text:description
placeholderText: qsTr("Description")
text:description!=""?description:""
onTextChanged: imageUploadModel.set(index,{"description":descriptionInput.text});
}
}
@ -190,13 +229,15 @@ Rectangle{
id: imageFooter
Image{
id: footerImage
width: 15*mm
height: 15*mm
height: root.width/4
width: root.width/4 //15*mm
//15*mm
fillMode: Image.PreserveAspectFit
source:"qrc:/images/addImage.png"
MouseArea{
anchors.fill: parent
onClicked:{
onClicked:{print(imagePicking)
imagePicking=true;
var imagePicker = Qt.createQmlObject('import QtQuick 2.0; import "qrc:/qml/genericqml";'+
osSettings.imagePickQml+'{multiple : false;onReady: {attachImageURLs.push(imageUrl);'+
'attachImage(imageUrl)}}',imageDialog,"imagePicker");
@ -207,7 +248,7 @@ Rectangle{
}
ComboBox{
id: album
x: 23*mm
x: 3*mm
y: 10*mm
width: root.width/2;
height: 5*mm;
@ -225,14 +266,14 @@ Rectangle{
BlueButton{
id:uploadButton
x:4*mm; y:40*mm
text: qsTr("Upload")
x:4*mm; y:root.width/2+18*mm //40*mm
text: imageId==""?qsTr("Upload"):qsTr("Change")
onClicked:{
//imageBusy.running=true;
if(album.currentText==""){Helperjs.showMessage(qsTr("Error"),qsTr(" No album name given"), imageDialog)}
else if (imageId!=""){uploadBusy.running=true; updateImage()}
else{newimageProgress.visible=true;
if (imageUploadModel.count>0){
uploadSelectedImage(0)
if (imageUploadModel.count>0){
uploadSelectedImage(0)
}}
}
}
@ -258,13 +299,4 @@ Rectangle{
for (var n in attachImageURLs){attachImage(attachImageURLs[n])}
}
}
// BusyIndicator{
// id: imageBusy
// anchors.horizontalCenter: imageUploadView.horizontalCenter
// anchors.top:imageUploadView.top
// anchors.topMargin: 2*mm
// width:10*mm
// height: 10*mm
// running:false
// }
}

View file

@ -29,8 +29,9 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.7
import QtQuick 2.5
import QtQuick.Controls 1.2
import "qrc:/qml/photoqml"
Package {
Item { id: stackItem; Package.name: 'stack'; z: stackItem.PathView.z;width:16.5*mm;height:16.5*mm}
@ -42,6 +43,7 @@ Package {
width: 16.5*mm; height: 16.5*mm
z: stackItem.PathView.z
property string hqphotolink: photoLink
property string imageId:""
Rectangle {
id: placeHolder
@ -82,7 +84,12 @@ Package {
MouseArea {
width: realImage.paintedWidth; height: realImage.paintedHeight; anchors.centerIn: realImage
onPressAndHold:{
var menuString="import QtQuick.Controls 1.4; Menu {MenuItem{text:qsTr('Delete on client and server'); onTriggered: {deletepics('image','"+imageLocation+"');photoModel.remove(index)}}}";
var menuString="import QtQuick 2.5;import QtQuick.Controls 1.4; "+
"Menu {MenuItem {text:qsTr('Delete on client and server'); onTriggered: {"+
"changeimage('delete','image','"+imageLocation+"');photoModel.remove(index)}}"+
"MenuItem {text:qsTr('Move to album'); onTriggered: {"+
"changeimage('update','image','"+imageId+"');}}"+
"}";
var imagemenuObject=Qt.createQmlObject(menuString,photoWrapper,"imagemenuOutput")
imagemenuObject.popup()
}

View file

@ -29,8 +29,8 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0
import QtQuick.Controls 1.2
import QtQuick 2.5
import QtQuick.Controls 1.4
import QtQml.Models 2.1
import "qrc:/js/image.js" as Imagejs
import "qrc:/js/helper.js" as Helperjs
@ -51,6 +51,7 @@ StackView{
property int currentimageno: 0
property bool remoteContact: false
onNewimagesChanged:{
if(fotorectangle.newimages.length>0){
//print("newimages "+JSON.stringify(newimages));
@ -104,6 +105,7 @@ StackView{
function showFotos(login,friend){
if(friend=="backButton"){
if (photoStack.depth>1){photoStack.pop()}
if(!albumgridview.currentItem){root.currentIndex=0}
if(albumgridview.currentItem.state=='fullscreen'){
albumgridview.currentItem.state = 'inGrid'}
@ -132,9 +134,17 @@ StackView{
}
}
function deletepics(type,url ,imageId){
Imagejs.deleteImage(db,login,type, url,filesystem,root,function(){//showFotos("")
})
function deletepics(method, type,id){
if(method=="delete"){Imagejs.deleteImage(db,login,type, id,filesystem,root,function(){//showFotos("")
})}
}
function updatepic(method,type,id){
if(method=="update"){
Helperjs.readData(db,"imageData",login.username,function(url){
photoStack.push({
item:"qrc:/qml/photoqml/ImageUploadDialog.qml",properties:{attachImageURLs:[url[0].location+url[0].filename],imageId:id,currentAlbum:url[0].album}
})
},"id",id)}
}
function uploadUrls(urls){
@ -159,7 +169,7 @@ StackView{
anchors.right:updatePhotolist.left
anchors.rightMargin:mm
text:"\uf0ee"
onClicked: {
onClicked: {print(root.imagePicking)
photoStack.push({item:"qrc:/qml/photoqml/ImageUploadDialog.qml",properties:{}});
// var component = Qt.createComponent("qrc:/qml/photoqml/ImageUploadDialog.qml");
// var imageUpload = component.createObject(fotorectangle);
@ -272,6 +282,8 @@ StackView{
Component.onCompleted: {
root.fotoSignal.connect(showFotos);
root.uploadSignal.connect(uploadUrls);
root.changeimage.connect(deletepics);
root.changeimage.connect(updatepic);
if (fotostab.phototabstatus=="Images"){showFotos(root.login,"")}
}
}

View file

@ -29,7 +29,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0
import QtQuick 2.5
import QtQuick.Controls 1.3
import QtQml.Models 2.1
//import "qrc:/js/service.js" as Service
@ -116,7 +116,7 @@ Package {
if (obj) {
for (var k=0;k<obj.length;k++){
if(typeof(obj[k].desc)=="string" && obj[k].desc!=""){var name=obj[k].desc}else{var name=obj[k].filename}
photoModel.append({"imageLocation": obj[k].location+obj[k].filename,"photoDescription":name,"photoLink":obj[k].location+obj[k].filename})
photoModel.append({"imageLocation": obj[k].location+obj[k].filename,"photoDescription":name,"photoLink":obj[k].location+obj[k].filename,"imageId":obj[k].id})
}
}
},"album",albumname)}