2024-09-20 06:39:01 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/xml"
|
|
|
|
)
|
|
|
|
|
|
|
|
type UiLayoutItem struct {
|
2024-10-05 04:49:10 +00:00
|
|
|
Row *int `xml:"row,attr"`
|
|
|
|
Column *int `xml:"column,attr"`
|
|
|
|
RowSpan *int `xml:"rowspan,attr"`
|
|
|
|
ColSpan *int `xml:"colspan,attr"`
|
2024-10-03 04:11:30 +00:00
|
|
|
|
|
|
|
// A layout item either has a widget, or a spacer
|
|
|
|
Widget *UiWidget `xml:"widget"`
|
|
|
|
Spacer *UiSpacer `xml:"spacer"`
|
2024-09-20 06:39:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type UiLayout struct {
|
2024-10-03 05:07:43 +00:00
|
|
|
Class string `xml:"class,attr"`
|
|
|
|
Name string `xml:"name,attr"`
|
|
|
|
Properties []UiProperty `xml:"property"`
|
|
|
|
Items []UiLayoutItem `xml:"item"`
|
2024-09-20 06:39:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type UiPropertyContainer struct {
|
|
|
|
Properties []UiProperty `xml:"property"`
|
|
|
|
}
|
|
|
|
|
2024-10-03 04:11:30 +00:00
|
|
|
type UiSpacer struct {
|
|
|
|
Name string `xml:"name,attr"`
|
|
|
|
Properties []UiProperty `xml:"property"`
|
|
|
|
}
|
|
|
|
|
2024-09-20 06:39:01 +00:00
|
|
|
type UiWidget struct {
|
|
|
|
Class string `xml:"class,attr"`
|
|
|
|
Name string `xml:"name,attr"`
|
|
|
|
Properties []UiProperty `xml:"property"`
|
|
|
|
Attributes []UiProperty `xml:"attribute"`
|
|
|
|
|
|
|
|
Layout *UiLayout `xml:"layout,omitempty"`
|
|
|
|
Widgets []UiWidget `xml:"widget"` // If no layout
|
|
|
|
|
|
|
|
Columns []UiPropertyContainer `xml:"column"` // e.g. for QTreeWidget
|
|
|
|
Items []UiPropertyContainer `xml:"item"` // e.g. for QComboBox
|
|
|
|
|
|
|
|
AddActions []UiActionReference `xml:"addaction"`
|
|
|
|
Actions []UiAction `xml:"action"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type UiRect struct {
|
|
|
|
X int `xml:"x"`
|
|
|
|
Y int `xml:"y"`
|
|
|
|
Width int `xml:"width"`
|
|
|
|
Height int `xml:"height"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type UiString struct {
|
|
|
|
Value string `xml:",chardata"`
|
|
|
|
Notr bool `xml:"notr,attr,omitempty"`
|
|
|
|
}
|
|
|
|
|
2024-10-03 05:51:50 +00:00
|
|
|
type UiIcon struct {
|
|
|
|
ResourceFile string `xml:"resource,attr"`
|
|
|
|
|
|
|
|
NormalOff *string `xml:"normaloff,omitempty"`
|
|
|
|
NormalOn *string `xml:"normalon,omitempty"`
|
|
|
|
ActiveOff *string `xml:"activeoff,omitempty"`
|
|
|
|
ActiveOn *string `xml:"activeon,omitempty"`
|
|
|
|
DisabledOff *string `xml:"disabledoff,omitempty"`
|
|
|
|
DisabledOn *string `xml:"disabledon,omitempty"`
|
|
|
|
SelectedOff *string `xml:"selectedoff,omitempty"`
|
|
|
|
SelectedOn *string `xml:"selectedon,omitempty"`
|
|
|
|
|
|
|
|
Base string `xml:",chardata"`
|
|
|
|
}
|
|
|
|
|
2024-09-20 06:39:01 +00:00
|
|
|
type UiProperty struct {
|
|
|
|
Name string `xml:"name,attr"`
|
|
|
|
StringVal *UiString `xml:"string,omitempty"`
|
|
|
|
NumberVal *string `xml:"number,omitempty"` // Preserve as string literal
|
2024-10-03 04:23:12 +00:00
|
|
|
BoolVal *bool `xml:"bool,omitempty"` // "true" or "false"
|
2024-09-20 06:39:01 +00:00
|
|
|
EnumVal *string `xml:"enum,omitempty"`
|
|
|
|
RectVal *UiRect `xml:"rect,omitempty"`
|
2024-10-03 05:51:50 +00:00
|
|
|
IconVal *UiIcon `xml:"iconset,omitempty"`
|
2024-10-05 04:48:58 +00:00
|
|
|
SetVal *string `xml:"set,omitempty"`
|
2024-09-20 06:39:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type UiActionReference struct {
|
|
|
|
Name string `xml:"name,attr"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type UiAction struct {
|
|
|
|
Name string `xml:"name,attr"`
|
|
|
|
Properties []UiProperty `xml:"property"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type UiResources struct {
|
|
|
|
}
|
|
|
|
|
|
|
|
type UiConnections struct {
|
|
|
|
}
|
|
|
|
|
2024-10-03 05:07:43 +00:00
|
|
|
type UiLayoutDefault struct {
|
|
|
|
Spacing *int `xml:"spacing,attr,omitempty"`
|
|
|
|
Margin *int `xml:"margin,attr,omitempty"`
|
|
|
|
}
|
|
|
|
|
2024-09-20 06:39:01 +00:00
|
|
|
type UiFile struct {
|
|
|
|
XMLName xml.Name // should always be xml.Name{Local: "ui"}
|
|
|
|
|
2024-10-03 05:07:43 +00:00
|
|
|
Class string `xml:"class"`
|
|
|
|
Version string `xml:"version,attr"` // e.g. 4.0
|
|
|
|
Widget UiWidget `xml:"widget"` // There's only one root widget
|
|
|
|
Resources UiResources `xml:"resources"`
|
|
|
|
Connections UiConnections `xml:"connections"`
|
|
|
|
LayoutDefault *UiLayoutDefault `xml:"layoutdefault,omitempty"`
|
2024-09-20 06:39:01 +00:00
|
|
|
}
|