-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathuitabcore.go
112 lines (106 loc) · 3.06 KB
/
uitabcore.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
// QCLauncher by syncore <[email protected]> 2017
// https://github.com/syncore/qclauncher
package qclauncher
import (
"fmt"
"github.com/lxn/walk"
wd "github.com/lxn/walk/declarative"
)
type Language struct {
LangCode string
Name string
}
const tabCoreTitle = "QC Core Settings"
func newQCCoreSettingsTab(qcCoreSettings *QCCoreSettings) *QCLSettingsTab {
qcCoreSettingsTab := &QCLSettingsTab{}
tabPage := wd.TabPage{
Title: tabCoreTitle,
Layout: wd.HBox{},
DataBinder: wd.DataBinder{
AssignTo: &qcCoreSettingsTab.DataBinder,
DataSource: qcCoreSettings,
ErrorPresenter: wd.ToolTipErrorPresenter{},
},
Children: []wd.Widget{
wd.GroupBox{
Title: tabCoreTitle,
Layout: wd.Grid{Columns: 3},
Children: []wd.Widget{
wd.VSpacer{ColumnSpan: 3, Size: 1},
wd.Label{
ColumnSpan: 2,
Text: "QC Username:",
},
wd.LineEdit{
ColumnSpan: 2,
Text: wd.Bind("Username"),
ToolTipText: `Enter your Bethesda.net username`,
},
wd.Label{
ColumnSpan: 2,
Text: "QC Password:",
},
wd.LineEdit{
ColumnSpan: 2,
Text: wd.Bind("Password"),
ToolTipText: `Enter your Bethesda.net password`,
PasswordMode: true,
},
wd.Label{
ColumnSpan: 2,
Text: "QC Language:",
},
wd.ComboBox{
ColumnSpan: 2,
Editable: false,
Value: wd.Bind("Language"),
ToolTipText: `Select the language for the in-game QC interface`,
BindingMember: "LangCode",
DisplayMember: "Name",
Model: []*Language{
{"en", "English"},
{"es", "Español"},
{"es-419", "Español (Latinoamérica)"},
{"de", "Deutsch"},
{"fr", "Français"},
{"it", "Italiano"},
{"pl", "Polski"},
{"pt", "Português (Brasil)"},
{"ru", "Русский"},
},
},
wd.Label{
ColumnSpan: 2,
Text: "QC EXE Location",
},
wd.PushButton{
ColumnSpan: 2,
Text: "Select QC EXE",
ToolTipText: "Select your Quake Champions.exe file location",
OnClicked: func() {
qcFilePathDialog := &walk.FileDialog{}
qcFilePathDialog.Filter = "Quake Champions Exe File (QuakeChampions.exe)|QuakeChampions.exe*.*"
qcFilePathDialog.Title = "Select your QuakeChampions.exe file"
qcDefaultDir := "C:\\Program Files (x86)\\Bethesda.net Launcher\\games\\quakechampions"
if dirExists(qcDefaultDir) {
qcFilePathDialog.InitialDirPath = qcDefaultDir
}
if accepted, err := qcFilePathDialog.ShowOpen(nil); err != nil {
logger.Errorw(fmt.Sprintf("%s: error submitting data to binder when saving QC filepath", GetCaller()),
"error", err)
return
} else if !accepted {
return
}
qcCoreSettings.FilePath = qcFilePathDialog.FilePath
},
},
wd.Label{ColumnSpan: 2, Text: qcCoreSettings.FilePath},
wd.VSpacer{ColumnSpan: 2, Size: 4},
},
},
},
}
qcCoreSettingsTab.TabPage = tabPage
return qcCoreSettingsTab
}