mirror of https://github.com/status-im/nimqml.git
Merge pull request #37 from status-im/feat/sound-manager
feat: sound manager added
This commit is contained in:
commit
fea98f226c
|
@ -35,6 +35,7 @@ include "nimqml/private/singleinstance.nim"
|
|||
include "nimqml/private/status/statusevent.nim"
|
||||
include "nimqml/private/status/statusosnotification.nim"
|
||||
include "nimqml/private/status/statuskeychainmanager.nim"
|
||||
include "nimqml/private/status/statussoundmanager.nim"
|
||||
|
||||
proc signal_handler*(receiver: pointer, signal: cstring, slot: cstring) =
|
||||
var dosqobj = cast[DosQObject](receiver)
|
||||
|
@ -65,3 +66,8 @@ proc url_toLocalFile*(fileUrl: string): string =
|
|||
|
||||
proc url_fromLocalFile*(filePath: string): string =
|
||||
result = $(dos_from_local_file(filePath.cstring))
|
||||
|
||||
proc app_isActive*(engine: QQmlApplicationEngine): bool =
|
||||
result = dos_app_is_active(engine.vptr)
|
||||
proc app_makeItActive*(engine: QQmlApplicationEngine) =
|
||||
dos_app_make_it_active(engine.vptr)
|
||||
|
|
|
@ -378,8 +378,16 @@ proc dos_keychainmanager_delete_data_async(vptr: DosStatusKeychainManager,
|
|||
proc dos_keychainmanager_delete(vptr: DosStatusKeychainManager)
|
||||
{.cdecl, dynlib: dynLibName, importc.}
|
||||
|
||||
# DosStatusSoundManager
|
||||
proc dos_soundmanager_play_sound(soundUrl: cstring) {.cdecl, dynlib: dynLibName, importc.}
|
||||
proc dos_soundmanager_set_player_volume(volume: int) {.cdecl, dynlib: dynLibName, importc.}
|
||||
proc dos_soundmanager_stop_player() {.cdecl, dynlib: dynLibName, importc.}
|
||||
|
||||
proc dos_to_local_file(fileUrl: cstring): cstring
|
||||
{.cdecl, dynlib: dynLibName, importc.}
|
||||
|
||||
proc dos_from_local_file(filePath: cstring): cstring
|
||||
{.cdecl, dynlib: dynLibName, importc.}
|
||||
|
||||
proc dos_app_is_active(engine: DosQQmlApplicationEngine): bool {.cdecl, dynlib: dynLibName, importc.}
|
||||
proc dos_app_make_it_active(engine: DosQQmlApplicationEngine) {.cdecl, dynlib: dynLibName, importc.}
|
|
@ -141,6 +141,8 @@ type
|
|||
StatusOSNotification* = ref object of QObject
|
||||
|
||||
StatusKeychainManager* = ref object of QObject
|
||||
|
||||
StatusSoundManager* = ref object of RootObj
|
||||
|
||||
const
|
||||
UserRole* = 0x100
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
proc setup(self: StatusSoundManager) =
|
||||
discard
|
||||
|
||||
proc delete*(self: StatusSoundManager) =
|
||||
discard
|
||||
|
||||
proc newStatusSoundManager*(): StatusSoundManager =
|
||||
new(result, delete)
|
||||
result.setup()
|
||||
|
||||
proc playSound*(self: StatusSoundManager, soundUrl: string) =
|
||||
dos_soundmanager_play_sound(soundUrl)
|
||||
|
||||
proc setPlayerVolume*(self: StatusSoundManager, volume: int) =
|
||||
dos_soundmanager_set_player_volume(volume)
|
||||
|
||||
proc stopPlayer*(self: StatusSoundManager) =
|
||||
dos_soundmanager_stop_player()
|
Loading…
Reference in New Issue