ui

package
v1.16.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 17, 2024 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const AppName = "FRP Manager"

Variables

View Source
var AppLocalName = i18n.Sprintf(AppName)

Functions

func AlignGrid added in v1.10.1

func AlignGrid(page TabPage, n int) TabPage

AlignGrid resizes the first child of a grid to the width of the first column. After that, we keep a fixed width column regardless of whether the row is hidden or not.

func GetWindowText added in v1.12.0

func GetWindowText(hWnd win.HWND) string

func NewAttributeDialog added in v1.16.0

func NewAttributeDialog(title string, data *map[string]string) Dialog

NewAttributeDialog returns a dialog box with data displayed in the attribute table.

func NewAttributeTable added in v1.16.0

func NewAttributeTable(m *AttributeModel, nameWidth, valueWidth int) Composite

NewAttributeTable returns a two-column table view. The first column is name and the second column is value. It provides the ability to edit cells by double-clicking.

func NewBasicDialog added in v1.7.1

func NewBasicDialog(assignTo **walk.Dialog, title string, icon Property, db DataBinder, yes func(), widgets ...Widget) Dialog

NewBasicDialog returns a dialog with given widgets and default buttons

func NewBrowseLineEdit added in v1.7.0

func NewBrowseLineEdit(assignTo **walk.LineEdit, visible, enable, text Property, title, filter string, file bool) Composite

NewBrowseLineEdit places a tool button at the tail of a LineEdit, and opens a file dialog when the button is clicked

func NewNumberInput added in v1.16.0

func NewNumberInput(opt NIOption) Composite

NewNumberInput returns a number edit with custom prefix and suffix.

func NewRadioButtonGroup added in v1.7.1

func NewRadioButtonGroup(dataMember string, db *DataBinder, visible Property, buttons []RadioButton) Composite

NewRadioButtonGroup returns a simple radio button group

func PathOfConf added in v1.9.0

func PathOfConf(base string) string

PathOfConf returns the file path of a config with given base file name

func RunUI

func RunUI() error

func SetWindowText added in v1.12.0

func SetWindowText(hWnd win.HWND, text string) bool

Types

type AboutPage

type AboutPage struct {
	*walk.TabPage
	// contains filtered or unexported fields
}

func NewAboutPage

func NewAboutPage() *AboutPage

func (*AboutPage) OnCreate added in v1.7.0

func (ap *AboutPage) OnCreate()

func (*AboutPage) Page added in v1.7.0

func (ap *AboutPage) Page() TabPage

type AttributeModel added in v1.16.0

type AttributeModel struct {
	walk.TableModelBase
	// contains filtered or unexported fields
}

AttributeModel is a list of name-value pairs.

func NewAttributeModel added in v1.16.0

func NewAttributeModel(attrs map[string]string) *AttributeModel

func (*AttributeModel) Add added in v1.16.0

func (a *AttributeModel) Add(k, v string)

func (*AttributeModel) AsMap added in v1.16.0

func (a *AttributeModel) AsMap() map[string]string

func (*AttributeModel) Clear added in v1.16.0

func (a *AttributeModel) Clear()

func (*AttributeModel) Delete added in v1.16.0

func (a *AttributeModel) Delete(i int)

func (*AttributeModel) RowCount added in v1.16.0

func (a *AttributeModel) RowCount() int

func (*AttributeModel) Value added in v1.16.0

func (a *AttributeModel) Value(row, col int) interface{}

type Conf added in v1.7.0

type Conf struct {
	sync.Mutex
	// Name of the config
	Name        string
	DisplayName string
	// Path of the config file
	Path string
	// State of service
	State consts.ServiceState
	// Install indicates whether a service is installed
	Install bool
	// Data is ClientConfig or ServerConfig
	Data config.Config
}

Conf contains all data of a config

func NewConf added in v1.7.0

func NewConf(path string, data config.Config) *Conf

func (*Conf) Delete added in v1.7.0

func (conf *Conf) Delete() (bool, error)

Delete config will remove service, logs, config file in disk/mem

func (*Conf) Save added in v1.7.0

func (conf *Conf) Save() error

Save config to the disk. The config will be completed before saving

type ConfBinder added in v1.7.0

