mirror of
https://github.com/clearlinux/clr-installer.git
synced 2026-09-06 05:31:58 +00:00
Change Done to Confirm
Another UX review suggestion implemented Signed-off-by: Mark D Horn <mark.d.horn@intel.com>
This commit is contained in:
+7
-7
@@ -45,7 +45,7 @@ func newAutoUpdatePage(tui *Tui) (Page, error) {
|
||||
page := &AutoUpdatePage{}
|
||||
|
||||
page.setupMenu(tui, TuiPageAutoUpdate, "Automatic OS Updates",
|
||||
BackButton|DoneButton, TuiPageMenu)
|
||||
BackButton|ConfirmButton, TuiPageMenu)
|
||||
|
||||
lbl := clui.CreateLabel(page.content, 2, 16, autoUpdateHelp, Fixed)
|
||||
lbl.SetMultiline(true)
|
||||
@@ -53,17 +53,17 @@ func newAutoUpdatePage(tui *Tui) (Page, error) {
|
||||
page.backBtn.SetTitle("No [Disable]")
|
||||
page.backBtn.SetSize(11, 1)
|
||||
|
||||
page.doneBtn.SetTitle("Yes [Enable, Default]")
|
||||
page.doneBtn.SetSize(21, 1)
|
||||
page.confirmBtn.SetTitle("Yes [Enable, Default]")
|
||||
page.confirmBtn.SetSize(21, 1)
|
||||
|
||||
return page, nil
|
||||
}
|
||||
|
||||
// DeActivate sets the model value and adjusts the "done" flag for this page
|
||||
// DeActivate sets the model value and adjusts the "confirm" flag for this page
|
||||
func (aup *AutoUpdatePage) DeActivate() {
|
||||
model := aup.getModel()
|
||||
|
||||
if aup.action == ActionDoneButton {
|
||||
if aup.action == ActionConfirmButton {
|
||||
model.AutoUpdate = true
|
||||
} else {
|
||||
model.AutoUpdate = false
|
||||
@@ -71,11 +71,11 @@ func (aup *AutoUpdatePage) DeActivate() {
|
||||
}
|
||||
|
||||
// Activate activates the proper button depending on the current model value.
|
||||
// If Auto Update is enabled in the data model then the Done button will be active
|
||||
// If Auto Update is enabled in the data model then the Confirm button will be active
|
||||
// otherwise the Back button will be activated.
|
||||
func (aup *AutoUpdatePage) Activate() {
|
||||
if aup.getModel().AutoUpdate {
|
||||
aup.activated = aup.doneBtn
|
||||
aup.activated = aup.confirmBtn
|
||||
} else {
|
||||
aup.activated = aup.backBtn
|
||||
}
|
||||
|
||||
+13
-13
@@ -20,7 +20,7 @@ type BasePage struct {
|
||||
cFrame *clui.Frame // control frame
|
||||
cancelBtn *SimpleButton // cancel button
|
||||
backBtn *SimpleButton // back button
|
||||
doneBtn *SimpleButton // done button
|
||||
confirmBtn *SimpleButton // confirm button
|
||||
activated clui.Control // activated control
|
||||
menuTitle string // the title used to show on main menu
|
||||
done bool // marks if an item is completed
|
||||
@@ -80,14 +80,14 @@ const (
|
||||
// BackButton mask defines a common Page will have a back button
|
||||
BackButton = 1 << 1
|
||||
|
||||
// DoneButton mask defines a common Page will have done button
|
||||
DoneButton = 1 << 2
|
||||
// ConfirmButton mask defines a common Page will have Confirm button
|
||||
ConfirmButton = 1 << 2
|
||||
|
||||
// CancelButton mask defines a common Page will have a cancel button
|
||||
CancelButton = 1 << 3
|
||||
|
||||
// AllButtons mask defines a common Page will have both Back and Done buttons
|
||||
AllButtons = BackButton | DoneButton
|
||||
// AllButtons mask defines a common Page will have both Back and Confirm buttons
|
||||
AllButtons = BackButton | ConfirmButton
|
||||
|
||||
// TuiPageMenu is the id for menu page
|
||||
TuiPageMenu = iota
|
||||
@@ -166,8 +166,8 @@ const (
|
||||
// ActionBackButton indicates the user has pressed back button
|
||||
ActionBackButton = iota
|
||||
|
||||
// ActionDoneButton indicates the user has pressed done button
|
||||
ActionDoneButton
|
||||
// ActionConfirmButton indicates the user has pressed confirm button
|
||||
ActionConfirmButton
|
||||
|
||||
// ActionCancelButton indicates the user has pressed cancel button
|
||||
ActionCancelButton
|
||||
@@ -316,8 +316,8 @@ func (page *BasePage) setup(tui *Tui, id int, btns int, returnID int) {
|
||||
page.newBackButton(returnID)
|
||||
}
|
||||
|
||||
if btns&DoneButton == DoneButton {
|
||||
page.newDoneButton(tui, returnID)
|
||||
if btns&ConfirmButton == ConfirmButton {
|
||||
page.newConfirmButton(tui, returnID)
|
||||
}
|
||||
|
||||
frm := clui.CreateFrame(page.window, AutoSize, 1, BorderNone, Fixed)
|
||||
@@ -393,17 +393,17 @@ func (page *BasePage) newCancelButton(pageID int) {
|
||||
page.cancelBtn = btn
|
||||
}
|
||||
|
||||
func (page *BasePage) newDoneButton(tui *Tui, pageID int) {
|
||||
btn := CreateSimpleButton(page.cFrame, AutoSize, AutoSize, "Done", Fixed)
|
||||
func (page *BasePage) newConfirmButton(tui *Tui, pageID int) {
|
||||
btn := CreateSimpleButton(page.cFrame, AutoSize, AutoSize, "Confirm", Fixed)
|
||||
|
||||
btn.OnClick(func(ev clui.Event) {
|
||||
if tui.currPage.SetDone(true) {
|
||||
page.action = ActionDoneButton
|
||||
page.action = ActionConfirmButton
|
||||
page.GotoPage(pageID)
|
||||
page.action = ActionNone
|
||||
}
|
||||
})
|
||||
page.doneBtn = btn
|
||||
page.confirmBtn = btn
|
||||
}
|
||||
|
||||
func (page *BasePage) getModel() *model.SystemInstall {
|
||||
|
||||
+3
-3
@@ -90,8 +90,8 @@ func (page *GuidedPartPage) showGuidedDisk(bd *storage.BlockDevice) error {
|
||||
labels = append(labels, lbl)
|
||||
}
|
||||
|
||||
page.doneBtn.SetEnabled(true)
|
||||
clui.ActivateControl(page.window, page.doneBtn)
|
||||
page.confirmBtn.SetEnabled(true)
|
||||
clui.ActivateControl(page.window, page.confirmBtn)
|
||||
page.bd = bd
|
||||
})
|
||||
|
||||
@@ -146,6 +146,6 @@ func newGuidedPartitionPage(tui *Tui) (Page, error) {
|
||||
lbl = clui.CreateLabel(page.content, 70, 3, guidedDesc, Fixed)
|
||||
lbl.SetMultiline(true)
|
||||
|
||||
page.doneBtn.SetEnabled(false)
|
||||
page.confirmBtn.SetEnabled(false)
|
||||
return page, nil
|
||||
}
|
||||
|
||||
+2
-2
@@ -158,7 +158,7 @@ func (page *ManualPartPage) Activate() {
|
||||
|
||||
for _, bd := range page.bds {
|
||||
if err = bd.Validate(); err == nil {
|
||||
page.doneBtn.SetEnabled(true)
|
||||
page.confirmBtn.SetEnabled(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -209,6 +209,6 @@ func newManualPartitionPage(tui *Tui) (Page, error) {
|
||||
lbl = clui.CreateLabel(page.content, 70, 3, manualDesc, Fixed)
|
||||
lbl.SetMultiline(true)
|
||||
|
||||
page.doneBtn.SetEnabled(false)
|
||||
page.confirmBtn.SetEnabled(false)
|
||||
return page, nil
|
||||
}
|
||||
|
||||
+3
-3
@@ -45,7 +45,7 @@ func (page *KeyboardPage) SetDone(done bool) bool {
|
||||
|
||||
// DeActivate will reset the selection case the user has pressed cancel
|
||||
func (page *KeyboardPage) DeActivate() {
|
||||
if page.action == ActionDoneButton {
|
||||
if page.action == ActionConfirmButton {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ func newKeyboardPage(tui *Tui) (Page, error) {
|
||||
}
|
||||
|
||||
page.setupMenu(tui, TuiPageKeyboard, "Configure the Keyboard",
|
||||
DoneButton|CancelButton, TuiPageMenu)
|
||||
ConfirmButton|CancelButton, TuiPageMenu)
|
||||
|
||||
lbl := clui.CreateLabel(page.content, 2, 2, "Select Keyboard", Fixed)
|
||||
lbl.SetPaddings(0, 2)
|
||||
@@ -124,7 +124,7 @@ func newKeyboardPage(tui *Tui) (Page, error) {
|
||||
|
||||
newEditField(frame, false, nil)
|
||||
|
||||
page.activated = page.doneBtn
|
||||
page.activated = page.confirmBtn
|
||||
|
||||
return page, nil
|
||||
}
|
||||
|
||||
+3
-3
@@ -45,7 +45,7 @@ func (page *LanguagePage) SetDone(done bool) bool {
|
||||
|
||||
// DeActivate will reset the selection case the user has pressed cancel
|
||||
func (page *LanguagePage) DeActivate() {
|
||||
if page.action == ActionDoneButton {
|
||||
if page.action == ActionConfirmButton {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ func newLanguagePage(tui *Tui) (Page, error) {
|
||||
},
|
||||
}
|
||||
|
||||
page.setupMenu(tui, TuiPageLanguage, "Choose Language", DoneButton|CancelButton, TuiPageMenu)
|
||||
page.setupMenu(tui, TuiPageLanguage, "Choose Language", ConfirmButton|CancelButton, TuiPageMenu)
|
||||
|
||||
lbl := clui.CreateLabel(page.content, 2, 2, "Select System Language", Fixed)
|
||||
lbl.SetPaddings(0, 2)
|
||||
@@ -99,7 +99,7 @@ func newLanguagePage(tui *Tui) (Page, error) {
|
||||
}
|
||||
|
||||
page.langListBox.SelectItem(defLanguage)
|
||||
page.activated = page.doneBtn
|
||||
page.activated = page.confirmBtn
|
||||
|
||||
return page, nil
|
||||
}
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ func (page *MenuPage) addMenuItem(item Page, tab *TabPage) *MenuButton {
|
||||
}
|
||||
|
||||
// Activate is called when the page is "shown" and it repaints the main menu based on the
|
||||
// available menu pages and their done/undone status
|
||||
// available menu pages and their confirm/unconfirm status
|
||||
func (page *MenuPage) Activate() {
|
||||
previous := false
|
||||
activeSet := false
|
||||
|
||||
+7
-7
@@ -42,7 +42,7 @@ func newTelemetryPage(tui *Tui) (Page, error) {
|
||||
required: true,
|
||||
},
|
||||
}
|
||||
page.setupMenu(tui, TuiPageTelemetry, "Telemetry", BackButton|DoneButton, TuiPageMenu)
|
||||
page.setupMenu(tui, TuiPageTelemetry, "Telemetry", BackButton|ConfirmButton, TuiPageMenu)
|
||||
|
||||
// Set one blank line between items for readability
|
||||
page.content.SetGaps(0, 1)
|
||||
@@ -75,24 +75,24 @@ func newTelemetryPage(tui *Tui) (Page, error) {
|
||||
page.backBtn.SetTitle("No, thanks")
|
||||
page.backBtn.SetSize(12, 1)
|
||||
|
||||
page.doneBtn.SetTitle("Yes, enable telemetry!!")
|
||||
page.doneBtn.SetSize(25, 1)
|
||||
page.confirmBtn.SetTitle("Yes, enable telemetry!!")
|
||||
page.confirmBtn.SetSize(25, 1)
|
||||
|
||||
return page, nil
|
||||
}
|
||||
|
||||
// DeActivate sets the model value and adjusts the "done" flag for this page
|
||||
// DeActivate sets the model value and adjusts the "confirm" flag for this page
|
||||
func (tp *TelemetryPage) DeActivate() {
|
||||
tp.getModel().EnableTelemetry(tp.action == ActionDoneButton)
|
||||
tp.getModel().EnableTelemetry(tp.action == ActionConfirmButton)
|
||||
tp.SetDone(true)
|
||||
}
|
||||
|
||||
// Activate activates the proper button depending on the current model value
|
||||
// if telemetry is enabled in the data model then the done button will be active
|
||||
// if telemetry is enabled in the data model then the confirm button will be active
|
||||
// otherwise the back button will be activated.
|
||||
func (tp *TelemetryPage) Activate() {
|
||||
if tp.getModel().Telemetry.Enabled {
|
||||
tp.activated = tp.doneBtn
|
||||
tp.activated = tp.confirmBtn
|
||||
} else {
|
||||
tp.activated = tp.backBtn
|
||||
}
|
||||
|
||||
+3
-3
@@ -45,7 +45,7 @@ func (page *TimezonePage) SetDone(done bool) bool {
|
||||
|
||||
// DeActivate will reset the selection case the user has pressed cancel
|
||||
func (page *TimezonePage) DeActivate() {
|
||||
if page.action == ActionDoneButton {
|
||||
if page.action == ActionConfirmButton {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ func newTimezonePage(tui *Tui) (Page, error) {
|
||||
},
|
||||
}
|
||||
|
||||
page.setupMenu(tui, TuiPageTimezone, "Choose Timezone", DoneButton|CancelButton, TuiPageMenu)
|
||||
page.setupMenu(tui, TuiPageTimezone, "Choose Timezone", ConfirmButton|CancelButton, TuiPageMenu)
|
||||
|
||||
lbl := clui.CreateLabel(page.content, 2, 2, "Select System Timezone", Fixed)
|
||||
lbl.SetPaddings(0, 2)
|
||||
@@ -99,7 +99,7 @@ func newTimezonePage(tui *Tui) (Page, error) {
|
||||
}
|
||||
|
||||
page.tzListBox.SelectItem(defTimezone)
|
||||
page.activated = page.doneBtn
|
||||
page.activated = page.confirmBtn
|
||||
|
||||
return page, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user