From c9cc1e688b874036329e208012ba4e41f0d2a9d4 Mon Sep 17 00:00:00 2001 From: lordwelch Date: Fri, 19 Feb 2016 08:46:03 -0800 Subject: [PATCH] fix stuff.... --- main.go | 29 +++++++++------------------- main.qml | 17 ++++++++--------- qml/AboutDialog.qml | 46 +++++---------------------------------------- qml/cell.qml | 10 ++++++++-- 4 files changed, 30 insertions(+), 72 deletions(-) diff --git a/main.go b/main.go index b37aed8..de50aed 100644 --- a/main.go +++ b/main.go @@ -34,9 +34,8 @@ var ( err error monitors []*glfw.Monitor projMonitor *glfw.Monitor - mw1, mw2 *imagick.MagickWand + mw1 *imagick.MagickWand tex1 uint32 - //drawSlide func() ) func main() { @@ -51,11 +50,6 @@ func main() { } -/*func init() { - // GLFW event handling must run on the main OS thread - //runtime.LockOSThread() -}*/ - func run() error { var mainQml qml.Object imagick.Initialize() @@ -91,8 +85,8 @@ func run() error { qml.RunMain(glInit) window.Wait() - //win.Destroy() - mw2.Destroy() + + mw1.Destroy() imagick.Terminate() return nil } @@ -100,9 +94,9 @@ func run() error { func setupScene() { gl.ClearColor(0.1, 0.5, 0.9, 0.0) - mw2 = resizeImage(mw1, x, y, true, true) + mw1 = resizeImage(mw1, x, y, true, true) - tex1 = newTexture(*mw2) + tex1 = newTexture(*mw1) gl.MatrixMode(gl.PROJECTION) gl.LoadIdentity() @@ -242,7 +236,6 @@ func setSignals() { window.On("closing", func() { fmt.Println(window.Bool("cls")) win.Hide() - //win.Destroy() window.Set("cls", true) }) @@ -259,9 +252,7 @@ func setSignals() { cel = slides[textEdit.Int("cell")] if textEdit.Bool("txt") { cel.qmlcell.ObjectByName("cellText").Set("text", str) - //fmt.Println("haha.....:-P") cel.text = str - //fmt.Println("----->"+cel.text, str, textEdit.Int("cell")) } } }) @@ -270,13 +261,12 @@ func setSignals() { func (cl *cell) setSignal() { cl.qmlcell.ObjectByName("cellMouse").On("doubleClicked", func() { - cellText := cl.qmlcell.ObjectByName("cellText") textEdit.Set("cell", cl.index) - textEdit.Set("x", cellText.Int("x")+4) - textEdit.Set("y", cellText.Int("y")+4) - textEdit.Set("width", cellText.Int("width")) - textEdit.Set("height", cellText.Int("height")) + textEdit.Set("x", cl.qmlcell.Int("x")+4) + textEdit.Set("y", cl.qmlcell.Int("y")+4) + textEdit.Set("width", cl.qmlcell.Int("width")) + textEdit.Set("height", cl.qmlcell.Int("height")) textEdit.Set("opacity", 100) textEdit.Set("visible", true) textEdit.ObjectByName("textEdit1").Set("focus", true) @@ -299,7 +289,6 @@ func (sl *slide) addCell( /*cl *cell*/ ) { cl.text = "testing 1... 2... 3..." cl.qmlcell.ObjectByName("cellText").Set("text", cl.text) *sl = append(*sl, &cl) - //fmt.Println("add Cell!!!!! :-P") cl.setSignal() } diff --git a/main.qml b/main.qml index da1f5bb..80e73d1 100644 --- a/main.qml +++ b/main.qml @@ -15,10 +15,12 @@ ApplicationWindow { property bool cls: false onClosing: if (!cls) { - close.accepted = false - } + // close.accepted = false + } - AboutDialog { id: aboutDialog } + AboutDialog { + id: aboutDialog + } Action { id: aboutAction @@ -96,7 +98,6 @@ ApplicationWindow { anchors.bottom: parent.bottom anchors.top: parent.top anchors.left: parent.left - //onAdded: children.width = data1.width } } @@ -136,7 +137,6 @@ ApplicationWindow { x: 8 y: 8 text: qsTr("Button") - } } } @@ -153,7 +153,8 @@ ApplicationWindow { visible: false property bool txt: true Keys.onPressed: { - if ((event.key == Qt.Key_Return) && (event.modifiers & Qt.ControlModifier)) { + if ((event.key == Qt.Key_Return) + && (event.modifiers & Qt.ControlModifier)) { txt = true x = -100 @@ -164,9 +165,9 @@ ApplicationWindow { opacity = 0 textEdit1.focus = false - event.accepted = true } + if (event.key == Qt.Key_Escape) { txt = false x = -100 @@ -177,12 +178,10 @@ ApplicationWindow { opacity = 0 textEdit1.focus = false - event.accepted = true } } - TextArea { id: textEdit1 objectName: "textEdit1" diff --git a/qml/AboutDialog.qml b/qml/AboutDialog.qml index 77f6efa..396fea7 100644 --- a/qml/AboutDialog.qml +++ b/qml/AboutDialog.qml @@ -1,48 +1,12 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ import QtQuick 2.2 import QtQuick.Dialogs 1.1 MessageDialog { icon: StandardIcon.Information - text: "Presentation App for use in a church service" - detailedText: "Made in 2016 by Timmy Welch." + text: "Presentation App \nVersion: Alpha" + detailedText: "Presentation App for use in a church service\nMade in 2016 by Timmy Welch." title: "About" + height: 100 + width: 200 + standardButtons: StandardButton.Close } diff --git a/qml/cell.qml b/qml/cell.qml index 0e30ec4..ba2fb8d 100644 --- a/qml/cell.qml +++ b/qml/cell.qml @@ -7,6 +7,7 @@ Rectangle { width: 100 height: 100 border.width: 2 + border.color: "black" anchors.right: parent.right anchors.left: parent.left @@ -31,6 +32,8 @@ Rectangle { anchors.fill: parent onFocusChanged: if (focus) { selected() + } else { + notSelected() } onClicked: { @@ -47,8 +50,11 @@ Rectangle { parent.color = "black" } - onExited: { - parent.parent.border.color = "white" + onExited: notSelected() + + function notSelected() { + + parent.parent.border.color = "black" parent.parent.color = "white" parent.color = "black" if (focus) {