type ConfBinder struct {
	// Current selected config
	Current *Conf
	// Selected indicates whether there's a selected config
	Selected bool
	// Commit will save the given config and try to reload service
	Commit func(conf *Conf, flag runFlag)
}

ConfBinder is the view model of the current selected config

type ConfListModel

type ConfListModel struct {
	walk.TableModelBase
	// contains filtered or unexported fields
}

func NewConfListModel

func NewConfListModel(items []*Conf) *ConfListModel

func (*ConfListModel) Items

func (m *ConfListModel) Items() interface{}

type ConfPage

type ConfPage struct {
	*walk.TabPage
	// contains filtered or unexported fields
}

func NewConfPage

func NewConfPage() *ConfPage

func (*ConfPage) OnCreate added in v1.7.0

func (cp *ConfPage) OnCreate()

func (*ConfPage) Page added in v1.7.0

func (cp *ConfPage) Page() TabPage

type ConfView

type ConfView struct {
	*walk.Composite
	// contains filtered or unexported fields
}

func NewConfView

func NewConfView() *ConfView

func (*ConfView) ImportFiles added in v1.8.0

func (cv *ConfView) ImportFiles(files []string)

func (*ConfView) Invalidate added in v1.7.0

func (cv *ConfView) Invalidate()

Invalidate conf view with last selected index

func (*ConfView) OnCreate added in v1.7.0

func (cv *ConfView) OnCreate()

func (*ConfView) View added in v1.7.0

func (cv *ConfView) View() Widget

type DetailView

type DetailView struct {
	*walk.Composite
	// contains filtered or unexported fields
}

func NewDetailView

func NewDetailView() *DetailView

func (*DetailView) Invalidate added in v1.7.0

func (dv *DetailView) Invalidate()

func (*DetailView) OnCreate added in v1.7.0

func (dv *DetailView) OnCreate()

func (*DetailView) View added in v1.7.0

func (dv *DetailView) View() Widget

type EditClientDialog added in v1.7.0

type EditClientDialog struct {
	*walk.Dialog

	// Config data
	Conf *Conf

	ShouldRestart bool
	Added         bool
	// contains filtered or unexported fields
}

func NewEditClientDialog added in v1.7.0

func NewEditClientDialog(conf *Conf, name string) *EditClientDialog

func (*EditClientDialog) Run added in v1.7.0

func (cd *EditClientDialog) Run(owner walk.Form) (int, error)

func (*EditClientDialog) View added in v1.7.0

func (cd *EditClientDialog) View() Dialog

type EditProxyDialog added in v1.7.0

type EditProxyDialog struct {
	*walk.Dialog

	Proxy *config.Proxy
	// contains filtered or unexported fields
}

func NewEditProxyDialog added in v1.7.0

func NewEditProxyDialog(configName string, proxy *config.Proxy, visitors []string, exist bool) *EditProxyDialog

func (*EditProxyDialog) Run added in v1.7.0

func (pd *EditProxyDialog) Run(owner walk.Form) (int, error)

func (*EditProxyDialog) View added in v1.7.0

func (pd *EditProxyDialog) View() Dialog

type FRPManager

type FRPManager struct {
	*walk.MainWindow
	// contains filtered or unexported fields
}

type GithubRelease added in v1.7.0

type GithubRelease struct {
	TagName string `json:"tag_name"`
	HtmlUrl string `json:"html_url"`
}

type ListModel added in v1.7.0

type ListModel struct {
	walk.ListModelBase
	// contains filtered or unexported fields
}

func NewListModel added in v1.7.0

func NewListModel(items []*Conf) *ListModel

func (*ListModel) ItemCount added in v1.7.0

func (m *ListModel) ItemCount() int

func (*ListModel) Value added in v1.7.0

func (m *ListModel) Value(index int) interface{}

type LogModel

type LogModel struct {
	walk.ReflectTableModelBase
	// contains filtered or unexported fields
}

func NewLogModel

func NewLogModel(path string) *LogModel

func (*LogModel) Items

func (m *LogModel) Items() interface{}

func (*LogModel) Reset

func (m *LogModel) Reset() error

Reset reload the whole log file from disk

type LogPage

type LogPage struct {
	*walk.TabPage
	sync.Mutex
	// contains filtered or unexported fields
}

