types.go (1542B)
1 package ui 2 3 import ( 4 "github.com/Nordgedanken/Morpheus/matrix" 5 "github.com/Nordgedanken/Morpheus/matrix/db" 6 "github.com/Nordgedanken/Morpheus/matrix/syncer" 7 "github.com/matrix-org/gomatrix" 8 "github.com/therecipe/qt/core" 9 "github.com/therecipe/qt/widgets" 10 ) 11 12 // Config holds important reused information in the UI 13 type config struct { 14 username string 15 password string 16 17 windowWidth int 18 windowHeight int 19 20 matrixClient 21 } 22 23 type matrixClient struct { 24 databases 25 cli *gomatrix.Client 26 syncer *syncer.MorpheusSyncer 27 } 28 29 type databases struct { 30 cacheDB db.Storer 31 } 32 33 // SetCurrentRoom sets the new room ID of the MainUI 34 func (d *databases) SetCacheDB(db db.Storer) { 35 d.cacheDB = db 36 } 37 38 // MainUI holds information about the MainUI 39 type MainUI struct { 40 config 41 42 widget *widgets.QWidget 43 widgetThread *core.QThread 44 RoomAvatar *widgets.QLabel 45 RoomTitle *widgets.QLabel 46 RoomTopic *widgets.QLabel 47 MainWidget *widgets.QWidget 48 MessageListLayout *QVBoxLayoutWithTriggerSlot 49 messageScrollArea *widgets.QScrollArea 50 messageScrollAreaThread *core.QThread 51 52 window *widgets.QMainWindow 53 storage *syncer.MorpheusStore 54 rooms map[string]*matrix.Room 55 currentRoom string 56 } 57 58 // SetCurrentRoom sets the new room ID of the MainUI 59 func (m *MainUI) SetCurrentRoom(RoomID string) { 60 m.currentRoom = RoomID 61 } 62 63 // LoginUI holds information about the LoginUI 64 type LoginUI struct { 65 config 66 widget *widgets.QWidget 67 window *widgets.QMainWindow 68 }