mirror of
https://github.com/mappu/miqt.git
synced 2024-12-23 01:18:37 +00:00
240 lines
7.9 KiB
Go
240 lines
7.9 KiB
Go
package qt
|
|
|
|
/*
|
|
|
|
#include "gen_qsessionmanager.h"
|
|
#include <stdlib.h>
|
|
|
|
*/
|
|
import "C"
|
|
|
|
import (
|
|
"runtime"
|
|
"unsafe"
|
|
)
|
|
|
|
type QSessionManager__RestartHint int
|
|
|
|
const (
|
|
QSessionManager__RestartHint__RestartIfRunning QSessionManager__RestartHint = 0
|
|
QSessionManager__RestartHint__RestartAnyway QSessionManager__RestartHint = 1
|
|
QSessionManager__RestartHint__RestartImmediately QSessionManager__RestartHint = 2
|
|
QSessionManager__RestartHint__RestartNever QSessionManager__RestartHint = 3
|
|
)
|
|
|
|
type QSessionManager struct {
|
|
h *C.QSessionManager
|
|
*QObject
|
|
}
|
|
|
|
func (this *QSessionManager) cPointer() *C.QSessionManager {
|
|
if this == nil {
|
|
return nil
|
|
}
|
|
return this.h
|
|
}
|
|
|
|
func newQSessionManager(h *C.QSessionManager) *QSessionManager {
|
|
if h == nil {
|
|
return nil
|
|
}
|
|
return &QSessionManager{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
|
|
}
|
|
|
|
func newQSessionManager_U(h unsafe.Pointer) *QSessionManager {
|
|
return newQSessionManager((*C.QSessionManager)(h))
|
|
}
|
|
|
|
func (this *QSessionManager) MetaObject() *QMetaObject {
|
|
_ret := C.QSessionManager_MetaObject(this.h)
|
|
return newQMetaObject_U(unsafe.Pointer(_ret))
|
|
}
|
|
|
|
func QSessionManager_Tr(s string) string {
|
|
s_Cstring := C.CString(s)
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
|
var _ms *C.struct_miqt_string = C.QSessionManager_Tr(s_Cstring)
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
C.free(unsafe.Pointer(_ms))
|
|
return _ret
|
|
}
|
|
|
|
func QSessionManager_TrUtf8(s string) string {
|
|
s_Cstring := C.CString(s)
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
|
var _ms *C.struct_miqt_string = C.QSessionManager_TrUtf8(s_Cstring)
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
C.free(unsafe.Pointer(_ms))
|
|
return _ret
|
|
}
|
|
|
|
func (this *QSessionManager) SessionId() string {
|
|
var _ms *C.struct_miqt_string = C.QSessionManager_SessionId(this.h)
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
C.free(unsafe.Pointer(_ms))
|
|
return _ret
|
|
}
|
|
|
|
func (this *QSessionManager) SessionKey() string {
|
|
var _ms *C.struct_miqt_string = C.QSessionManager_SessionKey(this.h)
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
C.free(unsafe.Pointer(_ms))
|
|
return _ret
|
|
}
|
|
|
|
func (this *QSessionManager) AllowsInteraction() bool {
|
|
_ret := C.QSessionManager_AllowsInteraction(this.h)
|
|
return (bool)(_ret)
|
|
}
|
|
|
|
func (this *QSessionManager) AllowsErrorInteraction() bool {
|
|
_ret := C.QSessionManager_AllowsErrorInteraction(this.h)
|
|
return (bool)(_ret)
|
|
}
|
|
|
|
func (this *QSessionManager) Release() {
|
|
C.QSessionManager_Release(this.h)
|
|
}
|
|
|
|
func (this *QSessionManager) Cancel() {
|
|
C.QSessionManager_Cancel(this.h)
|
|
}
|
|
|
|
func (this *QSessionManager) SetRestartHint(restartHint QSessionManager__RestartHint) {
|
|
C.QSessionManager_SetRestartHint(this.h, (C.uintptr_t)(restartHint))
|
|
}
|
|
|
|
func (this *QSessionManager) RestartHint() QSessionManager__RestartHint {
|
|
_ret := C.QSessionManager_RestartHint(this.h)
|
|
return (QSessionManager__RestartHint)(_ret)
|
|
}
|
|
|
|
func (this *QSessionManager) SetRestartCommand(restartCommand []string) {
|
|
// For the C ABI, malloc two C arrays; raw char* pointers and their lengths
|
|
restartCommand_CArray := (*[0xffff]*C.struct_miqt_string)(C.malloc(C.size_t(8 * len(restartCommand))))
|
|
defer C.free(unsafe.Pointer(restartCommand_CArray))
|
|
for i := range restartCommand {
|
|
single_ms := miqt_strdupg(restartCommand[i])
|
|
defer C.free(single_ms)
|
|
restartCommand_CArray[i] = (*C.struct_miqt_string)(single_ms)
|
|
}
|
|
restartCommand_ma := &C.struct_miqt_array{len: C.size_t(len(restartCommand)), data: unsafe.Pointer(restartCommand_CArray)}
|
|
defer runtime.KeepAlive(unsafe.Pointer(restartCommand_ma))
|
|
C.QSessionManager_SetRestartCommand(this.h, restartCommand_ma)
|
|
}
|
|
|
|
func (this *QSessionManager) RestartCommand() []string {
|
|
var _ma *C.struct_miqt_array = C.QSessionManager_RestartCommand(this.h)
|
|
_ret := make([]string, int(_ma.len))
|
|
_outCast := (*[0xffff]*C.struct_miqt_string)(unsafe.Pointer(_ma.data)) // hey ya
|
|
for i := 0; i < int(_ma.len); i++ {
|
|
_ret[i] = C.GoStringN(&_outCast[i].data, C.int(int64(_outCast[i].len)))
|
|
C.free(unsafe.Pointer(_outCast[i])) // free the inner miqt_string*
|
|
}
|
|
C.free(unsafe.Pointer(_ma))
|
|
return _ret
|
|
}
|
|
|
|
func (this *QSessionManager) SetDiscardCommand(discardCommand []string) {
|
|
// For the C ABI, malloc two C arrays; raw char* pointers and their lengths
|
|
discardCommand_CArray := (*[0xffff]*C.struct_miqt_string)(C.malloc(C.size_t(8 * len(discardCommand))))
|
|
defer C.free(unsafe.Pointer(discardCommand_CArray))
|
|
for i := range discardCommand {
|
|
single_ms := miqt_strdupg(discardCommand[i])
|
|
defer C.free(single_ms)
|
|
discardCommand_CArray[i] = (*C.struct_miqt_string)(single_ms)
|
|
}
|
|
discardCommand_ma := &C.struct_miqt_array{len: C.size_t(len(discardCommand)), data: unsafe.Pointer(discardCommand_CArray)}
|
|
defer runtime.KeepAlive(unsafe.Pointer(discardCommand_ma))
|
|
C.QSessionManager_SetDiscardCommand(this.h, discardCommand_ma)
|
|
}
|
|
|
|
func (this *QSessionManager) DiscardCommand() []string {
|
|
var _ma *C.struct_miqt_array = C.QSessionManager_DiscardCommand(this.h)
|
|
_ret := make([]string, int(_ma.len))
|
|
_outCast := (*[0xffff]*C.struct_miqt_string)(unsafe.Pointer(_ma.data)) // hey ya
|
|
for i := 0; i < int(_ma.len); i++ {
|
|
_ret[i] = C.GoStringN(&_outCast[i].data, C.int(int64(_outCast[i].len)))
|
|
C.free(unsafe.Pointer(_outCast[i])) // free the inner miqt_string*
|
|
}
|
|
C.free(unsafe.Pointer(_ma))
|
|
return _ret
|
|
}
|
|
|
|
func (this *QSessionManager) SetManagerProperty(name string, value string) {
|
|
name_ms := miqt_strdupg(name)
|
|
defer C.free(name_ms)
|
|
value_ms := miqt_strdupg(value)
|
|
defer C.free(value_ms)
|
|
C.QSessionManager_SetManagerProperty(this.h, (*C.struct_miqt_string)(name_ms), (*C.struct_miqt_string)(value_ms))
|
|
}
|
|
|
|
func (this *QSessionManager) SetManagerProperty2(name string, value []string) {
|
|
name_ms := miqt_strdupg(name)
|
|
defer C.free(name_ms)
|
|
// For the C ABI, malloc two C arrays; raw char* pointers and their lengths
|
|
value_CArray := (*[0xffff]*C.struct_miqt_string)(C.malloc(C.size_t(8 * len(value))))
|
|
defer C.free(unsafe.Pointer(value_CArray))
|
|
for i := range value {
|
|
single_ms := miqt_strdupg(value[i])
|
|
defer C.free(single_ms)
|
|
value_CArray[i] = (*C.struct_miqt_string)(single_ms)
|
|
}
|
|
value_ma := &C.struct_miqt_array{len: C.size_t(len(value)), data: unsafe.Pointer(value_CArray)}
|
|
defer runtime.KeepAlive(unsafe.Pointer(value_ma))
|
|
C.QSessionManager_SetManagerProperty2(this.h, (*C.struct_miqt_string)(name_ms), value_ma)
|
|
}
|
|
|
|
func (this *QSessionManager) IsPhase2() bool {
|
|
_ret := C.QSessionManager_IsPhase2(this.h)
|
|
return (bool)(_ret)
|
|
}
|
|
|
|
func (this *QSessionManager) RequestPhase2() {
|
|
C.QSessionManager_RequestPhase2(this.h)
|
|
}
|
|
|
|
func QSessionManager_Tr2(s string, c string) string {
|
|
s_Cstring := C.CString(s)
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
|
c_Cstring := C.CString(c)
|
|
defer C.free(unsafe.Pointer(c_Cstring))
|
|
var _ms *C.struct_miqt_string = C.QSessionManager_Tr2(s_Cstring, c_Cstring)
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
C.free(unsafe.Pointer(_ms))
|
|
return _ret
|
|
}
|
|
|
|
func QSessionManager_Tr3(s string, c string, n int) string {
|
|
s_Cstring := C.CString(s)
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
|
c_Cstring := C.CString(c)
|
|
defer C.free(unsafe.Pointer(c_Cstring))
|
|
var _ms *C.struct_miqt_string = C.QSessionManager_Tr3(s_Cstring, c_Cstring, (C.int)(n))
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
C.free(unsafe.Pointer(_ms))
|
|
return _ret
|
|
}
|
|
|
|
func QSessionManager_TrUtf82(s string, c string) string {
|
|
s_Cstring := C.CString(s)
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
|
c_Cstring := C.CString(c)
|
|
defer C.free(unsafe.Pointer(c_Cstring))
|
|
var _ms *C.struct_miqt_string = C.QSessionManager_TrUtf82(s_Cstring, c_Cstring)
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
C.free(unsafe.Pointer(_ms))
|
|
return _ret
|
|
}
|
|
|
|
func QSessionManager_TrUtf83(s string, c string, n int) string {
|
|
s_Cstring := C.CString(s)
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
|
c_Cstring := C.CString(c)
|
|
defer C.free(unsafe.Pointer(c_Cstring))
|
|
var _ms *C.struct_miqt_string = C.QSessionManager_TrUtf83(s_Cstring, c_Cstring, (C.int)(n))
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
C.free(unsafe.Pointer(_ms))
|
|
return _ret
|
|
}
|