diff options
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/bearer/connman/qconnmanengine.cpp | 40 | ||||
-rw-r--r-- | src/plugins/bearer/connman/qconnmanengine.h | 2 | ||||
-rw-r--r-- | src/plugins/bearer/connman/qconnmanservice_linux.cpp | 16 | ||||
-rw-r--r-- | src/plugins/bearer/connman/qconnmanservice_linux_p.h | 5 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoabackingstore.mm | 3 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoanativeinterface.h | 3 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoanativeinterface.mm | 17 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoatheme.mm | 24 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoawindow.h | 6 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoawindow.mm | 41 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qnsview.mm | 6 | ||||
-rw-r--r-- | src/plugins/platforms/eglfs/qeglfshooks.h | 3 | ||||
-rw-r--r-- | src/plugins/platforms/eglfs/qeglfshooks_stub.cpp | 26 | ||||
-rw-r--r-- | src/plugins/platforms/windows/qwindowsdialoghelpers.cpp | 2 | ||||
-rw-r--r-- | src/plugins/platforms/windows/qwindowsscreen.cpp | 2 |
15 files changed, 171 insertions, 25 deletions
diff --git a/src/plugins/bearer/connman/qconnmanengine.cpp b/src/plugins/bearer/connman/qconnmanengine.cpp index 6ea34b17f5..eac0d2b813 100644 --- a/src/plugins/bearer/connman/qconnmanengine.cpp +++ b/src/plugins/bearer/connman/qconnmanengine.cpp @@ -65,6 +65,9 @@ QConnmanEngine::QConnmanEngine(QObject *parent) : QBearerEngineImpl(parent), connmanManager(new QConnmanManagerInterface(this)) { + qDBusRegisterMetaType<ConnmanMap>(); + qDBusRegisterMetaType<ConnmanMapList>(); + qRegisterMetaType<ConnmanMapList>("ConnmanMapList"); } QConnmanEngine::~QConnmanEngine() @@ -82,6 +85,9 @@ void QConnmanEngine::initialize() connect(connmanManager,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), this,SLOT(propertyChangedContext(QString,QString,QDBusVariant))); + connect(connmanManager,SIGNAL(servicesChanged(ConnmanMapList, QList<QDBusObjectPath>)), + this, SLOT(updateServices(ConnmanMapList, QList<QDBusObjectPath>))); + foreach (const QString &techPath, connmanManager->getTechnologies()) { QConnmanTechnologyInterface *tech; tech = new QConnmanTechnologyInterface(techPath, this); @@ -172,6 +178,22 @@ void QConnmanEngine::requestUpdate() QTimer::singleShot(0, this, SLOT(doRequestUpdate())); } +void QConnmanEngine::updateServices(const ConnmanMapList &changed, const QList<QDBusObjectPath> &removed) +{ + foreach (const QDBusObjectPath &objectPath, removed) { + removeConfiguration(QString::number(qHash(objectPath.path()))); + } + + foreach (const ConnmanMap &connmanMap, changed) { + const QString id = QString::number(qHash(connmanMap.objectPath.path())); + if (accessPointConfigurations.contains(id)) { + configurationChange(id); + } else { + addServiceConfiguration(connmanMap.objectPath.path()); + } + } +} + QString QConnmanEngine::serviceFromId(const QString &id) { QMutexLocker locker(&mutex); @@ -394,21 +416,23 @@ QNetworkConfiguration::StateFlags QConnmanEngine::getStateForService(const QStri QMutexLocker locker(&mutex); QConnmanServiceInterface serv(service); QNetworkConfiguration::StateFlags flag = QNetworkConfiguration::Defined; - if( serv.getType() == "cellular") { - if(serv.isSetupRequired()) { + if (serv.getType() == "cellular") { + if (serv.isSetupRequired() || !serv.isAutoConnect() || (serv.isRoaming() && isAlwaysAskRoaming())) { flag = ( flag | QNetworkConfiguration::Defined); } else { flag = ( flag | QNetworkConfiguration::Discovered); } } else { - if(serv.isFavorite()) { - flag = ( flag | QNetworkConfiguration::Discovered); + if (serv.isFavorite()) { + if (serv.isAutoConnect()) { + flag = ( flag | QNetworkConfiguration::Discovered); + } } else { flag = QNetworkConfiguration::Undefined; } } - if(serv.getState() == "ready" || serv.getState() == "online") { + if (serv.getState() == "ready" || serv.getState() == "online") { flag = ( flag | QNetworkConfiguration::Active); } @@ -569,6 +593,12 @@ bool QConnmanEngine::requiresPolling() const return false; } +bool QConnmanEngine::isAlwaysAskRoaming() +{ + QSettings confFile(QStringLiteral("nemomobile"), QStringLiteral("connectionagent")); + confFile.beginGroup(QStringLiteral("Connectionagent")); + return confFile.value(QStringLiteral("askForRoaming")).toBool(); +} QT_END_NAMESPACE #endif // QT_NO_DBUS diff --git a/src/plugins/bearer/connman/qconnmanengine.h b/src/plugins/bearer/connman/qconnmanengine.h index 9b6a271011..49a1a91d29 100644 --- a/src/plugins/bearer/connman/qconnmanengine.h +++ b/src/plugins/bearer/connman/qconnmanengine.h @@ -105,6 +105,7 @@ private Q_SLOTS: void servicePropertyChangedContext(const QString &,const QString &,const QDBusVariant &); void propertyChangedContext(const QString &,const QString &,const QDBusVariant &); void technologyPropertyChangedContext(const QString &,const QString &, const QDBusVariant &); + void updateServices(const ConnmanMapList &changed, const QList<QDBusObjectPath> &removed); private: QConnmanManagerInterface *connmanManager; @@ -128,6 +129,7 @@ private: QNetworkConfiguration::BearerType ofonoTechToBearerType(const QString &type); bool isRoamingAllowed(const QString &context); + bool isAlwaysAskRoaming(); protected: bool requiresPolling() const; }; diff --git a/src/plugins/bearer/connman/qconnmanservice_linux.cpp b/src/plugins/bearer/connman/qconnmanservice_linux.cpp index 380cf92a24..6d9ee265c6 100644 --- a/src/plugins/bearer/connman/qconnmanservice_linux.cpp +++ b/src/plugins/bearer/connman/qconnmanservice_linux.cpp @@ -127,8 +127,24 @@ void QConnmanManagerInterface::connectNotify(const QMetaMethod &signal) QObject::connect(helper,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), this,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), Qt::UniqueConnection); } + static const QMetaMethod servicesChangedSignal = QMetaMethod::fromSignal(&QConnmanManagerInterface::servicesChanged); + if (signal == servicesChangedSignal) { + if (!connection().connect(QLatin1String(CONNMAN_SERVICE), + QLatin1String(CONNMAN_MANAGER_PATH), + QLatin1String(CONNMAN_MANAGER_INTERFACE), + QLatin1String("ServicesChanged"), + this,SLOT(onServicesChanged(ConnmanMapList, QList<QDBusObjectPath>)))) { + qWarning() << "servicesChanged not connected"; + } + } } +void QConnmanManagerInterface::onServicesChanged(const ConnmanMapList &changed, const QList<QDBusObjectPath> &removed) +{ + emit servicesChanged(changed, removed); +} + + void QConnmanManagerInterface::disconnectNotify(const QMetaMethod &signal) { static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QConnmanManagerInterface::propertyChanged); diff --git a/src/plugins/bearer/connman/qconnmanservice_linux_p.h b/src/plugins/bearer/connman/qconnmanservice_linux_p.h index 43fb3d70fd..6996fef5a7 100644 --- a/src/plugins/bearer/connman/qconnmanservice_linux_p.h +++ b/src/plugins/bearer/connman/qconnmanservice_linux_p.h @@ -155,11 +155,16 @@ Q_SIGNALS: void propertyChanged(const QString &, const QDBusVariant &value); void stateChanged(const QString &); void propertyChangedContext(const QString &,const QString &,const QDBusVariant &); + void servicesChanged(const ConnmanMapList&, const QList<QDBusObjectPath> &); protected: void connectNotify(const QMetaMethod &signal); void disconnectNotify(const QMetaMethod &signal); QVariant getProperty(const QString &); + +private slots: + void onServicesChanged(const ConnmanMapList&, const QList<QDBusObjectPath> &); + }; class QConnmanProfileInterfacePrivate; diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.mm b/src/plugins/platforms/cocoa/qcocoabackingstore.mm index 665b3d4c13..30c15d823a 100644 --- a/src/plugins/platforms/cocoa/qcocoabackingstore.mm +++ b/src/plugins/platforms/cocoa/qcocoabackingstore.mm @@ -73,7 +73,8 @@ QPaintDevice *QCocoaBackingStore::paintDevice() } #endif - QImage::Format format = window()->format().hasAlpha() + QCocoaWindow *cocoaWindow = static_cast<QCocoaWindow *>(window()->handle()); + QImage::Format format = (window()->format().hasAlpha() || cocoaWindow->m_drawContentBorderGradient) ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32; m_qImage = QImage(m_requestedSize * scaleFactor, format); m_qImage.setDevicePixelRatio(scaleFactor); diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.h b/src/plugins/platforms/cocoa/qcocoanativeinterface.h index d30b281eb8..5c59c73847 100644 --- a/src/plugins/platforms/cocoa/qcocoanativeinterface.h +++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.h @@ -132,6 +132,9 @@ private: // touch events, which then will be delivered until the widget // deregisters. static void registerTouchWindow(QWindow *window, bool enable); + + // Request a unified title and toolbar look for the window. + static void setContentBorderThickness(QWindow *window, int topThickness, int bottomThickness); }; #endif // QCOCOANATIVEINTERFACE_H diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm index 795d1a8149..eb520b97c9 100644 --- a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm +++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm @@ -123,6 +123,8 @@ QPlatformNativeInterface::NativeResourceForIntegrationFunction QCocoaNativeInter return NativeResourceForIntegrationFunction(QCocoaNativeInterface::registerTouchWindow); if (resource.toLower() == "setembeddedinforeignview") return NativeResourceForIntegrationFunction(QCocoaNativeInterface::setEmbeddedInForeignView); + if (resource.toLower() == "setcontentborderthickness") + return NativeResourceForIntegrationFunction(QCocoaNativeInterface::setContentBorderThickness); return 0; } @@ -268,14 +270,19 @@ void QCocoaNativeInterface::registerTouchWindow(QWindow *window, bool enable) if (!window) return; - // Make sure the QCocoaWindow is created when enabling. Disabling might - // happen on window destruction, don't (re)create the QCocoaWindow then. - if (enable) - window->create(); - QCocoaWindow *cocoaWindow = static_cast<QCocoaWindow *>(window->handle()); if (cocoaWindow) cocoaWindow->registerTouch(enable); } +void QCocoaNativeInterface::setContentBorderThickness(QWindow *window, int topThickness, int bottomThickness) +{ + if (!window) + return; + + QCocoaWindow *cocoaWindow = static_cast<QCocoaWindow *>(window->handle()); + if (cocoaWindow) + cocoaWindow->setContentBorderThickness(topThickness, bottomThickness); +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qcocoatheme.mm b/src/plugins/platforms/cocoa/qcocoatheme.mm index bf6c47f273..109649f24e 100644 --- a/src/plugins/platforms/cocoa/qcocoatheme.mm +++ b/src/plugins/platforms/cocoa/qcocoatheme.mm @@ -259,13 +259,17 @@ QPixmap QCocoaTheme::fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &siz NSImage *iconImage = [[NSWorkspace sharedWorkspace] iconForFile:QCFString::toNSString(fileInfo.canonicalFilePath())]; if (!iconImage) return QPixmap(); - - NSRect iconRect = NSMakeRect(0, 0, size.width(), size.height()); - NSGraphicsContext *gc = [NSGraphicsContext currentContext]; - CGImageRef cgImage = [iconImage CGImageForProposedRect:&iconRect - context:([gc graphicsPort] ? gc : nil) - hints:nil]; - QPixmap pixmap = QPixmap::fromImage(qt_mac_toQImage(cgImage)); + NSSize pixmapSize = NSMakeSize(size.width(), size.height()); + QPixmap pixmap(pixmapSize.width, pixmapSize.height); + pixmap.fill(Qt::transparent); + [iconImage setSize:pixmapSize]; + NSRect iconRect = NSMakeRect(0, 0, pixmapSize.width, pixmapSize.height); + CGContextRef ctx = qt_mac_cg_context(&pixmap); + NSGraphicsContext *gc = [NSGraphicsContext graphicsContextWithGraphicsPort:ctx flipped:YES]; + [NSGraphicsContext saveGraphicsState]; + [NSGraphicsContext setCurrentContext:gc]; + [iconImage drawInRect:iconRect fromRect:iconRect operation:NSCompositeSourceOver fraction:1.0 respectFlipped:YES hints:nil]; + [NSGraphicsContext restoreGraphicsState]; return pixmap; } @@ -281,8 +285,12 @@ QVariant QCocoaTheme::themeHint(ThemeHint hint) const case TabAllWidgets: return QVariant(bool([[NSApplication sharedApplication] isFullKeyboardAccessEnabled])); case IconPixmapSizes: { + qreal devicePixelRatio = qGuiApp->devicePixelRatio(); QList<int> sizes; - sizes << 16 << 32 << 64 << 128; + sizes << 16 * devicePixelRatio + << 32 * devicePixelRatio + << 64 * devicePixelRatio + << 128 * devicePixelRatio; return QVariant::fromValue(sizes); } case QPlatformTheme::PasswordMaskCharacter: diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h index 69bea31343..c20773601d 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.h +++ b/src/plugins/platforms/cocoa/qcocoawindow.h @@ -157,6 +157,8 @@ public: void setWindowCursor(NSCursor *cursor); void registerTouch(bool enable); + void setContentBorderThickness(int topThickness, int bottomThickness); + void applyContentBorderThickness(NSWindow *window); qreal devicePixelRatio() const; bool isWindowExposable(); @@ -215,6 +217,10 @@ public: // for QNSView NSInteger m_alertRequest; id monitor; + bool m_drawContentBorderGradient; + int m_topContentBorderThickness; + int m_bottomContentBorderThickness; + // used by showFullScreen in fake mode QRect m_normalGeometry; Qt::WindowFlags m_oldWindowFlags; diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 5702689d84..f62a6d29ce 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -220,6 +220,9 @@ QCocoaWindow::QCocoaWindow(QWindow *tlw) , m_overrideBecomeKey(false) , m_alertRequest(NoAlertRequest) , monitor(nil) + , m_drawContentBorderGradient(false) + , m_topContentBorderThickness(0) + , m_bottomContentBorderThickness(0) , m_normalGeometry(QRect(0,0,-1,-1)) { #ifdef QT_COCOA_ENABLE_WINDOW_DEBUG @@ -511,6 +514,9 @@ NSUInteger QCocoaWindow::windowStyleMask(Qt::WindowFlags flags) } } + if (m_drawContentBorderGradient) + styleMask |= NSTexturedBackgroundWindowMask; + #ifdef QT_COCOA_ENABLE_WINDOW_DEBUG qDebug("windowStyleMask of '%s': flags %X -> styleMask %lX", qPrintable(window()->title()), (int)flags, styleMask); #endif @@ -936,6 +942,9 @@ NSWindow * QCocoaWindow::createNSWindow() } m_windowModality = window()->modality(); + + applyContentBorderThickness(createdWindow); + return createdWindow; } @@ -1100,6 +1109,38 @@ void QCocoaWindow::registerTouch(bool enable) [m_contentView setAcceptsTouchEvents:NO]; } +void QCocoaWindow::setContentBorderThickness(int topThickness, int bottomThickness) +{ + m_topContentBorderThickness = topThickness; + m_bottomContentBorderThickness = bottomThickness; + bool enable = (topThickness > 0 || bottomThickness > 0); + m_drawContentBorderGradient = enable; + + applyContentBorderThickness(m_nsWindow); +} + +void QCocoaWindow::applyContentBorderThickness(NSWindow *window) +{ + if (!window) + return; + + if (m_drawContentBorderGradient) + [window setStyleMask:[window styleMask] | NSTexturedBackgroundWindowMask]; + else + [window setStyleMask:[window styleMask] & ~NSTexturedBackgroundWindowMask]; + + if (m_topContentBorderThickness > 0) { + [window setContentBorderThickness:m_topContentBorderThickness forEdge:NSMaxYEdge]; + [window setAutorecalculatesContentBorderThickness:NO forEdge:NSMaxYEdge]; + } + + if (m_bottomContentBorderThickness > 0) { + [window setContentBorderThickness:m_topContentBorderThickness forEdge:NSMinYEdge]; + [window setAutorecalculatesContentBorderThickness:NO forEdge:NSMinYEdge]; + } +} + + qreal QCocoaWindow::devicePixelRatio() const { #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index e183f93c6c..f7b129aea1 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -408,6 +408,9 @@ static QTouchDevice *touchDevice = 0; m_shouldSetGLContextinDrawRect = false; } + if (m_platformWindow->m_drawContentBorderGradient) + NSDrawWindowBackground(dirtyRect); + if (!m_backingStore) return; @@ -451,7 +454,8 @@ static QTouchDevice *touchDevice = 0; // Optimization: Copy frame buffer content instead of blending for // top-level windows where Qt fills the entire window content area. - if (m_platformWindow->m_nsWindow) + // (But don't overpaint the title-bar gradient) + if (m_platformWindow->m_nsWindow && !m_platformWindow->m_drawContentBorderGradient) CGContextSetBlendMode(cgContext, kCGBlendModeCopy); CGContextDrawImage(cgContext, dirtyWindowRect, cleanImg); diff --git a/src/plugins/platforms/eglfs/qeglfshooks.h b/src/plugins/platforms/eglfs/qeglfshooks.h index dfafec73af..67f4d1803d 100644 --- a/src/plugins/platforms/eglfs/qeglfshooks.h +++ b/src/plugins/platforms/eglfs/qeglfshooks.h @@ -77,7 +77,8 @@ public: virtual bool filterConfig(EGLDisplay display, EGLConfig config) const; virtual void waitForVSync() const; - virtual const char *fbDeviceName() const; + virtual QByteArray fbDeviceName() const; + virtual int framebufferIndex() const; static QEglFSHooks *hooks() { diff --git a/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp b/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp index f5467fd6a4..b81d260ecb 100644 --- a/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp +++ b/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp @@ -42,6 +42,7 @@ #include "qeglfshooks.h" #include <QtPlatformSupport/private/qeglplatformcursor_p.h> #include <QtPlatformSupport/private/qeglconvenience_p.h> +#include <QtCore/QRegularExpression> #include <fcntl.h> #include <unistd.h> @@ -56,17 +57,34 @@ QT_BEGIN_NAMESPACE // this is a global static to keep the QEglFSHooks interface as clean as possible static int framebuffer = -1; -const char *QEglFSHooks::fbDeviceName() const +QByteArray QEglFSHooks::fbDeviceName() const { - return "/dev/fb0"; + QByteArray fbDev = qgetenv("QT_QPA_EGLFS_FB"); + if (fbDev.isEmpty()) + fbDev = QByteArrayLiteral("/dev/fb0"); + + return fbDev; +} + +int QEglFSHooks::framebufferIndex() const +{ + int fbIndex = 0; + QRegularExpression fbIndexRx(QLatin1String("fb(\\d+)")); + QRegularExpressionMatch match = fbIndexRx.match(fbDeviceName()); + if (match.hasMatch()) + fbIndex = match.captured(1).toInt(); + + return fbIndex; } void QEglFSHooks::platformInit() { - framebuffer = qt_safe_open(fbDeviceName(), O_RDONLY); + QByteArray fbDev = fbDeviceName(); + + framebuffer = qt_safe_open(fbDev, O_RDONLY); if (framebuffer == -1) - qWarning("EGLFS: Failed to open %s", fbDeviceName()); + qWarning("EGLFS: Failed to open %s", qPrintable(fbDev)); } void QEglFSHooks::platformDestroy() diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp index 497d0975af..8ebfd018d0 100644 --- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp +++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp @@ -572,6 +572,8 @@ bool QWindowsDialogHelperBase<BaseClass>::show(Qt::WindowFlags, QWindow *parent) { const bool modal = (windowModality != Qt::NonModal); + if (!parent) + parent = QGuiApplication::focusWindow(); // Need a parent window, else the application loses activation when closed. if (parent) { m_ownerWindow = QWindowsWindow::handleOf(parent); } else { diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp index 234cadcd75..60c8bee286 100644 --- a/src/plugins/platforms/windows/qwindowsscreen.cpp +++ b/src/plugins/platforms/windows/qwindowsscreen.cpp @@ -304,6 +304,8 @@ QList<QPlatformScreen *> QWindowsScreen::virtualSiblings() const void QWindowsScreen::handleChanges(const QWindowsScreenData &newData) { + m_data.physicalSizeMM = newData.physicalSizeMM; + if (m_data.geometry != newData.geometry) { m_data.geometry = newData.geometry; QWindowSystemInterface::handleScreenGeometryChange(screen(), |