morpheus

A Matrix client written in Go-QT
git clone git://archive.git.mtrnord.blog/Nordgedanken/morpheus.git
Log | Files | Refs | README | LICENSE

commit 65c449b3ea024ec3d94c0ccf431eb7ec0b06822c
parent f5f014c477fa66768a9872d28950a974bfc77fd2
Author: MTRNord <mtrnord1@gmail.com>
Date:   Tue, 10 Oct 2017 10:26:52 +0200

Allow receiving messages (basic support not yet useable in any way.

Signed-off-by: MTRNord <mtrnord1@gmail.com>

Diffstat:
ABetaLogo.zip | 0
ALogo.zip | 0
ALogo/Logo.png | 0
ALogo/LogoBeta.png | 0
ALogo/icon.svg | 2++
Melements/messageList.go | 17+++++++++++++----
Aelements/moc.cpp | 349+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aelements/moc.go | 780+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aelements/moc.h | 76++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aelements/moc_cgo_windows_windows_amd64.go | 10++++++++++
Aelements/moc_moc.h | 114+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mmain.go | 8++------
Mmatrix/db.go | 29+++++++++++++++++++++++++++++
Mmatrix/types.go | 17+++++++++++++++++
Aqml/icons/ic_send_black_48px.svg | 5+++++
Mqml/ui/chat.ui | 3+++
Muis.go | 28+++++++++++++++++++++-------
17 files changed, 1421 insertions(+), 17 deletions(-)

diff --git a/BetaLogo.zip b/BetaLogo.zip Binary files differ. diff --git a/Logo.zip b/Logo.zip Binary files differ. diff --git a/Logo/Logo.png b/Logo/Logo.png Binary files differ. diff --git a/Logo/LogoBeta.png b/Logo/LogoBeta.png Binary files differ. diff --git a/Logo/icon.svg b/Logo/icon.svg @@ -0,0 +1 @@ +<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="48" height="48"><defs><linearGradient x1="12.94323" y1="13.95561" x2="54.72492" y2="55.76969" gradientUnits="userSpaceOnUse" id="color-1"><stop offset="0.19" stop-color="#000000" stop-opacity="0.57"></stop><stop offset="1" stop-color="#000000" stop-opacity="0"></stop></linearGradient><linearGradient x1="33.625" y1="14.375" x2="43" y2="23.75" gradientUnits="userSpaceOnUse" id="color-2"><stop offset="0" stop-color="#000000" stop-opacity="0.57"></stop><stop offset="1" stop-color="#000000" stop-opacity="0"></stop></linearGradient><filter id="dropshadow-base"><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .8 0"></feColorMatrix> <feOffset dx="0" dy="1"></feOffset> <feGaussianBlur stdDeviation="1"></feGaussianBlur> <feComposite in="SourceGraphic"></feComposite></filter><filter id="dropshadow-banner" x="-10%" y="-10%" width="120%" height="130%"><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .4 0"></feColorMatrix> <feOffset dx="0" dy="1"></feOffset> <feGaussianBlur stdDeviation="0.5"></feGaussianBlur> <feComposite in="SourceGraphic"></feComposite></filter></defs><g fill="none" fill-rule="nonzero" stroke="none" stroke-width="none" stroke-linecap="butt" stroke-linejoin="miter" stroke-miterlimit="10" stroke-dasharray="" stroke-dashoffset="0" font-family="none" font-weight="none" font-size="none" text-anchor="none" style="mix-blend-mode: normal"><path d="M7,43c-1.10457,0 -2,-0.89543 -2,-2v-34c0,-1.10457 0.89543,-2 2,-2l26,0l10,10v26c0,1.10457 -0.89543,2 -2,2z" id="base 1 9 1 2" fill="#ffba94" stroke-width="1"></path><path d="M29.58844,16.81144l13.41156,13.41156v10.777c0,1.10457 -0.89543,2 -2,2l-12.83414,0l-12.36001,-12.36001c-1.7685,-1.7685 -2.86261,-4.2134 -2.86261,-6.91428c0,-5.39588 4.36698,-9.77011 9.75391,-9.77011c2.69054,0 5.12664,1.09118 6.8913,2.85583z" fill="url(#color-1)" stroke-width="1"></path><path d="M12.94324,23.72571c0,-5.39588 4.36697,-9.77011 9.75391,-9.77011c5.38693,0 9.75391,4.37423 9.75391,9.77011c0,5.39588 -4.36697,9.77011 -9.75391,9.77011c-5.38693,0 -9.75391,-4.37423 -9.75391,-9.77011z" id="path4574 1 1" fill="none" stroke-width="0"></path><g id="svg8 2"><g id="layer2 1" fill="#bdbdbd" stroke-width="0.26458"><path d="M12.94324,23.72571c0,-5.39588 4.36697,-9.77011 9.75391,-9.77011c5.38693,0 9.75391,4.37423 9.75391,9.77011c0,5.39588 -4.36697,9.77011 -9.75391,9.77011c-5.38693,0 -9.75391,-4.37423 -9.75391,-9.77011z" id="path4574 1"></path></g><g id="layer1 1" fill="#ffffff" stroke-width="0.16607"><path d="M16.4002,29.59082l-0.2394,-0.2394v-5.54085v-5.54084l0.2394,-0.2394c0.17386,-0.17386 0.31827,-0.23941 0.52749,-0.23941c0.32864,0 0.24577,-0.0629 3.69461,2.80416l2.20925,1.83658l2.6693,-2.22758c1.46812,-1.22517 2.74732,-2.26933 2.84269,-2.32037c0.31343,-0.16775 0.66947,-0.11147 0.92755,0.14661l0.2394,0.2394v5.49989v5.49989l-0.2394,0.2394c-0.33041,0.33041 -0.74689,0.33041 -1.0773,0l-0.2394,-0.2394v-4.46984c0,-2.45842 -0.01947,-4.46985 -0.04328,-4.46985c-0.02381,0 -1.0281,0.8215 -2.23177,1.82556c-1.20367,1.00405 -2.27962,1.88857 -2.39099,1.96559c-0.47224,0.32659 -0.5853,0.26401 -2.74278,-1.51843c-1.10409,-0.91216 -2.183,-1.79682 -2.39758,-1.96591l-0.39014,-0.30744l-0.04095,4.55289l-0.04095,4.55289l-0.22979,0.19762c-0.32864,0.28263 -0.73789,0.26628 -1.04596,-0.04177z" id="path32 1"></path></g></g><path d="M2,24c0,-12.15026 9.84974,-22 22,-22c12.15026,0 22,9.84974 22,22c0,12.15026 -9.84974,22 -22,22c-12.15026,0 -22,-9.84974 -22,-22z" id="base 1 5 1" fill="none" stroke-width="1"></path><path d="M2,24c0,-12.15026 9.84974,-22 22,-22c12.15026,0 22,9.84974 22,22c0,12.15026 -9.84974,22 -22,22c-12.15026,0 -22,-9.84974 -22,-22z" id="base 1 1 1" fill="none" stroke-width="1"></path><g fill="#000000" stroke-width="1" font-family="Roboto, sans-serif" font-weight="normal" font-size="14" text-anchor="start"></g><rect x="2" y="2" width="44" height="22" fill="none" stroke-width="1"></rect><path d="M2,24v-22h44v22z" fill="none" stroke-width="1"></path><path d="M2,24v-22h44v22z" fill="none" stroke-width="1"></path><path d="M2,24v-22h44v22z" fill="none" stroke-width="1"></path><path d="M2,24v-22h44v22z" fill="none" stroke-width="1"></path><g id="svg8 1 1" fill="#000000" stroke-width="1" font-family="Roboto, sans-serif" font-weight="normal" font-size="14" text-anchor="start"><g id="layer2 1 1"></g><g id="layer1 1 1"></g></g><rect x="2" y="2" width="44" height="22" fill="none" stroke-width="1"></rect><path d="M2,24v-22h44v22z" fill="none" stroke-width="1"></path><path d="M2,24v-22h44v22z" fill="none" stroke-width="1"></path><path d="M2,24v-22h44v22z" fill="none" stroke-width="1"></path><path d="M2,24v-22h44v22z" fill="none" stroke-width="1"></path><path d="M33.625,14.375l9.375,0.625v8.75z" fill="url(#color-2)" stroke-width="1"></path><path d="M33,5l10,10h-8c-1,0 -2,-1 -2,-2z" fill="#ffd8b2" stroke-width="1"></path></g></svg> +\ No newline at end of file diff --git a/elements/messageList.go b/elements/messageList.go @@ -5,14 +5,23 @@ import ( "github.com/therecipe/qt/widgets" ) -func NewMessageList() (messageView *widgets.QWidget, messageViewLayout *widgets.QGridLayout) { +type QGridLayoutWithTriggerSlot struct { + widgets.QGridLayout + + _ func(messageBody string) `slot:"TriggerMessage"` +} + +func NewMessageList() (messageView *widgets.QWidget, messageViewLayout *QGridLayoutWithTriggerSlot) { messageView = widgets.NewQWidget(nil, 0) messageScroll := widgets.NewQScrollArea(nil) messageScroll.SetObjectName("messageScroll") messageScroll.SetStyleSheet("QScrollArea#messageScroll { border: 0px; };") + messageScroll.SetStyleSheet("QScrollArea#messageScroll { border: 0px; };") + + messageViewLayout = NewQGridLayoutWithTriggerSlot(messageView) - messageViewLayout = widgets.NewQGridLayout(messageView) + //messageViewLayout = widgets.NewQGridLayout(messageView) messageViewLayout.SetSpacing(0) messageViewLayout.SetContentsMargins(0, 0, 0, 0) @@ -22,7 +31,7 @@ func NewMessageList() (messageView *widgets.QWidget, messageViewLayout *widgets. return } -func NewMessage(messageBody string, messageViewLayout *widgets.QGridLayout) { +func (messageViewLayout *QGridLayoutWithTriggerSlot) NewMessage(messageBody string) { mesageWidget := widgets.NewQWidget(nil, 0) mesageWidget.SetStyleSheet("QLabel { border: 0px; }; QWidget { border: 0px; };") @@ -30,7 +39,7 @@ func NewMessage(messageBody string, messageViewLayout *widgets.QGridLayout) { message := widgets.NewQLabel2(messageBody, nil, 0) - messageLayout.AddWidget(message, 0, core.Qt__AlignTop) + message.SetLayout(messageLayout) messageViewLayout.AddWidget(message, 0, 0, core.Qt__AlignTop) diff --git a/elements/moc.cpp b/elements/moc.cpp @@ -0,0 +1,349 @@ + + +#define protected public +#define private public + +#include "moc.h" +#include "_cgo_export.h" + +#include <QByteArray> +#include <QChildEvent> +#include <QEvent> +#include <QGridLayout> +#include <QLayout> +#include <QLayoutItem> +#include <QList> +#include <QMetaMethod> +#include <QMetaObject> +#include <QObject> +#include <QRect> +#include <QSize> +#include <QSizePolicy> +#include <QSpacerItem> +#include <QString> +#include <QTime> +#include <QTimer> +#include <QTimerEvent> +#include <QWidget> + + +class QGridLayoutWithTriggerSlot: public QGridLayout +{ +Q_OBJECT +public: + QGridLayoutWithTriggerSlot() : QGridLayout() {qRegisterMetaType<quintptr>("quintptr");QGridLayoutWithTriggerSlot_QGridLayoutWithTriggerSlot_QRegisterMetaType();QGridLayoutWithTriggerSlot_QGridLayoutWithTriggerSlot_QRegisterMetaTypes();callbackQGridLayoutWithTriggerSlot_Constructor(this);}; + QGridLayoutWithTriggerSlot(QWidget *parent) : QGridLayout(parent) {qRegisterMetaType<quintptr>("quintptr");QGridLayoutWithTriggerSlot_QGridLayoutWithTriggerSlot_QRegisterMetaType();QGridLayoutWithTriggerSlot_QGridLayoutWithTriggerSlot_QRegisterMetaTypes();callbackQGridLayoutWithTriggerSlot_Constructor(this);}; + QLayoutItem * takeAt(int index) { return static_cast<QLayoutItem*>(callbackQGridLayoutWithTriggerSlot_TakeAt(this, index)); }; + void invalidate() { callbackQGridLayoutWithTriggerSlot_Invalidate(this); }; + void setGeometry(const QRect & rect) { callbackQGridLayoutWithTriggerSlot_SetGeometry(this, const_cast<QRect*>(&rect)); }; + QLayoutItem * itemAt(int index) const { return static_cast<QLayoutItem*>(callbackQGridLayoutWithTriggerSlot_ItemAt(const_cast<void*>(static_cast<const void*>(this)), index)); }; + QSize maximumSize() const { return *static_cast<QSize*>(callbackQGridLayoutWithTriggerSlot_MaximumSize(const_cast<void*>(static_cast<const void*>(this)))); }; + QSize minimumSize() const { return *static_cast<QSize*>(callbackQGridLayoutWithTriggerSlot_MinimumSize(const_cast<void*>(static_cast<const void*>(this)))); }; + QSize sizeHint() const { return *static_cast<QSize*>(callbackQGridLayoutWithTriggerSlot_SizeHint(const_cast<void*>(static_cast<const void*>(this)))); }; + Qt::Orientations expandingDirections() const { return static_cast<Qt::Orientation>(callbackQGridLayoutWithTriggerSlot_ExpandingDirections(const_cast<void*>(static_cast<const void*>(this)))); }; + bool hasHeightForWidth() const { return callbackQGridLayoutWithTriggerSlot_HasHeightForWidth(const_cast<void*>(static_cast<const void*>(this))) != 0; }; + int count() const { return callbackQGridLayoutWithTriggerSlot_Count(const_cast<void*>(static_cast<const void*>(this))); }; + int heightForWidth(int w) const { return callbackQGridLayoutWithTriggerSlot_HeightForWidth(const_cast<void*>(static_cast<const void*>(this)), w); }; + int minimumHeightForWidth(int w) const { return callbackQGridLayoutWithTriggerSlot_MinimumHeightForWidth(const_cast<void*>(static_cast<const void*>(this)), w); }; + QLayout * layout() { return static_cast<QLayout*>(callbackQGridLayoutWithTriggerSlot_Layout(this)); }; + void addItem(QLayoutItem * item) { callbackQGridLayoutWithTriggerSlot_AddItem(this, item); }; + void childEvent(QChildEvent * e) { callbackQGridLayoutWithTriggerSlot_ChildEvent(this, e); }; + QRect geometry() const { return *static_cast<QRect*>(callbackQGridLayoutWithTriggerSlot_Geometry(const_cast<void*>(static_cast<const void*>(this)))); }; + QSizePolicy::ControlTypes controlTypes() const { return static_cast<QSizePolicy::ControlType>(callbackQGridLayoutWithTriggerSlot_ControlTypes(const_cast<void*>(static_cast<const void*>(this)))); }; + bool isEmpty() const { return callbackQGridLayoutWithTriggerSlot_IsEmpty(const_cast<void*>(static_cast<const void*>(this))) != 0; }; + int indexOf(QWidget * widget) const { return callbackQGridLayoutWithTriggerSlot_IndexOf(const_cast<void*>(static_cast<const void*>(this)), widget); }; + bool event(QEvent * e) { return callbackQGridLayoutWithTriggerSlot_Event(this, e) != 0; }; + bool eventFilter(QObject * watched, QEvent * event) { return callbackQGridLayoutWithTriggerSlot_EventFilter(this, watched, event) != 0; }; + void connectNotify(const QMetaMethod & sign) { callbackQGridLayoutWithTriggerSlot_ConnectNotify(this, const_cast<QMetaMethod*>(&sign)); }; + void customEvent(QEvent * event) { callbackQGridLayoutWithTriggerSlot_CustomEvent(this, event); }; + void deleteLater() { callbackQGridLayoutWithTriggerSlot_DeleteLater(this); }; + void Signal_Destroyed(QObject * obj) { callbackQGridLayoutWithTriggerSlot_Destroyed(this, obj); }; + void disconnectNotify(const QMetaMethod & sign) { callbackQGridLayoutWithTriggerSlot_DisconnectNotify(this, const_cast<QMetaMethod*>(&sign)); }; + void Signal_ObjectNameChanged(const QString & objectName) { QByteArray taa2c4f = objectName.toUtf8(); Moc_PackedString objectNamePacked = { const_cast<char*>(taa2c4f.prepend("WHITESPACE").constData()+10), taa2c4f.size()-10 };callbackQGridLayoutWithTriggerSlot_ObjectNameChanged(this, objectNamePacked); }; + void timerEvent(QTimerEvent * event) { callbackQGridLayoutWithTriggerSlot_TimerEvent(this, event); }; + + QSpacerItem * spacerItem() { return static_cast<QSpacerItem*>(callbackQGridLayoutWithTriggerSlot_SpacerItem(this)); }; + QWidget * widget() { return static_cast<QWidget*>(callbackQGridLayoutWithTriggerSlot_Widget(this)); }; +signals: +public slots: + void TriggerMessage(QString messageBody) { QByteArray t59bf16 = messageBody.toUtf8(); Moc_PackedString messageBodyPacked = { const_cast<char*>(t59bf16.prepend("WHITESPACE").constData()+10), t59bf16.size()-10 };callbackQGridLayoutWithTriggerSlot_TriggerMessage(this, messageBodyPacked); }; +private: +}; + +Q_DECLARE_METATYPE(QGridLayoutWithTriggerSlot*) + + +void QGridLayoutWithTriggerSlot_QGridLayoutWithTriggerSlot_QRegisterMetaTypes() { +} + +void QGridLayoutWithTriggerSlot_TriggerMessage(void* ptr, struct Moc_PackedString messageBody) +{ + QMetaObject::invokeMethod(static_cast<QGridLayoutWithTriggerSlot*>(ptr), "TriggerMessage", Q_ARG(QString, QString::fromUtf8(messageBody.data, messageBody.len))); +} + +int QGridLayoutWithTriggerSlot_QGridLayoutWithTriggerSlot_QRegisterMetaType() +{ + return qRegisterMetaType<QGridLayoutWithTriggerSlot*>(); +} + +int QGridLayoutWithTriggerSlot_QGridLayoutWithTriggerSlot_QRegisterMetaType2(char* typeName) +{ + return qRegisterMetaType<QGridLayoutWithTriggerSlot*>(const_cast<const char*>(typeName)); +} + +int QGridLayoutWithTriggerSlot_QGridLayoutWithTriggerSlot_QmlRegisterType() +{ +#ifdef QT_QML_LIB + return qmlRegisterType<QGridLayoutWithTriggerSlot>(); +#else + return 0; +#endif +} + +int QGridLayoutWithTriggerSlot_QGridLayoutWithTriggerSlot_QmlRegisterType2(char* uri, int versionMajor, int versionMinor, char* qmlName) +{ +#ifdef QT_QML_LIB + return qmlRegisterType<QGridLayoutWithTriggerSlot>(const_cast<const char*>(uri), versionMajor, versionMinor, const_cast<const char*>(qmlName)); +#else + return 0; +#endif +} + +void* QGridLayoutWithTriggerSlot___dynamicPropertyNames_atList(void* ptr, int i) +{ + return new QByteArray(static_cast<QList<QByteArray>*>(ptr)->at(i)); +} + +void QGridLayoutWithTriggerSlot___dynamicPropertyNames_setList(void* ptr, void* i) +{ + static_cast<QList<QByteArray>*>(ptr)->append(*static_cast<QByteArray*>(i)); +} + +void* QGridLayoutWithTriggerSlot___dynamicPropertyNames_newList(void* ptr) +{ + Q_UNUSED(ptr); + return new QList<QByteArray>; +} + +void* QGridLayoutWithTriggerSlot___findChildren_atList2(void* ptr, int i) +{ + return const_cast<QObject*>(static_cast<QList<QObject*>*>(ptr)->at(i)); +} + +void QGridLayoutWithTriggerSlot___findChildren_setList2(void* ptr, void* i) +{ + static_cast<QList<QObject*>*>(ptr)->append(static_cast<QObject*>(i)); +} + +void* QGridLayoutWithTriggerSlot___findChildren_newList2(void* ptr) +{ + Q_UNUSED(ptr); + return new QList<QObject*>; +} + +void* QGridLayoutWithTriggerSlot___findChildren_atList3(void* ptr, int i) +{ + return const_cast<QObject*>(static_cast<QList<QObject*>*>(ptr)->at(i)); +} + +void QGridLayoutWithTriggerSlot___findChildren_setList3(void* ptr, void* i) +{ + static_cast<QList<QObject*>*>(ptr)->append(static_cast<QObject*>(i)); +} + +void* QGridLayoutWithTriggerSlot___findChildren_newList3(void* ptr) +{ + Q_UNUSED(ptr); + return new QList<QObject*>; +} + +void* QGridLayoutWithTriggerSlot___findChildren_atList(void* ptr, int i) +{ + return const_cast<QObject*>(static_cast<QList<QObject*>*>(ptr)->at(i)); +} + +void QGridLayoutWithTriggerSlot___findChildren_setList(void* ptr, void* i) +{ + static_cast<QList<QObject*>*>(ptr)->append(static_cast<QObject*>(i)); +} + +void* QGridLayoutWithTriggerSlot___findChildren_newList(void* ptr) +{ + Q_UNUSED(ptr); + return new QList<QObject*>; +} + +void* QGridLayoutWithTriggerSlot___children_atList(void* ptr, int i) +{ + return const_cast<QObject*>(static_cast<QList<QObject *>*>(ptr)->at(i)); +} + +void QGridLayoutWithTriggerSlot___children_setList(void* ptr, void* i) +{ + static_cast<QList<QObject *>*>(ptr)->append(static_cast<QObject*>(i)); +} + +void* QGridLayoutWithTriggerSlot___children_newList(void* ptr) +{ + Q_UNUSED(ptr); + return new QList<QObject *>; +} + +void* QGridLayoutWithTriggerSlot_NewQGridLayoutWithTriggerSlot2() +{ + return new QGridLayoutWithTriggerSlot(); +} + +void* QGridLayoutWithTriggerSlot_NewQGridLayoutWithTriggerSlot(void* parent) +{ + return new QGridLayoutWithTriggerSlot(static_cast<QWidget*>(parent)); +} + +void QGridLayoutWithTriggerSlot_DestroyQGridLayoutWithTriggerSlot(void* ptr) +{ + static_cast<QGridLayoutWithTriggerSlot*>(ptr)->~QGridLayoutWithTriggerSlot(); +} + +void* QGridLayoutWithTriggerSlot_TakeAtDefault(void* ptr, int index) +{ + return static_cast<QGridLayoutWithTriggerSlot*>(ptr)->QGridLayout::takeAt(index); +} + +void QGridLayoutWithTriggerSlot_InvalidateDefault(void* ptr) +{ + static_cast<QGridLayoutWithTriggerSlot*>(ptr)->QGridLayout::invalidate(); +} + +void QGridLayoutWithTriggerSlot_SetGeometryDefault(void* ptr, void* rect) +{ + static_cast<QGridLayoutWithTriggerSlot*>(ptr)->QGridLayout::setGeometry(*static_cast<QRect*>(rect)); +} + +void* QGridLayoutWithTriggerSlot_ItemAtDefault(void* ptr, int index) +{ + return static_cast<QGridLayoutWithTriggerSlot*>(ptr)->QGridLayout::itemAt(index); +} + +void* QGridLayoutWithTriggerSlot_MaximumSizeDefault(void* ptr) +{ + return ({ QSize tmpValue = static_cast<QGridLayoutWithTriggerSlot*>(ptr)->QGridLayout::maximumSize(); new QSize(tmpValue.width(), tmpValue.height()); }); +} + +void* QGridLayoutWithTriggerSlot_MinimumSizeDefault(void* ptr) +{ + return ({ QSize tmpValue = static_cast<QGridLayoutWithTriggerSlot*>(ptr)->QGridLayout::minimumSize(); new QSize(tmpValue.width(), tmpValue.height()); }); +} + +void* QGridLayoutWithTriggerSlot_SizeHintDefault(void* ptr) +{ + return ({ QSize tmpValue = static_cast<QGridLayoutWithTriggerSlot*>(ptr)->QGridLayout::sizeHint(); new QSize(tmpValue.width(), tmpValue.height()); }); +} + +long long QGridLayoutWithTriggerSlot_ExpandingDirectionsDefault(void* ptr) +{ + return static_cast<QGridLayoutWithTriggerSlot*>(ptr)->QGridLayout::expandingDirections(); +} + +char QGridLayoutWithTriggerSlot_HasHeightForWidthDefault(void* ptr) +{ + return static_cast<QGridLayoutWithTriggerSlot*>(ptr)->QGridLayout::hasHeightForWidth(); +} + +int QGridLayoutWithTriggerSlot_CountDefault(void* ptr) +{ + return static_cast<QGridLayoutWithTriggerSlot*>(ptr)->QGridLayout::count(); +} + +int QGridLayoutWithTriggerSlot_HeightForWidthDefault(void* ptr, int w) +{ + return static_cast<QGridLayoutWithTriggerSlot*>(ptr)->QGridLayout::heightForWidth(w); +} + +int QGridLayoutWithTriggerSlot_MinimumHeightForWidthDefault(void* ptr, int w) +{ + return static_cast<QGridLayoutWithTriggerSlot*>(ptr)->QGridLayout::minimumHeightForWidth(w); +} + +void* QGridLayoutWithTriggerSlot_LayoutDefault(void* ptr) +{ + return static_cast<QGridLayoutWithTriggerSlot*>(ptr)->QGridLayout::layout(); +} + +void QGridLayoutWithTriggerSlot_AddItemDefault(void* ptr, void* item) +{ + static_cast<QGridLayoutWithTriggerSlot*>(ptr)->QGridLayout::addItem(static_cast<QLayoutItem*>(item)); +} + +void QGridLayoutWithTriggerSlot_ChildEventDefault(void* ptr, void* e) +{ + static_cast<QGridLayoutWithTriggerSlot*>(ptr)->QGridLayout::childEvent(static_cast<QChildEvent*>(e)); +} + +void* QGridLayoutWithTriggerSlot_GeometryDefault(void* ptr) +{ + return ({ QRect tmpValue = static_cast<QGridLayoutWithTriggerSlot*>(ptr)->QGridLayout::geometry(); new QRect(tmpValue.x(), tmpValue.y(), tmpValue.width(), tmpValue.height()); }); +} + +long long QGridLayoutWithTriggerSlot_ControlTypesDefault(void* ptr) +{ + return static_cast<QGridLayoutWithTriggerSlot*>(ptr)->QGridLayout::controlTypes(); +} + +char QGridLayoutWithTriggerSlot_IsEmptyDefault(void* ptr) +{ + return static_cast<QGridLayoutWithTriggerSlot*>(ptr)->QGridLayout::isEmpty(); +} + +int QGridLayoutWithTriggerSlot_IndexOfDefault(void* ptr, void* widget) +{ + return static_cast<QGridLayoutWithTriggerSlot*>(ptr)->QGridLayout::indexOf(static_cast<QWidget*>(widget)); +} + +char QGridLayoutWithTriggerSlot_EventDefault(void* ptr, void* e) +{ + return static_cast<QGridLayoutWithTriggerSlot*>(ptr)->QGridLayout::event(static_cast<QEvent*>(e)); +} + +char QGridLayoutWithTriggerSlot_EventFilterDefault(void* ptr, void* watched, void* event) +{ + return static_cast<QGridLayoutWithTriggerSlot*>(ptr)->QGridLayout::eventFilter(static_cast<QObject*>(watched), static_cast<QEvent*>(event)); +} + +void QGridLayoutWithTriggerSlot_ConnectNotifyDefault(void* ptr, void* sign) +{ + static_cast<QGridLayoutWithTriggerSlot*>(ptr)->QGridLayout::connectNotify(*static_cast<QMetaMethod*>(sign)); +} + +void QGridLayoutWithTriggerSlot_CustomEventDefault(void* ptr, void* event) +{ + static_cast<QGridLayoutWithTriggerSlot*>(ptr)->QGridLayout::customEvent(static_cast<QEvent*>(event)); +} + +void QGridLayoutWithTriggerSlot_DeleteLaterDefault(void* ptr) +{ + static_cast<QGridLayoutWithTriggerSlot*>(ptr)->QGridLayout::deleteLater(); +} + +void QGridLayoutWithTriggerSlot_DisconnectNotifyDefault(void* ptr, void* sign) +{ + static_cast<QGridLayoutWithTriggerSlot*>(ptr)->QGridLayout::disconnectNotify(*static_cast<QMetaMethod*>(sign)); +} + +void QGridLayoutWithTriggerSlot_TimerEventDefault(void* ptr, void* event) +{ + static_cast<QGridLayoutWithTriggerSlot*>(ptr)->QGridLayout::timerEvent(static_cast<QTimerEvent*>(event)); +} + + + +void* QGridLayoutWithTriggerSlot_SpacerItemDefault(void* ptr) +{ + return static_cast<QGridLayoutWithTriggerSlot*>(ptr)->QGridLayout::spacerItem(); +} + +void* QGridLayoutWithTriggerSlot_WidgetDefault(void* ptr) +{ + return static_cast<QGridLayoutWithTriggerSlot*>(ptr)->QGridLayout::widget(); +} + +#include "moc_moc.h" diff --git a/elements/moc.go b/elements/moc.go @@ -0,0 +1,780 @@ +package elements + +//#include <stdint.h> +//#include <stdlib.h> +//#include <string.h> +//#include "moc.h" +import "C" +import ( + "runtime" + "unsafe" + + "github.com/therecipe/qt" + std_core "github.com/therecipe/qt/core" + std_widgets "github.com/therecipe/qt/widgets" +) + +func cGoUnpackString(s C.struct_Moc_PackedString) string { + if len := int(s.len); len == -1 { + return C.GoString(s.data) + } + return C.GoStringN(s.data, C.int(s.len)) +} + +type QGridLayoutWithTriggerSlot_ITF interface { + std_widgets.QGridLayout_ITF + QGridLayoutWithTriggerSlot_PTR() *QGridLayoutWithTriggerSlot +} + +func (ptr *QGridLayoutWithTriggerSlot) QGridLayoutWithTriggerSlot_PTR() *QGridLayoutWithTriggerSlot { + return ptr +} + +func (ptr *QGridLayoutWithTriggerSlot) Pointer() unsafe.Pointer { + if ptr != nil { + return ptr.QGridLayout_PTR().Pointer() + } + return nil +} + +func (ptr *QGridLayoutWithTriggerSlot) SetPointer(p unsafe.Pointer) { + if ptr != nil { + ptr.QGridLayout_PTR().SetPointer(p) + } +} + +func PointerFromQGridLayoutWithTriggerSlot(ptr QGridLayoutWithTriggerSlot_ITF) unsafe.Pointer { + if ptr != nil { + return ptr.QGridLayoutWithTriggerSlot_PTR().Pointer() + } + return nil +} + +func NewQGridLayoutWithTriggerSlotFromPointer(ptr unsafe.Pointer) *QGridLayoutWithTriggerSlot { + var n *QGridLayoutWithTriggerSlot + if gPtr, ok := qt.Receive(ptr); !ok { + n = new(QGridLayoutWithTriggerSlot) + n.SetPointer(ptr) + } else { + switch deduced := gPtr.(type) { + case *QGridLayoutWithTriggerSlot: + n = deduced + + case *std_widgets.QGridLayout: + n = &QGridLayoutWithTriggerSlot{QGridLayout: *deduced} + + default: + n = new(QGridLayoutWithTriggerSlot) + n.SetPointer(ptr) + } + } + return n +} + +//export callbackQGridLayoutWithTriggerSlot_Constructor +func callbackQGridLayoutWithTriggerSlot_Constructor(ptr unsafe.Pointer) { + gPtr := NewQGridLayoutWithTriggerSlotFromPointer(ptr) + qt.Register(ptr, gPtr) +} + +//export callbackQGridLayoutWithTriggerSlot_TriggerMessage +func callbackQGridLayoutWithTriggerSlot_TriggerMessage(ptr unsafe.Pointer, messageBody C.struct_Moc_PackedString) { + if signal := qt.GetSignal(ptr, "TriggerMessage"); signal != nil { + signal.(func(string))(cGoUnpackString(messageBody)) + } + +} + +func (ptr *QGridLayoutWithTriggerSlot) ConnectTriggerMessage(f func(messageBody string)) { + if ptr.Pointer() != nil { + + if signal := qt.LendSignal(ptr.Pointer(), "TriggerMessage"); signal != nil { + qt.ConnectSignal(ptr.Pointer(), "TriggerMessage", func(messageBody string) { + signal.(func(string))(messageBody) + f(messageBody) + }) + } else { + qt.ConnectSignal(ptr.Pointer(), "TriggerMessage", f) + } + } +} + +func (ptr *QGridLayoutWithTriggerSlot) DisconnectTriggerMessage() { + if ptr.Pointer() != nil { + + qt.DisconnectSignal(ptr.Pointer(), "TriggerMessage") + } +} + +func (ptr *QGridLayoutWithTriggerSlot) TriggerMessage(messageBody string) { + if ptr.Pointer() != nil { + var messageBodyC *C.char + if messageBody != "" { + messageBodyC = C.CString(messageBody) + defer C.free(unsafe.Pointer(messageBodyC)) + } + C.QGridLayoutWithTriggerSlot_TriggerMessage(ptr.Pointer(), C.struct_Moc_PackedString{data: messageBodyC, len: C.longlong(len(messageBody))}) + } +} + +func QGridLayoutWithTriggerSlot_QRegisterMetaType() int { + return int(int32(C.QGridLayoutWithTriggerSlot_QGridLayoutWithTriggerSlot_QRegisterMetaType())) +} + +func (ptr *QGridLayoutWithTriggerSlot) QRegisterMetaType() int { + return int(int32(C.QGridLayoutWithTriggerSlot_QGridLayoutWithTriggerSlot_QRegisterMetaType())) +} + +func QGridLayoutWithTriggerSlot_QRegisterMetaType2(typeName string) int { + var typeNameC *C.char + if typeName != "" { + typeNameC = C.CString(typeName) + defer C.free(unsafe.Pointer(typeNameC)) + } + return int(int32(C.QGridLayoutWithTriggerSlot_QGridLayoutWithTriggerSlot_QRegisterMetaType2(typeNameC))) +} + +func (ptr *QGridLayoutWithTriggerSlot) QRegisterMetaType2(typeName string) int { + var typeNameC *C.char + if typeName != "" { + typeNameC = C.CString(typeName) + defer C.free(unsafe.Pointer(typeNameC)) + } + return int(int32(C.QGridLayoutWithTriggerSlot_QGridLayoutWithTriggerSlot_QRegisterMetaType2(typeNameC))) +} + +func QGridLayoutWithTriggerSlot_QmlRegisterType() int { + return int(int32(C.QGridLayoutWithTriggerSlot_QGridLayoutWithTriggerSlot_QmlRegisterType())) +} + +func (ptr *QGridLayoutWithTriggerSlot) QmlRegisterType() int { + return int(int32(C.QGridLayoutWithTriggerSlot_QGridLayoutWithTriggerSlot_QmlRegisterType())) +} + +func QGridLayoutWithTriggerSlot_QmlRegisterType2(uri string, versionMajor int, versionMinor int, qmlName string) int { + var uriC *C.char + if uri != "" { + uriC = C.CString(uri) + defer C.free(unsafe.Pointer(uriC)) + } + var qmlNameC *C.char + if qmlName != "" { + qmlNameC = C.CString(qmlName) + defer C.free(unsafe.Pointer(qmlNameC)) + } + return int(int32(C.QGridLayoutWithTriggerSlot_QGridLayoutWithTriggerSlot_QmlRegisterType2(uriC, C.int(int32(versionMajor)), C.int(int32(versionMinor)), qmlNameC))) +} + +func (ptr *QGridLayoutWithTriggerSlot) QmlRegisterType2(uri string, versionMajor int, versionMinor int, qmlName string) int { + var uriC *C.char + if uri != "" { + uriC = C.CString(uri) + defer C.free(unsafe.Pointer(uriC)) + } + var qmlNameC *C.char + if qmlName != "" { + qmlNameC = C.CString(qmlName) + defer C.free(unsafe.Pointer(qmlNameC)) + } + return int(int32(C.QGridLayoutWithTriggerSlot_QGridLayoutWithTriggerSlot_QmlRegisterType2(uriC, C.int(int32(versionMajor)), C.int(int32(versionMinor)), qmlNameC))) +} + +func (ptr *QGridLayoutWithTriggerSlot) __dynamicPropertyNames_atList(i int) *std_core.QByteArray { + if ptr.Pointer() != nil { + var tmpValue = std_core.NewQByteArrayFromPointer(C.QGridLayoutWithTriggerSlot___dynamicPropertyNames_atList(ptr.Pointer(), C.int(int32(i)))) + runtime.SetFinalizer(tmpValue, (*std_core.QByteArray).DestroyQByteArray) + return tmpValue + } + return nil +} + +func (ptr *QGridLayoutWithTriggerSlot) __dynamicPropertyNames_setList(i std_core.QByteArray_ITF) { + if ptr.Pointer() != nil { + C.QGridLayoutWithTriggerSlot___dynamicPropertyNames_setList(ptr.Pointer(), std_core.PointerFromQByteArray(i)) + } +} + +func (ptr *QGridLayoutWithTriggerSlot) __dynamicPropertyNames_newList() unsafe.Pointer { + return unsafe.Pointer(C.QGridLayoutWithTriggerSlot___dynamicPropertyNames_newList(ptr.Pointer())) +} + +func (ptr *QGridLayoutWithTriggerSlot) __findChildren_atList2(i int) *std_core.QObject { + if ptr.Pointer() != nil { + var tmpValue = std_core.NewQObjectFromPointer(C.QGridLayoutWithTriggerSlot___findChildren_atList2(ptr.Pointer(), C.int(int32(i)))) + if !qt.ExistsSignal(tmpValue.Pointer(), "destroyed") { + tmpValue.ConnectDestroyed(func(*std_core.QObject) { tmpValue.SetPointer(nil) }) + } + return tmpValue + } + return nil +} + +func (ptr *QGridLayoutWithTriggerSlot) __findChildren_setList2(i std_core.QObject_ITF) { + if ptr.Pointer() != nil { + C.QGridLayoutWithTriggerSlot___findChildren_setList2(ptr.Pointer(), std_core.PointerFromQObject(i)) + } +} + +func (ptr *QGridLayoutWithTriggerSlot) __findChildren_newList2() unsafe.Pointer { + return unsafe.Pointer(C.QGridLayoutWithTriggerSlot___findChildren_newList2(ptr.Pointer())) +} + +func (ptr *QGridLayoutWithTriggerSlot) __findChildren_atList3(i int) *std_core.QObject { + if ptr.Pointer() != nil { + var tmpValue = std_core.NewQObjectFromPointer(C.QGridLayoutWithTriggerSlot___findChildren_atList3(ptr.Pointer(), C.int(int32(i)))) + if !qt.ExistsSignal(tmpValue.Pointer(), "destroyed") { + tmpValue.ConnectDestroyed(func(*std_core.QObject) { tmpValue.SetPointer(nil) }) + } + return tmpValue + } + return nil +} + +func (ptr *QGridLayoutWithTriggerSlot) __findChildren_setList3(i std_core.QObject_ITF) { + if ptr.Pointer() != nil { + C.QGridLayoutWithTriggerSlot___findChildren_setList3(ptr.Pointer(), std_core.PointerFromQObject(i)) + } +} + +func (ptr *QGridLayoutWithTriggerSlot) __findChildren_newList3() unsafe.Pointer { + return unsafe.Pointer(C.QGridLayoutWithTriggerSlot___findChildren_newList3(ptr.Pointer())) +} + +func (ptr *QGridLayoutWithTriggerSlot) __findChildren_atList(i int) *std_core.QObject { + if ptr.Pointer() != nil { + var tmpValue = std_core.NewQObjectFromPointer(C.QGridLayoutWithTriggerSlot___findChildren_atList(ptr.Pointer(), C.int(int32(i)))) + if !qt.ExistsSignal(tmpValue.Pointer(), "destroyed") { + tmpValue.ConnectDestroyed(func(*std_core.QObject) { tmpValue.SetPointer(nil) }) + } + return tmpValue + } + return nil +} + +func (ptr *QGridLayoutWithTriggerSlot) __findChildren_setList(i std_core.QObject_ITF) { + if ptr.Pointer() != nil { + C.QGridLayoutWithTriggerSlot___findChildren_setList(ptr.Pointer(), std_core.PointerFromQObject(i)) + } +} + +func (ptr *QGridLayoutWithTriggerSlot) __findChildren_newList() unsafe.Pointer { + return unsafe.Pointer(C.QGridLayoutWithTriggerSlot___findChildren_newList(ptr.Pointer())) +} + +func (ptr *QGridLayoutWithTriggerSlot) __children_atList(i int) *std_core.QObject { + if ptr.Pointer() != nil { + var tmpValue = std_core.NewQObjectFromPointer(C.QGridLayoutWithTriggerSlot___children_atList(ptr.Pointer(), C.int(int32(i)))) + if !qt.ExistsSignal(tmpValue.Pointer(), "destroyed") { + tmpValue.ConnectDestroyed(func(*std_core.QObject) { tmpValue.SetPointer(nil) }) + } + return tmpValue + } + return nil +} + +func (ptr *QGridLayoutWithTriggerSlot) __children_setList(i std_core.QObject_ITF) { + if ptr.Pointer() != nil { + C.QGridLayoutWithTriggerSlot___children_setList(ptr.Pointer(), std_core.PointerFromQObject(i)) + } +} + +func (ptr *QGridLayoutWithTriggerSlot) __children_newList() unsafe.Pointer { + return unsafe.Pointer(C.QGridLayoutWithTriggerSlot___children_newList(ptr.Pointer())) +} + +func NewQGridLayoutWithTriggerSlot2() *QGridLayoutWithTriggerSlot { + var tmpValue = NewQGridLayoutWithTriggerSlotFromPointer(C.QGridLayoutWithTriggerSlot_NewQGridLayoutWithTriggerSlot2()) + if !qt.ExistsSignal(tmpValue.Pointer(), "destroyed") { + tmpValue.ConnectDestroyed(func(*std_core.QObject) { tmpValue.SetPointer(nil) }) + } + return tmpValue +} + +func NewQGridLayoutWithTriggerSlot(parent std_widgets.QWidget_ITF) *QGridLayoutWithTriggerSlot { + var tmpValue = NewQGridLayoutWithTriggerSlotFromPointer(C.QGridLayoutWithTriggerSlot_NewQGridLayoutWithTriggerSlot(std_widgets.PointerFromQWidget(parent))) + if !qt.ExistsSignal(tmpValue.Pointer(), "destroyed") { + tmpValue.ConnectDestroyed(func(*std_core.QObject) { tmpValue.SetPointer(nil) }) + } + return tmpValue +} + +func (ptr *QGridLayoutWithTriggerSlot) DestroyQGridLayoutWithTriggerSlot() { + if ptr.Pointer() != nil { + C.QGridLayoutWithTriggerSlot_DestroyQGridLayoutWithTriggerSlot(ptr.Pointer()) + ptr.SetPointer(nil) + runtime.SetFinalizer(ptr, nil) + } +} + +//export callbackQGridLayoutWithTriggerSlot_TakeAt +func callbackQGridLayoutWithTriggerSlot_TakeAt(ptr unsafe.Pointer, index C.int) unsafe.Pointer { + if signal := qt.GetSignal(ptr, "takeAt"); signal != nil { + return std_widgets.PointerFromQLayoutItem(signal.(func(int) *std_widgets.QLayoutItem)(int(int32(index)))) + } + + return std_widgets.PointerFromQLayoutItem(NewQGridLayoutWithTriggerSlotFromPointer(ptr).TakeAtDefault(int(int32(index)))) +} + +func (ptr *QGridLayoutWithTriggerSlot) TakeAtDefault(index int) *std_widgets.QLayoutItem { + if ptr.Pointer() != nil { + return std_widgets.NewQLayoutItemFromPointer(C.QGridLayoutWithTriggerSlot_TakeAtDefault(ptr.Pointer(), C.int(int32(index)))) + } + return nil +} + +//export callbackQGridLayoutWithTriggerSlot_Invalidate +func callbackQGridLayoutWithTriggerSlot_Invalidate(ptr unsafe.Pointer) { + if signal := qt.GetSignal(ptr, "invalidate"); signal != nil { + signal.(func())() + } else { + NewQGridLayoutWithTriggerSlotFromPointer(ptr).InvalidateDefault() + } +} + +func (ptr *QGridLayoutWithTriggerSlot) InvalidateDefault() { + if ptr.Pointer() != nil { + C.QGridLayoutWithTriggerSlot_InvalidateDefault(ptr.Pointer()) + } +} + +//export callbackQGridLayoutWithTriggerSlot_SetGeometry +func callbackQGridLayoutWithTriggerSlot_SetGeometry(ptr unsafe.Pointer, rect unsafe.Pointer) { + if signal := qt.GetSignal(ptr, "setGeometry"); signal != nil { + signal.(func(*std_core.QRect))(std_core.NewQRectFromPointer(rect)) + } else { + NewQGridLayoutWithTriggerSlotFromPointer(ptr).SetGeometryDefault(std_core.NewQRectFromPointer(rect)) + } +} + +func (ptr *QGridLayoutWithTriggerSlot) SetGeometryDefault(rect std_core.QRect_ITF) { + if ptr.Pointer() != nil { + C.QGridLayoutWithTriggerSlot_SetGeometryDefault(ptr.Pointer(), std_core.PointerFromQRect(rect)) + } +} + +//export callbackQGridLayoutWithTriggerSlot_ItemAt +func callbackQGridLayoutWithTriggerSlot_ItemAt(ptr unsafe.Pointer, index C.int) unsafe.Pointer { + if signal := qt.GetSignal(ptr, "itemAt"); signal != nil { + return std_widgets.PointerFromQLayoutItem(signal.(func(int) *std_widgets.QLayoutItem)(int(int32(index)))) + } + + return std_widgets.PointerFromQLayoutItem(NewQGridLayoutWithTriggerSlotFromPointer(ptr).ItemAtDefault(int(int32(index)))) +} + +func (ptr *QGridLayoutWithTriggerSlot) ItemAtDefault(index int) *std_widgets.QLayoutItem { + if ptr.Pointer() != nil { + return std_widgets.NewQLayoutItemFromPointer(C.QGridLayoutWithTriggerSlot_ItemAtDefault(ptr.Pointer(), C.int(int32(index)))) + } + return nil +} + +//export callbackQGridLayoutWithTriggerSlot_MaximumSize +func callbackQGridLayoutWithTriggerSlot_MaximumSize(ptr unsafe.Pointer) unsafe.Pointer { + if signal := qt.GetSignal(ptr, "maximumSize"); signal != nil { + return std_core.PointerFromQSize(signal.(func() *std_core.QSize)()) + } + + return std_core.PointerFromQSize(NewQGridLayoutWithTriggerSlotFromPointer(ptr).MaximumSizeDefault()) +} + +func (ptr *QGridLayoutWithTriggerSlot) MaximumSizeDefault() *std_core.QSize { + if ptr.Pointer() != nil { + var tmpValue = std_core.NewQSizeFromPointer(C.QGridLayoutWithTriggerSlot_MaximumSizeDefault(ptr.Pointer())) + runtime.SetFinalizer(tmpValue, (*std_core.QSize).DestroyQSize) + return tmpValue + } + return nil +} + +//export callbackQGridLayoutWithTriggerSlot_MinimumSize +func callbackQGridLayoutWithTriggerSlot_MinimumSize(ptr unsafe.Pointer) unsafe.Pointer { + if signal := qt.GetSignal(ptr, "minimumSize"); signal != nil { + return std_core.PointerFromQSize(signal.(func() *std_core.QSize)()) + } + + return std_core.PointerFromQSize(NewQGridLayoutWithTriggerSlotFromPointer(ptr).MinimumSizeDefault()) +} + +func (ptr *QGridLayoutWithTriggerSlot) MinimumSizeDefault() *std_core.QSize { + if ptr.Pointer() != nil { + var tmpValue = std_core.NewQSizeFromPointer(C.QGridLayoutWithTriggerSlot_MinimumSizeDefault(ptr.Pointer())) + runtime.SetFinalizer(tmpValue, (*std_core.QSize).DestroyQSize) + return tmpValue + } + return nil +} + +//export callbackQGridLayoutWithTriggerSlot_SizeHint +func callbackQGridLayoutWithTriggerSlot_SizeHint(ptr unsafe.Pointer) unsafe.Pointer { + if signal := qt.GetSignal(ptr, "sizeHint"); signal != nil { + return std_core.PointerFromQSize(signal.(func() *std_core.QSize)()) + } + + return std_core.PointerFromQSize(NewQGridLayoutWithTriggerSlotFromPointer(ptr).SizeHintDefault()) +} + +func (ptr *QGridLayoutWithTriggerSlot) SizeHintDefault() *std_core.QSize { + if ptr.Pointer() != nil { + var tmpValue = std_core.NewQSizeFromPointer(C.QGridLayoutWithTriggerSlot_SizeHintDefault(ptr.Pointer())) + runtime.SetFinalizer(tmpValue, (*std_core.QSize).DestroyQSize) + return tmpValue + } + return nil +} + +//export callbackQGridLayoutWithTriggerSlot_ExpandingDirections +func callbackQGridLayoutWithTriggerSlot_ExpandingDirections(ptr unsafe.Pointer) C.longlong { + if signal := qt.GetSignal(ptr, "expandingDirections"); signal != nil { + return C.longlong(signal.(func() std_core.Qt__Orientation)()) + } + + return C.longlong(NewQGridLayoutWithTriggerSlotFromPointer(ptr).ExpandingDirectionsDefault()) +} + +func (ptr *QGridLayoutWithTriggerSlot) ExpandingDirectionsDefault() std_core.Qt__Orientation { + if ptr.Pointer() != nil { + return std_core.Qt__Orientation(C.QGridLayoutWithTriggerSlot_ExpandingDirectionsDefault(ptr.Pointer())) + } + return 0 +} + +//export callbackQGridLayoutWithTriggerSlot_HasHeightForWidth +func callbackQGridLayoutWithTriggerSlot_HasHeightForWidth(ptr unsafe.Pointer) C.char { + if signal := qt.GetSignal(ptr, "hasHeightForWidth"); signal != nil { + return C.char(int8(qt.GoBoolToInt(signal.(func() bool)()))) + } + + return C.char(int8(qt.GoBoolToInt(NewQGridLayoutWithTriggerSlotFromPointer(ptr).HasHeightForWidthDefault()))) +} + +func (ptr *QGridLayoutWithTriggerSlot) HasHeightForWidthDefault() bool { + if ptr.Pointer() != nil { + return C.QGridLayoutWithTriggerSlot_HasHeightForWidthDefault(ptr.Pointer()) != 0 + } + return false +} + +//export callbackQGridLayoutWithTriggerSlot_Count +func callbackQGridLayoutWithTriggerSlot_Count(ptr unsafe.Pointer) C.int { + if signal := qt.GetSignal(ptr, "count"); signal != nil { + return C.int(int32(signal.(func() int)())) + } + + return C.int(int32(NewQGridLayoutWithTriggerSlotFromPointer(ptr).CountDefault())) +} + +func (ptr *QGridLayoutWithTriggerSlot) CountDefault() int { + if ptr.Pointer() != nil { + return int(int32(C.QGridLayoutWithTriggerSlot_CountDefault(ptr.Pointer()))) + } + return 0 +} + +//export callbackQGridLayoutWithTriggerSlot_HeightForWidth +func callbackQGridLayoutWithTriggerSlot_HeightForWidth(ptr unsafe.Pointer, w C.int) C.int { + if signal := qt.GetSignal(ptr, "heightForWidth"); signal != nil { + return C.int(int32(signal.(func(int) int)(int(int32(w))))) + } + + return C.int(int32(NewQGridLayoutWithTriggerSlotFromPointer(ptr).HeightForWidthDefault(int(int32(w))))) +} + +func (ptr *QGridLayoutWithTriggerSlot) HeightForWidthDefault(w int) int { + if ptr.Pointer() != nil { + return int(int32(C.QGridLayoutWithTriggerSlot_HeightForWidthDefault(ptr.Pointer(), C.int(int32(w))))) + } + return 0 +} + +//export callbackQGridLayoutWithTriggerSlot_MinimumHeightForWidth +func callbackQGridLayoutWithTriggerSlot_MinimumHeightForWidth(ptr unsafe.Pointer, w C.int) C.int { + if signal := qt.GetSignal(ptr, "minimumHeightForWidth"); signal != nil { + return C.int(int32(signal.(func(int) int)(int(int32(w))))) + } + + return C.int(int32(NewQGridLayoutWithTriggerSlotFromPointer(ptr).MinimumHeightForWidthDefault(int(int32(w))))) +} + +func (ptr *QGridLayoutWithTriggerSlot) MinimumHeightForWidthDefault(w int) int { + if ptr.Pointer() != nil { + return int(int32(C.QGridLayoutWithTriggerSlot_MinimumHeightForWidthDefault(ptr.Pointer(), C.int(int32(w))))) + } + return 0 +} + +//export callbackQGridLayoutWithTriggerSlot_Layout +func callbackQGridLayoutWithTriggerSlot_Layout(ptr unsafe.Pointer) unsafe.Pointer { + if signal := qt.GetSignal(ptr, "layout"); signal != nil { + return std_widgets.PointerFromQLayout(signal.(func() *std_widgets.QLayout)()) + } + + return std_widgets.PointerFromQLayout(NewQGridLayoutWithTriggerSlotFromPointer(ptr).LayoutDefault()) +} + +func (ptr *QGridLayoutWithTriggerSlot) LayoutDefault() *std_widgets.QLayout { + if ptr.Pointer() != nil { + var tmpValue = std_widgets.NewQLayoutFromPointer(C.QGridLayoutWithTriggerSlot_LayoutDefault(ptr.Pointer())) + if !qt.ExistsSignal(tmpValue.Pointer(), "destroyed") { + tmpValue.ConnectDestroyed(func(*std_core.QObject) { tmpValue.SetPointer(nil) }) + } + return tmpValue + } + return nil +} + +//export callbackQGridLayoutWithTriggerSlot_AddItem +func callbackQGridLayoutWithTriggerSlot_AddItem(ptr unsafe.Pointer, item unsafe.Pointer) { + if signal := qt.GetSignal(ptr, "addItem"); signal != nil { + signal.(func(*std_widgets.QLayoutItem))(std_widgets.NewQLayoutItemFromPointer(item)) + } else { + NewQGridLayoutWithTriggerSlotFromPointer(ptr).AddItemDefault(std_widgets.NewQLayoutItemFromPointer(item)) + } +} + +func (ptr *QGridLayoutWithTriggerSlot) AddItemDefault(item std_widgets.QLayoutItem_ITF) { + if ptr.Pointer() != nil { + C.QGridLayoutWithTriggerSlot_AddItemDefault(ptr.Pointer(), std_widgets.PointerFromQLayoutItem(item)) + } +} + +//export callbackQGridLayoutWithTriggerSlot_ChildEvent +func callbackQGridLayoutWithTriggerSlot_ChildEvent(ptr unsafe.Pointer, e unsafe.Pointer) { + if signal := qt.GetSignal(ptr, "childEvent"); signal != nil { + signal.(func(*std_core.QChildEvent))(std_core.NewQChildEventFromPointer(e)) + } else { + NewQGridLayoutWithTriggerSlotFromPointer(ptr).ChildEventDefault(std_core.NewQChildEventFromPointer(e)) + } +} + +func (ptr *QGridLayoutWithTriggerSlot) ChildEventDefault(e std_core.QChildEvent_ITF) { + if ptr.Pointer() != nil { + C.QGridLayoutWithTriggerSlot_ChildEventDefault(ptr.Pointer(), std_core.PointerFromQChildEvent(e)) + } +} + +//export callbackQGridLayoutWithTriggerSlot_Geometry +func callbackQGridLayoutWithTriggerSlot_Geometry(ptr unsafe.Pointer) unsafe.Pointer { + if signal := qt.GetSignal(ptr, "geometry"); signal != nil { + return std_core.PointerFromQRect(signal.(func() *std_core.QRect)()) + } + + return std_core.PointerFromQRect(NewQGridLayoutWithTriggerSlotFromPointer(ptr).GeometryDefault()) +} + +func (ptr *QGridLayoutWithTriggerSlot) GeometryDefault() *std_core.QRect { + if ptr.Pointer() != nil { + var tmpValue = std_core.NewQRectFromPointer(C.QGridLayoutWithTriggerSlot_GeometryDefault(ptr.Pointer())) + runtime.SetFinalizer(tmpValue, (*std_core.QRect).DestroyQRect) + return tmpValue + } + return nil +} + +//export callbackQGridLayoutWithTriggerSlot_ControlTypes +func callbackQGridLayoutWithTriggerSlot_ControlTypes(ptr unsafe.Pointer) C.longlong { + if signal := qt.GetSignal(ptr, "controlTypes"); signal != nil { + return C.longlong(signal.(func() std_widgets.QSizePolicy__ControlType)()) + } + + return C.longlong(NewQGridLayoutWithTriggerSlotFromPointer(ptr).ControlTypesDefault()) +} + +func (ptr *QGridLayoutWithTriggerSlot) ControlTypesDefault() std_widgets.QSizePolicy__ControlType { + if ptr.Pointer() != nil { + return std_widgets.QSizePolicy__ControlType(C.QGridLayoutWithTriggerSlot_ControlTypesDefault(ptr.Pointer())) + } + return 0 +} + +//export callbackQGridLayoutWithTriggerSlot_IsEmpty +func callbackQGridLayoutWithTriggerSlot_IsEmpty(ptr unsafe.Pointer) C.char { + if signal := qt.GetSignal(ptr, "isEmpty"); signal != nil { + return C.char(int8(qt.GoBoolToInt(signal.(func() bool)()))) + } + + return C.char(int8(qt.GoBoolToInt(NewQGridLayoutWithTriggerSlotFromPointer(ptr).IsEmptyDefault()))) +} + +func (ptr *QGridLayoutWithTriggerSlot) IsEmptyDefault() bool { + if ptr.Pointer() != nil { + return C.QGridLayoutWithTriggerSlot_IsEmptyDefault(ptr.Pointer()) != 0 + } + return false +} + +//export callbackQGridLayoutWithTriggerSlot_IndexOf +func callbackQGridLayoutWithTriggerSlot_IndexOf(ptr unsafe.Pointer, widget unsafe.Pointer) C.int { + if signal := qt.GetSignal(ptr, "indexOf"); signal != nil { + return C.int(int32(signal.(func(*std_widgets.QWidget) int)(std_widgets.NewQWidgetFromPointer(widget)))) + } + + return C.int(int32(NewQGridLayoutWithTriggerSlotFromPointer(ptr).IndexOfDefault(std_widgets.NewQWidgetFromPointer(widget)))) +} + +func (ptr *QGridLayoutWithTriggerSlot) IndexOfDefault(widget std_widgets.QWidget_ITF) int { + if ptr.Pointer() != nil { + return int(int32(C.QGridLayoutWithTriggerSlot_IndexOfDefault(ptr.Pointer(), std_widgets.PointerFromQWidget(widget)))) + } + return 0 +} + +//export callbackQGridLayoutWithTriggerSlot_Event +func callbackQGridLayoutWithTriggerSlot_Event(ptr unsafe.Pointer, e unsafe.Pointer) C.char { + if signal := qt.GetSignal(ptr, "event"); signal != nil { + return C.char(int8(qt.GoBoolToInt(signal.(func(*std_core.QEvent) bool)(std_core.NewQEventFromPointer(e))))) + } + + return C.char(int8(qt.GoBoolToInt(NewQGridLayoutWithTriggerSlotFromPointer(ptr).EventDefault(std_core.NewQEventFromPointer(e))))) +} + +func (ptr *QGridLayoutWithTriggerSlot) EventDefault(e std_core.QEvent_ITF) bool { + if ptr.Pointer() != nil { + return C.QGridLayoutWithTriggerSlot_EventDefault(ptr.Pointer(), std_core.PointerFromQEvent(e)) != 0 + } + return false +} + +//export callbackQGridLayoutWithTriggerSlot_EventFilter +func callbackQGridLayoutWithTriggerSlot_EventFilter(ptr unsafe.Pointer, watched unsafe.Pointer, event unsafe.Pointer) C.char { + if signal := qt.GetSignal(ptr, "eventFilter"); signal != nil { + return C.char(int8(qt.GoBoolToInt(signal.(func(*std_core.QObject, *std_core.QEvent) bool)(std_core.NewQObjectFromPointer(watched), std_core.NewQEventFromPointer(event))))) + } + + return C.char(int8(qt.GoBoolToInt(NewQGridLayoutWithTriggerSlotFromPointer(ptr).EventFilterDefault(std_core.NewQObjectFromPointer(watched), std_core.NewQEventFromPointer(event))))) +} + +func (ptr *QGridLayoutWithTriggerSlot) EventFilterDefault(watched std_core.QObject_ITF, event std_core.QEvent_ITF) bool { + if ptr.Pointer() != nil { + return C.QGridLayoutWithTriggerSlot_EventFilterDefault(ptr.Pointer(), std_core.PointerFromQObject(watched), std_core.PointerFromQEvent(event)) != 0 + } + return false +} + +//export callbackQGridLayoutWithTriggerSlot_ConnectNotify +func callbackQGridLayoutWithTriggerSlot_ConnectNotify(ptr unsafe.Pointer, sign unsafe.Pointer) { + if signal := qt.GetSignal(ptr, "connectNotify"); signal != nil { + signal.(func(*std_core.QMetaMethod))(std_core.NewQMetaMethodFromPointer(sign)) + } else { + NewQGridLayoutWithTriggerSlotFromPointer(ptr).ConnectNotifyDefault(std_core.NewQMetaMethodFromPointer(sign)) + } +} + +func (ptr *QGridLayoutWithTriggerSlot) ConnectNotifyDefault(sign std_core.QMetaMethod_ITF) { + if ptr.Pointer() != nil { + C.QGridLayoutWithTriggerSlot_ConnectNotifyDefault(ptr.Pointer(), std_core.PointerFromQMetaMethod(sign)) + } +} + +//export callbackQGridLayoutWithTriggerSlot_CustomEvent +func callbackQGridLayoutWithTriggerSlot_CustomEvent(ptr unsafe.Pointer, event unsafe.Pointer) { + if signal := qt.GetSignal(ptr, "customEvent"); signal != nil { + signal.(func(*std_core.QEvent))(std_core.NewQEventFromPointer(event)) + } else { + NewQGridLayoutWithTriggerSlotFromPointer(ptr).CustomEventDefault(std_core.NewQEventFromPointer(event)) + } +} + +func (ptr *QGridLayoutWithTriggerSlot) CustomEventDefault(event std_core.QEvent_ITF) { + if ptr.Pointer() != nil { + C.QGridLayoutWithTriggerSlot_CustomEventDefault(ptr.Pointer(), std_core.PointerFromQEvent(event)) + } +} + +//export callbackQGridLayoutWithTriggerSlot_DeleteLater +func callbackQGridLayoutWithTriggerSlot_DeleteLater(ptr unsafe.Pointer) { + if signal := qt.GetSignal(ptr, "deleteLater"); signal != nil { + signal.(func())() + } else { + NewQGridLayoutWithTriggerSlotFromPointer(ptr).DeleteLaterDefault() + } +} + +func (ptr *QGridLayoutWithTriggerSlot) DeleteLaterDefault() { + if ptr.Pointer() != nil { + C.QGridLayoutWithTriggerSlot_DeleteLaterDefault(ptr.Pointer()) + ptr.SetPointer(nil) + runtime.SetFinalizer(ptr, nil) + } +} + +//export callbackQGridLayoutWithTriggerSlot_Destroyed +func callbackQGridLayoutWithTriggerSlot_Destroyed(ptr unsafe.Pointer, obj unsafe.Pointer) { + if signal := qt.GetSignal(ptr, "destroyed"); signal != nil { + signal.(func(*std_core.QObject))(std_core.NewQObjectFromPointer(obj)) + } + +} + +//export callbackQGridLayoutWithTriggerSlot_DisconnectNotify +func callbackQGridLayoutWithTriggerSlot_DisconnectNotify(ptr unsafe.Pointer, sign unsafe.Pointer) { + if signal := qt.GetSignal(ptr, "disconnectNotify"); signal != nil { + signal.(func(*std_core.QMetaMethod))(std_core.NewQMetaMethodFromPointer(sign)) + } else { + NewQGridLayoutWithTriggerSlotFromPointer(ptr).DisconnectNotifyDefault(std_core.NewQMetaMethodFromPointer(sign)) + } +} + +func (ptr *QGridLayoutWithTriggerSlot) DisconnectNotifyDefault(sign std_core.QMetaMethod_ITF) { + if ptr.Pointer() != nil { + C.QGridLayoutWithTriggerSlot_DisconnectNotifyDefault(ptr.Pointer(), std_core.PointerFromQMetaMethod(sign)) + } +} + +//export callbackQGridLayoutWithTriggerSlot_ObjectNameChanged +func callbackQGridLayoutWithTriggerSlot_ObjectNameChanged(ptr unsafe.Pointer, objectName C.struct_Moc_PackedString) { + if signal := qt.GetSignal(ptr, "objectNameChanged"); signal != nil { + signal.(func(string))(cGoUnpackString(objectName)) + } + +} + +//export callbackQGridLayoutWithTriggerSlot_TimerEvent +func callbackQGridLayoutWithTriggerSlot_TimerEvent(ptr unsafe.Pointer, event unsafe.Pointer) { + if signal := qt.GetSignal(ptr, "timerEvent"); signal != nil { + signal.(func(*std_core.QTimerEvent))(std_core.NewQTimerEventFromPointer(event)) + } else { + NewQGridLayoutWithTriggerSlotFromPointer(ptr).TimerEventDefault(std_core.NewQTimerEventFromPointer(event)) + } +} + +func (ptr *QGridLayoutWithTriggerSlot) TimerEventDefault(event std_core.QTimerEvent_ITF) { + if ptr.Pointer() != nil { + C.QGridLayoutWithTriggerSlot_TimerEventDefault(ptr.Pointer(), std_core.PointerFromQTimerEvent(event)) + } +} + +//export callbackQGridLayoutWithTriggerSlot_SpacerItem +func callbackQGridLayoutWithTriggerSlot_SpacerItem(ptr unsafe.Pointer) unsafe.Pointer { + if signal := qt.GetSignal(ptr, "spacerItem"); signal != nil { + return std_widgets.PointerFromQSpacerItem(signal.(func() *std_widgets.QSpacerItem)()) + } + + return std_widgets.PointerFromQSpacerItem(NewQGridLayoutWithTriggerSlotFromPointer(ptr).SpacerItemDefault()) +} + +func (ptr *QGridLayoutWithTriggerSlot) SpacerItemDefault() *std_widgets.QSpacerItem { + if ptr.Pointer() != nil { + return std_widgets.NewQSpacerItemFromPointer(C.QGridLayoutWithTriggerSlot_SpacerItemDefault(ptr.Pointer())) + } + return nil +} + +//export callbackQGridLayoutWithTriggerSlot_Widget +func callbackQGridLayoutWithTriggerSlot_Widget(ptr unsafe.Pointer) unsafe.Pointer { + if signal := qt.GetSignal(ptr, "widget"); signal != nil { + return std_widgets.PointerFromQWidget(signal.(func() *std_widgets.QWidget)()) + } + + return std_widgets.PointerFromQWidget(NewQGridLayoutWithTriggerSlotFromPointer(ptr).WidgetDefault()) +} + +func (ptr *QGridLayoutWithTriggerSlot) WidgetDefault() *std_widgets.QWidget { + if ptr.Pointer() != nil { + var tmpValue = std_widgets.NewQWidgetFromPointer(C.QGridLayoutWithTriggerSlot_WidgetDefault(ptr.Pointer())) + if !qt.ExistsSignal(tmpValue.Pointer(), "destroyed") { + tmpValue.ConnectDestroyed(func(*std_core.QObject) { tmpValue.SetPointer(nil) }) + } + return tmpValue + } + return nil +} diff --git a/elements/moc.h b/elements/moc.h @@ -0,0 +1,75 @@ + + +#pragma once + +#ifndef GO_MOC_H +#define GO_MOC_H + +#include <stdint.h> + +#ifdef __cplusplus +class QGridLayoutWithTriggerSlot; +void QGridLayoutWithTriggerSlot_QGridLayoutWithTriggerSlot_QRegisterMetaTypes(); +extern "C" { +#endif + +struct Moc_PackedString { char* data; long long len; }; +struct Moc_PackedList { void* data; long long len; }; +void QGridLayoutWithTriggerSlot_TriggerMessage(void* ptr, struct Moc_PackedString messageBody); +int QGridLayoutWithTriggerSlot_QGridLayoutWithTriggerSlot_QRegisterMetaType(); +int QGridLayoutWithTriggerSlot_QGridLayoutWithTriggerSlot_QRegisterMetaType2(char* typeName); +int QGridLayoutWithTriggerSlot_QGridLayoutWithTriggerSlot_QmlRegisterType(); +int QGridLayoutWithTriggerSlot_QGridLayoutWithTriggerSlot_QmlRegisterType2(char* uri, int versionMajor, int versionMinor, char* qmlName); +void* QGridLayoutWithTriggerSlot___dynamicPropertyNames_atList(void* ptr, int i); +void QGridLayoutWithTriggerSlot___dynamicPropertyNames_setList(void* ptr, void* i); +void* QGridLayoutWithTriggerSlot___dynamicPropertyNames_newList(void* ptr); +void* QGridLayoutWithTriggerSlot___findChildren_atList2(void* ptr, int i); +void QGridLayoutWithTriggerSlot___findChildren_setList2(void* ptr, void* i); +void* QGridLayoutWithTriggerSlot___findChildren_newList2(void* ptr); +void* QGridLayoutWithTriggerSlot___findChildren_atList3(void* ptr, int i); +void QGridLayoutWithTriggerSlot___findChildren_setList3(void* ptr, void* i); +void* QGridLayoutWithTriggerSlot___findChildren_newList3(void* ptr); +void* QGridLayoutWithTriggerSlot___findChildren_atList(void* ptr, int i); +void QGridLayoutWithTriggerSlot___findChildren_setList(void* ptr, void* i); +void* QGridLayoutWithTriggerSlot___findChildren_newList(void* ptr); +void* QGridLayoutWithTriggerSlot___children_atList(void* ptr, int i); +void QGridLayoutWithTriggerSlot___children_setList(void* ptr, void* i); +void* QGridLayoutWithTriggerSlot___children_newList(void* ptr); +void* QGridLayoutWithTriggerSlot_NewQGridLayoutWithTriggerSlot2(); +void* QGridLayoutWithTriggerSlot_NewQGridLayoutWithTriggerSlot(void* parent); +void QGridLayoutWithTriggerSlot_DestroyQGridLayoutWithTriggerSlot(void* ptr); +void* QGridLayoutWithTriggerSlot_TakeAtDefault(void* ptr, int index); +void QGridLayoutWithTriggerSlot_InvalidateDefault(void* ptr); +void QGridLayoutWithTriggerSlot_SetGeometryDefault(void* ptr, void* rect); +void* QGridLayoutWithTriggerSlot_ItemAtDefault(void* ptr, int index); +void* QGridLayoutWithTriggerSlot_MaximumSizeDefault(void* ptr); +void* QGridLayoutWithTriggerSlot_MinimumSizeDefault(void* ptr); +void* QGridLayoutWithTriggerSlot_SizeHintDefault(void* ptr); +long long QGridLayoutWithTriggerSlot_ExpandingDirectionsDefault(void* ptr); +char QGridLayoutWithTriggerSlot_HasHeightForWidthDefault(void* ptr); +int QGridLayoutWithTriggerSlot_CountDefault(void* ptr); +int QGridLayoutWithTriggerSlot_HeightForWidthDefault(void* ptr, int w); +int QGridLayoutWithTriggerSlot_MinimumHeightForWidthDefault(void* ptr, int w); +void* QGridLayoutWithTriggerSlot_LayoutDefault(void* ptr); +void QGridLayoutWithTriggerSlot_AddItemDefault(void* ptr, void* item); +void QGridLayoutWithTriggerSlot_ChildEventDefault(void* ptr, void* e); +void* QGridLayoutWithTriggerSlot_GeometryDefault(void* ptr); +long long QGridLayoutWithTriggerSlot_ControlTypesDefault(void* ptr); +char QGridLayoutWithTriggerSlot_IsEmptyDefault(void* ptr); +int QGridLayoutWithTriggerSlot_IndexOfDefault(void* ptr, void* widget); +char QGridLayoutWithTriggerSlot_EventDefault(void* ptr, void* e); +char QGridLayoutWithTriggerSlot_EventFilterDefault(void* ptr, void* watched, void* event); +void QGridLayoutWithTriggerSlot_ConnectNotifyDefault(void* ptr, void* sign); +void QGridLayoutWithTriggerSlot_CustomEventDefault(void* ptr, void* event); +void QGridLayoutWithTriggerSlot_DeleteLaterDefault(void* ptr); +void QGridLayoutWithTriggerSlot_DisconnectNotifyDefault(void* ptr, void* sign); +void QGridLayoutWithTriggerSlot_TimerEventDefault(void* ptr, void* event); +; +void* QGridLayoutWithTriggerSlot_SpacerItemDefault(void* ptr); +void* QGridLayoutWithTriggerSlot_WidgetDefault(void* ptr); + +#ifdef __cplusplus +} +#endif + +#endif +\ No newline at end of file diff --git a/elements/moc_cgo_windows_windows_amd64.go b/elements/moc_cgo_windows_windows_amd64.go @@ -0,0 +1,10 @@ +package elements + +/* +#cgo CFLAGS: -fno-keep-inline-dllexport -march=nocona -mtune=core2 -pipe -O2 -Wextra -Wall -W -DUNICODE -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN +#cgo CXXFLAGS: -fno-keep-inline-dllexport -march=nocona -mtune=core2 -pipe -O2 -Wextra -Wall -W -fexceptions -mthreads -DUNICODE -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN +#cgo CXXFLAGS: -I../../Morpheus -I. -isystem C:/msys64/mingw64/include/QtWidgets -isystem C:/msys64/mingw64/include/QtGui -isystem C:/msys64/mingw64/include/QtCore -Irelease -IC:/msys64/mingw64/share/qt5/mkspecs/win32-g++ +#cgo LDFLAGS: -Wl,-subsystem,windows -mthreads +#cgo LDFLAGS: -lglu32 -lopengl32 -lgdi32 -luser32 -lmingw32 -LC:/msys64/mingw64/lib -lqtmain -lshell32 -lQt5Widgets -lQt5Gui -lQt5Core +#cgo LDFLAGS: -Wl,--allow-multiple-definition +*/ diff --git a/elements/moc_moc.h b/elements/moc_moc.h @@ -0,0 +1,114 @@ +/**************************************************************************** +** Meta object code from reading C++ file 'moc.cpp' +** +** Created by: The Qt Meta Object Compiler version 67 (Qt 5.9.1) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#include <QtCore/qbytearray.h> +#include <QtCore/qmetatype.h> +#if !defined(Q_MOC_OUTPUT_REVISION) +#error "The header file 'moc.cpp' doesn't include <QObject>." +#elif Q_MOC_OUTPUT_REVISION != 67 +#error "This file was generated using the moc from 5.9.1. It" +#error "cannot be used with the include files from this version of Qt." +#error "(The moc has changed too much.)" +#endif + +QT_BEGIN_MOC_NAMESPACE +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED +struct qt_meta_stringdata_QGridLayoutWithTriggerSlot_t { + QByteArrayData data[4]; + char stringdata0[55]; +}; +#define QT_MOC_LITERAL(idx, ofs, len) \ + Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ + qptrdiff(offsetof(qt_meta_stringdata_QGridLayoutWithTriggerSlot_t, stringdata0) + ofs \ + - idx * sizeof(QByteArrayData)) \ + ) +static const qt_meta_stringdata_QGridLayoutWithTriggerSlot_t qt_meta_stringdata_QGridLayoutWithTriggerSlot = { + { +QT_MOC_LITERAL(0, 0, 26), // "QGridLayoutWithTriggerSlot" +QT_MOC_LITERAL(1, 27, 14), // "TriggerMessage" +QT_MOC_LITERAL(2, 42, 0), // "" +QT_MOC_LITERAL(3, 43, 11) // "messageBody" + + }, + "QGridLayoutWithTriggerSlot\0TriggerMessage\0" + "\0messageBody" +}; +#undef QT_MOC_LITERAL + +static const uint qt_meta_data_QGridLayoutWithTriggerSlot[] = { + + // content: + 7, // revision + 0, // classname + 0, 0, // classinfo + 1, 14, // methods + 0, 0, // properties + 0, 0, // enums/sets + 0, 0, // constructors + 0, // flags + 0, // signalCount + + // slots: name, argc, parameters, tag, flags + 1, 1, 19, 2, 0x0a /* Public */, + + // slots: parameters + QMetaType::Void, QMetaType::QString, 3, + + 0 // eod +}; + +void QGridLayoutWithTriggerSlot::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) +{ + if (_c == QMetaObject::InvokeMetaMethod) { + QGridLayoutWithTriggerSlot *_t = static_cast<QGridLayoutWithTriggerSlot *>(_o); + Q_UNUSED(_t) + switch (_id) { + case 0: _t->TriggerMessage((*reinterpret_cast< QString(*)>(_a[1]))); break; + default: ; + } + } +} + +const QMetaObject QGridLayoutWithTriggerSlot::staticMetaObject = { + { &QGridLayout::staticMetaObject, qt_meta_stringdata_QGridLayoutWithTriggerSlot.data, + qt_meta_data_QGridLayoutWithTriggerSlot, qt_static_metacall, nullptr, nullptr} +}; + + +const QMetaObject *QGridLayoutWithTriggerSlot::metaObject() const +{ + return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject; +} + +void *QGridLayoutWithTriggerSlot::qt_metacast(const char *_clname) +{ + if (!_clname) return nullptr; + if (!strcmp(_clname, qt_meta_stringdata_QGridLayoutWithTriggerSlot.stringdata0)) + return static_cast<void*>(const_cast< QGridLayoutWithTriggerSlot*>(this)); + return QGridLayout::qt_metacast(_clname); +} + +int QGridLayoutWithTriggerSlot::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = QGridLayout::qt_metacall(_c, _id, _a); + if (_id < 0) + return _id; + if (_c == QMetaObject::InvokeMetaMethod) { + if (_id < 1) + qt_static_metacall(this, _c, _id, _a); + _id -= 1; + } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { + if (_id < 1) + *reinterpret_cast<int*>(_a[0]) = -1; + _id -= 1; + } + return _id; +} +QT_WARNING_POP +QT_END_MOC_NAMESPACE diff --git a/main.go b/main.go @@ -45,8 +45,7 @@ func main() { // Get cache db.View(func(tx *buntdb.Tx) error { - var QueryErr error - QueryErr = tx.AscendKeys("user:accessToken", + QueryErr := tx.AscendKeys("user:accessToken", func(key, value string) bool { accessToken = value return true @@ -61,10 +60,7 @@ func main() { userID = value return true }) - if QueryErr != nil { - return QueryErr - } - return nil + return QueryErr }) if accessToken != "" && homeserverURL != "" && userID != "" { diff --git a/matrix/db.go b/matrix/db.go @@ -5,6 +5,7 @@ import ( "os" "path/filepath" + "github.com/matrix-org/gomatrix" "github.com/shibukawa/configdir" "github.com/tidwall/buntdb" ) @@ -25,3 +26,31 @@ func OpenDB() (expDB *buntdb.DB) { return } + +func InitData(cli *gomatrix.Client, db *buntdb.DB) { + roomsURL := cli.BuildURL("joined_rooms") + var rooms JoinedRooms + _, err := cli.MakeRequest("GET", roomsURL, nil, &rooms) + if err != nil { + localLog.Println(err) + } + + for _, room := range rooms.JoinedRooms { + var roomAliases RoomAliases + if err := cli.StateEvent(room, "m.room.aliases", "", &roomAliases); err != nil { + localLog.Println(err) + } + + for index, alias := range roomAliases.Content.Aliases { + // Update cache + DBerr := db.Update(func(tx *buntdb.Tx) error { + tx.Set("room:"+room+":aliases"+string(index), alias, nil) + return nil + }) + if DBerr != nil { + localLog.Fatalln(DBerr) + } + } + + } +} diff --git a/matrix/types.go b/matrix/types.go @@ -7,3 +7,20 @@ type HTMLMessage struct { FormattedBody string `json:"formatted_body"` Format string `json:"format"` } + +type RoomAliases struct { + Age int `json:"age"` + Content struct { + Aliases []string `json:"aliases"` + } `json:"content"` + EventID string `json:"event_id"` + OriginServerTs int64 `json:"origin_server_ts"` + RoomID string `json:"room_id"` + Sender string `json:"sender"` + StateKey string `json:"state_key"` + Type string `json:"type"` +} + +type JoinedRooms struct { + JoinedRooms []string `json:"joined_rooms"` +} diff --git a/qml/icons/ic_send_black_48px.svg b/qml/icons/ic_send_black_48px.svg @@ -0,0 +1,4 @@ +<svg fill="#000000" height="48" viewBox="0 0 24 24" width="48" xmlns="http://www.w3.org/2000/svg"> + <path d="M2.01 21L23 12 2.01 3 2 10l15 2-15 2z"/> + <path d="M0 0h24v24H0z" fill="none"/> +</svg> +\ No newline at end of file diff --git a/qml/ui/chat.ui b/qml/ui/chat.ui @@ -894,6 +894,9 @@ padding: 3px</string> <property name="text"> <string/> </property> + <property name="maxLength"> + <number>999999999</number> + </property> <property name="frame"> <bool>true</bool> </property> diff --git a/uis.go b/uis.go @@ -1,6 +1,7 @@ package main import ( + "github.com/Nordgedanken/Morpheus/elements" "github.com/Nordgedanken/Morpheus/matrix" "github.com/matrix-org/gomatrix" "github.com/rhinoman/go-commonmark" @@ -157,6 +158,7 @@ func NewMainUI(windowWidth, windowHeight int, cli *gomatrix.Client) *widgets.QWi var mainWidget = loader.Load(file, widget) file.Close() + matrix.InitData(cli, db) mainWidget.SetMinimumSize2(windowWidth, windowHeight) mainWidget.Resize2(windowWidth, windowHeight) mainWidget.SetGeometry2(0, 0, windowWidth, windowHeight) @@ -209,12 +211,8 @@ func NewMainUI(windowWidth, windowHeight int, cli *gomatrix.Client) *widgets.QWi cli.ClearCredentials() //Flush complete DB db.View(func(tx *buntdb.Tx) error { - var QueryErr error - QueryErr = tx.DeleteAll() - if QueryErr != nil { - return QueryErr - } - return nil + QueryErr := tx.DeleteAll() + return QueryErr }) results <- true } @@ -240,8 +238,23 @@ func NewMainUI(windowWidth, windowHeight int, cli *gomatrix.Client) *widgets.QWi customStore := gomatrix.NewInMemoryStore() cli.Store = customStore syncer.Store = customStore + + // Init Message View + _, messageListLayout := elements.NewMessageList() + + messageListLayout.ConnectTriggerMessage(func(messageBody string) { + localLog.Println("messageTriggered:", messageBody) + messageListLayout.NewMessage(messageBody) + }) + + messageScrollArea := widgets.NewQScrollAreaFromPointer(widget.FindChild("messageScroll", core.Qt__FindChildrenRecursively).Pointer()) + + messageScrollArea.SetLayout(messageListLayout) + syncer.OnEventType("m.room.message", func(ev *gomatrix.Event) { - localLog.Println("message:", ev.Content) + msg, _ := ev.Body() + localLog.Println("message:", msg) + messageListLayout.TriggerMessage(msg) }) // Start Non-blocking sync @@ -253,6 +266,7 @@ func NewMainUI(windowWidth, windowHeight int, cli *gomatrix.Client) *widgets.QWi localLog.Println("Fatal Sync() error") time.Sleep(10 * time.Second) } + localLog.Println("sync done") time.Sleep(10 * time.Second) } }()