mirror of
https://github.com/bluszcz/cutego.git
synced 2024-09-28 21:25:16 +03:00
preparation for Qt 5.8.0
This commit is contained in:
parent
c4bd0d0b10
commit
9d86d8aac3
14 changed files with 213 additions and 11 deletions
|
@ -555,6 +555,7 @@ func main() {
|
|||
|
||||
* [5k3105/AM](https://github.com/5k3105/AM)
|
||||
* [5k3105/Pipeline-Editor](https://github.com/5k3105/Pipeline-Editor)
|
||||
* [5k3105/Sprite-Editor](https://github.com/5k3105/Sprite-Editor)
|
||||
* [gen2brain/url2img](https://github.com/gen2brain/url2img)
|
||||
* [joeblew99/qt-archi](https://github.com/joeblew99/qt-archi)
|
||||
* [jordanorelli/grpc-ui](https://github.com/jordanorelli/grpc-ui)
|
||||
|
|
|
@ -3,6 +3,8 @@ package parser
|
|||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/therecipe/qt/internal/utils"
|
||||
)
|
||||
|
||||
type Class struct {
|
||||
|
@ -173,6 +175,16 @@ func (c *Class) IsSupported() bool {
|
|||
return false
|
||||
}
|
||||
|
||||
if utils.QT_VERSION() == "5.8.0" {
|
||||
switch c.Name {
|
||||
case "QSctpServer", "QSctpSocket", "Http2", "QAbstractExtensionFactory":
|
||||
{
|
||||
c.Access = "unsupported_isBlockedClass"
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch c.Name {
|
||||
case
|
||||
"QString", "QStringList", //mapped to primitive
|
||||
|
|
|
@ -131,6 +131,13 @@ func (c *Class) fixBases() {
|
|||
return
|
||||
}
|
||||
|
||||
if utils.QT_VERSION() == "5.8.0" {
|
||||
if c.Name == "QDesignerCustomWidgetInterface" ||
|
||||
c.Name == "QDesignerCustomWidgetCollectionInterface" {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
var (
|
||||
prefixPath string
|
||||
infixPath = "include"
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package parser
|
||||
|
||||
import "strings"
|
||||
import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
func (c *Class) remove() {
|
||||
c.removeFunctions()
|
||||
|
@ -57,7 +59,7 @@ func (c *Class) removeEnums() {
|
|||
func (c *Class) removeEnums_Version() {
|
||||
for i := len(c.Enums) - 1; i >= 0; i-- {
|
||||
switch c.Enums[i].ClassName() {
|
||||
case "QCss", "QScript":
|
||||
case "QCss", "QScript", "Http2":
|
||||
{
|
||||
c.Enums = append(c.Enums[:i], c.Enums[i+1:]...)
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@ package parser
|
|||
import (
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/therecipe/qt/internal/utils"
|
||||
)
|
||||
|
||||
type Function struct {
|
||||
|
@ -131,6 +133,18 @@ func (f *Function) IsJNIGeneric() bool {
|
|||
|
||||
func (f *Function) IsSupported() bool {
|
||||
|
||||
if utils.QT_VERSION() == "5.8.0" {
|
||||
if f.Fullname == "QJSEngine::newQMetaObject" && f.OverloadNumber == "2" ||
|
||||
f.Fullname == "QScxmlTableData::instructions" || f.Fullname == "QScxmlTableData::dataNames" ||
|
||||
f.Fullname == "QScxmlTableData::stateMachineTable" ||
|
||||
f.Fullname == "QTextToSpeech::voiceChanged" {
|
||||
if !strings.Contains(f.Access, "unsupported") {
|
||||
f.Access = "unsupported_isBlockedFunction"
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
switch {
|
||||
case
|
||||
(f.ClassName() == "QAccessibleObject" || f.ClassName() == "QAccessibleInterface" || f.ClassName() == "QAccessibleWidget" || //QAccessible::State -> quint64
|
||||
|
|
|
@ -132,6 +132,10 @@ var LibDeps = map[string][]string{
|
|||
"Charts": {"Widgets", "Gui", "Core"},
|
||||
//"Quick2DRenderer": {}, //TODO: uncomment
|
||||
|
||||
//"NetworkAuth": {"Network", "Gui", "Core"},
|
||||
"Speech": {"Core"},
|
||||
"QuickControls2": {"Core"},
|
||||
|
||||
"Sailfish": {"Core"},
|
||||
|
||||
MOC: make([]string, 0),
|
||||
|
@ -181,6 +185,10 @@ var Libs = []string{
|
|||
"Charts", //GPLv3
|
||||
//"Quick2DRenderer", //GPLv3
|
||||
|
||||
//"NetworkAuth",
|
||||
"Speech",
|
||||
"QuickControls2",
|
||||
|
||||
"Sailfish",
|
||||
}
|
||||
|
||||
|
@ -189,20 +197,24 @@ func ShouldBuild(module string) bool {
|
|||
}
|
||||
|
||||
func GetLibs() []string {
|
||||
var out = Libs
|
||||
for i := len(Libs) - 1; i >= 0; i-- {
|
||||
switch {
|
||||
case
|
||||
!(runtime.GOOS == "darwin" || runtime.GOOS == "linux") && Libs[i] == "WebEngine",
|
||||
case !(runtime.GOOS == "darwin" || runtime.GOOS == "linux") && Libs[i] == "WebEngine",
|
||||
runtime.GOOS != "windows" && Libs[i] == "WinExtras",
|
||||
runtime.GOOS != "darwin" && Libs[i] == "MacExtras",
|
||||
runtime.GOOS != "linux" && Libs[i] == "X11Extras":
|
||||
{
|
||||
Libs = append(Libs[:i], Libs[i+1:]...)
|
||||
out = append(out[:i], out[i+1:]...)
|
||||
}
|
||||
|
||||
case utils.QT_VERSION() != "5.8.0" && Libs[i] == "Speech":
|
||||
{
|
||||
out = append(out[:i], out[i+1:]...)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Libs
|
||||
return out
|
||||
}
|
||||
|
||||
func Dump() {
|
||||
|
|
|
@ -1074,6 +1074,9 @@ func cleanLibs(module string) []string {
|
|||
if v == "TestLib" {
|
||||
out[i] = "Test"
|
||||
}
|
||||
if v == "Speech" {
|
||||
out[i] = "TextToSpeech"
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@ func ParseFlags() {
|
|||
|
||||
if *debug {
|
||||
utils.Log.Level = logrus.DebugLevel
|
||||
os.Setenv("QT_DEBUG", "true")
|
||||
}
|
||||
|
||||
runtime.GOMAXPROCS(*p)
|
||||
|
|
|
@ -69,7 +69,7 @@ func install(buildTarget string) {
|
|||
for _, module := range parser.GetLibs() {
|
||||
if parser.ShouldBuild(module) {
|
||||
|
||||
if !(buildTarget == "android" && (module == "DBus" || module == "WebEngine" || module == "Designer" || (strings.HasSuffix(module, "Extras") && module != "AndroidExtras"))) &&
|
||||
if !(buildTarget == "android" && (module == "DBus" || module == "WebEngine" || module == "PrintSupport" || module == "Designer" || (strings.HasSuffix(module, "Extras") && module != "AndroidExtras"))) &&
|
||||
!(strings.HasPrefix(buildTarget, "ios") && (module == "SerialPort" || module == "SerialBus" || module == "WebEngine" || module == "PrintSupport" || module == "Designer" || strings.HasSuffix(module, "Extras"))) && //TODO: support for PrintSupport
|
||||
!(strings.HasPrefix(buildTarget, "rpi") && (module == "WebEngine" || module == "Designer" || strings.HasSuffix(module, "Extras"))) { //TODO: support for WebEngine (rpi2 + rpi3)
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
//source: http://doc.qt.io/qt-5/qtsql-querymodel-example.html
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
|
|
|
@ -9,7 +9,15 @@ import (
|
|||
"strings"
|
||||
)
|
||||
|
||||
var (
|
||||
QT_VERSION_CACHE string
|
||||
)
|
||||
|
||||
func QT_VERSION() string {
|
||||
if QT_VERSION_CACHE != "" {
|
||||
return QT_VERSION_CACHE
|
||||
}
|
||||
|
||||
if version := os.Getenv("QT_VERSION"); version != "" {
|
||||
return version
|
||||
}
|
||||
|
@ -27,7 +35,8 @@ func QT_VERSION() string {
|
|||
err = json.Unmarshal([]byte(LoadOptional(filepath.Join(QT_DARWIN_DIR(), "INSTALL_RECEIPT.json"))), cStruct)
|
||||
)
|
||||
if err == nil {
|
||||
return cStruct.Source.Versions.Stable
|
||||
QT_VERSION_CACHE = cStruct.Source.Versions.Stable
|
||||
return QT_VERSION_CACHE
|
||||
}
|
||||
} else {*/
|
||||
if dir := os.Getenv("QT_DIR"); dir != "" {
|
||||
|
@ -40,7 +49,8 @@ func QT_VERSION() string {
|
|||
err = xml.Unmarshal([]byte(LoadOptional(filepath.Join(dir, "components.xml"))), cStruct)
|
||||
)
|
||||
if err == nil {
|
||||
return strings.TrimSpace(strings.Split(cStruct.ApplicationName, " ")[1])
|
||||
QT_VERSION_CACHE = strings.TrimSpace(strings.Split(cStruct.ApplicationName, " ")[1])
|
||||
return QT_VERSION_CACHE
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
|
27
quickcontrols2/quickcontrols2.cpp
Executable file
27
quickcontrols2/quickcontrols2.cpp
Executable file
|
@ -0,0 +1,27 @@
|
|||
// +build !minimal
|
||||
|
||||
#define protected public
|
||||
#define private public
|
||||
|
||||
#include "quickcontrols2.h"
|
||||
#include "_cgo_export.h"
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QQuickStyle>
|
||||
#include <QString>
|
||||
|
||||
struct QtQuickControls2_PackedString QQuickStyle_QQuickStyle_Name()
|
||||
{
|
||||
return ({ QByteArray tca3084 = QQuickStyle::name().toUtf8(); QtQuickControls2_PackedString { const_cast<char*>(tca3084.prepend("WHITESPACE").constData()+10), tca3084.size()-10 }; });
|
||||
}
|
||||
|
||||
struct QtQuickControls2_PackedString QQuickStyle_QQuickStyle_Path()
|
||||
{
|
||||
return ({ QByteArray t432960 = QQuickStyle::path().toUtf8(); QtQuickControls2_PackedString { const_cast<char*>(t432960.prepend("WHITESPACE").constData()+10), t432960.size()-10 }; });
|
||||
}
|
||||
|
||||
void QQuickStyle_QQuickStyle_SetStyle(char* style)
|
||||
{
|
||||
QQuickStyle::setStyle(QString(style));
|
||||
}
|
||||
|
89
quickcontrols2/quickcontrols2.go
Executable file
89
quickcontrols2/quickcontrols2.go
Executable file
|
@ -0,0 +1,89 @@
|
|||
// +build !minimal
|
||||
|
||||
package quickcontrols2
|
||||
|
||||
//#include <stdint.h>
|
||||
//#include <stdlib.h>
|
||||
//#include "quickcontrols2.h"
|
||||
import "C"
|
||||
import (
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
func cGoUnpackString(s C.struct_QtQuickControls2_PackedString) string {
|
||||
if len := int(s.len); len == -1 {
|
||||
return C.GoString(s.data)
|
||||
}
|
||||
return C.GoStringN(s.data, C.int(s.len))
|
||||
}
|
||||
|
||||
type QQuickStyle struct {
|
||||
ptr unsafe.Pointer
|
||||
}
|
||||
|
||||
type QQuickStyle_ITF interface {
|
||||
QQuickStyle_PTR() *QQuickStyle
|
||||
}
|
||||
|
||||
func (p *QQuickStyle) QQuickStyle_PTR() *QQuickStyle {
|
||||
return p
|
||||
}
|
||||
|
||||
func (p *QQuickStyle) Pointer() unsafe.Pointer {
|
||||
if p != nil {
|
||||
return p.ptr
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *QQuickStyle) SetPointer(ptr unsafe.Pointer) {
|
||||
if p != nil {
|
||||
p.ptr = ptr
|
||||
}
|
||||
}
|
||||
|
||||
func PointerFromQQuickStyle(ptr QQuickStyle_ITF) unsafe.Pointer {
|
||||
if ptr != nil {
|
||||
return ptr.QQuickStyle_PTR().Pointer()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewQQuickStyleFromPointer(ptr unsafe.Pointer) *QQuickStyle {
|
||||
var n = new(QQuickStyle)
|
||||
n.SetPointer(ptr)
|
||||
return n
|
||||
}
|
||||
|
||||
func (ptr *QQuickStyle) DestroyQQuickStyle() {
|
||||
C.free(ptr.Pointer())
|
||||
ptr.SetPointer(nil)
|
||||
}
|
||||
|
||||
func QQuickStyle_Name() string {
|
||||
return cGoUnpackString(C.QQuickStyle_QQuickStyle_Name())
|
||||
}
|
||||
|
||||
func (ptr *QQuickStyle) Name() string {
|
||||
return cGoUnpackString(C.QQuickStyle_QQuickStyle_Name())
|
||||
}
|
||||
|
||||
func QQuickStyle_Path() string {
|
||||
return cGoUnpackString(C.QQuickStyle_QQuickStyle_Path())
|
||||
}
|
||||
|
||||
func (ptr *QQuickStyle) Path() string {
|
||||
return cGoUnpackString(C.QQuickStyle_QQuickStyle_Path())
|
||||
}
|
||||
|
||||
func QQuickStyle_SetStyle(style string) {
|
||||
var styleC = C.CString(style)
|
||||
defer C.free(unsafe.Pointer(styleC))
|
||||
C.QQuickStyle_QQuickStyle_SetStyle(styleC)
|
||||
}
|
||||
|
||||
func (ptr *QQuickStyle) SetStyle(style string) {
|
||||
var styleC = C.CString(style)
|
||||
defer C.free(unsafe.Pointer(styleC))
|
||||
C.QQuickStyle_QQuickStyle_SetStyle(styleC)
|
||||
}
|
24
quickcontrols2/quickcontrols2.h
Executable file
24
quickcontrols2/quickcontrols2.h
Executable file
|
@ -0,0 +1,24 @@
|
|||
// +build !minimal
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef GO_QTQUICKCONTROLS2_H
|
||||
#define GO_QTQUICKCONTROLS2_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct QtQuickControls2_PackedString { char* data; long long len; };
|
||||
struct QtQuickControls2_PackedList { void* data; long long len; };
|
||||
struct QtQuickControls2_PackedString QQuickStyle_QQuickStyle_Name();
|
||||
struct QtQuickControls2_PackedString QQuickStyle_QQuickStyle_Path();
|
||||
void QQuickStyle_QQuickStyle_SetStyle(char* style);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue