Add toOF() / toQt() for easy conversion
This commit is contained in:
parent
1d907ed62d
commit
53410c810f
6 changed files with 78 additions and 82 deletions
|
@ -21,18 +21,17 @@
|
|||
|
||||
- (OFString*)applicationName
|
||||
{
|
||||
return QToOFString([self qCoreApplication]->applicationName());
|
||||
return toOF([self qCoreApplication]->applicationName());
|
||||
}
|
||||
|
||||
- (void)setApplicationName: (OFString*)applicationName
|
||||
{
|
||||
[self qCoreApplication]->setApplicationName(
|
||||
OFToQString(applicationName));
|
||||
[self qCoreApplication]->setApplicationName(toQt(applicationName));
|
||||
}
|
||||
|
||||
- (OFString*)applicationVersion
|
||||
{
|
||||
return QToOFString([self qCoreApplication]->applicationVersion());
|
||||
return toOF([self qCoreApplication]->applicationVersion());
|
||||
}
|
||||
|
||||
- (void)installNativeEventFilter: (QAbstractNativeEventFilter*)filterObject
|
||||
|
@ -43,29 +42,28 @@
|
|||
- (void)setApplicationVersion: (OFString*)applicationVersion
|
||||
{
|
||||
[self qCoreApplication]->setApplicationVersion(
|
||||
OFToQString(applicationVersion));
|
||||
toQt(applicationVersion));
|
||||
}
|
||||
|
||||
- (OFString*)organizationDomain
|
||||
{
|
||||
return QToOFString([self qCoreApplication]->organizationDomain());
|
||||
return toOF([self qCoreApplication]->organizationDomain());
|
||||
}
|
||||
|
||||
- (void)setOrganizationDomain: (OFString*)organizationDomain
|
||||
{
|
||||
[self qCoreApplication]->setOrganizationDomain(
|
||||
OFToQString(organizationDomain));
|
||||
toQt(organizationDomain));
|
||||
}
|
||||
|
||||
- (OFString*)organizationName
|
||||
{
|
||||
return QToOFString([self qCoreApplication]->organizationName());
|
||||
return toOF([self qCoreApplication]->organizationName());
|
||||
}
|
||||
|
||||
- (void)setOrganizationName: (OFString*)organizationName
|
||||
{
|
||||
[self qCoreApplication]->setOrganizationName(
|
||||
OFToQString(organizationName));
|
||||
[self qCoreApplication]->setOrganizationName(toQt(organizationName));
|
||||
}
|
||||
|
||||
- (void)quit
|
||||
|
|
|
@ -45,12 +45,12 @@
|
|||
|
||||
- (OFString*)objectName
|
||||
{
|
||||
return QToOFString(_qObject->objectName());
|
||||
return toOF(_qObject->objectName());
|
||||
}
|
||||
|
||||
- (void)setObjectName: (OFString*)objectName
|
||||
{
|
||||
_qObject->setObjectName(OFToQString(objectName));
|
||||
_qObject->setObjectName(toQt(objectName));
|
||||
}
|
||||
|
||||
- (bool)setBlockSignals: (bool)block
|
||||
|
|
|
@ -22,24 +22,23 @@
|
|||
|
||||
- (OFString*)applicationDisplayName
|
||||
{
|
||||
return QToOFString([self qGuiApplication]->applicationDisplayName());
|
||||
return toOF([self qGuiApplication]->applicationDisplayName());
|
||||
}
|
||||
|
||||
- (void)setApplicationDisplayName: (OFString*)applicationDisplayName
|
||||
{
|
||||
[self qGuiApplication]->setApplicationDisplayName(
|
||||
OFToQString(applicationDisplayName));
|
||||
toQt(applicationDisplayName));
|
||||
}
|
||||
|
||||
- (OFString*)desktopFileName
|
||||
{
|
||||
return QToOFString([self qGuiApplication]->desktopFileName());
|
||||
return toOF([self qGuiApplication]->desktopFileName());
|
||||
}
|
||||
|
||||
- (void)setDesktopFileName: (OFString*)desktopFileName
|
||||
{
|
||||
[self qGuiApplication]->setDesktopFileName(
|
||||
OFToQString(desktopFileName));
|
||||
[self qGuiApplication]->setDesktopFileName(toQt(desktopFileName));
|
||||
}
|
||||
|
||||
- (double)devicePixelRatio
|
||||
|
@ -69,7 +68,7 @@
|
|||
|
||||
- (OFString*)platformName
|
||||
{
|
||||
return QToOFString([self qGuiApplication]->platformName());
|
||||
return toOF([self qGuiApplication]->platformName());
|
||||
}
|
||||
|
||||
- (QScreen*)primaryScreen
|
||||
|
@ -90,12 +89,12 @@
|
|||
|
||||
- (OFString*)sessionID
|
||||
{
|
||||
return QToOFString([self qGuiApplication]->sessionId());
|
||||
return toOF([self qGuiApplication]->sessionId());
|
||||
}
|
||||
|
||||
- (OFString*)sessionKey
|
||||
{
|
||||
return QToOFString([self qGuiApplication]->sessionKey());
|
||||
return toOF([self qGuiApplication]->sessionKey());
|
||||
}
|
||||
|
||||
- (QIcon)windowIcon
|
||||
|
|
|
@ -50,12 +50,12 @@
|
|||
|
||||
- (of_dimension_t)globalStrut
|
||||
{
|
||||
return QToOFDimension([self qApplication]->globalStrut());
|
||||
return toOF([self qApplication]->globalStrut());
|
||||
}
|
||||
|
||||
- (void)setGlobalStrut: (of_dimension_t)globalStrut
|
||||
{
|
||||
[self qApplication]->setGlobalStrut(OFToQSize(globalStrut));
|
||||
[self qApplication]->setGlobalStrut(toQt(globalStrut));
|
||||
}
|
||||
|
||||
- (int)keyboardInputInterval
|
||||
|
@ -90,12 +90,12 @@
|
|||
|
||||
- (OFString*)styleSheet
|
||||
{
|
||||
return QToOFString([self qApplication]->styleSheet());
|
||||
return toOF([self qApplication]->styleSheet());
|
||||
}
|
||||
|
||||
- (void)setStyleSheet: (OFString*)styleSheet
|
||||
{
|
||||
[self qApplication]->setStyleSheet(OFToQString(styleSheet));
|
||||
[self qApplication]->setStyleSheet(toQt(styleSheet));
|
||||
}
|
||||
|
||||
- (int)wheelScrollLines
|
||||
|
|
|
@ -34,23 +34,22 @@
|
|||
|
||||
- (OFString*)accessibleDescription
|
||||
{
|
||||
return QToOFString([self qWidget]->accessibleDescription());
|
||||
return toOF([self qWidget]->accessibleDescription());
|
||||
}
|
||||
|
||||
- (void)setAccessibleDescription: (OFString*)accessibleDescription
|
||||
{
|
||||
[self qWidget]->setAccessibleDescription(
|
||||
OFToQString(accessibleDescription));
|
||||
[self qWidget]->setAccessibleDescription(toQt(accessibleDescription));
|
||||
}
|
||||
|
||||
- (OFString*)accessibleName
|
||||
{
|
||||
return QToOFString([self qWidget]->accessibleName());
|
||||
return toOF([self qWidget]->accessibleName());
|
||||
}
|
||||
|
||||
- (void)setAccessibleName: (OFString*)accessibleName
|
||||
{
|
||||
[self qWidget]->setAccessibleName(OFToQString(accessibleName));
|
||||
[self qWidget]->setAccessibleName(toQt(accessibleName));
|
||||
}
|
||||
|
||||
- (bool)autoFillBackground
|
||||
|
@ -65,17 +64,17 @@
|
|||
|
||||
- (of_dimension_t)baseSize
|
||||
{
|
||||
return QToOFDimension([self qWidget]->baseSize());
|
||||
return toOF([self qWidget]->baseSize());
|
||||
}
|
||||
|
||||
- (void)setBaseSize: (of_dimension_t)baseSize
|
||||
{
|
||||
[self qWidget]->setBaseSize(OFToQSize(baseSize));
|
||||
[self qWidget]->setBaseSize(toQt(baseSize));
|
||||
}
|
||||
|
||||
- (of_rectangle_t)childrenRect
|
||||
{
|
||||
return QToOFRectangle([self qWidget]->childrenRect());
|
||||
return toOF([self qWidget]->childrenRect());
|
||||
}
|
||||
|
||||
- (QRegion)childrenRegion
|
||||
|
@ -145,12 +144,12 @@
|
|||
|
||||
- (of_rectangle_t)frameGeometry
|
||||
{
|
||||
return QToOFRectangle([self qWidget]->frameGeometry());
|
||||
return toOF([self qWidget]->frameGeometry());
|
||||
}
|
||||
|
||||
- (of_dimension_t)frameSize
|
||||
{
|
||||
return QToOFDimension([self qWidget]->frameSize());
|
||||
return toOF([self qWidget]->frameSize());
|
||||
}
|
||||
|
||||
- (bool)isFullScreen
|
||||
|
@ -160,12 +159,12 @@
|
|||
|
||||
- (of_rectangle_t)geometry
|
||||
{
|
||||
return QToOFRectangle([self qWidget]->geometry());
|
||||
return toOF([self qWidget]->geometry());
|
||||
}
|
||||
|
||||
- (void)setGeometry: (of_rectangle_t)geometry
|
||||
{
|
||||
[self qWidget]->setGeometry(OFToQRect(geometry));
|
||||
[self qWidget]->setGeometry(toQt(geometry));
|
||||
}
|
||||
|
||||
- (int)height
|
||||
|
@ -235,12 +234,12 @@
|
|||
|
||||
- (of_dimension_t)maximumSize
|
||||
{
|
||||
return QToOFDimension([self qWidget]->maximumSize());
|
||||
return toOF([self qWidget]->maximumSize());
|
||||
}
|
||||
|
||||
- (void)setMaximumSize: (of_dimension_t)maximumSize
|
||||
{
|
||||
[self qWidget]->setMaximumSize(OFToQSize(maximumSize));
|
||||
[self qWidget]->setMaximumSize(toQt(maximumSize));
|
||||
}
|
||||
|
||||
- (int)maximumWidth
|
||||
|
@ -270,17 +269,17 @@
|
|||
|
||||
- (of_dimension_t)minimumSize
|
||||
{
|
||||
return QToOFDimension([self qWidget]->minimumSize());
|
||||
return toOF([self qWidget]->minimumSize());
|
||||
}
|
||||
|
||||
- (void)setMinimumSize: (of_dimension_t)minimumSize
|
||||
{
|
||||
[self qWidget]->setMinimumSize(OFToQSize(minimumSize));
|
||||
[self qWidget]->setMinimumSize(toQt(minimumSize));
|
||||
}
|
||||
|
||||
- (of_dimension_t)minimumSizeHint
|
||||
{
|
||||
return QToOFDimension([self qWidget]->minimumSizeHint());
|
||||
return toOF([self qWidget]->minimumSizeHint());
|
||||
}
|
||||
|
||||
- (int)minimumWidth
|
||||
|
@ -310,7 +309,7 @@
|
|||
|
||||
- (of_rectangle_t)normalGeometry
|
||||
{
|
||||
return QToOFRectangle([self qWidget]->normalGeometry());
|
||||
return toOF([self qWidget]->normalGeometry());
|
||||
}
|
||||
|
||||
- (const QPalette&)palette
|
||||
|
@ -325,42 +324,42 @@
|
|||
|
||||
- (of_point_t)pos
|
||||
{
|
||||
return QToOFPoint([self qWidget]->pos());
|
||||
return toOF([self qWidget]->pos());
|
||||
}
|
||||
|
||||
- (void)moveToPosition: (of_point_t)pos
|
||||
{
|
||||
[self qWidget]->move(OFToQPoint(pos));
|
||||
[self qWidget]->move(toQt(pos));
|
||||
}
|
||||
|
||||
- (of_rectangle_t)rect
|
||||
{
|
||||
return QToOFRectangle([self qWidget]->rect());
|
||||
return toOF([self qWidget]->rect());
|
||||
}
|
||||
|
||||
- (of_dimension_t)size
|
||||
{
|
||||
return QToOFDimension([self qWidget]->size());
|
||||
return toOF([self qWidget]->size());
|
||||
}
|
||||
|
||||
- (void)resizeTo: (of_dimension_t)size
|
||||
{
|
||||
[self qWidget]->resize(OFToQSize(size));
|
||||
[self qWidget]->resize(toQt(size));
|
||||
}
|
||||
|
||||
- (of_dimension_t)sizeHint
|
||||
{
|
||||
return QToOFDimension([self qWidget]->sizeHint());
|
||||
return toOF([self qWidget]->sizeHint());
|
||||
}
|
||||
|
||||
- (of_dimension_t)sizeIncrement
|
||||
{
|
||||
return QToOFDimension([self qWidget]->sizeIncrement());
|
||||
return toOF([self qWidget]->sizeIncrement());
|
||||
}
|
||||
|
||||
- (void)setSizeIncrement: (of_dimension_t)sizeIncrement
|
||||
{
|
||||
[self qWidget]->setSizeIncrement(OFToQSize(sizeIncrement));
|
||||
[self qWidget]->setSizeIncrement(toQt(sizeIncrement));
|
||||
}
|
||||
|
||||
- (QSizePolicy)sizePolicy
|
||||
|
@ -375,32 +374,32 @@
|
|||
|
||||
- (OFString*)statusTip
|
||||
{
|
||||
return QToOFString([self qWidget]->statusTip());
|
||||
return toOF([self qWidget]->statusTip());
|
||||
}
|
||||
|
||||
- (void)setStatusTip: (OFString*)statusTip
|
||||
{
|
||||
[self qWidget]->setStatusTip(OFToQString(statusTip));
|
||||
[self qWidget]->setStatusTip(toQt(statusTip));
|
||||
}
|
||||
|
||||
- (OFString*)styleSheet
|
||||
{
|
||||
return QToOFString([self qWidget]->styleSheet());
|
||||
return toOF([self qWidget]->styleSheet());
|
||||
}
|
||||
|
||||
- (void)setStyleSheet: (OFString*)styleSheet
|
||||
{
|
||||
[self qWidget]->setStyleSheet(OFToQString(styleSheet));
|
||||
[self qWidget]->setStyleSheet(toQt(styleSheet));
|
||||
}
|
||||
|
||||
- (OFString*)toolTip
|
||||
{
|
||||
return QToOFString([self qWidget]->toolTip());
|
||||
return toOF([self qWidget]->toolTip());
|
||||
}
|
||||
|
||||
- (void)setToolTip: (OFString*)toolTip
|
||||
{
|
||||
[self qWidget]->setToolTip(OFToQString(toolTip));
|
||||
[self qWidget]->setToolTip(toQt(toolTip));
|
||||
}
|
||||
|
||||
- (int)toolTipDuration
|
||||
|
@ -435,12 +434,12 @@
|
|||
|
||||
- (OFString*)whatsThis
|
||||
{
|
||||
return QToOFString([self qWidget]->whatsThis());
|
||||
return toOF([self qWidget]->whatsThis());
|
||||
}
|
||||
|
||||
- (void)setWhatsThis: (OFString*)whatsThis
|
||||
{
|
||||
[self qWidget]->setWhatsThis(OFToQString(whatsThis));
|
||||
[self qWidget]->setWhatsThis(toQt(whatsThis));
|
||||
}
|
||||
|
||||
- (int)width
|
||||
|
@ -450,12 +449,12 @@
|
|||
|
||||
- (OFString*)windowFilePath
|
||||
{
|
||||
return QToOFString([self qWidget]->windowFilePath());
|
||||
return toOF([self qWidget]->windowFilePath());
|
||||
}
|
||||
|
||||
- (void)setWindowFilePath: (OFString*)windowFilePath
|
||||
{
|
||||
[self qWidget]->setWindowFilePath(OFToQString(windowFilePath));
|
||||
[self qWidget]->setWindowFilePath(toQt(windowFilePath));
|
||||
}
|
||||
|
||||
- (Qt::WindowFlags)windowFlags
|
||||
|
@ -510,12 +509,12 @@
|
|||
|
||||
- (OFString*)windowTitle
|
||||
{
|
||||
return QToOFString([self qWidget]->windowTitle());
|
||||
return toOF([self qWidget]->windowTitle());
|
||||
}
|
||||
|
||||
- (void)setWindowTitle: (OFString*)windowTitle
|
||||
{
|
||||
[self qWidget]->setWindowTitle(OFToQString(windowTitle));
|
||||
[self qWidget]->setWindowTitle(toQt(windowTitle));
|
||||
}
|
||||
|
||||
- (int)x
|
||||
|
|
|
@ -4,51 +4,51 @@
|
|||
#include <QSize>
|
||||
#include <QRect>
|
||||
|
||||
inline OFString*
|
||||
QToOFString(const QString &qString)
|
||||
static OF_INLINE OFString*
|
||||
toOF(const QString &qString)
|
||||
{
|
||||
return [OFString stringWithUTF8String: qString.toUtf8()];
|
||||
}
|
||||
|
||||
inline QString
|
||||
OFToQString(OFString *string)
|
||||
static OF_INLINE QString
|
||||
toQt(OFString *string)
|
||||
{
|
||||
return QString::fromUtf8([string UTF8String]);
|
||||
}
|
||||
|
||||
inline of_dimension_t
|
||||
QToOFDimension(const QSize &qSize)
|
||||
{
|
||||
return of_dimension(qSize.width(), qSize.height());
|
||||
}
|
||||
|
||||
inline of_point_t
|
||||
QToOFPoint(const QPoint &qPoint)
|
||||
static OF_INLINE of_point_t
|
||||
toOF(const QPoint &qPoint)
|
||||
{
|
||||
return of_point(qPoint.x(), qPoint.y());
|
||||
}
|
||||
|
||||
inline QPoint
|
||||
OFToQPoint(of_point_t point)
|
||||
static OF_INLINE QPoint
|
||||
toQt(of_point_t point)
|
||||
{
|
||||
return QPoint(point.x, point.y);
|
||||
}
|
||||
|
||||
inline QSize
|
||||
OFToQSize(of_dimension_t dimension)
|
||||
static OF_INLINE of_dimension_t
|
||||
toOF(const QSize &qSize)
|
||||
{
|
||||
return of_dimension(qSize.width(), qSize.height());
|
||||
}
|
||||
|
||||
static OF_INLINE QSize
|
||||
toQt(of_dimension_t dimension)
|
||||
{
|
||||
return QSize(dimension.width, dimension.height);
|
||||
}
|
||||
|
||||
inline of_rectangle_t
|
||||
QToOFRectangle(const QRect &qRect)
|
||||
static OF_INLINE of_rectangle_t
|
||||
toOF(const QRect &qRect)
|
||||
{
|
||||
return of_rectangle(qRect.x(), qRect.y(),
|
||||
qRect.width(), qRect.height());
|
||||
}
|
||||
|
||||
inline QRect
|
||||
OFToQRect(of_rectangle_t rectangle)
|
||||
static OF_INLINE QRect
|
||||
toQt(of_rectangle_t rectangle)
|
||||
{
|
||||
return QRect(rectangle.origin.x, rectangle.origin.y,
|
||||
rectangle.size.width, rectangle.size.height);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue