Skip to content

Commit

Permalink
tui: gui: Do not display version in Demo mode
Browse files Browse the repository at this point in the history
For documentation purposes (screen shots), we do not want to
include the version string. Having a version string in the image
requires updating all image each release.

Signed-off-by: Mark D Horn <[email protected]>
  • Loading branch information
mdhorn committed May 8, 2019
1 parent cb0c9f5 commit d96230f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
2 changes: 1 addition & 1 deletion clr-installer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func main() {
}

if options.DemoMode {
model.Version = "X.Y.Z"
model.Version = model.DemoVersion
}
// Make the Version of the program visible to telemetry
telemetry.ProgVersion = model.Version
Expand Down
8 changes: 6 additions & 2 deletions gui/window.go
Original file line number Diff line number Diff line change
Expand Up @@ -688,15 +688,19 @@ func (window *Window) GetRootDir() string {
// GetWelcomeMessage gets the welcome message
func GetWelcomeMessage() string {
text := "<span font-size='xx-large'>" + utils.Locale.Get("Welcome to Clear Linux* OS Desktop Installation") + "</span>"
text += "\n\n<small>" + utils.Locale.Get("VERSION %s", model.Version) + "</small>"
if model.Version != model.DemoVersion {
text += "\n\n<small>" + utils.Locale.Get("VERSION %s", model.Version) + "</small>"
}

return text
}

// GetThankYouMessage gets the thank you message
func GetThankYouMessage() string {
text := "<span font-size='xx-large'>" + utils.Locale.Get("Thank you for choosing Clear Linux* OS") + "</span>"
text += "\n\n<small>" + utils.Locale.Get("VERSION %s", model.Version) + "</small>"
if model.Version != model.DemoVersion {
text += "\n\n<small>" + utils.Locale.Get("VERSION %s", model.Version) + "</small>"
}

return text
}
7 changes: 7 additions & 0 deletions model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ import (
"github.com/clearlinux/clr-installer/utils"
)

const (
// DemoVersion is hard coded string we display in log files
// when running in demo (aka documentation mode). We will
// now use this as a flag to not include the version in UI.
DemoVersion = "X.Y.Z"
)

// Version of Clear Installer.
// Also used by the Makefile for releases.
// Default to the version of the program
Expand Down
8 changes: 6 additions & 2 deletions tui/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,12 @@ func (page *BasePage) newWindow() {

// Default all the windows to borderless
clui.WindowManager().SetBorder(clui.BorderNone)
page.window = clui.AddWindow(x, y, WindowWidth, WindowHeight,
" [Clear Linux* OS Installer ("+model.Version+")] ")
title := " [Clear Linux* OS Installer"
if model.Version != model.DemoVersion {
title = title + " (" + model.Version + ")"
}
title = title + "] "
page.window = clui.AddWindow(x, y, WindowWidth, WindowHeight, title)

page.window.SetTitleButtons(0)
page.window.SetSizable(false)
Expand Down

0 comments on commit d96230f

Please sign in to comment.