structures.go 1.29 KB
Newer Older
Loïck Bonniot's avatar
Loïck Bonniot committed
1
2
package gui

Loïck Bonniot's avatar
Loïck Bonniot committed
3
4
// This file stores strucutures used in GUI for fast documentation.

Loïck Bonniot's avatar
Loïck Bonniot committed
5
6
import (
	"time"
7
8

	"github.com/visualfc/goqt/ui"
Loïck Bonniot's avatar
Loïck Bonniot committed
9
10
)

11
12
13
14
15
16
// Window contains all information used to make the demonstrator works.
// It extends QMainWindow and cache several graphic informations.
// Do not attempt to instantiante it directly, use `NewWindow` function instead.
type Window struct {
	*ui.QMainWindow

Loïck Bonniot's avatar
Loïck Bonniot committed
17
18
19
20
21
	logField     *ui.QTextEdit
	graphics     *ui.QGraphicsView
	progress     *ui.QLabel
	playButton   *ui.QPushButton
	stopButton   *ui.QPushButton
22
	replayButton *ui.QPushButton
23
24
	quantumField *ui.QSpinBox
	speedSlider  *ui.QSlider
Loïck Bonniot's avatar
Loïck Bonniot committed
25
26
27
	scene        *Scene
	circleSize   float64
	pixmaps      map[string]*ui.QPixmap
28
29

	currentArrows []*ui.QGraphicsPathItem
30
	timer         *ui.QTimer
31
32
}

Loïck Bonniot's avatar
Loïck Bonniot committed
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Client represents a DFSSC instance
type Client struct {
	Name string
}

// EventType is used as an enum for event types, to differenciate promises, signatures...
type EventType int

const (
	PROMISE EventType = iota
	SIGNATURE
	OTHER
)

// Event represents a single signature event
type Event struct {
	Type     EventType
	Sender   int
	Receiver int
52
	Date     time.Time
Loïck Bonniot's avatar
Loïck Bonniot committed
53
54
55
56
57
58
59
}

// Scene holds the global scene for registered clients and signature events
type Scene struct {
	Clients []Client
	Events  []Event

Loïck Bonniot's avatar
Loïck Bonniot committed
60
61
	currentTime  time.Time
	currentEvent int
Loïck Bonniot's avatar
Loïck Bonniot committed
62
}