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:"os"`
_ string `property:"currentOpenConversation"` _ string `property:"currentOpenConversation"`
_ float32 `property:"themeScale"` _ float32 `property:"themeScale"`
_ string `property:"version"`
_ string `property:"buildDate"`
// contact list stuff // contact list stuff
_ func(handle, displayName, image, server string, badge, status int, trusted bool) `signal:"AddContact"` _ func(handle, displayName, image, server string, badge, status int, trusted bool) `signal:"AddContact"`

View File

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

Binary file not shown.

View File

@ -264,24 +264,30 @@
<translation>Cwtch Settings</translation> <translation>Cwtch Settings</translation>
</message> </message>
<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> <source>zoom-label</source>
<extracomment>Interface zoom (mostly affects text and button sizes)</extracomment> <extracomment>Interface zoom (mostly affects text and button sizes)</extracomment>
<translation>Interface zoom (mostly affects text and button sizes)</translation> <translation>Interface zoom (mostly affects text and button sizes)</translation>
</message> </message>
<message> <message>
<location filename="../qml/panes/SettingsPane.qml" line="46"/> <location filename="../qml/panes/SettingsPane.qml" line="52"/>
<source>large-text-label</source> <source>large-text-label</source>
<translation>Large</translation> <translation>Large</translation>
</message> </message>
<message> <message>
<location filename="../qml/panes/SettingsPane.qml" line="52"/> <location filename="../qml/panes/SettingsPane.qml" line="58"/>
<source>default-scaling-text</source> <source>default-scaling-text</source>
<extracomment>&quot;Default size text (scale factor: &quot;</extracomment> <extracomment>&quot;Default size text (scale factor: &quot;</extracomment>
<translation>Default size text (scale factor:</translation> <translation>Default size text (scale factor:</translation>
</message> </message>
<message> <message>
<location filename="../qml/panes/SettingsPane.qml" line="56"/> <location filename="../qml/panes/SettingsPane.qml" line="62"/>
<source>small-text-label</source> <source>small-text-label</source>
<translation>Small</translation> <translation>Small</translation>
</message> </message>

View File

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

View File

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

21
main.go
View File

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

View File

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