forked from cwtch.im/ui
Merge branch 'textfix' of cwtch.im/ui into master
This commit is contained in:
commit
68572a8cc0
|
@ -4,3 +4,5 @@ moc*
|
||||||
rcc*
|
rcc*
|
||||||
*.qmlc
|
*.qmlc
|
||||||
*.jsc
|
*.jsc
|
||||||
|
vendor/
|
||||||
|
tor/
|
||||||
|
|
21
main.go
21
main.go
|
@ -27,7 +27,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
log.SetLevel(log.LevelDebug)
|
log.SetLevel(log.LevelInfo)
|
||||||
|
|
||||||
// our globals
|
// our globals
|
||||||
gcd := gothings.NewGrandCentralDispatcher(nil)
|
gcd := gothings.NewGrandCentralDispatcher(nil)
|
||||||
|
@ -50,12 +50,13 @@ func main() {
|
||||||
app := gui.NewQGuiApplication(len(os.Args), os.Args)
|
app := gui.NewQGuiApplication(len(os.Args), os.Args)
|
||||||
app.SetWindowIcon(gui.NewQIcon5(":/qml/images/cwtch-icon.png"))
|
app.SetWindowIcon(gui.NewQIcon5(":/qml/images/cwtch-icon.png"))
|
||||||
|
|
||||||
// window construction boilerplate
|
core.QCoreApplication_SetAttribute(core.Qt__AA_EnableHighDpiScaling, true)
|
||||||
view := initializeQtView(qmlSource)
|
quickcontrols2.QQuickStyle_SetStyle("Universe")
|
||||||
|
engine := qml.NewQQmlApplicationEngine(nil)
|
||||||
|
|
||||||
// variables we want to access from inside qml
|
// variables we want to access from inside qml
|
||||||
view.RootContext().SetContextProperty("gcd", gcd)
|
engine.RootContext().SetContextProperty("gcd", gcd)
|
||||||
|
engine.Load(qmlSource)
|
||||||
|
|
||||||
acn, err := connectivity.StartTor(the.CwtchDir, "")
|
acn, err := connectivity.StartTor(the.CwtchDir, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -85,19 +86,11 @@ func main() {
|
||||||
//})
|
//})
|
||||||
return nam
|
return nam
|
||||||
})
|
})
|
||||||
view.SetNetworkAccessManagerFactory(factory)
|
engine.SetNetworkAccessManagerFactory(factory)
|
||||||
app.Exec()
|
app.Exec()
|
||||||
acn.Close()
|
acn.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
// window construction boilerplate
|
|
||||||
func initializeQtView(source *core.QUrl) *qml.QQmlApplicationEngine {
|
|
||||||
core.QCoreApplication_SetAttribute(core.Qt__AA_EnableHighDpiScaling, true)
|
|
||||||
quickcontrols2.QQuickStyle_SetStyle("Universe")
|
|
||||||
engine := qml.NewQQmlApplicationEngine(nil)
|
|
||||||
engine.Load(source)
|
|
||||||
return engine
|
|
||||||
}
|
|
||||||
|
|
||||||
// this is mostly going to get factored out when we add profile support
|
// this is mostly going to get factored out when we add profile support
|
||||||
// for now, it loads a single peer and fills the ui with its data
|
// for now, it loads a single peer and fills the ui with its data
|
||||||
|
|
|
@ -18,7 +18,6 @@ ColumnLayout {
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
text: parent.toolbar.text + " Bulletin Board"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TextField {
|
TextField {
|
||||||
|
@ -47,8 +46,8 @@ ColumnLayout {
|
||||||
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
contentWidth: bulletin.width
|
contentWidth: parent.width
|
||||||
contentHeight: bulletin.height
|
contentHeight: parent.height
|
||||||
boundsBehavior: Flickable.StopAtBounds
|
boundsBehavior: Flickable.StopAtBounds
|
||||||
maximumFlickVelocity: 800
|
maximumFlickVelocity: 800
|
||||||
|
|
||||||
|
@ -161,7 +160,6 @@ ColumnLayout {
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.rightMargin:10
|
anchors.rightMargin:10
|
||||||
onClicked: {
|
onClicked: {
|
||||||
console.log("REPLYING!!!")
|
|
||||||
gcd.broadcast("ResetMessagePane")
|
gcd.broadcast("ResetMessagePane")
|
||||||
theStack.pane = theStack.messagePane
|
theStack.pane = theStack.messagePane
|
||||||
gcd.loadMessagesPane(from)
|
gcd.loadMessagesPane(from)
|
||||||
|
|
|
@ -41,7 +41,7 @@ ColumnLayout {
|
||||||
var remove = -1
|
var remove = -1
|
||||||
for(var i=0;i<solutions.count;i++) {
|
for(var i=0;i<solutions.count;i++) {
|
||||||
var puzzleName = "Puzzle " + points
|
var puzzleName = "Puzzle " + points
|
||||||
console.log("Checking Solution " + puzzleName)
|
//console.log("Checking Solution " + puzzleName)
|
||||||
|
|
||||||
if (puzzleName == solutions.get(i).text) {
|
if (puzzleName == solutions.get(i).text) {
|
||||||
if (Utils.scorePath(JSON.parse(path)) < Utils.scorePath(JSON.parse(solutions.get(i).path))) {
|
if (Utils.scorePath(JSON.parse(path)) < Utils.scorePath(JSON.parse(solutions.get(i).path))) {
|
||||||
|
@ -54,7 +54,7 @@ ColumnLayout {
|
||||||
|
|
||||||
if (remove > -1) {
|
if (remove > -1) {
|
||||||
solutions.remove(remove)
|
solutions.remove(remove)
|
||||||
console.log("Better solution found for Puzzle " + "Puzzle " + JSON.stringify(msg.s))
|
//console.log("Better solution found for Puzzle " + "Puzzle " + JSON.stringify(msg.s))
|
||||||
|
|
||||||
}
|
}
|
||||||
solutions.insert(0,{
|
solutions.insert(0,{
|
||||||
|
@ -85,9 +85,9 @@ ColumnLayout {
|
||||||
textRole: "text"
|
textRole: "text"
|
||||||
model: solutions
|
model: solutions
|
||||||
onActivated: {
|
onActivated: {
|
||||||
console.log("Loading puzzle " + index)
|
//console.log("Loading puzzle " + index)
|
||||||
var solution = solutions.get(index)
|
var solution = solutions.get(index)
|
||||||
console.log("Loading puzzle " + JSON.parse(solution.path))
|
//console.log("Loading puzzle " + JSON.parse(solution.path))
|
||||||
canvas.points = JSON.parse(solution.points)
|
canvas.points = JSON.parse(solution.points)
|
||||||
canvas.path = JSON.parse(solution.path)
|
canvas.path = JSON.parse(solution.path)
|
||||||
gameScore.text = Utils.scorePath(canvas.path)
|
gameScore.text = Utils.scorePath(canvas.path)
|
||||||
|
@ -114,12 +114,6 @@ ColumnLayout {
|
||||||
property int nextMessageID: 1
|
property int nextMessageID: 1
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
/**if (newposttitle.text != "" && newpostbody.text != "") {
|
|
||||||
var msg = JSON.stringify({"o":2, "t":newposttitle.text, "b":newpostbody.text})
|
|
||||||
gcd.sendMessage(msg, nextMessageID++)
|
|
||||||
}
|
|
||||||
newposttitle.text = ""
|
|
||||||
newpostbody.text = ""**/
|
|
||||||
canvas.points = []
|
canvas.points = []
|
||||||
canvas.path = []
|
canvas.path = []
|
||||||
gameScore.text = 0
|
gameScore.text = 0
|
||||||
|
@ -147,7 +141,6 @@ ColumnLayout {
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
for(var i=0;i<5;i++) {
|
for(var i=0;i<5;i++) {
|
||||||
points.push(Utils.getRandomInt(0,256))
|
points.push(Utils.getRandomInt(0,256))
|
||||||
console.log("POINTS" + points)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,12 +191,12 @@ ColumnLayout {
|
||||||
var point = (mymouse.arrpoints["x"]*16)+mymouse.arrpoints["y"]
|
var point = (mymouse.arrpoints["x"]*16)+mymouse.arrpoints["y"]
|
||||||
var inPoints = Utils.isGridOccupied(mymouse.arrpoints["x"], mymouse.arrpoints["y"], canvas.points)
|
var inPoints = Utils.isGridOccupied(mymouse.arrpoints["x"], mymouse.arrpoints["y"], canvas.points)
|
||||||
|
|
||||||
console.log("Checking Point " + point + " in path " + inPoints + " path length is " + canvas.path.length)
|
//console.log("Checking Point " + point + " in path " + inPoints + " path length is " + canvas.path.length)
|
||||||
if (inPoints == true) {
|
if (inPoints == true) {
|
||||||
var alreadyInPath = false
|
var alreadyInPath = false
|
||||||
for(var i=0;i<canvas.path.length;i++) {
|
for(var i=0;i<canvas.path.length;i++) {
|
||||||
if (canvas.path[i] == point) {
|
if (canvas.path[i] == point) {
|
||||||
console.log("Point already in path!!")
|
//console.log("Point already in path!!")
|
||||||
|
|
||||||
alreadyInPath = true
|
alreadyInPath = true
|
||||||
}
|
}
|
||||||
|
@ -211,7 +204,7 @@ ColumnLayout {
|
||||||
|
|
||||||
if (alreadyInPath == false) {
|
if (alreadyInPath == false) {
|
||||||
canvas.path.push(point)
|
canvas.path.push(point)
|
||||||
console.log("Pushing " + point + " to path" + canvas.path)
|
//console.log("Pushing " + point + " to path" + canvas.path)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
canvas.path = []
|
canvas.path = []
|
||||||
|
|
|
@ -17,7 +17,6 @@ ColumnLayout {
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
text: parent.toolbar.text + " Lists"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TextField {
|
TextField {
|
||||||
|
@ -46,8 +45,8 @@ ColumnLayout {
|
||||||
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
contentWidth: bulletin.width
|
contentWidth: parent.width
|
||||||
contentHeight: bulletin.height
|
contentHeight: parent.height
|
||||||
boundsBehavior: Flickable.StopAtBounds
|
boundsBehavior: Flickable.StopAtBounds
|
||||||
maximumFlickVelocity: 800
|
maximumFlickVelocity: 800
|
||||||
|
|
||||||
|
@ -80,8 +79,6 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(msg.c != undefined) {
|
if(msg.c != undefined) {
|
||||||
console.log("Checking off " + msg.c)
|
|
||||||
console.log(jsonModel4.get(msg.c).title)
|
|
||||||
jsonModel4.get(msg.c).complete = true
|
jsonModel4.get(msg.c).complete = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +117,6 @@ ColumnLayout {
|
||||||
RowLayout {
|
RowLayout {
|
||||||
CheckBox {
|
CheckBox {
|
||||||
checked: complete
|
checked: complete
|
||||||
checkedState: complete ? Qt.Checked : Qt.UnChecked
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
var msg = JSON.stringify({"o":4, "c":index})
|
var msg = JSON.stringify({"o":4, "c":index})
|
||||||
gcd.sendMessage(msg, btnSend.nextMessageID++)
|
gcd.sendMessage(msg, btnSend.nextMessageID++)
|
||||||
|
|
|
@ -51,10 +51,4 @@ ColumnLayout { // settingsPane
|
||||||
}
|
}
|
||||||
|
|
||||||
}//end of column with padding
|
}//end of column with padding
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -32,10 +32,7 @@ function scorePath(path) {
|
||||||
var pathLength = 0
|
var pathLength = 0
|
||||||
for (var i=0;i<path.length-1;i++) {
|
for (var i=0;i<path.length-1;i++) {
|
||||||
pathLength += distance(path[i],path[i+1])
|
pathLength += distance(path[i],path[i+1])
|
||||||
console.log("Path Length:" + pathLength)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return ""+pathLength
|
return ""+pathLength
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ Rectangle {
|
||||||
Image {
|
Image {
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
id: ico
|
id: ico
|
||||||
source: "qrc:/qml/images/fontawesome/"+icon+".svg"
|
source: "qrc:/qml/images/fontawesome/"+(icon!=""?icon:"regular/window-maximize")+".svg"
|
||||||
height: button.height / 2
|
height: button.height / 2
|
||||||
sourceSize.height: button.height / 2
|
sourceSize.height: button.height / 2
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue