accept version at build time; display version in settings pane

This commit is contained in:
Dan Ballard 2019-03-27 12:57:11 -07:00
parent dfef958c68
commit eeb167ce38
8 changed files with 64 additions and 22 deletions

View File

@ -26,6 +26,8 @@ type GrandCentralDispatcher struct {
_ string `property:"os"`
_ string `property:"currentOpenConversation"`
_ float32 `property:"themeScale"`
_ string `property:"version"`
_ string `property:"buildDate"`
// contact list stuff
_ func(handle, displayName, image, server string, badge, status int, trusted bool) `signal:"AddContact"`

View File

@ -264,24 +264,30 @@
<translation>Cwtch Einstellungen</translation>
</message>
<message>
<location filename="../qml/panes/SettingsPane.qml" line="29"/>
<location filename="../qml/panes/SettingsPane.qml" line="28"/>
<source>version %1 builddate %2</source>
<extracomment>Version: %1 Built on: %2</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/SettingsPane.qml" line="35"/>
<source>zoom-label</source>
<extracomment>Interface zoom (mostly affects text and button sizes)</extracomment>
<translation>Benutzeroberflächen-Zoom (betriftt hauptsächlich Text- und Knopgrößen)</translation>
</message>
<message>
<location filename="../qml/panes/SettingsPane.qml" line="46"/>
<location filename="../qml/panes/SettingsPane.qml" line="52"/>
<source>large-text-label</source>
<translation>Groß</translation>
</message>
<message>
<location filename="../qml/panes/SettingsPane.qml" line="52"/>
<location filename="../qml/panes/SettingsPane.qml" line="58"/>
<source>default-scaling-text</source>
<extracomment>&quot;Default size text (scale factor: &quot;</extracomment>
<translation>defaultmäßige Textgröße (Skalierungsfaktor:</translation>
</message>
<message>
<location filename="../qml/panes/SettingsPane.qml" line="56"/>
<location filename="../qml/panes/SettingsPane.qml" line="62"/>
<source>small-text-label</source>
<translation>Klein</translation>
</message>

Binary file not shown.

View File

@ -264,24 +264,30 @@
<translation>Cwtch Settings</translation>
</message>
<message>
<location filename="../qml/panes/SettingsPane.qml" line="29"/>
<location filename="../qml/panes/SettingsPane.qml" line="28"/>
<source>version %1 builddate %2</source>
<extracomment>Version: %1 Built on: %2</extracomment>
<translation>Version: %1 Built on: %2</translation>
</message>
<message>
<location filename="../qml/panes/SettingsPane.qml" line="35"/>
<source>zoom-label</source>
<extracomment>Interface zoom (mostly affects text and button sizes)</extracomment>
<translation>Interface zoom (mostly affects text and button sizes)</translation>
</message>
<message>
<location filename="../qml/panes/SettingsPane.qml" line="46"/>
<location filename="../qml/panes/SettingsPane.qml" line="52"/>
<source>large-text-label</source>
<translation>Large</translation>
</message>
<message>
<location filename="../qml/panes/SettingsPane.qml" line="52"/>
<location filename="../qml/panes/SettingsPane.qml" line="58"/>
<source>default-scaling-text</source>
<extracomment>&quot;Default size text (scale factor: &quot;</extracomment>
<translation>Default size text (scale factor:</translation>
</message>
<message>
<location filename="../qml/panes/SettingsPane.qml" line="56"/>
<location filename="../qml/panes/SettingsPane.qml" line="62"/>
<source>small-text-label</source>
<translation>Small</translation>
</message>

View File

@ -264,24 +264,30 @@
<translation>Préférences Cwtch</translation>
</message>
<message>
<location filename="../qml/panes/SettingsPane.qml" line="29"/>
<location filename="../qml/panes/SettingsPane.qml" line="28"/>
<source>version %1 builddate %2</source>
<extracomment>Version: %1 Built on: %2</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/SettingsPane.qml" line="35"/>
<source>zoom-label</source>
<extracomment>Interface zoom (mostly affects text and button sizes)</extracomment>
<translation>Interface zoom (essentiellement la taille du texte et des composants de l&apos;interface)</translation>
</message>
<message>
<location filename="../qml/panes/SettingsPane.qml" line="46"/>
<location filename="../qml/panes/SettingsPane.qml" line="52"/>
<source>large-text-label</source>
<translation type="unfinished">Large</translation>
</message>
<message>
<location filename="../qml/panes/SettingsPane.qml" line="52"/>
<location filename="../qml/panes/SettingsPane.qml" line="58"/>
<source>default-scaling-text</source>
<extracomment>&quot;Default size text (scale factor: &quot;</extracomment>
<translation>Taille par défaut du texte (échelle:</translation>
</message>
<message>
<location filename="../qml/panes/SettingsPane.qml" line="56"/>
<location filename="../qml/panes/SettingsPane.qml" line="62"/>
<source>small-text-label</source>
<translation>Petit</translation>
</message>

View File

@ -264,24 +264,30 @@
<translation>Configurações do Cwtch</translation>
</message>
<message>
<location filename="../qml/panes/SettingsPane.qml" line="29"/>
<location filename="../qml/panes/SettingsPane.qml" line="28"/>
<source>version %1 builddate %2</source>
<extracomment>Version: %1 Built on: %2</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/SettingsPane.qml" line="35"/>
<source>zoom-label</source>
<extracomment>Interface zoom (mostly affects text and button sizes)</extracomment>
<translation>Zoom da interface (afeta principalmente tamanho de texto e botões)</translation>
</message>
<message>
<location filename="../qml/panes/SettingsPane.qml" line="46"/>
<location filename="../qml/panes/SettingsPane.qml" line="52"/>
<source>large-text-label</source>
<translation>Grande</translation>
</message>
<message>
<location filename="../qml/panes/SettingsPane.qml" line="52"/>
<location filename="../qml/panes/SettingsPane.qml" line="58"/>
<source>default-scaling-text</source>
<extracomment>&quot;Default size text (scale factor: &quot;</extracomment>
<translation>Texto tamanho padrão (fator de escala: </translation>
</message>
<message>
<location filename="../qml/panes/SettingsPane.qml" line="56"/>
<location filename="../qml/panes/SettingsPane.qml" line="62"/>
<source>small-text-label</source>
<translation>Pequeno</translation>
</message>

21
main.go
View File

@ -25,6 +25,11 @@ import (
const androidBaseDir = "/data/data/org.qtproject.example.go/"
var (
buildVer string
buildDate string
)
func init() {
// make go-defined types available in qml
gothings.GrandCentralDispatcher_QmlRegisterType2("CustomQmlTypes", 1, 0, "GrandCentralDispatcher")
@ -44,6 +49,13 @@ func main() {
// our globals
gcd := gothings.NewGrandCentralDispatcher(nil)
gcd.SetOs(runtime.GOOS)
if buildVer != "" {
gcd.SetVersion(buildVer)
gcd.SetBuildDate(buildDate)
} else {
gcd.SetVersion("development")
gcd.SetBuildDate("now")
}
gcd.UIState = gothings.NewUIState(gcd)
the.AcknowledgementIDs = make(map[string][]*the.AckId)
gcd.OutgoingMessages = make(chan gobjects.Letter, 1000)
@ -105,7 +117,7 @@ func main() {
the.CwtchDir = os.Getenv("CWTCH_FOLDER")
} else if runtime.GOOS == "android" {
the.CwtchDir = path.Join(androidBaseDir, "files")
} else {
} else {
usr, err := user.Current()
if err != nil {
fmt.Printf("\nerror: could not load current user: %v\n", err)
@ -158,7 +170,6 @@ func main() {
acn.Close()
}
// 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
func loadCwtchData(gcd *gothings.GrandCentralDispatcher, acn connectivity.ACN) {
@ -217,9 +228,9 @@ func loadCwtchData(gcd *gothings.GrandCentralDispatcher, acn connectivity.ACN) {
if !exists {
nick = group.GroupID[:12]
}
deleted,_ := group.GetAttribute("deleted")
deleted, _ := group.GetAttribute("deleted")
// Only join servers for active and explicitly accepted groups.
if deleted != "deleted"{
if deleted != "deleted" {
gcd.UIState.AddContact(&gobjects.Contact{
Handle: group.GroupID,
@ -230,7 +241,7 @@ func loadCwtchData(gcd *gothings.GrandCentralDispatcher, acn connectivity.ACN) {
})
// Only send a join server packet if we haven't joined this server yet...
_,connecting := the.Peer.GetServers()[group.GroupServer]
_, connecting := the.Peer.GetServers()[group.GroupServer]
if group.Accepted && !connecting {
the.Peer.JoinServer(group.GroupServer)
}

View File

@ -23,6 +23,11 @@ ColumnLayout { // settingsPane
leftPadding: 10
spacing: 5
ScalingLabel {
//: Version: %1 Built on: %2
text: qsTr("version %1 builddate %2").arg(gcd.version).arg(gcd.buildDate)
}
ScalingLabel {
Layout.maximumWidth: parent.width
//: Interface zoom (mostly affects text and button sizes)
@ -99,4 +104,4 @@ ColumnLayout { // settingsPane
// (locale is handled automatically by FlagButton)
}
}
}
}