63.diff (202222B)
1 diff --git a/.circleci/config.yml b/.circleci/config.yml 2 index 8655879..f460b8d 100644 3 --- a/.circleci/config.yml 4 +++ b/.circleci/config.yml 5 @@ -38,6 +38,10 @@ jobs: 6 - attach_workspace: 7 # Must be absolute path or relative path from working_directory 8 at: /home/user/work/ 9 + - run: 10 + name: Update Build Deps 11 + working_directory: /home/user/work/src/github.com/Nordgedanken/Morpheus/ 12 + command: apt-get update -y -qq && apt-get install apt -y -qq && add-apt-repository ppa:ubuntu-toolchain-r/test -y && apt-get update -y -qq && apt-get -y -qq install gcc-5 g++-5 && rm -f /usr/bin/gcc && ln -s /usr/bin/gcc-5 /usr/bin/gcc && rm -f /usr/bin/g++ && ln -s /usr/bin/g++-5 /usr/bin/g++ 13 - run: 14 name: Run Build 15 working_directory: /home/user/work/src/github.com/Nordgedanken/Morpheus/ 16 @@ -67,12 +71,12 @@ jobs: 17 - run: 18 name: Build Tests 19 working_directory: /home/user/work/src/github.com/Nordgedanken/Morpheus/ 20 - command: $GOPATH/bin/ginkgo build /home/user/work/src/github.com/Nordgedanken/Morpheus/ 21 + command: $GOPATH/bin/ginkgo build --cover /home/user/work/src/github.com/Nordgedanken/Morpheus/ 22 no_output_timeout: 1200 23 - run: 24 name: Run Tests 25 working_directory: /home/user/work/src/github.com/Nordgedanken/Morpheus/ 26 - command: $GOPATH/bin/ginkgo -r -p --randomizeAllSpecs --randomizeSuites --failOnPending --trace --race --progress /home/user/work/src/github.com/Nordgedanken/Morpheus/Morpheus.test 27 + command: $GOPATH/bin/ginkgo --cover --coverprofile=c.out -r -p --randomizeAllSpecs --randomizeSuites --failOnPending --trace --race --progress /home/user/work/src/github.com/Nordgedanken/Morpheus/Morpheus.test 28 no_output_timeout: 1200 29 - run: 30 name: Debug Print directory 31 @@ -81,6 +85,22 @@ jobs: 32 command: ls -lah 33 - store_test_results: 34 path: /home/user/work/src/github.com/Nordgedanken/Morpheus/junit.xml 35 + lint: 36 + docker: 37 + - image: therecipe/qt:linux 38 + steps: 39 + - attach_workspace: 40 + # Must be absolute path or relative path from working_directory 41 + at: /home/user/work/ 42 + - run: 43 + name: Generate additional binding files 44 + working_directory: /home/user/work/src/github.com/Nordgedanken/Morpheus/ 45 + command: $GOPATH/bin/qtrcc desktop && $GOPATH/bin/qtmoc desktop 46 + - run: 47 + name: Run Lint 48 + working_directory: /home/user/work/src/github.com/Nordgedanken/Morpheus/ 49 + command: chmod +x scripts/lint.sh && scripts/lint.sh 50 + no_output_timeout: 1200 51 build_win_static: 52 docker: 53 - image: therecipe/qt:windows_64_static 54 @@ -109,6 +129,9 @@ workflows: 55 - test: 56 requires: 57 - prepare 58 + - lint: 59 + requires: 60 + - prepare 61 notify: 62 webhooks: 63 - url: https://riot.nordgedanken.de:4051/services/hooks/Y2lyY2xlY2lfc2VydmljZQ 64 diff --git a/.gitignore b/.gitignore 65 index fbc1321..e1da019 100644 66 --- a/.gitignore 67 +++ b/.gitignore 68 @@ -18,6 +18,7 @@ debug* 69 log/ 70 data/ 71 ui/moc* 72 +matrix/moc* 73 .idea/ 74 Morpheus.exe 75 Morpheus.msi 76 \ No newline at end of file 77 diff --git a/README.md b/README.md 78 index 0255893..7ffd929 100644 79 --- a/README.md 80 +++ b/README.md 81 @@ -2,6 +2,8 @@ 82 [](https://circleci.com/gh/Nordgedanken/Morpheus) 83 84 []() 85 + 86 +[](https://goreportcard.com/report/github.com/Nordgedanken/Morpheus) 87 --- 88 89 A Matrix client written in Go-QT 90 diff --git a/artwork/34c3Banner.jpg b/artwork/34c3Banner.jpg 91 new file mode 100644 92 index 0000000..c46c007 93 Binary files /dev/null and b/artwork/34c3Banner.jpg differ 94 diff --git a/artwork/34c3Banner.xcf b/artwork/34c3Banner.xcf 95 new file mode 100644 96 index 0000000..fc0849a 97 Binary files /dev/null and b/artwork/34c3Banner.xcf differ 98 diff --git a/artwork/Morpheus Long Logo with link.xcf b/artwork/Morpheus Long Logo with link.xcf 99 new file mode 100644 100 index 0000000..0b9b0f0 101 Binary files /dev/null and b/artwork/Morpheus Long Logo with link.xcf differ 102 diff --git a/artwork/Morpheus Long Logo.png b/artwork/Morpheus Long Logo.png 103 new file mode 100644 104 index 0000000..b70ac9a 105 Binary files /dev/null and b/artwork/Morpheus Long Logo.png differ 106 diff --git a/artwork/Morpheus Long Logo.xcf b/artwork/Morpheus Long Logo.xcf 107 new file mode 100644 108 index 0000000..4f5577b 109 Binary files /dev/null and b/artwork/Morpheus Long Logo.xcf differ 110 diff --git a/linter.json b/linter.json 111 index 14230e7..2b2b1f4 100644 112 --- a/linter.json 113 +++ b/linter.json 114 @@ -1,5 +1,5 @@ 115 { 116 - "Vendor": false, 117 + "Vendor": true, 118 "Cyclo": 12, 119 "Deadline": "5m", 120 "Enable": [ 121 diff --git a/main.go b/main.go 122 index b20f4a0..9f05cfe 100644 123 --- a/main.go 124 +++ b/main.go 125 @@ -8,7 +8,6 @@ import ( 126 127 "github.com/Nordgedanken/Morpheus/matrix" 128 "github.com/Nordgedanken/Morpheus/matrix/db" 129 - "github.com/Nordgedanken/Morpheus/matrix/scalar" 130 "github.com/Nordgedanken/Morpheus/ui" 131 "github.com/Nordgedanken/dugong" 132 "github.com/matrix-org/gomatrix" 133 @@ -20,6 +19,8 @@ import ( 134 ) 135 136 var window *widgets.QMainWindow 137 +var mainUIStruct *ui.MainUI 138 +var loginUIStruct *ui.LoginUI 139 140 func main() { 141 runtime.GOMAXPROCS(128) 142 @@ -110,41 +111,28 @@ func main() { 143 144 //Show MainUI 145 for result := range results { 146 - //TODO Don't switch screen on wrong login data. 147 - MainUIStruct := ui.NewMainUIStruct(windowWidth, windowHeight, window) 148 - MainUIStruct.SetCli(result) 149 - mainUIErr := MainUIStruct.NewUI() 150 + mainUIStruct = ui.NewMainUIStruct(windowWidth, windowHeight, window) 151 + mainUIStruct.SetCli(result) 152 + mainUIErr := mainUIStruct.NewUI() 153 if mainUIErr != nil { 154 log.Errorln("mainUI: ", mainUIErr) 155 return 156 } 157 158 - //scalarTokenTest 159 - openIdToken, OpenIDerr := scalar.GetOpenIDToken(MainUIStruct.GetCli()) 160 - if OpenIDerr != nil { 161 - log.Warnln(OpenIDerr) 162 - } 163 - scalarToken, ScalarRegisterErr := scalar.GetScalarToken(MainUIStruct.GetCli(), openIdToken) 164 - if ScalarRegisterErr != nil { 165 - log.Warnln(ScalarRegisterErr) 166 - } 167 - 168 - log.Infoln(scalarToken) 169 - 170 - MainUIStruct.GetWidget().Resize2(windowWidth, windowHeight) 171 - window.SetCentralWidget(MainUIStruct.GetWidget()) 172 + mainUIStruct.GetWidget().Resize2(windowWidth, windowHeight) 173 + window.SetCentralWidget(mainUIStruct.GetWidget()) 174 } 175 } else { 176 //Show loginUI 177 - LoginUIStruct := ui.NewLoginUIStruct(windowWidth, windowHeight, window) 178 - loginUIErr := LoginUIStruct.NewUI() 179 + loginUIStruct = ui.NewLoginUIStruct(windowWidth, windowHeight, window) 180 + loginUIErr := loginUIStruct.NewUI() 181 if loginUIErr != nil { 182 log.Errorln("Login Err: ", loginUIErr) 183 return 184 } 185 186 - LoginUIStruct.GetWidget().Resize2(windowWidth, windowHeight) 187 - window.SetCentralWidget(LoginUIStruct.GetWidget()) 188 + loginUIStruct.GetWidget().Resize2(windowWidth, windowHeight) 189 + window.SetCentralWidget(loginUIStruct.GetWidget()) 190 } 191 192 window.Resize2(windowWidth, windowHeight) 193 @@ -164,6 +152,21 @@ func main() { 194 195 func cleanup() bool { 196 log.Infoln("cleanup") 197 + 198 + if mainUIStruct != nil { 199 + if mainUIStruct.GetCli() != nil { 200 + log.Infoln("Stop Sync") 201 + mainUIStruct.GetCli().StopSync() 202 + } 203 + } 204 + 205 + if loginUIStruct != nil { 206 + if loginUIStruct.GetCli() != nil { 207 + log.Infoln("Stop Sync") 208 + loginUIStruct.GetCli().StopSync() 209 + } 210 + } 211 + 212 UserDB, DBOpenErr := db.OpenUserDB() 213 if DBOpenErr != nil { 214 log.Errorln(DBOpenErr) 215 diff --git a/matrix/db/db.go b/matrix/db/db.go 216 index cc1b971..942aa01 100644 217 --- a/matrix/db/db.go 218 +++ b/matrix/db/db.go 219 @@ -5,31 +5,36 @@ import ( 220 "os" 221 "path/filepath" 222 "strconv" 223 - "sync" 224 225 "github.com/dgraph-io/badger" 226 "github.com/shibukawa/configdir" 227 ) 228 229 -var UserDB *badger.DB 230 -var CacheDB *badger.DB 231 -var onceCache sync.Once 232 -var onceUser sync.Once 233 +var userDB *badger.DB 234 +var cacheDB *badger.DB 235 +var onceCache Once 236 +var onceUser Once 237 + 238 +func ResetOnceUser() { 239 + onceUser.Reset() 240 +} 241 242 // OpenCacheDB opens or generates the Database file for settings and Cache 243 func OpenCacheDB() (db *badger.DB, err error) { 244 onceCache.Do(func() { 245 // Open the data.db file. It will be created if it doesn't exist. 246 configDirs := configdir.New("Nordgedanken", "Morpheus") 247 - if _, StatErr := os.Stat(filepath.ToSlash(configDirs.QueryFolders(configdir.Global)[0].Path) + "/data/"); os.IsNotExist(StatErr) { 248 - MkdirErr := os.MkdirAll(filepath.ToSlash(configDirs.QueryFolders(configdir.Global)[0].Path)+"/data/", 0755) 249 + filePath := filepath.ToSlash(configDirs.QueryFolders(configdir.Global)[0].Path) 250 + 251 + if _, StatErr := os.Stat(filePath + "/data/"); os.IsNotExist(StatErr) { 252 + MkdirErr := os.MkdirAll(filePath+"/data/", 0700) 253 if MkdirErr != nil { 254 err = MkdirErr 255 return 256 } 257 } 258 - if _, StatErr := os.Stat(filepath.ToSlash(configDirs.QueryFolders(configdir.Global)[0].Path) + "/data/cache/"); os.IsNotExist(StatErr) { 259 - MkdirErr := os.MkdirAll(filepath.ToSlash(configDirs.QueryFolders(configdir.Global)[0].Path)+"/data/cache/", 0755) 260 + if _, StatErr := os.Stat(filePath + "/data/cache/"); os.IsNotExist(StatErr) { 261 + MkdirErr := os.MkdirAll(filePath+"/data/cache/", 0700) 262 if MkdirErr != nil { 263 err = MkdirErr 264 return 265 @@ -37,23 +42,31 @@ func OpenCacheDB() (db *badger.DB, err error) { 266 } 267 opts := badger.DefaultOptions 268 opts.SyncWrites = false 269 - opts.Dir = filepath.ToSlash(configDirs.QueryFolders(configdir.Global)[0].Path) + "/data/cache" 270 - opts.ValueDir = filepath.ToSlash(configDirs.QueryFolders(configdir.Global)[0].Path) + "/data/cache" 271 + opts.Dir = filePath + "/data/cache" 272 + opts.ValueDir = filePath + "/data/cache" 273 + 274 + if _, StatErr := os.Stat(filePath + "/data/cache/LOCK"); StatErr == nil { 275 + DeleteErr := os.Remove(filePath + "/data/cache/LOCK") 276 + if DeleteErr != nil { 277 + err = DeleteErr 278 + return 279 + } 280 + } 281 282 expDB, DBErr := badger.Open(opts) 283 if DBErr != nil { 284 err = DBErr 285 return 286 } 287 - CacheDB = expDB 288 + userDB = expDB 289 }) 290 291 - if CacheDB == nil { 292 + if userDB == nil { 293 err = errors.New("missing CacheDB") 294 return 295 } 296 297 - db = CacheDB 298 + db = userDB 299 return 300 } 301 302 @@ -62,15 +75,17 @@ func OpenUserDB() (db *badger.DB, err error) { 303 onceUser.Do(func() { 304 // Open the data.db file. It will be created if it doesn't exist. 305 configDirs := configdir.New("Nordgedanken", "Morpheus") 306 - if _, StatErr := os.Stat(filepath.ToSlash(configDirs.QueryFolders(configdir.Global)[0].Path) + "/data/"); os.IsNotExist(StatErr) { 307 - MkdirErr := os.MkdirAll(filepath.ToSlash(configDirs.QueryFolders(configdir.Global)[0].Path)+"/data/", 0755) 308 + filePath := filepath.ToSlash(configDirs.QueryFolders(configdir.Global)[0].Path) 309 + 310 + if _, StatErr := os.Stat(filePath + "/data/"); os.IsNotExist(StatErr) { 311 + MkdirErr := os.MkdirAll(filePath+"/data/", 0700) 312 if MkdirErr != nil { 313 err = MkdirErr 314 return 315 } 316 } 317 - if _, StatErr := os.Stat(filepath.ToSlash(configDirs.QueryFolders(configdir.Global)[0].Path) + "/data/user/"); os.IsNotExist(StatErr) { 318 - MkdirErr := os.MkdirAll(filepath.ToSlash(configDirs.QueryFolders(configdir.Global)[0].Path)+"/data/user/", 0755) 319 + if _, StatErr := os.Stat(filePath + "/data/user/"); os.IsNotExist(StatErr) { 320 + MkdirErr := os.MkdirAll(filePath+"/data/user/", 0700) 321 if MkdirErr != nil { 322 err = MkdirErr 323 return 324 @@ -78,8 +93,16 @@ func OpenUserDB() (db *badger.DB, err error) { 325 } 326 opts := badger.DefaultOptions 327 opts.SyncWrites = false 328 - opts.Dir = filepath.ToSlash(configDirs.QueryFolders(configdir.Global)[0].Path) + "/data/user" 329 - opts.ValueDir = filepath.ToSlash(configDirs.QueryFolders(configdir.Global)[0].Path) + "/data/user" 330 + opts.Dir = filePath + "/data/user" 331 + opts.ValueDir = filePath + "/data/user" 332 + 333 + if _, StatErr := os.Stat(filePath + "/data/user/LOCK"); StatErr == nil { 334 + DeleteErr := os.Remove(filePath + "/data/user/LOCK") 335 + if DeleteErr != nil { 336 + err = DeleteErr 337 + return 338 + } 339 + } 340 341 expDB, DBErr := badger.Open(opts) 342 if DBErr != nil { 343 @@ -87,15 +110,15 @@ func OpenUserDB() (db *badger.DB, err error) { 344 return 345 } 346 347 - UserDB = expDB 348 + cacheDB = expDB 349 }) 350 351 - if UserDB == nil { 352 + if cacheDB == nil { 353 err = errors.New("missing UserDB") 354 return 355 } 356 357 - db = UserDB 358 + db = cacheDB 359 return 360 } 361 362 @@ -136,3 +159,21 @@ func CacheMessageEvents(id, sender, roomID, message string, timestamp int64) (er 363 364 return 365 } 366 + 367 +// Get dedpulicates all the Gets inside the Database to not repeat that much code. 368 +func Get(txn *badger.Txn, key []byte) (result []byte, err error) { 369 + item, QueryErr := txn.Get(key) 370 + if QueryErr != nil && QueryErr != badger.ErrKeyNotFound { 371 + err = QueryErr 372 + return 373 + } 374 + if QueryErr != badger.ErrKeyNotFound { 375 + valueByte, valueErr := item.Value() 376 + result = valueByte 377 + if valueErr != nil { 378 + err = valueErr 379 + return 380 + } 381 + } 382 + return 383 +} 384 diff --git a/matrix/db/once.go b/matrix/db/once.go 385 new file mode 100644 386 index 0000000..8f0f987 387 --- /dev/null 388 +++ b/matrix/db/once.go 389 @@ -0,0 +1,38 @@ 390 +package db 391 + 392 +import ( 393 + "sync" 394 + "sync/atomic" 395 +) 396 + 397 +// Once is an object that will perform exactly one action 398 +// until Reset is called. 399 +// See http://golang.org/pkg/sync/#Once 400 +type Once struct { 401 + m sync.Mutex 402 + done uint32 403 +} 404 + 405 +// Do simulates sync.Once.Do by executing the specified function 406 +// only once, until Reset is called. 407 +// See http://golang.org/pkg/sync/#Once 408 +func (o *Once) Do(f func()) { 409 + if atomic.LoadUint32(&o.done) == 1 { 410 + return 411 + } 412 + // Slow-path. 413 + o.m.Lock() 414 + defer o.m.Unlock() 415 + if o.done == 0 { 416 + defer atomic.StoreUint32(&o.done, 1) 417 + f() 418 + } 419 +} 420 + 421 +// Reset indicates that the next call to Do should actually be called 422 +// once again. 423 +func (o *Once) Reset() { 424 + o.m.Lock() 425 + defer o.m.Unlock() 426 + atomic.StoreUint32(&o.done, 0) 427 +} 428 diff --git a/matrix/db/storer.go b/matrix/db/storer.go 429 index a898e40..b79f627 100644 430 --- a/matrix/db/storer.go 431 +++ b/matrix/db/storer.go 432 @@ -1,6 +1,8 @@ 433 package db 434 435 import ( 436 + "fmt" 437 + 438 "github.com/dgraph-io/badger" 439 ) 440 441 @@ -10,6 +12,7 @@ type Storer interface { 442 LoadNextBatch(userID string) (nextBatch string, err error) 443 } 444 445 +// MorpheusStorage is the StorageInterface which needs to be conformed to in order to persist Go-NEB data 446 type MorpheusStorage struct { 447 Database *badger.DB 448 } 449 @@ -31,18 +34,11 @@ func (m *MorpheusStorage) UpdateNextBatch(userID, nextBatch string) (err error) 450 // LoadNextBatch loads the next_batch token for the given user. 451 func (m *MorpheusStorage) LoadNextBatch(userID string) (nextBatch string, err error) { 452 DBerr := m.Database.View(func(txn *badger.Txn) error { 453 - 454 - nextBatchItem, NextBatchErr := txn.Get([]byte("matrix|" + userID + "|nextBatch|")) 455 - if NextBatchErr != nil { 456 - return NextBatchErr 457 + nextBatchResult, QueryErr := Get(txn, []byte("user|accessToken")) 458 + if QueryErr != nil { 459 + return QueryErr 460 } 461 - 462 - nextBatchByte, nextBatchByteErr := nextBatchItem.Value() 463 - if nextBatchByteErr != nil { 464 - return nextBatchByteErr 465 - } 466 - 467 - nextBatch = string(nextBatchByte) 468 + nextBatch = fmt.Sprintf("%s", nextBatchResult) 469 return nil 470 }) 471 if DBerr != nil { 472 diff --git a/matrix/globalTypes/types.go b/matrix/globalTypes/types.go 473 new file mode 100644 474 index 0000000..8f24617 475 --- /dev/null 476 +++ b/matrix/globalTypes/types.go 477 @@ -0,0 +1,44 @@ 478 +package globalTypes 479 + 480 +import ( 481 + "github.com/Nordgedanken/Morpheus/matrix/db" 482 + "github.com/Nordgedanken/Morpheus/matrix/rooms" 483 + "github.com/Nordgedanken/Morpheus/ui/listLayouts" 484 + "github.com/matrix-org/gomatrix" 485 +) 486 + 487 +// Config holds important reused information in the UI 488 +type Config struct { 489 + Username string 490 + Password string 491 + 492 + WindowWidth int 493 + WindowHeight int 494 + 495 + Rooms map[string]*rooms.Room 496 + CurrentRoom string 497 + 498 + MessageListLayout *listLayouts.QVBoxLayoutWithTriggerSlot 499 + RoomListLayout *listLayouts.QRoomVBoxLayoutWithTriggerSlot 500 + 501 + matrixClient 502 +} 503 + 504 +type matrixClient struct { 505 + databases 506 + Cli *gomatrix.Client 507 +} 508 + 509 +// GetCli returns the Matrix Client 510 +func (mc *matrixClient) GetCli() *gomatrix.Client { 511 + return mc.Cli 512 +} 513 + 514 +type databases struct { 515 + CacheDB db.Storer 516 +} 517 + 518 +// SetCurrentRoom sets the new room ID of the MainUI 519 +func (d *databases) SetCacheDB(db db.Storer) { 520 + d.CacheDB = db 521 +} 522 diff --git a/matrix/rooms.go b/matrix/rooms.go 523 deleted file mode 100644 524 index a594a81..0000000 525 --- a/matrix/rooms.go 526 +++ /dev/null 527 @@ -1,210 +0,0 @@ 528 -package matrix 529 - 530 -import ( 531 - "bytes" 532 - "image" 533 - "image/draw" 534 - "image/png" 535 - "strings" 536 - 537 - "github.com/Nordgedanken/Morpheus/matrix/db" 538 - "github.com/dgraph-io/badger" 539 - "github.com/matrix-org/gomatrix" 540 - "github.com/rhinoman/go-commonmark" 541 - log "github.com/sirupsen/logrus" 542 - "github.com/therecipe/qt/gui" 543 -) 544 - 545 -// Room saves the information of a Room 546 -type Room struct { 547 - cli *gomatrix.Client 548 - RoomID string 549 - RoomName string 550 - RoomAvatarURL string 551 - RoomTopic string 552 -} 553 - 554 -// NewRoom Inits a new Room struct 555 -func NewRoom(roomID string, cli *gomatrix.Client) (room *Room) { 556 - room = &Room{RoomID: roomID, cli: cli} 557 - return 558 -} 559 - 560 -func (r *Room) crawlRoomAvatarURL() { 561 - roomAvatar := struct { 562 - URL string `json:"url"` 563 - }{} 564 - r.cli.StateEvent(r.RoomID, "m.room.avatar", "", &roomAvatar) 565 - r.RoomAvatarURL = roomAvatar.URL 566 -} 567 - 568 -func (r *Room) crawlRoomTopic() { 569 - roomTopic := struct { 570 - Topic string `json:"topic"` 571 - }{} 572 - r.cli.StateEvent(r.RoomID, "m.room.topic", "", &roomTopic) 573 - r.RoomTopic = roomTopic.Topic 574 -} 575 - 576 -// GetRoomTopic returns the Topic of the Room and crawls it if needed 577 -func (r *Room) GetRoomTopic() (topic string) { 578 - if r.RoomTopic == "" { 579 - r.crawlRoomTopic() 580 - } 581 - 582 - mardownMessage := commonmark.Md2Html(r.RoomTopic, 0) 583 - 584 - if mardownMessage == r.RoomTopic { 585 - topic = r.RoomTopic 586 - return 587 - } else { 588 - r.RoomTopic = mardownMessage 589 - topic = r.RoomTopic 590 - return 591 - } 592 -} 593 - 594 -// GetRoomAvatar generates the Avatar Image for a Room 595 -func (r *Room) GetRoomAvatar() (avatarResp *gui.QPixmap, err error) { 596 - // Get the Avatar URL if needed 597 - if r.RoomAvatarURL == "" { 598 - r.crawlRoomAvatarURL() 599 - } 600 - 601 - // Get the image Data 602 - cacheDB, DBOpenErr := db.OpenCacheDB() 603 - if DBOpenErr != nil { 604 - log.Fatalln(DBOpenErr) 605 - } 606 - 607 - // Init local vars 608 - var roomAvatarData []byte 609 - var IMGdata []byte 610 - 611 - // Get cache 612 - DBErr := cacheDB.View(func(txn *badger.Txn) error { 613 - roomAvatarDataItem, QueryErr := txn.Get([]byte("room|" + r.RoomID + "|84x84")) 614 - if QueryErr != nil && QueryErr != badger.ErrKeyNotFound { 615 - return QueryErr 616 - } 617 - if QueryErr != badger.ErrKeyNotFound { 618 - roomAvatarDataBytes, roomAvatarDataErr := roomAvatarDataItem.Value() 619 - roomAvatarData = roomAvatarDataBytes 620 - return roomAvatarDataErr 621 - } 622 - return nil 623 - }) 624 - if DBErr != nil { 625 - err = DBErr 626 - return 627 - } 628 - 629 - //If cache is empty do a ServerQuery 630 - if len(roomAvatarData) <= 0 { 631 - // If avatarURL is not empty (aka. has a avatar set) download it at the size of 100x100. Else make the data string empty 632 - if r.RoomAvatarURL != "" { 633 - hsURL := r.cli.HomeserverURL.String() 634 - roomAvatarURLSplits := strings.Split(strings.Replace(r.RoomAvatarURL, "mxc://", "", -1), "/") 635 - 636 - urlPath := hsURL + "/_matrix/media/r0/thumbnail/" + roomAvatarURLSplits[0] + "/" + roomAvatarURLSplits[1] + "?width=84&height=84&method=crop" 637 - 638 - data, ReqErr := r.cli.MakeRequest("GET", urlPath, nil, nil) 639 - if ReqErr != nil { 640 - err = ReqErr 641 - return 642 - } 643 - IMGdata = data 644 - } else { 645 - log.Println("Generating Room Avatar") 646 - var GenerateImgErr error 647 - var roomName string 648 - if r.RoomName == "" { 649 - r.crawlRoomName() 650 - } 651 - roomName = r.RoomName 652 - log.Println(roomName) 653 - if roomName == "" { 654 - roomName = "#" 655 - } 656 - IMGdata, GenerateImgErr = generateGenericImages(roomName, 84) 657 - if GenerateImgErr != nil { 658 - err = GenerateImgErr 659 - return 660 - } 661 - } 662 - 663 - // Update cache 664 - DBSetErr := cacheDB.Update(func(txn *badger.Txn) error { 665 - DBSetErr := txn.Set([]byte("room|"+r.RoomID+"|84x84"), IMGdata) 666 - return DBSetErr 667 - }) 668 - if DBSetErr != nil { 669 - err = DBSetErr 670 - return 671 - } 672 - 673 - } else { 674 - IMGdata = roomAvatarData 675 - } 676 - 677 - reader := bytes.NewReader(IMGdata) 678 - srcIMG, _, DecodeErr := image.Decode(reader) 679 - if DecodeErr != nil { 680 - err = DecodeErr 681 - } 682 - 683 - // Convert avatarimage to QPixmap for usage in QT 684 - canvas := image.NewRGBA(srcIMG.Bounds()) 685 - cx := srcIMG.Bounds().Min.X + srcIMG.Bounds().Dx()/2 686 - cy := srcIMG.Bounds().Min.Y + srcIMG.Bounds().Dy()/2 687 - draw.DrawMask(canvas, canvas.Bounds(), srcIMG, image.ZP, &circle{image.Point{cx, cy}, cx}, image.ZP, draw.Over) 688 - 689 - avatar := gui.NewQPixmap() 690 - buf := new(bytes.Buffer) 691 - ConvErr := png.Encode(buf, canvas) 692 - if ConvErr != nil { 693 - err = ConvErr 694 - } 695 - 696 - str := buf.String() 697 - avatar.LoadFromData(str, uint(len(str)), "", 0) 698 - avatarResp = avatar 699 - return 700 -} 701 - 702 -func (r *Room) crawlRoomName() { 703 - roomName := struct { 704 - Name string `json:"name"` 705 - }{} 706 - roomCanoncialAlias := struct { 707 - Alias string `json:"alias"` 708 - }{} 709 - 710 - if roomNameStateEventErr := r.cli.StateEvent(r.RoomID, "m.room.name", "", &roomName); roomNameStateEventErr != nil { 711 - log.Println(roomNameStateEventErr) 712 - // Not returning as a Error NotFound is allowed 713 - } 714 - if roomName.Name == "" { 715 - if roomCanoncialAliasStateEventErr := r.cli.StateEvent(r.RoomID, "m.room.canonical_alias", "", &roomCanoncialAlias); roomCanoncialAliasStateEventErr != nil { 716 - log.Println(roomCanoncialAliasStateEventErr) 717 - // Not returning as a Error NotFound is allowed 718 - } 719 - if roomCanoncialAlias.Alias == "" { 720 - r.RoomName = r.RoomID 721 - } else { 722 - r.RoomName = roomCanoncialAlias.Alias 723 - } 724 - } else { 725 - r.RoomName = roomName.Name 726 - } 727 - 728 -} 729 - 730 -// GetRoomName gives you the name of the current Room 731 -func (r *Room) GetRoomName() (name string) { 732 - if r.RoomName == "" { 733 - r.crawlRoomName() 734 - } 735 - name = r.RoomName 736 - return 737 -} 738 diff --git a/matrix/rooms/rooms.go b/matrix/rooms/rooms.go 739 new file mode 100644 740 index 0000000..9d13be7 741 --- /dev/null 742 +++ b/matrix/rooms/rooms.go 743 @@ -0,0 +1,314 @@ 744 +package rooms 745 + 746 +import ( 747 + "fmt" 748 + "strings" 749 + 750 + "github.com/Nordgedanken/Morpheus/matrix" 751 + "github.com/Nordgedanken/Morpheus/matrix/db" 752 + "github.com/dgraph-io/badger" 753 + "github.com/matrix-org/gomatrix" 754 + "github.com/rhinoman/go-commonmark" 755 + log "github.com/sirupsen/logrus" 756 + "github.com/therecipe/qt/gui" 757 +) 758 + 759 +const mRoomNameEv = "m.room.name" 760 +const mRoomCanonicalAliasEv = "m.room.canonical_alias" 761 + 762 +// Room saves the information of a Room 763 +type Room struct { 764 + cli *gomatrix.Client 765 + RoomID string 766 + RoomName string 767 + RoomNameEventType string 768 + RoomAvatarURL string 769 + RoomTopic string 770 +} 771 + 772 +// GetRooms either returns the joinedRoomsList from the Server or the cachedList 773 +func GetRooms(cli *gomatrix.Client) (rooms []string, err error) { 774 + // Get Cache 775 + cacheDB, DBOpenErr := db.OpenCacheDB() 776 + if DBOpenErr != nil { 777 + log.Fatalln(DBOpenErr) 778 + } 779 + 780 + var roomsString string 781 + DBErr := cacheDB.View(func(txn *badger.Txn) error { 782 + roomsResult, QueryErr := db.Get(txn, []byte("rooms")) 783 + if QueryErr != nil { 784 + return QueryErr 785 + } 786 + roomsString = fmt.Sprintf("%s", roomsResult) 787 + return nil 788 + }) 789 + if DBErr != nil { 790 + err = DBErr 791 + return 792 + } 793 + 794 + if roomsString == "" { 795 + roomsResp, ReqErr := cli.JoinedRooms() 796 + if ReqErr != nil { 797 + err = ReqErr 798 + return 799 + } 800 + rooms = roomsResp.JoinedRooms 801 + DBSetErr := cacheDB.Update(func(txn *badger.Txn) error { 802 + DBSetErr := txn.Set([]byte("rooms"), []byte(strings.Join(rooms, ","))) 803 + return DBSetErr 804 + }) 805 + if DBSetErr != nil { 806 + err = DBSetErr 807 + return 808 + } 809 + } else { 810 + rooms = strings.Split(roomsString, ",") 811 + } 812 + return 813 +} 814 + 815 +// NewRoom Inits a new Room struct 816 +func NewRoom(roomID string, cli *gomatrix.Client) (room *Room) { 817 + room = &Room{RoomID: roomID, cli: cli} 818 + return 819 +} 820 + 821 +func (r *Room) crawlRoomAvatarURL() { 822 + roomAvatar := struct { 823 + URL string `json:"url"` 824 + }{} 825 + r.cli.StateEvent(r.RoomID, "m.room.avatar", "", &roomAvatar) 826 + r.RoomAvatarURL = roomAvatar.URL 827 +} 828 + 829 +func (r *Room) crawlRoomTopic() { 830 + roomTopic := struct { 831 + Topic string `json:"topic"` 832 + }{} 833 + r.cli.StateEvent(r.RoomID, "m.room.topic", "", &roomTopic) 834 + r.RoomTopic = roomTopic.Topic 835 +} 836 + 837 +// GetRoomTopic returns the Topic of the Room and crawls it if needed 838 +func (r *Room) GetRoomTopic() (topic string) { 839 + if r.RoomTopic == "" { 840 + r.crawlRoomTopic() 841 + } 842 + 843 + mardownMessage := commonmark.Md2Html(r.RoomTopic, 0) 844 + 845 + topic = r.RoomTopic 846 + if mardownMessage == r.RoomTopic { 847 + topic = r.RoomTopic 848 + } else { 849 + r.RoomTopic = mardownMessage 850 + } 851 + return 852 +} 853 + 854 +// GetRoomAvatar generates the Avatar Image for a Room 855 +func (r *Room) GetRoomAvatar() (avatarResp *gui.QPixmap, err error) { 856 + // Get the Avatar URL if needed 857 + if r.RoomAvatarURL == "" { 858 + r.crawlRoomAvatarURL() 859 + } 860 + 861 + // Get the image Data 862 + cacheDB, DBOpenErr := db.OpenCacheDB() 863 + if DBOpenErr != nil { 864 + log.Fatalln(DBOpenErr) 865 + } 866 + 867 + // Init local vars 868 + var roomAvatarData []byte 869 + var IMGdata []byte 870 + 871 + // Get cache 872 + DBErr := cacheDB.View(func(txn *badger.Txn) error { 873 + roomAvatarDataResult, QueryErr := db.Get(txn, []byte("room|"+r.RoomID+"|84x84")) 874 + if QueryErr != nil { 875 + return QueryErr 876 + } 877 + roomAvatarData = roomAvatarDataResult 878 + return nil 879 + }) 880 + if DBErr != nil { 881 + err = DBErr 882 + return 883 + } 884 + 885 + //If cache is empty do a ServerQuery 886 + if len(roomAvatarData) <= 0 { 887 + // If avatarURL is not empty (aka. has a avatar set) download it at the size of 100x100. Else make the data string empty 888 + if r.RoomAvatarURL != "" { 889 + hsURL := r.cli.HomeserverURL.String() 890 + roomAvatarURLSplits := strings.Split(strings.Replace(r.RoomAvatarURL, "mxc://", "", -1), "/") 891 + 892 + urlPath := hsURL + "/_matrix/media/r0/thumbnail/" + roomAvatarURLSplits[0] + "/" + roomAvatarURLSplits[1] + "?width=84&height=84&method=crop" 893 + 894 + data, ReqErr := r.cli.MakeRequest("GET", urlPath, nil, nil) 895 + if ReqErr != nil { 896 + err = ReqErr 897 + return 898 + } 899 + IMGdata = data 900 + } else { 901 + log.Println("Generating Room Avatar") 902 + var GenerateImgErr error 903 + var roomName string 904 + if r.RoomName == "" { 905 + r.crawlRoomName() 906 + } 907 + roomName = r.RoomName 908 + log.Println(roomName) 909 + if roomName == "" { 910 + roomName = "#" 911 + } 912 + IMGdata, GenerateImgErr = matrix.GenerateGenericImages(roomName, 84) 913 + if GenerateImgErr != nil { 914 + err = GenerateImgErr 915 + return 916 + } 917 + } 918 + 919 + // Update cache 920 + DBSetErr := cacheDB.Update(func(txn *badger.Txn) error { 921 + DBSetErr := txn.Set([]byte("room|"+r.RoomID+"|84x84"), IMGdata) 922 + return DBSetErr 923 + }) 924 + if DBSetErr != nil { 925 + err = DBSetErr 926 + return 927 + } 928 + 929 + } else { 930 + IMGdata = roomAvatarData 931 + } 932 + 933 + avatar := gui.NewQPixmap() 934 + 935 + str := string(IMGdata[:]) 936 + avatar.LoadFromData(str, uint(len(str)), "", 0) 937 + avatarResp = avatar 938 + return 939 +} 940 + 941 +func (r *Room) crawlRoomName() { 942 + roomName := struct { 943 + Name string `json:"name"` 944 + }{} 945 + roomCanonicalAlias := struct { 946 + Alias string `json:"alias"` 947 + }{} 948 + 949 + if roomNameStateEventErr := r.cli.StateEvent(r.RoomID, mRoomNameEv, "", &roomName); roomNameStateEventErr != nil { 950 + log.Println(roomNameStateEventErr) 951 + // Not returning as a Error NotFound is allowed 952 + } 953 + if roomName.Name == "" { 954 + if roomCanonicalAliasStateEventErr := r.cli.StateEvent(r.RoomID, mRoomCanonicalAliasEv, "", &roomCanonicalAlias); roomCanonicalAliasStateEventErr != nil { 955 + log.Println(roomCanonicalAliasStateEventErr) 956 + // Not returning as a Error NotFound is allowed 957 + } 958 + if roomCanonicalAlias.Alias == "" { 959 + r.RoomNameEventType = "roomID" 960 + r.RoomName = r.RoomID 961 + } else { 962 + r.RoomNameEventType = mRoomCanonicalAliasEv 963 + r.RoomName = roomCanonicalAlias.Alias 964 + } 965 + } else { 966 + r.RoomNameEventType = mRoomNameEv 967 + r.RoomName = roomName.Name 968 + } 969 + 970 +} 971 + 972 +// UpdateRoomNameByEvent used to Update the Room Name of a Room when a Room Change Event comes down the Sync 973 +func (r *Room) UpdateRoomNameByEvent(newName, evType string) { 974 + if r.RoomNameEventType == "" { 975 + r.getRoomNameEventTypeFromDB() 976 + } 977 + if r.RoomNameEventType == mRoomNameEv && r.RoomNameEventType == evType { 978 + r.RoomName = newName 979 + r.cacheRoomName() 980 + } else if r.RoomNameEventType != mRoomNameEv { 981 + r.RoomName = newName 982 + r.cacheRoomName() 983 + } 984 +} 985 + 986 +func (r *Room) cacheRoomName() (err error) { 987 + cacheDB, DBOpenErr := db.OpenCacheDB() 988 + if DBOpenErr != nil { 989 + err = DBOpenErr 990 + return 991 + } 992 + 993 + // Update cache 994 + DBSetErr := cacheDB.Update(func(txn *badger.Txn) error { 995 + DBSetErr := txn.Set([]byte("room|"+r.RoomID+"|nameEventType"), []byte(r.RoomNameEventType)) 996 + if DBSetErr != nil { 997 + return DBSetErr 998 + } 999 + 1000 + DBSetErr = txn.Set([]byte("room|"+r.RoomID+"|name"), []byte(r.RoomName)) 1001 + return DBSetErr 1002 + }) 1003 + if DBSetErr != nil { 1004 + err = DBSetErr 1005 + return 1006 + } 1007 + return 1008 +} 1009 + 1010 +func (r *Room) getRoomNameEventTypeFromDB() (err error) { 1011 + cacheDB, DBOpenErr := db.OpenCacheDB() 1012 + if DBOpenErr != nil { 1013 + err = DBOpenErr 1014 + return 1015 + } 1016 + 1017 + cacheDB.View(func(txn *badger.Txn) error { 1018 + roomNameEventTypeResult, QueryErr := db.Get(txn, []byte("room|"+r.RoomID+"|nameEventType")) 1019 + if QueryErr != nil { 1020 + return QueryErr 1021 + } 1022 + r.RoomNameEventType = fmt.Sprintf("%s", roomNameEventTypeResult) 1023 + return nil 1024 + }) 1025 + 1026 + return 1027 +} 1028 + 1029 +func (r *Room) getRoomNameFromDB() (err error) { 1030 + cacheDB, DBOpenErr := db.OpenCacheDB() 1031 + if DBOpenErr != nil { 1032 + err = DBOpenErr 1033 + return 1034 + } 1035 + 1036 + cacheDB.View(func(txn *badger.Txn) error { 1037 + roomNameResult, QueryErr := db.Get(txn, []byte("room|"+r.RoomID+"|name")) 1038 + if QueryErr != nil { 1039 + return QueryErr 1040 + } 1041 + r.RoomName = fmt.Sprintf("%s", roomNameResult) 1042 + return nil 1043 + }) 1044 + 1045 + return 1046 +} 1047 + 1048 +// GetRoomName gives you the name of the current Room 1049 +func (r *Room) GetRoomName() (name string) { 1050 + r.getRoomNameFromDB() 1051 + if r.RoomName == "" { 1052 + r.crawlRoomName() 1053 + r.cacheRoomName() 1054 + } 1055 + name = r.RoomName 1056 + return 1057 +} 1058 diff --git a/matrix/scalar/client.go b/matrix/scalar/client.go 1059 deleted file mode 100644 1060 index bb7e57c..0000000 1061 --- a/matrix/scalar/client.go 1062 +++ /dev/null 1063 @@ -1,26 +0,0 @@ 1064 -package scalar 1065 - 1066 -import "github.com/matrix-org/gomatrix" 1067 - 1068 -type OpenIDTokenResponse struct { 1069 - AccessToken string `json:"access_token"` 1070 - TokenType string `json:"token_type"` 1071 - ExpiresIn int `json:"expires_in"` 1072 - MatrixServerName string `json:"matrix_server_name"` 1073 -} 1074 - 1075 -func GetOpenIDToken(cli *gomatrix.Client) (resp *OpenIDTokenResponse, err error) { 1076 - urlPath := cli.BuildURL("user", cli.UserID, "openid", "request_token") 1077 - _, err = MakeRequest(cli, "POST", urlPath, "{}", &resp) 1078 - return 1079 -} 1080 - 1081 -type ScalarRegisterResp struct { 1082 - ScalarToken string `json:"scalar_token"` 1083 -} 1084 - 1085 -func GetScalarToken(cli *gomatrix.Client, openIDToken *OpenIDTokenResponse) (resp *ScalarRegisterResp, err error) { 1086 - urlPath := "https://scalar.vector.im/api/register" 1087 - _, err = cli.MakeRequest("POST", urlPath, openIDToken, &resp) 1088 - return 1089 -} 1090 diff --git a/matrix/scalar/utils.go b/matrix/scalar/utils.go 1091 deleted file mode 100644 1092 index 821edcc..0000000 1093 --- a/matrix/scalar/utils.go 1094 +++ /dev/null 1095 @@ -1,65 +0,0 @@ 1096 -package scalar 1097 - 1098 -import ( 1099 - "bytes" 1100 - "encoding/json" 1101 - "io/ioutil" 1102 - "net/http" 1103 - 1104 - "github.com/matrix-org/gomatrix" 1105 -) 1106 - 1107 -func MakeRequest(cli *gomatrix.Client, method string, httpURL string, reqBody string, resBody interface{}) ([]byte, error) { 1108 - var req *http.Request 1109 - var err error 1110 - if reqBody != "" { 1111 - byteString := []byte(reqBody) 1112 - req, err = http.NewRequest(method, httpURL, bytes.NewBuffer(byteString)) 1113 - } else { 1114 - req, err = http.NewRequest(method, httpURL, nil) 1115 - } 1116 - 1117 - if err != nil { 1118 - return nil, err 1119 - } 1120 - req.Header.Set("Content-Type", "application/json") 1121 - res, err := cli.Client.Do(req) 1122 - if res != nil { 1123 - defer res.Body.Close() 1124 - } 1125 - if err != nil { 1126 - return nil, err 1127 - } 1128 - contents, err := ioutil.ReadAll(res.Body) 1129 - if res.StatusCode/100 != 2 { // not 2xx 1130 - var wrap error 1131 - var respErr gomatrix.RespError 1132 - if _ = json.Unmarshal(contents, &respErr); respErr.ErrCode != "" { 1133 - wrap = respErr 1134 - } 1135 - 1136 - // If we failed to decode as RespError, don't just drop the HTTP body, include it in the 1137 - // HTTP error instead (e.g proxy errors which return HTML). 1138 - msg := "Failed to " + method + " JSON to " + req.URL.Path 1139 - if wrap == nil { 1140 - msg = msg + ": " + string(contents) 1141 - } 1142 - 1143 - return contents, gomatrix.HTTPError{ 1144 - Code: res.StatusCode, 1145 - Message: msg, 1146 - WrappedError: wrap, 1147 - } 1148 - } 1149 - if err != nil { 1150 - return nil, err 1151 - } 1152 - 1153 - if resBody != nil { 1154 - if err = json.Unmarshal(contents, &resBody); err != nil { 1155 - return nil, err 1156 - } 1157 - } 1158 - 1159 - return contents, nil 1160 -} 1161 diff --git a/matrix/syncer/syncer.go b/matrix/syncer/syncer.go 1162 index 4b5d6ff..1be1738 100644 1163 --- a/matrix/syncer/syncer.go 1164 +++ b/matrix/syncer/syncer.go 1165 @@ -6,13 +6,17 @@ import ( 1166 "runtime/debug" 1167 "time" 1168 1169 + "github.com/Nordgedanken/Morpheus/matrix/globalTypes" 1170 + "github.com/Nordgedanken/Morpheus/matrix/rooms" 1171 "github.com/matrix-org/gomatrix" 1172 ) 1173 1174 +//MorpheusSyncer holds the UserID, the used Storer and the listener 1175 type MorpheusSyncer struct { 1176 UserID string 1177 Store gomatrix.Storer 1178 listeners map[string][]OnEventListener // event type to listeners array 1179 + config *globalTypes.Config 1180 } 1181 1182 // OnEventListener can be used with DefaultSyncer.OnEventType to be informed of incoming events. 1183 @@ -41,7 +45,7 @@ func (s *MorpheusSyncer) ProcessResponse(res *gomatrix.RespSync, since string) ( 1184 }() 1185 1186 for roomID, roomData := range res.Rooms.Join { 1187 - room := s.getOrCreateRoom(roomID) 1188 + room := s.getOrCreateRoom(roomID, "join") 1189 for _, event := range roomData.State.Events { 1190 event.RoomID = roomID 1191 room.UpdateState(&event) 1192 @@ -53,7 +57,7 @@ func (s *MorpheusSyncer) ProcessResponse(res *gomatrix.RespSync, since string) ( 1193 } 1194 } 1195 for roomID, roomData := range res.Rooms.Invite { 1196 - room := s.getOrCreateRoom(roomID) 1197 + room := s.getOrCreateRoom(roomID, "invite") 1198 for _, event := range roomData.State.Events { 1199 event.RoomID = roomID 1200 room.UpdateState(&event) 1201 @@ -61,7 +65,7 @@ func (s *MorpheusSyncer) ProcessResponse(res *gomatrix.RespSync, since string) ( 1202 } 1203 } 1204 for roomID, roomData := range res.Rooms.Leave { 1205 - room := s.getOrCreateRoom(roomID) 1206 + room := s.getOrCreateRoom(roomID, "leave") 1207 for _, event := range roomData.Timeline.Events { 1208 if event.StateKey != nil { 1209 event.RoomID = roomID 1210 @@ -121,7 +125,14 @@ func (s *MorpheusSyncer) shouldProcessResponse(resp *gomatrix.RespSync, since st 1211 } 1212 1213 // getOrCreateRoom must only be called by the Sync() goroutine which calls ProcessResponse() 1214 -func (s *MorpheusSyncer) getOrCreateRoom(roomID string) *gomatrix.Room { 1215 +func (s *MorpheusSyncer) getOrCreateRoom(roomID, state string) *gomatrix.Room { 1216 + // Add new Room to the List if new 1217 + _, present := s.config.Rooms[roomID] 1218 + if !present && state == "join" { 1219 + s.config.Rooms[roomID] = rooms.NewRoom(roomID, s.config.GetCli()) 1220 + s.config.RoomListLayout.TriggerRoom(roomID) 1221 + } 1222 + 1223 room := s.Store.LoadRoom(roomID) 1224 if room == nil { // create a new Room 1225 room = gomatrix.NewRoom(roomID) 1226 diff --git a/matrix/user.go b/matrix/user.go 1227 index cb310ba..90b340c 100644 1228 --- a/matrix/user.go 1229 +++ b/matrix/user.go 1230 @@ -3,65 +3,22 @@ package matrix 1231 import ( 1232 "bytes" 1233 "fmt" 1234 - "image" 1235 - "image/color" 1236 - "image/draw" 1237 - // image/gif needed to load gif images 1238 - _ "image/gif" 1239 - // image/jpeg needed to load jpeg images 1240 - _ "image/jpeg" 1241 "image/png" 1242 - // image/png needed to load png images 1243 - _ "image/png" 1244 "strconv" 1245 "strings" 1246 "unicode" 1247 "unicode/utf8" 1248 1249 - log "github.com/sirupsen/logrus" 1250 - 1251 "github.com/Nordgedanken/Morpheus/matrix/db" 1252 + "github.com/dgraph-io/badger" 1253 "github.com/disintegration/letteravatar" 1254 "github.com/matrix-org/gomatrix" 1255 + log "github.com/sirupsen/logrus" 1256 "github.com/therecipe/qt/gui" 1257 - 1258 - "github.com/dgraph-io/badger" 1259 - // golang.org/x/image/webp needed to load webp images 1260 - _ "golang.org/x/image/webp" 1261 - 1262 - // golang.org/x/image/bmp needed to load bmp images 1263 - _ "golang.org/x/image/bmp" 1264 - 1265 - // golang.org/x/image/riff needed to load riff images 1266 - _ "golang.org/x/image/riff" 1267 - 1268 - // golang.org/x/image/tiff needed to load tiff images 1269 - _ "golang.org/x/image/tiff" 1270 ) 1271 1272 -type circle struct { 1273 - p image.Point 1274 - r int 1275 -} 1276 - 1277 -func (c *circle) ColorModel() color.Model { 1278 - return color.AlphaModel 1279 -} 1280 - 1281 -func (c *circle) Bounds() image.Rectangle { 1282 - return image.Rect(c.p.X-c.r, c.p.Y-c.r, c.p.X+c.r, c.p.Y+c.r) 1283 -} 1284 - 1285 -func (c *circle) At(x, y int) color.Color { 1286 - xx, yy, rr := float64(x-c.p.X)+0.5, float64(y-c.p.Y)+0.5, float64(c.r) 1287 - if xx*xx+yy*yy < rr*rr { 1288 - return color.Alpha{A: 255} 1289 - } 1290 - return color.Alpha{A: 0} 1291 -} 1292 - 1293 -func generateGenericImages(displayname string, size int) (imgData []byte, err error) { 1294 - identifier := displayname 1295 +// GenerateGenericImages generates a byte slice containing a Image with the starting char as symbol and a colored background 1296 +func GenerateGenericImages(identifier string, size int) (imgData []byte, err error) { 1297 if (identifier[0] == '#' || identifier[0] == '!' || identifier[0] == '@') && len(identifier) > 1 { 1298 identifier = identifier[1:] 1299 } 1300 @@ -103,15 +60,11 @@ func GetUserAvatar(cli *gomatrix.Client, mxid string, size int) (avatarResp *gui 1301 1302 // Get cache 1303 DBErr := cacheDB.View(func(txn *badger.Txn) error { 1304 - roomAvatarDataItem, QueryErr := txn.Get([]byte("user|" + mxid + "|avatarData" + strconv.Itoa(size) + "x" + strconv.Itoa(size))) 1305 - if QueryErr != nil && QueryErr != badger.ErrKeyNotFound { 1306 + avatarDataResult, QueryErr := db.Get(txn, []byte("user|"+mxid+"|avatarData"+strconv.Itoa(size)+"x"+strconv.Itoa(size))) 1307 + if QueryErr != nil { 1308 return QueryErr 1309 } 1310 - if QueryErr != badger.ErrKeyNotFound { 1311 - avatarDataBytes, avatarDataErr := roomAvatarDataItem.Value() 1312 - avatarData = avatarDataBytes 1313 - return avatarDataErr 1314 - } 1315 + avatarData = avatarDataResult 1316 return nil 1317 }) 1318 if DBErr != nil { 1319 @@ -151,7 +104,7 @@ func GetUserAvatar(cli *gomatrix.Client, mxid string, size int) (avatarResp *gui 1320 DisplayNameResp, _ := cli.GetDisplayName(mxid) 1321 DisplayName := DisplayNameResp.DisplayName 1322 var GenerateImgErr error 1323 - IMGdata, GenerateImgErr = generateGenericImages(DisplayName, size) 1324 + IMGdata, GenerateImgErr = GenerateGenericImages(DisplayName, size) 1325 if GenerateImgErr != nil { 1326 err = GenerateImgErr 1327 return 1328 @@ -171,70 +124,38 @@ func GetUserAvatar(cli *gomatrix.Client, mxid string, size int) (avatarResp *gui 1329 IMGdata = avatarData 1330 } 1331 1332 - r := bytes.NewReader(IMGdata) 1333 - srcIMG, _, DecodeErr := image.Decode(r) 1334 - if DecodeErr != nil { 1335 - err = DecodeErr 1336 - } 1337 - 1338 - // Convert avatarimage to QPixmap for usage in QT 1339 - canvas := image.NewRGBA(srcIMG.Bounds()) 1340 - cx := srcIMG.Bounds().Min.X + srcIMG.Bounds().Dx()/2 1341 - cy := srcIMG.Bounds().Min.Y + srcIMG.Bounds().Dy()/2 1342 - draw.DrawMask(canvas, canvas.Bounds(), srcIMG, image.ZP, &circle{image.Point{cx, cy}, cx}, image.ZP, draw.Over) 1343 - 1344 avatar := gui.NewQPixmap() 1345 - buf := new(bytes.Buffer) 1346 - ConvErr := png.Encode(buf, canvas) 1347 - if ConvErr != nil { 1348 - err = ConvErr 1349 - } 1350 1351 - str := buf.Bytes() 1352 + str := string(IMGdata[:]) 1353 1354 - avatar.LoadFromData(string(str[:]), uint(len(str)), "PNG", 0) 1355 + avatar.LoadFromData(string(str[:]), uint(len(str)), "", 0) 1356 avatarResp = avatar 1357 return 1358 } 1359 1360 +//GetUserDataFromCache gets the last User from the cache 1361 func GetUserDataFromCache() (accessToken, homeserverURL, userID string, err error) { 1362 UserDB, err := db.OpenUserDB() 1363 1364 // Get cache 1365 DBErr := UserDB.View(func(txn *badger.Txn) error { 1366 - accessTokenItem, QueryErr := txn.Get([]byte("user|accessToken")) 1367 - if QueryErr != nil && QueryErr != badger.ErrKeyNotFound { 1368 + accessTokenResult, QueryErr := db.Get(txn, []byte("user|accessToken")) 1369 + if QueryErr != nil { 1370 return QueryErr 1371 } 1372 - if QueryErr != badger.ErrKeyNotFound { 1373 - accessTokenByte, accessTokenErr := accessTokenItem.Value() 1374 - accessToken = fmt.Sprintf("%s", accessTokenByte) 1375 - if accessTokenErr != nil { 1376 - return accessTokenErr 1377 - } 1378 - } 1379 + accessToken = fmt.Sprintf("%s", accessTokenResult) 1380 1381 - homeserverURLItem, QueryErr := txn.Get([]byte("user|homeserverURL")) 1382 - if QueryErr != nil && QueryErr != badger.ErrKeyNotFound { 1383 + homeserverURLResult, QueryErr := db.Get(txn, []byte("user|homeserverURL")) 1384 + if QueryErr != nil { 1385 return QueryErr 1386 } 1387 - if QueryErr != badger.ErrKeyNotFound { 1388 - homeserverURLByte, homeserverURLErr := homeserverURLItem.Value() 1389 - homeserverURL = fmt.Sprintf("%s", homeserverURLByte) 1390 - if homeserverURLErr != nil { 1391 - return homeserverURLErr 1392 - } 1393 - } 1394 + homeserverURL = fmt.Sprintf("%s", homeserverURLResult) 1395 1396 - userIDItem, QueryErr := txn.Get([]byte("user|userID")) 1397 - if QueryErr != nil && QueryErr != badger.ErrKeyNotFound { 1398 + userIDResult, QueryErr := db.Get(txn, []byte("user|userID")) 1399 + if QueryErr != nil { 1400 return QueryErr 1401 } 1402 - if QueryErr != badger.ErrKeyNotFound { 1403 - userIDByte, userIDErr := userIDItem.Value() 1404 - userID = fmt.Sprintf("%s", userIDByte) 1405 - return userIDErr 1406 - } 1407 + userID = fmt.Sprintf("%s", userIDResult) 1408 return nil 1409 }) 1410 if DBErr != nil { 1411 diff --git a/qml/ui/chat.ui b/qml/ui/chat.ui 1412 index cbfeb47..460c534 100644 1413 --- a/qml/ui/chat.ui 1414 +++ b/qml/ui/chat.ui 1415 @@ -566,7 +566,7 @@ border-radius: 5px;</string> 1416 <item> 1417 <widget class="QScrollArea" name="roomScroll"> 1418 <property name="sizePolicy"> 1419 - <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> 1420 + <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> 1421 <horstretch>0</horstretch> 1422 <verstretch>0</verstretch> 1423 </sizepolicy> 1424 @@ -676,9 +676,6 @@ border-radius: 2px;</string> 1425 <property name="text"> 1426 <string/> 1427 </property> 1428 - <property name="pixmap"> 1429 - <pixmap>../../../../../../../Downloads/MatrixHQ.png</pixmap> 1430 - </property> 1431 <property name="scaledContents"> 1432 <bool>true</bool> 1433 </property> 1434 @@ -712,7 +709,7 @@ border-radius: 2px;</string> 1435 </font> 1436 </property> 1437 <property name="text"> 1438 - <string>Matrix HQ</string> 1439 + <string/> 1440 </property> 1441 <property name="wordWrap"> 1442 <bool>true</bool> 1443 @@ -747,7 +744,7 @@ border-radius: 2px;</string> 1444 </font> 1445 </property> 1446 <property name="text"> 1447 - <string>The Official Matrix HQ - please come chat here! | To support Matrix.org development: https://patreon.com/matrixdotorg | Try http://riot.im/app for a glossy web client | Looking for homeserver hosting? Check out https://upcloud.com/matrix!</string> 1448 + <string/> 1449 </property> 1450 <property name="textFormat"> 1451 <enum>Qt::AutoText</enum> 1452 @@ -890,7 +887,7 @@ border-radius: 2px;</string> 1453 <x>0</x> 1454 <y>0</y> 1455 <width>601</width> 1456 - <height>424</height> 1457 + <height>469</height> 1458 </rect> 1459 </property> 1460 <property name="minimumSize"> 1461 diff --git a/qml/ui/message.ui b/qml/ui/message.ui 1462 index e427e23..3a37ba9 100644 1463 --- a/qml/ui/message.ui 1464 +++ b/qml/ui/message.ui 1465 @@ -117,7 +117,7 @@ border: 0; 1466 border-radius:7px;</string> 1467 </property> 1468 <property name="text"> 1469 - <string>Test</string> 1470 + <string/> 1471 </property> 1472 <property name="scaledContents"> 1473 <bool>false</bool> 1474 @@ -153,7 +153,7 @@ border-radius:7px;</string> 1475 <string notr="true">color:grey;</string> 1476 </property> 1477 <property name="text"> 1478 - <string>MTRNord</string> 1479 + <string/> 1480 </property> 1481 <property name="openExternalLinks"> 1482 <bool>true</bool> 1483 @@ -174,7 +174,7 @@ border-radius:7px;</string> 1484 <string notr="true">color:grey;</string> 1485 </property> 1486 <property name="text"> 1487 - <string>Way to early to say a time^^</string> 1488 + <string/> 1489 </property> 1490 <property name="alignment"> 1491 <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> 1492 diff --git a/qml/ui/ownmessage.ui b/qml/ui/ownmessage.ui 1493 index 9b18ed7..29dafb4 100644 1494 --- a/qml/ui/ownmessage.ui 1495 +++ b/qml/ui/ownmessage.ui 1496 @@ -114,7 +114,7 @@ border: 0; 1497 border-radius:7px;</string> 1498 </property> 1499 <property name="text"> 1500 - <string>Test</string> 1501 + <string/> 1502 </property> 1503 <property name="scaledContents"> 1504 <bool>false</bool> 1505 @@ -150,7 +150,7 @@ border-radius:7px;</string> 1506 <string notr="true">color:grey;</string> 1507 </property> 1508 <property name="text"> 1509 - <string>Way to early to say a time^^</string> 1510 + <string/> 1511 </property> 1512 <property name="alignment"> 1513 <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> 1514 @@ -174,7 +174,7 @@ border-radius:7px;</string> 1515 <string notr="true">color:grey;</string> 1516 </property> 1517 <property name="text"> 1518 - <string>MTRNord</string> 1519 + <string/> 1520 </property> 1521 <property name="alignment"> 1522 <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> 1523 diff --git a/qml/ui/room.ui b/qml/ui/room.ui 1524 index 50dfbc0..4969ef0 100644 1525 --- a/qml/ui/room.ui 1526 +++ b/qml/ui/room.ui 1527 @@ -129,7 +129,7 @@ 1528 <string notr="true">border: 0;</string> 1529 </property> 1530 <property name="text"> 1531 - <string>Test</string> 1532 + <string/> 1533 </property> 1534 <property name="scaledContents"> 1535 <bool>false</bool> 1536 diff --git a/scripts/lint.sh b/scripts/lint.sh 1537 index b831caf..ca212a4 100644 1538 --- a/scripts/lint.sh 1539 +++ b/scripts/lint.sh 1540 @@ -25,8 +25,8 @@ then args="$args --enable-gc" 1541 fi 1542 1543 echo "Installing lint search engine..." 1544 -go install github.com/alecthomas/gometalinter/ 1545 -gometalinter --config=linter.json ./... --install 1546 +go get -u -v github.com/alecthomas/gometalinter/ 1547 +$GOPATH/bin/gometalinter --config=linter.json ./... --install 1548 1549 echo "Looking for lint..." 1550 -gometalinter ./... ${args} 1551 \ No newline at end of file 1552 +$GOPATH/bin/gometalinter ./... ${args} --skip=vendor --exclude "vendor" --exclude "moc" --exclude "qt" 1553 diff --git a/ui/LoginUI.go b/ui/LoginUI.go 1554 index dad233f..7a77a04 100644 1555 --- a/ui/LoginUI.go 1556 +++ b/ui/LoginUI.go 1557 @@ -4,6 +4,7 @@ import ( 1558 "sync" 1559 1560 "github.com/Nordgedanken/Morpheus/matrix" 1561 + "github.com/Nordgedanken/Morpheus/matrix/globalTypes" 1562 "github.com/matrix-org/gomatrix" 1563 log "github.com/sirupsen/logrus" 1564 "github.com/therecipe/qt/core" 1565 @@ -13,22 +14,22 @@ import ( 1566 ) 1567 1568 // NewLoginUIStruct gives you a LoginUI struct with prefilled data 1569 -func NewLoginUIStruct(windowWidth, windowHeight int, window *widgets.QMainWindow) (loginUIStruct LoginUI) { 1570 - configStruct := config{ 1571 - windowWidth: windowWidth, 1572 - windowHeight: windowHeight, 1573 +func NewLoginUIStruct(windowWidth, windowHeight int, window *widgets.QMainWindow) (loginUIStruct *LoginUI) { 1574 + configStruct := globalTypes.Config{ 1575 + WindowWidth: windowWidth, 1576 + WindowHeight: windowHeight, 1577 } 1578 - loginUIStruct = LoginUI{ 1579 - config: configStruct, 1580 + loginUIStruct = &LoginUI{ 1581 + Config: configStruct, 1582 window: window, 1583 } 1584 return 1585 } 1586 1587 // NewLoginUIStructWithExistingConfig gives you a LoginUI struct with prefilled data and data from a previous Config 1588 -func NewLoginUIStructWithExistingConfig(configStruct config, window *widgets.QMainWindow) (loginUIStruct LoginUI) { 1589 - loginUIStruct = LoginUI{ 1590 - config: configStruct, 1591 +func NewLoginUIStructWithExistingConfig(configStruct globalTypes.Config, window *widgets.QMainWindow) (loginUIStruct *LoginUI) { 1592 + loginUIStruct = &LoginUI{ 1593 + Config: configStruct, 1594 window: window, 1595 } 1596 return 1597 @@ -77,35 +78,31 @@ func (l *LoginUI) NewUI() (err error) { 1598 if usernameInput.StyleSheet() == "border: 1px solid red" { 1599 usernameInput.SetStyleSheet("") 1600 } 1601 - l.username = value 1602 + l.Username = value 1603 }) 1604 1605 passwordInput.ConnectTextChanged(func(value string) { 1606 if passwordInput.StyleSheet() == "border: 1px solid red" { 1607 passwordInput.SetStyleSheet("") 1608 } 1609 - l.password = value 1610 + l.Password = value 1611 }) 1612 1613 loginButton.ConnectClicked(func(_ bool) { 1614 - if l.username != "" { 1615 - if l.password != "" { 1616 - LoginErr := l.login() 1617 - if LoginErr != nil { 1618 - err = LoginErr 1619 - return 1620 - } 1621 - } else { 1622 - passwordInput.SetStyleSheet("border: 1px solid red") 1623 + if l.Username != "" && l.Password != "" { 1624 + LoginErr := l.login() 1625 + if LoginErr != nil { 1626 + err = LoginErr 1627 + return 1628 } 1629 } else { 1630 - usernameInput.SetStyleSheet("border: 1px solid red") 1631 + passwordInput.SetStyleSheet("border: 1px solid red") 1632 } 1633 }) 1634 1635 usernameInput.ConnectKeyPressEvent(func(ev *gui.QKeyEvent) { 1636 if int(ev.Key()) == int(core.Qt__Key_Enter) || int(ev.Key()) == int(core.Qt__Key_Return) { 1637 - if l.password != "" { 1638 + if l.Password != "" { 1639 LoginErr := l.login() 1640 if LoginErr != nil { 1641 err = LoginErr 1642 @@ -126,7 +123,7 @@ func (l *LoginUI) NewUI() (err error) { 1643 1644 passwordInput.ConnectKeyPressEvent(func(ev *gui.QKeyEvent) { 1645 if int(ev.Key()) == int(core.Qt__Key_Enter) || int(ev.Key()) == int(core.Qt__Key_Return) { 1646 - if l.username != "" { 1647 + if l.Username != "" { 1648 LoginErr := l.login() 1649 if LoginErr != nil { 1650 err = LoginErr 1651 @@ -155,12 +152,12 @@ func (l *LoginUI) login() (err error) { 1652 1653 var wg sync.WaitGroup 1654 1655 - if l.username != "" && l.password != "" { 1656 + if l.Username != "" && l.Password != "" { 1657 log.Infoln("Starting Login Sequenze in background") 1658 results := make(chan *gomatrix.Client) 1659 1660 wg.Add(1) 1661 - go matrix.DoLogin(l.username, l.password, "", "", "", results, &wg) 1662 + go matrix.DoLogin(l.Username, l.Password, "", "", "", results, &wg) 1663 1664 go func() { 1665 wg.Wait() // wait for each execTask to return 1666 @@ -169,9 +166,8 @@ func (l *LoginUI) login() (err error) { 1667 1668 //Show MainUI 1669 for result := range results { 1670 - //TODO Don't switch screen on wrong login data. 1671 - l.cli = result 1672 - MainUIStruct := NewMainUIStructWithExistingConfig(l.config, l.window) 1673 + l.Cli = result 1674 + MainUIStruct := NewMainUIStructWithExistingConfig(l.Config, l.window) 1675 mainUIErr := MainUIStruct.NewUI() 1676 if mainUIErr != nil { 1677 err = mainUIErr 1678 diff --git a/ui/MainUI.go b/ui/MainUI.go 1679 index a5f8cfa..fc818ad 100644 1680 --- a/ui/MainUI.go 1681 +++ b/ui/MainUI.go 1682 @@ -2,18 +2,24 @@ package ui 1683 1684 import ( 1685 "fmt" 1686 + "os" 1687 + "path/filepath" 1688 "strconv" 1689 "strings" 1690 "sync" 1691 1692 "github.com/Nordgedanken/Morpheus/matrix" 1693 "github.com/Nordgedanken/Morpheus/matrix/db" 1694 + "github.com/Nordgedanken/Morpheus/matrix/globalTypes" 1695 + "github.com/Nordgedanken/Morpheus/matrix/rooms" 1696 "github.com/Nordgedanken/Morpheus/matrix/syncer" 1697 + "github.com/Nordgedanken/Morpheus/ui/listLayouts" 1698 "github.com/dgraph-io/badger" 1699 "github.com/matrix-org/gomatrix" 1700 "github.com/opennota/linkify" 1701 "github.com/pkg/errors" 1702 "github.com/rhinoman/go-commonmark" 1703 + "github.com/shibukawa/configdir" 1704 log "github.com/sirupsen/logrus" 1705 "github.com/therecipe/qt/core" 1706 "github.com/therecipe/qt/gui" 1707 @@ -22,32 +28,32 @@ import ( 1708 ) 1709 1710 // NewMainUIStruct gives you a MainUI struct with prefilled data 1711 -func NewMainUIStruct(windowWidth, windowHeight int, window *widgets.QMainWindow) (mainUIStruct MainUI) { 1712 - configStruct := config{ 1713 - windowWidth: windowWidth, 1714 - windowHeight: windowHeight, 1715 +func NewMainUIStruct(windowWidth, windowHeight int, window *widgets.QMainWindow) (mainUIStruct *MainUI) { 1716 + configStruct := globalTypes.Config{ 1717 + WindowWidth: windowWidth, 1718 + WindowHeight: windowHeight, 1719 + Rooms: make(map[string]*rooms.Room), 1720 } 1721 - mainUIStruct = MainUI{ 1722 - config: configStruct, 1723 + mainUIStruct = &MainUI{ 1724 + Config: configStruct, 1725 window: window, 1726 - rooms: make(map[string]*matrix.Room), 1727 } 1728 return 1729 } 1730 1731 // NewMainUIStructWithExistingConfig gives you a MainUI struct with prefilled data and data from a previous Config 1732 -func NewMainUIStructWithExistingConfig(configStruct config, window *widgets.QMainWindow) (mainUIStruct MainUI) { 1733 - mainUIStruct = MainUI{ 1734 - config: configStruct, 1735 +func NewMainUIStructWithExistingConfig(configStruct globalTypes.Config, window *widgets.QMainWindow) (mainUIStruct *MainUI) { 1736 + configStruct.Rooms = make(map[string]*rooms.Room) 1737 + mainUIStruct = &MainUI{ 1738 + Config: configStruct, 1739 window: window, 1740 - rooms: make(map[string]*matrix.Room), 1741 } 1742 return 1743 } 1744 1745 // SetCli allows you to add a gomatrix.Client to your MainUI struct 1746 func (m *MainUI) SetCli(cli *gomatrix.Client) { 1747 - m.cli = cli 1748 + m.Cli = cli 1749 } 1750 1751 // GetWidget gives you the widget of the MainUI struct 1752 @@ -58,38 +64,11 @@ func (m *MainUI) GetWidget() (widget *widgets.QWidget) { 1753 1754 // NewUI initializes a new Main Screen 1755 func (m *MainUI) NewUI() (err error) { 1756 - m.widget = widgets.NewQWidget(nil, 0) 1757 - 1758 - var loader = uitools.NewQUiLoader(nil) 1759 - var file = core.NewQFile2(":/qml/ui/chat.ui") 1760 - 1761 - file.Open(core.QIODevice__ReadOnly) 1762 - m.MainWidget = loader.Load(file, m.widget) 1763 - file.Close() 1764 - 1765 - m.messageScrollArea = widgets.NewQScrollAreaFromPointer(m.widget.FindChild("messageScroll", core.Qt__FindChildrenRecursively).Pointer()) 1766 - messagesScrollAreaContent := widgets.NewQWidgetFromPointer(m.widget.FindChild("messagesScrollAreaContent", core.Qt__FindChildrenRecursively).Pointer()) 1767 - roomScrollArea := widgets.NewQScrollAreaFromPointer(m.widget.FindChild("roomScroll", core.Qt__FindChildrenRecursively).Pointer()) 1768 - roomScrollAreaContent := widgets.NewQWidgetFromPointer(m.widget.FindChild("roomScrollAreaContent", core.Qt__FindChildrenRecursively).Pointer()) 1769 - 1770 - m.RoomAvatar = widgets.NewQLabelFromPointer(m.widget.FindChild("roomAvatar", core.Qt__FindChildrenRecursively).Pointer()) 1771 - m.RoomTitle = widgets.NewQLabelFromPointer(m.widget.FindChild("RoomTitle", core.Qt__FindChildrenRecursively).Pointer()) 1772 - m.RoomTopic = widgets.NewQLabelFromPointer(m.widget.FindChild("Topic", core.Qt__FindChildrenRecursively).Pointer()) 1773 - 1774 - var layout = widgets.NewQHBoxLayout() 1775 - m.window.SetLayout(layout) 1776 - layout.InsertWidget(0, m.MainWidget, 0, core.Qt__AlignTop|core.Qt__AlignLeft) 1777 - layout.SetSpacing(0) 1778 - layout.SetContentsMargins(0, 0, 0, 0) 1779 - 1780 - m.widget.ConnectResizeEvent(func(event *gui.QResizeEvent) { 1781 - m.MainWidget.Resize(event.Size()) 1782 - event.Accept() 1783 - }) 1784 + m.loadChatUIDefaults() 1785 1786 //Set Avatar 1787 avatarLogo := widgets.NewQLabelFromPointer(m.widget.FindChild("UserAvatar", core.Qt__FindChildrenRecursively).Pointer()) 1788 - avatar, AvatarErr := matrix.GetOwnUserAvatar(m.cli) 1789 + avatar, AvatarErr := matrix.GetOwnUserAvatar(m.Cli) 1790 if AvatarErr != nil { 1791 err = AvatarErr 1792 return 1793 @@ -106,25 +85,12 @@ func (m *MainUI) NewUI() (err error) { 1794 } 1795 }) 1796 1797 - // Init Message View 1798 - m.MessageListLayout = NewMessageList(m.messageScrollArea, messagesScrollAreaContent) 1799 - 1800 - // Init Room View 1801 - roomListLayout := NewRoomList(roomScrollArea, roomScrollAreaContent) 1802 - 1803 - m.messageScrollArea.SetWidgetResizable(true) 1804 - m.messageScrollArea.SetHorizontalScrollBarPolicy(core.Qt__ScrollBarAlwaysOff) 1805 - m.messageScrollArea.SetContentsMargins(0, 0, 0, 0) 1806 - //messageScrollArea.SetSizeAdjustPolicy(widgets.QAbstractScrollArea__AdjustToContents) 1807 - 1808 - roomScrollArea.SetWidgetResizable(true) 1809 - roomScrollArea.SetHorizontalScrollBarPolicy(core.Qt__ScrollBarAlwaysOff) 1810 - roomScrollArea.SetContentsMargins(0, 0, 0, 0) 1811 - roomScrollArea.SetSizeAdjustPolicy(widgets.QAbstractScrollArea__AdjustToContents) 1812 + m.initScrolls() 1813 1814 m.MessageListLayout.ConnectTriggerMessage(func(messageBody, sender string, timestamp int64) { 1815 + log.Println("triggered Message") 1816 var own bool 1817 - if sender == m.cli.UserID { 1818 + if sender == m.Cli.UserID { 1819 own = true 1820 } else { 1821 own = false 1822 @@ -152,43 +118,24 @@ func (m *MainUI) NewUI() (err error) { 1823 } 1824 } 1825 } 1826 - NewMessageErr := m.MessageListLayout.NewMessage(messageBody, m.cli, sender, timestamp, m.messageScrollArea, own, m) 1827 - if NewMessageErr != nil { 1828 - err = NewMessageErr 1829 - return 1830 - } 1831 + m.MessageListLayout.NewMessage(messageBody, m.Cli, sender, timestamp, m.messageScrollArea, own) 1832 }) 1833 1834 - m.startSync() 1835 + go m.startSync() 1836 m.widget.SetSizePolicy2(widgets.QSizePolicy__Expanding, widgets.QSizePolicy__Expanding) 1837 m.MainWidget.SetSizePolicy2(widgets.QSizePolicy__Expanding, widgets.QSizePolicy__Expanding) 1838 1839 - roomListLayout.ConnectTriggerRoom(func(roomID string) { 1840 - room := m.rooms[roomID] 1841 + m.RoomListLayout.ConnectTriggerRoom(func(roomID string) { 1842 + room := m.Rooms[roomID] 1843 1844 - NewRoomErr := roomListLayout.NewRoom(room, roomScrollArea, m) 1845 + NewRoomErr := m.RoomListLayout.NewRoom(room, m.roomScrollArea) 1846 if NewRoomErr != nil { 1847 err = NewRoomErr 1848 return 1849 } 1850 }) 1851 1852 - m.initRoomList(roomListLayout, roomScrollArea) 1853 - 1854 - go m.loadCache() 1855 - 1856 - m.MainWidget.SetWindowTitle("Morpheus - " + m.rooms[m.currentRoom].GetRoomTopic()) 1857 - 1858 - avatar, roomAvatarErr := m.rooms[m.currentRoom].GetRoomAvatar() 1859 - if roomAvatarErr != nil { 1860 - err = roomAvatarErr 1861 - return 1862 - } 1863 - m.RoomAvatar.SetPixmap(avatar) 1864 - 1865 - m.RoomTitle.SetText(m.rooms[m.currentRoom].GetRoomName()) 1866 - 1867 - m.RoomTopic.SetText(m.rooms[m.currentRoom].GetRoomTopic()) 1868 + go m.initRoomList() 1869 1870 var message string 1871 messageInput := widgets.NewQLineEditFromPointer(m.widget.FindChild("MessageInput", core.Qt__FindChildrenRecursively).Pointer()) 1872 @@ -198,11 +145,7 @@ func (m *MainUI) NewUI() (err error) { 1873 1874 m.window.ConnectKeyPressEvent(func(ev *gui.QKeyEvent) { 1875 if int(ev.Key()) == int(core.Qt__Key_Enter) || int(ev.Key()) == int(core.Qt__Key_Return) { 1876 - MessageErr := m.sendMessage(message) 1877 - if MessageErr != nil { 1878 - err = MessageErr 1879 - return 1880 - } 1881 + go m.sendMessage(message) 1882 1883 messageInput.Clear() 1884 ev.Accept() 1885 @@ -210,11 +153,84 @@ func (m *MainUI) NewUI() (err error) { 1886 messageInput.KeyPressEventDefault(ev) 1887 ev.Ignore() 1888 } 1889 + return 1890 + }) 1891 + 1892 + m.RoomListLayout.ConnectChangeRoom(func(roomID string) { 1893 + room := m.Rooms[roomID] 1894 + roomAvatar, roomAvatarErr := room.GetRoomAvatar() 1895 + if roomAvatarErr != nil { 1896 + err = roomAvatarErr 1897 + return 1898 + } 1899 + if m.CurrentRoom != room.RoomID { 1900 + m.SetCurrentRoom(room.RoomID) 1901 + m.MainWidget.SetWindowTitle("Morpheus - " + room.GetRoomTopic()) 1902 + 1903 + m.RoomAvatar.SetPixmap(roomAvatar) 1904 + 1905 + m.RoomTitle.SetText(room.GetRoomName()) 1906 + 1907 + m.RoomTopic.SetText(room.GetRoomTopic()) 1908 + count := m.MessageListLayout.Count() 1909 + for i := 0; i < count; i++ { 1910 + widgetScroll := m.MessageListLayout.ItemAt(i).Widget() 1911 + widgetScroll.DeleteLater() 1912 + } 1913 + 1914 + log.Println("next loadCache") 1915 + go m.loadCache() 1916 + } 1917 }) 1918 1919 return 1920 } 1921 1922 +func (m *MainUI) initScrolls() { 1923 + // Init Message View 1924 + m.MessageListLayout = listLayouts.NewMessageList(m.messageScrollArea) 1925 + 1926 + // Init Room View 1927 + m.RoomListLayout = listLayouts.NewRoomList(m.roomScrollArea) 1928 + 1929 + m.messageScrollArea.SetWidgetResizable(true) 1930 + m.messageScrollArea.SetHorizontalScrollBarPolicy(core.Qt__ScrollBarAlwaysOff) 1931 + m.messageScrollArea.SetContentsMargins(0, 0, 0, 0) 1932 + 1933 + m.roomScrollArea.SetWidgetResizable(true) 1934 + m.roomScrollArea.SetHorizontalScrollBarPolicy(core.Qt__ScrollBarAlwaysOff) 1935 + m.roomScrollArea.SetContentsMargins(0, 0, 0, 0) 1936 +} 1937 + 1938 +func (m *MainUI) loadChatUIDefaults() { 1939 + m.widget = widgets.NewQWidget(nil, 0) 1940 + 1941 + var loader = uitools.NewQUiLoader(nil) 1942 + var file = core.NewQFile2(":/qml/ui/chat.ui") 1943 + 1944 + file.Open(core.QIODevice__ReadOnly) 1945 + m.MainWidget = loader.Load(file, m.widget) 1946 + file.Close() 1947 + 1948 + m.messageScrollArea = widgets.NewQScrollAreaFromPointer(m.widget.FindChild("messageScroll", core.Qt__FindChildrenRecursively).Pointer()) 1949 + m.roomScrollArea = widgets.NewQScrollAreaFromPointer(m.widget.FindChild("roomScroll", core.Qt__FindChildrenRecursively).Pointer()) 1950 + 1951 + m.RoomAvatar = widgets.NewQLabelFromPointer(m.widget.FindChild("roomAvatar", core.Qt__FindChildrenRecursively).Pointer()) 1952 + m.RoomTitle = widgets.NewQLabelFromPointer(m.widget.FindChild("RoomTitle", core.Qt__FindChildrenRecursively).Pointer()) 1953 + m.RoomTopic = widgets.NewQLabelFromPointer(m.widget.FindChild("Topic", core.Qt__FindChildrenRecursively).Pointer()) 1954 + 1955 + var layout = widgets.NewQHBoxLayout() 1956 + m.window.SetLayout(layout) 1957 + layout.InsertWidget(0, m.MainWidget, 0, core.Qt__AlignTop|core.Qt__AlignLeft) 1958 + layout.SetSpacing(0) 1959 + layout.SetContentsMargins(0, 0, 0, 0) 1960 + 1961 + m.widget.ConnectResizeEvent(func(event *gui.QResizeEvent) { 1962 + m.MainWidget.Resize(event.Size()) 1963 + event.Accept() 1964 + }) 1965 +} 1966 + 1967 func (m *MainUI) sendMessage(message string) (err error) { 1968 messageOriginal := message 1969 lm := linkify.Links(message) 1970 @@ -225,13 +241,13 @@ func (m *MainUI) sendMessage(message string) (err error) { 1971 1972 mardownMessage := commonmark.Md2Html(message, 0) 1973 if mardownMessage == message { 1974 - _, SendErr := m.cli.SendMessageEvent(m.currentRoom, "m.room.message", matrix.HTMLMessage{MsgType: "m.text", Body: messageOriginal, FormattedBody: message, Format: "org.matrix.custom.html"}) 1975 + _, SendErr := m.Cli.SendMessageEvent(m.CurrentRoom, "m.room.message", matrix.HTMLMessage{MsgType: "m.text", Body: messageOriginal, FormattedBody: message, Format: "org.matrix.custom.html"}) 1976 if SendErr != nil { 1977 err = SendErr 1978 return 1979 } 1980 } else { 1981 - _, SendErr := m.cli.SendMessageEvent(m.currentRoom, "m.room.message", matrix.HTMLMessage{MsgType: "m.text", Body: message, FormattedBody: mardownMessage, Format: "org.matrix.custom.html"}) 1982 + _, SendErr := m.Cli.SendMessageEvent(m.CurrentRoom, "m.room.message", matrix.HTMLMessage{MsgType: "m.text", Body: message, FormattedBody: mardownMessage, Format: "org.matrix.custom.html"}) 1983 if SendErr != nil { 1984 err = SendErr 1985 return 1986 @@ -241,7 +257,6 @@ func (m *MainUI) sendMessage(message string) (err error) { 1987 } 1988 1989 func (m *MainUI) logout(widget *widgets.QWidget, messageScrollArea *widgets.QScrollArea) (err error) { 1990 - //TODO register enter and show loader or so 1991 log.Infoln("Starting Logout Sequence in background") 1992 var wg sync.WaitGroup 1993 results := make(chan bool) 1994 @@ -249,6 +264,7 @@ func (m *MainUI) logout(widget *widgets.QWidget, messageScrollArea *widgets.QScr 1995 wg.Add(1) 1996 go func(cli *gomatrix.Client, results chan<- bool) { 1997 defer wg.Done() 1998 + cli.StopSync() 1999 _, LogoutErr := cli.Logout() 2000 if LogoutErr != nil { 2001 log.Errorln(LogoutErr) 2002 @@ -260,29 +276,18 @@ func (m *MainUI) logout(widget *widgets.QWidget, messageScrollArea *widgets.QScr 2003 if DBOpenErr != nil { 2004 log.Errorln(DBOpenErr) 2005 } 2006 + userDB.Close() 2007 2008 - //Flush complete DB 2009 - txn := userDB.NewTransaction(true) // Read-write txn 2010 - QueryErr := txn.Delete([]byte("")) 2011 - if QueryErr != nil { 2012 - log.Errorln(QueryErr) 2013 - results <- false 2014 - } 2015 - 2016 - CommitErr := txn.Commit(nil) 2017 - if CommitErr != nil { 2018 - log.Errorln(CommitErr) 2019 + configDirs := configdir.New("Nordgedanken", "Morpheus") 2020 + filePath := filepath.ToSlash(configDirs.QueryFolders(configdir.Global)[0].Path) 2021 + DeleteErr := os.RemoveAll(filePath + "/data/user/") 2022 + if DeleteErr != nil { 2023 + log.Errorln(DeleteErr) 2024 results <- false 2025 } 2026 - 2027 - DBPurgeErr := userDB.PurgeOlderVersions() 2028 - if DBPurgeErr != nil { 2029 - log.Errorln(DBPurgeErr) 2030 - results <- false 2031 - } else { 2032 - results <- true 2033 - } 2034 - }(m.cli, results) 2035 + db.ResetOnceUser() 2036 + results <- true 2037 + }(m.Cli, results) 2038 2039 go func() { 2040 wg.Wait() // wait for each execTask to return 2041 @@ -297,7 +302,7 @@ func (m *MainUI) logout(widget *widgets.QWidget, messageScrollArea *widgets.QScr 2042 widget.DisconnectResizeEvent() 2043 messageScrollArea.DisconnectResizeEvent() 2044 2045 - LoginUIStruct := NewLoginUIStructWithExistingConfig(m.config, m.window) 2046 + LoginUIStruct := NewLoginUIStructWithExistingConfig(m.Config, m.window) 2047 loginUIErr := LoginUIStruct.NewUI() 2048 if loginUIErr != nil { 2049 err = loginUIErr 2050 @@ -321,16 +326,16 @@ func (m *MainUI) startSync() (err error) { 2051 }) 2052 m.storage = &syncer.MorpheusStore{ 2053 InMemoryStore: *gomatrix.NewInMemoryStore(), 2054 - CacheDatabase: m.cacheDB, 2055 + CacheDatabase: m.CacheDB, 2056 } 2057 2058 - m.syncer = syncer.NewMorpheusSyncer(m.cli.UserID, m.storage) 2059 + Syncer := syncer.NewMorpheusSyncer(m.Cli.UserID, m.storage) 2060 2061 - m.cli.Store = m.storage 2062 - m.cli.Syncer = m.syncer 2063 - m.syncer.Store = m.storage 2064 + m.Cli.Store = m.storage 2065 + m.Cli.Syncer = Syncer 2066 + Syncer.Store = m.storage 2067 2068 - m.syncer.OnEventType("m.room.message", func(ev *gomatrix.Event) { 2069 + Syncer.OnEventType("m.room.message", func(ev *gomatrix.Event) { 2070 formattedBody, _ := ev.Content["formatted_body"] 2071 var msg string 2072 msg, _ = formattedBody.(string) 2073 @@ -342,17 +347,38 @@ func (m *MainUI) startSync() (err error) { 2074 id := ev.ID 2075 timestamp := ev.Timestamp 2076 go db.CacheMessageEvents(id, sender, room, msg, timestamp) 2077 - if room == m.currentRoom { 2078 + if room == m.CurrentRoom { 2079 go m.MessageListLayout.TriggerMessage(msg, sender, timestamp) 2080 } 2081 }) 2082 2083 + Syncer.OnEventType("m.room.name", func(ev *gomatrix.Event) { 2084 + roomNameRaw, _ := ev.Content["name"] 2085 + var roomName string 2086 + roomName, _ = roomNameRaw.(string) 2087 + evType := ev.Type 2088 + room := ev.RoomID 2089 + go m.Rooms[room].UpdateRoomNameByEvent(roomName, evType) 2090 + }) 2091 + 2092 + Syncer.OnEventType("m.room.name", func(ev *gomatrix.Event) { 2093 + roomNameRaw, _ := ev.Content["name"] 2094 + var roomName string 2095 + roomName, _ = roomNameRaw.(string) 2096 + evType := ev.Type 2097 + room := ev.RoomID 2098 + go m.Rooms[room].UpdateRoomNameByEvent(roomName, evType) 2099 + }) 2100 + 2101 // Start Non-blocking sync 2102 go func() { 2103 log.Infoln("Start sync") 2104 for { 2105 - 2106 - if e := m.cli.Sync(); e != nil { 2107 + e := m.Cli.Sync() 2108 + if e == nil { 2109 + break 2110 + } 2111 + if e != nil { 2112 err = e 2113 } 2114 } 2115 @@ -360,21 +386,21 @@ func (m *MainUI) startSync() (err error) { 2116 return 2117 } 2118 2119 -func (m *MainUI) initRoomList(roomListLayout *QRoomVBoxLayoutWithTriggerSlot, roomScrollArea *widgets.QScrollArea) (err error) { 2120 - rooms, ReqErr := m.cli.JoinedRooms() 2121 - if ReqErr != nil { 2122 - err = ReqErr 2123 +func (m *MainUI) initRoomList() (err error) { 2124 + roomsStruct, roomsErr := rooms.GetRooms(m.Cli) 2125 + if roomsErr != nil { 2126 + err = roomsErr 2127 return 2128 } 2129 2130 - x := 0 2131 - for _, roomID := range rooms.JoinedRooms { 2132 - if x == 0 { 2133 - m.currentRoom = roomID 2134 + first := true 2135 + for _, roomID := range roomsStruct { 2136 + m.Rooms[roomID] = rooms.NewRoom(roomID, m.Cli) 2137 + m.RoomListLayout.TriggerRoom(roomID) 2138 + if first { 2139 + go m.RoomListLayout.ChangeRoom(roomID) 2140 } 2141 - x++ 2142 - m.rooms[roomID] = matrix.NewRoom(roomID, m.cli) 2143 - roomListLayout.TriggerRoom(roomID) 2144 + first = false 2145 } 2146 2147 return 2148 @@ -406,7 +432,7 @@ func (m *MainUI) loadCache() (err error) { 2149 MsgOpts := badger.DefaultIteratorOptions 2150 MsgOpts.PrefetchSize = 10 2151 MsgIt := txn.NewIterator(MsgOpts) 2152 - MsgPrefix := []byte("room|" + m.currentRoom + "|messages|") 2153 + MsgPrefix := []byte("room|" + m.CurrentRoom + "|messages") 2154 2155 var doneMsg []string 2156 2157 @@ -414,203 +440,47 @@ func (m *MainUI) loadCache() (err error) { 2158 item := MsgIt.Item() 2159 key := item.Key() 2160 stringKey := fmt.Sprintf("%s", key) 2161 + stringKeySlice := strings.Split(stringKey, "|") 2162 + stringKeyEnd := stringKeySlice[len(stringKeySlice)-1] 2163 + if stringKeyEnd != "id" { 2164 + continue 2165 + } 2166 + 2167 value, ValueErr := item.Value() 2168 if ValueErr != nil { 2169 return ValueErr 2170 } 2171 - stringValue := fmt.Sprintf("%s", value) 2172 - 2173 - if strings.HasSuffix(stringKey, "|id") { 2174 - if !contains(doneMsg, stringValue) { 2175 - // Remember we already added this message to the view 2176 - doneMsg = append(doneMsg, stringValue) 2177 - 2178 - // Get all Data 2179 - senderItem, senderErr := txn.Get([]byte(strings.Replace(stringKey, "|id", "|sender", -1))) 2180 - if senderErr != nil { 2181 - return errors.WithMessage(senderErr, "Key: "+strings.Replace(stringKey, "|id", "|sender", -1)) 2182 - } 2183 - 2184 - senderValue, senderValueErr := senderItem.Value() 2185 - if senderValueErr != nil { 2186 - return senderValueErr 2187 - } 2188 - sender := fmt.Sprintf("%s", senderValue) 2189 - 2190 - messageItem, messageErr := txn.Get([]byte(strings.Replace(stringKey, "|id", "|messageString", -1))) 2191 - if messageErr != nil { 2192 - return errors.WithMessage(messageErr, "Key: "+strings.Replace(stringKey, "|id", "|messageString", -1)) 2193 - } 2194 - 2195 - messageValue, messageValueErr := messageItem.Value() 2196 - if messageValueErr != nil { 2197 - return messageValueErr 2198 - } 2199 - msg := fmt.Sprintf("%s", messageValue) 2200 - 2201 - timestampItem, timestampErr := txn.Get([]byte(strings.Replace(stringKey, "|id", "|timestamp", -1))) 2202 - if timestampErr != nil { 2203 - return errors.WithMessage(timestampErr, "Key: "+strings.Replace(stringKey, "|id", "|timestamp", -1)) 2204 - } 2205 - 2206 - timestampValue, timestampValueErr := timestampItem.Value() 2207 - if timestampValueErr != nil { 2208 - return timestampValueErr 2209 - } 2210 - timestamp := fmt.Sprintf("%s", timestampValue) 2211 - timestampInt, ConvErr := strconv.ParseInt(timestamp, 10, 64) 2212 - if ConvErr != nil { 2213 - return ConvErr 2214 - } 2215 - 2216 - m.MessageListLayout.TriggerMessage(msg, sender, timestampInt) 2217 - } 2218 - } 2219 + idValue := fmt.Sprintf("%s", value) 2220 2221 - if strings.HasSuffix(stringKey, "|sender") { 2222 - idItem, idErr := txn.Get([]byte(strings.Replace(stringKey, "|sender", "|id", -1))) 2223 - if idErr != nil { 2224 - return errors.WithMessage(idErr, "Key: "+strings.Replace(stringKey, "|sender", "|id", -1)) 2225 - } 2226 - idValue, idValueErr := idItem.Value() 2227 - if idValueErr != nil { 2228 - return idValueErr 2229 - } 2230 - id := fmt.Sprintf("%s", idValue) 2231 - 2232 - if !contains(doneMsg, id) { 2233 - // Remember we already added this message to the view 2234 - doneMsg = append(doneMsg, id) 2235 - 2236 - // Get all Data 2237 - sender := stringValue 2238 - 2239 - messageItem, messageErr := txn.Get([]byte(strings.Replace(stringKey, "|sender", "|messageString", -1))) 2240 - if messageErr != nil { 2241 - return errors.WithMessage(messageErr, "Key: "+strings.Replace(stringKey, "|sender", "|messageString", -1)) 2242 - } 2243 + if !contains(doneMsg, idValue) { 2244 + // Remember we already added this message to the view 2245 + doneMsg = append(doneMsg, idValue) 2246 2247 - messageValue, messageValueErr := messageItem.Value() 2248 - if messageValueErr != nil { 2249 - return messageValueErr 2250 - } 2251 - msg := fmt.Sprintf("%s", messageValue) 2252 - 2253 - timestampItem, timestampErr := txn.Get([]byte(strings.Replace(stringKey, "|sender", "|timestamp", -1))) 2254 - if timestampErr != nil { 2255 - return errors.WithMessage(timestampErr, "Key: "+strings.Replace(stringKey, "|sender", "|timestamp", -1)) 2256 - } 2257 - 2258 - timestampValue, timestampValueErr := timestampItem.Value() 2259 - if timestampValueErr != nil { 2260 - return timestampValueErr 2261 - } 2262 - timestamp := fmt.Sprintf("%s", timestampValue) 2263 - 2264 - timestampInt, ConvErr := strconv.ParseInt(timestamp, 10, 64) 2265 - if ConvErr != nil { 2266 - return ConvErr 2267 - } 2268 - 2269 - m.MessageListLayout.TriggerMessage(msg, sender, timestampInt) 2270 - } 2271 - } 2272 - 2273 - if strings.HasSuffix(stringKey, "|messageString") { 2274 - idItem, idErr := txn.Get([]byte(strings.Replace(stringKey, "|messageString", "|id", -1))) 2275 - if idErr != nil { 2276 - return errors.WithMessage(idErr, "Key: "+strings.Replace(stringKey, "|messageString", "|id", -1)) 2277 + // Get all Data 2278 + senderResult, QueryErr := db.Get(txn, []byte(strings.Replace(stringKey, "|id", "|sender", -1))) 2279 + if QueryErr != nil { 2280 + return errors.WithMessage(QueryErr, "Key: "+strings.Replace(stringKey, "|id", "|sender", -1)) 2281 } 2282 + sender := fmt.Sprintf("%s", senderResult) 2283 2284 - idValue, idValueErr := idItem.Value() 2285 - if idValueErr != nil { 2286 - return idValueErr 2287 + msgResult, QueryErr := db.Get(txn, []byte(strings.Replace(stringKey, "|id", "|messageString", -1))) 2288 + if QueryErr != nil { 2289 + return errors.WithMessage(QueryErr, "Key: "+strings.Replace(stringKey, "|id", "|messageString", -1)) 2290 } 2291 - id := fmt.Sprintf("%s", idValue) 2292 - 2293 - if !contains(doneMsg, id) { 2294 - // Remember we already added this message to the view 2295 - doneMsg = append(doneMsg, id) 2296 - 2297 - // Get all Data 2298 - senderItem, senderErr := txn.Get([]byte(strings.Replace(stringKey, "|messageString", "|sender", -1))) 2299 - if senderErr != nil { 2300 - return errors.WithMessage(senderErr, "Key: "+strings.Replace(stringKey, "|messageString", "|sender", -1)) 2301 - } 2302 - 2303 - senderValue, senderValueErr := senderItem.Value() 2304 - if senderValueErr != nil { 2305 - return senderValueErr 2306 - } 2307 - sender := fmt.Sprintf("%s", senderValue) 2308 - 2309 - msg := stringValue 2310 - 2311 - timestampItem, timestampErr := txn.Get([]byte(strings.Replace(stringKey, "|messageString", "|timestamp", -1))) 2312 - if timestampErr != nil { 2313 - return errors.WithMessage(timestampErr, "Key: "+strings.Replace(stringKey, "|messageString", "|timestamp", -1)) 2314 - } 2315 - 2316 - timestampValue, timestampValueErr := timestampItem.Value() 2317 - if timestampValueErr != nil { 2318 - return timestampValueErr 2319 - } 2320 - timestamp := fmt.Sprintf("%s", timestampValue) 2321 + msg := fmt.Sprintf("%s", msgResult) 2322 2323 - timestampInt, ConvErr := strconv.ParseInt(timestamp, 10, 64) 2324 - if ConvErr != nil { 2325 - return ConvErr 2326 - } 2327 - 2328 - m.MessageListLayout.TriggerMessage(msg, sender, timestampInt) 2329 + timestampResult, QueryErr := db.Get(txn, []byte(strings.Replace(stringKey, "|id", "|timestamp", -1))) 2330 + if QueryErr != nil { 2331 + return errors.WithMessage(QueryErr, "Key: "+strings.Replace(stringKey, "|id", "|timestamp", -1)) 2332 } 2333 - } 2334 + timestamp := fmt.Sprintf("%s", timestampResult) 2335 2336 - if strings.HasSuffix(stringKey, "|timestamp") { 2337 - idItem, idErr := txn.Get([]byte(strings.Replace(stringKey, "|timestamp", "|id", -1))) 2338 - if idErr != nil { 2339 - return errors.WithMessage(idErr, "Key: "+strings.Replace(stringKey, "|timestamp", "|id", -1)) 2340 + timestampInt, ConvErr := strconv.ParseInt(timestamp, 10, 64) 2341 + if ConvErr != nil { 2342 + return errors.WithMessage(ConvErr, "Timestamp String: "+timestamp) 2343 } 2344 - idValue, idValueErr := idItem.Value() 2345 - if idValueErr != nil { 2346 - return idValueErr 2347 - } 2348 - id := fmt.Sprintf("%s", idValue) 2349 - 2350 - if !contains(doneMsg, id) { 2351 - // Remember we already added this message to the view 2352 - doneMsg = append(doneMsg, id) 2353 2354 - // Get all Data 2355 - senderItem, senderErr := txn.Get([]byte(strings.Replace(stringKey, "|timestamp", "|sender", -1))) 2356 - if senderErr != nil { 2357 - return errors.WithMessage(senderErr, "Key: "+strings.Replace(stringKey, "|timestamp", "|sender", -1)) 2358 - } 2359 - senderValue, senderValueErr := senderItem.Value() 2360 - if senderValueErr != nil { 2361 - return senderValueErr 2362 - } 2363 - sender := fmt.Sprintf("%s", senderValue) 2364 - 2365 - messageItem, messageErr := txn.Get([]byte(strings.Replace(stringKey, "|timestamp", "|messageString", -1))) 2366 - if messageErr != nil { 2367 - return errors.WithMessage(messageErr, "Key: "+strings.Replace(stringKey, "|timestamp", "|messageString", -1)) 2368 - } 2369 - messageValue, messageValueErr := messageItem.Value() 2370 - if messageValueErr != nil { 2371 - return messageValueErr 2372 - } 2373 - msg := fmt.Sprintf("%s", messageValue) 2374 - 2375 - timestamp := stringValue 2376 - 2377 - timestampInt, ConvErr := strconv.ParseInt(timestamp, 10, 64) 2378 - if ConvErr != nil { 2379 - return ConvErr 2380 - } 2381 - 2382 - m.MessageListLayout.TriggerMessage(msg, sender, timestampInt) 2383 - } 2384 + go m.MessageListLayout.TriggerMessage(msg, sender, timestampInt) 2385 } 2386 } 2387 2388 @@ -623,6 +493,7 @@ func (m *MainUI) loadCache() (err error) { 2389 } 2390 2391 if barAtBottom { 2392 + bar.Update() 2393 bar.SetValue(bar.Maximum()) 2394 } 2395 2396 diff --git a/ui/messageList.go b/ui/listLayouts/messageList.go 2397 similarity index 80% 2398 rename from ui/messageList.go 2399 rename to ui/listLayouts/messageList.go 2400 index e5a3c6c..90a6a6b 100644 2401 --- a/ui/messageList.go 2402 +++ b/ui/listLayouts/messageList.go 2403 @@ -1,4 +1,4 @@ 2404 -package ui 2405 +package listLayouts 2406 2407 import ( 2408 "time" 2409 @@ -6,7 +6,9 @@ import ( 2410 "github.com/Nordgedanken/Morpheus/matrix" 2411 "github.com/matrix-org/gomatrix" 2412 "github.com/rhinoman/go-commonmark" 2413 + log "github.com/sirupsen/logrus" 2414 "github.com/therecipe/qt/core" 2415 + "github.com/therecipe/qt/gui" 2416 "github.com/therecipe/qt/uitools" 2417 "github.com/therecipe/qt/widgets" 2418 ) 2419 @@ -26,17 +28,17 @@ import ( 2420 type QVBoxLayoutWithTriggerSlot struct { 2421 widgets.QVBoxLayout 2422 2423 - _ func(messageBody, sender string, timestamp int64) `slot:"TriggerMessage"` 2424 + _ func(messageBody, sender string, timestamp int64) `signal:"TriggerMessage"` 2425 } 2426 2427 // NewMessageList generates a new QVBoxLayoutWithTriggerSlot and adds it to the message scrollArea 2428 -func NewMessageList(scrollArea *widgets.QScrollArea, messageView *widgets.QWidget) (messageViewLayout *QVBoxLayoutWithTriggerSlot) { 2429 - messageViewLayout = NewQVBoxLayoutWithTriggerSlot2(messageView) 2430 +func NewMessageList(scrollArea *widgets.QScrollArea) (messageViewLayout *QVBoxLayoutWithTriggerSlot) { 2431 + messageViewLayout = NewQVBoxLayoutWithTriggerSlot2(scrollArea.Widget()) 2432 2433 messageViewLayout.SetSpacing(0) 2434 - messageViewLayout.SetContentsMargins(0, 0, 0, 0) 2435 - messageView.SetContentsMargins(0, 0, 0, 0) 2436 - scrollArea.SetWidget(messageView) 2437 + messageViewLayout.AddStretch(1) 2438 + messageViewLayout.SetContentsMargins(15, 0, 15, 15) 2439 + scrollArea.Widget().SetContentsMargins(0, 0, 0, 0) 2440 scrollArea.SetAlignment(core.Qt__AlignLeading | core.Qt__AlignLeft | core.Qt__AlignVCenter) 2441 scrollArea.Widget().SetLayout(messageViewLayout) 2442 2443 @@ -44,7 +46,7 @@ func NewMessageList(scrollArea *widgets.QScrollArea, messageView *widgets.QWidge 2444 } 2445 2446 // NewMessage adds a new message object to the view 2447 -func (messageViewLayout *QVBoxLayoutWithTriggerSlot) NewMessage(body string, cli *gomatrix.Client, sender string, timestamp int64, scrollArea *widgets.QScrollArea, own bool, mainUIStruct *MainUI) (err error) { 2448 +func (messageViewLayout *QVBoxLayoutWithTriggerSlot) NewMessage(body string, cli *gomatrix.Client, sender string, timestamp int64, scrollArea *widgets.QScrollArea, own bool) (err error) { 2449 barAtBottom := false 2450 bar := scrollArea.VerticalScrollBar() 2451 if bar.Value() == bar.Maximum() { 2452 @@ -94,6 +96,21 @@ func (messageViewLayout *QVBoxLayoutWithTriggerSlot) NewMessage(body string, cli 2453 } 2454 senderContent.SetText(senderDisplayName) 2455 timestampContent.SetText(timestampString) 2456 + 2457 + avatarNew := gui.NewQPixmap() 2458 + avatarLogo.ConnectPaintEvent(func(event *gui.QPaintEvent) { 2459 + log.Println("PaintEventAvatar") 2460 + painter := gui.NewQPainter2(avatarLogo) 2461 + 2462 + aWidth := 61 / 2 2463 + aHeight := 61 / 2 2464 + 2465 + painter.DrawEllipse3(aWidth, aHeight, 61.0, 61.0) 2466 + painter.DrawPixmap2(avatarLogo.Rect(), avatarNew, avatar.Rect()) 2467 + //avatarLogo.Update() 2468 + avatarLogo.SetPixmap(avatarNew) 2469 + }) 2470 + 2471 avatarLogo.SetPixmap(avatar) 2472 2473 var lineLength int 2474 diff --git a/ui/listLayouts/moc.cpp b/ui/listLayouts/moc.cpp 2475 new file mode 100644 2476 index 0000000..72b0ed7 2477 --- /dev/null 2478 +++ b/ui/listLayouts/moc.cpp 2479 @@ -0,0 +1,706 @@ 2480 + 2481 + 2482 +#define protected public 2483 +#define private public 2484 + 2485 +#include "moc.h" 2486 +#include "_cgo_export.h" 2487 + 2488 +#include <QByteArray> 2489 +#include <QChildEvent> 2490 +#include <QEvent> 2491 +#include <QLayout> 2492 +#include <QLayoutItem> 2493 +#include <QList> 2494 +#include <QMetaMethod> 2495 +#include <QObject> 2496 +#include <QRect> 2497 +#include <QSize> 2498 +#include <QSizePolicy> 2499 +#include <QSpacerItem> 2500 +#include <QString> 2501 +#include <QTime> 2502 +#include <QTimer> 2503 +#include <QTimerEvent> 2504 +#include <QVBoxLayout> 2505 +#include <QWidget> 2506 + 2507 + 2508 +class QRoomVBoxLayoutWithTriggerSlot: public QVBoxLayout 2509 +{ 2510 +Q_OBJECT 2511 +public: 2512 + QRoomVBoxLayoutWithTriggerSlot() : QVBoxLayout() {qRegisterMetaType<quintptr>("quintptr");QRoomVBoxLayoutWithTriggerSlot_QRoomVBoxLayoutWithTriggerSlot_QRegisterMetaType();QRoomVBoxLayoutWithTriggerSlot_QRoomVBoxLayoutWithTriggerSlot_QRegisterMetaTypes();callbackQRoomVBoxLayoutWithTriggerSlot_Constructor(this);}; 2513 + QRoomVBoxLayoutWithTriggerSlot(QWidget *parent) : QVBoxLayout(parent) {qRegisterMetaType<quintptr>("quintptr");QRoomVBoxLayoutWithTriggerSlot_QRoomVBoxLayoutWithTriggerSlot_QRegisterMetaType();QRoomVBoxLayoutWithTriggerSlot_QRoomVBoxLayoutWithTriggerSlot_QRegisterMetaTypes();callbackQRoomVBoxLayoutWithTriggerSlot_Constructor(this);}; 2514 + void Signal_TriggerRoom(QString roomID) { QByteArray tdf131c = roomID.toUtf8(); Moc_PackedString roomIDPacked = { const_cast<char*>(tdf131c.prepend("WHITESPACE").constData()+10), tdf131c.size()-10 };callbackQRoomVBoxLayoutWithTriggerSlot_TriggerRoom(this, roomIDPacked); }; 2515 + void Signal_ChangeRoom(QString roomID) { QByteArray tdf131c = roomID.toUtf8(); Moc_PackedString roomIDPacked = { const_cast<char*>(tdf131c.prepend("WHITESPACE").constData()+10), tdf131c.size()-10 };callbackQRoomVBoxLayoutWithTriggerSlot_ChangeRoom(this, roomIDPacked); }; 2516 + QLayoutItem * takeAt(int index) { return static_cast<QLayoutItem*>(callbackQRoomVBoxLayoutWithTriggerSlot_TakeAt(this, index)); }; 2517 + void addItem(QLayoutItem * item) { callbackQRoomVBoxLayoutWithTriggerSlot_AddItem(this, item); }; 2518 + void invalidate() { callbackQRoomVBoxLayoutWithTriggerSlot_Invalidate(this); }; 2519 + void setGeometry(const QRect & r) { callbackQRoomVBoxLayoutWithTriggerSlot_SetGeometry(this, const_cast<QRect*>(&r)); }; 2520 + QLayoutItem * itemAt(int index) const { return static_cast<QLayoutItem*>(callbackQRoomVBoxLayoutWithTriggerSlot_ItemAt(const_cast<void*>(static_cast<const void*>(this)), index)); }; 2521 + QSize maximumSize() const { return *static_cast<QSize*>(callbackQRoomVBoxLayoutWithTriggerSlot_MaximumSize(const_cast<void*>(static_cast<const void*>(this)))); }; 2522 + QSize minimumSize() const { return *static_cast<QSize*>(callbackQRoomVBoxLayoutWithTriggerSlot_MinimumSize(const_cast<void*>(static_cast<const void*>(this)))); }; 2523 + QSize sizeHint() const { return *static_cast<QSize*>(callbackQRoomVBoxLayoutWithTriggerSlot_SizeHint(const_cast<void*>(static_cast<const void*>(this)))); }; 2524 + Qt::Orientations expandingDirections() const { return static_cast<Qt::Orientation>(callbackQRoomVBoxLayoutWithTriggerSlot_ExpandingDirections(const_cast<void*>(static_cast<const void*>(this)))); }; 2525 + bool hasHeightForWidth() const { return callbackQRoomVBoxLayoutWithTriggerSlot_HasHeightForWidth(const_cast<void*>(static_cast<const void*>(this))) != 0; }; 2526 + int count() const { return callbackQRoomVBoxLayoutWithTriggerSlot_Count(const_cast<void*>(static_cast<const void*>(this))); }; 2527 + int heightForWidth(int w) const { return callbackQRoomVBoxLayoutWithTriggerSlot_HeightForWidth(const_cast<void*>(static_cast<const void*>(this)), w); }; 2528 + int minimumHeightForWidth(int w) const { return callbackQRoomVBoxLayoutWithTriggerSlot_MinimumHeightForWidth(const_cast<void*>(static_cast<const void*>(this)), w); }; 2529 + QLayout * layout() { return static_cast<QLayout*>(callbackQRoomVBoxLayoutWithTriggerSlot_Layout(this)); }; 2530 + void childEvent(QChildEvent * e) { callbackQRoomVBoxLayoutWithTriggerSlot_ChildEvent(this, e); }; 2531 + QRect geometry() const { return *static_cast<QRect*>(callbackQRoomVBoxLayoutWithTriggerSlot_Geometry(const_cast<void*>(static_cast<const void*>(this)))); }; 2532 + QSizePolicy::ControlTypes controlTypes() const { return static_cast<QSizePolicy::ControlType>(callbackQRoomVBoxLayoutWithTriggerSlot_ControlTypes(const_cast<void*>(static_cast<const void*>(this)))); }; 2533 + bool isEmpty() const { return callbackQRoomVBoxLayoutWithTriggerSlot_IsEmpty(const_cast<void*>(static_cast<const void*>(this))) != 0; }; 2534 + int indexOf(QWidget * widget) const { return callbackQRoomVBoxLayoutWithTriggerSlot_IndexOf(const_cast<void*>(static_cast<const void*>(this)), widget); }; 2535 + bool event(QEvent * e) { return callbackQRoomVBoxLayoutWithTriggerSlot_Event(this, e) != 0; }; 2536 + bool eventFilter(QObject * watched, QEvent * event) { return callbackQRoomVBoxLayoutWithTriggerSlot_EventFilter(this, watched, event) != 0; }; 2537 + void connectNotify(const QMetaMethod & sign) { callbackQRoomVBoxLayoutWithTriggerSlot_ConnectNotify(this, const_cast<QMetaMethod*>(&sign)); }; 2538 + void customEvent(QEvent * event) { callbackQRoomVBoxLayoutWithTriggerSlot_CustomEvent(this, event); }; 2539 + void deleteLater() { callbackQRoomVBoxLayoutWithTriggerSlot_DeleteLater(this); }; 2540 + void Signal_Destroyed(QObject * obj) { callbackQRoomVBoxLayoutWithTriggerSlot_Destroyed(this, obj); }; 2541 + void disconnectNotify(const QMetaMethod & sign) { callbackQRoomVBoxLayoutWithTriggerSlot_DisconnectNotify(this, const_cast<QMetaMethod*>(&sign)); }; 2542 + void Signal_ObjectNameChanged(const QString & objectName) { QByteArray taa2c4f = objectName.toUtf8(); Moc_PackedString objectNamePacked = { const_cast<char*>(taa2c4f.prepend("WHITESPACE").constData()+10), taa2c4f.size()-10 };callbackQRoomVBoxLayoutWithTriggerSlot_ObjectNameChanged(this, objectNamePacked); }; 2543 + void timerEvent(QTimerEvent * event) { callbackQRoomVBoxLayoutWithTriggerSlot_TimerEvent(this, event); }; 2544 + 2545 + QSpacerItem * spacerItem() { return static_cast<QSpacerItem*>(callbackQRoomVBoxLayoutWithTriggerSlot_SpacerItem(this)); }; 2546 + QWidget * widget() { return static_cast<QWidget*>(callbackQRoomVBoxLayoutWithTriggerSlot_Widget(this)); }; 2547 +signals: 2548 + void TriggerRoom(QString roomID); 2549 + void ChangeRoom(QString roomID); 2550 +public slots: 2551 +private: 2552 +}; 2553 + 2554 +Q_DECLARE_METATYPE(QRoomVBoxLayoutWithTriggerSlot*) 2555 + 2556 + 2557 +void QRoomVBoxLayoutWithTriggerSlot_QRoomVBoxLayoutWithTriggerSlot_QRegisterMetaTypes() { 2558 +} 2559 + 2560 +class QVBoxLayoutWithTriggerSlot: public QVBoxLayout 2561 +{ 2562 +Q_OBJECT 2563 +public: 2564 + QVBoxLayoutWithTriggerSlot() : QVBoxLayout() {qRegisterMetaType<quintptr>("quintptr");QVBoxLayoutWithTriggerSlot_QVBoxLayoutWithTriggerSlot_QRegisterMetaType();QVBoxLayoutWithTriggerSlot_QVBoxLayoutWithTriggerSlot_QRegisterMetaTypes();callbackQVBoxLayoutWithTriggerSlot_Constructor(this);}; 2565 + QVBoxLayoutWithTriggerSlot(QWidget *parent) : QVBoxLayout(parent) {qRegisterMetaType<quintptr>("quintptr");QVBoxLayoutWithTriggerSlot_QVBoxLayoutWithTriggerSlot_QRegisterMetaType();QVBoxLayoutWithTriggerSlot_QVBoxLayoutWithTriggerSlot_QRegisterMetaTypes();callbackQVBoxLayoutWithTriggerSlot_Constructor(this);}; 2566 + void Signal_TriggerMessage(QString messageBody, QString sender, qint64 timestamp) { QByteArray t59bf16 = messageBody.toUtf8(); Moc_PackedString messageBodyPacked = { const_cast<char*>(t59bf16.prepend("WHITESPACE").constData()+10), t59bf16.size()-10 };QByteArray tacc6a3 = sender.toUtf8(); Moc_PackedString senderPacked = { const_cast<char*>(tacc6a3.prepend("WHITESPACE").constData()+10), tacc6a3.size()-10 };callbackQVBoxLayoutWithTriggerSlot_TriggerMessage(this, messageBodyPacked, senderPacked, timestamp); }; 2567 + QLayoutItem * takeAt(int index) { return static_cast<QLayoutItem*>(callbackQVBoxLayoutWithTriggerSlot_TakeAt(this, index)); }; 2568 + void addItem(QLayoutItem * item) { callbackQVBoxLayoutWithTriggerSlot_AddItem(this, item); }; 2569 + void invalidate() { callbackQVBoxLayoutWithTriggerSlot_Invalidate(this); }; 2570 + void setGeometry(const QRect & r) { callbackQVBoxLayoutWithTriggerSlot_SetGeometry(this, const_cast<QRect*>(&r)); }; 2571 + QLayoutItem * itemAt(int index) const { return static_cast<QLayoutItem*>(callbackQVBoxLayoutWithTriggerSlot_ItemAt(const_cast<void*>(static_cast<const void*>(this)), index)); }; 2572 + QSize maximumSize() const { return *static_cast<QSize*>(callbackQVBoxLayoutWithTriggerSlot_MaximumSize(const_cast<void*>(static_cast<const void*>(this)))); }; 2573 + QSize minimumSize() const { return *static_cast<QSize*>(callbackQVBoxLayoutWithTriggerSlot_MinimumSize(const_cast<void*>(static_cast<const void*>(this)))); }; 2574 + QSize sizeHint() const { return *static_cast<QSize*>(callbackQVBoxLayoutWithTriggerSlot_SizeHint(const_cast<void*>(static_cast<const void*>(this)))); }; 2575 + Qt::Orientations expandingDirections() const { return static_cast<Qt::Orientation>(callbackQVBoxLayoutWithTriggerSlot_ExpandingDirections(const_cast<void*>(static_cast<const void*>(this)))); }; 2576 + bool hasHeightForWidth() const { return callbackQVBoxLayoutWithTriggerSlot_HasHeightForWidth(const_cast<void*>(static_cast<const void*>(this))) != 0; }; 2577 + int count() const { return callbackQVBoxLayoutWithTriggerSlot_Count(const_cast<void*>(static_cast<const void*>(this))); }; 2578 + int heightForWidth(int w) const { return callbackQVBoxLayoutWithTriggerSlot_HeightForWidth(const_cast<void*>(static_cast<const void*>(this)), w); }; 2579 + int minimumHeightForWidth(int w) const { return callbackQVBoxLayoutWithTriggerSlot_MinimumHeightForWidth(const_cast<void*>(static_cast<const void*>(this)), w); }; 2580 + QLayout * layout() { return static_cast<QLayout*>(callbackQVBoxLayoutWithTriggerSlot_Layout(this)); }; 2581 + void childEvent(QChildEvent * e) { callbackQVBoxLayoutWithTriggerSlot_ChildEvent(this, e); }; 2582 + QRect geometry() const { return *static_cast<QRect*>(callbackQVBoxLayoutWithTriggerSlot_Geometry(const_cast<void*>(static_cast<const void*>(this)))); }; 2583 + QSizePolicy::ControlTypes controlTypes() const { return static_cast<QSizePolicy::ControlType>(callbackQVBoxLayoutWithTriggerSlot_ControlTypes(const_cast<void*>(static_cast<const void*>(this)))); }; 2584 + bool isEmpty() const { return callbackQVBoxLayoutWithTriggerSlot_IsEmpty(const_cast<void*>(static_cast<const void*>(this))) != 0; }; 2585 + int indexOf(QWidget * widget) const { return callbackQVBoxLayoutWithTriggerSlot_IndexOf(const_cast<void*>(static_cast<const void*>(this)), widget); }; 2586 + bool event(QEvent * e) { return callbackQVBoxLayoutWithTriggerSlot_Event(this, e) != 0; }; 2587 + bool eventFilter(QObject * watched, QEvent * event) { return callbackQVBoxLayoutWithTriggerSlot_EventFilter(this, watched, event) != 0; }; 2588 + void connectNotify(const QMetaMethod & sign) { callbackQVBoxLayoutWithTriggerSlot_ConnectNotify(this, const_cast<QMetaMethod*>(&sign)); }; 2589 + void customEvent(QEvent * event) { callbackQVBoxLayoutWithTriggerSlot_CustomEvent(this, event); }; 2590 + void deleteLater() { callbackQVBoxLayoutWithTriggerSlot_DeleteLater(this); }; 2591 + void Signal_Destroyed(QObject * obj) { callbackQVBoxLayoutWithTriggerSlot_Destroyed(this, obj); }; 2592 + void disconnectNotify(const QMetaMethod & sign) { callbackQVBoxLayoutWithTriggerSlot_DisconnectNotify(this, const_cast<QMetaMethod*>(&sign)); }; 2593 + void Signal_ObjectNameChanged(const QString & objectName) { QByteArray taa2c4f = objectName.toUtf8(); Moc_PackedString objectNamePacked = { const_cast<char*>(taa2c4f.prepend("WHITESPACE").constData()+10), taa2c4f.size()-10 };callbackQVBoxLayoutWithTriggerSlot_ObjectNameChanged(this, objectNamePacked); }; 2594 + void timerEvent(QTimerEvent * event) { callbackQVBoxLayoutWithTriggerSlot_TimerEvent(this, event); }; 2595 + 2596 + QSpacerItem * spacerItem() { return static_cast<QSpacerItem*>(callbackQVBoxLayoutWithTriggerSlot_SpacerItem(this)); }; 2597 + QWidget * widget() { return static_cast<QWidget*>(callbackQVBoxLayoutWithTriggerSlot_Widget(this)); }; 2598 +signals: 2599 + void TriggerMessage(QString messageBody, QString sender, qint64 timestamp); 2600 +public slots: 2601 +private: 2602 +}; 2603 + 2604 +Q_DECLARE_METATYPE(QVBoxLayoutWithTriggerSlot*) 2605 + 2606 + 2607 +void QVBoxLayoutWithTriggerSlot_QVBoxLayoutWithTriggerSlot_QRegisterMetaTypes() { 2608 +} 2609 + 2610 +void QRoomVBoxLayoutWithTriggerSlot_ConnectTriggerRoom(void* ptr) 2611 +{ 2612 + QObject::connect(static_cast<QRoomVBoxLayoutWithTriggerSlot*>(ptr), static_cast<void (QRoomVBoxLayoutWithTriggerSlot::*)(QString)>(&QRoomVBoxLayoutWithTriggerSlot::TriggerRoom), static_cast<QRoomVBoxLayoutWithTriggerSlot*>(ptr), static_cast<void (QRoomVBoxLayoutWithTriggerSlot::*)(QString)>(&QRoomVBoxLayoutWithTriggerSlot::Signal_TriggerRoom)); 2613 +} 2614 + 2615 +void QRoomVBoxLayoutWithTriggerSlot_DisconnectTriggerRoom(void* ptr) 2616 +{ 2617 + QObject::disconnect(static_cast<QRoomVBoxLayoutWithTriggerSlot*>(ptr), static_cast<void (QRoomVBoxLayoutWithTriggerSlot::*)(QString)>(&QRoomVBoxLayoutWithTriggerSlot::TriggerRoom), static_cast<QRoomVBoxLayoutWithTriggerSlot*>(ptr), static_cast<void (QRoomVBoxLayoutWithTriggerSlot::*)(QString)>(&QRoomVBoxLayoutWithTriggerSlot::Signal_TriggerRoom)); 2618 +} 2619 + 2620 +void QRoomVBoxLayoutWithTriggerSlot_TriggerRoom(void* ptr, struct Moc_PackedString roomID) 2621 +{ 2622 + static_cast<QRoomVBoxLayoutWithTriggerSlot*>(ptr)->TriggerRoom(QString::fromUtf8(roomID.data, roomID.len)); 2623 +} 2624 + 2625 +void QRoomVBoxLayoutWithTriggerSlot_ConnectChangeRoom(void* ptr) 2626 +{ 2627 + QObject::connect(static_cast<QRoomVBoxLayoutWithTriggerSlot*>(ptr), static_cast<void (QRoomVBoxLayoutWithTriggerSlot::*)(QString)>(&QRoomVBoxLayoutWithTriggerSlot::ChangeRoom), static_cast<QRoomVBoxLayoutWithTriggerSlot*>(ptr), static_cast<void (QRoomVBoxLayoutWithTriggerSlot::*)(QString)>(&QRoomVBoxLayoutWithTriggerSlot::Signal_ChangeRoom)); 2628 +} 2629 + 2630 +void QRoomVBoxLayoutWithTriggerSlot_DisconnectChangeRoom(void* ptr) 2631 +{ 2632 + QObject::disconnect(static_cast<QRoomVBoxLayoutWithTriggerSlot*>(ptr), static_cast<void (QRoomVBoxLayoutWithTriggerSlot::*)(QString)>(&QRoomVBoxLayoutWithTriggerSlot::ChangeRoom), static_cast<QRoomVBoxLayoutWithTriggerSlot*>(ptr), static_cast<void (QRoomVBoxLayoutWithTriggerSlot::*)(QString)>(&QRoomVBoxLayoutWithTriggerSlot::Signal_ChangeRoom)); 2633 +} 2634 + 2635 +void QRoomVBoxLayoutWithTriggerSlot_ChangeRoom(void* ptr, struct Moc_PackedString roomID) 2636 +{ 2637 + static_cast<QRoomVBoxLayoutWithTriggerSlot*>(ptr)->ChangeRoom(QString::fromUtf8(roomID.data, roomID.len)); 2638 +} 2639 + 2640 +int QRoomVBoxLayoutWithTriggerSlot_QRoomVBoxLayoutWithTriggerSlot_QRegisterMetaType() 2641 +{ 2642 + return qRegisterMetaType<QRoomVBoxLayoutWithTriggerSlot*>(); 2643 +} 2644 + 2645 +int QRoomVBoxLayoutWithTriggerSlot_QRoomVBoxLayoutWithTriggerSlot_QRegisterMetaType2(char* typeName) 2646 +{ 2647 + return qRegisterMetaType<QRoomVBoxLayoutWithTriggerSlot*>(const_cast<const char*>(typeName)); 2648 +} 2649 + 2650 +int QRoomVBoxLayoutWithTriggerSlot_QRoomVBoxLayoutWithTriggerSlot_QmlRegisterType() 2651 +{ 2652 +#ifdef QT_QML_LIB 2653 + return qmlRegisterType<QRoomVBoxLayoutWithTriggerSlot>(); 2654 +#else 2655 + return 0; 2656 +#endif 2657 +} 2658 + 2659 +int QRoomVBoxLayoutWithTriggerSlot_QRoomVBoxLayoutWithTriggerSlot_QmlRegisterType2(char* uri, int versionMajor, int versionMinor, char* qmlName) 2660 +{ 2661 +#ifdef QT_QML_LIB 2662 + return qmlRegisterType<QRoomVBoxLayoutWithTriggerSlot>(const_cast<const char*>(uri), versionMajor, versionMinor, const_cast<const char*>(qmlName)); 2663 +#else 2664 + return 0; 2665 +#endif 2666 +} 2667 + 2668 +void* QRoomVBoxLayoutWithTriggerSlot___dynamicPropertyNames_atList(void* ptr, int i) 2669 +{ 2670 + return new QByteArray(static_cast<QList<QByteArray>*>(ptr)->at(i)); 2671 +} 2672 + 2673 +void QRoomVBoxLayoutWithTriggerSlot___dynamicPropertyNames_setList(void* ptr, void* i) 2674 +{ 2675 + static_cast<QList<QByteArray>*>(ptr)->append(*static_cast<QByteArray*>(i)); 2676 +} 2677 + 2678 +void* QRoomVBoxLayoutWithTriggerSlot___dynamicPropertyNames_newList(void* ptr) 2679 +{ 2680 + Q_UNUSED(ptr); 2681 + return new QList<QByteArray>; 2682 +} 2683 + 2684 +void* QRoomVBoxLayoutWithTriggerSlot___findChildren_atList2(void* ptr, int i) 2685 +{ 2686 + return const_cast<QObject*>(static_cast<QList<QObject*>*>(ptr)->at(i)); 2687 +} 2688 + 2689 +void QRoomVBoxLayoutWithTriggerSlot___findChildren_setList2(void* ptr, void* i) 2690 +{ 2691 + static_cast<QList<QObject*>*>(ptr)->append(static_cast<QObject*>(i)); 2692 +} 2693 + 2694 +void* QRoomVBoxLayoutWithTriggerSlot___findChildren_newList2(void* ptr) 2695 +{ 2696 + Q_UNUSED(ptr); 2697 + return new QList<QObject*>; 2698 +} 2699 + 2700 +void* QRoomVBoxLayoutWithTriggerSlot___findChildren_atList3(void* ptr, int i) 2701 +{ 2702 + return const_cast<QObject*>(static_cast<QList<QObject*>*>(ptr)->at(i)); 2703 +} 2704 + 2705 +void QRoomVBoxLayoutWithTriggerSlot___findChildren_setList3(void* ptr, void* i) 2706 +{ 2707 + static_cast<QList<QObject*>*>(ptr)->append(static_cast<QObject*>(i)); 2708 +} 2709 + 2710 +void* QRoomVBoxLayoutWithTriggerSlot___findChildren_newList3(void* ptr) 2711 +{ 2712 + Q_UNUSED(ptr); 2713 + return new QList<QObject*>; 2714 +} 2715 + 2716 +void* QRoomVBoxLayoutWithTriggerSlot___findChildren_atList(void* ptr, int i) 2717 +{ 2718 + return const_cast<QObject*>(static_cast<QList<QObject*>*>(ptr)->at(i)); 2719 +} 2720 + 2721 +void QRoomVBoxLayoutWithTriggerSlot___findChildren_setList(void* ptr, void* i) 2722 +{ 2723 + static_cast<QList<QObject*>*>(ptr)->append(static_cast<QObject*>(i)); 2724 +} 2725 + 2726 +void* QRoomVBoxLayoutWithTriggerSlot___findChildren_newList(void* ptr) 2727 +{ 2728 + Q_UNUSED(ptr); 2729 + return new QList<QObject*>; 2730 +} 2731 + 2732 +void* QRoomVBoxLayoutWithTriggerSlot___children_atList(void* ptr, int i) 2733 +{ 2734 + return const_cast<QObject*>(static_cast<QList<QObject *>*>(ptr)->at(i)); 2735 +} 2736 + 2737 +void QRoomVBoxLayoutWithTriggerSlot___children_setList(void* ptr, void* i) 2738 +{ 2739 + static_cast<QList<QObject *>*>(ptr)->append(static_cast<QObject*>(i)); 2740 +} 2741 + 2742 +void* QRoomVBoxLayoutWithTriggerSlot___children_newList(void* ptr) 2743 +{ 2744 + Q_UNUSED(ptr); 2745 + return new QList<QObject *>; 2746 +} 2747 + 2748 +void* QRoomVBoxLayoutWithTriggerSlot_NewQRoomVBoxLayoutWithTriggerSlot() 2749 +{ 2750 + return new QRoomVBoxLayoutWithTriggerSlot(); 2751 +} 2752 + 2753 +void* QRoomVBoxLayoutWithTriggerSlot_NewQRoomVBoxLayoutWithTriggerSlot2(void* parent) 2754 +{ 2755 + return new QRoomVBoxLayoutWithTriggerSlot(static_cast<QWidget*>(parent)); 2756 +} 2757 + 2758 +void QRoomVBoxLayoutWithTriggerSlot_DestroyQRoomVBoxLayoutWithTriggerSlot(void* ptr) 2759 +{ 2760 + static_cast<QRoomVBoxLayoutWithTriggerSlot*>(ptr)->~QRoomVBoxLayoutWithTriggerSlot(); 2761 +} 2762 + 2763 +void* QRoomVBoxLayoutWithTriggerSlot_TakeAtDefault(void* ptr, int index) 2764 +{ 2765 + return static_cast<QRoomVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::takeAt(index); 2766 +} 2767 + 2768 +void QRoomVBoxLayoutWithTriggerSlot_AddItemDefault(void* ptr, void* item) 2769 +{ 2770 + static_cast<QRoomVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::addItem(static_cast<QLayoutItem*>(item)); 2771 +} 2772 + 2773 +void QRoomVBoxLayoutWithTriggerSlot_InvalidateDefault(void* ptr) 2774 +{ 2775 + static_cast<QRoomVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::invalidate(); 2776 +} 2777 + 2778 +void QRoomVBoxLayoutWithTriggerSlot_SetGeometryDefault(void* ptr, void* r) 2779 +{ 2780 + static_cast<QRoomVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::setGeometry(*static_cast<QRect*>(r)); 2781 +} 2782 + 2783 +void* QRoomVBoxLayoutWithTriggerSlot_ItemAtDefault(void* ptr, int index) 2784 +{ 2785 + return static_cast<QRoomVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::itemAt(index); 2786 +} 2787 + 2788 +void* QRoomVBoxLayoutWithTriggerSlot_MaximumSizeDefault(void* ptr) 2789 +{ 2790 + return ({ QSize tmpValue = static_cast<QRoomVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::maximumSize(); new QSize(tmpValue.width(), tmpValue.height()); }); 2791 +} 2792 + 2793 +void* QRoomVBoxLayoutWithTriggerSlot_MinimumSizeDefault(void* ptr) 2794 +{ 2795 + return ({ QSize tmpValue = static_cast<QRoomVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::minimumSize(); new QSize(tmpValue.width(), tmpValue.height()); }); 2796 +} 2797 + 2798 +void* QRoomVBoxLayoutWithTriggerSlot_SizeHintDefault(void* ptr) 2799 +{ 2800 + return ({ QSize tmpValue = static_cast<QRoomVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::sizeHint(); new QSize(tmpValue.width(), tmpValue.height()); }); 2801 +} 2802 + 2803 +long long QRoomVBoxLayoutWithTriggerSlot_ExpandingDirectionsDefault(void* ptr) 2804 +{ 2805 + return static_cast<QRoomVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::expandingDirections(); 2806 +} 2807 + 2808 +char QRoomVBoxLayoutWithTriggerSlot_HasHeightForWidthDefault(void* ptr) 2809 +{ 2810 + return static_cast<QRoomVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::hasHeightForWidth(); 2811 +} 2812 + 2813 +int QRoomVBoxLayoutWithTriggerSlot_CountDefault(void* ptr) 2814 +{ 2815 + return static_cast<QRoomVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::count(); 2816 +} 2817 + 2818 +int QRoomVBoxLayoutWithTriggerSlot_HeightForWidthDefault(void* ptr, int w) 2819 +{ 2820 + return static_cast<QRoomVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::heightForWidth(w); 2821 +} 2822 + 2823 +int QRoomVBoxLayoutWithTriggerSlot_MinimumHeightForWidthDefault(void* ptr, int w) 2824 +{ 2825 + return static_cast<QRoomVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::minimumHeightForWidth(w); 2826 +} 2827 + 2828 +void* QRoomVBoxLayoutWithTriggerSlot_LayoutDefault(void* ptr) 2829 +{ 2830 + return static_cast<QRoomVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::layout(); 2831 +} 2832 + 2833 +void QRoomVBoxLayoutWithTriggerSlot_ChildEventDefault(void* ptr, void* e) 2834 +{ 2835 + static_cast<QRoomVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::childEvent(static_cast<QChildEvent*>(e)); 2836 +} 2837 + 2838 +void* QRoomVBoxLayoutWithTriggerSlot_GeometryDefault(void* ptr) 2839 +{ 2840 + return ({ QRect tmpValue = static_cast<QRoomVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::geometry(); new QRect(tmpValue.x(), tmpValue.y(), tmpValue.width(), tmpValue.height()); }); 2841 +} 2842 + 2843 +long long QRoomVBoxLayoutWithTriggerSlot_ControlTypesDefault(void* ptr) 2844 +{ 2845 + return static_cast<QRoomVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::controlTypes(); 2846 +} 2847 + 2848 +char QRoomVBoxLayoutWithTriggerSlot_IsEmptyDefault(void* ptr) 2849 +{ 2850 + return static_cast<QRoomVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::isEmpty(); 2851 +} 2852 + 2853 +int QRoomVBoxLayoutWithTriggerSlot_IndexOfDefault(void* ptr, void* widget) 2854 +{ 2855 + return static_cast<QRoomVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::indexOf(static_cast<QWidget*>(widget)); 2856 +} 2857 + 2858 +char QRoomVBoxLayoutWithTriggerSlot_EventDefault(void* ptr, void* e) 2859 +{ 2860 + return static_cast<QRoomVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::event(static_cast<QEvent*>(e)); 2861 +} 2862 + 2863 +char QRoomVBoxLayoutWithTriggerSlot_EventFilterDefault(void* ptr, void* watched, void* event) 2864 +{ 2865 + return static_cast<QRoomVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::eventFilter(static_cast<QObject*>(watched), static_cast<QEvent*>(event)); 2866 +} 2867 + 2868 +void QRoomVBoxLayoutWithTriggerSlot_ConnectNotifyDefault(void* ptr, void* sign) 2869 +{ 2870 + static_cast<QRoomVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::connectNotify(*static_cast<QMetaMethod*>(sign)); 2871 +} 2872 + 2873 +void QRoomVBoxLayoutWithTriggerSlot_CustomEventDefault(void* ptr, void* event) 2874 +{ 2875 + static_cast<QRoomVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::customEvent(static_cast<QEvent*>(event)); 2876 +} 2877 + 2878 +void QRoomVBoxLayoutWithTriggerSlot_DeleteLaterDefault(void* ptr) 2879 +{ 2880 + static_cast<QRoomVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::deleteLater(); 2881 +} 2882 + 2883 +void QRoomVBoxLayoutWithTriggerSlot_DisconnectNotifyDefault(void* ptr, void* sign) 2884 +{ 2885 + static_cast<QRoomVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::disconnectNotify(*static_cast<QMetaMethod*>(sign)); 2886 +} 2887 + 2888 +void QRoomVBoxLayoutWithTriggerSlot_TimerEventDefault(void* ptr, void* event) 2889 +{ 2890 + static_cast<QRoomVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::timerEvent(static_cast<QTimerEvent*>(event)); 2891 +} 2892 + 2893 + 2894 + 2895 +void* QRoomVBoxLayoutWithTriggerSlot_SpacerItemDefault(void* ptr) 2896 +{ 2897 + return static_cast<QRoomVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::spacerItem(); 2898 +} 2899 + 2900 +void* QRoomVBoxLayoutWithTriggerSlot_WidgetDefault(void* ptr) 2901 +{ 2902 + return static_cast<QRoomVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::widget(); 2903 +} 2904 + 2905 +void QVBoxLayoutWithTriggerSlot_ConnectTriggerMessage(void* ptr) 2906 +{ 2907 + QObject::connect(static_cast<QVBoxLayoutWithTriggerSlot*>(ptr), static_cast<void (QVBoxLayoutWithTriggerSlot::*)(QString, QString, qint64)>(&QVBoxLayoutWithTriggerSlot::TriggerMessage), static_cast<QVBoxLayoutWithTriggerSlot*>(ptr), static_cast<void (QVBoxLayoutWithTriggerSlot::*)(QString, QString, qint64)>(&QVBoxLayoutWithTriggerSlot::Signal_TriggerMessage)); 2908 +} 2909 + 2910 +void QVBoxLayoutWithTriggerSlot_DisconnectTriggerMessage(void* ptr) 2911 +{ 2912 + QObject::disconnect(static_cast<QVBoxLayoutWithTriggerSlot*>(ptr), static_cast<void (QVBoxLayoutWithTriggerSlot::*)(QString, QString, qint64)>(&QVBoxLayoutWithTriggerSlot::TriggerMessage), static_cast<QVBoxLayoutWithTriggerSlot*>(ptr), static_cast<void (QVBoxLayoutWithTriggerSlot::*)(QString, QString, qint64)>(&QVBoxLayoutWithTriggerSlot::Signal_TriggerMessage)); 2913 +} 2914 + 2915 +void QVBoxLayoutWithTriggerSlot_TriggerMessage(void* ptr, struct Moc_PackedString messageBody, struct Moc_PackedString sender, long long timestamp) 2916 +{ 2917 + static_cast<QVBoxLayoutWithTriggerSlot*>(ptr)->TriggerMessage(QString::fromUtf8(messageBody.data, messageBody.len), QString::fromUtf8(sender.data, sender.len), timestamp); 2918 +} 2919 + 2920 +int QVBoxLayoutWithTriggerSlot_QVBoxLayoutWithTriggerSlot_QRegisterMetaType() 2921 +{ 2922 + return qRegisterMetaType<QVBoxLayoutWithTriggerSlot*>(); 2923 +} 2924 + 2925 +int QVBoxLayoutWithTriggerSlot_QVBoxLayoutWithTriggerSlot_QRegisterMetaType2(char* typeName) 2926 +{ 2927 + return qRegisterMetaType<QVBoxLayoutWithTriggerSlot*>(const_cast<const char*>(typeName)); 2928 +} 2929 + 2930 +int QVBoxLayoutWithTriggerSlot_QVBoxLayoutWithTriggerSlot_QmlRegisterType() 2931 +{ 2932 +#ifdef QT_QML_LIB 2933 + return qmlRegisterType<QVBoxLayoutWithTriggerSlot>(); 2934 +#else 2935 + return 0; 2936 +#endif 2937 +} 2938 + 2939 +int QVBoxLayoutWithTriggerSlot_QVBoxLayoutWithTriggerSlot_QmlRegisterType2(char* uri, int versionMajor, int versionMinor, char* qmlName) 2940 +{ 2941 +#ifdef QT_QML_LIB 2942 + return qmlRegisterType<QVBoxLayoutWithTriggerSlot>(const_cast<const char*>(uri), versionMajor, versionMinor, const_cast<const char*>(qmlName)); 2943 +#else 2944 + return 0; 2945 +#endif 2946 +} 2947 + 2948 +void* QVBoxLayoutWithTriggerSlot___dynamicPropertyNames_atList(void* ptr, int i) 2949 +{ 2950 + return new QByteArray(static_cast<QList<QByteArray>*>(ptr)->at(i)); 2951 +} 2952 + 2953 +void QVBoxLayoutWithTriggerSlot___dynamicPropertyNames_setList(void* ptr, void* i) 2954 +{ 2955 + static_cast<QList<QByteArray>*>(ptr)->append(*static_cast<QByteArray*>(i)); 2956 +} 2957 + 2958 +void* QVBoxLayoutWithTriggerSlot___dynamicPropertyNames_newList(void* ptr) 2959 +{ 2960 + Q_UNUSED(ptr); 2961 + return new QList<QByteArray>; 2962 +} 2963 + 2964 +void* QVBoxLayoutWithTriggerSlot___findChildren_atList2(void* ptr, int i) 2965 +{ 2966 + return const_cast<QObject*>(static_cast<QList<QObject*>*>(ptr)->at(i)); 2967 +} 2968 + 2969 +void QVBoxLayoutWithTriggerSlot___findChildren_setList2(void* ptr, void* i) 2970 +{ 2971 + static_cast<QList<QObject*>*>(ptr)->append(static_cast<QObject*>(i)); 2972 +} 2973 + 2974 +void* QVBoxLayoutWithTriggerSlot___findChildren_newList2(void* ptr) 2975 +{ 2976 + Q_UNUSED(ptr); 2977 + return new QList<QObject*>; 2978 +} 2979 + 2980 +void* QVBoxLayoutWithTriggerSlot___findChildren_atList3(void* ptr, int i) 2981 +{ 2982 + return const_cast<QObject*>(static_cast<QList<QObject*>*>(ptr)->at(i)); 2983 +} 2984 + 2985 +void QVBoxLayoutWithTriggerSlot___findChildren_setList3(void* ptr, void* i) 2986 +{ 2987 + static_cast<QList<QObject*>*>(ptr)->append(static_cast<QObject*>(i)); 2988 +} 2989 + 2990 +void* QVBoxLayoutWithTriggerSlot___findChildren_newList3(void* ptr) 2991 +{ 2992 + Q_UNUSED(ptr); 2993 + return new QList<QObject*>; 2994 +} 2995 + 2996 +void* QVBoxLayoutWithTriggerSlot___findChildren_atList(void* ptr, int i) 2997 +{ 2998 + return const_cast<QObject*>(static_cast<QList<QObject*>*>(ptr)->at(i)); 2999 +} 3000 + 3001 +void QVBoxLayoutWithTriggerSlot___findChildren_setList(void* ptr, void* i) 3002 +{ 3003 + static_cast<QList<QObject*>*>(ptr)->append(static_cast<QObject*>(i)); 3004 +} 3005 + 3006 +void* QVBoxLayoutWithTriggerSlot___findChildren_newList(void* ptr) 3007 +{ 3008 + Q_UNUSED(ptr); 3009 + return new QList<QObject*>; 3010 +} 3011 + 3012 +void* QVBoxLayoutWithTriggerSlot___children_atList(void* ptr, int i) 3013 +{ 3014 + return const_cast<QObject*>(static_cast<QList<QObject *>*>(ptr)->at(i)); 3015 +} 3016 + 3017 +void QVBoxLayoutWithTriggerSlot___children_setList(void* ptr, void* i) 3018 +{ 3019 + static_cast<QList<QObject *>*>(ptr)->append(static_cast<QObject*>(i)); 3020 +} 3021 + 3022 +void* QVBoxLayoutWithTriggerSlot___children_newList(void* ptr) 3023 +{ 3024 + Q_UNUSED(ptr); 3025 + return new QList<QObject *>; 3026 +} 3027 + 3028 +void* QVBoxLayoutWithTriggerSlot_NewQVBoxLayoutWithTriggerSlot() 3029 +{ 3030 + return new QVBoxLayoutWithTriggerSlot(); 3031 +} 3032 + 3033 +void* QVBoxLayoutWithTriggerSlot_NewQVBoxLayoutWithTriggerSlot2(void* parent) 3034 +{ 3035 + return new QVBoxLayoutWithTriggerSlot(static_cast<QWidget*>(parent)); 3036 +} 3037 + 3038 +void QVBoxLayoutWithTriggerSlot_DestroyQVBoxLayoutWithTriggerSlot(void* ptr) 3039 +{ 3040 + static_cast<QVBoxLayoutWithTriggerSlot*>(ptr)->~QVBoxLayoutWithTriggerSlot(); 3041 +} 3042 + 3043 +void* QVBoxLayoutWithTriggerSlot_TakeAtDefault(void* ptr, int index) 3044 +{ 3045 + return static_cast<QVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::takeAt(index); 3046 +} 3047 + 3048 +void QVBoxLayoutWithTriggerSlot_AddItemDefault(void* ptr, void* item) 3049 +{ 3050 + static_cast<QVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::addItem(static_cast<QLayoutItem*>(item)); 3051 +} 3052 + 3053 +void QVBoxLayoutWithTriggerSlot_InvalidateDefault(void* ptr) 3054 +{ 3055 + static_cast<QVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::invalidate(); 3056 +} 3057 + 3058 +void QVBoxLayoutWithTriggerSlot_SetGeometryDefault(void* ptr, void* r) 3059 +{ 3060 + static_cast<QVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::setGeometry(*static_cast<QRect*>(r)); 3061 +} 3062 + 3063 +void* QVBoxLayoutWithTriggerSlot_ItemAtDefault(void* ptr, int index) 3064 +{ 3065 + return static_cast<QVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::itemAt(index); 3066 +} 3067 + 3068 +void* QVBoxLayoutWithTriggerSlot_MaximumSizeDefault(void* ptr) 3069 +{ 3070 + return ({ QSize tmpValue = static_cast<QVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::maximumSize(); new QSize(tmpValue.width(), tmpValue.height()); }); 3071 +} 3072 + 3073 +void* QVBoxLayoutWithTriggerSlot_MinimumSizeDefault(void* ptr) 3074 +{ 3075 + return ({ QSize tmpValue = static_cast<QVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::minimumSize(); new QSize(tmpValue.width(), tmpValue.height()); }); 3076 +} 3077 + 3078 +void* QVBoxLayoutWithTriggerSlot_SizeHintDefault(void* ptr) 3079 +{ 3080 + return ({ QSize tmpValue = static_cast<QVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::sizeHint(); new QSize(tmpValue.width(), tmpValue.height()); }); 3081 +} 3082 + 3083 +long long QVBoxLayoutWithTriggerSlot_ExpandingDirectionsDefault(void* ptr) 3084 +{ 3085 + return static_cast<QVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::expandingDirections(); 3086 +} 3087 + 3088 +char QVBoxLayoutWithTriggerSlot_HasHeightForWidthDefault(void* ptr) 3089 +{ 3090 + return static_cast<QVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::hasHeightForWidth(); 3091 +} 3092 + 3093 +int QVBoxLayoutWithTriggerSlot_CountDefault(void* ptr) 3094 +{ 3095 + return static_cast<QVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::count(); 3096 +} 3097 + 3098 +int QVBoxLayoutWithTriggerSlot_HeightForWidthDefault(void* ptr, int w) 3099 +{ 3100 + return static_cast<QVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::heightForWidth(w); 3101 +} 3102 + 3103 +int QVBoxLayoutWithTriggerSlot_MinimumHeightForWidthDefault(void* ptr, int w) 3104 +{ 3105 + return static_cast<QVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::minimumHeightForWidth(w); 3106 +} 3107 + 3108 +void* QVBoxLayoutWithTriggerSlot_LayoutDefault(void* ptr) 3109 +{ 3110 + return static_cast<QVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::layout(); 3111 +} 3112 + 3113 +void QVBoxLayoutWithTriggerSlot_ChildEventDefault(void* ptr, void* e) 3114 +{ 3115 + static_cast<QVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::childEvent(static_cast<QChildEvent*>(e)); 3116 +} 3117 + 3118 +void* QVBoxLayoutWithTriggerSlot_GeometryDefault(void* ptr) 3119 +{ 3120 + return ({ QRect tmpValue = static_cast<QVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::geometry(); new QRect(tmpValue.x(), tmpValue.y(), tmpValue.width(), tmpValue.height()); }); 3121 +} 3122 + 3123 +long long QVBoxLayoutWithTriggerSlot_ControlTypesDefault(void* ptr) 3124 +{ 3125 + return static_cast<QVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::controlTypes(); 3126 +} 3127 + 3128 +char QVBoxLayoutWithTriggerSlot_IsEmptyDefault(void* ptr) 3129 +{ 3130 + return static_cast<QVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::isEmpty(); 3131 +} 3132 + 3133 +int QVBoxLayoutWithTriggerSlot_IndexOfDefault(void* ptr, void* widget) 3134 +{ 3135 + return static_cast<QVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::indexOf(static_cast<QWidget*>(widget)); 3136 +} 3137 + 3138 +char QVBoxLayoutWithTriggerSlot_EventDefault(void* ptr, void* e) 3139 +{ 3140 + return static_cast<QVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::event(static_cast<QEvent*>(e)); 3141 +} 3142 + 3143 +char QVBoxLayoutWithTriggerSlot_EventFilterDefault(void* ptr, void* watched, void* event) 3144 +{ 3145 + return static_cast<QVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::eventFilter(static_cast<QObject*>(watched), static_cast<QEvent*>(event)); 3146 +} 3147 + 3148 +void QVBoxLayoutWithTriggerSlot_ConnectNotifyDefault(void* ptr, void* sign) 3149 +{ 3150 + static_cast<QVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::connectNotify(*static_cast<QMetaMethod*>(sign)); 3151 +} 3152 + 3153 +void QVBoxLayoutWithTriggerSlot_CustomEventDefault(void* ptr, void* event) 3154 +{ 3155 + static_cast<QVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::customEvent(static_cast<QEvent*>(event)); 3156 +} 3157 + 3158 +void QVBoxLayoutWithTriggerSlot_DeleteLaterDefault(void* ptr) 3159 +{ 3160 + static_cast<QVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::deleteLater(); 3161 +} 3162 + 3163 +void QVBoxLayoutWithTriggerSlot_DisconnectNotifyDefault(void* ptr, void* sign) 3164 +{ 3165 + static_cast<QVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::disconnectNotify(*static_cast<QMetaMethod*>(sign)); 3166 +} 3167 + 3168 +void QVBoxLayoutWithTriggerSlot_TimerEventDefault(void* ptr, void* event) 3169 +{ 3170 + static_cast<QVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::timerEvent(static_cast<QTimerEvent*>(event)); 3171 +} 3172 + 3173 + 3174 + 3175 +void* QVBoxLayoutWithTriggerSlot_SpacerItemDefault(void* ptr) 3176 +{ 3177 + return static_cast<QVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::spacerItem(); 3178 +} 3179 + 3180 +void* QVBoxLayoutWithTriggerSlot_WidgetDefault(void* ptr) 3181 +{ 3182 + return static_cast<QVBoxLayoutWithTriggerSlot*>(ptr)->QVBoxLayout::widget(); 3183 +} 3184 + 3185 +#include "moc_moc.h" 3186 diff --git a/ui/listLayouts/moc.go b/ui/listLayouts/moc.go 3187 new file mode 100644 3188 index 0000000..55fc930 3189 --- /dev/null 3190 +++ b/ui/listLayouts/moc.go 3191 @@ -0,0 +1,1595 @@ 3192 +package listLayouts 3193 + 3194 +//#include <stdint.h> 3195 +//#include <stdlib.h> 3196 +//#include <string.h> 3197 +//#include "moc.h" 3198 +import "C" 3199 +import ( 3200 + "runtime" 3201 + "unsafe" 3202 + 3203 + "github.com/therecipe/qt" 3204 + std_core "github.com/therecipe/qt/core" 3205 + std_widgets "github.com/therecipe/qt/widgets" 3206 +) 3207 + 3208 +func cGoUnpackString(s C.struct_Moc_PackedString) string { 3209 + if len := int(s.len); len == -1 { 3210 + return C.GoString(s.data) 3211 + } 3212 + return C.GoStringN(s.data, C.int(s.len)) 3213 +} 3214 + 3215 +type QRoomVBoxLayoutWithTriggerSlot_ITF interface { 3216 + std_widgets.QVBoxLayout_ITF 3217 + QRoomVBoxLayoutWithTriggerSlot_PTR() *QRoomVBoxLayoutWithTriggerSlot 3218 +} 3219 + 3220 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) QRoomVBoxLayoutWithTriggerSlot_PTR() *QRoomVBoxLayoutWithTriggerSlot { 3221 + return ptr 3222 +} 3223 + 3224 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) Pointer() unsafe.Pointer { 3225 + if ptr != nil { 3226 + return ptr.QVBoxLayout_PTR().Pointer() 3227 + } 3228 + return nil 3229 +} 3230 + 3231 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) SetPointer(p unsafe.Pointer) { 3232 + if ptr != nil { 3233 + ptr.QVBoxLayout_PTR().SetPointer(p) 3234 + } 3235 +} 3236 + 3237 +func PointerFromQRoomVBoxLayoutWithTriggerSlot(ptr QRoomVBoxLayoutWithTriggerSlot_ITF) unsafe.Pointer { 3238 + if ptr != nil { 3239 + return ptr.QRoomVBoxLayoutWithTriggerSlot_PTR().Pointer() 3240 + } 3241 + return nil 3242 +} 3243 + 3244 +func NewQRoomVBoxLayoutWithTriggerSlotFromPointer(ptr unsafe.Pointer) *QRoomVBoxLayoutWithTriggerSlot { 3245 + var n *QRoomVBoxLayoutWithTriggerSlot 3246 + if gPtr, ok := qt.Receive(ptr); !ok { 3247 + n = new(QRoomVBoxLayoutWithTriggerSlot) 3248 + n.SetPointer(ptr) 3249 + } else { 3250 + switch deduced := gPtr.(type) { 3251 + case *QRoomVBoxLayoutWithTriggerSlot: 3252 + n = deduced 3253 + 3254 + case *std_widgets.QVBoxLayout: 3255 + n = &QRoomVBoxLayoutWithTriggerSlot{QVBoxLayout: *deduced} 3256 + 3257 + default: 3258 + n = new(QRoomVBoxLayoutWithTriggerSlot) 3259 + n.SetPointer(ptr) 3260 + } 3261 + } 3262 + return n 3263 +} 3264 + 3265 +//export callbackQRoomVBoxLayoutWithTriggerSlot_Constructor 3266 +func callbackQRoomVBoxLayoutWithTriggerSlot_Constructor(ptr unsafe.Pointer) { 3267 + gPtr := NewQRoomVBoxLayoutWithTriggerSlotFromPointer(ptr) 3268 + qt.Register(ptr, gPtr) 3269 +} 3270 + 3271 +//export callbackQRoomVBoxLayoutWithTriggerSlot_TriggerRoom 3272 +func callbackQRoomVBoxLayoutWithTriggerSlot_TriggerRoom(ptr unsafe.Pointer, roomID C.struct_Moc_PackedString) { 3273 + if signal := qt.GetSignal(ptr, "TriggerRoom"); signal != nil { 3274 + signal.(func(string))(cGoUnpackString(roomID)) 3275 + } 3276 + 3277 +} 3278 + 3279 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) ConnectTriggerRoom(f func(roomID string)) { 3280 + if ptr.Pointer() != nil { 3281 + 3282 + if !qt.ExistsSignal(ptr.Pointer(), "TriggerRoom") { 3283 + C.QRoomVBoxLayoutWithTriggerSlot_ConnectTriggerRoom(ptr.Pointer()) 3284 + } 3285 + 3286 + if signal := qt.LendSignal(ptr.Pointer(), "TriggerRoom"); signal != nil { 3287 + qt.ConnectSignal(ptr.Pointer(), "TriggerRoom", func(roomID string) { 3288 + signal.(func(string))(roomID) 3289 + f(roomID) 3290 + }) 3291 + } else { 3292 + qt.ConnectSignal(ptr.Pointer(), "TriggerRoom", f) 3293 + } 3294 + } 3295 +} 3296 + 3297 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) DisconnectTriggerRoom() { 3298 + if ptr.Pointer() != nil { 3299 + C.QRoomVBoxLayoutWithTriggerSlot_DisconnectTriggerRoom(ptr.Pointer()) 3300 + qt.DisconnectSignal(ptr.Pointer(), "TriggerRoom") 3301 + } 3302 +} 3303 + 3304 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) TriggerRoom(roomID string) { 3305 + if ptr.Pointer() != nil { 3306 + var roomIDC *C.char 3307 + if roomID != "" { 3308 + roomIDC = C.CString(roomID) 3309 + defer C.free(unsafe.Pointer(roomIDC)) 3310 + } 3311 + C.QRoomVBoxLayoutWithTriggerSlot_TriggerRoom(ptr.Pointer(), C.struct_Moc_PackedString{data: roomIDC, len: C.longlong(len(roomID))}) 3312 + } 3313 +} 3314 + 3315 +//export callbackQRoomVBoxLayoutWithTriggerSlot_ChangeRoom 3316 +func callbackQRoomVBoxLayoutWithTriggerSlot_ChangeRoom(ptr unsafe.Pointer, roomID C.struct_Moc_PackedString) { 3317 + if signal := qt.GetSignal(ptr, "ChangeRoom"); signal != nil { 3318 + signal.(func(string))(cGoUnpackString(roomID)) 3319 + } 3320 + 3321 +} 3322 + 3323 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) ConnectChangeRoom(f func(roomID string)) { 3324 + if ptr.Pointer() != nil { 3325 + 3326 + if !qt.ExistsSignal(ptr.Pointer(), "ChangeRoom") { 3327 + C.QRoomVBoxLayoutWithTriggerSlot_ConnectChangeRoom(ptr.Pointer()) 3328 + } 3329 + 3330 + if signal := qt.LendSignal(ptr.Pointer(), "ChangeRoom"); signal != nil { 3331 + qt.ConnectSignal(ptr.Pointer(), "ChangeRoom", func(roomID string) { 3332 + signal.(func(string))(roomID) 3333 + f(roomID) 3334 + }) 3335 + } else { 3336 + qt.ConnectSignal(ptr.Pointer(), "ChangeRoom", f) 3337 + } 3338 + } 3339 +} 3340 + 3341 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) DisconnectChangeRoom() { 3342 + if ptr.Pointer() != nil { 3343 + C.QRoomVBoxLayoutWithTriggerSlot_DisconnectChangeRoom(ptr.Pointer()) 3344 + qt.DisconnectSignal(ptr.Pointer(), "ChangeRoom") 3345 + } 3346 +} 3347 + 3348 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) ChangeRoom(roomID string) { 3349 + if ptr.Pointer() != nil { 3350 + var roomIDC *C.char 3351 + if roomID != "" { 3352 + roomIDC = C.CString(roomID) 3353 + defer C.free(unsafe.Pointer(roomIDC)) 3354 + } 3355 + C.QRoomVBoxLayoutWithTriggerSlot_ChangeRoom(ptr.Pointer(), C.struct_Moc_PackedString{data: roomIDC, len: C.longlong(len(roomID))}) 3356 + } 3357 +} 3358 + 3359 +func QRoomVBoxLayoutWithTriggerSlot_QRegisterMetaType() int { 3360 + return int(int32(C.QRoomVBoxLayoutWithTriggerSlot_QRoomVBoxLayoutWithTriggerSlot_QRegisterMetaType())) 3361 +} 3362 + 3363 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) QRegisterMetaType() int { 3364 + return int(int32(C.QRoomVBoxLayoutWithTriggerSlot_QRoomVBoxLayoutWithTriggerSlot_QRegisterMetaType())) 3365 +} 3366 + 3367 +func QRoomVBoxLayoutWithTriggerSlot_QRegisterMetaType2(typeName string) int { 3368 + var typeNameC *C.char 3369 + if typeName != "" { 3370 + typeNameC = C.CString(typeName) 3371 + defer C.free(unsafe.Pointer(typeNameC)) 3372 + } 3373 + return int(int32(C.QRoomVBoxLayoutWithTriggerSlot_QRoomVBoxLayoutWithTriggerSlot_QRegisterMetaType2(typeNameC))) 3374 +} 3375 + 3376 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) QRegisterMetaType2(typeName string) int { 3377 + var typeNameC *C.char 3378 + if typeName != "" { 3379 + typeNameC = C.CString(typeName) 3380 + defer C.free(unsafe.Pointer(typeNameC)) 3381 + } 3382 + return int(int32(C.QRoomVBoxLayoutWithTriggerSlot_QRoomVBoxLayoutWithTriggerSlot_QRegisterMetaType2(typeNameC))) 3383 +} 3384 + 3385 +func QRoomVBoxLayoutWithTriggerSlot_QmlRegisterType() int { 3386 + return int(int32(C.QRoomVBoxLayoutWithTriggerSlot_QRoomVBoxLayoutWithTriggerSlot_QmlRegisterType())) 3387 +} 3388 + 3389 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) QmlRegisterType() int { 3390 + return int(int32(C.QRoomVBoxLayoutWithTriggerSlot_QRoomVBoxLayoutWithTriggerSlot_QmlRegisterType())) 3391 +} 3392 + 3393 +func QRoomVBoxLayoutWithTriggerSlot_QmlRegisterType2(uri string, versionMajor int, versionMinor int, qmlName string) int { 3394 + var uriC *C.char 3395 + if uri != "" { 3396 + uriC = C.CString(uri) 3397 + defer C.free(unsafe.Pointer(uriC)) 3398 + } 3399 + var qmlNameC *C.char 3400 + if qmlName != "" { 3401 + qmlNameC = C.CString(qmlName) 3402 + defer C.free(unsafe.Pointer(qmlNameC)) 3403 + } 3404 + return int(int32(C.QRoomVBoxLayoutWithTriggerSlot_QRoomVBoxLayoutWithTriggerSlot_QmlRegisterType2(uriC, C.int(int32(versionMajor)), C.int(int32(versionMinor)), qmlNameC))) 3405 +} 3406 + 3407 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) QmlRegisterType2(uri string, versionMajor int, versionMinor int, qmlName string) int { 3408 + var uriC *C.char 3409 + if uri != "" { 3410 + uriC = C.CString(uri) 3411 + defer C.free(unsafe.Pointer(uriC)) 3412 + } 3413 + var qmlNameC *C.char 3414 + if qmlName != "" { 3415 + qmlNameC = C.CString(qmlName) 3416 + defer C.free(unsafe.Pointer(qmlNameC)) 3417 + } 3418 + return int(int32(C.QRoomVBoxLayoutWithTriggerSlot_QRoomVBoxLayoutWithTriggerSlot_QmlRegisterType2(uriC, C.int(int32(versionMajor)), C.int(int32(versionMinor)), qmlNameC))) 3419 +} 3420 + 3421 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) __dynamicPropertyNames_atList(i int) *std_core.QByteArray { 3422 + if ptr.Pointer() != nil { 3423 + var tmpValue = std_core.NewQByteArrayFromPointer(C.QRoomVBoxLayoutWithTriggerSlot___dynamicPropertyNames_atList(ptr.Pointer(), C.int(int32(i)))) 3424 + runtime.SetFinalizer(tmpValue, (*std_core.QByteArray).DestroyQByteArray) 3425 + return tmpValue 3426 + } 3427 + return nil 3428 +} 3429 + 3430 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) __dynamicPropertyNames_setList(i std_core.QByteArray_ITF) { 3431 + if ptr.Pointer() != nil { 3432 + C.QRoomVBoxLayoutWithTriggerSlot___dynamicPropertyNames_setList(ptr.Pointer(), std_core.PointerFromQByteArray(i)) 3433 + } 3434 +} 3435 + 3436 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) __dynamicPropertyNames_newList() unsafe.Pointer { 3437 + return unsafe.Pointer(C.QRoomVBoxLayoutWithTriggerSlot___dynamicPropertyNames_newList(ptr.Pointer())) 3438 +} 3439 + 3440 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) __findChildren_atList2(i int) *std_core.QObject { 3441 + if ptr.Pointer() != nil { 3442 + var tmpValue = std_core.NewQObjectFromPointer(C.QRoomVBoxLayoutWithTriggerSlot___findChildren_atList2(ptr.Pointer(), C.int(int32(i)))) 3443 + if !qt.ExistsSignal(tmpValue.Pointer(), "destroyed") { 3444 + tmpValue.ConnectDestroyed(func(*std_core.QObject) { tmpValue.SetPointer(nil) }) 3445 + } 3446 + return tmpValue 3447 + } 3448 + return nil 3449 +} 3450 + 3451 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) __findChildren_setList2(i std_core.QObject_ITF) { 3452 + if ptr.Pointer() != nil { 3453 + C.QRoomVBoxLayoutWithTriggerSlot___findChildren_setList2(ptr.Pointer(), std_core.PointerFromQObject(i)) 3454 + } 3455 +} 3456 + 3457 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) __findChildren_newList2() unsafe.Pointer { 3458 + return unsafe.Pointer(C.QRoomVBoxLayoutWithTriggerSlot___findChildren_newList2(ptr.Pointer())) 3459 +} 3460 + 3461 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) __findChildren_atList3(i int) *std_core.QObject { 3462 + if ptr.Pointer() != nil { 3463 + var tmpValue = std_core.NewQObjectFromPointer(C.QRoomVBoxLayoutWithTriggerSlot___findChildren_atList3(ptr.Pointer(), C.int(int32(i)))) 3464 + if !qt.ExistsSignal(tmpValue.Pointer(), "destroyed") { 3465 + tmpValue.ConnectDestroyed(func(*std_core.QObject) { tmpValue.SetPointer(nil) }) 3466 + } 3467 + return tmpValue 3468 + } 3469 + return nil 3470 +} 3471 + 3472 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) __findChildren_setList3(i std_core.QObject_ITF) { 3473 + if ptr.Pointer() != nil { 3474 + C.QRoomVBoxLayoutWithTriggerSlot___findChildren_setList3(ptr.Pointer(), std_core.PointerFromQObject(i)) 3475 + } 3476 +} 3477 + 3478 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) __findChildren_newList3() unsafe.Pointer { 3479 + return unsafe.Pointer(C.QRoomVBoxLayoutWithTriggerSlot___findChildren_newList3(ptr.Pointer())) 3480 +} 3481 + 3482 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) __findChildren_atList(i int) *std_core.QObject { 3483 + if ptr.Pointer() != nil { 3484 + var tmpValue = std_core.NewQObjectFromPointer(C.QRoomVBoxLayoutWithTriggerSlot___findChildren_atList(ptr.Pointer(), C.int(int32(i)))) 3485 + if !qt.ExistsSignal(tmpValue.Pointer(), "destroyed") { 3486 + tmpValue.ConnectDestroyed(func(*std_core.QObject) { tmpValue.SetPointer(nil) }) 3487 + } 3488 + return tmpValue 3489 + } 3490 + return nil 3491 +} 3492 + 3493 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) __findChildren_setList(i std_core.QObject_ITF) { 3494 + if ptr.Pointer() != nil { 3495 + C.QRoomVBoxLayoutWithTriggerSlot___findChildren_setList(ptr.Pointer(), std_core.PointerFromQObject(i)) 3496 + } 3497 +} 3498 + 3499 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) __findChildren_newList() unsafe.Pointer { 3500 + return unsafe.Pointer(C.QRoomVBoxLayoutWithTriggerSlot___findChildren_newList(ptr.Pointer())) 3501 +} 3502 + 3503 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) __children_atList(i int) *std_core.QObject { 3504 + if ptr.Pointer() != nil { 3505 + var tmpValue = std_core.NewQObjectFromPointer(C.QRoomVBoxLayoutWithTriggerSlot___children_atList(ptr.Pointer(), C.int(int32(i)))) 3506 + if !qt.ExistsSignal(tmpValue.Pointer(), "destroyed") { 3507 + tmpValue.ConnectDestroyed(func(*std_core.QObject) { tmpValue.SetPointer(nil) }) 3508 + } 3509 + return tmpValue 3510 + } 3511 + return nil 3512 +} 3513 + 3514 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) __children_setList(i std_core.QObject_ITF) { 3515 + if ptr.Pointer() != nil { 3516 + C.QRoomVBoxLayoutWithTriggerSlot___children_setList(ptr.Pointer(), std_core.PointerFromQObject(i)) 3517 + } 3518 +} 3519 + 3520 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) __children_newList() unsafe.Pointer { 3521 + return unsafe.Pointer(C.QRoomVBoxLayoutWithTriggerSlot___children_newList(ptr.Pointer())) 3522 +} 3523 + 3524 +func NewQRoomVBoxLayoutWithTriggerSlot() *QRoomVBoxLayoutWithTriggerSlot { 3525 + var tmpValue = NewQRoomVBoxLayoutWithTriggerSlotFromPointer(C.QRoomVBoxLayoutWithTriggerSlot_NewQRoomVBoxLayoutWithTriggerSlot()) 3526 + if !qt.ExistsSignal(tmpValue.Pointer(), "destroyed") { 3527 + tmpValue.ConnectDestroyed(func(*std_core.QObject) { tmpValue.SetPointer(nil) }) 3528 + } 3529 + return tmpValue 3530 +} 3531 + 3532 +func NewQRoomVBoxLayoutWithTriggerSlot2(parent std_widgets.QWidget_ITF) *QRoomVBoxLayoutWithTriggerSlot { 3533 + var tmpValue = NewQRoomVBoxLayoutWithTriggerSlotFromPointer(C.QRoomVBoxLayoutWithTriggerSlot_NewQRoomVBoxLayoutWithTriggerSlot2(std_widgets.PointerFromQWidget(parent))) 3534 + if !qt.ExistsSignal(tmpValue.Pointer(), "destroyed") { 3535 + tmpValue.ConnectDestroyed(func(*std_core.QObject) { tmpValue.SetPointer(nil) }) 3536 + } 3537 + return tmpValue 3538 +} 3539 + 3540 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) DestroyQRoomVBoxLayoutWithTriggerSlot() { 3541 + if ptr.Pointer() != nil { 3542 + C.QRoomVBoxLayoutWithTriggerSlot_DestroyQRoomVBoxLayoutWithTriggerSlot(ptr.Pointer()) 3543 + ptr.SetPointer(nil) 3544 + runtime.SetFinalizer(ptr, nil) 3545 + } 3546 +} 3547 + 3548 +//export callbackQRoomVBoxLayoutWithTriggerSlot_TakeAt 3549 +func callbackQRoomVBoxLayoutWithTriggerSlot_TakeAt(ptr unsafe.Pointer, index C.int) unsafe.Pointer { 3550 + if signal := qt.GetSignal(ptr, "takeAt"); signal != nil { 3551 + return std_widgets.PointerFromQLayoutItem(signal.(func(int) *std_widgets.QLayoutItem)(int(int32(index)))) 3552 + } 3553 + 3554 + return std_widgets.PointerFromQLayoutItem(NewQRoomVBoxLayoutWithTriggerSlotFromPointer(ptr).TakeAtDefault(int(int32(index)))) 3555 +} 3556 + 3557 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) TakeAtDefault(index int) *std_widgets.QLayoutItem { 3558 + if ptr.Pointer() != nil { 3559 + return std_widgets.NewQLayoutItemFromPointer(C.QRoomVBoxLayoutWithTriggerSlot_TakeAtDefault(ptr.Pointer(), C.int(int32(index)))) 3560 + } 3561 + return nil 3562 +} 3563 + 3564 +//export callbackQRoomVBoxLayoutWithTriggerSlot_AddItem 3565 +func callbackQRoomVBoxLayoutWithTriggerSlot_AddItem(ptr unsafe.Pointer, item unsafe.Pointer) { 3566 + if signal := qt.GetSignal(ptr, "addItem"); signal != nil { 3567 + signal.(func(*std_widgets.QLayoutItem))(std_widgets.NewQLayoutItemFromPointer(item)) 3568 + } else { 3569 + NewQRoomVBoxLayoutWithTriggerSlotFromPointer(ptr).AddItemDefault(std_widgets.NewQLayoutItemFromPointer(item)) 3570 + } 3571 +} 3572 + 3573 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) AddItemDefault(item std_widgets.QLayoutItem_ITF) { 3574 + if ptr.Pointer() != nil { 3575 + C.QRoomVBoxLayoutWithTriggerSlot_AddItemDefault(ptr.Pointer(), std_widgets.PointerFromQLayoutItem(item)) 3576 + } 3577 +} 3578 + 3579 +//export callbackQRoomVBoxLayoutWithTriggerSlot_Invalidate 3580 +func callbackQRoomVBoxLayoutWithTriggerSlot_Invalidate(ptr unsafe.Pointer) { 3581 + if signal := qt.GetSignal(ptr, "invalidate"); signal != nil { 3582 + signal.(func())() 3583 + } else { 3584 + NewQRoomVBoxLayoutWithTriggerSlotFromPointer(ptr).InvalidateDefault() 3585 + } 3586 +} 3587 + 3588 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) InvalidateDefault() { 3589 + if ptr.Pointer() != nil { 3590 + C.QRoomVBoxLayoutWithTriggerSlot_InvalidateDefault(ptr.Pointer()) 3591 + } 3592 +} 3593 + 3594 +//export callbackQRoomVBoxLayoutWithTriggerSlot_SetGeometry 3595 +func callbackQRoomVBoxLayoutWithTriggerSlot_SetGeometry(ptr unsafe.Pointer, r unsafe.Pointer) { 3596 + if signal := qt.GetSignal(ptr, "setGeometry"); signal != nil { 3597 + signal.(func(*std_core.QRect))(std_core.NewQRectFromPointer(r)) 3598 + } else { 3599 + NewQRoomVBoxLayoutWithTriggerSlotFromPointer(ptr).SetGeometryDefault(std_core.NewQRectFromPointer(r)) 3600 + } 3601 +} 3602 + 3603 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) SetGeometryDefault(r std_core.QRect_ITF) { 3604 + if ptr.Pointer() != nil { 3605 + C.QRoomVBoxLayoutWithTriggerSlot_SetGeometryDefault(ptr.Pointer(), std_core.PointerFromQRect(r)) 3606 + } 3607 +} 3608 + 3609 +//export callbackQRoomVBoxLayoutWithTriggerSlot_ItemAt 3610 +func callbackQRoomVBoxLayoutWithTriggerSlot_ItemAt(ptr unsafe.Pointer, index C.int) unsafe.Pointer { 3611 + if signal := qt.GetSignal(ptr, "itemAt"); signal != nil { 3612 + return std_widgets.PointerFromQLayoutItem(signal.(func(int) *std_widgets.QLayoutItem)(int(int32(index)))) 3613 + } 3614 + 3615 + return std_widgets.PointerFromQLayoutItem(NewQRoomVBoxLayoutWithTriggerSlotFromPointer(ptr).ItemAtDefault(int(int32(index)))) 3616 +} 3617 + 3618 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) ItemAtDefault(index int) *std_widgets.QLayoutItem { 3619 + if ptr.Pointer() != nil { 3620 + return std_widgets.NewQLayoutItemFromPointer(C.QRoomVBoxLayoutWithTriggerSlot_ItemAtDefault(ptr.Pointer(), C.int(int32(index)))) 3621 + } 3622 + return nil 3623 +} 3624 + 3625 +//export callbackQRoomVBoxLayoutWithTriggerSlot_MaximumSize 3626 +func callbackQRoomVBoxLayoutWithTriggerSlot_MaximumSize(ptr unsafe.Pointer) unsafe.Pointer { 3627 + if signal := qt.GetSignal(ptr, "maximumSize"); signal != nil { 3628 + return std_core.PointerFromQSize(signal.(func() *std_core.QSize)()) 3629 + } 3630 + 3631 + return std_core.PointerFromQSize(NewQRoomVBoxLayoutWithTriggerSlotFromPointer(ptr).MaximumSizeDefault()) 3632 +} 3633 + 3634 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) MaximumSizeDefault() *std_core.QSize { 3635 + if ptr.Pointer() != nil { 3636 + var tmpValue = std_core.NewQSizeFromPointer(C.QRoomVBoxLayoutWithTriggerSlot_MaximumSizeDefault(ptr.Pointer())) 3637 + runtime.SetFinalizer(tmpValue, (*std_core.QSize).DestroyQSize) 3638 + return tmpValue 3639 + } 3640 + return nil 3641 +} 3642 + 3643 +//export callbackQRoomVBoxLayoutWithTriggerSlot_MinimumSize 3644 +func callbackQRoomVBoxLayoutWithTriggerSlot_MinimumSize(ptr unsafe.Pointer) unsafe.Pointer { 3645 + if signal := qt.GetSignal(ptr, "minimumSize"); signal != nil { 3646 + return std_core.PointerFromQSize(signal.(func() *std_core.QSize)()) 3647 + } 3648 + 3649 + return std_core.PointerFromQSize(NewQRoomVBoxLayoutWithTriggerSlotFromPointer(ptr).MinimumSizeDefault()) 3650 +} 3651 + 3652 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) MinimumSizeDefault() *std_core.QSize { 3653 + if ptr.Pointer() != nil { 3654 + var tmpValue = std_core.NewQSizeFromPointer(C.QRoomVBoxLayoutWithTriggerSlot_MinimumSizeDefault(ptr.Pointer())) 3655 + runtime.SetFinalizer(tmpValue, (*std_core.QSize).DestroyQSize) 3656 + return tmpValue 3657 + } 3658 + return nil 3659 +} 3660 + 3661 +//export callbackQRoomVBoxLayoutWithTriggerSlot_SizeHint 3662 +func callbackQRoomVBoxLayoutWithTriggerSlot_SizeHint(ptr unsafe.Pointer) unsafe.Pointer { 3663 + if signal := qt.GetSignal(ptr, "sizeHint"); signal != nil { 3664 + return std_core.PointerFromQSize(signal.(func() *std_core.QSize)()) 3665 + } 3666 + 3667 + return std_core.PointerFromQSize(NewQRoomVBoxLayoutWithTriggerSlotFromPointer(ptr).SizeHintDefault()) 3668 +} 3669 + 3670 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) SizeHintDefault() *std_core.QSize { 3671 + if ptr.Pointer() != nil { 3672 + var tmpValue = std_core.NewQSizeFromPointer(C.QRoomVBoxLayoutWithTriggerSlot_SizeHintDefault(ptr.Pointer())) 3673 + runtime.SetFinalizer(tmpValue, (*std_core.QSize).DestroyQSize) 3674 + return tmpValue 3675 + } 3676 + return nil 3677 +} 3678 + 3679 +//export callbackQRoomVBoxLayoutWithTriggerSlot_ExpandingDirections 3680 +func callbackQRoomVBoxLayoutWithTriggerSlot_ExpandingDirections(ptr unsafe.Pointer) C.longlong { 3681 + if signal := qt.GetSignal(ptr, "expandingDirections"); signal != nil { 3682 + return C.longlong(signal.(func() std_core.Qt__Orientation)()) 3683 + } 3684 + 3685 + return C.longlong(NewQRoomVBoxLayoutWithTriggerSlotFromPointer(ptr).ExpandingDirectionsDefault()) 3686 +} 3687 + 3688 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) ExpandingDirectionsDefault() std_core.Qt__Orientation { 3689 + if ptr.Pointer() != nil { 3690 + return std_core.Qt__Orientation(C.QRoomVBoxLayoutWithTriggerSlot_ExpandingDirectionsDefault(ptr.Pointer())) 3691 + } 3692 + return 0 3693 +} 3694 + 3695 +//export callbackQRoomVBoxLayoutWithTriggerSlot_HasHeightForWidth 3696 +func callbackQRoomVBoxLayoutWithTriggerSlot_HasHeightForWidth(ptr unsafe.Pointer) C.char { 3697 + if signal := qt.GetSignal(ptr, "hasHeightForWidth"); signal != nil { 3698 + return C.char(int8(qt.GoBoolToInt(signal.(func() bool)()))) 3699 + } 3700 + 3701 + return C.char(int8(qt.GoBoolToInt(NewQRoomVBoxLayoutWithTriggerSlotFromPointer(ptr).HasHeightForWidthDefault()))) 3702 +} 3703 + 3704 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) HasHeightForWidthDefault() bool { 3705 + if ptr.Pointer() != nil { 3706 + return C.QRoomVBoxLayoutWithTriggerSlot_HasHeightForWidthDefault(ptr.Pointer()) != 0 3707 + } 3708 + return false 3709 +} 3710 + 3711 +//export callbackQRoomVBoxLayoutWithTriggerSlot_Count 3712 +func callbackQRoomVBoxLayoutWithTriggerSlot_Count(ptr unsafe.Pointer) C.int { 3713 + if signal := qt.GetSignal(ptr, "count"); signal != nil { 3714 + return C.int(int32(signal.(func() int)())) 3715 + } 3716 + 3717 + return C.int(int32(NewQRoomVBoxLayoutWithTriggerSlotFromPointer(ptr).CountDefault())) 3718 +} 3719 + 3720 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) CountDefault() int { 3721 + if ptr.Pointer() != nil { 3722 + return int(int32(C.QRoomVBoxLayoutWithTriggerSlot_CountDefault(ptr.Pointer()))) 3723 + } 3724 + return 0 3725 +} 3726 + 3727 +//export callbackQRoomVBoxLayoutWithTriggerSlot_HeightForWidth 3728 +func callbackQRoomVBoxLayoutWithTriggerSlot_HeightForWidth(ptr unsafe.Pointer, w C.int) C.int { 3729 + if signal := qt.GetSignal(ptr, "heightForWidth"); signal != nil { 3730 + return C.int(int32(signal.(func(int) int)(int(int32(w))))) 3731 + } 3732 + 3733 + return C.int(int32(NewQRoomVBoxLayoutWithTriggerSlotFromPointer(ptr).HeightForWidthDefault(int(int32(w))))) 3734 +} 3735 + 3736 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) HeightForWidthDefault(w int) int { 3737 + if ptr.Pointer() != nil { 3738 + return int(int32(C.QRoomVBoxLayoutWithTriggerSlot_HeightForWidthDefault(ptr.Pointer(), C.int(int32(w))))) 3739 + } 3740 + return 0 3741 +} 3742 + 3743 +//export callbackQRoomVBoxLayoutWithTriggerSlot_MinimumHeightForWidth 3744 +func callbackQRoomVBoxLayoutWithTriggerSlot_MinimumHeightForWidth(ptr unsafe.Pointer, w C.int) C.int { 3745 + if signal := qt.GetSignal(ptr, "minimumHeightForWidth"); signal != nil { 3746 + return C.int(int32(signal.(func(int) int)(int(int32(w))))) 3747 + } 3748 + 3749 + return C.int(int32(NewQRoomVBoxLayoutWithTriggerSlotFromPointer(ptr).MinimumHeightForWidthDefault(int(int32(w))))) 3750 +} 3751 + 3752 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) MinimumHeightForWidthDefault(w int) int { 3753 + if ptr.Pointer() != nil { 3754 + return int(int32(C.QRoomVBoxLayoutWithTriggerSlot_MinimumHeightForWidthDefault(ptr.Pointer(), C.int(int32(w))))) 3755 + } 3756 + return 0 3757 +} 3758 + 3759 +//export callbackQRoomVBoxLayoutWithTriggerSlot_Layout 3760 +func callbackQRoomVBoxLayoutWithTriggerSlot_Layout(ptr unsafe.Pointer) unsafe.Pointer { 3761 + if signal := qt.GetSignal(ptr, "layout"); signal != nil { 3762 + return std_widgets.PointerFromQLayout(signal.(func() *std_widgets.QLayout)()) 3763 + } 3764 + 3765 + return std_widgets.PointerFromQLayout(NewQRoomVBoxLayoutWithTriggerSlotFromPointer(ptr).LayoutDefault()) 3766 +} 3767 + 3768 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) LayoutDefault() *std_widgets.QLayout { 3769 + if ptr.Pointer() != nil { 3770 + var tmpValue = std_widgets.NewQLayoutFromPointer(C.QRoomVBoxLayoutWithTriggerSlot_LayoutDefault(ptr.Pointer())) 3771 + if !qt.ExistsSignal(tmpValue.Pointer(), "destroyed") { 3772 + tmpValue.ConnectDestroyed(func(*std_core.QObject) { tmpValue.SetPointer(nil) }) 3773 + } 3774 + return tmpValue 3775 + } 3776 + return nil 3777 +} 3778 + 3779 +//export callbackQRoomVBoxLayoutWithTriggerSlot_ChildEvent 3780 +func callbackQRoomVBoxLayoutWithTriggerSlot_ChildEvent(ptr unsafe.Pointer, e unsafe.Pointer) { 3781 + if signal := qt.GetSignal(ptr, "childEvent"); signal != nil { 3782 + signal.(func(*std_core.QChildEvent))(std_core.NewQChildEventFromPointer(e)) 3783 + } else { 3784 + NewQRoomVBoxLayoutWithTriggerSlotFromPointer(ptr).ChildEventDefault(std_core.NewQChildEventFromPointer(e)) 3785 + } 3786 +} 3787 + 3788 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) ChildEventDefault(e std_core.QChildEvent_ITF) { 3789 + if ptr.Pointer() != nil { 3790 + C.QRoomVBoxLayoutWithTriggerSlot_ChildEventDefault(ptr.Pointer(), std_core.PointerFromQChildEvent(e)) 3791 + } 3792 +} 3793 + 3794 +//export callbackQRoomVBoxLayoutWithTriggerSlot_Geometry 3795 +func callbackQRoomVBoxLayoutWithTriggerSlot_Geometry(ptr unsafe.Pointer) unsafe.Pointer { 3796 + if signal := qt.GetSignal(ptr, "geometry"); signal != nil { 3797 + return std_core.PointerFromQRect(signal.(func() *std_core.QRect)()) 3798 + } 3799 + 3800 + return std_core.PointerFromQRect(NewQRoomVBoxLayoutWithTriggerSlotFromPointer(ptr).GeometryDefault()) 3801 +} 3802 + 3803 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) GeometryDefault() *std_core.QRect { 3804 + if ptr.Pointer() != nil { 3805 + var tmpValue = std_core.NewQRectFromPointer(C.QRoomVBoxLayoutWithTriggerSlot_GeometryDefault(ptr.Pointer())) 3806 + runtime.SetFinalizer(tmpValue, (*std_core.QRect).DestroyQRect) 3807 + return tmpValue 3808 + } 3809 + return nil 3810 +} 3811 + 3812 +//export callbackQRoomVBoxLayoutWithTriggerSlot_ControlTypes 3813 +func callbackQRoomVBoxLayoutWithTriggerSlot_ControlTypes(ptr unsafe.Pointer) C.longlong { 3814 + if signal := qt.GetSignal(ptr, "controlTypes"); signal != nil { 3815 + return C.longlong(signal.(func() std_widgets.QSizePolicy__ControlType)()) 3816 + } 3817 + 3818 + return C.longlong(NewQRoomVBoxLayoutWithTriggerSlotFromPointer(ptr).ControlTypesDefault()) 3819 +} 3820 + 3821 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) ControlTypesDefault() std_widgets.QSizePolicy__ControlType { 3822 + if ptr.Pointer() != nil { 3823 + return std_widgets.QSizePolicy__ControlType(C.QRoomVBoxLayoutWithTriggerSlot_ControlTypesDefault(ptr.Pointer())) 3824 + } 3825 + return 0 3826 +} 3827 + 3828 +//export callbackQRoomVBoxLayoutWithTriggerSlot_IsEmpty 3829 +func callbackQRoomVBoxLayoutWithTriggerSlot_IsEmpty(ptr unsafe.Pointer) C.char { 3830 + if signal := qt.GetSignal(ptr, "isEmpty"); signal != nil { 3831 + return C.char(int8(qt.GoBoolToInt(signal.(func() bool)()))) 3832 + } 3833 + 3834 + return C.char(int8(qt.GoBoolToInt(NewQRoomVBoxLayoutWithTriggerSlotFromPointer(ptr).IsEmptyDefault()))) 3835 +} 3836 + 3837 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) IsEmptyDefault() bool { 3838 + if ptr.Pointer() != nil { 3839 + return C.QRoomVBoxLayoutWithTriggerSlot_IsEmptyDefault(ptr.Pointer()) != 0 3840 + } 3841 + return false 3842 +} 3843 + 3844 +//export callbackQRoomVBoxLayoutWithTriggerSlot_IndexOf 3845 +func callbackQRoomVBoxLayoutWithTriggerSlot_IndexOf(ptr unsafe.Pointer, widget unsafe.Pointer) C.int { 3846 + if signal := qt.GetSignal(ptr, "indexOf"); signal != nil { 3847 + return C.int(int32(signal.(func(*std_widgets.QWidget) int)(std_widgets.NewQWidgetFromPointer(widget)))) 3848 + } 3849 + 3850 + return C.int(int32(NewQRoomVBoxLayoutWithTriggerSlotFromPointer(ptr).IndexOfDefault(std_widgets.NewQWidgetFromPointer(widget)))) 3851 +} 3852 + 3853 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) IndexOfDefault(widget std_widgets.QWidget_ITF) int { 3854 + if ptr.Pointer() != nil { 3855 + return int(int32(C.QRoomVBoxLayoutWithTriggerSlot_IndexOfDefault(ptr.Pointer(), std_widgets.PointerFromQWidget(widget)))) 3856 + } 3857 + return 0 3858 +} 3859 + 3860 +//export callbackQRoomVBoxLayoutWithTriggerSlot_Event 3861 +func callbackQRoomVBoxLayoutWithTriggerSlot_Event(ptr unsafe.Pointer, e unsafe.Pointer) C.char { 3862 + if signal := qt.GetSignal(ptr, "event"); signal != nil { 3863 + return C.char(int8(qt.GoBoolToInt(signal.(func(*std_core.QEvent) bool)(std_core.NewQEventFromPointer(e))))) 3864 + } 3865 + 3866 + return C.char(int8(qt.GoBoolToInt(NewQRoomVBoxLayoutWithTriggerSlotFromPointer(ptr).EventDefault(std_core.NewQEventFromPointer(e))))) 3867 +} 3868 + 3869 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) EventDefault(e std_core.QEvent_ITF) bool { 3870 + if ptr.Pointer() != nil { 3871 + return C.QRoomVBoxLayoutWithTriggerSlot_EventDefault(ptr.Pointer(), std_core.PointerFromQEvent(e)) != 0 3872 + } 3873 + return false 3874 +} 3875 + 3876 +//export callbackQRoomVBoxLayoutWithTriggerSlot_EventFilter 3877 +func callbackQRoomVBoxLayoutWithTriggerSlot_EventFilter(ptr unsafe.Pointer, watched unsafe.Pointer, event unsafe.Pointer) C.char { 3878 + if signal := qt.GetSignal(ptr, "eventFilter"); signal != nil { 3879 + return C.char(int8(qt.GoBoolToInt(signal.(func(*std_core.QObject, *std_core.QEvent) bool)(std_core.NewQObjectFromPointer(watched), std_core.NewQEventFromPointer(event))))) 3880 + } 3881 + 3882 + return C.char(int8(qt.GoBoolToInt(NewQRoomVBoxLayoutWithTriggerSlotFromPointer(ptr).EventFilterDefault(std_core.NewQObjectFromPointer(watched), std_core.NewQEventFromPointer(event))))) 3883 +} 3884 + 3885 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) EventFilterDefault(watched std_core.QObject_ITF, event std_core.QEvent_ITF) bool { 3886 + if ptr.Pointer() != nil { 3887 + return C.QRoomVBoxLayoutWithTriggerSlot_EventFilterDefault(ptr.Pointer(), std_core.PointerFromQObject(watched), std_core.PointerFromQEvent(event)) != 0 3888 + } 3889 + return false 3890 +} 3891 + 3892 +//export callbackQRoomVBoxLayoutWithTriggerSlot_ConnectNotify 3893 +func callbackQRoomVBoxLayoutWithTriggerSlot_ConnectNotify(ptr unsafe.Pointer, sign unsafe.Pointer) { 3894 + if signal := qt.GetSignal(ptr, "connectNotify"); signal != nil { 3895 + signal.(func(*std_core.QMetaMethod))(std_core.NewQMetaMethodFromPointer(sign)) 3896 + } else { 3897 + NewQRoomVBoxLayoutWithTriggerSlotFromPointer(ptr).ConnectNotifyDefault(std_core.NewQMetaMethodFromPointer(sign)) 3898 + } 3899 +} 3900 + 3901 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) ConnectNotifyDefault(sign std_core.QMetaMethod_ITF) { 3902 + if ptr.Pointer() != nil { 3903 + C.QRoomVBoxLayoutWithTriggerSlot_ConnectNotifyDefault(ptr.Pointer(), std_core.PointerFromQMetaMethod(sign)) 3904 + } 3905 +} 3906 + 3907 +//export callbackQRoomVBoxLayoutWithTriggerSlot_CustomEvent 3908 +func callbackQRoomVBoxLayoutWithTriggerSlot_CustomEvent(ptr unsafe.Pointer, event unsafe.Pointer) { 3909 + if signal := qt.GetSignal(ptr, "customEvent"); signal != nil { 3910 + signal.(func(*std_core.QEvent))(std_core.NewQEventFromPointer(event)) 3911 + } else { 3912 + NewQRoomVBoxLayoutWithTriggerSlotFromPointer(ptr).CustomEventDefault(std_core.NewQEventFromPointer(event)) 3913 + } 3914 +} 3915 + 3916 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) CustomEventDefault(event std_core.QEvent_ITF) { 3917 + if ptr.Pointer() != nil { 3918 + C.QRoomVBoxLayoutWithTriggerSlot_CustomEventDefault(ptr.Pointer(), std_core.PointerFromQEvent(event)) 3919 + } 3920 +} 3921 + 3922 +//export callbackQRoomVBoxLayoutWithTriggerSlot_DeleteLater 3923 +func callbackQRoomVBoxLayoutWithTriggerSlot_DeleteLater(ptr unsafe.Pointer) { 3924 + if signal := qt.GetSignal(ptr, "deleteLater"); signal != nil { 3925 + signal.(func())() 3926 + } else { 3927 + NewQRoomVBoxLayoutWithTriggerSlotFromPointer(ptr).DeleteLaterDefault() 3928 + } 3929 +} 3930 + 3931 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) DeleteLaterDefault() { 3932 + if ptr.Pointer() != nil { 3933 + C.QRoomVBoxLayoutWithTriggerSlot_DeleteLaterDefault(ptr.Pointer()) 3934 + ptr.SetPointer(nil) 3935 + runtime.SetFinalizer(ptr, nil) 3936 + } 3937 +} 3938 + 3939 +//export callbackQRoomVBoxLayoutWithTriggerSlot_Destroyed 3940 +func callbackQRoomVBoxLayoutWithTriggerSlot_Destroyed(ptr unsafe.Pointer, obj unsafe.Pointer) { 3941 + if signal := qt.GetSignal(ptr, "destroyed"); signal != nil { 3942 + signal.(func(*std_core.QObject))(std_core.NewQObjectFromPointer(obj)) 3943 + } 3944 + 3945 +} 3946 + 3947 +//export callbackQRoomVBoxLayoutWithTriggerSlot_DisconnectNotify 3948 +func callbackQRoomVBoxLayoutWithTriggerSlot_DisconnectNotify(ptr unsafe.Pointer, sign unsafe.Pointer) { 3949 + if signal := qt.GetSignal(ptr, "disconnectNotify"); signal != nil { 3950 + signal.(func(*std_core.QMetaMethod))(std_core.NewQMetaMethodFromPointer(sign)) 3951 + } else { 3952 + NewQRoomVBoxLayoutWithTriggerSlotFromPointer(ptr).DisconnectNotifyDefault(std_core.NewQMetaMethodFromPointer(sign)) 3953 + } 3954 +} 3955 + 3956 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) DisconnectNotifyDefault(sign std_core.QMetaMethod_ITF) { 3957 + if ptr.Pointer() != nil { 3958 + C.QRoomVBoxLayoutWithTriggerSlot_DisconnectNotifyDefault(ptr.Pointer(), std_core.PointerFromQMetaMethod(sign)) 3959 + } 3960 +} 3961 + 3962 +//export callbackQRoomVBoxLayoutWithTriggerSlot_ObjectNameChanged 3963 +func callbackQRoomVBoxLayoutWithTriggerSlot_ObjectNameChanged(ptr unsafe.Pointer, objectName C.struct_Moc_PackedString) { 3964 + if signal := qt.GetSignal(ptr, "objectNameChanged"); signal != nil { 3965 + signal.(func(string))(cGoUnpackString(objectName)) 3966 + } 3967 + 3968 +} 3969 + 3970 +//export callbackQRoomVBoxLayoutWithTriggerSlot_TimerEvent 3971 +func callbackQRoomVBoxLayoutWithTriggerSlot_TimerEvent(ptr unsafe.Pointer, event unsafe.Pointer) { 3972 + if signal := qt.GetSignal(ptr, "timerEvent"); signal != nil { 3973 + signal.(func(*std_core.QTimerEvent))(std_core.NewQTimerEventFromPointer(event)) 3974 + } else { 3975 + NewQRoomVBoxLayoutWithTriggerSlotFromPointer(ptr).TimerEventDefault(std_core.NewQTimerEventFromPointer(event)) 3976 + } 3977 +} 3978 + 3979 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) TimerEventDefault(event std_core.QTimerEvent_ITF) { 3980 + if ptr.Pointer() != nil { 3981 + C.QRoomVBoxLayoutWithTriggerSlot_TimerEventDefault(ptr.Pointer(), std_core.PointerFromQTimerEvent(event)) 3982 + } 3983 +} 3984 + 3985 +//export callbackQRoomVBoxLayoutWithTriggerSlot_SpacerItem 3986 +func callbackQRoomVBoxLayoutWithTriggerSlot_SpacerItem(ptr unsafe.Pointer) unsafe.Pointer { 3987 + if signal := qt.GetSignal(ptr, "spacerItem"); signal != nil { 3988 + return std_widgets.PointerFromQSpacerItem(signal.(func() *std_widgets.QSpacerItem)()) 3989 + } 3990 + 3991 + return std_widgets.PointerFromQSpacerItem(NewQRoomVBoxLayoutWithTriggerSlotFromPointer(ptr).SpacerItemDefault()) 3992 +} 3993 + 3994 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) SpacerItemDefault() *std_widgets.QSpacerItem { 3995 + if ptr.Pointer() != nil { 3996 + return std_widgets.NewQSpacerItemFromPointer(C.QRoomVBoxLayoutWithTriggerSlot_SpacerItemDefault(ptr.Pointer())) 3997 + } 3998 + return nil 3999 +} 4000 + 4001 +//export callbackQRoomVBoxLayoutWithTriggerSlot_Widget 4002 +func callbackQRoomVBoxLayoutWithTriggerSlot_Widget(ptr unsafe.Pointer) unsafe.Pointer { 4003 + if signal := qt.GetSignal(ptr, "widget"); signal != nil { 4004 + return std_widgets.PointerFromQWidget(signal.(func() *std_widgets.QWidget)()) 4005 + } 4006 + 4007 + return std_widgets.PointerFromQWidget(NewQRoomVBoxLayoutWithTriggerSlotFromPointer(ptr).WidgetDefault()) 4008 +} 4009 + 4010 +func (ptr *QRoomVBoxLayoutWithTriggerSlot) WidgetDefault() *std_widgets.QWidget { 4011 + if ptr.Pointer() != nil { 4012 + var tmpValue = std_widgets.NewQWidgetFromPointer(C.QRoomVBoxLayoutWithTriggerSlot_WidgetDefault(ptr.Pointer())) 4013 + if !qt.ExistsSignal(tmpValue.Pointer(), "destroyed") { 4014 + tmpValue.ConnectDestroyed(func(*std_core.QObject) { tmpValue.SetPointer(nil) }) 4015 + } 4016 + return tmpValue 4017 + } 4018 + return nil 4019 +} 4020 + 4021 +type QVBoxLayoutWithTriggerSlot_ITF interface { 4022 + std_widgets.QVBoxLayout_ITF 4023 + QVBoxLayoutWithTriggerSlot_PTR() *QVBoxLayoutWithTriggerSlot 4024 +} 4025 + 4026 +func (ptr *QVBoxLayoutWithTriggerSlot) QVBoxLayoutWithTriggerSlot_PTR() *QVBoxLayoutWithTriggerSlot { 4027 + return ptr 4028 +} 4029 + 4030 +func (ptr *QVBoxLayoutWithTriggerSlot) Pointer() unsafe.Pointer { 4031 + if ptr != nil { 4032 + return ptr.QVBoxLayout_PTR().Pointer() 4033 + } 4034 + return nil 4035 +} 4036 + 4037 +func (ptr *QVBoxLayoutWithTriggerSlot) SetPointer(p unsafe.Pointer) { 4038 + if ptr != nil { 4039 + ptr.QVBoxLayout_PTR().SetPointer(p) 4040 + } 4041 +} 4042 + 4043 +func PointerFromQVBoxLayoutWithTriggerSlot(ptr QVBoxLayoutWithTriggerSlot_ITF) unsafe.Pointer { 4044 + if ptr != nil { 4045 + return ptr.QVBoxLayoutWithTriggerSlot_PTR().Pointer() 4046 + } 4047 + return nil 4048 +} 4049 + 4050 +func NewQVBoxLayoutWithTriggerSlotFromPointer(ptr unsafe.Pointer) *QVBoxLayoutWithTriggerSlot { 4051 + var n *QVBoxLayoutWithTriggerSlot 4052 + if gPtr, ok := qt.Receive(ptr); !ok { 4053 + n = new(QVBoxLayoutWithTriggerSlot) 4054 + n.SetPointer(ptr) 4055 + } else { 4056 + switch deduced := gPtr.(type) { 4057 + case *QVBoxLayoutWithTriggerSlot: 4058 + n = deduced 4059 + 4060 + case *std_widgets.QVBoxLayout: 4061 + n = &QVBoxLayoutWithTriggerSlot{QVBoxLayout: *deduced} 4062 + 4063 + default: 4064 + n = new(QVBoxLayoutWithTriggerSlot) 4065 + n.SetPointer(ptr) 4066 + } 4067 + } 4068 + return n 4069 +} 4070 + 4071 +//export callbackQVBoxLayoutWithTriggerSlot_Constructor 4072 +func callbackQVBoxLayoutWithTriggerSlot_Constructor(ptr unsafe.Pointer) { 4073 + gPtr := NewQVBoxLayoutWithTriggerSlotFromPointer(ptr) 4074 + qt.Register(ptr, gPtr) 4075 +} 4076 + 4077 +//export callbackQVBoxLayoutWithTriggerSlot_TriggerMessage 4078 +func callbackQVBoxLayoutWithTriggerSlot_TriggerMessage(ptr unsafe.Pointer, messageBody C.struct_Moc_PackedString, sender C.struct_Moc_PackedString, timestamp C.longlong) { 4079 + if signal := qt.GetSignal(ptr, "TriggerMessage"); signal != nil { 4080 + signal.(func(string, string, int64))(cGoUnpackString(messageBody), cGoUnpackString(sender), int64(timestamp)) 4081 + } 4082 + 4083 +} 4084 + 4085 +func (ptr *QVBoxLayoutWithTriggerSlot) ConnectTriggerMessage(f func(messageBody string, sender string, timestamp int64)) { 4086 + if ptr.Pointer() != nil { 4087 + 4088 + if !qt.ExistsSignal(ptr.Pointer(), "TriggerMessage") { 4089 + C.QVBoxLayoutWithTriggerSlot_ConnectTriggerMessage(ptr.Pointer()) 4090 + } 4091 + 4092 + if signal := qt.LendSignal(ptr.Pointer(), "TriggerMessage"); signal != nil { 4093 + qt.ConnectSignal(ptr.Pointer(), "TriggerMessage", func(messageBody string, sender string, timestamp int64) { 4094 + signal.(func(string, string, int64))(messageBody, sender, timestamp) 4095 + f(messageBody, sender, timestamp) 4096 + }) 4097 + } else { 4098 + qt.ConnectSignal(ptr.Pointer(), "TriggerMessage", f) 4099 + } 4100 + } 4101 +} 4102 + 4103 +func (ptr *QVBoxLayoutWithTriggerSlot) DisconnectTriggerMessage() { 4104 + if ptr.Pointer() != nil { 4105 + C.QVBoxLayoutWithTriggerSlot_DisconnectTriggerMessage(ptr.Pointer()) 4106 + qt.DisconnectSignal(ptr.Pointer(), "TriggerMessage") 4107 + } 4108 +} 4109 + 4110 +func (ptr *QVBoxLayoutWithTriggerSlot) TriggerMessage(messageBody string, sender string, timestamp int64) { 4111 + if ptr.Pointer() != nil { 4112 + var messageBodyC *C.char 4113 + if messageBody != "" { 4114 + messageBodyC = C.CString(messageBody) 4115 + defer C.free(unsafe.Pointer(messageBodyC)) 4116 + } 4117 + var senderC *C.char 4118 + if sender != "" { 4119 + senderC = C.CString(sender) 4120 + defer C.free(unsafe.Pointer(senderC)) 4121 + } 4122 + C.QVBoxLayoutWithTriggerSlot_TriggerMessage(ptr.Pointer(), C.struct_Moc_PackedString{data: messageBodyC, len: C.longlong(len(messageBody))}, C.struct_Moc_PackedString{data: senderC, len: C.longlong(len(sender))}, C.longlong(timestamp)) 4123 + } 4124 +} 4125 + 4126 +func QVBoxLayoutWithTriggerSlot_QRegisterMetaType() int { 4127 + return int(int32(C.QVBoxLayoutWithTriggerSlot_QVBoxLayoutWithTriggerSlot_QRegisterMetaType())) 4128 +} 4129 + 4130 +func (ptr *QVBoxLayoutWithTriggerSlot) QRegisterMetaType() int { 4131 + return int(int32(C.QVBoxLayoutWithTriggerSlot_QVBoxLayoutWithTriggerSlot_QRegisterMetaType())) 4132 +} 4133 + 4134 +func QVBoxLayoutWithTriggerSlot_QRegisterMetaType2(typeName string) int { 4135 + var typeNameC *C.char 4136 + if typeName != "" { 4137 + typeNameC = C.CString(typeName) 4138 + defer C.free(unsafe.Pointer(typeNameC)) 4139 + } 4140 + return int(int32(C.QVBoxLayoutWithTriggerSlot_QVBoxLayoutWithTriggerSlot_QRegisterMetaType2(typeNameC))) 4141 +} 4142 + 4143 +func (ptr *QVBoxLayoutWithTriggerSlot) QRegisterMetaType2(typeName string) int { 4144 + var typeNameC *C.char 4145 + if typeName != "" { 4146 + typeNameC = C.CString(typeName) 4147 + defer C.free(unsafe.Pointer(typeNameC)) 4148 + } 4149 + return int(int32(C.QVBoxLayoutWithTriggerSlot_QVBoxLayoutWithTriggerSlot_QRegisterMetaType2(typeNameC))) 4150 +} 4151 + 4152 +func QVBoxLayoutWithTriggerSlot_QmlRegisterType() int { 4153 + return int(int32(C.QVBoxLayoutWithTriggerSlot_QVBoxLayoutWithTriggerSlot_QmlRegisterType())) 4154 +} 4155 + 4156 +func (ptr *QVBoxLayoutWithTriggerSlot) QmlRegisterType() int { 4157 + return int(int32(C.QVBoxLayoutWithTriggerSlot_QVBoxLayoutWithTriggerSlot_QmlRegisterType())) 4158 +} 4159 + 4160 +func QVBoxLayoutWithTriggerSlot_QmlRegisterType2(uri string, versionMajor int, versionMinor int, qmlName string) int { 4161 + var uriC *C.char 4162 + if uri != "" { 4163 + uriC = C.CString(uri) 4164 + defer C.free(unsafe.Pointer(uriC)) 4165 + } 4166 + var qmlNameC *C.char 4167 + if qmlName != "" { 4168 + qmlNameC = C.CString(qmlName) 4169 + defer C.free(unsafe.Pointer(qmlNameC)) 4170 + } 4171 + return int(int32(C.QVBoxLayoutWithTriggerSlot_QVBoxLayoutWithTriggerSlot_QmlRegisterType2(uriC, C.int(int32(versionMajor)), C.int(int32(versionMinor)), qmlNameC))) 4172 +} 4173 + 4174 +func (ptr *QVBoxLayoutWithTriggerSlot) QmlRegisterType2(uri string, versionMajor int, versionMinor int, qmlName string) int { 4175 + var uriC *C.char 4176 + if uri != "" { 4177 + uriC = C.CString(uri) 4178 + defer C.free(unsafe.Pointer(uriC)) 4179 + } 4180 + var qmlNameC *C.char 4181 + if qmlName != "" { 4182 + qmlNameC = C.CString(qmlName) 4183 + defer C.free(unsafe.Pointer(qmlNameC)) 4184 + } 4185 + return int(int32(C.QVBoxLayoutWithTriggerSlot_QVBoxLayoutWithTriggerSlot_QmlRegisterType2(uriC, C.int(int32(versionMajor)), C.int(int32(versionMinor)), qmlNameC))) 4186 +} 4187 + 4188 +func (ptr *QVBoxLayoutWithTriggerSlot) __dynamicPropertyNames_atList(i int) *std_core.QByteArray { 4189 + if ptr.Pointer() != nil { 4190 + var tmpValue = std_core.NewQByteArrayFromPointer(C.QVBoxLayoutWithTriggerSlot___dynamicPropertyNames_atList(ptr.Pointer(), C.int(int32(i)))) 4191 + runtime.SetFinalizer(tmpValue, (*std_core.QByteArray).DestroyQByteArray) 4192 + return tmpValue 4193 + } 4194 + return nil 4195 +} 4196 + 4197 +func (ptr *QVBoxLayoutWithTriggerSlot) __dynamicPropertyNames_setList(i std_core.QByteArray_ITF) { 4198 + if ptr.Pointer() != nil { 4199 + C.QVBoxLayoutWithTriggerSlot___dynamicPropertyNames_setList(ptr.Pointer(), std_core.PointerFromQByteArray(i)) 4200 + } 4201 +} 4202 + 4203 +func (ptr *QVBoxLayoutWithTriggerSlot) __dynamicPropertyNames_newList() unsafe.Pointer { 4204 + return unsafe.Pointer(C.QVBoxLayoutWithTriggerSlot___dynamicPropertyNames_newList(ptr.Pointer())) 4205 +} 4206 + 4207 +func (ptr *QVBoxLayoutWithTriggerSlot) __findChildren_atList2(i int) *std_core.QObject { 4208 + if ptr.Pointer() != nil { 4209 + var tmpValue = std_core.NewQObjectFromPointer(C.QVBoxLayoutWithTriggerSlot___findChildren_atList2(ptr.Pointer(), C.int(int32(i)))) 4210 + if !qt.ExistsSignal(tmpValue.Pointer(), "destroyed") { 4211 + tmpValue.ConnectDestroyed(func(*std_core.QObject) { tmpValue.SetPointer(nil) }) 4212 + } 4213 + return tmpValue 4214 + } 4215 + return nil 4216 +} 4217 + 4218 +func (ptr *QVBoxLayoutWithTriggerSlot) __findChildren_setList2(i std_core.QObject_ITF) { 4219 + if ptr.Pointer() != nil { 4220 + C.QVBoxLayoutWithTriggerSlot___findChildren_setList2(ptr.Pointer(), std_core.PointerFromQObject(i)) 4221 + } 4222 +} 4223 + 4224 +func (ptr *QVBoxLayoutWithTriggerSlot) __findChildren_newList2() unsafe.Pointer { 4225 + return unsafe.Pointer(C.QVBoxLayoutWithTriggerSlot___findChildren_newList2(ptr.Pointer())) 4226 +} 4227 + 4228 +func (ptr *QVBoxLayoutWithTriggerSlot) __findChildren_atList3(i int) *std_core.QObject { 4229 + if ptr.Pointer() != nil { 4230 + var tmpValue = std_core.NewQObjectFromPointer(C.QVBoxLayoutWithTriggerSlot___findChildren_atList3(ptr.Pointer(), C.int(int32(i)))) 4231 + if !qt.ExistsSignal(tmpValue.Pointer(), "destroyed") { 4232 + tmpValue.ConnectDestroyed(func(*std_core.QObject) { tmpValue.SetPointer(nil) }) 4233 + } 4234 + return tmpValue 4235 + } 4236 + return nil 4237 +} 4238 + 4239 +func (ptr *QVBoxLayoutWithTriggerSlot) __findChildren_setList3(i std_core.QObject_ITF) { 4240 + if ptr.Pointer() != nil { 4241 + C.QVBoxLayoutWithTriggerSlot___findChildren_setList3(ptr.Pointer(), std_core.PointerFromQObject(i)) 4242 + } 4243 +} 4244 + 4245 +func (ptr *QVBoxLayoutWithTriggerSlot) __findChildren_newList3() unsafe.Pointer { 4246 + return unsafe.Pointer(C.QVBoxLayoutWithTriggerSlot___findChildren_newList3(ptr.Pointer())) 4247 +} 4248 + 4249 +func (ptr *QVBoxLayoutWithTriggerSlot) __findChildren_atList(i int) *std_core.QObject { 4250 + if ptr.Pointer() != nil { 4251 + var tmpValue = std_core.NewQObjectFromPointer(C.QVBoxLayoutWithTriggerSlot___findChildren_atList(ptr.Pointer(), C.int(int32(i)))) 4252 + if !qt.ExistsSignal(tmpValue.Pointer(), "destroyed") { 4253 + tmpValue.ConnectDestroyed(func(*std_core.QObject) { tmpValue.SetPointer(nil) }) 4254 + } 4255 + return tmpValue 4256 + } 4257 + return nil 4258 +} 4259 + 4260 +func (ptr *QVBoxLayoutWithTriggerSlot) __findChildren_setList(i std_core.QObject_ITF) { 4261 + if ptr.Pointer() != nil { 4262 + C.QVBoxLayoutWithTriggerSlot___findChildren_setList(ptr.Pointer(), std_core.PointerFromQObject(i)) 4263 + } 4264 +} 4265 + 4266 +func (ptr *QVBoxLayoutWithTriggerSlot) __findChildren_newList() unsafe.Pointer { 4267 + return unsafe.Pointer(C.QVBoxLayoutWithTriggerSlot___findChildren_newList(ptr.Pointer())) 4268 +} 4269 + 4270 +func (ptr *QVBoxLayoutWithTriggerSlot) __children_atList(i int) *std_core.QObject { 4271 + if ptr.Pointer() != nil { 4272 + var tmpValue = std_core.NewQObjectFromPointer(C.QVBoxLayoutWithTriggerSlot___children_atList(ptr.Pointer(), C.int(int32(i)))) 4273 + if !qt.ExistsSignal(tmpValue.Pointer(), "destroyed") { 4274 + tmpValue.ConnectDestroyed(func(*std_core.QObject) { tmpValue.SetPointer(nil) }) 4275 + } 4276 + return tmpValue 4277 + } 4278 + return nil 4279 +} 4280 + 4281 +func (ptr *QVBoxLayoutWithTriggerSlot) __children_setList(i std_core.QObject_ITF) { 4282 + if ptr.Pointer() != nil { 4283 + C.QVBoxLayoutWithTriggerSlot___children_setList(ptr.Pointer(), std_core.PointerFromQObject(i)) 4284 + } 4285 +} 4286 + 4287 +func (ptr *QVBoxLayoutWithTriggerSlot) __children_newList() unsafe.Pointer { 4288 + return unsafe.Pointer(C.QVBoxLayoutWithTriggerSlot___children_newList(ptr.Pointer())) 4289 +} 4290 + 4291 +func NewQVBoxLayoutWithTriggerSlot() *QVBoxLayoutWithTriggerSlot { 4292 + var tmpValue = NewQVBoxLayoutWithTriggerSlotFromPointer(C.QVBoxLayoutWithTriggerSlot_NewQVBoxLayoutWithTriggerSlot()) 4293 + if !qt.ExistsSignal(tmpValue.Pointer(), "destroyed") { 4294 + tmpValue.ConnectDestroyed(func(*std_core.QObject) { tmpValue.SetPointer(nil) }) 4295 + } 4296 + return tmpValue 4297 +} 4298 + 4299 +func NewQVBoxLayoutWithTriggerSlot2(parent std_widgets.QWidget_ITF) *QVBoxLayoutWithTriggerSlot { 4300 + var tmpValue = NewQVBoxLayoutWithTriggerSlotFromPointer(C.QVBoxLayoutWithTriggerSlot_NewQVBoxLayoutWithTriggerSlot2(std_widgets.PointerFromQWidget(parent))) 4301 + if !qt.ExistsSignal(tmpValue.Pointer(), "destroyed") { 4302 + tmpValue.ConnectDestroyed(func(*std_core.QObject) { tmpValue.SetPointer(nil) }) 4303 + } 4304 + return tmpValue 4305 +} 4306 + 4307 +func (ptr *QVBoxLayoutWithTriggerSlot) DestroyQVBoxLayoutWithTriggerSlot() { 4308 + if ptr.Pointer() != nil { 4309 + C.QVBoxLayoutWithTriggerSlot_DestroyQVBoxLayoutWithTriggerSlot(ptr.Pointer()) 4310 + ptr.SetPointer(nil) 4311 + runtime.SetFinalizer(ptr, nil) 4312 + } 4313 +} 4314 + 4315 +//export callbackQVBoxLayoutWithTriggerSlot_TakeAt 4316 +func callbackQVBoxLayoutWithTriggerSlot_TakeAt(ptr unsafe.Pointer, index C.int) unsafe.Pointer { 4317 + if signal := qt.GetSignal(ptr, "takeAt"); signal != nil { 4318 + return std_widgets.PointerFromQLayoutItem(signal.(func(int) *std_widgets.QLayoutItem)(int(int32(index)))) 4319 + } 4320 + 4321 + return std_widgets.PointerFromQLayoutItem(NewQVBoxLayoutWithTriggerSlotFromPointer(ptr).TakeAtDefault(int(int32(index)))) 4322 +} 4323 + 4324 +func (ptr *QVBoxLayoutWithTriggerSlot) TakeAtDefault(index int) *std_widgets.QLayoutItem { 4325 + if ptr.Pointer() != nil { 4326 + return std_widgets.NewQLayoutItemFromPointer(C.QVBoxLayoutWithTriggerSlot_TakeAtDefault(ptr.Pointer(), C.int(int32(index)))) 4327 + } 4328 + return nil 4329 +} 4330 + 4331 +//export callbackQVBoxLayoutWithTriggerSlot_AddItem 4332 +func callbackQVBoxLayoutWithTriggerSlot_AddItem(ptr unsafe.Pointer, item unsafe.Pointer) { 4333 + if signal := qt.GetSignal(ptr, "addItem"); signal != nil { 4334 + signal.(func(*std_widgets.QLayoutItem))(std_widgets.NewQLayoutItemFromPointer(item)) 4335 + } else { 4336 + NewQVBoxLayoutWithTriggerSlotFromPointer(ptr).AddItemDefault(std_widgets.NewQLayoutItemFromPointer(item)) 4337 + } 4338 +} 4339 + 4340 +func (ptr *QVBoxLayoutWithTriggerSlot) AddItemDefault(item std_widgets.QLayoutItem_ITF) { 4341 + if ptr.Pointer() != nil { 4342 + C.QVBoxLayoutWithTriggerSlot_AddItemDefault(ptr.Pointer(), std_widgets.PointerFromQLayoutItem(item)) 4343 + } 4344 +} 4345 + 4346 +//export callbackQVBoxLayoutWithTriggerSlot_Invalidate 4347 +func callbackQVBoxLayoutWithTriggerSlot_Invalidate(ptr unsafe.Pointer) { 4348 + if signal := qt.GetSignal(ptr, "invalidate"); signal != nil { 4349 + signal.(func())() 4350 + } else { 4351 + NewQVBoxLayoutWithTriggerSlotFromPointer(ptr).InvalidateDefault() 4352 + } 4353 +} 4354 + 4355 +func (ptr *QVBoxLayoutWithTriggerSlot) InvalidateDefault() { 4356 + if ptr.Pointer() != nil { 4357 + C.QVBoxLayoutWithTriggerSlot_InvalidateDefault(ptr.Pointer()) 4358 + } 4359 +} 4360 + 4361 +//export callbackQVBoxLayoutWithTriggerSlot_SetGeometry 4362 +func callbackQVBoxLayoutWithTriggerSlot_SetGeometry(ptr unsafe.Pointer, r unsafe.Pointer) { 4363 + if signal := qt.GetSignal(ptr, "setGeometry"); signal != nil { 4364 + signal.(func(*std_core.QRect))(std_core.NewQRectFromPointer(r)) 4365 + } else { 4366 + NewQVBoxLayoutWithTriggerSlotFromPointer(ptr).SetGeometryDefault(std_core.NewQRectFromPointer(r)) 4367 + } 4368 +} 4369 + 4370 +func (ptr *QVBoxLayoutWithTriggerSlot) SetGeometryDefault(r std_core.QRect_ITF) { 4371 + if ptr.Pointer() != nil { 4372 + C.QVBoxLayoutWithTriggerSlot_SetGeometryDefault(ptr.Pointer(), std_core.PointerFromQRect(r)) 4373 + } 4374 +} 4375 + 4376 +//export callbackQVBoxLayoutWithTriggerSlot_ItemAt 4377 +func callbackQVBoxLayoutWithTriggerSlot_ItemAt(ptr unsafe.Pointer, index C.int) unsafe.Pointer { 4378 + if signal := qt.GetSignal(ptr, "itemAt"); signal != nil { 4379 + return std_widgets.PointerFromQLayoutItem(signal.(func(int) *std_widgets.QLayoutItem)(int(int32(index)))) 4380 + } 4381 + 4382 + return std_widgets.PointerFromQLayoutItem(NewQVBoxLayoutWithTriggerSlotFromPointer(ptr).ItemAtDefault(int(int32(index)))) 4383 +} 4384 + 4385 +func (ptr *QVBoxLayoutWithTriggerSlot) ItemAtDefault(index int) *std_widgets.QLayoutItem { 4386 + if ptr.Pointer() != nil { 4387 + return std_widgets.NewQLayoutItemFromPointer(C.QVBoxLayoutWithTriggerSlot_ItemAtDefault(ptr.Pointer(), C.int(int32(index)))) 4388 + } 4389 + return nil 4390 +} 4391 + 4392 +//export callbackQVBoxLayoutWithTriggerSlot_MaximumSize 4393 +func callbackQVBoxLayoutWithTriggerSlot_MaximumSize(ptr unsafe.Pointer) unsafe.Pointer { 4394 + if signal := qt.GetSignal(ptr, "maximumSize"); signal != nil { 4395 + return std_core.PointerFromQSize(signal.(func() *std_core.QSize)()) 4396 + } 4397 + 4398 + return std_core.PointerFromQSize(NewQVBoxLayoutWithTriggerSlotFromPointer(ptr).MaximumSizeDefault()) 4399 +} 4400 + 4401 +func (ptr *QVBoxLayoutWithTriggerSlot) MaximumSizeDefault() *std_core.QSize { 4402 + if ptr.Pointer() != nil { 4403 + var tmpValue = std_core.NewQSizeFromPointer(C.QVBoxLayoutWithTriggerSlot_MaximumSizeDefault(ptr.Pointer())) 4404 + runtime.SetFinalizer(tmpValue, (*std_core.QSize).DestroyQSize) 4405 + return tmpValue 4406 + } 4407 + return nil 4408 +} 4409 + 4410 +//export callbackQVBoxLayoutWithTriggerSlot_MinimumSize 4411 +func callbackQVBoxLayoutWithTriggerSlot_MinimumSize(ptr unsafe.Pointer) unsafe.Pointer { 4412 + if signal := qt.GetSignal(ptr, "minimumSize"); signal != nil { 4413 + return std_core.PointerFromQSize(signal.(func() *std_core.QSize)()) 4414 + } 4415 + 4416 + return std_core.PointerFromQSize(NewQVBoxLayoutWithTriggerSlotFromPointer(ptr).MinimumSizeDefault()) 4417 +} 4418 + 4419 +func (ptr *QVBoxLayoutWithTriggerSlot) MinimumSizeDefault() *std_core.QSize { 4420 + if ptr.Pointer() != nil { 4421 + var tmpValue = std_core.NewQSizeFromPointer(C.QVBoxLayoutWithTriggerSlot_MinimumSizeDefault(ptr.Pointer())) 4422 + runtime.SetFinalizer(tmpValue, (*std_core.QSize).DestroyQSize) 4423 + return tmpValue 4424 + } 4425 + return nil 4426 +} 4427 + 4428 +//export callbackQVBoxLayoutWithTriggerSlot_SizeHint 4429 +func callbackQVBoxLayoutWithTriggerSlot_SizeHint(ptr unsafe.Pointer) unsafe.Pointer { 4430 + if signal := qt.GetSignal(ptr, "sizeHint"); signal != nil { 4431 + return std_core.PointerFromQSize(signal.(func() *std_core.QSize)()) 4432 + } 4433 + 4434 + return std_core.PointerFromQSize(NewQVBoxLayoutWithTriggerSlotFromPointer(ptr).SizeHintDefault()) 4435 +} 4436 + 4437 +func (ptr *QVBoxLayoutWithTriggerSlot) SizeHintDefault() *std_core.QSize { 4438 + if ptr.Pointer() != nil { 4439 + var tmpValue = std_core.NewQSizeFromPointer(C.QVBoxLayoutWithTriggerSlot_SizeHintDefault(ptr.Pointer())) 4440 + runtime.SetFinalizer(tmpValue, (*std_core.QSize).DestroyQSize) 4441 + return tmpValue 4442 + } 4443 + return nil 4444 +} 4445 + 4446 +//export callbackQVBoxLayoutWithTriggerSlot_ExpandingDirections 4447 +func callbackQVBoxLayoutWithTriggerSlot_ExpandingDirections(ptr unsafe.Pointer) C.longlong { 4448 + if signal := qt.GetSignal(ptr, "expandingDirections"); signal != nil { 4449 + return C.longlong(signal.(func() std_core.Qt__Orientation)()) 4450 + } 4451 + 4452 + return C.longlong(NewQVBoxLayoutWithTriggerSlotFromPointer(ptr).ExpandingDirectionsDefault()) 4453 +} 4454 + 4455 +func (ptr *QVBoxLayoutWithTriggerSlot) ExpandingDirectionsDefault() std_core.Qt__Orientation { 4456 + if ptr.Pointer() != nil { 4457 + return std_core.Qt__Orientation(C.QVBoxLayoutWithTriggerSlot_ExpandingDirectionsDefault(ptr.Pointer())) 4458 + } 4459 + return 0 4460 +} 4461 + 4462 +//export callbackQVBoxLayoutWithTriggerSlot_HasHeightForWidth 4463 +func callbackQVBoxLayoutWithTriggerSlot_HasHeightForWidth(ptr unsafe.Pointer) C.char { 4464 + if signal := qt.GetSignal(ptr, "hasHeightForWidth"); signal != nil { 4465 + return C.char(int8(qt.GoBoolToInt(signal.(func() bool)()))) 4466 + } 4467 + 4468 + return C.char(int8(qt.GoBoolToInt(NewQVBoxLayoutWithTriggerSlotFromPointer(ptr).HasHeightForWidthDefault()))) 4469 +} 4470 + 4471 +func (ptr *QVBoxLayoutWithTriggerSlot) HasHeightForWidthDefault() bool { 4472 + if ptr.Pointer() != nil { 4473 + return C.QVBoxLayoutWithTriggerSlot_HasHeightForWidthDefault(ptr.Pointer()) != 0 4474 + } 4475 + return false 4476 +} 4477 + 4478 +//export callbackQVBoxLayoutWithTriggerSlot_Count 4479 +func callbackQVBoxLayoutWithTriggerSlot_Count(ptr unsafe.Pointer) C.int { 4480 + if signal := qt.GetSignal(ptr, "count"); signal != nil { 4481 + return C.int(int32(signal.(func() int)())) 4482 + } 4483 + 4484 + return C.int(int32(NewQVBoxLayoutWithTriggerSlotFromPointer(ptr).CountDefault())) 4485 +} 4486 + 4487 +func (ptr *QVBoxLayoutWithTriggerSlot) CountDefault() int { 4488 + if ptr.Pointer() != nil { 4489 + return int(int32(C.QVBoxLayoutWithTriggerSlot_CountDefault(ptr.Pointer()))) 4490 + } 4491 + return 0 4492 +} 4493 + 4494 +//export callbackQVBoxLayoutWithTriggerSlot_HeightForWidth 4495 +func callbackQVBoxLayoutWithTriggerSlot_HeightForWidth(ptr unsafe.Pointer, w C.int) C.int { 4496 + if signal := qt.GetSignal(ptr, "heightForWidth"); signal != nil { 4497 + return C.int(int32(signal.(func(int) int)(int(int32(w))))) 4498 + } 4499 + 4500 + return C.int(int32(NewQVBoxLayoutWithTriggerSlotFromPointer(ptr).HeightForWidthDefault(int(int32(w))))) 4501 +} 4502 + 4503 +func (ptr *QVBoxLayoutWithTriggerSlot) HeightForWidthDefault(w int) int { 4504 + if ptr.Pointer() != nil { 4505 + return int(int32(C.QVBoxLayoutWithTriggerSlot_HeightForWidthDefault(ptr.Pointer(), C.int(int32(w))))) 4506 + } 4507 + return 0 4508 +} 4509 + 4510 +//export callbackQVBoxLayoutWithTriggerSlot_MinimumHeightForWidth 4511 +func callbackQVBoxLayoutWithTriggerSlot_MinimumHeightForWidth(ptr unsafe.Pointer, w C.int) C.int { 4512 + if signal := qt.GetSignal(ptr, "minimumHeightForWidth"); signal != nil { 4513 + return C.int(int32(signal.(func(int) int)(int(int32(w))))) 4514 + } 4515 + 4516 + return C.int(int32(NewQVBoxLayoutWithTriggerSlotFromPointer(ptr).MinimumHeightForWidthDefault(int(int32(w))))) 4517 +} 4518 + 4519 +func (ptr *QVBoxLayoutWithTriggerSlot) MinimumHeightForWidthDefault(w int) int { 4520 + if ptr.Pointer() != nil { 4521 + return int(int32(C.QVBoxLayoutWithTriggerSlot_MinimumHeightForWidthDefault(ptr.Pointer(), C.int(int32(w))))) 4522 + } 4523 + return 0 4524 +} 4525 + 4526 +//export callbackQVBoxLayoutWithTriggerSlot_Layout 4527 +func callbackQVBoxLayoutWithTriggerSlot_Layout(ptr unsafe.Pointer) unsafe.Pointer { 4528 + if signal := qt.GetSignal(ptr, "layout"); signal != nil { 4529 + return std_widgets.PointerFromQLayout(signal.(func() *std_widgets.QLayout)()) 4530 + } 4531 + 4532 + return std_widgets.PointerFromQLayout(NewQVBoxLayoutWithTriggerSlotFromPointer(ptr).LayoutDefault()) 4533 +} 4534 + 4535 +func (ptr *QVBoxLayoutWithTriggerSlot) LayoutDefault() *std_widgets.QLayout { 4536 + if ptr.Pointer() != nil { 4537 + var tmpValue = std_widgets.NewQLayoutFromPointer(C.QVBoxLayoutWithTriggerSlot_LayoutDefault(ptr.Pointer())) 4538 + if !qt.ExistsSignal(tmpValue.Pointer(), "destroyed") { 4539 + tmpValue.ConnectDestroyed(func(*std_core.QObject) { tmpValue.SetPointer(nil) }) 4540 + } 4541 + return tmpValue 4542 + } 4543 + return nil 4544 +} 4545 + 4546 +//export callbackQVBoxLayoutWithTriggerSlot_ChildEvent 4547 +func callbackQVBoxLayoutWithTriggerSlot_ChildEvent(ptr unsafe.Pointer, e unsafe.Pointer) { 4548 + if signal := qt.GetSignal(ptr, "childEvent"); signal != nil { 4549 + signal.(func(*std_core.QChildEvent))(std_core.NewQChildEventFromPointer(e)) 4550 + } else { 4551 + NewQVBoxLayoutWithTriggerSlotFromPointer(ptr).ChildEventDefault(std_core.NewQChildEventFromPointer(e)) 4552 + } 4553 +} 4554 + 4555 +func (ptr *QVBoxLayoutWithTriggerSlot) ChildEventDefault(e std_core.QChildEvent_ITF) { 4556 + if ptr.Pointer() != nil { 4557 + C.QVBoxLayoutWithTriggerSlot_ChildEventDefault(ptr.Pointer(), std_core.PointerFromQChildEvent(e)) 4558 + } 4559 +} 4560 + 4561 +//export callbackQVBoxLayoutWithTriggerSlot_Geometry 4562 +func callbackQVBoxLayoutWithTriggerSlot_Geometry(ptr unsafe.Pointer) unsafe.Pointer { 4563 + if signal := qt.GetSignal(ptr, "geometry"); signal != nil { 4564 + return std_core.PointerFromQRect(signal.(func() *std_core.QRect)()) 4565 + } 4566 + 4567 + return std_core.PointerFromQRect(NewQVBoxLayoutWithTriggerSlotFromPointer(ptr).GeometryDefault()) 4568 +} 4569 + 4570 +func (ptr *QVBoxLayoutWithTriggerSlot) GeometryDefault() *std_core.QRect { 4571 + if ptr.Pointer() != nil { 4572 + var tmpValue = std_core.NewQRectFromPointer(C.QVBoxLayoutWithTriggerSlot_GeometryDefault(ptr.Pointer())) 4573 + runtime.SetFinalizer(tmpValue, (*std_core.QRect).DestroyQRect) 4574 + return tmpValue 4575 + } 4576 + return nil 4577 +} 4578 + 4579 +//export callbackQVBoxLayoutWithTriggerSlot_ControlTypes 4580 +func callbackQVBoxLayoutWithTriggerSlot_ControlTypes(ptr unsafe.Pointer) C.longlong { 4581 + if signal := qt.GetSignal(ptr, "controlTypes"); signal != nil { 4582 + return C.longlong(signal.(func() std_widgets.QSizePolicy__ControlType)()) 4583 + } 4584 + 4585 + return C.longlong(NewQVBoxLayoutWithTriggerSlotFromPointer(ptr).ControlTypesDefault()) 4586 +} 4587 + 4588 +func (ptr *QVBoxLayoutWithTriggerSlot) ControlTypesDefault() std_widgets.QSizePolicy__ControlType { 4589 + if ptr.Pointer() != nil { 4590 + return std_widgets.QSizePolicy__ControlType(C.QVBoxLayoutWithTriggerSlot_ControlTypesDefault(ptr.Pointer())) 4591 + } 4592 + return 0 4593 +} 4594 + 4595 +//export callbackQVBoxLayoutWithTriggerSlot_IsEmpty 4596 +func callbackQVBoxLayoutWithTriggerSlot_IsEmpty(ptr unsafe.Pointer) C.char { 4597 + if signal := qt.GetSignal(ptr, "isEmpty"); signal != nil { 4598 + return C.char(int8(qt.GoBoolToInt(signal.(func() bool)()))) 4599 + } 4600 + 4601 + return C.char(int8(qt.GoBoolToInt(NewQVBoxLayoutWithTriggerSlotFromPointer(ptr).IsEmptyDefault()))) 4602 +} 4603 + 4604 +func (ptr *QVBoxLayoutWithTriggerSlot) IsEmptyDefault() bool { 4605 + if ptr.Pointer() != nil { 4606 + return C.QVBoxLayoutWithTriggerSlot_IsEmptyDefault(ptr.Pointer()) != 0 4607 + } 4608 + return false 4609 +} 4610 + 4611 +//export callbackQVBoxLayoutWithTriggerSlot_IndexOf 4612 +func callbackQVBoxLayoutWithTriggerSlot_IndexOf(ptr unsafe.Pointer, widget unsafe.Pointer) C.int { 4613 + if signal := qt.GetSignal(ptr, "indexOf"); signal != nil { 4614 + return C.int(int32(signal.(func(*std_widgets.QWidget) int)(std_widgets.NewQWidgetFromPointer(widget)))) 4615 + } 4616 + 4617 + return C.int(int32(NewQVBoxLayoutWithTriggerSlotFromPointer(ptr).IndexOfDefault(std_widgets.NewQWidgetFromPointer(widget)))) 4618 +} 4619 + 4620 +func (ptr *QVBoxLayoutWithTriggerSlot) IndexOfDefault(widget std_widgets.QWidget_ITF) int { 4621 + if ptr.Pointer() != nil { 4622 + return int(int32(C.QVBoxLayoutWithTriggerSlot_IndexOfDefault(ptr.Pointer(), std_widgets.PointerFromQWidget(widget)))) 4623 + } 4624 + return 0 4625 +} 4626 + 4627 +//export callbackQVBoxLayoutWithTriggerSlot_Event 4628 +func callbackQVBoxLayoutWithTriggerSlot_Event(ptr unsafe.Pointer, e unsafe.Pointer) C.char { 4629 + if signal := qt.GetSignal(ptr, "event"); signal != nil { 4630 + return C.char(int8(qt.GoBoolToInt(signal.(func(*std_core.QEvent) bool)(std_core.NewQEventFromPointer(e))))) 4631 + } 4632 + 4633 + return C.char(int8(qt.GoBoolToInt(NewQVBoxLayoutWithTriggerSlotFromPointer(ptr).EventDefault(std_core.NewQEventFromPointer(e))))) 4634 +} 4635 + 4636 +func (ptr *QVBoxLayoutWithTriggerSlot) EventDefault(e std_core.QEvent_ITF) bool { 4637 + if ptr.Pointer() != nil { 4638 + return C.QVBoxLayoutWithTriggerSlot_EventDefault(ptr.Pointer(), std_core.PointerFromQEvent(e)) != 0 4639 + } 4640 + return false 4641 +} 4642 + 4643 +//export callbackQVBoxLayoutWithTriggerSlot_EventFilter 4644 +func callbackQVBoxLayoutWithTriggerSlot_EventFilter(ptr unsafe.Pointer, watched unsafe.Pointer, event unsafe.Pointer) C.char { 4645 + if signal := qt.GetSignal(ptr, "eventFilter"); signal != nil { 4646 + return C.char(int8(qt.GoBoolToInt(signal.(func(*std_core.QObject, *std_core.QEvent) bool)(std_core.NewQObjectFromPointer(watched), std_core.NewQEventFromPointer(event))))) 4647 + } 4648 + 4649 + return C.char(int8(qt.GoBoolToInt(NewQVBoxLayoutWithTriggerSlotFromPointer(ptr).EventFilterDefault(std_core.NewQObjectFromPointer(watched), std_core.NewQEventFromPointer(event))))) 4650 +} 4651 + 4652 +func (ptr *QVBoxLayoutWithTriggerSlot) EventFilterDefault(watched std_core.QObject_ITF, event std_core.QEvent_ITF) bool { 4653 + if ptr.Pointer() != nil { 4654 + return C.QVBoxLayoutWithTriggerSlot_EventFilterDefault(ptr.Pointer(), std_core.PointerFromQObject(watched), std_core.PointerFromQEvent(event)) != 0 4655 + } 4656 + return false 4657 +} 4658 + 4659 +//export callbackQVBoxLayoutWithTriggerSlot_ConnectNotify 4660 +func callbackQVBoxLayoutWithTriggerSlot_ConnectNotify(ptr unsafe.Pointer, sign unsafe.Pointer) { 4661 + if signal := qt.GetSignal(ptr, "connectNotify"); signal != nil { 4662 + signal.(func(*std_core.QMetaMethod))(std_core.NewQMetaMethodFromPointer(sign)) 4663 + } else { 4664 + NewQVBoxLayoutWithTriggerSlotFromPointer(ptr).ConnectNotifyDefault(std_core.NewQMetaMethodFromPointer(sign)) 4665 + } 4666 +} 4667 + 4668 +func (ptr *QVBoxLayoutWithTriggerSlot) ConnectNotifyDefault(sign std_core.QMetaMethod_ITF) { 4669 + if ptr.Pointer() != nil { 4670 + C.QVBoxLayoutWithTriggerSlot_ConnectNotifyDefault(ptr.Pointer(), std_core.PointerFromQMetaMethod(sign)) 4671 + } 4672 +} 4673 + 4674 +//export callbackQVBoxLayoutWithTriggerSlot_CustomEvent 4675 +func callbackQVBoxLayoutWithTriggerSlot_CustomEvent(ptr unsafe.Pointer, event unsafe.Pointer) { 4676 + if signal := qt.GetSignal(ptr, "customEvent"); signal != nil { 4677 + signal.(func(*std_core.QEvent))(std_core.NewQEventFromPointer(event)) 4678 + } else { 4679 + NewQVBoxLayoutWithTriggerSlotFromPointer(ptr).CustomEventDefault(std_core.NewQEventFromPointer(event)) 4680 + } 4681 +} 4682 + 4683 +func (ptr *QVBoxLayoutWithTriggerSlot) CustomEventDefault(event std_core.QEvent_ITF) { 4684 + if ptr.Pointer() != nil { 4685 + C.QVBoxLayoutWithTriggerSlot_CustomEventDefault(ptr.Pointer(), std_core.PointerFromQEvent(event)) 4686 + } 4687 +} 4688 + 4689 +//export callbackQVBoxLayoutWithTriggerSlot_DeleteLater 4690 +func callbackQVBoxLayoutWithTriggerSlot_DeleteLater(ptr unsafe.Pointer) { 4691 + if signal := qt.GetSignal(ptr, "deleteLater"); signal != nil { 4692 + signal.(func())() 4693 + } else { 4694 + NewQVBoxLayoutWithTriggerSlotFromPointer(ptr).DeleteLaterDefault() 4695 + } 4696 +} 4697 + 4698 +func (ptr *QVBoxLayoutWithTriggerSlot) DeleteLaterDefault() { 4699 + if ptr.Pointer() != nil { 4700 + C.QVBoxLayoutWithTriggerSlot_DeleteLaterDefault(ptr.Pointer()) 4701 + ptr.SetPointer(nil) 4702 + runtime.SetFinalizer(ptr, nil) 4703 + } 4704 +} 4705 + 4706 +//export callbackQVBoxLayoutWithTriggerSlot_Destroyed 4707 +func callbackQVBoxLayoutWithTriggerSlot_Destroyed(ptr unsafe.Pointer, obj unsafe.Pointer) { 4708 + if signal := qt.GetSignal(ptr, "destroyed"); signal != nil { 4709 + signal.(func(*std_core.QObject))(std_core.NewQObjectFromPointer(obj)) 4710 + } 4711 + 4712 +} 4713 + 4714 +//export callbackQVBoxLayoutWithTriggerSlot_DisconnectNotify 4715 +func callbackQVBoxLayoutWithTriggerSlot_DisconnectNotify(ptr unsafe.Pointer, sign unsafe.Pointer) { 4716 + if signal := qt.GetSignal(ptr, "disconnectNotify"); signal != nil { 4717 + signal.(func(*std_core.QMetaMethod))(std_core.NewQMetaMethodFromPointer(sign)) 4718 + } else { 4719 + NewQVBoxLayoutWithTriggerSlotFromPointer(ptr).DisconnectNotifyDefault(std_core.NewQMetaMethodFromPointer(sign)) 4720 + } 4721 +} 4722 + 4723 +func (ptr *QVBoxLayoutWithTriggerSlot) DisconnectNotifyDefault(sign std_core.QMetaMethod_ITF) { 4724 + if ptr.Pointer() != nil { 4725 + C.QVBoxLayoutWithTriggerSlot_DisconnectNotifyDefault(ptr.Pointer(), std_core.PointerFromQMetaMethod(sign)) 4726 + } 4727 +} 4728 + 4729 +//export callbackQVBoxLayoutWithTriggerSlot_ObjectNameChanged 4730 +func callbackQVBoxLayoutWithTriggerSlot_ObjectNameChanged(ptr unsafe.Pointer, objectName C.struct_Moc_PackedString) { 4731 + if signal := qt.GetSignal(ptr, "objectNameChanged"); signal != nil { 4732 + signal.(func(string))(cGoUnpackString(objectName)) 4733 + } 4734 + 4735 +} 4736 + 4737 +//export callbackQVBoxLayoutWithTriggerSlot_TimerEvent 4738 +func callbackQVBoxLayoutWithTriggerSlot_TimerEvent(ptr unsafe.Pointer, event unsafe.Pointer) { 4739 + if signal := qt.GetSignal(ptr, "timerEvent"); signal != nil { 4740 + signal.(func(*std_core.QTimerEvent))(std_core.NewQTimerEventFromPointer(event)) 4741 + } else { 4742 + NewQVBoxLayoutWithTriggerSlotFromPointer(ptr).TimerEventDefault(std_core.NewQTimerEventFromPointer(event)) 4743 + } 4744 +} 4745 + 4746 +func (ptr *QVBoxLayoutWithTriggerSlot) TimerEventDefault(event std_core.QTimerEvent_ITF) { 4747 + if ptr.Pointer() != nil { 4748 + C.QVBoxLayoutWithTriggerSlot_TimerEventDefault(ptr.Pointer(), std_core.PointerFromQTimerEvent(event)) 4749 + } 4750 +} 4751 + 4752 +//export callbackQVBoxLayoutWithTriggerSlot_SpacerItem 4753 +func callbackQVBoxLayoutWithTriggerSlot_SpacerItem(ptr unsafe.Pointer) unsafe.Pointer { 4754 + if signal := qt.GetSignal(ptr, "spacerItem"); signal != nil { 4755 + return std_widgets.PointerFromQSpacerItem(signal.(func() *std_widgets.QSpacerItem)()) 4756 + } 4757 + 4758 + return std_widgets.PointerFromQSpacerItem(NewQVBoxLayoutWithTriggerSlotFromPointer(ptr).SpacerItemDefault()) 4759 +} 4760 + 4761 +func (ptr *QVBoxLayoutWithTriggerSlot) SpacerItemDefault() *std_widgets.QSpacerItem { 4762 + if ptr.Pointer() != nil { 4763 + return std_widgets.NewQSpacerItemFromPointer(C.QVBoxLayoutWithTriggerSlot_SpacerItemDefault(ptr.Pointer())) 4764 + } 4765 + return nil 4766 +} 4767 + 4768 +//export callbackQVBoxLayoutWithTriggerSlot_Widget 4769 +func callbackQVBoxLayoutWithTriggerSlot_Widget(ptr unsafe.Pointer) unsafe.Pointer { 4770 + if signal := qt.GetSignal(ptr, "widget"); signal != nil { 4771 + return std_widgets.PointerFromQWidget(signal.(func() *std_widgets.QWidget)()) 4772 + } 4773 + 4774 + return std_widgets.PointerFromQWidget(NewQVBoxLayoutWithTriggerSlotFromPointer(ptr).WidgetDefault()) 4775 +} 4776 + 4777 +func (ptr *QVBoxLayoutWithTriggerSlot) WidgetDefault() *std_widgets.QWidget { 4778 + if ptr.Pointer() != nil { 4779 + var tmpValue = std_widgets.NewQWidgetFromPointer(C.QVBoxLayoutWithTriggerSlot_WidgetDefault(ptr.Pointer())) 4780 + if !qt.ExistsSignal(tmpValue.Pointer(), "destroyed") { 4781 + tmpValue.ConnectDestroyed(func(*std_core.QObject) { tmpValue.SetPointer(nil) }) 4782 + } 4783 + return tmpValue 4784 + } 4785 + return nil 4786 +} 4787 diff --git a/ui/listLayouts/moc.h b/ui/listLayouts/moc.h 4788 new file mode 100644 4789 index 0000000..422cfa2 4790 --- /dev/null 4791 +++ b/ui/listLayouts/moc.h 4792 @@ -0,0 +1,136 @@ 4793 + 4794 + 4795 +#pragma once 4796 + 4797 +#ifndef GO_MOC_H 4798 +#define GO_MOC_H 4799 + 4800 +#include <stdint.h> 4801 + 4802 +#ifdef __cplusplus 4803 +class QVBoxLayoutWithTriggerSlot; 4804 +void QVBoxLayoutWithTriggerSlot_QVBoxLayoutWithTriggerSlot_QRegisterMetaTypes(); 4805 +class QRoomVBoxLayoutWithTriggerSlot; 4806 +void QRoomVBoxLayoutWithTriggerSlot_QRoomVBoxLayoutWithTriggerSlot_QRegisterMetaTypes(); 4807 +extern "C" { 4808 +#endif 4809 + 4810 +struct Moc_PackedString { char* data; long long len; }; 4811 +struct Moc_PackedList { void* data; long long len; }; 4812 +void QRoomVBoxLayoutWithTriggerSlot_ConnectTriggerRoom(void* ptr); 4813 +void QRoomVBoxLayoutWithTriggerSlot_DisconnectTriggerRoom(void* ptr); 4814 +void QRoomVBoxLayoutWithTriggerSlot_TriggerRoom(void* ptr, struct Moc_PackedString roomID); 4815 +void QRoomVBoxLayoutWithTriggerSlot_ConnectChangeRoom(void* ptr); 4816 +void QRoomVBoxLayoutWithTriggerSlot_DisconnectChangeRoom(void* ptr); 4817 +void QRoomVBoxLayoutWithTriggerSlot_ChangeRoom(void* ptr, struct Moc_PackedString roomID); 4818 +int QRoomVBoxLayoutWithTriggerSlot_QRoomVBoxLayoutWithTriggerSlot_QRegisterMetaType(); 4819 +int QRoomVBoxLayoutWithTriggerSlot_QRoomVBoxLayoutWithTriggerSlot_QRegisterMetaType2(char* typeName); 4820 +int QRoomVBoxLayoutWithTriggerSlot_QRoomVBoxLayoutWithTriggerSlot_QmlRegisterType(); 4821 +int QRoomVBoxLayoutWithTriggerSlot_QRoomVBoxLayoutWithTriggerSlot_QmlRegisterType2(char* uri, int versionMajor, int versionMinor, char* qmlName); 4822 +void* QRoomVBoxLayoutWithTriggerSlot___dynamicPropertyNames_atList(void* ptr, int i); 4823 +void QRoomVBoxLayoutWithTriggerSlot___dynamicPropertyNames_setList(void* ptr, void* i); 4824 +void* QRoomVBoxLayoutWithTriggerSlot___dynamicPropertyNames_newList(void* ptr); 4825 +void* QRoomVBoxLayoutWithTriggerSlot___findChildren_atList2(void* ptr, int i); 4826 +void QRoomVBoxLayoutWithTriggerSlot___findChildren_setList2(void* ptr, void* i); 4827 +void* QRoomVBoxLayoutWithTriggerSlot___findChildren_newList2(void* ptr); 4828 +void* QRoomVBoxLayoutWithTriggerSlot___findChildren_atList3(void* ptr, int i); 4829 +void QRoomVBoxLayoutWithTriggerSlot___findChildren_setList3(void* ptr, void* i); 4830 +void* QRoomVBoxLayoutWithTriggerSlot___findChildren_newList3(void* ptr); 4831 +void* QRoomVBoxLayoutWithTriggerSlot___findChildren_atList(void* ptr, int i); 4832 +void QRoomVBoxLayoutWithTriggerSlot___findChildren_setList(void* ptr, void* i); 4833 +void* QRoomVBoxLayoutWithTriggerSlot___findChildren_newList(void* ptr); 4834 +void* QRoomVBoxLayoutWithTriggerSlot___children_atList(void* ptr, int i); 4835 +void QRoomVBoxLayoutWithTriggerSlot___children_setList(void* ptr, void* i); 4836 +void* QRoomVBoxLayoutWithTriggerSlot___children_newList(void* ptr); 4837 +void* QRoomVBoxLayoutWithTriggerSlot_NewQRoomVBoxLayoutWithTriggerSlot(); 4838 +void* QRoomVBoxLayoutWithTriggerSlot_NewQRoomVBoxLayoutWithTriggerSlot2(void* parent); 4839 +void QRoomVBoxLayoutWithTriggerSlot_DestroyQRoomVBoxLayoutWithTriggerSlot(void* ptr); 4840 +void* QRoomVBoxLayoutWithTriggerSlot_TakeAtDefault(void* ptr, int index); 4841 +void QRoomVBoxLayoutWithTriggerSlot_AddItemDefault(void* ptr, void* item); 4842 +void QRoomVBoxLayoutWithTriggerSlot_InvalidateDefault(void* ptr); 4843 +void QRoomVBoxLayoutWithTriggerSlot_SetGeometryDefault(void* ptr, void* r); 4844 +void* QRoomVBoxLayoutWithTriggerSlot_ItemAtDefault(void* ptr, int index); 4845 +void* QRoomVBoxLayoutWithTriggerSlot_MaximumSizeDefault(void* ptr); 4846 +void* QRoomVBoxLayoutWithTriggerSlot_MinimumSizeDefault(void* ptr); 4847 +void* QRoomVBoxLayoutWithTriggerSlot_SizeHintDefault(void* ptr); 4848 +long long QRoomVBoxLayoutWithTriggerSlot_ExpandingDirectionsDefault(void* ptr); 4849 +char QRoomVBoxLayoutWithTriggerSlot_HasHeightForWidthDefault(void* ptr); 4850 +int QRoomVBoxLayoutWithTriggerSlot_CountDefault(void* ptr); 4851 +int QRoomVBoxLayoutWithTriggerSlot_HeightForWidthDefault(void* ptr, int w); 4852 +int QRoomVBoxLayoutWithTriggerSlot_MinimumHeightForWidthDefault(void* ptr, int w); 4853 +void* QRoomVBoxLayoutWithTriggerSlot_LayoutDefault(void* ptr); 4854 +void QRoomVBoxLayoutWithTriggerSlot_ChildEventDefault(void* ptr, void* e); 4855 +void* QRoomVBoxLayoutWithTriggerSlot_GeometryDefault(void* ptr); 4856 +long long QRoomVBoxLayoutWithTriggerSlot_ControlTypesDefault(void* ptr); 4857 +char QRoomVBoxLayoutWithTriggerSlot_IsEmptyDefault(void* ptr); 4858 +int QRoomVBoxLayoutWithTriggerSlot_IndexOfDefault(void* ptr, void* widget); 4859 +char QRoomVBoxLayoutWithTriggerSlot_EventDefault(void* ptr, void* e); 4860 +char QRoomVBoxLayoutWithTriggerSlot_EventFilterDefault(void* ptr, void* watched, void* event); 4861 +void QRoomVBoxLayoutWithTriggerSlot_ConnectNotifyDefault(void* ptr, void* sign); 4862 +void QRoomVBoxLayoutWithTriggerSlot_CustomEventDefault(void* ptr, void* event); 4863 +void QRoomVBoxLayoutWithTriggerSlot_DeleteLaterDefault(void* ptr); 4864 +void QRoomVBoxLayoutWithTriggerSlot_DisconnectNotifyDefault(void* ptr, void* sign); 4865 +void QRoomVBoxLayoutWithTriggerSlot_TimerEventDefault(void* ptr, void* event); 4866 +; 4867 +void* QRoomVBoxLayoutWithTriggerSlot_SpacerItemDefault(void* ptr); 4868 +void* QRoomVBoxLayoutWithTriggerSlot_WidgetDefault(void* ptr); 4869 +void QVBoxLayoutWithTriggerSlot_ConnectTriggerMessage(void* ptr); 4870 +void QVBoxLayoutWithTriggerSlot_DisconnectTriggerMessage(void* ptr); 4871 +void QVBoxLayoutWithTriggerSlot_TriggerMessage(void* ptr, struct Moc_PackedString messageBody, struct Moc_PackedString sender, long long timestamp); 4872 +int QVBoxLayoutWithTriggerSlot_QVBoxLayoutWithTriggerSlot_QRegisterMetaType(); 4873 +int QVBoxLayoutWithTriggerSlot_QVBoxLayoutWithTriggerSlot_QRegisterMetaType2(char* typeName); 4874 +int QVBoxLayoutWithTriggerSlot_QVBoxLayoutWithTriggerSlot_QmlRegisterType(); 4875 +int QVBoxLayoutWithTriggerSlot_QVBoxLayoutWithTriggerSlot_QmlRegisterType2(char* uri, int versionMajor, int versionMinor, char* qmlName); 4876 +void* QVBoxLayoutWithTriggerSlot___dynamicPropertyNames_atList(void* ptr, int i); 4877 +void QVBoxLayoutWithTriggerSlot___dynamicPropertyNames_setList(void* ptr, void* i); 4878 +void* QVBoxLayoutWithTriggerSlot___dynamicPropertyNames_newList(void* ptr); 4879 +void* QVBoxLayoutWithTriggerSlot___findChildren_atList2(void* ptr, int i); 4880 +void QVBoxLayoutWithTriggerSlot___findChildren_setList2(void* ptr, void* i); 4881 +void* QVBoxLayoutWithTriggerSlot___findChildren_newList2(void* ptr); 4882 +void* QVBoxLayoutWithTriggerSlot___findChildren_atList3(void* ptr, int i); 4883 +void QVBoxLayoutWithTriggerSlot___findChildren_setList3(void* ptr, void* i); 4884 +void* QVBoxLayoutWithTriggerSlot___findChildren_newList3(void* ptr); 4885 +void* QVBoxLayoutWithTriggerSlot___findChildren_atList(void* ptr, int i); 4886 +void QVBoxLayoutWithTriggerSlot___findChildren_setList(void* ptr, void* i); 4887 +void* QVBoxLayoutWithTriggerSlot___findChildren_newList(void* ptr); 4888 +void* QVBoxLayoutWithTriggerSlot___children_atList(void* ptr, int i); 4889 +void QVBoxLayoutWithTriggerSlot___children_setList(void* ptr, void* i); 4890 +void* QVBoxLayoutWithTriggerSlot___children_newList(void* ptr); 4891 +void* QVBoxLayoutWithTriggerSlot_NewQVBoxLayoutWithTriggerSlot(); 4892 +void* QVBoxLayoutWithTriggerSlot_NewQVBoxLayoutWithTriggerSlot2(void* parent); 4893 +void QVBoxLayoutWithTriggerSlot_DestroyQVBoxLayoutWithTriggerSlot(void* ptr); 4894 +void* QVBoxLayoutWithTriggerSlot_TakeAtDefault(void* ptr, int index); 4895 +void QVBoxLayoutWithTriggerSlot_AddItemDefault(void* ptr, void* item); 4896 +void QVBoxLayoutWithTriggerSlot_InvalidateDefault(void* ptr); 4897 +void QVBoxLayoutWithTriggerSlot_SetGeometryDefault(void* ptr, void* r); 4898 +void* QVBoxLayoutWithTriggerSlot_ItemAtDefault(void* ptr, int index); 4899 +void* QVBoxLayoutWithTriggerSlot_MaximumSizeDefault(void* ptr); 4900 +void* QVBoxLayoutWithTriggerSlot_MinimumSizeDefault(void* ptr); 4901 +void* QVBoxLayoutWithTriggerSlot_SizeHintDefault(void* ptr); 4902 +long long QVBoxLayoutWithTriggerSlot_ExpandingDirectionsDefault(void* ptr); 4903 +char QVBoxLayoutWithTriggerSlot_HasHeightForWidthDefault(void* ptr); 4904 +int QVBoxLayoutWithTriggerSlot_CountDefault(void* ptr); 4905 +int QVBoxLayoutWithTriggerSlot_HeightForWidthDefault(void* ptr, int w); 4906 +int QVBoxLayoutWithTriggerSlot_MinimumHeightForWidthDefault(void* ptr, int w); 4907 +void* QVBoxLayoutWithTriggerSlot_LayoutDefault(void* ptr); 4908 +void QVBoxLayoutWithTriggerSlot_ChildEventDefault(void* ptr, void* e); 4909 +void* QVBoxLayoutWithTriggerSlot_GeometryDefault(void* ptr); 4910 +long long QVBoxLayoutWithTriggerSlot_ControlTypesDefault(void* ptr); 4911 +char QVBoxLayoutWithTriggerSlot_IsEmptyDefault(void* ptr); 4912 +int QVBoxLayoutWithTriggerSlot_IndexOfDefault(void* ptr, void* widget); 4913 +char QVBoxLayoutWithTriggerSlot_EventDefault(void* ptr, void* e); 4914 +char QVBoxLayoutWithTriggerSlot_EventFilterDefault(void* ptr, void* watched, void* event); 4915 +void QVBoxLayoutWithTriggerSlot_ConnectNotifyDefault(void* ptr, void* sign); 4916 +void QVBoxLayoutWithTriggerSlot_CustomEventDefault(void* ptr, void* event); 4917 +void QVBoxLayoutWithTriggerSlot_DeleteLaterDefault(void* ptr); 4918 +void QVBoxLayoutWithTriggerSlot_DisconnectNotifyDefault(void* ptr, void* sign); 4919 +void QVBoxLayoutWithTriggerSlot_TimerEventDefault(void* ptr, void* event); 4920 +; 4921 +void* QVBoxLayoutWithTriggerSlot_SpacerItemDefault(void* ptr); 4922 +void* QVBoxLayoutWithTriggerSlot_WidgetDefault(void* ptr); 4923 + 4924 +#ifdef __cplusplus 4925 +} 4926 +#endif 4927 + 4928 +#endif 4929 \ No newline at end of file 4930 diff --git a/ui/listLayouts/moc_cgo_windows_windows_386.go b/ui/listLayouts/moc_cgo_windows_windows_386.go 4931 new file mode 100644 4932 index 0000000..1a7efe7 4933 --- /dev/null 4934 +++ b/ui/listLayouts/moc_cgo_windows_windows_386.go 4935 @@ -0,0 +1,11 @@ 4936 +package listLayouts 4937 + 4938 +/* 4939 +#cgo CFLAGS: -fno-keep-inline-dllexport -O2 -Wextra -Wall -W -DUNICODE -D_UNICODE -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN 4940 +#cgo CXXFLAGS: -fno-keep-inline-dllexport -O2 -std=gnu++11 -Wextra -Wall -W -fexceptions -mthreads -DUNICODE -D_UNICODE -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN 4941 +#cgo CXXFLAGS: -I../../Morpheus -I. -IC:/Qt/Qt5.9.1/5.9.3/mingw53_32/include -IC:/Qt/Qt5.9.1/5.9.3/mingw53_32/include/QtWidgets -IC:/Qt/Qt5.9.1/5.9.3/mingw53_32/include/QtGui -IC:/Qt/Qt5.9.1/5.9.3/mingw53_32/include/QtANGLE -IC:/Qt/Qt5.9.1/5.9.3/mingw53_32/include/QtCore -Irelease -IC:/Qt/Qt5.9.1/5.9.3/mingw53_32/mkspecs/win32-g++ 4942 +#cgo LDFLAGS: -Wl,-s -Wl,-subsystem,windows -mthreads 4943 +#cgo LDFLAGS: -lmingw32 -LC:/Qt/Qt5.9.1/5.9.3/mingw53_32/lib C:/Qt/Qt5.9.1/5.9.3/mingw53_32/lib/libqtmain.a -LC:/utils/my_sql/my_sql/lib -LC:/utils/postgresql/pgsql/lib -lshell32 C:/Qt/Qt5.9.1/5.9.3/mingw53_32/lib/libQt5Widgets.a C:/Qt/Qt5.9.1/5.9.3/mingw53_32/lib/libQt5Gui.a C:/Qt/Qt5.9.1/5.9.3/mingw53_32/lib/libQt5Core.a 4944 +#cgo LDFLAGS: -Wl,--allow-multiple-definition 4945 +*/ 4946 +import "C" 4947 diff --git a/ui/listLayouts/moc_moc.h b/ui/listLayouts/moc_moc.h 4948 new file mode 100644 4949 index 0000000..6806399 4950 --- /dev/null 4951 +++ b/ui/listLayouts/moc_moc.h 4952 @@ -0,0 +1,257 @@ 4953 +/**************************************************************************** 4954 +** Meta object code from reading C++ file 'moc.cpp' 4955 +** 4956 +** Created by: The Qt Meta Object Compiler version 67 (Qt 5.9.3) 4957 +** 4958 +** WARNING! All changes made in this file will be lost! 4959 +*****************************************************************************/ 4960 + 4961 +#include <QtCore/qbytearray.h> 4962 +#include <QtCore/qmetatype.h> 4963 +#if !defined(Q_MOC_OUTPUT_REVISION) 4964 +#error "The header file 'moc.cpp' doesn't include <QObject>." 4965 +#elif Q_MOC_OUTPUT_REVISION != 67 4966 +#error "This file was generated using the moc from 5.9.3. It" 4967 +#error "cannot be used with the include files from this version of Qt." 4968 +#error "(The moc has changed too much.)" 4969 +#endif 4970 + 4971 +QT_BEGIN_MOC_NAMESPACE 4972 +QT_WARNING_PUSH 4973 +QT_WARNING_DISABLE_DEPRECATED 4974 +struct qt_meta_stringdata_QRoomVBoxLayoutWithTriggerSlot_t { 4975 + QByteArrayData data[5]; 4976 + char stringdata0[62]; 4977 +}; 4978 +#define QT_MOC_LITERAL(idx, ofs, len) \ 4979 + Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ 4980 + qptrdiff(offsetof(qt_meta_stringdata_QRoomVBoxLayoutWithTriggerSlot_t, stringdata0) + ofs \ 4981 + - idx * sizeof(QByteArrayData)) \ 4982 + ) 4983 +static const qt_meta_stringdata_QRoomVBoxLayoutWithTriggerSlot_t qt_meta_stringdata_QRoomVBoxLayoutWithTriggerSlot = { 4984 + { 4985 +QT_MOC_LITERAL(0, 0, 30), // "QRoomVBoxLayoutWithTriggerSlot" 4986 +QT_MOC_LITERAL(1, 31, 11), // "TriggerRoom" 4987 +QT_MOC_LITERAL(2, 43, 0), // "" 4988 +QT_MOC_LITERAL(3, 44, 6), // "roomID" 4989 +QT_MOC_LITERAL(4, 51, 10) // "ChangeRoom" 4990 + 4991 + }, 4992 + "QRoomVBoxLayoutWithTriggerSlot\0" 4993 + "TriggerRoom\0\0roomID\0ChangeRoom" 4994 +}; 4995 +#undef QT_MOC_LITERAL 4996 + 4997 +static const uint qt_meta_data_QRoomVBoxLayoutWithTriggerSlot[] = { 4998 + 4999 + // content: 5000 + 7, // revision 5001 + 0, // classname 5002 + 0, 0, // classinfo 5003 + 2, 14, // methods 5004 + 0, 0, // properties 5005 + 0, 0, // enums/sets 5006 + 0, 0, // constructors 5007 + 0, // flags 5008 + 2, // signalCount 5009 + 5010 + // signals: name, argc, parameters, tag, flags 5011 + 1, 1, 24, 2, 0x06 /* Public */, 5012 + 4, 1, 27, 2, 0x06 /* Public */, 5013 + 5014 + // signals: parameters 5015 + QMetaType::Void, QMetaType::QString, 3, 5016 + QMetaType::Void, QMetaType::QString, 3, 5017 + 5018 + 0 // eod 5019 +}; 5020 + 5021 +void QRoomVBoxLayoutWithTriggerSlot::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) 5022 +{ 5023 + if (_c == QMetaObject::InvokeMetaMethod) { 5024 + QRoomVBoxLayoutWithTriggerSlot *_t = static_cast<QRoomVBoxLayoutWithTriggerSlot *>(_o); 5025 + Q_UNUSED(_t) 5026 + switch (_id) { 5027 + case 0: _t->TriggerRoom((*reinterpret_cast< QString(*)>(_a[1]))); break; 5028 + case 1: _t->ChangeRoom((*reinterpret_cast< QString(*)>(_a[1]))); break; 5029 + default: ; 5030 + } 5031 + } else if (_c == QMetaObject::IndexOfMethod) { 5032 + int *result = reinterpret_cast<int *>(_a[0]); 5033 + { 5034 + typedef void (QRoomVBoxLayoutWithTriggerSlot::*_t)(QString ); 5035 + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QRoomVBoxLayoutWithTriggerSlot::TriggerRoom)) { 5036 + *result = 0; 5037 + return; 5038 + } 5039 + } 5040 + { 5041 + typedef void (QRoomVBoxLayoutWithTriggerSlot::*_t)(QString ); 5042 + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QRoomVBoxLayoutWithTriggerSlot::ChangeRoom)) { 5043 + *result = 1; 5044 + return; 5045 + } 5046 + } 5047 + } 5048 +} 5049 + 5050 +const QMetaObject QRoomVBoxLayoutWithTriggerSlot::staticMetaObject = { 5051 + { &QVBoxLayout::staticMetaObject, qt_meta_stringdata_QRoomVBoxLayoutWithTriggerSlot.data, 5052 + qt_meta_data_QRoomVBoxLayoutWithTriggerSlot, qt_static_metacall, nullptr, nullptr} 5053 +}; 5054 + 5055 + 5056 +const QMetaObject *QRoomVBoxLayoutWithTriggerSlot::metaObject() const 5057 +{ 5058 + return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject; 5059 +} 5060 + 5061 +void *QRoomVBoxLayoutWithTriggerSlot::qt_metacast(const char *_clname) 5062 +{ 5063 + if (!_clname) return nullptr; 5064 + if (!strcmp(_clname, qt_meta_stringdata_QRoomVBoxLayoutWithTriggerSlot.stringdata0)) 5065 + return static_cast<void*>(this); 5066 + return QVBoxLayout::qt_metacast(_clname); 5067 +} 5068 + 5069 +int QRoomVBoxLayoutWithTriggerSlot::qt_metacall(QMetaObject::Call _c, int _id, void **_a) 5070 +{ 5071 + _id = QVBoxLayout::qt_metacall(_c, _id, _a); 5072 + if (_id < 0) 5073 + return _id; 5074 + if (_c == QMetaObject::InvokeMetaMethod) { 5075 + if (_id < 2) 5076 + qt_static_metacall(this, _c, _id, _a); 5077 + _id -= 2; 5078 + } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { 5079 + if (_id < 2) 5080 + *reinterpret_cast<int*>(_a[0]) = -1; 5081 + _id -= 2; 5082 + } 5083 + return _id; 5084 +} 5085 + 5086 +// SIGNAL 0 5087 +void QRoomVBoxLayoutWithTriggerSlot::TriggerRoom(QString _t1) 5088 +{ 5089 + void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) }; 5090 + QMetaObject::activate(this, &staticMetaObject, 0, _a); 5091 +} 5092 + 5093 +// SIGNAL 1 5094 +void QRoomVBoxLayoutWithTriggerSlot::ChangeRoom(QString _t1) 5095 +{ 5096 + void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) }; 5097 + QMetaObject::activate(this, &staticMetaObject, 1, _a); 5098 +} 5099 +struct qt_meta_stringdata_QVBoxLayoutWithTriggerSlot_t { 5100 + QByteArrayData data[6]; 5101 + char stringdata0[72]; 5102 +}; 5103 +#define QT_MOC_LITERAL(idx, ofs, len) \ 5104 + Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ 5105 + qptrdiff(offsetof(qt_meta_stringdata_QVBoxLayoutWithTriggerSlot_t, stringdata0) + ofs \ 5106 + - idx * sizeof(QByteArrayData)) \ 5107 + ) 5108 +static const qt_meta_stringdata_QVBoxLayoutWithTriggerSlot_t qt_meta_stringdata_QVBoxLayoutWithTriggerSlot = { 5109 + { 5110 +QT_MOC_LITERAL(0, 0, 26), // "QVBoxLayoutWithTriggerSlot" 5111 +QT_MOC_LITERAL(1, 27, 14), // "TriggerMessage" 5112 +QT_MOC_LITERAL(2, 42, 0), // "" 5113 +QT_MOC_LITERAL(3, 43, 11), // "messageBody" 5114 +QT_MOC_LITERAL(4, 55, 6), // "sender" 5115 +QT_MOC_LITERAL(5, 62, 9) // "timestamp" 5116 + 5117 + }, 5118 + "QVBoxLayoutWithTriggerSlot\0TriggerMessage\0" 5119 + "\0messageBody\0sender\0timestamp" 5120 +}; 5121 +#undef QT_MOC_LITERAL 5122 + 5123 +static const uint qt_meta_data_QVBoxLayoutWithTriggerSlot[] = { 5124 + 5125 + // content: 5126 + 7, // revision 5127 + 0, // classname 5128 + 0, 0, // classinfo 5129 + 1, 14, // methods 5130 + 0, 0, // properties 5131 + 0, 0, // enums/sets 5132 + 0, 0, // constructors 5133 + 0, // flags 5134 + 1, // signalCount 5135 + 5136 + // signals: name, argc, parameters, tag, flags 5137 + 1, 3, 19, 2, 0x06 /* Public */, 5138 + 5139 + // signals: parameters 5140 + QMetaType::Void, QMetaType::QString, QMetaType::QString, QMetaType::LongLong, 3, 4, 5, 5141 + 5142 + 0 // eod 5143 +}; 5144 + 5145 +void QVBoxLayoutWithTriggerSlot::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) 5146 +{ 5147 + if (_c == QMetaObject::InvokeMetaMethod) { 5148 + QVBoxLayoutWithTriggerSlot *_t = static_cast<QVBoxLayoutWithTriggerSlot *>(_o); 5149 + Q_UNUSED(_t) 5150 + switch (_id) { 5151 + case 0: _t->TriggerMessage((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2])),(*reinterpret_cast< qint64(*)>(_a[3]))); break; 5152 + default: ; 5153 + } 5154 + } else if (_c == QMetaObject::IndexOfMethod) { 5155 + int *result = reinterpret_cast<int *>(_a[0]); 5156 + { 5157 + typedef void (QVBoxLayoutWithTriggerSlot::*_t)(QString , QString , qint64 ); 5158 + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QVBoxLayoutWithTriggerSlot::TriggerMessage)) { 5159 + *result = 0; 5160 + return; 5161 + } 5162 + } 5163 + } 5164 +} 5165 + 5166 +const QMetaObject QVBoxLayoutWithTriggerSlot::staticMetaObject = { 5167 + { &QVBoxLayout::staticMetaObject, qt_meta_stringdata_QVBoxLayoutWithTriggerSlot.data, 5168 + qt_meta_data_QVBoxLayoutWithTriggerSlot, qt_static_metacall, nullptr, nullptr} 5169 +}; 5170 + 5171 + 5172 +const QMetaObject *QVBoxLayoutWithTriggerSlot::metaObject() const 5173 +{ 5174 + return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject; 5175 +} 5176 + 5177 +void *QVBoxLayoutWithTriggerSlot::qt_metacast(const char *_clname) 5178 +{ 5179 + if (!_clname) return nullptr; 5180 + if (!strcmp(_clname, qt_meta_stringdata_QVBoxLayoutWithTriggerSlot.stringdata0)) 5181 + return static_cast<void*>(this); 5182 + return QVBoxLayout::qt_metacast(_clname); 5183 +} 5184 + 5185 +int QVBoxLayoutWithTriggerSlot::qt_metacall(QMetaObject::Call _c, int _id, void **_a) 5186 +{ 5187 + _id = QVBoxLayout::qt_metacall(_c, _id, _a); 5188 + if (_id < 0) 5189 + return _id; 5190 + if (_c == QMetaObject::InvokeMetaMethod) { 5191 + if (_id < 1) 5192 + qt_static_metacall(this, _c, _id, _a); 5193 + _id -= 1; 5194 + } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { 5195 + if (_id < 1) 5196 + *reinterpret_cast<int*>(_a[0]) = -1; 5197 + _id -= 1; 5198 + } 5199 + return _id; 5200 +} 5201 + 5202 +// SIGNAL 0 5203 +void QVBoxLayoutWithTriggerSlot::TriggerMessage(QString _t1, QString _t2, qint64 _t3) 5204 +{ 5205 + void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)), const_cast<void*>(reinterpret_cast<const void*>(&_t2)), const_cast<void*>(reinterpret_cast<const void*>(&_t3)) }; 5206 + QMetaObject::activate(this, &staticMetaObject, 0, _a); 5207 +} 5208 +QT_WARNING_POP 5209 +QT_END_MOC_NAMESPACE 5210 diff --git a/ui/roomlist.go b/ui/listLayouts/roomlist.go 5211 similarity index 62% 5212 rename from ui/roomlist.go 5213 rename to ui/listLayouts/roomlist.go 5214 index 0664703..5774889 100644 5215 --- a/ui/roomlist.go 5216 +++ b/ui/listLayouts/roomlist.go 5217 @@ -1,7 +1,8 @@ 5218 -package ui 5219 +package listLayouts 5220 5221 import ( 5222 - "github.com/Nordgedanken/Morpheus/matrix" 5223 + "github.com/Nordgedanken/Morpheus/matrix/rooms" 5224 + log "github.com/sirupsen/logrus" 5225 "github.com/therecipe/qt/core" 5226 "github.com/therecipe/qt/gui" 5227 "github.com/therecipe/qt/uitools" 5228 @@ -23,25 +24,24 @@ import ( 5229 type QRoomVBoxLayoutWithTriggerSlot struct { 5230 widgets.QVBoxLayout 5231 5232 - _ func(roomID string) `slot:"TriggerRoom"` 5233 - _ func(url *core.QUrl) `slot:"ChangeRoom"` 5234 + _ func(roomID string) `signal:"TriggerRoom"` 5235 + _ func(roomID string) `signal:"ChangeRoom"` 5236 } 5237 5238 // NewRoomList generates a new QRoomVBoxLayoutWithTriggerSlot and adds it to the room scrollArea 5239 -func NewRoomList(scrollArea *widgets.QScrollArea, roomView *widgets.QWidget) (roomViewLayout *QRoomVBoxLayoutWithTriggerSlot) { 5240 - roomViewLayout = NewQRoomVBoxLayoutWithTriggerSlot2(roomView) 5241 +func NewRoomList(scrollArea *widgets.QScrollArea) (roomViewLayout *QRoomVBoxLayoutWithTriggerSlot) { 5242 + roomViewLayout = NewQRoomVBoxLayoutWithTriggerSlot2(scrollArea.Widget()) 5243 5244 roomViewLayout.SetSpacing(0) 5245 roomViewLayout.SetContentsMargins(0, 0, 0, 0) 5246 - roomView.SetContentsMargins(0, 0, 0, 0) 5247 - scrollArea.SetWidget(roomView) 5248 + scrollArea.Widget().SetContentsMargins(0, 0, 0, 0) 5249 scrollArea.Widget().SetLayout(roomViewLayout) 5250 5251 return 5252 } 5253 5254 // NewRoom adds a new room object to the view 5255 -func (roomViewLayout *QRoomVBoxLayoutWithTriggerSlot) NewRoom(room *matrix.Room, scrollArea *widgets.QScrollArea, mainUIStruct *MainUI) (err error) { 5256 +func (roomViewLayout *QRoomVBoxLayoutWithTriggerSlot) NewRoom(room *rooms.Room, scrollArea *widgets.QScrollArea) (err error) { 5257 roomAvatar, roomAvatarErr := room.GetRoomAvatar() 5258 if roomAvatarErr != nil { 5259 err = roomAvatarErr 5260 @@ -61,42 +61,38 @@ func (roomViewLayout *QRoomVBoxLayoutWithTriggerSlot) NewRoom(room *matrix.Room, 5261 roomName := widgets.NewQLabelFromPointer(widget.FindChild("roomName", core.Qt__FindChildrenRecursively).Pointer()) 5262 /*lastMessageContent := widgets.NewQLabelFromPointer(widget.FindChild("lastMessage", core.Qt__FindChildrenRecursively).Pointer())*/ 5263 5264 - roomAvatarQLabel.SetPixmap(roomAvatar) 5265 - roomName.SetText(room.GetRoomName()) 5266 + roomAvatarQLabel.ConnectSetPixmap(func(vqp *gui.QPixmap) { 5267 + log.Println("SetPixmapEventRoomAvatar") 5268 5269 - /* 5270 - messageContent.SetText(markdownMessage) 5271 + vqp.Scaled2(roomAvatarQLabel.Width(), roomAvatarQLabel.Height(), 0, 0) 5272 5273 - messageContent.SetMinimumWidth(messageContent.LineWidth()) 5274 + newPixmap := gui.NewQPixmap3(2*roomAvatarQLabel.Width(), 2*roomAvatarQLabel.Height()) 5275 + newPixmap.Fill(nil) 5276 5277 - roomWidget.SetMinimumWidth(messageContent.LineWidth() + 100) 5278 - */ 5279 - widget.Resize(wrapperWidget.Size()) 5280 + painter := gui.NewQPainter2(newPixmap) 5281 5282 - var filterObject = core.NewQObject(nil) 5283 - filterObject.ConnectEventFilter(func(watched *core.QObject, event *core.QEvent) bool { 5284 - if event.Type() == core.QEvent__MouseButtonPress { 5285 - var mouseEvent = gui.NewQMouseEventFromPointer(event.Pointer()) 5286 + r := gui.NewQRegion2(roomAvatarQLabel.Width()/2, roomAvatarQLabel.Height()/2, roomAvatarQLabel.Width(), roomAvatarQLabel.Height(), gui.QRegion__Ellipse) 5287 5288 - if mouseEvent.Button() == core.Qt__LeftButton { 5289 - if mainUIStruct.currentRoom != room.RoomID { 5290 - mainUIStruct.SetCurrentRoom(room.RoomID) 5291 - mainUIStruct.MainWidget.SetWindowTitle("Morpheus - " + room.GetRoomTopic()) 5292 + painter.SetClipRegion(r, 0) 5293 5294 - mainUIStruct.RoomAvatar.SetPixmap(roomAvatar) 5295 + painter.DrawPixmap10(roomAvatarQLabel.Rect(), vqp) 5296 + newImage := newPixmap.ToImage() 5297 + vqp.FromImage(newImage, 0) 5298 + }) 5299 5300 - mainUIStruct.RoomTitle.SetText(room.GetRoomName()) 5301 + roomAvatarQLabel.SetPixmap(roomAvatar) 5302 + roomName.SetText(room.GetRoomName()) 5303 5304 - mainUIStruct.RoomTopic.SetText(room.GetRoomTopic()) 5305 - count := mainUIStruct.MessageListLayout.Count() 5306 - for i := 0; i < count; i++ { 5307 - widgetScroll := mainUIStruct.MessageListLayout.ItemAt(i).Widget() 5308 - widgetScroll.DeleteLater() 5309 - } 5310 + wrapperWidget.Resize2(scrollArea.Widget().Size().Width(), wrapperWidget.Size().Height()) 5311 + widget.Resize2(scrollArea.Widget().Size().Width(), wrapperWidget.Size().Height()) 5312 5313 - go mainUIStruct.loadCache() 5314 - } 5315 + var filterObject = core.NewQObject(nil) 5316 + filterObject.ConnectEventFilter(func(watched *core.QObject, event *core.QEvent) bool { 5317 + if event.Type() == core.QEvent__MouseButtonPress { 5318 + var mouseEvent = gui.NewQMouseEventFromPointer(event.Pointer()) 5319 5320 + if mouseEvent.Button() == core.Qt__LeftButton { 5321 + go roomViewLayout.ChangeRoom(room.RoomID) 5322 return true 5323 } 5324 5325 @@ -112,6 +108,9 @@ func (roomViewLayout *QRoomVBoxLayoutWithTriggerSlot) NewRoom(room *matrix.Room, 5326 wrapperWidget.InstallEventFilter(filterObject) 5327 5328 roomViewLayout.InsertWidget(roomViewLayout.Count()+1, wrapperWidget, 0, 0) 5329 + scrollArea.SetWidgetResizable(true) 5330 + scrollArea.Resize2(wrapperWidget.Size().Width(), scrollArea.Widget().Size().Height()) 5331 + scrollArea.Widget().Resize2(wrapperWidget.Size().Width(), scrollArea.Widget().Size().Height()) 5332 5333 return 5334 } 5335 diff --git a/ui/types.go b/ui/types.go 5336 index ea32e62..7364a0f 100644 5337 --- a/ui/types.go 5338 +++ b/ui/types.go 5339 @@ -1,70 +1,36 @@ 5340 package ui 5341 5342 import ( 5343 - "github.com/Nordgedanken/Morpheus/matrix" 5344 - "github.com/Nordgedanken/Morpheus/matrix/db" 5345 + "github.com/Nordgedanken/Morpheus/matrix/globalTypes" 5346 "github.com/Nordgedanken/Morpheus/matrix/syncer" 5347 - "github.com/matrix-org/gomatrix" 5348 "github.com/therecipe/qt/widgets" 5349 ) 5350 5351 -// Config holds important reused information in the UI 5352 -type config struct { 5353 - username string 5354 - password string 5355 - 5356 - windowWidth int 5357 - windowHeight int 5358 - 5359 - matrixClient 5360 -} 5361 - 5362 -type matrixClient struct { 5363 - databases 5364 - cli *gomatrix.Client 5365 - syncer *syncer.MorpheusSyncer 5366 -} 5367 - 5368 -// GetCli returns the Matrix Client 5369 -func (mc *matrixClient) GetCli() *gomatrix.Client{ 5370 - return mc.cli 5371 -} 5372 - 5373 -type databases struct { 5374 - cacheDB db.Storer 5375 -} 5376 - 5377 -// SetCurrentRoom sets the new room ID of the MainUI 5378 -func (d *databases) SetCacheDB(db db.Storer) { 5379 - d.cacheDB = db 5380 -} 5381 - 5382 // MainUI holds information about the MainUI 5383 type MainUI struct { 5384 - config 5385 + globalTypes.Config 5386 5387 widget *widgets.QWidget 5388 RoomAvatar *widgets.QLabel 5389 RoomTitle *widgets.QLabel 5390 RoomTopic *widgets.QLabel 5391 MainWidget *widgets.QWidget 5392 - MessageListLayout *QVBoxLayoutWithTriggerSlot 5393 messageScrollArea *widgets.QScrollArea 5394 + roomScrollArea *widgets.QScrollArea 5395 5396 - window *widgets.QMainWindow 5397 - storage *syncer.MorpheusStore 5398 - rooms map[string]*matrix.Room 5399 - currentRoom string 5400 + window *widgets.QMainWindow 5401 + storage *syncer.MorpheusStore 5402 } 5403 5404 // SetCurrentRoom sets the new room ID of the MainUI 5405 func (m *MainUI) SetCurrentRoom(RoomID string) { 5406 - m.currentRoom = RoomID 5407 + m.CurrentRoom = RoomID 5408 } 5409 5410 // LoginUI holds information about the LoginUI 5411 type LoginUI struct { 5412 - config 5413 + globalTypes.Config 5414 + 5415 LoginWidget *widgets.QWidget 5416 widget *widgets.QWidget 5417 window *widgets.QMainWindow