diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2011-07-19 13:08:23 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2011-07-19 13:08:23 (GMT) |
commit | 4e2a44d6d56f2c28709ef9687ca10b820332dd5f (patch) | |
tree | bf9a0af7516c0a71f516017da07c3aac72095fc4 /src | |
parent | 98b40e05ed8289402c4d05c17645db4f8f04d890 (diff) | |
parent | b683aaa27430ced087b4230e031f56c3100f8068 (diff) | |
download | Qt-4e2a44d6d56f2c28709ef9687ca10b820332dd5f.zip Qt-4e2a44d6d56f2c28709ef9687ca10b820332dd5f.tar.gz Qt-4e2a44d6d56f2c28709ef9687ca10b820332dd5f.tar.bz2 |
Merge branch 'master' of git://scm.dev.nokia.troll.no/qt/qt-fire-team
* 'master' of git://scm.dev.nokia.troll.no/qt/qt-fire-team:
Move separator skipping to proper place
Skip shaping for hidden line/paragraph separators
Support interface orientation for uikit.
Add support for opening LinuxInput devices exclusively ('grabbing').
Fixed regression in compilerwarnings.
Properly quit the input event thread in the directfb platform plugin.
Apply 57993ba7 properly to 4.8
Deprecate some QPixmap functions (marked as obsolete already).
Deprecate some functions in QImage (that have been obsolete since 4.1).
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/embedded/qkbdlinuxinput_qws.cpp | 4 | ||||
-rw-r--r-- | src/gui/embedded/qmouselinuxinput_qws.cpp | 13 | ||||
-rw-r--r-- | src/gui/image/qimage.h | 13 | ||||
-rw-r--r-- | src/gui/image/qpixmap.h | 10 | ||||
-rw-r--r-- | src/gui/text/qtextengine.cpp | 2 | ||||
-rw-r--r-- | src/gui/text/qtextengine_mac.cpp | 7 | ||||
-rw-r--r-- | src/plugins/platforms/directfb/qdirectfbintegration.cpp | 2 | ||||
-rw-r--r-- | src/plugins/platforms/uikit/quikiteventloop.mm | 65 | ||||
-rw-r--r-- | src/plugins/platforms/uikit/quikitintegration.h | 2 | ||||
-rw-r--r-- | src/plugins/platforms/uikit/quikitintegration.mm | 9 | ||||
-rw-r--r-- | src/plugins/platforms/uikit/quikitscreen.h | 1 | ||||
-rw-r--r-- | src/plugins/platforms/uikit/quikitscreen.mm | 26 | ||||
-rw-r--r-- | src/plugins/platforms/uikit/quikitwindow.h | 4 | ||||
-rw-r--r-- | src/plugins/platforms/uikit/quikitwindow.mm | 67 |
14 files changed, 194 insertions, 31 deletions
diff --git a/src/gui/embedded/qkbdlinuxinput_qws.cpp b/src/gui/embedded/qkbdlinuxinput_qws.cpp index 376b0d0..b2e7cb3 100644 --- a/src/gui/embedded/qkbdlinuxinput_qws.cpp +++ b/src/gui/embedded/qkbdlinuxinput_qws.cpp @@ -103,6 +103,7 @@ QWSLinuxInputKbPrivate::QWSLinuxInputKbPrivate(QWSLinuxInputKeyboardHandler *h, QString dev = QLatin1String("/dev/input/event1"); int repeat_delay = -1; int repeat_rate = -1; + int grab = 0; QStringList args = device.split(QLatin1Char(':')); foreach (const QString &arg, args) { @@ -110,12 +111,15 @@ QWSLinuxInputKbPrivate::QWSLinuxInputKbPrivate(QWSLinuxInputKeyboardHandler *h, repeat_delay = arg.mid(13).toInt(); else if (arg.startsWith(QLatin1String("repeat-rate="))) repeat_rate = arg.mid(12).toInt(); + else if (arg.startsWith(QLatin1String("grab="))) + grab = arg.mid(5).toInt(); else if (arg.startsWith(QLatin1String("/dev/"))) dev = arg; } m_fd = QT_OPEN(dev.toLocal8Bit().constData(), O_RDWR, 0); if (m_fd >= 0) { + ::ioctl(m_fd, EVIOCGRAB, grab); if (repeat_delay > 0 && repeat_rate > 0) { int kbdrep[2] = { repeat_delay, repeat_rate }; ::ioctl(m_fd, EVIOCSREP, kbdrep); diff --git a/src/gui/embedded/qmouselinuxinput_qws.cpp b/src/gui/embedded/qmouselinuxinput_qws.cpp index 19a9a99..5b4f664 100644 --- a/src/gui/embedded/qmouselinuxinput_qws.cpp +++ b/src/gui/embedded/qmouselinuxinput_qws.cpp @@ -43,6 +43,7 @@ #include <QScreen> #include <QSocketNotifier> +#include <QStringList> #include <qplatformdefs.h> #include <private/qcore_unix_p.h> // overrides QT_OPEN @@ -101,11 +102,19 @@ QWSLinuxInputMousePrivate::QWSLinuxInputMousePrivate(QWSLinuxInputMouseHandler * setObjectName(QLatin1String("LinuxInputSubsystem Mouse Handler")); QString dev = QLatin1String("/dev/input/event0"); - if (device.startsWith(QLatin1String("/dev/"))) - dev = device; + int grab = 0; + + QStringList args = device.split(QLatin1Char(':')); + foreach (const QString &arg, args) { + if (arg.startsWith(QLatin1String("grab="))) + grab = arg.mid(5).toInt(); + else if (arg.startsWith(QLatin1String("/dev/"))) + dev = arg; + } m_fd = QT_OPEN(dev.toLocal8Bit().constData(), O_RDONLY | O_NDELAY, 0); if (m_fd >= 0) { + ::ioctl(m_fd, EVIOCGRAB, grab); m_notify = new QSocketNotifier(m_fd, QSocketNotifier::Read, this); connect(m_notify, SIGNAL(activated(int)), this, SLOT(readMouseData())); } else { diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h index c783b76..2aeb3de 100644 --- a/src/gui/image/qimage.h +++ b/src/gui/image/qimage.h @@ -275,12 +275,13 @@ public: QString text(const QString &key = QString()) const; void setText(const QString &key, const QString &value); - // The following functions are obsolete as of 4.1 - QString text(const char* key, const char* lang=0) const; - QList<QImageTextKeyLang> textList() const; - QStringList textLanguages() const; - QString text(const QImageTextKeyLang&) const; - void setText(const char* key, const char* lang, const QString&); +#ifdef QT_DEPRECATED + QT_DEPRECATED QString text(const char* key, const char* lang=0) const; + QT_DEPRECATED QList<QImageTextKeyLang> textList() const; + QT_DEPRECATED QStringList textLanguages() const; + QT_DEPRECATED QString text(const QImageTextKeyLang&) const; + QT_DEPRECATED void setText(const char* key, const char* lang, const QString&); +#endif #endif #ifdef QT3_SUPPORT diff --git a/src/gui/image/qpixmap.h b/src/gui/image/qpixmap.h index 4668913..f5479e7 100644 --- a/src/gui/image/qpixmap.h +++ b/src/gui/image/qpixmap.h @@ -109,8 +109,10 @@ public: QBitmap mask() const; void setMask(const QBitmap &); - QPixmap alphaChannel() const; - void setAlphaChannel(const QPixmap &); +#ifdef QT_DEPRECATED + QT_DEPRECATED QPixmap alphaChannel() const; + QT_DEPRECATED void setAlphaChannel(const QPixmap &); +#endif bool hasAlpha() const; bool hasAlphaChannel() const; @@ -183,7 +185,9 @@ public: inline void scroll(int dx, int dy, int x, int y, int width, int height, QRegion *exposed = 0); void scroll(int dx, int dy, const QRect &rect, QRegion *exposed = 0); - int serialNumber() const; +#ifdef QT_DEPRECATED + QT_DEPRECATED int serialNumber() const; +#endif qint64 cacheKey() const; bool isDetached() const; diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index db50bdf..d92c418 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -2808,7 +2808,7 @@ QFixed QTextEngine::alignLine(const QScriptLine &line) if (align & Qt::AlignRight) x = line.width - (line.textAdvance + leadingSpaceWidth(line)); else if (align & Qt::AlignHCenter) - x = (line.width - (line.textAdvance + leadingSpaceWidth(line)))/2; + x = (line.width - line.textAdvance)/2 - leadingSpaceWidth(line); } return x; } diff --git a/src/gui/text/qtextengine_mac.cpp b/src/gui/text/qtextengine_mac.cpp index 251d9b5..9da8f03 100644 --- a/src/gui/text/qtextengine_mac.cpp +++ b/src/gui/text/qtextengine_mac.cpp @@ -605,6 +605,12 @@ void QTextEngine::shapeTextMac(int item) const unsigned short *log_clusters = logClusters(&si); bool stringToCMapFailed = false; + // Skip shaping of line or paragraph separators since we are not + // going to draw them anyway + if (si.analysis.flags == QScriptAnalysis::LineOrParagraphSeparator + && !(option.flags() & QTextOption::ShowLineAndParagraphSeparators)) + goto cleanUp; + if (!fe->stringToCMap(str, len, &g, &num_glyphs, flags, log_clusters, attributes(), &si)) { ensureSpace(num_glyphs); g = availableGlyphs(&si); @@ -645,6 +651,7 @@ void QTextEngine::shapeTextMac(int item) const } } +cleanUp: const ushort *uc = reinterpret_cast<const ushort *>(str); if ((si.analysis.flags == QScriptAnalysis::SmallCaps || si.analysis.flags == QScriptAnalysis::Uppercase diff --git a/src/plugins/platforms/directfb/qdirectfbintegration.cpp b/src/plugins/platforms/directfb/qdirectfbintegration.cpp index 61f1d25..06b0b51 100644 --- a/src/plugins/platforms/directfb/qdirectfbintegration.cpp +++ b/src/plugins/platforms/directfb/qdirectfbintegration.cpp @@ -112,6 +112,8 @@ QDirectFbIntegration::QDirectFbIntegration() QDirectFbIntegration::~QDirectFbIntegration() { mInput->stopInputEventLoop(); + mInputRunner->quit(); + mInputRunner->wait(); delete mInputRunner; delete mInput; } diff --git a/src/plugins/platforms/uikit/quikiteventloop.mm b/src/plugins/platforms/uikit/quikiteventloop.mm index 7c3e929..01ecf3f 100644 --- a/src/plugins/platforms/uikit/quikiteventloop.mm +++ b/src/plugins/platforms/uikit/quikiteventloop.mm @@ -40,6 +40,8 @@ ****************************************************************************/ #include "quikiteventloop.h" +#include "quikitintegration.h" +#include "quikitscreen.h" #include "quikitwindow.h" #include "quikitwindowsurface.h" @@ -50,7 +52,11 @@ #include <QtDebug> @interface QUIKitAppDelegate : NSObject <UIApplicationDelegate> { + UIInterfaceOrientation mOrientation; } + +- (void)updateOrientation:(NSNotification *)notification; + @end @interface EventLoopHelper : NSObject { @@ -69,14 +75,71 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { Q_UNUSED(launchOptions) - Q_UNUSED(application) + mOrientation = application.statusBarOrientation; + [self updateOrientation:nil]; + if (QUIKitIntegration::instance()->screens().size() > 0) { + QUIKitScreen *screen = static_cast<QUIKitScreen *>(QUIKitIntegration::instance()->screens().at(0)); + screen->updateInterfaceOrientation(); + } foreach (QWidget *widget, qApp->topLevelWidgets()) { QUIKitWindow *platformWindow = static_cast<QUIKitWindow *>(widget->platformWindow()); if (platformWindow) platformWindow->ensureNativeWindow(); } + // orientation support + [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(updateOrientation:) + name:UIDeviceOrientationDidChangeNotification + object:nil]; return YES; } +- (void)updateOrientation:(NSNotification *)notification +{ + Q_UNUSED(notification) + UIInterfaceOrientation newOrientation = mOrientation; + NSString *infoValue = @""; + switch ([UIDevice currentDevice].orientation) { + case UIDeviceOrientationUnknown: + break; + case UIDeviceOrientationPortrait: + newOrientation = UIInterfaceOrientationPortrait; + infoValue = @"UIInterfaceOrientationPortrait"; + break; + case UIDeviceOrientationPortraitUpsideDown: + newOrientation = UIInterfaceOrientationPortraitUpsideDown; + infoValue = @"UIInterfaceOrientationPortraitUpsideDown"; + break; + case UIDeviceOrientationLandscapeLeft: + newOrientation = UIInterfaceOrientationLandscapeRight; // as documentated + infoValue = @"UIInterfaceOrientationLandscapeRight"; + break; + case UIDeviceOrientationLandscapeRight: + newOrientation = UIInterfaceOrientationLandscapeLeft; // as documentated + infoValue = @"UIInterfaceOrientationLandscapeLeft"; + break; + case UIDeviceOrientationFaceUp: + case UIDeviceOrientationFaceDown: + break; + } + + if (newOrientation == mOrientation) + return; + + // check against supported orientations + NSBundle *bundle = [NSBundle mainBundle]; + NSArray *orientations = [bundle objectForInfoDictionaryKey:@"UISupportedInterfaceOrientations"]; + if (![orientations containsObject:infoValue]) + return; + + mOrientation = newOrientation; + [UIApplication sharedApplication].statusBarOrientation = mOrientation; + if (QUIKitIntegration::instance()->screens().size() > 0) { + QUIKitScreen *screen = static_cast<QUIKitScreen *>(QUIKitIntegration::instance()->screens().at(0)); + screen->updateInterfaceOrientation(); + } +} + - (void)applicationWillTerminate:(UIApplication *)application { Q_UNUSED(application) diff --git a/src/plugins/platforms/uikit/quikitintegration.h b/src/plugins/platforms/uikit/quikitintegration.h index d9844b2..a392f1d 100644 --- a/src/plugins/platforms/uikit/quikitintegration.h +++ b/src/plugins/platforms/uikit/quikitintegration.h @@ -52,6 +52,8 @@ public: QUIKitIntegration(); ~QUIKitIntegration(); + static QUIKitIntegration *instance(); + QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const; QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; diff --git a/src/plugins/platforms/uikit/quikitintegration.mm b/src/plugins/platforms/uikit/quikitintegration.mm index 21ab38f..ca020c9 100644 --- a/src/plugins/platforms/uikit/quikitintegration.mm +++ b/src/plugins/platforms/uikit/quikitintegration.mm @@ -66,9 +66,18 @@ public: } }; +static QUIKitIntegration *m_instance = 0; + +QUIKitIntegration * QUIKitIntegration::instance() +{ + return m_instance; +} + QUIKitIntegration::QUIKitIntegration() :mFontDb(new QUIKitFontDatabase() ) { + if (!m_instance) + m_instance = this; mScreens << new QUIKitScreen(0); } diff --git a/src/plugins/platforms/uikit/quikitscreen.h b/src/plugins/platforms/uikit/quikitscreen.h index 23e95f6..1b17d60 100644 --- a/src/plugins/platforms/uikit/quikitscreen.h +++ b/src/plugins/platforms/uikit/quikitscreen.h @@ -61,6 +61,7 @@ public: UIScreen *uiScreen() const; + void updateInterfaceOrientation(); private: QRect m_geometry; int m_depth; diff --git a/src/plugins/platforms/uikit/quikitscreen.mm b/src/plugins/platforms/uikit/quikitscreen.mm index ae1c7cf..d7d8207 100644 --- a/src/plugins/platforms/uikit/quikitscreen.mm +++ b/src/plugins/platforms/uikit/quikitscreen.mm @@ -40,6 +40,7 @@ ****************************************************************************/ #include "quikitscreen.h" +#include "quikitwindow.h" #include <QtGui/QApplication> @@ -52,8 +53,7 @@ QUIKitScreen::QUIKitScreen(int screenIndex) m_index(screenIndex) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - UIScreen *screen = [[UIScreen screens] objectAtIndex:screenIndex]; - CGRect bounds = [screen bounds]; + CGRect bounds = [uiScreen() bounds]; m_geometry = QRect(bounds.origin.x, bounds.origin.y, bounds.size.width, bounds.size.height); m_format = QImage::Format_ARGB32; @@ -87,4 +87,26 @@ UIScreen *QUIKitScreen::uiScreen() const return [[UIScreen screens] objectAtIndex:m_index]; } +void QUIKitScreen::updateInterfaceOrientation() +{ + CGRect bounds = [uiScreen() bounds]; + switch ([[UIApplication sharedApplication] statusBarOrientation]) { + case UIInterfaceOrientationPortrait: + case UIInterfaceOrientationPortraitUpsideDown: + m_geometry = QRect(bounds.origin.x, bounds.origin.y, bounds.size.width, bounds.size.height);; + break; + case UIInterfaceOrientationLandscapeLeft: + case UIInterfaceOrientationLandscapeRight: + m_geometry = QRect(bounds.origin.x, bounds.origin.y, + bounds.size.height, bounds.size.width); + break; + } + foreach (QWidget *widget, qApp->topLevelWidgets()) { + QUIKitWindow *platformWindow = static_cast<QUIKitWindow *>(widget->platformWindow()); + if (platformWindow && platformWindow->platformScreen() == this) { + platformWindow->updateGeometryAndOrientation(); + } + } +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/uikit/quikitwindow.h b/src/plugins/platforms/uikit/quikitwindow.h index c482dae..c91b751 100644 --- a/src/plugins/platforms/uikit/quikitwindow.h +++ b/src/plugins/platforms/uikit/quikitwindow.h @@ -119,9 +119,13 @@ public: QPlatformGLContext *glContext() const; + QUIKitScreen *platformScreen() const { return mScreen; } + + void updateGeometryAndOrientation(); private: QUIKitScreen *mScreen; UIWindow *mWindow; + CGRect mFrame; EAGLView *mView; mutable EAGLPlatformContext *mContext; }; diff --git a/src/plugins/platforms/uikit/quikitwindow.mm b/src/plugins/platforms/uikit/quikitwindow.mm index ec33cd0..6e018fe 100644 --- a/src/plugins/platforms/uikit/quikitwindow.mm +++ b/src/plugins/platforms/uikit/quikitwindow.mm @@ -320,10 +320,7 @@ QUIKitWindow::QUIKitWindow(QWidget *tlw) : mContext(0) { mScreen = static_cast<QUIKitScreen *>(QPlatformScreen::platformScreenForWidget(tlw)); - CGRect screenBounds = [mScreen->uiScreen() bounds]; - QRect geom(screenBounds.origin.x, screenBounds.origin.y, screenBounds.size.width, screenBounds.size.height); - QPlatformWindow::setGeometry(geom); - mView = [[EAGLView alloc] initWithFrame:CGRectMake(geom.x(), geom.y(), geom.width(), geom.height())]; + mView = [[EAGLView alloc] init]; } QUIKitWindow::~QUIKitWindow() @@ -335,29 +332,23 @@ QUIKitWindow::~QUIKitWindow() void QUIKitWindow::setGeometry(const QRect &rect) { - if (mWindow && rect != geometry()) { - mWindow.frame = CGRectMake(rect.x(), rect.y(), rect.width(), rect.height()); - mView.frame = CGRectMake(0, 0, rect.width(), rect.height()); - [mView deleteFramebuffer]; - [mWindow setNeedsDisplay]; - } + // Not supported. Only a single "full screen" window is supported QPlatformWindow::setGeometry(rect); } UIWindow *QUIKitWindow::ensureNativeWindow() { if (!mWindow) { - // window - CGRect frame = [mScreen->uiScreen() applicationFrame]; - QRect geom = QRect(frame.origin.x, frame.origin.y, frame.size.width, frame.size.height); - widget()->setGeometry(geom); mWindow = [[UIWindow alloc] init]; + updateGeometryAndOrientation(); + // window mWindow.screen = mScreen->uiScreen(); - mWindow.frame = frame; // for some reason setting the screen resets frame.origin, so we need to set the frame afterwards + // for some reason setting the screen resets frame.origin, so we need to set the frame afterwards + mWindow.frame = mFrame; // view [mView deleteFramebuffer]; - mView.frame = CGRectMake(0, 0, frame.size.width, frame.size.height); // fill + mView.frame = CGRectMake(0, 0, mWindow.bounds.size.width, mWindow.bounds.size.height); // fill [mView setMultipleTouchEnabled:YES]; [mView setWindow:this]; [mWindow addSubview:mView]; @@ -367,6 +358,50 @@ UIWindow *QUIKitWindow::ensureNativeWindow() return mWindow; } +void QUIKitWindow::updateGeometryAndOrientation() +{ + if (!mWindow) + return; + mFrame = [mScreen->uiScreen() applicationFrame]; + CGRect screen = [mScreen->uiScreen() bounds]; + QRect geom; + CGFloat angle = 0; + switch ([[UIApplication sharedApplication] statusBarOrientation]) { + case UIInterfaceOrientationPortrait: + geom = QRect(mFrame.origin.x, mFrame.origin.y, mFrame.size.width, mFrame.size.height); + break; + case UIInterfaceOrientationPortraitUpsideDown: + geom = QRect(screen.size.width - mFrame.origin.x - mFrame.size.width, + screen.size.height - mFrame.origin.y - mFrame.size.height, + mFrame.size.width, + mFrame.size.height); + angle = M_PI; + break; + case UIInterfaceOrientationLandscapeLeft: + geom = QRect(screen.size.height - mFrame.origin.y - mFrame.size.height, + mFrame.origin.x, + mFrame.size.height, + mFrame.size.width); + angle = -M_PI/2.; + break; + case UIInterfaceOrientationLandscapeRight: + geom = QRect(mFrame.origin.y, + screen.size.width - mFrame.origin.x - mFrame.size.width, + mFrame.size.height, + mFrame.size.width); + angle = +M_PI/2.; + break; + } + if (angle != 0) { + [mView layer].transform = CATransform3DMakeRotation(angle, 0, 0, 1.); + } else { + [mView layer].transform = CATransform3DIdentity; + } + [mView setNeedsDisplay]; + widget()->setGeometry(geom); + widget()->update(); +} + QPlatformGLContext *QUIKitWindow::glContext() const { if (!mContext) { |