func NewLogPage

func NewLogPage() *LogPage

func (*LogPage) OnCreate added in v1.7.0

func (lp *LogPage) OnCreate()

func (*LogPage) Page added in v1.7.0

func (lp *LogPage) Page() TabPage

type NATDiscoveryDialog added in v1.14.0

type NATDiscoveryDialog struct {
	*walk.Dialog
	// contains filtered or unexported fields
}

func NewNATDiscoveryDialog added in v1.14.0

func NewNATDiscoveryDialog(serverAddr string) *NATDiscoveryDialog

func (*NATDiscoveryDialog) Run added in v1.14.0

func (nd *NATDiscoveryDialog) Run(owner walk.Form) (int, error)

type NIOption added in v1.16.0

type NIOption struct {
	Title        string
	Value        Property
	Suffix       string
	Min          float64
	Max          float64
	Width        int
	Style        uint32
	Greedy       bool
	NoSpinButton bool
	NoSpacer     bool
	Visible      Property
	Enabled      Property
}

type NonSortedModel added in v1.14.0

type NonSortedModel[T any] struct {
	walk.ReflectTableModelBase
	// contains filtered or unexported fields
}

NonSortedModel preserves the original order of items in the slice.

func NewNonSortedModel added in v1.14.0

func NewNonSortedModel[T any](items []*T) *NonSortedModel[T]

func (*NonSortedModel[T]) Items added in v1.14.0

func (m *NonSortedModel[T]) Items() interface{}

type PanelView added in v1.7.0

type PanelView struct {
	*walk.GroupBox
	// contains filtered or unexported fields
}

func NewPanelView added in v1.7.0

func NewPanelView() *PanelView

func (*PanelView) Invalidate added in v1.7.0

func (pv *PanelView) Invalidate()

Invalidate updates views using the current config

func (*PanelView) OnCreate added in v1.7.0

func (pv *PanelView) OnCreate()

func (*PanelView) StartService added in v1.7.0

func (pv *PanelView) StartService(conf *Conf) error

StartService creates a daemon service of the given config, then starts it

func (*PanelView) StopService added in v1.7.0

func (pv *PanelView) StopService(conf *Conf) error

StopService stops the service of the given config, then removes it

func (*PanelView) ToggleService added in v1.7.0

func (pv *PanelView) ToggleService()

func (*PanelView) View added in v1.7.0

func (pv *PanelView) View() Widget

type PluginProxyDialog added in v1.7.1

type PluginProxyDialog struct {
	*walk.Dialog

	Proxies []*config.Proxy
	// contains filtered or unexported fields
}

func NewPluginProxyDialog added in v1.7.1

func NewPluginProxyDialog(title string, icon *walk.Icon, plugin string) *PluginProxyDialog

NewPluginProxyDialog creates proxy with given plugin

func (*PluginProxyDialog) GetProxies added in v1.7.1

func (pp *PluginProxyDialog) GetProxies() []*config.Proxy

func (*PluginProxyDialog) Run added in v1.7.1

func (pp *PluginProxyDialog) Run(owner walk.Form) (int, error)

type PortProxyDialog added in v1.12.0

type PortProxyDialog struct {
	*walk.Dialog

	Proxies []*config.Proxy
	// contains filtered or unexported fields
}

func NewPortProxyDialog added in v1.12.0

func NewPortProxyDialog() *PortProxyDialog

func (*PortProxyDialog) GetProxies added in v1.12.0

func (pp *PortProxyDialog) GetProxies() []*config.Proxy

func (*PortProxyDialog) Run added in v1.12.0

func (pp *PortProxyDialog) Run(owner walk.Form) (int, error)

type PrefPage added in v1.12.0

type PrefPage struct {
	*walk.TabPage
	// contains filtered or unexported fields
}

func NewPrefPage added in v1.12.0

func NewPrefPage() *PrefPage

func (*PrefPage) OnCreate added in v1.12.0

func (pp *PrefPage) OnCreate()

func (*PrefPage) Page added in v1.12.0

func (pp *PrefPage) Page() TabPage

type ProxyItem added in v1.9.0

