forked from cwtch.im/ui
initial commit
This commit is contained in:
parent
1011d4a4f9
commit
b3ef6f91ee
8
gcd.go
8
gcd.go
|
@ -15,7 +15,8 @@ var TIME_FORMAT = "Mon 3:04pm"
|
||||||
type GrandCentralDispatcher struct {
|
type GrandCentralDispatcher struct {
|
||||||
core.QObject
|
core.QObject
|
||||||
|
|
||||||
currentOpenConversation string
|
currentOpenConversation string `property:"currentOpenConversation"`
|
||||||
|
themeScale float32 `property:"themeScale"`
|
||||||
|
|
||||||
// messages pane stuff
|
// messages pane stuff
|
||||||
_ func(from, message, displayname string, mID uint, ts, source string) `signal:"AppendMessage"`
|
_ func(from, message, displayname string, mID uint, ts, source string) `signal:"AppendMessage"`
|
||||||
|
@ -133,6 +134,11 @@ func (this *GrandCentralDispatcher) broadcast(signal string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *GrandCentralDispatcher) importString(str string) {
|
func (this *GrandCentralDispatcher) importString(str string) {
|
||||||
|
if len(str) < 5 {
|
||||||
|
log.Printf("ignoring short string")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
log.Printf("importing: %s\n", str)
|
log.Printf("importing: %s\n", str)
|
||||||
onion := str
|
onion := str
|
||||||
name := onion
|
name := onion
|
||||||
|
|
11
main.go
11
main.go
|
@ -22,7 +22,7 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"cwtch.im/cwtch/model"
|
"cwtch.im/cwtch/model"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
)
|
)
|
||||||
|
|
||||||
var gcd *GrandCentralDispatcher
|
var gcd *GrandCentralDispatcher
|
||||||
|
|
||||||
|
@ -242,7 +242,7 @@ func andHisBlackAndWhiteCat(incomingMessages chan Message) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func initialize(view *quick.QQuickView) {
|
func initialize(view *quick.QQuickView) {
|
||||||
log.Printf(os.Args[0])
|
var err error
|
||||||
//TODO: this section is ported over and has a lot of printf errors, need to show them in the ui
|
//TODO: this section is ported over and has a lot of printf errors, need to show them in the ui
|
||||||
var dirname, filename string
|
var dirname, filename string
|
||||||
if os.Getenv("CWTCH_FOLDER") != "" {
|
if os.Getenv("CWTCH_FOLDER") != "" {
|
||||||
|
@ -258,8 +258,13 @@ func initialize(view *quick.QQuickView) {
|
||||||
filename = path.Join(dirname, "keep-this-file-private")
|
filename = path.Join(dirname, "keep-this-file-private")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*_, err := app2.NewApp(dirname, "/data/data/org.qtproject.example.go/lib/libtor.so")
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("ERROR CREATING CWTCH APP: %v", err)
|
||||||
|
}
|
||||||
|
time.Sleep(time.Second * 10)
|
||||||
|
*/
|
||||||
os.MkdirAll(dirname, 0700)
|
os.MkdirAll(dirname, 0700)
|
||||||
var err error
|
|
||||||
peer, err = libpeer.LoadCwtchPeer(filename, "be gay do crime")
|
peer, err = libpeer.LoadCwtchPeer(filename, "be gay do crime")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("couldn't load your config file, attempting to create a new one now")
|
fmt.Println("couldn't load your config file, attempting to create a new one now")
|
||||||
|
|
37
qml/main.qml
37
qml/main.qml
|
@ -3,6 +3,7 @@ import QtQuick 2.7
|
||||||
import QtQuick.Controls 2.4
|
import QtQuick.Controls 2.4
|
||||||
import QtQuick.Controls.Material 2.0
|
import QtQuick.Controls.Material 2.0
|
||||||
import QtQuick.Layouts 1.3
|
import QtQuick.Layouts 1.3
|
||||||
|
import QtQuick.Window 2.11
|
||||||
|
|
||||||
import "fonts/Twemoji.js" as T
|
import "fonts/Twemoji.js" as T
|
||||||
import "widgets"
|
import "widgets"
|
||||||
|
@ -42,6 +43,10 @@ Item {
|
||||||
return newtext
|
return newtext
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function scale() {
|
||||||
|
return 0.1 + 2 * zoomSlider.value
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Rectangle { // THE TOOLBAR
|
/* Rectangle { // THE TOOLBAR
|
||||||
id: toolbar
|
id: toolbar
|
||||||
|
@ -145,7 +150,37 @@ Item {
|
||||||
aux.visible: false
|
aux.visible: false
|
||||||
}
|
}
|
||||||
|
|
||||||
Label { text: "welcome to the global app settings page!" }
|
ScalingLabel {
|
||||||
|
Layout.maximumWidth: parent.width
|
||||||
|
text: "welcome to the global app settings page!"
|
||||||
|
}
|
||||||
|
|
||||||
|
Slider {
|
||||||
|
id: zoomSlider
|
||||||
|
from: 0.5
|
||||||
|
to: 1.6
|
||||||
|
}
|
||||||
|
|
||||||
|
ScalingLabel {
|
||||||
|
text: "Large text"
|
||||||
|
size: 20
|
||||||
|
}
|
||||||
|
|
||||||
|
ScalingLabel{
|
||||||
|
text: "Default size text, scale factor: " + zoomSlider.value
|
||||||
|
}
|
||||||
|
|
||||||
|
ScalingLabel {
|
||||||
|
text: "Small text"
|
||||||
|
size: 8
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
zoomSlider.value = Screen.pixelDensity / 3.2 // artistic license. set by erinn. fight me before changing
|
||||||
|
if (zoomSlider.value < zoomSlider.from) zoomSlider.value = zoomSlider.from
|
||||||
|
if (zoomSlider.value > zoomSlider.to) zoomSlider.value = zoomSlider.to
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ColumnLayout { // userProfilePane
|
ColumnLayout { // userProfilePane
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
import QtGraphicalEffects 1.0
|
|
||||||
import QtQuick 2.7
|
|
||||||
import QtQuick.Controls 2.4
|
|
||||||
import QtQuick.Controls.Material 2.0
|
|
||||||
import QtQuick.Layouts 1.3
|
|
||||||
|
|
||||||
SimpleButton {
|
|
||||||
id: root
|
|
||||||
font: "FontAwesome"
|
|
||||||
text: icon + (label == "" ? "" : " " + label)
|
|
||||||
|
|
||||||
property string icon
|
|
||||||
property string label
|
|
||||||
}
|
|
|
@ -41,8 +41,12 @@ RowLayout {
|
||||||
|
|
||||||
Rectangle { // THIS IS JUST A PRETTY MESSAGE-HOLDING RECTANGLE
|
Rectangle { // THIS IS JUST A PRETTY MESSAGE-HOLDING RECTANGLE
|
||||||
id: rectMessageBubble
|
id: rectMessageBubble
|
||||||
height: lbl.height + ts.height + 4
|
height: lbl.height + ts.height + 8
|
||||||
|
Layout.minimumHeight: height
|
||||||
|
Layout.maximumHeight: height
|
||||||
width: colMessageBubble.width + 6
|
width: colMessageBubble.width + 6
|
||||||
|
Layout.minimumWidth: width
|
||||||
|
Layout.maximumWidth: width
|
||||||
color: from == "me" ? "#B09CBC" : "#4B3557"
|
color: from == "me" ? "#B09CBC" : "#4B3557"
|
||||||
radius: 5
|
radius: 5
|
||||||
|
|
||||||
|
@ -99,15 +103,13 @@ RowLayout {
|
||||||
leftPadding: 10
|
leftPadding: 10
|
||||||
}
|
}
|
||||||
|
|
||||||
Label { text: dummy.width+", "+root.width }
|
|
||||||
|
|
||||||
Label { // MESSAGE ACKNOWLEDGMENT
|
Label { // MESSAGE ACKNOWLEDGMENT
|
||||||
id: ack
|
id: ack
|
||||||
color: "#FFFFFF"
|
color: "#FFFFFF"
|
||||||
font.pixelSize: 10
|
font.pixelSize: 10
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
font.family: "FontAwesome"
|
font.family: "FontAwesome"
|
||||||
text: from == "me" ? awesome.icons.fa_ellipsis_h : displayname
|
text: from == "me" ? (awesome.loaded ? awesome.icons.fa_ellipsis_h : "") : displayname
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,8 +87,9 @@ ColumnLayout {
|
||||||
RowLayout { // THE BOTTOM DRAWER
|
RowLayout { // THE BOTTOM DRAWER
|
||||||
Rectangle { // MESSAGE ENTRY TEXTFIELD
|
Rectangle { // MESSAGE ENTRY TEXTFIELD
|
||||||
id: rectMessage
|
id: rectMessage
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: 40 * zoomSlider.value
|
||||||
height: 40
|
Layout.minimumHeight: 40 * zoomSlider.value
|
||||||
|
//height: 40 * zoomSlider.value
|
||||||
color: "#EDEDED"
|
color: "#EDEDED"
|
||||||
border.color: "#AAAAAA"
|
border.color: "#AAAAAA"
|
||||||
radius: 10
|
radius: 10
|
||||||
|
@ -194,14 +195,17 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
|
id: colRight
|
||||||
spacing: 1
|
spacing: 1
|
||||||
|
|
||||||
|
|
||||||
IconButton { // SEND MESSAGE BUTTON
|
SimpleButton { // SEND MESSAGE BUTTON
|
||||||
id: btnSend
|
id: btnSend
|
||||||
icon: awesome.icons.fa_paper_plane
|
icon: "regular/paper-plane"
|
||||||
label: "send"
|
text: "send"
|
||||||
width: btnEmoji.width + btnAttach.width + 1
|
Layout.minimumWidth: btnEmoji.width + btnAttach.width + 1
|
||||||
|
Layout.maximumWidth: btnEmoji.width + btnAttach.width + 1
|
||||||
|
|
||||||
property int nextMessageID: 1
|
property int nextMessageID: 1
|
||||||
|
|
||||||
TextEdit {
|
TextEdit {
|
||||||
|
@ -225,17 +229,18 @@ ColumnLayout {
|
||||||
|
|
||||||
SimpleButton { // EMOJI DRAWER BUTTON
|
SimpleButton { // EMOJI DRAWER BUTTON
|
||||||
id: btnEmoji
|
id: btnEmoji
|
||||||
text: awesome.icons.fa_smile_o
|
icon: "regular/smile"
|
||||||
font: "FontAwesome"
|
|
||||||
|
|
||||||
onClicked: gcd.popup("emoji not yet implemented, sorry")
|
onClicked: gcd.popup("emoji not yet implemented, sorry")
|
||||||
}
|
}
|
||||||
|
|
||||||
IconButton {
|
SimpleButton {
|
||||||
id: btnAttach
|
id: btnAttach
|
||||||
icon: awesome.icons.fa_paperclip
|
icon: "solid/paperclip"
|
||||||
|
|
||||||
onClicked: gcd.popup("attachments not yet implemented, sorry")
|
onClicked: {
|
||||||
|
gcd.popup("attachments not yet implemented, sorry")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import QtQuick.Controls 2.4
|
||||||
import QtQuick.Controls.Material 2.0
|
import QtQuick.Controls.Material 2.0
|
||||||
import QtQuick.Controls.Styles 1.4
|
import QtQuick.Controls.Styles 1.4
|
||||||
import QtQuick.Layouts 1.3
|
import QtQuick.Layouts 1.3
|
||||||
|
import QtQuick.Window 2.11
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: root
|
id: root
|
||||||
|
@ -146,8 +147,9 @@ ColumnLayout {
|
||||||
text: "This is your address. You can give it out to people!\n" + onion
|
text: "This is your address. You can give it out to people!\n" + onion
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout { // TOOLS FOR EDITING PROFILE
|
Row { // TOOLS FOR EDITING PROFILE
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
spacing: zoomSlider.value * 2
|
||||||
|
|
||||||
|
|
||||||
TextEdit { // USED TO POWER THE COPY/PASTE BUTTON
|
TextEdit { // USED TO POWER THE COPY/PASTE BUTTON
|
||||||
|
@ -155,9 +157,9 @@ ColumnLayout {
|
||||||
visible: false
|
visible: false
|
||||||
}
|
}
|
||||||
|
|
||||||
IconButton { // COPY ONION ADDRESS BUTTON
|
SimpleButton { // COPY ONION ADDRESS BUTTON
|
||||||
icon: awesome.icons.fa_clipboard
|
icon: "regular/clipboard"
|
||||||
label: "copy"
|
text: "copy"
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
gcd.popup("copied to clipboard!")
|
gcd.popup("copied to clipboard!")
|
||||||
|
@ -167,16 +169,14 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IconButton { // SETTINGS BUTTON
|
SimpleButton { // SETTINGS BUTTON
|
||||||
icon: awesome.icons.fa_cog
|
icon: "solid/cog"
|
||||||
//label: "settings"
|
|
||||||
|
|
||||||
onClicked: theStack.pane = theStack.settingsPane
|
onClicked: theStack.pane = theStack.settingsPane
|
||||||
}
|
}
|
||||||
|
|
||||||
IconButton { // SIGN OUT BUTTON
|
SimpleButton { // SIGN OUT BUTTON
|
||||||
icon: awesome.icons.fa_sign_out
|
icon: "solid/sign-out-alt"
|
||||||
//label: "sign out"
|
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
gcd.popup("not yet implemented, sorry :(")
|
gcd.popup("not yet implemented, sorry :(")
|
||||||
|
@ -207,6 +207,7 @@ ColumnLayout {
|
||||||
color: "#888888"
|
color: "#888888"
|
||||||
padding: 2
|
padding: 2
|
||||||
text: hint
|
text: hint
|
||||||
|
selectByMouse: true
|
||||||
|
|
||||||
onTextChanged: {
|
onTextChanged: {
|
||||||
if (text != hint && text != "") {
|
if (text != hint && text != "") {
|
||||||
|
|
Binary file not shown.
|
@ -1,36 +1,68 @@
|
||||||
import QtQuick 2.0
|
import QtGraphicalEffects 1.0
|
||||||
|
import QtQuick 2.7
|
||||||
|
import QtQuick.Controls 2.4
|
||||||
|
import QtQuick.Controls.Material 2.0
|
||||||
|
import QtQuick.Layouts 1.3
|
||||||
|
|
||||||
|
import "controls" as Awesome
|
||||||
|
import "../fonts/Twemoji.js" as T
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: button
|
id: button
|
||||||
width: buttonText.width + 20
|
width: (text == undefined || text == "" ? 0 : buttonText.width) + (icon == undefined || icon == "" ? 0 : ico.width) + 24 * zoomSlider.value
|
||||||
height: 20
|
Layout.minimumWidth: width
|
||||||
color: "#4B3557"
|
Layout.maximumWidth: width
|
||||||
//border.color: focus ? "#BBBBBB" : "#AAAAAA"
|
height: 20 * zoomSlider.value
|
||||||
//border.width: 1
|
Layout.minimumHeight: height
|
||||||
|
Layout.maximumHeight: height
|
||||||
|
color: mousedown ? "#B09CBC" : "#4B3557"
|
||||||
|
border.color: "#4B3557"
|
||||||
|
border.width: 1
|
||||||
radius: 2
|
radius: 2
|
||||||
antialiasing: true
|
antialiasing: true
|
||||||
|
|
||||||
property bool checked: false
|
property bool checked: false
|
||||||
property alias text: buttonText.text
|
property alias text: buttonText.text
|
||||||
property alias font: buttonText.font.family
|
property alias font: buttonText.font.family
|
||||||
|
property string icon
|
||||||
|
property bool mousedown
|
||||||
signal clicked
|
signal clicked
|
||||||
|
|
||||||
|
|
||||||
Text {
|
RowLayout {
|
||||||
id: buttonText
|
anchors.centerIn: parent
|
||||||
anchors.centerIn: parent
|
|
||||||
font.pixelSize: parent.height * .5
|
Image {
|
||||||
color: "#FFFFFF"
|
anchors.left: parent.left
|
||||||
}
|
id: ico
|
||||||
|
source: "qrc:/qml/images/fontawesome/"+icon+".svg"
|
||||||
|
height: button.height / 2
|
||||||
|
sourceSize.height: button.height / 2
|
||||||
|
}
|
||||||
|
|
||||||
|
Label {
|
||||||
|
id: buttonText
|
||||||
|
font.pixelSize: button.height / 2
|
||||||
|
color: "#FFFFFF"
|
||||||
|
anchors.left: ico.right
|
||||||
|
anchors.leftMargin: 6
|
||||||
|
visible: button.text != "" && button.text != undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: mouseArea
|
id: mouseArea
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
parent.focus = true
|
parent.focus = true
|
||||||
parent.clicked()
|
parent.clicked()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onPressed: mousedown = true
|
||||||
|
|
||||||
|
onReleased: mousedown = false
|
||||||
}
|
}
|
||||||
|
|
||||||
Keys.onSpacePressed: clicked()
|
Keys.onSpacePressed: clicked()
|
||||||
|
|
Binary file not shown.
|
@ -12,7 +12,9 @@ Rectangle { // OVERHEAD BAR ON STACK PANE
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
height: 28
|
height: 20 * zoomSlider.value//btnAux.height + 4
|
||||||
|
Layout.minimumHeight: height
|
||||||
|
Layout.maximumHeight: height
|
||||||
color: "#EDEDED"
|
color: "#EDEDED"
|
||||||
|
|
||||||
property alias text: lbl.text
|
property alias text: lbl.text
|
||||||
|
@ -20,9 +22,9 @@ Rectangle { // OVERHEAD BAR ON STACK PANE
|
||||||
property alias back: btnBack
|
property alias back: btnBack
|
||||||
|
|
||||||
|
|
||||||
IconButton {// BACK BUTTON
|
SimpleButton {// BACK BUTTON
|
||||||
id: btnBack
|
id: btnBack
|
||||||
icon: awesome.icons.fa_arrow_circle_o_left
|
icon: "solid/arrow-circle-left"
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
anchors.leftMargin: 6
|
anchors.leftMargin: 6
|
||||||
|
@ -31,19 +33,18 @@ Rectangle { // OVERHEAD BAR ON STACK PANE
|
||||||
onClicked: theStack.pane = theStack.emptyPane
|
onClicked: theStack.pane = theStack.emptyPane
|
||||||
}
|
}
|
||||||
|
|
||||||
Label { // TEXT
|
ScalingLabel { // TEXT
|
||||||
id: lbl
|
id: lbl
|
||||||
font.pixelSize: 16
|
|
||||||
text: "Sarah Jamie Lewis"
|
text: "Sarah Jamie Lewis"
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
IconButton { // COG BUTTON
|
SimpleButton { // COG BUTTON
|
||||||
id: btnAux
|
id: btnAux
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.rightMargin: 6
|
anchors.rightMargin: 6
|
||||||
icon: awesome.icons.fa_cog
|
icon: "solid/cog"
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue