Add a proper build system
Also lowers the minimum required Qt version to 5.5.
This commit is contained in:
parent
f30c404f3d
commit
c3ea2c3893
42 changed files with 5146 additions and 58 deletions
11
src/QtGui/Makefile
Normal file
11
src/QtGui/Makefile
Normal file
|
@ -0,0 +1,11 @@
|
|||
include ../../extra.mk
|
||||
|
||||
STATIC_PIC_LIB_NOINST = ${QTGUI_LIB_A}
|
||||
STATIC_LIB_NOINST = ${QTGUI_A}
|
||||
|
||||
SRCS = QtGUIApplication.mm \
|
||||
QtPaintDevice.mm
|
||||
|
||||
include ../../buildsys.mk
|
||||
|
||||
CPPFLAGS += -I. -I../QtCore -I../common
|
62
src/QtGui/QtGUIApplication.h
Normal file
62
src/QtGui/QtGUIApplication.h
Normal file
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* Copyright (c) 2017, Jonathan Schleifer <js@heap.zone>
|
||||
*
|
||||
* https://heap.zone/git/objqt.git
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice is present in all copies.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#import "QtCoreApplication.h"
|
||||
|
||||
#include <QGuiApplication>
|
||||
|
||||
@interface QtGUIApplication: QtCoreApplication
|
||||
@property (readonly) QGuiApplication *qGuiApplication;
|
||||
@property (copy) OFString *applicationDisplayName;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
|
||||
@property (copy) OFString *desktopFileName;
|
||||
#endif
|
||||
@property Qt::LayoutDirection layoutDirection;
|
||||
@property (readonly, copy) OFString *platformName;
|
||||
@property (readonly) QScreen *primaryScreen;
|
||||
@property bool quitsOnLastWindowClosed;
|
||||
@property QIcon windowIcon;
|
||||
|
||||
- initWithQGuiApplication: (QGuiApplication*)qGuiApplication;
|
||||
- (double)devicePixelRatio;
|
||||
- (bool)isSavingSession;
|
||||
- (bool)isSessionRestored;
|
||||
- (OFString*)sessionID;
|
||||
- (OFString*)sessionKey;
|
||||
@end
|
||||
|
||||
namespace ObjQt {
|
||||
|
||||
static OF_INLINE QtGUIApplication*
|
||||
toOF(QGuiApplication *qGuiApplication)
|
||||
{
|
||||
return [[[QtGUIApplication alloc]
|
||||
initWithQGuiApplication: qGuiApplication] autorelease];
|
||||
}
|
||||
|
||||
static OF_INLINE QGuiApplication*
|
||||
toQt(QtGUIApplication *GUIApplication)
|
||||
{
|
||||
return [GUIApplication qGuiApplication];
|
||||
}
|
||||
|
||||
}
|
133
src/QtGui/QtGUIApplication.mm
Normal file
133
src/QtGui/QtGUIApplication.mm
Normal file
|
@ -0,0 +1,133 @@
|
|||
/*
|
||||
* Copyright (c) 2017, Jonathan Schleifer <js@heap.zone>
|
||||
*
|
||||
* https://heap.zone/git/objqt.git
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice is present in all copies.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#import "QtGUIApplication.h"
|
||||
#import "OFString+QString.h"
|
||||
|
||||
#include <QIcon>
|
||||
|
||||
using ObjQt::toOF;
|
||||
using ObjQt::toQt;
|
||||
|
||||
@implementation QtGUIApplication
|
||||
- initWithQCoreApplication: (QCoreApplication*)qCoreApplication
|
||||
{
|
||||
OF_INVALID_INIT_METHOD
|
||||
}
|
||||
|
||||
- initWithQGuiApplication: (QGuiApplication*)qGuiApplication
|
||||
{
|
||||
return [super initWithQCoreApplication: qGuiApplication];
|
||||
}
|
||||
|
||||
- (QGuiApplication*)qGuiApplication
|
||||
{
|
||||
return qobject_cast<QGuiApplication*>(_qObject);
|
||||
}
|
||||
|
||||
- (OFString*)applicationDisplayName
|
||||
{
|
||||
return toOF(toQt(self)->applicationDisplayName());
|
||||
}
|
||||
|
||||
- (void)setApplicationDisplayName: (OFString*)applicationDisplayName
|
||||
{
|
||||
toQt(self)->setApplicationDisplayName(toQt(applicationDisplayName));
|
||||
}
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
|
||||
- (OFString*)desktopFileName
|
||||
{
|
||||
return toOF(toQt(self)->desktopFileName());
|
||||
}
|
||||
|
||||
- (void)setDesktopFileName: (OFString*)desktopFileName
|
||||
{
|
||||
toQt(self)->setDesktopFileName(toQt(desktopFileName));
|
||||
}
|
||||
#endif
|
||||
|
||||
- (double)devicePixelRatio
|
||||
{
|
||||
return toQt(self)->devicePixelRatio();
|
||||
}
|
||||
|
||||
- (bool)isSavingSession
|
||||
{
|
||||
return toQt(self)->isSavingSession();
|
||||
}
|
||||
|
||||
- (bool)isSessionRestored
|
||||
{
|
||||
return toQt(self)->isSessionRestored();
|
||||
}
|
||||
|
||||
- (Qt::LayoutDirection)layoutDirection
|
||||
{
|
||||
return toQt(self)->layoutDirection();
|
||||
}
|
||||
|
||||
- (void)setLayoutDirection: (Qt::LayoutDirection)layoutDirection
|
||||
{
|
||||
toQt(self)->setLayoutDirection(layoutDirection);
|
||||
}
|
||||
|
||||
- (OFString*)platformName
|
||||
{
|
||||
return toOF(toQt(self)->platformName());
|
||||
}
|
||||
|
||||
- (QScreen*)primaryScreen
|
||||
{
|
||||
return toQt(self)->primaryScreen();
|
||||
}
|
||||
|
||||
- (bool)quitsOnLastWindowClosed
|
||||
{
|
||||
return toQt(self)->quitOnLastWindowClosed();
|
||||
}
|
||||
|
||||
- (void)setQuitsOnLastWindowClosed: (bool)quitsOnLastWindowClosed
|
||||
{
|
||||
toQt(self)->setQuitOnLastWindowClosed(quitsOnLastWindowClosed);
|
||||
}
|
||||
|
||||
- (OFString*)sessionID
|
||||
{
|
||||
return toOF(toQt(self)->sessionId());
|
||||
}
|
||||
|
||||
- (OFString*)sessionKey
|
||||
{
|
||||
return toOF(toQt(self)->sessionKey());
|
||||
}
|
||||
|
||||
- (QIcon)windowIcon
|
||||
{
|
||||
return toQt(self)->windowIcon();
|
||||
}
|
||||
|
||||
- (void)setWindowIcon: (QIcon)windowIcon
|
||||
{
|
||||
toQt(self)->setWindowIcon(windowIcon);
|
||||
}
|
||||
@end
|
59
src/QtGui/QtPaintDevice.h
Normal file
59
src/QtGui/QtPaintDevice.h
Normal file
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* Copyright (c) 2017, Jonathan Schleifer <js@heap.zone>
|
||||
*
|
||||
* https://heap.zone/git/objqt.git
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice is present in all copies.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#import <ObjFW/ObjFW.h>
|
||||
|
||||
#include <QPaintDevice>
|
||||
|
||||
@protocol QtPaintDevice
|
||||
- (QPaintDevice*)qPaintDevice;
|
||||
- (int)colorCount;
|
||||
- (int)depth;
|
||||
- (int)devicePixelRatio;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
|
||||
- (double)devicePixelRatioF;
|
||||
#endif
|
||||
- (int)height;
|
||||
- (int)heightMM;
|
||||
- (int)logicalDPIX;
|
||||
- (int)logicalDPIY;
|
||||
- (QPaintEngine*)paintEngine;
|
||||
- (bool)paintingActive;
|
||||
- (int)physicalDPIX;
|
||||
- (int)physicalDPIY;
|
||||
- (int)width;
|
||||
- (int)widthMM;
|
||||
@end
|
||||
|
||||
@interface QtPaintDevice: OFObject <QtPaintDevice>
|
||||
@property (readonly) QObject *qObject;
|
||||
@end
|
||||
|
||||
namespace ObjQt {
|
||||
|
||||
static OF_INLINE QPaintDevice*
|
||||
toQt(QtPaintDevice *paintDevice)
|
||||
{
|
||||
return [paintDevice qPaintDevice];
|
||||
}
|
||||
|
||||
}
|
108
src/QtGui/QtPaintDevice.mm
Normal file
108
src/QtGui/QtPaintDevice.mm
Normal file
|
@ -0,0 +1,108 @@
|
|||
/*
|
||||
* Copyright (c) 2017, Jonathan Schleifer <js@heap.zone>
|
||||
*
|
||||
* https://heap.zone/git/objqt.git
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice is present in all copies.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#import "QtPaintDevice.h"
|
||||
|
||||
#include <QObject>
|
||||
|
||||
using ObjQt::toQt;
|
||||
|
||||
@implementation QtPaintDevice
|
||||
@dynamic qObject;
|
||||
|
||||
- (QPaintDevice*)qPaintDevice
|
||||
{
|
||||
return dynamic_cast<QPaintDevice*>([self qObject]);
|
||||
}
|
||||
|
||||
- (int)colorCount
|
||||
{
|
||||
return toQt(self)->colorCount();
|
||||
}
|
||||
|
||||
- (int)depth
|
||||
{
|
||||
return toQt(self)->depth();
|
||||
}
|
||||
|
||||
- (int)devicePixelRatio
|
||||
{
|
||||
return toQt(self)->devicePixelRatio();
|
||||
}
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
|
||||
- (double)devicePixelRatioF
|
||||
{
|
||||
return toQt(self)->devicePixelRatioF();
|
||||
}
|
||||
#endif
|
||||
|
||||
- (int)height
|
||||
{
|
||||
return toQt(self)->height();
|
||||
}
|
||||
|
||||
- (int)heightMM
|
||||
{
|
||||
return toQt(self)->heightMM();
|
||||
}
|
||||
|
||||
- (int)logicalDPIX
|
||||
{
|
||||
return toQt(self)->logicalDpiX();
|
||||
}
|
||||
|
||||
- (int)logicalDPIY
|
||||
{
|
||||
return toQt(self)->logicalDpiY();
|
||||
}
|
||||
|
||||
- (QPaintEngine*)paintEngine
|
||||
{
|
||||
return toQt(self)->paintEngine();
|
||||
}
|
||||
|
||||
- (bool)paintingActive
|
||||
{
|
||||
return toQt(self)->paintingActive();
|
||||
}
|
||||
|
||||
- (int)physicalDPIX
|
||||
{
|
||||
return toQt(self)->physicalDpiX();
|
||||
}
|
||||
|
||||
- (int)physicalDPIY
|
||||
{
|
||||
return toQt(self)->physicalDpiY();
|
||||
}
|
||||
|
||||
- (int)width
|
||||
{
|
||||
return toQt(self)->width();
|
||||
}
|
||||
|
||||
- (int)widthMM
|
||||
{
|
||||
return toQt(self)->widthMM();
|
||||
}
|
||||
@end
|
Loading…
Add table
Add a link
Reference in a new issue