type ProxyItem struct {
	*config.Proxy
	// Domains is a list of domains bound to this proxy
	Domains string
	// DisplayLocalIP changes the local address shown in table
	DisplayLocalIP string
	// DisplayLocalPort changes the local port shown in table
	DisplayLocalPort string
}

type ProxyModel added in v1.7.1

type ProxyModel struct {
	walk.ReflectTableModelBase
	// contains filtered or unexported fields
}

func NewProxyModel added in v1.7.1

func NewProxyModel(conf *Conf) *ProxyModel

func (*ProxyModel) Items added in v1.7.1

func (m *ProxyModel) Items() interface{}

type ProxyView added in v1.7.1

type ProxyView struct {
	*walk.Composite
	// contains filtered or unexported fields
}

func NewProxyView added in v1.7.1

func NewProxyView() *ProxyView

func (*ProxyView) Invalidate added in v1.7.1

func (pv *ProxyView) Invalidate()

func (*ProxyView) OnCreate added in v1.7.1

func (pv *ProxyView) OnCreate()

func (*ProxyView) View added in v1.7.1

func (pv *ProxyView) View() Widget

type QuickAdd added in v1.7.1

type QuickAdd interface {
	// Run a new simple dialog to input few parameters
	Run(owner walk.Form) (int, error)
	// GetProxies returns the proxies generated by quick-add dialog
	GetProxies() []*config.Proxy
}

QuickAdd is the interface that must be implemented to build a quick-add dialog

type SimpleProxyDialog added in v1.7.0

type SimpleProxyDialog struct {
	*walk.Dialog

	Proxies []*config.Proxy
	// contains filtered or unexported fields
}

func NewSimpleProxyDialog added in v1.7.0

func NewSimpleProxyDialog(title string, icon *walk.Icon, service string, types []string, localAddr string) *SimpleProxyDialog

NewSimpleProxyDialog creates proxies connecting to the local service

func (*SimpleProxyDialog) GetProxies added in v1.7.1

func (sp *SimpleProxyDialog) GetProxies() []*config.Proxy

func (*SimpleProxyDialog) Run added in v1.7.0

func (sp *SimpleProxyDialog) Run(owner walk.Form) (int, error)

type StringPair added in v1.11.0

type StringPair struct {
	Name        string
	DisplayName string
}

StringPair is a simple struct to hold a pair of strings.

func NewDefaultListModel added in v1.7.0

func NewDefaultListModel(items []string, defaultKey string, defaultName string) []*StringPair

NewDefaultListModel creates a default item at the top of the model.

func NewStringPairModel added in v1.11.0

func NewStringPairModel(keys []string, values []string, defaultValue string) []*StringPair

NewStringPairModel creates a slice of string pair from two string slices.

type TextLine added in v1.7.0

type TextLine struct {
	Text string
}

type URLConf added in v1.9.0

type URLConf struct {
	// Filename is the name of the downloaded file
	Filename string
	// Zip defines whether the Data is a zip file
	Zip bool
	// Rename defines whether we can change the name of
	// new config if the original name exists.
	Rename bool
	// Downloaded raw Data from URL
	Data []byte
}

URLConf provides config data downloaded from URL

type URLImportDialog added in v1.9.0

type URLImportDialog struct {
	*walk.Dialog

	// Items contain the downloaded data from URLs
	Items []URLConf
	// contains filtered or unexported fields
}

func NewURLImportDialog added in v1.9.0

func NewURLImportDialog() *URLImportDialog

func (*URLImportDialog) Run added in v1.9.0

func (ud *URLImportDialog) Run(owner walk.Form) (int, error)

type ValidateDialog added in v1.12.0

type ValidateDialog struct {
	// contains filtered or unexported fields
}

ValidateDialog validates the administration password.

func NewValidateDialog added in v1.12.0

func NewValidateDialog() *ValidateDialog

func (*ValidateDialog) Run added in v1.12.0

func (vd *ValidateDialog) Run() (int, error)

type View added in v1.7.0

type View interface {
	// View should define widget in declarative way, and will
	// be called by the parent widget.
	View() Widget
	// OnCreate will be called after the creation of views. The
	// view reference should be available now.
	OnCreate()
	// Invalidate should be called if data that view relying on
	// is changed. The view should be updated with new data.
	Invalidate()
}

View is the interface that must be implemented to build a Widget.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL