Index: QtCore/QtCoreApplication.mm ================================================================== --- QtCore/QtCoreApplication.mm +++ QtCore/QtCoreApplication.mm @@ -19,22 +19,21 @@ return qobject_cast(_qObject); } - (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 { [self qCoreApplication]->installNativeEventFilter(filterObject); @@ -41,33 +40,32 @@ } - (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 { [self qCoreApplication]->quit(); Index: QtCore/QtObject.mm ================================================================== --- QtCore/QtObject.mm +++ QtCore/QtObject.mm @@ -43,16 +43,16 @@ _ownsObject = false; } - (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 { return _qObject->blockSignals(block); Index: QtGui/QtGuiApplication.mm ================================================================== --- QtGui/QtGuiApplication.mm +++ QtGui/QtGuiApplication.mm @@ -20,28 +20,27 @@ return qobject_cast(_qObject); } - (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 { return [self qGuiApplication]->devicePixelRatio(); @@ -67,11 +66,11 @@ [self qGuiApplication]->setLayoutDirection(layoutDirection); } - (OFString*)platformName { - return QToOFString([self qGuiApplication]->platformName()); + return toOF([self qGuiApplication]->platformName()); } - (QScreen*)primaryScreen { return [self qGuiApplication]->primaryScreen(); @@ -88,16 +87,16 @@ quitOnLastWindowClosed); } - (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 { return [self qGuiApplication]->windowIcon(); Index: QtWidgets/QtApplication.mm ================================================================== --- QtWidgets/QtApplication.mm +++ QtWidgets/QtApplication.mm @@ -48,16 +48,16 @@ [self qApplication]->setDoubleClickInterval(doubleClickInterval); } - (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 { return [self qApplication]->keyboardInputInterval(); @@ -88,16 +88,16 @@ [self qApplication]->setStartDragTime(startDragTime); } - (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 { return [self qApplication]->wheelScrollLines(); Index: QtWidgets/QtWidget.mm ================================================================== --- QtWidgets/QtWidget.mm +++ QtWidgets/QtWidget.mm @@ -32,27 +32,26 @@ [self qWidget]->setAcceptDrops(acceptDrops); } - (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 { return [self qWidget]->autoFillBackground(); @@ -63,21 +62,21 @@ [self qWidget]->setAutoFillBackground(autoFillBackground); } - (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 { return [self qWidget]->childrenRegion(); @@ -143,31 +142,31 @@ [self qWidget]->setFont(font); } - (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 { return [self qWidget]->isFullScreen(); } - (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 { return [self qWidget]->height(); @@ -233,16 +232,16 @@ [self qWidget]->setMaximumHeight(maximumHeight); } - (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 { return [self qWidget]->maximumWidth(); @@ -268,21 +267,21 @@ [self qWidget]->setMinimumHeight(minimumHeight); } - (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 { return [self qWidget]->minimumWidth(); @@ -308,11 +307,11 @@ [self qWidget]->setMouseTracking(mouseTracking); } - (of_rectangle_t)normalGeometry { - return QToOFRectangle([self qWidget]->normalGeometry()); + return toOF([self qWidget]->normalGeometry()); } - (const QPalette&)palette { return [self qWidget]->palette(); @@ -323,46 +322,46 @@ [self qWidget]->setPalette(palette); } - (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 { return [self qWidget]->sizePolicy(); @@ -373,36 +372,36 @@ [self qWidget]->setSizePolicy(sizePolicy); } - (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 { return [self qWidget]->toolTipDuration(); @@ -433,31 +432,31 @@ [self qWidget]->setVisible(visible); } - (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 { return [self qWidget]->width(); } - (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 { return [self qWidget]->windowFlags(); @@ -508,16 +507,16 @@ [self qWidget]->setWindowOpacity(windowOpacity); } - (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 { return [self qWidget]->x(); Index: common/helpers.h ================================================================== --- common/helpers.h +++ common/helpers.h @@ -2,54 +2,54 @@ #include #include #include -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); }