app

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidInput = fmt.Errorf("invalid input provided")

Functions

This section is empty.

Types

type App

type App struct {
	*Config
	// contains filtered or unexported fields
}

App struct.

func New

func New(logger *logs.Logger, config *Config) *App

New creates a new App application struct.

func (*App) Ask added in v0.1.0

func (a *App) Ask(title, msg string) bool

Ask the user a Yes/No question.

func (*App) CheckUpdate added in v0.0.2

func (a *App) CheckUpdate() (*Release, error)

func (*App) CreateShortcut added in v0.0.2

func (a *App) CreateShortcut() (string, error)

CreateShortcut makes a shortcut to the exe on Windows desktop.

func (*App) DownloadUpdate added in v0.0.2

func (a *App) DownloadUpdate() (*UpdateInfo, error)

func (*App) ErrorDialog added in v0.1.0

func (a *App) ErrorDialog(title, msg string)

ErrorDialog displays an error on screen.

func (*App) GetConfig

func (a *App) GetConfig() *config.Settings

GetConfig returns a copy of the app settings.

func (*App) Languages added in v0.0.3

func (a *App) Languages() map[string]string

Languages returns a list of languages the backend supports.

func (*App) LaunchInstaller added in v0.0.2

func (a *App) LaunchInstaller(path string) (string, error)

func (*App) OpenFolder added in v0.0.2

func (a *App) OpenFolder(path string) string

func (*App) PickFile added in v0.1.0

func (a *App) PickFile(path, extname, extensions string) (string, error)

PickFile opens the file selector.

func (*App) PickFolder

func (a *App) PickFolder(path string) (string, error)

PickFolder opens the folder selector.

func (*App) Quit

func (a *App) Quit()

Quit shuts the app down.

func (*App) RemoveInstance added in v0.1.0

func (a *App) RemoveInstance(idx int, starrApp string) (*SavedInstance, error)

RemoveInstance deletes an instance from the configuration.

func (*App) SaveConfigItem

func (a *App) SaveConfigItem(name string, value any, reload bool) (*ConfigSaved, error)

SaveConfigItem saves a single item to the running config and writes the config file.

func (*App) SaveInstance added in v0.1.0

func (a *App) SaveInstance(idx int, instance starrs.AppConfig, defaultInstance bool) (*SavedInstance, error)

SaveInstance saves the configuration for an instance.

func (*App) Startup

func (a *App) Startup(ctx context.Context)

Startup is called when the app starts. The context is saved so runtime methods may be called.

func (*App) Version

func (a *App) Version() Version

Version returns the app version and other immutable info.

type Config added in v0.1.0

type Config struct {
	Logger     *logs.Logger
	ConfigFile string // empty unless passed in from cli
	AppMenu    *menu.Menu
	Starrs     *starrs.Starrs
}

Config is the input data passed in from main.go.

type ConfigSaved added in v0.0.3

type ConfigSaved struct {
	Msg string
	Val any
}

ConfigSaved sends back the value and a message when a config item changes.

type Info added in v0.0.3

type Info struct {
	IsWindows bool
	IsLinux   bool
	IsMac     bool
	Name      string
	Title     string
	Exe       string
	Home      string
	Username  string
}

Info provides additional immutable data to the front end.

type Release added in v0.0.3

type Release struct {
	*update.Update
	Size string
}

type SavedInstance added in v0.1.0

type SavedInstance struct {
	Msg  string
	List []starrs.AppConfig
}

SavedInstance is the response to the frontend after instances changes.

type UpdateInfo added in v0.0.2

type UpdateInfo struct {
	Msg  string
	Path string
	Size string
}

type Version

type Version struct {
	StartTime int64
	Version   string
	Revision  string
	Branch    string
	BuildUser string
	BuildDate string
	GoVersion string
	Started   string
	Info
}

Version lets the frontend know who it is.

Jump to

Keyboard shortcuts

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