summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/bearer/corewlan/qcorewlanengine.h6
-rw-r--r--src/plugins/bearer/corewlan/qcorewlanengine.mm221
-rw-r--r--src/plugins/bearer/icd/monitor.cpp56
-rw-r--r--src/plugins/bearer/icd/monitor.h22
-rw-r--r--src/plugins/bearer/icd/qicdengine.cpp24
-rw-r--r--src/plugins/bearer/icd/qnetworksession_impl.cpp32
-rw-r--r--src/plugins/bearer/icd/qnetworksession_impl.h7
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp3
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp293
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerservice.h112
-rw-r--r--src/plugins/bearer/networkmanager/qnmdbushelper.cpp11
-rw-r--r--src/plugins/bearer/networkmanager/qnmdbushelper.h2
-rw-r--r--src/plugins/bearer/qnetworksession_impl.cpp11
-rw-r--r--src/plugins/bearer/symbian/qnetworksession_impl.cpp17
-rw-r--r--src/plugins/bearer/symbian/symbianengine.cpp38
-rw-r--r--src/plugins/bearer/symbian/symbianengine.h1
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp227
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp2
-rw-r--r--src/plugins/gfxdrivers/vnc/qscreenvnc_qws.cpp34
-rw-r--r--src/plugins/imageformats/jpeg/qjpeghandler.cpp20
-rw-r--r--src/plugins/imageformats/tiff/tiff.pro3
-rw-r--r--src/plugins/mediaservices/directshow/mediaplayer/directshowaudioendpointcontrol.cpp11
-rw-r--r--src/plugins/mediaservices/directshow/mediaplayer/directshowglobal.h81
-rw-r--r--src/plugins/mediaservices/directshow/mediaplayer/directshowioreader.cpp2
-rw-r--r--src/plugins/mediaservices/directshow/mediaplayer/directshowiosource.cpp10
-rw-r--r--src/plugins/mediaservices/directshow/mediaplayer/directshowiosource.h4
-rw-r--r--src/plugins/mediaservices/directshow/mediaplayer/directshowmediatype.cpp34
-rw-r--r--src/plugins/mediaservices/directshow/mediaplayer/directshowmetadatacontrol.cpp4
-rw-r--r--src/plugins/mediaservices/directshow/mediaplayer/directshowmetadatacontrol.h3
-rw-r--r--src/plugins/mediaservices/directshow/mediaplayer/directshowplayercontrol.cpp2
-rw-r--r--src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.cpp98
-rw-r--r--src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.h1
-rw-r--r--src/plugins/mediaservices/directshow/mediaplayer/mediaplayer.pri2
-rw-r--r--src/plugins/mediaservices/directshow/mediaplayer/videosurfacefilter.cpp18
-rw-r--r--src/plugins/mediaservices/directshow/mediaplayer/videosurfacefilter.h4
-rw-r--r--src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.cpp27
-rw-r--r--src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamermetadataprovider.cpp5
-rw-r--r--src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp138
-rw-r--r--src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayercontrol.h7
-rw-r--r--src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.cpp130
-rw-r--r--src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.h11
-rw-r--r--src/plugins/mediaservices/gstreamer/qgstreamerbushelper.cpp3
-rw-r--r--src/plugins/mediaservices/gstreamer/qgstreamermessage.cpp6
-rw-r--r--src/plugins/mediaservices/gstreamer/qgstreamervideoinputdevicecontrol.cpp6
-rw-r--r--src/plugins/mediaservices/gstreamer/qgstreamervideooutputcontrol.cpp5
-rw-r--r--src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.cpp5
-rw-r--r--src/plugins/mediaservices/gstreamer/qgstreamervideorenderer.cpp6
-rw-r--r--src/plugins/mediaservices/gstreamer/qgstreamervideorendererinterface.cpp6
-rw-r--r--src/plugins/mediaservices/gstreamer/qgstreamervideorendererinterface.h4
-rw-r--r--src/plugins/mediaservices/gstreamer/qgstreamervideowidget.cpp6
-rw-r--r--src/plugins/mediaservices/gstreamer/qgstvideobuffer.cpp4
-rw-r--r--src/plugins/mediaservices/gstreamer/qgstxvimagebuffer.cpp6
-rw-r--r--src/plugins/mediaservices/gstreamer/qgstxvimagebuffer.h6
-rw-r--r--src/plugins/mediaservices/gstreamer/qvideosurfacegstsink.cpp6
-rw-r--r--src/plugins/mediaservices/gstreamer/qx11videosurface.cpp6
-rw-r--r--src/plugins/mediaservices/mediaservices.pro2
-rw-r--r--src/plugins/mediaservices/qt7/mediaplayer/qt7playermetadata.mm75
-rw-r--r--src/plugins/mediaservices/qt7/mediaplayer/qt7playerservice.mm3
-rw-r--r--src/plugins/mediaservices/qt7/mediaplayer/qt7playersession.h6
-rw-r--r--src/plugins/mediaservices/qt7/mediaplayer/qt7playersession.mm94
-rw-r--r--src/plugins/mediaservices/qt7/qt7movierenderer.mm21
-rw-r--r--src/plugins/mediaservices/qt7/qt7movievideowidget.mm17
-rw-r--r--src/plugins/mediaservices/qt7/qt7movieviewoutput.mm6
-rw-r--r--src/plugins/plugins.pro1
-rw-r--r--src/plugins/qdeclarativemodules/multimedia/multimedia.cpp63
-rw-r--r--src/plugins/qdeclarativemodules/multimedia/multimedia.pro15
-rw-r--r--src/plugins/qdeclarativemodules/qdeclarativemodules.pro6
-rw-r--r--src/plugins/qdeclarativemodules/widgets/graphicslayouts.cpp260
-rw-r--r--src/plugins/qdeclarativemodules/widgets/graphicslayouts_p.h226
-rw-r--r--src/plugins/qdeclarativemodules/widgets/graphicswidgets.cpp40
-rw-r--r--src/plugins/qdeclarativemodules/widgets/graphicswidgets_p.h68
-rw-r--r--src/plugins/qdeclarativemodules/widgets/widgets.cpp138
-rw-r--r--src/plugins/qdeclarativemodules/widgets/widgets.pro20
-rw-r--r--src/plugins/sqldrivers/odbc/odbc.pro1
74 files changed, 1332 insertions, 1539 deletions
diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.h b/src/plugins/bearer/corewlan/qcorewlanengine.h
index 044b433..cfd89e4 100644
--- a/src/plugins/bearer/corewlan/qcorewlanengine.h
+++ b/src/plugins/bearer/corewlan/qcorewlanengine.h
@@ -46,6 +46,7 @@
#include <QMap>
#include <QTimer>
+#include <SystemConfiguration/SystemConfiguration.h>
QT_BEGIN_NAMESPACE
@@ -91,6 +92,11 @@ private:
bool isKnownSsid(const QString &interfaceName, const QString &ssid);
QList<QNetworkConfigurationPrivate *> foundConfigurations;
+ SCDynamicStoreRef storeSession;
+ CFRunLoopSourceRef runloopSource;
+
+ void startNetworkChangeLoop();
+
};
QT_END_NAMESPACE
diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm
index a5384d1..2d33d36 100644
--- a/src/plugins/bearer/corewlan/qcorewlanengine.mm
+++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm
@@ -105,12 +105,23 @@ static QString qGetInterfaceType(const QString &interfaceString)
return networkInterfaces.value(interfaceString, QLatin1String("Unknown"));
}
+void networkChangeCallback(SCDynamicStoreRef/* store*/, CFArrayRef changedKeys, void *info)
+{
+ for ( long i = 0; i < CFArrayGetCount(changedKeys); i++) {
+
+ CFStringRef changed = (CFStringRef)CFArrayGetValueAtIndex(changedKeys, i);
+ if( cfstringRefToQstring(changed).contains("/Network/Global/IPv4")) {
+ QCoreWlanEngine* wlanEngine = static_cast<QCoreWlanEngine*>(info);
+ wlanEngine->requestUpdate();
+ }
+ }
+ return;
+}
+
QCoreWlanEngine::QCoreWlanEngine(QObject *parent)
: QBearerEngineImpl(parent)
{
- connect(&pollTimer, SIGNAL(timeout()), this, SLOT(doRequestUpdate()));
- pollTimer.setInterval(10000);
- doRequestUpdate();
+ startNetworkChangeLoop();
}
QCoreWlanEngine::~QCoreWlanEngine()
@@ -150,17 +161,16 @@ void QCoreWlanEngine::connectToId(const QString &id)
NSEnumerator *enumerator = [remNets objectEnumerator];
CWWirelessProfile *wProfile;
NSUInteger index=0;
- CWNetwork *apNetwork;
NSDictionary *parametersDict;
NSArray* apArray;
- CW8021XProfile *user8021XProfile;
- NSError *err;
- NSMutableDictionary *params;
+ CW8021XProfile *user8021XProfile;
+ NSError *err;
+ NSMutableDictionary *params;
while ((wProfile = [enumerator nextObject])) { //CWWirelessProfile
- if(id == nsstringToQString([wProfile ssid])) {
+ if(id == QString::number(qHash(QLatin1String("corewlan:") + nsstringToQString([wProfile ssid])))) {
user8021XProfile = nil;
user8021XProfile = [ wProfile user8021XProfile];
@@ -179,16 +189,14 @@ void QCoreWlanEngine::connectToId(const QString &id)
if(!err) {
for(uint row=0; row < [apArray count]; row++ ) {
- apNetwork = [apArray objectAtIndex:row];
+ CWNetwork *apNetwork = [apArray objectAtIndex:row];
if([[apNetwork ssid] compare:[wProfile ssid]] == NSOrderedSame) {
bool result = [wifiInterface associateToNetwork: apNetwork parameters:[NSDictionary dictionaryWithDictionary:params] error:&err];
if(!result) {
- qWarning() <<"ERROR"<< nsstringToQString([err localizedDescription ]);
emit connectionError(id, ConnectError);
} else {
- [apNetwork release];
[autoreleasepool release];
return;
}
@@ -198,7 +206,6 @@ void QCoreWlanEngine::connectToId(const QString &id)
}
index++;
}
- [apNetwork release];
emit connectionError(id, InterfaceLookupError);
#endif
@@ -284,7 +291,7 @@ void QCoreWlanEngine::doRequestUpdate()
if (!interface.addressEntries().isEmpty())
state = QNetworkConfiguration::Active;
- if (accessPointConfigurations.contains(id)) {
+ if (accessPointConfigurations.contains(id)) { //handle only scanned AP's
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
bool changed = false;
@@ -311,20 +318,6 @@ void QCoreWlanEngine::doRequestUpdate()
if (changed)
emit configurationChanged(ptr);
- } else {
- QNetworkConfigurationPrivatePointer ptr(new QNetworkConfigurationPrivate);
-
- ptr->name = name;
- ptr->isValid = true;
- ptr->id = id;
- ptr->state = state;
- ptr->type = QNetworkConfiguration::InternetAccessPoint;
- ptr->bearer = qGetInterfaceType(interface.name());
-
- accessPointConfigurations.insert(id, ptr);
- configurationInterface.insert(id, interface.name());
-
- emit configurationAdded(ptr);
}
}
@@ -350,83 +343,81 @@ QStringList QCoreWlanEngine::scanForSsids(const QString &interfaceName)
NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init];
CWInterface *currentInterface = [CWInterface interfaceWithName:qstringToNSString(interfaceName)];
- NSError *err = nil;
- NSDictionary *parametersDict = nil;
- NSArray* apArray = [currentInterface scanForNetworksWithParameters:parametersDict error:&err];
+ if([currentInterface power]) {
+ NSError *err = nil;
+ NSDictionary *parametersDict = nil;
+ NSArray* apArray = [currentInterface scanForNetworksWithParameters:parametersDict error:&err];
- CWNetwork *apNetwork;
- if (!err) {
- for(uint row=0; row < [apArray count]; row++ ) {
- NSAutoreleasePool *looppool = [[NSAutoreleasePool alloc] init];
+ CWNetwork *apNetwork;
+ if (!err) {
+ for(uint row=0; row < [apArray count]; row++ ) {
+ NSAutoreleasePool *looppool = [[NSAutoreleasePool alloc] init];
- apNetwork = [apArray objectAtIndex:row];
+ apNetwork = [apArray objectAtIndex:row];
- const QString networkSsid = nsstringToQString([apNetwork ssid]);
+ const QString networkSsid = nsstringToQString([apNetwork ssid]);
- const QString id = QString::number(qHash(QLatin1String("corewlan:") + networkSsid));
- found.append(id);
+ const QString id = QString::number(qHash(QLatin1String("corewlan:") + networkSsid));
+ found.append(id);
- QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Undefined;
+ QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Undefined;
- if ([currentInterface.interfaceState intValue] == kCWInterfaceStateRunning) {
- if (networkSsid == nsstringToQString([currentInterface ssid]))
- state = QNetworkConfiguration::Active;
- } else {
- if (isKnownSsid(interfaceName, networkSsid))
- state = QNetworkConfiguration::Discovered;
- else
- state = QNetworkConfiguration::Defined;
- }
+ if ([currentInterface.interfaceState intValue] == kCWInterfaceStateRunning) {
+ if (networkSsid == nsstringToQString([currentInterface ssid]))
+ state = QNetworkConfiguration::Active;
+ } else {
+ if (isKnownSsid(interfaceName, networkSsid))
+ state = QNetworkConfiguration::Discovered;
+ else
+ state = QNetworkConfiguration::Defined;
+ }
- if (accessPointConfigurations.contains(id)) {
- QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
+ if (accessPointConfigurations.contains(id)) {
+ QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
- bool changed = false;
+ bool changed = false;
- if (!ptr->isValid) {
- ptr->isValid = true;
- changed = true;
- }
+ if (!ptr->isValid) {
+ ptr->isValid = true;
+ changed = true;
+ }
- if (ptr->name != networkSsid) {
- ptr->name = networkSsid;
- changed = true;
- }
+ if (ptr->name != networkSsid) {
+ ptr->name = networkSsid;
+ changed = true;
+ }
- if (ptr->id != id) {
- ptr->id = id;
- changed = true;
- }
+ if (ptr->id != id) {
+ ptr->id = id;
+ changed = true;
+ }
- if (ptr->state != state) {
- ptr->state = state;
- changed = true;
- }
+ if (ptr->state != state) {
+ ptr->state = state;
+ changed = true;
+ }
- if (changed)
- emit configurationChanged(ptr);
- } else {
- QNetworkConfigurationPrivatePointer ptr(new QNetworkConfigurationPrivate);
+ if (changed)
+ emit configurationChanged(ptr);
+ } else {
+ QNetworkConfigurationPrivatePointer ptr(new QNetworkConfigurationPrivate);
- ptr->name = networkSsid;
- ptr->isValid = true;
- ptr->id = id;
- ptr->state = state;
- ptr->type = QNetworkConfiguration::InternetAccessPoint;
- ptr->bearer = QLatin1String("WLAN");
+ ptr->name = networkSsid;
+ ptr->isValid = true;
+ ptr->id = id;
+ ptr->state = state;
+ ptr->type = QNetworkConfiguration::InternetAccessPoint;
+ ptr->bearer = QLatin1String("WLAN");
- accessPointConfigurations.insert(id, ptr);
- configurationInterface.insert(id, interfaceName);
+ accessPointConfigurations.insert(id, ptr);
+ configurationInterface.insert(id, interfaceName);
- emit configurationAdded(ptr);
+ emit configurationAdded(ptr);
+ }
+ [looppool release];
}
- [looppool release];
}
- } else {
- qWarning() << "ERROR scanning for ssids" << nsstringToQString([err localizedDescription])
- <<nsstringToQString([err domain]);
}
-
[autoreleasepool drain];
#else
Q_UNUSED(interfaceName);
@@ -490,12 +481,6 @@ bool QCoreWlanEngine::getAllScInterfaces()
CFStringRef type = SCNetworkInterfaceGetInterfaceType((SCNetworkInterfaceRef)thisInterface);
if ( CFEqual(type, kSCNetworkInterfaceTypeIEEE80211)) {
typeStr = "WLAN";
-// } else if (CFEqual(type, kSCNetworkInterfaceTypeBluetooth)) {
-// typeStr = "Bluetooth";
- } else if(CFEqual(type, kSCNetworkInterfaceTypeEthernet)) {
- typeStr = "Ethernet";
- } else if(CFEqual(type, kSCNetworkInterfaceTypeFireWire)) {
- typeStr = "Ethernet"; //ok a bit fudged
}
if(!networkInterfaces.contains(interfaceName) && !typeStr.isEmpty()) {
networkInterfaces.insert(interfaceName,typeStr);
@@ -540,6 +525,60 @@ QNetworkConfigurationManager::Capabilities QCoreWlanEngine::capabilities() const
return QNetworkConfigurationManager::ForcedRoaming;
}
+void QCoreWlanEngine::startNetworkChangeLoop()
+{
+ storeSession = NULL;
+
+ SCDynamicStoreContext dynStoreContext = { 0, this/*(void *)storeSession*/, NULL, NULL, NULL };
+ storeSession = SCDynamicStoreCreate(NULL,
+ CFSTR("networkChangeCallback"),
+ networkChangeCallback,
+ &dynStoreContext);
+ if (!storeSession ) {
+ qWarning() << "could not open dynamic store: error:" << SCErrorString(SCError());
+ return;
+ }
+
+ CFMutableArrayRef notificationKeys;
+ notificationKeys = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+ CFMutableArrayRef patternsArray;
+ patternsArray = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+
+ CFStringRef storeKey;
+ storeKey = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
+ kSCDynamicStoreDomainState,
+ kSCEntNetIPv4);
+ CFArrayAppendValue(notificationKeys, storeKey);
+ CFRelease(storeKey);
+
+ storeKey = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
+ kSCDynamicStoreDomainState,
+ kSCCompAnyRegex,
+ kSCEntNetIPv4);
+ CFArrayAppendValue(patternsArray, storeKey);
+ CFRelease(storeKey);
+
+ if (!SCDynamicStoreSetNotificationKeys(storeSession , notificationKeys, patternsArray)) {
+ qWarning() << "register notification error:"<< SCErrorString(SCError());
+ CFRelease(storeSession );
+ CFRelease(notificationKeys);
+ CFRelease(patternsArray);
+ return;
+ }
+ CFRelease(notificationKeys);
+ CFRelease(patternsArray);
+
+ runloopSource = SCDynamicStoreCreateRunLoopSource(NULL, storeSession , 0);
+ if (!runloopSource) {
+ qWarning() << "runloop source error:"<< SCErrorString(SCError());
+ CFRelease(storeSession );
+ return;
+ }
+
+ CFRunLoopAddSource(CFRunLoopGetCurrent(), runloopSource, kCFRunLoopDefaultMode);
+ return;
+}
+
QNetworkSessionPrivate *QCoreWlanEngine::createSessionBackend()
{
return new QNetworkSessionPrivateImpl;
diff --git a/src/plugins/bearer/icd/monitor.cpp b/src/plugins/bearer/icd/monitor.cpp
index 0ff45d2..5b0af7e 100644
--- a/src/plugins/bearer/icd/monitor.cpp
+++ b/src/plugins/bearer/icd/monitor.cpp
@@ -47,32 +47,12 @@
#include <maemo_icd.h>
#include <iapconf.h>
-#define IAP "/system/osso/connectivity/IAP"
-
-static int iap_prefix_len;
-
-/* Notify func that is called when IAP is added or deleted */
-void notify_iap(GConfClient *, guint, GConfEntry *entry, gpointer user_data)
-{
- const char *key = gconf_entry_get_key(entry);
- if (key && g_str_has_prefix(key, IAP)) {
- IapMonitor *ptr = (IapMonitor *)user_data;
- if (gconf_entry_get_value(entry)) {
- ptr->iapAdded(key, entry);
- } else {
- ptr->iapDeleted(key, entry);
- }
- }
-}
-
void IapMonitor::setup(QIcdEngine *d_ptr)
{
if (first_call) {
- d = d_ptr;
- iap_prefix_len = strlen(IAP);
- iap = new Maemo::IAPMonitor(notify_iap, (gpointer)this);
- first_call = false;
+ d = d_ptr;
+ first_call = false;
}
}
@@ -80,37 +60,25 @@ void IapMonitor::setup(QIcdEngine *d_ptr)
void IapMonitor::cleanup()
{
if (!first_call) {
- delete iap;
- timers.removeAll();
- first_call = true;
+ timers.removeAll();
+ first_call = true;
}
}
-void IapMonitor::iapAdded(const char *key, GConfEntry * /*entry*/)
+void IapMonitor::iapAdded(const QString &iap_id)
{
- //qDebug("Notify called for added element: %s=%s",
- // gconf_entry_get_key(entry), gconf_value_to_string(gconf_entry_get_value(entry)));
-
- /* We cannot know when the IAP is fully added to gconf, so a timer is
+ /* We cannot know when the IAP is fully added to db, so a timer is
* installed instead. When the timer expires we hope that IAP is added ok.
*/
- QString iap_id = QString(key + iap_prefix_len + 1).section('/',0,0);
- timers.add(iap_id, d);
+ QString id = iap_id;
+ timers.add(id, d);
}
-void IapMonitor::iapDeleted(const char *key, GConfEntry * /*entry*/)
+void IapMonitor::iapRemoved(const QString &iap_id)
{
- //qDebug("Notify called for deleted element: %s", gconf_entry_get_key(entry));
-
- /* We are only interested in IAP deletions so we skip the config entries
- */
- if (strstr(key + iap_prefix_len + 1, "/")) {
- //qDebug("Deleting IAP config %s", key+iap_prefix_len);
- return;
- }
-
- QString iap_id = key + iap_prefix_len + 1;
- d->deleteConfiguration(iap_id);
+ QString id = iap_id;
+ d->deleteConfiguration(id);
}
+
diff --git a/src/plugins/bearer/icd/monitor.h b/src/plugins/bearer/icd/monitor.h
index 82b0f36..10ffb30 100644
--- a/src/plugins/bearer/icd/monitor.h
+++ b/src/plugins/bearer/icd/monitor.h
@@ -53,7 +53,7 @@
class QIcdEngine;
/* The IapAddTimer is a helper class that makes sure we update
- * the configuration only after all gconf additions to certain
+ * the configuration only after all db additions to certain
* iap are finished (after a certain timeout)
*/
class _IapAddTimer : public QObject
@@ -64,10 +64,10 @@ public:
_IapAddTimer() {}
~_IapAddTimer()
{
- if (timer.isActive()) {
- QObject::disconnect(&timer, SIGNAL(timeout()), this, SLOT(timeout()));
- timer.stop();
- }
+ if (timer.isActive()) {
+ QObject::disconnect(&timer, SIGNAL(timeout()), this, SLOT(timeout()));
+ timer.stop();
+ }
}
void add(QString& iap_id, QIcdEngine *d);
@@ -92,23 +92,21 @@ public:
void removeAll();
};
-class IapMonitor
+class IapMonitor : public Maemo::IAPMonitor
{
public:
IapMonitor() : first_call(true) { }
- friend void notify_iap(GConfClient *, guint,
- GConfEntry *entry, gpointer user_data);
void setup(QIcdEngine *d);
void cleanup();
+protected:
+ void iapAdded(const QString &iapId);
+ void iapRemoved(const QString &iapId);
+
private:
bool first_call;
- void iapAdded(const char *key, GConfEntry *entry);
- void iapDeleted(const char *key, GConfEntry *entry);
-
- Maemo::IAPMonitor *iap;
QIcdEngine *d;
IapAddTimer timers;
};
diff --git a/src/plugins/bearer/icd/qicdengine.cpp b/src/plugins/bearer/icd/qicdengine.cpp
index f10042a..206a6fd 100644
--- a/src/plugins/bearer/icd/qicdengine.cpp
+++ b/src/plugins/bearer/icd/qicdengine.cpp
@@ -189,14 +189,9 @@ void QIcdEngine::doRequestUpdate()
QList<QString> all_iaps;
Maemo::IAPConf::getAll(all_iaps);
- foreach (QString escaped_iap_id, all_iaps) {
+ foreach (QString iap_id, all_iaps) {
QByteArray ssid;
- /* The key that is returned by getAll() needs to be unescaped */
- gchar *unescaped_id = gconf_unescape_key(escaped_iap_id.toUtf8().data(), -1);
- QString iap_id = QString((char *)unescaped_id);
- g_free(unescaped_id);
-
previous.removeAll(iap_id);
Maemo::IAPConf saved_ap(iap_id);
@@ -231,11 +226,12 @@ void QIcdEngine::doRequestUpdate()
IcdNetworkConfigurationPrivate *cpPriv = new IcdNetworkConfigurationPrivate;
cpPriv->name = saved_ap.value("name").toString();
- if (cpPriv->name.isEmpty())
- if (!ssid.isEmpty() && ssid.size() > 0)
- cpPriv->name = ssid.data();
- else
- cpPriv->name = iap_id;
+ if (cpPriv->name.isEmpty()) {
+ if (!ssid.isEmpty() && ssid.size() > 0)
+ cpPriv->name = ssid.data();
+ else
+ cpPriv->name = iap_id;
+ }
cpPriv->isValid = true;
cpPriv->id = iap_id;
cpPriv->network_id = ssid;
@@ -379,9 +375,9 @@ void QIcdEngine::deleteConfiguration(const QString &iap_id)
{
QMutexLocker locker(&mutex);
- /* Called when IAPs are deleted in gconf, in this case we do not scan
- * or read all the IAPs from gconf because it might take too much power
- * (multiple applications would need to scan and read all IAPs from gconf)
+ /* Called when IAPs are deleted in db, in this case we do not scan
+ * or read all the IAPs from db because it might take too much power
+ * (multiple applications would need to scan and read all IAPs from db)
*/
if (accessPointConfigurations.contains(iap_id)) {
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.take(iap_id);
diff --git a/src/plugins/bearer/icd/qnetworksession_impl.cpp b/src/plugins/bearer/icd/qnetworksession_impl.cpp
index e7c56a2..03624fa 100644
--- a/src/plugins/bearer/icd/qnetworksession_impl.cpp
+++ b/src/plugins/bearer/icd/qnetworksession_impl.cpp
@@ -49,6 +49,7 @@
#include <maemo_icd.h>
#include <iapconf.h>
+#include <proxyconf.h>
#include <sys/types.h>
#include <ifaddrs.h>
@@ -299,6 +300,8 @@ void IcdListener::cleanupSession(QNetworkSessionPrivateImpl *ptr)
void QNetworkSessionPrivateImpl::cleanupSession(void)
{
icdListener()->cleanupSession(this);
+
+ QObject::disconnect(q, SIGNAL(stateChanged(QNetworkSession::State)), this, SLOT(updateProxies(QNetworkSession::State)));
}
@@ -451,6 +454,8 @@ void QNetworkSessionPrivateImpl::syncStateWithInterface()
connect(&manager, SIGNAL(configurationChanged(QNetworkConfiguration)),
this, SLOT(configurationChanged(QNetworkConfiguration)));
+ QObject::connect(q, SIGNAL(stateChanged(QNetworkSession::State)), this, SLOT(updateProxies(QNetworkSession::State)));
+
state = QNetworkSession::Invalid;
lastError = QNetworkSession::UnknownSessionError;
@@ -867,7 +872,6 @@ void QNetworkSessionPrivateImpl::do_open()
qDebug() << "connect to"<< iap << "failed, result is empty";
#endif
updateState(QNetworkSession::Disconnected);
- emit quitPendingWaitsForOpened();
emit QNetworkSessionPrivate::error(QNetworkSession::InvalidConfigurationError);
if (publicConfig.type() == QNetworkConfiguration::UserChoice)
cleanupAnyConfiguration();
@@ -882,7 +886,6 @@ void QNetworkSessionPrivateImpl::do_open()
if ((publicConfig.type() != QNetworkConfiguration::UserChoice) &&
(connected_iap != config.identifier())) {
updateState(QNetworkSession::Disconnected);
- emit quitPendingWaitsForOpened();
emit QNetworkSessionPrivate::error(QNetworkSession::InvalidConfigurationError);
return;
}
@@ -946,7 +949,6 @@ void QNetworkSessionPrivateImpl::do_open()
updateState(QNetworkSession::Disconnected);
if (publicConfig.type() == QNetworkConfiguration::UserChoice)
cleanupAnyConfiguration();
- emit quitPendingWaitsForOpened();
emit QNetworkSessionPrivate::error(QNetworkSession::UnknownSessionError);
}
}
@@ -1099,6 +1101,30 @@ QNetworkSession::SessionError QNetworkSessionPrivateImpl::error() const
return QNetworkSession::UnknownSessionError;
}
+void QNetworkSessionPrivateImpl::updateProxies(QNetworkSession::State newState)
+{
+ if ((newState == QNetworkSession::Connected) &&
+ (newState != currentState))
+ updateProxyInformation();
+ else if ((newState == QNetworkSession::Disconnected) &&
+ (currentState == QNetworkSession::Closing))
+ clearProxyInformation();
+
+ currentState = newState;
+}
+
+
+void QNetworkSessionPrivateImpl::updateProxyInformation()
+{
+ Maemo::ProxyConf::update();
+}
+
+
+void QNetworkSessionPrivateImpl::clearProxyInformation()
+{
+ Maemo::ProxyConf::clear();
+}
+
#include "qnetworksession_impl.moc"
QT_END_NAMESPACE
diff --git a/src/plugins/bearer/icd/qnetworksession_impl.h b/src/plugins/bearer/icd/qnetworksession_impl.h
index b7461dc..587e6dc 100644
--- a/src/plugins/bearer/icd/qnetworksession_impl.h
+++ b/src/plugins/bearer/icd/qnetworksession_impl.h
@@ -75,7 +75,7 @@ class QNetworkSessionPrivateImpl : public QNetworkSessionPrivate
public:
QNetworkSessionPrivateImpl(QIcdEngine *engine)
- : engine(engine), connectFlags(ICD_CONNECTION_FLAG_USER_EVENT)
+ : engine(engine), connectFlags(ICD_CONNECTION_FLAG_USER_EVENT), currentState(QNetworkSession::Invalid)
{
}
@@ -118,6 +118,7 @@ private Q_SLOTS:
void do_open();
void networkConfigurationsChanged();
void configurationChanged(const QNetworkConfiguration &config);
+ void updateProxies(QNetworkSession::State newState);
private:
QNetworkConfigurationManager manager;
@@ -139,6 +140,10 @@ private:
void updateIdentifier(QString &newId);
quint64 getStatistics(bool sent) const;
void cleanupSession(void);
+
+ void updateProxyInformation();
+ void clearProxyInformation();
+ QNetworkSession::State currentState;
};
QT_END_NAMESPACE
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
index 5c6efe3..0fa8f3c 100644
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
+++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
@@ -49,7 +49,6 @@
#include <QtCore/qdebug.h>
-#include <NetworkManager/NetworkManager.h>
#include <QtDBus>
#include <QDBusConnection>
#include <QDBusError>
@@ -147,7 +146,7 @@ QString QNetworkManagerEngine::getInterfaceFromId(const QString &id)
continue;
QNetworkManagerInterfaceDevice device(devices.at(0).path());
- return device.interface().name();
+ return device.networkInterface().name();
}
}
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp
index 5dc0ea4..c780fbc 100644
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp
+++ b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp
@@ -41,26 +41,22 @@
#include <QObject>
#include <QList>
-#include <QtDBus>
-#include <QDBusConnection>
-#include <QDBusError>
-#include <QDBusInterface>
-#include <QDBusMessage>
-#include <QDBusReply>
-#include <QDBusPendingCallWatcher>
-#include <QDBusObjectPath>
-#include <QDBusPendingCall>
-
-#include <NetworkManager/NetworkManager.h>
+#include <QtDBus/QtDBus>
+#include <QtDBus/QDBusConnection>
+#include <QtDBus/QDBusError>
+#include <QtDBus/QDBusInterface>
+#include <QtDBus/QDBusMessage>
+#include <QtDBus/QDBusReply>
+#include <QtDBus/QDBusPendingCallWatcher>
+#include <QtDBus/QDBusObjectPath>
+#include <QtDBus/QDBusPendingCall>
-#include "qnmdbushelper.h"
#include "qnetworkmanagerservice.h"
+#include "qnmdbushelper.h"
-//Q_DECLARE_METATYPE(QList<uint>)
QT_BEGIN_NAMESPACE
static QDBusConnection dbusConnection = QDBusConnection::systemBus();
-//static QDBusInterface iface(NM_DBUS_SERVICE, NM_DBUS_PATH, NM_DBUS_INTERFACE, dbusConnection);
class QNetworkManagerInterfacePrivate
{
@@ -70,19 +66,19 @@ public:
};
QNetworkManagerInterface::QNetworkManagerInterface(QObject *parent)
- : QObject(parent), nmDBusHelper(0)
+ : QObject(parent)
{
d = new QNetworkManagerInterfacePrivate();
- d->connectionInterface = new QDBusInterface(NM_DBUS_SERVICE,
- NM_DBUS_PATH,
- NM_DBUS_INTERFACE,
+ d->connectionInterface = new QDBusInterface(QLatin1String(NM_DBUS_SERVICE),
+ QLatin1String(NM_DBUS_PATH),
+ QLatin1String(NM_DBUS_INTERFACE),
dbusConnection);
if (!d->connectionInterface->isValid()) {
d->valid = false;
return;
}
d->valid = true;
- nmDBusHelper = new QNmDBusHelper;
+ nmDBusHelper = new QNmDBusHelper(this);
connect(nmDBusHelper, SIGNAL(pathForPropertiesChanged(const QString &,QMap<QString,QVariant>)),
this,SIGNAL(propertiesChanged( const QString &, QMap<QString,QVariant>)));
connect(nmDBusHelper,SIGNAL(pathForStateChanged(const QString &, quint32)),
@@ -92,8 +88,6 @@ QNetworkManagerInterface::QNetworkManagerInterface(QObject *parent)
QNetworkManagerInterface::~QNetworkManagerInterface()
{
- if (nmDBusHelper)
- delete nmDBusHelper;
delete d->connectionInterface;
delete d;
}
@@ -108,24 +102,24 @@ bool QNetworkManagerInterface::setConnections()
if(!isValid() )
return false;
bool allOk = false;
- if (!dbusConnection.connect(NM_DBUS_SERVICE,
- NM_DBUS_PATH,
- NM_DBUS_INTERFACE,
- "PropertiesChanged",
+ if (!dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
+ QLatin1String(NM_DBUS_PATH),
+ QLatin1String(NM_DBUS_INTERFACE),
+ QLatin1String("PropertiesChanged"),
nmDBusHelper,SLOT(slotPropertiesChanged( QMap<QString,QVariant>)))) {
allOk = true;
}
- if (!dbusConnection.connect(NM_DBUS_SERVICE,
- NM_DBUS_PATH,
- NM_DBUS_INTERFACE,
- "DeviceAdded",
+ if (!dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
+ QLatin1String(NM_DBUS_PATH),
+ QLatin1String(NM_DBUS_INTERFACE),
+ QLatin1String("DeviceAdded"),
this,SIGNAL(deviceAdded(QDBusObjectPath)))) {
allOk = true;
}
- if (!dbusConnection.connect(NM_DBUS_SERVICE,
- NM_DBUS_PATH,
- NM_DBUS_INTERFACE,
- "DeviceRemoved",
+ if (!dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
+ QLatin1String(NM_DBUS_PATH),
+ QLatin1String(NM_DBUS_INTERFACE),
+ QLatin1String("DeviceRemoved"),
this,SIGNAL(deviceRemoved(QDBusObjectPath)))) {
allOk = true;
}
@@ -140,7 +134,7 @@ QDBusInterface *QNetworkManagerInterface::connectionInterface() const
QList <QDBusObjectPath> QNetworkManagerInterface::getDevices() const
{
- QDBusReply<QList<QDBusObjectPath> > reply = d->connectionInterface->call("GetDevices");
+ QDBusReply<QList<QDBusObjectPath> > reply = d->connectionInterface->call(QLatin1String("GetDevices"));
return reply.value();
}
@@ -149,7 +143,7 @@ void QNetworkManagerInterface::activateConnection( const QString &serviceName,
QDBusObjectPath devicePath,
QDBusObjectPath specificObject)
{
- QDBusPendingCall pendingCall = d->connectionInterface->asyncCall("ActivateConnection",
+ QDBusPendingCall pendingCall = d->connectionInterface->asyncCall(QLatin1String("ActivateConnection"),
QVariant(serviceName),
QVariant::fromValue(connectionPath),
QVariant::fromValue(devicePath),
@@ -162,7 +156,7 @@ void QNetworkManagerInterface::activateConnection( const QString &serviceName,
void QNetworkManagerInterface::deactivateConnection(QDBusObjectPath connectionPath) const
{
- d->connectionInterface->call("DeactivateConnection", QVariant::fromValue(connectionPath));
+ d->connectionInterface->call(QLatin1String("DeactivateConnection"), QVariant::fromValue(connectionPath));
}
bool QNetworkManagerInterface::wirelessEnabled() const
@@ -186,7 +180,6 @@ quint32 QNetworkManagerInterface::state()
return d->connectionInterface->property("State").toUInt();
}
-/////////////
class QNetworkManagerInterfaceAccessPointPrivate
{
public:
@@ -200,9 +193,9 @@ QNetworkManagerInterfaceAccessPoint::QNetworkManagerInterfaceAccessPoint(const Q
{
d = new QNetworkManagerInterfaceAccessPointPrivate();
d->path = dbusPathName;
- d->connectionInterface = new QDBusInterface(NM_DBUS_SERVICE,
+ d->connectionInterface = new QDBusInterface(QLatin1String(NM_DBUS_SERVICE),
d->path,
- NM_DBUS_INTERFACE_ACCESS_POINT,
+ QLatin1String(NM_DBUS_INTERFACE_ACCESS_POINT),
dbusConnection);
if (!d->connectionInterface->isValid()) {
d->valid = false;
@@ -215,8 +208,6 @@ QNetworkManagerInterfaceAccessPoint::QNetworkManagerInterfaceAccessPoint(const Q
QNetworkManagerInterfaceAccessPoint::~QNetworkManagerInterfaceAccessPoint()
{
- if (nmDBusHelper)
- delete nmDBusHelper;
delete d->connectionInterface;
delete d;
}
@@ -232,17 +223,15 @@ bool QNetworkManagerInterfaceAccessPoint::setConnections()
return false;
bool allOk = false;
- if (nmDBusHelper)
- delete nmDBusHelper;
- nmDBusHelper = 0;
- nmDBusHelper = new QNmDBusHelper;
+ delete nmDBusHelper;
+ nmDBusHelper = new QNmDBusHelper(this);
connect(nmDBusHelper, SIGNAL(pathForPropertiesChanged(const QString &,QMap<QString,QVariant>)),
this,SIGNAL(propertiesChanged( const QString &, QMap<QString,QVariant>)));
- if(dbusConnection.connect(NM_DBUS_SERVICE,
+ if(dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
d->path,
- NM_DBUS_INTERFACE_ACCESS_POINT,
- "PropertiesChanged",
+ QLatin1String(NM_DBUS_INTERFACE_ACCESS_POINT),
+ QLatin1String("PropertiesChanged"),
nmDBusHelper,SLOT(slotPropertiesChanged( QMap<QString,QVariant>))) ) {
allOk = true;
@@ -300,7 +289,6 @@ quint32 QNetworkManagerInterfaceAccessPoint::strength() const
return d->connectionInterface->property("Strength").toUInt();
}
-/////////////
class QNetworkManagerInterfaceDevicePrivate
{
public:
@@ -314,9 +302,9 @@ QNetworkManagerInterfaceDevice::QNetworkManagerInterfaceDevice(const QString &de
{
d = new QNetworkManagerInterfaceDevicePrivate();
d->path = deviceObjectPath;
- d->connectionInterface = new QDBusInterface(NM_DBUS_SERVICE,
+ d->connectionInterface = new QDBusInterface(QLatin1String(NM_DBUS_SERVICE),
d->path,
- NM_DBUS_INTERFACE_DEVICE,
+ QLatin1String(NM_DBUS_INTERFACE_DEVICE),
dbusConnection);
if (!d->connectionInterface->isValid()) {
d->valid = false;
@@ -328,8 +316,6 @@ QNetworkManagerInterfaceDevice::QNetworkManagerInterfaceDevice(const QString &de
QNetworkManagerInterfaceDevice::~QNetworkManagerInterfaceDevice()
{
- if (nmDBusHelper)
- delete nmDBusHelper;
delete d->connectionInterface;
delete d;
}
@@ -345,16 +331,14 @@ bool QNetworkManagerInterfaceDevice::setConnections()
return false;
bool allOk = false;
- if (nmDBusHelper)
- delete nmDBusHelper;
- nmDBusHelper = 0;
- nmDBusHelper = new QNmDBusHelper;
+ delete nmDBusHelper;
+ nmDBusHelper = new QNmDBusHelper(this);
connect(nmDBusHelper,SIGNAL(pathForStateChanged(const QString &, quint32)),
this, SIGNAL(stateChanged(const QString&, quint32)));
- if(dbusConnection.connect(NM_DBUS_SERVICE,
+ if(dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
d->path,
- NM_DBUS_INTERFACE_DEVICE,
- "StateChanged",
+ QLatin1String(NM_DBUS_INTERFACE_DEVICE),
+ QLatin1String("StateChanged"),
nmDBusHelper,SLOT(deviceStateChanged(quint32)))) {
allOk = true;
}
@@ -371,7 +355,7 @@ QString QNetworkManagerInterfaceDevice::udi() const
return d->connectionInterface->property("Udi").toString();
}
-QNetworkInterface QNetworkManagerInterfaceDevice::interface() const
+QNetworkInterface QNetworkManagerInterfaceDevice::networkInterface() const
{
return QNetworkInterface::interfaceFromName(d->connectionInterface->property("Interface").toString());
}
@@ -397,7 +381,6 @@ QDBusObjectPath QNetworkManagerInterfaceDevice::ip4config() const
return prop.value<QDBusObjectPath>();
}
-/////////////
class QNetworkManagerInterfaceDeviceWiredPrivate
{
public:
@@ -411,9 +394,9 @@ QNetworkManagerInterfaceDeviceWired::QNetworkManagerInterfaceDeviceWired(const Q
{
d = new QNetworkManagerInterfaceDeviceWiredPrivate();
d->path = ifaceDevicePath;
- d->connectionInterface = new QDBusInterface(NM_DBUS_SERVICE,
+ d->connectionInterface = new QDBusInterface(QLatin1String(NM_DBUS_SERVICE),
d->path,
- NM_DBUS_INTERFACE_DEVICE_WIRED,
+ QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRED),
dbusConnection, parent);
if (!d->connectionInterface->isValid()) {
d->valid = false;
@@ -425,8 +408,6 @@ QNetworkManagerInterfaceDeviceWired::QNetworkManagerInterfaceDeviceWired(const Q
QNetworkManagerInterfaceDeviceWired::~QNetworkManagerInterfaceDeviceWired()
{
- if (nmDBusHelper)
- delete nmDBusHelper;
delete d->connectionInterface;
delete d;
}
@@ -444,16 +425,14 @@ bool QNetworkManagerInterfaceDeviceWired::setConnections()
bool allOk = false;
- if (nmDBusHelper)
- delete nmDBusHelper;
- nmDBusHelper = 0;
- nmDBusHelper = new QNmDBusHelper;
+ delete nmDBusHelper;
+ nmDBusHelper = new QNmDBusHelper(this);
connect(nmDBusHelper, SIGNAL(pathForPropertiesChanged(const QString &,QMap<QString,QVariant>)),
this,SIGNAL(propertiesChanged( const QString &, QMap<QString,QVariant>)));
- if(dbusConnection.connect(NM_DBUS_SERVICE,
+ if(dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
d->path,
- NM_DBUS_INTERFACE_DEVICE_WIRED,
- "PropertiesChanged",
+ QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRED),
+ QLatin1String("PropertiesChanged"),
nmDBusHelper,SLOT(slotPropertiesChanged( QMap<QString,QVariant>))) ) {
allOk = true;
}
@@ -480,7 +459,6 @@ bool QNetworkManagerInterfaceDeviceWired::carrier() const
return d->connectionInterface->property("Carrier").toBool();
}
-/////////////
class QNetworkManagerInterfaceDeviceWirelessPrivate
{
public:
@@ -494,9 +472,9 @@ QNetworkManagerInterfaceDeviceWireless::QNetworkManagerInterfaceDeviceWireless(c
{
d = new QNetworkManagerInterfaceDeviceWirelessPrivate();
d->path = ifaceDevicePath;
- d->connectionInterface = new QDBusInterface(NM_DBUS_SERVICE,
+ d->connectionInterface = new QDBusInterface(QLatin1String(NM_DBUS_SERVICE),
d->path,
- NM_DBUS_INTERFACE_DEVICE_WIRELESS,
+ QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRELESS),
dbusConnection, parent);
if (!d->connectionInterface->isValid()) {
d->valid = false;
@@ -508,8 +486,6 @@ QNetworkManagerInterfaceDeviceWireless::QNetworkManagerInterfaceDeviceWireless(c
QNetworkManagerInterfaceDeviceWireless::~QNetworkManagerInterfaceDeviceWireless()
{
- if (nmDBusHelper)
- delete nmDBusHelper;
delete d->connectionInterface;
delete d;
}
@@ -525,10 +501,8 @@ bool QNetworkManagerInterfaceDeviceWireless::setConnections()
return false;
bool allOk = false;
- if (nmDBusHelper)
- delete nmDBusHelper;
- nmDBusHelper = 0;
- nmDBusHelper = new QNmDBusHelper;
+ delete nmDBusHelper;
+ nmDBusHelper = new QNmDBusHelper(this);
connect(nmDBusHelper, SIGNAL(pathForPropertiesChanged(const QString &,QMap<QString,QVariant>)),
this,SIGNAL(propertiesChanged( const QString &, QMap<QString,QVariant>)));
@@ -538,28 +512,28 @@ bool QNetworkManagerInterfaceDeviceWireless::setConnections()
connect(nmDBusHelper, SIGNAL(pathForAccessPointRemoved(const QString &,QDBusObjectPath)),
this,SIGNAL(accessPointRemoved(const QString &,QDBusObjectPath)));
- if(!dbusConnection.connect(NM_DBUS_SERVICE,
+ if(!dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
d->path,
- NM_DBUS_INTERFACE_DEVICE_WIRELESS,
- "AccessPointAdded",
+ QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRELESS),
+ QLatin1String("AccessPointAdded"),
nmDBusHelper, SLOT(slotAccessPointAdded( QDBusObjectPath )))) {
allOk = true;
}
- if(!dbusConnection.connect(NM_DBUS_SERVICE,
+ if(!dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
d->path,
- NM_DBUS_INTERFACE_DEVICE_WIRELESS,
- "AccessPointRemoved",
+ QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRELESS),
+ QLatin1String("AccessPointRemoved"),
nmDBusHelper, SLOT(slotAccessPointRemoved( QDBusObjectPath )))) {
allOk = true;
}
- if(!dbusConnection.connect(NM_DBUS_SERVICE,
+ if(!dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
d->path,
- NM_DBUS_INTERFACE_DEVICE_WIRELESS,
- "PropertiesChanged",
+ QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRELESS),
+ QLatin1String("PropertiesChanged"),
nmDBusHelper,SLOT(slotPropertiesChanged( QMap<QString,QVariant>)))) {
allOk = true;
}
@@ -574,7 +548,7 @@ QDBusInterface *QNetworkManagerInterfaceDeviceWireless::connectionInterface() co
QList <QDBusObjectPath> QNetworkManagerInterfaceDeviceWireless::getAccessPoints()
{
- QDBusReply<QList<QDBusObjectPath> > reply = d->connectionInterface->call("GetAccessPoints");
+ QDBusReply<QList<QDBusObjectPath> > reply = d->connectionInterface->call(QLatin1String("GetAccessPoints"));
return reply.value();
}
@@ -603,7 +577,6 @@ quint32 QNetworkManagerInterfaceDeviceWireless::wirelessCapabilities() const
return d->connectionInterface->property("WirelelessCapabilities").toUInt();
}
-/////////////
class QNetworkManagerSettingsPrivate
{
public:
@@ -618,8 +591,8 @@ QNetworkManagerSettings::QNetworkManagerSettings(const QString &settingsService,
d = new QNetworkManagerSettingsPrivate();
d->path = settingsService;
d->connectionInterface = new QDBusInterface(settingsService,
- NM_DBUS_PATH_SETTINGS,
- NM_DBUS_IFACE_SETTINGS,
+ QLatin1String(NM_DBUS_PATH_SETTINGS),
+ QLatin1String(NM_DBUS_IFACE_SETTINGS),
dbusConnection);
if (!d->connectionInterface->isValid()) {
d->valid = false;
@@ -644,8 +617,8 @@ bool QNetworkManagerSettings::setConnections()
{
bool allOk = false;
- if (!dbusConnection.connect(d->path, NM_DBUS_PATH_SETTINGS,
- NM_DBUS_IFACE_SETTINGS, "NewConnection",
+ if (!dbusConnection.connect(d->path, QLatin1String(NM_DBUS_PATH_SETTINGS),
+ QLatin1String(NM_DBUS_IFACE_SETTINGS), QLatin1String("NewConnection"),
this, SIGNAL(newConnection(QDBusObjectPath)))) {
allOk = true;
}
@@ -655,7 +628,7 @@ bool QNetworkManagerSettings::setConnections()
QList <QDBusObjectPath> QNetworkManagerSettings::listConnections()
{
- QDBusReply<QList<QDBusObjectPath> > reply = d->connectionInterface->call("ListConnections");
+ QDBusReply<QList<QDBusObjectPath> > reply = d->connectionInterface->call(QLatin1String("ListConnections"));
return reply.value();
}
@@ -665,7 +638,6 @@ QDBusInterface *QNetworkManagerSettings::connectionInterface() const
}
-/////////////
class QNetworkManagerSettingsConnectionPrivate
{
public:
@@ -685,7 +657,7 @@ QNetworkManagerSettingsConnection::QNetworkManagerSettingsConnection(const QStri
d->service = settingsService;
d->connectionInterface = new QDBusInterface(settingsService,
d->path,
- NM_DBUS_IFACE_SETTINGS_CONNECTION,
+ QLatin1String(NM_DBUS_IFACE_SETTINGS_CONNECTION),
dbusConnection, parent);
if (!d->connectionInterface->isValid()) {
//qWarning() << "Could not find NetworkManagerSettingsConnection";
@@ -693,14 +665,12 @@ QNetworkManagerSettingsConnection::QNetworkManagerSettingsConnection(const QStri
return;
}
d->valid = true;
- QDBusReply< QNmSettingsMap > rep = d->connectionInterface->call("GetSettings");
+ QDBusReply< QNmSettingsMap > rep = d->connectionInterface->call(QLatin1String("GetSettings"));
d->settingsMap = rep.value();
}
QNetworkManagerSettingsConnection::~QNetworkManagerSettingsConnection()
{
- if (nmDBusHelper)
- delete nmDBusHelper;
delete d->connectionInterface;
delete d;
}
@@ -717,32 +687,26 @@ bool QNetworkManagerSettingsConnection::setConnections()
bool allOk = false;
if(!dbusConnection.connect(d->service, d->path,
- NM_DBUS_IFACE_SETTINGS_CONNECTION, "Updated",
+ QLatin1String(NM_DBUS_IFACE_SETTINGS_CONNECTION), QLatin1String("Updated"),
this, SIGNAL(updated(QNmSettingsMap)))) {
allOk = true;
} else {
QDBusError error = dbusConnection.lastError();
}
- if (nmDBusHelper)
- delete nmDBusHelper;
- nmDBusHelper = 0;
- nmDBusHelper = new QNmDBusHelper;
+ delete nmDBusHelper;
+ nmDBusHelper = new QNmDBusHelper(this);
connect(nmDBusHelper, SIGNAL(pathForSettingsRemoved(const QString &)),
this,SIGNAL(removed( const QString &)));
if (!dbusConnection.connect(d->service, d->path,
- NM_DBUS_IFACE_SETTINGS_CONNECTION, "Removed",
+ QLatin1String(NM_DBUS_IFACE_SETTINGS_CONNECTION), QLatin1String("Removed"),
nmDBusHelper, SIGNAL(slotSettingsRemoved()))) {
allOk = true;
}
return allOk;
}
-//QNetworkManagerSettingsConnection::update(QNmSettingsMap map)
-//{
-// d->connectionInterface->call("Update", QVariant::fromValue(map));
-//}
QDBusInterface *QNetworkManagerSettingsConnection::connectionInterface() const
{
@@ -751,23 +715,23 @@ QDBusInterface *QNetworkManagerSettingsConnection::connectionInterface() const
QNmSettingsMap QNetworkManagerSettingsConnection::getSettings()
{
- QDBusReply< QNmSettingsMap > rep = d->connectionInterface->call("GetSettings");
+ QDBusReply< QNmSettingsMap > rep = d->connectionInterface->call(QLatin1String("GetSettings"));
d->settingsMap = rep.value();
return d->settingsMap;
}
NMDeviceType QNetworkManagerSettingsConnection::getType()
{
- QNmSettingsMap::const_iterator i = d->settingsMap.find("connection");
- while (i != d->settingsMap.end() && i.key() == "connection") {
+ QNmSettingsMap::const_iterator i = d->settingsMap.find(QLatin1String("connection"));
+ while (i != d->settingsMap.end() && i.key() == QLatin1String("connection")) {
QMap<QString,QVariant> innerMap = i.value();
- QMap<QString,QVariant>::const_iterator ii = innerMap.find("type");
- while (ii != innerMap.end() && ii.key() == "type") {
+ QMap<QString,QVariant>::const_iterator ii = innerMap.find(QLatin1String("type"));
+ while (ii != innerMap.end() && ii.key() == QLatin1String("type")) {
QString devType = ii.value().toString();
- if (devType == "802-3-ethernet") {
+ if (devType == QLatin1String("802-3-ethernet")) {
return DEVICE_TYPE_802_3_ETHERNET;
}
- if (devType == "802-11-wireless") {
+ if (devType == QLatin1String("802-11-wireless")) {
return DEVICE_TYPE_802_11_WIRELESS;
}
ii++;
@@ -779,11 +743,11 @@ NMDeviceType QNetworkManagerSettingsConnection::getType()
bool QNetworkManagerSettingsConnection::isAutoConnect()
{
- QNmSettingsMap::const_iterator i = d->settingsMap.find("connection");
- while (i != d->settingsMap.end() && i.key() == "connection") {
+ QNmSettingsMap::const_iterator i = d->settingsMap.find(QLatin1String("connection"));
+ while (i != d->settingsMap.end() && i.key() == QLatin1String("connection")) {
QMap<QString,QVariant> innerMap = i.value();
- QMap<QString,QVariant>::const_iterator ii = innerMap.find("autoconnect");
- while (ii != innerMap.end() && ii.key() == "autoconnect") {
+ QMap<QString,QVariant>::const_iterator ii = innerMap.find(QLatin1String("autoconnect"));
+ while (ii != innerMap.end() && ii.key() == QLatin1String("autoconnect")) {
return ii.value().toBool();
ii++;
}
@@ -794,11 +758,11 @@ bool QNetworkManagerSettingsConnection::isAutoConnect()
quint64 QNetworkManagerSettingsConnection::getTimestamp()
{
- QNmSettingsMap::const_iterator i = d->settingsMap.find("connection");
- while (i != d->settingsMap.end() && i.key() == "connection") {
+ QNmSettingsMap::const_iterator i = d->settingsMap.find(QLatin1String("connection"));
+ while (i != d->settingsMap.end() && i.key() == QLatin1String("connection")) {
QMap<QString,QVariant> innerMap = i.value();
- QMap<QString,QVariant>::const_iterator ii = innerMap.find("timestamp");
- while (ii != innerMap.end() && ii.key() == "timestamp") {
+ QMap<QString,QVariant>::const_iterator ii = innerMap.find(QLatin1String("timestamp"));
+ while (ii != innerMap.end() && ii.key() == QLatin1String("timestamp")) {
return ii.value().toUInt();
ii++;
}
@@ -809,11 +773,11 @@ quint64 QNetworkManagerSettingsConnection::getTimestamp()
QString QNetworkManagerSettingsConnection::getId()
{
- QNmSettingsMap::const_iterator i = d->settingsMap.find("connection");
- while (i != d->settingsMap.end() && i.key() == "connection") {
+ QNmSettingsMap::const_iterator i = d->settingsMap.find(QLatin1String("connection"));
+ while (i != d->settingsMap.end() && i.key() == QLatin1String("connection")) {
QMap<QString,QVariant> innerMap = i.value();
- QMap<QString,QVariant>::const_iterator ii = innerMap.find("id");
- while (ii != innerMap.end() && ii.key() == "id") {
+ QMap<QString,QVariant>::const_iterator ii = innerMap.find(QLatin1String("id"));
+ while (ii != innerMap.end() && ii.key() == QLatin1String("id")) {
return ii.value().toString();
ii++;
}
@@ -824,11 +788,11 @@ QString QNetworkManagerSettingsConnection::getId()
QString QNetworkManagerSettingsConnection::getUuid()
{
- QNmSettingsMap::const_iterator i = d->settingsMap.find("connection");
- while (i != d->settingsMap.end() && i.key() == "connection") {
+ QNmSettingsMap::const_iterator i = d->settingsMap.find(QLatin1String("connection"));
+ while (i != d->settingsMap.end() && i.key() == QLatin1String("connection")) {
QMap<QString,QVariant> innerMap = i.value();
- QMap<QString,QVariant>::const_iterator ii = innerMap.find("uuid");
- while (ii != innerMap.end() && ii.key() == "uuid") {
+ QMap<QString,QVariant>::const_iterator ii = innerMap.find(QLatin1String("uuid"));
+ while (ii != innerMap.end() && ii.key() == QLatin1String("uuid")) {
return ii.value().toString();
ii++;
}
@@ -840,11 +804,11 @@ QString QNetworkManagerSettingsConnection::getUuid()
QString QNetworkManagerSettingsConnection::getSsid()
{
- QNmSettingsMap::const_iterator i = d->settingsMap.find("802-11-wireless");
- while (i != d->settingsMap.end() && i.key() == "802-11-wireless") {
+ QNmSettingsMap::const_iterator i = d->settingsMap.find(QLatin1String("802-11-wireless"));
+ while (i != d->settingsMap.end() && i.key() == QLatin1String("802-11-wireless")) {
QMap<QString,QVariant> innerMap = i.value();
- QMap<QString,QVariant>::const_iterator ii = innerMap.find("ssid");
- while (ii != innerMap.end() && ii.key() == "ssid") {
+ QMap<QString,QVariant>::const_iterator ii = innerMap.find(QLatin1String("ssid"));
+ while (ii != innerMap.end() && ii.key() == QLatin1String("ssid")) {
return ii.value().toString();
ii++;
}
@@ -856,11 +820,11 @@ QString QNetworkManagerSettingsConnection::getSsid()
QString QNetworkManagerSettingsConnection::getMacAddress()
{
if(getType() == DEVICE_TYPE_802_3_ETHERNET) {
- QNmSettingsMap::const_iterator i = d->settingsMap.find("802-3-ethernet");
- while (i != d->settingsMap.end() && i.key() == "802-3-ethernet") {
+ QNmSettingsMap::const_iterator i = d->settingsMap.find(QLatin1String("802-3-ethernet"));
+ while (i != d->settingsMap.end() && i.key() == QLatin1String("802-3-ethernet")) {
QMap<QString,QVariant> innerMap = i.value();
- QMap<QString,QVariant>::const_iterator ii = innerMap.find("mac-address");
- while (ii != innerMap.end() && ii.key() == "mac-address") {
+ QMap<QString,QVariant>::const_iterator ii = innerMap.find(QLatin1String("mac-address"));
+ while (ii != innerMap.end() && ii.key() == QLatin1String("mac-address")) {
return ii.value().toString();
ii++;
}
@@ -869,11 +833,11 @@ QString QNetworkManagerSettingsConnection::getMacAddress()
}
else if(getType() == DEVICE_TYPE_802_11_WIRELESS) {
- QNmSettingsMap::const_iterator i = d->settingsMap.find("802-11-wireless");
- while (i != d->settingsMap.end() && i.key() == "802-11-wireless") {
+ QNmSettingsMap::const_iterator i = d->settingsMap.find(QLatin1String("802-11-wireless"));
+ while (i != d->settingsMap.end() && i.key() == QLatin1String("802-11-wireless")) {
QMap<QString,QVariant> innerMap = i.value();
- QMap<QString,QVariant>::const_iterator ii = innerMap.find("mac-address");
- while (ii != innerMap.end() && ii.key() == "mac-address") {
+ QMap<QString,QVariant>::const_iterator ii = innerMap.find(QLatin1String("mac-address"));
+ while (ii != innerMap.end() && ii.key() == QLatin1String("mac-address")) {
return ii.value().toString();
ii++;
}
@@ -886,11 +850,11 @@ QString QNetworkManagerSettingsConnection::getMacAddress()
QStringList QNetworkManagerSettingsConnection::getSeenBssids()
{
if(getType() == DEVICE_TYPE_802_11_WIRELESS) {
- QNmSettingsMap::const_iterator i = d->settingsMap.find("802-11-wireless");
- while (i != d->settingsMap.end() && i.key() == "802-11-wireless") {
+ QNmSettingsMap::const_iterator i = d->settingsMap.find(QLatin1String("802-11-wireless"));
+ while (i != d->settingsMap.end() && i.key() == QLatin1String("802-11-wireless")) {
QMap<QString,QVariant> innerMap = i.value();
- QMap<QString,QVariant>::const_iterator ii = innerMap.find("seen-bssids");
- while (ii != innerMap.end() && ii.key() == "seen-bssids") {
+ QMap<QString,QVariant>::const_iterator ii = innerMap.find(QLatin1String("seen-bssids"));
+ while (ii != innerMap.end() && ii.key() == QLatin1String("seen-bssids")) {
return ii.value().toStringList();
ii++;
}
@@ -900,7 +864,6 @@ QStringList QNetworkManagerSettingsConnection::getSeenBssids()
return QStringList();
}
-/////////////
class QNetworkManagerConnectionActivePrivate
{
public:
@@ -914,9 +877,9 @@ QNetworkManagerConnectionActive::QNetworkManagerConnectionActive( const QString
{
d = new QNetworkManagerConnectionActivePrivate();
d->path = activeConnectionObjectPath;
- d->connectionInterface = new QDBusInterface(NM_DBUS_SERVICE,
+ d->connectionInterface = new QDBusInterface(QLatin1String(NM_DBUS_SERVICE),
d->path,
- NM_DBUS_INTERFACE_ACTIVE_CONNECTION,
+ QLatin1String(NM_DBUS_INTERFACE_ACTIVE_CONNECTION),
dbusConnection, parent);
if (!d->connectionInterface->isValid()) {
d->valid = false;
@@ -928,8 +891,6 @@ QNetworkManagerConnectionActive::QNetworkManagerConnectionActive( const QString
QNetworkManagerConnectionActive::~QNetworkManagerConnectionActive()
{
- if (nmDBusHelper)
- delete nmDBusHelper;
delete d->connectionInterface;
delete d;
}
@@ -945,16 +906,14 @@ bool QNetworkManagerConnectionActive::setConnections()
return false;
bool allOk = false;
- if (nmDBusHelper)
- delete nmDBusHelper;
- nmDBusHelper = 0;
- nmDBusHelper = new QNmDBusHelper;
+ delete nmDBusHelper;
+ nmDBusHelper = new QNmDBusHelper(this);
connect(nmDBusHelper, SIGNAL(pathForPropertiesChanged(const QString &,QMap<QString,QVariant>)),
this,SIGNAL(propertiesChanged( const QString &, QMap<QString,QVariant>)));
- if(dbusConnection.connect(NM_DBUS_SERVICE,
+ if(dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
d->path,
- NM_DBUS_INTERFACE_ACTIVE_CONNECTION,
- "PropertiesChanged",
+ QLatin1String(NM_DBUS_INTERFACE_ACTIVE_CONNECTION),
+ QLatin1String("PropertiesChanged"),
nmDBusHelper,SLOT(slotPropertiesChanged( QMap<QString,QVariant>))) ) {
allOk = true;
}
@@ -1000,8 +959,6 @@ bool QNetworkManagerConnectionActive::defaultRoute() const
return d->connectionInterface->property("Default").toBool();
}
-
-////
class QNetworkManagerIp4ConfigPrivate
{
public:
@@ -1015,9 +972,9 @@ QNetworkManagerIp4Config::QNetworkManagerIp4Config( const QString &deviceObjectP
{
d = new QNetworkManagerIp4ConfigPrivate();
d->path = deviceObjectPath;
- d->connectionInterface = new QDBusInterface(NM_DBUS_SERVICE,
+ d->connectionInterface = new QDBusInterface(QLatin1String(NM_DBUS_SERVICE),
d->path,
- NM_DBUS_INTERFACE_IP4_CONFIG,
+ QLatin1String(NM_DBUS_INTERFACE_IP4_CONFIG),
dbusConnection, parent);
if (!d->connectionInterface->isValid()) {
d->valid = false;
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h
index 81903ec..048f628 100644
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h
+++ b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h
@@ -53,26 +53,87 @@
// We mean it.
//
-#include <NetworkManager/NetworkManager.h>
-#include <QtDBus>
-#include <QDBusConnection>
-#include <QDBusError>
-#include <QDBusInterface>
-#include <QDBusMessage>
-#include <QDBusReply>
+#include <QtDBus/QtDBus>
+#include <QtDBus/QDBusConnection>
+#include <QtDBus/QDBusError>
+#include <QtDBus/QDBusInterface>
+#include <QtDBus/QDBusMessage>
+#include <QtDBus/QDBusReply>
#include <QNetworkInterface>
-#include <QDBusPendingCallWatcher>
+#include <QtDBus/QDBusPendingCallWatcher>
+#include <QtDBus/QDBusObjectPath>
+#include <QtDBus/QDBusContext>
+#include <QMap>
#include "qnmdbushelper.h"
+#ifndef NETWORK_MANAGER_H
+typedef enum NMDeviceType
+{
+ DEVICE_TYPE_UNKNOWN = 0,
+ DEVICE_TYPE_802_3_ETHERNET,
+ DEVICE_TYPE_802_11_WIRELESS,
+ DEVICE_TYPE_GSM,
+ DEVICE_TYPE_CDMA
+} NMDeviceType;
+
+typedef enum
+{
+ NM_DEVICE_STATE_UNKNOWN = 0,
+ NM_DEVICE_STATE_UNMANAGED,
+ NM_DEVICE_STATE_UNAVAILABLE,
+ NM_DEVICE_STATE_DISCONNECTED,
+ NM_DEVICE_STATE_PREPARE,
+ NM_DEVICE_STATE_CONFIG,
+ NM_DEVICE_STATE_NEED_AUTH,
+ NM_DEVICE_STATE_IP_CONFIG,
+ NM_DEVICE_STATE_ACTIVATED,
+ NM_DEVICE_STATE_FAILED
+} NMDeviceState;
+
+typedef enum
+{
+ NM_ACTIVE_CONNECTION_STATE_UNKNOWN = 0,
+ NM_ACTIVE_CONNECTION_STATE_ACTIVATING,
+ NM_ACTIVE_CONNECTION_STATE_ACTIVATED
+} NMActiveConnectionState;
+
+#define NM_DBUS_SERVICE "org.freedesktop.NetworkManager"
+
+#define NM_DBUS_PATH "/org/freedesktop/NetworkManager"
+#define NM_DBUS_INTERFACE "org.freedesktop.NetworkManager"
+#define NM_DBUS_INTERFACE_DEVICE NM_DBUS_INTERFACE ".Device"
+#define NM_DBUS_INTERFACE_DEVICE_WIRED NM_DBUS_INTERFACE_DEVICE ".Wired"
+#define NM_DBUS_INTERFACE_DEVICE_WIRELESS NM_DBUS_INTERFACE_DEVICE ".Wireless"
+#define NM_DBUS_PATH_ACCESS_POINT NM_DBUS_PATH "/AccessPoint"
+#define NM_DBUS_INTERFACE_ACCESS_POINT NM_DBUS_INTERFACE ".AccessPoint"
+
+#define NM_DBUS_PATH_SETTINGS "/org/freedesktop/NetworkManagerSettings"
+
+#define NM_DBUS_IFACE_SETTINGS_CONNECTION "org.freedesktop.NetworkManagerSettings.Connection"
+#define NM_DBUS_IFACE_SETTINGS "org.freedesktop.NetworkManagerSettings"
+#define NM_DBUS_INTERFACE_ACTIVE_CONNECTION NM_DBUS_INTERFACE ".Connection.Active"
+#define NM_DBUS_INTERFACE_IP4_CONFIG NM_DBUS_INTERFACE ".IP4Config"
+
+#define NM_DBUS_SERVICE_USER_SETTINGS "org.freedesktop.NetworkManagerUserSettings"
+#define NM_DBUS_SERVICE_SYSTEM_SETTINGS "org.freedesktop.NetworkManagerSystemSettings"
+
+#define NM_802_11_AP_FLAGS_NONE 0x00000000
+#define NM_802_11_AP_FLAGS_PRIVACY 0x00000001
+#endif
+
QT_BEGIN_NAMESPACE
typedef QMap< QString, QMap<QString,QVariant> > QNmSettingsMap;
typedef QList<quint32> ServerThing;
-Q_DECLARE_METATYPE(QNmSettingsMap)
-Q_DECLARE_METATYPE(ServerThing)
+QT_END_NAMESPACE
+
+Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(QNmSettingsMap))
+Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(ServerThing))
+
+QT_BEGIN_NAMESPACE
class QNetworkManagerInterfacePrivate;
class QNetworkManagerInterface : public QObject
@@ -107,12 +168,10 @@ Q_SIGNALS:
private Q_SLOTS:
private:
-// Q_DISABLE_COPY(QNetworkManagerInterface); ??
QNetworkManagerInterfacePrivate *d;
QNmDBusHelper *nmDBusHelper;
-}; //end QNetworkManagerInterface
+};
-////////
class QNetworkManagerInterfaceAccessPointPrivate;
class QNetworkManagerInterfaceAccessPoint : public QObject
{
@@ -120,7 +179,6 @@ class QNetworkManagerInterfaceAccessPoint : public QObject
public:
- // NM_DEVICE_STATE
enum DeviceState {
Unknown = 0,
Unmanaged,
@@ -181,9 +239,8 @@ private:
QNetworkManagerInterfaceAccessPointPrivate *d;
QNmDBusHelper *nmDBusHelper;
-}; //end QNetworkManagerInterfaceAccessPoint
+};
-////////
class QNetworkManagerInterfaceDevicePrivate;
class QNetworkManagerInterfaceDevice : public QObject
{
@@ -195,7 +252,7 @@ public:
~QNetworkManagerInterfaceDevice();
QString udi() const;
- QNetworkInterface interface() const;
+ QNetworkInterface networkInterface() const;
QDBusInterface *connectionInterface() const;
quint32 ip4Address() const;
quint32 state() const;
@@ -211,9 +268,8 @@ Q_SIGNALS:
private:
QNetworkManagerInterfaceDevicePrivate *d;
QNmDBusHelper *nmDBusHelper;
-}; //end QNetworkManagerInterfaceDevice
+};
-////////
class QNetworkManagerInterfaceDeviceWiredPrivate;
class QNetworkManagerInterfaceDeviceWired : public QObject
{
@@ -236,9 +292,8 @@ Q_SIGNALS:
private:
QNetworkManagerInterfaceDeviceWiredPrivate *d;
QNmDBusHelper *nmDBusHelper;
-}; // end QNetworkManagerInterfaceDeviceWired
+};
-////
class QNetworkManagerInterfaceDeviceWirelessPrivate;
class QNetworkManagerInterfaceDeviceWireless : public QObject
{
@@ -278,9 +333,8 @@ Q_SIGNALS:
private:
QNetworkManagerInterfaceDeviceWirelessPrivate *d;
QNmDBusHelper *nmDBusHelper;
-}; // end QNetworkManagerInterfaceDeviceWireless
+};
-////
class QNetworkManagerSettingsPrivate;
class QNetworkManagerSettings : public QObject
{
@@ -300,9 +354,8 @@ Q_SIGNALS:
void newConnection(QDBusObjectPath);
private:
QNetworkManagerSettingsPrivate *d;
-}; //end QNetworkManagerSettings
+};
-////
class QNetworkManagerSettingsConnectionPrivate;
class QNetworkManagerSettingsConnection : public QObject
{
@@ -315,7 +368,6 @@ public:
QDBusInterface *connectionInterface() const;
QNmSettingsMap getSettings();
- // void update(QNmSettingsMap map);
bool setConnections();
NMDeviceType getType();
bool isAutoConnect();
@@ -335,9 +387,8 @@ Q_SIGNALS:
private:
QNmDBusHelper *nmDBusHelper;
QNetworkManagerSettingsConnectionPrivate *d;
-}; //end QNetworkManagerSettingsConnection
+};
-////
class QNetworkManagerConnectionActivePrivate;
class QNetworkManagerConnectionActive : public QObject
{
@@ -371,9 +422,8 @@ Q_SIGNALS:
private:
QNetworkManagerConnectionActivePrivate *d;
QNmDBusHelper *nmDBusHelper;
-}; //QNetworkManagerConnectionActive
+};
-////
class QNetworkManagerIp4ConfigPrivate;
class QNetworkManagerIp4Config : public QObject
{
@@ -383,14 +433,12 @@ public:
QNetworkManagerIp4Config(const QString &dbusPathName, QObject *parent = 0);
~QNetworkManagerIp4Config();
- // QList<quint32> nameservers();
QStringList domains() const;
bool isValid();
private:
QNetworkManagerIp4ConfigPrivate *d;
};
-////
QT_END_NAMESPACE
diff --git a/src/plugins/bearer/networkmanager/qnmdbushelper.cpp b/src/plugins/bearer/networkmanager/qnmdbushelper.cpp
index d5e20f3..e195eeb 100644
--- a/src/plugins/bearer/networkmanager/qnmdbushelper.cpp
+++ b/src/plugins/bearer/networkmanager/qnmdbushelper.cpp
@@ -43,7 +43,7 @@
#include "qnmdbushelper.h"
-#include <NetworkManager/NetworkManager.h>
+#include "qnetworkmanagerservice.h"
#include <QDBusError>
#include <QDBusInterface>
@@ -54,6 +54,15 @@
QT_BEGIN_NAMESPACE
+QNmDBusHelper::QNmDBusHelper(QObject * parent)
+ : QObject(parent)
+{
+}
+
+QNmDBusHelper::~QNmDBusHelper()
+{
+}
+
void QNmDBusHelper::deviceStateChanged(quint32 state)
{
QDBusMessage msg = this->message();
diff --git a/src/plugins/bearer/networkmanager/qnmdbushelper.h b/src/plugins/bearer/networkmanager/qnmdbushelper.h
index 862290c..933d55a 100644
--- a/src/plugins/bearer/networkmanager/qnmdbushelper.h
+++ b/src/plugins/bearer/networkmanager/qnmdbushelper.h
@@ -52,6 +52,8 @@ class QNmDBusHelper: public QObject, protected QDBusContext
{
Q_OBJECT
public:
+ QNmDBusHelper(QObject *parent = 0);
+ ~QNmDBusHelper();
public slots:
void deviceStateChanged(quint32);
diff --git a/src/plugins/bearer/qnetworksession_impl.cpp b/src/plugins/bearer/qnetworksession_impl.cpp
index f41fdba..11585ef 100644
--- a/src/plugins/bearer/qnetworksession_impl.cpp
+++ b/src/plugins/bearer/qnetworksession_impl.cpp
@@ -147,6 +147,8 @@ void QNetworkSessionPrivateImpl::open()
if ((activeConfig.state() & QNetworkConfiguration::Discovered) !=
QNetworkConfiguration::Discovered) {
lastError =QNetworkSession::InvalidConfigurationError;
+ state = QNetworkSession::Invalid;
+ emit stateChanged(state);
emit QNetworkSessionPrivate::error(lastError);
return;
}
@@ -201,22 +203,22 @@ void QNetworkSessionPrivateImpl::stop()
void QNetworkSessionPrivateImpl::migrate()
{
- qWarning("This platform does not support roaming (%s).", __FUNCTION__);
+ qWarning("This platform does not support roaming (%s).", Q_FUNC_INFO);
}
void QNetworkSessionPrivateImpl::accept()
{
- qWarning("This platform does not support roaming (%s).", __FUNCTION__);
+ qWarning("This platform does not support roaming (%s).", Q_FUNC_INFO);
}
void QNetworkSessionPrivateImpl::ignore()
{
- qWarning("This platform does not support roaming (%s).", __FUNCTION__);
+ qWarning("This platform does not support roaming (%s).", Q_FUNC_INFO);
}
void QNetworkSessionPrivateImpl::reject()
{
- qWarning("This platform does not support roaming (%s).", __FUNCTION__);
+ qWarning("This platform does not support roaming (%s).", Q_FUNC_INFO);
}
QNetworkInterface QNetworkSessionPrivateImpl::currentInterface() const
@@ -400,7 +402,6 @@ void QNetworkSessionPrivateImpl::connectionError(const QString &id,
lastError = QNetworkSession::UnknownSessionError;
}
- emit quitPendingWaitsForOpened();
emit QNetworkSessionPrivate::error(lastError);
}
}
diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.cpp b/src/plugins/bearer/symbian/qnetworksession_impl.cpp
index 9af1fe9..bec562d 100644
--- a/src/plugins/bearer/symbian/qnetworksession_impl.cpp
+++ b/src/plugins/bearer/symbian/qnetworksession_impl.cpp
@@ -141,7 +141,10 @@ void QNetworkSessionPrivateImpl::syncStateWithInterface()
if (state != QNetworkSession::Connected) {
// There were no open connections to used IAP or SNAP
- if ((privateConfiguration(publicConfig)->state & QNetworkConfiguration::Discovered) ==
+ if (iError == QNetworkSession::InvalidConfigurationError) {
+ newState(QNetworkSession::Invalid);
+ }
+ else if ((privateConfiguration(publicConfig)->state & QNetworkConfiguration::Discovered) ==
QNetworkConfiguration::Discovered) {
newState(QNetworkSession::Disconnected);
} else {
@@ -231,13 +234,23 @@ QNetworkSession::SessionError QNetworkSessionPrivateImpl::error() const
void QNetworkSessionPrivateImpl::open()
{
- if (isOpen || !privateConfiguration(publicConfig) || (state == QNetworkSession::Connecting)) {
+ if (isOpen || (state == QNetworkSession::Connecting)) {
return;
}
// Cancel notifications from RConnectionMonitor
// => RConnection::ProgressNotification will be used for IAP/SNAP monitoring
iConnectionMonitor.CancelNotifications();
+
+ // Configuration must be at least in Discovered - state for connecting purposes.
+ if ((publicConfig.state() & QNetworkConfiguration::Discovered) !=
+ QNetworkConfiguration::Discovered) {
+ newState(QNetworkSession::Invalid);
+ iError = QNetworkSession::InvalidConfigurationError;
+ emit QNetworkSessionPrivate::error(iError);
+ syncStateWithInterface();
+ return;
+ }
TInt error = iSocketServ.Connect();
if (error != KErrNone) {
diff --git a/src/plugins/bearer/symbian/symbianengine.cpp b/src/plugins/bearer/symbian/symbianengine.cpp
index b3c9cb3..88a563c 100644
--- a/src/plugins/bearer/symbian/symbianengine.cpp
+++ b/src/plugins/bearer/symbian/symbianengine.cpp
@@ -98,7 +98,7 @@ QString SymbianNetworkConfigurationPrivate::bearerName() const
}
SymbianEngine::SymbianEngine(QObject *parent)
-: QBearerEngine(parent), CActive(CActive::EPriorityIdle), iInitOk(true)
+: QBearerEngine(parent), CActive(CActive::EPriorityIdle), iFirstUpdate(true), iInitOk(true)
{
CActiveScheduler::Add(this);
@@ -136,9 +136,12 @@ SymbianEngine::SymbianEngine(QObject *parent)
updateConfigurations();
updateStatesToSnaps();
+
+ updateAvailableAccessPoints(); // On first time updates synchronously (without WLAN scans)
// Start monitoring IAP and/or SNAP changes in Symbian CommsDB
startCommsDatabaseNotifications();
+ iFirstUpdate = false;
}
SymbianEngine::~SymbianEngine()
@@ -153,7 +156,14 @@ SymbianEngine::~SymbianEngine()
#endif
delete ipAccessPointsAvailabilityScanner;
+
+ // CCommsDatabase destructor uses cleanup stack. Since QNetworkConfigurationManager
+ // is a global static, but the time we are here, E32Main() has been exited already and
+ // the thread's default cleanup stack has been deleted. Without this line, a
+ // 'E32USER-CBase 69' -panic will occur.
+ CTrapCleanup* cleanup = CTrapCleanup::New();
delete ipCommsDB;
+ delete cleanup;
}
bool SymbianEngine::hasIdentifier(const QString &id)
@@ -692,9 +702,10 @@ void SymbianEngine::accessPointScanningReady(TBool scanSuccessful, TConnMonIapIn
updateStatesToSnaps();
- startCommsDatabaseNotifications();
-
- emit updateCompleted();
+ if (!iFirstUpdate) {
+ startCommsDatabaseNotifications();
+ emit updateCompleted();
+ }
}
void SymbianEngine::updateStatesToSnaps()
@@ -987,11 +998,22 @@ void AccessPointsAvailabilityScanner::DoCancel()
void AccessPointsAvailabilityScanner::StartScanning()
{
- iConnectionMonitor.GetPckgAttribute(EBearerIdAll, 0, KIapAvailability, iIapBuf, iStatus);
- if (!IsActive()) {
- SetActive();
+ if (iOwner.iFirstUpdate) {
+ // On first update (the mgr is being instantiated) update only those bearers who
+ // don't need time-consuming scans (WLAN).
+ // Note: EBearerIdWCDMA covers also GPRS bearer
+ iConnectionMonitor.GetPckgAttribute(EBearerIdWCDMA, 0, KIapAvailability, iIapBuf, iStatus);
+ User::WaitForRequest(iStatus);
+ if (iStatus.Int() == KErrNone) {
+ iOwner.accessPointScanningReady(true,iIapBuf());
+ }
+ } else {
+ iConnectionMonitor.GetPckgAttribute(EBearerIdAll, 0, KIapAvailability, iIapBuf, iStatus);
+ if (!IsActive()) {
+ SetActive();
+ }
}
-}
+}
void AccessPointsAvailabilityScanner::RunL()
{
diff --git a/src/plugins/bearer/symbian/symbianengine.h b/src/plugins/bearer/symbian/symbianengine.h
index 5448813..ee6d070 100644
--- a/src/plugins/bearer/symbian/symbianengine.h
+++ b/src/plugins/bearer/symbian/symbianengine.h
@@ -162,6 +162,7 @@ private: // MConnectionMonitorObserver
void EventL(const CConnMonEventBase& aEvent);
private: // Data
+ bool iFirstUpdate;
CCommsDatabase* ipCommsDB;
RConnectionMonitor iConnectionMonitor;
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
index 12f4c6b..54f4a8a 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
@@ -68,11 +68,10 @@ public:
};
enum CompositionModeStatus {
- PorterDuff_None = 0x00,
- PorterDuff_SupportedBlits = 0x01,
- PorterDuff_SupportedPrimitives = 0x02,
- PorterDuff_SupportedOpaquePrimitives = 0x04,
- PorterDuff_Dirty = 0x10
+ PorterDuff_None = 0x0,
+ PorterDuff_Supported = 0x1,
+ PorterDuff_PremultiplyColors = 0x2,
+ PorterDuff_AlwaysBlend = 0x4
};
enum ClipType {
@@ -97,7 +96,6 @@ public:
inline void unlock();
static inline void unlock(QDirectFBPaintDevice *device);
- inline bool testCompositionMode(const QPen *pen, const QBrush *brush, const QColor *color = 0) const;
inline bool isSimpleBrush(const QBrush &brush) const;
void drawTiledPixmap(const QRectF &dest, const QPixmap &pixmap, const QPointF &pos);
@@ -130,6 +128,7 @@ public:
ClipType clipType;
QDirectFBPaintDevice *dfbDevice;
uint compositionModeStatus;
+ bool isPremultiplied;
bool inClip;
QRect currentClip;
@@ -168,7 +167,7 @@ struct CachedImage
static QCache<qint64, CachedImage> imageCache(4*1024*1024); // 4 MB
#endif
-#if defined QT_DIRECTFB_WARN_ON_RASTERFALLBACKS || defined QT_DIRECTFB_DISABLE_RASTERFALLBACKS
+#if defined QT_DIRECTFB_WARN_ON_RASTERFALLBACKS || defined QT_DIRECTFB_DISABLE_RASTERFALLBACKS || defined QT_DEBUG
#define VOID_ARG() static_cast<bool>(false)
enum PaintOperation {
DRAW_RECTS = 0x0001, DRAW_LINES = 0x0002, DRAW_IMAGE = 0x0004,
@@ -178,9 +177,89 @@ enum PaintOperation {
FILL_RECT = 0x1000, DRAW_COLORSPANS = 0x2000, DRAW_ROUNDED_RECT = 0x4000,
DRAW_STATICTEXT = 0x8000, ALL = 0xffff
};
+
+#ifdef QT_DEBUG
+static void initRasterFallbacksMasks(int *warningMask, int *disableMask)
+{
+ struct {
+ const char *name;
+ PaintOperation operation;
+ } const operations[] = {
+ { "DRAW_RECTS", DRAW_RECTS },
+ { "DRAW_LINES", DRAW_LINES },
+ { "DRAW_IMAGE", DRAW_IMAGE },
+ { "DRAW_PIXMAP", DRAW_PIXMAP },
+ { "DRAW_TILED_PIXMAP", DRAW_TILED_PIXMAP },
+ { "STROKE_PATH", STROKE_PATH },
+ { "DRAW_PATH", DRAW_PATH },
+ { "DRAW_POINTS", DRAW_POINTS },
+ { "DRAW_ELLIPSE", DRAW_ELLIPSE },
+ { "DRAW_POLYGON", DRAW_POLYGON },
+ { "DRAW_TEXT", DRAW_TEXT },
+ { "FILL_PATH", FILL_PATH },
+ { "FILL_RECT", FILL_RECT },
+ { "DRAW_COLORSPANS", DRAW_COLORSPANS },
+ { "DRAW_ROUNDED_RECT", DRAW_ROUNDED_RECT },
+ { "ALL", ALL },
+ { 0, ALL }
+ };
+
+ QStringList warning = QString::fromLatin1(qgetenv("QT_DIRECTFB_WARN_ON_RASTERFALLBACKS")).toUpper().split(QLatin1Char('|'),
+ QString::SkipEmptyParts);
+ QStringList disable = QString::fromLatin1(qgetenv("QT_DIRECTFB_DISABLE_RASTERFALLBACKS")).toUpper().split(QLatin1Char('|'),
+ QString::SkipEmptyParts);
+ *warningMask = 0;
+ *disableMask = 0;
+ if (!warning.isEmpty() || !disable.isEmpty()) {
+ for (int i=0; operations[i].name; ++i) {
+ const QString name = QString::fromLatin1(operations[i].name);
+ int idx = warning.indexOf(name);
+ if (idx != -1) {
+ *warningMask |= operations[i].operation;
+ warning.remove(warning.begin() + idx);
+ }
+ idx = disable.indexOf(name);
+ if (idx != -1) {
+ *disableMask |= operations[i].operation;
+ disable.remove(disable.begin() + idx);
+ }
+ }
+ }
+ if (!warning.isEmpty()) {
+ qWarning("QDirectFBPaintEngine QT_DIRECTFB_WARN_ON_RASTERFALLBACKS Unknown operation(s): %s",
+ qPrintable(warning.join(QLatin1String("|"))));
+ }
+ if (!disable.isEmpty()) {
+ qWarning("QDirectFBPaintEngine QT_DIRECTFB_DISABLE_RASTERFALLBACKS Unknown operation(s): %s",
+ qPrintable(disable.join(QLatin1String("|"))));
+ }
+
+}
#endif
+static inline int rasterFallbacksMask(bool warn)
+{
#ifdef QT_DIRECTFB_WARN_ON_RASTERFALLBACKS
+ if (warn)
+ return QT_DIRECTFB_WARN_ON_RASTERFALLBACKS;
+#endif
+#ifdef QT_DIRECTFB_DISABLE_RASTERFALLBACKS
+ if (!warn)
+ return QT_DIRECTFB_DISABLE_RASTERFALLBACKS;
+#endif
+#ifndef QT_DEBUG
+ return 0;
+#else
+ static int warnMask = -1;
+ static int disableMask = -1;
+ if (warnMask == -1)
+ initRasterFallbacksMasks(&warnMask, &disableMask);
+ return warn ? warnMask : disableMask;
+#endif
+}
+#endif
+
+#if defined QT_DIRECTFB_WARN_ON_RASTERFALLBACKS || defined QT_DEBUG
template <typename device, typename T1, typename T2, typename T3>
static void rasterFallbackWarn(const char *msg, const char *func, const device *dev,
uint transformationType, bool simplePen,
@@ -190,25 +269,31 @@ static void rasterFallbackWarn(const char *msg, const char *func, const device *
const char *nameThree, const T3 &three);
#endif
-#if defined QT_DIRECTFB_WARN_ON_RASTERFALLBACKS && defined QT_DIRECTFB_DISABLE_RASTERFALLBACKS
+#if defined QT_DEBUG || (defined QT_DIRECTFB_WARN_ON_RASTERFALLBACKS && defined QT_DIRECTFB_DISABLE_RASTERFALLBACKS)
#define RASTERFALLBACK(op, one, two, three) \
- if (op & (QT_DIRECTFB_WARN_ON_RASTERFALLBACKS)) \
- rasterFallbackWarn("Disabled raster engine operation", \
- __FUNCTION__, state()->painter->device(), \
- d_func()->transformationType, \
- d_func()->simplePen, \
- d_func()->clipType, \
- d_func()->compositionModeStatus, \
- #one, one, #two, two, #three, three); \
- if (op & (QT_DIRECTFB_DISABLE_RASTERFALLBACKS)) \
- return;
+ { \
+ const bool disable = op & rasterFallbacksMask(false); \
+ if (op & rasterFallbacksMask(true)) \
+ rasterFallbackWarn(disable \
+ ? "Disabled raster engine operation" \
+ : "Falling back to raster engine for", \
+ __FUNCTION__, \
+ state()->painter->device(), \
+ d_func()->transformationType, \
+ d_func()->simplePen, \
+ d_func()->clipType, \
+ d_func()->compositionModeStatus, \
+ #one, one, #two, two, #three, three); \
+ if (disable) \
+ return; \
+ }
#elif defined QT_DIRECTFB_DISABLE_RASTERFALLBACKS
-#define RASTERFALLBACK(op, one, two, three) \
- if (op & (QT_DIRECTFB_DISABLE_RASTERFALLBACKS)) \
+#define RASTERFALLBACK(op, one, two, three) \
+ if (op & rasterFallbacksMask(false)) \
return;
#elif defined QT_DIRECTFB_WARN_ON_RASTERFALLBACKS
#define RASTERFALLBACK(op, one, two, three) \
- if (op & (QT_DIRECTFB_WARN_ON_RASTERFALLBACKS)) \
+ if (op & rasterFallbacksMask(true)) \
rasterFallbackWarn("Falling back to raster engine for", \
__FUNCTION__, state()->painter->device(), \
d_func()->transformationType, \
@@ -287,6 +372,7 @@ bool QDirectFBPaintEngine::begin(QPaintDevice *device)
qFatal("QDirectFBPaintEngine used on an invalid device: 0x%x",
device->devType());
}
+ d->isPremultiplied = QDirectFBScreen::isPremultiplied(d->dfbDevice->format());
d->prepare(d->dfbDevice);
gccaps = AllFeatures;
@@ -413,7 +499,7 @@ void QDirectFBPaintEngine::drawRects(const QRect *rects, int rectCount)
|| !d->simplePen
|| d->clipType == QDirectFBPaintEnginePrivate::ComplexClip
|| !d->isSimpleBrush(brush)
- || !d->testCompositionMode(&pen, &brush)) {
+ || !(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)) {
RASTERFALLBACK(DRAW_RECTS, rectCount, VOID_ARG(), VOID_ARG());
d->lock();
QRasterPaintEngine::drawRects(rects, rectCount);
@@ -443,7 +529,7 @@ void QDirectFBPaintEngine::drawRects(const QRectF *rects, int rectCount)
|| !d->simplePen
|| d->clipType == QDirectFBPaintEnginePrivate::ComplexClip
|| !d->isSimpleBrush(brush)
- || !d->testCompositionMode(&pen, &brush)) {
+ || !(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)) {
RASTERFALLBACK(DRAW_RECTS, rectCount, VOID_ARG(), VOID_ARG());
d->lock();
QRasterPaintEngine::drawRects(rects, rectCount);
@@ -468,7 +554,7 @@ void QDirectFBPaintEngine::drawLines(const QLine *lines, int lineCount)
const QPen &pen = state()->pen;
if (!d->simplePen
|| d->clipType == QDirectFBPaintEnginePrivate::ComplexClip
- || !d->testCompositionMode(&pen, 0)) {
+ || !(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)) {
RASTERFALLBACK(DRAW_LINES, lineCount, VOID_ARG(), VOID_ARG());
d->lock();
QRasterPaintEngine::drawLines(lines, lineCount);
@@ -488,7 +574,7 @@ void QDirectFBPaintEngine::drawLines(const QLineF *lines, int lineCount)
const QPen &pen = state()->pen;
if (!d->simplePen
|| d->clipType == QDirectFBPaintEnginePrivate::ComplexClip
- || !d->testCompositionMode(&pen, 0)) {
+ || !(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)) {
RASTERFALLBACK(DRAW_LINES, lineCount, VOID_ARG(), VOID_ARG());
d->lock();
QRasterPaintEngine::drawLines(lines, lineCount);
@@ -526,7 +612,7 @@ void QDirectFBPaintEngine::drawImage(const QRectF &r, const QImage &image,
*/
#if !defined QT_NO_DIRECTFB_PREALLOCATED || defined QT_DIRECTFB_IMAGECACHE
- if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedBlits)
+ if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)
|| (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported)
|| (d->clipType == QDirectFBPaintEnginePrivate::ComplexClip)
|| (!d->supportsStretchBlit() && state()->matrix.mapRect(r).size() != sr.size())
@@ -575,7 +661,7 @@ void QDirectFBPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pixmap,
QPixmapData *data = pixmap.pixmapData();
Q_ASSERT(data->classId() == QPixmapData::DirectFBClass);
QDirectFBPixmapData *dfbData = static_cast<QDirectFBPixmapData*>(data);
- if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedBlits)
+ if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)
|| (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported)
|| (d->clipType == QDirectFBPaintEnginePrivate::ComplexClip)
|| (!d->supportsStretchBlit() && state()->matrix.mapRect(r).size() != sr.size())) {
@@ -606,7 +692,7 @@ void QDirectFBPaintEngine::drawTiledPixmap(const QRectF &r,
RASTERFALLBACK(DRAW_TILED_PIXMAP, r, pixmap.size(), offset);
d->lock();
QRasterPaintEngine::drawTiledPixmap(r, pixmap, offset);
- } else if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedBlits)
+ } else if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)
|| (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported)
|| (d->clipType == QDirectFBPaintEnginePrivate::ComplexClip)
|| (!d->supportsStretchBlit() && state()->matrix.isScaling())) {
@@ -727,20 +813,21 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QBrush &brush)
if (d->clipType != QDirectFBPaintEnginePrivate::ComplexClip) {
switch (brush.style()) {
case Qt::SolidPattern: {
- if (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_RectsUnsupported
- || !d->testCompositionMode(0, &brush)) {
- break;
- }
const QColor color = brush.color();
if (!color.isValid())
return;
+
+ if (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_RectsUnsupported
+ || !(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)) {
+ break;
+ }
d->setDFBColor(color);
const QRect r = state()->matrix.mapRect(rect).toRect();
CLIPPED_PAINT(d->surface->FillRectangle(d->surface, r.x(), r.y(), r.width(), r.height()));
return; }
case Qt::TexturePattern: {
- if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedBlits)
+ if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)
|| (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported)
|| (!d->supportsStretchBlit() && state()->matrix.isScaling())) {
break;
@@ -768,7 +855,7 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QColor &color)
Q_D(QDirectFBPaintEngine);
if ((d->transformationType & QDirectFBPaintEnginePrivate::Matrix_RectsUnsupported)
|| (d->clipType == QDirectFBPaintEnginePrivate::ComplexClip)
- || !d->testCompositionMode(0, 0, &color)) {
+ || !(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)) {
RASTERFALLBACK(FILL_RECT, rect, color, VOID_ARG());
d->lock();
QRasterPaintEngine::fillRect(rect, color);
@@ -812,7 +899,7 @@ QDirectFBPaintEnginePrivate::QDirectFBPaintEnginePrivate(QDirectFBPaintEngine *p
: surface(0), antialiased(false), simplePen(false),
transformationType(0), opacity(255),
clipType(ClipUnset), dfbDevice(0),
- compositionModeStatus(0), inClip(false), q(p)
+ compositionModeStatus(0), isPremultiplied(false), inClip(false), q(p)
{
fb = QDirectFBScreen::instance()->dfb();
surfaceCache = new SurfaceCache;
@@ -828,36 +915,6 @@ bool QDirectFBPaintEnginePrivate::isSimpleBrush(const QBrush &brush) const
return (brush.style() == Qt::NoBrush) || (brush.style() == Qt::SolidPattern && !antialiased);
}
-bool QDirectFBPaintEnginePrivate::testCompositionMode(const QPen *pen, const QBrush *brush, const QColor *color) const
-{
- Q_ASSERT(!pen || pen->style() == Qt::NoPen || pen->style() == Qt::SolidLine);
- Q_ASSERT(!brush || brush->style() == Qt::NoBrush || brush->style() == Qt::SolidPattern);
- switch (compositionModeStatus & (QDirectFBPaintEnginePrivate::PorterDuff_SupportedOpaquePrimitives
- |QDirectFBPaintEnginePrivate::PorterDuff_SupportedPrimitives)) {
- case QDirectFBPaintEnginePrivate::PorterDuff_SupportedPrimitives:
- return true;
- case QDirectFBPaintEnginePrivate::PorterDuff_SupportedOpaquePrimitives:
- if (pen && pen->style() == Qt::SolidLine && pen->color().alpha() != 255)
- return false;
- if (brush) {
- if (brush->style() == Qt::SolidPattern && brush->color().alpha() != 255) {
- return false;
- }
- } else if (color && color->alpha() != 255) {
- return false;
- }
- return true;
- case QDirectFBPaintEnginePrivate::PorterDuff_None:
- return false;
- default:
- // ### PorterDuff_SupportedOpaquePrimitives|PorterDuff_SupportedPrimitives can't be combined
- break;
- }
- Q_ASSERT(0);
- return false;
-}
-
-
void QDirectFBPaintEnginePrivate::lock()
{
// We will potentially get a new pointer to the buffer after a
@@ -920,21 +977,23 @@ void QDirectFBPaintEnginePrivate::setCompositionMode(QPainter::CompositionMode m
static const bool forceRasterFallBack = qgetenv("QT_DIRECTFB_FORCE_RASTER").toInt() > 0;
if (forceRasterFallBack) {
- compositionModeStatus = 0;
+ compositionModeStatus = PorterDuff_None;
return;
}
- compositionModeStatus = PorterDuff_SupportedBlits;
+ compositionModeStatus = PorterDuff_Supported|PorterDuff_PremultiplyColors|PorterDuff_AlwaysBlend;
switch (mode) {
case QPainter::CompositionMode_Clear:
surface->SetPorterDuff(surface, DSPD_CLEAR);
break;
case QPainter::CompositionMode_Source:
surface->SetPorterDuff(surface, DSPD_SRC);
- compositionModeStatus |= PorterDuff_SupportedOpaquePrimitives;
+ compositionModeStatus &= ~PorterDuff_AlwaysBlend;
+ if (!isPremultiplied)
+ compositionModeStatus &= ~PorterDuff_PremultiplyColors;
break;
case QPainter::CompositionMode_SourceOver:
- compositionModeStatus |= PorterDuff_SupportedPrimitives;
+ compositionModeStatus &= ~PorterDuff_AlwaysBlend;
surface->SetPorterDuff(surface, DSPD_SRC_OVER);
break;
case QPainter::CompositionMode_DestinationOver:
@@ -942,6 +1001,8 @@ void QDirectFBPaintEnginePrivate::setCompositionMode(QPainter::CompositionMode m
break;
case QPainter::CompositionMode_SourceIn:
surface->SetPorterDuff(surface, DSPD_SRC_IN);
+ if (!isPremultiplied)
+ compositionModeStatus &= ~PorterDuff_PremultiplyColors;
break;
case QPainter::CompositionMode_DestinationIn:
surface->SetPorterDuff(surface, DSPD_DST_IN);
@@ -952,6 +1013,11 @@ void QDirectFBPaintEnginePrivate::setCompositionMode(QPainter::CompositionMode m
case QPainter::CompositionMode_DestinationOut:
surface->SetPorterDuff(surface, DSPD_DST_OUT);
break;
+#if (Q_DIRECTFB_VERSION >= 0x010209)
+ case QPainter::CompositionMode_Destination:
+ surface->SetPorterDuff(surface, DSPD_DST);
+ break;
+#endif
#if (Q_DIRECTFB_VERSION >= 0x010000)
case QPainter::CompositionMode_SourceAtop:
surface->SetPorterDuff(surface, DSPD_SRC_ATOP);
@@ -967,7 +1033,7 @@ void QDirectFBPaintEnginePrivate::setCompositionMode(QPainter::CompositionMode m
break;
#endif
default:
- compositionModeStatus = 0;
+ compositionModeStatus = PorterDuff_None;
break;
}
}
@@ -989,9 +1055,6 @@ void QDirectFBPaintEnginePrivate::prepareForBlit(bool alpha)
}
surface->SetColor(surface, 0xff, 0xff, 0xff, opacity);
surface->SetBlittingFlags(surface, blittingFlags);
- if (compositionModeStatus & PorterDuff_Dirty) {
- setCompositionMode(q->state()->composition_mode);
- }
}
static inline uint ALPHA_MUL(uint x, uint a)
@@ -1004,12 +1067,20 @@ static inline uint ALPHA_MUL(uint x, uint a)
void QDirectFBPaintEnginePrivate::setDFBColor(const QColor &color)
{
Q_ASSERT(surface);
+ Q_ASSERT(compositionModeStatus & PorterDuff_Supported);
const quint8 alpha = (opacity == 255 ?
color.alpha() : ALPHA_MUL(color.alpha(), opacity));
- surface->SetColor(surface, color.red(), color.green(), color.blue(), alpha);
- surface->SetPorterDuff(surface, DSPD_NONE);
- surface->SetDrawingFlags(surface, alpha == 255 ? DSDRAW_NOFX : DSDRAW_BLEND);
- compositionModeStatus |= PorterDuff_Dirty;
+ QColor col;
+ if (compositionModeStatus & PorterDuff_PremultiplyColors) {
+ col = QColor(ALPHA_MUL(color.red(), alpha),
+ ALPHA_MUL(color.green(), alpha),
+ ALPHA_MUL(color.blue(), alpha),
+ alpha);
+ } else {
+ col = QColor(color.red(), color.green(), color.blue(), alpha);
+ }
+ surface->SetColor(surface, col.red(), col.green(), col.blue(), col.alpha());
+ surface->SetDrawingFlags(surface, alpha == 255 && !(compositionModeStatus & PorterDuff_AlwaysBlend) ? DSDRAW_NOFX : DSDRAW_BLEND);
}
IDirectFBSurface *QDirectFBPaintEnginePrivate::getSurface(const QImage &img, bool *release)
@@ -1291,7 +1362,7 @@ static inline void drawRects(const T *rects, int n, const QTransform &transform,
}
}
-#ifdef QT_DIRECTFB_WARN_ON_RASTERFALLBACKS
+#if defined QT_DIRECTFB_WARN_ON_RASTERFALLBACKS || defined QT_DEBUG
template <typename T> inline const T *ptr(const T &t) { return &t; }
template <> inline const bool* ptr<bool>(const bool &) { return 0; }
template <typename device, typename T1, typename T2, typename T3>
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
index ba50329..b5ac67d 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
@@ -425,7 +425,7 @@ void QDirectFBPixmapData::fill(const QColor &color)
Q_ASSERT(dfbSurface);
- alpha = (color.alpha() < 255);
+ alpha |= (color.alpha() < 255);
if (alpha && isOpaqueFormat(imageFormat)) {
QSize size;
diff --git a/src/plugins/gfxdrivers/vnc/qscreenvnc_qws.cpp b/src/plugins/gfxdrivers/vnc/qscreenvnc_qws.cpp
index 7bcb74d..e78fec1 100644
--- a/src/plugins/gfxdrivers/vnc/qscreenvnc_qws.cpp
+++ b/src/plugins/gfxdrivers/vnc/qscreenvnc_qws.cpp
@@ -325,6 +325,36 @@ static const struct {
{ 0xffe8, Qt::Key_Meta },
{ 0xffe9, Qt::Key_Alt },
{ 0xffea, Qt::Key_Alt },
+
+ { 0xffb0, Qt::Key_0 },
+ { 0xffb1, Qt::Key_1 },
+ { 0xffb2, Qt::Key_2 },
+ { 0xffb3, Qt::Key_3 },
+ { 0xffb4, Qt::Key_4 },
+ { 0xffb5, Qt::Key_5 },
+ { 0xffb6, Qt::Key_6 },
+ { 0xffb7, Qt::Key_7 },
+ { 0xffb8, Qt::Key_8 },
+ { 0xffb9, Qt::Key_9 },
+
+ { 0xff8d, Qt::Key_Return },
+ { 0xffaa, Qt::Key_Asterisk },
+ { 0xffab, Qt::Key_Plus },
+ { 0xffad, Qt::Key_Minus },
+ { 0xffae, Qt::Key_Period },
+ { 0xffaf, Qt::Key_Slash },
+
+ { 0xff95, Qt::Key_Home },
+ { 0xff96, Qt::Key_Left },
+ { 0xff97, Qt::Key_Up },
+ { 0xff98, Qt::Key_Right },
+ { 0xff99, Qt::Key_Down },
+ { 0xff9a, Qt::Key_PageUp },
+ { 0xff9b, Qt::Key_PageDown },
+ { 0xff9c, Qt::Key_End },
+ { 0xff9e, Qt::Key_Insert },
+ { 0xff9f, Qt::Key_Delete },
+
{ 0, 0 }
};
@@ -483,6 +513,10 @@ bool QRfbKeyEvent::read(QTcpSocket *s)
keycode = keyMap[i].keycode;
i++;
}
+
+ if (keycode >= ' ' && keycode <= '~')
+ unicode = keycode;
+
if (!keycode) {
if (key <= 0xff) {
unicode = key;
diff --git a/src/plugins/imageformats/jpeg/qjpeghandler.cpp b/src/plugins/imageformats/jpeg/qjpeghandler.cpp
index 3555b21..6eed824 100644
--- a/src/plugins/imageformats/jpeg/qjpeghandler.cpp
+++ b/src/plugins/imageformats/jpeg/qjpeghandler.cpp
@@ -562,11 +562,29 @@ inline my_jpeg_destination_mgr::my_jpeg_destination_mgr(QIODevice *device)
free_in_buffer = max_buf;
}
+static bool can_write_format(QImage::Format fmt)
+{
+ switch (fmt) {
+ case QImage::Format_Mono:
+ case QImage::Format_MonoLSB:
+ case QImage::Format_Indexed8:
+ case QImage::Format_RGB888:
+ case QImage::Format_RGB32:
+ case QImage::Format_ARGB32:
+ case QImage::Format_ARGB32_Premultiplied:
+ return true;
+ break;
+ default:
+ break;
+ }
+ return false;
+}
static bool write_jpeg_image(const QImage &sourceImage, QIODevice *device, int sourceQuality)
{
bool success = false;
- const QImage image = sourceImage;
+ const QImage image = can_write_format(sourceImage.format()) ?
+ sourceImage : sourceImage.convertToFormat(QImage::Format_RGB888);
const QVector<QRgb> cmap = image.colorTable();
struct jpeg_compress_struct cinfo;
diff --git a/src/plugins/imageformats/tiff/tiff.pro b/src/plugins/imageformats/tiff/tiff.pro
index 514fd69..85f618f 100644
--- a/src/plugins/imageformats/tiff/tiff.pro
+++ b/src/plugins/imageformats/tiff/tiff.pro
@@ -55,7 +55,8 @@ contains(QT_CONFIG, system-tiff) {
}
wince*: {
SOURCES += ../../../corelib/kernel/qfunctions_wince.cpp \
- ../../../3rdparty/libtiff/libtiff/tif_wince.c
+ ../../../3rdparty/libtiff/libtiff/tif_wince.c \
+ ../../../3rdparty/libtiff/libtiff/tif_win32.c
}
symbian*: {
SOURCES += ../../../3rdparty/libtiff/port/lfind.c
diff --git a/src/plugins/mediaservices/directshow/mediaplayer/directshowaudioendpointcontrol.cpp b/src/plugins/mediaservices/directshow/mediaplayer/directshowaudioendpointcontrol.cpp
index 570b44a..5f72ca6 100644
--- a/src/plugins/mediaservices/directshow/mediaplayer/directshowaudioendpointcontrol.cpp
+++ b/src/plugins/mediaservices/directshow/mediaplayer/directshowaudioendpointcontrol.cpp
@@ -55,7 +55,7 @@ DirectShowAudioEndpointControl::DirectShowAudioEndpointControl(
, m_deviceEnumerator(0)
{
if (CreateBindCtx(0, &m_bindContext) == S_OK) {
- m_deviceEnumerator = com_new<ICreateDevEnum>(CLSID_SystemDeviceEnum);
+ m_deviceEnumerator = com_new<ICreateDevEnum>(CLSID_SystemDeviceEnum, IID_ICreateDevEnum);
updateEndpoints();
@@ -82,6 +82,7 @@ QList<QString> DirectShowAudioEndpointControl::availableEndpoints() const
QString DirectShowAudioEndpointControl::endpointDescription(const QString &name) const
{
+#ifdef __IPropertyBag_INTERFACE_DEFINED__
QString description;
if (IMoniker *moniker = m_devices.value(name, 0)) {
@@ -96,7 +97,11 @@ QString DirectShowAudioEndpointControl::endpointDescription(const QString &name)
propertyBag->Release();
}
}
- return description;;
+
+ return description;
+#else
+ return name.section(QLatin1Char('\\'), -1);
+#endif
}
QString DirectShowAudioEndpointControl::defaultEndpoint() const
@@ -120,7 +125,7 @@ void DirectShowAudioEndpointControl::setActiveEndpoint(const QString &name)
if (moniker->BindToObject(
m_bindContext,
0,
- __uuidof(IBaseFilter),
+ IID_IBaseFilter,
reinterpret_cast<void **>(&filter)) == S_OK) {
m_service->setAudioOutput(filter);
diff --git a/src/plugins/mediaservices/directshow/mediaplayer/directshowglobal.h b/src/plugins/mediaservices/directshow/mediaplayer/directshowglobal.h
index 1c9fe54..e43e2a7 100644
--- a/src/plugins/mediaservices/directshow/mediaplayer/directshowglobal.h
+++ b/src/plugins/mediaservices/directshow/mediaplayer/directshowglobal.h
@@ -42,30 +42,30 @@
#ifndef DIRECTSHOWGLOBAL_H
#define DIRECTSHOWGLOBAL_H
-#include <dshow.h>
+#include <QtCore/qglobal.h>
+#include <dshow.h>
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-template <typename T> T *com_cast(IUnknown *unknown)
+template <typename T> T *com_cast(IUnknown *unknown, const IID &iid)
{
T *iface = 0;
- return unknown && unknown->QueryInterface(
- __uuidof(T), reinterpret_cast<void **>(&iface)) == S_OK
+ return unknown && unknown->QueryInterface(iid, reinterpret_cast<void **>(&iface)) == S_OK
? iface
: 0;
}
-template <typename T> T *com_new(const IID &clsid)
+template <typename T> T *com_new(const IID &clsid, const IID &iid)
{
T *object = 0;
return CoCreateInstance(
clsid,
NULL,
CLSCTX_INPROC_SERVER,
- __uuidof(T),
+ iid,
reinterpret_cast<void **>(&object)) == S_OK
? object
: 0;
@@ -75,4 +75,73 @@ QT_END_NAMESPACE
QT_END_HEADER
+#ifndef __IFilterGraph2_INTERFACE_DEFINED__
+#define __IFilterGraph2_INTERFACE_DEFINED__
+#define INTERFACE IFilterGraph2
+DECLARE_INTERFACE_(IFilterGraph2 ,IGraphBuilder)
+{
+ STDMETHOD(AddSourceFilterForMoniker)(THIS_ IMoniker *, IBindCtx *, LPCWSTR,IBaseFilter **) PURE;
+ STDMETHOD(ReconnectEx)(THIS_ IPin *, const AM_MEDIA_TYPE *) PURE;
+ STDMETHOD(RenderEx)(IPin *, DWORD, DWORD *) PURE;
+};
+#undef INTERFACE
+#endif
+
+#ifndef __IAMFilterMiscFlags_INTERFACE_DEFINED__
+#define __IAMFilterMiscFlags_INTERFACE_DEFINED__
+#define INTERFACE IAMFilterMiscFlags
+DECLARE_INTERFACE_(IAMFilterMiscFlags ,IUnknown)
+{
+ STDMETHOD(QueryInterface)(THIS_ REFIID,PVOID*) PURE;
+ STDMETHOD_(ULONG,AddRef)(THIS) PURE;
+ STDMETHOD_(ULONG,Release)(THIS) PURE;
+ STDMETHOD_(ULONG,GetMiscFlags)(THIS) PURE;
+};
+#undef INTERFACE
+#endif
+
+#ifndef __IFileSourceFilter_INTERFACE_DEFINED__
+#define __IFileSourceFilter_INTERFACE_DEFINED__
+#define INTERFACE IFileSourceFilter
+DECLARE_INTERFACE_(IFileSourceFilter ,IUnknown)
+{
+ STDMETHOD(QueryInterface)(THIS_ REFIID,PVOID*) PURE;
+ STDMETHOD_(ULONG,AddRef)(THIS) PURE;
+ STDMETHOD_(ULONG,Release)(THIS) PURE;
+ STDMETHOD(Load)(THIS_ LPCOLESTR, const AM_MEDIA_TYPE *) PURE;
+ STDMETHOD(GetCurFile)(THIS_ LPOLESTR *ppszFileName, AM_MEDIA_TYPE *) PURE;
+};
+#undef INTERFACE
+#endif
+
+#ifndef __IAMOpenProgress_INTERFACE_DEFINED__
+#define __IAMOpenProgress_INTERFACE_DEFINED__
+#define INTERFACE IAMOpenProgress
+DECLARE_INTERFACE_(IAMOpenProgress ,IUnknown)
+{
+ STDMETHOD(QueryInterface)(THIS_ REFIID,PVOID*) PURE;
+ STDMETHOD_(ULONG,AddRef)(THIS) PURE;
+ STDMETHOD_(ULONG,Release)(THIS) PURE;
+ STDMETHOD(QueryProgress)(THIS_ LONGLONG *, LONGLONG *) PURE;
+ STDMETHOD(AbortOperation)(THIS) PURE;
+};
+#undef INTERFACE
+#endif
+
+#ifndef __IFilterChain_INTERFACE_DEFINED__
+#define __IFilterChain_INTERFACE_DEFINED__
+#define INTERFACE IFilterChain
+DECLARE_INTERFACE_(IFilterChain ,IUnknown)
+{
+ STDMETHOD(QueryInterface)(THIS_ REFIID,PVOID*) PURE;
+ STDMETHOD_(ULONG,AddRef)(THIS) PURE;
+ STDMETHOD_(ULONG,Release)(THIS) PURE;
+ STDMETHOD(StartChain)(IBaseFilter *, IBaseFilter *) PURE;
+ STDMETHOD(PauseChain)(IBaseFilter *, IBaseFilter *) PURE;
+ STDMETHOD(StopChain)(IBaseFilter *, IBaseFilter *) PURE;
+ STDMETHOD(RemoveChain)(IBaseFilter *, IBaseFilter *) PURE;
+};
+#undef INTERFACE
+#endif
+
#endif
diff --git a/src/plugins/mediaservices/directshow/mediaplayer/directshowioreader.cpp b/src/plugins/mediaservices/directshow/mediaplayer/directshowioreader.cpp
index 54446b8..7369099 100644
--- a/src/plugins/mediaservices/directshow/mediaplayer/directshowioreader.cpp
+++ b/src/plugins/mediaservices/directshow/mediaplayer/directshowioreader.cpp
@@ -143,7 +143,7 @@ HRESULT DirectShowIOReader::RequestAllocator(
return S_OK;
} else {
- *ppActual = com_new<IMemAllocator>(CLSID_MemoryAllocator);
+ *ppActual = com_new<IMemAllocator>(CLSID_MemoryAllocator, IID_IMemAllocator);
if (*ppActual) {
if ((*ppActual)->SetProperties(pProps, &actualProperties) != S_OK) {
diff --git a/src/plugins/mediaservices/directshow/mediaplayer/directshowiosource.cpp b/src/plugins/mediaservices/directshow/mediaplayer/directshowiosource.cpp
index 1dca465..7b66d56 100644
--- a/src/plugins/mediaservices/directshow/mediaplayer/directshowiosource.cpp
+++ b/src/plugins/mediaservices/directshow/mediaplayer/directshowiosource.cpp
@@ -121,6 +121,10 @@ void DirectShowIOSource::setAllocator(IMemAllocator *allocator)
// IUnknown
HRESULT DirectShowIOSource::QueryInterface(REFIID riid, void **ppvObject)
{
+ // 2dd74950-a890-11d1-abe8-00a0c905f375
+ static const GUID iid_IAmFilterMiscFlags = {
+ 0x2dd74950, 0xa890, 0x11d1, {0xab, 0xe8, 0x00, 0xa0, 0xc9, 0x05, 0xf3, 0x75}};
+
if (!ppvObject) {
return E_POINTER;
} else if (riid == IID_IUnknown
@@ -128,7 +132,7 @@ HRESULT DirectShowIOSource::QueryInterface(REFIID riid, void **ppvObject)
|| riid == IID_IMediaFilter
|| riid == IID_IBaseFilter) {
*ppvObject = static_cast<IBaseFilter *>(this);
- } else if (riid == IID_IAMFilterMiscFlags) {
+ } else if (riid == iid_IAmFilterMiscFlags) {
*ppvObject = static_cast<IAMFilterMiscFlags *>(this);
} else if (riid == IID_IPin) {
*ppvObject = static_cast<IPin *>(this);
@@ -414,8 +418,8 @@ HRESULT DirectShowIOSource::tryConnect(IPin *pin, const AM_MEDIA_TYPE *type)
} else if (!m_allocator) {
hr = VFW_E_NO_TRANSPORT;
- if (IMemInputPin *memPin = com_cast<IMemInputPin>(pin)) {
- if ((m_allocator = com_new<IMemAllocator>(CLSID_MemoryAllocator))) {
+ if (IMemInputPin *memPin = com_cast<IMemInputPin>(pin, IID_IMemInputPin)) {
+ if ((m_allocator = com_new<IMemAllocator>(CLSID_MemoryAllocator, IID_IMemAllocator))) {
ALLOCATOR_PROPERTIES properties;
if (memPin->GetAllocatorRequirements(&properties) == S_OK
|| m_allocator->GetProperties(&properties) == S_OK) {
diff --git a/src/plugins/mediaservices/directshow/mediaplayer/directshowiosource.h b/src/plugins/mediaservices/directshow/mediaplayer/directshowiosource.h
index b626473..1d917df 100644
--- a/src/plugins/mediaservices/directshow/mediaplayer/directshowiosource.h
+++ b/src/plugins/mediaservices/directshow/mediaplayer/directshowiosource.h
@@ -42,17 +42,17 @@
#ifndef DIRECTSHOWIOSOURCE_H
#define DIRECTSHOWIOSOURCE_H
+#include "directshowglobal.h"
#include "directshowioreader.h"
#include "directshowmediatype.h"
#include "directshowmediatypelist.h"
+#include <QtCore/qfile.h>
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-#include <QtCore/qfile.h>
-
class DirectShowIOSource
: public DirectShowMediaTypeList
, public IBaseFilter
diff --git a/src/plugins/mediaservices/directshow/mediaplayer/directshowmediatype.cpp b/src/plugins/mediaservices/directshow/mediaplayer/directshowmediatype.cpp
index f719b29..cf6d45b 100644
--- a/src/plugins/mediaservices/directshow/mediaplayer/directshowmediatype.cpp
+++ b/src/plugins/mediaservices/directshow/mediaplayer/directshowmediatype.cpp
@@ -54,20 +54,20 @@ namespace
static const TypeLookup qt_typeLookup[] =
{
- { QVideoFrame::Format_RGB32, MEDIASUBTYPE_RGB32 },
- { QVideoFrame::Format_BGR24, MEDIASUBTYPE_RGB24 },
- { QVideoFrame::Format_RGB565, MEDIASUBTYPE_RGB565 },
- { QVideoFrame::Format_RGB555, MEDIASUBTYPE_RGB555 },
- { QVideoFrame::Format_AYUV444, MEDIASUBTYPE_AYUV },
- { QVideoFrame::Format_YUYV, MEDIASUBTYPE_YUY2 },
- { QVideoFrame::Format_UYVY, MEDIASUBTYPE_UYVY },
- { QVideoFrame::Format_IMC1, MEDIASUBTYPE_IMC1 },
- { QVideoFrame::Format_IMC2, MEDIASUBTYPE_IMC2 },
- { QVideoFrame::Format_IMC3, MEDIASUBTYPE_IMC3 },
- { QVideoFrame::Format_IMC4, MEDIASUBTYPE_IMC4 },
- { QVideoFrame::Format_YV12, MEDIASUBTYPE_YV12 },
- { QVideoFrame::Format_NV12, MEDIASUBTYPE_NV12 },
- { QVideoFrame::Format_YUV420P, MEDIASUBTYPE_IYUV }
+ { QVideoFrame::Format_RGB32, /*MEDIASUBTYPE_RGB32*/ {0xe436eb7e, 0x524f, 0x11ce, {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}} },
+ { QVideoFrame::Format_BGR24, /*MEDIASUBTYPE_RGB24*/ {0xe436eb7d, 0x524f, 0x11ce, {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}} },
+ { QVideoFrame::Format_RGB565, /*MEDIASUBTYPE_RGB565*/ {0xe436eb7b, 0x524f, 0x11ce, {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}} },
+ { QVideoFrame::Format_RGB555, /*MEDIASUBTYPE_RGB555*/ {0xe436eb7c, 0x524f, 0x11ce, {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}} },
+ { QVideoFrame::Format_AYUV444, /*MEDIASUBTYPE_AYUV*/ {0x56555941, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}} },
+ { QVideoFrame::Format_YUYV, /*MEDIASUBTYPE_YUY2*/ {0x32595559, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}} },
+ { QVideoFrame::Format_UYVY, /*MEDIASUBTYPE_UYVY*/ {0x59565955, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}} },
+ { QVideoFrame::Format_IMC1, /*MEDIASUBTYPE_IMC1*/ {0x31434D49, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}} },
+ { QVideoFrame::Format_IMC2, /*MEDIASUBTYPE_IMC2*/ {0x32434D49, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}} },
+ { QVideoFrame::Format_IMC3, /*MEDIASUBTYPE_IMC3*/ {0x33434D49, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}} },
+ { QVideoFrame::Format_IMC4, /*MEDIASUBTYPE_IMC4*/ {0x34434D49, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}} },
+ { QVideoFrame::Format_YV12, /*MEDIASUBTYPE_YV12*/ {0x32315659, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}} },
+ { QVideoFrame::Format_NV12, /*MEDIASUBTYPE_NV12*/ {0x3231564E, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}} },
+ { QVideoFrame::Format_YUV420P, /*MEDIASUBTYPE_IYUV*/ {0x56555949, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}} }
};
}
@@ -102,12 +102,16 @@ void DirectShowMediaType::freeData(AM_MEDIA_TYPE *type)
GUID DirectShowMediaType::convertPixelFormat(QVideoFrame::PixelFormat format)
{
+ // MEDIASUBTYPE_None;
+ static const GUID none = {
+ 0xe436eb8e, 0x524f, 0x11ce, {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70} };
+
const int count = sizeof(qt_typeLookup) / sizeof(TypeLookup);
for (int i = 0; i < count; ++i)
if (qt_typeLookup[i].pixelFormat == format)
return qt_typeLookup[i].mediaType;
- return MEDIASUBTYPE_None;
+ return none;
}
QVideoSurfaceFormat DirectShowMediaType::formatFromType(const AM_MEDIA_TYPE &type)
diff --git a/src/plugins/mediaservices/directshow/mediaplayer/directshowmetadatacontrol.cpp b/src/plugins/mediaservices/directshow/mediaplayer/directshowmetadatacontrol.cpp
index 7b2552f..89821c4 100644
--- a/src/plugins/mediaservices/directshow/mediaplayer/directshowmetadatacontrol.cpp
+++ b/src/plugins/mediaservices/directshow/mediaplayer/directshowmetadatacontrol.cpp
@@ -297,7 +297,7 @@ QVariant DirectShowMetaDataControl::metaData(QtMultimedia::MetaData key) const
}
if (string) {
- value = QString::fromUtf16(string, ::SysStringLen(string));
+ value = QString::fromUtf16(reinterpret_cast<ushort *>(string), ::SysStringLen(string));
::SysFreeString(string);
}
@@ -344,7 +344,7 @@ void DirectShowMetaDataControl::updateGraph(IFilterGraph2 *graph, IBaseFilter *s
if (m_headerInfo)
m_headerInfo->Release();
- m_headerInfo = com_cast<IWMHeaderInfo>(source);
+ m_headerInfo = com_cast<IWMHeaderInfo>(source, IID_IWMHeaderInfo);
#endif
// DirectShowMediaPlayerService holds a lock at this point so defer emitting signals to a later
// time.
diff --git a/src/plugins/mediaservices/directshow/mediaplayer/directshowmetadatacontrol.h b/src/plugins/mediaservices/directshow/mediaplayer/directshowmetadatacontrol.h
index 966f9b8..9a81ba8 100644
--- a/src/plugins/mediaservices/directshow/mediaplayer/directshowmetadatacontrol.h
+++ b/src/plugins/mediaservices/directshow/mediaplayer/directshowmetadatacontrol.h
@@ -42,9 +42,10 @@
#ifndef DIRECTSHOWMETADATACONTROL_H
#define DIRECTSHOWMETADATACONTROL_H
+#include "directshowglobal.h"
+
#include <QtMultimedia/qmetadatacontrol.h>
-#include <dshow.h>
#include <qnetwork.h>
#ifndef QT_NO_WMSDK
diff --git a/src/plugins/mediaservices/directshow/mediaplayer/directshowplayercontrol.cpp b/src/plugins/mediaservices/directshow/mediaplayer/directshowplayercontrol.cpp
index b024557..bb7bac3 100644
--- a/src/plugins/mediaservices/directshow/mediaplayer/directshowplayercontrol.cpp
+++ b/src/plugins/mediaservices/directshow/mediaplayer/directshowplayercontrol.cpp
@@ -371,7 +371,7 @@ void DirectShowPlayerControl::updateAudioOutput(IBaseFilter *filter)
if (m_audio)
m_audio->Release();
- m_audio = com_cast<IBasicAudio>(filter);
+ m_audio = com_cast<IBasicAudio>(filter, IID_IBasicAudio);
}
void DirectShowPlayerControl::updateError(QMediaPlayer::Error error, const QString &errorString)
diff --git a/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.cpp b/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.cpp
index 57f4bec..317fa5c 100644
--- a/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.cpp
+++ b/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.cpp
@@ -56,8 +56,6 @@
#include <QtCore/qthread.h>
#include <QtCore/qvarlengtharray.h>
-#include <uuids.h>
-
Q_GLOBAL_STATIC(DirectShowEventLoop, qt_directShowEventLoop)
QT_BEGIN_NAMESPACE
@@ -80,11 +78,11 @@ private:
DirectShowPlayerService::DirectShowPlayerService(QObject *parent)
: QMediaService(parent)
, m_playerControl(0)
- , m_audioEndpointControl(0)
, m_metaDataControl(0)
, m_videoOutputControl(0)
, m_videoRendererControl(0)
, m_videoWindowControl(0)
+ , m_audioEndpointControl(0)
, m_taskThread(0)
, m_loop(qt_directShowEventLoop())
, m_pendingTasks(0)
@@ -203,9 +201,12 @@ void DirectShowPlayerService::load(const QMediaContent &media, QIODevice *stream
m_graphStatus = InvalidMedia;
m_error = QMediaPlayer::ResourceError;
} else {
+ // {36b73882-c2c8-11cf-8b46-00805f6cef60}
+ static const GUID iid_IFilterGraph2 = {
+ 0x36b73882, 0xc2c8, 0x11cf, {0x8b, 0x46, 0x00, 0x80, 0x5f, 0x6c, 0xef, 0x60} };
m_graphStatus = Loading;
- m_graph = com_new<IFilterGraph2>(CLSID_FilterGraph);
+ m_graph = com_new<IFilterGraph2>(CLSID_FilterGraph, iid_IFilterGraph2);
if (stream)
m_pendingTasks = SetStreamSource;
@@ -231,15 +232,22 @@ void DirectShowPlayerService::doSetUrlSource(QMutexLocker *locker)
HRESULT hr = E_FAIL;
-#ifndef QT_NO_WMSDK
if (url.scheme() == QLatin1String("http") || url.scheme() == QLatin1String("https")) {
- if (IFileSourceFilter *fileSource = com_new<IFileSourceFilter>(CLSID_WMAsfReader)) {
+ static const GUID clsid_WMAsfReader = {
+ 0x187463a0, 0x5bb7, 0x11d3, {0xac, 0xbe, 0x00, 0x80, 0xc7, 0x5e, 0x24, 0x6e} };
+
+ // {56a868a6-0ad4-11ce-b03a-0020af0ba770}
+ static const GUID iid_IFileSourceFilter = {
+ 0x56a868a6, 0x0ad4, 0x11ce, {0xb0, 0x3a, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70} };
+
+ if (IFileSourceFilter *fileSource = com_new<IFileSourceFilter>(
+ clsid_WMAsfReader, iid_IFileSourceFilter)) {
locker->unlock();
- hr = fileSource->Load(url.toString().utf16(), 0);
+ hr = fileSource->Load(reinterpret_cast<const OLECHAR *>(url.toString().utf16()), 0);
locker->relock();
if (SUCCEEDED(hr)) {
- source = com_cast<IBaseFilter>(fileSource);
+ source = com_cast<IBaseFilter>(fileSource, IID_IBaseFilter);
if (!SUCCEEDED(hr = m_graph->AddFilter(source, L"Source")) && source) {
source->Release();
@@ -259,13 +267,11 @@ void DirectShowPlayerService::doSetUrlSource(QMutexLocker *locker)
}
if (!SUCCEEDED(hr)) {
-#endif
locker->unlock();
- hr = m_graph->AddSourceFilter(url.toString().utf16(), L"Source", &source);
+ hr = m_graph->AddSourceFilter(
+ reinterpret_cast<const OLECHAR *>(url.toString().utf16()), L"Source", &source);
locker->relock();
-#ifndef QT_NO_WMSDK
}
-#endif
if (SUCCEEDED(hr)) {
m_executedTasks = SetSource;
@@ -299,7 +305,7 @@ void DirectShowPlayerService::doSetUrlSource(QMutexLocker *locker)
default:
m_error = QMediaPlayer::ResourceError;
m_errorString = QString();
- qWarning("DirectShowPlayerService::doSetUrlSource: Unresolved error code %x", hr);
+ qWarning("DirectShowPlayerService::doSetUrlSource: Unresolved error code %x", uint(hr));
break;
}
@@ -342,7 +348,7 @@ void DirectShowPlayerService::doRender(QMutexLocker *locker)
{
m_pendingTasks |= m_executedTasks & (Play | Pause);
- if (IMediaControl *control = com_cast<IMediaControl>(m_graph)) {
+ if (IMediaControl *control = com_cast<IMediaControl>(m_graph, IID_IMediaControl)) {
control->Stop();
control->Release();
}
@@ -393,7 +399,7 @@ void DirectShowPlayerService::doRender(QMutexLocker *locker)
locker->unlock();
HRESULT hr;
if (SUCCEEDED(hr = graph->RenderEx(
- pin, AM_RENDEREX_RENDERTOEXISTINGRENDERERS, 0))) {
+ pin, /*AM_RENDEREX_RENDERTOEXISTINGRENDERERS*/ 1, 0))) {
rendered = true;
} else if (renderHr == S_OK || renderHr == VFW_E_NO_DECOMPRESSOR){
renderHr = hr;
@@ -448,7 +454,7 @@ void DirectShowPlayerService::doRender(QMutexLocker *locker)
m_error = QMediaPlayer::ResourceError;
m_errorString = QString();
qWarning("DirectShowPlayerService::doRender: Unresolved error code %x",
- renderHr);
+ uint(renderHr));
}
}
@@ -462,11 +468,11 @@ void DirectShowPlayerService::doRender(QMutexLocker *locker)
void DirectShowPlayerService::doFinalizeLoad(QMutexLocker *locker)
{
if (m_graphStatus != Loaded) {
- if (IMediaEvent *event = com_cast<IMediaEvent>(m_graph)) {
+ if (IMediaEvent *event = com_cast<IMediaEvent>(m_graph, IID_IMediaEvent)) {
event->GetEventHandle(reinterpret_cast<OAEVENT *>(&m_eventHandle));
event->Release();
}
- if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph)) {
+ if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph, IID_IMediaSeeking)) {
LONGLONG duration = 0;
seeking->GetDuration(&duration);
m_duration = duration / 10;
@@ -496,7 +502,12 @@ void DirectShowPlayerService::releaseGraph()
{
if (m_graph) {
if (m_executingTask != 0) {
- if (IAMOpenProgress *progress = com_cast<IAMOpenProgress>(m_graph)) {
+ // {8E1C39A1-DE53-11cf-AA63-0080C744528D}
+ static const GUID iid_IAMOpenProgress = {
+ 0x8E1C39A1, 0xDE53, 0x11cf, {0xAA, 0x63, 0x00, 0x80, 0xC7, 0x44, 0x52, 0x8D} };
+
+ if (IAMOpenProgress *progress = com_cast<IAMOpenProgress>(
+ m_graph, iid_IAMOpenProgress)) {
progress->AbortOperation();
progress->Release();
}
@@ -515,7 +526,7 @@ void DirectShowPlayerService::doReleaseGraph(QMutexLocker *locker)
{
Q_UNUSED(locker);
- if (IMediaControl *control = com_cast<IMediaControl>(m_graph)) {
+ if (IMediaControl *control = com_cast<IMediaControl>(m_graph, IID_IMediaControl)) {
control->Stop();
control->Release();
}
@@ -630,7 +641,7 @@ void DirectShowPlayerService::play()
void DirectShowPlayerService::doPlay(QMutexLocker *locker)
{
- if (IMediaControl *control = com_cast<IMediaControl>(m_graph)) {
+ if (IMediaControl *control = com_cast<IMediaControl>(m_graph, IID_IMediaControl)) {
locker->unlock();
HRESULT hr = control->Run();
locker->relock();
@@ -644,7 +655,7 @@ void DirectShowPlayerService::doPlay(QMutexLocker *locker)
} else {
m_error = QMediaPlayer::ResourceError;
m_errorString = QString();
- qWarning("DirectShowPlayerService::doPlay: Unresolved error code %x", hr);
+ qWarning("DirectShowPlayerService::doPlay: Unresolved error code %x", uint(hr));
QCoreApplication::postEvent(this, new QEvent(QEvent::Type(Error)));
}
@@ -672,7 +683,7 @@ void DirectShowPlayerService::pause()
void DirectShowPlayerService::doPause(QMutexLocker *locker)
{
- if (IMediaControl *control = com_cast<IMediaControl>(m_graph)) {
+ if (IMediaControl *control = com_cast<IMediaControl>(m_graph, IID_IMediaControl)) {
locker->unlock();
HRESULT hr = control->Pause();
locker->relock();
@@ -680,7 +691,7 @@ void DirectShowPlayerService::doPause(QMutexLocker *locker)
control->Release();
if (SUCCEEDED(hr)) {
- if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph)) {
+ if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph, IID_IMediaSeeking)) {
LONGLONG position = 0;
seeking->GetCurrentPosition(&position);
@@ -697,7 +708,7 @@ void DirectShowPlayerService::doPause(QMutexLocker *locker)
} else {
m_error = QMediaPlayer::ResourceError;
m_errorString = QString();
- qWarning("DirectShowPlayerService::doPause: Unresolved error code %x", hr);
+ qWarning("DirectShowPlayerService::doPause: Unresolved error code %x", uint(hr));
QCoreApplication::postEvent(this, new QEvent(QEvent::Type(Error)));
}
@@ -723,12 +734,12 @@ void DirectShowPlayerService::stop()
void DirectShowPlayerService::doStop(QMutexLocker *locker)
{
if (m_executedTasks & (Play | Pause)) {
- if (IMediaControl *control = com_cast<IMediaControl>(m_graph)) {
+ if (IMediaControl *control = com_cast<IMediaControl>(m_graph, IID_IMediaControl)) {
control->Stop();
control->Release();
}
- if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph)) {
+ if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph, IID_IMediaSeeking)) {
LONGLONG position = 0;
seeking->GetCurrentPosition(&position);
@@ -763,7 +774,7 @@ void DirectShowPlayerService::setRate(qreal rate)
void DirectShowPlayerService::doSetRate(QMutexLocker *locker)
{
- if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph)) {
+ if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph, IID_IMediaSeeking)) {
// Cache current values as we can't query IMediaSeeking during a seek due to the
// possibility of a deadlock when flushing the VideoSurfaceFilter.
LONGLONG currentPosition = 0;
@@ -801,7 +812,7 @@ qint64 DirectShowPlayerService::position() const
if (m_graphStatus == Loaded) {
if (m_executingTask == Seek || m_executingTask == SetRate) {
return m_position;
- } else if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph)) {
+ } else if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph, IID_IMediaSeeking)) {
LONGLONG position = 0;
seeking->GetCurrentPosition(&position);
@@ -822,7 +833,7 @@ QMediaTimeRange DirectShowPlayerService::availablePlaybackRanges() const
if (m_graphStatus == Loaded) {
if (m_executingTask == Seek || m_executingTask == SetRate) {
return m_playbackRange;
- } else if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph)) {
+ } else if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph, IID_IMediaSeeking)) {
LONGLONG minimum = 0;
LONGLONG maximum = 0;
@@ -850,7 +861,7 @@ void DirectShowPlayerService::seek(qint64 position)
void DirectShowPlayerService::doSeek(QMutexLocker *locker)
{
- if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph)) {
+ if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph, IID_IMediaSeeking)) {
LONGLONG seekPosition = LONGLONG(m_position) * 10;
// Cache current values as we can't query IMediaSeeking during a seek due to the
@@ -886,7 +897,8 @@ int DirectShowPlayerService::bufferStatus() const
#ifndef QT_NO_WMSDK
QMutexLocker locker(const_cast<QMutex *>(&m_mutex));
- if (IWMReaderAdvanced2 *reader = com_cast<IWMReaderAdvanced2>(m_source)) {
+ if (IWMReaderAdvanced2 *reader = com_cast<IWMReaderAdvanced2>(
+ m_source, IID_IWMReaderAdvanced2)) {
DWORD percentage = 0;
reader->GetBufferProgress(&percentage, 0);
@@ -949,7 +961,7 @@ void DirectShowPlayerService::doReleaseAudioOutput(QMutexLocker *locker)
{
m_pendingTasks |= m_executedTasks & (Play | Pause);
- if (IMediaControl *control = com_cast<IMediaControl>(m_graph)) {
+ if (IMediaControl *control = com_cast<IMediaControl>(m_graph, IID_IMediaControl)) {
control->Stop();
control->Release();
}
@@ -960,7 +972,11 @@ void DirectShowPlayerService::doReleaseAudioOutput(QMutexLocker *locker)
decoder->AddRef();
}
- if (IFilterChain *chain = com_cast<IFilterChain>(m_graph)) {
+ // {DCFBDCF6-0DC2-45f5-9AB2-7C330EA09C29}
+ static const GUID iid_IFilterChain = {
+ 0xDCFBDCF6, 0x0DC2, 0x45f5, {0x9A, 0xB2, 0x7C, 0x33, 0x0E, 0xA0, 0x9C, 0x29} };
+
+ if (IFilterChain *chain = com_cast<IFilterChain>(m_graph, iid_IFilterChain)) {
chain->RemoveChain(decoder, m_audioOutput);
chain->Release();
} else {
@@ -1018,7 +1034,7 @@ void DirectShowPlayerService::doReleaseVideoOutput(QMutexLocker *locker)
{
m_pendingTasks |= m_executedTasks & (Play | Pause);
- if (IMediaControl *control = com_cast<IMediaControl>(m_graph)) {
+ if (IMediaControl *control = com_cast<IMediaControl>(m_graph, IID_IMediaControl)) {
control->Stop();
control->Release();
}
@@ -1035,7 +1051,11 @@ void DirectShowPlayerService::doReleaseVideoOutput(QMutexLocker *locker)
decoder->AddRef();
}
- if (IFilterChain *chain = com_cast<IFilterChain>(m_graph)) {
+ // {DCFBDCF6-0DC2-45f5-9AB2-7C330EA09C29}
+ static const GUID iid_IFilterChain = {
+ 0xDCFBDCF6, 0x0DC2, 0x45f5, {0x9A, 0xB2, 0x7C, 0x33, 0x0E, 0xA0, 0x9C, 0x29} };
+
+ if (IFilterChain *chain = com_cast<IFilterChain>(m_graph, iid_IFilterChain)) {
chain->RemoveChain(decoder, m_videoOutput);
chain->Release();
} else {
@@ -1118,7 +1138,7 @@ void DirectShowPlayerService::videoOutputChanged()
void DirectShowPlayerService::graphEvent(QMutexLocker *locker)
{
- if (IMediaEvent *event = com_cast<IMediaEvent>(m_graph)) {
+ if (IMediaEvent *event = com_cast<IMediaEvent>(m_graph, IID_IMediaEvent)) {
long eventCode;
LONG_PTR param1;
LONG_PTR param2;
@@ -1137,7 +1157,7 @@ void DirectShowPlayerService::graphEvent(QMutexLocker *locker)
m_buffering = false;
m_atEnd = true;
- if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph)) {
+ if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph, IID_IMediaSeeking)) {
LONGLONG position = 0;
seeking->GetCurrentPosition(&position);
@@ -1149,7 +1169,7 @@ void DirectShowPlayerService::graphEvent(QMutexLocker *locker)
QCoreApplication::postEvent(this, new QEvent(QEvent::Type(EndOfMedia)));
break;
case EC_LENGTH_CHANGED:
- if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph)) {
+ if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph, IID_IMediaSeeking)) {
LONGLONG duration = 0;
seeking->GetDuration(&duration);
m_duration = duration / 10;
diff --git a/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.h b/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.h
index a5da9a4..23515d0 100644
--- a/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.h
+++ b/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.h
@@ -57,7 +57,6 @@
#include <QtCore/private/qwineventnotifier_p.h>
-
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/mediaservices/directshow/mediaplayer/mediaplayer.pri b/src/plugins/mediaservices/directshow/mediaplayer/mediaplayer.pri
index a7adb38..99a1191 100644
--- a/src/plugins/mediaservices/directshow/mediaplayer/mediaplayer.pri
+++ b/src/plugins/mediaservices/directshow/mediaplayer/mediaplayer.pri
@@ -2,7 +2,7 @@ INCLUDEPATH += $$PWD
DEFINES += QMEDIA_DIRECTSHOW_PLAYER
-win32-g++: DEFINES += QT_NO_WMSDK
+!contains(QT_CONFIG, wmsdk): DEFINES += QT_NO_WMSDK
HEADERS += \
$$PWD/directshowaudioendpointcontrol.h \
diff --git a/src/plugins/mediaservices/directshow/mediaplayer/videosurfacefilter.cpp b/src/plugins/mediaservices/directshow/mediaplayer/videosurfacefilter.cpp
index 7b4aad5..a471c68 100644
--- a/src/plugins/mediaservices/directshow/mediaplayer/videosurfacefilter.cpp
+++ b/src/plugins/mediaservices/directshow/mediaplayer/videosurfacefilter.cpp
@@ -84,7 +84,11 @@ VideoSurfaceFilter::~VideoSurfaceFilter()
}
HRESULT VideoSurfaceFilter::QueryInterface(REFIID riid, void **ppvObject)
-{
+{
+ // 2dd74950-a890-11d1-abe8-00a0c905f375
+ static const GUID iid_IAmFilterMiscFlags = {
+ 0x2dd74950, 0xa890, 0x11d1, {0xab, 0xe8, 0x00, 0xa0, 0xc9, 0x05, 0xf3, 0x75} };
+
if (!ppvObject) {
return E_POINTER;
} else if (riid == IID_IUnknown
@@ -92,7 +96,7 @@ HRESULT VideoSurfaceFilter::QueryInterface(REFIID riid, void **ppvObject)
|| riid == IID_IMediaFilter
|| riid == IID_IBaseFilter) {
*ppvObject = static_cast<IBaseFilter *>(this);
- } else if (riid == IID_IAMFilterMiscFlags) {
+ } else if (riid == iid_IAmFilterMiscFlags) {
*ppvObject = static_cast<IAMFilterMiscFlags *>(this);
} else if (riid == IID_IPin) {
*ppvObject = static_cast<IPin *>(this);
@@ -446,7 +450,7 @@ HRESULT VideoSurfaceFilter::EndOfStream()
QMutexLocker locker(&m_mutex);
if (!m_sampleScheduler.scheduleEndOfStream()) {
- if (IMediaEventSink *sink = com_cast<IMediaEventSink>(m_graph)) {
+ if (IMediaEventSink *sink = com_cast<IMediaEventSink>(m_graph, IID_IMediaEventSink)) {
sink->Notify(
EC_COMPLETE,
S_OK,
@@ -570,6 +574,10 @@ void VideoSurfaceFilter::supportedFormatsChanged()
{
QMutexLocker locker(&m_mutex);
+ // MEDIASUBTYPE_None;
+ static const GUID none = {
+ 0xe436eb8e, 0x524f, 0x11ce, {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70} };
+
QList<QVideoFrame::PixelFormat> formats = m_surface->supportedPixelFormats();
QVector<AM_MEDIA_TYPE> mediaTypes;
@@ -588,7 +596,7 @@ void VideoSurfaceFilter::supportedFormatsChanged()
foreach (QVideoFrame::PixelFormat format, formats) {
type.subtype = DirectShowMediaType::convertPixelFormat(format);
- if (type.subtype != MEDIASUBTYPE_None)
+ if (type.subtype != none)
mediaTypes.append(type);
}
@@ -610,7 +618,7 @@ void VideoSurfaceFilter::sampleReady()
sample->Release();
if (eos) {
- if (IMediaEventSink *sink = com_cast<IMediaEventSink>(m_graph)) {
+ if (IMediaEventSink *sink = com_cast<IMediaEventSink>(m_graph, IID_IMediaEventSink)) {
sink->Notify(
EC_COMPLETE,
S_OK,
diff --git a/src/plugins/mediaservices/directshow/mediaplayer/videosurfacefilter.h b/src/plugins/mediaservices/directshow/mediaplayer/videosurfacefilter.h
index 8f3a101..0607fd3 100644
--- a/src/plugins/mediaservices/directshow/mediaplayer/videosurfacefilter.h
+++ b/src/plugins/mediaservices/directshow/mediaplayer/videosurfacefilter.h
@@ -41,6 +41,7 @@
#ifndef VIDEOSURFACEFILTER_H
#define VIDEOSURFACEFILTER_H
+#include "directshowglobal.h"
#include "directshowmediatypelist.h"
#include "directshowsamplescheduler.h"
#include "directshowmediatype.h"
@@ -52,9 +53,6 @@
#include <QtCore/qstring.h>
#include <QtCore/qwaitcondition.h>
-#include <dshow.h>
-
-
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.cpp b/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.cpp
index a564e14..b1ddd98 100644
--- a/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.cpp
+++ b/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.cpp
@@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE
Vmr9VideoWindowControl::Vmr9VideoWindowControl(QObject *parent)
: QVideoWindowControl(parent)
- , m_filter(com_new<IBaseFilter>(CLSID_VideoMixingRenderer9))
+ , m_filter(com_new<IBaseFilter>(CLSID_VideoMixingRenderer9, IID_IBaseFilter))
, m_windowId(0)
, m_dirtyValues(0)
, m_brightness(0)
@@ -57,7 +57,7 @@ Vmr9VideoWindowControl::Vmr9VideoWindowControl(QObject *parent)
, m_saturation(0)
, m_fullScreen(false)
{
- if (IVMRFilterConfig9 *config = com_cast<IVMRFilterConfig9>(m_filter)) {
+ if (IVMRFilterConfig9 *config = com_cast<IVMRFilterConfig9>(m_filter, IID_IVMRFilterConfig9)) {
config->SetRenderingMode(VMR9Mode_Windowless);
config->SetNumberOfStreams(1);
config->Release();
@@ -81,7 +81,8 @@ void Vmr9VideoWindowControl::setWinId(WId id)
{
m_windowId = id;
- if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>(m_filter)) {
+ if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>(
+ m_filter, IID_IVMRWindowlessControl9)) {
control->SetVideoClippingWindow(m_windowId);
control->Release();
}
@@ -91,7 +92,8 @@ QRect Vmr9VideoWindowControl::displayRect() const
{
QRect rect;
- if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>(m_filter)) {
+ if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>(
+ m_filter, IID_IVMRWindowlessControl9)) {
RECT sourceRect;
RECT displayRect;
@@ -109,7 +111,8 @@ QRect Vmr9VideoWindowControl::displayRect() const
void Vmr9VideoWindowControl::setDisplayRect(const QRect &rect)
{
- if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>(m_filter)) {
+ if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>(
+ m_filter, IID_IVMRWindowlessControl9)) {
RECT sourceRect = { 0, 0, 0, 0 };
RECT displayRect = { rect.left(), rect.top(), rect.right(), rect.bottom() };
@@ -134,7 +137,8 @@ void Vmr9VideoWindowControl::repaint()
if (QWidget *widget = QWidget::find(m_windowId)) {
HDC dc = widget->getDC();
- if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>(m_filter)) {
+ if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>(
+ m_filter, IID_IVMRWindowlessControl9)) {
control->RepaintVideo(m_windowId, dc);
control->Release();
}
@@ -146,7 +150,8 @@ QSize Vmr9VideoWindowControl::nativeSize() const
{
QSize size;
- if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>(m_filter)) {
+ if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>(
+ m_filter, IID_IVMRWindowlessControl9)) {
LONG width;
LONG height;
@@ -161,7 +166,8 @@ QVideoWidget::AspectRatioMode Vmr9VideoWindowControl::aspectRatioMode() const
{
QVideoWidget::AspectRatioMode mode = QVideoWidget::KeepAspectRatio;
- if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>(m_filter)) {
+ if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>(
+ m_filter, IID_IVMRWindowlessControl9)) {
DWORD arMode;
if (control->GetAspectRatioMode(&arMode) == S_OK && arMode == VMR9ARMode_None)
@@ -173,7 +179,8 @@ QVideoWidget::AspectRatioMode Vmr9VideoWindowControl::aspectRatioMode() const
void Vmr9VideoWindowControl::setAspectRatioMode(QVideoWidget::AspectRatioMode mode)
{
- if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>(m_filter)) {
+ if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>(
+ m_filter, IID_IVMRWindowlessControl9)) {
switch (mode) {
case QVideoWidget::IgnoreAspectRatio:
control->SetAspectRatioMode(VMR9ARMode_None);
@@ -254,7 +261,7 @@ void Vmr9VideoWindowControl::setSaturation(int saturation)
void Vmr9VideoWindowControl::setProcAmpValues()
{
- if (IVMRMixerControl9 *control = com_cast<IVMRMixerControl9>(m_filter)) {
+ if (IVMRMixerControl9 *control = com_cast<IVMRMixerControl9>(m_filter, IID_IVMRMixerControl9)) {
VMR9ProcAmpControl procAmp;
procAmp.dwSize = sizeof(VMR9ProcAmpControl);
procAmp.dwFlags = m_dirtyValues;
diff --git a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamermetadataprovider.cpp b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamermetadataprovider.cpp
index 4d0ffe4..eff6ea4 100644
--- a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamermetadataprovider.cpp
+++ b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamermetadataprovider.cpp
@@ -45,6 +45,8 @@
#include <gst/gstversion.h>
+QT_BEGIN_NAMESPACE
+
struct QGstreamerMetaDataKeyLookup
{
QtMultimedia::MetaData key;
@@ -202,3 +204,6 @@ void QGstreamerMetaDataProvider::updateTags()
{
emit metaDataChanged();
}
+
+QT_END_NAMESPACE
+
diff --git a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp
index d417266..e646693 100644
--- a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp
+++ b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp
@@ -54,9 +54,14 @@
#include <fcntl.h>
#include <unistd.h>
+QT_BEGIN_NAMESPACE
+
QGstreamerPlayerControl::QGstreamerPlayerControl(QGstreamerPlayerSession *session, QObject *parent)
: QMediaPlayerControl(parent)
, m_session(session)
+ , m_state(QMediaPlayer::StoppedState)
+ , m_mediaStatus(QMediaPlayer::NoMedia)
+ , m_bufferProgress(-1)
, m_stream(0)
, m_fifoNotifier(0)
, m_fifoCanWrite(false)
@@ -75,11 +80,11 @@ QGstreamerPlayerControl::QGstreamerPlayerControl(QGstreamerPlayerSession *sessio
connect(m_session, SIGNAL(volumeChanged(int)),
this, SIGNAL(volumeChanged(int)));
connect(m_session, SIGNAL(stateChanged(QMediaPlayer::State)),
- this, SIGNAL(stateChanged(QMediaPlayer::State)));
- connect(m_session, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)),
- this, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)));
+ this, SLOT(updateState(QMediaPlayer::State)));
connect(m_session,SIGNAL(bufferingProgressChanged(int)),
- this, SIGNAL(bufferStatusChanged(int)));
+ this, SLOT(setBufferProgress(int)));
+ connect(m_session, SIGNAL(playbackFinished()),
+ this, SLOT(processEOS()));
connect(m_session, SIGNAL(audioAvailableChanged(bool)),
this, SIGNAL(audioAvailableChanged(bool)));
connect(m_session, SIGNAL(videoAvailableChanged(bool)),
@@ -112,17 +117,20 @@ qint64 QGstreamerPlayerControl::duration() const
QMediaPlayer::State QGstreamerPlayerControl::state() const
{
- return m_session->state();
+ return m_state;
}
QMediaPlayer::MediaStatus QGstreamerPlayerControl::mediaStatus() const
{
- return m_session->mediaStatus();
+ return m_mediaStatus;
}
int QGstreamerPlayerControl::bufferStatus() const
{
- return 100;
+ if (m_bufferProgress == -1) {
+ return m_session->state() == QMediaPlayer::StoppedState ? 0 : 100;
+ } else
+ return m_bufferProgress;
}
int QGstreamerPlayerControl::volume() const
@@ -167,23 +175,33 @@ void QGstreamerPlayerControl::setPosition(qint64 pos)
void QGstreamerPlayerControl::play()
{
- m_session->play();
-
- if (m_fifoFd[1] >= 0) {
- m_fifoCanWrite = true;
-
- writeFifo();
+ if (m_session->play()) {
+ if (m_state != QMediaPlayer::PlayingState)
+ emit stateChanged(m_state = QMediaPlayer::PlayingState);
}
}
void QGstreamerPlayerControl::pause()
{
- m_session->pause();
+ if (m_session->pause()) {
+ if (m_state != QMediaPlayer::PausedState)
+ emit stateChanged(m_state = QMediaPlayer::PausedState);
+ }
}
void QGstreamerPlayerControl::stop()
{
- m_session->stop();
+ if (m_state != QMediaPlayer::StoppedState) {
+ m_session->pause();
+ if (!m_session->seek(0)) {
+ m_bufferProgress = -1;
+ m_session->stop();
+ m_session->pause();
+ }
+ emit positionChanged(0);
+ if (m_state != QMediaPlayer::StoppedState)
+ emit stateChanged(m_state = QMediaPlayer::StoppedState);
+ }
}
void QGstreamerPlayerControl::setVolume(int volume)
@@ -208,8 +226,15 @@ const QIODevice *QGstreamerPlayerControl::mediaStream() const
void QGstreamerPlayerControl::setMedia(const QMediaContent &content, QIODevice *stream)
{
+ QMediaPlayer::State oldState = m_state;
+ m_state = QMediaPlayer::StoppedState;
m_session->stop();
+ if (m_bufferProgress != -1) {
+ m_bufferProgress = -1;
+ emit bufferStatusChanged(0);
+ }
+
if (m_stream) {
closeFifo();
@@ -232,7 +257,25 @@ void QGstreamerPlayerControl::setMedia(const QMediaContent &content, QIODevice *
m_session->load(url);
+ if (m_fifoFd[1] >= 0) {
+ m_fifoCanWrite = true;
+
+ writeFifo();
+ }
+
+ if (!url.isEmpty()) {
+ if (m_mediaStatus != QMediaPlayer::LoadingMedia)
+ emit mediaStatusChanged(m_mediaStatus = QMediaPlayer::LoadingMedia);
+ m_session->pause();
+ } else {
+ if (m_mediaStatus != QMediaPlayer::NoMedia)
+ emit mediaStatusChanged(m_mediaStatus = QMediaPlayer::NoMedia);
+ setBufferProgress(0);
+ }
+
emit mediaChanged(m_currentResource);
+ if (m_state != oldState)
+ emit stateChanged(m_state);
}
void QGstreamerPlayerControl::setVideoOutput(QObject *output)
@@ -250,6 +293,68 @@ bool QGstreamerPlayerControl::isVideoAvailable() const
return m_session->isVideoAvailable();
}
+void QGstreamerPlayerControl::updateState(QMediaPlayer::State state)
+{
+ QMediaPlayer::MediaStatus oldStatus = m_mediaStatus;
+
+ switch (state) {
+ case QMediaPlayer::StoppedState:
+ if (m_state != QMediaPlayer::StoppedState)
+ emit stateChanged(m_state = QMediaPlayer::StoppedState);
+ break;
+
+ case QMediaPlayer::PlayingState:
+ case QMediaPlayer::PausedState:
+ if (m_state == QMediaPlayer::StoppedState)
+ m_mediaStatus = QMediaPlayer::LoadedMedia;
+ else {
+ if (m_bufferProgress == -1)
+ m_mediaStatus = QMediaPlayer::BufferedMedia;
+ }
+ break;
+ }
+
+ if (m_mediaStatus != oldStatus)
+ emit mediaStatusChanged(m_mediaStatus);
+}
+
+void QGstreamerPlayerControl::processEOS()
+{
+ m_mediaStatus = QMediaPlayer::EndOfMedia;
+ m_state = QMediaPlayer::StoppedState;
+
+ emit stateChanged(m_state);
+ emit mediaStatusChanged(m_mediaStatus);
+}
+
+void QGstreamerPlayerControl::setBufferProgress(int progress)
+{
+ if (m_bufferProgress == progress || m_mediaStatus == QMediaPlayer::NoMedia)
+ return;
+
+ QMediaPlayer::MediaStatus oldStatus = m_mediaStatus;
+
+ m_bufferProgress = progress;
+
+ if (m_state == QMediaPlayer::StoppedState) {
+ m_mediaStatus = QMediaPlayer::LoadedMedia;
+ } else {
+ if (m_bufferProgress < 100) {
+ m_mediaStatus = QMediaPlayer::StalledMedia;
+ m_session->pause();
+ } else {
+ m_mediaStatus = QMediaPlayer::BufferedMedia;
+ if (m_state == QMediaPlayer::PlayingState)
+ m_session->play();
+ }
+ }
+
+ if (m_mediaStatus != oldStatus)
+ emit mediaStatusChanged(m_mediaStatus);
+
+ emit bufferStatusChanged(m_bufferProgress);
+}
+
void QGstreamerPlayerControl::writeFifo()
{
if (m_fifoCanWrite) {
@@ -341,3 +446,6 @@ void QGstreamerPlayerControl::closeFifo()
m_bufferOffset = 0;
}
}
+
+QT_END_NAMESPACE
+
diff --git a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayercontrol.h b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayercontrol.h
index ae0f8b6..0c53945 100644
--- a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayercontrol.h
+++ b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayercontrol.h
@@ -107,11 +107,18 @@ private Q_SLOTS:
void writeFifo();
void fifoReadyWrite(int socket);
+ void updateState(QMediaPlayer::State);
+ void processEOS();
+ void setBufferProgress(int progress);
+
private:
bool openFifo();
void closeFifo();
QGstreamerPlayerSession *m_session;
+ QMediaPlayer::State m_state;
+ QMediaPlayer::MediaStatus m_mediaStatus;
+ int m_bufferProgress;
QMediaContent m_currentResource;
QIODevice *m_stream;
QSocketNotifier *m_fifoNotifier;
diff --git a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.cpp b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.cpp
index 2e5d10f..392a7a8 100644
--- a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.cpp
+++ b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.cpp
@@ -51,10 +51,12 @@
//#define USE_PLAYBIN2
+
+QT_BEGIN_NAMESPACE
+
QGstreamerPlayerSession::QGstreamerPlayerSession(QObject *parent)
:QObject(parent),
m_state(QMediaPlayer::StoppedState),
- m_mediaStatus(QMediaPlayer::UnknownMediaStatus),
m_busHelper(0),
m_playbin(0),
m_nullVideoOutput(0),
@@ -89,6 +91,7 @@ QGstreamerPlayerSession::QGstreamerPlayerSession(QObject *parent)
m_busHelper->installSyncEventFilter(this);
m_nullVideoOutput = gst_element_factory_make("fakesink", NULL);
+ gst_object_ref(GST_OBJECT(m_nullVideoOutput));
g_object_set(G_OBJECT(m_playbin), "video-sink", m_nullVideoOutput, NULL);
// Initial volume
@@ -106,12 +109,14 @@ QGstreamerPlayerSession::~QGstreamerPlayerSession()
delete m_busHelper;
gst_object_unref(GST_OBJECT(m_bus));
gst_object_unref(GST_OBJECT(m_playbin));
+ gst_object_unref(GST_OBJECT(m_nullVideoOutput));
}
}
void QGstreamerPlayerSession::load(const QUrl &url)
{
m_url = url;
+
if (m_playbin) {
m_tags.clear();
emit tagsChanged();
@@ -256,26 +261,36 @@ bool QGstreamerPlayerSession::isSeekable() const
return m_seekable;
}
-void QGstreamerPlayerSession::play()
+bool QGstreamerPlayerSession::play()
{
if (m_playbin) {
if (gst_element_set_state(m_playbin, GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) {
qWarning() << "GStreamer; Unable to play -" << m_url.toString();
- m_state = QMediaPlayer::StoppedState;
- m_mediaStatus = QMediaPlayer::InvalidMedia;
+ m_state = QMediaPlayer::StoppedState;
emit stateChanged(m_state);
- emit mediaStatusChanged(m_mediaStatus);
-
emit error(int(QMediaPlayer::ResourceError), tr("Unable to play %1").arg(m_url.path()));
- }
+ } else
+ return true;
}
+
+ return false;
}
-void QGstreamerPlayerSession::pause()
+bool QGstreamerPlayerSession::pause()
{
- if (m_playbin)
- gst_element_set_state(m_playbin, GST_STATE_PAUSED);
+ if (m_playbin) {
+ if (gst_element_set_state(m_playbin, GST_STATE_PAUSED) == GST_STATE_CHANGE_FAILURE) {
+ qWarning() << "GStreamer; Unable to play -" << m_url.toString();
+ m_state = QMediaPlayer::StoppedState;
+
+ emit stateChanged(m_state);
+ emit error(int(QMediaPlayer::ResourceError), tr("Unable to play %1").arg(m_url.path()));
+ } else
+ return true;
+ }
+
+ return false;
}
void QGstreamerPlayerSession::stop()
@@ -289,31 +304,45 @@ void QGstreamerPlayerSession::stop()
}
}
-void QGstreamerPlayerSession::seek(qint64 ms)
+bool QGstreamerPlayerSession::seek(qint64 ms)
{
if (m_playbin && m_state != QMediaPlayer::StoppedState) {
gint64 position = (gint64)ms * 1000000;
- gst_element_seek_simple(m_playbin, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH, position);
+ return gst_element_seek_simple(m_playbin, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH, position);
}
+
+ return false;
}
void QGstreamerPlayerSession::setVolume(int volume)
{
- m_volume = volume;
- emit volumeChanged(m_volume);
+ if (m_volume != volume) {
+ m_volume = volume;
+
+ if (m_playbin) {
+#ifndef USE_PLAYBIN2
+ if(!m_muted)
+#endif
+ g_object_set(G_OBJECT(m_playbin), "volume", m_volume/100.0, NULL);
+ }
- if (!m_muted && m_playbin)
- g_object_set(G_OBJECT(m_playbin), "volume", m_volume/100.0, NULL);
+ emit volumeChanged(m_volume);
+ }
}
void QGstreamerPlayerSession::setMuted(bool muted)
{
- m_muted = muted;
-
- g_object_set(G_OBJECT(m_playbin), "volume", (m_muted ? 0 : m_volume/100.0), NULL);
+ if (m_muted != muted) {
+ m_muted = muted;
- emit mutedStateChanged(m_muted);
+#ifdef USE_PLAYBIN2
+ g_object_set(G_OBJECT(m_playbin), "mute", m_muted, NULL);
+#else
+ g_object_set(G_OBJECT(m_playbin), "volume", (m_muted ? 0 : m_volume/100.0), NULL);
+#endif
+ emit mutedStateChanged(m_muted);
+ }
}
static void addTagToMap(const GstTagList *list,
@@ -385,14 +414,6 @@ void QGstreamerPlayerSession::setSeekable(bool seekable)
}
}
-void QGstreamerPlayerSession::setMediaStatus(QMediaPlayer::MediaStatus status)
-{
- if (m_mediaStatus != status) {
- m_mediaStatus = status;
- emit mediaStatusChanged(status);
- }
-}
-
bool QGstreamerPlayerSession::processSyncMessage(const QGstreamerMessage &message)
{
GstMessage* gm = message.rawMessage();
@@ -437,9 +458,6 @@ void QGstreamerPlayerSession::busMessage(const QGstreamerMessage &message)
if (GST_MESSAGE_SRC(gm) == GST_OBJECT_CAST(m_playbin)) {
switch (GST_MESSAGE_TYPE(gm)) {
- case GST_MESSAGE_DURATION:
- break;
-
case GST_MESSAGE_STATE_CHANGED:
{
GstState oldState;
@@ -459,24 +477,19 @@ void QGstreamerPlayerSession::busMessage(const QGstreamerMessage &message)
switch (newState) {
case GST_STATE_VOID_PENDING:
case GST_STATE_NULL:
- setMediaStatus(QMediaPlayer::UnknownMediaStatus);
setSeekable(false);
if (m_state != QMediaPlayer::StoppedState)
emit stateChanged(m_state = QMediaPlayer::StoppedState);
break;
case GST_STATE_READY:
- setMediaStatus(QMediaPlayer::LoadedMedia);
setSeekable(false);
if (m_state != QMediaPlayer::StoppedState)
emit stateChanged(m_state = QMediaPlayer::StoppedState);
break;
case GST_STATE_PAUSED:
- //don't emit state changes for intermediate states
- if (m_state != QMediaPlayer::PausedState && pending == GST_STATE_VOID_PENDING)
+ if (m_state != QMediaPlayer::PausedState)
emit stateChanged(m_state = QMediaPlayer::PausedState);
- setMediaStatus(QMediaPlayer::LoadedMedia);
-
//check for seekable
if (oldState == GST_STATE_READY) {
/*
@@ -510,17 +523,13 @@ void QGstreamerPlayerSession::busMessage(const QGstreamerMessage &message)
if (m_state != QMediaPlayer::PlayingState)
emit stateChanged(m_state = QMediaPlayer::PlayingState);
+
break;
}
}
break;
case GST_MESSAGE_EOS:
- if (m_state != QMediaPlayer::StoppedState)
- emit stateChanged(m_state = QMediaPlayer::StoppedState);
-
- setMediaStatus(QMediaPlayer::EndOfMedia);
-
emit playbackFinished();
break;
@@ -543,7 +552,11 @@ void QGstreamerPlayerSession::busMessage(const QGstreamerMessage &message)
case GST_MESSAGE_INFO:
break;
case GST_MESSAGE_BUFFERING:
- setMediaStatus(QMediaPlayer::BufferingMedia);
+ {
+ int progress = 0;
+ gst_message_parse_buffering(gm, &progress);
+ emit bufferingProgressChanged(progress);
+ }
break;
case GST_MESSAGE_STATE_DIRTY:
case GST_MESSAGE_STEP_DONE:
@@ -553,8 +566,32 @@ void QGstreamerPlayerSession::busMessage(const QGstreamerMessage &message)
case GST_MESSAGE_STRUCTURE_CHANGE:
case GST_MESSAGE_APPLICATION:
case GST_MESSAGE_ELEMENT:
+ break;
case GST_MESSAGE_SEGMENT_START:
+ {
+ const GstStructure *structure = gst_message_get_structure(gm);
+ qint64 position = g_value_get_int64(gst_structure_get_value(structure, "position"));
+ position /= 1000000;
+ m_lastPosition = position;
+ emit positionChanged(position);
+ }
+ break;
case GST_MESSAGE_SEGMENT_DONE:
+ break;
+ case GST_MESSAGE_DURATION:
+ {
+ GstFormat format = GST_FORMAT_TIME;
+ gint64 duration = 0;
+
+ if (gst_element_query_duration(m_playbin, &format, &duration)) {
+ int newDuration = duration / 1000000;
+ if (m_duration != newDuration) {
+ m_duration = newDuration;
+ emit durationChanged(m_duration);
+ }
+ }
+ }
+ break;
case GST_MESSAGE_LATENCY:
#if (GST_VERSION_MAJOR >= 0) && (GST_VERSION_MINOR >= 10) && (GST_VERSION_MICRO >= 13)
case GST_MESSAGE_ASYNC_START:
@@ -601,7 +638,7 @@ void QGstreamerPlayerSession::getStreamsInfo()
haveAudio = audioStreamsCount > 0;
haveVideo = videoStreamsCount > 0;
- m_playbin2StreamOffset[QMediaStreamsControl::AudioStream] = 0;
+ /*m_playbin2StreamOffset[QMediaStreamsControl::AudioStream] = 0;
m_playbin2StreamOffset[QMediaStreamsControl::VideoStream] = audioStreamsCount;
m_playbin2StreamOffset[QMediaStreamsControl::SubPictureStream] = audioStreamsCount+videoStreamsCount;
@@ -645,7 +682,9 @@ void QGstreamerPlayerSession::getStreamsInfo()
}
m_streamProperties.append(streamProperties);
+
}
+ */
#else
enum {
@@ -710,3 +749,6 @@ void QGstreamerPlayerSession::getStreamsInfo()
emit streamsChanged();
}
+
+QT_END_NAMESPACE
+
diff --git a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.h b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.h
index d650ec7..edfec5b 100644
--- a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.h
+++ b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.h
@@ -71,7 +71,6 @@ public:
QUrl url() const;
QMediaPlayer::State state() const { return m_state; }
- QMediaPlayer::MediaStatus mediaStatus() const { return m_mediaStatus; }
qint64 duration() const;
qint64 position() const;
@@ -105,11 +104,11 @@ public:
public slots:
void load(const QUrl &url);
- void play();
- void pause();
+ bool play();
+ bool pause();
void stop();
- void seek(qint64 pos);
+ bool seek(qint64 pos);
void setVolume(int volume);
void setMuted(bool muted);
@@ -118,7 +117,6 @@ signals:
void durationChanged(qint64 duration);
void positionChanged(qint64 position);
void stateChanged(QMediaPlayer::State state);
- void mediaStatusChanged(QMediaPlayer::MediaStatus mediaStatus);
void volumeChanged(int volume);
void mutedStateChanged(bool muted);
void audioAvailableChanged(bool audioAvailable);
@@ -137,11 +135,8 @@ private slots:
void setSeekable(bool);
private:
- void setMediaStatus(QMediaPlayer::MediaStatus);
-
QUrl m_url;
QMediaPlayer::State m_state;
- QMediaPlayer::MediaStatus m_mediaStatus;
QGstreamerBusHelper* m_busHelper;
GstElement* m_playbin;
GstElement* m_nullVideoOutput;
diff --git a/src/plugins/mediaservices/gstreamer/qgstreamerbushelper.cpp b/src/plugins/mediaservices/gstreamer/qgstreamerbushelper.cpp
index 59ae5be..5049fa1 100644
--- a/src/plugins/mediaservices/gstreamer/qgstreamerbushelper.cpp
+++ b/src/plugins/mediaservices/gstreamer/qgstreamerbushelper.cpp
@@ -45,6 +45,7 @@
#include "qgstreamerbushelper.h"
+QT_BEGIN_NAMESPACE
#ifndef QT_NO_GLIB
class QGstreamerBusHelperPrivate : public QObject
@@ -200,4 +201,6 @@ void QGstreamerBusHelper::installSyncEventFilter(QGstreamerSyncEventFilter *filt
d->filter = filter;
}
+QT_END_NAMESPACE
+
#include "qgstreamerbushelper.moc"
diff --git a/src/plugins/mediaservices/gstreamer/qgstreamermessage.cpp b/src/plugins/mediaservices/gstreamer/qgstreamermessage.cpp
index 13a2454..d52aa75 100644
--- a/src/plugins/mediaservices/gstreamer/qgstreamermessage.cpp
+++ b/src/plugins/mediaservices/gstreamer/qgstreamermessage.cpp
@@ -44,11 +44,13 @@
#include "qgstreamermessage.h"
+QT_BEGIN_NAMESPACE
+
static int wuchi = qRegisterMetaType<QGstreamerMessage>();
/*!
- \class gstreamer::QGstreamerMessage
+ \class QGstreamerMessage
\internal
*/
@@ -91,3 +93,5 @@ QGstreamerMessage& QGstreamerMessage::operator=(QGstreamerMessage const& rhs)
return *this;
}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/mediaservices/gstreamer/qgstreamervideoinputdevicecontrol.cpp b/src/plugins/mediaservices/gstreamer/qgstreamervideoinputdevicecontrol.cpp
index 94ae847..406cefe11 100644
--- a/src/plugins/mediaservices/gstreamer/qgstreamervideoinputdevicecontrol.cpp
+++ b/src/plugins/mediaservices/gstreamer/qgstreamervideoinputdevicecontrol.cpp
@@ -57,6 +57,9 @@
#include <sys/mman.h>
#include <linux/videodev2.h>
+
+QT_BEGIN_NAMESPACE
+
QGstreamerVideoInputDeviceControl::QGstreamerVideoInputDeviceControl(QObject *parent)
:QVideoDeviceControl(parent), m_selectedDevice(0)
{
@@ -155,3 +158,6 @@ void QGstreamerVideoInputDeviceControl::update()
::close(fd);
}
}
+
+QT_END_NAMESPACE
+
diff --git a/src/plugins/mediaservices/gstreamer/qgstreamervideooutputcontrol.cpp b/src/plugins/mediaservices/gstreamer/qgstreamervideooutputcontrol.cpp
index decf524..f406bff 100644
--- a/src/plugins/mediaservices/gstreamer/qgstreamervideooutputcontrol.cpp
+++ b/src/plugins/mediaservices/gstreamer/qgstreamervideooutputcontrol.cpp
@@ -41,6 +41,8 @@
#include "qgstreamervideooutputcontrol.h"
+QT_BEGIN_NAMESPACE
+
QGstreamerVideoOutputControl::QGstreamerVideoOutputControl(QObject *parent)
: QVideoOutputControl(parent)
, m_output(NoOutput)
@@ -70,3 +72,6 @@ void QGstreamerVideoOutputControl::setOutput(Output output)
if (m_output != output)
emit outputChanged(m_output = output);
}
+
+QT_END_NAMESPACE
+
diff --git a/src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.cpp b/src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.cpp
index 6c6c802..846a24a 100644
--- a/src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.cpp
+++ b/src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.cpp
@@ -46,6 +46,8 @@
#include "qx11videosurface.h"
+QT_BEGIN_NAMESPACE
+
QGstreamerVideoOverlay::QGstreamerVideoOverlay(QObject *parent)
: QVideoWindowControl(parent)
, m_surface(new QX11VideoSurface)
@@ -208,3 +210,6 @@ void QGstreamerVideoOverlay::setScaledDisplayRect()
break;
};
}
+
+QT_END_NAMESPACE
+
diff --git a/src/plugins/mediaservices/gstreamer/qgstreamervideorenderer.cpp b/src/plugins/mediaservices/gstreamer/qgstreamervideorenderer.cpp
index 25a53cf..1f03990 100644
--- a/src/plugins/mediaservices/gstreamer/qgstreamervideorenderer.cpp
+++ b/src/plugins/mediaservices/gstreamer/qgstreamervideorenderer.cpp
@@ -47,6 +47,9 @@
#include <gst/gst.h>
+
+QT_BEGIN_NAMESPACE
+
QGstreamerVideoRenderer::QGstreamerVideoRenderer(QObject *parent)
:QVideoRendererControl(parent),m_videoSink(0)
{
@@ -80,3 +83,6 @@ void QGstreamerVideoRenderer::setSurface(QAbstractVideoSurface *surface)
m_surface = surface;
}
+QT_END_NAMESPACE
+
+
diff --git a/src/plugins/mediaservices/gstreamer/qgstreamervideorendererinterface.cpp b/src/plugins/mediaservices/gstreamer/qgstreamervideorendererinterface.cpp
index 0a1c20d..886a064 100644
--- a/src/plugins/mediaservices/gstreamer/qgstreamervideorendererinterface.cpp
+++ b/src/plugins/mediaservices/gstreamer/qgstreamervideorendererinterface.cpp
@@ -41,6 +41,12 @@
#include "qgstreamervideorendererinterface.h"
+
+QT_BEGIN_NAMESPACE
+
QGstreamerVideoRendererInterface::~QGstreamerVideoRendererInterface()
{
}
+
+QT_END_NAMESPACE
+
diff --git a/src/plugins/mediaservices/gstreamer/qgstreamervideorendererinterface.h b/src/plugins/mediaservices/gstreamer/qgstreamervideorendererinterface.h
index 39deee8..c63a757 100644
--- a/src/plugins/mediaservices/gstreamer/qgstreamervideorendererinterface.h
+++ b/src/plugins/mediaservices/gstreamer/qgstreamervideorendererinterface.h
@@ -59,11 +59,11 @@ public:
virtual void precessNewStream() {}
};
-QT_END_NAMESPACE
-
#define QGstreamerVideoRendererInterface_iid "com.nokia.Qt.QGstreamerVideoRendererInterface/1.0"
Q_DECLARE_INTERFACE(QGstreamerVideoRendererInterface, QGstreamerVideoRendererInterface_iid)
+QT_END_NAMESPACE
+
QT_END_HEADER
#endif
diff --git a/src/plugins/mediaservices/gstreamer/qgstreamervideowidget.cpp b/src/plugins/mediaservices/gstreamer/qgstreamervideowidget.cpp
index 1d8d43d..47fb451 100644
--- a/src/plugins/mediaservices/gstreamer/qgstreamervideowidget.cpp
+++ b/src/plugins/mediaservices/gstreamer/qgstreamervideowidget.cpp
@@ -51,6 +51,9 @@
#include <gst/interfaces/xoverlay.h>
#include <gst/interfaces/propertyprobe.h>
+
+QT_BEGIN_NAMESPACE
+
class QGstreamerVideoWidget : public QWidget
{
public:
@@ -320,3 +323,6 @@ void QGstreamerVideoWidgetControl::setSaturation(int saturation)
emit saturationChanged(saturation);
}
}
+
+QT_END_NAMESPACE
+
diff --git a/src/plugins/mediaservices/gstreamer/qgstvideobuffer.cpp b/src/plugins/mediaservices/gstreamer/qgstvideobuffer.cpp
index 9519db6..76289bf 100644
--- a/src/plugins/mediaservices/gstreamer/qgstvideobuffer.cpp
+++ b/src/plugins/mediaservices/gstreamer/qgstvideobuffer.cpp
@@ -42,6 +42,8 @@
#include "qgstvideobuffer.h"
+QT_BEGIN_NAMESPACE
+
QGstVideoBuffer::QGstVideoBuffer(GstBuffer *buffer, int bytesPerLine)
: QAbstractVideoBuffer(NoHandle)
, m_buffer(buffer)
@@ -95,3 +97,5 @@ void QGstVideoBuffer::unmap()
m_mode = NotMapped;
}
+QT_END_NAMESPACE
+
diff --git a/src/plugins/mediaservices/gstreamer/qgstxvimagebuffer.cpp b/src/plugins/mediaservices/gstreamer/qgstxvimagebuffer.cpp
index 5b99817..b2e633d 100644
--- a/src/plugins/mediaservices/gstreamer/qgstxvimagebuffer.cpp
+++ b/src/plugins/mediaservices/gstreamer/qgstxvimagebuffer.cpp
@@ -47,6 +47,9 @@
#include "qgstxvimagebuffer.h"
#include "qvideosurfacegstsink.h"
+
+QT_BEGIN_NAMESPACE
+
GstBufferClass *QGstXvImageBuffer::parent_class = NULL;
GType QGstXvImageBuffer::get_type(void)
@@ -274,3 +277,6 @@ void QGstXvImageBufferPool::destroyBuffer(QGstXvImageBuffer *xvBuffer)
if (m_imagesToDestroy.size() == 1)
QMetaObject::invokeMethod(this, "queuedDestroy", Qt::QueuedConnection);
}
+
+QT_END_NAMESPACE
+
diff --git a/src/plugins/mediaservices/gstreamer/qgstxvimagebuffer.h b/src/plugins/mediaservices/gstreamer/qgstxvimagebuffer.h
index beeb01f..30f77d1 100644
--- a/src/plugins/mediaservices/gstreamer/qgstxvimagebuffer.h
+++ b/src/plugins/mediaservices/gstreamer/qgstxvimagebuffer.h
@@ -56,14 +56,13 @@
#include <X11/extensions/Xv.h>
#include <X11/extensions/Xvlib.h>
-
#include <gst/gst.h>
+
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-
class QGstXvImageBufferPool;
struct QGstXvImageBuffer {
@@ -82,7 +81,6 @@ struct QGstXvImageBuffer {
const QAbstractVideoBuffer::HandleType XvHandleType = QAbstractVideoBuffer::HandleType(4);
-Q_DECLARE_METATYPE(XvImage*)
class QGstXvImageBufferPool : public QObject {
@@ -125,6 +123,8 @@ private:
QT_END_NAMESPACE
+Q_DECLARE_METATYPE(::XvImage*)
+
QT_END_HEADER
diff --git a/src/plugins/mediaservices/gstreamer/qvideosurfacegstsink.cpp b/src/plugins/mediaservices/gstreamer/qvideosurfacegstsink.cpp
index 402a225..76d87ce 100644
--- a/src/plugins/mediaservices/gstreamer/qvideosurfacegstsink.cpp
+++ b/src/plugins/mediaservices/gstreamer/qvideosurfacegstsink.cpp
@@ -52,8 +52,11 @@
#include "qgstxvimagebuffer.h"
+
Q_DECLARE_METATYPE(QVideoSurfaceFormat)
+QT_BEGIN_NAMESPACE
+
QVideoSurfaceGstDelegate::QVideoSurfaceGstDelegate(QAbstractVideoSurface *surface)
: m_surface(surface)
, m_renderReturn(GST_FLOW_ERROR)
@@ -691,3 +694,6 @@ GstFlowReturn QVideoSurfaceGstSink::render(GstBaseSink *base, GstBuffer *buffer)
return sink->delegate->render(buffer);
}
+QT_END_NAMESPACE
+
+
diff --git a/src/plugins/mediaservices/gstreamer/qx11videosurface.cpp b/src/plugins/mediaservices/gstreamer/qx11videosurface.cpp
index 6e282ff..cbd5a76 100644
--- a/src/plugins/mediaservices/gstreamer/qx11videosurface.cpp
+++ b/src/plugins/mediaservices/gstreamer/qx11videosurface.cpp
@@ -46,7 +46,9 @@
#include "qx11videosurface.h"
-Q_DECLARE_METATYPE(XvImage*);
+Q_DECLARE_METATYPE(::XvImage*);
+
+QT_BEGIN_NAMESPACE
static QAbstractVideoBuffer::HandleType XvHandleType = QAbstractVideoBuffer::HandleType(4);
@@ -507,3 +509,5 @@ void QX11VideoSurface::querySupportedFormats()
XFree(attributes);
}
}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/mediaservices/mediaservices.pro b/src/plugins/mediaservices/mediaservices.pro
index d84b276..19d678b 100644
--- a/src/plugins/mediaservices/mediaservices.pro
+++ b/src/plugins/mediaservices/mediaservices.pro
@@ -1,7 +1,7 @@
TEMPLATE = subdirs
contains(QT_CONFIG, mediaservice) {
- win32:!wince: SUBDIRS += directshow
+ win32:!wince*: SUBDIRS += directshow
mac: SUBDIRS += qt7
diff --git a/src/plugins/mediaservices/qt7/mediaplayer/qt7playermetadata.mm b/src/plugins/mediaservices/qt7/mediaplayer/qt7playermetadata.mm
index a14981a..59d01a2 100644
--- a/src/plugins/mediaservices/qt7/mediaplayer/qt7playermetadata.mm
+++ b/src/plugins/mediaservices/qt7/mediaplayer/qt7playermetadata.mm
@@ -132,15 +132,19 @@ static OSStatus readMetaValue(QTMetaDataRef metaDataRef, QTMetaDataItem item, QT
UInt32 propFlags;
OSStatus err = QTMetaDataGetItemPropertyInfo(metaDataRef, item, propClass, id, &type, &propSize, &propFlags);
-
- *value = malloc(propSize);
-
- err = QTMetaDataGetItemProperty(metaDataRef, item, propClass, id, propSize, *value, size);
-
- if (type == 'code' || type == 'itsk' || type == 'itlk') {
- // convert from native endian to big endian
- OSTypePtr pType = (OSTypePtr)*value;
- *pType = EndianU32_NtoB(*pType);
+ if (err == noErr) {
+ *value = malloc(propSize);
+ if (*value != 0) {
+ err = QTMetaDataGetItemProperty(metaDataRef, item, propClass, id, propSize, *value, size);
+
+ if (err == noErr && (type == 'code' || type == 'itsk' || type == 'itlk')) {
+ // convert from native endian to big endian
+ OSTypePtr pType = (OSTypePtr)*value;
+ *pType = EndianU32_NtoB(*pType);
+ }
+ }
+ else
+ return -1;
}
return err;
@@ -153,10 +157,14 @@ static UInt32 getMetaType(QTMetaDataRef metaDataRef, QTMetaDataItem item)
OSStatus err = readMetaValue(
metaDataRef, item, kPropertyClass_MetaDataItem, kQTMetaDataItemPropertyID_DataType, &value, &ignore);
- UInt32 type = *((UInt32 *) value);
- if (value)
- free(value);
- return type;
+ if (err == noErr) {
+ UInt32 type = *((UInt32 *) value);
+ if (value)
+ free(value);
+ return type;
+ }
+
+ return 0;
}
static QString cFStringToQString(CFStringRef str)
@@ -179,23 +187,26 @@ static QString getMetaValue(QTMetaDataRef metaDataRef, QTMetaDataItem item, SInt
QTPropertyValuePtr value = 0;
ByteCount size = 0;
OSStatus err = readMetaValue(metaDataRef, item, kPropertyClass_MetaDataItem, id, &value, &size);
-
QString string;
- UInt32 dataType = getMetaType(metaDataRef, item);
- switch (dataType){
- case kQTMetaDataTypeUTF8:
- case kQTMetaDataTypeMacEncodedText:
- string = cFStringToQString(CFStringCreateWithBytes(0, (UInt8*)value, size, kCFStringEncodingUTF8, false));
- break;
- case kQTMetaDataTypeUTF16BE:
- string = cFStringToQString(CFStringCreateWithBytes(0, (UInt8*)value, size, kCFStringEncodingUTF16BE, false));
- break;
- default:
- break;
+
+ if (err == noErr) {
+ UInt32 dataType = getMetaType(metaDataRef, item);
+ switch (dataType){
+ case kQTMetaDataTypeUTF8:
+ case kQTMetaDataTypeMacEncodedText:
+ string = cFStringToQString(CFStringCreateWithBytes(0, (UInt8*)value, size, kCFStringEncodingUTF8, false));
+ break;
+ case kQTMetaDataTypeUTF16BE:
+ string = cFStringToQString(CFStringCreateWithBytes(0, (UInt8*)value, size, kCFStringEncodingUTF16BE, false));
+ break;
+ default:
+ break;
+ }
+
+ if (value)
+ free(value);
}
- if (value)
- free(value);
return string;
}
@@ -234,11 +245,13 @@ void QT7PlayerMetaDataControl::updateTags()
#ifdef QUICKTIME_C_API_AVAILABLE
QTMetaDataRef metaDataRef;
OSStatus err = QTCopyMovieMetaData([movie quickTimeMovie], &metaDataRef);
-
- readFormattedData(metaDataRef, kQTMetaDataStorageFormatUserData, metaMap);
- readFormattedData(metaDataRef, kQTMetaDataStorageFormatQuickTime, metaMap);
- readFormattedData(metaDataRef, kQTMetaDataStorageFormatiTunes, metaMap);
+ if (err == noErr) {
+ readFormattedData(metaDataRef, kQTMetaDataStorageFormatUserData, metaMap);
+ readFormattedData(metaDataRef, kQTMetaDataStorageFormatQuickTime, metaMap);
+ readFormattedData(metaDataRef, kQTMetaDataStorageFormatiTunes, metaMap);
+ }
#else
+ AutoReleasePool pool;
NSString *name = [movie attributeForKey:@"QTMovieDisplayNameAttribute"];
metaMap.insert(QLatin1String("nam"), QString::fromUtf8([name UTF8String]));
#endif // QUICKTIME_C_API_AVAILABLE
diff --git a/src/plugins/mediaservices/qt7/mediaplayer/qt7playerservice.mm b/src/plugins/mediaservices/qt7/mediaplayer/qt7playerservice.mm
index faf75d1..205e862 100644
--- a/src/plugins/mediaservices/qt7/mediaplayer/qt7playerservice.mm
+++ b/src/plugins/mediaservices/qt7/mediaplayer/qt7playerservice.mm
@@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE
QT7PlayerService::QT7PlayerService(QObject *parent):
QMediaService(parent)
{
- m_session = new QT7PlayerSession;
+ m_session = new QT7PlayerSession(this);
m_control = new QT7PlayerControl(this);
m_control->setSession(m_session);
@@ -102,6 +102,7 @@ QT7PlayerService::QT7PlayerService(QObject *parent):
QT7PlayerService::~QT7PlayerService()
{
+ m_session->setVideoOutput(0);
}
QMediaControl *QT7PlayerService::control(const char *name) const
diff --git a/src/plugins/mediaservices/qt7/mediaplayer/qt7playersession.h b/src/plugins/mediaservices/qt7/mediaplayer/qt7playersession.h
index 4742e2e..0ba3041 100644
--- a/src/plugins/mediaservices/qt7/mediaplayer/qt7playersession.h
+++ b/src/plugins/mediaservices/qt7/mediaplayer/qt7playersession.h
@@ -107,7 +107,7 @@ public slots:
void setMuted(bool muted);
void processEOS();
- void processStateChange();
+ void processLoadStateChange();
void processVolumeChange();
void processNaturalSizeChange();
@@ -138,6 +138,10 @@ private:
bool m_muted;
int m_volume;
qreal m_rate;
+
+ qint64 m_duration;
+ bool m_videoAvailable;
+ bool m_audioAvailable;
};
QT_END_NAMESPACE
diff --git a/src/plugins/mediaservices/qt7/mediaplayer/qt7playersession.mm b/src/plugins/mediaservices/qt7/mediaplayer/qt7playersession.mm
index 3f198b9..d83c0e3 100644
--- a/src/plugins/mediaservices/qt7/mediaplayer/qt7playersession.mm
+++ b/src/plugins/mediaservices/qt7/mediaplayer/qt7playersession.mm
@@ -48,10 +48,13 @@
#include "qt7playercontrol.h"
#include "qt7videooutputcontrol.h"
+#include <QtNetwork/qnetworkcookie.h>
#include <QtMultimedia/qmediaplaylistnavigator.h>
#include <CoreFoundation/CoreFoundation.h>
+#include <Foundation/Foundation.h>
+#include <QtCore/qdatetime.h>
#include <QtCore/qurl.h>
#include <QtCore/qdebug.h>
@@ -65,7 +68,9 @@
- (QTMovieObserver *) initWithPlayerSession:(QT7PlayerSession*)session;
- (void) setMovie:(QTMovie *)movie;
- (void) processEOS:(NSNotification *)notification;
-- (void) processStateChange:(NSNotification *)notification;
+- (void) processLoadStateChange:(NSNotification *)notification;
+- (void) processVolumeChange:(NSNotification *)notification;
+- (void) processNaturalSizeChange :(NSNotification *)notification;
@end
@implementation QTMovieObserver
@@ -98,7 +103,7 @@
object:m_movie];
[[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(processStateChange:)
+ selector:@selector(processLoadStateChange:)
name:QTMovieLoadStateDidChangeNotification
object:m_movie];
@@ -126,10 +131,10 @@
m_session->processEOS();
}
-- (void) processStateChange:(NSNotification *)notification
+- (void) processLoadStateChange:(NSNotification *)notification
{
Q_UNUSED(notification);
- m_session->processStateChange();
+ m_session->processLoadStateChange();
}
- (void) processVolumeChange:(NSNotification *)notification
@@ -164,6 +169,9 @@ QT7PlayerSession::QT7PlayerSession(QObject *parent)
, m_muted(false)
, m_volume(100)
, m_rate(1.0)
+ , m_duration(0)
+ , m_videoAvailable(false)
+ , m_audioAvailable(false)
{
m_movieObserver = [[QTMovieObserver alloc] initWithPlayerSession:this];
}
@@ -172,6 +180,7 @@ QT7PlayerSession::~QT7PlayerSession()
{
[(QTMovieObserver*)m_movieObserver setMovie:nil];
[(QTMovieObserver*)m_movieObserver release];
+ [(QTMovie*)m_QTMovie release];
}
void *QT7PlayerSession::movie() const
@@ -365,17 +374,37 @@ void QT7PlayerSession::setMedia(const QMediaContent &content, QIODevice *stream)
m_mediaStream = stream;
m_mediaStatus = QMediaPlayer::NoMedia;
- QUrl url;
+ QNetworkRequest request;
if (!content.isNull())
- url = content.canonicalUrl();
+ request = content.canonicalResource().request();
else
return;
-// qDebug() << "Open media" << url;
+ QVariant cookies = request.header(QNetworkRequest::CookieHeader);
+ if (cookies.isValid()) {
+ NSHTTPCookieStorage *store = [NSHTTPCookieStorage sharedHTTPCookieStorage];
+ QList<QNetworkCookie> cookieList = cookies.value<QList<QNetworkCookie> >();
+
+ foreach (const QNetworkCookie &requestCookie, cookieList) {
+ NSMutableDictionary *p = [NSMutableDictionary dictionaryWithObjectsAndKeys:
+ (NSString*)qString2CFStringRef(requestCookie.name()), NSHTTPCookieName,
+ (NSString*)qString2CFStringRef(requestCookie.value()), NSHTTPCookieValue,
+ (NSString*)qString2CFStringRef(requestCookie.domain()), NSHTTPCookieDomain,
+ (NSString*)qString2CFStringRef(requestCookie.path()), NSHTTPCookiePath,
+ nil
+ ];
+ if (requestCookie.isSessionCookie())
+ [p setObject:[NSString stringWithUTF8String:"TRUE"] forKey:NSHTTPCookieDiscard];
+ else
+ [p setObject:[NSDate dateWithTimeIntervalSince1970:requestCookie.expirationDate().toTime_t()] forKey:NSHTTPCookieExpires];
+
+ [store setCookie:[NSHTTPCookie cookieWithProperties:p]];
+ }
+ }
NSError *err = 0;
- NSString *urlString = (NSString *)qString2CFStringRef(url.toString());
+ NSString *urlString = (NSString *)qString2CFStringRef(request.url().toString());
NSDictionary *attr = [NSDictionary dictionaryWithObjectsAndKeys:
[NSURL URLWithString:urlString], QTMovieURLAttribute,
@@ -400,7 +429,7 @@ void QT7PlayerSession::setMedia(const QMediaContent &content, QIODevice *stream)
m_videoOutput->setMovie(m_QTMovie);
m_videoOutput->setEnabled(true);
}
- processStateChange();
+ processLoadStateChange();
[(QTMovie*)m_QTMovie setMuted:m_muted];
setVolume(m_volume);
@@ -432,8 +461,11 @@ void QT7PlayerSession::processEOS()
emit mediaStatusChanged(m_mediaStatus);
}
-void QT7PlayerSession::processStateChange()
+void QT7PlayerSession::processLoadStateChange()
{
+ if (!m_QTMovie)
+ return;
+
signed long state = [[(QTMovie*)m_QTMovie attributeForKey:QTMovieLoadStateAttribute]
longValue];
// qDebug() << "Moview load state changed:" << state;
@@ -461,32 +493,30 @@ void QT7PlayerSession::processStateChange()
if (state == kMovieLoadStateError) {
newStatus = QMediaPlayer::InvalidMedia;
- emit error(QMediaPlayer::FormatError, tr("Playback failed"));
+ emit error(QMediaPlayer::FormatError, tr("Failed to load media"));
+ emit stateChanged(m_state = QMediaPlayer::StoppedState);
}
- if (newStatus != m_mediaStatus) {
- switch (newStatus) {
- case QMediaPlayer::BufferedMedia:
- case QMediaPlayer::BufferingMedia:
- //delayed playback start is necessary for network sources
- if (m_state == QMediaPlayer::PlayingState) {
- QMetaObject::invokeMethod(this, "play", Qt::QueuedConnection);
- }
- //fall
- case QMediaPlayer::LoadedMedia:
- case QMediaPlayer::LoadingMedia:
- emit durationChanged(duration());
- emit audioAvailableChanged(isAudioAvailable());
- emit videoAvailableChanged(isVideoAvailable());
- break;
- case QMediaPlayer::InvalidMedia:
- emit stateChanged(m_state = QMediaPlayer::StoppedState);
- default:
- break;
- }
+ if (state >= kMovieLoadStatePlayable &&
+ m_state == QMediaPlayer::PlayingState &&
+ [(QTMovie*)m_QTMovie rate] == 0) {
+ QMetaObject::invokeMethod(this, "play", Qt::QueuedConnection);
+ }
- emit mediaStatusChanged(m_mediaStatus = newStatus);
+ if (state >= kMovieLoadStateLoaded) {
+ qint64 currentDuration = duration();
+ if (m_duration != currentDuration)
+ emit durationChanged(m_duration = currentDuration);
+
+ if (m_audioAvailable != isAudioAvailable())
+ emit audioAvailableChanged(m_audioAvailable = !m_audioAvailable);
+
+ if (m_videoAvailable != isVideoAvailable())
+ emit videoAvailableChanged(m_videoAvailable = !m_videoAvailable);
}
+
+ if (newStatus != m_mediaStatus)
+ emit mediaStatusChanged(m_mediaStatus = newStatus);
}
void QT7PlayerSession::processVolumeChange()
diff --git a/src/plugins/mediaservices/qt7/qt7movierenderer.mm b/src/plugins/mediaservices/qt7/qt7movierenderer.mm
index 6b9fd21..1c1f5e4 100644
--- a/src/plugins/mediaservices/qt7/qt7movierenderer.mm
+++ b/src/plugins/mediaservices/qt7/qt7movierenderer.mm
@@ -58,6 +58,8 @@
QT_BEGIN_NAMESPACE
+//#define USE_MAIN_MONITOR_COLOR_SPACE 1
+
class CVGLTextureVideoBuffer : public QAbstractVideoBuffer
{
public:
@@ -233,7 +235,24 @@ bool QT7MovieRenderer::createPixelBufferVisualContext()
&kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
CFDictionarySetValue(visualContextOptions, kQTVisualContextPixelBufferAttributesKey, pixelBufferOptions);
- CFDictionarySetValue(visualContextOptions, kQTVisualContextWorkingColorSpaceKey, CGColorSpaceCreateDeviceRGB());
+
+ CGColorSpaceRef colorSpace = NULL;
+
+#if USE_MAIN_MONITOR_COLOR_SPACE
+ CMProfileRef sysprof = NULL;
+
+ // Get the Systems Profile for the main display
+ if (CMGetSystemProfile(&sysprof) == noErr) {
+ // Create a colorspace with the systems profile
+ colorSpace = CGColorSpaceCreateWithPlatformColorSpace(sysprof);
+ CMCloseProfile(sysprof);
+ }
+#endif
+
+ if (!colorSpace)
+ colorSpace = CGColorSpaceCreateDeviceRGB();
+
+ CFDictionarySetValue(visualContextOptions, kQTVisualContextOutputColorSpaceKey, colorSpace);
OSStatus err = QTPixelBufferContextCreate(kCFAllocatorDefault,
visualContextOptions,
diff --git a/src/plugins/mediaservices/qt7/qt7movievideowidget.mm b/src/plugins/mediaservices/qt7/qt7movievideowidget.mm
index 4043330..00ceffc 100644
--- a/src/plugins/mediaservices/qt7/qt7movievideowidget.mm
+++ b/src/plugins/mediaservices/qt7/qt7movievideowidget.mm
@@ -199,7 +199,6 @@ QT7MovieVideoWidget::QT7MovieVideoWidget(QObject *parent)
}
}
-
bool QT7MovieVideoWidget::createVisualContext()
{
#ifdef QUICKTIME_C_API_AVAILABLE
@@ -210,8 +209,20 @@ bool QT7MovieVideoWidget::createVisualContext()
NSOpenGLPixelFormat *nsglPixelFormat = [NSOpenGLView defaultPixelFormat];
CGLPixelFormatObj cglPixelFormat = static_cast<CGLPixelFormatObj>([nsglPixelFormat CGLPixelFormatObj]);
- CFTypeRef keys[] = { kQTVisualContextWorkingColorSpaceKey };
- CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
+ CFTypeRef keys[] = { kQTVisualContextOutputColorSpaceKey };
+ CGColorSpaceRef colorSpace = NULL;
+ CMProfileRef sysprof = NULL;
+
+ // Get the Systems Profile for the main display
+ if (CMGetSystemProfile(&sysprof) == noErr) {
+ // Create a colorspace with the systems profile
+ colorSpace = CGColorSpaceCreateWithPlatformColorSpace(sysprof);
+ CMCloseProfile(sysprof);
+ }
+
+ if (!colorSpace)
+ colorSpace = CGColorSpaceCreateDeviceRGB();
+
CFDictionaryRef textureContextAttributes = CFDictionaryCreate(kCFAllocatorDefault,
(const void **)keys,
(const void **)&colorSpace, 1,
diff --git a/src/plugins/mediaservices/qt7/qt7movieviewoutput.mm b/src/plugins/mediaservices/qt7/qt7movieviewoutput.mm
index b90470c..254af46 100644
--- a/src/plugins/mediaservices/qt7/qt7movieviewoutput.mm
+++ b/src/plugins/mediaservices/qt7/qt7movieviewoutput.mm
@@ -60,6 +60,7 @@
- (TransparentQTMovieView *) init;
- (void) setDrawRect:(QRect &)rect;
+- (CIImage *) view:(QTMovieView *)view willDisplayImage:(CIImage *)img;
- (void) setContrast:(qreal) contrast;
@end
@@ -201,7 +202,10 @@ void QT7MovieViewOutput::setMovie(void *movie)
void QT7MovieViewOutput::updateNaturalSize(const QSize &newSize)
{
- m_nativeSize = newSize;
+ if (m_nativeSize != newSize) {
+ m_nativeSize = newSize;
+ emit nativeSizeChanged();
+ }
}
WId QT7MovieViewOutput::winId() const
diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro
index 418fd81..730fdc5 100644
--- a/src/plugins/plugins.pro
+++ b/src/plugins/plugins.pro
@@ -12,6 +12,5 @@ embedded:SUBDIRS *= gfxdrivers decorations mousedrivers kbddrivers
symbian:SUBDIRS += s60
contains(QT_CONFIG, phonon): SUBDIRS *= phonon
contains(QT_CONFIG, multimedia): SUBDIRS *= audio mediaservices
-contains(QT_CONFIG, declarative): SUBDIRS *= qdeclarativemodules
diff --git a/src/plugins/qdeclarativemodules/multimedia/multimedia.cpp b/src/plugins/qdeclarativemodules/multimedia/multimedia.cpp
deleted file mode 100644
index 8becbf3..0000000
--- a/src/plugins/qdeclarativemodules/multimedia/multimedia.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtDeclarative/qdeclarativeextensionplugin.h>
-#include <QtDeclarative/qdeclarative.h>
-#include <QtMultimedia/multimediadeclarative.h>
-
-QT_BEGIN_NAMESPACE
-
-class QMultimediaQmlModule : public QDeclarativeExtensionPlugin
-{
- Q_OBJECT
-public:
- virtual void registerTypes(const char *uri)
- {
- QtMultimedia::qRegisterDeclarativeElements(uri);
- }
-};
-
-QT_END_NAMESPACE
-
-#include "multimedia.moc"
-
-Q_EXPORT_PLUGIN2(qmultimediaqmlmodule, QT_PREPEND_NAMESPACE(QMultimediaQmlModule));
-
diff --git a/src/plugins/qdeclarativemodules/multimedia/multimedia.pro b/src/plugins/qdeclarativemodules/multimedia/multimedia.pro
deleted file mode 100644
index d8ad18e..0000000
--- a/src/plugins/qdeclarativemodules/multimedia/multimedia.pro
+++ /dev/null
@@ -1,15 +0,0 @@
-TARGET = multimedia
-include(../../qpluginbase.pri)
-
-QT += multimedia declarative
-
-SOURCES += multimedia.cpp
-
-QTDIR_build:DESTDIR = $$QT_BUILD_TREE/imports/Qt/multimedia
-target.path = $$[QT_INSTALL_IMPORTS]/Qt/multimedia
-
-qmldir.files += $$QT_BUILD_TREE/imports/Qt/multimedia/qmldir
-qmldir.path += $$[QT_INSTALL_IMPORTS]/Qt/multimedia
-
-INSTALLS += target qmldir
-
diff --git a/src/plugins/qdeclarativemodules/qdeclarativemodules.pro b/src/plugins/qdeclarativemodules/qdeclarativemodules.pro
deleted file mode 100644
index 0a6f444..0000000
--- a/src/plugins/qdeclarativemodules/qdeclarativemodules.pro
+++ /dev/null
@@ -1,6 +0,0 @@
-TEMPLATE = subdirs
-
-SUBDIRS += widgets
-
-contains(QT_CONFIG, multimedia): SUBDIRS += multimedia
-
diff --git a/src/plugins/qdeclarativemodules/widgets/graphicslayouts.cpp b/src/plugins/qdeclarativemodules/widgets/graphicslayouts.cpp
deleted file mode 100644
index fc15ad2..0000000
--- a/src/plugins/qdeclarativemodules/widgets/graphicslayouts.cpp
+++ /dev/null
@@ -1,260 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "graphicslayouts_p.h"
-
-#include <QtGui/qgraphicswidget.h>
-#include <QtCore/qdebug.h>
-
-QT_BEGIN_NAMESPACE
-
-LinearLayoutAttached::LinearLayoutAttached(QObject *parent)
-: QObject(parent), _stretch(1), _alignment(Qt::AlignCenter)
-{
-}
-
-void LinearLayoutAttached::setStretchFactor(int f)
-{
- if (_stretch == f)
- return;
-
- _stretch = f;
- emit stretchChanged(reinterpret_cast<QGraphicsLayoutItem*>(parent()), _stretch);
-}
-
-void LinearLayoutAttached::setAlignment(Qt::Alignment a)
-{
- if (_alignment == a)
- return;
-
- _alignment = a;
- emit alignmentChanged(reinterpret_cast<QGraphicsLayoutItem*>(parent()), _alignment);
-}
-
-QGraphicsLinearLayoutStretchItemObject::QGraphicsLinearLayoutStretchItemObject(QObject *parent)
- : QObject(parent)
-{
-}
-
-QSizeF QGraphicsLinearLayoutStretchItemObject::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
-{
-Q_UNUSED(which);
-Q_UNUSED(constraint);
-return QSizeF();
-}
-
-
-QGraphicsLinearLayoutObject::QGraphicsLinearLayoutObject(QObject *parent)
-: QObject(parent)
-{
-}
-
-QGraphicsLinearLayoutObject::~QGraphicsLinearLayoutObject()
-{
-}
-
-void QGraphicsLinearLayoutObject::insertLayoutItem(int index, QGraphicsLayoutItem *item)
-{
-insertItem(index, item);
-
-//connect attached properties
-if (LinearLayoutAttached *obj = attachedProperties.value(item)) {
- setStretchFactor(item, obj->stretchFactor());
- setAlignment(item, obj->alignment());
- QObject::connect(obj, SIGNAL(stretchChanged(QGraphicsLayoutItem*,int)),
- this, SLOT(updateStretch(QGraphicsLayoutItem*,int)));
- QObject::connect(obj, SIGNAL(alignmentChanged(QGraphicsLayoutItem*,Qt::Alignment)),
- this, SLOT(updateAlignment(QGraphicsLayoutItem*,Qt::Alignment)));
- //### need to disconnect when widget is removed?
-}
-}
-
-//### is there a better way to do this?
-void QGraphicsLinearLayoutObject::clearChildren()
-{
-for (int i = 0; i < count(); ++i)
- removeAt(i);
-}
-
-void QGraphicsLinearLayoutObject::updateStretch(QGraphicsLayoutItem *item, int stretch)
-{
-QGraphicsLinearLayout::setStretchFactor(item, stretch);
-}
-
-void QGraphicsLinearLayoutObject::updateAlignment(QGraphicsLayoutItem *item, Qt::Alignment alignment)
-{
-QGraphicsLinearLayout::setAlignment(item, alignment);
-}
-
-QHash<QGraphicsLayoutItem*, LinearLayoutAttached*> QGraphicsLinearLayoutObject::attachedProperties;
-LinearLayoutAttached *QGraphicsLinearLayoutObject::qmlAttachedProperties(QObject *obj)
-{
-// ### This is not allowed - you must attach to any object
-if (!qobject_cast<QGraphicsLayoutItem*>(obj))
- return 0;
-LinearLayoutAttached *rv = new LinearLayoutAttached(obj);
-attachedProperties.insert(qobject_cast<QGraphicsLayoutItem*>(obj), rv);
-return rv;
-}
-
-//////////////////////////////////////////////////////////////////////////////////////////////////////
-// QGraphicsGridLayout-related classes
-//////////////////////////////////////////////////////////////////////////////////////////////////////
-GridLayoutAttached::GridLayoutAttached(QObject *parent)
-: QObject(parent), _row(-1), _column(-1), _rowspan(1), _colspan(1), _alignment(-1)
-{
-}
-
-void GridLayoutAttached::setRow(int r)
-{
- if (_row == r)
- return;
-
- _row = r;
- //emit rowChanged(reinterpret_cast<QGraphicsLayoutItem*>(parent()), _row);
-}
-
-void GridLayoutAttached::setColumn(int c)
-{
- if (_column == c)
- return;
-
- _column = c;
- //emit columnChanged(reinterpret_cast<QGraphicsLayoutItem*>(parent()), _column);
-}
-
-void GridLayoutAttached::setRowSpan(int rs)
-{
- if (_rowspan == rs)
- return;
-
- _rowspan = rs;
- //emit rowSpanChanged(reinterpret_cast<QGraphicsLayoutItem*>(parent()), _rowSpan);
-}
-
-void GridLayoutAttached::setColumnSpan(int cs)
-{
- if (_colspan == cs)
- return;
-
- _colspan = cs;
- //emit columnSpanChanged(reinterpret_cast<QGraphicsLayoutItem*>(parent()), _columnSpan);
-}
-
-void GridLayoutAttached::setAlignment(Qt::Alignment a)
-{
- if (_alignment == a)
- return;
-
- _alignment = a;
- //emit alignmentChanged(reinterpret_cast<QGraphicsLayoutItem*>(parent()), _alignment);
-}
-
-QGraphicsGridLayoutObject::QGraphicsGridLayoutObject(QObject *parent)
-: QObject(parent)
-{
-}
-
-QGraphicsGridLayoutObject::~QGraphicsGridLayoutObject()
-{
-}
-
-void QGraphicsGridLayoutObject::addWidget(QGraphicsWidget *wid)
-{
-//use attached properties
-if (QObject *obj = attachedProperties.value(qobject_cast<QGraphicsLayoutItem*>(wid))) {
- int row = static_cast<GridLayoutAttached *>(obj)->row();
- int column = static_cast<GridLayoutAttached *>(obj)->column();
- int rowSpan = static_cast<GridLayoutAttached *>(obj)->rowSpan();
- int columnSpan = static_cast<GridLayoutAttached *>(obj)->columnSpan();
- if (row == -1 || column == -1) {
- qWarning() << "Must set row and column for an item in a grid layout";
- return;
- }
- addItem(wid, row, column, rowSpan, columnSpan);
-}
-}
-
-void QGraphicsGridLayoutObject::addLayoutItem(QGraphicsLayoutItem *item)
-{
-//use attached properties
-if (GridLayoutAttached *obj = attachedProperties.value(item)) {
- int row = obj->row();
- int column = obj->column();
- int rowSpan = obj->rowSpan();
- int columnSpan = obj->columnSpan();
- Qt::Alignment alignment = obj->alignment();
- if (row == -1 || column == -1) {
- qWarning() << "Must set row and column for an item in a grid layout";
- return;
- }
- addItem(item, row, column, rowSpan, columnSpan);
- if (alignment != -1)
- setAlignment(item,alignment);
-}
-}
-
-//### is there a better way to do this?
-void QGraphicsGridLayoutObject::clearChildren()
-{
-for (int i = 0; i < count(); ++i)
- removeAt(i);
-}
-
-qreal QGraphicsGridLayoutObject::spacing() const
-{
-if (verticalSpacing() == horizontalSpacing())
- return verticalSpacing();
-return -1; //###
-}
-
-QHash<QGraphicsLayoutItem*, GridLayoutAttached*> QGraphicsGridLayoutObject::attachedProperties;
-GridLayoutAttached *QGraphicsGridLayoutObject::qmlAttachedProperties(QObject *obj)
-{
-// ### This is not allowed - you must attach to any object
-if (!qobject_cast<QGraphicsLayoutItem*>(obj))
- return 0;
-GridLayoutAttached *rv = new GridLayoutAttached(obj);
-attachedProperties.insert(qobject_cast<QGraphicsLayoutItem*>(obj), rv);
-return rv;
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/qdeclarativemodules/widgets/graphicslayouts_p.h b/src/plugins/qdeclarativemodules/widgets/graphicslayouts_p.h
deleted file mode 100644
index f9b9ae8..0000000
--- a/src/plugins/qdeclarativemodules/widgets/graphicslayouts_p.h
+++ /dev/null
@@ -1,226 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef GRAPHICSLAYOUTS_H
-#define GRAPHICSLAYOUTS_H
-
-#include "graphicswidgets_p.h"
-
-#include <QtGui/QGraphicsLinearLayout>
-#include <QtGui/QGraphicsGridLayout>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Declarative)
-
-class QGraphicsLinearLayoutStretchItemObject : public QObject, public QGraphicsLayoutItem
-{
- Q_OBJECT
- Q_INTERFACES(QGraphicsLayoutItem)
-public:
- QGraphicsLinearLayoutStretchItemObject(QObject *parent = 0);
-
- virtual QSizeF sizeHint(Qt::SizeHint, const QSizeF &) const;
-};
-
-class LinearLayoutAttached;
-class QGraphicsLinearLayoutObject : public QObject, public QGraphicsLinearLayout
-{
- Q_OBJECT
- Q_INTERFACES(QGraphicsLayout QGraphicsLayoutItem)
-
- Q_PROPERTY(QDeclarativeListProperty<QGraphicsLayoutItem> children READ children)
- Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation)
- Q_PROPERTY(qreal spacing READ spacing WRITE setSpacing)
- Q_CLASSINFO("DefaultProperty", "children")
-public:
- QGraphicsLinearLayoutObject(QObject * = 0);
- ~QGraphicsLinearLayoutObject();
-
- QDeclarativeListProperty<QGraphicsLayoutItem> children() { return QDeclarativeListProperty<QGraphicsLayoutItem>(this, 0, children_append, children_count, children_at, children_clear); }
-
- static LinearLayoutAttached *qmlAttachedProperties(QObject *);
-
-private Q_SLOTS:
- void updateStretch(QGraphicsLayoutItem*,int);
- void updateAlignment(QGraphicsLayoutItem*,Qt::Alignment);
-
-private:
- friend class LinearLayoutAttached;
- void clearChildren();
- void insertLayoutItem(int, QGraphicsLayoutItem *);
- static QHash<QGraphicsLayoutItem*, LinearLayoutAttached*> attachedProperties;
-
- static void children_append(QDeclarativeListProperty<QGraphicsLayoutItem> *prop, QGraphicsLayoutItem *item) {
- static_cast<QGraphicsLinearLayoutObject*>(prop->object)->insertLayoutItem(-1, item);
- }
-
- static void children_clear(QDeclarativeListProperty<QGraphicsLayoutItem> *prop) {
- static_cast<QGraphicsLinearLayoutObject*>(prop->object)->clearChildren();
- }
-
- static int children_count(QDeclarativeListProperty<QGraphicsLayoutItem> *prop) {
- return static_cast<QGraphicsLinearLayoutObject*>(prop->object)->count();
- }
-
- static QGraphicsLayoutItem *children_at(QDeclarativeListProperty<QGraphicsLayoutItem> *prop, int index) {
- return static_cast<QGraphicsLinearLayoutObject*>(prop->object)->itemAt(index);
- }
-};
-
-class GridLayoutAttached;
-class QGraphicsGridLayoutObject : public QObject, public QGraphicsGridLayout
-{
- Q_OBJECT
- Q_INTERFACES(QGraphicsLayout QGraphicsLayoutItem)
-
- Q_PROPERTY(QDeclarativeListProperty<QGraphicsLayoutItem> children READ children)
- Q_PROPERTY(qreal spacing READ spacing WRITE setSpacing)
- Q_PROPERTY(qreal verticalSpacing READ verticalSpacing WRITE setVerticalSpacing)
- Q_PROPERTY(qreal horizontalSpacing READ horizontalSpacing WRITE setHorizontalSpacing)
- Q_CLASSINFO("DefaultProperty", "children")
-public:
- QGraphicsGridLayoutObject(QObject * = 0);
- ~QGraphicsGridLayoutObject();
-
- QDeclarativeListProperty<QGraphicsLayoutItem> children() { return QDeclarativeListProperty<QGraphicsLayoutItem>(this, 0, children_append, children_count, children_at, children_clear); }
-
- qreal spacing() const;
-
- static GridLayoutAttached *qmlAttachedProperties(QObject *);
-
-private:
- friend class GraphicsLayoutAttached;
- void addWidget(QGraphicsWidget *);
- void clearChildren();
- void addLayoutItem(QGraphicsLayoutItem *);
- static QHash<QGraphicsLayoutItem*, GridLayoutAttached*> attachedProperties;
-
- static void children_append(QDeclarativeListProperty<QGraphicsLayoutItem> *prop, QGraphicsLayoutItem *item) {
- static_cast<QGraphicsGridLayoutObject*>(prop->object)->addLayoutItem(item);
- }
-
- static void children_clear(QDeclarativeListProperty<QGraphicsLayoutItem> *prop) {
- static_cast<QGraphicsGridLayoutObject*>(prop->object)->clearChildren();
- }
-
- static int children_count(QDeclarativeListProperty<QGraphicsLayoutItem> *prop) {
- return static_cast<QGraphicsGridLayoutObject*>(prop->object)->count();
- }
-
- static QGraphicsLayoutItem *children_at(QDeclarativeListProperty<QGraphicsLayoutItem> *prop, int index) {
- return static_cast<QGraphicsGridLayoutObject*>(prop->object)->itemAt(index);
- }
-};
-
-class LinearLayoutAttached : public QObject
-{
- Q_OBJECT
-
- Q_PROPERTY(int stretchFactor READ stretchFactor WRITE setStretchFactor NOTIFY stretchChanged)
- Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment NOTIFY alignmentChanged)
-public:
- LinearLayoutAttached(QObject *parent);
-
- int stretchFactor() const { return _stretch; }
- void setStretchFactor(int f);
- Qt::Alignment alignment() const { return _alignment; }
- void setAlignment(Qt::Alignment a);
-
-Q_SIGNALS:
- void stretchChanged(QGraphicsLayoutItem*,int);
- void alignmentChanged(QGraphicsLayoutItem*,Qt::Alignment);
-
-private:
- int _stretch;
- Qt::Alignment _alignment;
-};
-
-class GridLayoutAttached : public QObject
-{
- Q_OBJECT
-
- Q_PROPERTY(int row READ row WRITE setRow)
- Q_PROPERTY(int column READ column WRITE setColumn)
- Q_PROPERTY(int rowSpan READ rowSpan WRITE setRowSpan)
- Q_PROPERTY(int columnSpan READ columnSpan WRITE setColumnSpan)
- Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment)
-public:
- GridLayoutAttached(QObject *parent);
-
- int row() const { return _row; }
- void setRow(int r);
-
- int column() const { return _column; }
- void setColumn(int c);
-
- int rowSpan() const { return _rowspan; }
- void setRowSpan(int rs);
-
- int columnSpan() const { return _colspan; }
- void setColumnSpan(int cs);
-
- Qt::Alignment alignment() const { return _alignment; }
- void setAlignment(Qt::Alignment a);
-
-private:
- int _row;
- int _column;
- int _rowspan;
- int _colspan;
- Qt::Alignment _alignment;
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_INTERFACE(QGraphicsLayoutItem)
-QML_DECLARE_INTERFACE(QGraphicsLayout)
-QML_DECLARE_TYPE(QGraphicsLinearLayoutStretchItemObject)
-QML_DECLARE_TYPE(QGraphicsLinearLayoutObject)
-QML_DECLARE_TYPEINFO(QGraphicsLinearLayoutObject, QML_HAS_ATTACHED_PROPERTIES)
-QML_DECLARE_TYPE(QGraphicsGridLayoutObject)
-QML_DECLARE_TYPEINFO(QGraphicsGridLayoutObject, QML_HAS_ATTACHED_PROPERTIES)
-
-QT_END_HEADER
-
-#endif // GRAPHICSLAYOUTS_H
diff --git a/src/plugins/qdeclarativemodules/widgets/graphicswidgets.cpp b/src/plugins/qdeclarativemodules/widgets/graphicswidgets.cpp
deleted file mode 100644
index 062e516..0000000
--- a/src/plugins/qdeclarativemodules/widgets/graphicswidgets.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
diff --git a/src/plugins/qdeclarativemodules/widgets/graphicswidgets_p.h b/src/plugins/qdeclarativemodules/widgets/graphicswidgets_p.h
deleted file mode 100644
index 2c2b707..0000000
--- a/src/plugins/qdeclarativemodules/widgets/graphicswidgets_p.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef GRAPHICSWIDGETS_H
-#define GRAPHICSWIDGETS_H
-
-#include <qdeclarative.h>
-
-#include <QtGui/QGraphicsScene>
-#include <QtGui/QGraphicsView>
-#include <QtGui/QGraphicsWidget>
-#include <QtGui/QGraphicsItem>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Declarative)
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QGraphicsView)
-QML_DECLARE_TYPE_HASMETATYPE(QGraphicsScene)
-QML_DECLARE_TYPE(QGraphicsWidget)
-QML_DECLARE_TYPE(QGraphicsObject)
-QML_DECLARE_INTERFACE_HASMETATYPE(QGraphicsItem)
-
-QT_END_HEADER
-
-#endif // GRAPHICSWIDGETS_H
diff --git a/src/plugins/qdeclarativemodules/widgets/widgets.cpp b/src/plugins/qdeclarativemodules/widgets/widgets.cpp
deleted file mode 100644
index ec21cc4..0000000
--- a/src/plugins/qdeclarativemodules/widgets/widgets.cpp
+++ /dev/null
@@ -1,138 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtDeclarative/qdeclarativeextensionplugin.h>
-#include <QtDeclarative/qdeclarative.h>
-
-#include "graphicslayouts_p.h"
-#include "graphicswidgets_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class QGraphicsViewDeclarativeUI : public QObject
-{
- Q_OBJECT
-
- Q_PROPERTY(QGraphicsScene *scene READ scene WRITE setScene)
- Q_CLASSINFO("DefaultProperty", "scene")
-public:
- QGraphicsViewDeclarativeUI(QObject *other) : QObject(other) {}
-
- QGraphicsScene *scene() const { return static_cast<QGraphicsView *>(parent())->scene(); }
- void setScene(QGraphicsScene *scene)
- {
- static_cast<QGraphicsView *>(parent())->setScene(scene);
- }
-};
-
-class QGraphicsSceneDeclarativeUI : public QObject
-{
- Q_OBJECT
-
- Q_PROPERTY(QDeclarativeListProperty<QObject> children READ children)
- Q_CLASSINFO("DefaultProperty", "children")
-public:
- QGraphicsSceneDeclarativeUI(QObject *other) : QObject(other) {}
-
- QDeclarativeListProperty<QObject> children() { return QDeclarativeListProperty<QObject>(this->parent(), 0, children_append); }
-
-private:
- static void children_append(QDeclarativeListProperty<QObject> *prop, QObject *o) {
- if (QGraphicsObject *go = qobject_cast<QGraphicsObject *>(o))
- static_cast<QGraphicsScene *>(prop->object)->addItem(go);
- }
-};
-
-class QGraphicsWidgetDeclarativeUI : public QObject
-{
- Q_OBJECT
-
- Q_PROPERTY(QDeclarativeListProperty<QGraphicsItem> children READ children)
- Q_PROPERTY(QGraphicsLayout *layout READ layout WRITE setLayout)
- Q_CLASSINFO("DefaultProperty", "children")
-public:
- QGraphicsWidgetDeclarativeUI(QObject *other) : QObject(other) {}
-
- QDeclarativeListProperty<QGraphicsItem> children() { return QDeclarativeListProperty<QGraphicsItem>(this, 0, children_append); }
-
- QGraphicsLayout *layout() const { return static_cast<QGraphicsWidget *>(parent())->layout(); }
- void setLayout(QGraphicsLayout *lo)
- {
- static_cast<QGraphicsWidget *>(parent())->setLayout(lo);
- }
-
-private:
- void setItemParent(QGraphicsItem *wid)
- {
- wid->setParentItem(static_cast<QGraphicsWidget *>(parent()));
- }
-
- static void children_append(QDeclarativeListProperty<QGraphicsItem> *prop, QGraphicsItem *i) {
- static_cast<QGraphicsWidgetDeclarativeUI*>(prop->object)->setItemParent(i);
- }
-};
-
-class QWidgetsQmlModule : public QDeclarativeExtensionPlugin
-{
- Q_OBJECT
-public:
- virtual void registerTypes(const char *uri)
- {
- Q_ASSERT(QLatin1String(uri) == QLatin1String("Qt.widgets"));
-
- QML_REGISTER_INTERFACE(QGraphicsLayoutItem);
- QML_REGISTER_INTERFACE(QGraphicsLayout);
- qmlRegisterType<QGraphicsLinearLayoutStretchItemObject>(uri,4,6,"QGraphicsLinearLayoutStretchItem");
- qmlRegisterType<QGraphicsLinearLayoutObject>(uri,4,6,"QGraphicsLinearLayout");
- qmlRegisterType<QGraphicsGridLayoutObject>(uri,4,6,"QGraphicsGridLayout");
- qmlRegisterExtendedType<QGraphicsView, QGraphicsViewDeclarativeUI>(uri,4,6,"QGraphicsView");
- qmlRegisterExtendedType<QGraphicsScene,QGraphicsSceneDeclarativeUI>(uri,4,6,"QGraphicsScene");
- qmlRegisterExtendedType<QGraphicsWidget,QGraphicsWidgetDeclarativeUI>(uri,4,6,"QGraphicsWidget");
- QML_REGISTER_INTERFACE(QGraphicsItem);
- }
-};
-
-QT_END_NAMESPACE
-
-#include "widgets.moc"
-
-Q_EXPORT_PLUGIN2(qtwidgetsqmlmodule, QT_PREPEND_NAMESPACE(QWidgetsQmlModule));
-
diff --git a/src/plugins/qdeclarativemodules/widgets/widgets.pro b/src/plugins/qdeclarativemodules/widgets/widgets.pro
deleted file mode 100644
index 3ec38da..0000000
--- a/src/plugins/qdeclarativemodules/widgets/widgets.pro
+++ /dev/null
@@ -1,20 +0,0 @@
-TARGET = widgets
-include(../../qpluginbase.pri)
-
-QT += declarative
-
-SOURCES += \
- graphicslayouts.cpp \
- widgets.cpp
-
-HEADERS += \
- graphicswidgets_p.h \
- graphicslayouts_p.h
-
-QTDIR_build:DESTDIR = $$QT_BUILD_TREE/imports/Qt/widgets
-target.path = $$[QT_INSTALL_IMPORTS]/Qt/widgets
-
-qmldir.files += $$QT_BUILD_TREE/imports/Qt/widgets/qmldir
-qmldir.path += $$[QT_INSTALL_IMPORTS]/Qt/widgets
-
-INSTALLS += target qmldir
diff --git a/src/plugins/sqldrivers/odbc/odbc.pro b/src/plugins/sqldrivers/odbc/odbc.pro
index 3de8ab2..2bf85f1 100644
--- a/src/plugins/sqldrivers/odbc/odbc.pro
+++ b/src/plugins/sqldrivers/odbc/odbc.pro
@@ -8,6 +8,7 @@ unix {
!contains( LIBS, .*odbc.* ) {
LIBS *= $$QT_LFLAGS_ODBC
}
+ DEFINES += UNICODE
}
win32 {