Version 0.004
This commit is contained in:
parent
10dccdcdbb
commit
438f8a4e4d
64 changed files with 2736 additions and 636 deletions
|
@ -1,4 +1,4 @@
|
|||
import QtQuick 2.0
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Dialogs 1.2
|
||||
import QtQuick.Controls 1.2
|
||||
import "qrc:/js/service.js" as Service
|
||||
|
@ -15,13 +15,18 @@ StackView{
|
|||
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:[]
|
||||
|
||||
function setServericon(server){
|
||||
try {Helperjs.friendicaWebRequest(server+"/api/statusnet/config",configBackground, function (obj){
|
||||
var serverdata = JSON.parse(obj);
|
||||
servericon.source=serverdata.site.logo})} catch(e){print(e)}
|
||||
}
|
||||
BlueButton{
|
||||
id:userButton
|
||||
text:qsTr("User")
|
||||
|
@ -35,6 +40,7 @@ StackView{
|
|||
"'; onTriggered: {Service.readConfig(db,function(obj){
|
||||
userButton.text=obj.username;
|
||||
servername.text=obj.server;
|
||||
configBackground.setServericon(obj.server);
|
||||
username.text= obj.username;
|
||||
password.text=Qt.atob(obj.password);
|
||||
imagestore.text=obj.imagestore;
|
||||
|
@ -49,37 +55,51 @@ StackView{
|
|||
}
|
||||
|
||||
Text {
|
||||
text: "Server"
|
||||
text: qsTr("Server")
|
||||
x: 4*mm; y: 10*mm
|
||||
}
|
||||
Text {
|
||||
text: "User"
|
||||
text: qsTr("User")
|
||||
x: 4*mm; y: 20*mm
|
||||
}
|
||||
|
||||
Text {
|
||||
text: "Password"
|
||||
text: qsTr("Password")
|
||||
x: 4*mm; y: 30*mm
|
||||
}
|
||||
Text {
|
||||
text: "Image dir."
|
||||
text: qsTr("Image dir.")
|
||||
x: 4*mm; y: 40*mm
|
||||
}
|
||||
|
||||
Text {
|
||||
text: "Max. News"
|
||||
text: qsTr("Max. News")
|
||||
x: 4*mm; y: 50*mm
|
||||
}
|
||||
Text {
|
||||
text: "News as"
|
||||
text: qsTr("News as")
|
||||
x: 4*mm; y: 60*mm
|
||||
}
|
||||
Text {
|
||||
text: "Interval (0=None)"
|
||||
text: qsTr("Interval (0=None)")
|
||||
visible: false
|
||||
x: 4*mm; y: 70*mm; width:20*mm;wrapMode: Text.Wrap
|
||||
}
|
||||
|
||||
Image{
|
||||
id:servericon
|
||||
x:19*mm;y:10*mm
|
||||
width:5*mm; height: 5*mm
|
||||
source:""
|
||||
MouseArea{
|
||||
anchors.fill:parent
|
||||
onClicked:{
|
||||
Service.showServerConfig(servername.text, configBackground, function(configString){
|
||||
var serverconfigObject=Qt.createQmlObject(configString,configBackground,"serverconfigOutput");})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle{color: "light grey"; x: 25*mm; y: 10*mm; width: root.width/2; height: 5*mm;}
|
||||
Flickable {
|
||||
id: servernameFlickable
|
||||
|
@ -93,9 +113,13 @@ StackView{
|
|||
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:{}
|
||||
onEditingFinished:{
|
||||
if((servername.text).substring(0,14) =="https://...http"){
|
||||
serverstring.text= (serverstring.text).substring(11)
|
||||
}
|
||||
|
||||
configBackground.setServericon(servername.text)
|
||||
}
|
||||
onCursorRectangleChanged: Layoutjs.ensureVisibility(cursorRectangle,servernameFlickable)
|
||||
}
|
||||
}
|
||||
|
@ -134,9 +158,11 @@ StackView{
|
|||
}
|
||||
}
|
||||
Slider{ id: maxNews
|
||||
x:37*mm; y: 50*mm;width: root.width/3;height:5*mm
|
||||
minimumValue: 0;maximumValue:100000; stepSize: 1000
|
||||
x:34*mm; y: 50*mm;width: root.width/3;height:5*mm
|
||||
minimumValue: 0;maximumValue:2000; stepSize: 100
|
||||
}
|
||||
|
||||
|
||||
Rectangle{color: "light grey"; x: 25*mm; y: 50*mm; width: 9*mm; height: 5*mm;
|
||||
TextEdit{id:maxNewsText;
|
||||
anchors.fill: parent
|
||||
|
@ -199,13 +225,12 @@ StackView{
|
|||
|
||||
|
||||
BlueButton {
|
||||
x: 25*mm; y: 80*mm
|
||||
text: "Confirm"
|
||||
x: 25*mm; y: 78*mm
|
||||
text: qsTr("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!")}
|
||||
|
@ -228,11 +253,6 @@ StackView{
|
|||
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;
|
||||
|
@ -252,6 +272,7 @@ StackView{
|
|||
filesystem.Directory=imagestore.text+"albums";
|
||||
filesystem.rmDir();
|
||||
servername.text="https://...";
|
||||
servericon.source="";
|
||||
username.text="";
|
||||
password.text="";
|
||||
imagestore.text="";
|
||||
|
@ -272,6 +293,7 @@ StackView{
|
|||
text: "+"
|
||||
onClicked:{
|
||||
servername.text="https://..."
|
||||
servericon.source="";
|
||||
username.text=""
|
||||
password.text=""
|
||||
imagestore.text=""
|
||||
|
@ -297,8 +319,8 @@ StackView{
|
|||
onTriggered: {newsTypeField.text="Timeline"}
|
||||
}
|
||||
MenuItem {
|
||||
text: qsTr("Tree")
|
||||
onTriggered: {newsTypeField.text="Tree"}
|
||||
text: qsTr("Conversations")
|
||||
onTriggered: {newsTypeField.text="Conversations"}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -311,6 +333,7 @@ StackView{
|
|||
Service.readConfig(db,function(obj){
|
||||
userButton.text=obj.username;
|
||||
servername.text=obj.server;
|
||||
configBackground.setServericon(obj.server);
|
||||
username.text= obj.username;
|
||||
password.text=Qt.atob(obj.password);
|
||||
imagestore.text=obj.imagestore;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue