forked from cwtch.im/ui
Merge branch 'textfix' of cwtch.im/ui into master
This commit is contained in:
commit
79fdc94598
31
main.go
31
main.go
|
@ -11,12 +11,11 @@ import (
|
|||
"fmt"
|
||||
"git.openprivacy.ca/openprivacy/libricochet-go/connectivity"
|
||||
"git.openprivacy.ca/openprivacy/libricochet-go/log"
|
||||
"github.com/therecipe/qt/gui"
|
||||
"github.com/therecipe/qt/core"
|
||||
"github.com/therecipe/qt/network"
|
||||
"github.com/therecipe/qt/qml"
|
||||
"github.com/therecipe/qt/quick"
|
||||
"github.com/therecipe/qt/quickcontrols2"
|
||||
"github.com/therecipe/qt/widgets"
|
||||
"os"
|
||||
"os/user"
|
||||
"path"
|
||||
|
@ -47,14 +46,16 @@ func main() {
|
|||
qmlSource = core.NewQUrl3("qrc:/qml/main.qml", 0)
|
||||
}
|
||||
|
||||
|
||||
app := gui.NewQGuiApplication(len(os.Args), os.Args)
|
||||
app.SetWindowIcon(gui.NewQIcon5(":/qml/images/cwtch-icon.png"))
|
||||
|
||||
// window construction boilerplate
|
||||
view := initializeQtView()
|
||||
view := initializeQtView(qmlSource)
|
||||
|
||||
// variables we want to access from inside qml
|
||||
view.RootContext().SetContextProperty("gcd", gcd)
|
||||
|
||||
// this actually loads the qml
|
||||
view.SetSource(qmlSource)
|
||||
|
||||
acn, err := connectivity.StartTor(the.CwtchDir, "")
|
||||
if err != nil {
|
||||
|
@ -84,26 +85,18 @@ func main() {
|
|||
//})
|
||||
return nam
|
||||
})
|
||||
view.Engine().SetNetworkAccessManagerFactory(factory)
|
||||
|
||||
// here we go!
|
||||
view.Show()
|
||||
widgets.QApplication_Exec()
|
||||
view.SetNetworkAccessManagerFactory(factory)
|
||||
app.Exec()
|
||||
acn.Close()
|
||||
}
|
||||
|
||||
// window construction boilerplate
|
||||
func initializeQtView() *quick.QQuickView {
|
||||
func initializeQtView(source *core.QUrl) *qml.QQmlApplicationEngine {
|
||||
core.QCoreApplication_SetAttribute(core.Qt__AA_EnableHighDpiScaling, true)
|
||||
widgets.NewQApplication(len(os.Args), os.Args)
|
||||
quickcontrols2.QQuickStyle_SetStyle("Universe")
|
||||
view := quick.NewQQuickView(nil)
|
||||
view.SetResizeMode(quick.QQuickView__SizeRootObjectToView)
|
||||
//view.SetMinimumHeight(800) // these end up getting overridden by main.qml
|
||||
//view.SetMinimumWidth(1200)
|
||||
view.SetTitle("cwtch")
|
||||
|
||||
return view
|
||||
engine := qml.NewQQmlApplicationEngine(nil)
|
||||
engine.Load(source)
|
||||
return engine
|
||||
}
|
||||
|
||||
// this is mostly going to get factored out when we add profile support
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 4.0 KiB |
|
@ -11,10 +11,15 @@ import "panes"
|
|||
import "widgets"
|
||||
import "utils.js" as Utils
|
||||
|
||||
Item {
|
||||
|
||||
ApplicationWindow {
|
||||
id: windowItem
|
||||
width: 1200
|
||||
height: 800
|
||||
visible: true
|
||||
title: "cwtch" + ""
|
||||
|
||||
|
||||
|
||||
readonly property real ratio: height / width
|
||||
|
||||
|
|
Loading…
Reference in New Issue