removed projection.qml

using gflw instead
qml cant detect if there are multiple monitors
both packages appear to be compatible with eachother
This commit is contained in:
lordwelch 2016-01-21 10:11:16 -08:00
parent d26d6e08b2
commit 5410aac4d4
3 changed files with 49 additions and 13 deletions

50
main.go
View File

@ -4,9 +4,12 @@ package main
import (
"fmt"
//"image"
"log"
"os"
"path/filepath"
"runtime"
"github.com/go-gl/glfw/v3.1/glfw"
"github.com/kardianos/osext"
"gopkg.in/qml.v1"
)
@ -26,31 +29,50 @@ var (
window *qml.Window
slides slide
err error
monitors []*glfw.Monitor
)
func main() {
if err := glfw.Init(); err != nil {
log.Fatalln("failed to initialize glfw:", err)
}
checkMon()
if err := qml.Run(run); err != nil {
fmt.Fprintf(os.Stderr, "error: %v\n", err)
os.Exit(1)
}
glfw.Terminate()
}
func init() {
// GLFW event handling must run on the main OS thread
runtime.LockOSThread()
}
func run() error {
engine := qml.NewEngine()
path, err = osext.ExecutableFolder()
path = filepath.Clean(path + "/../src/github.com/lordwelch/PresentationApp/")
fmt.Println(path)
//fmt.Println(path)
mainQml, err := engine.LoadFile(path + "/main.qml")
if err != nil {
return err
}
/*projQml, err := engine.LoadFile(path + "/qml/projection.qml")
if err != nil {
return err
}*/
cellQml, err = engine.LoadFile(path + "/qml/cell.qml")
if err != nil {
return err
}
window = mainQml.CreateWindow(nil)
//created(projQml)
textEdit = window.ObjectByName("textEdit")
slides.addCell()
@ -59,6 +81,25 @@ func run() error {
return nil
}
func checkMon() {
monitors = glfw.GetMonitors()
if i := len(monitors); i < 2 {
fmt.Println("You only have 1 monitor!!!!!!!!!!! :-P")
} else {
fmt.Printf("You have %d monitors\n", i)
}
monitorInfo()
}
func monitorInfo() {
for _, mon := range monitors {
fmt.Printf("monitor name: %s\n", mon.GetName())
i, t := mon.GetPos()
fmt.Printf("position X: %d Y: %d\n", i, t)
//fmt.Println(mon.)
}
}
func (cl *cell) setSignals() {
cl.qmlcell.ObjectByName("cellMouse").On("doubleClicked", func() {
cellText := cl.qmlcell.ObjectByName("cellText")
@ -81,7 +122,7 @@ func (cl *cell) setSignals() {
str string
cel cell
)
fmt.Printf("focusChanged: focus: %t\n", focus)
//fmt.Printf("focusChanged: focus: %t\n", focus)
if !focus {
str = textEdit.ObjectByName("textEdit1").String("text")
cel = slides[textEdit.Int("cell")]
@ -98,17 +139,18 @@ func (sl *slide) addCell( /*cl *cell*/ ) {
cl.qmlcell.Set("parent", window.ObjectByName("data1"))
cl.index = len(*sl)
cl.text = "testing 1... 2... 3..."
cl.qmlcell.ObjectByName("cellText").Set("text", cl.text)
*sl = append(*sl, cl)
cl.setSignals()
fmt.Print((*sl)[len(*sl)-1])
//fmt.Print((*sl)[cl.index])
}
func (cl cell) String() string {
return fmt.Sprintf("Index: %T \nText: %T\n", cl.index, cl.text)
return fmt.Sprintf("Index: %d \nText: %s\n", cl.index, cl.text)
}
func (cl cell) GoString() string {

View File

@ -1,7 +1,6 @@
import QtQuick 2.5
import QtQuick 2.4
import QtQuick.Controls 1.3
import QtQuick.Dialogs 1.1
import QtQuick.Layouts 1.0
import QtQuick.Window 2.0
import "qml"
ApplicationWindow {
@ -13,6 +12,7 @@ ApplicationWindow {
minimumHeight: 500
width: 1000
height: 600
Screen.objectName: "Screen1"
AboutDialog { id: aboutDialog }
Action {
@ -25,7 +25,6 @@ ApplicationWindow {
Menu {
title: "&File"
MenuItem {
}
MenuItem {
text: "Close"

View File

@ -1,5 +0,0 @@
import QtQuick 2.0
Item {
}