From da41f0c515c6d95d107d961bdfd79f03115277c6 Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Tue, 12 Feb 2019 20:10:46 -0800 Subject: [PATCH] Cleanup --- .gitignore | 2 ++ main.go | 21 +++++++-------------- qml/overlays/BulletinOverlay.qml | 6 ++---- qml/overlays/Game1Overlay.qml | 21 +++++++-------------- qml/overlays/ListOverlay.qml | 8 ++------ qml/panes/AddGroupPane.qml | 6 ------ qml/utils.js | 3 --- qml/widgets/SimpleButton.qml | 2 +- 8 files changed, 21 insertions(+), 48 deletions(-) diff --git a/.gitignore b/.gitignore index be88cd4..1d78428 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ moc* rcc* *.qmlc *.jsc +vendor/ +tor/ diff --git a/main.go b/main.go index c151903..ac6abb7 100644 --- a/main.go +++ b/main.go @@ -27,7 +27,7 @@ func init() { } func main() { - log.SetLevel(log.LevelDebug) + log.SetLevel(log.LevelInfo) // our globals gcd := gothings.NewGrandCentralDispatcher(nil) @@ -50,12 +50,13 @@ func main() { app := gui.NewQGuiApplication(len(os.Args), os.Args) app.SetWindowIcon(gui.NewQIcon5(":/qml/images/cwtch-icon.png")) - // window construction boilerplate - view := initializeQtView(qmlSource) + core.QCoreApplication_SetAttribute(core.Qt__AA_EnableHighDpiScaling, true) + quickcontrols2.QQuickStyle_SetStyle("Universe") + engine := qml.NewQQmlApplicationEngine(nil) // 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, "") if err != nil { @@ -85,19 +86,11 @@ func main() { //}) return nam }) - view.SetNetworkAccessManagerFactory(factory) + engine.SetNetworkAccessManagerFactory(factory) app.Exec() 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 // for now, it loads a single peer and fills the ui with its data diff --git a/qml/overlays/BulletinOverlay.qml b/qml/overlays/BulletinOverlay.qml index 06a37fc..5ac875d 100644 --- a/qml/overlays/BulletinOverlay.qml +++ b/qml/overlays/BulletinOverlay.qml @@ -18,7 +18,6 @@ ColumnLayout { Text { Layout.fillWidth: true - text: parent.toolbar.text + " Bulletin Board" } TextField { @@ -47,8 +46,8 @@ ColumnLayout { Layout.alignment: Qt.AlignLeft | Qt.AlignTop Layout.fillHeight: true Layout.fillWidth: true - contentWidth: bulletin.width - contentHeight: bulletin.height + contentWidth: parent.width + contentHeight: parent.height boundsBehavior: Flickable.StopAtBounds maximumFlickVelocity: 800 @@ -161,7 +160,6 @@ ColumnLayout { anchors.right: parent.right anchors.rightMargin:10 onClicked: { - console.log("REPLYING!!!") gcd.broadcast("ResetMessagePane") theStack.pane = theStack.messagePane gcd.loadMessagesPane(from) diff --git a/qml/overlays/Game1Overlay.qml b/qml/overlays/Game1Overlay.qml index 5f2e846..e9b9523 100644 --- a/qml/overlays/Game1Overlay.qml +++ b/qml/overlays/Game1Overlay.qml @@ -41,7 +41,7 @@ ColumnLayout { var remove = -1 for(var i=0;i -1) { 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,{ @@ -85,9 +85,9 @@ ColumnLayout { textRole: "text" model: solutions onActivated: { - console.log("Loading puzzle " + index) + //console.log("Loading puzzle " + 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.path = JSON.parse(solution.path) gameScore.text = Utils.scorePath(canvas.path) @@ -114,12 +114,6 @@ ColumnLayout { property int nextMessageID: 1 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.path = [] gameScore.text = 0 @@ -147,7 +141,6 @@ ColumnLayout { Component.onCompleted: { for(var i=0;i<5;i++) { 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 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) { var alreadyInPath = false for(var i=0;i zoomSlider.to) zoomSlider.value = zoomSlider.to - } } \ No newline at end of file diff --git a/qml/utils.js b/qml/utils.js index f045284..1a20069 100644 --- a/qml/utils.js +++ b/qml/utils.js @@ -32,10 +32,7 @@ function scorePath(path) { var pathLength = 0 for (var i=0;i