From 1401d0a8b232278f5f07c9c34ed537885e7f17e2 Mon Sep 17 00:00:00 2001 From: Aleksandar Sasha Babic Date: Wed, 8 Jul 2009 17:20:00 +0200 Subject: For some reason interface info on Symbian will not give neither correct netmask nor broadcast address. But, experiments show that route info can be used to obtain netmask. Then is easy to calculate broadcast address. Idea is to match interface and destination address from routeinfo entry, and then to use given netmask. "Machines take me by surprise with great frequency." Alan Turing(1912 - 1954) --- src/network/kernel/qnetworkinterface_symbian.cpp | 61 +++++++++++++++++++++++- 1 file changed, 59 insertions(+), 2 deletions(-) diff --git a/src/network/kernel/qnetworkinterface_symbian.cpp b/src/network/kernel/qnetworkinterface_symbian.cpp index 59f1c02..e3a282f 100644 --- a/src/network/kernel/qnetworkinterface_symbian.cpp +++ b/src/network/kernel/qnetworkinterface_symbian.cpp @@ -175,7 +175,7 @@ static QList interfaceListing() iface->addressEntries << entry; #if defined(QNETWORKINTERFACE_DEBUG) - qDebug("\n Found network interface %s, interface flags:\n\ + printf("\n Found network interface %s, interface flags:\n\ IsUp = %d, IsRunning = %d, CanBroadcast = %d,\n\ IsLoopBack = %d, IsPointToPoint = %d, CanMulticast = %d, \n\ ip = %s, netmask = %s, broadcast = %s,\n\ @@ -188,8 +188,65 @@ static QList interfaceListing() #endif } } + + // we will try to use routing info to detect more precisely + // netmask and then ::postProcess() should calculate + // broadcast addresses + + // use dummy socket to start enumerating routes + err = socket.SetOpt(KSoInetEnumRoutes, KSolInetRtCtrl); + if( err ) + { + socket.Close(); + socketServ.Close(); + // return what we have + // up to this moment + return interfaces; + } + + TSoInetRouteInfo routeInfo; + TPckg routeInfoPkg(routeInfo); + while(socket.GetOpt(KSoInetNextRoute, KSolInetRtCtrl, routeInfoPkg) == KErrNone) + { + TName address; + + // get interface address + routeInfo.iIfAddr.Output(address); + QHostAddress ifAddr(qstringFromDesc(address)); + if(ifAddr.isNull()) + continue; + + routeInfo.iDstAddr.Output(address); + QHostAddress destination(qstringFromDesc(address)); + if(destination.isNull() || destination != ifAddr) + continue; + + // search interfaces + for(int ifindex = 0; ifindex < interfaces.size(); ++ifindex) { + QNetworkInterfacePrivate *iface = interfaces.at(ifindex); + for(int eindex = 0; eindex < iface->addressEntries.size(); ++eindex) { + QNetworkAddressEntry entry = iface->addressEntries.at(eindex); + if(entry.ip() != ifAddr) { + continue; + } else { + routeInfo.iNetMask.Output(address); + QHostAddress netmask(qstringFromDesc(address)); + entry.setNetmask(netmask); + // NULL boradcast address for + // ::postProcess to have effect + entry.setBroadcast(QHostAddress()); + iface->addressEntries.replace(eindex, entry); +// printf("for %s netmask = %s and destination = %s ; type = %d; state = %d; metric = %d \n", +// ifAddr.toString().toLatin1().constData(), netmask.toString().toLatin1().constData(), destination.toString().toLatin1().constData(), +// routeInfo.iType, routeInfo.iState, routeInfo.iMetric); + } + } + } + } + socket.Close(); - socketServ.Close(); + socketServ.Close(); + return interfaces; } -- cgit v0.12 From e49bf3037c2cd170c93c35f7657bef0e7af3d189 Mon Sep 17 00:00:00 2001 From: Aleksandar Sasha Babic Date: Fri, 24 Jul 2009 11:45:34 +0200 Subject: Small optimization. Do not use route info for addresses other than IPV4. --- src/network/kernel/qnetworkinterface_symbian.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/network/kernel/qnetworkinterface_symbian.cpp b/src/network/kernel/qnetworkinterface_symbian.cpp index e3a282f..d3aafa3 100644 --- a/src/network/kernel/qnetworkinterface_symbian.cpp +++ b/src/network/kernel/qnetworkinterface_symbian.cpp @@ -228,6 +228,10 @@ static QList interfaceListing() QNetworkAddressEntry entry = iface->addressEntries.at(eindex); if(entry.ip() != ifAddr) { continue; + } else if(entry.ip().protocol() != QAbstractSocket::IPv4Protocol) { + // skip if not IPv4 address (e.g. IPv6) + // as results not reliable on Symbian + continue; } else { routeInfo.iNetMask.Output(address); QHostAddress netmask(qstringFromDesc(address)); -- cgit v0.12 From aa73e59574961987f31144c3b9aad53f9bb12820 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Fri, 24 Jul 2009 13:16:21 +0300 Subject: Updated style demo to adjust spinbox value when sliders are moved. Task: 258515: StyleDemo: Moving sliders do not update spinbox --- demos/embedded/styledemo/stylewidget.ui | 305 +++++++++++++++++--------------- 1 file changed, 161 insertions(+), 144 deletions(-) diff --git a/demos/embedded/styledemo/stylewidget.ui b/demos/embedded/styledemo/stylewidget.ui index 9c5f253..a084dde 100644 --- a/demos/embedded/styledemo/stylewidget.ui +++ b/demos/embedded/styledemo/stylewidget.ui @@ -1,138 +1,139 @@ - + + StyleWidget - - + + 0 0 - 172 + 174 220 - + Form - - + + 4 - + 4 - - - + + + 0 0 - + Styles - - + + 4 - + 4 - - - - + + + + 0 0 - + Qt::StrongFocus - + Transp. - + true - + false - + true - - - - + + + + 0 0 - + Qt::StrongFocus - + Blue - + true - + false - + true - - - - + + + + 0 0 - + Qt::StrongFocus - + Khaki - + true - + false - + true - - - - + + + + 0 0 - + Qt::StrongFocus - + None - + true - + true - + true @@ -141,11 +142,11 @@ - - + + Qt::Vertical - + 0 0 @@ -154,56 +155,56 @@ - - - + + + 0 0 - + QFrame::StyledPanel - + QFrame::Raised - - + + 0 - + - - - + + + 0 0 - + My Value is: - + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - + + + 0 0 - + Qt::WheelFocus - + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - + false @@ -211,88 +212,88 @@ - - + + 4 - - - - + + + + 0 0 - + 0 24 - + Qt::Horizontal - - - - + + + + 0 0 - + Qt::StrongFocus - + Show - + true - + true - + false - - - + + + 0 24 - + Qt::Horizontal - - - - + + + + 0 0 - + Qt::StrongFocus - + Enable - + true - + true - + false @@ -303,14 +304,14 @@ - - + + Qt::Vertical - + QSizePolicy::Expanding - + 0 0 @@ -319,13 +320,13 @@ - + - + Qt::Horizontal - + 40 20 @@ -334,11 +335,11 @@ - - + + Qt::StrongFocus - + Close @@ -348,7 +349,7 @@ - + @@ -357,13 +358,13 @@ horizontalScrollBar_2 setValue(int) - - 134 - 196 + + 84 + 147 - - 523 - 193 + + 166 + 147 @@ -373,13 +374,13 @@ horizontalScrollBar setValue(int) - - 577 - 199 + + 166 + 147 - - 127 - 207 + + 84 + 147 @@ -389,13 +390,13 @@ horizontalScrollBar_2 setEnabled(bool) - - 566 - 241 + + 166 + 175 - - 492 - 207 + + 166 + 147 @@ -405,13 +406,13 @@ horizontalScrollBar setVisible(bool) - - 123 - 239 + + 84 + 175 - - 123 - 184 + + 84 + 147 @@ -421,13 +422,29 @@ horizontalScrollBar_2 setValue(int) - - 603 - 136 + + 166 + 115 - - 575 - 199 + + 166 + 147 + + + + + horizontalScrollBar_2 + valueChanged(int) + spinBox + setValue(int) + + + 132 + 132 + + + 135 + 110 -- cgit v0.12 From 45edfc7465db4ca377db308d0a8fa80c068b2c11 Mon Sep 17 00:00:00 2001 From: Aleksandar Sasha Babic Date: Fri, 24 Jul 2009 19:14:01 +0200 Subject: Adaptation done to make network-chat work on S60. "Many attempts to communicate are nullified by saying too much." Robert Greenleaf(1904-1990) --- examples/network/network-chat/chatdialog.cpp | 4 ++++ examples/network/network-chat/main.cpp | 11 +++++++++++ examples/network/network-chat/network-chat.pro | 7 +++++++ examples/network/network-chat/peermanager.cpp | 11 +++++++++-- 4 files changed, 31 insertions(+), 2 deletions(-) diff --git a/examples/network/network-chat/chatdialog.cpp b/examples/network/network-chat/chatdialog.cpp index b461412..c3b978d 100644 --- a/examples/network/network-chat/chatdialog.cpp +++ b/examples/network/network-chat/chatdialog.cpp @@ -54,6 +54,10 @@ ChatDialog::ChatDialog(QWidget *parent) listWidget->setFocusPolicy(Qt::NoFocus); connect(lineEdit, SIGNAL(returnPressed()), this, SLOT(returnPressed())); +#ifdef Q_OS_SYMBIAN + connect(sendButton, SIGNAL(clicked()), this, SLOT(returnPressed())); +#endif + connect(lineEdit, SIGNAL(returnPressed()), this, SLOT(returnPressed())); connect(&client, SIGNAL(newMessage(const QString &, const QString &)), this, SLOT(appendMessage(const QString &, const QString &))); connect(&client, SIGNAL(newParticipant(const QString &)), diff --git a/examples/network/network-chat/main.cpp b/examples/network/network-chat/main.cpp index e373095..79039a0 100644 --- a/examples/network/network-chat/main.cpp +++ b/examples/network/network-chat/main.cpp @@ -42,11 +42,22 @@ #include #include "chatdialog.h" +#ifdef Q_OS_SYMBIAN +#include "sym_iap_util.h" +#endif int main(int argc, char *argv[]) { +#ifdef Q_OS_SYMBIAN + qt_SetDefaultIap(); +#endif QApplication app(argc, argv); ChatDialog dialog; +#ifdef Q_OS_SYMBIAN + // Make application better looking and more usable on small screen + dialog.showMaximized(); +#else dialog.show(); +#endif return app.exec(); } diff --git a/examples/network/network-chat/network-chat.pro b/examples/network/network-chat/network-chat.pro index 6967228..5ba2289 100644 --- a/examples/network/network-chat/network-chat.pro +++ b/examples/network/network-chat/network-chat.pro @@ -19,3 +19,10 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/network/network-chat INSTALLS += target sources include($$QT_SOURCE_TREE/examples/examplebase.pri) + +symbian { + HEADERS += $$QT_SOURCE_TREE/examples/network/ftp/sym_iap_util.h + LIBS += -lesock -lconnmon -lcharconv -linsock + TARGET.CAPABILITY = "NetworkServices ReadUserData WriteUserData" + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 +} diff --git a/examples/network/network-chat/peermanager.cpp b/examples/network/network-chat/peermanager.cpp index 7fb91b1..c812505 100644 --- a/examples/network/network-chat/peermanager.cpp +++ b/examples/network/network-chat/peermanager.cpp @@ -70,7 +70,11 @@ PeerManager::PeerManager(Client *client) } if (username.isEmpty()) +#ifndef Q_OS_SYMBIAN username = "unknown"; +#else + username = "QtS60"; +#endif updateAddresses(); serverPort = 0; @@ -160,8 +164,11 @@ void PeerManager::updateAddresses() foreach (QNetworkInterface interface, QNetworkInterface::allInterfaces()) { foreach (QNetworkAddressEntry entry, interface.addressEntries()) { QHostAddress broadcastAddress = entry.broadcast(); - if (broadcastAddress != QHostAddress::Null && - entry.ip() != QHostAddress::LocalHost) { + if (broadcastAddress != QHostAddress::Null && entry.ip() != QHostAddress::LocalHost) { + //printf("entry.ip: %s\n", entry.ip().toString().toLatin1().data()); + //printf("entry.netmask: %s\n", entry.netmask().toString().toLatin1().data()); + //printf("entry.prefixLength: %i\n", entry.prefixLength()); + //printf("entry.broadcast %s \n", broadcastAddress.toString().toLatin1().data()); broadcastAddresses << broadcastAddress; ipAddresses << entry.ip(); } -- cgit v0.12 From d937a141a411e632d668bf67c5af8b72335b26b1 Mon Sep 17 00:00:00 2001 From: Aleksandar Sasha Babic Date: Mon, 27 Jul 2009 10:47:40 +0200 Subject: Adding some interesting functions that help finding info about network interfaces and network routes. Can be of broader interest. "By seeking and blundering we learn." Johann Wolfgang Von Goethe (1749 - 1832) --- examples/network/ftp/ftp.pro | 2 +- examples/network/ftp/sym_iap_util.h | 200 +++++++++++++++++++++++++++++++++++- 2 files changed, 197 insertions(+), 5 deletions(-) diff --git a/examples/network/ftp/ftp.pro b/examples/network/ftp/ftp.pro index ac3d3e6..0ddcb6c 100644 --- a/examples/network/ftp/ftp.pro +++ b/examples/network/ftp/ftp.pro @@ -17,5 +17,5 @@ symbian { INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE TARGET.CAPABILITY="NetworkServices ReadUserData WriteUserData" TARGET.UID3 = 0xA000A648 - LIBS+=-lesock -lcommdb # For IAP selection + LIBS+=-lesock -lcommdb -linsock # For IAP selection } \ No newline at end of file diff --git a/examples/network/ftp/sym_iap_util.h b/examples/network/ftp/sym_iap_util.h index 6d52b1d..74fe93a 100644 --- a/examples/network/ftp/sym_iap_util.h +++ b/examples/network/ftp/sym_iap_util.h @@ -42,9 +42,13 @@ #define QSYM_IAP_UTIL_H // Symbian +#include #include +#include #include +#include #include +#include // OpenC #include @@ -53,6 +57,7 @@ //Qt #include #include +//#include _LIT(KIapNameSetting, "IAP\\Name"); // text - mandatory _LIT(KIapDialogPref, "IAP\\DialogPref"); // TUnit32 - optional @@ -68,6 +73,8 @@ const QLatin1String iapGroupTag("IAP"); const QLatin1String iapNamesArrayTag("Names"); const QLatin1String iapNameItemTag("Name"); +static QTextCodec *utf16LETextCodec = 0; + void clearIapNamesSettings(QSettings &settings) { settings.beginGroup(qtNetworkModuleTag); settings.beginGroup(iapGroupTag); @@ -103,6 +110,189 @@ void readIapNamesSettings(QSettings &settings, QStringList& iapNames) { settings.endGroup(); } +static QString qt_TNameToQString(TName data) { + if(utf16LETextCodec == 0) + utf16LETextCodec = QTextCodec::codecForName("UTF-16LE"); + + QByteArray tmpByteArray = QByteArray::fromRawData((char*)(data.PtrZ()), data.Length() * 2); + return utf16LETextCodec->toUnicode(tmpByteArray); +} + +static QString qt_InterfaceInfoL() +{ + QString output; + + TBuf8<512> buffer; + TBuf<128> t; + TAutoClose ss; + User::LeaveIfError(ss.iObj.Connect()); + ss.PushL(); + + TAutoClose sock; + User::LeaveIfError(sock.iObj.Open(ss.iObj, _L("udp"))); + sock.PushL(); + + User::LeaveIfError(sock.iObj.SetOpt(KSoInetEnumInterfaces, KSolInetIfCtrl)); + + TProtocolDesc in; + User::LeaveIfError(sock.iObj.Info(in)); + printf("EPOC32 IP Configuration TCPIP Version %d.%d.%d\n", in.iVersion.iMajor, in.iVersion.iMinor, in.iVersion.iBuild); + + TPckgBuf info, next; + + TInt res=sock.iObj.GetOpt(KSoInetNextInterface, KSolInetIfCtrl, info); + if(res!=KErrNone) + User::Leave(res); + TInt count = 0; + while(res==KErrNone) { + res=sock.iObj.GetOpt(KSoInetNextInterface, KSolInetIfCtrl, next); + + if(info().iName != _L("") && info().iName != _L("loop6") && info().iName != _L("loop4")) { + printf("Interface %d\n", count++); + + printf("Name \"%s\"\n", qt_TNameToQString(info().iName).toLatin1().data()); + printf("NIF tag \"%s\"\n", qt_TNameToQString(info().iTag).toLatin1().data()); + + printf("State "); + switch (info().iState) + { + case EIfPending: + printf("pending\n"); + break; + case EIfUp: + printf("up\n"); + break; + case EIfBusy: + printf("busy\n"); + break; + default: + printf("down\n"); + break; + } + + printf("Mtu %d\n", info().iMtu); + printf("Speed Metric %d\n", info().iSpeedMetric); + + printf("Features:"); + info().iFeatures & KIfIsLoopback ? printf(" loopback") : printf(""); + info().iFeatures & KIfIsDialup ? printf(" dialup") : printf(""); + info().iFeatures & KIfIsPointToPoint ? printf(" pointtopoint") : printf(""); + info().iFeatures & KIfCanBroadcast ? printf(" canbroadcast") : printf(""); + info().iFeatures & KIfCanMulticast ? printf(" canmulticast") : printf(""); + info().iFeatures & KIfCanSetMTU ? printf(" cansetmtu") : printf(""); + info().iFeatures & KIfHasHardwareAddr ? printf(" hardwareaddr") : printf(""); + info().iFeatures & KIfCanSetHardwareAddr ? printf(" cansethardwareaddr") : printf(""); + printf("\n"); + + TName address; + info().iAddress.Output(address); + printf("Addr: %s\n", qt_TNameToQString(address).toLatin1().data()); + + if(info().iAddress.IsLinkLocal()) { + printf(" -link local\n"); + } else if(info().iAddress.IsSiteLocal()) { + printf(" -site local\n"); + } else { + printf(" -global\n"); + } + + info().iNetMask.Output(address); + printf("Netmask %s\n", qt_TNameToQString(address).toLatin1().data()); + + info().iBrdAddr.Output(address); + printf("Broadcast address %s\n", qt_TNameToQString(address).toLatin1().data()); + + info().iDefGate.Output(address); + printf("Gatew: %s\n", qt_TNameToQString(address).toLatin1().data()); + + info().iNameSer1.Output(address); + printf("DNS 1: %s\n", qt_TNameToQString(address).toLatin1().data()); + + info().iNameSer2.Output(address); + printf("DNS 2: %s\n", qt_TNameToQString(address).toLatin1().data()); + + if (info().iHwAddr.Family() != KAFUnspec) { + printf("Hardware address "); + TUint j; + for(j = sizeof(SSockAddr) ; j < sizeof(SSockAddr) + 6 ; ++j) { + if(j < (TUint)info().iHwAddr.Length()) { + printf("%02X", info().iHwAddr[j]); + } else { + printf("??"); + } + if(j < sizeof(SSockAddr) + 5) + printf("-"); + else + printf("\n"); + } + } + } + if(res == KErrNone) { + info = next; + printf("\n"); + } else { + printf("\n"); + } + } + + sock.Pop(); + ss.Pop(); + + return output; +} + +static QString qt_RouteInfoL() { + QString output; + TAutoClose ss; + User::LeaveIfError(ss.iObj.Connect()); + ss.PushL(); + + TAutoClose sock; + User::LeaveIfError(sock.iObj.Open(ss.iObj, _L("udp"))); + sock.PushL(); + + TSoInetRouteInfo routeInfo; + TPckg routeInfoPkg(routeInfo); + + TName destAddr; + TName netMask; + TName gateway; + TName ifAddr; + + // Begins enumeration of routes by setting this option + User::LeaveIfError(sock.iObj.SetOpt(KSoInetEnumRoutes, KSolInetRtCtrl)); + + // The TSoInetRouteInfo contains information for a new route each time GetOpt returns KErrNone + for(TInt i = 0; sock.iObj.GetOpt(KSoInetNextRoute, KSolInetRtCtrl, routeInfoPkg) == KErrNone ; i++) + { + // Extract the destination and netmask + routeInfo.iDstAddr.Output(destAddr); + routeInfo.iNetMask.Output(netMask); + routeInfo.iGateway.Output(gateway); + routeInfo.iIfAddr.Output(ifAddr); +/* + if(destAddr.Length() <= 2) + continue; + + if(netMask.Find(_L("255.255.255.255")) != KErrNotFound + || netMask.Find(_L("0.0.0.0")) != KErrNotFound + || netMask.Find(_L("ffff:ffff:ffff:ffff")) != KErrNotFound) + continue; +*/ + printf("Route Info #[%i]\n", i); + printf("DstAddr %s\n", qt_TNameToQString(destAddr).toLatin1().data()); + printf("NetMask %s\n", qt_TNameToQString(netMask).toLatin1().data()); + printf("Gateway %s\n", qt_TNameToQString(gateway).toLatin1().data()); + printf("IfAddr %s\n", qt_TNameToQString(ifAddr).toLatin1().data()); + printf("\n"); + } + + sock.Pop(); + ss.Pop(); + + return output; +} + QString qt_TDesC2QStringL(const TDesC& aDescriptor) { #ifdef QT_NO_UNICODE @@ -230,13 +420,13 @@ static QString qt_CheckForActiveConnection() { tempConn.GetDesSetting(TPtrC(KIapServiceType), iapServiceType); //tempConn.Stop(); iapName.ZeroTerminate(); - iapServiceType.ZeroTerminate(); + iapServiceType.ZeroTerminate(); // if(iapServiceType.Find(_L8("LANService")) != KErrNotFound) { // activeLanConnectionFound = ETrue; // break; // } - strIapName = QString((char*)iapName.Ptr()); + strIapName = QString((char*)iapName.Ptr()); int error = 0; if(!qt_SetDefaultIapName(strIapName, error)) { //printf("failed setdefaultif @ %i with %s and errno = %d \n", __LINE__, strIapName.toUtf8().data(), error); @@ -311,8 +501,10 @@ static void qt_SetDefaultIapL() static int qt_SetDefaultIap() { - TRAPD(err, qt_SetDefaultIapL()); - return err; + TRAPD(err1, qt_SetDefaultIapL()); +// TRAPD(err2, qt_InterfaceInfoL()); +// TRAPD(err3, qt_RouteInfoL()); + return err1; } #endif // QSYM_IAP_UTIL_H -- cgit v0.12 From 529e43e9652bc5a3b027211a17c7738eb600519b Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Mon, 27 Jul 2009 14:13:40 +0300 Subject: Enabled QtUiTools and related example building for Symbian OS. --- examples/examples.pro | 1 + projects.pro | 2 +- tools/designer/src/src.pro | 1 + tools/tools.pro | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/examples.pro b/examples/examples.pro index 218cf9b..42a3aa3 100644 --- a/examples/examples.pro +++ b/examples/examples.pro @@ -36,6 +36,7 @@ symbian: SUBDIRS = \ mainwindows \ script \ sql \ + uitools \ xml contains(QT_CONFIG, phonon):!static: SUBDIRS += phonon diff --git a/projects.pro b/projects.pro index 389ec71..a1f2dd1 100644 --- a/projects.pro +++ b/projects.pro @@ -29,7 +29,7 @@ isEmpty(QT_BUILD_PARTS) { #defaults } symbian { - QT_BUILD_PARTS = libs examples demos + QT_BUILD_PARTS = libs tools examples demos } #process the projects diff --git a/tools/designer/src/src.pro b/tools/designer/src/src.pro index e7ce55f..e1710b8 100644 --- a/tools/designer/src/src.pro +++ b/tools/designer/src/src.pro @@ -10,4 +10,5 @@ SUBDIRS = \ CONFIG(shared,shared|static):SUBDIRS += plugins wince*: SUBDIRS -= designer plugins +symbian: SUBDIRS = uitools contains(DEFINES, QT_NO_CURSOR): SUBDIRS -= lib components \ No newline at end of file diff --git a/tools/tools.pro b/tools/tools.pro index d034dcd..a978227 100644 --- a/tools/tools.pro +++ b/tools/tools.pro @@ -13,6 +13,7 @@ no-png { SUBDIRS += designer } SUBDIRS += linguist + symbian: SUBDIRS = designer wince*: SUBDIRS = qtestlib designer unix:!mac:!embedded:contains(QT_CONFIG, qt3support):SUBDIRS += qtconfig win32:!wince*:SUBDIRS += activeqt -- cgit v0.12 From 369d1e0999d1fd130777e0f48831734d30d03efa Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Tue, 28 Jul 2009 10:23:46 +0300 Subject: Changed .pkg files to follow the naming scheme of make targets. Task: 246499 QMake now generates the package files like deform_debug-gcce.pkg instead of deform_gcce_udeb.pkg. The new naming scheme is inline with make target which in this example was debug-gcce. --- qmake/generators/symbian/symmake.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp index 374d058..ec19675 100644 --- a/qmake/generators/symbian/symmake.cpp +++ b/qmake/generators/symbian/symmake.cpp @@ -269,10 +269,11 @@ bool SymbianMakefileGenerator::writeMakefile(QTextStream &t) { } bool SymbianMakefileGenerator::generatePkgFile(const QString &compiler, const QString &config, const QString &iconFile) { - QString pkgFilename = QString("%1_%2_%3.%4") + QString build = ( config == "udeb" ) ? "debug" : "release"; + QString pkgFilename = QString("%1_%2-%3.%4") .arg(fileInfo(project->projectFile()).completeBaseName()) + .arg(build) .arg(compiler) - .arg(config) .arg("pkg"); QFile pkgFile(pkgFilename); if (!pkgFile.open(QIODevice::WriteOnly | QIODevice::Text)) -- cgit v0.12 From d050cb9c44d3c185a36f2af8be36ab70ce7a794e Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Wed, 29 Jul 2009 08:37:57 +0300 Subject: Extended PKG customization possibilities via qmake. Task: 242139 This commit replaces Symbian specific 'depends' keyword in qmake DEPLOYMENT variable with two more generic ones. The new keywords are 'pkg_prerules' and 'pkg_postrules', and they allow developer to pass raw data to PKG file. The strings in 'pkg_prerules' are added before PKG file package-body headers and 'pkg_postrules' after them. Correspondingly as old 'depends' keyword, the new keywords are not parsed by qmake, so they must be in a format understood by Symbian package generation tools. Note that 'pkg_prerules' can also replace default language, package-header and vendor statements in pkg file. If you decide to override any of these statements, you need to pay attention that also other statements stay valid. --- demos/demobase.pri | 11 ++- doc/src/qmake-manual.qdoc | 32 +++++-- doc/src/snippets/code/doc_src_qmake-manual.qdoc | 6 +- examples/examplebase.pri | 12 ++- mkspecs/common/symbian/symbian.conf | 3 +- mkspecs/features/symbian/qt.prf | 3 +- qmake/generators/symbian/symmake.cpp | 106 +++++++++++++++++++----- qmake/generators/symbian/symmake.h | 1 + src/s60installs/qt_libs.pro | 15 +++- 9 files changed, 152 insertions(+), 37 deletions(-) diff --git a/demos/demobase.pri b/demos/demobase.pri index c0bba64..f010327 100644 --- a/demos/demobase.pri +++ b/demos/demobase.pri @@ -1 +1,10 @@ -symbian:RSS_RULES = "group_name=\"QtDemos\";" \ No newline at end of file +symbian { + RSS_RULES ="group_name=\"QtDemos\";" + + vendorinfo = \ + "; Localised Vendor name" \ + "%{\"Nokia, Qt Software\"}" \ + "; Unique Vendor name" \ + ":\"Nokia, Qt Software\"" + default_deployment.pkg_prerules += vendorinfo +} \ No newline at end of file diff --git a/doc/src/qmake-manual.qdoc b/doc/src/qmake-manual.qdoc index 68f1976..a167399 100644 --- a/doc/src/qmake-manual.qdoc +++ b/doc/src/qmake-manual.qdoc @@ -1358,14 +1358,36 @@ \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 128 - In Symbian, dependencies to other packages can also be created using - this variable. The strings defined as dependencies are not parsed by - qmake, so they should be in a format understood by Symbian package - generation tools. Please consult Symbian documentation for correct syntax. + In Symbian, generic PKG file content can also be specified with this + variable. You can use either \c pkg_prerules or \c pkg_postrules to + pass raw data to PKG file. The strings in \c pkg_prerules are added before + package-body and \c pkg_postrules after. The strings defined in + \c pkg_postrules or \c pkg_prerules are not parsed by qmake, so they + should be in a format understood by Symbian package generation tools. + Please consult Symbian documentation for correct syntax. - For example: + For example, to deploy DLL and add a new dependency: \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 140 + + Please note that \c pkg_prerules can also replace default statements in + pkg file. If no pkg_prerules is defined, qmake makes sure that PKG file + syntax is correct and it contains all mandatory statements such as: + + \list + \o languages, for example \BR + &EN,FR + \o package-header, for example \BR + #{"MyApp-EN", "MyApp-FR"}, (0x1000001F), 1, 2, 3, TYPE=SA + \o localized and unique vendor, for example \BR + %{"Vendor-EN", ..., "Vendor-FR"} + :"Unique vendor name" + \endlist + + If you decide to override any of these statements, you need to pay + attention that also other statements stay valid. For example if you + override languages statement, you must override also package-header + statement and all other statements which are language specific. In Symbian, the \c default_deployment item specifies default platform dependencies. It can be overwritten if a more diff --git a/doc/src/snippets/code/doc_src_qmake-manual.qdoc b/doc/src/snippets/code/doc_src_qmake-manual.qdoc index b93e151..50515b7 100644 --- a/doc/src/snippets/code/doc_src_qmake-manual.qdoc +++ b/doc/src/snippets/code/doc_src_qmake-manual.qdoc @@ -885,14 +885,14 @@ MMP_RULES += myIfdefBlock //! [140] somelib.sources = somelib.dll somelib.path = \sys\bin -somelib.depends = "(0x12345678), 2, 2, 0, {\"Some Package\"}" \ +somelib.pkg_prerules = "(0x12345678), 2, 2, 0, {\"Some Package\"}" \ "(0x87654321), 1, *, * ~ 2, 2, 0, {\"Some Other Package\"}" -justdep.depends = "(0xAAAABBBB), 0, 2, 0, {\"My Framework\"}" +justdep.pkg_prerules = "(0xAAAABBBB), 0, 2, 0, {\"My Framework\"}" DEPLOYMENT += somelib justdep //! [140] //! [141] -default_deployment.depends = "[0x11223344],0,0,0,{\"SomeSpecificDeviceID\"}" +default_deployment.pkg_prerules = "[0x11223344],0,0,0,{\"SomeSpecificDeviceID\"}" //! [141] //! [142] diff --git a/examples/examplebase.pri b/examples/examplebase.pri index eff6588..84dcf92 100644 --- a/examples/examplebase.pri +++ b/examples/examplebase.pri @@ -1 +1,11 @@ -symbian:RSS_RULES ="group_name=\"QtExamples\";" \ No newline at end of file +symbian { + RSS_RULES ="group_name=\"QtExamples\";" + + vendorinfo = \ + "; Localised Vendor name" \ + "%{\"Nokia, Qt Software\"}" \ + "; Unique Vendor name" \ + ":\"Nokia, Qt Software\"" + default_deployment.pkg_prerules += vendorinfo +} + \ No newline at end of file diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf index 4f3e1d2..fbadadc 100644 --- a/mkspecs/common/symbian/symbian.conf +++ b/mkspecs/common/symbian/symbian.conf @@ -118,7 +118,8 @@ INCLUDEPATH = \ $$INCLUDEPATH # Supports S60 3.0, 3.1, 3.2 and 5.0 by default -default_deployment.depends = \ +default_deployment.pkg_prerules = \ + "; Default HW/platform dependencies" \ "[0x101F7961],0,0,0,{\"S60ProductID\"}" \ "[0x102032BE],0,0,0,{\"S60ProductID\"}" \ "[0x102752AE],0,0,0,{\"S60ProductID\"}" \ diff --git a/mkspecs/features/symbian/qt.prf b/mkspecs/features/symbian/qt.prf index 29b39a5..db2ea14 100644 --- a/mkspecs/features/symbian/qt.prf +++ b/mkspecs/features/symbian/qt.prf @@ -7,7 +7,8 @@ CONFIG += qtmain load(qt) contains(CONFIG, qt):!contains(TARGET.UID3, 0x2001E61C):!contains(TARGET.UID3, 0xE001E61C) { - default_deployment.depends += \ + default_deployment.pkg_prerules += \ + "; Default dependency to Qt libraries" \ "(0x2001E61C), $${QT_MAJOR_VERSION}, $${QT_MINOR_VERSION}, $${QT_PATCH_VERSION}, {\"QtLibs pre-release\"}" } diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp index ec19675..34ab560 100644 --- a/qmake/generators/symbian/symmake.cpp +++ b/qmake/generators/symbian/symmake.cpp @@ -286,36 +286,67 @@ bool SymbianMakefileGenerator::generatePkgFile(const QString &compiler, const QS t << QString("; %1 generated by qmake at %2").arg(pkgFilename).arg(QDateTime::currentDateTime().toString(Qt::ISODate)) << endl; t << "; This file is generated by qmake and should not be modified by the user" << endl; t << ";" << endl << endl; - - // language, (*** hardcoded to english atm) - t << "; Language" << endl; - t << "&EN" << endl << endl; + + // Construct QStringList from pkg_prerules since we need search it before printed to file + QStringList rawPkgPreRules; + foreach(QString deploymentItem, project->values("DEPLOYMENT")) { + foreach(QString pkgrulesItem, project->values(deploymentItem + ".pkg_prerules")) { + QStringList pkgrulesValue = project->values(pkgrulesItem); + // If there is no stringlist defined for a rule, use rule name directly + // This is convenience for defining single line mmp statements + if (pkgrulesValue.isEmpty()){ + rawPkgPreRules << pkgrulesItem; + } else { + foreach(QString pkgrule, pkgrulesValue) { + rawPkgPreRules << pkgrule; + } + } + } + } + + // Apply some defaults if specific data does not exist in PKG pre-rules + + if(!containsStartWithItem('&', rawPkgPreRules)) { + // language, (*** hardcoded to english atm, should be parsed from TRANSLATIONS) + t << "; Language" << endl; + t << "&EN" << endl << endl; + } else { + // In case user defines langs, he must take care also about SIS header + if(!containsStartWithItem('#', rawPkgPreRules)) + fprintf(stderr, "Warning: If language is defined with DEPLOYMENT pkg_prerules, also the SIS header must be defined\n"); + } // name of application, UID and version QString applicationName = project->first("TARGET"); int last = applicationName.lastIndexOf(QLatin1Char('/')); applicationName = applicationName.mid( last == -1 ? 0 : last+1 ); - QString applicationVersion = project->first("VERSION").isEmpty() ? "1,0,0" : project->first("VERSION").replace('.', ','); + + if(!containsStartWithItem('#', rawPkgPreRules)) { + t << "; SIS header: name, uid, version" << endl; + t << QString("#{\"%1\"},(%2),%3").arg(applicationName).arg(uid3).arg(applicationVersion) << endl << endl; + } - t << "; SIS header: name, uid, version" << endl; - t << QString("#{\"%1\"},(%2),%3").arg(applicationName).arg(uid3).arg(applicationVersion) << endl << endl; - - // vendor names (*** hardcoded for now) - t << "; Localised Vendor name" << endl; - t << "%{\"Nokia, Qt Software\"}" << endl << endl; - t << "; Unique Vendor name" << endl; - t << ":\"Nokia, Qt Software\"" << endl << endl; - - // Dependencies - t << "; Dependencies" << endl; - foreach(QString item, project->values("DEPLOYMENT")) { - QStringList dependencies = project->values(item + ".depends"); - foreach(QString dependency, dependencies) { - t << dependency << endl; - } + // Localized vendor name + if(!containsStartWithItem('%', rawPkgPreRules)) { + t << "; Localised Vendor name" << endl; + t << "%{\"Vendor\"}" << endl << endl; + } + + // Unique vendor name + if(!containsStartWithItem(':', rawPkgPreRules)) { + t << "; Unique Vendor name" << endl; + t << ":\"Vendor\"" << endl << endl; } - t << endl; + + // PKG pre-rules - these are added before actual file installations i.e. SISX package body + if(rawPkgPreRules.size()) { + t << "; Manual PKG pre-rules from PRO files" << endl; + foreach(QString item, rawPkgPreRules) { + t << item << endl; + } + t << endl; + } // install paths on the phone *** should be dynamic at some point QString installPathBin = "!:\\sys\\bin"; @@ -378,10 +409,41 @@ bool SymbianMakefileGenerator::generatePkgFile(const QString &compiler, const QS .arg(QString(depList.at(i).from).replace('\\','/')) .arg(depList.at(i).to) << endl; } + t << endl; + + // PKG post-rules - these are added after actual file installations i.e. SISX package body + t << "; Manual PKG post-rules from PRO files" << endl; + foreach(QString deploymentItem, project->values("DEPLOYMENT")) { + foreach(QString pkgrulesItem, project->values(deploymentItem + ".pkg_postrules")) { + QStringList pkgrulesValue = project->values(pkgrulesItem); + // If there is no stringlist defined for a rule, use rule name directly + // This is convenience for defining single line mmp statements + if (pkgrulesValue.isEmpty()){ + t << pkgrulesItem << endl; + } else { + foreach(QString pkgrule, pkgrulesValue) { + t << pkgrule << endl; + } + } + t << endl; + } + } return true; } +bool SymbianMakefileGenerator::containsStartWithItem(const QChar &c, const QStringList& src) +{ + bool result = false; + foreach (QString str, src) { + if (str.startsWith(c)) { + result = true; + break; + } + } + return result; +} + bool SymbianMakefileGenerator::writeCustomDefFile() { if(targetType.compare("plugin", Qt::CaseInsensitive) == 0 && !project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) { // Create custom def file for plugin diff --git a/qmake/generators/symbian/symmake.h b/qmake/generators/symbian/symmake.h index 52c3c4d..aade0a0 100644 --- a/qmake/generators/symbian/symmake.h +++ b/qmake/generators/symbian/symmake.h @@ -86,6 +86,7 @@ protected: virtual bool writeMakefile(QTextStream &t); bool generatePkgFile(const QString &compiler, const QString &config, const QString &iconFile); + bool containsStartWithItem(const QChar &c, const QStringList& src); virtual void init(); diff --git a/src/s60installs/qt_libs.pro b/src/s60installs/qt_libs.pro index bd5c67f..a3be711 100644 --- a/src/s60installs/qt_libs.pro +++ b/src/s60installs/qt_libs.pro @@ -37,12 +37,21 @@ symbian: { #ENDIF qtlibraries.path = /sys/bin - qtlibraries.depends = "(0x20013851), 1, 5, 1, {\"PIPS Installer\"}" + + vendorinfo = \ + "; Localised Vendor name" \ + "%{\"Nokia, Qt Software\"}" \ + "; Unique Vendor name" \ + ":\"Nokia, Qt Software\"" + + qtlibraries.pkg_prerules = vendorinfo + qtlibraries.pkg_prerules += "; Dependencies of Qt libraries" + qtlibraries.pkg_prerules += "(0x20013851), 1, 5, 1, {\"PIPS Installer\"}" contains(QT_CONFIG, openssl) | contains(QT_CONFIG, openssl-linked) { - qtlibraries.depends += "(0x200110CB), 1, 5, 1, {\"Open C LIBSSL Common\"}" + qtlibraries.pkg_prerules += "(0x200110CB), 1, 5, 1, {\"Open C LIBSSL Common\"}" } contains(CONFIG, stl) { - qtlibraries.depends += "(0x2000F866), 1, 0, 0, {\"Standard C++ Library Common\"}" + qtlibraries.pkg_prerules += "(0x2000F866), 1, 0, 0, {\"Standard C++ Library Common\"}" } !contains(QT_CONFIG, no-jpeg): imageformats_plugins.sources += qjpeg.dll -- cgit v0.12 From e1a690e10098cdc29d7b4fb453f84e18855357be Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Wed, 29 Jul 2009 08:52:13 +0300 Subject: Fixed some tab/space usage in symmake.cpp --- qmake/generators/symbian/symmake.cpp | 40 ++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp index 34ab560..f2c7557 100644 --- a/qmake/generators/symbian/symmake.cpp +++ b/qmake/generators/symbian/symmake.cpp @@ -1267,7 +1267,7 @@ bool SymbianMakefileGenerator::writeRegRssFile(QString &appName, QStringList &us QFile ft(filename); if(ft.open(QIODevice::WriteOnly)) { generatedFiles << ft.fileName(); - QTextStream t(&ft); + QTextStream t(&ft); t << "// ============================================================================" << endl; t << "// * Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: "; t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl; @@ -1275,21 +1275,21 @@ bool SymbianMakefileGenerator::writeRegRssFile(QString &appName, QStringList &us t << "// * user." << endl; t << "// ============================================================================" << endl; t << endl; - t << "#include <" << appName << ".rsg>" << endl; - t << "#include " << endl; + t << "#include <" << appName << ".rsg>" << endl; + t << "#include " << endl; + t << endl; + //t << "#include " << "\n" << endl; + t << "UID2 " << "KUidAppRegistrationResourceFile" << endl; + t << "UID3 " << uid3 << endl << endl; + t << "RESOURCE APP_REGISTRATION_INFO" << endl; + t << "\t{" << endl; + t << "\tapp_file=\"" << appName << "\";" << endl; + t << "\tlocalisable_resource_file=\"" RESOURCE_DIRECTORY_RESOURCE << appName << "\";" << endl; t << endl; - //t << "#include " << "\n" << endl; - t << "UID2 " << "KUidAppRegistrationResourceFile" << endl; - t << "UID3 " << uid3 << endl << endl; - t << "RESOURCE APP_REGISTRATION_INFO" << endl; - t << "\t{" << endl; - t << "\tapp_file=\"" << appName << "\";" << endl; - t << "\tlocalisable_resource_file=\"" RESOURCE_DIRECTORY_RESOURCE << appName << "\";" << endl; - t << endl; foreach(QString item, userItems) t << "\t" << item << endl; - t << "\t}" << endl; + t << "\t}" << endl; } else { return false; } @@ -1302,7 +1302,7 @@ bool SymbianMakefileGenerator::writeRssFile(QString &appName, QString &numberOfI QFile ft(filename); if(ft.open(QIODevice::WriteOnly)) { generatedFiles << ft.fileName(); - QTextStream t(&ft); + QTextStream t(&ft); t << "// ============================================================================" << endl; t << "// * Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: "; t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl; @@ -1314,11 +1314,11 @@ bool SymbianMakefileGenerator::writeRssFile(QString &appName, QString &numberOfI t << "#include \"" << appName << ".loc\"" << endl; t << endl; t << "RESOURCE LOCALISABLE_APP_INFO r_localisable_app_info" << endl; - t << "\t{" << endl; + t << "\t{" << endl; t << "\tshort_caption = STRING_r_short_caption;" << endl; t << "\tcaption_and_icon =" << endl; t << "\tCAPTION_AND_ICON_INFO" << endl; - t << "\t\t{" << endl; + t << "\t\t{" << endl; t << "\t\tcaption = STRING_r_caption;" << endl; if(numberOfIcons.isEmpty() || iconFile.isEmpty() ) { @@ -1331,10 +1331,10 @@ bool SymbianMakefileGenerator::writeRssFile(QString &appName, QString &numberOfI t << "\t\tnumber_of_icons = " << numberOfIcons << ";" << endl; t << "\t\ticon_file = \"" << iconFile << "\";" << endl; } - t << "\t\t};" << endl; - t << "\t}" << endl; - t << endl; - } else { + t << "\t\t};" << endl; + t << "\t}" << endl; + t << endl; + } else { return false; } return true; @@ -1346,7 +1346,7 @@ bool SymbianMakefileGenerator::writeLocFile(QString &appName, QStringList &symbi QFile ft(filename); if(ft.open(QIODevice::WriteOnly)) { generatedFiles << ft.fileName(); - QTextStream t(&ft); + QTextStream t(&ft); t << "// ============================================================================" << endl; t << "// * Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: "; t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl; -- cgit v0.12 From 3fe008b1c420105865d2eb192fb7e104019c6aa3 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Wed, 29 Jul 2009 08:55:41 +0300 Subject: Removed unused method from SymbianMakefileGenerator. The getWithoutSpecialCharacters wasn't even in sync with similar removeSpecialCharacters method. --- qmake/generators/symbian/symmake.cpp | 13 ------------- qmake/generators/symbian/symmake.h | 1 - 2 files changed, 14 deletions(-) diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp index f2c7557..c842b0e 100644 --- a/qmake/generators/symbian/symmake.cpp +++ b/qmake/generators/symbian/symmake.cpp @@ -1697,19 +1697,6 @@ void SymbianMakefileGenerator::generateCleanCommands(QTextStream& t, } } -QString SymbianMakefileGenerator::getWithoutSpecialCharacters(QString& str) -{ - QString tmp = str; - - tmp.replace(QString("/"), QString("_")); - tmp.replace(QString("\\"), QString("_")); - tmp.replace(QString("-"), QString("_")); - tmp.replace(QString(":"), QString("_")); - tmp.replace(QString("."), QString("_")); - - return tmp; -} - void SymbianMakefileGenerator::removeSpecialCharacters(QString& str) { str.replace(QString("/"), QString("_")); diff --git a/qmake/generators/symbian/symmake.h b/qmake/generators/symbian/symmake.h index aade0a0..ba49118 100644 --- a/qmake/generators/symbian/symmake.h +++ b/qmake/generators/symbian/symmake.h @@ -80,7 +80,6 @@ protected: QHash qt2S60LangMapTable; void removeSpecialCharacters(QString& str); - QString getWithoutSpecialCharacters(QString& str); QString fixPathForMmp(const QString& origPath, const QDir& parentDir); QString canonizePath(const QString& origPath); -- cgit v0.12 From b9c45a1e2fd9bc19287aebd0ffe92bbfa443a6cf Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Thu, 30 Jul 2009 09:36:16 +0300 Subject: Swicthed back to original way of using AddToStackL and RemoveFromStack Task: 258504 This commit fixes the problem that background widgets do not get orientation change events, and thus will not be correctly layouted after the foreground windget is closed. See also: c17c1c101cbe09d4c6149ef8e76a9bb792222456 At the time when commit c17c1c101cbe09d4c6149ef8e76a9bb792222456 was created there were no SetFocus calls in hide_sys and show_sys. I think that has been the root cause why focus change event has not been generated. I.e. hiding a CCoeControl in Symbian (MakeVisible) does not generate focus event but setFocus(false/true) generates. I tried this code with Drilldown example. In city detaisl view the combobox was working fine with keypad navigation. The change had no effects to qcombobox autotest results and qwidget autotest resutls were better on some run and a bit worse on some run. There was variation in 2-4 qwidget autotest results on each run. Note also that screensaver seems to affect to test results. --- src/gui/kernel/qwidget_s60.cpp | 41 ++++++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 5b05e55..2b3dbf4 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -312,7 +312,17 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de data.crect.moveTopLeft(QPoint(clientRect.iTl.iX, clientRect.iTl.iY)); QSymbianControl *control= new QSymbianControl(q); control->ConstructL(true,desktop); + + if (!desktop) { + TInt stackingFlags; + if ((q->windowType() & Qt::Popup) == Qt::Popup) { + stackingFlags = ECoeStackFlagRefusesAllKeys | ECoeStackFlagRefusesFocus; + } else { + stackingFlags = ECoeStackFlagStandard; + } + control->ControlEnv()->AppUi()->AddToStackL(control, ECoeStackPriorityDefault, stackingFlags); + QTLWExtra *topExtra = topData(); topExtra->rwindow = control->DrawableWindow(); // Request mouse move events. @@ -341,6 +351,15 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de } else if (q->testAttribute(Qt::WA_NativeWindow) || paintOnScreen()) { // create native child widget QSymbianControl *control = new QSymbianControl(q); control->ConstructL(!parentWidget); + + TInt stackingFlags; + if ((q->windowType() & Qt::Popup) == Qt::Popup) { + stackingFlags = ECoeStackFlagRefusesAllKeys | ECoeStackFlagRefusesFocus; + } else { + stackingFlags = ECoeStackFlagStandard; + } + control->ControlEnv()->AppUi()->AddToStackL(control, ECoeStackPriorityDefault, stackingFlags); + setWinId(control); WId parentw = parentWidget->effectiveWinId(); control->SetContainerWindowL(*parentw); @@ -381,15 +400,9 @@ void QWidgetPrivate::show_sys() id->ActivateL(); extra->topextra->activated = 1; } - TInt stackingFlags; - if ((q->windowType() & Qt::Popup) == Qt::Popup) { - stackingFlags = ECoeStackFlagRefusesAllKeys | ECoeStackFlagRefusesFocus; - } else { - stackingFlags = ECoeStackFlagStandard; - } - id->ControlEnv()->AppUi()->AddToStackL(id, ECoeStackPriorityDefault, stackingFlags); id->MakeVisible(true); - + id->SetFocus(true); + // Force setting of the icon after window is made visible, // this is needed even WA_SetWindowIcon is not set, as in that case we need // to reset to the application level window icon @@ -406,10 +419,9 @@ void QWidgetPrivate::hide_sys() deactivateWidgetCleanup(); WId id = q->internalWinId(); if (q->isWindow() && id) { - if(id->IsFocused()) // Avoid unnecessry calls to FocusChanged() + if(id->IsFocused()) // Avoid unnecessary calls to FocusChanged() id->SetFocus(false); id->MakeVisible(false); - id->ControlEnv()->AppUi()->RemoveFromStack(id); if (QWidgetBackingStore *bs = maybeBackingStore()) bs->releaseBuffer(); } else { @@ -544,7 +556,8 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f) // destroyed when emitting the child remove event below. See QWorkspace. if (wasCreated && old_winid) { old_winid->MakeVisible(false); - old_winid->ControlEnv()->AppUi()->RemoveFromStack(old_winid); + if(old_winid->IsFocused()) // Avoid unnecessary calls to FocusChanged() + old_winid->SetFocus(false); old_winid->SetParent(0); } @@ -1028,14 +1041,16 @@ void QWidget::setWindowState(Qt::WindowStates newstate) if (newstate & Qt::WindowMinimized) { if (isVisible()) { WId id = effectiveWinId(); + if(id->IsFocused()) // Avoid unnecessary calls to FocusChanged() + id->SetFocus(false); id->MakeVisible(false); - id->ControlEnv()->AppUi()->RemoveFromStack(id); } } else { if (isVisible()) { WId id = effectiveWinId(); id->MakeVisible(true); - id->ControlEnv()->AppUi()->AddToStackL(id); + if(!id->IsFocused()) // Avoid unnecessary calls to FocusChanged() + id->SetFocus(true); } const QRect normalGeometry = geometry(); const QRect r = top->normalGeometry; -- cgit v0.12 From ab2d49bcea3cdf90c6c5702fba2bdc4e5c1986c1 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Thu, 30 Jul 2009 09:49:12 +0300 Subject: Added some spaces to pkg_prerules statements to make output more readable. --- demos/demobase.pri | 4 +++- examples/examplebase.pri | 4 +++- mkspecs/common/symbian/symbian.conf | 3 ++- src/s60installs/qt_libs.pro | 5 ++++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/demos/demobase.pri b/demos/demobase.pri index f010327..724f64b 100644 --- a/demos/demobase.pri +++ b/demos/demobase.pri @@ -4,7 +4,9 @@ symbian { vendorinfo = \ "; Localised Vendor name" \ "%{\"Nokia, Qt Software\"}" \ + " " \ "; Unique Vendor name" \ - ":\"Nokia, Qt Software\"" + ":\"Nokia, Qt Software\"" \ + " " default_deployment.pkg_prerules += vendorinfo } \ No newline at end of file diff --git a/examples/examplebase.pri b/examples/examplebase.pri index 84dcf92..70e1c37 100644 --- a/examples/examplebase.pri +++ b/examples/examplebase.pri @@ -4,8 +4,10 @@ symbian { vendorinfo = \ "; Localised Vendor name" \ "%{\"Nokia, Qt Software\"}" \ + " " \ "; Unique Vendor name" \ - ":\"Nokia, Qt Software\"" + ":\"Nokia, Qt Software\"" \ + " " default_deployment.pkg_prerules += vendorinfo } \ No newline at end of file diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf index fbadadc..554bf85 100644 --- a/mkspecs/common/symbian/symbian.conf +++ b/mkspecs/common/symbian/symbian.conf @@ -123,7 +123,8 @@ default_deployment.pkg_prerules = \ "[0x101F7961],0,0,0,{\"S60ProductID\"}" \ "[0x102032BE],0,0,0,{\"S60ProductID\"}" \ "[0x102752AE],0,0,0,{\"S60ProductID\"}" \ - "[0x1028315F],0,0,0,{\"S60ProductID\"}" + "[0x1028315F],0,0,0,{\"S60ProductID\"}" \ + " " DEPLOYMENT += default_deployment diff --git a/src/s60installs/qt_libs.pro b/src/s60installs/qt_libs.pro index a3be711..369a74e 100644 --- a/src/s60installs/qt_libs.pro +++ b/src/s60installs/qt_libs.pro @@ -41,8 +41,11 @@ symbian: { vendorinfo = \ "; Localised Vendor name" \ "%{\"Nokia, Qt Software\"}" \ + " " \ "; Unique Vendor name" \ - ":\"Nokia, Qt Software\"" + ":\"Nokia, Qt Software\"" \ + " " + qtlibraries.pkg_prerules = vendorinfo qtlibraries.pkg_prerules += "; Dependencies of Qt libraries" -- cgit v0.12 From 3ac8079726f326a60fd6216139265587f66dc1bf Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Thu, 30 Jul 2009 09:52:18 +0300 Subject: Removed tiff libarary warning: `inline' redefined. Since inline is defined by platform, it should be safe to leave it as is, and not to tuch the definition here at all. --- src/3rdparty/libtiff/libtiff/tif_config.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/3rdparty/libtiff/libtiff/tif_config.h b/src/3rdparty/libtiff/libtiff/tif_config.h index 324fbe8..f6da51b 100644 --- a/src/3rdparty/libtiff/libtiff/tif_config.h +++ b/src/3rdparty/libtiff/libtiff/tif_config.h @@ -284,10 +284,12 @@ /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef Q_OS_SYMBIAN #ifndef __cplusplus #undef inline #define inline #endif +#endif /* Define to `long' if does not define. */ /* #undef off_t */ -- cgit v0.12 From 85c37140e48411b2400dd34bdf1eb7bc38e0f73b Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Thu, 30 Jul 2009 13:16:16 +0300 Subject: Fixed UiLoader autotest case build errors for Symbian. --- tests/auto/uiloader/uiloader/tst_uiloader.cpp | 3 +++ tests/auto/uiloader/uiloader/uiloader.pro | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/auto/uiloader/uiloader/tst_uiloader.cpp b/tests/auto/uiloader/uiloader/tst_uiloader.cpp index ad93fba..114b7c3 100644 --- a/tests/auto/uiloader/uiloader/tst_uiloader.cpp +++ b/tests/auto/uiloader/uiloader/tst_uiloader.cpp @@ -46,6 +46,9 @@ #include #include +#ifdef Q_OS_SYMBIAN +#define SRCDIR "" +#endif class uiLoaderAutotest: public QObject { diff --git a/tests/auto/uiloader/uiloader/uiloader.pro b/tests/auto/uiloader/uiloader/uiloader.pro index 1c4da0b..d99df00 100644 --- a/tests/auto/uiloader/uiloader/uiloader.pro +++ b/tests/auto/uiloader/uiloader/uiloader.pro @@ -3,7 +3,7 @@ load(qttest_p4) TEMPLATE = app !embedded:CONFIG += uitools TARGET = ../tst_uiloader -DEFINES += SRCDIR=\\\"$$PWD\\\" +!symbian:DEFINES += SRCDIR=\\\"$$PWD\\\" win32 { CONFIG(debug, debug|release) { @@ -16,7 +16,7 @@ win32 { QT += xml svg network contains(QT_CONFIG, qt3support): QT += qt3support -wince*: { +wince*|symbian: { configuration.sources = ../*.ini configuration.path = . -- cgit v0.12 From 51ca17ad4017273debf6a9970e99a51137afd91e Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Thu, 30 Jul 2009 13:17:52 +0300 Subject: These autotests do not really depend on gui, fixed dependencies. This fix will make the gradual porting of different Qt modules for new platforms easier. --- tests/auto/qanimationgroup/qanimationgroup.pro | 2 +- tests/auto/qpropertyanimation/qpropertyanimation.pro | 2 +- tests/auto/qsequentialanimationgroup/qsequentialanimationgroup.pro | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/auto/qanimationgroup/qanimationgroup.pro b/tests/auto/qanimationgroup/qanimationgroup.pro index 97d33dd..31667a8 100644 --- a/tests/auto/qanimationgroup/qanimationgroup.pro +++ b/tests/auto/qanimationgroup/qanimationgroup.pro @@ -1,5 +1,5 @@ load(qttest_p4) -QT = core gui +QT = core SOURCES += tst_qanimationgroup.cpp diff --git a/tests/auto/qpropertyanimation/qpropertyanimation.pro b/tests/auto/qpropertyanimation/qpropertyanimation.pro index 6d6ddbf..9199ac3 100644 --- a/tests/auto/qpropertyanimation/qpropertyanimation.pro +++ b/tests/auto/qpropertyanimation/qpropertyanimation.pro @@ -1,5 +1,5 @@ load(qttest_p4) -QT = core gui +QT = core SOURCES += tst_qpropertyanimation.cpp diff --git a/tests/auto/qsequentialanimationgroup/qsequentialanimationgroup.pro b/tests/auto/qsequentialanimationgroup/qsequentialanimationgroup.pro index ad861c3..01ef68a 100644 --- a/tests/auto/qsequentialanimationgroup/qsequentialanimationgroup.pro +++ b/tests/auto/qsequentialanimationgroup/qsequentialanimationgroup.pro @@ -1,5 +1,5 @@ load(qttest_p4) -QT = core gui +QT = core SOURCES += tst_qsequentialanimationgroup.cpp -- cgit v0.12 From 6d2fc844e6e71e0757bc5b161563c45a0bef88ff Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Thu, 30 Jul 2009 13:35:55 +0300 Subject: Updated autotest category files for Qt 4.6 --- tests/auto/_Categories/QtCore.txt | 12 +++++++++++- tests/auto/_Categories/QtGui.txt | 6 ++++++ tests/auto/_Categories/QtNetwork.txt | 2 ++ tests/auto/_Categories/QtSql.txt | 1 - tests/auto/_Categories/QtUiTools.txt | 1 + tests/auto/_Categories/QtWebkit.txt | 5 ++++- tests/auto/_Categories/qmake.txt | 1 + 7 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 tests/auto/_Categories/QtUiTools.txt diff --git a/tests/auto/_Categories/QtCore.txt b/tests/auto/_Categories/QtCore.txt index 7238bf8..c3fb879 100644 --- a/tests/auto/_Categories/QtCore.txt +++ b/tests/auto/_Categories/QtCore.txt @@ -4,7 +4,8 @@ collections exceptionsafety qabstractitemmodel #Requires STL -qalgorithms +qalgorithms +qanimationgroup qatomicint qatomicpointer qbitarray @@ -13,6 +14,7 @@ qbytearray qbytearraymatcher qcache qchar +qcontiguouscache qcoreapplication qcryptographichash qdatastream @@ -21,6 +23,7 @@ qdatetime qdebug qdir qdiriterator +qeasingcurve qevent qeventloop qexplicitlyshareddatapointer @@ -47,11 +50,13 @@ qnumeric qobject cetest-pro: tst_qobject.pro qobjectperformance qobjectrace +qparallelanimationgroup qplugin cetest-pro: tst_qplugin.pro qpluginloader cetest-subdir: tst qpoint qpointer qprocess cetest-subdir: test +qpropertyanimation qqueue qrand qreadlocker @@ -59,7 +64,10 @@ qreadwritelock qrect qregexp qresourceengine +qringbuffer +qscopedpointer qsemaphore +qsequentialanimationgroup qset qsettings qsharedmemory cetest-subdir: test @@ -69,6 +77,8 @@ qsignalspy qsize qsizef qsocketnotifier +qstate +qstatemachine #Requires STL qstl qstring diff --git a/tests/auto/_Categories/QtGui.txt b/tests/auto/_Categories/QtGui.txt index b03a870..6ef7cfe 100644 --- a/tests/auto/_Categories/QtGui.txt +++ b/tests/auto/_Categories/QtGui.txt @@ -1,4 +1,7 @@ +exceptionsafety_objects +gestures languagechange +math3d modeltest qabstractbutton qabstractitemview @@ -59,6 +62,7 @@ qgraphicsitemanimation qgraphicslayout qgraphicslayoutitem qgraphicslinearlayout +qgraphicsobject qgraphicspixmapitem qgraphicspolygonitem qgraphicsproxywidget @@ -75,6 +79,7 @@ qimage qimageiohandler qimagereader qimagewriter +qinputcontext qinputdialog qintvalidator qitemdelegate @@ -170,6 +175,7 @@ qtoolbar qtoolbox qtoolbutton qtooltip +qtouchevent qtransform qtransformedscreen qtreeview diff --git a/tests/auto/_Categories/QtNetwork.txt b/tests/auto/_Categories/QtNetwork.txt index f5d191d..f08cfc9 100644 --- a/tests/auto/_Categories/QtNetwork.txt +++ b/tests/auto/_Categories/QtNetwork.txt @@ -11,6 +11,8 @@ qhttpnetworkreply qhttpsocketengine qlocalsocket cetest-subdir: test qnativesocketengine +#requires gui, but is more network test +qnetworkaccessmanager_and_qprogressdialog qnetworkaddressentry qnetworkcachemetadata qnetworkcookie diff --git a/tests/auto/_Categories/QtSql.txt b/tests/auto/_Categories/QtSql.txt index 1232500..4fc1614 100644 --- a/tests/auto/_Categories/QtSql.txt +++ b/tests/auto/_Categories/QtSql.txt @@ -1,5 +1,4 @@ qsql -qsqlbatch qsqldatabase qsqldriver qsqlerror diff --git a/tests/auto/_Categories/QtUiTools.txt b/tests/auto/_Categories/QtUiTools.txt new file mode 100644 index 0000000..0df0e3c --- /dev/null +++ b/tests/auto/_Categories/QtUiTools.txt @@ -0,0 +1 @@ +uiloader \ No newline at end of file diff --git a/tests/auto/_Categories/QtWebkit.txt b/tests/auto/_Categories/QtWebkit.txt index 5c29b20..90ea514 100644 --- a/tests/auto/_Categories/QtWebkit.txt +++ b/tests/auto/_Categories/QtWebkit.txt @@ -1,2 +1,5 @@ +qwebelement qwebframe -qwebpage +qwebhistory +qwebhistoryinterface +qwebpage \ No newline at end of file diff --git a/tests/auto/_Categories/qmake.txt b/tests/auto/_Categories/qmake.txt index e69de29..8fa141f 100644 --- a/tests/auto/_Categories/qmake.txt +++ b/tests/auto/_Categories/qmake.txt @@ -0,0 +1 @@ +qmake \ No newline at end of file -- cgit v0.12 From 85b9a2ff7f956d97eb9109ef9c4fef66344a3f8f Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Fri, 31 Jul 2009 15:28:09 +0300 Subject: Removed unnecessary code, UID is associated to wserv by framework. This code was inialy added before we had s60main. Since that time we did not had S60 application framework classes constructed we had to associate application UID to wserv manually to get fast swap window (FSW) working correctly. Now application frameworks take care of associating the UID to wserv window group. --- src/gui/kernel/qapplication_s60.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index d47747f..766ca4b 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -723,11 +723,6 @@ void qt_init(QApplicationPrivate * /* priv */, int) TSecureId securId = me.SecureId(); S60->uid = securId.operator TUid(); - // New code to configure the window group name such that window server knows the associated application's UID - CApaWindowGroupName *wgn = CApaWindowGroupName::NewL(S60->wsSession()); - wgn->SetAppUid(S60->uid); - User::LeaveIfError(wgn->SetWindowGroupName((S60->windowGroup()))); - delete wgn; /* ### Commented out for now as parameter handling not needed in SOS(yet). Code below will break testlib with -o flag -- cgit v0.12 From ae597a532683e5d544400b62497c870cf570b069 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Fri, 31 Jul 2009 15:31:16 +0300 Subject: Restored window title after another top-level window was closed. Task: 249995 The window title in S60 is global entity, i.e. is located in application status pane. When top level window, for example mesage box is closed, the window title has to be restored for window which is getting the focus. This way we don't leave title from destroyed window to title bar. It is also into question, whether the non-maximized dialogs should set title to statuspane at all. For now they will, but things may change if we switch to use native dialogs. --- src/gui/kernel/qwidget_s60.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 2b3dbf4..d860eba 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -765,8 +765,12 @@ void QWidgetPrivate::setWindowTitle_sys(const QString &caption) if (q->isWindow()) { Q_ASSERT(q->testAttribute(Qt::WA_WState_Created)); CAknTitlePane* titlePane = S60->titlePane(); - if(titlePane) - titlePane->SetTextL(qt_QString2TPtrC(caption)); + if(titlePane) { + if(caption.isEmpty()) + titlePane->SetTextToDefaultL(); + else + titlePane->SetTextL(qt_QString2TPtrC(caption)); + } } #else Q_UNUSED(caption) @@ -1113,8 +1117,10 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows) // the next visible window will get keyboard focus WId wid = CEikonEnv::Static()->AppUi()->TopFocusedControl(); if (wid) { - QWidget *widget = QWidget::find(wid); + QWidget *widget = QWidget::find(wid); QApplication::setActiveWindow(widget); + // Reset global window title for focusing window + widget->d_func()->setWindowTitle_sys(widget->windowTitle()); } } -- cgit v0.12 From 1b18cf510e749dbaf120c1597b2ee57730fa4f3b Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 3 Aug 2009 14:32:07 +0300 Subject: Fixed SRCDIR usage for Symbian in qtextcodec autotest --- tests/auto/qtextcodec/test/test.pro | 5 +++++ tests/auto/qtextcodec/tst_qtextcodec.cpp | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/tests/auto/qtextcodec/test/test.pro b/tests/auto/qtextcodec/test/test.pro index 7d4fdb3..7748ce4 100644 --- a/tests/auto/qtextcodec/test/test.pro +++ b/tests/auto/qtextcodec/test/test.pro @@ -6,7 +6,12 @@ wince*|symbian { addFiles.path = . DEPLOYMENT += addFiles DEPLOYMENT_PLUGIN += qcncodecs qjpcodecs qkrcodecs qtwcodecs +} + +wince*: { DEFINES += SRCDIR=\\\"\\\" +}else:symbian { + # Symbian can't define SRCDIR meaningfully here } else { DEFINES += SRCDIR=\\\"$$PWD/../\\\" } diff --git a/tests/auto/qtextcodec/tst_qtextcodec.cpp b/tests/auto/qtextcodec/tst_qtextcodec.cpp index 750b4ec..5899b10 100644 --- a/tests/auto/qtextcodec/tst_qtextcodec.cpp +++ b/tests/auto/qtextcodec/tst_qtextcodec.cpp @@ -48,6 +48,11 @@ #include #include +#ifdef Q_OS_SYMBIAN +#define SRCDIR "" +#endif + + class tst_QTextCodec : public QObject { Q_OBJECT -- cgit v0.12 From f4d1a087e7b9224b54851d8049cf2724633d7959 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 3 Aug 2009 15:15:49 +0300 Subject: Fixed incorrect port usage in qiodevice test --- tests/auto/qiodevice/tst_qiodevice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qiodevice/tst_qiodevice.cpp b/tests/auto/qiodevice/tst_qiodevice.cpp index 8a76626..ded9bf4 100644 --- a/tests/auto/qiodevice/tst_qiodevice.cpp +++ b/tests/auto/qiodevice/tst_qiodevice.cpp @@ -124,7 +124,7 @@ void tst_QIODevice::constructing_QTcpSocket() QVERIFY(!device->isOpen()); - socket.connectToHost(QtNetworkSettings::serverName(), 21); + socket.connectToHost(QtNetworkSettings::serverName(), 143); QVERIFY(socket.waitForConnected(5000)); QVERIFY(device->isOpen()); -- cgit v0.12 From 78b769c7d433e38352ac936c4d1f2e35134f5fa0 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Mon, 3 Aug 2009 15:39:54 +0300 Subject: Trailing whitespace and tab/space fixes for QtNetwork --- src/network/access/qhttpnetworkreply.cpp | 2 +- src/network/access/qnetworkcookie.h | 2 +- src/network/access/qnetworkrequest.h | 2 +- src/network/kernel/qnetworkinterface.cpp | 6 +- src/network/kernel/qnetworkinterface_symbian.cpp | 70 ++++++++-------- src/network/network.pro | 1 - src/network/socket/qlocalserver_unix.cpp | 10 +-- src/network/socket/qlocalsocket_unix.cpp | 14 ++-- src/network/socket/qnativesocketengine.cpp | 8 +- src/network/socket/qnativesocketengine_p.h | 4 +- src/network/socket/qnativesocketengine_unix.cpp | 102 +++++++++++------------ src/network/socket/qudpsocket.cpp | 16 ++-- src/network/ssl/qsslsocket_openssl_symbols.cpp | 4 +- src/network/ssl/ssl.pri | 4 +- 14 files changed, 122 insertions(+), 123 deletions(-) diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp index ef4a865..5319252 100644 --- a/src/network/access/qhttpnetworkreply.cpp +++ b/src/network/access/qhttpnetworkreply.cpp @@ -550,7 +550,7 @@ bool QHttpNetworkReplyPrivate::connectionCloseEnabled() // note this function can only be used for non-chunked, non-compressed with // known content length qint64 QHttpNetworkReplyPrivate::readBodyFast(QAbstractSocket *socket, QRingBuffer *rb) -{ +{ quint64 toBeRead = qMin(socket->bytesAvailable(), bodyLength - contentRead); char* dst = rb->reserve(toBeRead); qint64 haveRead = socket->read(dst, toBeRead); diff --git a/src/network/access/qnetworkcookie.h b/src/network/access/qnetworkcookie.h index c5f03fb..1bae7ae 100644 --- a/src/network/access/qnetworkcookie.h +++ b/src/network/access/qnetworkcookie.h @@ -67,7 +67,7 @@ public: Full }; - QNetworkCookie(); + QNetworkCookie(); QNetworkCookie(const QByteArray &name ); QNetworkCookie(const QByteArray &name, const QByteArray &value ); QNetworkCookie(const QNetworkCookie &other); diff --git a/src/network/access/qnetworkrequest.h b/src/network/access/qnetworkrequest.h index a53aed3..cf06f7c 100644 --- a/src/network/access/qnetworkrequest.h +++ b/src/network/access/qnetworkrequest.h @@ -89,7 +89,7 @@ public: explicit QNetworkRequest(); - explicit QNetworkRequest(const QUrl &url); + explicit QNetworkRequest(const QUrl &url); QNetworkRequest(const QNetworkRequest &other); ~QNetworkRequest(); QNetworkRequest &operator=(const QNetworkRequest &other); diff --git a/src/network/kernel/qnetworkinterface.cpp b/src/network/kernel/qnetworkinterface.cpp index 953722c..e588c18 100644 --- a/src/network/kernel/qnetworkinterface.cpp +++ b/src/network/kernel/qnetworkinterface.cpp @@ -128,7 +128,7 @@ QString QNetworkInterfacePrivate::makeHwAddress(int len, uchar *data) for (int i = 0; i < len; ++i) { if (i) result += QLatin1Char(':'); - + char buf[3]; #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && defined(_MSC_VER) && _MSC_VER >= 1400 sprintf_s(buf, 3, "%02hX", ushort(data[i])); @@ -603,13 +603,13 @@ QDebug operator<<(QDebug debug, const QNetworkInterface &networkInterface) << ", hardware address = " << networkInterface.hardwareAddress() << ", flags = "; flagsDebug(debug, networkInterface.flags()); -#if defined(Q_CC_RVCT) +#if defined(Q_CC_RVCT) // RVCT gets confused with << networkInterface.addressEntries(), reason unknown. debug.nospace() << ")\n"; #else debug.nospace() << ", entries = " << networkInterface.addressEntries() << ")\n"; -#endif +#endif return debug.space(); } #endif diff --git a/src/network/kernel/qnetworkinterface_symbian.cpp b/src/network/kernel/qnetworkinterface_symbian.cpp index d3aafa3..bec2dc3 100644 --- a/src/network/kernel/qnetworkinterface_symbian.cpp +++ b/src/network/kernel/qnetworkinterface_symbian.cpp @@ -69,14 +69,14 @@ static QNetworkInterface::InterfaceFlags convertFlags( const TSoInetInterfaceInf flags |= (aInfo.iState == EIfUp) ? QNetworkInterface::IsUp : QNetworkInterface::InterfaceFlag(0); // We do not have separate flag for running in Symbian OS flags |= (aInfo.iState == EIfUp) ? QNetworkInterface::IsRunning : QNetworkInterface::InterfaceFlag(0); - flags |= (aInfo.iFeatures&KIfCanBroadcast) ? QNetworkInterface::CanBroadcast : QNetworkInterface::InterfaceFlag(0); + flags |= (aInfo.iFeatures&KIfCanBroadcast) ? QNetworkInterface::CanBroadcast : QNetworkInterface::InterfaceFlag(0); flags |= (aInfo.iFeatures&KIfIsLoopback) ? QNetworkInterface::IsLoopBack : QNetworkInterface::InterfaceFlag(0); flags |= (aInfo.iFeatures&KIfIsPointToPoint) ? QNetworkInterface::IsPointToPoint : QNetworkInterface::InterfaceFlag(0); flags |= (aInfo.iFeatures&KIfCanMulticast) ? QNetworkInterface::CanMulticast : QNetworkInterface::InterfaceFlag(0); return flags; } -QString qstringFromDesc( const TDesC& aData ) +QString qstringFromDesc( const TDesC& aData ) { return QString::fromUtf16(aData.Ptr(), aData.Length()); } @@ -85,20 +85,20 @@ static QList interfaceListing() { TInt err( KErrNone ); QList interfaces; - + // Connect to Native socket server RSocketServ socketServ; err = socketServ.Connect(); if( err ) return interfaces; - + // Open dummy socket for interface queries RSocket socket; err = socket.Open( socketServ, _L("udp")); if( err ) { socketServ.Close(); - return interfaces; + return interfaces; } // Ask socket to start enumerating interfaces @@ -107,8 +107,8 @@ static QList interfaceListing() { socket.Close(); socketServ.Close(); - return interfaces; - } + return interfaces; + } int ifindex = 0; TPckgBuf infoPckg; @@ -118,74 +118,74 @@ static QList interfaceListing() // Do not include IPv6 addresses because netmask and broadcast address cannot be determined correctly if( info.iName != KNullDesC && info.iAddress.IsV4Mapped() ) { - TName address; - QNetworkAddressEntry entry; - QNetworkInterfacePrivate *iface = 0; - - iface = new QNetworkInterfacePrivate; + TName address; + QNetworkAddressEntry entry; + QNetworkInterfacePrivate *iface = 0; + + iface = new QNetworkInterfacePrivate; iface->index = ifindex++; interfaces << iface; iface->name = qstringFromDesc( info.iName ); iface->flags = convertFlags( info ); - + if( /*info.iFeatures&KIfHasHardwareAddr &&*/ info.iHwAddr.Family() != KAFUnspec ) { - for ( TInt i = sizeof(SSockAddr); i < sizeof(SSockAddr) + info.iHwAddr.GetUserLen(); i++ ) + for ( TInt i = sizeof(SSockAddr); i < sizeof(SSockAddr) + info.iHwAddr.GetUserLen(); i++ ) { address.AppendNumFixedWidth(info.iHwAddr[i], EHex, 2); if( ( i + 1) < sizeof(SSockAddr) + info.iHwAddr.GetUserLen() ) address.Append( _L(":") ); - } - address.UpperCase(); + } + address.UpperCase(); iface->hardwareAddress = qstringFromDesc( address ); } - + // Get the address of the interface info.iAddress.Output(address); - entry.setIp( QHostAddress( qstringFromDesc( address ) ) ); + entry.setIp( QHostAddress( qstringFromDesc( address ) ) ); - // Get the interface netmask - // TODO: For some reason netmask is always 0.0.0.0 + // Get the interface netmask + // TODO: For some reason netmask is always 0.0.0.0 //info.iNetMask.Output(address); - //entry.setNetmask( QHostAddress( qstringFromDesc( address ) ) ); - + //entry.setNetmask( QHostAddress( qstringFromDesc( address ) ) ); + // Workaround: Let Symbian determine netmask based on IP address class // TODO: works only for IPv4 TInetAddr netmask; netmask.NetMask( info.iAddress ); netmask.Output(address); - entry.setNetmask( QHostAddress( qstringFromDesc( address ) ) ); - + entry.setNetmask( QHostAddress( qstringFromDesc( address ) ) ); + // Get the interface broadcast address - if (iface->flags & QNetworkInterface::CanBroadcast) + if (iface->flags & QNetworkInterface::CanBroadcast) { // For some reason broadcast address is always 0.0.0.0 // info.iBrdAddr.Output(address); - // entry.setBroadcast( QHostAddress( qstringFromDesc( address ) ) ); - + // entry.setBroadcast( QHostAddress( qstringFromDesc( address ) ) ); + // Workaround: Let Symbian determine broadcast address based on IP address // TODO: works only for IPv4 TInetAddr broadcast; - broadcast.NetBroadcast( info.iAddress ); + broadcast.NetBroadcast( info.iAddress ); broadcast.Output(address); entry.setBroadcast( QHostAddress( qstringFromDesc( address ) ) ); } - + // Add new entry to interface address entries - iface->addressEntries << entry; - -#if defined(QNETWORKINTERFACE_DEBUG) + iface->addressEntries << entry; + +#if defined(QNETWORKINTERFACE_DEBUG) printf("\n Found network interface %s, interface flags:\n\ IsUp = %d, IsRunning = %d, CanBroadcast = %d,\n\ IsLoopBack = %d, IsPointToPoint = %d, CanMulticast = %d, \n\ ip = %s, netmask = %s, broadcast = %s,\n\ - hwaddress = %s", + hwaddress = %s", iface->name.toLatin1().constData(), iface->flags & QNetworkInterface::IsUp, iface->flags & QNetworkInterface::IsRunning, iface->flags & QNetworkInterface::CanBroadcast, iface->flags & QNetworkInterface::IsLoopBack, iface->flags & QNetworkInterface::IsPointToPoint, iface->flags & QNetworkInterface::CanMulticast, entry.ip().toString().toLatin1().constData(), entry.netmask().toString().toLatin1().constData(), entry.broadcast().toString().toLatin1().constData(), - iface->hardwareAddress.toLatin1().constData()); -#endif + iface->hardwareAddress.toLatin1().constData()); +#endif } } diff --git a/src/network/network.pro b/src/network/network.pro index 59cffd0..e890b94 100644 --- a/src/network/network.pro +++ b/src/network/network.pro @@ -28,4 +28,3 @@ symbian { TARGET.UID3=0x2001B2DE LIBS += -lesock -linsock } - diff --git a/src/network/socket/qlocalserver_unix.cpp b/src/network/socket/qlocalserver_unix.cpp index e4bc1aa..b05a2cc 100644 --- a/src/network/socket/qlocalserver_unix.cpp +++ b/src/network/socket/qlocalserver_unix.cpp @@ -112,7 +112,7 @@ bool QLocalServerPrivate::listen(const QString &requestedServerName) // // As an workaround, we set the socket to non blocking so possible // subsequent call to accept will not block in any case - // + // // This change can be removed once more generic fix to select thread // syncronization problem is implemented. int flags = fcntl(listenSocket, F_GETFL, 0); @@ -120,10 +120,10 @@ bool QLocalServerPrivate::listen(const QString &requestedServerName) || -1 == (fcntl(listenSocket, F_SETFL, flags | O_NONBLOCK))) { setError(QLatin1String("QLocalServer::listen")); closeServer(); - return false; - } -#endif - + return false; + } +#endif + // bind if(-1 == qBind(listenSocket, (sockaddr *)&addr, sizeof(sockaddr_un))) { setError(QLatin1String("QLocalServer::listen")); diff --git a/src/network/socket/qlocalsocket_unix.cpp b/src/network/socket/qlocalsocket_unix.cpp index cba5a7f..b2eb15f 100644 --- a/src/network/socket/qlocalsocket_unix.cpp +++ b/src/network/socket/qlocalsocket_unix.cpp @@ -301,7 +301,7 @@ void QLocalSocketPrivate::_q_connectToSocket() case ETIMEDOUT: errorOccurred(QLocalSocket::SocketTimeoutError, function); break; - case EINPROGRESS: + case EINPROGRESS: case EAGAIN: // Try again later, all of the sockets listening are full if (!delayConnect) { @@ -534,14 +534,14 @@ bool QLocalSocket::waitForConnected(int msec) timer.start(); while (state() == ConnectingState && (-1 == msec || timer.elapsed() < msec)) { -#ifdef Q_OS_SYMBIAN - // On Symbian, ready-to-write is signaled when non-blocking socket - // connect is finised. Is ready-to-read really used on other - // UNIX paltforms when using non-blocking AF_UNIX socket? +#ifdef Q_OS_SYMBIAN + // On Symbian, ready-to-write is signaled when non-blocking socket + // connect is finised. Is ready-to-read really used on other + // UNIX paltforms when using non-blocking AF_UNIX socket? result = ::select(d->connectingSocket + 1, 0, &fds, 0, &timeout); #else - result = ::select(d->connectingSocket + 1, &fds, 0, 0, &timeout); -#endif + result = ::select(d->connectingSocket + 1, &fds, 0, 0, &timeout); +#endif if (-1 == result && errno != EINTR) { d->errorOccurred( QLocalSocket::UnknownSocketError, QLatin1String("QLocalSocket::waitForConnected")); diff --git a/src/network/socket/qnativesocketengine.cpp b/src/network/socket/qnativesocketengine.cpp index 666c86e..f88094a 100644 --- a/src/network/socket/qnativesocketengine.cpp +++ b/src/network/socket/qnativesocketengine.cpp @@ -381,13 +381,13 @@ bool QNativeSocketEngine::initialize(QAbstractSocket::SocketType socketType, QAb return false; } - + // Make sure we receive out-of-band data // On Symbian OS this works only with native IP stack, not with WinSock if (socketType == QAbstractSocket::TcpSocket && !setOption(ReceiveOutOfBandData, 1)) { qWarning("QNativeSocketEngine::initialize unable to inline out-of-band data"); - } + } // Set the send and receive buffer sizes to a magic size, found // most optimal for our platforms. @@ -913,7 +913,7 @@ bool QNativeSocketEngine::waitForReadOrWrite(bool *readyToRead, bool *readyToWri d_func()->fetchConnectionParameters(); return true; } -#endif +#endif if (ret == 0) { if (timedOut) *timedOut = true; @@ -1094,7 +1094,7 @@ bool QExceptionNotifier::event(QEvent *e) engine->exceptionNotification(); return true; } - return QSocketNotifier::event(e); + return QSocketNotifier::event(e); } void QNativeSocketEngine::setReadNotificationEnabled(bool enable) diff --git a/src/network/socket/qnativesocketengine_p.h b/src/network/socket/qnativesocketengine_p.h index a8d7fff..c2881b0 100644 --- a/src/network/socket/qnativesocketengine_p.h +++ b/src/network/socket/qnativesocketengine_p.h @@ -351,8 +351,8 @@ public: struct sockaddr_storage aa; #else struct sockaddr_in aa; -#endif - +#endif + QSocketNotifier *readNotifier, *writeNotifier, *exceptNotifier; #ifdef Q_OS_WIN diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp index 58adaff..0027c8e 100644 --- a/src/network/socket/qnativesocketengine_unix.cpp +++ b/src/network/socket/qnativesocketengine_unix.cpp @@ -281,7 +281,7 @@ bool QNativeSocketEnginePrivate::setOption(QNativeSocketEngine::SocketOption opt } case QNativeSocketEngine::AddressReusable: #ifdef Q_OS_SYMBIAN - n = SO_REUSEADDR; + n = SO_REUSEADDR; #elif SO_REUSEPORT n = SO_REUSEPORT; #else @@ -295,7 +295,7 @@ bool QNativeSocketEnginePrivate::setOption(QNativeSocketEngine::SocketOption opt break; } - return qt_socket_setsockopt(socketDescriptor, SOL_SOCKET, n, (char *) &v, sizeof(v)) == 0; + return qt_socket_setsockopt(socketDescriptor, SOL_SOCKET, n, (char *) &v, sizeof(v)) == 0; } @@ -303,8 +303,8 @@ bool QNativeSocketEnginePrivate::nativeConnect(const QHostAddress &addr, quint16 { #ifdef QNATIVESOCKETENGINE_DEBUG qDebug("QNativeSocketEnginePrivate::nativeConnect() : %d ", socketDescriptor); -#endif - +#endif + struct sockaddr_in sockAddrIPv4; struct sockaddr *sockAddrPtr = 0; QT_SOCKLEN_T sockAddrSize = 0; @@ -571,7 +571,7 @@ bool QNativeSocketEnginePrivate::nativeHasPendingDatagrams() const #ifdef Q_OS_SYMBIAN qint64 QNativeSocketEnginePrivate::nativePendingDatagramSize() const { - size_t nbytes = 0; + size_t nbytes = 0; qt_socket_ioctl(socketDescriptor, E32IONREAD, (char *) &nbytes); return qint64(nbytes-28); } @@ -579,7 +579,7 @@ qint64 QNativeSocketEnginePrivate::nativePendingDatagramSize() const qint64 QNativeSocketEnginePrivate::nativePendingDatagramSize() const { QVarLengthArray udpMessagePeekBuffer(8192); - ssize_t recvResult = -1; + ssize_t recvResult = -1; for (;;) { // the data written to udpMessagePeekBuffer is discarded, so @@ -595,7 +595,7 @@ qint64 QNativeSocketEnginePrivate::nativePendingDatagramSize() const udpMessagePeekBuffer.resize(udpMessagePeekBuffer.size() * 2); } - + #if defined (QNATIVESOCKETENGINE_DEBUG) qDebug("QNativeSocketEnginePrivate::nativePendingDatagramSize() == %i", recvResult); #endif @@ -644,23 +644,23 @@ qint64 QNativeSocketEnginePrivate::nativeSendDatagram(const char *data, qint64 l #if !defined(QT_NO_IPV6) struct sockaddr_in6 sockAddrIPv6; if (host.protocol() == QAbstractSocket::IPv6Protocol) { - memset(&sockAddrIPv6, 0, sizeof(sockAddrIPv6)); - sockAddrIPv6.sin6_family = AF_INET6; - sockAddrIPv6.sin6_port = htons(port); - - Q_IPV6ADDR tmp = host.toIPv6Address(); - memcpy(&sockAddrIPv6.sin6_addr.s6_addr, &tmp, sizeof(tmp)); - sockAddrSize = sizeof(sockAddrIPv6); - sockAddrPtr = (struct sockaddr *)&sockAddrIPv6; + memset(&sockAddrIPv6, 0, sizeof(sockAddrIPv6)); + sockAddrIPv6.sin6_family = AF_INET6; + sockAddrIPv6.sin6_port = htons(port); + + Q_IPV6ADDR tmp = host.toIPv6Address(); + memcpy(&sockAddrIPv6.sin6_addr.s6_addr, &tmp, sizeof(tmp)); + sockAddrSize = sizeof(sockAddrIPv6); + sockAddrPtr = (struct sockaddr *)&sockAddrIPv6; } else #endif if (host.protocol() == QAbstractSocket::IPv4Protocol) { - memset(&sockAddrIPv4, 0, sizeof(sockAddrIPv4)); - sockAddrIPv4.sin_family = AF_INET; - sockAddrIPv4.sin_port = htons(port); - sockAddrIPv4.sin_addr.s_addr = htonl(host.toIPv4Address()); - sockAddrSize = sizeof(sockAddrIPv4); - sockAddrPtr = (struct sockaddr *)&sockAddrIPv4; + memset(&sockAddrIPv4, 0, sizeof(sockAddrIPv4)); + sockAddrIPv4.sin_family = AF_INET; + sockAddrIPv4.sin_port = htons(port); + sockAddrIPv4.sin_addr.s_addr = htonl(host.toIPv4Address()); + sockAddrSize = sizeof(sockAddrIPv4); + sockAddrPtr = (struct sockaddr *)&sockAddrIPv4; } // ignore the SIGPIPE signal @@ -870,10 +870,10 @@ int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool selectForRead) co tv.tv_sec = timeout / 1000; tv.tv_usec = (timeout % 1000) * 1000; -#ifdef Q_OS_SYMBIAN +#ifdef Q_OS_SYMBIAN fd_set fdexec; FD_ZERO(&fdexec); - FD_SET(socketDescriptor, &fdexec); + FD_SET(socketDescriptor, &fdexec); #endif QTime timer; @@ -884,18 +884,18 @@ int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool selectForRead) co if (selectForRead) #ifndef Q_OS_SYMBIAN retval = qt_socket_select(socketDescriptor + 1, &fds, 0, 0, timeout < 0 ? 0 : &tv); -#else - retval = qt_socket_select(socketDescriptor + 1, &fds, 0, &fdexec, timeout < 0 ? 0 : &tv); -#endif +#else + retval = qt_socket_select(socketDescriptor + 1, &fds, 0, &fdexec, timeout < 0 ? 0 : &tv); +#endif else #ifndef Q_OS_SYMBIAN retval = qt_socket_select(socketDescriptor + 1, 0, &fds, 0, timeout < 0 ? 0 : &tv); -#else - retval = qt_socket_select(socketDescriptor + 1, 0, &fds, &fdexec, timeout < 0 ? 0 : &tv); -#endif +#else + retval = qt_socket_select(socketDescriptor + 1, 0, &fds, &fdexec, timeout < 0 ? 0 : &tv); +#endif + - -#ifdef Q_OS_SYMBIAN +#ifdef Q_OS_SYMBIAN bool selectForExec = false; if(retval != 0) { if(retval < 0) { @@ -904,10 +904,10 @@ int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool selectForRead) co selectForExec = FD_ISSET(socketDescriptor, &fdexec); } if(selectForExec) { - qWarning("nativeSelect (selectForRead %d, retVal %d, errno %d) Unexpected expectfds ready in fd %d", - selectForRead, retval, errno, socketDescriptor); - } -#endif + qWarning("nativeSelect (selectForRead %d, retVal %d, errno %d) Unexpected expectfds ready in fd %d", + selectForRead, retval, errno, socketDescriptor); + } +#endif if (retval != -1 || errno != EINTR) { break; @@ -931,7 +931,7 @@ int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool selectForRead) co } int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool checkRead, bool checkWrite, - bool *selectForRead, bool *selectForWrite) const + bool *selectForRead, bool *selectForWrite) const { fd_set fdread; FD_ZERO(&fdread); @@ -942,12 +942,12 @@ int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool checkRead, bool c FD_ZERO(&fdwrite); if (checkWrite) FD_SET(socketDescriptor, &fdwrite); - -#ifdef Q_OS_SYMBIAN + +#ifdef Q_OS_SYMBIAN fd_set fdexec; FD_ZERO(&fdexec); - FD_SET(socketDescriptor, &fdexec); -#endif + FD_SET(socketDescriptor, &fdexec); +#endif struct timeval tv; tv.tv_sec = timeout / 1000; @@ -960,7 +960,7 @@ int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool checkRead, bool c do { #ifndef Q_OS_SYMBIAN ret = qt_socket_select(socketDescriptor + 1, &fdread, &fdwrite, 0, timeout < 0 ? 0 : &tv); -#else +#else ret = qt_socket_select(socketDescriptor + 1, &fdread, &fdwrite, &fdexec, timeout < 0 ? 0 : &tv); bool selectForExec = false; if(ret != 0) { @@ -970,18 +970,18 @@ int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool checkRead, bool c selectForExec = FD_ISSET(socketDescriptor, &fdexec); } if(selectForExec) { - qWarning("nativeSelect (checkRead %d, checkWrite %d, ret %d, errno %d): Unexpected expectfds ready in fd %d", - checkRead, checkWrite, ret, errno, socketDescriptor); - if (checkRead) - FD_SET(socketDescriptor, &fdread); - if (checkWrite) - FD_SET(socketDescriptor, &fdwrite); - - if ((ret == -1) && ( errno == ECONNREFUSED || errno == EPIPE )) + qWarning("nativeSelect (checkRead %d, checkWrite %d, ret %d, errno %d): Unexpected expectfds ready in fd %d", + checkRead, checkWrite, ret, errno, socketDescriptor); + if (checkRead) + FD_SET(socketDescriptor, &fdread); + if (checkWrite) + FD_SET(socketDescriptor, &fdwrite); + + if ((ret == -1) && ( errno == ECONNREFUSED || errno == EPIPE )) ret = 1; - + } -#endif +#endif if (ret != -1 || errno != EINTR) { break; } diff --git a/src/network/socket/qudpsocket.cpp b/src/network/socket/qudpsocket.cpp index 61b28ba..8e641d9 100644 --- a/src/network/socket/qudpsocket.cpp +++ b/src/network/socket/qudpsocket.cpp @@ -91,12 +91,12 @@ This enum describes the different flags you can pass to modify the behavior of QUdpSocket::bind(). - + \note On Symbian OS bind flags behaviour depends on process capabilties. - If process has NetworkControl capability, the bind attempt with + If process has NetworkControl capability, the bind attempt with ReuseAddressHint will always succeed even the address and port is already - bound by another socket with any flags. If process does not have - NetworkControl capability, the bind attempt to address and port already + bound by another socket with any flags. If process does not have + NetworkControl capability, the bind attempt to address and port already bound by another socket will always fail. \value ShareAddress Allow other services to bind to the same address @@ -353,7 +353,7 @@ qint64 QUdpSocket::pendingDatagramSize() const as even if they are sent successfully, they are likely to be fragmented by the IP layer before arriving at their final destination. - + \warning In S60 5.0 and earlier versions, the writeDatagram return value is not reliable for large datagrams. @@ -383,8 +383,8 @@ qint64 QUdpSocket::writeDatagram(const char *data, qint64 size, const QHostAddre // As an workaround, we just set sent = size if( sent == 0 ) sent = size; - } -#endif + } +#endif d->cachedSocketDescriptor = d->socketEngine->socketDescriptor(); if (sent >= 0) { @@ -397,7 +397,7 @@ qint64 QUdpSocket::writeDatagram(const char *data, qint64 size, const QHostAddre return sent; } -/*! +/*! \fn qint64 QUdpSocket::writeDatagram(const QByteArray &datagram, const QHostAddress &host, quint16 port) \overload diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp index 6b777e3..2199a58 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols.cpp +++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp @@ -602,7 +602,7 @@ bool q_resolveOpenSslSymbols() RESOLVEFUNC(d2i_RSAPrivateKey, 2296, libs.second ) #endif RESOLVEFUNC(OPENSSL_add_all_algorithms_noconf, 1153, libs.second ) - RESOLVEFUNC(OPENSSL_add_all_algorithms_conf, 1152, libs.second ) + RESOLVEFUNC(OPENSSL_add_all_algorithms_conf, 1152, libs.second ) #else // Q_OS_SYMBIAN #ifdef SSLEAY_MACROS RESOLVEFUNC(ASN1_dup) @@ -723,7 +723,7 @@ bool q_resolveOpenSslSymbols() #endif RESOLVEFUNC(OPENSSL_add_all_algorithms_noconf) RESOLVEFUNC(OPENSSL_add_all_algorithms_conf) -#endif // Q_OS_SYMBIAN +#endif // Q_OS_SYMBIAN symbolsResolved = true; delete libs.first; delete libs.second; diff --git a/src/network/ssl/ssl.pri b/src/network/ssl/ssl.pri index 6021d5d..d07f406 100644 --- a/src/network/ssl/ssl.pri +++ b/src/network/ssl/ssl.pri @@ -1,11 +1,11 @@ # OpenSSL support; compile in QSslSocket. contains(QT_CONFIG, openssl) | contains(QT_CONFIG, openssl-linked) { - + symbian { INCLUDEPATH *= $$OS_LAYER_SSL_SYSTEMINCLUDE } else { - include($$QT_SOURCE_TREE/config.tests/unix/openssl/openssl.pri) + include($$QT_SOURCE_TREE/config.tests/unix/openssl/openssl.pri) } HEADERS += ssl/qssl.h \ -- cgit v0.12 From 41a83e1ff19ad1396e6001e6b0ac003c701ba55a Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Mon, 3 Aug 2009 15:12:46 +0200 Subject: Squashed commit of the topic/exceptions branch. Contains some smaller fixes and renaming of macros. Looks big, but isn't scary at all ;) --- .../code/src_corelib_tools_qscopedpointer.cpp | 21 ++ doc/src/symbian-exceptionsafety.qdoc | 78 ++++++- examples/script/qsdbg/scriptdebugger.h | 2 +- mkspecs/common/symbian/qplatformdefs.h | 6 +- src/3rdparty/freetype/src/base/ftobjs.c | 20 +- src/3rdparty/freetype/src/base/ftstream.c | 2 +- src/3rdparty/freetype/src/truetype/ttinterp.c | 2 - src/3rdparty/freetype/src/truetype/ttpload.c | 6 +- src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp | 20 +- src/3rdparty/phonon/phonon/abstractmediastream.h | 2 +- src/3rdparty/phonon/phonon/iodevicestream_p.h | 2 +- src/corelib/animation/qabstractanimation.h | 2 +- src/corelib/animation/qanimationgroup.h | 2 +- src/corelib/animation/qparallelanimationgroup.h | 2 +- src/corelib/animation/qpauseanimation.h | 2 +- src/corelib/animation/qpropertyanimation.h | 2 +- src/corelib/animation/qsequentialanimationgroup.h | 2 +- src/corelib/animation/qvariantanimation.h | 2 +- src/corelib/arch/symbian/qatomic_symbian.cpp | 31 +++ src/corelib/concurrent/qfuturewatcher.h | 2 +- src/corelib/concurrent/qthreadpool.h | 2 +- src/corelib/global/qglobal.cpp | 84 ++++--- src/corelib/global/qglobal.h | 41 ++-- src/corelib/io/qabstractfileengine.h | 2 +- src/corelib/io/qbuffer.h | 2 +- src/corelib/io/qdir.cpp | 10 +- src/corelib/io/qdir.h | 2 +- src/corelib/io/qfile.h | 2 +- src/corelib/io/qfileinfo.h | 2 +- src/corelib/io/qfilesystemwatcher.h | 2 +- src/corelib/io/qfilesystemwatcher_symbian.cpp | 2 +- src/corelib/io/qfsfileengine.h | 2 +- src/corelib/io/qfsfileengine_unix.cpp | 6 +- src/corelib/io/qiodevice.h | 2 +- src/corelib/io/qprocess.h | 2 +- src/corelib/io/qresource.h | 2 +- src/corelib/io/qresource_p.h | 2 +- src/corelib/io/qsettings.cpp | 12 +- src/corelib/io/qsettings.h | 2 +- src/corelib/io/qsettings_p.h | 2 + src/corelib/io/qtemporaryfile.cpp | 2 +- src/corelib/io/qtemporaryfile.h | 2 +- src/corelib/io/qtextstream.h | 2 +- src/corelib/kernel/qabstracteventdispatcher.h | 2 +- src/corelib/kernel/qabstractitemmodel.h | 2 +- src/corelib/kernel/qcore_symbian_p.cpp | 8 +- src/corelib/kernel/qcore_symbian_p.h | 4 +- src/corelib/kernel/qcoreapplication.cpp | 4 + src/corelib/kernel/qcoreapplication.h | 2 +- src/corelib/kernel/qeventdispatcher_glib_p.h | 2 +- src/corelib/kernel/qeventdispatcher_symbian.cpp | 43 ++-- src/corelib/kernel/qeventdispatcher_symbian_p.h | 5 +- src/corelib/kernel/qeventdispatcher_unix_p.h | 2 +- src/corelib/kernel/qeventdispatcher_win_p.h | 2 +- src/corelib/kernel/qeventloop.h | 2 +- src/corelib/kernel/qmetaobject.cpp | 2 + src/corelib/kernel/qmetatype.cpp | 2 +- src/corelib/kernel/qmimedata.h | 2 +- src/corelib/kernel/qobject.cpp | 99 ++++++-- src/corelib/kernel/qobject.h | 2 +- src/corelib/kernel/qsharedmemory.h | 2 +- src/corelib/kernel/qsignalmapper.h | 2 +- src/corelib/kernel/qsocketnotifier.h | 2 +- src/corelib/kernel/qtranslator.h | 2 +- src/corelib/kernel/qwineventnotifier_p.h | 2 +- src/corelib/plugin/qfactoryloader_p.h | 2 +- src/corelib/statemachine/qabstractstate.h | 2 +- src/corelib/statemachine/qabstracttransition.h | 2 +- src/corelib/statemachine/qeventtransition.h | 2 +- src/corelib/statemachine/qfinalstate.h | 2 +- src/corelib/statemachine/qhistorystate.h | 2 +- src/corelib/statemachine/qsignaltransition.h | 2 +- src/corelib/statemachine/qstate.h | 2 +- src/corelib/statemachine/qstatemachine.h | 2 +- src/corelib/thread/qthread.h | 4 +- src/corelib/thread/qthread_p.h | 2 +- src/corelib/tools/qbytearray.cpp | 1 + src/corelib/tools/qhash.h | 13 +- src/corelib/tools/qlist.h | 23 +- src/corelib/tools/qlistdata.cpp | 40 +++- src/corelib/tools/qlocale.cpp | 17 +- src/corelib/tools/qlocale_symbian.cpp | 16 +- src/corelib/tools/qregexp.cpp | 10 +- src/corelib/tools/qringbuffer_p.h | 7 +- src/corelib/tools/qscopedpointer.cpp | 38 ++- src/corelib/tools/qscopedpointer.h | 118 +++++++--- src/corelib/tools/qstring.cpp | 9 +- src/corelib/tools/qtimeline.h | 2 +- src/corelib/xml/qxmlstream.h | 4 +- src/corelib/xml/qxmlstream_p.h | 1 + src/dbus/qdbusabstractadaptor.h | 2 +- src/dbus/qdbusabstractinterface.h | 2 +- src/dbus/qdbusinterface.h | 2 +- src/dbus/qdbuspendingcall.h | 2 +- src/gui/accessible/qaccessiblewidget.cpp | 2 +- src/gui/dialogs/qabstractpagesetupdialog.h | 2 +- src/gui/dialogs/qabstractprintdialog.h | 2 +- src/gui/dialogs/qcolordialog.h | 2 +- src/gui/dialogs/qdialog.h | 2 +- src/gui/dialogs/qerrormessage.h | 2 +- src/gui/dialogs/qfiledialog.h | 2 +- src/gui/dialogs/qfilesystemmodel.h | 2 +- src/gui/dialogs/qfontdialog.h | 2 +- src/gui/dialogs/qinputdialog.h | 2 +- src/gui/dialogs/qmessagebox.h | 2 +- src/gui/dialogs/qpagesetupdialog.h | 2 +- src/gui/dialogs/qprintdialog.h | 2 +- src/gui/dialogs/qprintpreviewdialog.h | 2 +- src/gui/dialogs/qprogressdialog.h | 2 +- src/gui/dialogs/qwizard.h | 4 +- src/gui/dialogs/qwizard_win.cpp | 2 +- src/gui/embedded/qdirectpainter_qws.h | 2 +- src/gui/embedded/qscreen_qws.cpp | 2 +- src/gui/embedded/qtransportauth_qws.h | 2 +- src/gui/embedded/qwindowsystem_qws.cpp | 14 +- src/gui/embedded/qwindowsystem_qws.h | 4 +- src/gui/embedded/qwsembedwidget.h | 2 +- src/gui/embedded/qwsmanager_qws.h | 2 +- src/gui/graphicsview/qgraphicsgridlayout.h | 2 +- src/gui/graphicsview/qgraphicsitem.h | 20 +- src/gui/graphicsview/qgraphicslayout.h | 2 +- src/gui/graphicsview/qgraphicslayoutitem.h | 2 +- src/gui/graphicsview/qgraphicslinearlayout.h | 2 +- src/gui/graphicsview/qgraphicsscene.h | 2 +- src/gui/graphicsview/qgraphicssceneevent.h | 20 +- src/gui/graphicsview/qgraphicsview.h | 2 +- src/gui/image/qimageiohandler.h | 2 +- src/gui/image/qmovie.h | 2 +- src/gui/image/qpaintengine_pic_p.h | 2 +- src/gui/image/qpicture.h | 2 +- src/gui/image/qpixmap.cpp | 24 +- src/gui/image/qpixmap_raster.cpp | 10 +- src/gui/image/qpixmap_s60.cpp | 4 +- src/gui/image/qpixmapcache.cpp | 3 +- src/gui/image/qpixmapfilter_p.h | 8 +- src/gui/inputmethod/qcoefepinputcontext_p.h | 1 + src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 19 +- src/gui/inputmethod/qinputcontext.h | 2 +- src/gui/inputmethod/qmacinputcontext_p.h | 2 +- src/gui/itemviews/qabstractitemview.h | 2 +- src/gui/itemviews/qabstractproxymodel.h | 2 +- src/gui/itemviews/qcolumnview.h | 2 +- src/gui/itemviews/qcolumnviewgrip_p.h | 2 +- src/gui/itemviews/qdatawidgetmapper.h | 2 +- src/gui/itemviews/qdirmodel.h | 2 +- src/gui/itemviews/qfileiconprovider.h | 2 +- src/gui/itemviews/qheaderview.h | 2 +- src/gui/itemviews/qitemdelegate.h | 2 +- src/gui/itemviews/qitemselectionmodel.h | 2 +- src/gui/itemviews/qlistview.h | 2 +- src/gui/itemviews/qlistwidget.h | 2 +- src/gui/itemviews/qproxymodel.h | 2 +- src/gui/itemviews/qsortfilterproxymodel.h | 2 +- src/gui/itemviews/qstandarditemmodel.h | 4 +- src/gui/itemviews/qstyleditemdelegate.h | 2 +- src/gui/itemviews/qtableview.h | 2 +- src/gui/itemviews/qtablewidget.h | 2 +- src/gui/itemviews/qtreeview.h | 2 +- src/gui/itemviews/qtreewidget.h | 2 +- src/gui/itemviews/qtreewidget_p.h | 2 +- src/gui/itemviews/qtreewidgetitemiterator.h | 2 +- src/gui/kernel/qaction.h | 2 +- src/gui/kernel/qactiongroup.h | 2 +- src/gui/kernel/qapplication.cpp | 33 +-- src/gui/kernel/qapplication.h | 2 +- src/gui/kernel/qapplication_qws.cpp | 12 +- src/gui/kernel/qapplication_s60.cpp | 12 +- src/gui/kernel/qapplication_win.cpp | 2 +- src/gui/kernel/qboxlayout.cpp | 29 ++- src/gui/kernel/qboxlayout.h | 2 +- src/gui/kernel/qclipboard.h | 2 +- src/gui/kernel/qclipboard_s60.cpp | 15 +- src/gui/kernel/qdesktopwidget.h | 2 +- src/gui/kernel/qdesktopwidget_x11.cpp | 2 +- src/gui/kernel/qdnd_s60.cpp | 2 +- src/gui/kernel/qdnd_x11.cpp | 2 +- src/gui/kernel/qdrag.h | 2 +- src/gui/kernel/qeventdispatcher_glib_qws_p.h | 2 +- src/gui/kernel/qeventdispatcher_mac_p.h | 2 +- src/gui/kernel/qeventdispatcher_qws_p.h | 2 +- src/gui/kernel/qeventdispatcher_s60.cpp | 2 +- src/gui/kernel/qeventdispatcher_x11_p.h | 2 +- src/gui/kernel/qformlayout.h | 2 +- src/gui/kernel/qgesture.h | 4 +- src/gui/kernel/qgesturerecognizer.h | 2 +- src/gui/kernel/qgridlayout.h | 2 +- src/gui/kernel/qguieventdispatcher_glib_p.h | 2 +- src/gui/kernel/qkeymapper_mac.cpp | 10 +- src/gui/kernel/qkeymapper_p.h | 4 +- src/gui/kernel/qkeymapper_win.cpp | 9 +- src/gui/kernel/qkeysequence.cpp | 4 +- src/gui/kernel/qlayout.h | 2 +- src/gui/kernel/qsessionmanager.h | 2 +- src/gui/kernel/qshortcut.h | 2 +- src/gui/kernel/qshortcutmap_p.h | 2 +- src/gui/kernel/qsound.h | 2 +- src/gui/kernel/qstackedlayout.h | 2 +- src/gui/kernel/qt_s60_p.h | 10 +- src/gui/kernel/qwidget.cpp | 74 ++++-- src/gui/kernel/qwidget.h | 2 +- src/gui/kernel/qwidget_mac.mm | 6 +- src/gui/kernel/qwidget_p.h | 7 +- src/gui/kernel/qwidget_qws.cpp | 9 +- src/gui/kernel/qwidget_s60.cpp | 34 +-- src/gui/kernel/qwidget_win.cpp | 6 +- src/gui/kernel/qwidget_x11.cpp | 6 +- src/gui/kernel/qwidgetaction.h | 2 +- src/gui/kernel/qx11embed_x11.cpp | 2 +- src/gui/kernel/qx11embed_x11.h | 4 +- src/gui/painting/qbrush.cpp | 10 +- src/gui/painting/qbrush.h | 4 +- src/gui/painting/qgrayraster.c | 4 + src/gui/painting/qpaintengine.h | 2 +- src/gui/painting/qpaintengine_alpha_p.h | 2 +- src/gui/painting/qpaintengine_mac_p.h | 2 +- src/gui/painting/qpaintengine_preview_p.h | 2 +- src/gui/painting/qpaintengine_raster.cpp | 98 ++++---- src/gui/painting/qpaintengine_raster_p.h | 16 +- src/gui/painting/qpaintengine_x11.cpp | 2 +- src/gui/painting/qpaintengine_x11_p.h | 2 +- src/gui/painting/qpaintengineex_p.h | 2 +- src/gui/painting/qpainter.cpp | 19 +- src/gui/painting/qpainter.h | 6 +- src/gui/painting/qpainterpath.cpp | 9 +- src/gui/painting/qpainterpath.h | 8 +- src/gui/painting/qpdf_p.h | 2 +- src/gui/painting/qprintengine_mac_p.h | 2 +- src/gui/painting/qprintengine_pdf_p.h | 2 +- src/gui/painting/qprintengine_ps_p.h | 2 +- src/gui/painting/qprintengine_qws_p.h | 2 +- src/gui/painting/qprintengine_win_p.h | 2 +- src/gui/painting/qprinter.h | 2 +- src/gui/painting/qprinterinfo.h | 6 +- src/gui/painting/qprinterinfo_mac.cpp | 8 +- src/gui/painting/qprinterinfo_unix.cpp | 8 +- src/gui/painting/qprinterinfo_win.cpp | 8 +- src/gui/painting/qrasterizer.cpp | 4 +- src/gui/painting/qtessellator.cpp | 12 +- src/gui/painting/qwindowsurface_raster_p.h | 2 +- src/gui/painting/qwindowsurface_s60.cpp | 9 +- src/gui/statemachine/qbasickeyeventtransition_p.h | 2 +- .../statemachine/qbasicmouseeventtransition_p.h | 2 +- src/gui/statemachine/qkeyeventtransition.h | 2 +- src/gui/statemachine/qmouseeventtransition.h | 2 +- src/gui/styles/qcleanlooksstyle.h | 2 +- src/gui/styles/qcommonstyle.cpp | 4 +- src/gui/styles/qcommonstyle.h | 2 +- src/gui/styles/qgtkstyle.h | 2 +- src/gui/styles/qmotifstyle.h | 2 +- src/gui/styles/qplastiquestyle.h | 2 +- src/gui/styles/qproxystyle.h | 2 +- src/gui/styles/qs60style.cpp | 22 +- src/gui/styles/qs60style.h | 2 +- src/gui/styles/qs60style_p.h | 2 +- src/gui/styles/qs60style_s60.cpp | 53 +++-- src/gui/styles/qstyle.h | 2 +- src/gui/styles/qstylesheetstyle_p.h | 2 +- src/gui/styles/qwindowsmobilestyle.h | 2 +- src/gui/styles/qwindowsstyle.h | 2 +- src/gui/styles/qwindowsvistastyle.h | 2 +- src/gui/styles/qwindowsxpstyle.h | 2 +- src/gui/text/qabstractfontengine_qws.h | 4 +- src/gui/text/qabstracttextdocumentlayout.h | 2 +- src/gui/text/qfontdatabase.cpp | 4 +- src/gui/text/qfontdatabase_qws.cpp | 86 +++---- src/gui/text/qfontdatabase_s60.cpp | 17 +- src/gui/text/qfontengine.cpp | 4 +- src/gui/text/qfontengine_ft.cpp | 19 +- src/gui/text/qfontengine_ft_p.h | 2 +- src/gui/text/qfontengine_s60.cpp | 8 +- src/gui/text/qfontengine_win.cpp | 11 +- src/gui/text/qfragmentmap_p.h | 13 +- src/gui/text/qsyntaxhighlighter.h | 2 +- src/gui/text/qtextcontrol_p.h | 2 +- src/gui/text/qtextdocument.h | 2 +- src/gui/text/qtextdocument_p.cpp | 76 +++--- src/gui/text/qtextdocumentlayout_p.h | 2 +- src/gui/text/qtextformat.cpp | 16 +- src/gui/text/qtextlist.h | 2 +- src/gui/text/qtextobject.h | 6 +- src/gui/text/qtexttable.cpp | 8 +- src/gui/text/qtexttable.h | 2 +- src/gui/util/qcompleter.cpp | 7 +- src/gui/util/qcompleter.h | 2 +- src/gui/util/qcompleter_p.h | 5 +- src/gui/util/qdesktopservices_s60.cpp | 57 +++-- src/gui/util/qsystemtrayicon.h | 2 +- src/gui/util/qundogroup.h | 2 +- src/gui/util/qundostack.h | 2 +- src/gui/util/qundoview.h | 2 +- src/gui/widgets/qabstractbutton.h | 2 +- src/gui/widgets/qabstractscrollarea.h | 2 +- src/gui/widgets/qabstractslider.h | 2 +- src/gui/widgets/qabstractspinbox.h | 2 +- src/gui/widgets/qbuttongroup.h | 2 +- src/gui/widgets/qcalendarwidget.h | 2 +- src/gui/widgets/qcheckbox.h | 2 +- src/gui/widgets/qcombobox.cpp | 8 +- src/gui/widgets/qcombobox.h | 2 +- src/gui/widgets/qcommandlinkbutton.h | 2 +- src/gui/widgets/qdatetimeedit.h | 2 +- src/gui/widgets/qdial.h | 2 +- src/gui/widgets/qdialogbuttonbox.h | 2 +- src/gui/widgets/qdockwidget.h | 2 +- src/gui/widgets/qfocusframe.h | 2 +- src/gui/widgets/qfontcombobox.h | 2 +- src/gui/widgets/qframe.h | 2 +- src/gui/widgets/qgroupbox.h | 2 +- src/gui/widgets/qlabel.h | 2 +- src/gui/widgets/qlcdnumber.h | 2 +- src/gui/widgets/qlineedit.h | 2 +- src/gui/widgets/qmaccocoaviewcontainer_mac.h | 2 +- src/gui/widgets/qmacnativewidget_mac.h | 2 +- src/gui/widgets/qmainwindow.h | 2 +- src/gui/widgets/qmdiarea.h | 2 +- src/gui/widgets/qmdisubwindow.h | 2 +- src/gui/widgets/qmenu.cpp | 2 +- src/gui/widgets/qmenu.h | 2 +- src/gui/widgets/qmenu_symbian.cpp | 4 +- src/gui/widgets/qmenubar.h | 2 +- src/gui/widgets/qplaintextedit.h | 4 +- src/gui/widgets/qprintpreviewwidget.h | 2 +- src/gui/widgets/qprogressbar.h | 2 +- src/gui/widgets/qpushbutton.h | 2 +- src/gui/widgets/qradiobutton.h | 2 +- src/gui/widgets/qrubberband.h | 2 +- src/gui/widgets/qscrollarea.h | 2 +- src/gui/widgets/qscrollbar.h | 2 +- src/gui/widgets/qsizegrip.h | 2 +- src/gui/widgets/qslider.h | 2 +- src/gui/widgets/qspinbox.h | 4 +- src/gui/widgets/qsplashscreen.h | 2 +- src/gui/widgets/qsplitter.h | 4 +- src/gui/widgets/qstackedwidget.h | 2 +- src/gui/widgets/qstatusbar.h | 2 +- src/gui/widgets/qtabbar.h | 2 +- src/gui/widgets/qtabwidget.h | 2 +- src/gui/widgets/qtextbrowser.h | 2 +- src/gui/widgets/qtextedit.h | 2 +- src/gui/widgets/qtoolbar.h | 2 +- src/gui/widgets/qtoolbox.h | 2 +- src/gui/widgets/qtoolbutton.h | 2 +- src/gui/widgets/qvalidator.h | 4 +- src/gui/widgets/qworkspace.cpp | 2 +- src/gui/widgets/qworkspace.h | 2 +- src/network/access/qabstractnetworkcache.h | 2 +- src/network/access/qftp.h | 2 +- src/network/access/qhttp.h | 8 +- src/network/access/qhttpnetworkconnection_p.h | 2 +- src/network/access/qhttpnetworkreply_p.h | 2 +- src/network/access/qnetworkaccessmanager.h | 2 +- src/network/access/qnetworkcookie.h | 2 +- src/network/access/qnetworkdiskcache.h | 2 +- src/network/access/qnetworkreply.h | 2 +- src/network/access/qnetworkreplyimpl_p.h | 2 +- src/network/socket/qabstractsocket.h | 2 +- src/network/socket/qabstractsocketengine_p.h | 2 +- src/network/socket/qhttpsocketengine_p.h | 2 +- src/network/socket/qlocalserver.h | 2 +- src/network/socket/qlocalsocket.h | 2 +- src/network/socket/qnativesocketengine_p.h | 2 +- src/network/socket/qsocks5socketengine_p.h | 2 +- src/network/socket/qtcpserver.h | 2 +- src/network/socket/qtcpsocket.h | 2 +- src/network/socket/qudpsocket.h | 2 +- src/network/ssl/qsslsocket.h | 2 +- .../gl2paintengineex/qpaintengineex_opengl2_p.h | 2 +- src/opengl/qgl.h | 4 +- src/opengl/qglframebufferobject.h | 2 +- src/opengl/qglpaintdevice_qws_p.h | 2 +- src/opengl/qglpixelbuffer.h | 2 +- src/opengl/qglscreen_qws.h | 2 +- src/opengl/qglwindowsurface_qws_p.h | 2 +- src/opengl/qpaintengine_opengl_p.h | 2 +- .../gfxdrivers/directfb/qdirectfbpaintengine.h | 2 +- src/plugins/imageformats/mng/qmnghandler.h | 2 +- src/plugins/s60/src/qdesktopservices_3_2.cpp | 18 +- src/qt3support/other/q3dragobject.h | 8 +- src/qt3support/painting/q3paintengine_svg_p.h | 2 +- src/qt3support/widgets/q3mainwindow.h | 2 +- src/qt3support/widgets/q3titlebar_p.h | 2 +- src/s60main/qts60main_mcrt0.cpp | 9 +- src/s60main/qts60mainappui.cpp | 7 +- src/script/qscriptable.h | 2 +- src/script/qscriptclass.h | 2 +- src/script/qscriptclasspropertyiterator.h | 2 +- src/script/qscriptcontext.h | 2 +- src/script/qscriptcontextinfo.h | 2 +- src/script/qscriptengine.h | 4 +- src/script/qscriptengineagent.h | 2 +- src/script/qscriptstring.cpp | 8 +- src/script/qscriptstring.h | 6 +- src/script/qscriptvalue.cpp | 8 +- src/script/qscriptvalue.h | 6 +- src/script/qscriptvalueiterator.h | 2 +- .../debugging/qscriptbreakpointdata_p.h | 2 +- .../debugging/qscriptbreakpointsmodel_p.h | 2 +- .../debugging/qscriptbreakpointswidget_p.h | 2 +- .../qscriptbreakpointswidgetinterface_p.h | 2 +- .../debugging/qscriptcompletiontask_p.h | 2 +- .../debugging/qscriptcompletiontaskinterface_p.h | 2 +- src/scripttools/debugging/qscriptdebugger_p.h | 2 +- src/scripttools/debugging/qscriptdebuggeragent_p.h | 2 +- .../debugging/qscriptdebuggerbackend_p.h | 2 +- .../debugging/qscriptdebuggercodefinderwidget_p.h | 2 +- .../qscriptdebuggercodefinderwidgetinterface_p.h | 2 +- .../debugging/qscriptdebuggercodeview_p.h | 2 +- .../debugging/qscriptdebuggercodeviewinterface_p.h | 2 +- .../debugging/qscriptdebuggercodewidget_p.h | 2 +- .../qscriptdebuggercodewidgetinterface_p.h | 2 +- .../debugging/qscriptdebuggercommand_p.h | 2 +- .../debugging/qscriptdebuggercommandexecutor_p.h | 2 +- .../qscriptdebuggercommandschedulerjob_p.h | 2 +- .../debugging/qscriptdebuggerconsole_p.h | 2 +- .../debugging/qscriptdebuggerconsolecommand_p.h | 2 +- .../qscriptdebuggerconsolecommandgroupdata_p.h | 2 +- .../debugging/qscriptdebuggerconsolecommandjob_p.h | 2 +- .../qscriptdebuggerconsolecommandmanager_p.h | 2 +- .../qscriptdebuggerconsoleglobalobject_p.h | 2 +- .../debugging/qscriptdebuggerconsolewidget_p.h | 2 +- .../qscriptdebuggerconsolewidgetinterface_p.h | 2 +- src/scripttools/debugging/qscriptdebuggerevent_p.h | 2 +- .../debugging/qscriptdebuggerfrontend_p.h | 2 +- src/scripttools/debugging/qscriptdebuggerjob_p.h | 2 +- .../debugging/qscriptdebuggerlocalsmodel_p.h | 2 +- .../debugging/qscriptdebuggerlocalswidget_p.h | 2 +- .../qscriptdebuggerlocalswidgetinterface_p.h | 2 +- .../debugging/qscriptdebuggerresponse_p.h | 2 +- .../qscriptdebuggerscriptedconsolecommand.cpp | 2 +- .../qscriptdebuggerscriptedconsolecommand_p.h | 2 +- .../debugging/qscriptdebuggerscriptsmodel_p.h | 2 +- .../debugging/qscriptdebuggerscriptswidget_p.h | 2 +- .../qscriptdebuggerscriptswidgetinterface_p.h | 2 +- .../debugging/qscriptdebuggerstackmodel_p.h | 2 +- .../debugging/qscriptdebuggerstackwidget_p.h | 2 +- .../qscriptdebuggerstackwidgetinterface_p.h | 2 +- src/scripttools/debugging/qscriptdebuggervalue_p.h | 2 +- .../debugging/qscriptdebuggervalueproperty_p.h | 2 +- .../debugging/qscriptdebugoutputwidget_p.h | 2 +- .../qscriptdebugoutputwidgetinterface_p.h | 2 +- src/scripttools/debugging/qscriptenginedebugger.h | 2 +- .../debugging/qscriptenginedebuggerfrontend.cpp | 2 +- .../debugging/qscriptenginedebuggerfrontend_p.h | 2 +- .../debugging/qscripterrorlogwidget_p.h | 2 +- .../debugging/qscripterrorlogwidgetinterface_p.h | 2 +- src/scripttools/debugging/qscriptscriptdata_p.h | 2 +- .../debugging/qscriptstdmessagehandler_p.h | 2 +- src/scripttools/debugging/qscriptvalueproperty_p.h | 2 +- src/sql/kernel/qsqldriver.h | 2 +- src/sql/models/qsqlquerymodel.h | 2 +- src/sql/models/qsqlrelationaltablemodel.h | 2 +- src/sql/models/qsqltablemodel.h | 2 +- src/svg/qgraphicssvgitem.h | 2 +- src/svg/qsvggenerator.cpp | 2 +- src/svg/qsvggenerator.h | 2 +- src/svg/qsvgrenderer.h | 2 +- src/svg/qsvgwidget.h | 2 +- src/testlib/qplaintestlogger.cpp | 18 +- src/xml/sax/qxml.h | 2 +- src/xmlpatterns/api/qabstractmessagehandler.h | 2 +- src/xmlpatterns/api/qabstracturiresolver.h | 2 +- src/xmlpatterns/api/qsimplexmlnodemodel.h | 2 +- src/xmlpatterns/api/qxmlformatter.h | 2 +- src/xmlpatterns/api/qxmlresultitems.h | 2 +- src/xmlpatterns/api/qxmlserializer.h | 2 +- tests/auto/exceptionsafety_objects/oomsimulator.h | 158 ++++++++++--- .../tst_exceptionsafety_objects.cpp | 257 +++++++++++++++++---- tests/auto/qfiledialog/tst_qfiledialog.cpp | 2 +- .../auto/qfilesystemmodel/tst_qfilesystemmodel.cpp | 2 +- tests/auto/qglobal/tst_qglobal.cpp | 10 + .../qstandarditemmodel/tst_qstandarditemmodel.cpp | 2 +- .../qmainexceptions/tst_qmainexceptions.cpp | 156 ++++++++++++- .../src/components/formeditor/brushmanagerproxy.h | 2 +- .../src/components/formeditor/qtbrushmanager.h | 2 +- tools/designer/src/lib/shared/iconselector_p.h | 4 +- .../src/lib/shared/qtresourceeditordialog_p.h | 2 +- tools/designer/src/lib/shared/qtresourcemodel_p.h | 4 +- tools/designer/src/lib/shared/qtresourceview_p.h | 4 +- tools/designer/src/uitools/quiloader.h | 2 +- tools/shared/qtgradienteditor/qtcolorbutton.h | 2 +- tools/shared/qtgradienteditor/qtcolorline.h | 2 +- tools/shared/qtgradienteditor/qtgradientdialog.h | 2 +- tools/shared/qtgradienteditor/qtgradienteditor.h | 2 +- .../qtgradienteditor/qtgradientstopscontroller.h | 2 +- .../shared/qtgradienteditor/qtgradientstopsmodel.h | 2 +- .../qtgradienteditor/qtgradientstopswidget.h | 2 +- tools/shared/qtgradienteditor/qtgradientwidget.h | 2 +- .../qtpropertybrowser/qtbuttonpropertybrowser.h | 2 +- tools/shared/qtpropertybrowser/qteditorfactory.h | 30 +-- .../qtpropertybrowser/qtgroupboxpropertybrowser.h | 2 +- tools/shared/qtpropertybrowser/qtpropertybrowser.h | 4 +- tools/shared/qtpropertybrowser/qtpropertymanager.h | 44 ++-- .../qtpropertybrowser/qttreepropertybrowser.h | 2 +- tools/shared/qtpropertybrowser/qtvariantproperty.h | 4 +- tools/shared/qttoolbardialog/qttoolbardialog.cpp | 2 +- tools/shared/qttoolbardialog/qttoolbardialog.h | 4 +- 496 files changed, 2155 insertions(+), 1261 deletions(-) diff --git a/doc/src/snippets/code/src_corelib_tools_qscopedpointer.cpp b/doc/src/snippets/code/src_corelib_tools_qscopedpointer.cpp index 7de42b7..b625eb2 100644 --- a/doc/src/snippets/code/src_corelib_tools_qscopedpointer.cpp +++ b/doc/src/snippets/code/src_corelib_tools_qscopedpointer.cpp @@ -27,6 +27,7 @@ void myFunction(bool useSubClass) //! [1] void myFunction(bool useSubClass) { + // assuming that MyClass has a virtual destructor QScopedPointer p(useSubClass ? new MyClass() : new MySubClass); QScopedPointer device(handsOverOwnership()); @@ -80,3 +81,23 @@ private: // generate them. }; //! [4] + +//! [5] +// this QScopedPointer deletes its data using the delete[] operator: +QScopedPointer > arrayPointer(new int[42]); + +// this QScopedPointer frees its data using free(): +QScopedPointer > podPointer(reinterpret_cast(malloc(42))); + +// this struct calls "myCustomDeallocator" to delete the pointer +struct ScopedPointerCustomDeleter +{ + static inline void cleanup(MyCustomClass *pointer) + { + myCustomDeallocator(pointer); + } +}; + +// QScopedPointer using a custom deleter: +QScopedPointer customPointer(new MyCustomClass); +//! [5] diff --git a/doc/src/symbian-exceptionsafety.qdoc b/doc/src/symbian-exceptionsafety.qdoc index 56b28c9..df18031 100644 --- a/doc/src/symbian-exceptionsafety.qdoc +++ b/doc/src/symbian-exceptionsafety.qdoc @@ -80,11 +80,16 @@ Symbian leaves to standard C++ exceptions. The following help is provided: \list - \o \l qt_translateSymbianErrorToException() takes a Symbian + \o \l qt_throwIfError() takes a Symbian error code and throws an appropriate exception to represent it. This will do nothing if the error code is not in fact an error. The function is equivalent to Symbian's \c User::LeaveIfError. - \o \l QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION() takes a Symbian leaving + \o \l q_check_ptr() takes a pointer and throws a std::bad_alloc + exception if it is 0, otherwise the pointer is returned. This can be + used to check the success of a non-throwing allocation, eg from + \c malloc(). The function is equivalent to Symbian's \c + User::LeaveIfNull. + \o \l QT_TRAP_THROWING() takes a Symbian leaving code fragment f and runs it under a trap harness converting any resulting error into an exception. \o \c TRAP and \c TRAPD from the Symbian libraries can be used to convert @@ -94,16 +99,35 @@ \code HBufC* buf=0; // this will throw a std::bad_alloc because we've asked for too much memory - QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION(buf = HBufC::NewL(100000000)); + QT_TRAP_THROWING(buf = HBufC::NewL(100000000)); _LIT(KStr,"abc"); TInt pos = KStr().Locate('c'); // pos is a good value, >= 0, so no exception is thrown - qt_translateSymbianErrorToException(pos); + qt_throwIfError(pos); pos = KStr().Locate('d'); // pos == KErrNotFound, so this throws an exception - qt_translateSymbianErrorToException(pos); + qt_throwIfError(pos); + + // we are asking for a lot of memory, HBufC::New may return NULL, so check it + HBufC *buffer = q_check_ptr(HBufC::New(1000000)); + \endcode + + \section2 Be careful with new and CBase + + When writing Qt code, \c new will normally throw a \c std::bad_alloc if the + allocation fails. However this may not happen if the object being created + has its own \c {operator new}. For example, CBase and derived classes have + their own \c {operator new} which returns 0 and the \c {new(ELeave)} + overload for a leaving \c {operator new}, neither of which does what we want. + When using 2-phase construction of CBase derived objects, use \c new and + \l q_check_ptr(). + + \oldcode + CFbsBitmap* fbsBitmap = new(ELeave) CFbsBitmap; + \newcode + CFbsBitmap* fbsBitmap = q_check_ptr(new CFbsBitmap); \endcode \section1 Qt called from Symbian @@ -113,18 +137,18 @@ provided: \list - \o \l qt_translateExceptionToSymbianError() - + \o \l qt_exception2SymbianError() - this takes a standard exception and gives an appropriate Symbian error code. If no mapping is known for the exception type, \c KErrGeneral is returned. - \o \l qt_translateExceptionToSymbianErrorL() - + \o \l qt_exception2SymbianLeaveL() - this takes a standard exception and generates an appropriate Symbian leave. - \o \l QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_ERROR() - this macro + \o \l QT_TRYCATCH_ERROR() - this macro takes the standard C++ code fragment \c f, catches any std::exceptions thrown from it, and sets err to the corresponding Symbian error code. err is set to \c KErrNone otherwise. - \o \l QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_LEAVE() - this macro takes the + \o \l QT_TRYCATCH_LEAVING() - this macro takes the standard C++ code fragment \c f, catches any std::exceptions thrown from it, and throws a corresponding Symbian leave. \endlist @@ -133,7 +157,7 @@ TInt DoTickL() // called from an active object RunL, ie Symbian leaves expected { // without the translation to Symbian Leave, we get a USER:0 panic - QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_LEAVE({ + QT_TRYCATCH_LEAVING({ int* x = new int[100000000]; // compiled as Qt code, will throw std::bad_alloc delete [] x; }); @@ -180,4 +204,38 @@ Now the exception generating functions are separated from the leaving functions. + + \section1 Advanced technique + When using Symbian APIs in Qt code, you may find that Symbian leaving + code and Qt exception throwing code are just too mixed up to have + them interoperate through barriers. In some circumstances you can allow + code to both leave and throw exceptions. But you must be aware of the + following issues: + + \list + \o Depending on whether a leave or exception is thrown, or a normal + exit happens, the cleanup order will vary. If the code leaves, + cleanup stack cleanup will happen first. On an exception however, + cleanup stack cleanup will happen last. + \o There must not be any destructor dependencies between different + code styles. That is, you must not have symbian objects using Qt + objects in their destructors, and vice versa. This is because the + cleanup order varies, and may result in objects being used after + they are deleted. + \o The cleanup stack must not refer to any stack based object. For + instance, in Symbian you may use \c CleanupClosePushL() to push + stack based R-classes onto the cleanup stack. However if the + stack has unwound due to an exception before the cleanup stack + cleanup happens, stack based objects will now be invalid. + Instead of using the cleanup stack, consider Symbian's new + \c LManagedHandle<> (or a custom cleanup object) to tie R-class + cleanup to the stack. + \o Mixed throwing code must be called within both a TRAP and a + try/catch harness. Standard exceptions must not propagate to + the TRAP and cleanup stack cleanup will only happen if a leave + is thrown, so the correct pattern is either \c {TRAPD(err, + QT_TRYCATCH_LEAVING( f ));} or \c {QT_TRAP_THROWING( + QT_TRYCATCH_LEAVING( f ));}, depending if you want an error + code or exception as a result. + \endlist */ diff --git a/examples/script/qsdbg/scriptdebugger.h b/examples/script/qsdbg/scriptdebugger.h index 2d4ba07..4752511 100644 --- a/examples/script/qsdbg/scriptdebugger.h +++ b/examples/script/qsdbg/scriptdebugger.h @@ -78,7 +78,7 @@ protected: ScriptDebuggerPrivate *d_ptr; private: - Q_DECLARE_PRIVATE(ScriptDebugger) + Q_DECLARE_SCOPED_PRIVATE(ScriptDebugger) Q_DISABLE_COPY(ScriptDebugger) }; diff --git a/mkspecs/common/symbian/qplatformdefs.h b/mkspecs/common/symbian/qplatformdefs.h index ebcd295..5f093b7 100644 --- a/mkspecs/common/symbian/qplatformdefs.h +++ b/mkspecs/common/symbian/qplatformdefs.h @@ -157,9 +157,9 @@ #endif -#if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 500) -#define QT_SNPRINTF ::snprintf -#define QT_VSNPRINTF ::vsnprintf +#if defined(__ISO_C_VISIBLE) && (__ISO_C_VISIBLE >= 1999) +#define QT_SNPRINTF ::snprintf +#define QT_VSNPRINTF ::vsnprintf #endif diff --git a/src/3rdparty/freetype/src/base/ftobjs.c b/src/3rdparty/freetype/src/base/ftobjs.c index 8208e2a..f90af67 100644 --- a/src/3rdparty/freetype/src/base/ftobjs.c +++ b/src/3rdparty/freetype/src/base/ftobjs.c @@ -244,7 +244,7 @@ FT_BASE_DEF( void ) ft_glyphslot_free_bitmap( FT_GlyphSlot slot ) { - if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) + if ( slot->internal && slot->internal->flags & FT_GLYPH_OWN_BITMAP ) { FT_Memory memory = FT_FACE_MEMORY( slot->face ); @@ -337,14 +337,18 @@ /* free bitmap buffer if needed */ ft_glyphslot_free_bitmap( slot ); - /* free glyph loader */ - if ( FT_DRIVER_USES_OUTLINES( driver ) ) + /* slot->internal might be 0 in out-of-memory situations */ + if ( slot->internal ) { - FT_GlyphLoader_Done( slot->internal->loader ); - slot->internal->loader = 0; - } + /* free glyph loader */ + if ( FT_DRIVER_USES_OUTLINES( driver ) ) + { + FT_GlyphLoader_Done( slot->internal->loader ); + slot->internal->loader = 0; + } - FT_FREE( slot->internal ); + FT_FREE( slot->internal ); + } } @@ -1096,7 +1100,7 @@ if ( error ) { destroy_charmaps( face, memory ); - if ( clazz->done_face ) + if ( clazz->done_face && face ) clazz->done_face( face ); FT_FREE( internal ); FT_FREE( face ); diff --git a/src/3rdparty/freetype/src/base/ftstream.c b/src/3rdparty/freetype/src/base/ftstream.c index 569e46c..2082345 100644 --- a/src/3rdparty/freetype/src/base/ftstream.c +++ b/src/3rdparty/freetype/src/base/ftstream.c @@ -211,7 +211,7 @@ FT_Stream_ReleaseFrame( FT_Stream stream, FT_Byte** pbytes ) { - if ( stream->read ) + if ( stream && stream->read ) { FT_Memory memory = stream->memory; diff --git a/src/3rdparty/freetype/src/truetype/ttinterp.c b/src/3rdparty/freetype/src/truetype/ttinterp.c index f9c3656..143ca65 100644 --- a/src/3rdparty/freetype/src/truetype/ttinterp.c +++ b/src/3rdparty/freetype/src/truetype/ttinterp.c @@ -799,8 +799,6 @@ return driver->context; Fail: - FT_FREE( exec ); - return 0; } diff --git a/src/3rdparty/freetype/src/truetype/ttpload.c b/src/3rdparty/freetype/src/truetype/ttpload.c index 9d3381b..38674a1 100644 --- a/src/3rdparty/freetype/src/truetype/ttpload.c +++ b/src/3rdparty/freetype/src/truetype/ttpload.c @@ -483,10 +483,10 @@ tt_face_free_hdmx( TT_Face face ) { FT_Stream stream = face->root.stream; - FT_Memory memory = stream->memory; - + FT_Memory memory = stream ? stream->memory : NULL; - FT_FREE( face->hdmx_record_sizes ); + if ( face->hdmx_record_sizes ) + FT_FREE( face->hdmx_record_sizes ); FT_FRAME_RELEASE( face->hdmx_table ); } diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp index 2e3ef38..f92bb55 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp +++ b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp @@ -969,6 +969,7 @@ HB_Face HB_NewFace(void *font, HB_GetFontTableFunc tableFunc) face->tmpAttributes = 0; face->tmpLogClusters = 0; face->glyphs_substituted = false; + face->buffer = 0; HB_Error error; HB_Stream stream; @@ -1004,7 +1005,10 @@ HB_Face HB_NewFace(void *font, HB_GetFontTableFunc tableFunc) for (unsigned int i = 0; i < HB_ScriptCount; ++i) face->supported_scripts[i] = checkScript(face, i); - hb_buffer_new(&face->buffer); + if (hb_buffer_new(&face->buffer) != HB_Err_Ok) { + HB_FreeFace(face); + return 0; + } return face; } @@ -1124,6 +1128,8 @@ HB_Bool HB_SelectScript(HB_ShaperItem *shaper_item, const HB_OpenTypeFeature *fe HB_Bool HB_OpenTypeShape(HB_ShaperItem *item, const hb_uint32 *properties) { + HB_GlyphAttributes *tmpAttributes; + unsigned int *tmpLogClusters; HB_Face face = item->face; @@ -1131,8 +1137,16 @@ HB_Bool HB_OpenTypeShape(HB_ShaperItem *item, const hb_uint32 *properties) hb_buffer_clear(face->buffer); - face->tmpAttributes = (HB_GlyphAttributes *) realloc(face->tmpAttributes, face->length*sizeof(HB_GlyphAttributes)); - face->tmpLogClusters = (unsigned int *) realloc(face->tmpLogClusters, face->length*sizeof(unsigned int)); + tmpAttributes = (HB_GlyphAttributes *) realloc(face->tmpAttributes, face->length*sizeof(HB_GlyphAttributes)); + if (!tmpAttributes) + return false; + face->tmpAttributes = tmpAttributes; + + tmpLogClusters = (unsigned int *) realloc(face->tmpLogClusters, face->length*sizeof(unsigned int)); + if (!tmpLogClusters) + return false; + face->tmpLogClusters = tmpLogClusters; + for (int i = 0; i < face->length; ++i) { hb_buffer_add_glyph(face->buffer, item->glyphs[i], properties ? properties[i] : 0, i); face->tmpAttributes[i] = item->attributes[i]; diff --git a/src/3rdparty/phonon/phonon/abstractmediastream.h b/src/3rdparty/phonon/phonon/abstractmediastream.h index c4cde85..be45861 100644 --- a/src/3rdparty/phonon/phonon/abstractmediastream.h +++ b/src/3rdparty/phonon/phonon/abstractmediastream.h @@ -103,7 +103,7 @@ class AbstractMediaStreamPrivate; class PHONON_EXPORT AbstractMediaStream : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(AbstractMediaStream) + Q_DECLARE_SCOPED_PRIVATE(AbstractMediaStream) friend class MediaObject; friend class MediaObjectPrivate; friend class StreamInterface; diff --git a/src/3rdparty/phonon/phonon/iodevicestream_p.h b/src/3rdparty/phonon/phonon/iodevicestream_p.h index 5eb90bc..527ff17 100644 --- a/src/3rdparty/phonon/phonon/iodevicestream_p.h +++ b/src/3rdparty/phonon/phonon/iodevicestream_p.h @@ -39,7 +39,7 @@ class IODeviceStreamPrivate; class IODeviceStream : public AbstractMediaStream { Q_OBJECT - Q_DECLARE_PRIVATE(IODeviceStream) + Q_DECLARE_SCOPED_PRIVATE(IODeviceStream) public: explicit IODeviceStream(QIODevice *ioDevice, QObject *parent = 0); ~IODeviceStream(); diff --git a/src/corelib/animation/qabstractanimation.h b/src/corelib/animation/qabstractanimation.h index e4b1fcc..8da0935 100644 --- a/src/corelib/animation/qabstractanimation.h +++ b/src/corelib/animation/qabstractanimation.h @@ -125,7 +125,7 @@ protected: private: Q_DISABLE_COPY(QAbstractAnimation) - Q_DECLARE_PRIVATE(QAbstractAnimation) + Q_DECLARE_SCOPED_PRIVATE(QAbstractAnimation) }; #endif //QT_NO_ANIMATION diff --git a/src/corelib/animation/qanimationgroup.h b/src/corelib/animation/qanimationgroup.h index 93c6fb1..5b07524 100644 --- a/src/corelib/animation/qanimationgroup.h +++ b/src/corelib/animation/qanimationgroup.h @@ -76,7 +76,7 @@ protected: private: Q_DISABLE_COPY(QAnimationGroup) - Q_DECLARE_PRIVATE(QAnimationGroup) + Q_DECLARE_SCOPED_PRIVATE(QAnimationGroup) }; #endif //QT_NO_ANIMATION diff --git a/src/corelib/animation/qparallelanimationgroup.h b/src/corelib/animation/qparallelanimationgroup.h index 07808f1..8422102 100644 --- a/src/corelib/animation/qparallelanimationgroup.h +++ b/src/corelib/animation/qparallelanimationgroup.h @@ -73,7 +73,7 @@ protected: private: Q_DISABLE_COPY(QParallelAnimationGroup) - Q_DECLARE_PRIVATE(QParallelAnimationGroup) + Q_DECLARE_SCOPED_PRIVATE(QParallelAnimationGroup) Q_PRIVATE_SLOT(d_func(), void _q_uncontrolledAnimationFinished()) }; diff --git a/src/corelib/animation/qpauseanimation.h b/src/corelib/animation/qpauseanimation.h index 6907d0a..b84e940 100644 --- a/src/corelib/animation/qpauseanimation.h +++ b/src/corelib/animation/qpauseanimation.h @@ -72,7 +72,7 @@ protected: private: Q_DISABLE_COPY(QPauseAnimation) - Q_DECLARE_PRIVATE(QPauseAnimation) + Q_DECLARE_SCOPED_PRIVATE(QPauseAnimation) }; #endif //QT_NO_ANIMATION diff --git a/src/corelib/animation/qpropertyanimation.h b/src/corelib/animation/qpropertyanimation.h index e07444c..6631f67 100644 --- a/src/corelib/animation/qpropertyanimation.h +++ b/src/corelib/animation/qpropertyanimation.h @@ -78,7 +78,7 @@ protected: private: Q_PRIVATE_SLOT(d_func(), void _q_targetDestroyed()) Q_DISABLE_COPY(QPropertyAnimation) - Q_DECLARE_PRIVATE(QPropertyAnimation) + Q_DECLARE_SCOPED_PRIVATE(QPropertyAnimation) }; #endif //QT_NO_ANIMATION diff --git a/src/corelib/animation/qsequentialanimationgroup.h b/src/corelib/animation/qsequentialanimationgroup.h index 5d43356..81a7ff5 100644 --- a/src/corelib/animation/qsequentialanimationgroup.h +++ b/src/corelib/animation/qsequentialanimationgroup.h @@ -83,7 +83,7 @@ protected: private: Q_DISABLE_COPY(QSequentialAnimationGroup) - Q_DECLARE_PRIVATE(QSequentialAnimationGroup) + Q_DECLARE_SCOPED_PRIVATE(QSequentialAnimationGroup) Q_PRIVATE_SLOT(d_func(), void _q_uncontrolledAnimationFinished()) }; diff --git a/src/corelib/animation/qvariantanimation.h b/src/corelib/animation/qvariantanimation.h index b2d52d5..0afe80f 100644 --- a/src/corelib/animation/qvariantanimation.h +++ b/src/corelib/animation/qvariantanimation.h @@ -113,7 +113,7 @@ private: static void registerInterpolator(Interpolator func, int interpolationType); Q_DISABLE_COPY(QVariantAnimation) - Q_DECLARE_PRIVATE(QVariantAnimation) + Q_DECLARE_SCOPED_PRIVATE(QVariantAnimation) }; template diff --git a/src/corelib/arch/symbian/qatomic_symbian.cpp b/src/corelib/arch/symbian/qatomic_symbian.cpp index 170b737..9bec0f5 100644 --- a/src/corelib/arch/symbian/qatomic_symbian.cpp +++ b/src/corelib/arch/symbian/qatomic_symbian.cpp @@ -42,6 +42,37 @@ #include #include +#include + +// Heap and handle info printer. This code is placed here as it happens to make it the very last static to be destroyed in a Qt app. +// This way we can report on heap cells and handles that are really not owned by anything which still exists. +// This information can be used to detect whether memory leaks are happening, particularly if these numbers grow as the app is used more. +struct SPrintExitInfo +{ + SPrintExitInfo() + { + RThread().HandleCount(initProcessHandleCount,initThreadHandleCount); + initCells = User::CountAllocCells(); + } + ~SPrintExitInfo() + { + RProcess myProc; + TFullName fullName = myProc.FileName(); + TInt cells = User::CountAllocCells(); + TInt processHandleCount=0; + TInt threadHandleCount=0; + RThread().HandleCount(processHandleCount,threadHandleCount); + RDebug::Print(_L("%S exiting with %d allocated cells, %d handles"), + &fullName, + cells - initCells, + (processHandleCount + threadHandleCount) - (initProcessHandleCount + initThreadHandleCount)); + } + TInt initCells; + TInt initProcessHandleCount; + TInt initThreadHandleCount; +} printExitInfo; + + #if defined(Q_CC_RVCT) #include "../arm/qatomic_arm.cpp" diff --git a/src/corelib/concurrent/qfuturewatcher.h b/src/corelib/concurrent/qfuturewatcher.h index 04d5680..948ecca 100644 --- a/src/corelib/concurrent/qfuturewatcher.h +++ b/src/corelib/concurrent/qfuturewatcher.h @@ -59,7 +59,7 @@ class QFutureWatcherBasePrivate; class Q_CORE_EXPORT QFutureWatcherBase : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QFutureWatcherBase) + Q_DECLARE_SCOPED_PRIVATE(QFutureWatcherBase) public: QFutureWatcherBase(QObject *parent = 0); diff --git a/src/corelib/concurrent/qthreadpool.h b/src/corelib/concurrent/qthreadpool.h index 0ddefd1..dddf962 100644 --- a/src/corelib/concurrent/qthreadpool.h +++ b/src/corelib/concurrent/qthreadpool.h @@ -58,7 +58,7 @@ class QThreadPoolPrivate; class Q_CORE_EXPORT QThreadPool : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QThreadPool) + Q_DECLARE_SCOPED_PRIVATE(QThreadPool) Q_PROPERTY(int expiryTimeout READ expiryTimeout WRITE setExpiryTimeout) Q_PROPERTY(int maxThreadCount READ maxThreadCount WRITE setMaxThreadCount) Q_PROPERTY(int activeThreadCount READ activeThreadCount) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 76ffb6a..818e555 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -1910,6 +1910,15 @@ QSysInfo::SymVersion QSysInfo::symbianVersion() */ /*! + T *q_check_ptr(T *pointer) + \relates + + Users Q_CHECK_PTR on \a pointer, then returns \a pointer. + + This can be used as an inline version of Q_CHECK_PTR. +*/ + +/*! \macro const char* Q_FUNC_INFO() \relates @@ -2162,7 +2171,7 @@ void qt_message_output(QtMsgType msgType, const char *buf) _LIT(format, "[Qt Message] %S"); const int maxBlockSize = 256 - ((const TDesC &)format).Length(); const TPtrC8 ptr(reinterpret_cast(buf)); - HBufC* hbuffer = HBufC::NewL(qMin(maxBlockSize, ptr.Length())); + HBufC* hbuffer = q_check_ptr(HBufC::New(qMin(maxBlockSize, ptr.Length()))); for (int i = 0; i < ptr.Length(); i += hbuffer->Length()) { hbuffer->Des().Copy(ptr.Mid(i, qMin(maxBlockSize, ptr.Length()-i))); RDebug::Print(format, hbuffer); @@ -2464,7 +2473,11 @@ bool qputenv(const char *varName, const QByteArray& value) QByteArray buffer(varName); buffer += '='; buffer += value; - return putenv(qstrdup(buffer.constData())) == 0; + char* envVar = qstrdup(buffer.constData()); + int result = putenv(envVar); + if (result != 0) // error. we have to delete the string. + delete[] envVar; + return result == 0; #endif } @@ -3231,7 +3244,7 @@ bool QInternal::callFunction(InternalFunction func, void **args) #include -/*! \macro QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION(function) +/*! \macro QT_TRAP_THROWING(function) \relates \ingroup qts60 @@ -3251,14 +3264,14 @@ bool QInternal::callFunction(InternalFunction func, void **args) CAknTitlePane* titlePane = S60->titlePane(); if (titlePane) { TPtrC captionPtr(qt_QString2TPtrC(caption)); - QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION(titlePane->SetTextL(captionPtr)); + QT_TRAP_THROWING(titlePane->SetTextL(captionPtr)); } \endcode - \sa QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_ERROR(), QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_LEAVE() + \sa QT_TRYCATCH_ERROR(), QT_TRYCATCH_LEAVING() */ -/*! \macro QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_ERROR(error, function) +/*! \macro QT_TRYCATCH_ERROR(error, function) \relates \ingroup qts60 @@ -3278,7 +3291,7 @@ bool QInternal::callFunction(InternalFunction func, void **args) { TPtrC name; TInt err; - QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_ERROR(err, name.Set(qt_QString2TPtrC(serverName))); + QT_TRYCATCH_ERROR(err, name.Set(qt_QString2TPtrC(serverName))); if (err != KErrNone) return err; return iServer.Connect(name); @@ -3286,10 +3299,10 @@ bool QInternal::callFunction(InternalFunction func, void **args) \endcode } - \sa QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_LEAVE(), QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION() + \sa QT_TRYCATCH_LEAVING(), QT_TRAP_THROWING() */ -/*! \macro QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_LEAVE(function) +/*! \macro QT_TRYCATCH_LEAVING(function) \relates \ingroup qts60 @@ -3309,11 +3322,11 @@ bool QInternal::callFunction(InternalFunction func, void **args) { iStatus = KRequestPending; SetActive(); - QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_LEAVE(m_dispatcher->wakeUpWasCalled()); + QT_TRYCATCH_LEAVING(m_dispatcher->wakeUpWasCalled()); } \endcode - \sa QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION(), QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_ERROR() + \sa QT_TRAP_THROWING(), QT_TRYCATCH_ERROR() */ #include @@ -3336,15 +3349,21 @@ public: \warning This function is only available on Symbian. - \sa qt_translateExceptionToSymbianErrorL(), qt_translateExceptionToSymbianError() + \sa qt_exception2SymbianLeaveL(), qt_exception2SymbianError() */ -void qt_translateSymbianErrorToException(int error) +void qt_throwIfError(int error) { if (error >= KErrNone) return; // do nothing - not an exception switch (error) { case KErrNoMemory: throw std::bad_alloc(); + case KErrArgument: + throw std::invalid_argument("from Symbian error"); + case KErrOverflow: + throw std::overflow_error("from Symbian error"); + case KErrUnderflow: + throw std::underflow_error("from Symbian error"); default: throw QSymbianLeaveException(error); } @@ -3357,11 +3376,11 @@ void qt_translateSymbianErrorToException(int error) \warning This function is only available on Symbian. - \sa qt_translateSymbianErrorToException(), qt_translateExceptionToSymbianError() + \sa qt_throwIfError(), qt_exception2SymbianError() */ -void qt_translateExceptionToSymbianErrorL(const std::exception& aThrow) +void qt_exception2SymbianLeaveL(const std::exception& aThrow) { - User::Leave(qt_translateExceptionToSymbianError(aThrow)); + User::Leave(qt_exception2SymbianError(aThrow)); } /*! \relates @@ -3371,9 +3390,9 @@ void qt_translateExceptionToSymbianErrorL(const std::exception& aThrow) \warning This function is only available on Symbian. - \sa qt_translateSymbianErrorToException(), qt_translateExceptionToSymbianErrorL() + \sa qt_throwIfError(), qt_exception2SymbianLeaveL() */ -int qt_translateExceptionToSymbianError(const std::exception& aThrow) +int qt_exception2SymbianError(const std::exception& aThrow) { const std::type_info& atype = typeid(aThrow); int err = KErrGeneral; @@ -3382,19 +3401,22 @@ int qt_translateExceptionToSymbianError(const std::exception& aThrow) err = KErrNoMemory; else if(atype == typeid(QSymbianLeaveException)) err = static_cast(aThrow).error; - else if(atype == typeid(std::invalid_argument)) - err = KErrArgument; - else if(atype == typeid(std::out_of_range)) - // std::out_of_range is of type logic_error which by definition means that it is - // "presumably detectable before the program executes". - // std::out_of_range is used to report an argument is not within the expected range. - // The description of KErrArgument says an argument is out of range. Hence the mapping. - err = KErrArgument; - else if(atype == typeid(std::overflow_error)) - err = KErrOverflow; - else if(atype == typeid(std::underflow_error)) - err = KErrUnderflow; - + else { + if(atype == typeid(std::invalid_argument)) + err = KErrArgument; + else if(atype == typeid(std::out_of_range)) + // std::out_of_range is of type logic_error which by definition means that it is + // "presumably detectable before the program executes". + // std::out_of_range is used to report an argument is not within the expected range. + // The description of KErrArgument says an argument is out of range. Hence the mapping. + err = KErrArgument; + else if(atype == typeid(std::overflow_error)) + err = KErrOverflow; + else if(atype == typeid(std::underflow_error)) + err = KErrUnderflow; + qWarning("translation from std exception \"%s\" to %d", aThrow.what(), err); + } + return err; } #endif diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index e6508a8..257e3db 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -1662,6 +1662,9 @@ Q_CORE_EXPORT void qBadAlloc(); # define Q_CHECK_PTR(p) do { if (!(p)) qBadAlloc(); } while (0) #endif +template +inline T *q_check_ptr(T *p) { Q_CHECK_PTR(p); return p; } + #if (defined(Q_CC_GNU) && !defined(Q_OS_SOLARIS)) || defined(Q_CC_HPACC) # define Q_FUNC_INFO __PRETTY_FUNCTION__ #elif defined(_MSC_VER) @@ -2283,6 +2286,11 @@ inline const QForeachContainer *qForeachContainer(const QForeachContainerBase #endif #define Q_DECLARE_PRIVATE(Class) \ + inline Class##Private* d_func() { return reinterpret_cast(d_ptr); } \ + inline const Class##Private* d_func() const { return reinterpret_cast(d_ptr); } \ + friend class Class##Private; + +#define Q_DECLARE_SCOPED_PRIVATE(Class) \ inline Class##Private* d_func() { return reinterpret_cast(d_ptr.data()); } \ inline const Class##Private* d_func() const { return reinterpret_cast(d_ptr.data()); } \ friend class Class##Private; @@ -2378,33 +2386,32 @@ QT_END_NAMESPACE namespace std { class exception; } #endif QT_BEGIN_NAMESPACE -Q_CORE_EXPORT void qt_translateSymbianErrorToException(int error); -Q_CORE_EXPORT void qt_translateExceptionToSymbianErrorL(const std::exception& ex); -Q_CORE_EXPORT int qt_translateExceptionToSymbianError(const std::exception& ex); +Q_CORE_EXPORT void qt_throwIfError(int error); +Q_CORE_EXPORT void qt_exception2SymbianLeaveL(const std::exception& ex); +Q_CORE_EXPORT int qt_exception2SymbianError(const std::exception& ex); -#define QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION(f) \ +#define QT_TRAP_THROWING(_f) \ { \ - TInt error; \ - TRAP(error, f); \ - if (error) \ - qt_translateSymbianErrorToException(error); \ + TInt ____error; \ + TRAP(____error, _f); \ + qt_throwIfError(____error); \ } -#define QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_ERROR(err, f) \ +#define QT_TRYCATCH_ERROR(_err, _f) \ { \ - err = KErrNone; \ + _err = KErrNone; \ try { \ - f; \ - } catch (const std::exception &ex) { \ - err = qt_translateExceptionToSymbianError(ex); \ + _f; \ + } catch (const std::exception &____ex) { \ + _err = qt_exception2SymbianError(____ex); \ } \ } -#define QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_LEAVE(f) \ +#define QT_TRYCATCH_LEAVING(_f) \ { \ - TInt err; \ - QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_ERROR(err, f) \ - User::LeaveIfError(err); \ + TInt ____err; \ + QT_TRYCATCH_ERROR(____err, _f) \ + User::LeaveIfError(____err); \ } #endif diff --git a/src/corelib/io/qabstractfileengine.h b/src/corelib/io/qabstractfileengine.h index 54eb6de..07c92d2 100644 --- a/src/corelib/io/qabstractfileengine.h +++ b/src/corelib/io/qabstractfileengine.h @@ -196,7 +196,7 @@ protected: QScopedPointer d_ptr; private: - Q_DECLARE_PRIVATE(QAbstractFileEngine) + Q_DECLARE_SCOPED_PRIVATE(QAbstractFileEngine) Q_DISABLE_COPY(QAbstractFileEngine) }; diff --git a/src/corelib/io/qbuffer.h b/src/corelib/io/qbuffer.h index e078d05..ce5f605 100644 --- a/src/corelib/io/qbuffer.h +++ b/src/corelib/io/qbuffer.h @@ -96,7 +96,7 @@ protected: qint64 writeData(const char *data, qint64 len); private: - Q_DECLARE_PRIVATE(QBuffer) + Q_DECLARE_SCOPED_PRIVATE(QBuffer) Q_DISABLE_COPY(QBuffer) Q_PRIVATE_SLOT(d_func(), void _q_emitSignals()) diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index edbe5f0..9787566 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -86,7 +86,7 @@ class QDirPrivate QDir *q_ptr; Q_DECLARE_PUBLIC(QDir) - friend class QScopedPointer; + friend class QScopedPointerDeleter; protected: QDirPrivate(QDir*, const QDir *copy=0); ~QDirPrivate(); @@ -288,10 +288,10 @@ inline void QDirPrivate::sortFileList(QDir::SortFlags sort, QFileInfoList &l, names->append(l.at(i).fileName()); } } else { - QDirSortItem *si = new QDirSortItem[n]; + QScopedArrayPointer si(new QDirSortItem[n]); for (int i = 0; i < n; ++i) si[i].item = l.at(i); - qSort(si, si+n, QDirSortItemComparator(sort)); + qSort(si.data(), si.data()+n, QDirSortItemComparator(sort)); // put them back in the list(s) if(infos) { for (int i = 0; i < n; ++i) @@ -301,7 +301,6 @@ inline void QDirPrivate::sortFileList(QDir::SortFlags sort, QFileInfoList &l, for (int i = 0; i < n; ++i) names->append(si[i].item.fileName()); } - delete [] si; } } } @@ -334,8 +333,9 @@ void QDirPrivate::detach(bool createFileEngine) { qAtomicDetach(data); if (createFileEngine) { + QAbstractFileEngine *newFileEngine = QAbstractFileEngine::create(data->path); delete data->fileEngine; - data->fileEngine = QAbstractFileEngine::create(data->path); + data->fileEngine = newFileEngine; } } diff --git a/src/corelib/io/qdir.h b/src/corelib/io/qdir.h index f54fbdc..5ef4356 100644 --- a/src/corelib/io/qdir.h +++ b/src/corelib/io/qdir.h @@ -60,7 +60,7 @@ class Q_CORE_EXPORT QDir protected: QScopedPointer d_ptr; private: - Q_DECLARE_PRIVATE(QDir) + Q_DECLARE_SCOPED_PRIVATE(QDir) public: enum Filter { Dirs = 0x001, Files = 0x002, diff --git a/src/corelib/io/qfile.h b/src/corelib/io/qfile.h index f448609..24ce617 100644 --- a/src/corelib/io/qfile.h +++ b/src/corelib/io/qfile.h @@ -64,7 +64,7 @@ class Q_CORE_EXPORT QFile : public QIODevice #ifndef QT_NO_QOBJECT Q_OBJECT #endif - Q_DECLARE_PRIVATE(QFile) + Q_DECLARE_SCOPED_PRIVATE(QFile) public: diff --git a/src/corelib/io/qfileinfo.h b/src/corelib/io/qfileinfo.h index 5295b16..c73823a 100644 --- a/src/corelib/io/qfileinfo.h +++ b/src/corelib/io/qfileinfo.h @@ -168,7 +168,7 @@ public: protected: QScopedPointer d_ptr; private: - Q_DECLARE_PRIVATE(QFileInfo) + Q_DECLARE_SCOPED_PRIVATE(QFileInfo) }; Q_DECLARE_TYPEINFO(QFileInfo, Q_MOVABLE_TYPE); diff --git a/src/corelib/io/qfilesystemwatcher.h b/src/corelib/io/qfilesystemwatcher.h index 60458e5..76a6c60 100644 --- a/src/corelib/io/qfilesystemwatcher.h +++ b/src/corelib/io/qfilesystemwatcher.h @@ -57,7 +57,7 @@ class QFileSystemWatcherPrivate; class Q_CORE_EXPORT QFileSystemWatcher : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QFileSystemWatcher) + Q_DECLARE_SCOPED_PRIVATE(QFileSystemWatcher) public: QFileSystemWatcher(QObject *parent = 0); diff --git a/src/corelib/io/qfilesystemwatcher_symbian.cpp b/src/corelib/io/qfilesystemwatcher_symbian.cpp index aeb19db..c8c1d82 100644 --- a/src/corelib/io/qfilesystemwatcher_symbian.cpp +++ b/src/corelib/io/qfilesystemwatcher_symbian.cpp @@ -80,7 +80,7 @@ void CNotifyChangeEvent::RunL() if (iStatus.Int() == KErrNone){ fsSession.NotifyChange(ENotifyAll, iStatus, watchedPath); SetActive(); - QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_LEAVE(engine->emitPathChanged(this)); + QT_TRYCATCH_LEAVING(engine->emitPathChanged(this)); } else { qWarning("CNotifyChangeEvent::RunL() - Failed to order change notifications: %d", iStatus.Int()); } diff --git a/src/corelib/io/qfsfileengine.h b/src/corelib/io/qfsfileengine.h index feca09b..0fd87a4 100644 --- a/src/corelib/io/qfsfileengine.h +++ b/src/corelib/io/qfsfileengine.h @@ -56,7 +56,7 @@ class QFSFileEnginePrivate; class Q_CORE_EXPORT QFSFileEngine : public QAbstractFileEngine { - Q_DECLARE_PRIVATE(QFSFileEngine) + Q_DECLARE_SCOPED_PRIVATE(QFSFileEngine) public: QFSFileEngine(); explicit QFSFileEngine(const QString &file); diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp index 84394fe..2421282 100644 --- a/src/corelib/io/qfsfileengine_unix.cpp +++ b/src/corelib/io/qfsfileengine_unix.cpp @@ -1003,11 +1003,7 @@ QString QFSFileEngine::fileName(FileName file) const int size = PATH_CHUNK_SIZE; while (1) { - s = (char *) ::realloc(s, size); - if (s == 0) { - len = -1; - break; - } + s = q_check_ptr((char *) ::realloc(s, size)); len = ::readlink(d->nativeFilePath.constData(), s, size); if (len < 0) { ::free(s); diff --git a/src/corelib/io/qiodevice.h b/src/corelib/io/qiodevice.h index 866fa72..d8237a7 100644 --- a/src/corelib/io/qiodevice.h +++ b/src/corelib/io/qiodevice.h @@ -165,7 +165,7 @@ protected: #endif private: - Q_DECLARE_PRIVATE(QIODevice) + Q_DECLARE_SCOPED_PRIVATE(QIODevice) Q_DISABLE_COPY(QIODevice) #ifdef QT3_SUPPORT diff --git a/src/corelib/io/qprocess.h b/src/corelib/io/qprocess.h index bff5f7e..a4025a1 100644 --- a/src/corelib/io/qprocess.h +++ b/src/corelib/io/qprocess.h @@ -191,7 +191,7 @@ protected: qint64 writeData(const char *data, qint64 len); private: - Q_DECLARE_PRIVATE(QProcess) + Q_DECLARE_SCOPED_PRIVATE(QProcess) Q_DISABLE_COPY(QProcess) Q_PRIVATE_SLOT(d_func(), bool _q_canReadStandardOutput()) diff --git a/src/corelib/io/qresource.h b/src/corelib/io/qresource.h index 0bf9660..49dacea 100644 --- a/src/corelib/io/qresource.h +++ b/src/corelib/io/qresource.h @@ -94,7 +94,7 @@ protected: QScopedPointer d_ptr; private: - Q_DECLARE_PRIVATE(QResource) + Q_DECLARE_SCOPED_PRIVATE(QResource) }; QT_END_NAMESPACE diff --git a/src/corelib/io/qresource_p.h b/src/corelib/io/qresource_p.h index f58f9a2..452d8e1 100644 --- a/src/corelib/io/qresource_p.h +++ b/src/corelib/io/qresource_p.h @@ -61,7 +61,7 @@ class QResourceFileEnginePrivate; class QResourceFileEngine : public QAbstractFileEngine { private: - Q_DECLARE_PRIVATE(QResourceFileEngine) + Q_DECLARE_SCOPED_PRIVATE(QResourceFileEngine) public: explicit QResourceFileEngine(const QString &path); ~QResourceFileEngine(); diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index b324441..1650526 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -217,6 +217,11 @@ QConfFile::QConfFile(const QString &fileName, bool _userPerms) usedHashFunc()->insert(name, this); } +QConfFile::~QConfFile() +{ + usedHashFunc()->remove(name); +} + ParsedSettingsMap QConfFile::mergedKeyMap() const { ParsedSettingsMap result = originalKeys; @@ -263,7 +268,7 @@ QConfFile *QConfFile::fromName(const QString &fileName, bool _userPerms) ConfFileHash *usedHash = usedHashFunc(); ConfFileCache *unusedCache = unusedCacheFunc(); - QConfFile *confFile; + QConfFile *confFile = 0; QMutexLocker locker(globalMutex()); if (!(confFile = usedHash->value(absPath))) { @@ -1232,12 +1237,11 @@ QConfFileSettingsPrivate::~QConfFileSettingsPrivate() for (int i = 0; i < NumConfFiles; ++i) { if (confFiles[i] && !confFiles[i]->ref.deref()) { - if (usedHash) - usedHash->remove(confFiles[i]->name); - if (confFiles[i]->size == 0) { delete confFiles[i].take(); } else if (unusedCache) { + if (usedHash) + usedHash->remove(confFiles[i]->name); QT_TRY { // compute a better size? unusedCache->insert(confFiles[i]->name, confFiles[i].data(), diff --git a/src/corelib/io/qsettings.h b/src/corelib/io/qsettings.h index 0d382b66..a082d6a 100644 --- a/src/corelib/io/qsettings.h +++ b/src/corelib/io/qsettings.h @@ -80,7 +80,7 @@ class Q_CORE_EXPORT QSettings #else QScopedPointer d_ptr; #endif - Q_DECLARE_PRIVATE(QSettings) + Q_DECLARE_SCOPED_PRIVATE(QSettings) public: enum Status { diff --git a/src/corelib/io/qsettings_p.h b/src/corelib/io/qsettings_p.h index a49a063..883e2fe 100644 --- a/src/corelib/io/qsettings_p.h +++ b/src/corelib/io/qsettings_p.h @@ -149,6 +149,8 @@ inline QString QSettingsGroup::toString() const class Q_AUTOTEST_EXPORT QConfFile { public: + ~QConfFile(); + ParsedSettingsMap mergedKeyMap() const; bool isWritable() const; diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index 2d5bea6..f7120e1 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -289,7 +289,7 @@ static int qt_mkstemps(char *path, int slen) //************* QTemporaryFileEngine class QTemporaryFileEngine : public QFSFileEngine { - Q_DECLARE_PRIVATE(QFSFileEngine) + Q_DECLARE_SCOPED_PRIVATE(QFSFileEngine) public: QTemporaryFileEngine(const QString &file, bool fileIsTemplate = true) : QFSFileEngine(file), filePathIsTemplate(fileIsTemplate) diff --git a/src/corelib/io/qtemporaryfile.h b/src/corelib/io/qtemporaryfile.h index a597a93..c0b41bb 100644 --- a/src/corelib/io/qtemporaryfile.h +++ b/src/corelib/io/qtemporaryfile.h @@ -64,7 +64,7 @@ class Q_CORE_EXPORT QTemporaryFile : public QFile #ifndef QT_NO_QOBJECT Q_OBJECT #endif - Q_DECLARE_PRIVATE(QTemporaryFile) + Q_DECLARE_SCOPED_PRIVATE(QTemporaryFile) public: QTemporaryFile(); diff --git a/src/corelib/io/qtextstream.h b/src/corelib/io/qtextstream.h index fc4794e..9d4b3d0 100644 --- a/src/corelib/io/qtextstream.h +++ b/src/corelib/io/qtextstream.h @@ -72,7 +72,7 @@ class QTextDecoder; class QTextStreamPrivate; class Q_CORE_EXPORT QTextStream // text stream class { - Q_DECLARE_PRIVATE(QTextStream) + Q_DECLARE_SCOPED_PRIVATE(QTextStream) public: enum RealNumberNotation { diff --git a/src/corelib/kernel/qabstracteventdispatcher.h b/src/corelib/kernel/qabstracteventdispatcher.h index 0550dde..93815f6 100644 --- a/src/corelib/kernel/qabstracteventdispatcher.h +++ b/src/corelib/kernel/qabstracteventdispatcher.h @@ -58,7 +58,7 @@ template struct QPair; class Q_CORE_EXPORT QAbstractEventDispatcher : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QAbstractEventDispatcher) + Q_DECLARE_SCOPED_PRIVATE(QAbstractEventDispatcher) public: typedef QPair TimerInfo; diff --git a/src/corelib/kernel/qabstractitemmodel.h b/src/corelib/kernel/qabstractitemmodel.h index dc7d7bd..90d04cd 100644 --- a/src/corelib/kernel/qabstractitemmodel.h +++ b/src/corelib/kernel/qabstractitemmodel.h @@ -283,7 +283,7 @@ protected: QModelIndexList persistentIndexList() const; private: - Q_DECLARE_PRIVATE(QAbstractItemModel) + Q_DECLARE_SCOPED_PRIVATE(QAbstractItemModel) Q_DISABLE_COPY(QAbstractItemModel) }; diff --git a/src/corelib/kernel/qcore_symbian_p.cpp b/src/corelib/kernel/qcore_symbian_p.cpp index a3a85b0..c681b1f 100644 --- a/src/corelib/kernel/qcore_symbian_p.cpp +++ b/src/corelib/kernel/qcore_symbian_p.cpp @@ -61,13 +61,12 @@ Q_CORE_EXPORT HBufC* qt_QString2HBufC(const QString& aString) #else TPtrC16 ptr(qt_QString2TPtrC(aString)); #endif - buffer = HBufC::New(ptr.Length()); - Q_CHECK_PTR(buffer); + buffer = q_check_ptr(HBufC::New(ptr.Length())); buffer->Des().Copy(ptr); return buffer; } -Q_CORE_EXPORT QString qt_TDesC2QStringL(const TDesC& aDescriptor) +Q_CORE_EXPORT QString qt_TDesC2QString(const TDesC& aDescriptor) { #ifdef QT_NO_UNICODE return QString::fromLocal8Bit(aDescriptor.Ptr(), aDescriptor.Length()); @@ -82,9 +81,8 @@ QHBufC::QHBufC() } QHBufC::QHBufC(const QHBufC &src) + : m_hBufC(q_check_ptr(src.m_hBufC->Alloc())) { - m_hBufC = src.m_hBufC->Alloc(); - Q_CHECK_PTR(m_hBufC); } /*! diff --git a/src/corelib/kernel/qcore_symbian_p.h b/src/corelib/kernel/qcore_symbian_p.h index bd8f304..453c3d3 100644 --- a/src/corelib/kernel/qcore_symbian_p.h +++ b/src/corelib/kernel/qcore_symbian_p.h @@ -65,8 +65,8 @@ QT_BEGIN_NAMESPACE Q_CORE_EXPORT HBufC* qt_QString2HBufC(const QString& aString); -Q_CORE_EXPORT QString qt_TDesC2QStringL(const TDesC& aDescriptor); -inline QString qt_TDes2QStringL(const TDes& aDescriptor) { return qt_TDesC2QStringL(aDescriptor); } +Q_CORE_EXPORT QString qt_TDesC2QString(const TDesC& aDescriptor); +inline QString qt_TDes2QString(const TDes& aDescriptor) { return qt_TDesC2QString(aDescriptor); } static inline QSize qt_TSize2QSize(const TSize& ts) { diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index c07a6e9..90d8f2f 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -1114,6 +1114,9 @@ void QCoreApplication::postEvent(QObject *receiver, QEvent *event, int priority) event->d = reinterpret_cast(quintptr(data->loopLevel)); } + // delete the event on exceptions to protect against memory leaks till the event is + // properly owned in the postEventList + QScopedPointer eventDeleter(event); if (data->postEventList.isEmpty() || data->postEventList.last().priority >= priority) { // optimization: we can simply append if the last event in // the queue has higher or equal priority @@ -1128,6 +1131,7 @@ void QCoreApplication::postEvent(QObject *receiver, QEvent *event, int priority) QPostEventList::iterator at = qUpperBound(begin, end, priority); data->postEventList.insert(at, QPostEvent(receiver, event, priority)); } + eventDeleter.take(); event->posted = true; ++receiver->d_func()->postedEvents; data->canWait = false; diff --git a/src/corelib/kernel/qcoreapplication.h b/src/corelib/kernel/qcoreapplication.h index 48e65a7..60b0882 100644 --- a/src/corelib/kernel/qcoreapplication.h +++ b/src/corelib/kernel/qcoreapplication.h @@ -76,7 +76,7 @@ class Q_CORE_EXPORT QCoreApplication : public QObject Q_PROPERTY(QString organizationName READ organizationName WRITE setOrganizationName) Q_PROPERTY(QString organizationDomain READ organizationDomain WRITE setOrganizationDomain) - Q_DECLARE_PRIVATE(QCoreApplication) + Q_DECLARE_SCOPED_PRIVATE(QCoreApplication) public: QCoreApplication(int &argc, char **argv); ~QCoreApplication(); diff --git a/src/corelib/kernel/qeventdispatcher_glib_p.h b/src/corelib/kernel/qeventdispatcher_glib_p.h index 80ec9fa..bcb655b 100644 --- a/src/corelib/kernel/qeventdispatcher_glib_p.h +++ b/src/corelib/kernel/qeventdispatcher_glib_p.h @@ -67,7 +67,7 @@ class QEventDispatcherGlibPrivate; class Q_CORE_EXPORT QEventDispatcherGlib : public QAbstractEventDispatcher { Q_OBJECT - Q_DECLARE_PRIVATE(QEventDispatcherGlib) + Q_DECLARE_SCOPED_PRIVATE(QEventDispatcherGlib) public: explicit QEventDispatcherGlib(QObject *parent = 0); diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp index 34a20da..3293d47 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian.cpp +++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp @@ -194,7 +194,7 @@ void QWakeUpActiveObject::RunL() { iStatus = KRequestPending; SetActive(); - QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_LEAVE(m_dispatcher->wakeUpWasCalled()); + QT_TRYCATCH_LEAVING(m_dispatcher->wakeUpWasCalled()); } QTimerActiveObject::QTimerActiveObject(QEventDispatcherSymbian *dispatcher, SymbianTimerInfo *timerInfo) @@ -224,7 +224,7 @@ void QTimerActiveObject::DoCancel() void QTimerActiveObject::RunL() { int error; - QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_ERROR(error, Run()); + QT_TRYCATCH_ERROR(error, Run()); if (error < 0) { CActiveScheduler::Current()->Error(error); // stop and report here, as this timer will be deleted on scope exit } @@ -274,6 +274,11 @@ void QTimerActiveObject::Start() } } +SymbianTimerInfo::SymbianTimerInfo() +: timerAO(0) +{ +} + SymbianTimerInfo::~SymbianTimerInfo() { delete timerAO; @@ -314,7 +319,7 @@ void QCompleteDeferredAOs::RunL() iStatus = KRequestPending; SetActive(); - QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_LEAVE(m_dispatcher->reactivateDeferredActiveObjects()); + QT_TRYCATCH_LEAVING(m_dispatcher->reactivateDeferredActiveObjects()); } QSelectThread::QSelectThread() @@ -587,7 +592,7 @@ void QSocketActiveObject::RunL() if (!okToRun()) return; - QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_LEAVE(m_dispatcher->socketFired(this)); + QT_TRYCATCH_LEAVING(m_dispatcher->socketFired(this)); } void QSocketActiveObject::deleteLater() @@ -619,11 +624,11 @@ QEventDispatcherSymbian::~QEventDispatcherSymbian() void QEventDispatcherSymbian::startingUp() { if( !CActiveScheduler::Current() ) { - m_activeScheduler = new(ELeave)CQtActiveScheduler(); + m_activeScheduler = q_check_ptr(new CQtActiveScheduler()); // CBase derived class needs to be checked on new CActiveScheduler::Install(m_activeScheduler); } - m_wakeUpAO = new(ELeave) QWakeUpActiveObject(this); - m_completeDeferredAOs = new(ELeave) QCompleteDeferredAOs(this); + m_wakeUpAO = q_check_ptr(new QWakeUpActiveObject(this)); + m_completeDeferredAOs = q_check_ptr(new QCompleteDeferredAOs(this)); // We already might have posted events, wakeup once to process them wakeUp(); } @@ -742,7 +747,7 @@ bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags fla m_noSocketEvents = oldNoSocketEventsValue; } QT_CATCH (const std::exception& ex) { #ifndef QT_NO_EXCEPTIONS - CActiveScheduler::Current()->Error(qt_translateExceptionToSymbianError(ex)); + CActiveScheduler::Current()->Error(qt_exception2SymbianError(ex)); #endif } @@ -896,7 +901,7 @@ bool QEventDispatcherSymbian::hasPendingEvents() void QEventDispatcherSymbian::registerSocketNotifier ( QSocketNotifier * notifier ) { - QSocketActiveObject *socketAO = new (ELeave) QSocketActiveObject(this, notifier); + QSocketActiveObject *socketAO = q_check_ptr(new QSocketActiveObject(this, notifier)); m_notifiers.insert(notifier, socketAO); m_selectThread.requestSocketEvents(notifier, &socketAO->iStatus); } @@ -930,7 +935,7 @@ void QEventDispatcherSymbian::registerTimer ( int timerId, int interval, QObject timer->inTimerEvent = false; timer->receiver = object; timer->dispatcher = this; - timer->timerAO = new(ELeave) QTimerActiveObject(this, timer.data()); + timer->timerAO = q_check_ptr(new QTimerActiveObject(this, timer.data())); m_timerList.insert(timerId, timer); timer->timerAO->Start(); @@ -952,16 +957,20 @@ bool QEventDispatcherSymbian::unregisterTimer ( int timerId ) bool QEventDispatcherSymbian::unregisterTimers ( QObject * object ) { - QList idsToRemove = registeredTimers(object); - - if (idsToRemove.isEmpty()) + if (m_timerList.isEmpty()) return false; - - for (int c = 0; c < idsToRemove.size(); ++c) { - unregisterTimer(idsToRemove[c].first); + + bool unregistered = false; + for (QHash::iterator i = m_timerList.begin(); i != m_timerList.end(); ) { + if ((*i)->receiver == object) { + i = m_timerList.erase(i); + unregistered = true; + } else { + ++i; + } } - return true; + return unregistered; } QList QEventDispatcherSymbian::registeredTimers ( QObject * object ) const diff --git a/src/corelib/kernel/qeventdispatcher_symbian_p.h b/src/corelib/kernel/qeventdispatcher_symbian_p.h index b39d6df..310d74d 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian_p.h +++ b/src/corelib/kernel/qeventdispatcher_symbian_p.h @@ -112,6 +112,7 @@ private: struct SymbianTimerInfo : public QSharedData { + SymbianTimerInfo(); ~SymbianTimerInfo(); int timerId; @@ -183,7 +184,7 @@ private: class QSelectThread : public QThread { - Q_DECLARE_PRIVATE(QThread) + Q_DECLARE_SCOPED_PRIVATE(QThread) public: QSelectThread(); @@ -217,7 +218,7 @@ public: // from CActiveScheduler class Q_CORE_EXPORT QEventDispatcherSymbian : public QAbstractEventDispatcher { - Q_DECLARE_PRIVATE(QAbstractEventDispatcher) + Q_DECLARE_SCOPED_PRIVATE(QAbstractEventDispatcher) public: QEventDispatcherSymbian(QObject *parent = 0); diff --git a/src/corelib/kernel/qeventdispatcher_unix_p.h b/src/corelib/kernel/qeventdispatcher_unix_p.h index e0ac5da..c52965a 100644 --- a/src/corelib/kernel/qeventdispatcher_unix_p.h +++ b/src/corelib/kernel/qeventdispatcher_unix_p.h @@ -181,7 +181,7 @@ class QEventDispatcherUNIXPrivate; class Q_CORE_EXPORT QEventDispatcherUNIX : public QAbstractEventDispatcher { Q_OBJECT - Q_DECLARE_PRIVATE(QEventDispatcherUNIX) + Q_DECLARE_SCOPED_PRIVATE(QEventDispatcherUNIX) public: explicit QEventDispatcherUNIX(QObject *parent = 0); diff --git a/src/corelib/kernel/qeventdispatcher_win_p.h b/src/corelib/kernel/qeventdispatcher_win_p.h index ca5dbf8..37578a0 100644 --- a/src/corelib/kernel/qeventdispatcher_win_p.h +++ b/src/corelib/kernel/qeventdispatcher_win_p.h @@ -67,7 +67,7 @@ LRESULT CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp) class Q_CORE_EXPORT QEventDispatcherWin32 : public QAbstractEventDispatcher { Q_OBJECT - Q_DECLARE_PRIVATE(QEventDispatcherWin32) + Q_DECLARE_SCOPED_PRIVATE(QEventDispatcherWin32) void createInternalHwnd(); friend class QGuiEventDispatcherWin32; diff --git a/src/corelib/kernel/qeventloop.h b/src/corelib/kernel/qeventloop.h index 60d00df..e14e352 100644 --- a/src/corelib/kernel/qeventloop.h +++ b/src/corelib/kernel/qeventloop.h @@ -55,7 +55,7 @@ class QEventLoopPrivate; class Q_CORE_EXPORT QEventLoop : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QEventLoop) + Q_DECLARE_SCOPED_PRIVATE(QEventLoop) public: explicit QEventLoop(QObject *parent = 0); diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index 215f6ae..0b9f841 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -1535,7 +1535,9 @@ bool QMetaMethod::invoke(QObject *object, int nargs = 1; // include return type void **args = (void **) qMalloc(paramCount * sizeof(void *)); + Q_CHECK_PTR(args); int *types = (int *) qMalloc(paramCount * sizeof(int)); + Q_CHECK_PTR(types); types[0] = 0; // return type args[0] = 0; diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index 91266db..02338fe 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -434,8 +434,8 @@ int QMetaType::registerType(const char *typeName, Destructor destructor, int idx = qMetaTypeType_unlocked(normalizedTypeName); if (!idx) { - idx = currentIdx++; ct->resize(ct->count() + 1); + idx = currentIdx++; QCustomTypeInfo &inf = (*ct)[idx - User]; inf.typeName = normalizedTypeName; inf.constr = constructor; diff --git a/src/corelib/kernel/qmimedata.h b/src/corelib/kernel/qmimedata.h index 609528a..9366c5d 100644 --- a/src/corelib/kernel/qmimedata.h +++ b/src/corelib/kernel/qmimedata.h @@ -94,7 +94,7 @@ protected: QVariant::Type preferredType) const; private: Q_DISABLE_COPY(QMimeData) - Q_DECLARE_PRIVATE(QMimeData) + Q_DECLARE_SCOPED_PRIVATE(QMimeData) }; QT_END_NAMESPACE diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 85e0ed1..cc2df0c 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -72,6 +72,7 @@ static int DIRECT_CONNECTION_ONLY = 0; static int *queuedConnectionTypes(const QList &typeNames) { int *types = new int [typeNames.count() + 1]; + Q_CHECK_PTR(types); for (int i = 0; i < typeNames.count(); ++i) { const QByteArray typeName = typeNames.at(i); if (typeName.endsWith('*')) @@ -401,6 +402,10 @@ void QMetaObject::changeGuard(QObject **ptr, QObject *o) return; } QMutexLocker locker(guardHashLock()); + if (o) { + hash->insert(o, ptr); + QObjectPrivate::get(o)->hasGuards = true; + } if (*ptr) { bool more = false; //if the QObject has more pointer attached to it. GuardHash::iterator it = hash->find(*ptr); @@ -417,10 +422,6 @@ void QMetaObject::changeGuard(QObject **ptr, QObject *o) QObjectPrivate::get(*ptr)->hasGuards = false; } *ptr = o; - if (*ptr) { - hash->insert(*ptr, ptr); - QObjectPrivate::get(*ptr)->hasGuards = true; - } } /*! \internal @@ -665,12 +666,18 @@ QObject::QObject(QObject *parent) : d_ptr(new QObjectPrivate) { Q_D(QObject); - qt_addObject(d_ptr->q_ptr = this); + d_ptr->q_ptr = this; d->threadData = (parent && !parent->thread()) ? parent->d_func()->threadData : QThreadData::current(); d->threadData->ref(); - if (!check_parent_thread(parent, parent ? parent->d_func()->threadData : 0, d->threadData)) - parent = 0; - setParent(parent); + QT_TRY { + if (!check_parent_thread(parent, parent ? parent->d_func()->threadData : 0, d->threadData)) + parent = 0; + setParent(parent); + } QT_CATCH(...) { + d->threadData->deref(); + QT_RETHROW; + } + qt_addObject(this); } #ifdef QT3_SUPPORT @@ -700,20 +707,26 @@ QObject::QObject(QObjectPrivate &dd, QObject *parent) : d_ptr(&dd) { Q_D(QObject); - qt_addObject(d_ptr->q_ptr = this); + d_ptr->q_ptr = this; d->threadData = (parent && !parent->thread()) ? parent->d_func()->threadData : QThreadData::current(); d->threadData->ref(); - if (!check_parent_thread(parent, parent ? parent->d_func()->threadData : 0, d->threadData)) - parent = 0; - if (d->isWidget) { - if (parent) { - d->parent = parent; - d->parent->d_func()->children.append(this); + QT_TRY { + if (!check_parent_thread(parent, parent ? parent->d_func()->threadData : 0, d->threadData)) + parent = 0; + if (d->isWidget) { + if (parent) { + d->parent = parent; + d->parent->d_func()->children.append(this); + } + // no events sent here, this is done at the end of the QWidget constructor + } else { + setParent(parent); } - // no events sent here, this is done at the end of the QWidget constructor - } else { - setParent(parent); + } QT_CATCH(...) { + d->threadData->deref(); + QT_RETHROW; } + qt_addObject(this); } /*! @@ -765,11 +778,26 @@ QObject::~QObject() // all the signal/slots connections are still in place - if we don't // quit now, we will crash pretty soon. qWarning("Detected an unexpected exception in ~QObject while emitting destroyed()."); +#if defined(Q_AUTOTEST_EXPORT) && !defined(QT_NO_EXCEPTIONS) + struct AutotestException : public std::exception + { + const char *what() const throw() { return "autotest swallow"; } + } autotestException; + // throw autotestException; + +#else QT_RETHROW; +#endif } { - QMutexLocker locker(signalSlotLock(this)); + QMutex *signalSlotMutex = 0; + QT_TRY { + signalSlotMutex = signalSlotLock(this); + } QT_CATCH(const std::bad_alloc &) { + // out of memory - swallow to prevent a crash + } + QMutexLocker locker(signalSlotMutex); // set ref to zero to indicate that this object has been deleted if (d->currentSender != 0) @@ -2658,8 +2686,14 @@ bool QObject::disconnect(const QObject *sender, const char *signal, QByteArray signal_name; bool signal_found = false; if (signal) { - signal_name = QMetaObject::normalizedSignature(signal); - signal = signal_name; + QT_TRY { + signal_name = QMetaObject::normalizedSignature(signal); + signal = signal_name.constData(); + } QT_CATCH (const std::bad_alloc &) { + // if the signal is already normalized, we can continue. + if (sender->metaObject()->indexOfSignal(signal + 1) == -1) + QT_RETHROW; + } if (!check_signal_macro(sender, signal, "disconnect", "unbind")) return false; @@ -2671,8 +2705,15 @@ bool QObject::disconnect(const QObject *sender, const char *signal, int membcode = -1; bool method_found = false; if (method) { - method_name = QMetaObject::normalizedSignature(method); - method = method_name; + QT_TRY { + method_name = QMetaObject::normalizedSignature(method); + method = method_name.constData(); + } QT_CATCH(const std::bad_alloc &) { + // if the method is already normalized, we can continue. + if (receiver->metaObject()->indexOfMethod(method + 1) == -1) + QT_RETHROW; + } + membcode = extract_code(method); if (!check_method_code(membcode, receiver, method, "disconnect")) return false; @@ -2831,14 +2872,20 @@ bool QMetaObject::connect(const QObject *sender, int signal_index, c->method = method_index; c->connectionType = type; c->argumentTypes = types; + + QT_TRY { + s->d_func()->addConnection(signal_index, c); + } QT_CATCH(...) { + delete c; + QT_RETHROW; + } + c->prev = &r->d_func()->senders; c->next = *c->prev; *c->prev = c; if (c->next) c->next->prev = &c->next; - s->d_func()->addConnection(signal_index, c); - if (signal_index < 0) sender->d_func()->connectedSignals = ~0u; else if (signal_index < 32) @@ -3024,7 +3071,9 @@ static void queued_activate(QObject *sender, int signal, QObjectPrivate::Connect while (c->argumentTypes[nargs-1]) ++nargs; int *types = (int *) qMalloc(nargs*sizeof(int)); + Q_CHECK_PTR(types); void **args = (void **) qMalloc(nargs*sizeof(void *)); + Q_CHECK_PTR(args); types[0] = 0; // return type args[0] = 0; // return value for (int n = 1; n < nargs; ++n) diff --git a/src/corelib/kernel/qobject.h b/src/corelib/kernel/qobject.h index 74a5904..e725c82 100644 --- a/src/corelib/kernel/qobject.h +++ b/src/corelib/kernel/qobject.h @@ -117,7 +117,7 @@ class Q_CORE_EXPORT QObject { Q_OBJECT Q_PROPERTY(QString objectName READ objectName WRITE setObjectName) - Q_DECLARE_PRIVATE(QObject) + Q_DECLARE_SCOPED_PRIVATE(QObject) public: Q_INVOKABLE explicit QObject(QObject *parent=0); diff --git a/src/corelib/kernel/qsharedmemory.h b/src/corelib/kernel/qsharedmemory.h index 4957c3e..0e15ebe 100644 --- a/src/corelib/kernel/qsharedmemory.h +++ b/src/corelib/kernel/qsharedmemory.h @@ -57,7 +57,7 @@ class QSharedMemoryPrivate; class Q_CORE_EXPORT QSharedMemory : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QSharedMemory) + Q_DECLARE_SCOPED_PRIVATE(QSharedMemory) public: enum AccessMode diff --git a/src/corelib/kernel/qsignalmapper.h b/src/corelib/kernel/qsignalmapper.h index 7bc5035..8c1f663 100644 --- a/src/corelib/kernel/qsignalmapper.h +++ b/src/corelib/kernel/qsignalmapper.h @@ -56,7 +56,7 @@ class QSignalMapperPrivate; class Q_CORE_EXPORT QSignalMapper : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QSignalMapper) + Q_DECLARE_SCOPED_PRIVATE(QSignalMapper) public: explicit QSignalMapper(QObject *parent = 0); ~QSignalMapper(); diff --git a/src/corelib/kernel/qsocketnotifier.h b/src/corelib/kernel/qsocketnotifier.h index 96dda35..bc5d97d 100644 --- a/src/corelib/kernel/qsocketnotifier.h +++ b/src/corelib/kernel/qsocketnotifier.h @@ -53,7 +53,7 @@ QT_MODULE(Core) class Q_CORE_EXPORT QSocketNotifier : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QObject) + Q_DECLARE_SCOPED_PRIVATE(QObject) public: enum Type { Read, Write, Exception }; diff --git a/src/corelib/kernel/qtranslator.h b/src/corelib/kernel/qtranslator.h index b4cea18..1f94210 100644 --- a/src/corelib/kernel/qtranslator.h +++ b/src/corelib/kernel/qtranslator.h @@ -86,7 +86,7 @@ public: private: Q_DISABLE_COPY(QTranslator) - Q_DECLARE_PRIVATE(QTranslator) + Q_DECLARE_SCOPED_PRIVATE(QTranslator) }; #endif // QT_NO_TRANSLATION diff --git a/src/corelib/kernel/qwineventnotifier_p.h b/src/corelib/kernel/qwineventnotifier_p.h index 07aa0ae..2c8934f 100644 --- a/src/corelib/kernel/qwineventnotifier_p.h +++ b/src/corelib/kernel/qwineventnotifier_p.h @@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE class Q_CORE_EXPORT QWinEventNotifier : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QObject) + Q_DECLARE_SCOPED_PRIVATE(QObject) public: explicit QWinEventNotifier(QObject *parent = 0); diff --git a/src/corelib/plugin/qfactoryloader_p.h b/src/corelib/plugin/qfactoryloader_p.h index 1717ac0..b646b4d 100644 --- a/src/corelib/plugin/qfactoryloader_p.h +++ b/src/corelib/plugin/qfactoryloader_p.h @@ -66,7 +66,7 @@ class QFactoryLoaderPrivate; class Q_CORE_EXPORT QFactoryLoader : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QFactoryLoader) + Q_DECLARE_SCOPED_PRIVATE(QFactoryLoader) public: QFactoryLoader(const char *iid, diff --git a/src/corelib/statemachine/qabstractstate.h b/src/corelib/statemachine/qabstractstate.h index 5355ac2..3229ab7 100644 --- a/src/corelib/statemachine/qabstractstate.h +++ b/src/corelib/statemachine/qabstractstate.h @@ -85,7 +85,7 @@ protected: private: Q_DISABLE_COPY(QAbstractState) - Q_DECLARE_PRIVATE(QAbstractState) + Q_DECLARE_SCOPED_PRIVATE(QAbstractState) }; #endif //QT_NO_STATEMACHINE diff --git a/src/corelib/statemachine/qabstracttransition.h b/src/corelib/statemachine/qabstracttransition.h index 9ba1f11..a87af39 100644 --- a/src/corelib/statemachine/qabstracttransition.h +++ b/src/corelib/statemachine/qabstracttransition.h @@ -109,7 +109,7 @@ protected: private: Q_DISABLE_COPY(QAbstractTransition) - Q_DECLARE_PRIVATE(QAbstractTransition) + Q_DECLARE_SCOPED_PRIVATE(QAbstractTransition) }; #endif //QT_NO_STATEMACHINE diff --git a/src/corelib/statemachine/qeventtransition.h b/src/corelib/statemachine/qeventtransition.h index b05ffef..c227ab1 100644 --- a/src/corelib/statemachine/qeventtransition.h +++ b/src/corelib/statemachine/qeventtransition.h @@ -88,7 +88,7 @@ protected: private: Q_DISABLE_COPY(QEventTransition) - Q_DECLARE_PRIVATE(QEventTransition) + Q_DECLARE_SCOPED_PRIVATE(QEventTransition) }; #endif //QT_NO_STATEMACHINE diff --git a/src/corelib/statemachine/qfinalstate.h b/src/corelib/statemachine/qfinalstate.h index e37ef36..7b77b2b 100644 --- a/src/corelib/statemachine/qfinalstate.h +++ b/src/corelib/statemachine/qfinalstate.h @@ -68,7 +68,7 @@ protected: private: Q_DISABLE_COPY(QFinalState) - Q_DECLARE_PRIVATE(QFinalState) + Q_DECLARE_SCOPED_PRIVATE(QFinalState) }; #endif //QT_NO_STATEMACHINE diff --git a/src/corelib/statemachine/qhistorystate.h b/src/corelib/statemachine/qhistorystate.h index 395bb98..889308d 100644 --- a/src/corelib/statemachine/qhistorystate.h +++ b/src/corelib/statemachine/qhistorystate.h @@ -83,7 +83,7 @@ protected: private: Q_DISABLE_COPY(QHistoryState) - Q_DECLARE_PRIVATE(QHistoryState) + Q_DECLARE_SCOPED_PRIVATE(QHistoryState) }; #endif //QT_NO_STATEMACHINE diff --git a/src/corelib/statemachine/qsignaltransition.h b/src/corelib/statemachine/qsignaltransition.h index 69060ae..d6c2324 100644 --- a/src/corelib/statemachine/qsignaltransition.h +++ b/src/corelib/statemachine/qsignaltransition.h @@ -81,7 +81,7 @@ protected: private: Q_DISABLE_COPY(QSignalTransition) - Q_DECLARE_PRIVATE(QSignalTransition) + Q_DECLARE_SCOPED_PRIVATE(QSignalTransition) }; #endif //QT_NO_STATEMACHINE diff --git a/src/corelib/statemachine/qstate.h b/src/corelib/statemachine/qstate.h index 41d32be..be37591 100644 --- a/src/corelib/statemachine/qstate.h +++ b/src/corelib/statemachine/qstate.h @@ -105,7 +105,7 @@ protected: private: Q_DISABLE_COPY(QState) - Q_DECLARE_PRIVATE(QState) + Q_DECLARE_SCOPED_PRIVATE(QState) }; #endif //QT_NO_STATEMACHINE diff --git a/src/corelib/statemachine/qstatemachine.h b/src/corelib/statemachine/qstatemachine.h index 30d0e3a..1f0d5b0 100644 --- a/src/corelib/statemachine/qstatemachine.h +++ b/src/corelib/statemachine/qstatemachine.h @@ -153,7 +153,7 @@ protected: private: Q_DISABLE_COPY(QStateMachine) - Q_DECLARE_PRIVATE(QStateMachine) + Q_DECLARE_SCOPED_PRIVATE(QStateMachine) Q_PRIVATE_SLOT(d_func(), void _q_start()) Q_PRIVATE_SLOT(d_func(), void _q_process()) #ifndef QT_NO_ANIMATION diff --git a/src/corelib/thread/qthread.h b/src/corelib/thread/qthread.h index c784352..0d8aa8b 100644 --- a/src/corelib/thread/qthread.h +++ b/src/corelib/thread/qthread.h @@ -127,7 +127,7 @@ protected: private: Q_OBJECT - Q_DECLARE_PRIVATE(QThread) + Q_DECLARE_SCOPED_PRIVATE(QThread) static void initialize(); static void cleanup(); @@ -154,7 +154,7 @@ private: friend class QCoreApplication; friend class QThreadData; friend class QAdoptedThread; - Q_DECLARE_PRIVATE(QThread) + Q_DECLARE_SCOPED_PRIVATE(QThread) }; #endif // QT_NO_THREAD diff --git a/src/corelib/thread/qthread_p.h b/src/corelib/thread/qthread_p.h index 31b5090..51de0be 100644 --- a/src/corelib/thread/qthread_p.h +++ b/src/corelib/thread/qthread_p.h @@ -214,7 +214,7 @@ public: // thread wrapper for the main() thread class QAdoptedThread : public QThread { - Q_DECLARE_PRIVATE(QThread) + Q_DECLARE_SCOPED_PRIVATE(QThread) public: QAdoptedThread(QThreadData *data = 0); diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index 22cee0e..97f437f 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -1307,6 +1307,7 @@ QByteArray::QByteArray(int size, char ch) QByteArray::QByteArray(int size, Qt::Initialization) { d = static_cast(qMalloc(sizeof(Data)+size)); + Q_CHECK_PTR(d); d->ref = 1; d->alloc = d->size = size; d->data = d->array; diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h index d1a3386..fc6a1e3a 100644 --- a/src/corelib/tools/qhash.h +++ b/src/corelib/tools/qhash.h @@ -167,8 +167,13 @@ inline bool QHashData::willGrow() inline void QHashData::hasShrunk() { - if (size <= (numBuckets >> 3) && numBits > userNumBits) - rehash(qMax(int(numBits) - 2, int(userNumBits))); + if (size <= (numBuckets >> 3) && numBits > userNumBits) { + QT_TRY { + rehash(qMax(int(numBits) - 2, int(userNumBits))); + } QT_CATCH(const std::bad_alloc &) { + // ignore bad allocs - shrinking shouldn't throw. rehash is exception safe. + } + } } inline QHashData::Node *QHashData::firstNode() @@ -761,6 +766,8 @@ Q_INLINE_TEMPLATE typename QHash::iterator QHash::insertMulti(co template Q_OUTOFLINE_TEMPLATE int QHash::remove(const Key &akey) { + if (isEmpty()) // prevents detaching shared null + return 0; detach(); int oldSize = d->size; @@ -782,6 +789,8 @@ Q_OUTOFLINE_TEMPLATE int QHash::remove(const Key &akey) template Q_OUTOFLINE_TEMPLATE T QHash::take(const Key &akey) { + if (isEmpty()) // prevents detaching shared null + return T(); detach(); Node **node = findNode(akey); diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index a56518b..c6c898d 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -363,15 +363,16 @@ Q_INLINE_TEMPLATE void QList::node_copy(Node *from, Node *to, Node *src) Node *current = from; if (QTypeInfo::isLarge || QTypeInfo::isStatic) { QT_TRY { - while(current != to) + while(current != to) { (current++)->v = new T(*reinterpret_cast((src++)->v)); + } } QT_CATCH(...) { while (current != from) delete reinterpret_cast(current--); QT_RETHROW; } - } - else if (QTypeInfo::isComplex) { + + } else if (QTypeInfo::isComplex) { QT_TRY { while(current != to) new (current++) T(*reinterpret_cast(src++)); @@ -380,6 +381,9 @@ Q_INLINE_TEMPLATE void QList::node_copy(Node *from, Node *to, Node *src) (reinterpret_cast(current--))->~T(); QT_RETHROW; } + } else { + if (src != from && to - from > 0) + memcpy(from, src, (to - from) * sizeof(Node *)); } } @@ -408,11 +412,12 @@ Q_INLINE_TEMPLATE QList &QList::operator=(const QList &l) template inline typename QList::iterator QList::insert(iterator before, const T &t) { - Node *n = reinterpret_cast(p.insert(before.i - reinterpret_cast(p.begin()))); + int iBefore = before.i - reinterpret_cast(p.begin()); + Node *n = reinterpret_cast(p.insert(iBefore)); QT_TRY { node_construct(n, t); } QT_CATCH(...) { - p.remove(before.i - reinterpret_cast(p.begin())); + p.remove(iBefore); QT_RETHROW; } return n; @@ -689,7 +694,13 @@ Q_OUTOFLINE_TEMPLATE QList &QList::operator+=(const QList &l) { detach(); Node *n = reinterpret_cast(p.append(l.p)); - node_copy(n, reinterpret_cast(p.end()), reinterpret_cast(l.p.begin())); + QT_TRY{ + node_copy(n, reinterpret_cast(p.end()), reinterpret_cast(l.p.begin())); + } QT_CATCH(...) { + // restore the old end + d->end -= (reinterpret_cast(p.end()) - n); + QT_RETHROW; + } return *this; } diff --git a/src/corelib/tools/qlistdata.cpp b/src/corelib/tools/qlistdata.cpp index 3c45bed..c67af7a 100644 --- a/src/corelib/tools/qlistdata.cpp +++ b/src/corelib/tools/qlistdata.cpp @@ -74,12 +74,16 @@ QListData::Data *QListData::detach() Data *x = static_cast(qMalloc(DataHeaderSize + d->alloc * sizeof(void *))); Q_CHECK_PTR(x); - ::memcpy(x, d, DataHeaderSize + d->alloc * sizeof(void *)); - x->alloc = d->alloc; x->ref = 1; x->sharable = true; - if (!x->alloc) - x->begin = x->end = 0; + x->alloc = d->alloc; + if (!x->alloc) { + x->begin = 0; + x->end = 0; + } else { + x->begin = d->begin; + x->end = d->end; + } qSwap(d, x); if (!x->ref.deref()) @@ -87,20 +91,30 @@ QListData::Data *QListData::detach() return 0; } -// Returns the old (shared) data, it is up to the caller to deref() and free() +/*! + * Detaches the QListData by reallocating new memory. + * Returns the old (shared) data, it is up to the caller to deref() and free() + * For the new data node_copy needs to be called. + * + * \internal + */ QListData::Data *QListData::detach2() { Data *x = d; Data* t = static_cast(qMalloc(DataHeaderSize + x->alloc * sizeof(void *))); Q_CHECK_PTR(t); + t->ref = 1; + t->sharable = true; + t->alloc = x->alloc; + if (!t->alloc) { + t->begin = 0; + t->end = 0; + } else { + t->begin = x->begin; + t->end = x->end; + } d = t; - ::memcpy(d, x, DataHeaderSize + x->alloc * sizeof(void *)); - d->alloc = x->alloc; - d->ref = 1; - d->sharable = true; - if (!d->alloc) - d->begin = d->end = 0; return x; } @@ -117,12 +131,14 @@ void QListData::realloc(int alloc) d->begin = d->end = 0; } +// ensures that enough space is available to append one element void **QListData::append() { Q_ASSERT(d->ref == 1); if (d->end == d->alloc) { int n = d->end - d->begin; if (d->begin > 2 * d->alloc / 3) { + // we have enough space. Just not at the end -> move it. ::memcpy(d->array + n, d->array + d->begin, n * sizeof(void *)); d->begin = n; d->end = n * 2; @@ -133,6 +149,7 @@ void **QListData::append() return d->array + d->end++; } +// ensures that enough space is available to append the list void **QListData::append(const QListData& l) { Q_ASSERT(d->ref == 1); @@ -141,7 +158,6 @@ void **QListData::append(const QListData& l) if (n) { if (e + n > d->alloc) realloc(grow(e + l.d->end - l.d->begin)); - ::memcpy(d->array + d->end, l.d->array + l.d->begin, n * sizeof(void*)); d->end += n; } return d->array + e; diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index 17634c1..a8fac2d 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -3943,7 +3943,13 @@ QString QLocalePrivate::doubleToString(double d, char *rve = 0; char *buff = 0; - digits = QLatin1String(qdtoa(d, mode, pr, &decpt, &sign, &rve, &buff)); + QT_TRY { + digits = QLatin1String(qdtoa(d, mode, pr, &decpt, &sign, &rve, &buff)); + } QT_CATCH(...) { + if (buff != 0) + free(buff); + QT_RETHROW; + } if (buff != 0) free(buff); #endif // QT_QLOCALE_USES_FCVT @@ -6786,8 +6792,13 @@ static char *_qdtoa( NEEDS_VOLATILE double d, int mode, int ndigits, int *decpt, if (i <= 0) i = 1; } - *resultp = static_cast(malloc(i + 1)); - Q_CHECK_PTR(resultp); + QT_TRY { + *resultp = static_cast(malloc(i + 1)); + Q_CHECK_PTR(*resultp); + } QT_CATCH(...) { + Bfree(b); + QT_RETHROW; + } s = s0 = *resultp; if (ilim >= 0 && ilim <= Quick_max && try_quick) { diff --git a/src/corelib/tools/qlocale_symbian.cpp b/src/corelib/tools/qlocale_symbian.cpp index 976227d..95d4edf 100644 --- a/src/corelib/tools/qlocale_symbian.cpp +++ b/src/corelib/tools/qlocale_symbian.cpp @@ -637,9 +637,9 @@ static QString symbianDayName(int day, bool short_format) return QString(); if (short_format) { - return qt_TDes2QStringL(TDayNameAbb(TDay(day))); + return qt_TDes2QString(TDayNameAbb(TDay(day))); } else { - return qt_TDes2QStringL(TDayName(TDay(day))); + return qt_TDes2QString(TDayName(TDay(day))); } } @@ -655,9 +655,9 @@ static QString symbianMonthName(int month, bool short_format) return QString(); if (short_format) { - return qt_TDes2QStringL(TMonthNameAbb(TMonth(month))); + return qt_TDes2QString(TMonthNameAbb(TMonth(month))); } else { - return qt_TDes2QStringL(TMonthName(TMonth(month))); + return qt_TDes2QString(TMonthName(TMonth(month))); } } @@ -678,7 +678,7 @@ static QString symbianDateFormat(bool short_format) dateFormat.Set(ptrGetLongDateFormatSpec(_s60Locale)); } - return s60ToQtFormat(qt_TDesC2QStringL(dateFormat)); + return s60ToQtFormat(qt_TDesC2QString(dateFormat)); } /*! @@ -687,7 +687,7 @@ static QString symbianDateFormat(bool short_format) */ static QString symbianTimeFormat() { - return s60ToQtFormat(qt_TDesC2QStringL(ptrGetTimeFormatSpec(_s60Locale))); + return s60ToQtFormat(qt_TDesC2QString(ptrGetTimeFormatSpec(_s60Locale))); } /*! @@ -719,7 +719,7 @@ static QString symbianDateToString(const QDate &date, bool short_format) TRAPD(err, ptrTimeFormatL(timeStr, buffer, dateFormat, *_s60Locale.GetLocale());) if (err == KErrNone) - return qt_TDes2QStringL(buffer); + return qt_TDes2QString(buffer); else return QString(); } @@ -749,7 +749,7 @@ static QString symbianTimeToString(const QTime &time) ) if (err == KErrNone) - return qt_TDes2QStringL(buffer); + return qt_TDes2QString(buffer); else return QString(); } diff --git a/src/corelib/tools/qregexp.cpp b/src/corelib/tools/qregexp.cpp index d7d347f..d980a9b 100644 --- a/src/corelib/tools/qregexp.cpp +++ b/src/corelib/tools/qregexp.cpp @@ -1216,7 +1216,7 @@ private: int yyPos; // the position of the next character to read int yyLen; // the length of yyIn int yyCh; // the last character read - QRegExpCharClass *yyCharClass; // attribute for Tok_CharClass tokens + QScopedPointer yyCharClass; // attribute for Tok_CharClass tokens int yyMinRep; // attribute for Tok_Quantifier int yyMaxRep; // ditto QString yyError; // syntax error or overflow during parsing? @@ -1303,8 +1303,7 @@ void QRegExpMatchState::prepareForMatch(QRegExpEngine *eng) #endif int numCaptures = eng->numCaptures(); int newCapturedSize = 2 + 2 * numCaptures; - bigArray = (int *)realloc(bigArray, ((3 + 4 * ncap) * ns + 4 * ncap + newSlideTabSize + newCapturedSize)*sizeof(int)); - Q_CHECK_PTR(bigArray); + bigArray = q_check_ptr((int *)realloc(bigArray, ((3 + 4 * ncap) * ns + 4 * ncap + newSlideTabSize + newCapturedSize)*sizeof(int))); // set all internal variables only _after_ bigArray is realloc'ed // to prevent a broken regexp in oom case @@ -2795,7 +2794,7 @@ void QRegExpEngine::startTokenizer(const QChar *rx, int len) yyPos = 0; yyLen = len; yyCh = getChar(); - yyCharClass = new QRegExpCharClass; + yyCharClass.reset(new QRegExpCharClass); yyMinRep = 0; yyMaxRep = 0; yyError = QString(); @@ -2989,8 +2988,7 @@ int QRegExpEngine::parse(const QChar *pattern, int len) #endif box.cat(middleBox); box.cat(rightBox); - delete yyCharClass; - yyCharClass = 0; + yyCharClass.reset(0); #ifndef QT_NO_REGEXP_CAPTURE for (int i = 0; i < nf; ++i) { diff --git a/src/corelib/tools/qringbuffer_p.h b/src/corelib/tools/qringbuffer_p.h index d8ca658..16368e9 100644 --- a/src/corelib/tools/qringbuffer_p.h +++ b/src/corelib/tools/qringbuffer_p.h @@ -245,12 +245,7 @@ public: inline void clear() { if(!buffers.isEmpty()) { - QByteArray tmp = buffers[0]; - buffers.clear(); - buffers << tmp; - //TODO merge this optimization ? - //buffers.erase(buffers.begin() + 1, buffers.end()); - //>>>>>>> 08ae7ee1fb930e7d4b4039e2294cba69f9380964:src/corelib/tools/qringbuffer_p.h + buffers.erase(buffers.begin() + 1, buffers.end()); if (buffers.at(0).size() != basicBlockSize) buffers[0].resize(basicBlockSize); } diff --git a/src/corelib/tools/qscopedpointer.cpp b/src/corelib/tools/qscopedpointer.cpp index 912edb6..cf24381 100644 --- a/src/corelib/tools/qscopedpointer.cpp +++ b/src/corelib/tools/qscopedpointer.cpp @@ -39,6 +39,10 @@ ** ****************************************************************************/ +#include "qscopedpointer.h" + +QT_BEGIN_NAMESPACE + /*! \class QScopedPointer \brief The QScopedPointer class stores a pointer to a dynamically allocated object, and deletes it upon destruction. @@ -53,9 +57,7 @@ called resource acquisition is initialization(RAII). QScopedPointer guarantees that the object pointed to will get deleted when - the current scope dissapears, and it also has no way of releasing - ownership, hence clearly communicating the lifetime and ownership of the - object. These guarantees are convenient when reading the code. + the current scope dissapears. Consider this function which does heap allocations, and have various exit points: @@ -68,7 +70,7 @@ The code the compiler generates for QScopedPointer is the same as when writing it manually. Code that makes use of \a delete are candidates for - QScopedPointer usage(and if not, possibly another type of smart pointer + QScopedPointer usage (and if not, possibly another type of smart pointer such as QSharedPointer). QScopedPointer intentionally has no copy constructor or assignment operator, such that ownership and lifetime is clearly communicated. @@ -78,7 +80,26 @@ \snippet doc/src/snippets/code/src_corelib_tools_qscopedpointer.cpp 2 - \note QScopedPointer does not work with arrays. + \section1 Custom cleanup handlers + + Arrays as well as pointers that have been allocated with \c malloc must + not be deleted using \c delete. QScopedPointer's second template parameter + can be used for custom cleanup handlers. + + The following custom cleanup handlers exist: + + \list + \i QScopedPointerDeleter - the default, deletes the pointer using \c delete + \i QScopedPointerArrayDeleter - deletes the pointer using \c{delete []}. Use + this handler for pointers that were allocated with \c{new []}. + \i QScopedPointerPodDeleter - deletes the pointer using \c{free()}. Use this + handler for pointers that were allocated with \c{malloc()}. + \endlist + + You can pass your own classes as handlers, provided that they have a public + static function \c{void cleanup(T *pointer)}. + + \snippet doc/src/snippets/code/src_corelib_tools_qscopedpointer.cpp 5 \section1 Forward Declared Pointers @@ -175,9 +196,6 @@ Deletes the existing object it is pointing to if any, and sets its pointer to \a other. QScopedPointer now owns \a other and will delete it in its destructor. - - If \a other is equal to the value returned by data(), behavior is - undefined. */ /*! @@ -185,8 +203,8 @@ Returns the value of the pointer referenced by this object. The pointer of this QScopedPointer object will be reset to \c null. + + Callers of this function take ownership of the pointer. */ QT_END_NAMESPACE - -#endif diff --git a/src/corelib/tools/qscopedpointer.h b/src/corelib/tools/qscopedpointer.h index fc8f9e2..62daacb 100644 --- a/src/corelib/tools/qscopedpointer.h +++ b/src/corelib/tools/qscopedpointer.h @@ -49,8 +49,46 @@ QT_BEGIN_NAMESPACE QT_MODULE(Core) template +struct QScopedPointerDeleter +{ + static inline void cleanup(T *pointer) + { + // Enforce a complete type. + // If you get a compile error here, read the secion on forward declared + // classes in the QScopedPointer documentation. + typedef char IsIncompleteType[ sizeof(T) ? 1 : -1 ]; + (void) sizeof(IsIncompleteType); + + delete pointer; + } +}; + +template +struct QScopedPointerArrayDeleter +{ + static inline void cleanup(T *pointer) + { + // Enforce a complete type. + // If you get a compile error here, read the secion on forward declared + // classes in the QScopedPointer documentation. + typedef char IsIncompleteType[ sizeof(T) ? 1 : -1 ]; + (void) sizeof(IsIncompleteType); + + delete [] pointer; + } +}; + +struct QScopedPointerPodDeleter +{ + static inline void cleanup(void *pointer) { if (pointer) qFree(pointer); } +}; + +template > class QScopedPointer { +#ifndef Q_CC_NOKIAX86 + typedef T *QScopedPointer:: *RestrictedBool; +#endif public: explicit inline QScopedPointer(T *p = 0) : d(p) { @@ -58,16 +96,20 @@ public: inline ~QScopedPointer() { - delete d; + T *oldD = this->d; + Cleanup::cleanup(oldD); + this->d = 0; } inline T &operator*() const { + Q_ASSERT(d); return *d; } inline T *operator->() const { + Q_ASSERT(d); return d; } @@ -81,10 +123,17 @@ public: return d != other.d; } +#if defined(Q_CC_NOKIAX86) || defined(Q_QDOC) inline operator bool() const { - return d; + return isNull() ? 0 : &QScopedPointer::d; + } +#else + inline operator RestrictedBool() const + { + return isNull() ? 0 : &QScopedPointer::d; } +#endif inline T *data() const { @@ -98,9 +147,11 @@ public: inline void reset(T *other = 0) { + if (d == other) + return; T *oldD = d; d = other; - delete oldD; + Cleanup::cleanup(oldD); } inline T *take() @@ -117,37 +168,52 @@ private: Q_DISABLE_COPY(QScopedPointer) }; -/* internal class - allows special handling for resetting and cleaning the pointer */ -template -class QScopedCustomPointer : public QScopedPointer +template > +class QScopedArrayPointer : public QScopedPointer { public: - inline QScopedCustomPointer(T *p = 0) - : QScopedPointer(p) + explicit inline QScopedArrayPointer(T *p = 0) + : QScopedPointer(p) { } - inline ~QScopedCustomPointer() + inline T &operator[](int i) { - T *oldD = this->d; - this->d = 0; - CustomHandler::cleanup(oldD); + return this->d[i]; } - inline void reset(T *other = 0) + inline const T &operator[](int i) const + { + return this->d[i]; + } + +private: + Q_DISABLE_COPY(QScopedArrayPointer) +}; + +/* Internal helper class - exposes the data through data_ptr (legacy from QShared). + Required for some internal Qt classes, do not use otherwise. */ +template > +class QCustomScopedPointer : public QScopedPointer +{ +public: + explicit inline QCustomScopedPointer(T *p = 0) + : QScopedPointer(p) { - CustomHandler::reset(this->d, other); } inline T *&data_ptr() { return this->d; } + +private: + Q_DISABLE_COPY(QCustomScopedPointer) }; -/* Internal helper class - a handler for QShared* classes, to be used in QScopedCustomPointer */ +/* Internal helper class - a handler for QShared* classes, to be used in QCustomScopedPointer */ template -class QScopedSharedPointerHandler +class QScopedPointerSharedDeleter { public: static inline void cleanup(T *d) @@ -155,24 +221,17 @@ public: if (d && !d->ref.deref()) delete d; } - - static inline void reset(T *&d, T *other) - { - T *oldD = d; - d = other; - cleanup(oldD); - } }; -/* Internal. This should really have been a typedef, but you can't have a templated typedef :) +/* Internal. This class is basically a scoped pointer pointing to a ref-counted object */ template -class QScopedSharedPointer : public QScopedCustomPointer > +class QScopedSharedPointer : public QCustomScopedPointer > { public: - inline QScopedSharedPointer(T *p = 0) - : QScopedCustomPointer >(p) + explicit inline QScopedSharedPointer(T *p = 0) + : QCustomScopedPointer >(p) { } @@ -189,8 +248,11 @@ public: other->ref.ref(); T *oldD = this->d; this->d = other; - QScopedSharedPointerHandler::cleanup(oldD); + QScopedPointerSharedDeleter::cleanup(oldD); } + +private: + Q_DISABLE_COPY(QScopedSharedPointer) }; QT_END_NAMESPACE diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 38b6f58..ca2fd1a 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -1023,6 +1023,7 @@ QString::QString(int size, QChar ch) QString::QString(int size, Qt::Initialization) { d = (Data*) qMalloc(sizeof(Data)+size*sizeof(QChar)); + Q_CHECK_PTR(d); d->ref = 1; d->alloc = d->size = size; d->clean = d->asciiCache = d->simpletext = d->righttoleft = d->capacity = 0; @@ -1236,11 +1237,9 @@ void QString::realloc(int alloc) asciiCache->remove(d); } #endif - Data *x = static_cast(qRealloc(d, sizeof(Data) + alloc * sizeof(QChar))); - Q_CHECK_PTR(x); - x->alloc = alloc; - x->data = x->array; - d = x; + d = static_cast(q_check_ptr(qRealloc(d, sizeof(Data) + alloc * sizeof(QChar)))); + d->alloc = alloc; + d->data = d->array; } } diff --git a/src/corelib/tools/qtimeline.h b/src/corelib/tools/qtimeline.h index 2d1ad42..2a1c2c2 100644 --- a/src/corelib/tools/qtimeline.h +++ b/src/corelib/tools/qtimeline.h @@ -136,7 +136,7 @@ protected: private: Q_DISABLE_COPY(QTimeLine) - Q_DECLARE_PRIVATE(QTimeLine) + Q_DECLARE_SCOPED_PRIVATE(QTimeLine) }; QT_END_NAMESPACE diff --git a/src/corelib/xml/qxmlstream.h b/src/corelib/xml/qxmlstream.h index 7be7138..3215624 100644 --- a/src/corelib/xml/qxmlstream.h +++ b/src/corelib/xml/qxmlstream.h @@ -392,7 +392,7 @@ public: private: Q_DISABLE_COPY(QXmlStreamReader) - Q_DECLARE_PRIVATE(QXmlStreamReader) + Q_DECLARE_SCOPED_PRIVATE(QXmlStreamReader) QScopedPointer d_ptr; }; @@ -465,7 +465,7 @@ public: private: Q_DISABLE_COPY(QXmlStreamWriter) - Q_DECLARE_PRIVATE(QXmlStreamWriter) + Q_DECLARE_SCOPED_PRIVATE(QXmlStreamWriter) QScopedPointer d_ptr; }; #endif // QT_NO_XMLSTREAMWRITER diff --git a/src/corelib/xml/qxmlstream_p.h b/src/corelib/xml/qxmlstream_p.h index f1614ea..e6c914f 100644 --- a/src/corelib/xml/qxmlstream_p.h +++ b/src/corelib/xml/qxmlstream_p.h @@ -648,6 +648,7 @@ public: if (tos + extraCapacity + 1 > cap) { cap = qMax(tos + extraCapacity + 1, cap << 1 ); data = reinterpret_cast(qRealloc(data, cap * sizeof(T))); + Q_CHECK_PTR(data); } } diff --git a/src/dbus/qdbusabstractadaptor.h b/src/dbus/qdbusabstractadaptor.h index 06ba004..2af1d14 100644 --- a/src/dbus/qdbusabstractadaptor.h +++ b/src/dbus/qdbusabstractadaptor.h @@ -66,7 +66,7 @@ protected: bool autoRelaySignals() const; private: - Q_DECLARE_PRIVATE(QDBusAbstractAdaptor) + Q_DECLARE_SCOPED_PRIVATE(QDBusAbstractAdaptor) }; QT_END_NAMESPACE diff --git a/src/dbus/qdbusabstractinterface.h b/src/dbus/qdbusabstractinterface.h index 6400b26..331ce0e 100644 --- a/src/dbus/qdbusabstractinterface.h +++ b/src/dbus/qdbusabstractinterface.h @@ -135,7 +135,7 @@ protected: const QList &args = QList()) const; private: - Q_DECLARE_PRIVATE(QDBusAbstractInterface) + Q_DECLARE_SCOPED_PRIVATE(QDBusAbstractInterface) Q_PRIVATE_SLOT(d_func(), void _q_serviceOwnerChanged(QString,QString,QString)) }; diff --git a/src/dbus/qdbusinterface.h b/src/dbus/qdbusinterface.h index 9cf36f8..9d0779b 100644 --- a/src/dbus/qdbusinterface.h +++ b/src/dbus/qdbusinterface.h @@ -69,7 +69,7 @@ public: virtual int qt_metacall(QMetaObject::Call, int, void **); private: - Q_DECLARE_PRIVATE(QDBusInterface) + Q_DECLARE_SCOPED_PRIVATE(QDBusInterface) }; QT_END_NAMESPACE diff --git a/src/dbus/qdbuspendingcall.h b/src/dbus/qdbuspendingcall.h index 8881920..55a5bb2 100644 --- a/src/dbus/qdbuspendingcall.h +++ b/src/dbus/qdbuspendingcall.h @@ -108,7 +108,7 @@ Q_SIGNALS: void finished(QDBusPendingCallWatcher *self); private: - Q_DECLARE_PRIVATE(QDBusPendingCallWatcher) + Q_DECLARE_SCOPED_PRIVATE(QDBusPendingCallWatcher) Q_PRIVATE_SLOT(d_func(), void _q_finished()) }; diff --git a/src/gui/accessible/qaccessiblewidget.cpp b/src/gui/accessible/qaccessiblewidget.cpp index 447edc1..2d09c9c 100644 --- a/src/gui/accessible/qaccessiblewidget.cpp +++ b/src/gui/accessible/qaccessiblewidget.cpp @@ -269,7 +269,7 @@ QT_END_INCLUDE_NAMESPACE class QACConnectionObject : public QObject { - Q_DECLARE_PRIVATE(QObject) + Q_DECLARE_SCOPED_PRIVATE(QObject) public: inline bool isSender(const QObject *receiver, const char *signal) const { return d_func()->isSender(receiver, signal); } diff --git a/src/gui/dialogs/qabstractpagesetupdialog.h b/src/gui/dialogs/qabstractpagesetupdialog.h index 7a3bb48..ba6b452 100644 --- a/src/gui/dialogs/qabstractpagesetupdialog.h +++ b/src/gui/dialogs/qabstractpagesetupdialog.h @@ -58,7 +58,7 @@ class QPrinter; // ### Qt 5: Remove this class class Q_GUI_EXPORT QAbstractPageSetupDialog : public QDialog { - Q_DECLARE_PRIVATE(QAbstractPageSetupDialog) + Q_DECLARE_SCOPED_PRIVATE(QAbstractPageSetupDialog) Q_OBJECT public: diff --git a/src/gui/dialogs/qabstractprintdialog.h b/src/gui/dialogs/qabstractprintdialog.h index 272d1b1..0a94034 100644 --- a/src/gui/dialogs/qabstractprintdialog.h +++ b/src/gui/dialogs/qabstractprintdialog.h @@ -58,7 +58,7 @@ class QPrinter; // ### Qt 5: remove this class class Q_GUI_EXPORT QAbstractPrintDialog : public QDialog { - Q_DECLARE_PRIVATE(QAbstractPrintDialog) + Q_DECLARE_SCOPED_PRIVATE(QAbstractPrintDialog) Q_OBJECT public: diff --git a/src/gui/dialogs/qcolordialog.h b/src/gui/dialogs/qcolordialog.h index 2c107bd..d0aeec7 100644 --- a/src/gui/dialogs/qcolordialog.h +++ b/src/gui/dialogs/qcolordialog.h @@ -57,7 +57,7 @@ class QColorDialogPrivate; class Q_GUI_EXPORT QColorDialog : public QDialog { Q_OBJECT - Q_DECLARE_PRIVATE(QColorDialog) + Q_DECLARE_SCOPED_PRIVATE(QColorDialog) Q_ENUMS(ColorDialogOption) Q_PROPERTY(QColor currentColor READ currentColor WRITE setCurrentColor NOTIFY currentColorChanged) diff --git a/src/gui/dialogs/qdialog.h b/src/gui/dialogs/qdialog.h index 8479994..0b5b326 100644 --- a/src/gui/dialogs/qdialog.h +++ b/src/gui/dialogs/qdialog.h @@ -121,7 +121,7 @@ protected: void adjustPosition(QWidget*); private: - Q_DECLARE_PRIVATE(QDialog) + Q_DECLARE_SCOPED_PRIVATE(QDialog) Q_DISABLE_COPY(QDialog) #ifdef Q_WS_WINCE_WM diff --git a/src/gui/dialogs/qerrormessage.h b/src/gui/dialogs/qerrormessage.h index 9721f46..1d79f78 100644 --- a/src/gui/dialogs/qerrormessage.h +++ b/src/gui/dialogs/qerrormessage.h @@ -57,7 +57,7 @@ class QErrorMessagePrivate; class Q_GUI_EXPORT QErrorMessage: public QDialog { Q_OBJECT - Q_DECLARE_PRIVATE(QErrorMessage) + Q_DECLARE_SCOPED_PRIVATE(QErrorMessage) public: explicit QErrorMessage(QWidget* parent = 0); ~QErrorMessage(); diff --git a/src/gui/dialogs/qfiledialog.h b/src/gui/dialogs/qfiledialog.h index 70ee720..987e436 100644 --- a/src/gui/dialogs/qfiledialog.h +++ b/src/gui/dialogs/qfiledialog.h @@ -283,7 +283,7 @@ protected: void changeEvent(QEvent *e); private: - Q_DECLARE_PRIVATE(QFileDialog) + Q_DECLARE_SCOPED_PRIVATE(QFileDialog) Q_DISABLE_COPY(QFileDialog) Q_PRIVATE_SLOT(d_func(), void _q_pathChanged(const QString &)) diff --git a/src/gui/dialogs/qfilesystemmodel.h b/src/gui/dialogs/qfilesystemmodel.h index 769463c..5ab49ff 100644 --- a/src/gui/dialogs/qfilesystemmodel.h +++ b/src/gui/dialogs/qfilesystemmodel.h @@ -151,7 +151,7 @@ protected: bool event(QEvent *event); private: - Q_DECLARE_PRIVATE(QFileSystemModel) + Q_DECLARE_SCOPED_PRIVATE(QFileSystemModel) Q_DISABLE_COPY(QFileSystemModel) Q_PRIVATE_SLOT(d_func(), void _q_directoryChanged(const QString &directory, const QStringList &list)) diff --git a/src/gui/dialogs/qfontdialog.h b/src/gui/dialogs/qfontdialog.h index 6e0f1a0..4c80194 100644 --- a/src/gui/dialogs/qfontdialog.h +++ b/src/gui/dialogs/qfontdialog.h @@ -59,7 +59,7 @@ class QFontDialogPrivate; class Q_GUI_EXPORT QFontDialog : public QDialog { Q_OBJECT - Q_DECLARE_PRIVATE(QFontDialog) + Q_DECLARE_SCOPED_PRIVATE(QFontDialog) Q_ENUMS(FontDialogOption) Q_PROPERTY(QFont currentFont READ currentFont WRITE setCurrentFont NOTIFY currentFontChanged) Q_PROPERTY(FontDialogOptions options READ options WRITE setOptions) diff --git a/src/gui/dialogs/qinputdialog.h b/src/gui/dialogs/qinputdialog.h index 401b328..edeaadd 100644 --- a/src/gui/dialogs/qinputdialog.h +++ b/src/gui/dialogs/qinputdialog.h @@ -59,7 +59,7 @@ class QInputDialogPrivate; class Q_GUI_EXPORT QInputDialog : public QDialog { Q_OBJECT - Q_DECLARE_PRIVATE(QInputDialog) + Q_DECLARE_SCOPED_PRIVATE(QInputDialog) // Q_ENUMS(InputMode InputDialogOption) QDOC_PROPERTY(InputMode inputMode READ inputMode WRITE setInputMode) QDOC_PROPERTY(QString labelText READ labelText WRITE setLabelText) diff --git a/src/gui/dialogs/qmessagebox.h b/src/gui/dialogs/qmessagebox.h index 048455e..d24d466 100644 --- a/src/gui/dialogs/qmessagebox.h +++ b/src/gui/dialogs/qmessagebox.h @@ -336,7 +336,7 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_buttonClicked(QAbstractButton *)) Q_DISABLE_COPY(QMessageBox) - Q_DECLARE_PRIVATE(QMessageBox) + Q_DECLARE_SCOPED_PRIVATE(QMessageBox) }; Q_DECLARE_OPERATORS_FOR_FLAGS(QMessageBox::StandardButtons) diff --git a/src/gui/dialogs/qpagesetupdialog.h b/src/gui/dialogs/qpagesetupdialog.h index 43e316d..1757c32 100644 --- a/src/gui/dialogs/qpagesetupdialog.h +++ b/src/gui/dialogs/qpagesetupdialog.h @@ -57,7 +57,7 @@ class QPageSetupDialogPrivate; class Q_GUI_EXPORT QPageSetupDialog : public QAbstractPageSetupDialog { Q_OBJECT - Q_DECLARE_PRIVATE(QPageSetupDialog) + Q_DECLARE_SCOPED_PRIVATE(QPageSetupDialog) Q_ENUMS(PageSetupDialogOption) Q_PROPERTY(PageSetupDialogOptions options READ options WRITE setOptions) diff --git a/src/gui/dialogs/qprintdialog.h b/src/gui/dialogs/qprintdialog.h index e5a90cc..5af70b3 100644 --- a/src/gui/dialogs/qprintdialog.h +++ b/src/gui/dialogs/qprintdialog.h @@ -81,7 +81,7 @@ private: class Q_GUI_EXPORT QPrintDialog : public QAbstractPrintDialog { Q_OBJECT - Q_DECLARE_PRIVATE(QPrintDialog) + Q_DECLARE_SCOPED_PRIVATE(QPrintDialog) Q_ENUMS(PrintDialogOption) Q_PROPERTY(PrintDialogOptions options READ options WRITE setOptions) diff --git a/src/gui/dialogs/qprintpreviewdialog.h b/src/gui/dialogs/qprintpreviewdialog.h index 85ed517..5836e5a 100644 --- a/src/gui/dialogs/qprintpreviewdialog.h +++ b/src/gui/dialogs/qprintpreviewdialog.h @@ -58,7 +58,7 @@ class QPrintPreviewDialogPrivate; class Q_GUI_EXPORT QPrintPreviewDialog : public QDialog { Q_OBJECT - Q_DECLARE_PRIVATE(QPrintPreviewDialog) + Q_DECLARE_SCOPED_PRIVATE(QPrintPreviewDialog) public: explicit QPrintPreviewDialog(QWidget *parent = 0, Qt::WindowFlags flags = 0); diff --git a/src/gui/dialogs/qprogressdialog.h b/src/gui/dialogs/qprogressdialog.h index 1118c45..41a825a 100644 --- a/src/gui/dialogs/qprogressdialog.h +++ b/src/gui/dialogs/qprogressdialog.h @@ -61,7 +61,7 @@ class QProgressDialogPrivate; class Q_GUI_EXPORT QProgressDialog : public QDialog { Q_OBJECT - Q_DECLARE_PRIVATE(QProgressDialog) + Q_DECLARE_SCOPED_PRIVATE(QProgressDialog) Q_PROPERTY(bool wasCanceled READ wasCanceled) Q_PROPERTY(int minimum READ minimum WRITE setMinimum) Q_PROPERTY(int maximum READ maximum WRITE setMaximum) diff --git a/src/gui/dialogs/qwizard.h b/src/gui/dialogs/qwizard.h index d1f9cf7..a8976c4 100644 --- a/src/gui/dialogs/qwizard.h +++ b/src/gui/dialogs/qwizard.h @@ -194,7 +194,7 @@ protected: private: Q_DISABLE_COPY(QWizard) - Q_DECLARE_PRIVATE(QWizard) + Q_DECLARE_SCOPED_PRIVATE(QWizard) Q_PRIVATE_SLOT(d_func(), void _q_emitCustomButtonClicked()) Q_PRIVATE_SLOT(d_func(), void _q_updateButtonStates()) Q_PRIVATE_SLOT(d_func(), void _q_handleFieldObjectDestroyed(QObject *)) @@ -246,7 +246,7 @@ protected: private: Q_DISABLE_COPY(QWizardPage) - Q_DECLARE_PRIVATE(QWizardPage) + Q_DECLARE_SCOPED_PRIVATE(QWizardPage) Q_PRIVATE_SLOT(d_func(), void _q_maybeEmitCompleteChanged()) Q_PRIVATE_SLOT(d_func(), void _q_updateCachedCompleteState()) diff --git a/src/gui/dialogs/qwizard_win.cpp b/src/gui/dialogs/qwizard_win.cpp index 840149b..bb51cbd 100644 --- a/src/gui/dialogs/qwizard_win.cpp +++ b/src/gui/dialogs/qwizard_win.cpp @@ -429,7 +429,7 @@ void QVistaHelper::setWindowPosHack() class QHackWidget : public QWidget { public: - Q_DECLARE_PRIVATE(QWidget) + Q_DECLARE_SCOPED_PRIVATE(QWidget) QTLWExtra* topData() { return d_func()->topData(); } }; diff --git a/src/gui/embedded/qdirectpainter_qws.h b/src/gui/embedded/qdirectpainter_qws.h index eddde10..a7f82f1 100644 --- a/src/gui/embedded/qdirectpainter_qws.h +++ b/src/gui/embedded/qdirectpainter_qws.h @@ -57,7 +57,7 @@ class QWSEmbedEvent; class Q_GUI_EXPORT QDirectPainter : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QDirectPainter) + Q_DECLARE_SCOPED_PRIVATE(QDirectPainter) public: enum SurfaceFlag { NonReserved = 0, diff --git a/src/gui/embedded/qscreen_qws.cpp b/src/gui/embedded/qscreen_qws.cpp index 05771ff..af53cd7 100644 --- a/src/gui/embedded/qscreen_qws.cpp +++ b/src/gui/embedded/qscreen_qws.cpp @@ -2420,7 +2420,7 @@ void QScreen::exposeRegion(QRegion r, int windowIndex) #endif compose(0, r, blendRegion, &blendBuffer, changing); - if (blendBuffer) { + if (blendBuffer && !blendBuffer->isNull()) { const QPoint offset = blendRegion.boundingRect().topLeft(); #ifndef QT_NO_QWS_CURSOR if (qt_screencursor && !qt_screencursor->isAccelerated()) { diff --git a/src/gui/embedded/qtransportauth_qws.h b/src/gui/embedded/qtransportauth_qws.h index d8753fe..e633a90 100644 --- a/src/gui/embedded/qtransportauth_qws.h +++ b/src/gui/embedded/qtransportauth_qws.h @@ -169,7 +169,7 @@ private: ~QTransportAuth(); friend class QAuthDevice; - Q_DECLARE_PRIVATE(QTransportAuth) + Q_DECLARE_SCOPED_PRIVATE(QTransportAuth) }; class Q_GUI_EXPORT RequestAnalyzer diff --git a/src/gui/embedded/qwindowsystem_qws.cpp b/src/gui/embedded/qwindowsystem_qws.cpp index a521319..dfc1e76 100644 --- a/src/gui/embedded/qwindowsystem_qws.cpp +++ b/src/gui/embedded/qwindowsystem_qws.cpp @@ -1768,10 +1768,16 @@ void QWSServerPrivate::cleanupFonts(bool force) #if defined(QWS_DEBUG_FONTCLEANUP) qDebug() << "removing unused font file" << fontName; #endif - QFile::remove(QFile::decodeName(fontName)); - sendFontRemovedEvent(fontName); - - it = fontReferenceCount.erase(it); + QT_TRY { + QFile::remove(QFile::decodeName(fontName)); + sendFontRemovedEvent(fontName); + + it = fontReferenceCount.erase(it); + } QT_CATCH(...) { + // so we were not able to remove the font. + // don't be angry and just continue with the next ones. + ++it; + } } } diff --git a/src/gui/embedded/qwindowsystem_qws.h b/src/gui/embedded/qwindowsystem_qws.h index 3cda9f6..04cd756 100644 --- a/src/gui/embedded/qwindowsystem_qws.h +++ b/src/gui/embedded/qwindowsystem_qws.h @@ -214,7 +214,7 @@ class Q_GUI_EXPORT QWSServer : public QObject friend class QWSDisplay; friend class QWSInputMethod; Q_OBJECT - Q_DECLARE_PRIVATE(QWSServer) + Q_DECLARE_SCOPED_PRIVATE(QWSServer) public: explicit QWSServer(int flags = 0, QObject *parent=0); #ifdef QT3_SUPPORT @@ -443,7 +443,7 @@ class QWSConvertSelectionCommand; class Q_GUI_EXPORT QWSClient : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QWSClient) + Q_DECLARE_SCOPED_PRIVATE(QWSClient) public: QWSClient(QObject* parent, QWS_SOCK_BASE *, int id); ~QWSClient(); diff --git a/src/gui/embedded/qwsembedwidget.h b/src/gui/embedded/qwsembedwidget.h index 8313c38..d880454 100644 --- a/src/gui/embedded/qwsembedwidget.h +++ b/src/gui/embedded/qwsembedwidget.h @@ -71,7 +71,7 @@ protected: void showEvent(QShowEvent *event); private: - Q_DECLARE_PRIVATE(QWSEmbedWidget) + Q_DECLARE_SCOPED_PRIVATE(QWSEmbedWidget) }; QT_END_NAMESPACE diff --git a/src/gui/embedded/qwsmanager_qws.h b/src/gui/embedded/qwsmanager_qws.h index 5a4312c..86aadc9 100644 --- a/src/gui/embedded/qwsmanager_qws.h +++ b/src/gui/embedded/qwsmanager_qws.h @@ -66,7 +66,7 @@ class QWSManagerPrivate; class Q_GUI_EXPORT QWSManager : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QWSManager) + Q_DECLARE_SCOPED_PRIVATE(QWSManager) public: explicit QWSManager(QWidget *); ~QWSManager(); diff --git a/src/gui/graphicsview/qgraphicsgridlayout.h b/src/gui/graphicsview/qgraphicsgridlayout.h index b9db03e..faa91b3 100644 --- a/src/gui/graphicsview/qgraphicsgridlayout.h +++ b/src/gui/graphicsview/qgraphicsgridlayout.h @@ -127,7 +127,7 @@ public: private: Q_DISABLE_COPY(QGraphicsGridLayout) - Q_DECLARE_PRIVATE(QGraphicsGridLayout) + Q_DECLARE_SCOPED_PRIVATE(QGraphicsGridLayout) }; inline void QGraphicsGridLayout::addItem(QGraphicsLayoutItem *aitem, int arow, int acolumn, Qt::Alignment aalignment) diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h index ac77dc2..0b93c27 100644 --- a/src/gui/graphicsview/qgraphicsitem.h +++ b/src/gui/graphicsview/qgraphicsitem.h @@ -437,7 +437,7 @@ protected: private: Q_DISABLE_COPY(QGraphicsItem) - Q_DECLARE_PRIVATE(QGraphicsItem) + Q_DECLARE_SCOPED_PRIVATE(QGraphicsItem) friend class QGraphicsItemGroup; friend class QGraphicsScene; friend class QGraphicsScenePrivate; @@ -559,7 +559,7 @@ protected: private: Q_DISABLE_COPY(QAbstractGraphicsShapeItem) - Q_DECLARE_PRIVATE(QAbstractGraphicsShapeItem) + Q_DECLARE_SCOPED_PRIVATE(QAbstractGraphicsShapeItem) }; class QGraphicsPathItemPrivate; @@ -602,7 +602,7 @@ protected: private: Q_DISABLE_COPY(QGraphicsPathItem) - Q_DECLARE_PRIVATE(QGraphicsPathItem) + Q_DECLARE_SCOPED_PRIVATE(QGraphicsPathItem) }; class QGraphicsRectItemPrivate; @@ -652,7 +652,7 @@ protected: private: Q_DISABLE_COPY(QGraphicsRectItem) - Q_DECLARE_PRIVATE(QGraphicsRectItem) + Q_DECLARE_SCOPED_PRIVATE(QGraphicsRectItem) }; inline void QGraphicsRectItem::setRect(qreal ax, qreal ay, qreal w, qreal h) @@ -711,7 +711,7 @@ protected: private: Q_DISABLE_COPY(QGraphicsEllipseItem) - Q_DECLARE_PRIVATE(QGraphicsEllipseItem) + Q_DECLARE_SCOPED_PRIVATE(QGraphicsEllipseItem) }; inline void QGraphicsEllipseItem::setRect(qreal ax, qreal ay, qreal w, qreal h) @@ -761,7 +761,7 @@ protected: private: Q_DISABLE_COPY(QGraphicsPolygonItem) - Q_DECLARE_PRIVATE(QGraphicsPolygonItem) + Q_DECLARE_SCOPED_PRIVATE(QGraphicsPolygonItem) }; class QGraphicsLineItemPrivate; @@ -815,7 +815,7 @@ protected: private: Q_DISABLE_COPY(QGraphicsLineItem) - Q_DECLARE_PRIVATE(QGraphicsLineItem) + Q_DECLARE_SCOPED_PRIVATE(QGraphicsLineItem) }; class QGraphicsPixmapItemPrivate; @@ -874,7 +874,7 @@ protected: private: Q_DISABLE_COPY(QGraphicsPixmapItem) - Q_DECLARE_PRIVATE(QGraphicsPixmapItem) + Q_DECLARE_SCOPED_PRIVATE(QGraphicsPixmapItem) }; inline void QGraphicsPixmapItem::setOffset(qreal ax, qreal ay) @@ -1030,7 +1030,7 @@ protected: private: Q_DISABLE_COPY(QGraphicsSimpleTextItem) - Q_DECLARE_PRIVATE(QGraphicsSimpleTextItem) + Q_DECLARE_SCOPED_PRIVATE(QGraphicsSimpleTextItem) }; class QGraphicsItemGroupPrivate; @@ -1059,7 +1059,7 @@ public: private: Q_DISABLE_COPY(QGraphicsItemGroup) - Q_DECLARE_PRIVATE(QGraphicsItemGroup) + Q_DECLARE_SCOPED_PRIVATE(QGraphicsItemGroup) }; template inline T qgraphicsitem_cast(QGraphicsItem *item) diff --git a/src/gui/graphicsview/qgraphicslayout.h b/src/gui/graphicsview/qgraphicslayout.h index 7c758bc..d2c45ab 100644 --- a/src/gui/graphicsview/qgraphicslayout.h +++ b/src/gui/graphicsview/qgraphicslayout.h @@ -81,7 +81,7 @@ protected: private: Q_DISABLE_COPY(QGraphicsLayout) - Q_DECLARE_PRIVATE(QGraphicsLayout) + Q_DECLARE_SCOPED_PRIVATE(QGraphicsLayout) friend class QGraphicsWidget; }; diff --git a/src/gui/graphicsview/qgraphicslayoutitem.h b/src/gui/graphicsview/qgraphicslayoutitem.h index 60f894f..156c843 100644 --- a/src/gui/graphicsview/qgraphicslayoutitem.h +++ b/src/gui/graphicsview/qgraphicslayoutitem.h @@ -117,7 +117,7 @@ protected: private: QSizeF *effectiveSizeHints(const QSizeF &constraint) const; - Q_DECLARE_PRIVATE(QGraphicsLayoutItem) + Q_DECLARE_SCOPED_PRIVATE(QGraphicsLayoutItem) friend class QGraphicsLayout; }; diff --git a/src/gui/graphicsview/qgraphicslinearlayout.h b/src/gui/graphicsview/qgraphicslinearlayout.h index f469680..91335db 100644 --- a/src/gui/graphicsview/qgraphicslinearlayout.h +++ b/src/gui/graphicsview/qgraphicslinearlayout.h @@ -108,7 +108,7 @@ protected: private: Q_DISABLE_COPY(QGraphicsLinearLayout) - Q_DECLARE_PRIVATE(QGraphicsLinearLayout) + Q_DECLARE_SCOPED_PRIVATE(QGraphicsLinearLayout) }; #endif diff --git a/src/gui/graphicsview/qgraphicsscene.h b/src/gui/graphicsview/qgraphicsscene.h index 4d65b91..7c1160c 100644 --- a/src/gui/graphicsview/qgraphicsscene.h +++ b/src/gui/graphicsview/qgraphicsscene.h @@ -272,7 +272,7 @@ Q_SIGNALS: void selectionChanged(); private: - Q_DECLARE_PRIVATE(QGraphicsScene) + Q_DECLARE_SCOPED_PRIVATE(QGraphicsScene) Q_DISABLE_COPY(QGraphicsScene) Q_PRIVATE_SLOT(d_func(), void _q_updateIndex()) Q_PRIVATE_SLOT(d_func(), void _q_emitUpdated()) diff --git a/src/gui/graphicsview/qgraphicssceneevent.h b/src/gui/graphicsview/qgraphicssceneevent.h index c6a3eff..6850b3d 100644 --- a/src/gui/graphicsview/qgraphicssceneevent.h +++ b/src/gui/graphicsview/qgraphicssceneevent.h @@ -76,7 +76,7 @@ public: protected: QGraphicsSceneEvent(QGraphicsSceneEventPrivate &dd, Type type = None); QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QGraphicsSceneEvent) + Q_DECLARE_SCOPED_PRIVATE(QGraphicsSceneEvent) }; class QGraphicsSceneMouseEventPrivate; @@ -123,7 +123,7 @@ public: void setModifiers(Qt::KeyboardModifiers modifiers); private: - Q_DECLARE_PRIVATE(QGraphicsSceneMouseEvent) + Q_DECLARE_SCOPED_PRIVATE(QGraphicsSceneMouseEvent) }; class QGraphicsSceneWheelEventPrivate; @@ -155,7 +155,7 @@ public: void setOrientation(Qt::Orientation orientation); private: - Q_DECLARE_PRIVATE(QGraphicsSceneWheelEvent) + Q_DECLARE_SCOPED_PRIVATE(QGraphicsSceneWheelEvent) }; class QGraphicsSceneContextMenuEventPrivate; @@ -183,7 +183,7 @@ public: void setReason(Reason reason); private: - Q_DECLARE_PRIVATE(QGraphicsSceneContextMenuEvent) + Q_DECLARE_SCOPED_PRIVATE(QGraphicsSceneContextMenuEvent) }; class QGraphicsSceneHoverEventPrivate; @@ -215,7 +215,7 @@ public: void setModifiers(Qt::KeyboardModifiers modifiers); private: - Q_DECLARE_PRIVATE(QGraphicsSceneHoverEvent) + Q_DECLARE_SCOPED_PRIVATE(QGraphicsSceneHoverEvent) }; class QGraphicsSceneHelpEventPrivate; @@ -232,7 +232,7 @@ public: void setScreenPos(const QPoint &pos); private: - Q_DECLARE_PRIVATE(QGraphicsSceneHelpEvent) + Q_DECLARE_SCOPED_PRIVATE(QGraphicsSceneHelpEvent) }; class QGraphicsSceneDragDropEventPrivate; @@ -274,13 +274,13 @@ public: void setMimeData(const QMimeData *data); private: - Q_DECLARE_PRIVATE(QGraphicsSceneDragDropEvent) + Q_DECLARE_SCOPED_PRIVATE(QGraphicsSceneDragDropEvent) }; class QGraphicsSceneResizeEventPrivate; class Q_GUI_EXPORT QGraphicsSceneResizeEvent : public QGraphicsSceneEvent { - Q_DECLARE_PRIVATE(QGraphicsSceneResizeEvent) + Q_DECLARE_SCOPED_PRIVATE(QGraphicsSceneResizeEvent) public: QGraphicsSceneResizeEvent(); ~QGraphicsSceneResizeEvent(); @@ -295,7 +295,7 @@ public: class QGraphicsSceneMoveEventPrivate; class Q_GUI_EXPORT QGraphicsSceneMoveEvent : public QGraphicsSceneEvent { - Q_DECLARE_PRIVATE(QGraphicsSceneMoveEvent) + Q_DECLARE_SCOPED_PRIVATE(QGraphicsSceneMoveEvent) public: QGraphicsSceneMoveEvent(); ~QGraphicsSceneMoveEvent(); @@ -312,7 +312,7 @@ class QGraphicsItem; class QGraphicsSceneGestureEventPrivate; class Q_GUI_EXPORT QGraphicsSceneGestureEvent : public QGraphicsSceneEvent { - Q_DECLARE_PRIVATE(QGraphicsSceneGestureEvent) + Q_DECLARE_SCOPED_PRIVATE(QGraphicsSceneGestureEvent) public: QGraphicsSceneGestureEvent(); ~QGraphicsSceneGestureEvent(); diff --git a/src/gui/graphicsview/qgraphicsview.h b/src/gui/graphicsview/qgraphicsview.h index 1285e45..425f174 100644 --- a/src/gui/graphicsview/qgraphicsview.h +++ b/src/gui/graphicsview/qgraphicsview.h @@ -269,7 +269,7 @@ protected: const QStyleOptionGraphicsItem options[]); private: - Q_DECLARE_PRIVATE(QGraphicsView) + Q_DECLARE_SCOPED_PRIVATE(QGraphicsView) Q_DISABLE_COPY(QGraphicsView) #ifndef QT_NO_CURSOR Q_PRIVATE_SLOT(d_func(), void _q_setViewportCursor(const QCursor &)) diff --git a/src/gui/image/qimageiohandler.h b/src/gui/image/qimageiohandler.h index 50508c0..97b2ba2 100644 --- a/src/gui/image/qimageiohandler.h +++ b/src/gui/image/qimageiohandler.h @@ -60,7 +60,7 @@ class QVariant; class QImageIOHandlerPrivate; class Q_GUI_EXPORT QImageIOHandler { - Q_DECLARE_PRIVATE(QImageIOHandler) + Q_DECLARE_SCOPED_PRIVATE(QImageIOHandler) public: QImageIOHandler(); virtual ~QImageIOHandler(); diff --git a/src/gui/image/qmovie.h b/src/gui/image/qmovie.h index afee789..eda5aa1 100644 --- a/src/gui/image/qmovie.h +++ b/src/gui/image/qmovie.h @@ -74,7 +74,7 @@ class QMoviePrivate; class Q_GUI_EXPORT QMovie : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QMovie) + Q_DECLARE_SCOPED_PRIVATE(QMovie) Q_ENUMS(MovieState CacheMode) Q_PROPERTY(int speed READ speed WRITE setSpeed) Q_PROPERTY(CacheMode cacheMode READ cacheMode WRITE setCacheMode) diff --git a/src/gui/image/qpaintengine_pic_p.h b/src/gui/image/qpaintengine_pic_p.h index 1e6413e..2aaa5f0 100644 --- a/src/gui/image/qpaintengine_pic_p.h +++ b/src/gui/image/qpaintengine_pic_p.h @@ -65,7 +65,7 @@ class QBuffer; class QPicturePaintEngine : public QPaintEngine { - Q_DECLARE_PRIVATE(QPicturePaintEngine) + Q_DECLARE_SCOPED_PRIVATE(QPicturePaintEngine) public: QPicturePaintEngine(); ~QPicturePaintEngine(); diff --git a/src/gui/image/qpicture.h b/src/gui/image/qpicture.h index c323f0e..4d9af37 100644 --- a/src/gui/image/qpicture.h +++ b/src/gui/image/qpicture.h @@ -56,7 +56,7 @@ QT_MODULE(Gui) class QPicturePrivate; class Q_GUI_EXPORT QPicture : public QPaintDevice { - Q_DECLARE_PRIVATE(QPicture) + Q_DECLARE_SCOPED_PRIVATE(QPicture) public: explicit QPicture(int formatVersion = -1); QPicture(const QPicture &); diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index a3b2343..c9478cb 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -268,7 +268,12 @@ QPixmap::QPixmap(const QString& fileName, const char *format, Qt::ImageConversio if (!qt_pixmap_thread_test()) return; - load(fileName, format, flags); + QT_TRY { + load(fileName, format, flags); + } QT_CATCH(...) { + deref(); + QT_RETHROW; + } } /*! @@ -316,12 +321,17 @@ QPixmap::QPixmap(const char * const xpm[]) if (!xpm) return; - QImage image(xpm); - if (!image.isNull()) { - if (data->pixelType() == QPixmapData::BitmapType) - *this = QBitmap::fromImage(image); - else - *this = fromImage(image); + QT_TRY { + QImage image(xpm); + if (!image.isNull()) { + if (data->pixelType() == QPixmapData::BitmapType) + *this = QBitmap::fromImage(image); + else + *this = fromImage(image); + } + } QT_CATCH(...) { + deref(); + QT_RETHROW; } } #endif diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp index 9cc896b..e0d952a 100644 --- a/src/gui/image/qpixmap_raster.cpp +++ b/src/gui/image/qpixmap_raster.cpp @@ -172,9 +172,13 @@ void QRasterPixmapData::fromImage(const QImage &sourceImage, } } #endif - w = image.d->width; - h = image.d->height; - d = image.d->depth; + if (image.d) { + w = image.d->width; + h = image.d->height; + d = image.d->depth; + } else { + w = h = d = 0; + } is_null = (w <= 0 || h <= 0); setSerialNumber(image.serialNumber()); diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp index 132e26e..0460c30 100644 --- a/src/gui/image/qpixmap_s60.cpp +++ b/src/gui/image/qpixmap_s60.cpp @@ -82,7 +82,7 @@ QPixmap QPixmap::grabWindow(WId winId, int x, int y, int w, int h ) return QPixmap(); TDisplayMode displayMode = screenDevice->DisplayMode(); - CFbsBitmap* temporary = new (ELeave) CFbsBitmap(); + CFbsBitmap* temporary = q_check_ptr(new CFbsBitmap()); // CBase derived object needs check on new TInt error = temporary->Create(srcRect.Size(), displayMode); if (error == KErrNone) error = screenDevice->CopyScreenToBitmap(temporary, srcRect); @@ -171,7 +171,7 @@ CFbsBitmap *QPixmap::toSymbianCFbsBitmap() const return 0; } - CFbsBitmap* bitmap = new (ELeave) CFbsBitmap(); + CFbsBitmap* bitmap = q_check_ptr(new CFbsBitmap()); // CBase derived object needs check on new TSize size(width(), height()); if (bitmap->Create(size, mode) != KErrNone) { CBase::Delete(bitmap); diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp index baa2969..af13375 100644 --- a/src/gui/image/qpixmapcache.cpp +++ b/src/gui/image/qpixmapcache.cpp @@ -357,7 +357,8 @@ void QPMCache::resizeKeyArray(int size) { if (size <= keyArraySize || size == 0) return; - keyArray = reinterpret_cast(realloc(keyArray, size * sizeof(int))); + keyArray = q_check_ptr(reinterpret_cast(realloc(keyArray, + size * sizeof(int)))); for (int i = keyArraySize; i != size; ++i) keyArray[i] = i + 1; keyArraySize = size; diff --git a/src/gui/image/qpixmapfilter_p.h b/src/gui/image/qpixmapfilter_p.h index 51292b3..83fc1b9 100644 --- a/src/gui/image/qpixmapfilter_p.h +++ b/src/gui/image/qpixmapfilter_p.h @@ -70,7 +70,7 @@ class QPixmapFilterPrivate; class Q_GUI_EXPORT QPixmapFilter : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QPixmapFilter) + Q_DECLARE_SCOPED_PRIVATE(QPixmapFilter) public: virtual ~QPixmapFilter() = 0; @@ -98,7 +98,7 @@ class QPixmapConvolutionFilterPrivate; class Q_GUI_EXPORT QPixmapConvolutionFilter : public QPixmapFilter { Q_OBJECT - Q_DECLARE_PRIVATE(QPixmapConvolutionFilter) + Q_DECLARE_SCOPED_PRIVATE(QPixmapConvolutionFilter) public: QPixmapConvolutionFilter(QObject *parent = 0); @@ -122,7 +122,7 @@ class QPixmapColorizeFilterPrivate; class Q_GUI_EXPORT QPixmapColorizeFilter : public QPixmapFilter { Q_OBJECT - Q_DECLARE_PRIVATE(QPixmapColorizeFilter) + Q_DECLARE_SCOPED_PRIVATE(QPixmapColorizeFilter) public: QPixmapColorizeFilter(QObject *parent = 0); @@ -138,7 +138,7 @@ class QPixmapDropShadowFilterPrivate; class Q_GUI_EXPORT QPixmapDropShadowFilter : public QPixmapFilter { Q_OBJECT - Q_DECLARE_PRIVATE(QPixmapDropShadowFilter) + Q_DECLARE_SCOPED_PRIVATE(QPixmapDropShadowFilter) public: QPixmapDropShadowFilter(QObject *parent = 0); diff --git a/src/gui/inputmethod/qcoefepinputcontext_p.h b/src/gui/inputmethod/qcoefepinputcontext_p.h index d754763..e63f045 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_p.h +++ b/src/gui/inputmethod/qcoefepinputcontext_p.h @@ -121,6 +121,7 @@ public: private: void DoCommitFepInlineEditL(); MCoeFepAwareTextEditor_Extension1* Extension1(TBool& aSetToTrue); + void ReportAknEdStateEvent(MAknEdStateObserver::EAknEdwinStateEvent aEventType); // From MCoeFepAwareTextEditor_Extension1 public: diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index c03426f..2ef1175 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE QCoeFepInputContext::QCoeFepInputContext(QObject *parent) : QInputContext(parent), - m_fepState(new (ELeave) CAknEdwinState), + m_fepState(q_check_ptr(new CAknEdwinState)), // CBase derived object needs check on new m_lastImHints(Qt::ImhNone), m_textCapabilities(TCoeInputCapabilities::EAllText), m_isEditing(false), @@ -100,6 +100,11 @@ void QCoeFepInputContext::reset() CCoeEnv::Static()->Fep()->CancelTransaction(); } +void QCoeFepInputContext::ReportAknEdStateEvent(MAknEdStateObserver::EAknEdwinStateEvent aEventType) +{ + QT_TRAP_THROWING(m_fepState->ReportAknEdStateEventL(QT_EAknCursorPositionChanged)); +} + void QCoeFepInputContext::update() { updateHints(false); @@ -112,7 +117,7 @@ void QCoeFepInputContext::update() // Don't be fooled (as I was) by the name of this enumeration. // What it really does is tell the virtual keyboard UI that the text has been // updated and it should be reflected in the internal display of the VK. - m_fepState->ReportAknEdStateEventL(QT_EAknCursorPositionChanged); + ReportAknEdStateEvent(QT_EAknCursorPositionChanged); } void QCoeFepInputContext::setFocusWidget(QWidget *w) @@ -394,7 +399,7 @@ void QCoeFepInputContext::applyHints(Qt::InputMethodHints hints) flags = EAknEditorAllInputModes; } m_fepState->SetPermittedInputModes(flags); - m_fepState->ReportAknEdStateEventL(MAknEdStateObserver::EAknEdwinStateInputModeUpdate); + ReportAknEdStateEvent(MAknEdStateObserver::EAknEdwinStateInputModeUpdate); if (hints & ImhPreferLowercase) { m_fepState->SetDefaultCase(EAknEditorLowerCase); @@ -423,7 +428,7 @@ void QCoeFepInputContext::applyHints(Qt::InputMethodHints hints) } } m_fepState->SetPermittedCases(flags); - m_fepState->ReportAknEdStateEventL(MAknEdStateObserver::EAknEdwinStateCaseModeUpdate); + ReportAknEdStateEvent(MAknEdStateObserver::EAknEdwinStateCaseModeUpdate); flags = 0; if (hints & ImhUppercaseOnly && !(hints & ImhLowercaseOnly) @@ -435,7 +440,7 @@ void QCoeFepInputContext::applyHints(Qt::InputMethodHints hints) flags |= EAknEditorFlagNoT9; } m_fepState->SetFlags(flags); - m_fepState->ReportAknEdStateEventL(MAknEdStateObserver::EAknEdwinStateFlagsUpdate); + ReportAknEdStateEvent(MAknEdStateObserver::EAknEdwinStateFlagsUpdate); if (hints & ImhFormattedNumbersOnly) { flags = EAknEditorCalculatorNumberModeKeymap; @@ -525,7 +530,7 @@ void QCoeFepInputContext::StartFepInlineEditL(const TDesC& aInitialInlineText, m_cursorVisibility = aCursorVisibility ? 1 : 0; m_inlinePosition = aPositionOfInsertionPointInInlineText; - m_preeditString = qt_TDesC2QStringL(aInitialInlineText); + m_preeditString = qt_TDesC2QString(aInitialInlineText); m_formatRetriever = &aInlineTextFormatRetriever; m_pointerHandler = &aPointerEventHandlerDuringInlineEdit; @@ -555,7 +560,7 @@ void QCoeFepInputContext::UpdateFepInlineTextL(const TDesC& aNewInlineText, m_inlinePosition, m_cursorVisibility, QVariant())); - m_preeditString = qt_TDesC2QStringL(aNewInlineText); + m_preeditString = qt_TDesC2QString(aNewInlineText); QInputMethodEvent event(m_preeditString, attributes); sendEvent(event); } diff --git a/src/gui/inputmethod/qinputcontext.h b/src/gui/inputmethod/qinputcontext.h index e4e5f9d..87112b5 100644 --- a/src/gui/inputmethod/qinputcontext.h +++ b/src/gui/inputmethod/qinputcontext.h @@ -83,7 +83,7 @@ class QInputContextPrivate; class Q_GUI_EXPORT QInputContext : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QInputContext) + Q_DECLARE_SCOPED_PRIVATE(QInputContext) public: explicit QInputContext(QObject* parent = 0); virtual ~QInputContext(); diff --git a/src/gui/inputmethod/qmacinputcontext_p.h b/src/gui/inputmethod/qmacinputcontext_p.h index 4fcba9a..69ac3e8 100644 --- a/src/gui/inputmethod/qmacinputcontext_p.h +++ b/src/gui/inputmethod/qmacinputcontext_p.h @@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE class Q_GUI_EXPORT QMacInputContext : public QInputContext { Q_OBJECT - //Q_DECLARE_PRIVATE(QMacInputContext) + //Q_DECLARE_SCOPED_PRIVATE(QMacInputContext) void createTextDocument(); public: explicit QMacInputContext(QObject* parent = 0); diff --git a/src/gui/itemviews/qabstractitemview.h b/src/gui/itemviews/qabstractitemview.h index f98dd16..19d6383 100644 --- a/src/gui/itemviews/qabstractitemview.h +++ b/src/gui/itemviews/qabstractitemview.h @@ -345,7 +345,7 @@ protected: #endif private: - Q_DECLARE_PRIVATE(QAbstractItemView) + Q_DECLARE_SCOPED_PRIVATE(QAbstractItemView) Q_DISABLE_COPY(QAbstractItemView) Q_PRIVATE_SLOT(d_func(), void _q_columnsAboutToBeRemoved(const QModelIndex&, int, int)) Q_PRIVATE_SLOT(d_func(), void _q_columnsRemoved(const QModelIndex&, int, int)) diff --git a/src/gui/itemviews/qabstractproxymodel.h b/src/gui/itemviews/qabstractproxymodel.h index 8a703da..356d923 100644 --- a/src/gui/itemviews/qabstractproxymodel.h +++ b/src/gui/itemviews/qabstractproxymodel.h @@ -87,7 +87,7 @@ protected: QAbstractProxyModel(QAbstractProxyModelPrivate &, QObject *parent); private: - Q_DECLARE_PRIVATE(QAbstractProxyModel) + Q_DECLARE_SCOPED_PRIVATE(QAbstractProxyModel) Q_DISABLE_COPY(QAbstractProxyModel) Q_PRIVATE_SLOT(d_func(), void _q_sourceModelDestroyed()) }; diff --git a/src/gui/itemviews/qcolumnview.h b/src/gui/itemviews/qcolumnview.h index 880870a..96da637 100644 --- a/src/gui/itemviews/qcolumnview.h +++ b/src/gui/itemviews/qcolumnview.h @@ -108,7 +108,7 @@ protected Q_SLOTS: void currentChanged(const QModelIndex ¤t, const QModelIndex &previous); private: - Q_DECLARE_PRIVATE(QColumnView) + Q_DECLARE_SCOPED_PRIVATE(QColumnView) Q_DISABLE_COPY(QColumnView) Q_PRIVATE_SLOT(d_func(), void _q_gripMoved(int)) Q_PRIVATE_SLOT(d_func(), void _q_changeCurrentColumn()) diff --git a/src/gui/itemviews/qcolumnviewgrip_p.h b/src/gui/itemviews/qcolumnviewgrip_p.h index 4dc35ec..8e670e9 100644 --- a/src/gui/itemviews/qcolumnviewgrip_p.h +++ b/src/gui/itemviews/qcolumnviewgrip_p.h @@ -82,7 +82,7 @@ protected: void mousePressEvent(QMouseEvent *event); private: - Q_DECLARE_PRIVATE(QColumnViewGrip) + Q_DECLARE_SCOPED_PRIVATE(QColumnViewGrip) Q_DISABLE_COPY(QColumnViewGrip) }; diff --git a/src/gui/itemviews/qdatawidgetmapper.h b/src/gui/itemviews/qdatawidgetmapper.h index 2df7b69..2773b59 100644 --- a/src/gui/itemviews/qdatawidgetmapper.h +++ b/src/gui/itemviews/qdatawidgetmapper.h @@ -111,7 +111,7 @@ Q_SIGNALS: void currentIndexChanged(int index); private: - Q_DECLARE_PRIVATE(QDataWidgetMapper) + Q_DECLARE_SCOPED_PRIVATE(QDataWidgetMapper) Q_DISABLE_COPY(QDataWidgetMapper) Q_PRIVATE_SLOT(d_func(), void _q_dataChanged(const QModelIndex &, const QModelIndex &)) Q_PRIVATE_SLOT(d_func(), void _q_commitData(QWidget *)) diff --git a/src/gui/itemviews/qdirmodel.h b/src/gui/itemviews/qdirmodel.h index 719d551..1f28cc9 100644 --- a/src/gui/itemviews/qdirmodel.h +++ b/src/gui/itemviews/qdirmodel.h @@ -146,7 +146,7 @@ protected: friend class QFileDialogPrivate; private: - Q_DECLARE_PRIVATE(QDirModel) + Q_DECLARE_SCOPED_PRIVATE(QDirModel) Q_DISABLE_COPY(QDirModel) Q_PRIVATE_SLOT(d_func(), void _q_refresh()) }; diff --git a/src/gui/itemviews/qfileiconprovider.h b/src/gui/itemviews/qfileiconprovider.h index 165e30f..dd1bedd 100644 --- a/src/gui/itemviews/qfileiconprovider.h +++ b/src/gui/itemviews/qfileiconprovider.h @@ -67,7 +67,7 @@ public: virtual QString type(const QFileInfo &info) const; private: - Q_DECLARE_PRIVATE(QFileIconProvider) + Q_DECLARE_SCOPED_PRIVATE(QFileIconProvider) QScopedPointer d_ptr; Q_DISABLE_COPY(QFileIconProvider) }; diff --git a/src/gui/itemviews/qheaderview.h b/src/gui/itemviews/qheaderview.h index f752ae2..cdbc1e6 100644 --- a/src/gui/itemviews/qheaderview.h +++ b/src/gui/itemviews/qheaderview.h @@ -229,7 +229,7 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_sectionsRemoved(const QModelIndex &parent, int logicalFirst, int logicalLast)) Q_PRIVATE_SLOT(d_func(), void _q_layoutAboutToBeChanged()) Q_PRIVATE_SLOT(d_func(), void _q_layoutChanged()) - Q_DECLARE_PRIVATE(QHeaderView) + Q_DECLARE_SCOPED_PRIVATE(QHeaderView) Q_DISABLE_COPY(QHeaderView) }; diff --git a/src/gui/itemviews/qitemdelegate.h b/src/gui/itemviews/qitemdelegate.h index d46481c..a6f0ba1 100644 --- a/src/gui/itemviews/qitemdelegate.h +++ b/src/gui/itemviews/qitemdelegate.h @@ -126,7 +126,7 @@ protected: const QFont &font, const QString &text) const; private: - Q_DECLARE_PRIVATE(QItemDelegate) + Q_DECLARE_SCOPED_PRIVATE(QItemDelegate) Q_DISABLE_COPY(QItemDelegate) Q_PRIVATE_SLOT(d_func(), void _q_commitDataAndCloseEditor(QWidget*)) diff --git a/src/gui/itemviews/qitemselectionmodel.h b/src/gui/itemviews/qitemselectionmodel.h index e6a99a6..bc9f61c 100644 --- a/src/gui/itemviews/qitemselectionmodel.h +++ b/src/gui/itemviews/qitemselectionmodel.h @@ -125,7 +125,7 @@ class QItemSelectionModelPrivate; class Q_GUI_EXPORT QItemSelectionModel : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QItemSelectionModel) + Q_DECLARE_SCOPED_PRIVATE(QItemSelectionModel) Q_FLAGS(SelectionFlags) public: diff --git a/src/gui/itemviews/qlistview.h b/src/gui/itemviews/qlistview.h index 75dff40..a098427 100644 --- a/src/gui/itemviews/qlistview.h +++ b/src/gui/itemviews/qlistview.h @@ -190,7 +190,7 @@ private: friend class QAccessibleItemView; int visualIndex(const QModelIndex &index) const; - Q_DECLARE_PRIVATE(QListView) + Q_DECLARE_SCOPED_PRIVATE(QListView) Q_DISABLE_COPY(QListView) }; diff --git a/src/gui/itemviews/qlistwidget.h b/src/gui/itemviews/qlistwidget.h index afcc331..d2f2f06 100644 --- a/src/gui/itemviews/qlistwidget.h +++ b/src/gui/itemviews/qlistwidget.h @@ -291,7 +291,7 @@ private: void setModel(QAbstractItemModel *model); Qt::SortOrder sortOrder() const; - Q_DECLARE_PRIVATE(QListWidget) + Q_DECLARE_SCOPED_PRIVATE(QListWidget) Q_DISABLE_COPY(QListWidget) Q_PRIVATE_SLOT(d_func(), void _q_emitItemPressed(const QModelIndex &index)) diff --git a/src/gui/itemviews/qproxymodel.h b/src/gui/itemviews/qproxymodel.h index 62cf33e..420753c 100644 --- a/src/gui/itemviews/qproxymodel.h +++ b/src/gui/itemviews/qproxymodel.h @@ -119,7 +119,7 @@ protected: void disconnectFromModel(const QAbstractItemModel *model) const; private: - Q_DECLARE_PRIVATE(QProxyModel) + Q_DECLARE_SCOPED_PRIVATE(QProxyModel) Q_DISABLE_COPY(QProxyModel) Q_PRIVATE_SLOT(d_func(), void _q_sourceDataChanged(const QModelIndex&,const QModelIndex&)) diff --git a/src/gui/itemviews/qsortfilterproxymodel.h b/src/gui/itemviews/qsortfilterproxymodel.h index 0bd084e..b179559 100644 --- a/src/gui/itemviews/qsortfilterproxymodel.h +++ b/src/gui/itemviews/qsortfilterproxymodel.h @@ -172,7 +172,7 @@ public: QStringList mimeTypes() const; Qt::DropActions supportedDropActions() const; private: - Q_DECLARE_PRIVATE(QSortFilterProxyModel) + Q_DECLARE_SCOPED_PRIVATE(QSortFilterProxyModel) Q_DISABLE_COPY(QSortFilterProxyModel) Q_PRIVATE_SLOT(d_func(), void _q_sourceDataChanged(const QModelIndex &source_top_left, const QModelIndex &source_bottom_right)) diff --git a/src/gui/itemviews/qstandarditemmodel.h b/src/gui/itemviews/qstandarditemmodel.h index c470b80..7e76a4a 100644 --- a/src/gui/itemviews/qstandarditemmodel.h +++ b/src/gui/itemviews/qstandarditemmodel.h @@ -245,7 +245,7 @@ protected: void emitDataChanged(); private: - Q_DECLARE_PRIVATE(QStandardItem) + Q_DECLARE_SCOPED_PRIVATE(QStandardItem) friend class QStandardItemModelPrivate; friend class QStandardItemModel; }; @@ -422,7 +422,7 @@ private: friend class QStandardItemPrivate; friend class QStandardItem; Q_DISABLE_COPY(QStandardItemModel) - Q_DECLARE_PRIVATE(QStandardItemModel) + Q_DECLARE_SCOPED_PRIVATE(QStandardItemModel) Q_PRIVATE_SLOT(d_func(), void _q_emitItemChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)) diff --git a/src/gui/itemviews/qstyleditemdelegate.h b/src/gui/itemviews/qstyleditemdelegate.h index ccb1024..2f31387 100644 --- a/src/gui/itemviews/qstyleditemdelegate.h +++ b/src/gui/itemviews/qstyleditemdelegate.h @@ -101,7 +101,7 @@ protected: const QStyleOptionViewItem &option, const QModelIndex &index); private: - Q_DECLARE_PRIVATE(QStyledItemDelegate) + Q_DECLARE_SCOPED_PRIVATE(QStyledItemDelegate) Q_DISABLE_COPY(QStyledItemDelegate) Q_PRIVATE_SLOT(d_func(), void _q_commitDataAndCloseEditor(QWidget*)) diff --git a/src/gui/itemviews/qtableview.h b/src/gui/itemviews/qtableview.h index c09186c..7e4ba54 100644 --- a/src/gui/itemviews/qtableview.h +++ b/src/gui/itemviews/qtableview.h @@ -178,7 +178,7 @@ private: friend class QAccessibleItemView; int visualIndex(const QModelIndex &index) const; - Q_DECLARE_PRIVATE(QTableView) + Q_DECLARE_SCOPED_PRIVATE(QTableView) Q_DISABLE_COPY(QTableView) Q_PRIVATE_SLOT(d_func(), void _q_selectRow(int)) Q_PRIVATE_SLOT(d_func(), void _q_selectColumn(int)) diff --git a/src/gui/itemviews/qtablewidget.h b/src/gui/itemviews/qtablewidget.h index 6c25ba0..1963df8 100644 --- a/src/gui/itemviews/qtablewidget.h +++ b/src/gui/itemviews/qtablewidget.h @@ -336,7 +336,7 @@ protected: private: void setModel(QAbstractItemModel *model); - Q_DECLARE_PRIVATE(QTableWidget) + Q_DECLARE_SCOPED_PRIVATE(QTableWidget) Q_DISABLE_COPY(QTableWidget) Q_PRIVATE_SLOT(d_func(), void _q_emitItemPressed(const QModelIndex &index)) diff --git a/src/gui/itemviews/qtreeview.h b/src/gui/itemviews/qtreeview.h index 35a205c..f9748c6 100644 --- a/src/gui/itemviews/qtreeview.h +++ b/src/gui/itemviews/qtreeview.h @@ -220,7 +220,7 @@ private: friend class QAccessibleItemView; int visualIndex(const QModelIndex &index) const; - Q_DECLARE_PRIVATE(QTreeView) + Q_DECLARE_SCOPED_PRIVATE(QTreeView) Q_DISABLE_COPY(QTreeView) Q_PRIVATE_SLOT(d_func(), void _q_endAnimatedOperation()) Q_PRIVATE_SLOT(d_func(), void _q_animate()) diff --git a/src/gui/itemviews/qtreewidget.h b/src/gui/itemviews/qtreewidget.h index 3266725..b640a7a 100644 --- a/src/gui/itemviews/qtreewidget.h +++ b/src/gui/itemviews/qtreewidget.h @@ -367,7 +367,7 @@ protected: private: void setModel(QAbstractItemModel *model); - Q_DECLARE_PRIVATE(QTreeWidget) + Q_DECLARE_SCOPED_PRIVATE(QTreeWidget) Q_DISABLE_COPY(QTreeWidget) Q_PRIVATE_SLOT(d_func(), void _q_emitItemPressed(const QModelIndex &index)) diff --git a/src/gui/itemviews/qtreewidget_p.h b/src/gui/itemviews/qtreewidget_p.h index 145916a..6d62062 100644 --- a/src/gui/itemviews/qtreewidget_p.h +++ b/src/gui/itemviews/qtreewidget_p.h @@ -162,7 +162,7 @@ private: bool isChanging() const; private: - Q_DECLARE_PRIVATE(QTreeModel) + Q_DECLARE_SCOPED_PRIVATE(QTreeModel) public: struct SkipSorting { diff --git a/src/gui/itemviews/qtreewidgetitemiterator.h b/src/gui/itemviews/qtreewidgetitemiterator.h index eff9fdb..ce0b610 100644 --- a/src/gui/itemviews/qtreewidgetitemiterator.h +++ b/src/gui/itemviews/qtreewidgetitemiterator.h @@ -109,7 +109,7 @@ private: QScopedPointer d_ptr; QTreeWidgetItem *current; IteratorFlags flags; - Q_DECLARE_PRIVATE(QTreeWidgetItemIterator) + Q_DECLARE_SCOPED_PRIVATE(QTreeWidgetItemIterator) }; inline const QTreeWidgetItemIterator QTreeWidgetItemIterator::operator++(int) diff --git a/src/gui/kernel/qaction.h b/src/gui/kernel/qaction.h index b9bdcf1..f884a9a 100644 --- a/src/gui/kernel/qaction.h +++ b/src/gui/kernel/qaction.h @@ -64,7 +64,7 @@ class QGraphicsWidget; class Q_GUI_EXPORT QAction : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QAction) + Q_DECLARE_SCOPED_PRIVATE(QAction) Q_ENUMS(MenuRole) Q_ENUMS(SoftKeyRole) diff --git a/src/gui/kernel/qactiongroup.h b/src/gui/kernel/qactiongroup.h index e42c2e5..07bdbda 100644 --- a/src/gui/kernel/qactiongroup.h +++ b/src/gui/kernel/qactiongroup.h @@ -57,7 +57,7 @@ class QActionGroupPrivate; class Q_GUI_EXPORT QActionGroup : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QActionGroup) + Q_DECLARE_SCOPED_PRIVATE(QActionGroup) Q_PROPERTY(bool exclusive READ isExclusive WRITE setExclusive) Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled) diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 2f1ab0e..ab2672b 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -855,7 +855,7 @@ extern void qInitDrawhelperAsm(); void QApplicationPrivate::initialize() { QWidgetPrivate::mapper = new QWidgetMapper; - QWidgetPrivate::uncreatedWidgets = new QWidgetSet; + QWidgetPrivate::allWidgets = new QWidgetSet; if (qt_appType != QApplication::Tty) (void) QApplication::style(); // trigger creation of application style // trigger registering of QVariant's GUI types @@ -1007,23 +1007,13 @@ QApplication::~QApplication() qt_clipboard = 0; #endif - // delete widget mapper - if (QWidgetPrivate::mapper) { - QWidgetMapper * myMapper = QWidgetPrivate::mapper; - QWidgetPrivate::mapper = 0; - for (QWidgetMapper::ConstIterator it = myMapper->constBegin(); - it != myMapper->constEnd(); ++it) { - register QWidget *w = *it; - if (!w->parent()) // window - w->destroy(true, true); - } - delete myMapper; - } + delete QWidgetPrivate::mapper; + QWidgetPrivate::mapper = 0; - // delete uncreated widgets - if (QWidgetPrivate::uncreatedWidgets) { - QWidgetSet *mySet = QWidgetPrivate::uncreatedWidgets; - QWidgetPrivate::uncreatedWidgets = 0; + // delete all widgets + if (QWidgetPrivate::allWidgets) { + QWidgetSet *mySet = QWidgetPrivate::allWidgets; + QWidgetPrivate::allWidgets = 0; for (QWidgetSet::ConstIterator it = mySet->constBegin(); it != mySet->constEnd(); ++it) { register QWidget *w = *it; if (!w->parent()) // window @@ -2050,12 +2040,9 @@ QWidgetList QApplication::topLevelWidgets() QWidgetList QApplication::allWidgets() { - QWidgetList list; - if (QWidgetPrivate::mapper) - list += QWidgetPrivate::mapper->values(); - if (QWidgetPrivate::uncreatedWidgets) - list += QWidgetPrivate::uncreatedWidgets->toList(); - return list; + if (QWidgetPrivate::allWidgets) + return QWidgetPrivate::allWidgets->toList(); + return QWidgetList(); } /*! diff --git a/src/gui/kernel/qapplication.h b/src/gui/kernel/qapplication.h index 4b447b5..6305951 100644 --- a/src/gui/kernel/qapplication.h +++ b/src/gui/kernel/qapplication.h @@ -371,7 +371,7 @@ public: private: Q_DISABLE_COPY(QApplication) - Q_DECLARE_PRIVATE(QApplication) + Q_DECLARE_SCOPED_PRIVATE(QApplication) friend class QGraphicsWidget; friend class QGraphicsScene; diff --git a/src/gui/kernel/qapplication_qws.cpp b/src/gui/kernel/qapplication_qws.cpp index 92fe5f5..b7d1288 100644 --- a/src/gui/kernel/qapplication_qws.cpp +++ b/src/gui/kernel/qapplication_qws.cpp @@ -668,7 +668,7 @@ void QWSDisplay::Data::sendSynchronousCommand(QWSCommand & cmd) int QWSDisplay::Data::takeId() { - if (unused_identifiers.count() == 10) + if (unused_identifiers.count() <= 10) create(15); if (unused_identifiers.count() == 0) waitForCreation(); @@ -3758,4 +3758,14 @@ void QApplicationPrivate::initializeMultitouch_sys() void QApplicationPrivate::cleanupMultitouch_sys() { } +/* \internal + This is used to clean up the qws server + in case the QApplication constructor threw an exception +*/ +QWSServerCleaner::~QWSServerCleaner() +{ + if (qwsServer && qws_single_process) + QWSServer::closedown(); +} + QT_END_NAMESPACE diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 766ca4b..7836238 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -76,13 +76,18 @@ QT_BEGIN_NAMESPACE static bool appNoGrab = false; // Grabbing enabled #endif -Q_GUI_EXPORT QS60Data *qt_s60Data = 0; +Q_GLOBAL_STATIC(QS60Data, qt_s60Data); extern bool qt_sendSpontaneousEvent(QObject*,QEvent*); extern QDesktopWidget *qt_desktopWidget; // qapplication.cpp QWidget *qt_button_down = 0; // widget got last button-down +QS60Data* qGlobalS60Data() +{ + return qt_s60Data(); +} + bool qt_nograb() // application no-grab option { #if defined(QT_DEBUG) @@ -441,7 +446,7 @@ void QSymbianControl::sendMouseEvent(QWidget *widget, QMouseEvent *mEvent) TKeyResponse QSymbianControl::OfferKeyEventL(const TKeyEvent& keyEvent, TEventCode type) { TKeyResponse r = EKeyWasNotConsumed; - QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_LEAVE(r = OfferKeyEvent(keyEvent, type)); + QT_TRYCATCH_LEAVING(r = OfferKeyEvent(keyEvent, type)); return r; } @@ -706,8 +711,6 @@ TTypeUid::Ptr QSymbianControl::MopSupplyObject(TTypeUid id) void qt_init(QApplicationPrivate * /* priv */, int) { - S60 = new QS60Data; - #ifdef QT_NO_DEBUG if (!qgetenv("QT_S60_AUTO_FLUSH_WSERV").isEmpty()) #endif @@ -723,7 +726,6 @@ void qt_init(QApplicationPrivate * /* priv */, int) TSecureId securId = me.SecureId(); S60->uid = securId.operator TUid(); - /* ### Commented out for now as parameter handling not needed in SOS(yet). Code below will break testlib with -o flag int argc = priv->argc; diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index bb7d931..4f35583 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -1191,7 +1191,7 @@ static void qWinProcessConfigRequests() // perform requests in qu class QGuiEventDispatcherWin32 : public QEventDispatcherWin32 { - Q_DECLARE_PRIVATE(QEventDispatcherWin32) + Q_DECLARE_SCOPED_PRIVATE(QEventDispatcherWin32) public: QGuiEventDispatcherWin32(QObject *parent = 0); bool processEvents(QEventLoop::ProcessEventsFlags flags); diff --git a/src/gui/kernel/qboxlayout.cpp b/src/gui/kernel/qboxlayout.cpp index 770f5bb..b51d77f 100644 --- a/src/gui/kernel/qboxlayout.cpp +++ b/src/gui/kernel/qboxlayout.cpp @@ -925,9 +925,15 @@ void QBoxLayout::insertSpacing(int index, int size) else b = QLayoutPrivate::createSpacerItem(this, 0, size, QSizePolicy::Minimum, QSizePolicy::Fixed); - QBoxLayoutItem *it = new QBoxLayoutItem(b); - it->magic = true; - d->list.insert(index, it); + QT_TRY { + QBoxLayoutItem *it = new QBoxLayoutItem(b); + it->magic = true; + d->list.insert(index, it); + + } QT_CATCH(...) { + delete b; + QT_RETHROW; + } invalidate(); } @@ -1027,8 +1033,21 @@ void QBoxLayout::insertWidget(int index, QWidget *widget, int stretch, index = d->list.count(); QWidgetItem *b = QLayoutPrivate::createWidgetItem(this, widget); b->setAlignment(alignment); - QBoxLayoutItem *it = new QBoxLayoutItem(b, stretch); - d->list.insert(index, it); + + QBoxLayoutItem *it; + QT_TRY{ + it = new QBoxLayoutItem(b, stretch); + } QT_CATCH(...) { + delete b; + QT_RETHROW; + } + + QT_TRY{ + d->list.insert(index, it); + } QT_CATCH(...) { + delete it; + QT_RETHROW; + } invalidate(); } diff --git a/src/gui/kernel/qboxlayout.h b/src/gui/kernel/qboxlayout.h index f463c31..c399b8d 100644 --- a/src/gui/kernel/qboxlayout.h +++ b/src/gui/kernel/qboxlayout.h @@ -60,7 +60,7 @@ class QBoxLayoutPrivate; class Q_GUI_EXPORT QBoxLayout : public QLayout { Q_OBJECT - Q_DECLARE_PRIVATE(QBoxLayout) + Q_DECLARE_SCOPED_PRIVATE(QBoxLayout) public: enum Direction { LeftToRight, RightToLeft, TopToBottom, BottomToTop, Down = TopToBottom, Up = BottomToTop }; diff --git a/src/gui/kernel/qclipboard.h b/src/gui/kernel/qclipboard.h index 8241812..68fbf33 100644 --- a/src/gui/kernel/qclipboard.h +++ b/src/gui/kernel/qclipboard.h @@ -62,7 +62,7 @@ class QClipboardPrivate; class Q_GUI_EXPORT QClipboard : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QClipboard) + Q_DECLARE_SCOPED_PRIVATE(QClipboard) private: QClipboard(QObject *parent); ~QClipboard(); diff --git a/src/gui/kernel/qclipboard_s60.cpp b/src/gui/kernel/qclipboard_s60.cpp index db5e7f3..27b4fdb 100644 --- a/src/gui/kernel/qclipboard_s60.cpp +++ b/src/gui/kernel/qclipboard_s60.cpp @@ -143,8 +143,10 @@ static QClipboardData *clipboardData() return internalCbData; } -void writeToStream(const QMimeData* aData, RWriteStream& aStream) +void writeToStreamLX(const QMimeData* aData, RWriteStream& aStream) { + // This function both leaves and throws exceptions. There must be no destructor + // dependencies between cleanup styles, and no cleanup stack dependencies on stacked objects. QStringList headers = aData->formats(); aStream << TCardinality(headers.count()); for (QStringList::const_iterator iter= headers.constBegin();iter != headers.constEnd();iter++) @@ -162,8 +164,10 @@ void writeToStream(const QMimeData* aData, RWriteStream& aStream) } } -void readFromStream(QMimeData* aData,RReadStream& aStream) +void readFromStreamLX(QMimeData* aData,RReadStream& aStream) { + // This function both leaves and throws exceptions. There must be no destructor + // dependencies between cleanup styles, and no cleanup stack dependencies on stacked objects. TCardinality mimeTypeCount; aStream >> mimeTypeCount; for (int i = 0; i< mimeTypeCount;i++) @@ -173,6 +177,7 @@ void readFromStream(QMimeData* aData,RReadStream& aStream) aStream >> mimeTypeSize; HBufC* mimeTypeBuf = HBufC::NewLC(aStream,mimeTypeSize); QString mimeType = QString::fromUtf16(mimeTypeBuf->Des().Ptr(),mimeTypeBuf->Length()); + CleanupStack::PopAndDestroy(mimeTypeBuf); // mime data TCardinality dataSize; aStream >> dataSize; @@ -182,8 +187,6 @@ void readFromStream(QMimeData* aData,RReadStream& aStream) ba.data_ptr()->size = dataSize; qDebug() << "paste from clipboard mime: " << mimeType << " data: " << ba; aData->setData(mimeType,ba); - CleanupStack::PopAndDestroy(mimeTypeBuf); - } } @@ -210,7 +213,7 @@ const QMimeData* QClipboard::mimeData(Mode mode) const RStoreReadStream stream; TStreamId stid = (cb->StreamDictionary()).At(KQtCbDataStream); stream.OpenLC(cb->Store(),stid); - readFromStream(d->source(),stream); + QT_TRYCATCH_LEAVING(readFromStreamLX(d->source(),stream)); CleanupStack::PopAndDestroy(2,cb); return d->source(); }); @@ -235,7 +238,7 @@ void QClipboard::setMimeData(QMimeData* src, Mode mode) CClipboard* cb = CClipboard::NewForWritingLC(fs); RStoreWriteStream stream; TStreamId stid = stream.CreateLC(cb->Store()); - writeToStream(src,stream); + QT_TRYCATCH_LEAVING(writeToStreamLX(src,stream)); d->setSource(src); stream.CommitL(); (cb->StreamDictionary()).AssignL(KQtCbDataStream,stid); diff --git a/src/gui/kernel/qdesktopwidget.h b/src/gui/kernel/qdesktopwidget.h index 470f10a..d61e00c 100644 --- a/src/gui/kernel/qdesktopwidget.h +++ b/src/gui/kernel/qdesktopwidget.h @@ -91,7 +91,7 @@ protected: private: Q_DISABLE_COPY(QDesktopWidget) - Q_DECLARE_PRIVATE(QDesktopWidget) + Q_DECLARE_SCOPED_PRIVATE(QDesktopWidget) friend class QApplication; friend class QApplicationPrivate; diff --git a/src/gui/kernel/qdesktopwidget_x11.cpp b/src/gui/kernel/qdesktopwidget_x11.cpp index 59d3239..94032e3 100644 --- a/src/gui/kernel/qdesktopwidget_x11.cpp +++ b/src/gui/kernel/qdesktopwidget_x11.cpp @@ -197,7 +197,7 @@ void QDesktopWidgetPrivate::init() if (screens) { // leaks QWidget* pointers on purpose, can't delete them as pointer escapes - screens = (QWidget**) realloc(screens, j * sizeof(QWidget*)); + screens = q_check_ptr((QWidget**) realloc(screens, j * sizeof(QWidget*))); if (j > screenCount) memset(&screens[screenCount], 0, (j-screenCount) * sizeof(QWidget*)); } diff --git a/src/gui/kernel/qdnd_s60.cpp b/src/gui/kernel/qdnd_s60.cpp index c459f8f..07b196e 100644 --- a/src/gui/kernel/qdnd_s60.cpp +++ b/src/gui/kernel/qdnd_s60.cpp @@ -128,7 +128,7 @@ public: QImage temp = pm.toImage(); QSize size = pm.size(); temp.bits(); - CFbsBitmap *curbm = new (ELeave) CFbsBitmap(); + CFbsBitmap *curbm = q_check_ptr(new CFbsBitmap()); // CBase derived object needs check on new curbm->Create(TSize(size.width(),size.height()),EColor16MA); curbm->LockHeap(ETrue); memcpy((uchar*)curbm->DataAddress(),temp.bits(),temp.numBytes()); diff --git a/src/gui/kernel/qdnd_x11.cpp b/src/gui/kernel/qdnd_x11.cpp index 7b445ea..410d1a9 100644 --- a/src/gui/kernel/qdnd_x11.cpp +++ b/src/gui/kernel/qdnd_x11.cpp @@ -316,7 +316,7 @@ static XdndData xdnd_data = { 0, 0 }; class QExtraWidget : public QWidget { - Q_DECLARE_PRIVATE(QWidget) + Q_DECLARE_SCOPED_PRIVATE(QWidget) public: inline QWExtra* extraData(); inline QTLWExtra* topData(); diff --git a/src/gui/kernel/qdrag.h b/src/gui/kernel/qdrag.h index b49d82a..7e54b51 100644 --- a/src/gui/kernel/qdrag.h +++ b/src/gui/kernel/qdrag.h @@ -61,7 +61,7 @@ class QDragManager; class Q_GUI_EXPORT QDrag : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QDrag) + Q_DECLARE_SCOPED_PRIVATE(QDrag) public: explicit QDrag(QWidget *dragSource); ~QDrag(); diff --git a/src/gui/kernel/qeventdispatcher_glib_qws_p.h b/src/gui/kernel/qeventdispatcher_glib_qws_p.h index 826661e..f0751be 100644 --- a/src/gui/kernel/qeventdispatcher_glib_qws_p.h +++ b/src/gui/kernel/qeventdispatcher_glib_qws_p.h @@ -62,7 +62,7 @@ class QWSEventDispatcherGlibPrivate; class QWSEventDispatcherGlib : public QEventDispatcherGlib { Q_OBJECT - Q_DECLARE_PRIVATE(QWSEventDispatcherGlib) + Q_DECLARE_SCOPED_PRIVATE(QWSEventDispatcherGlib) public: explicit QWSEventDispatcherGlib(QObject *parent = 0); diff --git a/src/gui/kernel/qeventdispatcher_mac_p.h b/src/gui/kernel/qeventdispatcher_mac_p.h index 88663c6..1986c4c 100644 --- a/src/gui/kernel/qeventdispatcher_mac_p.h +++ b/src/gui/kernel/qeventdispatcher_mac_p.h @@ -108,7 +108,7 @@ class QEventDispatcherMacPrivate; class QEventDispatcherMac : public QAbstractEventDispatcher { Q_OBJECT - Q_DECLARE_PRIVATE(QEventDispatcherMac) + Q_DECLARE_SCOPED_PRIVATE(QEventDispatcherMac) public: explicit QEventDispatcherMac(QObject *parent = 0); diff --git a/src/gui/kernel/qeventdispatcher_qws_p.h b/src/gui/kernel/qeventdispatcher_qws_p.h index b83fa10..982ed58 100644 --- a/src/gui/kernel/qeventdispatcher_qws_p.h +++ b/src/gui/kernel/qeventdispatcher_qws_p.h @@ -62,7 +62,7 @@ class QEventDispatcherQWSPrivate; class QEventDispatcherQWS : public QEventDispatcherUNIX { Q_OBJECT - Q_DECLARE_PRIVATE(QEventDispatcherQWS) + Q_DECLARE_SCOPED_PRIVATE(QEventDispatcherQWS) public: explicit QEventDispatcherQWS(QObject *parent = 0); diff --git a/src/gui/kernel/qeventdispatcher_s60.cpp b/src/gui/kernel/qeventdispatcher_s60.cpp index 51878df..2fea8a4 100644 --- a/src/gui/kernel/qeventdispatcher_s60.cpp +++ b/src/gui/kernel/qeventdispatcher_s60.cpp @@ -76,7 +76,7 @@ bool QEventDispatcherS60::processEvents ( QEventLoop::ProcessEventsFlags flags ) m_noInputEvents = oldNoInputEventsValue; } QT_CATCH (const std::exception& ex) { #ifndef QT_NO_EXCEPTIONS - CActiveScheduler::Current()->Error(qt_translateExceptionToSymbianError(ex)); + CActiveScheduler::Current()->Error(qt_exception2SymbianError(ex)); #endif } diff --git a/src/gui/kernel/qeventdispatcher_x11_p.h b/src/gui/kernel/qeventdispatcher_x11_p.h index 9a54c36..b4c553d 100644 --- a/src/gui/kernel/qeventdispatcher_x11_p.h +++ b/src/gui/kernel/qeventdispatcher_x11_p.h @@ -62,7 +62,7 @@ class QEventDispatcherX11Private; class QEventDispatcherX11 : public QEventDispatcherUNIX { Q_OBJECT - Q_DECLARE_PRIVATE(QEventDispatcherX11) + Q_DECLARE_SCOPED_PRIVATE(QEventDispatcherX11) public: explicit QEventDispatcherX11(QObject *parent = 0); diff --git a/src/gui/kernel/qformlayout.h b/src/gui/kernel/qformlayout.h index b560e85..0143711 100644 --- a/src/gui/kernel/qformlayout.h +++ b/src/gui/kernel/qformlayout.h @@ -56,7 +56,7 @@ class Q_GUI_EXPORT QFormLayout : public QLayout { Q_OBJECT Q_ENUMS(FormStyle FieldGrowthPolicy RowWrapPolicy ItemRole) - Q_DECLARE_PRIVATE(QFormLayout) + Q_DECLARE_SCOPED_PRIVATE(QFormLayout) Q_PROPERTY(FieldGrowthPolicy fieldGrowthPolicy READ fieldGrowthPolicy WRITE setFieldGrowthPolicy RESET resetFieldGrowthPolicy) Q_PROPERTY(RowWrapPolicy rowWrapPolicy READ rowWrapPolicy WRITE setRowWrapPolicy RESET resetRowWrapPolicy) Q_PROPERTY(Qt::Alignment labelAlignment READ labelAlignment WRITE setLabelAlignment RESET resetLabelAlignment) diff --git a/src/gui/kernel/qgesture.h b/src/gui/kernel/qgesture.h index f3c95cc..a7aba22 100644 --- a/src/gui/kernel/qgesture.h +++ b/src/gui/kernel/qgesture.h @@ -59,7 +59,7 @@ class QGesturePrivate; class Q_GUI_EXPORT QGesture : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QGesture) + Q_DECLARE_SCOPED_PRIVATE(QGesture) Q_PROPERTY(QString type READ type) Q_PROPERTY(Qt::GestureState state READ state) @@ -128,7 +128,7 @@ class QPanningGesturePrivate; class Q_GUI_EXPORT QPanningGesture : public QGesture { Q_OBJECT - Q_DECLARE_PRIVATE(QPanningGesture) + Q_DECLARE_SCOPED_PRIVATE(QPanningGesture) Q_PROPERTY(Qt::DirectionType lastDirection READ lastDirection) Q_PROPERTY(Qt::DirectionType direction READ direction) diff --git a/src/gui/kernel/qgesturerecognizer.h b/src/gui/kernel/qgesturerecognizer.h index 2c1c61b..65c4ca0 100644 --- a/src/gui/kernel/qgesturerecognizer.h +++ b/src/gui/kernel/qgesturerecognizer.h @@ -53,7 +53,7 @@ class QGestureRecognizerPrivate; class Q_GUI_EXPORT QGestureRecognizer : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QGestureRecognizer) + Q_DECLARE_SCOPED_PRIVATE(QGestureRecognizer) public: enum Result diff --git a/src/gui/kernel/qgridlayout.h b/src/gui/kernel/qgridlayout.h index 89a04a4..2b5299e 100644 --- a/src/gui/kernel/qgridlayout.h +++ b/src/gui/kernel/qgridlayout.h @@ -60,7 +60,7 @@ class QGridLayoutPrivate; class Q_GUI_EXPORT QGridLayout : public QLayout { Q_OBJECT - Q_DECLARE_PRIVATE(QGridLayout) + Q_DECLARE_SCOPED_PRIVATE(QGridLayout) QDOC_PROPERTY(int horizontalSpacing READ horizontalSpacing WRITE setHorizontalSpacing) QDOC_PROPERTY(int verticalSpacing READ verticalSpacing WRITE setVerticalSpacing) diff --git a/src/gui/kernel/qguieventdispatcher_glib_p.h b/src/gui/kernel/qguieventdispatcher_glib_p.h index 65d233e..8543836 100644 --- a/src/gui/kernel/qguieventdispatcher_glib_p.h +++ b/src/gui/kernel/qguieventdispatcher_glib_p.h @@ -62,7 +62,7 @@ class QGuiEventDispatcherGlibPrivate; class QGuiEventDispatcherGlib : public QEventDispatcherGlib { Q_OBJECT - Q_DECLARE_PRIVATE(QGuiEventDispatcherGlib) + Q_DECLARE_SCOPED_PRIVATE(QGuiEventDispatcherGlib) public: explicit QGuiEventDispatcherGlib(QObject *parent = 0); diff --git a/src/gui/kernel/qkeymapper_mac.cpp b/src/gui/kernel/qkeymapper_mac.cpp index 017c13c..87dad1e 100644 --- a/src/gui/kernel/qkeymapper_mac.cpp +++ b/src/gui/kernel/qkeymapper_mac.cpp @@ -563,7 +563,7 @@ QKeyMapperPrivate::QKeyMapperPrivate() QKeyMapperPrivate::~QKeyMapperPrivate() { - clearMappings(); + deleteLayouts(); } bool @@ -658,7 +658,7 @@ QKeyMapperPrivate::updateKeyboard() } void -QKeyMapperPrivate::clearMappings() +QKeyMapperPrivate::deleteLayouts() { keyboard_mode = NullMode; for (int i = 0; i < 255; ++i) { @@ -667,6 +667,12 @@ QKeyMapperPrivate::clearMappings() keyLayout[i] = 0; } } +} + +void +QKeyMapperPrivate::clearMappings() +{ + deleteLayouts(); updateKeyboard(); } diff --git a/src/gui/kernel/qkeymapper_p.h b/src/gui/kernel/qkeymapper_p.h index ba1fcfe..6c12b0f 100644 --- a/src/gui/kernel/qkeymapper_p.h +++ b/src/gui/kernel/qkeymapper_p.h @@ -85,7 +85,7 @@ public: private: friend QKeyMapperPrivate *qt_keymapper_private(); - Q_DECLARE_PRIVATE(QKeyMapper) + Q_DECLARE_SCOPED_PRIVATE(QKeyMapper) Q_DISABLE_COPY(QKeyMapper) }; @@ -161,6 +161,7 @@ public: bool translateKeyEvent(QWidget *receiver, const MSG &msg, bool grab); void updatePossibleKeyCodes(unsigned char *kbdBuffer, quint32 scancode, quint32 vk_key); bool isADeadKey(unsigned int vk_key, unsigned int modifiers); + void deleteLayouts(); KeyboardLayoutItem *keyLayout[256]; @@ -189,6 +190,7 @@ public: bool updateKeyboard(); void updateKeyMap(EventHandlerCallRef, EventRef, void *); bool translateKeyEvent(QWidget *, EventHandlerCallRef, EventRef, void *, bool); + void deleteLayouts(); enum { NullMode, UnicodeMode, OtherMode } keyboard_mode; union { diff --git a/src/gui/kernel/qkeymapper_win.cpp b/src/gui/kernel/qkeymapper_win.cpp index e40dfa0..d1b3456 100644 --- a/src/gui/kernel/qkeymapper_win.cpp +++ b/src/gui/kernel/qkeymapper_win.cpp @@ -621,10 +621,10 @@ QKeyMapperPrivate::QKeyMapperPrivate() QKeyMapperPrivate::~QKeyMapperPrivate() { - clearMappings(); + deleteLayouts(); } -void QKeyMapperPrivate::clearMappings() +void QKeyMapperPrivate::deleteLayouts() { for (int i = 0; i < 255; ++i) { if (keyLayout[i]) { @@ -632,6 +632,11 @@ void QKeyMapperPrivate::clearMappings() keyLayout[i] = 0; } } +} + +void QKeyMapperPrivate::clearMappings() +{ + deleteLayouts(); /* MAKELCID()'s first argument is a WORD, and GetKeyboardLayout() * returns a DWORD. */ diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index 6563dae..e2a5b27 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -753,7 +753,9 @@ QKeySequence::QKeySequence(StandardKey key) */ QKeySequence::QKeySequence() { - d = new QKeySequencePrivate(); + static QKeySequencePrivate shared_empty; + d = &shared_empty; + d->ref.ref(); } /*! diff --git a/src/gui/kernel/qlayout.h b/src/gui/kernel/qlayout.h index 4f46c1d..ec95ca8 100644 --- a/src/gui/kernel/qlayout.h +++ b/src/gui/kernel/qlayout.h @@ -89,7 +89,7 @@ class QLayoutPrivate; class Q_GUI_EXPORT QLayout : public QObject, public QLayoutItem { Q_OBJECT - Q_DECLARE_PRIVATE(QLayout) + Q_DECLARE_SCOPED_PRIVATE(QLayout) Q_ENUMS(SizeConstraint) Q_PROPERTY(int margin READ margin WRITE setMargin) diff --git a/src/gui/kernel/qsessionmanager.h b/src/gui/kernel/qsessionmanager.h index f27dbaa..0a55d0c 100644 --- a/src/gui/kernel/qsessionmanager.h +++ b/src/gui/kernel/qsessionmanager.h @@ -60,7 +60,7 @@ class QSessionManagerPrivate; class Q_GUI_EXPORT QSessionManager : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QSessionManager) + Q_DECLARE_SCOPED_PRIVATE(QSessionManager) QSessionManager(QApplication *app, QString &id, QString &key); ~QSessionManager(); public: diff --git a/src/gui/kernel/qshortcut.h b/src/gui/kernel/qshortcut.h index c81ce7c..7b79faa 100644 --- a/src/gui/kernel/qshortcut.h +++ b/src/gui/kernel/qshortcut.h @@ -57,7 +57,7 @@ class QShortcutPrivate; class Q_GUI_EXPORT QShortcut : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QShortcut) + Q_DECLARE_SCOPED_PRIVATE(QShortcut) Q_PROPERTY(QKeySequence key READ key WRITE setKey) Q_PROPERTY(QString whatsThis READ whatsThis WRITE setWhatsThis) Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled) diff --git a/src/gui/kernel/qshortcutmap_p.h b/src/gui/kernel/qshortcutmap_p.h index 8962ac7..53a39ec 100644 --- a/src/gui/kernel/qshortcutmap_p.h +++ b/src/gui/kernel/qshortcutmap_p.h @@ -74,7 +74,7 @@ class QObject; class QShortcutMap { - Q_DECLARE_PRIVATE(QShortcutMap) + Q_DECLARE_SCOPED_PRIVATE(QShortcutMap) public: QShortcutMap(); ~QShortcutMap(); diff --git a/src/gui/kernel/qsound.h b/src/gui/kernel/qsound.h index 22cfdde..eeef047 100644 --- a/src/gui/kernel/qsound.h +++ b/src/gui/kernel/qsound.h @@ -82,7 +82,7 @@ public: static inline QT3_SUPPORT bool available() { return isAvailable(); } #endif private: - Q_DECLARE_PRIVATE(QSound) + Q_DECLARE_SCOPED_PRIVATE(QSound) friend class QAuServer; }; diff --git a/src/gui/kernel/qstackedlayout.h b/src/gui/kernel/qstackedlayout.h index d14b2ab..ab215fa 100644 --- a/src/gui/kernel/qstackedlayout.h +++ b/src/gui/kernel/qstackedlayout.h @@ -55,7 +55,7 @@ class QStackedLayoutPrivate; class Q_GUI_EXPORT QStackedLayout : public QLayout { Q_OBJECT - Q_DECLARE_PRIVATE(QStackedLayout) + Q_DECLARE_SCOPED_PRIVATE(QStackedLayout) Q_ENUMS(StackingMode) Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentChanged) Q_PROPERTY(StackingMode stackingMode READ stackingMode WRITE setStackingMode) diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index bcbe48f..802a2f7 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -80,11 +80,6 @@ QT_BEGIN_NAMESPACE // system evens seems to start with 0x10 const TInt KInternalStatusPaneChange = 0x50000000; -struct QS60Data; -extern QS60Data *qt_s60Data; - -#define S60 qt_s60Data - class QS60Data { public: @@ -114,6 +109,9 @@ public: #endif }; +QS60Data* qGlobalS60Data(); +#define S60 qGlobalS60Data() + class QAbstractLongTapObserver { public: @@ -241,7 +239,7 @@ inline CEikButtonGroupContainer* QS60Data::buttonGroupContainer() static inline QFont qt_TFontSpec2QFontL(const TFontSpec &fontSpec) { return QFont( - qt_TDesC2QStringL(fontSpec.iTypeface.iName), + qt_TDesC2QString(fontSpec.iTypeface.iName), fontSpec.iHeight / KTwipsPerPoint, fontSpec.iFontStyle.StrokeWeight() == EStrokeWeightNormal ? QFont::Normal : QFont::Bold, fontSpec.iFontStyle.Posture() == EPostureItalic diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 4c2fe9d..bfcb02b 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -922,8 +922,8 @@ void QWidget::setAutoFillBackground(bool enabled) */ -QWidgetMapper *QWidgetPrivate::mapper = 0; // widget with wid -QWidgetSet *QWidgetPrivate::uncreatedWidgets = 0; // widgets with no wid +QWidgetMapper *QWidgetPrivate::mapper = 0; // widget with wid +QWidgetSet *QWidgetPrivate::allWidgets = 0; // widgets with no wid /***************************************************************************** @@ -969,7 +969,7 @@ struct QWidgetExceptionCleaner static inline void cleanup(QWidget *that, QWidgetPrivate *d) { #ifndef QT_NO_EXCEPTIONS - QWidgetPrivate::uncreatedWidgets->remove(that); + QWidgetPrivate::allWidgets->remove(that); if (d->focus_next != that) { if (d->focus_next) d->focus_next->d_func()->focus_prev = d->focus_prev; @@ -1121,8 +1121,8 @@ void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f) if (QApplication::type() == QApplication::Tty) qFatal("QWidget: Cannot create a QWidget when no GUI is being used"); - Q_ASSERT(uncreatedWidgets); - uncreatedWidgets->insert(q); + Q_ASSERT(allWidgets); + allWidgets->insert(q); QWidget *desktopWidget = 0; if (parentWidget && parentWidget->windowType() == Qt::Desktop) { @@ -1415,15 +1415,31 @@ QWidget::~QWidget() } #endif - clearFocus(); + QT_TRY { + clearFocus(); + } QT_CATCH(...) { + // swallow this problem because we are in a destructor + } d->setDirtyOpaqueRegion(); - if (isWindow() && isVisible() && internalWinId()) - d->close_helper(QWidgetPrivate::CloseNoEvent); + if (isWindow() && isVisible() && internalWinId()) { + QT_TRY { + d->close_helper(QWidgetPrivate::CloseNoEvent); + } QT_CATCH(...) { + // if we're out of memory, at least hide the window. + QT_TRY { + hide(); + } QT_CATCH(...) { + // and if that also doesn't work, then give up + } + } + } + #if defined(Q_WS_WIN) || defined(Q_WS_X11) - else if (!internalWinId() && isVisible()) + else if (!internalWinId() && isVisible()) { qApp->d_func()->sendSyntheticEnterLeave(this); + } #endif if (QWidgetBackingStore *bs = d->maybeBackingStore()) { @@ -1443,12 +1459,15 @@ QWidget::~QWidget() QApplication::removePostedEvents(this); - destroy(); // platform-dependent cleanup - + QT_TRY { + destroy(); // platform-dependent cleanup + } QT_CATCH(...) { + // if this fails we can't do anything about it but at least we are not allowed to throw. + } --QWidgetPrivate::instanceCounter; - if (QWidgetPrivate::uncreatedWidgets) // might have been deleted by ~QApplication - QWidgetPrivate::uncreatedWidgets->remove(this); + if (QWidgetPrivate::allWidgets) // might have been deleted by ~QApplication + QWidgetPrivate::allWidgets->remove(this); QEvent e(QEvent::Destroy); QCoreApplication::sendEvent(this, &e); @@ -1468,7 +1487,6 @@ void QWidgetPrivate::setWinId(WId id) // set widget identifier bool userDesktopWidget = qt_desktopWidget != 0 && qt_desktopWidget != q && q->windowType() == Qt::Desktop; if (mapper && data.winid && !userDesktopWidget) { mapper->remove(data.winid); - uncreatedWidgets->insert(q); } data.winid = id; @@ -1477,7 +1495,6 @@ void QWidgetPrivate::setWinId(WId id) // set widget identifier #endif if (mapper && id && !userDesktopWidget) { mapper->insert(data.winid, q); - uncreatedWidgets->remove(q); } } @@ -4645,8 +4662,9 @@ void QWidget::setCursor(const QCursor &cursor) #endif { d->createExtra(); + QCursor *newCursor = new QCursor(cursor); delete d->extra->curs; - d->extra->curs = new QCursor(cursor); + d->extra->curs = newCursor; } setAttribute(Qt::WA_SetCursor); d->setCursor_sys(cursor); @@ -5359,6 +5377,17 @@ QString QWidget::windowTitle() const return QString(); } +/*! + Returns a modified window title with the [*] place holder + replaced according to the rules described in QWidget::setWindowTitle + + This function assumes that "[*]" can be quoted by another + "[*]", so it will replace two place holders by one and + a single last one by either "*" or nothing depending on + the modified flag. + + \internal +*/ QString qt_setWindowTitle_helperHelper(const QString &title, const QWidget *widget) { Q_ASSERT(widget); @@ -5370,16 +5399,21 @@ QString qt_setWindowTitle_helperHelper(const QString &title, const QWidget *widg QString cap = title; #endif - QString placeHolder(QLatin1String("[*]")); + if (cap.isEmpty()) + return cap; + + QLatin1String placeHolder("[*]"); + int placeHolderLength = 3; // QLatin1String doesn't have length() int index = cap.indexOf(placeHolder); + // here the magic begins while (index != -1) { - index += placeHolder.length(); + index += placeHolderLength; int count = 1; while (cap.indexOf(placeHolder, index) == index) { ++count; - index += placeHolder.length(); + index += placeHolderLength; } if (count%2) { // odd number of [*] -> replace last one @@ -5394,7 +5428,7 @@ QString qt_setWindowTitle_helperHelper(const QString &title, const QWidget *widg index = cap.indexOf(placeHolder, index); } - cap.replace(QLatin1String("[*][*]"), QLatin1String("[*]")); + cap.replace(QLatin1String("[*][*]"), placeHolder); return cap; } diff --git a/src/gui/kernel/qwidget.h b/src/gui/kernel/qwidget.h index 2008723..51605ba 100644 --- a/src/gui/kernel/qwidget.h +++ b/src/gui/kernel/qwidget.h @@ -143,7 +143,7 @@ class QWidgetPrivate; class Q_GUI_EXPORT QWidget : public QObject, public QPaintDevice { Q_OBJECT - Q_DECLARE_PRIVATE(QWidget) + Q_DECLARE_SCOPED_PRIVATE(QWidget) Q_PROPERTY(bool modal READ isModal) Q_PROPERTY(Qt::WindowModality windowModality READ windowModality WRITE setWindowModality) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 045bcb3..4797ddf 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -2575,7 +2575,11 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows) qt_mac_destructWindow(window); } } - d->setWinId(0); + QT_TRY { + d->setWinId(0); + } QT_CATCH (const std::bad_alloc &) { + // swallow - destructors must not throw + } } } diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index 84a15ed..b425450 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -490,10 +490,11 @@ public: QWidgetItemV2 *widgetItem; QPaintEngine *extraPaintEngine; mutable const QMetaObject *polished; - // All widgets are initially added into the uncreatedWidgets set. Once - // they receive a window id they are removed and added to the mapper + // All widgets are added into the allWidgets set. Once + // they receive a window id they are also added to the mapper. + // This should just ensure that all widgets are deleted by QApplication static QWidgetMapper *mapper; - static QWidgetSet *uncreatedWidgets; + static QWidgetSet *allWidgets; #if !defined(QT_NO_IM) QPointer ic; Qt::InputMethodHints imHints; diff --git a/src/gui/kernel/qwidget_qws.cpp b/src/gui/kernel/qwidget_qws.cpp index 4ded5cf..eacf656 100644 --- a/src/gui/kernel/qwidget_qws.cpp +++ b/src/gui/kernel/qwidget_qws.cpp @@ -298,11 +298,16 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows) d->hide_sys(); } if (destroyWindow && isWindow()) { - d->extra->topextra->backingStore->windowSurface->setGeometry(QRect()); + if (d->extra && d->extra->topextra && d->extra->topextra->backingStore) + d->extra->topextra->backingStore->windowSurface->setGeometry(QRect()); qwsDisplay()->destroyRegion(internalWinId()); } } - d->setWinId(0); + QT_TRY { + d->setWinId(0); + } QT_CATCH (const std::bad_alloc &) { + // swallow - destructors must not throw + } } } diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index d860eba..bf53f5d 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -89,7 +89,7 @@ void QWidgetPrivate::setSoftKeys_sys(const QList &softkeys) return; } CEikButtonGroupContainer* nativeContainer = S60->buttonGroupContainer(); - nativeContainer->SetCommandSetL(R_AVKON_SOFTKEYS_EMPTY_WITH_IDS); + QT_TRAP_THROWING(nativeContainer->SetCommandSetL(R_AVKON_SOFTKEYS_EMPTY_WITH_IDS)); int position = -1; int command; @@ -137,12 +137,12 @@ void QWidgetPrivate::setSoftKeys_sys(const QList &softkeys) if (position != -1) { TPtrC text = qt_QString2TPtrC(softKeyAction->text()); - nativeContainer->SetCommandL(position, command, text); + QT_TRAP_THROWING(nativeContainer->SetCommandL(position, command, text)); } } if (needsExitButton) - nativeContainer->SetCommandL(2, EAknSoftkeyExit, qt_QString2TPtrC(QObject::tr("Exit"))); + QT_TRAP_THROWING(nativeContainer->SetCommandL(2, EAknSoftkeyExit, qt_QString2TPtrC(QObject::tr("Exit")))); nativeContainer->DrawDeferred(); // 3.1 needs an extra invitation #else @@ -310,10 +310,8 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de } else if (topLevel) { if (!q->testAttribute(Qt::WA_Moved) && !q->testAttribute(Qt::WA_DontShowOnScreen)) data.crect.moveTopLeft(QPoint(clientRect.iTl.iX, clientRect.iTl.iY)); - QSymbianControl *control= new QSymbianControl(q); - control->ConstructL(true,desktop); - - + QSymbianControl *control= q_check_ptr(new QSymbianControl(q)); + QT_TRAP_THROWING(control->ConstructL(true,desktop)); if (!desktop) { TInt stackingFlags; if ((q->windowType() & Qt::Popup) == Qt::Popup) { @@ -350,7 +348,7 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de control->SetRect(TRect(TPoint(x, y), TSize(w, h))); } else if (q->testAttribute(Qt::WA_NativeWindow) || paintOnScreen()) { // create native child widget QSymbianControl *control = new QSymbianControl(q); - control->ConstructL(!parentWidget); + QT_TRAP_THROWING(control->ConstructL(!parentWidget)); TInt stackingFlags; if ((q->windowType() & Qt::Popup) == Qt::Popup) { @@ -362,7 +360,7 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de setWinId(control); WId parentw = parentWidget->effectiveWinId(); - control->SetContainerWindowL(*parentw); + QT_TRAP_THROWING(control->SetContainerWindowL(*parentw)); q->setAttribute(Qt::WA_WState_Created); int x, y, w, h; @@ -397,7 +395,7 @@ void QWidgetPrivate::show_sys() WId id = q->internalWinId(); if (!extra->topextra->activated) { - id->ActivateL(); + QT_TRAP_THROWING(id->ActivateL()); extra->topextra->activated = 1; } id->MakeVisible(true); @@ -621,9 +619,9 @@ void QWidgetPrivate::s60UpdateIsOpaque() } } -CFbsBitmap* qt_pixmapToNativeBitmapL(QPixmap pixmap, bool invert) +CFbsBitmap* qt_pixmapToNativeBitmap(QPixmap pixmap, bool invert) { - CFbsBitmap* fbsBitmap = new(ELeave)CFbsBitmap; + CFbsBitmap* fbsBitmap = q_check_ptr(new CFbsBitmap); // CBase derived object needs check on new TSize size(pixmap.size().width(), pixmap.size().height()); TDisplayMode mode(EColor16MU); @@ -659,7 +657,7 @@ CFbsBitmap* qt_pixmapToNativeBitmapL(QPixmap pixmap, bool invert) break; } - User::LeaveIfError(fbsBitmap->Create(size, mode)); + qt_throwIfError(fbsBitmap->Create(size, mode)); fbsBitmap->LockHeap(); QImage image = pixmap.toImage(); @@ -714,7 +712,7 @@ void QWidgetPrivate::setWindowIcon_sys(bool forceReset) contextPane->SetPicture(nBitmap,nMask); } else { // Icon set to null -> set context pane picture to default - contextPane->SetPictureToDefaultL(); + QT_TRAP_THROWING(contextPane->SetPictureToDefaultL()); } } else { // Context pane does not exist, try setting small icon to title pane @@ -769,7 +767,7 @@ void QWidgetPrivate::setWindowTitle_sys(const QString &caption) if(caption.isEmpty()) titlePane->SetTextToDefaultL(); else - titlePane->SetTextL(qt_QString2TPtrC(caption)); + QT_TRAP_THROWING(titlePane->SetTextL(qt_QString2TPtrC(caption))); } } #else @@ -1125,7 +1123,11 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows) } - d->setWinId(0); + QT_TRY { + d->setWinId(0); + } QT_CATCH (const std::bad_alloc &) { + // swallow - destructors must not throw + } } } diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp index e39ca77..9d31f57 100644 --- a/src/gui/kernel/qwidget_win.cpp +++ b/src/gui/kernel/qwidget_win.cpp @@ -577,7 +577,11 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows) } #endif - d->setWinId(0); + QT_TRY { + d->setWinId(0); + } QT_CATCH (const std::bad_alloc &) { + // swallow - destructors must not throw + } } } diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp index 2a3d2f3..2bb3626 100644 --- a/src/gui/kernel/qwidget_x11.cpp +++ b/src/gui/kernel/qwidget_x11.cpp @@ -1008,7 +1008,11 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows) if (destroyWindow) qt_XDestroyWindow(this, X11->display, data->winid); } - d->setWinId(0); + QT_TRY { + d->setWinId(0); + } QT_CATCH (const std::bad_alloc &) { + // swallow - destructors must not throw + } extern void qPRCleanup(QWidget *widget); // from qapplication_x11.cpp if (testAttribute(Qt::WA_WState_Reparented)) diff --git a/src/gui/kernel/qwidgetaction.h b/src/gui/kernel/qwidgetaction.h index 4ec489e..a39b281 100644 --- a/src/gui/kernel/qwidgetaction.h +++ b/src/gui/kernel/qwidgetaction.h @@ -57,7 +57,7 @@ class QWidgetActionPrivate; class Q_GUI_EXPORT QWidgetAction : public QAction { Q_OBJECT - Q_DECLARE_PRIVATE(QWidgetAction) + Q_DECLARE_SCOPED_PRIVATE(QWidgetAction) public: explicit QWidgetAction(QObject *parent); diff --git a/src/gui/kernel/qx11embed_x11.cpp b/src/gui/kernel/qx11embed_x11.cpp index 3ddde1b..84d7d0a 100644 --- a/src/gui/kernel/qx11embed_x11.cpp +++ b/src/gui/kernel/qx11embed_x11.cpp @@ -269,7 +269,7 @@ const int XButtonRelease = ButtonRelease; // need to to inspect window()'s embedded state. class QHackWidget : public QWidget { - Q_DECLARE_PRIVATE(QWidget) + Q_DECLARE_SCOPED_PRIVATE(QWidget) public: QTLWExtra* topData() { return d_func()->topData(); } }; diff --git a/src/gui/kernel/qx11embed_x11.h b/src/gui/kernel/qx11embed_x11.h index 8659ed6..0d67c23 100644 --- a/src/gui/kernel/qx11embed_x11.h +++ b/src/gui/kernel/qx11embed_x11.h @@ -80,7 +80,7 @@ protected: void resizeEvent(QResizeEvent *); private: - Q_DECLARE_PRIVATE(QX11EmbedWidget) + Q_DECLARE_SCOPED_PRIVATE(QX11EmbedWidget) Q_DISABLE_COPY(QX11EmbedWidget) }; @@ -121,7 +121,7 @@ protected: bool event(QEvent *); private: - Q_DECLARE_PRIVATE(QX11EmbedContainer) + Q_DECLARE_SCOPED_PRIVATE(QX11EmbedContainer) Q_DISABLE_COPY(QX11EmbedContainer) }; diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp index 519e02e..97cbecc 100644 --- a/src/gui/painting/qbrush.cpp +++ b/src/gui/painting/qbrush.cpp @@ -230,7 +230,7 @@ struct QGradientBrushData : public QBrushData QGradient gradient; }; -struct QBrushDataPointerHandler +struct QBrushDataPointerDeleter { static inline void deleteData(QBrushData *d) { @@ -254,12 +254,6 @@ struct QBrushDataPointerHandler deleteData(d); } } - - static inline void reset(QBrushData *&d, QBrushData *other) - { - cleanup(d); - d = other; - } }; /*! @@ -580,7 +574,7 @@ QBrush::~QBrush() void QBrush::cleanUp(QBrushData *x) { - QBrushDataPointerHandler::deleteData(x); + QBrushDataPointerDeleter::deleteData(x); } diff --git a/src/gui/painting/qbrush.h b/src/gui/painting/qbrush.h index 5479305..69adee2 100644 --- a/src/gui/painting/qbrush.h +++ b/src/gui/painting/qbrush.h @@ -62,7 +62,7 @@ struct QBrushData; class QPixmap; class QGradient; class QVariant; -struct QBrushDataPointerHandler; +struct QBrushDataPointerDeleter; class Q_GUI_EXPORT QBrush { @@ -128,7 +128,7 @@ private: friend bool Q_GUI_EXPORT qHasPixmapTexture(const QBrush& brush); void detach(Qt::BrushStyle newStyle); void init(const QColor &color, Qt::BrushStyle bs); - QScopedCustomPointer d; + QCustomScopedPointer d; void cleanUp(QBrushData *x); public: diff --git a/src/gui/painting/qgrayraster.c b/src/gui/painting/qgrayraster.c index 888fd9a..f908d48 100644 --- a/src/gui/painting/qgrayraster.c +++ b/src/gui/painting/qgrayraster.c @@ -1880,6 +1880,10 @@ if (memory) fprintf(stderr, "gray_raster_new(), memory ignored"); memory = malloc(sizeof(TRaster)); + if (!memory) { + *araster = 0; + return ErrRaster_Memory_Overflow; + } QT_FT_MEM_ZERO(memory, sizeof(TRaster)); *araster = (QT_FT_Raster) memory; diff --git a/src/gui/painting/qpaintengine.h b/src/gui/painting/qpaintengine.h index 92aa506..6460afa 100644 --- a/src/gui/painting/qpaintengine.h +++ b/src/gui/painting/qpaintengine.h @@ -89,7 +89,7 @@ Q_DECLARE_TYPEINFO(QTextItem, Q_PRIMITIVE_TYPE); class Q_GUI_EXPORT QPaintEngine { - Q_DECLARE_PRIVATE(QPaintEngine) + Q_DECLARE_SCOPED_PRIVATE(QPaintEngine) public: enum PaintEngineFeature { PrimitiveTransform = 0x00000001, // Can transform primitives brushes diff --git a/src/gui/painting/qpaintengine_alpha_p.h b/src/gui/painting/qpaintengine_alpha_p.h index 7f45ad6..1a0b1ac 100644 --- a/src/gui/painting/qpaintengine_alpha_p.h +++ b/src/gui/painting/qpaintengine_alpha_p.h @@ -62,7 +62,7 @@ class QAlphaPaintEnginePrivate; class QAlphaPaintEngine : public QPaintEngine { - Q_DECLARE_PRIVATE(QAlphaPaintEngine) + Q_DECLARE_SCOPED_PRIVATE(QAlphaPaintEngine) public: ~QAlphaPaintEngine(); diff --git a/src/gui/painting/qpaintengine_mac_p.h b/src/gui/painting/qpaintengine_mac_p.h index 755b7b1..58150d0 100644 --- a/src/gui/painting/qpaintengine_mac_p.h +++ b/src/gui/painting/qpaintengine_mac_p.h @@ -174,7 +174,7 @@ public: class QCoreGraphicsPaintEnginePrivate; class QCoreGraphicsPaintEngine : public QPaintEngine { - Q_DECLARE_PRIVATE(QCoreGraphicsPaintEngine) + Q_DECLARE_SCOPED_PRIVATE(QCoreGraphicsPaintEngine) public: QCoreGraphicsPaintEngine(); diff --git a/src/gui/painting/qpaintengine_preview_p.h b/src/gui/painting/qpaintengine_preview_p.h index 9f96d40..d8e2b08 100644 --- a/src/gui/painting/qpaintengine_preview_p.h +++ b/src/gui/painting/qpaintengine_preview_p.h @@ -65,7 +65,7 @@ class QPreviewPaintEnginePrivate; class QPreviewPaintEngine : public QPaintEngine, public QPrintEngine { - Q_DECLARE_PRIVATE(QPreviewPaintEngine) + Q_DECLARE_SCOPED_PRIVATE(QPreviewPaintEngine) public: QPreviewPaintEngine(); ~QPreviewPaintEngine(); diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index c5e342c..ead3355 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -351,30 +351,33 @@ void QRasterPaintEngine::init() Q_CHECK_PTR(d->rasterPoolBase); // The antialiasing raster. - d->grayRaster = new QT_FT_Raster; - qt_ft_grays_raster.raster_new(0, d->grayRaster); - qt_ft_grays_raster.raster_reset(*d->grayRaster, d->rasterPoolBase, d->rasterPoolSize); + d->grayRaster.reset(new QT_FT_Raster); + Q_CHECK_PTR(d->grayRaster.data()); + if (qt_ft_grays_raster.raster_new(0, d->grayRaster.data())) + QT_THROW(std::bad_alloc()); // an error creating the raster is caused by a bad malloc - d->rasterizer = new QRasterizer; - d->rasterBuffer = new QRasterBuffer(); - d->outlineMapper = new QOutlineMapper; + + qt_ft_grays_raster.raster_reset(*d->grayRaster.data(), d->rasterPoolBase, d->rasterPoolSize); + + d->rasterizer.reset(new QRasterizer); + d->rasterBuffer.reset(new QRasterBuffer()); + d->outlineMapper.reset(new QOutlineMapper); d->outlinemapper_xform_dirty = true; d->basicStroker.setMoveToHook(qt_ft_outline_move_to); d->basicStroker.setLineToHook(qt_ft_outline_line_to); d->basicStroker.setCubicToHook(qt_ft_outline_cubic_to); - d->dashStroker = 0; - d->baseClip = new QClipData(d->device->height()); + d->baseClip.reset(new QClipData(d->device->height())); d->baseClip->setClipRect(QRect(0, 0, d->device->width(), d->device->height())); - d->image_filler.init(d->rasterBuffer, this); + d->image_filler.init(d->rasterBuffer.data(), this); d->image_filler.type = QSpanData::Texture; - d->image_filler_xform.init(d->rasterBuffer, this); + d->image_filler_xform.init(d->rasterBuffer.data(), this); d->image_filler_xform.type = QSpanData::Texture; - d->solid_color_filler.init(d->rasterBuffer, this); + d->solid_color_filler.init(d->rasterBuffer.data(), this); d->solid_color_filler.type = QSpanData::Solid; d->deviceDepth = d->device->depth(); @@ -443,15 +446,7 @@ QRasterPaintEngine::~QRasterPaintEngine() free(d->rasterPoolBase); #endif - qt_ft_grays_raster.raster_done(*d->grayRaster); - delete d->grayRaster; - - delete d->rasterBuffer; - delete d->outlineMapper; - delete d->rasterizer; - delete d->dashStroker; - - delete d->baseClip; + qt_ft_grays_raster.raster_done(*d->grayRaster.data()); } /*! @@ -487,12 +482,12 @@ bool QRasterPaintEngine::begin(QPaintDevice *device) d->rasterizer->setClipRect(d->deviceRect); - s->penData.init(d->rasterBuffer, this); + s->penData.init(d->rasterBuffer.data(), this); s->penData.setup(s->pen.brush(), s->intOpacity, s->composition_mode); s->stroker = &d->basicStroker; d->basicStroker.setClipRect(d->deviceRect); - s->brushData.init(d->rasterBuffer, this); + s->brushData.init(d->rasterBuffer.data(), this); s->brushData.setup(s->brush, s->intOpacity, s->composition_mode); d->rasterBuffer->compositionMode = QPainter::CompositionMode_SourceOver; @@ -556,8 +551,7 @@ bool QRasterPaintEngine::end() void QRasterPaintEngine::releaseBuffer() { Q_D(QRasterPaintEngine); - delete d->rasterBuffer; - d->rasterBuffer = new QRasterBuffer; + d->rasterBuffer.reset(new QRasterBuffer); } /*! @@ -801,8 +795,8 @@ void QRasterPaintEngine::updatePen(const QPen &pen) if(pen_style == Qt::SolidLine) { s->stroker = &d->basicStroker; } else if (pen_style != Qt::NoPen) { - if (!d->dashStroker) - d->dashStroker = new QDashStroker(&d->basicStroker); + if (!d->dashStroker.data()) + d->dashStroker.reset(new QDashStroker(&d->basicStroker)); if (pen.isCosmetic()) { d->dashStroker->setClipRect(d->deviceRect); } else { @@ -812,7 +806,7 @@ void QRasterPaintEngine::updatePen(const QPen &pen) } d->dashStroker->setDashPattern(pen.dashPattern()); d->dashStroker->setDashOffset(pen.dashOffset()); - s->stroker = d->dashStroker; + s->stroker = d->dashStroker.data(); } else { s->stroker = 0; } @@ -1245,7 +1239,7 @@ void QRasterPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op) qrasterpaintengine_state_setNoClip(s); } else { - QClipData *base = d->baseClip; + QClipData *base = d->baseClip.data(); // Intersect with current clip when available... if (op == Qt::IntersectClip && s->clip) @@ -1370,7 +1364,7 @@ void QRasterPaintEngine::clip(const QRegion ®ion, Qt::ClipOperation op) QRasterPaintEngineState *s = state(); const QClipData *clip = d->clip(); - const QClipData *baseClip = d->baseClip; + const QClipData *baseClip = d->baseClip.data(); if (op == Qt::NoClip) { qrasterpaintengine_state_setNoClip(s); @@ -1438,7 +1432,7 @@ void QRasterPaintEngine::fillPath(const QPainterPath &path, QSpanData *fillData) } ensureOutlineMapper(); - d->rasterize(d->outlineMapper->convertPath(path), blend, fillData, d->rasterBuffer); + d->rasterize(d->outlineMapper->convertPath(path), blend, fillData, d->rasterBuffer.data()); } static void fillRect_normalized(const QRect &r, QSpanData *data, @@ -1699,7 +1693,7 @@ void QRasterPaintEnginePrivate::strokeProjective(const QPainterPath &path) ? pathStroker.createStroke(s->matrix.map(path)) : s->matrix.map(pathStroker.createStroke(path)); - rasterize(outlineMapper->convertPath(stroke), s->penData.blend, &s->penData, rasterBuffer); + rasterize(outlineMapper->convertPath(stroke), s->penData.blend, &s->penData, rasterBuffer.data()); outlinemapper_xform_dirty = true; } @@ -1875,7 +1869,7 @@ void QRasterPaintEngine::fill(const QVectorPath &path, const QBrush &brush) // } ensureOutlineMapper(); - d->rasterize(d->outlineMapper->convertPath(path), blend, &s->brushData, d->rasterBuffer); + d->rasterize(d->outlineMapper->convertPath(path), blend, &s->brushData, d->rasterBuffer.data()); } void QRasterPaintEngine::fillRect(const QRectF &r, QSpanData *data) @@ -1996,20 +1990,20 @@ void QRasterPaintEngine::drawPath(const QPainterPath &path) d->dashStroker->setClipRect(d->deviceRect); d->basicStroker.setStrokeWidth(strokeWidth * txscale); d->outlineMapper->setMatrix(QTransform()); - s->stroker->strokePath(path, d->outlineMapper, s->matrix); + s->stroker->strokePath(path, d->outlineMapper.data(), s->matrix); d->outlinemapper_xform_dirty = true; d->basicStroker.setStrokeWidth(strokeWidth); - if (d->dashStroker) + if (d->dashStroker.data()) d->dashStroker->setClipRect(clipRect); } else { ensureOutlineMapper(); - s->stroker->strokePath(path, d->outlineMapper, QTransform()); + s->stroker->strokePath(path, d->outlineMapper.data(), QTransform()); } d->outlineMapper->endOutline(); ProcessSpans blend = d->getPenFunc(d->outlineMapper->controlPointRect, &s->penData); - d->rasterize(d->outlineMapper->outline(), blend, &s->penData, d->rasterBuffer); + d->rasterize(d->outlineMapper->outline(), blend, &s->penData, d->rasterBuffer.data()); } } @@ -2103,7 +2097,7 @@ void QRasterPaintEngine::fillPolygon(const QPointF *points, int pointCount, Poly // scanconvert. ProcessSpans brushBlend = d->getBrushFunc(d->outlineMapper->controlPointRect, &s->brushData); - d->rasterize(outline, brushBlend, &s->brushData, d->rasterBuffer); + d->rasterize(outline, brushBlend, &s->brushData, d->rasterBuffer.data()); } /*! @@ -2199,7 +2193,7 @@ void QRasterPaintEngine::drawPolygon(const QPoint *points, int pointCount, Polyg // scanconvert. ProcessSpans brushBlend = d->getBrushFunc(d->outlineMapper->controlPointRect, &s->brushData); - d->rasterize(d->outlineMapper->outline(), brushBlend, &s->brushData, d->rasterBuffer); + d->rasterize(d->outlineMapper->outline(), brushBlend, &s->brushData, d->rasterBuffer.data()); d->outlineMapper->setCoordinateRounding(false); } } @@ -2824,7 +2818,7 @@ void QRasterPaintEngine::alphaPenBlt(const void* src, int bpl, int depth, int rx if (!s->penData.blend) return; - QRasterBuffer *rb = d->rasterBuffer; + QRasterBuffer *rb = d->rasterBuffer.data(); const QRect rect(rx, ry, w, h); const QClipData *clip = d->clip(); @@ -4086,7 +4080,7 @@ void QRasterPaintEnginePrivate::rasterize(QT_FT_Outline *outline, rasterParams.flags |= (QT_FT_RASTER_FLAG_AA | QT_FT_RASTER_FLAG_DIRECT); rasterParams.gray_spans = callback; - error = qt_ft_grays_raster.raster_render(*grayRaster, &rasterParams); + error = qt_ft_grays_raster.raster_render(*grayRaster.data(), &rasterParams); // Out of memory, reallocate some more and try again... if (error == -6) { // -6 is Result_err_OutOfMemory @@ -4113,9 +4107,9 @@ void QRasterPaintEnginePrivate::rasterize(QT_FT_Outline *outline, #endif Q_CHECK_PTR(rasterPoolBase); // note: we just freed the old rasterPoolBase. I hope it's not fatal. - qt_ft_grays_raster.raster_done(*grayRaster); - qt_ft_grays_raster.raster_new(0, grayRaster); - qt_ft_grays_raster.raster_reset(*grayRaster, rasterPoolBase, rasterPoolSize); + qt_ft_grays_raster.raster_done(*grayRaster.data()); + qt_ft_grays_raster.raster_new(0, grayRaster.data()); + qt_ft_grays_raster.raster_reset(*grayRaster.data(), rasterPoolBase, rasterPoolSize); } else { done = true; } @@ -4149,6 +4143,8 @@ QImage QRasterBuffer::colorizeBitmap(const QImage &image, const QColor &color) for (int y=0; y(dest.scanLine(y)); + if (!source || !target) + QT_THROW(std::bad_alloc()); // we must have run out of memory for (int x=0; x < width; ++x) target[x] = (source[x>>3] >> (x&7)) & 1 ? fg : bg; } @@ -4352,7 +4348,7 @@ void QClipData::initialize() Q_CHECK_PTR(m_clipLines); QT_TRY { m_spans = (QSpan *)malloc(clipSpanHeight*sizeof(QSpan)); - allocated = clipSpanHeight; + allocated = clipSpanHeight; Q_CHECK_PTR(m_spans); QT_TRY { @@ -4392,9 +4388,7 @@ void QClipData::initialize() { // resize const int maxSpans = (ymax - ymin) * numRects; if (maxSpans > allocated) { - QSpan *newSpans = (QSpan *)realloc(m_spans, maxSpans * sizeof(QSpan)); - Q_CHECK_PTR(newSpans); - m_spans = newSpans; + m_spans = q_check_ptr((QSpan *)realloc(m_spans, maxSpans * sizeof(QSpan))); allocated = maxSpans; } } @@ -4446,11 +4440,13 @@ void QClipData::initialize() } } QT_CATCH(...) { - free(m_spans); + free(m_spans); // have to free m_spans again or someone might think that we were successfully initialized. + m_spans = 0; QT_RETHROW; } } QT_CATCH(...) { - free(m_clipLines); + free(m_clipLines); // same for clipLines + m_clipLines = 0; QT_RETHROW; } } @@ -4824,9 +4820,7 @@ static void qt_span_clip(int count, const QSpan *spans, void *userData) &newspans, newClip->allocated - newClip->count); newClip->count = newspans - newClip->m_spans; if (spans < end) { - QSpan *newSpan = (QSpan *)realloc(newClip->m_spans, newClip->allocated*2*sizeof(QSpan)); - Q_CHECK_PTR(newSpan); - newClip->m_spans = newSpan; + newClip->m_spans = q_check_ptr((QSpan *)realloc(newClip->m_spans, newClip->allocated*2*sizeof(QSpan))); newClip->allocated *= 2; } } diff --git a/src/gui/painting/qpaintengine_raster_p.h b/src/gui/painting/qpaintengine_raster_p.h index 283c442..e0f4f6d 100644 --- a/src/gui/painting/qpaintengine_raster_p.h +++ b/src/gui/painting/qpaintengine_raster_p.h @@ -134,7 +134,7 @@ Q_GUI_EXPORT #endif QRasterPaintEngine : public QPaintEngineEx { - Q_DECLARE_PRIVATE(QRasterPaintEngine) + Q_DECLARE_SCOPED_PRIVATE(QRasterPaintEngine) public: QRasterPaintEngine(QPaintDevice *device); @@ -333,8 +333,8 @@ public: void recalculateFastImages(); QPaintDevice *device; - QOutlineMapper *outlineMapper; - QRasterBuffer *rasterBuffer; + QScopedPointer outlineMapper; + QScopedPointer rasterBuffer; #if defined (Q_WS_WIN) HDC hdc; @@ -345,9 +345,9 @@ public: QRect deviceRect; QStroker basicStroker; - QDashStroker *dashStroker; + QScopedPointer dashStroker; - QT_FT_Raster *grayRaster; + QScopedPointer grayRaster; unsigned long rasterPoolSize; unsigned char *rasterPoolBase; @@ -359,7 +359,7 @@ public: QFontEngineGlyphCache::Type glyphCacheType; - QClipData *baseClip; + QScopedPointer baseClip; int deviceDepth; @@ -370,7 +370,7 @@ public: uint isPlain45DegreeRotation : 1; #endif - QRasterizer *rasterizer; + QScopedPointer rasterizer; }; @@ -541,7 +541,7 @@ inline const QClipData *QRasterPaintEnginePrivate::clip() const { Q_Q(const QRasterPaintEngine); if (q->state() && q->state()->clip && q->state()->clip->enabled) return q->state()->clip; - return baseClip; + return baseClip.data(); } diff --git a/src/gui/painting/qpaintengine_x11.cpp b/src/gui/painting/qpaintengine_x11.cpp index e3248ea..6ab39da 100644 --- a/src/gui/painting/qpaintengine_x11.cpp +++ b/src/gui/painting/qpaintengine_x11.cpp @@ -271,7 +271,7 @@ void QXRenderTessellator::addTrap(const Trapezoid &trap) { if (size == allocated) { allocated = qMax(2*allocated, 64); - traps = (XTrapezoid *)realloc(traps, allocated * sizeof(XTrapezoid)); + traps = q_check_ptr((XTrapezoid *)realloc(traps, allocated * sizeof(XTrapezoid))); } traps[size].top = Q27Dot5ToXFixed(trap.top); traps[size].bottom = Q27Dot5ToXFixed(trap.bottom); diff --git a/src/gui/painting/qpaintengine_x11_p.h b/src/gui/painting/qpaintengine_x11_p.h index 738a155..2a7894d 100644 --- a/src/gui/painting/qpaintengine_x11_p.h +++ b/src/gui/painting/qpaintengine_x11_p.h @@ -76,7 +76,7 @@ struct qt_float_point class QX11PaintEngine : public QPaintEngine { - Q_DECLARE_PRIVATE(QX11PaintEngine) + Q_DECLARE_SCOPED_PRIVATE(QX11PaintEngine) public: QX11PaintEngine(); ~QX11PaintEngine(); diff --git a/src/gui/painting/qpaintengineex_p.h b/src/gui/painting/qpaintengineex_p.h index 2a50a51..c38716f 100644 --- a/src/gui/painting/qpaintengineex_p.h +++ b/src/gui/painting/qpaintengineex_p.h @@ -143,7 +143,7 @@ class QPixmapFilter; class Q_GUI_EXPORT QPaintEngineEx : public QPaintEngine { - Q_DECLARE_PRIVATE(QPaintEngineEx) + Q_DECLARE_SCOPED_PRIVATE(QPaintEngineEx) public: QPaintEngineEx(); diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 8738f54..5e106fb 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -80,21 +80,6 @@ QT_BEGIN_NAMESPACE bool qt_show_painter_debug_output = true; #endif -class QPainterPrivateCleaner -{ -public: - static inline void cleanup(QPainterPrivate *d) - { - delete d; - } - - static inline void reset(QPainterPrivate *&d, QPainterPrivate *other) - { - delete d; - d = other; - } -}; - extern QPixmap qt_pixmapForBrush(int style, bool invert); void qt_format_text(const QFont &font, @@ -276,9 +261,7 @@ bool QPainterPrivate::attachPainterPrivate(QPainter *q, QPaintDevice *pdev) // However, to support corner cases we grow the array dynamically if needed. sp->d_ptr->d_ptrs_size <<= 1; const int newSize = sp->d_ptr->d_ptrs_size * sizeof(QPainterPrivate *); - QPainterPrivate ** newPointers = (QPainterPrivate **)realloc(sp->d_ptr->d_ptrs, newSize); - Q_CHECK_PTR(newPointers); - sp->d_ptr->d_ptrs = newPointers; + sp->d_ptr->d_ptrs = q_check_ptr((QPainterPrivate **)realloc(sp->d_ptr->d_ptrs, newSize)); } sp->d_ptr->d_ptrs[++sp->d_ptr->refcount - 2] = q->d_ptr.data(); q->d_ptr.data_ptr() = sp->d_ptr.data(); diff --git a/src/gui/painting/qpainter.h b/src/gui/painting/qpainter.h index c81f5d4..227c6f5 100644 --- a/src/gui/painting/qpainter.h +++ b/src/gui/painting/qpainter.h @@ -79,11 +79,11 @@ class QTextItem; class QMatrix; class QTransform; -class QPainterPrivateCleaner; +class QPainterPrivateDeleter; class Q_GUI_EXPORT QPainter { - Q_DECLARE_PRIVATE(QPainter) + Q_DECLARE_SCOPED_PRIVATE(QPainter) Q_GADGET Q_FLAGS(RenderHint RenderHints) @@ -500,7 +500,7 @@ private: Q_DISABLE_COPY(QPainter) friend class Q3Painter; - QScopedCustomPointer d_ptr; + QCustomScopedPointer d_ptr; friend class QFontEngine; friend class QFontEngineBox; diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp index ec8a46c..713cb14 100644 --- a/src/gui/painting/qpainterpath.cpp +++ b/src/gui/painting/qpainterpath.cpp @@ -73,7 +73,7 @@ QT_BEGIN_NAMESPACE -struct QPainterPathPrivateHandler +struct QPainterPathPrivateDeleter { static inline void cleanup(QPainterPathPrivate *d) { @@ -82,13 +82,6 @@ struct QPainterPathPrivateHandler if (d && !d->ref.deref()) delete static_cast(d); } - - static inline void reset(QPainterPathPrivate *&d, QPainterPathPrivate *other) - { - QPainterPathPrivate *oldD = d; - d = other; - cleanup(oldD); - } }; // This value is used to determine the length of control point vectors diff --git a/src/gui/painting/qpainterpath.h b/src/gui/painting/qpainterpath.h index 5068739..ef92397 100644 --- a/src/gui/painting/qpainterpath.h +++ b/src/gui/painting/qpainterpath.h @@ -57,7 +57,7 @@ QT_MODULE(Gui) class QFont; class QPainterPathPrivate; -struct QPainterPathPrivateHandler; +struct QPainterPathPrivateDeleter; class QPainterPathData; class QPainterPathStrokerPrivate; class QPolygonF; @@ -203,7 +203,7 @@ public: QPainterPath &operator-=(const QPainterPath &other); private: - QScopedCustomPointer d_ptr; + QScopedPointer d_ptr; inline void ensureData() { if (!d_ptr) ensureData_helper(); } void ensureData_helper(); @@ -237,7 +237,7 @@ public: friend class QPainterPathStrokerPrivate; friend class QMatrix; friend class QTransform; - friend struct QPainterPathPrivateHandler; + friend struct QPainterPathPrivateDeleter; #ifndef QT_NO_DATASTREAM friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QPainterPath &); friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPainterPath &); @@ -256,7 +256,7 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPainterPath &); class Q_GUI_EXPORT QPainterPathStroker { - Q_DECLARE_PRIVATE(QPainterPathStroker) + Q_DECLARE_SCOPED_PRIVATE(QPainterPathStroker) public: QPainterPathStroker(); ~QPainterPathStroker(); diff --git a/src/gui/painting/qpdf_p.h b/src/gui/painting/qpdf_p.h index 0e023d6..26f5bd7 100644 --- a/src/gui/painting/qpdf_p.h +++ b/src/gui/painting/qpdf_p.h @@ -183,7 +183,7 @@ class QPdfBaseEnginePrivate; class QPdfBaseEngine : public QAlphaPaintEngine, public QPrintEngine { - Q_DECLARE_PRIVATE(QPdfBaseEngine) + Q_DECLARE_SCOPED_PRIVATE(QPdfBaseEngine) public: QPdfBaseEngine(QPdfBaseEnginePrivate &d, PaintEngineFeatures f); ~QPdfBaseEngine() {} diff --git a/src/gui/painting/qprintengine_mac_p.h b/src/gui/painting/qprintengine_mac_p.h index 23e99cd..1fdb172 100644 --- a/src/gui/painting/qprintengine_mac_p.h +++ b/src/gui/painting/qprintengine_mac_p.h @@ -72,7 +72,7 @@ class QPrinterPrivate; class QMacPrintEnginePrivate; class QMacPrintEngine : public QPaintEngine, public QPrintEngine { - Q_DECLARE_PRIVATE(QMacPrintEngine) + Q_DECLARE_SCOPED_PRIVATE(QMacPrintEngine) public: QMacPrintEngine(QPrinter::PrinterMode mode); diff --git a/src/gui/painting/qprintengine_pdf_p.h b/src/gui/painting/qprintengine_pdf_p.h index 6f884a9..e130ada 100644 --- a/src/gui/painting/qprintengine_pdf_p.h +++ b/src/gui/painting/qprintengine_pdf_p.h @@ -84,7 +84,7 @@ class QPdfEnginePrivate; class QPdfEngine : public QPdfBaseEngine { - Q_DECLARE_PRIVATE(QPdfEngine) + Q_DECLARE_SCOPED_PRIVATE(QPdfEngine) public: QPdfEngine(QPrinter::PrinterMode m); virtual ~QPdfEngine(); diff --git a/src/gui/painting/qprintengine_ps_p.h b/src/gui/painting/qprintengine_ps_p.h index 986be38a..4b8034e 100644 --- a/src/gui/painting/qprintengine_ps_p.h +++ b/src/gui/painting/qprintengine_ps_p.h @@ -70,7 +70,7 @@ class QPSPrintEnginePrivate; class QPSPrintEngine : public QPdfBaseEngine { - Q_DECLARE_PRIVATE(QPSPrintEngine) + Q_DECLARE_SCOPED_PRIVATE(QPSPrintEngine) public: // QPrinter uses these explicit QPSPrintEngine(QPrinter::PrinterMode m); diff --git a/src/gui/painting/qprintengine_qws_p.h b/src/gui/painting/qprintengine_qws_p.h index 41cf935..5e552fe 100644 --- a/src/gui/painting/qprintengine_qws_p.h +++ b/src/gui/painting/qprintengine_qws_p.h @@ -70,7 +70,7 @@ class QImage; class QtopiaPrintEngine : public QPaintEngine, public QPrintEngine { - Q_DECLARE_PRIVATE(QtopiaPrintEngine) + Q_DECLARE_SCOPED_PRIVATE(QtopiaPrintEngine) public: QtopiaPrintEngine(QPrinter::PrinterMode mode); diff --git a/src/gui/painting/qprintengine_win_p.h b/src/gui/painting/qprintengine_win_p.h index 9eb0b69..4438ce7 100644 --- a/src/gui/painting/qprintengine_win_p.h +++ b/src/gui/painting/qprintengine_win_p.h @@ -69,7 +69,7 @@ class QPainterState; class QWin32PrintEngine : public QAlphaPaintEngine, public QPrintEngine { - Q_DECLARE_PRIVATE(QWin32PrintEngine) + Q_DECLARE_SCOPED_PRIVATE(QWin32PrintEngine) public: QWin32PrintEngine(QPrinter::PrinterMode mode); diff --git a/src/gui/painting/qprinter.h b/src/gui/painting/qprinter.h index 25c2f0c..842845b 100644 --- a/src/gui/painting/qprinter.h +++ b/src/gui/painting/qprinter.h @@ -65,7 +65,7 @@ class QPrinterInfo; class Q_GUI_EXPORT QPrinter : public QPaintDevice { - Q_DECLARE_PRIVATE(QPrinter) + Q_DECLARE_SCOPED_PRIVATE(QPrinter) public: enum PrinterMode { ScreenResolution, PrinterResolution, HighResolution }; diff --git a/src/gui/painting/qprinterinfo.h b/src/gui/painting/qprinterinfo.h index c34e591..5c0a25f 100644 --- a/src/gui/painting/qprinterinfo.h +++ b/src/gui/painting/qprinterinfo.h @@ -53,10 +53,10 @@ QT_MODULE(Gui) #ifndef QT_NO_PRINTER class QPrinterInfoPrivate; -class QPrinterInfoPrivateCleanup; +class QPrinterInfoPrivateDeleter; class Q_GUI_EXPORT QPrinterInfo { -Q_DECLARE_PRIVATE(QPrinterInfo) +Q_DECLARE_SCOPED_PRIVATE(QPrinterInfo) public: QPrinterInfo(); @@ -77,7 +77,7 @@ public: private: QPrinterInfo(const QString& name); - QScopedCustomPointer d_ptr; + QScopedPointer d_ptr; }; #endif // QT_NO_PRINTER diff --git a/src/gui/painting/qprinterinfo_mac.cpp b/src/gui/painting/qprinterinfo_mac.cpp index 6932015..66455d9 100644 --- a/src/gui/painting/qprinterinfo_mac.cpp +++ b/src/gui/painting/qprinterinfo_mac.cpp @@ -65,7 +65,7 @@ private: static QPrinterInfoPrivate nullQPrinterInfoPrivate; -class QPrinterInfoPrivateCleanup +class QPrinterInfoPrivateDeleter { public: static inline void cleanup(QPrinterInfoPrivate *d) @@ -73,12 +73,6 @@ public: if (d != &nullQPrinterInfoPrivate) delete d; } - - static inline void reset(QPrinterInfoPrivate *&d, QPrinterInfoPrivate *other) - { - cleanup(d); - d = other; - } }; extern QPrinter::PaperSize qSizeFTopaperSize(const QSizeF& size); diff --git a/src/gui/painting/qprinterinfo_unix.cpp b/src/gui/painting/qprinterinfo_unix.cpp index b9f1f3b..11f94dc 100644 --- a/src/gui/painting/qprinterinfo_unix.cpp +++ b/src/gui/painting/qprinterinfo_unix.cpp @@ -82,7 +82,7 @@ private: static QPrinterInfoPrivate nullQPrinterInfoPrivate; -class QPrinterInfoPrivateCleanup +class QPrinterInfoPrivateDeleter { public: static inline void cleanup(QPrinterInfoPrivate *d) @@ -90,12 +90,6 @@ public: if (d != &nullQPrinterInfoPrivate) delete d; } - - static inline void reset(QPrinterInfoPrivate *&d, QPrinterInfoPrivate *other) - { - cleanup(d); - d = other; - } }; ///////////////////////////////////////////////////////////////////////////// diff --git a/src/gui/painting/qprinterinfo_win.cpp b/src/gui/painting/qprinterinfo_win.cpp index e047f5d..3f2c510 100644 --- a/src/gui/painting/qprinterinfo_win.cpp +++ b/src/gui/painting/qprinterinfo_win.cpp @@ -69,7 +69,7 @@ private: static QPrinterInfoPrivate nullQPrinterInfoPrivate; -class QPrinterInfoPrivateCleanup +class QPrinterInfoPrivateDeleter { public: static inline void cleanup(QPrinterInfoPrivate *d) @@ -77,12 +77,6 @@ public: if (d != &nullQPrinterInfoPrivate) delete d; } - - static inline void reset(QPrinterInfoPrivate *&d, QPrinterInfoPrivate *other) - { - cleanup(d); - d = other; - } }; ///////////////////////////////////////////////////////////////////////////// diff --git a/src/gui/painting/qrasterizer.cpp b/src/gui/painting/qrasterizer.cpp index 6d15271..346b31d 100644 --- a/src/gui/painting/qrasterizer.cpp +++ b/src/gui/painting/qrasterizer.cpp @@ -437,10 +437,8 @@ inline void QScanConverter::allocate(int size) { if (m_alloc < size) { int newAlloc = qMax(size, 2 * m_alloc); - Intersection *newIntersections = (Intersection *)realloc(m_intersections, newAlloc * sizeof(Intersection)); - Q_CHECK_PTR(newIntersections); + m_intersections = q_check_ptr((Intersection *)realloc(m_intersections, newAlloc * sizeof(Intersection))); m_alloc = newAlloc; - m_intersections = newIntersections; } } diff --git a/src/gui/painting/qtessellator.cpp b/src/gui/painting/qtessellator.cpp index 711f997..6c16772 100644 --- a/src/gui/painting/qtessellator.cpp +++ b/src/gui/painting/qtessellator.cpp @@ -406,9 +406,9 @@ void QTessellatorPrivate::Scanline::init(int maxActiveEdges) if (!edges || maxActiveEdges > default_alloc) { max_edges = maxActiveEdges; int s = qMax(maxActiveEdges + 1, default_alloc + 1); - edges = (Edge **)realloc(edges, s*sizeof(Edge *)); - edge_table = (Edge *)realloc(edge_table, s*sizeof(Edge)); - old = (Edge **)realloc(old, s*sizeof(Edge *)); + edges = q_check_ptr((Edge **)realloc(edges, s*sizeof(Edge *))); + edge_table = q_check_ptr((Edge *)realloc(edge_table, s*sizeof(Edge))); + old = q_check_ptr((Edge **)realloc(old, s*sizeof(Edge *))); } size = 0; old_size = 0; @@ -566,8 +566,8 @@ void QTessellatorPrivate::Vertices::init(int maxVertices) { if (!storage || maxVertices > allocated) { int size = qMax((int)default_alloc, maxVertices); - storage = (Vertex *)realloc(storage, size*sizeof(Vertex)); - sorted = (Vertex **)realloc(sorted, size*sizeof(Vertex *)); + storage = q_check_ptr((Vertex *)realloc(storage, size*sizeof(Vertex))); + sorted = q_check_ptr((Vertex **)realloc(sorted, size*sizeof(Vertex *))); allocated = maxVertices; } } @@ -739,7 +739,7 @@ void QTessellatorPrivate::cancelCoincidingEdges() if (testListSize > tlSize - 2) { tlSize = qMax(tlSize*2, 16); - tl = (QCoincidingEdge *)realloc(tl, tlSize*sizeof(QCoincidingEdge)); + tl = q_check_ptr((QCoincidingEdge *)realloc(tl, tlSize*sizeof(QCoincidingEdge))); } if (n->flags & (LineBeforeStarts|LineBeforeHorizontal)) { tl[testListSize].start = n; diff --git a/src/gui/painting/qwindowsurface_raster_p.h b/src/gui/painting/qwindowsurface_raster_p.h index 0f02a45..1b09914 100644 --- a/src/gui/painting/qwindowsurface_raster_p.h +++ b/src/gui/painting/qwindowsurface_raster_p.h @@ -111,7 +111,7 @@ public: private: void prepareBuffer(QImage::Format format, QWidget *widget); - Q_DECLARE_PRIVATE(QRasterWindowSurface) + Q_DECLARE_SCOPED_PRIVATE(QRasterWindowSurface) QScopedPointer d_ptr; }; diff --git a/src/gui/painting/qwindowsurface_s60.cpp b/src/gui/painting/qwindowsurface_s60.cpp index e81adcc..5de4317 100644 --- a/src/gui/painting/qwindowsurface_s60.cpp +++ b/src/gui/painting/qwindowsurface_s60.cpp @@ -75,8 +75,8 @@ QS60WindowSurface::QS60WindowSurface(QWidget* widget) // We create empty CFbsBitmap here -> it will be resized in setGeometry - d_ptr->bitmap = new (ELeave) CFbsBitmap; - User::LeaveIfError( d_ptr->bitmap->Create(TSize(0, 0), mode ) ); + d_ptr->bitmap = q_check_ptr(new CFbsBitmap); // CBase derived object needs check on new + qt_throwIfError( d_ptr->bitmap->Create(TSize(0, 0), mode ) ); updatePaintDeviceOnBitmap(); @@ -141,7 +141,8 @@ bool QS60WindowSurface::scroll(const QRegion &area, int dx, int dy) if (d_ptr->device.isNull()) return false; - CFbsBitmapDevice *bitmapDevice = CFbsBitmapDevice::NewL(d_ptr->bitmap); + CFbsBitmapDevice *bitmapDevice = 0; + QT_TRAP_THROWING(bitmapDevice = CFbsBitmapDevice::NewL(d_ptr->bitmap)); CBitmapContext *bitmapContext; TInt err = bitmapDevice->CreateBitmapContext(bitmapContext); if (err != KErrNone) { @@ -177,7 +178,7 @@ void QS60WindowSurface::setGeometry(const QRect& rect) QWindowSurface::setGeometry(rect); TRect nativeRect(qt_QRect2TRect(rect)); - User::LeaveIfError(d_ptr->bitmap->Resize(nativeRect.Size())); + qt_throwIfError(d_ptr->bitmap->Resize(nativeRect.Size())); if (!rect.isNull()) updatePaintDeviceOnBitmap(); diff --git a/src/gui/statemachine/qbasickeyeventtransition_p.h b/src/gui/statemachine/qbasickeyeventtransition_p.h index 1d507b3..038c7d1 100644 --- a/src/gui/statemachine/qbasickeyeventtransition_p.h +++ b/src/gui/statemachine/qbasickeyeventtransition_p.h @@ -88,7 +88,7 @@ protected: private: Q_DISABLE_COPY(QBasicKeyEventTransition) - Q_DECLARE_PRIVATE(QBasicKeyEventTransition) + Q_DECLARE_SCOPED_PRIVATE(QBasicKeyEventTransition) }; QT_END_NAMESPACE diff --git a/src/gui/statemachine/qbasicmouseeventtransition_p.h b/src/gui/statemachine/qbasicmouseeventtransition_p.h index 8ca6118..eb0dc0f 100644 --- a/src/gui/statemachine/qbasicmouseeventtransition_p.h +++ b/src/gui/statemachine/qbasicmouseeventtransition_p.h @@ -91,7 +91,7 @@ protected: private: Q_DISABLE_COPY(QBasicMouseEventTransition) - Q_DECLARE_PRIVATE(QBasicMouseEventTransition) + Q_DECLARE_SCOPED_PRIVATE(QBasicMouseEventTransition) }; QT_END_NAMESPACE diff --git a/src/gui/statemachine/qkeyeventtransition.h b/src/gui/statemachine/qkeyeventtransition.h index f5e8de3..aeae620 100644 --- a/src/gui/statemachine/qkeyeventtransition.h +++ b/src/gui/statemachine/qkeyeventtransition.h @@ -79,7 +79,7 @@ protected: private: Q_DISABLE_COPY(QKeyEventTransition) - Q_DECLARE_PRIVATE(QKeyEventTransition) + Q_DECLARE_SCOPED_PRIVATE(QKeyEventTransition) }; #endif //QT_NO_STATEMACHINE diff --git a/src/gui/statemachine/qmouseeventtransition.h b/src/gui/statemachine/qmouseeventtransition.h index 73ae6c9..5f2d57b 100644 --- a/src/gui/statemachine/qmouseeventtransition.h +++ b/src/gui/statemachine/qmouseeventtransition.h @@ -84,7 +84,7 @@ protected: private: Q_DISABLE_COPY(QMouseEventTransition) - Q_DECLARE_PRIVATE(QMouseEventTransition) + Q_DECLARE_SCOPED_PRIVATE(QMouseEventTransition) }; #endif //QT_NO_STATEMACHINE diff --git a/src/gui/styles/qcleanlooksstyle.h b/src/gui/styles/qcleanlooksstyle.h index ebfb707..834f238 100644 --- a/src/gui/styles/qcleanlooksstyle.h +++ b/src/gui/styles/qcleanlooksstyle.h @@ -56,7 +56,7 @@ class QCleanlooksStylePrivate; class Q_GUI_EXPORT QCleanlooksStyle : public QWindowsStyle { Q_OBJECT - Q_DECLARE_PRIVATE(QCleanlooksStyle) + Q_DECLARE_SCOPED_PRIVATE(QCleanlooksStyle) public: QCleanlooksStyle(); diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp index 7b8b75e..ba23499 100644 --- a/src/gui/styles/qcommonstyle.cpp +++ b/src/gui/styles/qcommonstyle.cpp @@ -3176,8 +3176,10 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt, if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast(opt)) { if (!d->isViewItemCached(*vopt)) { d->viewItemLayout(vopt, &d->checkRect, &d->decorationRect, &d->displayRect, false); - if (d->cachedOption) + if (d->cachedOption) { delete d->cachedOption; + d->cachedOption = 0; + } d->cachedOption = new QStyleOptionViewItemV4(*vopt); } if (sr == SE_ViewItemCheckIndicator) diff --git a/src/gui/styles/qcommonstyle.h b/src/gui/styles/qcommonstyle.h index ce54a96..1f64fb3 100644 --- a/src/gui/styles/qcommonstyle.h +++ b/src/gui/styles/qcommonstyle.h @@ -98,7 +98,7 @@ protected: QCommonStyle(QCommonStylePrivate &dd); private: - Q_DECLARE_PRIVATE(QCommonStyle) + Q_DECLARE_SCOPED_PRIVATE(QCommonStyle) Q_DISABLE_COPY(QCommonStyle) }; diff --git a/src/gui/styles/qgtkstyle.h b/src/gui/styles/qgtkstyle.h index e12f175..3feeafa 100644 --- a/src/gui/styles/qgtkstyle.h +++ b/src/gui/styles/qgtkstyle.h @@ -60,7 +60,7 @@ class QGtkStylePrivate; class Q_GUI_EXPORT QGtkStyle : public QCleanlooksStyle { Q_OBJECT - Q_DECLARE_PRIVATE(QGtkStyle) + Q_DECLARE_SCOPED_PRIVATE(QGtkStyle) public: QGtkStyle(); diff --git a/src/gui/styles/qmotifstyle.h b/src/gui/styles/qmotifstyle.h index e848eb4..356f420 100644 --- a/src/gui/styles/qmotifstyle.h +++ b/src/gui/styles/qmotifstyle.h @@ -113,7 +113,7 @@ protected: bool eventFilter(QObject *o, QEvent *e); private: - Q_DECLARE_PRIVATE(QMotifStyle) + Q_DECLARE_SCOPED_PRIVATE(QMotifStyle) Q_DISABLE_COPY(QMotifStyle) bool highlightCols; diff --git a/src/gui/styles/qplastiquestyle.h b/src/gui/styles/qplastiquestyle.h index ac3da41..74560fc 100644 --- a/src/gui/styles/qplastiquestyle.h +++ b/src/gui/styles/qplastiquestyle.h @@ -56,7 +56,7 @@ class QPlastiqueStylePrivate; class Q_GUI_EXPORT QPlastiqueStyle : public QWindowsStyle { Q_OBJECT - Q_DECLARE_PRIVATE(QPlastiqueStyle) + Q_DECLARE_SCOPED_PRIVATE(QPlastiqueStyle) public: QPlastiqueStyle(); ~QPlastiqueStyle(); diff --git a/src/gui/styles/qproxystyle.h b/src/gui/styles/qproxystyle.h index c9edaff..33f252a 100644 --- a/src/gui/styles/qproxystyle.h +++ b/src/gui/styles/qproxystyle.h @@ -102,7 +102,7 @@ protected Q_SLOTS: Qt::Orientation orientation, const QStyleOption *option = 0, const QWidget *widget = 0) const; private: Q_DISABLE_COPY(QProxyStyle) - Q_DECLARE_PRIVATE(QProxyStyle) + Q_DECLARE_SCOPED_PRIVATE(QProxyStyle) }; #endif // QT_NO_STYLE_PROXY diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index b083f4b..888a6ed 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -88,16 +88,16 @@ static const QByteArray propertyKeyCurrentlayout = "currentlayout"; const layoutHeader QS60StylePrivate::m_layoutHeaders[] = { // *** generated layout data *** -{240,320,1,14,true,QLatin1String("QVGA Landscape Mirrored")}, -{240,320,1,14,false,QLatin1String("QVGA Landscape")}, -{320,240,1,14,true,QLatin1String("QVGA Portrait Mirrored")}, -{320,240,1,14,false,QLatin1String("QVGA Portrait")}, -{360,640,1,14,true,QLatin1String("NHD Landscape Mirrored")}, -{360,640,1,14,false,QLatin1String("NHD Landscape")}, -{640,360,1,14,true,QLatin1String("NHD Portrait Mirrored")}, -{640,360,1,14,false,QLatin1String("NHD Portrait")}, -{352,800,1,12,true,QLatin1String("E90 Landscape Mirrored")}, -{352,800,1,12,false,QLatin1String("E90 Landscape")} +{240,320,1,14,true,"QVGA Landscape Mirrored"}, +{240,320,1,14,false,"QVGA Landscape"}, +{320,240,1,14,true,"QVGA Portrait Mirrored"}, +{320,240,1,14,false,"QVGA Portrait"}, +{360,640,1,14,true,"NHD Landscape Mirrored"}, +{360,640,1,14,false,"NHD Landscape"}, +{640,360,1,14,true,"NHD Portrait Mirrored"}, +{640,360,1,14,false,"NHD Portrait"}, +{352,800,1,12,true,"E90 Landscape Mirrored"}, +{352,800,1,12,false,"E90 Landscape"} // *** End of generated data *** }; const int QS60StylePrivate::m_numberOfLayouts = @@ -319,7 +319,7 @@ QVariant QS60StylePrivate::styleProperty(const char *name) const static QStringList layouts; if (layouts.isEmpty()) for (int i = 0; i < m_numberOfLayouts; i++) - layouts.append(m_layoutHeaders[i].layoutName); + layouts.append(QLatin1String(m_layoutHeaders[i].layoutName)); return layouts; } return QVariant(); diff --git a/src/gui/styles/qs60style.h b/src/gui/styles/qs60style.h index d8e9a40..38d8e48 100644 --- a/src/gui/styles/qs60style.h +++ b/src/gui/styles/qs60style.h @@ -57,7 +57,7 @@ class QS60StylePrivate; class Q_GUI_EXPORT QS60Style : public QCommonStyle { Q_OBJECT - Q_DECLARE_PRIVATE(QS60Style) + Q_DECLARE_SCOPED_PRIVATE(QS60Style) public: QS60Style(); diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h index 7240978..2eb40de 100644 --- a/src/gui/styles/qs60style_p.h +++ b/src/gui/styles/qs60style_p.h @@ -75,7 +75,7 @@ typedef struct { int major_version; int minor_version; bool mirroring; // TODO: (nice to have) Use Qt::LayoutDirection - QString layoutName; + const char* layoutName; } layoutHeader; #ifdef Q_OS_SYMBIAN diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index 63346da..8e9918e 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -106,10 +106,10 @@ public: static QPixmap generateMissingThemeGraphic(QS60StyleEnums::SkinParts &part, const QSize &size, QS60StylePrivate::SkinElementFlags flags); private: - static QPixmap createSkinnedGraphicsL(QS60StyleEnums::SkinParts part, + static QPixmap createSkinnedGraphicsLX(QS60StyleEnums::SkinParts part, const QSize &size, QS60StylePrivate::SkinElementFlags flags); - static QPixmap createSkinnedGraphicsL(QS60StylePrivate::SkinFrameElements frameElement, const QSize &size, QS60StylePrivate::SkinElementFlags flags); - static QPixmap colorSkinnedGraphicsL(const QS60StyleEnums::SkinParts &stylepart, + static QPixmap createSkinnedGraphicsLX(QS60StylePrivate::SkinFrameElements frameElement, const QSize &size, QS60StylePrivate::SkinElementFlags flags); + static QPixmap colorSkinnedGraphicsLX(const QS60StyleEnums::SkinParts &stylepart, const QSize &size, QS60StylePrivate::SkinElementFlags flags); static void frameIdAndCenterId(QS60StylePrivate::SkinFrameElements frameElement, TAknsItemID &frameId, TAknsItemID ¢erId); static TRect innerRectFromElement(QS60StylePrivate::SkinFrameElements frameElement, const TRect &outerRect); @@ -336,10 +336,10 @@ QPixmap QS60StyleModeSpecifics::skinnedGraphics( QS60StylePrivate::SkinElementFlags flags) { QPixmap themedImage; - TRAPD( error, { - const QPixmap skinnedImage = createSkinnedGraphicsL(stylepart, size, flags); + TRAPD( error, QT_TRYCATCH_LEAVING({ + const QPixmap skinnedImage = createSkinnedGraphicsLX(stylepart, size, flags); themedImage = skinnedImage; - }); + })); if (error) return themedImage = QPixmap(); return themedImage; @@ -349,10 +349,10 @@ QPixmap QS60StyleModeSpecifics::skinnedGraphics( QS60StylePrivate::SkinFrameElements frame, const QSize &size, QS60StylePrivate::SkinElementFlags flags) { QPixmap themedImage; - TRAPD( error, { - const QPixmap skinnedImage = createSkinnedGraphicsL(frame, size, flags); + TRAPD( error, QT_TRYCATCH_LEAVING({ + const QPixmap skinnedImage = createSkinnedGraphicsLX(frame, size, flags); themedImage = skinnedImage; - }); + })); if (error) return themedImage = QPixmap(); return themedImage; @@ -363,7 +363,7 @@ QPixmap QS60StyleModeSpecifics::colorSkinnedGraphics( const QSize &size, QS60StylePrivate::SkinElementFlags flags) { QPixmap colorGraphics; - TRAPD(error, colorGraphics = colorSkinnedGraphicsL(stylepart, size, flags)); + TRAPD(error, QT_TRYCATCH_LEAVING(colorGraphics = colorSkinnedGraphicsLX(stylepart, size, flags))); return error ? QPixmap() : colorGraphics; } @@ -521,10 +521,11 @@ void QS60StyleModeSpecifics::fallbackInfo(const QS60StyleEnums::SkinParts &style } } -QPixmap QS60StyleModeSpecifics::colorSkinnedGraphicsL( +QPixmap QS60StyleModeSpecifics::colorSkinnedGraphicsLX( const QS60StyleEnums::SkinParts &stylepart, const QSize &size, QS60StylePrivate::SkinElementFlags flags) { + // this function can throw both exceptions and leaves. There are no cleanup dependencies between Qt and Symbian parts. const int stylepartIndex = (int)stylepart; const TAknsItemID skinId = m_partMap[stylepartIndex].skinID; @@ -563,6 +564,13 @@ QColor QS60StyleModeSpecifics::colorValue(const TAknsItemID &colorGroup, int col return QColor(skinnedColor.Red(),skinnedColor.Green(),skinnedColor.Blue()); } +struct QAutoFbsBitmapHeapLock +{ + QAutoFbsBitmapHeapLock(CFbsBitmap* aBmp) : mBmp(aBmp) { mBmp->LockHeap(); } + ~QAutoFbsBitmapHeapLock() { mBmp->UnlockHeap(); } + CFbsBitmap* mBmp; +}; + QPixmap QS60StyleModeSpecifics::fromFbsBitmap(CFbsBitmap *icon, CFbsBitmap *mask, QS60StylePrivate::SkinElementFlags flags, QImage::Format format) { Q_ASSERT(icon); @@ -589,13 +597,13 @@ QPixmap QS60StyleModeSpecifics::fromFbsBitmap(CFbsBitmap *icon, CFbsBitmap *mask if (mask) { //checkAndUnCompressBitmap might set mask to NULL const TSize maskSize = icon->SizeInPixels(); const int maskBytesPerLine = CFbsBitmap::ScanLineLength(maskSize.iWidth, mask->DisplayMode()); - mask->LockHeap(); + // heap lock object required because QImage ctor might throw + QAutoFbsBitmapHeapLock maskHeapLock(mask); const uchar *const maskBytes = (uchar *)mask->DataAddress(); // Since no other bitmap should be locked, we can just "borrow" the mask data for setAlphaChannel const QImage maskImage(maskBytes, maskSize.iWidth, maskSize.iHeight, maskBytesPerLine, QImage::Format_Indexed8); if (!maskImage.isNull()) iconImage.setAlphaChannel(maskImage); - mask->UnlockHeap(); } } @@ -631,10 +639,11 @@ QPoint qt_s60_fill_background_offset(const QWidget *targetWidget) return QPoint(globalPos.iX, globalPos.iY); } -QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsL( +QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsLX( QS60StyleEnums::SkinParts part, const QSize &size, QS60StylePrivate::SkinElementFlags flags) { + // this function can throw both exceptions and leaves. There are no cleanup dependencies between Qt and Symbian parts. if (!size.isValid()) return QPixmap(); @@ -712,9 +721,10 @@ QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsL( return result; } -QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsL(QS60StylePrivate::SkinFrameElements frameElement, +QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsLX(QS60StylePrivate::SkinFrameElements frameElement, const QSize &size, QS60StylePrivate::SkinElementFlags flags) { + // this function can throw both exceptions and leaves. There are no cleanup dependencies between Qt and Symbian parts. if (!size.isValid()) return QPixmap(); @@ -892,7 +902,10 @@ void QS60StyleModeSpecifics::checkAndUnCompressBitmap(CFbsBitmap*& aOriginalBitm void QS60StyleModeSpecifics::checkAndUnCompressBitmapL(CFbsBitmap*& aOriginalBitmap) { - if (aOriginalBitmap->IsCompressedInRAM()) { + const TSize iconSize = aOriginalBitmap->SizeInPixels(); + const int iconBytesPerLine = CFbsBitmap::ScanLineLength(iconSize.iWidth, aOriginalBitmap->DisplayMode()); + const int iconBytesCount = iconBytesPerLine * iconSize.iHeight; + if (aOriginalBitmap->IsCompressedInRAM() || aOriginalBitmap->DataSize() < iconBytesCount) { const TSize iconSize(aOriginalBitmap->SizeInPixels().iWidth, aOriginalBitmap->SizeInPixels().iHeight); CFbsBitmap* uncompressedBitmap = new (ELeave) CFbsBitmap(); @@ -941,7 +954,7 @@ QFont QS60StylePrivate::s60Font_specific( } QFont result; - TRAPD( error, { + TRAPD( error, QT_TRYCATCH_LEAVING({ const CAknLayoutFont* aknFont = AknFontAccess::CreateLayoutFontFromSpecificationL(*dev, spec); @@ -950,7 +963,7 @@ QFont QS60StylePrivate::s60Font_specific( result.setPointSize(pointSize); // Correct the font size returned by CreateLayoutFontFromSpecificationL() delete aknFont; - }); + })); if (error) result = QFont(); return result; } @@ -1178,7 +1191,9 @@ void QS60StyleModeSpecifics::unCompressBitmapL(const TRect& aTrgRect, CFbsBitmap User::Leave(KErrArgument); // Note! aSrcBitmap->IsCompressedInRAM() is always ETrue, since this method is called only if that applies! - ASSERT(aSrcBitmap->IsCompressedInRAM()); + // Extra note! this function is also being used when bitmaps appear to be compressed (because DataSize is too small) + // even when they pretend they are not. Assert removed. +// ASSERT(aSrcBitmap->IsCompressedInRAM()); TDisplayMode displayMode = aSrcBitmap->DisplayMode(); diff --git a/src/gui/styles/qstyle.h b/src/gui/styles/qstyle.h index d79c39c..61a4ed5 100644 --- a/src/gui/styles/qstyle.h +++ b/src/gui/styles/qstyle.h @@ -68,7 +68,7 @@ class QStylePrivate; class Q_GUI_EXPORT QStyle : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QStyle) + Q_DECLARE_SCOPED_PRIVATE(QStyle) protected: QStyle(QStylePrivate &dd); diff --git a/src/gui/styles/qstylesheetstyle_p.h b/src/gui/styles/qstylesheetstyle_p.h index 9b7b79d..399e449 100644 --- a/src/gui/styles/qstylesheetstyle_p.h +++ b/src/gui/styles/qstylesheetstyle_p.h @@ -182,7 +182,7 @@ public: private: Q_DISABLE_COPY(QStyleSheetStyle) - Q_DECLARE_PRIVATE(QStyleSheetStyle) + Q_DECLARE_SCOPED_PRIVATE(QStyleSheetStyle) }; diff --git a/src/gui/styles/qwindowsmobilestyle.h b/src/gui/styles/qwindowsmobilestyle.h index ab32e8e..9892dec 100644 --- a/src/gui/styles/qwindowsmobilestyle.h +++ b/src/gui/styles/qwindowsmobilestyle.h @@ -104,7 +104,7 @@ protected: QWindowsMobileStyle(QWindowsMobileStylePrivate &dd); private: - Q_DECLARE_PRIVATE(QWindowsMobileStyle) + Q_DECLARE_SCOPED_PRIVATE(QWindowsMobileStyle) }; #endif // QT_NO_STYLE_WINDOWSMOBILE diff --git a/src/gui/styles/qwindowsstyle.h b/src/gui/styles/qwindowsstyle.h index c169a84..45260e8 100644 --- a/src/gui/styles/qwindowsstyle.h +++ b/src/gui/styles/qwindowsstyle.h @@ -98,7 +98,7 @@ protected: private: Q_DISABLE_COPY(QWindowsStyle) - Q_DECLARE_PRIVATE(QWindowsStyle) + Q_DECLARE_SCOPED_PRIVATE(QWindowsStyle) void *reserved; }; diff --git a/src/gui/styles/qwindowsvistastyle.h b/src/gui/styles/qwindowsvistastyle.h index 97b1e74..60cd7a5 100644 --- a/src/gui/styles/qwindowsvistastyle.h +++ b/src/gui/styles/qwindowsvistastyle.h @@ -96,7 +96,7 @@ protected Q_SLOTS: private: Q_DISABLE_COPY(QWindowsVistaStyle) - Q_DECLARE_PRIVATE(QWindowsVistaStyle) + Q_DECLARE_SCOPED_PRIVATE(QWindowsVistaStyle) friend class QStyleFactory; }; #endif //QT_NO_STYLE_WINDOWSVISTA diff --git a/src/gui/styles/qwindowsxpstyle.h b/src/gui/styles/qwindowsxpstyle.h index ab26f56..21e24ff 100644 --- a/src/gui/styles/qwindowsxpstyle.h +++ b/src/gui/styles/qwindowsxpstyle.h @@ -93,7 +93,7 @@ protected Q_SLOTS: private: Q_DISABLE_COPY(QWindowsXPStyle) - Q_DECLARE_PRIVATE(QWindowsXPStyle) + Q_DECLARE_SCOPED_PRIVATE(QWindowsXPStyle) friend class QStyleFactory; void *reserved; }; diff --git a/src/gui/text/qabstractfontengine_qws.h b/src/gui/text/qabstractfontengine_qws.h index e6be611..8403f87 100644 --- a/src/gui/text/qabstractfontengine_qws.h +++ b/src/gui/text/qabstractfontengine_qws.h @@ -118,7 +118,7 @@ public: virtual QList availableFontEngines() const = 0; private: - Q_DECLARE_PRIVATE(QFontEnginePlugin) + Q_DECLARE_SCOPED_PRIVATE(QFontEnginePlugin) Q_DISABLE_COPY(QFontEnginePlugin) }; @@ -207,7 +207,7 @@ public: */ private: - Q_DECLARE_PRIVATE(QAbstractFontEngine) + Q_DECLARE_SCOPED_PRIVATE(QAbstractFontEngine) Q_DISABLE_COPY(QAbstractFontEngine) }; diff --git a/src/gui/text/qabstracttextdocumentlayout.h b/src/gui/text/qabstracttextdocumentlayout.h index 070c301..3681eec 100644 --- a/src/gui/text/qabstracttextdocumentlayout.h +++ b/src/gui/text/qabstracttextdocumentlayout.h @@ -62,7 +62,7 @@ class QTextFrame; class Q_GUI_EXPORT QAbstractTextDocumentLayout : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QAbstractTextDocumentLayout) + Q_DECLARE_SCOPED_PRIVATE(QAbstractTextDocumentLayout) public: explicit QAbstractTextDocumentLayout(QTextDocument *doc); diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 844c3f9..d33cdf0 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -226,7 +226,9 @@ struct QtFontStyle delete [] setwidthName; #endif #if defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) - while (count--) { + while (count) { + // bitfield count-- in while condition does not work correctly in mwccsym2 + count--; #ifdef Q_WS_X11 free(pixelSizes[count].encodings); #endif diff --git a/src/gui/text/qfontdatabase_qws.cpp b/src/gui/text/qfontdatabase_qws.cpp index 1ac87ea..f4e37b7 100644 --- a/src/gui/text/qfontdatabase_qws.cpp +++ b/src/gui/text/qfontdatabase_qws.cpp @@ -757,21 +757,21 @@ QFontDatabase::findFont(int script, const QFontPrivate *fp, if (!privateDb()->count) initializeDb(); - QFontEngine *fe = 0; + QScopedPointer fe; if (fp) { if (fp->rawMode) { - fe = loadEngine(script, fp, request, 0, 0, 0, 0 - ); + fe.reset(loadEngine(script, fp, request, 0, 0, 0, 0)); // if we fail to load the rawmode font, use a 12pixel box engine instead - if (! fe) fe = new QFontEngineBox(12); - return fe; + if (fe.isNull()) + fe.reset(new QFontEngineBox(12)); + return fe.take(); } QFontCache::Key key(request, script); - fe = QFontCache::instance()->findEngine(key); - if (fe) - return fe; + fe.reset(QFontCache::instance()->findEngine(key)); + if (! fe.isNull()) + return fe.take(); } QString family_name, foundry_name; @@ -795,11 +795,11 @@ QFontDatabase::findFont(int script, const QFontPrivate *fp, script, request.weight, request.style, request.stretch, request.pixelSize, pitch); if (qt_enable_test_font && request.family == QLatin1String("__Qt__Box__Engine__")) { - fe = new QTestFontEngine(request.pixelSize); + fe.reset(new QTestFontEngine(request.pixelSize)); fe->fontDef = request; } - if (!fe) + if (fe.isNull()) { QtFontDesc desc; match(script, request, family_name, foundry_name, force_encoding_id, &desc); @@ -820,16 +820,28 @@ QFontDatabase::findFont(int script, const QFontPrivate *fp, 'p', 0 ); - fe = loadEngine(script, fp, request, desc.family, desc.foundry, desc.style, desc.size - ); + fe.reset(loadEngine(script, fp, request, desc.family, desc.foundry, desc.style, desc.size + )); } else { FM_DEBUG(" NO MATCH FOUND\n"); } - if (fe) + if (! fe.isNull()) initFontDef(desc, request, &fe->fontDef); } - if (fe) { +#ifndef QT_NO_FREETYPE + if (! fe.isNull()) { + if (scriptRequiresOpenType(script) && fe->type() == QFontEngine::Freetype) { + HB_Face hbFace = static_cast(fe.data())->harfbuzzFace(); + if (!hbFace || !hbFace->supported_scripts[script]) { + FM_DEBUG(" OpenType support missing for script\n"); + fe.reset(0); + } + } + } +#endif + + if (! fe.isNull()) { if (fp) { QFontDef def = request; if (def.family.isEmpty()) { @@ -837,32 +849,21 @@ QFontDatabase::findFont(int script, const QFontPrivate *fp, def.family = def.family.left(def.family.indexOf(QLatin1Char(','))); } QFontCache::Key key(def, script); - QFontCache::instance()->insertEngine(key, fe); - } - -#ifndef QT_NO_FREETYPE - if (scriptRequiresOpenType(script) && fe->type() == QFontEngine::Freetype) { - HB_Face hbFace = static_cast(fe)->harfbuzzFace(); - if (!hbFace || !hbFace->supported_scripts[script]) { - FM_DEBUG(" OpenType support missing for script\n"); - delete fe; - fe = 0; - } + QFontCache::instance()->insertEngine(key, fe.data()); } -#endif } - if (!fe) { + if (fe.isNull()) { if (!request.family.isEmpty()) return 0; FM_DEBUG("returning box engine"); - fe = new QFontEngineBox(request.pixelSize); + fe.reset(new QFontEngineBox(request.pixelSize)); if (fp) { QFontCache::Key key(request, script); - QFontCache::instance()->insertEngine(key, fe); + QFontCache::instance()->insertEngine(key, fe.data()); } } @@ -872,7 +873,7 @@ QFontDatabase::findFont(int script, const QFontPrivate *fp, fe->fontDef.pointSize = request.pointSize; } - return fe; + return fe.take(); } void QFontDatabase::load(const QFontPrivate *d, int script) @@ -893,7 +894,13 @@ void QFontDatabase::load(const QFontPrivate *d, int script) if (!d->engineData) { // create a new one d->engineData = new QFontEngineData; - QFontCache::instance()->insertEngineData(key, d->engineData); + QT_TRY { + QFontCache::instance()->insertEngineData(key, d->engineData); + } QT_CATCH(...) { + delete d->engineData; + d->engineData = 0; + QT_RETHROW; + } } else { d->engineData->ref.ref(); } @@ -902,8 +909,6 @@ void QFontDatabase::load(const QFontPrivate *d, int script) // the cached engineData could have already loaded the engine we want if (d->engineData->engines[script]) return; - // load the font - QFontEngine *engine = 0; // double scale = 1.0; // ### TODO: fix the scale calculations // list of families to try @@ -935,20 +940,15 @@ void QFontDatabase::load(const QFontPrivate *d, int script) // null family means find the first font matching the specified script family_list << QString(); + // load the font + QFontEngine *engine = 0; QStringList::ConstIterator it = family_list.constBegin(), end = family_list.constEnd(); - for (; ! engine && it != end; ++it) { + for (; !engine && it != end; ++it) { req.family = *it; engine = QFontDatabase::findFont(script, d, req); - if (engine) { - if (engine->type() != QFontEngine::Box) - break; - - if (! req.family.isEmpty()) - engine = 0; - - continue; - } + if (engine && (engine->type()==QFontEngine::Box) && !req.family.isEmpty()) + engine = 0; } engine->ref.ref(); diff --git a/src/gui/text/qfontdatabase_s60.cpp b/src/gui/text/qfontdatabase_s60.cpp index 416c3d1..6838d17 100644 --- a/src/gui/text/qfontdatabase_s60.cpp +++ b/src/gui/text/qfontdatabase_s60.cpp @@ -107,9 +107,12 @@ private: QFontDatabaseS60StoreImplementation::QFontDatabaseS60StoreImplementation() { m_heap = User::ChunkHeap(NULL, 0x1000, 0x100000); - m_store = CFontStore::NewL(m_heap); - m_rasterizer = COpenFontRasterizer::NewL(TUid::Uid(0x101F7F5E)); - m_store->InstallRasterizerL(m_rasterizer); + QT_TRAP_THROWING( + m_store = CFontStore::NewL(m_heap); + m_rasterizer = COpenFontRasterizer::NewL(TUid::Uid(0x101F7F5E)); + CleanupStack::PushL(m_rasterizer); + m_store->InstallRasterizerL(m_rasterizer); + CleanupStack::Pop(m_rasterizer);); QStringList filters; filters.append(QString::fromLatin1("*.ttf")); @@ -117,14 +120,14 @@ QFontDatabaseS60StoreImplementation::QFontDatabaseS60StoreImplementation() const QFileInfoList fontFiles = alternativeFilePaths(QString::fromLatin1("resource\\Fonts"), filters); foreach (const QFileInfo &fontFileInfo, fontFiles) { const QString fontFile = QDir::toNativeSeparators(fontFileInfo.absoluteFilePath()); - m_store->AddFileL(qt_QString2TPtrC(fontFile)); + TPtrC fontFilePtr(qt_QString2TPtrC(fontFile)); + QT_TRAP_THROWING(m_store->AddFileL(fontFilePtr)); } } QFontDatabaseS60StoreImplementation::~QFontDatabaseS60StoreImplementation() { qDeleteAll(m_extensions); - delete m_rasterizer; - delete m_store; + // TODO m_store cleanup removed because it was crashing m_heap->Close(); } @@ -218,7 +221,7 @@ static void initializeDb() QS60Data::screenDevice()->TypefaceSupport(typefaceSupport, i); CFont *font; // We have to get a font instance in order to know all the details TFontSpec fontSpec(typefaceSupport.iTypeface.iName, 11); - QS60Data::screenDevice()->GetNearestFontInPixels(font, fontSpec); + qt_throwIfError(QS60Data::screenDevice()->GetNearestFontInPixels(font, fontSpec)); if (font->TypeUid() == KCFbsFontUid) { TOpenFontFaceAttrib faceAttrib; const CFbsFont *cfbsFont = dynamic_cast(font); diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index 730137e..794fd79 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -236,8 +236,10 @@ HB_Font QFontEngine::harfbuzzFont() const HB_Face QFontEngine::harfbuzzFace() const { - if (!hbFace) + if (!hbFace) { hbFace = qHBNewFace(const_cast(this), hb_getSFntTable); + Q_CHECK_PTR(hbFace); + } return hbFace; } diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index ab04dc7..ecc4b4f 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -205,7 +205,9 @@ QFreetypeFace *QFreetypeFace::getFace(const QFontEngine::FaceId &face_id) FT_Init_FreeType(&freetypeData->library); QFreetypeFace *freetype = freetypeData->faces.value(face_id, 0); - if (!freetype) { + if (freetype) { + freetype->ref.ref(); + } else { QScopedPointer newFreetype(new QFreetypeFace); FT_Face face; QFile file(QString::fromUtf8(face_id.filename)); @@ -234,7 +236,8 @@ QFreetypeFace *QFreetypeFace::getFace(const QFontEngine::FaceId &face_id) newFreetype->face = face; newFreetype->hbFace = qHBNewFace(face, hb_getSFntTable); - newFreetype->ref = 0; + Q_CHECK_PTR(newFreetype->hbFace); + newFreetype->ref = 1; newFreetype->xsize = 0; newFreetype->ysize = 0; newFreetype->matrix.xx = 0x10000; @@ -289,10 +292,15 @@ QFreetypeFace *QFreetypeFace::getFace(const QFontEngine::FaceId &face_id) #endif FT_Set_Charmap(newFreetype->face, newFreetype->unicode_map); - freetypeData->faces.insert(face_id, newFreetype.data()); + QT_TRY { + freetypeData->faces.insert(face_id, newFreetype.data()); + } QT_CATCH(...) { + newFreetype.take()->release(face_id); + // we could return null in principle instead of throwing + QT_RETHROW; + } freetype = newFreetype.take(); } - freetype->ref.ref(); return freetype; } @@ -306,7 +314,8 @@ void QFreetypeFace::release(const QFontEngine::FaceId &face_id) if (charset) FcCharSetDestroy(charset); #endif - freetypeData->faces.take(face_id); + if(freetypeData->faces.contains(face_id)) + freetypeData->faces.take(face_id); delete this; } if (freetypeData->faces.isEmpty()) { diff --git a/src/gui/text/qfontengine_ft_p.h b/src/gui/text/qfontengine_ft_p.h index aa1cd0a..0572e92 100644 --- a/src/gui/text/qfontengine_ft_p.h +++ b/src/gui/text/qfontengine_ft_p.h @@ -119,7 +119,7 @@ struct QFreetypeFace static void addBitmapToPath(FT_GlyphSlot slot, const QFixedPoint &point, QPainterPath *path, bool = false); private: - friend class QScopedPointer; + friend class QScopedPointerDeleter; QFreetypeFace() : _lock(QMutex::Recursive) {} ~QFreetypeFace() {} QAtomicInt ref; diff --git a/src/gui/text/qfontengine_s60.cpp b/src/gui/text/qfontengine_s60.cpp index f485afb..d1e591e 100644 --- a/src/gui/text/qfontengine_s60.cpp +++ b/src/gui/text/qfontengine_s60.cpp @@ -130,11 +130,11 @@ QFontEngineS60::QFontEngineS60(const QFontDef &request, const QFontEngineS60Exte m_fontSizeInPixels = (request.pixelSize >= 0)? request.pixelSize:pointsToPixels(request.pointSize); QS60WindowSurface::unlockBitmapHeap(); - m_textRenderBitmap = new (ELeave) CFbsBitmap(); + m_textRenderBitmap = q_check_ptr(new CFbsBitmap()); // CBase derived object needs check on new const TSize bitmapSize(1, 1); // It is just a dummy bitmap that I need to keep the font alive (or maybe not) - User::LeaveIfError(m_textRenderBitmap->Create(bitmapSize, EGray256)); - m_textRenderBitmapDevice = CFbsBitmapDevice::NewL(m_textRenderBitmap); - User::LeaveIfError(m_textRenderBitmapDevice->CreateContext(m_textRenderBitmapGc)); + qt_throwIfError(m_textRenderBitmap->Create(bitmapSize, EGray256)); + QT_TRAP_THROWING(m_textRenderBitmapDevice = CFbsBitmapDevice::NewL(m_textRenderBitmap)); + qt_throwIfError(m_textRenderBitmapDevice->CreateContext(m_textRenderBitmapGc)); cache_cost = sizeof(QFontEngineS60) + bitmapSize.iHeight * bitmapSize.iWidth * 4; TFontSpec fontSpec(qt_QString2TPtrC(request.family), m_fontSizeInPixels); diff --git a/src/gui/text/qfontengine_win.cpp b/src/gui/text/qfontengine_win.cpp index 9715aef..8e4bb55 100644 --- a/src/gui/text/qfontengine_win.cpp +++ b/src/gui/text/qfontengine_win.cpp @@ -495,7 +495,7 @@ bool QFontEngineWin::stringToCMap(const QChar *str, int len, QGlyphLayout *glyph unsigned int glyph = glyphs->glyphs[glyph_pos]; if(int(glyph) >= designAdvancesSize) { int newSize = (glyph + 256) >> 8 << 8; - designAdvances = (QFixed *)realloc(designAdvances, newSize*sizeof(QFixed)); + designAdvances = q_check_ptr((QFixed *)realloc(designAdvances, newSize*sizeof(QFixed))); for(int i = designAdvancesSize; i < newSize; ++i) designAdvances[i] = -1000000; designAdvancesSize = newSize; @@ -528,7 +528,8 @@ bool QFontEngineWin::stringToCMap(const QChar *str, int len, QGlyphLayout *glyph if (glyph >= widthCacheSize) { int newSize = (glyph + 256) >> 8 << 8; - widthCache = (unsigned char *)realloc(widthCache, newSize*sizeof(QFixed)); + widthCache = q_check_ptr((unsigned char *)realloc(widthCache, + newSize*sizeof(QFixed))); memset(widthCache + widthCacheSize, 0, newSize - widthCacheSize); widthCacheSize = newSize; } @@ -570,7 +571,8 @@ void QFontEngineWin::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFla unsigned int glyph = glyphs->glyphs[i]; if(int(glyph) >= designAdvancesSize) { int newSize = (glyph + 256) >> 8 << 8; - designAdvances = (QFixed *)realloc(designAdvances, newSize*sizeof(QFixed)); + designAdvances = q_check_ptr((QFixed *)realloc(designAdvances, + newSize*sizeof(QFixed))); for(int i = designAdvancesSize; i < newSize; ++i) designAdvances[i] = -1000000; designAdvancesSize = newSize; @@ -620,7 +622,8 @@ void QFontEngineWin::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFla if (glyph >= widthCacheSize) { int newSize = (glyph + 256) >> 8 << 8; - widthCache = (unsigned char *)realloc(widthCache, newSize*sizeof(QFixed)); + widthCache = q_check_ptr((unsigned char *)realloc(widthCache, + newSize*sizeof(QFixed))); memset(widthCache + widthCacheSize, 0, newSize - widthCacheSize); widthCacheSize = newSize; } diff --git a/src/gui/text/qfragmentmap_p.h b/src/gui/text/qfragmentmap_p.h index c2ba2b4..9c2a673 100644 --- a/src/gui/text/qfragmentmap_p.h +++ b/src/gui/text/qfragmentmap_p.h @@ -222,13 +222,19 @@ QFragmentMapData::QFragmentMapData() template void QFragmentMapData::init() { - fragments = (Fragment *)malloc(64*fragmentSize); + // the following code will realloc an existing fragment or create a new one. + // it will also ignore errors when shrinking an existing fragment. + Fragment *newFragments = (Fragment *)realloc(fragments, 64*fragmentSize); + if (newFragments) { + fragments = newFragments; + head->allocated = 64; + } Q_CHECK_PTR(fragments); + head->tag = (((quint32)'p') << 24) | (((quint32)'m') << 16) | (((quint32)'a') << 8) | 'p'; //TAG('p', 'm', 'a', 'p'); head->root = 0; head->freelist = 1; head->node_count = 0; - head->allocated = 64; // mark all items to the right as unused F(head->freelist).right = 0; } @@ -236,7 +242,7 @@ void QFragmentMapData::init() template QFragmentMapData::~QFragmentMapData() { - free(head); + free(fragments); } template @@ -800,7 +806,6 @@ public: inline void clear() { for (Iterator it = begin(); !it.atEnd(); ++it) it.value()->free(); - ::free(data.head); data.init(); } diff --git a/src/gui/text/qsyntaxhighlighter.h b/src/gui/text/qsyntaxhighlighter.h index 4e5271b..b2fee15 100644 --- a/src/gui/text/qsyntaxhighlighter.h +++ b/src/gui/text/qsyntaxhighlighter.h @@ -66,7 +66,7 @@ class QTextEdit; class Q_GUI_EXPORT QSyntaxHighlighter : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QSyntaxHighlighter) + Q_DECLARE_SCOPED_PRIVATE(QSyntaxHighlighter) public: QSyntaxHighlighter(QObject *parent); QSyntaxHighlighter(QTextDocument *parent); diff --git a/src/gui/text/qtextcontrol_p.h b/src/gui/text/qtextcontrol_p.h index 872bcd5..8ba6a06 100644 --- a/src/gui/text/qtextcontrol_p.h +++ b/src/gui/text/qtextcontrol_p.h @@ -86,7 +86,7 @@ class QTimerEvent; class Q_AUTOTEST_EXPORT QTextControl : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QTextControl) + Q_DECLARE_SCOPED_PRIVATE(QTextControl) #ifndef QT_NO_TEXTHTMLPARSER Q_PROPERTY(QString html READ toHtml WRITE setHtml NOTIFY textChanged USER true) #endif diff --git a/src/gui/text/qtextdocument.h b/src/gui/text/qtextdocument.h index 40b6621..cfbb558 100644 --- a/src/gui/text/qtextdocument.h +++ b/src/gui/text/qtextdocument.h @@ -286,7 +286,7 @@ public: QTextDocumentPrivate *docHandle() const; private: Q_DISABLE_COPY(QTextDocument) - Q_DECLARE_PRIVATE(QTextDocument) + Q_DECLARE_SCOPED_PRIVATE(QTextDocument) friend class QTextObjectPrivate; }; diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp index ea37e04..71baa88 100644 --- a/src/gui/text/qtextdocument_p.cpp +++ b/src/gui/text/qtextdocument_p.cpp @@ -179,6 +179,7 @@ QTextDocumentPrivate::QTextDocumentPrivate() docChangeOldLength(0), docChangeLength(0), framesDirty(true), + rtFrame(0), initialBlockCharFormatIndex(-1) // set correctly later in init() { editBlock = 0; @@ -209,7 +210,6 @@ QTextDocumentPrivate::QTextDocumentPrivate() void QTextDocumentPrivate::init() { - rtFrame = 0; framesDirty = false; bool undoState = undoEnabled; @@ -232,42 +232,48 @@ void QTextDocumentPrivate::clear() } QListoldCursors = cursors; - cursors.clear(); - changedCursors.clear(); - - QMap::Iterator objectIt = objects.begin(); - while (objectIt != objects.end()) { - if (*objectIt != rtFrame) { - delete *objectIt; - objectIt = objects.erase(objectIt); - } else { - ++objectIt; + QT_TRY{ + cursors.clear(); + changedCursors.clear(); + + QMap::Iterator objectIt = objects.begin(); + while (objectIt != objects.end()) { + if (*objectIt != rtFrame) { + delete *objectIt; + objectIt = objects.erase(objectIt); + } else { + ++objectIt; + } } - } - // also clear out the remaining root frame pointer - // (we're going to delete the object further down) - objects.clear(); + // also clear out the remaining root frame pointer + // (we're going to delete the object further down) + objects.clear(); - title.clear(); - undoState = 0; - truncateUndoStack(); - text = QString(); - unreachableCharacterCount = 0; - modifiedState = 0; - modified = false; - formats = QTextFormatCollection(); - int len = fragments.length(); - fragments.clear(); - blocks.clear(); - cachedResources.clear(); - delete rtFrame; - init(); - cursors = oldCursors; - inContentsChange = true; - q->contentsChange(0, len, 0); - inContentsChange = false; - if (lout) - lout->documentChanged(0, len, 0); + title.clear(); + undoState = 0; + truncateUndoStack(); + text = QString(); + unreachableCharacterCount = 0; + modifiedState = 0; + modified = false; + formats = QTextFormatCollection(); + int len = fragments.length(); + fragments.clear(); + blocks.clear(); + cachedResources.clear(); + delete rtFrame; + rtFrame = 0; + init(); + cursors = oldCursors; + inContentsChange = true; + q->contentsChange(0, len, 0); + inContentsChange = false; + if (lout) + lout->documentChanged(0, len, 0); + } QT_CATCH(...) { + cursors = oldCursors; // at least recover the cursors + QT_RETHROW; + } } QTextDocumentPrivate::~QTextDocumentPrivate() diff --git a/src/gui/text/qtextdocumentlayout_p.h b/src/gui/text/qtextdocumentlayout_p.h index 41507b0..4dc18d0 100644 --- a/src/gui/text/qtextdocumentlayout_p.h +++ b/src/gui/text/qtextdocumentlayout_p.h @@ -65,7 +65,7 @@ class QTextDocumentLayoutPrivate; class Q_AUTOTEST_EXPORT QTextDocumentLayout : public QAbstractTextDocumentLayout { - Q_DECLARE_PRIVATE(QTextDocumentLayout) + Q_DECLARE_SCOPED_PRIVATE(QTextDocumentLayout) Q_OBJECT Q_PROPERTY(int cursorWidth READ cursorWidth WRITE setCursorWidth) Q_PROPERTY(qreal idealWidth READ idealWidth) diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp index 9bc62b1..9b91f7e 100644 --- a/src/gui/text/qtextformat.cpp +++ b/src/gui/text/qtextformat.cpp @@ -2996,12 +2996,18 @@ int QTextFormatCollection::indexForFormat(const QTextFormat &format) int idx = formats.size(); formats.append(format); - QTextFormat &f = formats.last(); - if (!f.d) - f.d = new QTextFormatPrivate; - f.d->resolveFont(defaultFnt); + QT_TRY{ + QTextFormat &f = formats.last(); + if (!f.d) + f.d = new QTextFormatPrivate; + f.d->resolveFont(defaultFnt); - hashes.insert(hash); + hashes.insert(hash); + + } QT_CATCH(...) { + formats.pop_back(); + QT_RETHROW; + } return idx; } diff --git a/src/gui/text/qtextlist.h b/src/gui/text/qtextlist.h index 04f1838..3d07be8 100644 --- a/src/gui/text/qtextlist.h +++ b/src/gui/text/qtextlist.h @@ -81,7 +81,7 @@ public: private: Q_DISABLE_COPY(QTextList) - Q_DECLARE_PRIVATE(QTextList) + Q_DECLARE_SCOPED_PRIVATE(QTextList) }; inline void QTextList::setFormat(const QTextListFormat &aformat) diff --git a/src/gui/text/qtextobject.h b/src/gui/text/qtextobject.h index 4f239b2..f22f77c 100644 --- a/src/gui/text/qtextobject.h +++ b/src/gui/text/qtextobject.h @@ -84,7 +84,7 @@ protected: QTextObject(QTextObjectPrivate &p, QTextDocument *doc); private: - Q_DECLARE_PRIVATE(QTextObject) + Q_DECLARE_SCOPED_PRIVATE(QTextObject) Q_DISABLE_COPY(QTextObject) friend class QTextDocumentPrivate; }; @@ -107,7 +107,7 @@ protected: protected: QTextBlockGroup(QTextBlockGroupPrivate &p, QTextDocument *doc); private: - Q_DECLARE_PRIVATE(QTextBlockGroup) + Q_DECLARE_SCOPED_PRIVATE(QTextBlockGroup) Q_DISABLE_COPY(QTextBlockGroup) friend class QTextDocumentPrivate; }; @@ -182,7 +182,7 @@ protected: QTextFrame(QTextFramePrivate &p, QTextDocument *doc); private: friend class QTextDocumentPrivate; - Q_DECLARE_PRIVATE(QTextFrame) + Q_DECLARE_SCOPED_PRIVATE(QTextFrame) Q_DISABLE_COPY(QTextFrame) }; Q_DECLARE_TYPEINFO(QTextFrame::iterator, Q_MOVABLE_TYPE); diff --git a/src/gui/text/qtexttable.cpp b/src/gui/text/qtexttable.cpp index 11ea2a7..160eb35 100644 --- a/src/gui/text/qtexttable.cpp +++ b/src/gui/text/qtexttable.cpp @@ -446,9 +446,7 @@ void QTextTablePrivate::update() const nRows = (cells.size() + nCols-1)/nCols; // qDebug(">>>> QTextTablePrivate::update, nRows=%d, nCols=%d", nRows, nCols); - int* newGrid = (int *)realloc(grid, nRows*nCols*sizeof(int)); - Q_CHECK_PTR(newGrid); - grid = newGrid; + grid = q_check_ptr((int *)realloc(grid, nRows*nCols*sizeof(int))); memset(grid, 0, nRows*nCols*sizeof(int)); QTextDocumentPrivate *p = pieceTable; @@ -472,9 +470,7 @@ void QTextTablePrivate::update() const cellIndices[i] = cell; if (r + rowspan > nRows) { - newGrid = (int *)realloc(grid, sizeof(int)*(r + rowspan)*nCols); - Q_CHECK_PTR(newGrid); - grid = newGrid; + grid = q_check_ptr((int *)realloc(grid, sizeof(int)*(r + rowspan)*nCols)); memset(grid + (nRows*nCols), 0, sizeof(int)*(r+rowspan-nRows)*nCols); nRows = r + rowspan; } diff --git a/src/gui/text/qtexttable.h b/src/gui/text/qtexttable.h index 612c71c..2deb3fa 100644 --- a/src/gui/text/qtexttable.h +++ b/src/gui/text/qtexttable.h @@ -134,7 +134,7 @@ public: private: Q_DISABLE_COPY(QTextTable) - Q_DECLARE_PRIVATE(QTextTable) + Q_DECLARE_SCOPED_PRIVATE(QTextTable) friend class QTextTableCell; }; diff --git a/src/gui/util/qcompleter.cpp b/src/gui/util/qcompleter.cpp index 8fe32bd..89cb283 100644 --- a/src/gui/util/qcompleter.cpp +++ b/src/gui/util/qcompleter.cpp @@ -158,7 +158,7 @@ QT_BEGIN_NAMESPACE QCompletionModel::QCompletionModel(QCompleterPrivate *c, QObject *parent) : QAbstractProxyModel(*new QCompletionModelPrivate, parent), - c(c), engine(0), showAll(false) + c(c), showAll(false) { createEngine(); } @@ -208,11 +208,10 @@ void QCompletionModel::createEngine() break; } - delete engine; if (sortedEngine) - engine = new QSortedModelEngine(c); + engine.reset(new QSortedModelEngine(c)); else - engine = new QUnsortedModelEngine(c); + engine.reset(new QUnsortedModelEngine(c)); } QModelIndex QCompletionModel::mapToSource(const QModelIndex& index) const diff --git a/src/gui/util/qcompleter.h b/src/gui/util/qcompleter.h index c1169ef..35ecc56 100644 --- a/src/gui/util/qcompleter.h +++ b/src/gui/util/qcompleter.h @@ -150,7 +150,7 @@ Q_SIGNALS: private: Q_DISABLE_COPY(QCompleter) - Q_DECLARE_PRIVATE(QCompleter) + Q_DECLARE_SCOPED_PRIVATE(QCompleter) Q_PRIVATE_SLOT(d_func(), void _q_complete(QModelIndex)) Q_PRIVATE_SLOT(d_func(), void _q_completionSelected(const QItemSelection&)) diff --git a/src/gui/util/qcompleter_p.h b/src/gui/util/qcompleter_p.h index dc4189f..def0235 100644 --- a/src/gui/util/qcompleter_p.h +++ b/src/gui/util/qcompleter_p.h @@ -213,7 +213,6 @@ class QCompletionModel : public QAbstractProxyModel public: QCompletionModel(QCompleterPrivate *c, QObject *parent); - ~QCompletionModel() { delete engine; } void createEngine(); void setFiltered(bool); @@ -236,10 +235,10 @@ public: QModelIndex mapFromSource(const QModelIndex& sourceIndex) const; QCompleterPrivate *c; - QCompletionEngine *engine; + QScopedPointer engine; bool showAll; - Q_DECLARE_PRIVATE(QCompletionModel) + Q_DECLARE_SCOPED_PRIVATE(QCompletionModel) signals: void rowsAdded(); diff --git a/src/gui/util/qdesktopservices_s60.cpp b/src/gui/util/qdesktopservices_s60.cpp index 77cf254..567b4ee 100644 --- a/src/gui/util/qdesktopservices_s60.cpp +++ b/src/gui/util/qdesktopservices_s60.cpp @@ -74,8 +74,31 @@ _LIT(KBrowserPrefix, "4 " ); _LIT(KFontsDir, "z:\\resource\\Fonts\\"); const TUid KUidBrowser = { 0x10008D39 }; -static void handleMailtoSchemeL(const QUrl &url) +template +class QAutoClose { +public: + QAutoClose(R& aObj) : mPtr(&aObj) {} + ~QAutoClose() + { + if (mPtr) + mPtr->Close(); + } + void Forget() + { + mPtr = 0; + } +private: + QAutoClose(const QAutoClose&); + QAutoClose& operator=(const QAutoClose&); +private: + R* mPtr; +}; + +static void handleMailtoSchemeLX(const QUrl &url) +{ + // this function has many intermingled leaves and throws. Qt and Symbian objects do not have + // destructor dependencies, and cleanup object is used to prevent cleanup stack dependency on stack. QString recipient = url.path(); QString subject = url.queryItemValue("subject"); QString body = url.queryItemValue("body"); @@ -84,15 +107,15 @@ static void handleMailtoSchemeL(const QUrl &url) QString bcc = url.queryItemValue("bcc"); // these fields might have comma separated addresses - QStringList recipients = recipient.split(","); - QStringList tos = to.split(","); - QStringList ccs = cc.split(","); - QStringList bccs = bcc.split(","); + QStringList recipients = recipient.split(",", QString::SkipEmptyParts); + QStringList tos = to.split(",", QString::SkipEmptyParts); + QStringList ccs = cc.split(",", QString::SkipEmptyParts); + QStringList bccs = bcc.split(",", QString::SkipEmptyParts); RSendAs sendAs; User::LeaveIfError(sendAs.Connect()); - CleanupClosePushL(sendAs); + QAutoClose sendAsCleanup(sendAs); CSendAsAccounts* accounts = CSendAsAccounts::NewL(); @@ -109,7 +132,7 @@ static void handleMailtoSchemeL(const QUrl &url) } else { RSendAsMessage sendAsMessage; sendAsMessage.CreateL(sendAs, KUidMsgTypeSMTP); - CleanupClosePushL(sendAsMessage); + QAutoClose sendAsMessageCleanup(sendAsMessage); // Subject @@ -135,17 +158,14 @@ static void handleMailtoSchemeL(const QUrl &url) // send the message sendAsMessage.LaunchEditorAndCloseL(); - - // sendAsMessage (already closed) - CleanupStack::Pop(); + // sendAsMessage is already closed + sendAsMessageCleanup.Forget(); } - // sendAs - CleanupStack::PopAndDestroy(); } static bool handleMailtoScheme(const QUrl &url) { - TRAPD(err, handleMailtoSchemeL(url)); + TRAPD(err, QT_TRYCATCH_LEAVING(handleMailtoSchemeLX(url))); return err ? false : true; } @@ -182,7 +202,9 @@ static void handleOtherSchemesL(const TDesC& aUrl) static bool handleOtherSchemes(const QUrl &url) { - TRAPD( err, handleOtherSchemesL(qt_QString2TPtrC(url.toEncoded()))); + QString encUrl(url.toEncoded()); + TPtrC urlPtr(qt_QString2TPtrC(encUrl)); + TRAPD( err, handleOtherSchemesL(urlPtr)); return err ? false : true; } @@ -276,7 +298,9 @@ static bool handleUrl(const QUrl &url) if (!url.isValid()) return false; - TRAPD( err, handleUrlL(qt_QString2TPtrC(url.toString()))); + QString urlString(url.toString()); + TPtrC urlPtr(qt_QString2TPtrC(urlString)); + TRAPD( err, handleUrlL(urlPtr)); return err ? false : true; } @@ -316,7 +340,8 @@ static bool openDocument(const QUrl &file) QString filePath = file.toLocalFile(); filePath = QDir::toNativeSeparators(filePath); - TRAPD(err, openDocumentL(qt_QString2TPtrC(filePath))); + TPtrC filePathPtr(qt_QString2TPtrC(filePath)); + TRAPD(err, openDocumentL(filePathPtr)); return err ? false : true; } diff --git a/src/gui/util/qsystemtrayicon.h b/src/gui/util/qsystemtrayicon.h index 0f1e2d2..ac90487 100644 --- a/src/gui/util/qsystemtrayicon.h +++ b/src/gui/util/qsystemtrayicon.h @@ -117,7 +117,7 @@ protected: private: Q_DISABLE_COPY(QSystemTrayIcon) - Q_DECLARE_PRIVATE(QSystemTrayIcon) + Q_DECLARE_SCOPED_PRIVATE(QSystemTrayIcon) friend class QSystemTrayIconSys; friend class QBalloonTip; diff --git a/src/gui/util/qundogroup.h b/src/gui/util/qundogroup.h index ddab6e0..24d4e12 100644 --- a/src/gui/util/qundogroup.h +++ b/src/gui/util/qundogroup.h @@ -60,7 +60,7 @@ QT_MODULE(Gui) class Q_GUI_EXPORT QUndoGroup : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QUndoGroup) + Q_DECLARE_SCOPED_PRIVATE(QUndoGroup) public: explicit QUndoGroup(QObject *parent = 0); diff --git a/src/gui/util/qundostack.h b/src/gui/util/qundostack.h index 8efad0e..8ad4b198 100644 --- a/src/gui/util/qundostack.h +++ b/src/gui/util/qundostack.h @@ -90,7 +90,7 @@ private: class Q_GUI_EXPORT QUndoStack : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QUndoStack) + Q_DECLARE_SCOPED_PRIVATE(QUndoStack) Q_PROPERTY(bool active READ isActive WRITE setActive) Q_PROPERTY(int undoLimit READ undoLimit WRITE setUndoLimit) diff --git a/src/gui/util/qundoview.h b/src/gui/util/qundoview.h index fa0c163..293c0c2 100644 --- a/src/gui/util/qundoview.h +++ b/src/gui/util/qundoview.h @@ -61,7 +61,7 @@ QT_MODULE(Gui) class Q_GUI_EXPORT QUndoView : public QListView { Q_OBJECT - Q_DECLARE_PRIVATE(QUndoView) + Q_DECLARE_SCOPED_PRIVATE(QUndoView) Q_PROPERTY(QString emptyLabel READ emptyLabel WRITE setEmptyLabel) Q_PROPERTY(QIcon cleanIcon READ cleanIcon WRITE setCleanIcon) diff --git a/src/gui/widgets/qabstractbutton.h b/src/gui/widgets/qabstractbutton.h index 29e9bf9..9e33479 100644 --- a/src/gui/widgets/qabstractbutton.h +++ b/src/gui/widgets/qabstractbutton.h @@ -168,7 +168,7 @@ protected: QAbstractButton(QAbstractButtonPrivate &dd, QWidget* parent = 0); private: - Q_DECLARE_PRIVATE(QAbstractButton) + Q_DECLARE_SCOPED_PRIVATE(QAbstractButton) Q_DISABLE_COPY(QAbstractButton) friend class QButtonGroup; }; diff --git a/src/gui/widgets/qabstractscrollarea.h b/src/gui/widgets/qabstractscrollarea.h index 3ec41d1..9a7e844 100644 --- a/src/gui/widgets/qabstractscrollarea.h +++ b/src/gui/widgets/qabstractscrollarea.h @@ -123,7 +123,7 @@ protected: virtual void scrollContentsBy(int dx, int dy); private: - Q_DECLARE_PRIVATE(QAbstractScrollArea) + Q_DECLARE_SCOPED_PRIVATE(QAbstractScrollArea) Q_DISABLE_COPY(QAbstractScrollArea) Q_PRIVATE_SLOT(d_func(), void _q_hslide(int)) Q_PRIVATE_SLOT(d_func(), void _q_vslide(int)) diff --git a/src/gui/widgets/qabstractslider.h b/src/gui/widgets/qabstractslider.h index 7e03b6e..6517944 100644 --- a/src/gui/widgets/qabstractslider.h +++ b/src/gui/widgets/qabstractslider.h @@ -174,7 +174,7 @@ protected: private: Q_DISABLE_COPY(QAbstractSlider) - Q_DECLARE_PRIVATE(QAbstractSlider) + Q_DECLARE_SCOPED_PRIVATE(QAbstractSlider) }; QT_END_NAMESPACE diff --git a/src/gui/widgets/qabstractspinbox.h b/src/gui/widgets/qabstractspinbox.h index e65f27b..2e8f7f9 100644 --- a/src/gui/widgets/qabstractspinbox.h +++ b/src/gui/widgets/qabstractspinbox.h @@ -165,7 +165,7 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_editorTextChanged(const QString &)) Q_PRIVATE_SLOT(d_func(), void _q_editorCursorPositionChanged(int, int)) - Q_DECLARE_PRIVATE(QAbstractSpinBox) + Q_DECLARE_SCOPED_PRIVATE(QAbstractSpinBox) Q_DISABLE_COPY(QAbstractSpinBox) }; Q_DECLARE_OPERATORS_FOR_FLAGS(QAbstractSpinBox::StepEnabled) diff --git a/src/gui/widgets/qbuttongroup.h b/src/gui/widgets/qbuttongroup.h index 708c91c..fca1524 100644 --- a/src/gui/widgets/qbuttongroup.h +++ b/src/gui/widgets/qbuttongroup.h @@ -98,7 +98,7 @@ public: private: Q_DISABLE_COPY(QButtonGroup) - Q_DECLARE_PRIVATE(QButtonGroup) + Q_DECLARE_SCOPED_PRIVATE(QButtonGroup) friend class QAbstractButton; friend class QAbstractButtonPrivate; }; diff --git a/src/gui/widgets/qcalendarwidget.h b/src/gui/widgets/qcalendarwidget.h index f567180..edd1511 100644 --- a/src/gui/widgets/qcalendarwidget.h +++ b/src/gui/widgets/qcalendarwidget.h @@ -179,7 +179,7 @@ Q_SIGNALS: void currentPageChanged(int year, int month); private: - Q_DECLARE_PRIVATE(QCalendarWidget) + Q_DECLARE_SCOPED_PRIVATE(QCalendarWidget) Q_DISABLE_COPY(QCalendarWidget) Q_PRIVATE_SLOT(d_func(), void _q_slotShowDate(const QDate &date)) diff --git a/src/gui/widgets/qcheckbox.h b/src/gui/widgets/qcheckbox.h index 1d61783..cd41626 100644 --- a/src/gui/widgets/qcheckbox.h +++ b/src/gui/widgets/qcheckbox.h @@ -102,7 +102,7 @@ public: #endif private: - Q_DECLARE_PRIVATE(QCheckBox) + Q_DECLARE_SCOPED_PRIVATE(QCheckBox) Q_DISABLE_COPY(QCheckBox) }; diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp index 7b91731..65a4279 100644 --- a/src/gui/widgets/qcombobox.cpp +++ b/src/gui/widgets/qcombobox.cpp @@ -1249,8 +1249,12 @@ QComboBox::~QComboBox() // ### check delegateparent and delete delegate if us? Q_D(QComboBox); - disconnect(d->model, SIGNAL(destroyed()), - this, SLOT(_q_modelDestroyed())); + QT_TRY { + disconnect(d->model, SIGNAL(destroyed()), + this, SLOT(_q_modelDestroyed())); + } QT_CATCH(...) { + ; // objects can't throw in destructor + } } /*! diff --git a/src/gui/widgets/qcombobox.h b/src/gui/widgets/qcombobox.h index 22f6928..2807a4f 100644 --- a/src/gui/widgets/qcombobox.h +++ b/src/gui/widgets/qcombobox.h @@ -300,7 +300,7 @@ protected: QComboBox(QComboBoxPrivate &, QWidget *); private: - Q_DECLARE_PRIVATE(QComboBox) + Q_DECLARE_SCOPED_PRIVATE(QComboBox) Q_DISABLE_COPY(QComboBox) Q_PRIVATE_SLOT(d_func(), void _q_itemSelected(const QModelIndex &item)) Q_PRIVATE_SLOT(d_func(), void _q_emitHighlighted(const QModelIndex &)) diff --git a/src/gui/widgets/qcommandlinkbutton.h b/src/gui/widgets/qcommandlinkbutton.h index bf30242..5191252 100644 --- a/src/gui/widgets/qcommandlinkbutton.h +++ b/src/gui/widgets/qcommandlinkbutton.h @@ -75,7 +75,7 @@ protected: private: Q_DISABLE_COPY(QCommandLinkButton) - Q_DECLARE_PRIVATE(QCommandLinkButton) + Q_DECLARE_SCOPED_PRIVATE(QCommandLinkButton) }; QT_END_NAMESPACE diff --git a/src/gui/widgets/qdatetimeedit.h b/src/gui/widgets/qdatetimeedit.h index e43a3fa..1e4c621 100644 --- a/src/gui/widgets/qdatetimeedit.h +++ b/src/gui/widgets/qdatetimeedit.h @@ -197,7 +197,7 @@ protected: QDateTimeEdit(const QVariant &val, QVariant::Type parserType, QWidget *parent = 0); private: - Q_DECLARE_PRIVATE(QDateTimeEdit) + Q_DECLARE_SCOPED_PRIVATE(QDateTimeEdit) Q_DISABLE_COPY(QDateTimeEdit) Q_PRIVATE_SLOT(d_func(), void _q_resetButton()) diff --git a/src/gui/widgets/qdial.h b/src/gui/widgets/qdial.h index 91b8c5e..f07999b 100644 --- a/src/gui/widgets/qdial.h +++ b/src/gui/widgets/qdial.h @@ -109,7 +109,7 @@ Q_SIGNALS: #endif private: - Q_DECLARE_PRIVATE(QDial) + Q_DECLARE_SCOPED_PRIVATE(QDial) Q_DISABLE_COPY(QDial) }; diff --git a/src/gui/widgets/qdialogbuttonbox.h b/src/gui/widgets/qdialogbuttonbox.h index df40a66..97a6a59 100644 --- a/src/gui/widgets/qdialogbuttonbox.h +++ b/src/gui/widgets/qdialogbuttonbox.h @@ -154,7 +154,7 @@ protected: private: Q_DISABLE_COPY(QDialogButtonBox) - Q_DECLARE_PRIVATE(QDialogButtonBox) + Q_DECLARE_SCOPED_PRIVATE(QDialogButtonBox) Q_PRIVATE_SLOT(d_func(), void _q_handleButtonClicked()) Q_PRIVATE_SLOT(d_func(), void _q_handleButtonDestroyed()) }; diff --git a/src/gui/widgets/qdockwidget.h b/src/gui/widgets/qdockwidget.h index f0c0b46..b1abbdd 100644 --- a/src/gui/widgets/qdockwidget.h +++ b/src/gui/widgets/qdockwidget.h @@ -124,7 +124,7 @@ protected: void initStyleOption(QStyleOptionDockWidget *option) const; private: - Q_DECLARE_PRIVATE(QDockWidget) + Q_DECLARE_SCOPED_PRIVATE(QDockWidget) Q_DISABLE_COPY(QDockWidget) Q_PRIVATE_SLOT(d_func(), void _q_toggleView(bool)) Q_PRIVATE_SLOT(d_func(), void _q_toggleTopLevel()) diff --git a/src/gui/widgets/qfocusframe.h b/src/gui/widgets/qfocusframe.h index 139374c..e496343 100644 --- a/src/gui/widgets/qfocusframe.h +++ b/src/gui/widgets/qfocusframe.h @@ -71,7 +71,7 @@ protected: void initStyleOption(QStyleOption *option) const; private: - Q_DECLARE_PRIVATE(QFocusFrame) + Q_DECLARE_SCOPED_PRIVATE(QFocusFrame) Q_DISABLE_COPY(QFocusFrame) }; diff --git a/src/gui/widgets/qfontcombobox.h b/src/gui/widgets/qfontcombobox.h index 6034881..41f9d72 100644 --- a/src/gui/widgets/qfontcombobox.h +++ b/src/gui/widgets/qfontcombobox.h @@ -97,7 +97,7 @@ protected: private: Q_DISABLE_COPY(QFontComboBox) - Q_DECLARE_PRIVATE(QFontComboBox) + Q_DECLARE_SCOPED_PRIVATE(QFontComboBox) Q_PRIVATE_SLOT(d_func(), void _q_currentChanged(const QString &)) Q_PRIVATE_SLOT(d_func(), void _q_updateModel()) }; diff --git a/src/gui/widgets/qframe.h b/src/gui/widgets/qframe.h index 7b6073b..f8776c6 100644 --- a/src/gui/widgets/qframe.h +++ b/src/gui/widgets/qframe.h @@ -138,7 +138,7 @@ protected: private: Q_DISABLE_COPY(QFrame) - Q_DECLARE_PRIVATE(QFrame) + Q_DECLARE_SCOPED_PRIVATE(QFrame) }; QT_END_NAMESPACE diff --git a/src/gui/widgets/qgroupbox.h b/src/gui/widgets/qgroupbox.h index d3f76e1..c4bef6e 100644 --- a/src/gui/widgets/qgroupbox.h +++ b/src/gui/widgets/qgroupbox.h @@ -109,7 +109,7 @@ public: private: Q_DISABLE_COPY(QGroupBox) - Q_DECLARE_PRIVATE(QGroupBox) + Q_DECLARE_SCOPED_PRIVATE(QGroupBox) Q_PRIVATE_SLOT(d_func(), void _q_setChildrenEnabled(bool b)) }; diff --git a/src/gui/widgets/qlabel.h b/src/gui/widgets/qlabel.h index b7a7c11..520d661 100644 --- a/src/gui/widgets/qlabel.h +++ b/src/gui/widgets/qlabel.h @@ -156,7 +156,7 @@ public: private: Q_DISABLE_COPY(QLabel) - Q_DECLARE_PRIVATE(QLabel) + Q_DECLARE_SCOPED_PRIVATE(QLabel) #ifndef QT_NO_MOVIE Q_PRIVATE_SLOT(d_func(), void _q_movieUpdated(const QRect&)) Q_PRIVATE_SLOT(d_func(), void _q_movieResized(const QSize&)) diff --git a/src/gui/widgets/qlcdnumber.h b/src/gui/widgets/qlcdnumber.h index 1437427..3d7cf43 100644 --- a/src/gui/widgets/qlcdnumber.h +++ b/src/gui/widgets/qlcdnumber.h @@ -128,7 +128,7 @@ public: private: Q_DISABLE_COPY(QLCDNumber) - Q_DECLARE_PRIVATE(QLCDNumber) + Q_DECLARE_SCOPED_PRIVATE(QLCDNumber) }; #endif // QT_NO_LCDNUMBER diff --git a/src/gui/widgets/qlineedit.h b/src/gui/widgets/qlineedit.h index a97dc9a..0d01253 100644 --- a/src/gui/widgets/qlineedit.h +++ b/src/gui/widgets/qlineedit.h @@ -265,7 +265,7 @@ private: friend class QDateTimeEdit; #endif Q_DISABLE_COPY(QLineEdit) - Q_DECLARE_PRIVATE(QLineEdit) + Q_DECLARE_SCOPED_PRIVATE(QLineEdit) Q_PRIVATE_SLOT(d_func(), void _q_handleWindowActivate()) Q_PRIVATE_SLOT(d_func(), void _q_deleteSelected()) #ifndef QT_NO_COMPLETER diff --git a/src/gui/widgets/qmaccocoaviewcontainer_mac.h b/src/gui/widgets/qmaccocoaviewcontainer_mac.h index 8ca1073..0fdaac5 100644 --- a/src/gui/widgets/qmaccocoaviewcontainer_mac.h +++ b/src/gui/widgets/qmaccocoaviewcontainer_mac.h @@ -63,7 +63,7 @@ public: void *cocoaView() const; private: - Q_DECLARE_PRIVATE(QMacCocoaViewContainer) + Q_DECLARE_SCOPED_PRIVATE(QMacCocoaViewContainer) }; QT_END_NAMESPACE diff --git a/src/gui/widgets/qmacnativewidget_mac.h b/src/gui/widgets/qmacnativewidget_mac.h index 5c654b5..904108e 100644 --- a/src/gui/widgets/qmacnativewidget_mac.h +++ b/src/gui/widgets/qmacnativewidget_mac.h @@ -64,7 +64,7 @@ protected: bool event(QEvent *ev); private: - Q_DECLARE_PRIVATE(QMacNativeWidget) + Q_DECLARE_SCOPED_PRIVATE(QMacNativeWidget) }; QT_END_NAMESPACE diff --git a/src/gui/widgets/qmainwindow.h b/src/gui/widgets/qmainwindow.h index 9c2fb88..a221131 100644 --- a/src/gui/widgets/qmainwindow.h +++ b/src/gui/widgets/qmainwindow.h @@ -202,7 +202,7 @@ protected: bool event(QEvent *event); private: - Q_DECLARE_PRIVATE(QMainWindow) + Q_DECLARE_SCOPED_PRIVATE(QMainWindow) Q_DISABLE_COPY(QMainWindow) }; diff --git a/src/gui/widgets/qmdiarea.h b/src/gui/widgets/qmdiarea.h index 9f1014e..f64397b 100644 --- a/src/gui/widgets/qmdiarea.h +++ b/src/gui/widgets/qmdiarea.h @@ -153,7 +153,7 @@ protected: private: Q_DISABLE_COPY(QMdiArea) - Q_DECLARE_PRIVATE(QMdiArea) + Q_DECLARE_SCOPED_PRIVATE(QMdiArea) Q_PRIVATE_SLOT(d_func(), void _q_deactivateAllWindows()) Q_PRIVATE_SLOT(d_func(), void _q_processWindowStateChanged(Qt::WindowStates, Qt::WindowStates)) Q_PRIVATE_SLOT(d_func(), void _q_currentTabChanged(int index)) diff --git a/src/gui/widgets/qmdisubwindow.h b/src/gui/widgets/qmdisubwindow.h index 924cc9a..bfb523d 100644 --- a/src/gui/widgets/qmdisubwindow.h +++ b/src/gui/widgets/qmdisubwindow.h @@ -137,7 +137,7 @@ protected: private: Q_DISABLE_COPY(QMdiSubWindow) - Q_DECLARE_PRIVATE(QMdiSubWindow) + Q_DECLARE_SCOPED_PRIVATE(QMdiSubWindow) Q_PRIVATE_SLOT(d_func(), void _q_updateStaysOnTopHint()) Q_PRIVATE_SLOT(d_func(), void _q_enterInteractiveMode()) Q_PRIVATE_SLOT(d_func(), void _q_processFocusChanged(QWidget *, QWidget *)) diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index 43dc33a..f1cbd65 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -144,7 +144,7 @@ public slots: void onTrigger(QAction *action) { d_func()->activateAction(action, QAction::Trigger, false); } void onHovered(QAction *action) { d_func()->activateAction(action, QAction::Hover, false); } private: - Q_DECLARE_PRIVATE(QTornOffMenu) + Q_DECLARE_SCOPED_PRIVATE(QTornOffMenu) friend class QMenuPrivate; }; diff --git a/src/gui/widgets/qmenu.h b/src/gui/widgets/qmenu.h index 41890c4..9f9cdf5 100644 --- a/src/gui/widgets/qmenu.h +++ b/src/gui/widgets/qmenu.h @@ -77,7 +77,7 @@ class Q_GUI_EXPORT QMenu : public QWidget { private: Q_OBJECT - Q_DECLARE_PRIVATE(QMenu) + Q_DECLARE_SCOPED_PRIVATE(QMenu) Q_PROPERTY(bool tearOffEnabled READ isTearOffEnabled WRITE setTearOffEnabled) Q_PROPERTY(QString title READ title WRITE setTitle) diff --git a/src/gui/widgets/qmenu_symbian.cpp b/src/gui/widgets/qmenu_symbian.cpp index 76057e7..5207cc6 100644 --- a/src/gui/widgets/qmenu_symbian.cpp +++ b/src/gui/widgets/qmenu_symbian.cpp @@ -244,7 +244,7 @@ Q_GUI_EXPORT void qt_symbian_show_toplevel( CEikMenuPane* menuPane) return; rebuildMenu(); for (int i = 0; i < symbianMenus.count(); ++i) - menuPane->AddMenuItemL(symbianMenus.at(i)->menuItemData); + QT_TRAP_THROWING(menuPane->AddMenuItemL(symbianMenus.at(i)->menuItemData)); } Q_GUI_EXPORT void qt_symbian_show_submenu( CEikMenuPane* menuPane, int id) @@ -252,7 +252,7 @@ Q_GUI_EXPORT void qt_symbian_show_submenu( CEikMenuPane* menuPane, int id) SymbianMenuItem* menu = qt_symbian_find_menu(id, symbianMenus); if (menu) { for (int i = 0; i < menu->children.count(); ++i) - menuPane->AddMenuItemL(menu->children.at(i)->menuItemData); + QT_TRAP_THROWING(menuPane->AddMenuItemL(menu->children.at(i)->menuItemData)); } } diff --git a/src/gui/widgets/qmenubar.h b/src/gui/widgets/qmenubar.h index 1fda1c1..ddd2d67 100644 --- a/src/gui/widgets/qmenubar.h +++ b/src/gui/widgets/qmenubar.h @@ -336,7 +336,7 @@ private: #endif private: - Q_DECLARE_PRIVATE(QMenuBar) + Q_DECLARE_SCOPED_PRIVATE(QMenuBar) Q_DISABLE_COPY(QMenuBar) Q_PRIVATE_SLOT(d_func(), void _q_actionTriggered()) Q_PRIVATE_SLOT(d_func(), void _q_actionHovered()) diff --git a/src/gui/widgets/qplaintextedit.h b/src/gui/widgets/qplaintextedit.h index dc0851b..2366a29 100644 --- a/src/gui/widgets/qplaintextedit.h +++ b/src/gui/widgets/qplaintextedit.h @@ -69,7 +69,7 @@ class QMimeData; class Q_GUI_EXPORT QPlainTextEdit : public QAbstractScrollArea { Q_OBJECT - Q_DECLARE_PRIVATE(QPlainTextEdit) + Q_DECLARE_SCOPED_PRIVATE(QPlainTextEdit) Q_ENUMS(LineWrapMode) Q_PROPERTY(bool tabChangesFocus READ tabChangesFocus WRITE setTabChangesFocus) Q_PROPERTY(QString documentTitle READ documentTitle WRITE setDocumentTitle) @@ -277,7 +277,7 @@ class QPlainTextDocumentLayoutPrivate; class Q_GUI_EXPORT QPlainTextDocumentLayout : public QAbstractTextDocumentLayout { Q_OBJECT - Q_DECLARE_PRIVATE(QPlainTextDocumentLayout) + Q_DECLARE_SCOPED_PRIVATE(QPlainTextDocumentLayout) Q_PROPERTY(int cursorWidth READ cursorWidth WRITE setCursorWidth) public: diff --git a/src/gui/widgets/qprintpreviewwidget.h b/src/gui/widgets/qprintpreviewwidget.h index d74bf93..240306f 100644 --- a/src/gui/widgets/qprintpreviewwidget.h +++ b/src/gui/widgets/qprintpreviewwidget.h @@ -58,7 +58,7 @@ class QPrintPreviewWidgetPrivate; class Q_GUI_EXPORT QPrintPreviewWidget : public QWidget { Q_OBJECT - Q_DECLARE_PRIVATE(QPrintPreviewWidget) + Q_DECLARE_SCOPED_PRIVATE(QPrintPreviewWidget) public: enum ViewMode { diff --git a/src/gui/widgets/qprogressbar.h b/src/gui/widgets/qprogressbar.h index 5ac6b85..de995b6 100644 --- a/src/gui/widgets/qprogressbar.h +++ b/src/gui/widgets/qprogressbar.h @@ -117,7 +117,7 @@ protected: void initStyleOption(QStyleOptionProgressBar *option) const; private: - Q_DECLARE_PRIVATE(QProgressBar) + Q_DECLARE_SCOPED_PRIVATE(QProgressBar) Q_DISABLE_COPY(QProgressBar) }; diff --git a/src/gui/widgets/qpushbutton.h b/src/gui/widgets/qpushbutton.h index 2264cc3..1b4cb95 100644 --- a/src/gui/widgets/qpushbutton.h +++ b/src/gui/widgets/qpushbutton.h @@ -111,7 +111,7 @@ public: private: Q_DISABLE_COPY(QPushButton) - Q_DECLARE_PRIVATE(QPushButton) + Q_DECLARE_SCOPED_PRIVATE(QPushButton) #ifndef QT_NO_MENU Q_PRIVATE_SLOT(d_func(), void _q_popupPressed()) #endif diff --git a/src/gui/widgets/qradiobutton.h b/src/gui/widgets/qradiobutton.h index e631bab..d2eaa4d 100644 --- a/src/gui/widgets/qradiobutton.h +++ b/src/gui/widgets/qradiobutton.h @@ -77,7 +77,7 @@ public: #endif private: - Q_DECLARE_PRIVATE(QRadioButton) + Q_DECLARE_SCOPED_PRIVATE(QRadioButton) Q_DISABLE_COPY(QRadioButton) }; diff --git a/src/gui/widgets/qrubberband.h b/src/gui/widgets/qrubberband.h index 1e638fd..629bc29 100644 --- a/src/gui/widgets/qrubberband.h +++ b/src/gui/widgets/qrubberband.h @@ -87,7 +87,7 @@ protected: void initStyleOption(QStyleOptionRubberBand *option) const; private: - Q_DECLARE_PRIVATE(QRubberBand) + Q_DECLARE_SCOPED_PRIVATE(QRubberBand) }; inline void QRubberBand::setGeometry(int ax, int ay, int aw, int ah) diff --git a/src/gui/widgets/qscrollarea.h b/src/gui/widgets/qscrollarea.h index d713e15..d2179b8 100644 --- a/src/gui/widgets/qscrollarea.h +++ b/src/gui/widgets/qscrollarea.h @@ -88,7 +88,7 @@ protected: void scrollContentsBy(int dx, int dy); private: - Q_DECLARE_PRIVATE(QScrollArea) + Q_DECLARE_SCOPED_PRIVATE(QScrollArea) Q_DISABLE_COPY(QScrollArea) }; diff --git a/src/gui/widgets/qscrollbar.h b/src/gui/widgets/qscrollbar.h index 9d25359..b9302b3 100644 --- a/src/gui/widgets/qscrollbar.h +++ b/src/gui/widgets/qscrollbar.h @@ -92,7 +92,7 @@ private: friend Q_GUI_EXPORT QStyleOptionSlider qt_qscrollbarStyleOption(QScrollBar *scrollBar); Q_DISABLE_COPY(QScrollBar) - Q_DECLARE_PRIVATE(QScrollBar) + Q_DECLARE_SCOPED_PRIVATE(QScrollBar) }; #endif // QT_NO_SCROLLBAR diff --git a/src/gui/widgets/qsizegrip.h b/src/gui/widgets/qsizegrip.h index 5a0fb3b..7e9e6ac 100644 --- a/src/gui/widgets/qsizegrip.h +++ b/src/gui/widgets/qsizegrip.h @@ -82,7 +82,7 @@ public: #endif private: - Q_DECLARE_PRIVATE(QSizeGrip) + Q_DECLARE_SCOPED_PRIVATE(QSizeGrip) Q_DISABLE_COPY(QSizeGrip) Q_PRIVATE_SLOT(d_func(), void _q_showIfNotHidden()) }; diff --git a/src/gui/widgets/qslider.h b/src/gui/widgets/qslider.h index 18c2603..3ff3889 100644 --- a/src/gui/widgets/qslider.h +++ b/src/gui/widgets/qslider.h @@ -122,7 +122,7 @@ private: friend Q_GUI_EXPORT QStyleOptionSlider qt_qsliderStyleOption(QSlider *slider); Q_DISABLE_COPY(QSlider) - Q_DECLARE_PRIVATE(QSlider) + Q_DECLARE_SCOPED_PRIVATE(QSlider) }; #endif // QT_NO_SLIDER diff --git a/src/gui/widgets/qspinbox.h b/src/gui/widgets/qspinbox.h index a168528..96d7b96 100644 --- a/src/gui/widgets/qspinbox.h +++ b/src/gui/widgets/qspinbox.h @@ -119,7 +119,7 @@ Q_SIGNALS: private: Q_DISABLE_COPY(QSpinBox) - Q_DECLARE_PRIVATE(QSpinBox) + Q_DECLARE_SCOPED_PRIVATE(QSpinBox) }; class QDoubleSpinBoxPrivate; @@ -176,7 +176,7 @@ Q_SIGNALS: private: Q_DISABLE_COPY(QDoubleSpinBox) - Q_DECLARE_PRIVATE(QDoubleSpinBox) + Q_DECLARE_SCOPED_PRIVATE(QDoubleSpinBox) }; #endif // QT_NO_SPINBOX diff --git a/src/gui/widgets/qsplashscreen.h b/src/gui/widgets/qsplashscreen.h index d7c521c..23d4d34 100644 --- a/src/gui/widgets/qsplashscreen.h +++ b/src/gui/widgets/qsplashscreen.h @@ -87,7 +87,7 @@ protected: private: Q_DISABLE_COPY(QSplashScreen) - Q_DECLARE_PRIVATE(QSplashScreen) + Q_DECLARE_SCOPED_PRIVATE(QSplashScreen) }; #endif // QT_NO_SPLASHSCREEN diff --git a/src/gui/widgets/qsplitter.h b/src/gui/widgets/qsplitter.h index ad5620e..5f16db2 100644 --- a/src/gui/widgets/qsplitter.h +++ b/src/gui/widgets/qsplitter.h @@ -142,7 +142,7 @@ public: private: Q_DISABLE_COPY(QSplitter) - Q_DECLARE_PRIVATE(QSplitter) + Q_DECLARE_SCOPED_PRIVATE(QSplitter) private: friend class QSplitterHandle; }; @@ -179,7 +179,7 @@ protected: private: Q_DISABLE_COPY(QSplitterHandle) - Q_DECLARE_PRIVATE(QSplitterHandle) + Q_DECLARE_SCOPED_PRIVATE(QSplitterHandle) }; #endif // QT_NO_SPLITTER diff --git a/src/gui/widgets/qstackedwidget.h b/src/gui/widgets/qstackedwidget.h index 95d6d9f..6dd21bb 100644 --- a/src/gui/widgets/qstackedwidget.h +++ b/src/gui/widgets/qstackedwidget.h @@ -88,7 +88,7 @@ protected: private: Q_DISABLE_COPY(QStackedWidget) - Q_DECLARE_PRIVATE(QStackedWidget) + Q_DECLARE_SCOPED_PRIVATE(QStackedWidget) }; #endif // QT_NO_STACKEDWIDGET diff --git a/src/gui/widgets/qstatusbar.h b/src/gui/widgets/qstatusbar.h index 86d1cda..28cb2a9 100644 --- a/src/gui/widgets/qstatusbar.h +++ b/src/gui/widgets/qstatusbar.h @@ -104,7 +104,7 @@ protected: private: Q_DISABLE_COPY(QStatusBar) - Q_DECLARE_PRIVATE(QStatusBar) + Q_DECLARE_SCOPED_PRIVATE(QStatusBar) }; #endif // QT_NO_STATUSBAR diff --git a/src/gui/widgets/qtabbar.h b/src/gui/widgets/qtabbar.h index 7514486..23d914e 100644 --- a/src/gui/widgets/qtabbar.h +++ b/src/gui/widgets/qtabbar.h @@ -212,7 +212,7 @@ Q_SIGNALS: friend class QAccessibleTabBar; private: Q_DISABLE_COPY(QTabBar) - Q_DECLARE_PRIVATE(QTabBar) + Q_DECLARE_SCOPED_PRIVATE(QTabBar) Q_PRIVATE_SLOT(d_func(), void _q_scrollTabs()) Q_PRIVATE_SLOT(d_func(), void _q_closeTab()) Q_PRIVATE_SLOT(d_func(), void _q_moveTab(int)) diff --git a/src/gui/widgets/qtabwidget.h b/src/gui/widgets/qtabwidget.h index 10150af..138a612 100644 --- a/src/gui/widgets/qtabwidget.h +++ b/src/gui/widgets/qtabwidget.h @@ -234,7 +234,7 @@ Q_SIGNALS: #endif // QT3_SUPPORT private: - Q_DECLARE_PRIVATE(QTabWidget) + Q_DECLARE_SCOPED_PRIVATE(QTabWidget) Q_DISABLE_COPY(QTabWidget) Q_PRIVATE_SLOT(d_func(), void _q_showTab(int)) Q_PRIVATE_SLOT(d_func(), void _q_removeTab(int)) diff --git a/src/gui/widgets/qtextbrowser.h b/src/gui/widgets/qtextbrowser.h index d5bd956..b9a501f 100644 --- a/src/gui/widgets/qtextbrowser.h +++ b/src/gui/widgets/qtextbrowser.h @@ -125,7 +125,7 @@ public: private: Q_DISABLE_COPY(QTextBrowser) - Q_DECLARE_PRIVATE(QTextBrowser) + Q_DECLARE_SCOPED_PRIVATE(QTextBrowser) Q_PRIVATE_SLOT(d_func(), void _q_documentModified()) Q_PRIVATE_SLOT(d_func(), void _q_activateAnchor(const QString &)) Q_PRIVATE_SLOT(d_func(), void _q_highlightLink(const QString &)) diff --git a/src/gui/widgets/qtextedit.h b/src/gui/widgets/qtextedit.h index 617822a..c1c6360 100644 --- a/src/gui/widgets/qtextedit.h +++ b/src/gui/widgets/qtextedit.h @@ -70,7 +70,7 @@ class QMimeData; class Q_GUI_EXPORT QTextEdit : public QAbstractScrollArea { Q_OBJECT - Q_DECLARE_PRIVATE(QTextEdit) + Q_DECLARE_SCOPED_PRIVATE(QTextEdit) Q_FLAGS(AutoFormatting) Q_ENUMS(LineWrapMode) Q_PROPERTY(AutoFormatting autoFormatting READ autoFormatting WRITE setAutoFormatting) diff --git a/src/gui/widgets/qtoolbar.h b/src/gui/widgets/qtoolbar.h index 2ab4ffd..590a345 100644 --- a/src/gui/widgets/qtoolbar.h +++ b/src/gui/widgets/qtoolbar.h @@ -162,7 +162,7 @@ public: #endif private: - Q_DECLARE_PRIVATE(QToolBar) + Q_DECLARE_SCOPED_PRIVATE(QToolBar) Q_DISABLE_COPY(QToolBar) Q_PRIVATE_SLOT(d_func(), void _q_toggleView(bool)) Q_PRIVATE_SLOT(d_func(), void _q_updateIconSize(const QSize &)) diff --git a/src/gui/widgets/qtoolbox.h b/src/gui/widgets/qtoolbox.h index 2c38967..242efa6 100644 --- a/src/gui/widgets/qtoolbox.h +++ b/src/gui/widgets/qtoolbox.h @@ -124,7 +124,7 @@ public: #endif private: - Q_DECLARE_PRIVATE(QToolBox) + Q_DECLARE_SCOPED_PRIVATE(QToolBox) Q_DISABLE_COPY(QToolBox) Q_PRIVATE_SLOT(d_func(), void _q_buttonClicked()) Q_PRIVATE_SLOT(d_func(), void _q_widgetDestroyed(QObject*)) diff --git a/src/gui/widgets/qtoolbutton.h b/src/gui/widgets/qtoolbutton.h index 1e7d678..7286096 100644 --- a/src/gui/widgets/qtoolbutton.h +++ b/src/gui/widgets/qtoolbutton.h @@ -127,7 +127,7 @@ protected: private: Q_DISABLE_COPY(QToolButton) - Q_DECLARE_PRIVATE(QToolButton) + Q_DECLARE_SCOPED_PRIVATE(QToolButton) #ifndef QT_NO_MENU Q_PRIVATE_SLOT(d_func(), void _q_buttonPressed()) Q_PRIVATE_SLOT(d_func(), void _q_updateButtonDown()) diff --git a/src/gui/widgets/qvalidator.h b/src/gui/widgets/qvalidator.h index ce78959..a38b98f 100644 --- a/src/gui/widgets/qvalidator.h +++ b/src/gui/widgets/qvalidator.h @@ -90,7 +90,7 @@ protected: private: Q_DISABLE_COPY(QValidator) - Q_DECLARE_PRIVATE(QValidator) + Q_DECLARE_SCOPED_PRIVATE(QValidator) }; class Q_GUI_EXPORT QIntValidator : public QValidator @@ -168,7 +168,7 @@ public: QObject * parent, const char *name); #endif private: - Q_DECLARE_PRIVATE(QDoubleValidator) + Q_DECLARE_SCOPED_PRIVATE(QDoubleValidator) Q_DISABLE_COPY(QDoubleValidator) double b; diff --git a/src/gui/widgets/qworkspace.cpp b/src/gui/widgets/qworkspace.cpp index 58ef1e3..47b654e 100644 --- a/src/gui/widgets/qworkspace.cpp +++ b/src/gui/widgets/qworkspace.cpp @@ -228,7 +228,7 @@ void QMDIControl::paintEvent(QPaintEvent *) class QWorkspaceTitleBar : public QWidget { Q_OBJECT - Q_DECLARE_PRIVATE(QWorkspaceTitleBar) + Q_DECLARE_SCOPED_PRIVATE(QWorkspaceTitleBar) Q_PROPERTY(bool autoRaise READ autoRaise WRITE setAutoRaise) Q_PROPERTY(bool movable READ isMovable WRITE setMovable) diff --git a/src/gui/widgets/qworkspace.h b/src/gui/widgets/qworkspace.h index 8a64315..1a20d6c 100644 --- a/src/gui/widgets/qworkspace.h +++ b/src/gui/widgets/qworkspace.h @@ -115,7 +115,7 @@ protected: #endif private: - Q_DECLARE_PRIVATE(QWorkspace) + Q_DECLARE_SCOPED_PRIVATE(QWorkspace) Q_DISABLE_COPY(QWorkspace) Q_PRIVATE_SLOT(d_func(), void _q_normalizeActiveWindow()) Q_PRIVATE_SLOT(d_func(), void _q_minimizeActiveWindow()) diff --git a/src/network/access/qabstractnetworkcache.h b/src/network/access/qabstractnetworkcache.h index 40f2313..38ebb69 100644 --- a/src/network/access/qabstractnetworkcache.h +++ b/src/network/access/qabstractnetworkcache.h @@ -130,7 +130,7 @@ protected: QAbstractNetworkCache(QAbstractNetworkCachePrivate &dd, QObject *parent); private: - Q_DECLARE_PRIVATE(QAbstractNetworkCache) + Q_DECLARE_SCOPED_PRIVATE(QAbstractNetworkCache) Q_DISABLE_COPY(QAbstractNetworkCache) }; diff --git a/src/network/access/qftp.h b/src/network/access/qftp.h index c6aaea4..8e4af9f 100644 --- a/src/network/access/qftp.h +++ b/src/network/access/qftp.h @@ -162,7 +162,7 @@ public: private: Q_DISABLE_COPY(QFtp) - Q_DECLARE_PRIVATE(QFtp) + Q_DECLARE_SCOPED_PRIVATE(QFtp) Q_PRIVATE_SLOT(d_func(), void _q_startNextCommand()) Q_PRIVATE_SLOT(d_func(), void _q_piFinished(const QString&)) diff --git a/src/network/access/qhttp.h b/src/network/access/qhttp.h index e524350..c1fda0e 100644 --- a/src/network/access/qhttp.h +++ b/src/network/access/qhttp.h @@ -112,7 +112,7 @@ protected: QScopedPointer d_ptr; private: - Q_DECLARE_PRIVATE(QHttpHeader) + Q_DECLARE_SCOPED_PRIVATE(QHttpHeader) }; class QHttpResponseHeaderPrivate; @@ -139,7 +139,7 @@ protected: bool parseLine(const QString &line, int number); private: - Q_DECLARE_PRIVATE(QHttpResponseHeader) + Q_DECLARE_SCOPED_PRIVATE(QHttpResponseHeader) friend class QHttpPrivate; }; @@ -167,7 +167,7 @@ protected: bool parseLine(const QString &line, int number); private: - Q_DECLARE_PRIVATE(QHttpRequestHeader) + Q_DECLARE_SCOPED_PRIVATE(QHttpRequestHeader) }; class Q_NETWORK_EXPORT QHttp : public QObject @@ -282,7 +282,7 @@ Q_SIGNALS: private: Q_DISABLE_COPY(QHttp) - Q_DECLARE_PRIVATE(QHttp) + Q_DECLARE_SCOPED_PRIVATE(QHttp) Q_PRIVATE_SLOT(d_func(), void _q_startNextRequest()) Q_PRIVATE_SLOT(d_func(), void _q_slotReadyRead()) diff --git a/src/network/access/qhttpnetworkconnection_p.h b/src/network/access/qhttpnetworkconnection_p.h index a0813d4..3b23870 100644 --- a/src/network/access/qhttpnetworkconnection_p.h +++ b/src/network/access/qhttpnetworkconnection_p.h @@ -132,7 +132,7 @@ Q_SIGNALS: void error(QNetworkReply::NetworkError errorCode, const QString &detail = QString()); private: - Q_DECLARE_PRIVATE(QHttpNetworkConnection) + Q_DECLARE_SCOPED_PRIVATE(QHttpNetworkConnection) Q_DISABLE_COPY(QHttpNetworkConnection) friend class QHttpNetworkReply; diff --git a/src/network/access/qhttpnetworkreply_p.h b/src/network/access/qhttpnetworkreply_p.h index 26e1047..c729df9 100644 --- a/src/network/access/qhttpnetworkreply_p.h +++ b/src/network/access/qhttpnetworkreply_p.h @@ -144,7 +144,7 @@ Q_SIGNALS: void dataSendProgress(qint64 done, qint64 total); private: - Q_DECLARE_PRIVATE(QHttpNetworkReply) + Q_DECLARE_SCOPED_PRIVATE(QHttpNetworkReply) friend class QHttpNetworkConnection; friend class QHttpNetworkConnectionPrivate; }; diff --git a/src/network/access/qnetworkaccessmanager.h b/src/network/access/qnetworkaccessmanager.h index f7967f6..01f09cf 100644 --- a/src/network/access/qnetworkaccessmanager.h +++ b/src/network/access/qnetworkaccessmanager.h @@ -119,7 +119,7 @@ protected: private: friend class QNetworkReplyImplPrivate; - Q_DECLARE_PRIVATE(QNetworkAccessManager) + Q_DECLARE_SCOPED_PRIVATE(QNetworkAccessManager) Q_PRIVATE_SLOT(d_func(), void _q_replyFinished()) Q_PRIVATE_SLOT(d_func(), void _q_replySslErrors(QList)) }; diff --git a/src/network/access/qnetworkcookie.h b/src/network/access/qnetworkcookie.h index 1bae7ae..0653806 100644 --- a/src/network/access/qnetworkcookie.h +++ b/src/network/access/qnetworkcookie.h @@ -124,7 +124,7 @@ protected: void setAllCookies(const QList &cookieList); private: - Q_DECLARE_PRIVATE(QNetworkCookieJar) + Q_DECLARE_SCOPED_PRIVATE(QNetworkCookieJar) Q_DISABLE_COPY(QNetworkCookieJar) }; diff --git a/src/network/access/qnetworkdiskcache.h b/src/network/access/qnetworkdiskcache.h index 2d04564..8827bfb 100644 --- a/src/network/access/qnetworkdiskcache.h +++ b/src/network/access/qnetworkdiskcache.h @@ -84,7 +84,7 @@ protected: virtual qint64 expire(); private: - Q_DECLARE_PRIVATE(QNetworkDiskCache) + Q_DECLARE_SCOPED_PRIVATE(QNetworkDiskCache) Q_DISABLE_COPY(QNetworkDiskCache) }; diff --git a/src/network/access/qnetworkreply.h b/src/network/access/qnetworkreply.h index 7cb082f..3fc2dbc 100644 --- a/src/network/access/qnetworkreply.h +++ b/src/network/access/qnetworkreply.h @@ -162,7 +162,7 @@ protected: void setAttribute(QNetworkRequest::Attribute code, const QVariant &value); private: - Q_DECLARE_PRIVATE(QNetworkReply) + Q_DECLARE_SCOPED_PRIVATE(QNetworkReply) }; QT_END_NAMESPACE diff --git a/src/network/access/qnetworkreplyimpl_p.h b/src/network/access/qnetworkreplyimpl_p.h index 3e89a00..ae5038e 100644 --- a/src/network/access/qnetworkreplyimpl_p.h +++ b/src/network/access/qnetworkreplyimpl_p.h @@ -90,7 +90,7 @@ public: virtual void ignoreSslErrors(); #endif - Q_DECLARE_PRIVATE(QNetworkReplyImpl) + Q_DECLARE_SCOPED_PRIVATE(QNetworkReplyImpl) Q_PRIVATE_SLOT(d_func(), void _q_startOperation()) Q_PRIVATE_SLOT(d_func(), void _q_copyReadyRead()) Q_PRIVATE_SLOT(d_func(), void _q_copyReadChannelFinished()) diff --git a/src/network/socket/qabstractsocket.h b/src/network/socket/qabstractsocket.h index ed187e5..bc0b603 100644 --- a/src/network/socket/qabstractsocket.h +++ b/src/network/socket/qabstractsocket.h @@ -201,7 +201,7 @@ protected: QAbstractSocket(SocketType socketType, QAbstractSocketPrivate &dd, QObject *parent = 0); private: - Q_DECLARE_PRIVATE(QAbstractSocket) + Q_DECLARE_SCOPED_PRIVATE(QAbstractSocket) Q_DISABLE_COPY(QAbstractSocket) Q_PRIVATE_SLOT(d_func(), void _q_connectToNextAddress()) diff --git a/src/network/socket/qabstractsocketengine_p.h b/src/network/socket/qabstractsocketengine_p.h index b784f65..7305144 100644 --- a/src/network/socket/qabstractsocketengine_p.h +++ b/src/network/socket/qabstractsocketengine_p.h @@ -175,7 +175,7 @@ protected: void setPeerPort(quint16 port); private: - Q_DECLARE_PRIVATE(QAbstractSocketEngine) + Q_DECLARE_SCOPED_PRIVATE(QAbstractSocketEngine) Q_DISABLE_COPY(QAbstractSocketEngine) }; diff --git a/src/network/socket/qhttpsocketengine_p.h b/src/network/socket/qhttpsocketengine_p.h index bc7e47a..f4d29cf 100644 --- a/src/network/socket/qhttpsocketengine_p.h +++ b/src/network/socket/qhttpsocketengine_p.h @@ -144,7 +144,7 @@ private: void emitWriteNotification(); void emitConnectionNotification(); - Q_DECLARE_PRIVATE(QHttpSocketEngine) + Q_DECLARE_SCOPED_PRIVATE(QHttpSocketEngine) Q_DISABLE_COPY(QHttpSocketEngine) }; diff --git a/src/network/socket/qlocalserver.h b/src/network/socket/qlocalserver.h index 24b69a8..10dd62f 100644 --- a/src/network/socket/qlocalserver.h +++ b/src/network/socket/qlocalserver.h @@ -58,7 +58,7 @@ class QLocalServerPrivate; class Q_NETWORK_EXPORT QLocalServer : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QLocalServer) + Q_DECLARE_SCOPED_PRIVATE(QLocalServer) Q_SIGNALS: void newConnection(); diff --git a/src/network/socket/qlocalsocket.h b/src/network/socket/qlocalsocket.h index 417671a..683d63e 100644 --- a/src/network/socket/qlocalsocket.h +++ b/src/network/socket/qlocalsocket.h @@ -58,7 +58,7 @@ class QLocalSocketPrivate; class Q_NETWORK_EXPORT QLocalSocket : public QIODevice { Q_OBJECT - Q_DECLARE_PRIVATE(QLocalSocket) + Q_DECLARE_SCOPED_PRIVATE(QLocalSocket) public: enum LocalSocketError diff --git a/src/network/socket/qnativesocketengine_p.h b/src/network/socket/qnativesocketengine_p.h index c2881b0..d4d4d7b 100644 --- a/src/network/socket/qnativesocketengine_p.h +++ b/src/network/socket/qnativesocketengine_p.h @@ -322,7 +322,7 @@ public Q_SLOTS: void connectionNotification(); private: - Q_DECLARE_PRIVATE(QNativeSocketEngine) + Q_DECLARE_SCOPED_PRIVATE(QNativeSocketEngine) Q_DISABLE_COPY(QNativeSocketEngine) }; diff --git a/src/network/socket/qsocks5socketengine_p.h b/src/network/socket/qsocks5socketengine_p.h index 19560f0..04c6280 100644 --- a/src/network/socket/qsocks5socketengine_p.h +++ b/src/network/socket/qsocks5socketengine_p.h @@ -117,7 +117,7 @@ public: void setExceptionNotificationEnabled(bool enable); private: - Q_DECLARE_PRIVATE(QSocks5SocketEngine) + Q_DECLARE_SCOPED_PRIVATE(QSocks5SocketEngine) Q_DISABLE_COPY(QSocks5SocketEngine) Q_PRIVATE_SLOT(d_func(), void _q_controlSocketConnected()) Q_PRIVATE_SLOT(d_func(), void _q_controlSocketReadNotification()) diff --git a/src/network/socket/qtcpserver.h b/src/network/socket/qtcpserver.h index 19f2a45..697f998 100644 --- a/src/network/socket/qtcpserver.h +++ b/src/network/socket/qtcpserver.h @@ -99,7 +99,7 @@ Q_SIGNALS: private: Q_DISABLE_COPY(QTcpServer) - Q_DECLARE_PRIVATE(QTcpServer) + Q_DECLARE_SCOPED_PRIVATE(QTcpServer) }; QT_END_NAMESPACE diff --git a/src/network/socket/qtcpsocket.h b/src/network/socket/qtcpsocket.h index 81f81de..f60d131 100644 --- a/src/network/socket/qtcpsocket.h +++ b/src/network/socket/qtcpsocket.h @@ -64,7 +64,7 @@ protected: private: Q_DISABLE_COPY(QTcpSocket) - Q_DECLARE_PRIVATE(QTcpSocket) + Q_DECLARE_SCOPED_PRIVATE(QTcpSocket) }; QT_END_NAMESPACE diff --git a/src/network/socket/qudpsocket.h b/src/network/socket/qudpsocket.h index 078b8ad..ea0c42c 100644 --- a/src/network/socket/qudpsocket.h +++ b/src/network/socket/qudpsocket.h @@ -85,7 +85,7 @@ public: private: Q_DISABLE_COPY(QUdpSocket) - Q_DECLARE_PRIVATE(QUdpSocket) + Q_DECLARE_SCOPED_PRIVATE(QUdpSocket) }; Q_DECLARE_OPERATORS_FOR_FLAGS(QUdpSocket::BindMode) diff --git a/src/network/ssl/qsslsocket.h b/src/network/ssl/qsslsocket.h index 785a083..d52f5c1 100644 --- a/src/network/ssl/qsslsocket.h +++ b/src/network/ssl/qsslsocket.h @@ -192,7 +192,7 @@ protected: qint64 writeData(const char *data, qint64 len); private: - Q_DECLARE_PRIVATE(QSslSocket) + Q_DECLARE_SCOPED_PRIVATE(QSslSocket) Q_DISABLE_COPY(QSslSocket) Q_PRIVATE_SLOT(d_func(), void _q_connectedSlot()) Q_PRIVATE_SLOT(d_func(), void _q_hostFoundSlot()) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h index 0d28a49..4d6b982 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h @@ -91,7 +91,7 @@ public: class QGL2PaintEngineEx : public QPaintEngineEx { - Q_DECLARE_PRIVATE(QGL2PaintEngineEx) + Q_DECLARE_SCOPED_PRIVATE(QGL2PaintEngineEx) public: QGL2PaintEngineEx(); ~QGL2PaintEngineEx(); diff --git a/src/opengl/qgl.h b/src/opengl/qgl.h index 24a4bbb..b8943f1 100644 --- a/src/opengl/qgl.h +++ b/src/opengl/qgl.h @@ -266,7 +266,7 @@ Q_OPENGL_EXPORT bool operator!=(const QGLFormat&, const QGLFormat&); class Q_OPENGL_EXPORT QGLContext { - Q_DECLARE_PRIVATE(QGLContext) + Q_DECLARE_SCOPED_PRIVATE(QGLContext) public: QGLContext(const QGLFormat& format, QPaintDevice* device); QGLContext(const QGLFormat& format); @@ -387,7 +387,7 @@ private: class Q_OPENGL_EXPORT QGLWidget : public QWidget { Q_OBJECT - Q_DECLARE_PRIVATE(QGLWidget) + Q_DECLARE_SCOPED_PRIVATE(QGLWidget) public: explicit QGLWidget(QWidget* parent=0, const QGLWidget* shareWidget = 0, Qt::WindowFlags f=0); diff --git a/src/opengl/qglframebufferobject.h b/src/opengl/qglframebufferobject.h index 108bbb4..7130dec 100644 --- a/src/opengl/qglframebufferobject.h +++ b/src/opengl/qglframebufferobject.h @@ -56,7 +56,7 @@ class QGLFramebufferObjectFormat; class Q_OPENGL_EXPORT QGLFramebufferObject : public QPaintDevice { - Q_DECLARE_PRIVATE(QGLFramebufferObject) + Q_DECLARE_SCOPED_PRIVATE(QGLFramebufferObject) public: enum Attachment { NoAttachment, diff --git a/src/opengl/qglpaintdevice_qws_p.h b/src/opengl/qglpaintdevice_qws_p.h index ec7d6c8..08ad304 100644 --- a/src/opengl/qglpaintdevice_qws_p.h +++ b/src/opengl/qglpaintdevice_qws_p.h @@ -64,7 +64,7 @@ class QWSGLPaintDevicePrivate; class Q_OPENGL_EXPORT QWSGLPaintDevice : public QPaintDevice { - Q_DECLARE_PRIVATE(QWSGLPaintDevice) + Q_DECLARE_SCOPED_PRIVATE(QWSGLPaintDevice) public: QWSGLPaintDevice(QWidget *widget); ~QWSGLPaintDevice(); diff --git a/src/opengl/qglpixelbuffer.h b/src/opengl/qglpixelbuffer.h index 06894c0..f8b5707 100644 --- a/src/opengl/qglpixelbuffer.h +++ b/src/opengl/qglpixelbuffer.h @@ -55,7 +55,7 @@ class QGLPixelBufferPrivate; class Q_OPENGL_EXPORT QGLPixelBuffer : public QPaintDevice { - Q_DECLARE_PRIVATE(QGLPixelBuffer) + Q_DECLARE_SCOPED_PRIVATE(QGLPixelBuffer) public: QGLPixelBuffer(const QSize &size, const QGLFormat &format = QGLFormat::defaultFormat(), QGLWidget *shareWidget = 0); diff --git a/src/opengl/qglscreen_qws.h b/src/opengl/qglscreen_qws.h index 8f2ccb7..4caa134 100644 --- a/src/opengl/qglscreen_qws.h +++ b/src/opengl/qglscreen_qws.h @@ -88,7 +88,7 @@ public: class Q_OPENGL_EXPORT QGLScreen : public QScreen { - Q_DECLARE_PRIVATE(QGLScreen) + Q_DECLARE_SCOPED_PRIVATE(QGLScreen) public: QGLScreen(int displayId); virtual ~QGLScreen(); diff --git a/src/opengl/qglwindowsurface_qws_p.h b/src/opengl/qglwindowsurface_qws_p.h index 1def568..f6d6713 100644 --- a/src/opengl/qglwindowsurface_qws_p.h +++ b/src/opengl/qglwindowsurface_qws_p.h @@ -70,7 +70,7 @@ class QWSGLWindowSurfacePrivate; class Q_OPENGL_EXPORT QWSGLWindowSurface : public QWSWindowSurface { - Q_DECLARE_PRIVATE(QWSGLWindowSurface) + Q_DECLARE_SCOPED_PRIVATE(QWSGLWindowSurface) public: QWSGLWindowSurface(QWidget *widget); diff --git a/src/opengl/qpaintengine_opengl_p.h b/src/opengl/qpaintengine_opengl_p.h index 439782b..e1cd897 100644 --- a/src/opengl/qpaintengine_opengl_p.h +++ b/src/opengl/qpaintengine_opengl_p.h @@ -74,7 +74,7 @@ public: class QOpenGLPaintEngine : public QPaintEngineEx { - Q_DECLARE_PRIVATE(QOpenGLPaintEngine) + Q_DECLARE_SCOPED_PRIVATE(QOpenGLPaintEngine) public: QOpenGLPaintEngine(); ~QOpenGLPaintEngine(); diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h index 8c5877b..6df0c0a 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h @@ -53,7 +53,7 @@ class QDirectFBPaintEnginePrivate; class QDirectFBPaintEngine : public QRasterPaintEngine { - Q_DECLARE_PRIVATE(QDirectFBPaintEngine) + Q_DECLARE_SCOPED_PRIVATE(QDirectFBPaintEngine) public: QDirectFBPaintEngine(QPaintDevice *device); ~QDirectFBPaintEngine(); diff --git a/src/plugins/imageformats/mng/qmnghandler.h b/src/plugins/imageformats/mng/qmnghandler.h index b9e37bf..aa6efd3 100644 --- a/src/plugins/imageformats/mng/qmnghandler.h +++ b/src/plugins/imageformats/mng/qmnghandler.h @@ -74,7 +74,7 @@ class QMngHandler : public QImageIOHandler virtual bool supportsOption(ImageOption option) const; private: - Q_DECLARE_PRIVATE(QMngHandler) + Q_DECLARE_SCOPED_PRIVATE(QMngHandler) QScopedPointer d_ptr; }; diff --git a/src/plugins/s60/src/qdesktopservices_3_2.cpp b/src/plugins/s60/src/qdesktopservices_3_2.cpp index cbdc810..f08799b 100644 --- a/src/plugins/s60/src/qdesktopservices_3_2.cpp +++ b/src/plugins/s60/src/qdesktopservices_3_2.cpp @@ -52,14 +52,16 @@ EXPORT_C QString localizedDirectoryName(QString& rawPath) QString ret; TRAPD(err, - CDirectoryLocalizer* localizer = CDirectoryLocalizer::NewL(); - CleanupStack::PushL(localizer); - localizer->SetFullPath(qt_QString2TPtrC(QDir::toNativeSeparators(rawPath))); - if(localizer->IsLocalized()){ - TPtrC locName(localizer->LocalizedName()); - ret = qt_TDesC2QStringL(locName); - } - CleanupStack::PopAndDestroy(localizer); + QT_TRYCATCH_LEAVING( + CDirectoryLocalizer* localizer = CDirectoryLocalizer::NewL(); + CleanupStack::PushL(localizer); + localizer->SetFullPath(qt_QString2TPtrC(QDir::toNativeSeparators(rawPath))); + if(localizer->IsLocalized()){ + TPtrC locName(localizer->LocalizedName()); + ret = qt_TDesC2QString(locName); + } + CleanupStack::PopAndDestroy(localizer); + ) ) if (err != KErrNone) diff --git a/src/qt3support/other/q3dragobject.h b/src/qt3support/other/q3dragobject.h index 356e1f7..c25e54b 100644 --- a/src/qt3support/other/q3dragobject.h +++ b/src/qt3support/other/q3dragobject.h @@ -68,7 +68,7 @@ class QPixmap; class Q_COMPAT_EXPORT Q3DragObject : public QObject, public QMimeSource { Q_OBJECT - Q_DECLARE_PRIVATE(Q3DragObject) + Q_DECLARE_SCOPED_PRIVATE(Q3DragObject) public: Q3DragObject(QWidget * dragSource = 0, const char *name = 0); virtual ~Q3DragObject(); @@ -99,7 +99,7 @@ private: class Q_COMPAT_EXPORT Q3StoredDrag: public Q3DragObject { Q_OBJECT - Q_DECLARE_PRIVATE(Q3StoredDrag) + Q_DECLARE_SCOPED_PRIVATE(Q3StoredDrag) public: Q3StoredDrag(const char *mimeType, QWidget *dragSource = 0, const char *name = 0); ~Q3StoredDrag(); @@ -118,7 +118,7 @@ private: class Q_COMPAT_EXPORT Q3TextDrag: public Q3DragObject { Q_OBJECT - Q_DECLARE_PRIVATE(Q3TextDrag) + Q_DECLARE_SCOPED_PRIVATE(Q3TextDrag) public: Q3TextDrag(const QString &, QWidget *dragSource = 0, const char *name = 0); Q3TextDrag(QWidget * dragSource = 0, const char * name = 0); @@ -143,7 +143,7 @@ private: class Q_COMPAT_EXPORT Q3ImageDrag: public Q3DragObject { Q_OBJECT - Q_DECLARE_PRIVATE(Q3ImageDrag) + Q_DECLARE_SCOPED_PRIVATE(Q3ImageDrag) public: Q3ImageDrag(QImage image, QWidget * dragSource = 0, const char * name = 0); Q3ImageDrag(QWidget * dragSource = 0, const char * name = 0); diff --git a/src/qt3support/painting/q3paintengine_svg_p.h b/src/qt3support/painting/q3paintengine_svg_p.h index 26452ab..1faffff 100644 --- a/src/qt3support/painting/q3paintengine_svg_p.h +++ b/src/qt3support/painting/q3paintengine_svg_p.h @@ -63,7 +63,7 @@ class Q3SVGPaintEnginePrivate; class Q3SVGPaintEngine : public QPaintEngine { - Q_DECLARE_PRIVATE(Q3SVGPaintEngine) + Q_DECLARE_SCOPED_PRIVATE(Q3SVGPaintEngine) public: Q3SVGPaintEngine(); diff --git a/src/qt3support/widgets/q3mainwindow.h b/src/qt3support/widgets/q3mainwindow.h index 60dea5d..2e056b4 100644 --- a/src/qt3support/widgets/q3mainwindow.h +++ b/src/qt3support/widgets/q3mainwindow.h @@ -66,7 +66,7 @@ template class QList; class Q_COMPAT_EXPORT Q3MainWindow: public QWidget { Q_OBJECT - Q_DECLARE_PRIVATE(Q3MainWindow) + Q_DECLARE_SCOPED_PRIVATE(Q3MainWindow) Q_PROPERTY(bool rightJustification READ rightJustification WRITE setRightJustification DESIGNABLE false) Q_PROPERTY(bool usesBigPixmaps READ usesBigPixmaps WRITE setUsesBigPixmaps) diff --git a/src/qt3support/widgets/q3titlebar_p.h b/src/qt3support/widgets/q3titlebar_p.h index c4be34e..6b3c22c 100644 --- a/src/qt3support/widgets/q3titlebar_p.h +++ b/src/qt3support/widgets/q3titlebar_p.h @@ -67,7 +67,7 @@ class QPixmap; class Q_COMPAT_EXPORT Q3TitleBar : public QWidget { Q_OBJECT - Q_DECLARE_PRIVATE(Q3TitleBar) + Q_DECLARE_SCOPED_PRIVATE(Q3TitleBar) Q_PROPERTY(bool autoRaise READ autoRaise WRITE setAutoRaise) Q_PROPERTY(bool movable READ isMovable WRITE setMovable) diff --git a/src/s60main/qts60main_mcrt0.cpp b/src/s60main/qts60main_mcrt0.cpp index 49a47bd..8631989 100644 --- a/src/s60main/qts60main_mcrt0.cpp +++ b/src/s60main/qts60main_mcrt0.cpp @@ -80,14 +80,7 @@ GLDEF_C TInt QtMainWrapper() CleanupArrayDelete::PushL(envp); //Call user(application)'s main int ret = 0; - try - { - ret = CALLMAIN(argc, argv, envp); - } - catch (...) - { - User::Leave(KErrGeneral); - } + QT_TRYCATCH_LEAVING( ret = CALLMAIN(argc, argv, envp); ); CleanupStack::PopAndDestroy(2,argv); return ret; } diff --git a/src/s60main/qts60mainappui.cpp b/src/s60main/qts60mainappui.cpp index 85badcc..ef54417 100644 --- a/src/s60main/qts60mainappui.cpp +++ b/src/s60main/qts60mainappui.cpp @@ -63,6 +63,11 @@ // void CQtS60MainAppUi::ConstructL() { + // Cone's heap and handle checks on app destruction are not suitable for Qt apps, as many + // objects can still exist in static data at that point. Instead we will print relevant information + // so that comparative checks may be made for memory leaks, using ~SPrintExitInfo in corelib. + iEikonEnv->DisableExitChecks(ETrue); + // Initialise app UI with standard value. // ENoAppResourceFile and ENonStandardResourceFile makes UI to work without // resource files in most SDKs. S60 3rd FP1 public seems to require resource file @@ -127,7 +132,7 @@ void CQtS60MainAppUi::HandleWsEventL(const TWsEvent& aEvent, CCoeControl *contro { int result = 0; if (qApp) - QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_LEAVE( + QT_TRYCATCH_LEAVING( result = qApp->s60ProcessEvent(const_cast(&aEvent)) ); diff --git a/src/script/qscriptable.h b/src/script/qscriptable.h index 76a0496..11ecb6b 100644 --- a/src/script/qscriptable.h +++ b/src/script/qscriptable.h @@ -78,7 +78,7 @@ private: QScopedPointer d_ptr; Q_DISABLE_COPY(QScriptable) - Q_DECLARE_PRIVATE(QScriptable) + Q_DECLARE_SCOPED_PRIVATE(QScriptable) }; #endif // QT_NO_QOBJECT diff --git a/src/script/qscriptclass.h b/src/script/qscriptclass.h index 7070470..e821cf7 100644 --- a/src/script/qscriptclass.h +++ b/src/script/qscriptclass.h @@ -107,7 +107,7 @@ protected: QScopedPointer d_ptr; private: - Q_DECLARE_PRIVATE(QScriptClass) + Q_DECLARE_SCOPED_PRIVATE(QScriptClass) Q_DISABLE_COPY(QScriptClass) }; diff --git a/src/script/qscriptclasspropertyiterator.h b/src/script/qscriptclasspropertyiterator.h index 1570410..ce6d3d4 100644 --- a/src/script/qscriptclasspropertyiterator.h +++ b/src/script/qscriptclasspropertyiterator.h @@ -84,7 +84,7 @@ protected: QScopedPointer d_ptr; private: - Q_DECLARE_PRIVATE(QScriptClassPropertyIterator) + Q_DECLARE_SCOPED_PRIVATE(QScriptClassPropertyIterator) Q_DISABLE_COPY(QScriptClassPropertyIterator) }; diff --git a/src/script/qscriptcontext.h b/src/script/qscriptcontext.h index 5a86cba..84d4192 100644 --- a/src/script/qscriptcontext.h +++ b/src/script/qscriptcontext.h @@ -114,7 +114,7 @@ private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QScriptContext) + Q_DECLARE_SCOPED_PRIVATE(QScriptContext) Q_DISABLE_COPY(QScriptContext) }; diff --git a/src/script/qscriptcontextinfo.h b/src/script/qscriptcontextinfo.h index 3540060..95e88e2 100644 --- a/src/script/qscriptcontextinfo.h +++ b/src/script/qscriptcontextinfo.h @@ -107,7 +107,7 @@ public: private: QScopedSharedPointer d_ptr; - Q_DECLARE_PRIVATE(QScriptContextInfo) + Q_DECLARE_SCOPED_PRIVATE(QScriptContextInfo) }; typedef QList QScriptContextInfoList; diff --git a/src/script/qscriptengine.h b/src/script/qscriptengine.h index 794c965..4f39c57 100644 --- a/src/script/qscriptengine.h +++ b/src/script/qscriptengine.h @@ -117,7 +117,7 @@ private: QScriptSyntaxCheckResult(QScriptSyntaxCheckResultPrivate *d); QScopedSharedPointer d_ptr; - Q_DECLARE_PRIVATE(QScriptSyntaxCheckResult) + Q_DECLARE_SCOPED_PRIVATE(QScriptSyntaxCheckResult) friend class QScriptEnginePrivate; }; @@ -291,7 +291,7 @@ protected: #endif private: - Q_DECLARE_PRIVATE(QScriptEngine) + Q_DECLARE_SCOPED_PRIVATE(QScriptEngine) Q_DISABLE_COPY(QScriptEngine) #ifndef QT_NO_QOBJECT Q_PRIVATE_SLOT(d_func(), void _q_objectDestroyed(QObject *)) diff --git a/src/script/qscriptengineagent.h b/src/script/qscriptengineagent.h index e71560c..10209df 100644 --- a/src/script/qscriptengineagent.h +++ b/src/script/qscriptengineagent.h @@ -100,7 +100,7 @@ protected: QScopedPointer d_ptr; private: - Q_DECLARE_PRIVATE(QScriptEngineAgent) + Q_DECLARE_SCOPED_PRIVATE(QScriptEngineAgent) Q_DISABLE_COPY(QScriptEngineAgent) }; diff --git a/src/script/qscriptstring.cpp b/src/script/qscriptstring.cpp index 137c6d0..945e532 100644 --- a/src/script/qscriptstring.cpp +++ b/src/script/qscriptstring.cpp @@ -55,7 +55,7 @@ QT_BEGIN_NAMESPACE /*! \internal */ -struct QScriptStringPrivatePointerHandler +struct QScriptStringPrivatePointerDeleter { static inline void cleanup(QScriptStringPrivate *d) { @@ -69,12 +69,6 @@ struct QScriptStringPrivatePointerHandler delete d; } } - - static inline void reset(QScriptStringPrivate *&d, QScriptStringPrivate *other) - { - cleanup(d); - d = other; - } }; /*! diff --git a/src/script/qscriptstring.h b/src/script/qscriptstring.h index 7256ee9..17cb687 100644 --- a/src/script/qscriptstring.h +++ b/src/script/qscriptstring.h @@ -56,7 +56,7 @@ QT_MODULE(Script) class QScriptEngine; class QScriptStringPrivate; -struct QScriptStringPrivatePointerHandler; +struct QScriptStringPrivatePointerDeleter; class Q_SCRIPT_EXPORT QScriptString { @@ -76,9 +76,9 @@ public: operator QString() const; private: - QScopedCustomPointer d_ptr; + QCustomScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QScriptString) + Q_DECLARE_SCOPED_PRIVATE(QScriptString) }; QT_END_NAMESPACE diff --git a/src/script/qscriptvalue.cpp b/src/script/qscriptvalue.cpp index d99e912..608fef3 100644 --- a/src/script/qscriptvalue.cpp +++ b/src/script/qscriptvalue.cpp @@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE /*! \internal */ -struct QScriptValuePrivatePointerHandler +struct QScriptValuePrivatePointerDeleter { static inline void cleanup(QScriptValuePrivate *d) { @@ -71,12 +71,6 @@ struct QScriptValuePrivatePointerHandler delete d; } } - - static inline void reset(QScriptValuePrivate *&d, QScriptValuePrivate *other) - { - cleanup(d); - d = other; - } }; /*! diff --git a/src/script/qscriptvalue.h b/src/script/qscriptvalue.h index 8125d01..5b10f9e 100644 --- a/src/script/qscriptvalue.h +++ b/src/script/qscriptvalue.h @@ -72,7 +72,7 @@ typedef QList QScriptValueList; typedef double qsreal; class QScriptValuePrivate; -struct QScriptValuePrivatePointerHandler; +struct QScriptValuePrivatePointerDeleter; class Q_SCRIPT_EXPORT QScriptValue { public: @@ -223,9 +223,9 @@ private: inline QScriptValue(QScriptEngine *, void *); private: - QScopedCustomPointer d_ptr; + QCustomScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QScriptValue) + Q_DECLARE_SCOPED_PRIVATE(QScriptValue) }; Q_DECLARE_OPERATORS_FOR_FLAGS(QScriptValue::ResolveFlags) diff --git a/src/script/qscriptvalueiterator.h b/src/script/qscriptvalueiterator.h index c8684ea..a25d12c 100644 --- a/src/script/qscriptvalueiterator.h +++ b/src/script/qscriptvalueiterator.h @@ -88,7 +88,7 @@ public: private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QScriptValueIterator) + Q_DECLARE_SCOPED_PRIVATE(QScriptValueIterator) Q_DISABLE_COPY(QScriptValueIterator) }; diff --git a/src/scripttools/debugging/qscriptbreakpointdata_p.h b/src/scripttools/debugging/qscriptbreakpointdata_p.h index 6fcb3f3..4f6d7b9 100644 --- a/src/scripttools/debugging/qscriptbreakpointdata_p.h +++ b/src/scripttools/debugging/qscriptbreakpointdata_p.h @@ -116,7 +116,7 @@ public: private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QScriptBreakpointData) + Q_DECLARE_SCOPED_PRIVATE(QScriptBreakpointData) }; typedef QMap QScriptBreakpointMap; diff --git a/src/scripttools/debugging/qscriptbreakpointsmodel_p.h b/src/scripttools/debugging/qscriptbreakpointsmodel_p.h index b6e11e5..7c0ba01 100644 --- a/src/scripttools/debugging/qscriptbreakpointsmodel_p.h +++ b/src/scripttools/debugging/qscriptbreakpointsmodel_p.h @@ -98,7 +98,7 @@ public: Qt::ItemFlags flags(const QModelIndex &index) const; private: - Q_DECLARE_PRIVATE(QScriptBreakpointsModel) + Q_DECLARE_SCOPED_PRIVATE(QScriptBreakpointsModel) Q_DISABLE_COPY(QScriptBreakpointsModel) }; diff --git a/src/scripttools/debugging/qscriptbreakpointswidget_p.h b/src/scripttools/debugging/qscriptbreakpointswidget_p.h index 0717351..e0bb25c 100644 --- a/src/scripttools/debugging/qscriptbreakpointswidget_p.h +++ b/src/scripttools/debugging/qscriptbreakpointswidget_p.h @@ -81,7 +81,7 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_onCurrentChanged(const QModelIndex &)) Q_PRIVATE_SLOT(d_func(), void _q_onNewBreakpointRequest(const QString &, int)) - Q_DECLARE_PRIVATE(QScriptBreakpointsWidget) + Q_DECLARE_SCOPED_PRIVATE(QScriptBreakpointsWidget) Q_DISABLE_COPY(QScriptBreakpointsWidget) }; diff --git a/src/scripttools/debugging/qscriptbreakpointswidgetinterface_p.h b/src/scripttools/debugging/qscriptbreakpointswidgetinterface_p.h index c2b6418..74e775b 100644 --- a/src/scripttools/debugging/qscriptbreakpointswidgetinterface_p.h +++ b/src/scripttools/debugging/qscriptbreakpointswidgetinterface_p.h @@ -83,7 +83,7 @@ protected: QWidget *parent, Qt::WindowFlags flags); private: - Q_DECLARE_PRIVATE(QScriptBreakpointsWidgetInterface) + Q_DECLARE_SCOPED_PRIVATE(QScriptBreakpointsWidgetInterface) Q_DISABLE_COPY(QScriptBreakpointsWidgetInterface) }; diff --git a/src/scripttools/debugging/qscriptcompletiontask_p.h b/src/scripttools/debugging/qscriptcompletiontask_p.h index 1dd80c0..95afa88 100644 --- a/src/scripttools/debugging/qscriptcompletiontask_p.h +++ b/src/scripttools/debugging/qscriptcompletiontask_p.h @@ -81,7 +81,7 @@ public: void start(); private: - Q_DECLARE_PRIVATE(QScriptCompletionTask) + Q_DECLARE_SCOPED_PRIVATE(QScriptCompletionTask) Q_DISABLE_COPY(QScriptCompletionTask) }; diff --git a/src/scripttools/debugging/qscriptcompletiontaskinterface_p.h b/src/scripttools/debugging/qscriptcompletiontaskinterface_p.h index 6a47bed..abe908c 100644 --- a/src/scripttools/debugging/qscriptcompletiontaskinterface_p.h +++ b/src/scripttools/debugging/qscriptcompletiontaskinterface_p.h @@ -97,7 +97,7 @@ protected: QScriptCompletionTaskInterfacePrivate &dd, QObject *parent); private: - Q_DECLARE_PRIVATE(QScriptCompletionTaskInterface) + Q_DECLARE_SCOPED_PRIVATE(QScriptCompletionTaskInterface) Q_DISABLE_COPY(QScriptCompletionTaskInterface) }; diff --git a/src/scripttools/debugging/qscriptdebugger_p.h b/src/scripttools/debugging/qscriptdebugger_p.h index ba27200..f9cbf74 100644 --- a/src/scripttools/debugging/qscriptdebugger_p.h +++ b/src/scripttools/debugging/qscriptdebugger_p.h @@ -185,7 +185,7 @@ protected: QScriptDebugger(QScriptDebuggerPrivate &dd, QObject *parent); private: - Q_DECLARE_PRIVATE(QScriptDebugger) + Q_DECLARE_SCOPED_PRIVATE(QScriptDebugger) Q_DISABLE_COPY(QScriptDebugger) Q_PRIVATE_SLOT(d_func(), void _q_onLineEntered(const QString &)) diff --git a/src/scripttools/debugging/qscriptdebuggeragent_p.h b/src/scripttools/debugging/qscriptdebuggeragent_p.h index ca4ab2e..769ed53 100644 --- a/src/scripttools/debugging/qscriptdebuggeragent_p.h +++ b/src/scripttools/debugging/qscriptdebuggeragent_p.h @@ -125,7 +125,7 @@ public: const QVariant &argument = QVariant()); private: - Q_DECLARE_PRIVATE(QScriptDebuggerAgent) + Q_DECLARE_SCOPED_PRIVATE(QScriptDebuggerAgent) Q_DISABLE_COPY(QScriptDebuggerAgent) }; diff --git a/src/scripttools/debugging/qscriptdebuggerbackend_p.h b/src/scripttools/debugging/qscriptdebuggerbackend_p.h index 759a304..64c6ef3 100644 --- a/src/scripttools/debugging/qscriptdebuggerbackend_p.h +++ b/src/scripttools/debugging/qscriptdebuggerbackend_p.h @@ -147,7 +147,7 @@ protected: QScopedPointer d_ptr; private: - Q_DECLARE_PRIVATE(QScriptDebuggerBackend) + Q_DECLARE_SCOPED_PRIVATE(QScriptDebuggerBackend) Q_DISABLE_COPY(QScriptDebuggerBackend) }; diff --git a/src/scripttools/debugging/qscriptdebuggercodefinderwidget_p.h b/src/scripttools/debugging/qscriptdebuggercodefinderwidget_p.h index f6d000d..b7d9392 100644 --- a/src/scripttools/debugging/qscriptdebuggercodefinderwidget_p.h +++ b/src/scripttools/debugging/qscriptdebuggercodefinderwidget_p.h @@ -78,7 +78,7 @@ protected: void keyPressEvent(QKeyEvent *e); private: - Q_DECLARE_PRIVATE(QScriptDebuggerCodeFinderWidget) + Q_DECLARE_SCOPED_PRIVATE(QScriptDebuggerCodeFinderWidget) Q_DISABLE_COPY(QScriptDebuggerCodeFinderWidget) Q_PRIVATE_SLOT(d_func(), void _q_updateButtons()) diff --git a/src/scripttools/debugging/qscriptdebuggercodefinderwidgetinterface_p.h b/src/scripttools/debugging/qscriptdebuggercodefinderwidgetinterface_p.h index 5848e34..e73be00 100644 --- a/src/scripttools/debugging/qscriptdebuggercodefinderwidgetinterface_p.h +++ b/src/scripttools/debugging/qscriptdebuggercodefinderwidgetinterface_p.h @@ -84,7 +84,7 @@ protected: QWidget *parent, Qt::WindowFlags flags); private: - Q_DECLARE_PRIVATE(QScriptDebuggerCodeFinderWidgetInterface) + Q_DECLARE_SCOPED_PRIVATE(QScriptDebuggerCodeFinderWidgetInterface) Q_DISABLE_COPY(QScriptDebuggerCodeFinderWidgetInterface) }; diff --git a/src/scripttools/debugging/qscriptdebuggercodeview_p.h b/src/scripttools/debugging/qscriptdebuggercodeview_p.h index 1748102..5945382 100644 --- a/src/scripttools/debugging/qscriptdebuggercodeview_p.h +++ b/src/scripttools/debugging/qscriptdebuggercodeview_p.h @@ -87,7 +87,7 @@ public: bool event(QEvent *e); private: - Q_DECLARE_PRIVATE(QScriptDebuggerCodeView) + Q_DECLARE_SCOPED_PRIVATE(QScriptDebuggerCodeView) Q_DISABLE_COPY(QScriptDebuggerCodeView) }; diff --git a/src/scripttools/debugging/qscriptdebuggercodeviewinterface_p.h b/src/scripttools/debugging/qscriptdebuggercodeviewinterface_p.h index ea9eb62..9bb4017 100644 --- a/src/scripttools/debugging/qscriptdebuggercodeviewinterface_p.h +++ b/src/scripttools/debugging/qscriptdebuggercodeviewinterface_p.h @@ -97,7 +97,7 @@ protected: QWidget *parent, Qt::WindowFlags flags); private: - Q_DECLARE_PRIVATE(QScriptDebuggerCodeViewInterface) + Q_DECLARE_SCOPED_PRIVATE(QScriptDebuggerCodeViewInterface) Q_DISABLE_COPY(QScriptDebuggerCodeViewInterface) }; diff --git a/src/scripttools/debugging/qscriptdebuggercodewidget_p.h b/src/scripttools/debugging/qscriptdebuggercodewidget_p.h index e072a3d..f9a1b82 100644 --- a/src/scripttools/debugging/qscriptdebuggercodewidget_p.h +++ b/src/scripttools/debugging/qscriptdebuggercodewidget_p.h @@ -82,7 +82,7 @@ public: QScriptDebuggerCodeViewInterface *currentView() const; private: - Q_DECLARE_PRIVATE(QScriptDebuggerCodeWidget) + Q_DECLARE_SCOPED_PRIVATE(QScriptDebuggerCodeWidget) Q_DISABLE_COPY(QScriptDebuggerCodeWidget) Q_PRIVATE_SLOT(d_func(), void _q_onBreakpointToggleRequest(int,bool)) diff --git a/src/scripttools/debugging/qscriptdebuggercodewidgetinterface_p.h b/src/scripttools/debugging/qscriptdebuggercodewidgetinterface_p.h index 03b813a..d27af3d 100644 --- a/src/scripttools/debugging/qscriptdebuggercodewidgetinterface_p.h +++ b/src/scripttools/debugging/qscriptdebuggercodewidgetinterface_p.h @@ -92,7 +92,7 @@ protected: QWidget *parent, Qt::WindowFlags flags); private: - Q_DECLARE_PRIVATE(QScriptDebuggerCodeWidgetInterface) + Q_DECLARE_SCOPED_PRIVATE(QScriptDebuggerCodeWidgetInterface) Q_DISABLE_COPY(QScriptDebuggerCodeWidgetInterface) }; diff --git a/src/scripttools/debugging/qscriptdebuggercommand_p.h b/src/scripttools/debugging/qscriptdebuggercommand_p.h index 8e44fcf..ffdb107 100644 --- a/src/scripttools/debugging/qscriptdebuggercommand_p.h +++ b/src/scripttools/debugging/qscriptdebuggercommand_p.h @@ -257,7 +257,7 @@ public: private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QScriptDebuggerCommand) + Q_DECLARE_SCOPED_PRIVATE(QScriptDebuggerCommand) }; Q_AUTOTEST_EXPORT QDataStream &operator<<(QDataStream &, const QScriptDebuggerCommand &); diff --git a/src/scripttools/debugging/qscriptdebuggercommandexecutor_p.h b/src/scripttools/debugging/qscriptdebuggercommandexecutor_p.h index 0da0d87..d303d66 100644 --- a/src/scripttools/debugging/qscriptdebuggercommandexecutor_p.h +++ b/src/scripttools/debugging/qscriptdebuggercommandexecutor_p.h @@ -78,7 +78,7 @@ protected: QScopedPointer d_ptr; private: - Q_DECLARE_PRIVATE(QScriptDebuggerCommandExecutor) + Q_DECLARE_SCOPED_PRIVATE(QScriptDebuggerCommandExecutor) Q_DISABLE_COPY(QScriptDebuggerCommandExecutor) }; diff --git a/src/scripttools/debugging/qscriptdebuggercommandschedulerjob_p.h b/src/scripttools/debugging/qscriptdebuggercommandschedulerjob_p.h index db9c503..3c80173 100644 --- a/src/scripttools/debugging/qscriptdebuggercommandschedulerjob_p.h +++ b/src/scripttools/debugging/qscriptdebuggercommandschedulerjob_p.h @@ -78,7 +78,7 @@ protected: QScriptDebuggerCommandSchedulerInterface *commandScheduler); private: - Q_DECLARE_PRIVATE(QScriptDebuggerCommandSchedulerJob) + Q_DECLARE_SCOPED_PRIVATE(QScriptDebuggerCommandSchedulerJob) Q_DISABLE_COPY(QScriptDebuggerCommandSchedulerJob) }; diff --git a/src/scripttools/debugging/qscriptdebuggerconsole_p.h b/src/scripttools/debugging/qscriptdebuggerconsole_p.h index 2e4a726..5b88291 100644 --- a/src/scripttools/debugging/qscriptdebuggerconsole_p.h +++ b/src/scripttools/debugging/qscriptdebuggerconsole_p.h @@ -112,7 +112,7 @@ public: private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QScriptDebuggerConsole) + Q_DECLARE_SCOPED_PRIVATE(QScriptDebuggerConsole) Q_DISABLE_COPY(QScriptDebuggerConsole) }; diff --git a/src/scripttools/debugging/qscriptdebuggerconsolecommand_p.h b/src/scripttools/debugging/qscriptdebuggerconsolecommand_p.h index c380150..a335e56 100644 --- a/src/scripttools/debugging/qscriptdebuggerconsolecommand_p.h +++ b/src/scripttools/debugging/qscriptdebuggerconsolecommand_p.h @@ -94,7 +94,7 @@ protected: QScopedPointer d_ptr; private: - Q_DECLARE_PRIVATE(QScriptDebuggerConsoleCommand) + Q_DECLARE_SCOPED_PRIVATE(QScriptDebuggerConsoleCommand) Q_DISABLE_COPY(QScriptDebuggerConsoleCommand) }; diff --git a/src/scripttools/debugging/qscriptdebuggerconsolecommandgroupdata_p.h b/src/scripttools/debugging/qscriptdebuggerconsolecommandgroupdata_p.h index 5e23628..b1dfecb 100644 --- a/src/scripttools/debugging/qscriptdebuggerconsolecommandgroupdata_p.h +++ b/src/scripttools/debugging/qscriptdebuggerconsolecommandgroupdata_p.h @@ -85,7 +85,7 @@ private: QScopedSharedPointer d_ptr; private: - Q_DECLARE_PRIVATE(QScriptDebuggerConsoleCommandGroupData) + Q_DECLARE_SCOPED_PRIVATE(QScriptDebuggerConsoleCommandGroupData) }; typedef QMap QScriptDebuggerConsoleCommandGroupMap; diff --git a/src/scripttools/debugging/qscriptdebuggerconsolecommandjob_p.h b/src/scripttools/debugging/qscriptdebuggerconsolecommandjob_p.h index ce35157..65b2a4c 100644 --- a/src/scripttools/debugging/qscriptdebuggerconsolecommandjob_p.h +++ b/src/scripttools/debugging/qscriptdebuggerconsolecommandjob_p.h @@ -77,7 +77,7 @@ protected: QScriptDebuggerCommandSchedulerInterface *scheduler); private: - Q_DECLARE_PRIVATE(QScriptDebuggerConsoleCommandJob) + Q_DECLARE_SCOPED_PRIVATE(QScriptDebuggerConsoleCommandJob) Q_DISABLE_COPY(QScriptDebuggerConsoleCommandJob) }; diff --git a/src/scripttools/debugging/qscriptdebuggerconsolecommandmanager_p.h b/src/scripttools/debugging/qscriptdebuggerconsolecommandmanager_p.h index c6de5b1..0ffd61e 100644 --- a/src/scripttools/debugging/qscriptdebuggerconsolecommandmanager_p.h +++ b/src/scripttools/debugging/qscriptdebuggerconsolecommandmanager_p.h @@ -88,7 +88,7 @@ public: private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QScriptDebuggerConsoleCommandManager) + Q_DECLARE_SCOPED_PRIVATE(QScriptDebuggerConsoleCommandManager) }; QT_END_NAMESPACE diff --git a/src/scripttools/debugging/qscriptdebuggerconsoleglobalobject_p.h b/src/scripttools/debugging/qscriptdebuggerconsoleglobalobject_p.h index 0200a32..1145162 100644 --- a/src/scripttools/debugging/qscriptdebuggerconsoleglobalobject_p.h +++ b/src/scripttools/debugging/qscriptdebuggerconsoleglobalobject_p.h @@ -163,7 +163,7 @@ public Q_SLOTS: void setEvaluateAction(int action); private: - Q_DECLARE_PRIVATE(QScriptDebuggerConsoleGlobalObject) + Q_DECLARE_SCOPED_PRIVATE(QScriptDebuggerConsoleGlobalObject) Q_DISABLE_COPY(QScriptDebuggerConsoleGlobalObject) }; diff --git a/src/scripttools/debugging/qscriptdebuggerconsolewidget_p.h b/src/scripttools/debugging/qscriptdebuggerconsolewidget_p.h index 462d445..02e9e94 100644 --- a/src/scripttools/debugging/qscriptdebuggerconsolewidget_p.h +++ b/src/scripttools/debugging/qscriptdebuggerconsolewidget_p.h @@ -85,7 +85,7 @@ protected: QWidget *parent); private: - Q_DECLARE_PRIVATE(QScriptDebuggerConsoleWidget) + Q_DECLARE_SCOPED_PRIVATE(QScriptDebuggerConsoleWidget) Q_DISABLE_COPY(QScriptDebuggerConsoleWidget) Q_PRIVATE_SLOT(d_func(), void _q_onLineEntered(const QString &)) diff --git a/src/scripttools/debugging/qscriptdebuggerconsolewidgetinterface_p.h b/src/scripttools/debugging/qscriptdebuggerconsolewidgetinterface_p.h index 486a19a..a3b5b5f 100644 --- a/src/scripttools/debugging/qscriptdebuggerconsolewidgetinterface_p.h +++ b/src/scripttools/debugging/qscriptdebuggerconsolewidgetinterface_p.h @@ -94,7 +94,7 @@ protected: QWidget *parent, Qt::WindowFlags flags); private: - Q_DECLARE_PRIVATE(QScriptDebuggerConsoleWidgetInterface) + Q_DECLARE_SCOPED_PRIVATE(QScriptDebuggerConsoleWidgetInterface) Q_DISABLE_COPY(QScriptDebuggerConsoleWidgetInterface) }; diff --git a/src/scripttools/debugging/qscriptdebuggerevent_p.h b/src/scripttools/debugging/qscriptdebuggerevent_p.h index 8c4e460..c6067d5 100644 --- a/src/scripttools/debugging/qscriptdebuggerevent_p.h +++ b/src/scripttools/debugging/qscriptdebuggerevent_p.h @@ -140,7 +140,7 @@ public: private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QScriptDebuggerEvent) + Q_DECLARE_SCOPED_PRIVATE(QScriptDebuggerEvent) }; Q_AUTOTEST_EXPORT QDataStream &operator<<(QDataStream &, const QScriptDebuggerEvent &); diff --git a/src/scripttools/debugging/qscriptdebuggerfrontend_p.h b/src/scripttools/debugging/qscriptdebuggerfrontend_p.h index 1f7b2ef..04ebb5c 100644 --- a/src/scripttools/debugging/qscriptdebuggerfrontend_p.h +++ b/src/scripttools/debugging/qscriptdebuggerfrontend_p.h @@ -93,7 +93,7 @@ protected: QScopedPointer d_ptr; private: - Q_DECLARE_PRIVATE(QScriptDebuggerFrontend) + Q_DECLARE_SCOPED_PRIVATE(QScriptDebuggerFrontend) Q_DISABLE_COPY(QScriptDebuggerFrontend) }; diff --git a/src/scripttools/debugging/qscriptdebuggerjob_p.h b/src/scripttools/debugging/qscriptdebuggerjob_p.h index 099ad16..0b723c7 100644 --- a/src/scripttools/debugging/qscriptdebuggerjob_p.h +++ b/src/scripttools/debugging/qscriptdebuggerjob_p.h @@ -80,7 +80,7 @@ protected: QScopedPointer d_ptr; private: - Q_DECLARE_PRIVATE(QScriptDebuggerJob) + Q_DECLARE_SCOPED_PRIVATE(QScriptDebuggerJob) Q_DISABLE_COPY(QScriptDebuggerJob) }; diff --git a/src/scripttools/debugging/qscriptdebuggerlocalsmodel_p.h b/src/scripttools/debugging/qscriptdebuggerlocalsmodel_p.h index 172fb7e..b93e490 100644 --- a/src/scripttools/debugging/qscriptdebuggerlocalsmodel_p.h +++ b/src/scripttools/debugging/qscriptdebuggerlocalsmodel_p.h @@ -93,7 +93,7 @@ Q_SIGNALS: void scopeObjectAvailable(const QModelIndex &index); private: - Q_DECLARE_PRIVATE(QScriptDebuggerLocalsModel) + Q_DECLARE_SCOPED_PRIVATE(QScriptDebuggerLocalsModel) Q_DISABLE_COPY(QScriptDebuggerLocalsModel) }; diff --git a/src/scripttools/debugging/qscriptdebuggerlocalswidget_p.h b/src/scripttools/debugging/qscriptdebuggerlocalswidget_p.h index e68ce53..6ef9b37 100644 --- a/src/scripttools/debugging/qscriptdebuggerlocalswidget_p.h +++ b/src/scripttools/debugging/qscriptdebuggerlocalswidget_p.h @@ -72,7 +72,7 @@ public: void expand(const QModelIndex &index); private: - Q_DECLARE_PRIVATE(QScriptDebuggerLocalsWidget) + Q_DECLARE_SCOPED_PRIVATE(QScriptDebuggerLocalsWidget) Q_DISABLE_COPY(QScriptDebuggerLocalsWidget) Q_PRIVATE_SLOT(d_func(), void _q_onCompletionTaskFinished()) diff --git a/src/scripttools/debugging/qscriptdebuggerlocalswidgetinterface_p.h b/src/scripttools/debugging/qscriptdebuggerlocalswidgetinterface_p.h index 45936de..fd6ebae 100644 --- a/src/scripttools/debugging/qscriptdebuggerlocalswidgetinterface_p.h +++ b/src/scripttools/debugging/qscriptdebuggerlocalswidgetinterface_p.h @@ -83,7 +83,7 @@ protected: QWidget *parent, Qt::WindowFlags flags); private: - Q_DECLARE_PRIVATE(QScriptDebuggerLocalsWidgetInterface) + Q_DECLARE_SCOPED_PRIVATE(QScriptDebuggerLocalsWidgetInterface) Q_DISABLE_COPY(QScriptDebuggerLocalsWidgetInterface) }; diff --git a/src/scripttools/debugging/qscriptdebuggerresponse_p.h b/src/scripttools/debugging/qscriptdebuggerresponse_p.h index 645cab0..f372994 100644 --- a/src/scripttools/debugging/qscriptdebuggerresponse_p.h +++ b/src/scripttools/debugging/qscriptdebuggerresponse_p.h @@ -129,7 +129,7 @@ public: private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QScriptDebuggerResponse) + Q_DECLARE_SCOPED_PRIVATE(QScriptDebuggerResponse) }; Q_AUTOTEST_EXPORT QDataStream &operator<<(QDataStream &, const QScriptDebuggerResponse &); diff --git a/src/scripttools/debugging/qscriptdebuggerscriptedconsolecommand.cpp b/src/scripttools/debugging/qscriptdebuggerscriptedconsolecommand.cpp index 1324c01..4944411 100644 --- a/src/scripttools/debugging/qscriptdebuggerscriptedconsolecommand.cpp +++ b/src/scripttools/debugging/qscriptdebuggerscriptedconsolecommand.cpp @@ -359,7 +359,7 @@ public: int commandId); private: - Q_DECLARE_PRIVATE(QScriptDebuggerScriptedConsoleCommandJob) + Q_DECLARE_SCOPED_PRIVATE(QScriptDebuggerScriptedConsoleCommandJob) Q_DISABLE_COPY(QScriptDebuggerScriptedConsoleCommandJob) }; diff --git a/src/scripttools/debugging/qscriptdebuggerscriptedconsolecommand_p.h b/src/scripttools/debugging/qscriptdebuggerscriptedconsolecommand_p.h index 0fefea6..cea8ec9 100644 --- a/src/scripttools/debugging/qscriptdebuggerscriptedconsolecommand_p.h +++ b/src/scripttools/debugging/qscriptdebuggerscriptedconsolecommand_p.h @@ -97,7 +97,7 @@ public: QScriptDebuggerCommandSchedulerInterface *commandScheduler); private: - Q_DECLARE_PRIVATE(QScriptDebuggerScriptedConsoleCommand) + Q_DECLARE_SCOPED_PRIVATE(QScriptDebuggerScriptedConsoleCommand) Q_DISABLE_COPY(QScriptDebuggerScriptedConsoleCommand) }; diff --git a/src/scripttools/debugging/qscriptdebuggerscriptsmodel_p.h b/src/scripttools/debugging/qscriptdebuggerscriptsmodel_p.h index 1988ace..0e05d7e 100644 --- a/src/scripttools/debugging/qscriptdebuggerscriptsmodel_p.h +++ b/src/scripttools/debugging/qscriptdebuggerscriptsmodel_p.h @@ -92,7 +92,7 @@ public: QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; private: - Q_DECLARE_PRIVATE(QScriptDebuggerScriptsModel) + Q_DECLARE_SCOPED_PRIVATE(QScriptDebuggerScriptsModel) Q_DISABLE_COPY(QScriptDebuggerScriptsModel) }; diff --git a/src/scripttools/debugging/qscriptdebuggerscriptswidget_p.h b/src/scripttools/debugging/qscriptdebuggerscriptswidget_p.h index 4359ec1..4c17eda 100644 --- a/src/scripttools/debugging/qscriptdebuggerscriptswidget_p.h +++ b/src/scripttools/debugging/qscriptdebuggerscriptswidget_p.h @@ -73,7 +73,7 @@ public: void setCurrentScript(qint64 id); private: - Q_DECLARE_PRIVATE(QScriptDebuggerScriptsWidget) + Q_DECLARE_SCOPED_PRIVATE(QScriptDebuggerScriptsWidget) Q_DISABLE_COPY(QScriptDebuggerScriptsWidget) Q_PRIVATE_SLOT(d_func(), void _q_onCurrentChanged(const QModelIndex &)) diff --git a/src/scripttools/debugging/qscriptdebuggerscriptswidgetinterface_p.h b/src/scripttools/debugging/qscriptdebuggerscriptswidgetinterface_p.h index eff08dc..8aa3203 100644 --- a/src/scripttools/debugging/qscriptdebuggerscriptswidgetinterface_p.h +++ b/src/scripttools/debugging/qscriptdebuggerscriptswidgetinterface_p.h @@ -83,7 +83,7 @@ protected: QWidget *parent, Qt::WindowFlags flags); private: - Q_DECLARE_PRIVATE(QScriptDebuggerScriptsWidgetInterface) + Q_DECLARE_SCOPED_PRIVATE(QScriptDebuggerScriptsWidgetInterface) Q_DISABLE_COPY(QScriptDebuggerScriptsWidgetInterface) }; diff --git a/src/scripttools/debugging/qscriptdebuggerstackmodel_p.h b/src/scripttools/debugging/qscriptdebuggerstackmodel_p.h index ff493f2..3075594 100644 --- a/src/scripttools/debugging/qscriptdebuggerstackmodel_p.h +++ b/src/scripttools/debugging/qscriptdebuggerstackmodel_p.h @@ -78,7 +78,7 @@ public: QVariant headerData(int section, Qt::Orientation, int role) const; private: - Q_DECLARE_PRIVATE(QScriptDebuggerStackModel) + Q_DECLARE_SCOPED_PRIVATE(QScriptDebuggerStackModel) Q_DISABLE_COPY(QScriptDebuggerStackModel) }; diff --git a/src/scripttools/debugging/qscriptdebuggerstackwidget_p.h b/src/scripttools/debugging/qscriptdebuggerstackwidget_p.h index eaa04f3..4d8e6bc 100644 --- a/src/scripttools/debugging/qscriptdebuggerstackwidget_p.h +++ b/src/scripttools/debugging/qscriptdebuggerstackwidget_p.h @@ -73,7 +73,7 @@ public: void setCurrentFrameIndex(int frameIndex); private: - Q_DECLARE_PRIVATE(QScriptDebuggerStackWidget) + Q_DECLARE_SCOPED_PRIVATE(QScriptDebuggerStackWidget) Q_DISABLE_COPY(QScriptDebuggerStackWidget) Q_PRIVATE_SLOT(d_func(), void _q_onCurrentChanged(const QModelIndex &)) diff --git a/src/scripttools/debugging/qscriptdebuggerstackwidgetinterface_p.h b/src/scripttools/debugging/qscriptdebuggerstackwidgetinterface_p.h index d3c466c..bf1b698 100644 --- a/src/scripttools/debugging/qscriptdebuggerstackwidgetinterface_p.h +++ b/src/scripttools/debugging/qscriptdebuggerstackwidgetinterface_p.h @@ -82,7 +82,7 @@ protected: QWidget *parent, Qt::WindowFlags flags); private: - Q_DECLARE_PRIVATE(QScriptDebuggerStackWidgetInterface) + Q_DECLARE_SCOPED_PRIVATE(QScriptDebuggerStackWidgetInterface) Q_DISABLE_COPY(QScriptDebuggerStackWidgetInterface) }; diff --git a/src/scripttools/debugging/qscriptdebuggervalue_p.h b/src/scripttools/debugging/qscriptdebuggervalue_p.h index e701313..522f601 100644 --- a/src/scripttools/debugging/qscriptdebuggervalue_p.h +++ b/src/scripttools/debugging/qscriptdebuggervalue_p.h @@ -105,7 +105,7 @@ public: private: QScopedSharedPointer d_ptr; - Q_DECLARE_PRIVATE(QScriptDebuggerValue) + Q_DECLARE_SCOPED_PRIVATE(QScriptDebuggerValue) }; typedef QList QScriptDebuggerValueList; diff --git a/src/scripttools/debugging/qscriptdebuggervalueproperty_p.h b/src/scripttools/debugging/qscriptdebuggervalueproperty_p.h index 5e8f72a..af8b2d6 100644 --- a/src/scripttools/debugging/qscriptdebuggervalueproperty_p.h +++ b/src/scripttools/debugging/qscriptdebuggervalueproperty_p.h @@ -88,7 +88,7 @@ public: private: QScopedSharedPointer d_ptr; - Q_DECLARE_PRIVATE(QScriptDebuggerValueProperty) + Q_DECLARE_SCOPED_PRIVATE(QScriptDebuggerValueProperty) }; typedef QList QScriptDebuggerValuePropertyList; diff --git a/src/scripttools/debugging/qscriptdebugoutputwidget_p.h b/src/scripttools/debugging/qscriptdebugoutputwidget_p.h index 21c7eb2..e9fe112 100644 --- a/src/scripttools/debugging/qscriptdebugoutputwidget_p.h +++ b/src/scripttools/debugging/qscriptdebugoutputwidget_p.h @@ -74,7 +74,7 @@ public: void clear(); private: - Q_DECLARE_PRIVATE(QScriptDebugOutputWidget) + Q_DECLARE_SCOPED_PRIVATE(QScriptDebugOutputWidget) Q_DISABLE_COPY(QScriptDebugOutputWidget) }; diff --git a/src/scripttools/debugging/qscriptdebugoutputwidgetinterface_p.h b/src/scripttools/debugging/qscriptdebugoutputwidgetinterface_p.h index 6a124e4..22f9443 100644 --- a/src/scripttools/debugging/qscriptdebugoutputwidgetinterface_p.h +++ b/src/scripttools/debugging/qscriptdebugoutputwidgetinterface_p.h @@ -75,7 +75,7 @@ protected: QWidget *parent, Qt::WindowFlags flags); private: - Q_DECLARE_PRIVATE(QScriptDebugOutputWidgetInterface) + Q_DECLARE_SCOPED_PRIVATE(QScriptDebugOutputWidgetInterface) Q_DISABLE_COPY(QScriptDebugOutputWidgetInterface) }; diff --git a/src/scripttools/debugging/qscriptenginedebugger.h b/src/scripttools/debugging/qscriptenginedebugger.h index b9061a2..f5fa5fc 100644 --- a/src/scripttools/debugging/qscriptenginedebugger.h +++ b/src/scripttools/debugging/qscriptenginedebugger.h @@ -120,7 +120,7 @@ Q_SIGNALS: void evaluationResumed(); private: - Q_DECLARE_PRIVATE(QScriptEngineDebugger) + Q_DECLARE_SCOPED_PRIVATE(QScriptEngineDebugger) Q_DISABLE_COPY(QScriptEngineDebugger) Q_PRIVATE_SLOT(d_func(), void _q_showStandardWindow()) diff --git a/src/scripttools/debugging/qscriptenginedebuggerfrontend.cpp b/src/scripttools/debugging/qscriptenginedebuggerfrontend.cpp index c5e21ef..0a2886a 100644 --- a/src/scripttools/debugging/qscriptenginedebuggerfrontend.cpp +++ b/src/scripttools/debugging/qscriptenginedebuggerfrontend.cpp @@ -111,7 +111,7 @@ protected: void event(const QScriptDebuggerEvent &event); private: - Q_DECLARE_PRIVATE(QScriptEngineDebuggerBackend) + Q_DECLARE_SCOPED_PRIVATE(QScriptEngineDebuggerBackend) Q_DISABLE_COPY(QScriptEngineDebuggerBackend) }; diff --git a/src/scripttools/debugging/qscriptenginedebuggerfrontend_p.h b/src/scripttools/debugging/qscriptenginedebuggerfrontend_p.h index 226fecc..9320461 100644 --- a/src/scripttools/debugging/qscriptenginedebuggerfrontend_p.h +++ b/src/scripttools/debugging/qscriptenginedebuggerfrontend_p.h @@ -80,7 +80,7 @@ protected: void processCommand(int id, const QScriptDebuggerCommand &command); private: - Q_DECLARE_PRIVATE(QScriptEngineDebuggerFrontend) + Q_DECLARE_SCOPED_PRIVATE(QScriptEngineDebuggerFrontend) Q_DISABLE_COPY(QScriptEngineDebuggerFrontend) }; diff --git a/src/scripttools/debugging/qscripterrorlogwidget_p.h b/src/scripttools/debugging/qscripterrorlogwidget_p.h index 75d3e57..f05b5fb 100644 --- a/src/scripttools/debugging/qscripterrorlogwidget_p.h +++ b/src/scripttools/debugging/qscripterrorlogwidget_p.h @@ -74,7 +74,7 @@ public: void clear(); private: - Q_DECLARE_PRIVATE(QScriptErrorLogWidget) + Q_DECLARE_SCOPED_PRIVATE(QScriptErrorLogWidget) Q_DISABLE_COPY(QScriptErrorLogWidget) }; diff --git a/src/scripttools/debugging/qscripterrorlogwidgetinterface_p.h b/src/scripttools/debugging/qscripterrorlogwidgetinterface_p.h index 0ce86ff..903bc21 100644 --- a/src/scripttools/debugging/qscripterrorlogwidgetinterface_p.h +++ b/src/scripttools/debugging/qscripterrorlogwidgetinterface_p.h @@ -75,7 +75,7 @@ protected: QWidget *parent, Qt::WindowFlags flags); private: - Q_DECLARE_PRIVATE(QScriptErrorLogWidgetInterface) + Q_DECLARE_SCOPED_PRIVATE(QScriptErrorLogWidgetInterface) Q_DISABLE_COPY(QScriptErrorLogWidgetInterface) }; diff --git a/src/scripttools/debugging/qscriptscriptdata_p.h b/src/scripttools/debugging/qscriptscriptdata_p.h index d5ef52d..750bd2a 100644 --- a/src/scripttools/debugging/qscriptscriptdata_p.h +++ b/src/scripttools/debugging/qscriptscriptdata_p.h @@ -93,7 +93,7 @@ public: private: QScopedSharedPointer d_ptr; - Q_DECLARE_PRIVATE(QScriptScriptData) + Q_DECLARE_SCOPED_PRIVATE(QScriptScriptData) }; typedef QMap QScriptScriptMap; diff --git a/src/scripttools/debugging/qscriptstdmessagehandler_p.h b/src/scripttools/debugging/qscriptstdmessagehandler_p.h index 6242c94..10accc2 100644 --- a/src/scripttools/debugging/qscriptstdmessagehandler_p.h +++ b/src/scripttools/debugging/qscriptstdmessagehandler_p.h @@ -76,7 +76,7 @@ private: QScopedPointer d_ptr; private: - Q_DECLARE_PRIVATE(QScriptStdMessageHandler) + Q_DECLARE_SCOPED_PRIVATE(QScriptStdMessageHandler) Q_DISABLE_COPY(QScriptStdMessageHandler) }; diff --git a/src/scripttools/debugging/qscriptvalueproperty_p.h b/src/scripttools/debugging/qscriptvalueproperty_p.h index b752272..545047d 100644 --- a/src/scripttools/debugging/qscriptvalueproperty_p.h +++ b/src/scripttools/debugging/qscriptvalueproperty_p.h @@ -84,7 +84,7 @@ public: private: QScopedSharedPointer d_ptr; - Q_DECLARE_PRIVATE(QScriptValueProperty) + Q_DECLARE_SCOPED_PRIVATE(QScriptValueProperty) }; typedef QList QScriptValuePropertyList; diff --git a/src/sql/kernel/qsqldriver.h b/src/sql/kernel/qsqldriver.h index 3052be6..b411d65 100644 --- a/src/sql/kernel/qsqldriver.h +++ b/src/sql/kernel/qsqldriver.h @@ -69,7 +69,7 @@ class Q_SQL_EXPORT QSqlDriver : public QObject { friend class QSqlDatabase; Q_OBJECT - Q_DECLARE_PRIVATE(QSqlDriver) + Q_DECLARE_SCOPED_PRIVATE(QSqlDriver) public: enum DriverFeature { Transactions, QuerySize, BLOB, Unicode, PreparedQueries, diff --git a/src/sql/models/qsqlquerymodel.h b/src/sql/models/qsqlquerymodel.h index c81fa2c..bf99634 100644 --- a/src/sql/models/qsqlquerymodel.h +++ b/src/sql/models/qsqlquerymodel.h @@ -59,7 +59,7 @@ class QSqlQuery; class Q_SQL_EXPORT QSqlQueryModel: public QAbstractTableModel { Q_OBJECT - Q_DECLARE_PRIVATE(QSqlQueryModel) + Q_DECLARE_SCOPED_PRIVATE(QSqlQueryModel) public: explicit QSqlQueryModel(QObject *parent = 0); diff --git a/src/sql/models/qsqlrelationaltablemodel.h b/src/sql/models/qsqlrelationaltablemodel.h index f476a48..fa060b8 100644 --- a/src/sql/models/qsqlrelationaltablemodel.h +++ b/src/sql/models/qsqlrelationaltablemodel.h @@ -102,7 +102,7 @@ protected: QString orderByClause() const; private: - Q_DECLARE_PRIVATE(QSqlRelationalTableModel) + Q_DECLARE_SCOPED_PRIVATE(QSqlRelationalTableModel) }; QT_END_NAMESPACE diff --git a/src/sql/models/qsqltablemodel.h b/src/sql/models/qsqltablemodel.h index a6f4469..3e539be 100644 --- a/src/sql/models/qsqltablemodel.h +++ b/src/sql/models/qsqltablemodel.h @@ -59,7 +59,7 @@ class QSqlIndex; class Q_SQL_EXPORT QSqlTableModel: public QSqlQueryModel { Q_OBJECT - Q_DECLARE_PRIVATE(QSqlTableModel) + Q_DECLARE_SCOPED_PRIVATE(QSqlTableModel) public: enum EditStrategy {OnFieldChange, OnRowChange, OnManualSubmit}; diff --git a/src/svg/qgraphicssvgitem.h b/src/svg/qgraphicssvgitem.h index e7ef4b3..9a41e9b 100644 --- a/src/svg/qgraphicssvgitem.h +++ b/src/svg/qgraphicssvgitem.h @@ -87,7 +87,7 @@ public: private: Q_DISABLE_COPY(QGraphicsSvgItem) - // Q_DECLARE_PRIVATE_WITH_BASE(QGraphicsSvgItem, QObject) + // Q_DECLARE_SCOPED_PRIVATE_WITH_BASE(QGraphicsSvgItem, QObject) inline QGraphicsSvgItemPrivate *d_func() { return reinterpret_cast(QObject::d_ptr.data()); } inline const QGraphicsSvgItemPrivate *d_func() const diff --git a/src/svg/qsvggenerator.cpp b/src/svg/qsvggenerator.cpp index 9486479..b5c56cd 100644 --- a/src/svg/qsvggenerator.cpp +++ b/src/svg/qsvggenerator.cpp @@ -155,7 +155,7 @@ static inline QPaintEngine::PaintEngineFeatures svgEngineFeatures() class QSvgPaintEngine : public QPaintEngine { - Q_DECLARE_PRIVATE(QSvgPaintEngine) + Q_DECLARE_SCOPED_PRIVATE(QSvgPaintEngine) public: QSvgPaintEngine() diff --git a/src/svg/qsvggenerator.h b/src/svg/qsvggenerator.h index 5b60a05..951cee1 100644 --- a/src/svg/qsvggenerator.h +++ b/src/svg/qsvggenerator.h @@ -61,7 +61,7 @@ class QSvgGeneratorPrivate; class Q_SVG_EXPORT QSvgGenerator : public QPaintDevice { - Q_DECLARE_PRIVATE(QSvgGenerator) + Q_DECLARE_SCOPED_PRIVATE(QSvgGenerator) Q_PROPERTY(QSize size READ size WRITE setSize) Q_PROPERTY(QRectF viewBox READ viewBoxF WRITE setViewBox) diff --git a/src/svg/qsvgrenderer.h b/src/svg/qsvgrenderer.h index 78e8a7e..2b9a4f7 100644 --- a/src/svg/qsvgrenderer.h +++ b/src/svg/qsvgrenderer.h @@ -109,7 +109,7 @@ Q_SIGNALS: void repaintNeeded(); private: - Q_DECLARE_PRIVATE(QSvgRenderer) + Q_DECLARE_SCOPED_PRIVATE(QSvgRenderer) }; QT_END_NAMESPACE diff --git a/src/svg/qsvgwidget.h b/src/svg/qsvgwidget.h index ccf66bb..1a2cdd1 100644 --- a/src/svg/qsvgwidget.h +++ b/src/svg/qsvgwidget.h @@ -74,7 +74,7 @@ protected: void paintEvent(QPaintEvent *event); private: Q_DISABLE_COPY(QSvgWidget) - Q_DECLARE_PRIVATE(QSvgWidget) + Q_DECLARE_SCOPED_PRIVATE(QSvgWidget) }; QT_END_NAMESPACE diff --git a/src/testlib/qplaintestlogger.cpp b/src/testlib/qplaintestlogger.cpp index ce4bb5d..a0f0d25 100644 --- a/src/testlib/qplaintestlogger.cpp +++ b/src/testlib/qplaintestlogger.cpp @@ -129,7 +129,11 @@ namespace QTest { static const char *messageType2String(QAbstractTestLogger::MessageTypes type) { +#ifdef Q_OS_WIN static bool colored = (!qgetenv("QTEST_COLORED").isEmpty()); +#else + static bool colored = ::getenv("QTEST_COLORED"); +#endif switch (type) { case QAbstractTestLogger::Skip: return COLORED_MSG(0, 37, "SKIP "); //white @@ -165,10 +169,16 @@ namespace QTest { LeaveCriticalSection(&outputCriticalSection); #elif defined(Q_OS_SYMBIAN) TPtrC8 ptr(reinterpret_cast(str)); - HBufC* hbuffer = HBufC::NewL(ptr.Length()); - hbuffer->Des().Copy(ptr); - RDebug::Print(_L("[QTestLib Message] %S"), hbuffer); - delete hbuffer; + HBufC* hbuffer = HBufC::New(ptr.Length()); + if (hbuffer) { + hbuffer->Des().Copy(ptr); + RDebug::Print(_L("[QTestLib Message] %S"), hbuffer); + delete hbuffer; + } else { + TBuf<256> tmp; + tmp.Copy(ptr.Left(Min(256, ptr.Length()))); + RDebug::Print(_L("[QTestLib Message] %S"), &tmp); + } #endif QAbstractTestLogger::outputString(str); } diff --git a/src/xml/sax/qxml.h b/src/xml/sax/qxml.h index 5b1592c..acb84ef 100644 --- a/src/xml/sax/qxml.h +++ b/src/xml/sax/qxml.h @@ -271,7 +271,7 @@ public: private: Q_DISABLE_COPY(QXmlSimpleReader) - Q_DECLARE_PRIVATE(QXmlSimpleReader) + Q_DECLARE_SCOPED_PRIVATE(QXmlSimpleReader) QScopedPointer d_ptr; friend class QXmlSimpleReaderLocator; diff --git a/src/xmlpatterns/api/qabstractmessagehandler.h b/src/xmlpatterns/api/qabstractmessagehandler.h index 21c6fe5..2c26143 100644 --- a/src/xmlpatterns/api/qabstractmessagehandler.h +++ b/src/xmlpatterns/api/qabstractmessagehandler.h @@ -70,7 +70,7 @@ protected: const QUrl &identifier, const QSourceLocation &sourceLocation) = 0; private: - Q_DECLARE_PRIVATE(QAbstractMessageHandler) + Q_DECLARE_SCOPED_PRIVATE(QAbstractMessageHandler) Q_DISABLE_COPY(QAbstractMessageHandler) }; diff --git a/src/xmlpatterns/api/qabstracturiresolver.h b/src/xmlpatterns/api/qabstracturiresolver.h index c341ac2c..db545ea 100644 --- a/src/xmlpatterns/api/qabstracturiresolver.h +++ b/src/xmlpatterns/api/qabstracturiresolver.h @@ -64,7 +64,7 @@ public: private: Q_DISABLE_COPY(QAbstractUriResolver) - Q_DECLARE_PRIVATE(QAbstractUriResolver) + Q_DECLARE_SCOPED_PRIVATE(QAbstractUriResolver) }; QT_END_NAMESPACE diff --git a/src/xmlpatterns/api/qsimplexmlnodemodel.h b/src/xmlpatterns/api/qsimplexmlnodemodel.h index 1c70159..3098604 100644 --- a/src/xmlpatterns/api/qsimplexmlnodemodel.h +++ b/src/xmlpatterns/api/qsimplexmlnodemodel.h @@ -67,7 +67,7 @@ public: virtual QVector nodesByIdref(const QXmlName &idref) const; private: - Q_DECLARE_PRIVATE(QSimpleXmlNodeModel) + Q_DECLARE_SCOPED_PRIVATE(QSimpleXmlNodeModel) }; QT_END_NAMESPACE diff --git a/src/xmlpatterns/api/qxmlformatter.h b/src/xmlpatterns/api/qxmlformatter.h index 9bec06d..ca65331 100644 --- a/src/xmlpatterns/api/qxmlformatter.h +++ b/src/xmlpatterns/api/qxmlformatter.h @@ -84,7 +84,7 @@ public: virtual void item(const QPatternist::Item &item); private: inline void startFormattingContent(); - Q_DECLARE_PRIVATE(QXmlFormatter) + Q_DECLARE_SCOPED_PRIVATE(QXmlFormatter) }; QT_END_NAMESPACE diff --git a/src/xmlpatterns/api/qxmlresultitems.h b/src/xmlpatterns/api/qxmlresultitems.h index 6fc8d52..ad222ed 100644 --- a/src/xmlpatterns/api/qxmlresultitems.h +++ b/src/xmlpatterns/api/qxmlresultitems.h @@ -66,7 +66,7 @@ public: private: friend class QXmlQuery; - Q_DECLARE_PRIVATE(QXmlResultItems) + Q_DECLARE_SCOPED_PRIVATE(QXmlResultItems) QScopedPointer d_ptr; Q_DISABLE_COPY(QXmlResultItems) }; diff --git a/src/xmlpatterns/api/qxmlserializer.h b/src/xmlpatterns/api/qxmlserializer.h index d46a566..2fcc454 100644 --- a/src/xmlpatterns/api/qxmlserializer.h +++ b/src/xmlpatterns/api/qxmlserializer.h @@ -148,7 +148,7 @@ private: */ inline void write(const QString &content); - Q_DECLARE_PRIVATE(QXmlSerializer) + Q_DECLARE_SCOPED_PRIVATE(QXmlSerializer) }; QT_END_NAMESPACE diff --git a/tests/auto/exceptionsafety_objects/oomsimulator.h b/tests/auto/exceptionsafety_objects/oomsimulator.h index 3c8b389..11dd769 100644 --- a/tests/auto/exceptionsafety_objects/oomsimulator.h +++ b/tests/auto/exceptionsafety_objects/oomsimulator.h @@ -39,10 +39,29 @@ ** ****************************************************************************/ +#ifndef Q_OS_SYMBIAN #include +#endif #include -#include "3rdparty/memcheck.h" +#include +#include +#if !defined(Q_OS_WIN) && !defined(Q_OS_SYMBIAN) +# include "3rdparty/memcheck.h" +#endif + +static bool mallocFailActive = false; +static int mallocFailIndex = 0; +static int mallocCount = 0; + +static void my_terminate_handler() +{ + // set a breakpoint here to get a backtrace for your uncaught exceptions + fprintf(stderr, "Uncaught Exception Detected. Set a breakpoint in my_terminate_handler()\n"); + exit(1); +} + +#ifdef __GLIBC__ /* Use glibc's memory allocation hooks */ /* our hooks */ @@ -88,40 +107,6 @@ void my_init_hook() enableHooks(); } -static bool mallocFailActive = false; -static int mallocFailIndex = 0; -static int mallocCount = 0; - -struct AllocFailer -{ - inline AllocFailer() { mallocFailActive = true; setAllocFailIndex(0); } - inline ~AllocFailer() { deactivate(); } - - inline void setAllocFailIndex(int index) - { - if (RUNNING_ON_VALGRIND) { - VALGRIND_ENABLE_OOM_AT_ALLOC_INDEX(VALGRIND_GET_ALLOC_INDEX + index + 1); - } else { - mallocFailIndex = index; - } - } - - inline void deactivate() - { - mallocFailActive = false; - VALGRIND_ENABLE_OOM_AT_ALLOC_INDEX(INT_MAX); - } - - inline int currentAllocIndex() const - { - if (RUNNING_ON_VALGRIND) { - return VALGRIND_GET_ALLOC_INDEX; - } else { - return mallocCount; - } - } -}; - void *my_malloc_hook(size_t size, const void *) { ++mallocCount; @@ -173,6 +158,98 @@ void my_free_hook(void *ptr, const void *) __free_hook = my_free_hook; } +#elif defined(Q_CC_MSVC) + +#include "crtdbg.h" + +static int qCrtAllocHook(int allocType, void * /*userData*/, size_t /*size*/, + int blockType, long /*requestNumber*/, + const unsigned char * /*filename*/, int /*lineNumber*/) +{ + if (blockType == _CRT_BLOCK) + return TRUE; // ignore allocations from the C library + + switch (allocType) { + case _HOOK_ALLOC: + case _HOOK_REALLOC: + ++mallocCount; + if (mallocFailActive && --mallocFailIndex < 0) + return FALSE; // simulate OOM + } + + return TRUE; +} + +static struct QCrtDebugRegistrator +{ + QCrtDebugRegistrator() + { + _CrtSetAllocHook(qCrtAllocHook); + } + +} crtDebugRegistrator; + +#endif + +struct AllocFailer +{ + inline AllocFailer(int index) { reactivateAt(index); } + inline ~AllocFailer() { deactivate(); } + + inline void reactivateAt(int index) + { +#ifdef RUNNING_ON_VALGRIND + if (RUNNING_ON_VALGRIND) + VALGRIND_ENABLE_OOM_AT_ALLOC_INDEX(VALGRIND_GET_ALLOC_INDEX + index + 1); +#elif defined(Q_OS_SYMBIAN) + // symbian alloc fail index is 1 based + __UHEAP_BURSTFAILNEXT(index+1, KMaxTUint16); +#endif + mallocFailIndex = index; + mallocFailActive = true; + } + + inline void deactivate() + { + mallocFailActive = false; +#ifdef RUNNING_ON_VALGRIND + VALGRIND_ENABLE_OOM_AT_ALLOC_INDEX(0); +#elif defined(Q_OS_SYMBIAN) + __UHEAP_RESET; +#endif + } + + inline int currentAllocIndex() const + { +#ifdef RUNNING_ON_VALGRIND + if (RUNNING_ON_VALGRIND) + return VALGRIND_GET_ALLOC_INDEX; +#endif + return mallocCount; + } + + static bool initialize() + { + std::set_terminate(my_terminate_handler); +#ifdef RUNNING_ON_VALGRIND + if (RUNNING_ON_VALGRIND) { + if (VALGRIND_GET_ALLOC_INDEX == -1u) { + qWarning("You must use a valgrind with oom simulation support"); + return false; + } + // running in valgrind - don't use glibc hooks + disableHooks(); + + // never stop simulating OOM + VALGRIND_DISABLE_OOM_AT_ALLOC_INDEX(-1u); + } +#endif + return true; + } +}; + +#ifndef Q_OS_SYMBIAN + static void *new_helper(std::size_t size) { void *ptr = malloc(size); @@ -181,6 +258,11 @@ static void *new_helper(std::size_t size) return ptr; } +#ifdef Q_CC_MSVC +# pragma warning(push) +# pragma warning(disable: 4290) +#endif + // overload operator new void* operator new(size_t size) throw (std::bad_alloc) { return new_helper(size); } void* operator new[](size_t size) throw (std::bad_alloc) { return new_helper(size); } @@ -193,6 +275,12 @@ void operator delete[](void *ptr) throw() { if (ptr) free(ptr); } void operator delete(void *ptr, const std::nothrow_t&) throw() { if (ptr) free(ptr); } void operator delete[](void *ptr, const std::nothrow_t&) throw() { if (ptr) free (ptr); } +#ifdef Q_CC_MSVC +# pragma warning(pop) +#endif + +#endif + // ignore placement new and placement delete - those don't allocate. diff --git a/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp b/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp index dd5f8da..c867899 100644 --- a/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp +++ b/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp @@ -42,15 +42,21 @@ #include #include +#include + QT_USE_NAMESPACE -// this test only works with GLIBC (let moc run regardless, because it doesn't know about __GLIBC__) -#if defined(QT_NO_EXCEPTIONS) || (!defined(__GLIBC__) && !defined(Q_MOC_RUN)) +// this test only works with +// * GLIBC +// * MSVC - only debug builds (we need the crtdbg.h helpers) +#if (defined(QT_NO_EXCEPTIONS) || (!defined(__GLIBC__) && !defined(Q_CC_MSVC) && !defined(Q_OS_SYMBIAN))) && !defined(Q_MOC_RUN) QTEST_NOOP_MAIN #else #include "oomsimulator.h" +#if !defined(Q_OS_SYMBIAN) #include "3rdparty/memcheck.h" +#endif class tst_ExceptionSafetyObjects: public QObject { @@ -70,7 +76,7 @@ private slots: // helper structs to create an arbitrary widget struct AbstractObjectCreator { - virtual QObject *create(QObject *parent) = 0; + virtual void test(QObject *parent) = 0; }; Q_DECLARE_METATYPE(AbstractObjectCreator *) @@ -78,9 +84,57 @@ Q_DECLARE_METATYPE(AbstractObjectCreator *) template struct ObjectCreator : public AbstractObjectCreator { - QObject *create(QObject *parent) + void test(QObject *) + { + QScopedPointer ptr(new T); + } +}; + +struct BitArrayCreator : public AbstractObjectCreator +{ + void test(QObject *) + { QScopedPointer bitArray(new QBitArray(100, true)); } +}; + +struct ByteArrayMatcherCreator : public AbstractObjectCreator +{ + void test(QObject *) + { QScopedPointer ptr(new QByteArrayMatcher("ralf test",8)); } +}; + +struct CryptographicHashCreator : public AbstractObjectCreator +{ + void test(QObject *) + { + QScopedPointer ptr(new QCryptographicHash(QCryptographicHash::Sha1)); + ptr->addData("ralf test",8); + } +}; + +struct DataStreamCreator : public AbstractObjectCreator +{ + void test(QObject *) { - return parent ? new T(parent) : new T; + QScopedPointer arr(new QByteArray("hallo, test")); + QScopedPointer ptr(new QDataStream(arr.data(), QIODevice::ReadWrite)); + ptr->writeBytes("ralf test",8); + } +}; + +struct DirCreator : public AbstractObjectCreator +{ + void test(QObject *) + { + QDir::cleanPath("../////././"); + QScopedPointer ptr(new QDir(".")); + while( ptr->cdUp() ) + ; // just going up + ptr->count(); + ptr->exists(ptr->path()); + + QStringList filters; + filters << "*.cpp" << "*.cxx" << "*.cc"; + ptr->setNameFilters(filters); } }; @@ -90,46 +144,83 @@ void tst_ExceptionSafetyObjects::objects_data() #define NEWROW(T) QTest::newRow(#T) << static_cast(new ObjectCreator) NEWROW(QObject); + NEWROW(QBuffer); + NEWROW(QFile); + NEWROW(QProcess); + NEWROW(QSettings); + // NEWROW(QSocketNotifier); + NEWROW(QThread); + NEWROW(QThreadPool); + NEWROW(QTranslator); + NEWROW(QFSFileEngine); + +#define NEWROW2(T, CREATOR) QTest::newRow(#T) << static_cast(new CREATOR) + NEWROW2(QBitArray, BitArrayCreator); + NEWROW2(QByteArrayMatcher, ByteArrayMatcherCreator); + NEWROW2(QCryptographicHash, CryptographicHashCreator); + NEWROW2(QDataStream, DataStreamCreator); + NEWROW2(QDir, DirCreator); + } // create and destructs an object, and lets each and every allocation // during construction and destruction fail. static void doOOMTest(AbstractObjectCreator *creator, QObject *parent) { - AllocFailer allocFailer; int currentOOMIndex = 0; bool caught = false; + bool done = false; - int allocStartIndex = 0; - int allocEndIndex = 0; - int lastAllocCount = 0; + AllocFailer allocFailer(0); + int allocCountBefore = allocFailer.currentAllocIndex(); do { - allocFailer.setAllocFailIndex(++currentOOMIndex); + allocFailer.reactivateAt(++currentOOMIndex); caught = false; - lastAllocCount = allocEndIndex - allocStartIndex; - allocStartIndex = allocFailer.currentAllocIndex(); try { - QScopedPointer ptr(creator->create(parent)); + creator->test(parent); } catch (const std::bad_alloc &) { caught = true; + } catch (const std::exception &ex) { + if (strcmp(ex.what(), "autotest swallow") != 0) + throw; + caught = true; + } + + if (!caught) { + void *buf = malloc(42); + if (buf) { + // we got memory here - oom test is over. + free(buf); + done = true; + } } - allocEndIndex = allocFailer.currentAllocIndex(); +//#define REALLY_VERBOSE +#ifdef REALLY_VERBOSE + fprintf(stderr, " OOM Index: %d\n", currentOOMIndex); +#endif - } while (caught || allocEndIndex - allocStartIndex != lastAllocCount); + + } while (caught || !done); allocFailer.deactivate(); + +//#define VERBOSE +#ifdef VERBOSE + fprintf(stderr, "OOM Test done, checked allocs: %d (range %d - %d)\n", currentOOMIndex, + allocCountBefore, allocFailer.currentAllocIndex()); +#endif } -static bool alloc1Failed = false; -static bool alloc2Failed = false; -static bool alloc3Failed = false; -static bool alloc4Failed = false; -static bool malloc1Failed = false; -static bool malloc2Failed = false; +static int alloc1Failed = 0; +static int alloc2Failed = 0; +static int alloc3Failed = 0; +static int alloc4Failed = 0; +static int malloc1Failed = 0; +static int malloc2Failed = 0; // Tests that new, new[] and malloc() fail at least once during OOM testing. class SelfTestObject : public QObject @@ -138,54 +229,62 @@ public: SelfTestObject(QObject *parent = 0) : QObject(parent) { - try { delete new int; } catch (const std::bad_alloc &) { alloc1Failed = true; } - try { delete [] new double[5]; } catch (const std::bad_alloc &) { alloc2Failed = true; } + try { delete new int; } catch (const std::bad_alloc &) { ++alloc1Failed; throw; } + try { delete [] new double[5]; } catch (const std::bad_alloc &) { ++alloc2Failed; throw ;} void *buf = malloc(42); if (buf) free(buf); else - malloc1Failed = true; + ++malloc1Failed; } ~SelfTestObject() { - try { delete new int; } catch (const std::bad_alloc &) { alloc3Failed = true; } - try { delete [] new double[5]; } catch (const std::bad_alloc &) { alloc4Failed = true; } + try { delete new int; } catch (const std::bad_alloc &) { ++alloc3Failed; } + try { delete [] new double[5]; } catch (const std::bad_alloc &) { ++alloc4Failed; } void *buf = malloc(42); if (buf) free(buf); else - malloc2Failed = true; + ++malloc2Failed = true; } }; void tst_ExceptionSafetyObjects::initTestCase() { - if (RUNNING_ON_VALGRIND) { - QVERIFY2(VALGRIND_GET_ALLOC_INDEX != -1u, - "You must use a valgrind with oom simulation support"); - // running in valgrind - don't use glibc hooks - disableHooks(); - } + QVERIFY(AllocFailer::initialize()); // sanity check whether OOM simulation works - AllocFailer allocFailer; + AllocFailer allocFailer(0); // malloc fail index is 0 -> this malloc should fail. void *buf = malloc(42); + allocFailer.deactivate(); QVERIFY(!buf); // malloc fail index is 1 - second malloc should fail. - allocFailer.setAllocFailIndex(1); + allocFailer.reactivateAt(1); buf = malloc(42); + void *buf2 = malloc(42); + allocFailer.deactivate(); + QVERIFY(buf); free(buf); - buf = malloc(42); - QVERIFY(!buf); + QVERIFY(!buf2); - allocFailer.deactivate(); +#ifdef Q_OS_SYMBIAN + // temporary workaround for INC138398 + std::new_handler nh_func = std::set_new_handler(0); + (void) std::set_new_handler(nh_func); +#endif doOOMTest(new ObjectCreator, 0); + QCOMPARE(alloc1Failed, 1); + QCOMPARE(alloc2Failed, 1); + QCOMPARE(alloc3Failed, 2); + QCOMPARE(alloc4Failed, 3); + QCOMPARE(malloc1Failed, 1); + QCOMPARE(malloc2Failed, 1); } void tst_ExceptionSafetyObjects::objects() @@ -198,23 +297,94 @@ void tst_ExceptionSafetyObjects::objects() template struct WidgetCreator : public AbstractObjectCreator { - QObject *create(QObject *parent) + void test(QObject *parent) + { + Q_ASSERT(!parent || parent->isWidgetType()); + QScopedPointer ptr(parent ? new T(static_cast(parent)) : new T); + } +}; + +// QSizeGrip doesn't have a default constructor - always pass parent (even though it might be 0) +template <> struct WidgetCreator : public AbstractObjectCreator +{ + void test(QObject *parent) { - return parent ? new T(static_cast(parent)) : new T; + Q_ASSERT(!parent || parent->isWidgetType()); + QScopedPointer ptr(new QSizeGrip(static_cast(parent))); } }; +// QDesktopWidget doesn't need a parent. +template <> struct WidgetCreator : public AbstractObjectCreator +{ + void test(QObject *parent) + { + Q_ASSERT(!parent || parent->isWidgetType()); + QScopedPointer ptr(new QDesktopWidget()); + } +}; void tst_ExceptionSafetyObjects::widgets_data() { QTest::addColumn("widgetCreator"); #undef NEWROW #define NEWROW(T) QTest::newRow(#T) << static_cast(new WidgetCreator) + NEWROW(QWidget); - NEWROW(QPushButton); - NEWROW(QLabel); + + NEWROW(QButtonGroup); + NEWROW(QDesktopWidget); + NEWROW(QCheckBox); + NEWROW(QComboBox); + NEWROW(QCommandLinkButton); + NEWROW(QDateEdit); + NEWROW(QDateTimeEdit); + NEWROW(QDial); + NEWROW(QDoubleSpinBox); + NEWROW(QFocusFrame); + NEWROW(QFontComboBox); NEWROW(QFrame); + NEWROW(QGroupBox); + NEWROW(QLCDNumber); + NEWROW(QLabel); + NEWROW(QLCDNumber); + NEWROW(QLineEdit); + NEWROW(QMenu); + NEWROW(QPlainTextEdit); + NEWROW(QProgressBar); + NEWROW(QPushButton); + NEWROW(QRadioButton); + NEWROW(QScrollArea); + NEWROW(QScrollBar); + NEWROW(QSizeGrip); + NEWROW(QSlider); + NEWROW(QSpinBox); + NEWROW(QSplitter); NEWROW(QStackedWidget); + NEWROW(QStatusBar); + NEWROW(QTabBar); + NEWROW(QTabWidget); + NEWROW(QTextBrowser); + NEWROW(QTextEdit); + NEWROW(QTimeEdit); + NEWROW(QToolBox); + NEWROW(QToolButton); + NEWROW(QStatusBar); + NEWROW(QSplitter); + NEWROW(QTextEdit); + NEWROW(QTextBrowser); + NEWROW(QToolBar); + NEWROW(QMenuBar); + NEWROW(QMainWindow); + NEWROW(QWorkspace); + NEWROW(QColumnView); + NEWROW(QListView); + NEWROW(QListWidget); + NEWROW(QTableView); + NEWROW(QTableWidget); + NEWROW(QTreeView); + NEWROW(QTreeWidget); + } void tst_ExceptionSafetyObjects::widgets() @@ -225,6 +395,9 @@ void tst_ExceptionSafetyObjects::widgets() QWidget parent; doOOMTest(widgetCreator, &parent); + + // if the test reaches here without crashing, we passed :) + QVERIFY(true); } QTEST_MAIN(tst_ExceptionSafetyObjects) diff --git a/tests/auto/qfiledialog/tst_qfiledialog.cpp b/tests/auto/qfiledialog/tst_qfiledialog.cpp index 19ea0b8..f412cfb 100644 --- a/tests/auto/qfiledialog/tst_qfiledialog.cpp +++ b/tests/auto/qfiledialog/tst_qfiledialog.cpp @@ -1353,7 +1353,7 @@ void tst_QFiledialog::heapCorruption() struct FriendlyQFileDialog : public QFileDialog { friend class tst_QFileDialog; - Q_DECLARE_PRIVATE(QFileDialog) + Q_DECLARE_SCOPED_PRIVATE(QFileDialog) }; diff --git a/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp index c41f1d1..e6c0030 100644 --- a/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp +++ b/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp @@ -770,7 +770,7 @@ void tst_QFileSystemModel::setData() class MyFriendFileSystemModel : public QFileSystemModel { friend class tst_QFileSystemModel; - Q_DECLARE_PRIVATE(QFileSystemModel) + Q_DECLARE_SCOPED_PRIVATE(QFileSystemModel) }; void tst_QFileSystemModel::sort_data() diff --git a/tests/auto/qglobal/tst_qglobal.cpp b/tests/auto/qglobal/tst_qglobal.cpp index 49e5d7d..28556be 100644 --- a/tests/auto/qglobal/tst_qglobal.cpp +++ b/tests/auto/qglobal/tst_qglobal.cpp @@ -51,6 +51,7 @@ private slots: void for_each(); void qassert(); void qtry(); + void checkptr(); }; void tst_QGlobal::qIsNull() @@ -252,5 +253,14 @@ void tst_QGlobal::qtry() QCOMPARE(i, 4); } +void tst_QGlobal::checkptr() +{ + int i; + QCOMPARE(q_check_ptr(&i), &i); + + const char *c = "hello"; + QCOMPARE(q_check_ptr(c), c); +} + QTEST_MAIN(tst_QGlobal) #include "tst_qglobal.moc" diff --git a/tests/auto/qstandarditemmodel/tst_qstandarditemmodel.cpp b/tests/auto/qstandarditemmodel/tst_qstandarditemmodel.cpp index 85611e2..216fe8a 100644 --- a/tests/auto/qstandarditemmodel/tst_qstandarditemmodel.cpp +++ b/tests/auto/qstandarditemmodel/tst_qstandarditemmodel.cpp @@ -1467,7 +1467,7 @@ static QModelIndex indexFromText(QStandardItemModel *model, const QString &text) struct FriendlyTreeView : public QTreeView { friend class tst_QStandardItemModel; - Q_DECLARE_PRIVATE(QTreeView) + Q_DECLARE_SCOPED_PRIVATE(QTreeView) }; void tst_QStandardItemModel::treeDragAndDrop() diff --git a/tests/auto/symbian/qmainexceptions/tst_qmainexceptions.cpp b/tests/auto/symbian/qmainexceptions/tst_qmainexceptions.cpp index adad544..1601b7e 100644 --- a/tests/auto/symbian/qmainexceptions/tst_qmainexceptions.cpp +++ b/tests/auto/symbian/qmainexceptions/tst_qmainexceptions.cpp @@ -41,6 +41,9 @@ #include #include +#include +#include +#include #ifdef Q_OS_SYMBIAN @@ -55,6 +58,7 @@ public: void TestSchedulerCatchesError(TLeavingFunc* f, int error); void TestSymbianRoundTrip(int leave, int trap); + void TestStdRoundTrip(const std::exception& thrown, const std::exception& caught); bool event(QEvent *event); @@ -72,6 +76,8 @@ private slots: void testDtor1(); void testDtor2(); void testNestedExceptions(); + void testScopedPointer(); + void testHybrid(); }; class CDummy : public CBase @@ -169,7 +175,7 @@ void ThrowBadAlloc() void TranslateThrowBadAllocL() { - QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_LEAVE(ThrowBadAlloc()); + QT_TRYCATCH_LEAVING(ThrowBadAlloc()); } void tst_qmainexceptions::testTranslateBadAlloc() @@ -186,7 +192,7 @@ void BigAlloc() void TranslateBigAllocL() { - QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_LEAVE(BigAlloc()); + QT_TRYCATCH_LEAVING(BigAlloc()); } void tst_qmainexceptions::testTranslateBigAlloc() @@ -199,13 +205,27 @@ void tst_qmainexceptions::TestSymbianRoundTrip(int leave, int trap) { // check that leave converted to exception, converted to error gives expected error code int trapped; - QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_ERROR( + QT_TRYCATCH_ERROR( trapped, - QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION( + QT_TRAP_THROWING( User::LeaveIfError(leave))); QCOMPARE(trap, trapped); } +void tst_qmainexceptions::TestStdRoundTrip(const std::exception& thrown, const std::exception& caught) +{ + bool ok = false; + try { + QT_TRAP_THROWING(qt_exception2SymbianLeaveL(thrown)); + } catch (const std::exception& ex) { + const std::type_info& exType = typeid(ex); + const std::type_info& caughtType = typeid(caught); + QCOMPARE(exType, caughtType); + ok = true; + } + QCOMPARE(ok, true); +} + void tst_qmainexceptions::testRoundTrip() { for (int e=-50; e<0; e++) @@ -214,12 +234,16 @@ void tst_qmainexceptions::testRoundTrip() // positive error codes are not errors TestSymbianRoundTrip(1, KErrNone); TestSymbianRoundTrip(1000000000, KErrNone); + TestStdRoundTrip(std::bad_alloc(), std::bad_alloc()); + TestStdRoundTrip(std::invalid_argument("abc"), std::invalid_argument("")); + TestStdRoundTrip(std::underflow_error("abc"), std::underflow_error("")); + TestStdRoundTrip(std::overflow_error("abc"), std::overflow_error("")); } void tst_qmainexceptions::testTrap() { - // testing qt_translateExceptionToSymbianErrorL - TRAPD(err, qt_translateExceptionToSymbianErrorL(std::bad_alloc())); + // testing qt_exception2SymbianLeaveL + TRAPD(err, qt_exception2SymbianLeaveL(std::bad_alloc())); QCOMPARE(err, KErrNoMemory); } @@ -310,6 +334,126 @@ void tst_qmainexceptions::testNestedExceptions() catch (const std::exception&) {} } +class CTestRef : public CBase +{ +public: + CTestRef(int& aX) : iX(aX) { iX++; } + ~CTestRef() { iX--; } + int& iX; +}; + +void tst_qmainexceptions::testScopedPointer() +{ + int x = 0; + { + QScopedPointer ptr(q_check_ptr(new CTestRef(x))); + QCOMPARE(x, 1); + } + QCOMPARE(x, 0); + try { + QScopedPointer ptr(q_check_ptr(new CTestRef(x))); + QCOMPARE(x, 1); + throw 1; + } catch (int) { + QCOMPARE(x, 0); + } + QCOMPARE(x, 0); +} + +int dtorFired[20]; +int* recDtor; + +class CDtorOrder : public CBase +{ +public: + CDtorOrder(TInt aId) : iId(aId) {} + ~CDtorOrder() { *(recDtor++)=iId; } + TInt iId; +}; + +class QDtorOrder +{ +public: + QDtorOrder(int aId) : iId(aId) {} + ~QDtorOrder() { *(recDtor++)=iId; } + int iId; +}; + +class RDtorOrder : public RHandleBase +{ +public: + TInt Connect(TInt aId) {iId = aId; SetHandle(aId); return KErrNone; } + void Close() { *(recDtor++)=iId; } + TInt iId; +}; + +enum THybridAction {EHybridLeave, EHybridThrow, EHybridPass}; + +void HybridFuncLX(THybridAction aAction) +{ + recDtor = dtorFired; + QDtorOrder q1(1); + {QDtorOrder q2(2);} + CDtorOrder* c1 = new(ELeave) CDtorOrder(11); + CleanupStack::PushL(c1); + {LManagedHandle r1; + r1->Connect(21) OR_LEAVE;} + CDtorOrder* c2 = new(ELeave) CDtorOrder(12); + CleanupStack::PushL(c2); + QDtorOrder q3(3); + LManagedHandle r2; + r2->Connect(22) OR_LEAVE; + CDtorOrder* c3 = new(ELeave) CDtorOrder(13); + CleanupStack::PushL(c3); + CleanupStack::PopAndDestroy(c3); + QDtorOrder q4(4); + switch (aAction) + { + case EHybridLeave: + User::Leave(KErrNotFound); + break; + case EHybridThrow: + throw std::bad_alloc(); + break; + default: + break; + } + CleanupStack::PopAndDestroy(2); +} + +void tst_qmainexceptions::testHybrid() +{ + TRAPD(error, + QT_TRYCATCH_LEAVING( + HybridFuncLX(EHybridLeave); + ) ); + QCOMPARE(error, KErrNotFound); + int expected1[] = {2, 21, 13, 12, 11, 4, 22, 3, 1}; + QCOMPARE(int(sizeof(expected1)/sizeof(int)), int(recDtor - dtorFired)); + for (int i=0; i d_ptr; - Q_DECLARE_PRIVATE(BrushManagerProxy) + Q_DECLARE_SCOPED_PRIVATE(BrushManagerProxy) Q_DISABLE_COPY(BrushManagerProxy) Q_PRIVATE_SLOT(d_func(), void brushAdded(const QString &, const QBrush &)) Q_PRIVATE_SLOT(d_func(), void brushRemoved(const QString &name)) diff --git a/tools/designer/src/components/formeditor/qtbrushmanager.h b/tools/designer/src/components/formeditor/qtbrushmanager.h index 4884c577..e6ced60 100644 --- a/tools/designer/src/components/formeditor/qtbrushmanager.h +++ b/tools/designer/src/components/formeditor/qtbrushmanager.h @@ -78,7 +78,7 @@ signals: private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtBrushManager) + Q_DECLARE_SCOPED_PRIVATE(QtBrushManager) Q_DISABLE_COPY(QtBrushManager) }; diff --git a/tools/designer/src/lib/shared/iconselector_p.h b/tools/designer/src/lib/shared/iconselector_p.h index 9190d54..e91a21e 100644 --- a/tools/designer/src/lib/shared/iconselector_p.h +++ b/tools/designer/src/lib/shared/iconselector_p.h @@ -88,7 +88,7 @@ public: private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(LanguageResourceDialog) + Q_DECLARE_SCOPED_PRIVATE(LanguageResourceDialog) Q_DISABLE_COPY(LanguageResourceDialog) Q_PRIVATE_SLOT(d_func(), void slotAccepted()) Q_PRIVATE_SLOT(d_func(), void slotPathChanged(QString)) @@ -121,7 +121,7 @@ signals: void iconChanged(const PropertySheetIconValue &icon); private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(IconSelector) + Q_DECLARE_SCOPED_PRIVATE(IconSelector) Q_DISABLE_COPY(IconSelector) Q_PRIVATE_SLOT(d_func(), void slotStateActivated()) diff --git a/tools/designer/src/lib/shared/qtresourceeditordialog_p.h b/tools/designer/src/lib/shared/qtresourceeditordialog_p.h index 6eac2b8..59c5ca6 100644 --- a/tools/designer/src/lib/shared/qtresourceeditordialog_p.h +++ b/tools/designer/src/lib/shared/qtresourceeditordialog_p.h @@ -85,7 +85,7 @@ private: ~QtResourceEditorDialog(); QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtResourceEditorDialog) + Q_DECLARE_SCOPED_PRIVATE(QtResourceEditorDialog) Q_DISABLE_COPY(QtResourceEditorDialog) Q_PRIVATE_SLOT(d_func(), void slotQrcFileInserted(QtQrcFile *)) diff --git a/tools/designer/src/lib/shared/qtresourcemodel_p.h b/tools/designer/src/lib/shared/qtresourcemodel_p.h index e9f1c93..22e98bb 100644 --- a/tools/designer/src/lib/shared/qtresourcemodel_p.h +++ b/tools/designer/src/lib/shared/qtresourcemodel_p.h @@ -89,7 +89,7 @@ private: friend class QtResourceModel; QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtResourceSet) + Q_DECLARE_SCOPED_PRIVATE(QtResourceSet) Q_DISABLE_COPY(QtResourceSet) }; @@ -134,7 +134,7 @@ private: friend class QtResourceSet; QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtResourceModel) + Q_DECLARE_SCOPED_PRIVATE(QtResourceModel) Q_DISABLE_COPY(QtResourceModel) Q_PRIVATE_SLOT(d_func(), void slotFileChanged(const QString &)) diff --git a/tools/designer/src/lib/shared/qtresourceview_p.h b/tools/designer/src/lib/shared/qtresourceview_p.h index 0484686..82bb8d8 100644 --- a/tools/designer/src/lib/shared/qtresourceview_p.h +++ b/tools/designer/src/lib/shared/qtresourceview_p.h @@ -103,7 +103,7 @@ protected: private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtResourceView) + Q_DECLARE_SCOPED_PRIVATE(QtResourceView) Q_DISABLE_COPY(QtResourceView) Q_PRIVATE_SLOT(d_func(), void slotResourceSetActivated(QtResourceSet *)) Q_PRIVATE_SLOT(d_func(), void slotCurrentPathChanged(QTreeWidgetItem *)) @@ -131,7 +131,7 @@ public: private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtResourceViewDialog) + Q_DECLARE_SCOPED_PRIVATE(QtResourceViewDialog) Q_DISABLE_COPY(QtResourceViewDialog) Q_PRIVATE_SLOT(d_func(), void slotResourceSelected(const QString &)) }; diff --git a/tools/designer/src/uitools/quiloader.h b/tools/designer/src/uitools/quiloader.h index 40b5010..7f718a6 100644 --- a/tools/designer/src/uitools/quiloader.h +++ b/tools/designer/src/uitools/quiloader.h @@ -92,7 +92,7 @@ public: private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QUiLoader) + Q_DECLARE_SCOPED_PRIVATE(QUiLoader) Q_DISABLE_COPY(QUiLoader) }; diff --git a/tools/shared/qtgradienteditor/qtcolorbutton.h b/tools/shared/qtgradienteditor/qtcolorbutton.h index 0348998..5f34815 100644 --- a/tools/shared/qtgradienteditor/qtcolorbutton.h +++ b/tools/shared/qtgradienteditor/qtcolorbutton.h @@ -76,7 +76,7 @@ protected: #endif private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtColorButton) + Q_DECLARE_SCOPED_PRIVATE(QtColorButton) Q_DISABLE_COPY(QtColorButton) Q_PRIVATE_SLOT(d_func(), void slotEditColor()) }; diff --git a/tools/shared/qtgradienteditor/qtcolorline.h b/tools/shared/qtgradienteditor/qtcolorline.h index ffd3eea..f54ec70 100644 --- a/tools/shared/qtgradienteditor/qtcolorline.h +++ b/tools/shared/qtgradienteditor/qtcolorline.h @@ -115,7 +115,7 @@ protected: private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtColorLine) + Q_DECLARE_SCOPED_PRIVATE(QtColorLine) Q_DISABLE_COPY(QtColorLine) }; diff --git a/tools/shared/qtgradienteditor/qtgradientdialog.h b/tools/shared/qtgradienteditor/qtgradientdialog.h index f293a28..6f40794 100644 --- a/tools/shared/qtgradienteditor/qtgradientdialog.h +++ b/tools/shared/qtgradienteditor/qtgradientdialog.h @@ -77,7 +77,7 @@ public: private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtGradientDialog) + Q_DECLARE_SCOPED_PRIVATE(QtGradientDialog) Q_DISABLE_COPY(QtGradientDialog) Q_PRIVATE_SLOT(d_func(), void slotAboutToShowDetails(bool details, int extensionWidthHint)) }; diff --git a/tools/shared/qtgradienteditor/qtgradienteditor.h b/tools/shared/qtgradienteditor/qtgradienteditor.h index 2d96515..b7dcfd3 100644 --- a/tools/shared/qtgradienteditor/qtgradienteditor.h +++ b/tools/shared/qtgradienteditor/qtgradienteditor.h @@ -79,7 +79,7 @@ signals: private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtGradientEditor) + Q_DECLARE_SCOPED_PRIVATE(QtGradientEditor) Q_DISABLE_COPY(QtGradientEditor) Q_PRIVATE_SLOT(d_func(), void slotGradientStopsChanged(const QGradientStops &stops)) Q_PRIVATE_SLOT(d_func(), void slotTypeChanged(int type)) diff --git a/tools/shared/qtgradienteditor/qtgradientstopscontroller.h b/tools/shared/qtgradienteditor/qtgradientstopscontroller.h index 7c6a660..94a5619 100644 --- a/tools/shared/qtgradienteditor/qtgradientstopscontroller.h +++ b/tools/shared/qtgradienteditor/qtgradientstopscontroller.h @@ -71,7 +71,7 @@ signals: private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtGradientStopsController) + Q_DECLARE_SCOPED_PRIVATE(QtGradientStopsController) Q_DISABLE_COPY(QtGradientStopsController) Q_PRIVATE_SLOT(d_func(), void slotHsvClicked()) Q_PRIVATE_SLOT(d_func(), void slotRgbClicked()) diff --git a/tools/shared/qtgradienteditor/qtgradientstopsmodel.h b/tools/shared/qtgradienteditor/qtgradientstopsmodel.h index a02ebc5..8190829 100644 --- a/tools/shared/qtgradienteditor/qtgradientstopsmodel.h +++ b/tools/shared/qtgradienteditor/qtgradientstopsmodel.h @@ -112,7 +112,7 @@ signals: private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtGradientStopsModel) + Q_DECLARE_SCOPED_PRIVATE(QtGradientStopsModel) Q_DISABLE_COPY(QtGradientStopsModel) }; diff --git a/tools/shared/qtgradienteditor/qtgradientstopswidget.h b/tools/shared/qtgradienteditor/qtgradientstopswidget.h index 753d695..7c7c5fc 100644 --- a/tools/shared/qtgradienteditor/qtgradientstopswidget.h +++ b/tools/shared/qtgradienteditor/qtgradientstopswidget.h @@ -92,7 +92,7 @@ protected: private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtGradientStopsWidget) + Q_DECLARE_SCOPED_PRIVATE(QtGradientStopsWidget) Q_DISABLE_COPY(QtGradientStopsWidget) Q_PRIVATE_SLOT(d_func(), void slotStopAdded(QtGradientStop *stop)) Q_PRIVATE_SLOT(d_func(), void slotStopRemoved(QtGradientStop *stop)) diff --git a/tools/shared/qtgradienteditor/qtgradientwidget.h b/tools/shared/qtgradienteditor/qtgradientwidget.h index 3e23bf9..52fdcbb 100644 --- a/tools/shared/qtgradienteditor/qtgradientwidget.h +++ b/tools/shared/qtgradienteditor/qtgradientwidget.h @@ -111,7 +111,7 @@ protected: private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtGradientWidget) + Q_DECLARE_SCOPED_PRIVATE(QtGradientWidget) Q_DISABLE_COPY(QtGradientWidget) }; diff --git a/tools/shared/qtpropertybrowser/qtbuttonpropertybrowser.h b/tools/shared/qtpropertybrowser/qtbuttonpropertybrowser.h index a558657..13d37e2 100644 --- a/tools/shared/qtpropertybrowser/qtbuttonpropertybrowser.h +++ b/tools/shared/qtpropertybrowser/qtbuttonpropertybrowser.h @@ -72,7 +72,7 @@ protected: private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtButtonPropertyBrowser) + Q_DECLARE_SCOPED_PRIVATE(QtButtonPropertyBrowser) Q_DISABLE_COPY(QtButtonPropertyBrowser) Q_PRIVATE_SLOT(d_func(), void slotUpdate()) Q_PRIVATE_SLOT(d_func(), void slotEditorDestroyed()) diff --git a/tools/shared/qtpropertybrowser/qteditorfactory.h b/tools/shared/qtpropertybrowser/qteditorfactory.h index bad2080..ec30f9d 100644 --- a/tools/shared/qtpropertybrowser/qteditorfactory.h +++ b/tools/shared/qtpropertybrowser/qteditorfactory.h @@ -61,7 +61,7 @@ protected: void disconnectPropertyManager(QtIntPropertyManager *manager); private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtSpinBoxFactory) + Q_DECLARE_SCOPED_PRIVATE(QtSpinBoxFactory) Q_DISABLE_COPY(QtSpinBoxFactory) Q_PRIVATE_SLOT(d_func(), void slotPropertyChanged(QtProperty *, int)) Q_PRIVATE_SLOT(d_func(), void slotRangeChanged(QtProperty *, int, int)) @@ -85,7 +85,7 @@ protected: void disconnectPropertyManager(QtIntPropertyManager *manager); private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtSliderFactory) + Q_DECLARE_SCOPED_PRIVATE(QtSliderFactory) Q_DISABLE_COPY(QtSliderFactory) Q_PRIVATE_SLOT(d_func(), void slotPropertyChanged(QtProperty *, int)) Q_PRIVATE_SLOT(d_func(), void slotRangeChanged(QtProperty *, int, int)) @@ -109,7 +109,7 @@ protected: void disconnectPropertyManager(QtIntPropertyManager *manager); private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtScrollBarFactory) + Q_DECLARE_SCOPED_PRIVATE(QtScrollBarFactory) Q_DISABLE_COPY(QtScrollBarFactory) Q_PRIVATE_SLOT(d_func(), void slotPropertyChanged(QtProperty *, int)) Q_PRIVATE_SLOT(d_func(), void slotRangeChanged(QtProperty *, int, int)) @@ -133,7 +133,7 @@ protected: void disconnectPropertyManager(QtBoolPropertyManager *manager); private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtCheckBoxFactory) + Q_DECLARE_SCOPED_PRIVATE(QtCheckBoxFactory) Q_DISABLE_COPY(QtCheckBoxFactory) Q_PRIVATE_SLOT(d_func(), void slotPropertyChanged(QtProperty *, bool)) Q_PRIVATE_SLOT(d_func(), void slotSetValue(bool)) @@ -155,7 +155,7 @@ protected: void disconnectPropertyManager(QtDoublePropertyManager *manager); private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtDoubleSpinBoxFactory) + Q_DECLARE_SCOPED_PRIVATE(QtDoubleSpinBoxFactory) Q_DISABLE_COPY(QtDoubleSpinBoxFactory) Q_PRIVATE_SLOT(d_func(), void slotPropertyChanged(QtProperty *, double)) Q_PRIVATE_SLOT(d_func(), void slotRangeChanged(QtProperty *, double, double)) @@ -180,7 +180,7 @@ protected: void disconnectPropertyManager(QtStringPropertyManager *manager); private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtLineEditFactory) + Q_DECLARE_SCOPED_PRIVATE(QtLineEditFactory) Q_DISABLE_COPY(QtLineEditFactory) Q_PRIVATE_SLOT(d_func(), void slotPropertyChanged(QtProperty *, const QString &)) Q_PRIVATE_SLOT(d_func(), void slotRegExpChanged(QtProperty *, const QRegExp &)) @@ -203,7 +203,7 @@ protected: void disconnectPropertyManager(QtDatePropertyManager *manager); private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtDateEditFactory) + Q_DECLARE_SCOPED_PRIVATE(QtDateEditFactory) Q_DISABLE_COPY(QtDateEditFactory) Q_PRIVATE_SLOT(d_func(), void slotPropertyChanged(QtProperty *, const QDate &)) Q_PRIVATE_SLOT(d_func(), void slotRangeChanged(QtProperty *, @@ -227,7 +227,7 @@ protected: void disconnectPropertyManager(QtTimePropertyManager *manager); private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtTimeEditFactory) + Q_DECLARE_SCOPED_PRIVATE(QtTimeEditFactory) Q_DISABLE_COPY(QtTimeEditFactory) Q_PRIVATE_SLOT(d_func(), void slotPropertyChanged(QtProperty *, const QTime &)) Q_PRIVATE_SLOT(d_func(), void slotSetValue(const QTime &)) @@ -249,7 +249,7 @@ protected: void disconnectPropertyManager(QtDateTimePropertyManager *manager); private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtDateTimeEditFactory) + Q_DECLARE_SCOPED_PRIVATE(QtDateTimeEditFactory) Q_DISABLE_COPY(QtDateTimeEditFactory) Q_PRIVATE_SLOT(d_func(), void slotPropertyChanged(QtProperty *, const QDateTime &)) Q_PRIVATE_SLOT(d_func(), void slotSetValue(const QDateTime &)) @@ -271,7 +271,7 @@ protected: void disconnectPropertyManager(QtKeySequencePropertyManager *manager); private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtKeySequenceEditorFactory) + Q_DECLARE_SCOPED_PRIVATE(QtKeySequenceEditorFactory) Q_DISABLE_COPY(QtKeySequenceEditorFactory) Q_PRIVATE_SLOT(d_func(), void slotPropertyChanged(QtProperty *, const QKeySequence &)) Q_PRIVATE_SLOT(d_func(), void slotSetValue(const QKeySequence &)) @@ -293,7 +293,7 @@ protected: void disconnectPropertyManager(QtCharPropertyManager *manager); private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtCharEditorFactory) + Q_DECLARE_SCOPED_PRIVATE(QtCharEditorFactory) Q_DISABLE_COPY(QtCharEditorFactory) Q_PRIVATE_SLOT(d_func(), void slotPropertyChanged(QtProperty *, const QChar &)) Q_PRIVATE_SLOT(d_func(), void slotSetValue(const QChar &)) @@ -315,7 +315,7 @@ protected: void disconnectPropertyManager(QtEnumPropertyManager *manager); private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtEnumEditorFactory) + Q_DECLARE_SCOPED_PRIVATE(QtEnumEditorFactory) Q_DISABLE_COPY(QtEnumEditorFactory) Q_PRIVATE_SLOT(d_func(), void slotPropertyChanged(QtProperty *, int)) Q_PRIVATE_SLOT(d_func(), void slotEnumNamesChanged(QtProperty *, @@ -341,7 +341,7 @@ protected: void disconnectPropertyManager(QtCursorPropertyManager *manager); private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtCursorEditorFactory) + Q_DECLARE_SCOPED_PRIVATE(QtCursorEditorFactory) Q_DISABLE_COPY(QtCursorEditorFactory) Q_PRIVATE_SLOT(d_func(), void slotPropertyChanged(QtProperty *, const QCursor &)) Q_PRIVATE_SLOT(d_func(), void slotEnumChanged(QtProperty *, int)) @@ -363,7 +363,7 @@ protected: void disconnectPropertyManager(QtColorPropertyManager *manager); private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtColorEditorFactory) + Q_DECLARE_SCOPED_PRIVATE(QtColorEditorFactory) Q_DISABLE_COPY(QtColorEditorFactory) Q_PRIVATE_SLOT(d_func(), void slotPropertyChanged(QtProperty *, const QColor &)) Q_PRIVATE_SLOT(d_func(), void slotEditorDestroyed(QObject *)) @@ -385,7 +385,7 @@ protected: void disconnectPropertyManager(QtFontPropertyManager *manager); private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtFontEditorFactory) + Q_DECLARE_SCOPED_PRIVATE(QtFontEditorFactory) Q_DISABLE_COPY(QtFontEditorFactory) Q_PRIVATE_SLOT(d_func(), void slotPropertyChanged(QtProperty *, const QFont &)) Q_PRIVATE_SLOT(d_func(), void slotEditorDestroyed(QObject *)) diff --git a/tools/shared/qtpropertybrowser/qtgroupboxpropertybrowser.h b/tools/shared/qtpropertybrowser/qtgroupboxpropertybrowser.h index 1cfda63..5124fd5 100644 --- a/tools/shared/qtpropertybrowser/qtgroupboxpropertybrowser.h +++ b/tools/shared/qtpropertybrowser/qtgroupboxpropertybrowser.h @@ -64,7 +64,7 @@ protected: private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtGroupBoxPropertyBrowser) + Q_DECLARE_SCOPED_PRIVATE(QtGroupBoxPropertyBrowser) Q_DISABLE_COPY(QtGroupBoxPropertyBrowser) Q_PRIVATE_SLOT(d_func(), void slotUpdate()) Q_PRIVATE_SLOT(d_func(), void slotEditorDestroyed()) diff --git a/tools/shared/qtpropertybrowser/qtpropertybrowser.h b/tools/shared/qtpropertybrowser/qtpropertybrowser.h index 19996c0..dfcb65a 100644 --- a/tools/shared/qtpropertybrowser/qtpropertybrowser.h +++ b/tools/shared/qtpropertybrowser/qtpropertybrowser.h @@ -119,7 +119,7 @@ protected: private: friend class QtProperty; QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtAbstractPropertyManager) + Q_DECLARE_SCOPED_PRIVATE(QtAbstractPropertyManager) Q_DISABLE_COPY(QtAbstractPropertyManager) }; @@ -293,7 +293,7 @@ private: QtAbstractEditorFactoryBase *abstractFactory); QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtAbstractPropertyBrowser) + Q_DECLARE_SCOPED_PRIVATE(QtAbstractPropertyBrowser) Q_DISABLE_COPY(QtAbstractPropertyBrowser) Q_PRIVATE_SLOT(d_func(), void slotPropertyInserted(QtProperty *, QtProperty *, QtProperty *)) diff --git a/tools/shared/qtpropertybrowser/qtpropertymanager.h b/tools/shared/qtpropertybrowser/qtpropertymanager.h index 31c308e..14b71fb 100644 --- a/tools/shared/qtpropertybrowser/qtpropertymanager.h +++ b/tools/shared/qtpropertybrowser/qtpropertymanager.h @@ -95,7 +95,7 @@ protected: virtual void uninitializeProperty(QtProperty *property); private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtIntPropertyManager) + Q_DECLARE_SCOPED_PRIVATE(QtIntPropertyManager) Q_DISABLE_COPY(QtIntPropertyManager) }; @@ -121,7 +121,7 @@ protected: virtual void uninitializeProperty(QtProperty *property); private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtBoolPropertyManager) + Q_DECLARE_SCOPED_PRIVATE(QtBoolPropertyManager) Q_DISABLE_COPY(QtBoolPropertyManager) }; @@ -158,7 +158,7 @@ protected: virtual void uninitializeProperty(QtProperty *property); private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtDoublePropertyManager) + Q_DECLARE_SCOPED_PRIVATE(QtDoublePropertyManager) Q_DISABLE_COPY(QtDoublePropertyManager) }; @@ -186,7 +186,7 @@ protected: virtual void uninitializeProperty(QtProperty *property); private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtStringPropertyManager) + Q_DECLARE_SCOPED_PRIVATE(QtStringPropertyManager) Q_DISABLE_COPY(QtStringPropertyManager) }; @@ -217,7 +217,7 @@ protected: virtual void uninitializeProperty(QtProperty *property); private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtDatePropertyManager) + Q_DECLARE_SCOPED_PRIVATE(QtDatePropertyManager) Q_DISABLE_COPY(QtDatePropertyManager) }; @@ -242,7 +242,7 @@ protected: virtual void uninitializeProperty(QtProperty *property); private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtTimePropertyManager) + Q_DECLARE_SCOPED_PRIVATE(QtTimePropertyManager) Q_DISABLE_COPY(QtTimePropertyManager) }; @@ -267,7 +267,7 @@ protected: virtual void uninitializeProperty(QtProperty *property); private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtDateTimePropertyManager) + Q_DECLARE_SCOPED_PRIVATE(QtDateTimePropertyManager) Q_DISABLE_COPY(QtDateTimePropertyManager) }; @@ -292,7 +292,7 @@ protected: virtual void uninitializeProperty(QtProperty *property); private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtKeySequencePropertyManager) + Q_DECLARE_SCOPED_PRIVATE(QtKeySequencePropertyManager) Q_DISABLE_COPY(QtKeySequencePropertyManager) }; @@ -317,7 +317,7 @@ protected: virtual void uninitializeProperty(QtProperty *property); private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtCharPropertyManager) + Q_DECLARE_SCOPED_PRIVATE(QtCharPropertyManager) Q_DISABLE_COPY(QtCharPropertyManager) }; @@ -345,7 +345,7 @@ protected: virtual void uninitializeProperty(QtProperty *property); private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtLocalePropertyManager) + Q_DECLARE_SCOPED_PRIVATE(QtLocalePropertyManager) Q_DISABLE_COPY(QtLocalePropertyManager) Q_PRIVATE_SLOT(d_func(), void slotEnumChanged(QtProperty *, int)) Q_PRIVATE_SLOT(d_func(), void slotPropertyDestroyed(QtProperty *)) @@ -374,7 +374,7 @@ protected: virtual void uninitializeProperty(QtProperty *property); private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtPointPropertyManager) + Q_DECLARE_SCOPED_PRIVATE(QtPointPropertyManager) Q_DISABLE_COPY(QtPointPropertyManager) Q_PRIVATE_SLOT(d_func(), void slotIntChanged(QtProperty *, int)) Q_PRIVATE_SLOT(d_func(), void slotPropertyDestroyed(QtProperty *)) @@ -406,7 +406,7 @@ protected: virtual void uninitializeProperty(QtProperty *property); private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtPointFPropertyManager) + Q_DECLARE_SCOPED_PRIVATE(QtPointFPropertyManager) Q_DISABLE_COPY(QtPointFPropertyManager) Q_PRIVATE_SLOT(d_func(), void slotDoubleChanged(QtProperty *, double)) Q_PRIVATE_SLOT(d_func(), void slotPropertyDestroyed(QtProperty *)) @@ -441,7 +441,7 @@ protected: virtual void uninitializeProperty(QtProperty *property); private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtSizePropertyManager) + Q_DECLARE_SCOPED_PRIVATE(QtSizePropertyManager) Q_DISABLE_COPY(QtSizePropertyManager) Q_PRIVATE_SLOT(d_func(), void slotIntChanged(QtProperty *, int)) Q_PRIVATE_SLOT(d_func(), void slotPropertyDestroyed(QtProperty *)) @@ -479,7 +479,7 @@ protected: virtual void uninitializeProperty(QtProperty *property); private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtSizeFPropertyManager) + Q_DECLARE_SCOPED_PRIVATE(QtSizeFPropertyManager) Q_DISABLE_COPY(QtSizeFPropertyManager) Q_PRIVATE_SLOT(d_func(), void slotDoubleChanged(QtProperty *, double)) Q_PRIVATE_SLOT(d_func(), void slotPropertyDestroyed(QtProperty *)) @@ -511,7 +511,7 @@ protected: virtual void uninitializeProperty(QtProperty *property); private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtRectPropertyManager) + Q_DECLARE_SCOPED_PRIVATE(QtRectPropertyManager) Q_DISABLE_COPY(QtRectPropertyManager) Q_PRIVATE_SLOT(d_func(), void slotIntChanged(QtProperty *, int)) Q_PRIVATE_SLOT(d_func(), void slotPropertyDestroyed(QtProperty *)) @@ -546,7 +546,7 @@ protected: virtual void uninitializeProperty(QtProperty *property); private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtRectFPropertyManager) + Q_DECLARE_SCOPED_PRIVATE(QtRectFPropertyManager) Q_DISABLE_COPY(QtRectFPropertyManager) Q_PRIVATE_SLOT(d_func(), void slotDoubleChanged(QtProperty *, double)) Q_PRIVATE_SLOT(d_func(), void slotPropertyDestroyed(QtProperty *)) @@ -580,7 +580,7 @@ protected: virtual void uninitializeProperty(QtProperty *property); private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtEnumPropertyManager) + Q_DECLARE_SCOPED_PRIVATE(QtEnumPropertyManager) Q_DISABLE_COPY(QtEnumPropertyManager) }; @@ -610,7 +610,7 @@ protected: virtual void uninitializeProperty(QtProperty *property); private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtFlagPropertyManager) + Q_DECLARE_SCOPED_PRIVATE(QtFlagPropertyManager) Q_DISABLE_COPY(QtFlagPropertyManager) Q_PRIVATE_SLOT(d_func(), void slotBoolChanged(QtProperty *, bool)) Q_PRIVATE_SLOT(d_func(), void slotPropertyDestroyed(QtProperty *)) @@ -640,7 +640,7 @@ protected: virtual void uninitializeProperty(QtProperty *property); private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtSizePolicyPropertyManager) + Q_DECLARE_SCOPED_PRIVATE(QtSizePolicyPropertyManager) Q_DISABLE_COPY(QtSizePolicyPropertyManager) Q_PRIVATE_SLOT(d_func(), void slotIntChanged(QtProperty *, int)) Q_PRIVATE_SLOT(d_func(), void slotEnumChanged(QtProperty *, int)) @@ -673,7 +673,7 @@ protected: virtual void uninitializeProperty(QtProperty *property); private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtFontPropertyManager) + Q_DECLARE_SCOPED_PRIVATE(QtFontPropertyManager) Q_DISABLE_COPY(QtFontPropertyManager) Q_PRIVATE_SLOT(d_func(), void slotIntChanged(QtProperty *, int)) Q_PRIVATE_SLOT(d_func(), void slotEnumChanged(QtProperty *, int)) @@ -707,7 +707,7 @@ protected: virtual void uninitializeProperty(QtProperty *property); private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtColorPropertyManager) + Q_DECLARE_SCOPED_PRIVATE(QtColorPropertyManager) Q_DISABLE_COPY(QtColorPropertyManager) Q_PRIVATE_SLOT(d_func(), void slotIntChanged(QtProperty *, int)) Q_PRIVATE_SLOT(d_func(), void slotPropertyDestroyed(QtProperty *)) @@ -737,7 +737,7 @@ protected: virtual void uninitializeProperty(QtProperty *property); private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtCursorPropertyManager) + Q_DECLARE_SCOPED_PRIVATE(QtCursorPropertyManager) Q_DISABLE_COPY(QtCursorPropertyManager) }; diff --git a/tools/shared/qtpropertybrowser/qttreepropertybrowser.h b/tools/shared/qtpropertybrowser/qttreepropertybrowser.h index ebcf185..4994bfc 100644 --- a/tools/shared/qtpropertybrowser/qttreepropertybrowser.h +++ b/tools/shared/qtpropertybrowser/qttreepropertybrowser.h @@ -119,7 +119,7 @@ protected: private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtTreePropertyBrowser) + Q_DECLARE_SCOPED_PRIVATE(QtTreePropertyBrowser) Q_DISABLE_COPY(QtTreePropertyBrowser) Q_PRIVATE_SLOT(d_func(), void slotCollapsed(const QModelIndex &)) diff --git a/tools/shared/qtpropertybrowser/qtvariantproperty.h b/tools/shared/qtpropertybrowser/qtvariantproperty.h index 4f32c57..f4f45da 100644 --- a/tools/shared/qtpropertybrowser/qtvariantproperty.h +++ b/tools/shared/qtpropertybrowser/qtvariantproperty.h @@ -149,7 +149,7 @@ private: Q_PRIVATE_SLOT(d_func(), void slotPropertyInserted(QtProperty *, QtProperty *, QtProperty *)) Q_PRIVATE_SLOT(d_func(), void slotPropertyRemoved(QtProperty *, QtProperty *)) - Q_DECLARE_PRIVATE(QtVariantPropertyManager) + Q_DECLARE_SCOPED_PRIVATE(QtVariantPropertyManager) Q_DISABLE_COPY(QtVariantPropertyManager) }; @@ -166,7 +166,7 @@ protected: void disconnectPropertyManager(QtVariantPropertyManager *manager); private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtVariantEditorFactory) + Q_DECLARE_SCOPED_PRIVATE(QtVariantEditorFactory) Q_DISABLE_COPY(QtVariantEditorFactory) }; diff --git a/tools/shared/qttoolbardialog/qttoolbardialog.cpp b/tools/shared/qttoolbardialog/qttoolbardialog.cpp index 8ceb582..0c4622f 100644 --- a/tools/shared/qttoolbardialog/qttoolbardialog.cpp +++ b/tools/shared/qttoolbardialog/qttoolbardialog.cpp @@ -120,7 +120,7 @@ signals: private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtFullToolBarManager) + Q_DECLARE_SCOPED_PRIVATE(QtFullToolBarManager) Q_DISABLE_COPY(QtFullToolBarManager) }; diff --git a/tools/shared/qttoolbardialog/qttoolbardialog.h b/tools/shared/qttoolbardialog/qttoolbardialog.h index 9227b56..d3f7396 100644 --- a/tools/shared/qttoolbardialog/qttoolbardialog.h +++ b/tools/shared/qttoolbardialog/qttoolbardialog.h @@ -89,7 +89,7 @@ private: friend class QtToolBarDialog; QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtToolBarManager) + Q_DECLARE_SCOPED_PRIVATE(QtToolBarManager) Q_DISABLE_COPY(QtToolBarManager) }; @@ -113,7 +113,7 @@ protected: private: QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(QtToolBarDialog) + Q_DECLARE_SCOPED_PRIVATE(QtToolBarDialog) Q_DISABLE_COPY(QtToolBarDialog) Q_PRIVATE_SLOT(d_func(), void newClicked()) -- cgit v0.12 From 7dce0e368cdeec00641d029101d34e9ce64395f6 Mon Sep 17 00:00:00 2001 From: mread Date: Mon, 3 Aug 2009 14:42:57 +0100 Subject: fixed qt_pixmapToNativeBitmap name merge problem --- src/gui/kernel/qwidget_s60.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index bf53f5d..b206517 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -706,8 +706,8 @@ void QWidgetPrivate::setWindowIcon_sys(bool forceReset) // Convert to CFbsBitmp // TODO: When QPixmap is adapted to use native CFbsBitmap, // it could be set directly to context pane - CFbsBitmap* nBitmap = qt_pixmapToNativeBitmapL(pm, false); - CFbsBitmap* nMask = qt_pixmapToNativeBitmapL(mask, true); + CFbsBitmap* nBitmap = qt_pixmapToNativeBitmap(pm, false); + CFbsBitmap* nMask = qt_pixmapToNativeBitmap(mask, true); contextPane->SetPicture(nBitmap,nMask); } else { @@ -740,8 +740,8 @@ void QWidgetPrivate::setWindowIcon_sys(bool forceReset) // Convert to CFbsBitmp // TODO: When QPixmap is adapted to use native CFbsBitmap, // it could be set directly to context pane - CFbsBitmap* nBitmap = qt_pixmapToNativeBitmapL(pm, false); - CFbsBitmap* nMask = qt_pixmapToNativeBitmapL(mask, true); + CFbsBitmap* nBitmap = qt_pixmapToNativeBitmap(pm, false); + CFbsBitmap* nMask = qt_pixmapToNativeBitmap(mask, true); titlePane->SetSmallPicture( nBitmap, nMask, ETrue ); } else { -- cgit v0.12 From 95812dd991bdcc63c9a4c10d4cf32811aa0c413b Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Mon, 3 Aug 2009 20:27:32 +0200 Subject: CFbsBitmap::DataSize() seems to be a private Api function. But CFbsBitmap::Header().iBitmapSize seems to do the same job, and it works wit hthe public SDK. Thanks to jbarron for finding that public pendant. --- src/gui/styles/qs60style_s60.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index 8e9918e..81ee8b1 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -905,7 +905,7 @@ void QS60StyleModeSpecifics::checkAndUnCompressBitmapL(CFbsBitmap*& aOriginalBit const TSize iconSize = aOriginalBitmap->SizeInPixels(); const int iconBytesPerLine = CFbsBitmap::ScanLineLength(iconSize.iWidth, aOriginalBitmap->DisplayMode()); const int iconBytesCount = iconBytesPerLine * iconSize.iHeight; - if (aOriginalBitmap->IsCompressedInRAM() || aOriginalBitmap->DataSize() < iconBytesCount) { + if (aOriginalBitmap->IsCompressedInRAM() || aOriginalBitmap->Header().iBitmapSize < iconBytesCount) { const TSize iconSize(aOriginalBitmap->SizeInPixels().iWidth, aOriginalBitmap->SizeInPixels().iHeight); CFbsBitmap* uncompressedBitmap = new (ELeave) CFbsBitmap(); -- cgit v0.12 From 796fea3ddd24e8be22196607500439f4db8e8332 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Tue, 4 Aug 2009 08:05:00 +0300 Subject: Trailing whitespace and tab/space fixes for QtSql --- src/sql/sql.pro | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/sql/sql.pro b/src/sql/sql.pro index 60be748..b8f819d 100644 --- a/src/sql/sql.pro +++ b/src/sql/sql.pro @@ -19,9 +19,8 @@ include(models/models.pri) symbian: { TARGET.UID3=0x2001E61D - + # Workaroud for problems with paging this dll MMP_RULES -= PAGED MMP_RULES *= UNPAGED } - -- cgit v0.12 From 76629bf75b29a29e8532943e530bb5455ee9cdf8 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Tue, 4 Aug 2009 08:13:02 +0300 Subject: Trailing whitespace and tab/space fixes for demos/embedded --- demos/embedded/anomaly/src/Main.cpp | 1 - demos/embedded/desktopservices/contenttab.cpp | 36 +++++++++++----------- demos/embedded/desktopservices/contenttab.h | 26 ++++++++-------- demos/embedded/desktopservices/desktopservices.pro | 4 +-- demos/embedded/desktopservices/desktopservices.qrc | 10 +++--- demos/embedded/desktopservices/desktopwidget.cpp | 36 +++++++++++----------- demos/embedded/desktopservices/desktopwidget.h | 16 +++++----- demos/embedded/desktopservices/linktab.h | 30 +++++++++--------- demos/embedded/desktopservices/main.cpp | 4 +-- demos/embedded/embedded.pro | 1 - .../embeddedsvgviewer/embeddedsvgviewer.pro | 3 +- demos/embedded/fluidlauncher/config_s60/config.xml | 2 +- demos/embedded/fluidlauncher/fluidlauncher.pro | 20 ++++++------ 13 files changed, 93 insertions(+), 96 deletions(-) diff --git a/demos/embedded/anomaly/src/Main.cpp b/demos/embedded/anomaly/src/Main.cpp index d861857..6ab7403 100644 --- a/demos/embedded/anomaly/src/Main.cpp +++ b/demos/embedded/anomaly/src/Main.cpp @@ -51,4 +51,3 @@ int main(int argc, char *argv[]) return app.exec(); } - diff --git a/demos/embedded/desktopservices/contenttab.cpp b/demos/embedded/desktopservices/contenttab.cpp index bdc5e03..619f5c0 100644 --- a/demos/embedded/desktopservices/contenttab.cpp +++ b/demos/embedded/desktopservices/contenttab.cpp @@ -53,32 +53,32 @@ #include "contenttab.h" -// CONSTRUCTORS & DESTRUCTORS -ContentTab::ContentTab(QWidget *parent) : +// CONSTRUCTORS & DESTRUCTORS +ContentTab::ContentTab(QWidget *parent) : QListWidget(parent) -{ +{ setDragEnabled(false); setIconSize(QSize(45, 45)); } - -ContentTab::~ContentTab() + +ContentTab::~ContentTab() { } // NEW PUBLIC METHODS -void ContentTab::init(const QDesktopServices::StandardLocation &location, - const QString &filter, +void ContentTab::init(const QDesktopServices::StandardLocation &location, + const QString &filter, const QString &icon) { setContentDir(location); QStringList filterList; filterList = filter.split(";"); - m_ContentDir.setNameFilters(filterList); - setIcon(icon); - + m_ContentDir.setNameFilters(filterList); + setIcon(icon); + connect(this, SIGNAL(itemClicked(QListWidgetItem *)), - this, SLOT(openItem(QListWidgetItem *))); - + this, SLOT(openItem(QListWidgetItem *))); + populateListWidget(); } @@ -98,7 +98,7 @@ void ContentTab::populateListWidget() QFileInfoList fileList = m_ContentDir.entryInfoList(QDir::Files, QDir::Time); foreach(QFileInfo item, fileList) { new QListWidgetItem(m_Icon, itemName(item), this); - } + } } QString ContentTab::itemName(const QFileInfo &item) @@ -111,21 +111,21 @@ QUrl ContentTab::itemUrl(QListWidgetItem *item) return QUrl("file:///" + m_ContentDir.absolutePath() + "/" + item->text()); } -void ContentTab::keyPressEvent(QKeyEvent *event) +void ContentTab::keyPressEvent(QKeyEvent *event) { switch(event->key()) { case Qt::Key_Up: if(currentRow() == 0) { setCurrentRow(count()-1); } else { - setCurrentRow(currentRow()-1); + setCurrentRow(currentRow()-1); } break; case Qt::Key_Down: if(currentRow() == (count()-1)) { - setCurrentRow(0); + setCurrentRow(0); } else { - setCurrentRow(currentRow()+1); + setCurrentRow(currentRow()+1); } break; case Qt::Key_Select: @@ -138,7 +138,7 @@ void ContentTab::keyPressEvent(QKeyEvent *event) void ContentTab::handleErrorInOpen(QListWidgetItem *item) { - Q_UNUSED(item); + Q_UNUSED(item); QMessageBox::warning( this, tr("Operation Failed"), tr("Unkown error!"), QMessageBox::Close); } diff --git a/demos/embedded/desktopservices/contenttab.h b/demos/embedded/desktopservices/contenttab.h index 8d37209..21da07f 100644 --- a/demos/embedded/desktopservices/contenttab.h +++ b/demos/embedded/desktopservices/contenttab.h @@ -61,41 +61,41 @@ QT_END_NAMESPACE /** * ContentTab class. -* +* * This class implements general purpose tab for media files. */ class ContentTab : public QListWidget { Q_OBJECT -public: // Constructors & Destructors +public: // Constructors & Destructors ContentTab(QWidget *parent); virtual ~ContentTab(); - + public: // New Methods - virtual void init(const QDesktopServices::StandardLocation &location, - const QString &filter, - const QString &icon); - + virtual void init(const QDesktopServices::StandardLocation &location, + const QString &filter, + const QString &icon); + protected: // New Methods virtual void setContentDir(const QDesktopServices::StandardLocation &location); - virtual void setIcon(const QString &icon); + virtual void setIcon(const QString &icon); virtual void populateListWidget(); virtual QString itemName(const QFileInfo &item); virtual QUrl itemUrl(QListWidgetItem *item); virtual void handleErrorInOpen(QListWidgetItem *item); protected: - void keyPressEvent(QKeyEvent *event); - + void keyPressEvent(QKeyEvent *event); + public slots: // New Slots - virtual void openItem(QListWidgetItem *item); + virtual void openItem(QListWidgetItem *item); -protected: // Owned variables +protected: // Owned variables QDir m_ContentDir; QIcon m_Icon; }; -#endif // CONTENTTAB_H_ +#endif // CONTENTTAB_H_ // End of File diff --git a/demos/embedded/desktopservices/desktopservices.pro b/demos/embedded/desktopservices/desktopservices.pro index 32cb6d9..32dfa40 100644 --- a/demos/embedded/desktopservices/desktopservices.pro +++ b/demos/embedded/desktopservices/desktopservices.pro @@ -1,5 +1,5 @@ TEMPLATE = app -TARGET = +TARGET = INCLUDEPATH += . HEADERS += desktopwidget.h contenttab.h linktab.h @@ -18,6 +18,6 @@ DEPLOYMENT += music image include($$QT_SOURCE_TREE/demos/demobase.pri) symbian { - TARGET.UID3 = 0xA000C611 + TARGET.UID3 = 0xA000C611 ICON = ./resources/heart.svg } diff --git a/demos/embedded/desktopservices/desktopservices.qrc b/demos/embedded/desktopservices/desktopservices.qrc index d36205d..410175f 100644 --- a/demos/embedded/desktopservices/desktopservices.qrc +++ b/demos/embedded/desktopservices/desktopservices.qrc @@ -1,8 +1,8 @@ - - resources/music.png - resources/photo.png - resources/browser.png - resources/message.png + + resources/music.png + resources/photo.png + resources/browser.png + resources/message.png diff --git a/demos/embedded/desktopservices/desktopwidget.cpp b/demos/embedded/desktopservices/desktopwidget.cpp index 3abe591..f3c02dc 100644 --- a/demos/embedded/desktopservices/desktopwidget.cpp +++ b/demos/embedded/desktopservices/desktopwidget.cpp @@ -51,40 +51,40 @@ // CLASS HEADER #include "desktopwidget.h" -// CONSTRUCTORS & DESTRUCTORS +// CONSTRUCTORS & DESTRUCTORS DesktopWidget::DesktopWidget(QWidget *parent) : QWidget(parent) - + { QTabWidget *tabWidget = new QTabWidget(this); // Images ContentTab* imageTab = new ContentTab(tabWidget); - imageTab->init(QDesktopServices::PicturesLocation, + imageTab->init(QDesktopServices::PicturesLocation, "*.png;*.jpg;*.jpeg;*.bmp;*.gif", ":/resources/photo.png"); - tabWidget->addTab(imageTab, tr("Images")); - + tabWidget->addTab(imageTab, tr("Images")); + // Music - ContentTab* musicTab = new ContentTab(tabWidget); - musicTab->init(QDesktopServices::MusicLocation, - "*.wav;*.mp3;*.mp4", - ":/resources/music.png"); - tabWidget->addTab(musicTab, tr("Music")); - + ContentTab* musicTab = new ContentTab(tabWidget); + musicTab->init(QDesktopServices::MusicLocation, + "*.wav;*.mp3;*.mp4", + ":/resources/music.png"); + tabWidget->addTab(musicTab, tr("Music")); + // Links - LinkTab* othersTab = new LinkTab(tabWidget);; + LinkTab* othersTab = new LinkTab(tabWidget);; // Given icon file will be overriden by LinkTab - othersTab->init(QDesktopServices::PicturesLocation, "", ""); - tabWidget->addTab(othersTab, tr("Links")); - + othersTab->init(QDesktopServices::PicturesLocation, "", ""); + tabWidget->addTab(othersTab, tr("Links")); + // Layout QVBoxLayout *layout = new QVBoxLayout; layout->addWidget(tabWidget); - setLayout(layout); + setLayout(layout); } - + DesktopWidget::~DesktopWidget() { } - + // End of file diff --git a/demos/embedded/desktopservices/desktopwidget.h b/demos/embedded/desktopservices/desktopwidget.h index 246ab18..6b0af79 100644 --- a/demos/embedded/desktopservices/desktopwidget.h +++ b/demos/embedded/desktopservices/desktopwidget.h @@ -55,19 +55,19 @@ QT_END_NAMESPACE // CLASS DECLARATION /** * DesktopWidget class. -* +* * Implements the main top level widget for QDesktopServices demo app. */ class DesktopWidget : public QWidget { - Q_OBJECT - -public: // Constructors & Destructors + Q_OBJECT + +public: // Constructors & Destructors DesktopWidget(QWidget *parent); ~DesktopWidget(); - + }; - -#endif // DESKTOPWIDGET_H_ - + +#endif // DESKTOPWIDGET_H_ + // End of file diff --git a/demos/embedded/desktopservices/linktab.h b/demos/embedded/desktopservices/linktab.h index a9c9868..e44b785 100644 --- a/demos/embedded/desktopservices/linktab.h +++ b/demos/embedded/desktopservices/linktab.h @@ -57,30 +57,30 @@ QT_END_NAMESPACE /** * LinkTab class. -* +* * This class implements tab for opening http and mailto links. */ class LinkTab : public ContentTab { Q_OBJECT - -public: // Constructors & Destructors + +public: // Constructors & Destructors LinkTab(QWidget *parent); - ~LinkTab(); - -protected: // Derived Methods + ~LinkTab(); + +protected: // Derived Methods virtual void populateListWidget(); - virtual QUrl itemUrl(QListWidgetItem *item); + virtual QUrl itemUrl(QListWidgetItem *item); virtual void handleErrorInOpen(QListWidgetItem *item); - -private: // Used variables + +private: // Used variables QListWidgetItem *m_WebItem; - QListWidgetItem *m_MailToItem; - -private: // Owned variables - + QListWidgetItem *m_MailToItem; + +private: // Owned variables + }; -#endif // CONTENTTAB_H_ - +#endif // CONTENTTAB_H_ + // End of File diff --git a/demos/embedded/desktopservices/main.cpp b/demos/embedded/desktopservices/main.cpp index ebbcf63..0abfc78 100644 --- a/demos/embedded/desktopservices/main.cpp +++ b/demos/embedded/desktopservices/main.cpp @@ -48,8 +48,8 @@ int main(int argc, char *argv[]) QApplication app(argc, argv); DesktopWidget* myWidget = new DesktopWidget(0); - myWidget->showMaximized(); - + myWidget->showMaximized(); + return app.exec(); } diff --git a/demos/embedded/embedded.pro b/demos/embedded/embedded.pro index 25904ef..a5e3465 100644 --- a/demos/embedded/embedded.pro +++ b/demos/embedded/embedded.pro @@ -17,4 +17,3 @@ sources.path = $$[QT_INSTALL_DEMOS]/embedded INSTALLS += sources include($$QT_SOURCE_TREE/demos/demobase.pri) - diff --git a/demos/embedded/embeddedsvgviewer/embeddedsvgviewer.pro b/demos/embedded/embeddedsvgviewer/embeddedsvgviewer.pro index 51a04e7..3ce2fbf 100644 --- a/demos/embedded/embeddedsvgviewer/embeddedsvgviewer.pro +++ b/demos/embedded/embeddedsvgviewer/embeddedsvgviewer.pro @@ -9,7 +9,7 @@ RESOURCES += embeddedsvgviewer.qrc target.path = $$[QT_INSTALL_DEMOS]/embedded/embeddedsvgviewer sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro *.html *.svg files sources.path = $$[QT_INSTALL_DEMOS]/embedded/embeddedsvgviewer -INSTALLS += target sources +INSTALLS += target sources wince* { DEPLOYMENT_PLUGIN += qsvg @@ -18,4 +18,3 @@ wince* { include($$QT_SOURCE_TREE/demos/demobase.pri) symbian:TARGET.UID3 = 0xA000A640 - diff --git a/demos/embedded/fluidlauncher/config_s60/config.xml b/demos/embedded/fluidlauncher/config_s60/config.xml index f6bac67..95e96bd 100644 --- a/demos/embedded/fluidlauncher/config_s60/config.xml +++ b/demos/embedded/fluidlauncher/config_s60/config.xml @@ -13,7 +13,7 @@ - + diff --git a/demos/embedded/fluidlauncher/fluidlauncher.pro b/demos/embedded/fluidlauncher/fluidlauncher.pro index 0d83945..3eff37b 100644 --- a/demos/embedded/fluidlauncher/fluidlauncher.pro +++ b/demos/embedded/fluidlauncher/fluidlauncher.pro @@ -1,5 +1,5 @@ TEMPLATE = app -TARGET = +TARGET = DEPENDPATH += . INCLUDEPATH += . @@ -55,9 +55,9 @@ wince*{ DEPLOYMENT_PLUGIN += qgif qjpeg qmng qsvg } -symbian { +symbian { load(data_caging_paths) - + TARGET.UID3 = 0xA000A641 executables.sources = \ @@ -73,7 +73,7 @@ symbian { fridgemagnets.exe \ drilldown.exe \ softkeys.exe - contains(QT_CONFIG, webkit) { + contains(QT_CONFIG, webkit) { executables.sources += anomaly.exe } @@ -92,9 +92,9 @@ symbian { $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/fridgemagnets_reg.rsc \ $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/drilldown_reg.rsc \ $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/softkeys_reg.rsc - contains(QT_CONFIG, webkit) { + contains(QT_CONFIG, webkit) { reg_resource.sources += $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/anomaly_reg.rsc - } + } reg_resource.path = $$REG_RESOURCE_IMPORT_DIR @@ -111,9 +111,9 @@ symbian { $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/fridgemagnets.rsc \ $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/drilldown.rsc \ $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/softkeys.rsc - contains(QT_CONFIG, webkit) { + contains(QT_CONFIG, webkit) { resource.sources += $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/anomaly.rsc - } + } resource.path = $$APP_RESOURCE_DIR @@ -134,9 +134,9 @@ symbian { $$PWD/../desktopservices/data/*.mp3 \ $$PWD/../desktopservices/data/*.wav desktopservices_music.path = /data/sounds - + desktopservices_images.sources = $$PWD/../desktopservices/data/*.png - desktopservices_images.path = /data/images + desktopservices_images.path = /data/images saxbookmarks.sources = $$PWD/../../../examples/xml/saxbookmarks/frank.xbel saxbookmarks.sources += $$PWD/../../../examples/xml/saxbookmarks/jennifer.xbel -- cgit v0.12 From 2c9007fbedf7664c0e389d8a3c5ab3eb2f187c01 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Tue, 4 Aug 2009 10:20:57 +0300 Subject: Cleanup and applied Qt coding style for qnetworkinterface_symbian.cpp --- src/network/kernel/qnetworkinterface_symbian.cpp | 114 +++++++++-------------- 1 file changed, 46 insertions(+), 68 deletions(-) diff --git a/src/network/kernel/qnetworkinterface_symbian.cpp b/src/network/kernel/qnetworkinterface_symbian.cpp index bec2dc3..f2ded36 100644 --- a/src/network/kernel/qnetworkinterface_symbian.cpp +++ b/src/network/kernel/qnetworkinterface_symbian.cpp @@ -41,12 +41,8 @@ //#define QNETWORKINTERFACE_DEBUG -//#include "qset.h" #include "qnetworkinterface.h" #include "qnetworkinterface_p.h" -//#include -//#include "qalgorithms.h" - #ifndef QT_NO_NETWORKINTERFACE @@ -54,57 +50,49 @@ #include #include -//#include -//#include -//#include -//#include -//#include - QT_BEGIN_NAMESPACE -static QNetworkInterface::InterfaceFlags convertFlags( const TSoInetInterfaceInfo& aInfo ) +static QNetworkInterface::InterfaceFlags convertFlags(const TSoInetInterfaceInfo& aInfo) { QNetworkInterface::InterfaceFlags flags = 0; flags |= (aInfo.iState == EIfUp) ? QNetworkInterface::IsUp : QNetworkInterface::InterfaceFlag(0); // We do not have separate flag for running in Symbian OS flags |= (aInfo.iState == EIfUp) ? QNetworkInterface::IsRunning : QNetworkInterface::InterfaceFlag(0); - flags |= (aInfo.iFeatures&KIfCanBroadcast) ? QNetworkInterface::CanBroadcast : QNetworkInterface::InterfaceFlag(0); - flags |= (aInfo.iFeatures&KIfIsLoopback) ? QNetworkInterface::IsLoopBack : QNetworkInterface::InterfaceFlag(0); - flags |= (aInfo.iFeatures&KIfIsPointToPoint) ? QNetworkInterface::IsPointToPoint : QNetworkInterface::InterfaceFlag(0); - flags |= (aInfo.iFeatures&KIfCanMulticast) ? QNetworkInterface::CanMulticast : QNetworkInterface::InterfaceFlag(0); + flags |= (aInfo.iFeatures & KIfCanBroadcast) ? QNetworkInterface::CanBroadcast : QNetworkInterface::InterfaceFlag(0); + flags |= (aInfo.iFeatures & KIfIsLoopback) ? QNetworkInterface::IsLoopBack : QNetworkInterface::InterfaceFlag(0); + flags |= (aInfo.iFeatures & KIfIsPointToPoint) ? QNetworkInterface::IsPointToPoint : QNetworkInterface::InterfaceFlag(0); + flags |= (aInfo.iFeatures & KIfCanMulticast) ? QNetworkInterface::CanMulticast : QNetworkInterface::InterfaceFlag(0); return flags; } -QString qstringFromDesc( const TDesC& aData ) +QString qstringFromDesc(const TDesC& aData) { return QString::fromUtf16(aData.Ptr(), aData.Length()); } static QList interfaceListing() { - TInt err( KErrNone ); + TInt err(KErrNone); QList interfaces; // Connect to Native socket server RSocketServ socketServ; err = socketServ.Connect(); - if( err ) + if (err) return interfaces; // Open dummy socket for interface queries RSocket socket; - err = socket.Open( socketServ, _L("udp")); - if( err ) - { + err = socket.Open(socketServ, _L("udp")); + if (err) { socketServ.Close(); return interfaces; } // Ask socket to start enumerating interfaces - err = socket.SetOpt( KSoInetEnumInterfaces, KSolInetIfCtrl ); - if( err ) - { + err = socket.SetOpt(KSoInetEnumInterfaces, KSolInetIfCtrl); + if (err) { socket.Close(); socketServ.Close(); return interfaces; @@ -113,11 +101,9 @@ static QList interfaceListing() int ifindex = 0; TPckgBuf infoPckg; TSoInetInterfaceInfo &info = infoPckg(); - while( socket.GetOpt(KSoInetNextInterface, KSolInetIfCtrl, infoPckg) == KErrNone ) - { + while (socket.GetOpt(KSoInetNextInterface, KSolInetIfCtrl, infoPckg) == KErrNone) { // Do not include IPv6 addresses because netmask and broadcast address cannot be determined correctly - if( info.iName != KNullDesC && info.iAddress.IsV4Mapped() ) - { + if (info.iName != KNullDesC && info.iAddress.IsV4Mapped()) { TName address; QNetworkAddressEntry entry; QNetworkInterfacePrivate *iface = 0; @@ -125,51 +111,48 @@ static QList interfaceListing() iface = new QNetworkInterfacePrivate; iface->index = ifindex++; interfaces << iface; - iface->name = qstringFromDesc( info.iName ); - iface->flags = convertFlags( info ); + iface->name = qstringFromDesc(info.iName); + iface->flags = convertFlags(info); - if( /*info.iFeatures&KIfHasHardwareAddr &&*/ info.iHwAddr.Family() != KAFUnspec ) - { - for ( TInt i = sizeof(SSockAddr); i < sizeof(SSockAddr) + info.iHwAddr.GetUserLen(); i++ ) - { + if (/*info.iFeatures&KIfHasHardwareAddr &&*/ info.iHwAddr.Family() != KAFUnspec) { + for (TInt i = sizeof(SSockAddr); i < sizeof(SSockAddr) + info.iHwAddr.GetUserLen(); i++) { address.AppendNumFixedWidth(info.iHwAddr[i], EHex, 2); - if( ( i + 1) < sizeof(SSockAddr) + info.iHwAddr.GetUserLen() ) - address.Append( _L(":") ); + if ((i + 1) < sizeof(SSockAddr) + info.iHwAddr.GetUserLen()) + address.Append(_L(":")); } address.UpperCase(); - iface->hardwareAddress = qstringFromDesc( address ); + iface->hardwareAddress = qstringFromDesc(address); } // Get the address of the interface info.iAddress.Output(address); - entry.setIp( QHostAddress( qstringFromDesc( address ) ) ); + entry.setIp(QHostAddress(qstringFromDesc(address))); // Get the interface netmask - // TODO: For some reason netmask is always 0.0.0.0 - //info.iNetMask.Output(address); - //entry.setNetmask( QHostAddress( qstringFromDesc( address ) ) ); + // For some reason netmask is always 0.0.0.0 + // info.iNetMask.Output(address); + // entry.setNetmask( QHostAddress( qstringFromDesc( address ) ) ); // Workaround: Let Symbian determine netmask based on IP address class - // TODO: works only for IPv4 + // TODO: Works only for IPv4 - Task: 259128 Implement IPv6 support TInetAddr netmask; - netmask.NetMask( info.iAddress ); + netmask.NetMask(info.iAddress); netmask.Output(address); - entry.setNetmask( QHostAddress( qstringFromDesc( address ) ) ); + entry.setNetmask(QHostAddress(qstringFromDesc(address))); // Get the interface broadcast address - if (iface->flags & QNetworkInterface::CanBroadcast) - { + if (iface->flags & QNetworkInterface::CanBroadcast) { // For some reason broadcast address is always 0.0.0.0 // info.iBrdAddr.Output(address); // entry.setBroadcast( QHostAddress( qstringFromDesc( address ) ) ); // Workaround: Let Symbian determine broadcast address based on IP address - // TODO: works only for IPv4 + // TODO: Works only for IPv4 - Task: 259128 Implement IPv6 support TInetAddr broadcast; - broadcast.NetBroadcast( info.iAddress ); + broadcast.NetBroadcast(info.iAddress); broadcast.Output(address); - entry.setBroadcast( QHostAddress( qstringFromDesc( address ) ) ); - } + entry.setBroadcast(QHostAddress(qstringFromDesc(address))); + } // Add new entry to interface address entries iface->addressEntries << entry; @@ -180,11 +163,11 @@ static QList interfaceListing() IsLoopBack = %d, IsPointToPoint = %d, CanMulticast = %d, \n\ ip = %s, netmask = %s, broadcast = %s,\n\ hwaddress = %s", - iface->name.toLatin1().constData(), - iface->flags & QNetworkInterface::IsUp, iface->flags & QNetworkInterface::IsRunning, iface->flags & QNetworkInterface::CanBroadcast, - iface->flags & QNetworkInterface::IsLoopBack, iface->flags & QNetworkInterface::IsPointToPoint, iface->flags & QNetworkInterface::CanMulticast, - entry.ip().toString().toLatin1().constData(), entry.netmask().toString().toLatin1().constData(), entry.broadcast().toString().toLatin1().constData(), - iface->hardwareAddress.toLatin1().constData()); + iface->name.toLatin1().constData(), + iface->flags & QNetworkInterface::IsUp, iface->flags & QNetworkInterface::IsRunning, iface->flags & QNetworkInterface::CanBroadcast, + iface->flags & QNetworkInterface::IsLoopBack, iface->flags & QNetworkInterface::IsPointToPoint, iface->flags & QNetworkInterface::CanMulticast, + entry.ip().toString().toLatin1().constData(), entry.netmask().toString().toLatin1().constData(), entry.broadcast().toString().toLatin1().constData(), + iface->hardwareAddress.toLatin1().constData()); #endif } } @@ -195,8 +178,7 @@ static QList interfaceListing() // use dummy socket to start enumerating routes err = socket.SetOpt(KSoInetEnumRoutes, KSolInetRtCtrl); - if( err ) - { + if (err) { socket.Close(); socketServ.Close(); // return what we have @@ -206,29 +188,28 @@ static QList interfaceListing() TSoInetRouteInfo routeInfo; TPckg routeInfoPkg(routeInfo); - while(socket.GetOpt(KSoInetNextRoute, KSolInetRtCtrl, routeInfoPkg) == KErrNone) - { + while (socket.GetOpt(KSoInetNextRoute, KSolInetRtCtrl, routeInfoPkg) == KErrNone) { TName address; // get interface address routeInfo.iIfAddr.Output(address); QHostAddress ifAddr(qstringFromDesc(address)); - if(ifAddr.isNull()) + if (ifAddr.isNull()) continue; routeInfo.iDstAddr.Output(address); QHostAddress destination(qstringFromDesc(address)); - if(destination.isNull() || destination != ifAddr) + if (destination.isNull() || destination != ifAddr) continue; // search interfaces - for(int ifindex = 0; ifindex < interfaces.size(); ++ifindex) { + for (int ifindex = 0; ifindex < interfaces.size(); ++ifindex) { QNetworkInterfacePrivate *iface = interfaces.at(ifindex); - for(int eindex = 0; eindex < iface->addressEntries.size(); ++eindex) { + for (int eindex = 0; eindex < iface->addressEntries.size(); ++eindex) { QNetworkAddressEntry entry = iface->addressEntries.at(eindex); - if(entry.ip() != ifAddr) { + if (entry.ip() != ifAddr) { continue; - } else if(entry.ip().protocol() != QAbstractSocket::IPv4Protocol) { + } else if (entry.ip().protocol() != QAbstractSocket::IPv4Protocol) { // skip if not IPv4 address (e.g. IPv6) // as results not reliable on Symbian continue; @@ -240,9 +221,6 @@ static QList interfaceListing() // ::postProcess to have effect entry.setBroadcast(QHostAddress()); iface->addressEntries.replace(eindex, entry); -// printf("for %s netmask = %s and destination = %s ; type = %d; state = %d; metric = %d \n", -// ifAddr.toString().toLatin1().constData(), netmask.toString().toLatin1().constData(), destination.toString().toLatin1().constData(), -// routeInfo.iType, routeInfo.iState, routeInfo.iMetric); } } } -- cgit v0.12 From c58ad73ee53374a96dc67b8bf554f14cf718be2a Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Tue, 4 Aug 2009 11:48:18 +0300 Subject: Whitespace, comment, and dead code cleanup for qmake --- qmake/Makefile.win32 | 19 +- qmake/Makefile.win32-g++ | 10 +- qmake/Makefile.win32-g++-sh | 8 +- qmake/Makefile.win32-mwc | 8 +- qmake/generators/makefile.cpp | 2 +- qmake/generators/metamakefile.cpp | 86 +++----- .../symbian/initprojectdeploy_symbian.cpp | 5 +- qmake/generators/symbian/symmake.cpp | 226 ++++++++++----------- qmake/generators/symbian/symmake.h | 17 +- qmake/generators/symbian/symmake_abld.cpp | 12 +- qmake/generators/symbian/symmake_abld.h | 6 +- qmake/generators/symbian/symmake_sbsv2.cpp | 7 +- qmake/generators/symbian/symmake_sbsv2.h | 5 +- qmake/project.cpp | 10 +- qmake/qmake.pri | 4 +- qmake/qpopen.cpp | 3 - 16 files changed, 176 insertions(+), 252 deletions(-) diff --git a/qmake/Makefile.win32 b/qmake/Makefile.win32 index 54c2872..3f4f8d4 100644 --- a/qmake/Makefile.win32 +++ b/qmake/Makefile.win32 @@ -86,11 +86,11 @@ CFLAGS = $(CFLAGS) -DQMAKE_OPENSOURCE_EDITION QTOBJS= \ qbitarray.obj \ qbuffer.obj \ - qcryptographichash.obj \ + qcryptographichash.obj \ qfsfileengine.obj \ qfsfileengine_iterator.obj \ qbytearray.obj \ - qvsnprintf.obj \ + qvsnprintf.obj \ qbytearraymatcher.obj \ qdatetime.obj \ qdir.obj \ @@ -107,7 +107,7 @@ QTOBJS= \ qlistdata.obj \ qlinkedlist.obj \ qlocale.obj \ - qmalloc.obj \ + qmalloc.obj \ qmap.obj \ qregexp.obj \ qstring.obj \ @@ -119,9 +119,9 @@ QTOBJS= \ qsettings.obj \ qlibraryinfo.obj \ qvariant.obj \ - qurl.obj \ + qurl.obj \ qsettings_win.obj \ - qmetatype.obj \ + qmetatype.obj \ qnumeric.obj \ qscriptasm.obj \ qscriptast.obj \ @@ -179,7 +179,7 @@ clean:: -del qfsfileengine.obj -del qfsfileengine_iterator.obj -del qbytearray.obj - -del qvsnprintf.obj + -del qvsnprintf.obj -del qbytearraymatcher.obj -del qdatetime.obj -del qdir.obj @@ -207,9 +207,9 @@ clean:: -del qsettings.obj -del qlibraryinfo.obj -del qvariant.obj - -del qurl.obj + -del qurl.obj -del qsettings_win.obj - -del qmetatype.obj + -del qmetatype.obj -del project.obj -del main.obj -del makefile.obj @@ -424,6 +424,7 @@ qmap.obj: $(SOURCE_PATH)\src\corelib\tools\qmap.cpp qunicodetables.obj: $(SOURCE_PATH)\src\corelib\tools\qunicodetables.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\corelib\tools\qunicodetables.cpp + makefile.obj: $(SOURCE_PATH)/qmake/generators\makefile.cpp $(CXX) $(CXXFLAGS) generators\makefile.cpp @@ -464,7 +465,7 @@ symmake_sbsv2.obj: $(SOURCE_PATH)/qmake/generators/symbian/symmake_sbsv2.cpp $(CXX) $(CXXFLAGS) generators/symbian/symmake_sbsv2.cpp initprojectdeploy_symbian.obj: $(SOURCE_PATH)/qmake/generators/symbian/initprojectdeploy_symbian.cpp - $(CXX) $(CXXFLAGS) generators/symbian/initprojectdeploy_symbian.cpp + $(CXX) $(CXXFLAGS) generators/symbian/initprojectdeploy_symbian.cpp md5.obj: $(SOURCE_PATH)\src\3rdparty\md5\md5.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\3rdparty\md5\md5.cpp diff --git a/qmake/Makefile.win32-g++ b/qmake/Makefile.win32-g++ index dd65145..03ca6dd 100644 --- a/qmake/Makefile.win32-g++ +++ b/qmake/Makefile.win32-g++ @@ -19,13 +19,13 @@ CFLAGS = -c -o$@ -O \ -I$(BUILD_PATH)/include -I$(BUILD_PATH)/include/QtCore \ -I$(SOURCE_PATH)/include -I$(SOURCE_PATH)/include/QtCore \ -I$(BUILD_PATH)/src/corelib/global \ - -I$(BUILD_PATH)/include/QtScript \ + -I$(BUILD_PATH)/include/QtScript \ -I$(BUILD_PATH)/src/corelib/xml \ -I$(SOURCE_PATH)/mkspecs/win32-g++ \ -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_LITE_COMPONENT -DQT_NO_PCRE \ - -DQT_NODLL -DQT_NO_STL -DQT_NO_COMPRESS -DUNICODE -DHAVE_QCONFIG_CPP \ - -DQT_BUILD_QMAKE -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM \ - -DQT_BOOTSTRAPPED + -DQT_NODLL -DQT_NO_STL -DQT_NO_COMPRESS -DUNICODE -DHAVE_QCONFIG_CPP \ + -DQT_BUILD_QMAKE -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM \ + -DQT_BOOTSTRAPPED CXXFLAGS = $(CFLAGS) LFLAGS = LIBS = -lole32 -luuid @@ -50,7 +50,7 @@ QTOBJS= \ qbitarray.o \ qbuffer.o \ qbytearray.o \ - qcryptographichash.o \ + qcryptographichash.o \ qvsnprintf.o \ qbytearraymatcher.o \ qconfig.o \ diff --git a/qmake/Makefile.win32-g++-sh b/qmake/Makefile.win32-g++-sh index 646815b..bd1b8b5 100644 --- a/qmake/Makefile.win32-g++-sh +++ b/qmake/Makefile.win32-g++-sh @@ -19,13 +19,13 @@ CFLAGS = -c -o$@ -O \ -I$(BUILD_PATH)/include -I$(BUILD_PATH)/include/QtCore \ -I$(SOURCE_PATH)/include -I$(SOURCE_PATH)/include/QtCore \ -I$(BUILD_PATH)/src/corelib/global \ - -I$(BUILD_PATH)/include/QtScript \ + -I$(BUILD_PATH)/include/QtScript \ -I$(BUILD_PATH)/src/corelib/xml \ -I$(SOURCE_PATH)/mkspecs/win32-g++ \ -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_LITE_COMPONENT -DQT_NO_PCRE \ - -DQT_NODLL -DQT_NO_STL -DQT_NO_COMPRESS -DUNICODE -DHAVE_QCONFIG_CPP \ - -DQT_BUILD_QMAKE -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM \ - -DQT_BOOTSTRAPPED + -DQT_NODLL -DQT_NO_STL -DQT_NO_COMPRESS -DUNICODE -DHAVE_QCONFIG_CPP \ + -DQT_BUILD_QMAKE -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM \ + -DQT_BOOTSTRAPPED CXXFLAGS = $(CFLAGS) LFLAGS = LIBS = -lole32 -luuid diff --git a/qmake/Makefile.win32-mwc b/qmake/Makefile.win32-mwc index 08b6c49..b3b1b71 100644 --- a/qmake/Makefile.win32-mwc +++ b/qmake/Makefile.win32-mwc @@ -14,7 +14,7 @@ endif CXX = mwccsym2 CFLAGS = -gccinc \ -w on -w nonotused -w nonotinlined -w noimplicit -w nopadding -w noemptydecl \ - -w nounusedexpr -w nopossible -c -o $@ -O \ + -w nounusedexpr -w nopossible -c -o $@ -O \ -I. -Igenerators -Igenerators\unix \ -Igenerators\win32 -Igenerators\mac \ -Igenerators\symbian \ @@ -23,8 +23,8 @@ CFLAGS = -gccinc \ -I$(BUILD_PATH)\src\corelib\global \ -I$(SOURCE_PATH)\mkspecs\win32-mwc \ -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_LITE_COMPONENT -DQT_NO_PCRE \ - -DQT_NODLL -DQT_NO_STL -DQT_NO_COMPRESS -DHAVE_QCONFIG_CPP \ - -DQT_BUILD_QMAKE -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM \ + -DQT_NODLL -DQT_NO_STL -DQT_NO_COMPRESS -DHAVE_QCONFIG_CPP \ + -DQT_BUILD_QMAKE -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM \ -DQT_NO_LIBRARY -I$(BUILD_PATH)\include\QtScript \ -I$(SOURCE_PATH)\corelib\xml -DQT_BOOTSTRAPPED @@ -52,7 +52,7 @@ QTOBJS= \ qbitarray.o \ qbuffer.o \ qbytearray.o \ - qcryptographichash.o \ + qcryptographichash.o \ qvsnprintf.o \ qbytearraymatcher.o \ qconfig.o \ diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 5eaa39f..345f999 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -275,7 +275,7 @@ MakefileGenerator::initOutPaths() int slash = path.lastIndexOf(Option::dir_sep); if(slash != -1) { path = path.left(slash); - // Make out path only if it does not contains makefile variables + // Make out path only if it does not contain makefile variables if(!path.contains("${")) if(path != "." && !mkdir(fileFixify(path, qmake_getpwd(), Option::output_dir))) diff --git a/qmake/generators/metamakefile.cpp b/qmake/generators/metamakefile.cpp index 63b0f17..0b8fa17 100644 --- a/qmake/generators/metamakefile.cpp +++ b/qmake/generators/metamakefile.cpp @@ -420,8 +420,8 @@ SubdirsMetaMakefileGenerator::~SubdirsMetaMakefileGenerator() subs.clear(); } -class SymbianSubdirsMetaMakefileGenerator : public SubdirsMetaMakefileGenerator { - +class SymbianSubdirsMetaMakefileGenerator : public SubdirsMetaMakefileGenerator +{ public: SymbianSubdirsMetaMakefileGenerator(QMakeProject *p, const QString &n, bool op) : SubdirsMetaMakefileGenerator(p, n, op) { } virtual ~SymbianSubdirsMetaMakefileGenerator(); @@ -441,29 +441,23 @@ protected: private: QString cleanFromSpecialCharacters(QString& str); - }; QMap SymbianSubdirsMetaMakefileGenerator::mmpPaths; QMultiMap SymbianSubdirsMetaMakefileGenerator::mmpDependency; -QStringList SymbianSubdirsMetaMakefileGenerator::getDependencyList(QString mmpFilename, int recursionDepth) { - +QStringList SymbianSubdirsMetaMakefileGenerator::getDependencyList(QString mmpFilename, int recursionDepth) +{ QStringList list; - // printf("Entering recursion mmpFilename = %s and depth = %d \n", qPrintable(mmpFilename), recursionDepth); - QList values = mmpDependency.values(mmpFilename); if(recursionDepth < 0) { - // special case - // just first dependency level + // special case; just first dependency level list = values; return list; - } if(values.size() == 0) { - //reached recursion END condition if(recursionDepth == 0) { --recursionDepth; @@ -477,16 +471,13 @@ QStringList SymbianSubdirsMetaMakefileGenerator::getDependencyList(QString mmpFi } else { recursionDepth++; for (int i = 0; i < values.size(); ++i) { - QString current = values.at(i); - QStringList tailList = getDependencyList(current, recursionDepth); - for(int j = 0; j < tailList.size(); ++j) { - //QString path = mmpFilename + tailList.at(j); - QString path = tailList.at(j); - list.append(path); - //printf("MMPDEPENDENCY: %s\n", path.toAscii().data()); - }// for(int j = 0; j < values.size(); ++j) - //list.append(current); - } // for (int i = 0; i < values.size(); ++i) + QString current = values.at(i); + QStringList tailList = getDependencyList(current, recursionDepth); + for(int j = 0; j < tailList.size(); ++j) { + QString path = tailList.at(j); + list.append(path); + } + } if(recursionDepth > 0) { //for mmp somewhere in middle @@ -495,15 +486,17 @@ QStringList SymbianSubdirsMetaMakefileGenerator::getDependencyList(QString mmpFi recursionDepth--; return list; } - } + SymbianSubdirsMetaMakefileGenerator::~SymbianSubdirsMetaMakefileGenerator() { } -bool SymbianSubdirsMetaMakefileGenerator::write(const QString &oldpwd) { +bool SymbianSubdirsMetaMakefileGenerator::write(const QString &oldpwd) +{ return SubdirsMetaMakefileGenerator::write(oldpwd); } -QString SymbianSubdirsMetaMakefileGenerator::cleanFromSpecialCharacters(QString& str) { +QString SymbianSubdirsMetaMakefileGenerator::cleanFromSpecialCharacters(QString& str) +{ QString tmp = str; tmp.replace(QString("/"), QString("_")); @@ -515,26 +508,14 @@ QString SymbianSubdirsMetaMakefileGenerator::cleanFromSpecialCharacters(QString& return tmp; } -bool SymbianSubdirsMetaMakefileGenerator::init() { - +bool SymbianSubdirsMetaMakefileGenerator::init() +{ if(init_flag) return false; init_flag = true; - /* - Not neccessary as it was - causing second pass through - subdir elements - - SubdirsMetaMakefileGenerator::init(); - */ - - /* - if we are here then we have template = subdirs - - so... go for it ... - */ + // If we are here then we have template == subdirs Option::recursive = true; @@ -577,7 +558,6 @@ bool SymbianSubdirsMetaMakefileGenerator::init() { if(subdir.isDir()) { subdir = QFileInfo(subdir.filePath() + "/" + subdir.fileName() + Option::pro_ext); childMmpFilename = subdir.fileName(); - // TODO: create Option::mmp_ext childMmpFilename = subdir.absoluteFilePath(); childMmpFilename.replace(Option::pro_ext, QString("")); childMmpFilename.append(".mmp"); @@ -599,7 +579,7 @@ bool SymbianSubdirsMetaMakefileGenerator::init() { if(subdir.isRelative() && old_output_dir != oldpwd) { sub->output_dir = old_output_dir + "/" + subdir.path(); printf("Reading %s [%s]\n", subdir.absoluteFilePath().toLatin1().constData(), sub->output_dir.toLatin1().constData()); - } else { //what about shadow builds? + } else { sub->output_dir = sub->input_dir; printf("Reading %s\n", subdir.absoluteFilePath().toLatin1().constData()); } @@ -654,10 +634,8 @@ bool SymbianSubdirsMetaMakefileGenerator::init() { Subdir *self = new Subdir; self->input_dir = qmake_getpwd(); - // to fully expand find all dependencies - // do as recursion, then - // insert result - // as subdirs data in project + // To fully expand find all dependencies: + // Do as recursion, then insert result as subdirs data in project QString newpwd = qmake_getpwd(); if(!newpwd.endsWith('/')) newpwd += '/'; @@ -667,7 +645,7 @@ bool SymbianSubdirsMetaMakefileGenerator::init() { mmpFilename.prepend(newpwd); mmpFilename = mmpFilename.append(".mmp"); - // map mmpfile to its absolut filepath + // map mmpfile to its absolute filepath mmpPaths.insert(mmpFilename, newpwd); QStringList directDependencyList = getDependencyList(mmpFilename, -1); @@ -676,27 +654,14 @@ bool SymbianSubdirsMetaMakefileGenerator::init() { } QStringList dependencyList = getDependencyList(mmpFilename, 0); -/* - printf("\n \n PRINTING DEPENDENCY FOR: %s \n", mmpFilename.toAscii().data()); - // print it for debug - for(int i = 0; i < dependencyList.size(); ++i) { - printf("FINAL MMP DEPENDENCIES: %s\n", dependencyList.at(i).toAscii().data()); - } - printf("\n \n"); - printf("\n \n PRINTING DIRECT DEPENDENCY FOR: %s \n", mmpFilename.toAscii().data()); - // print it for debug - for(int i = 0; i < directDependencyList.size(); ++i) { - printf("DIRECT MMP DEPENDENCIES: %s\n", directDependencyList.at(i).toAscii().data()); - } - printf("\n \n"); -*/ self->output_dir = Option::output_dir; if(!Option::recursive || (!Option::output.fileName().endsWith(Option::dir_sep) && !QFileInfo(Option::output).isDir())) self->output_file = Option::output.fileName(); self->makefile = new BuildsMetaMakefileGenerator(project, name, false); self->makefile->init(); subs.append(self); + return true; } @@ -714,7 +679,6 @@ QStringList SymbianSubdirsMetaMakefileGenerator::calculateRelativePaths(QString mmpRelativePaths.append(childDir); else directory.relativeFilePath(relativePath); - //mmpRelativePaths.append(directory.relativeFilePath(childDir) + "/" + mmpChildren.at(i)); } } return mmpRelativePaths; diff --git a/qmake/generators/symbian/initprojectdeploy_symbian.cpp b/qmake/generators/symbian/initprojectdeploy_symbian.cpp index 22e4aad..8e3e20b 100644 --- a/qmake/generators/symbian/initprojectdeploy_symbian.cpp +++ b/qmake/generators/symbian/initprojectdeploy_symbian.cpp @@ -118,9 +118,7 @@ void initProjectDeploySymbian(QMakeProject* project, } QString deploymentDrive = targetPathHasDriveLetter ? targetPath.left(2) : QLatin1String("c:"); - // foreach item in DEPLOYMENT foreach(QString item, project->values("DEPLOYMENT")) { - // get item.path QString devicePath = project->first(item + ".path"); if (!deployBinaries && !devicePath.isEmpty() @@ -172,7 +170,6 @@ void initProjectDeploySymbian(QMakeProject* project, continue; } - // foreach d in item.sources foreach(QString source, project->values(item + ".sources")) { source = Option::fixPathToLocalOS(source); QString nameFilter; @@ -216,7 +213,7 @@ void initProjectDeploySymbian(QMakeProject* project, QDirIterator iterator(searchPath, QStringList() << nameFilter , QDir::Files | QDir::NoDotAndDotDot | QDir::NoSymLinks , dirSearch ? QDirIterator::Subdirectories : QDirIterator::NoIteratorFlags ); - // foreach dirIterator-entry in d + while(iterator.hasNext()) { iterator.next(); QFileInfo iteratorInfo(iterator.filePath()); diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp index c842b0e..1f22c70 100644 --- a/qmake/generators/symbian/symmake.cpp +++ b/qmake/generators/symbian/symmake.cpp @@ -146,7 +146,8 @@ QString SymbianMakefileGenerator::canonizePath(const QString& origPath) SymbianMakefileGenerator::SymbianMakefileGenerator() : MakefileGenerator() { } SymbianMakefileGenerator::~SymbianMakefileGenerator() { } -void SymbianMakefileGenerator::writeHeader(QTextStream &t) { +void SymbianMakefileGenerator::writeHeader(QTextStream &t) +{ t << "// ============================================================================" << endl; t << "// * Makefile for building: " << escapeFilePath(var("TARGET")) << endl; t << "// * Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: "; @@ -155,13 +156,10 @@ void SymbianMakefileGenerator::writeHeader(QTextStream &t) { t << "// * user." << endl; t << "// * Project: " << fileFixify(project->projectFile()) << endl; t << "// * Template: " << var("TEMPLATE") << endl; - //if(!project->isActiveConfig("build_pass")) - // t << "// = Command: " << build_args().replace("$(QMAKE)", - // (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : var("QMAKE_QMAKE"))) << endl; t << "// ============================================================================" << endl; t << endl; - // defining define for bld.inf + // Defining define for bld.inf QString shortProFilename = project->projectFile(); shortProFilename.replace(0, shortProFilename.lastIndexOf("/") + 1, QString("")); @@ -177,7 +175,8 @@ void SymbianMakefileGenerator::writeHeader(QTextStream &t) { t << "#define " << bldinfDefine.toUpper() << endl << endl; } -bool SymbianMakefileGenerator::writeMakefile(QTextStream &t) { +bool SymbianMakefileGenerator::writeMakefile(QTextStream &t) +{ writeHeader(t); QString numberOfIcons; @@ -268,7 +267,8 @@ bool SymbianMakefileGenerator::writeMakefile(QTextStream &t) { return true; } -bool SymbianMakefileGenerator::generatePkgFile(const QString &compiler, const QString &config, const QString &iconFile) { +bool SymbianMakefileGenerator::generatePkgFile(const QString &compiler, const QString &config, const QString &iconFile) +{ QString build = ( config == "udeb" ) ? "debug" : "release"; QString pkgFilename = QString("%1_%2-%3.%4") .arg(fileInfo(project->projectFile()).completeBaseName()) @@ -281,15 +281,15 @@ bool SymbianMakefileGenerator::generatePkgFile(const QString &compiler, const QS generatedFiles << pkgFile.fileName(); - // header info + // Header info QTextStream t(&pkgFile); t << QString("; %1 generated by qmake at %2").arg(pkgFilename).arg(QDateTime::currentDateTime().toString(Qt::ISODate)) << endl; t << "; This file is generated by qmake and should not be modified by the user" << endl; t << ";" << endl << endl; - + // Construct QStringList from pkg_prerules since we need search it before printed to file QStringList rawPkgPreRules; - foreach(QString deploymentItem, project->values("DEPLOYMENT")) { + foreach(QString deploymentItem, project->values("DEPLOYMENT")) { foreach(QString pkgrulesItem, project->values(deploymentItem + ".pkg_prerules")) { QStringList pkgrulesValue = project->values(pkgrulesItem); // If there is no stringlist defined for a rule, use rule name directly @@ -300,20 +300,20 @@ bool SymbianMakefileGenerator::generatePkgFile(const QString &compiler, const QS foreach(QString pkgrule, pkgrulesValue) { rawPkgPreRules << pkgrule; } - } + } } - } + } // Apply some defaults if specific data does not exist in PKG pre-rules - - if(!containsStartWithItem('&', rawPkgPreRules)) { + + if(!containsStartWithItem('&', rawPkgPreRules)) { // language, (*** hardcoded to english atm, should be parsed from TRANSLATIONS) t << "; Language" << endl; t << "&EN" << endl << endl; } else { // In case user defines langs, he must take care also about SIS header if(!containsStartWithItem('#', rawPkgPreRules)) - fprintf(stderr, "Warning: If language is defined with DEPLOYMENT pkg_prerules, also the SIS header must be defined\n"); + fprintf(stderr, "Warning: If language is defined with DEPLOYMENT pkg_prerules, also the SIS header must be defined\n"); } // name of application, UID and version @@ -321,39 +321,39 @@ bool SymbianMakefileGenerator::generatePkgFile(const QString &compiler, const QS int last = applicationName.lastIndexOf(QLatin1Char('/')); applicationName = applicationName.mid( last == -1 ? 0 : last+1 ); QString applicationVersion = project->first("VERSION").isEmpty() ? "1,0,0" : project->first("VERSION").replace('.', ','); - - if(!containsStartWithItem('#', rawPkgPreRules)) { + + if(!containsStartWithItem('#', rawPkgPreRules)) { t << "; SIS header: name, uid, version" << endl; t << QString("#{\"%1\"},(%2),%3").arg(applicationName).arg(uid3).arg(applicationVersion) << endl << endl; } // Localized vendor name if(!containsStartWithItem('%', rawPkgPreRules)) { - t << "; Localised Vendor name" << endl; - t << "%{\"Vendor\"}" << endl << endl; + t << "; Localised Vendor name" << endl; + t << "%{\"Vendor\"}" << endl << endl; } - + // Unique vendor name - if(!containsStartWithItem(':', rawPkgPreRules)) { + if(!containsStartWithItem(':', rawPkgPreRules)) { t << "; Unique Vendor name" << endl; t << ":\"Vendor\"" << endl << endl; } // PKG pre-rules - these are added before actual file installations i.e. SISX package body if(rawPkgPreRules.size()) { - t << "; Manual PKG pre-rules from PRO files" << endl; + t << "; Manual PKG pre-rules from PRO files" << endl; foreach(QString item, rawPkgPreRules) { t << item << endl; } - t << endl; - } + t << endl; + } - // install paths on the phone *** should be dynamic at some point + // Install paths on the phone *** should be dynamic at some point QString installPathBin = "!:\\sys\\bin"; QString installPathResource = "!:\\resource\\apps"; QString installPathRegResource = "!:\\private\\10003a3f\\import\\apps"; - // find location of builds + // Find location of builds QString epocReleasePath = QString("%1epoc32/release/%2/%3") .arg(epocRoot()) .arg(compiler) @@ -409,15 +409,15 @@ bool SymbianMakefileGenerator::generatePkgFile(const QString &compiler, const QS .arg(QString(depList.at(i).from).replace('\\','/')) .arg(depList.at(i).to) << endl; } - t << endl; - - // PKG post-rules - these are added after actual file installations i.e. SISX package body + t << endl; + + // PKG post-rules - these are added after actual file installations i.e. SIS package body t << "; Manual PKG post-rules from PRO files" << endl; - foreach(QString deploymentItem, project->values("DEPLOYMENT")) { + foreach(QString deploymentItem, project->values("DEPLOYMENT")) { foreach(QString pkgrulesItem, project->values(deploymentItem + ".pkg_postrules")) { QStringList pkgrulesValue = project->values(pkgrulesItem); // If there is no stringlist defined for a rule, use rule name directly - // This is convenience for defining single line mmp statements + // This is convenience for defining single line statements if (pkgrulesValue.isEmpty()){ t << pkgrulesItem << endl; } else { @@ -425,9 +425,9 @@ bool SymbianMakefileGenerator::generatePkgFile(const QString &compiler, const QS t << pkgrule << endl; } } - t << endl; + t << endl; } - } + } return true; } @@ -444,7 +444,8 @@ bool SymbianMakefileGenerator::containsStartWithItem(const QChar &c, const QStri return result; } -bool SymbianMakefileGenerator::writeCustomDefFile() { +bool SymbianMakefileGenerator::writeCustomDefFile() +{ if(targetType.compare("plugin", Qt::CaseInsensitive) == 0 && !project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) { // Create custom def file for plugin QFile ft(QLatin1String(PLUGIN_COMMON_DEF_FILE_ACTUAL)); @@ -482,10 +483,7 @@ bool SymbianMakefileGenerator::writeCustomDefFile() { void SymbianMakefileGenerator::init() { MakefileGenerator::init(); -/* - DUMP_VAR("GENERATED_SOURCES"); -*/ - // fixing again !!! + if(0 != project->values("QMAKE_PLATFORM").size()) platform = varGlue("QMAKE_PLATFORM", "", " ", ""); @@ -502,29 +500,25 @@ void SymbianMakefileGenerator::init() // .mmp initMmpVariables(); - // UID1 - uid1 = generateUID1(); - - // check TARGET.UID2 and TARGET.UID3 presence + // Check TARGET.UID2 and TARGET.UID3 presence if(0 != project->values("TARGET.UID3").size()) { uid3 = project->first("TARGET.UID3"); } else { uid3 = generateUID3(); } - // some fix if((project->values("TEMPLATE")).contains("app")) targetType = "exe"; else if((project->values("TEMPLATE")).contains("lib")) { - // check CONFIG to see if we are to build staticlib or dll + // Check CONFIG to see if we are to build staticlib or dll if(project->values("CONFIG").contains("staticlib") || project->values("CONFIG").contains("static")) targetType = "staticlib"; else if (project->values("CONFIG").contains("plugin")) targetType = "plugin"; - else // for now it will be default + else targetType = "dll"; } - else // fix + else targetType = "subdirs"; if(0 != project->values("TARGET.UID2").size()) { @@ -534,11 +528,10 @@ void SymbianMakefileGenerator::init() } else { if(getTargetExtension() == "exe") { if(project->values("QT").contains("gui", Qt::CaseInsensitive)) { - // exe and also gui + // exe and gui -> uid2 needed uid2 = "0x100039CE"; } else { - // exe but not gui.. uid2 is ignored anyway - // set it to 0 + // exe but not gui: uid2 is ignored anyway -> set it to 0 uid2 = "0"; } } else if(getTargetExtension() == "dll" || getTargetExtension() == "lib") { @@ -563,7 +556,8 @@ void SymbianMakefileGenerator::init() } } -QString SymbianMakefileGenerator::getTargetExtension() { +QString SymbianMakefileGenerator::getTargetExtension() +{ QString ret; if(targetType.compare("exe", Qt::CaseInsensitive) == 0 || targetType.compare("app", Qt::CaseInsensitive) == 0) { ret.append("exe"); @@ -572,41 +566,30 @@ QString SymbianMakefileGenerator::getTargetExtension() { } else if (targetType.compare("dll", Qt::CaseInsensitive) == 0 || targetType.compare("plugin", Qt::CaseInsensitive) == 0) { ret.append("dll"); } else if (targetType.compare("subdirs", Qt::CaseInsensitive) == 0) { - // just fix ret.append("subdirs"); } else { - // if nothing said then assume "exe" + // If nothing else set, default to exe ret.append("exe"); } return ret; } -bool SymbianMakefileGenerator::isConfigSetToSymbian() { +bool SymbianMakefileGenerator::isConfigSetToSymbian() +{ return project->values("CONFIG").contains("symbian", Qt::CaseInsensitive); } -QString SymbianMakefileGenerator::generateUID1() { - // just for now - return QString(""); -} - -QString SymbianMakefileGenerator::generateUID2() { - // standard stuff; picked form symbian - // later meybe read from somewhere - return QString(""); -} - -QString SymbianMakefileGenerator::generateUID3() { - +QString SymbianMakefileGenerator::generateUID3() +{ QString target = project->first("TARGET"); QString currPath = qmake_getpwd(); target.prepend("/").prepend(currPath); return generate_test_uid(target); - } -bool SymbianMakefileGenerator::initMmpVariables() { +bool SymbianMakefileGenerator::initMmpVariables() +{ QStringList sysincspaths; QStringList srcincpaths; QStringList srcpaths; @@ -655,9 +638,7 @@ bool SymbianMakefileGenerator::initMmpVariables() { appendIfnotExist(sysincspaths, includepath + QString("/" QT_EXTRA_INCLUDE_DIR)); } - // remove duplicate include path entries - // convert to native directory separators - // to check if includepaths are same + // Remove duplicate include path entries QStringList temporary; for(int i = 0; i < sysincspaths.size(); ++i) { QString origPath = sysincspaths.at(i); @@ -671,7 +652,7 @@ bool SymbianMakefileGenerator::initMmpVariables() { if(origPathInfo.absoluteFilePath() == tmpPathInfo.absoluteFilePath()) { bFound = true; if(!tmpPathInfo.isRelative() && origPathInfo.isRelative()) { - // we keep the relative notation + // We keep the relative notation temporary.removeOne(tmpPath); temporary << origPath; } @@ -691,8 +672,8 @@ bool SymbianMakefileGenerator::initMmpVariables() { return true; } -bool SymbianMakefileGenerator::removeDuplicatedStrings(QStringList& stringList) { - +bool SymbianMakefileGenerator::removeDuplicatedStrings(QStringList& stringList) +{ QStringList tmpStringList; for(int i = 0; i < stringList.size(); ++i) { @@ -708,7 +689,8 @@ bool SymbianMakefileGenerator::removeDuplicatedStrings(QStringList& stringList) return true; } -bool SymbianMakefileGenerator::writeMmpFileHeader(QTextStream &t){ +bool SymbianMakefileGenerator::writeMmpFileHeader(QTextStream &t) +{ t << "// ==============================================================================" << endl; t << "// Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: "; t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl; @@ -726,8 +708,6 @@ bool SymbianMakefileGenerator::writeMmpFile(QString &filename, QStringList &symb if(ft.open(QIODevice::WriteOnly)) { generatedFiles << ft.fileName(); - //printf("WRITING: %s \n", qPrintable(filename)); - QTextStream t(&ft); writeMmpFileHeader(t); @@ -775,8 +755,8 @@ bool SymbianMakefileGenerator::writeMmpFile(QString &filename, QStringList &symb return true; } -bool SymbianMakefileGenerator::writeMmpFileMacrosPart(QTextStream& t) { - +bool SymbianMakefileGenerator::writeMmpFileMacrosPart(QTextStream& t) +{ t << endl; if(isConfigSetToSymbian()) @@ -804,32 +784,34 @@ bool SymbianMakefileGenerator::writeMmpFileMacrosPart(QTextStream& t) { return true; } -bool SymbianMakefileGenerator::addMacro(QTextStream& t, const QString& value) { +bool SymbianMakefileGenerator::addMacro(QTextStream& t, const QString& value) +{ t << "MACRO" << "\t\t" << value << endl; return true; } -bool SymbianMakefileGenerator::writeMmpFileTargetPart(QTextStream& t) { +bool SymbianMakefileGenerator::writeMmpFileTargetPart(QTextStream& t) +{ if(getTargetExtension() == "exe") { t << "TARGET" << "\t\t" << removePathSeparators(escapeFilePath(fileFixify(project->first("TARGET"))).append(".exe")) << "\n"; if (project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) t << "TARGETTYPE" << "\t\t" << "STDEXE" << endl; else t << "TARGETTYPE" << "\t\t" << "EXE" << endl; - } else if (getTargetExtension() == "dll"){ + } else if (getTargetExtension() == "dll"){ t << "TARGET" << "\t\t" << removePathSeparators(escapeFilePath(fileFixify(project->first("TARGET"))).append(".dll")) << "\n"; if (project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) t << "TARGETTYPE" << "\t\t" << "STDDLL" << endl; else t << "TARGETTYPE" << "\t\t" << "DLL" << endl; - } else if (getTargetExtension() == "lib"){ + } else if (getTargetExtension() == "lib"){ t << "TARGET" << "\t\t" << removePathSeparators(escapeFilePath(fileFixify(project->first("TARGET"))).append(".lib")) << "\n"; if (project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) t << "TARGETTYPE" << "\t\t" << "STDLIB" << endl; else t << "TARGETTYPE" << "\t\t" << "LIB" << endl; - } else { + } else { printf("unexpected target and targettype %s\n", getTargetExtension().toAscii().data()); } @@ -846,7 +828,7 @@ bool SymbianMakefileGenerator::writeMmpFileTargetPart(QTextStream& t) { t << "SECUREID" << "\t\t" << uid3 << endl; } - // default value used from mkspecs..qconfig.h is 0 + // default value used from mkspecs is 0 if(0 != project->values("TARGET.VID").size()) { t << "VENDORID" << "\t\t" << project->values("TARGET.VID").join(" ") << endl; } @@ -861,7 +843,7 @@ bool SymbianMakefileGenerator::writeMmpFileTargetPart(QTextStream& t) { t << "EPOCALLOWDLLDATA" << endl; if(targetType.compare("plugin", Qt::CaseInsensitive) == 0 && !project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) { - // use custom def file for Qt plugins + // Use custom def file for Qt plugins t << "DEFFILE " PLUGIN_COMMON_DEF_FILE_FOR_MMP << endl; } @@ -872,12 +854,11 @@ bool SymbianMakefileGenerator::writeMmpFileTargetPart(QTextStream& t) { /* - Application registration resource files - should be installed to the - + Application registration resource files should be installed to the \private\10003a3f\import\apps directory. */ -bool SymbianMakefileGenerator::writeMmpFileResourcePart(QTextStream& t, QStringList &symbianLangCodes) { +bool SymbianMakefileGenerator::writeMmpFileResourcePart(QTextStream& t, QStringList &symbianLangCodes) +{ if((getTargetExtension() == "exe") && !project->values("CONFIG").contains("no_icon", Qt::CaseInsensitive)) { QString target = escapeFilePath(fileFixify(project->first("TARGET"))); @@ -897,15 +878,10 @@ bool SymbianMakefileGenerator::writeMmpFileResourcePart(QTextStream& t, QStringL t << "TARGETPATH\t\t\t" RESOURCE_DIRECTORY_MMP<< endl; t << "END" << endl << endl; - // now append extension QString regTarget = target; regTarget.append("_reg.rss"); - // must state SOURCEPATH for resources - // relative placement (relative to dir where .mmp located) - // absolute placement (!RELATIVE! to EPOCROOT dir) - - t << "SOURCEPATH\t\t\t. " << endl; + t << "SOURCEPATH\t\t\t." << endl; t << "START RESOURCE\t\t" << regTarget << endl; if (isForSymbianSbsv2()) t << "DEPENDS " << target << ".rsg" << endl; @@ -915,7 +891,8 @@ bool SymbianMakefileGenerator::writeMmpFileResourcePart(QTextStream& t, QStringL return true; } -bool SymbianMakefileGenerator::writeMmpFileSystemIncludePart(QTextStream& t) { +bool SymbianMakefileGenerator::writeMmpFileSystemIncludePart(QTextStream& t) +{ QDir current = QDir::current(); @@ -932,14 +909,16 @@ bool SymbianMakefileGenerator::writeMmpFileSystemIncludePart(QTextStream& t) { return true; } -bool SymbianMakefileGenerator::writeMmpFileIncludePart(QTextStream& t) { +bool SymbianMakefileGenerator::writeMmpFileIncludePart(QTextStream& t) +{ writeMmpFileSystemIncludePart(t); return true; } -bool SymbianMakefileGenerator::writeMmpFileLibraryPart(QTextStream& t) { +bool SymbianMakefileGenerator::writeMmpFileLibraryPart(QTextStream& t) +{ QStringList &libs = project->values("LIBS"); libs << project->values("QMAKE_LIBS"); @@ -947,8 +926,7 @@ bool SymbianMakefileGenerator::writeMmpFileLibraryPart(QTextStream& t) { for(int i = 0; i < libs.size(); ++i) { QString lib = libs.at(i); - // The -L flag is uninteresting, since all symbian libraries exist in the - // same directory. + // The -L flag is uninteresting, since all symbian libraries exist in the same directory. if(lib.startsWith("-l")) { lib.remove(0,2); QString mmpStatement; @@ -961,7 +939,7 @@ bool SymbianMakefileGenerator::writeMmpFileLibraryPart(QTextStream& t) { } else { // Hacky way to find out what kind of library it is. Check the // ARMV5 build directory for library type. We default to shared - // library, since that is probably more common. + // library, since that is more common. QString udebStaticLibLocation(epocRoot()); QString urelStaticLibLocation(udebStaticLibLocation); udebStaticLibLocation += QString("epoc32/release/armv5/udeb/%1.lib").arg(lib); @@ -981,7 +959,8 @@ bool SymbianMakefileGenerator::writeMmpFileLibraryPart(QTextStream& t) { return true; } -bool SymbianMakefileGenerator::writeMmpFileCapabilityPart(QTextStream& t) { +bool SymbianMakefileGenerator::writeMmpFileCapabilityPart(QTextStream& t) +{ if(0 != project->first("TARGET.CAPABILITY").size()) { QStringList &capabilities = project->values("TARGET.CAPABILITY"); t << "CAPABILITY" << "\t\t"; @@ -999,7 +978,8 @@ bool SymbianMakefileGenerator::writeMmpFileCapabilityPart(QTextStream& t) { return true; } -bool SymbianMakefileGenerator::writeMmpFileCompilerOptionPart(QTextStream& t) { +bool SymbianMakefileGenerator::writeMmpFileCompilerOptionPart(QTextStream& t) +{ QString cw, armcc; if(0 != project->values("QMAKE_CXXFLAGS.CW").size()) { @@ -1045,13 +1025,13 @@ bool SymbianMakefileGenerator::writeMmpFileCompilerOptionPart(QTextStream& t) { t << "OPTION" << '\t' << " CW " << cw << endl; if (!armcc.isEmpty()) t << "OPTION" << '\t' << " ARMCC "<< armcc << endl; - // others to come t << endl; return true; } -bool SymbianMakefileGenerator::writeMmpFileBinaryVersionPart(QTextStream& t) { +bool SymbianMakefileGenerator::writeMmpFileBinaryVersionPart(QTextStream& t) +{ QString applicationVersion = project->first("VERSION"); QStringList verNumList = applicationVersion.split('.'); uint major = 0; @@ -1088,7 +1068,8 @@ bool SymbianMakefileGenerator::writeMmpFileBinaryVersionPart(QTextStream& t) { return true; } -bool SymbianMakefileGenerator::writeMmpFileRulesPart(QTextStream& t) { +bool SymbianMakefileGenerator::writeMmpFileRulesPart(QTextStream& t) +{ foreach(QString item, project->values("MMP_RULES")) { t << endl; // If there is no stringlist defined for a rule, use rule name directly @@ -1104,7 +1085,8 @@ bool SymbianMakefileGenerator::writeMmpFileRulesPart(QTextStream& t) { return true; } -bool SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploymentExtension) { +bool SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploymentExtension) +{ // Read user defined bld inf rules QMap userBldInfRules; for(QMap::iterator it = project->variables().begin(); it != project->variables().end(); ++it) { @@ -1146,7 +1128,7 @@ bool SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploy removeDuplicatedStrings(mmpProjects); removeDuplicatedStrings(shadowProjects); - // go in reverse order ... as that is the way how I build the list + // Go in reverse order as that is the way how we build the list QListIterator iT(mmpProjects); iT.toBack(); while(iT.hasPrevious()) { @@ -1167,10 +1149,9 @@ bool SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploy relativePath = directory.relativeFilePath(fullProFilename); bldinfFilename = BLD_INF_FILENAME "." + cleanMmpName; if(relativePath.contains("/")) { - // shadow .pro not in same - // directory as parent .pro + // Shadow .pro not in same directory as parent .pro if(relativePath.startsWith("..")) { - // shadow .pro out of parent .pro + // Shadow .pro out of parent .pro relativePath.replace(relativePath.lastIndexOf("/"), relativePath.length(), QString("")); bldinfFilename.prepend("/").prepend(relativePath); } else { @@ -1178,11 +1159,10 @@ bool SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploy bldinfFilename.prepend("/").prepend(relativePath); } } else { - // shadow .pro and parent .pro in same directory + // Shadow .pro and parent .pro in same directory bldinfFilename.prepend("./"); } } else { // regular project - // calc relative path QDir directory(currentPath); relativePath = directory.relativeFilePath(fullProFilename); relativePath.replace(relativePath.lastIndexOf("/"), relativePath.length(), QString("")); @@ -1261,7 +1241,8 @@ bool SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploy return true; } -bool SymbianMakefileGenerator::writeRegRssFile(QString &appName, QStringList &userItems) { +bool SymbianMakefileGenerator::writeRegRssFile(QString &appName, QStringList &userItems) +{ QString filename(appName); filename.append("_reg.rss"); QFile ft(filename); @@ -1296,7 +1277,8 @@ bool SymbianMakefileGenerator::writeRegRssFile(QString &appName, QStringList &us return true; } -bool SymbianMakefileGenerator::writeRssFile(QString &appName, QString &numberOfIcons, QString &iconFile) { +bool SymbianMakefileGenerator::writeRssFile(QString &appName, QString &numberOfIcons, QString &iconFile) +{ QString filename(appName); filename.append(".rss"); QFile ft(filename); @@ -1340,7 +1322,8 @@ bool SymbianMakefileGenerator::writeRssFile(QString &appName, QString &numberOfI return true; } -bool SymbianMakefileGenerator::writeLocFile(QString &appName, QStringList &symbianLangCodes) { +bool SymbianMakefileGenerator::writeLocFile(QString &appName, QStringList &symbianLangCodes) +{ QString filename(appName); filename.append(".loc"); QFile ft(filename); @@ -1374,7 +1357,8 @@ bool SymbianMakefileGenerator::writeLocFile(QString &appName, QStringList &symbi return true; } -void SymbianMakefileGenerator::readRssRules(QString &numberOfIcons, QString &iconFile, QStringList &userRssRules) { +void SymbianMakefileGenerator::readRssRules(QString &numberOfIcons, QString &iconFile, QStringList &userRssRules) +{ for(QMap::iterator it = project->variables().begin(); it != project->variables().end(); ++it) { if (it.key().startsWith(RSS_RULES_BASE)) { QString newKey = it.key().mid(sizeof(RSS_RULES_BASE)-1); @@ -1455,7 +1439,8 @@ void SymbianMakefileGenerator::readRssRules(QString &numberOfIcons, QString &ico } } -QStringList SymbianMakefileGenerator::symbianLangCodesFromTsFiles() { +QStringList SymbianMakefileGenerator::symbianLangCodesFromTsFiles() +{ QStringList tsfiles; QStringList symbianLangCodes; tsfiles << project->values("TRANSLATIONS"); @@ -1476,7 +1461,8 @@ QStringList SymbianMakefileGenerator::symbianLangCodesFromTsFiles() { return symbianLangCodes; } -void SymbianMakefileGenerator::fillQt2S60LangMapTable() { +void SymbianMakefileGenerator::fillQt2S60LangMapTable() +{ qt2S60LangMapTable.reserve(170); // 165 items at time of writing. qt2S60LangMapTable.insert("ab", "SC"); //Abkhazian // qt2S60LangMapTable.insert("om", "SC"); //Afan // diff --git a/qmake/generators/symbian/symmake.h b/qmake/generators/symbian/symmake.h index ba49118..3bf9f1d 100644 --- a/qmake/generators/symbian/symmake.h +++ b/qmake/generators/symbian/symmake.h @@ -46,25 +46,16 @@ QT_BEGIN_NAMESPACE -// In the Qt evaluation and educational version, we have a postfix in the -// library name (e.g. qtmteval301.dll). QTDLL_POSTFIX is used for this. -// A script modifies these lines when building eval/edu version, so be careful -// when changing them. -#ifndef QTDLL_POSTFIX -#define QTDLL_POSTFIX "" -#endif - #define BLD_INF_FILENAME "bld.inf" #define MAKEFILE_DEPENDENCY_SEPARATOR " \\\n\t" #define QT_EXTRA_INCLUDE_DIR "tmp" -class SymbianMakefileGenerator : public MakefileGenerator { - +class SymbianMakefileGenerator : public MakefileGenerator +{ protected: QString platform; - QString uid1; QString uid2; QString uid3; QString privateDirUid; @@ -92,8 +83,6 @@ protected: QString getTargetExtension(); bool isConfigSetToSymbian(); - QString generateUID1(); - QString generateUID2(); QString generateUID3(); bool initMmpVariables(); @@ -150,8 +139,6 @@ public: SymbianMakefileGenerator(); ~SymbianMakefileGenerator(); - }; #endif // SYMMAKEFILE_H - diff --git a/qmake/generators/symbian/symmake_abld.cpp b/qmake/generators/symbian/symmake_abld.cpp index ccda9f2..17c365d 100644 --- a/qmake/generators/symbian/symmake_abld.cpp +++ b/qmake/generators/symbian/symmake_abld.cpp @@ -64,7 +64,6 @@ SymbianAbldMakefileGenerator::~SymbianAbldMakefileGenerator() { } bool SymbianAbldMakefileGenerator::writeMkFile(const QString& wrapperFileName, bool deploymentOnly) { - QString gnuMakefileName = QLatin1String("Makefile_") + uid3; removeSpecialCharacters(gnuMakefileName); gnuMakefileName.append(".mk"); @@ -204,9 +203,9 @@ void SymbianAbldMakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool t << "endif" << endl; t << endl; t << "DEFINES" << '\t' << " = " - << varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ") - << varGlue("QMAKE_COMPILER_DEFINES", "-D", "-D", " ") - << varGlue("DEFINES","-D"," -D","") << endl; + << varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ") + << varGlue("QMAKE_COMPILER_DEFINES", "-D", "-D", " ") + << varGlue("DEFINES","-D"," -D","") << endl; t << "INCPATH" << '\t' << " = "; @@ -365,7 +364,7 @@ void SymbianAbldMakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool t << "\t-bldmake clean" << endl; t << endl; - // create execution target + // Create execution target if (debugPlatforms.contains("winscw") && getTargetExtension() == "exe") { t << "run:" << endl; t << "\t-call " << epocRoot() << "epoc32\\release\\winscw\\udeb\\" << removePathSeparators(escapeFilePath(fileFixify(project->first("TARGET"))).append(".exe")) << endl << endl; @@ -391,7 +390,7 @@ bool SymbianAbldMakefileGenerator::writeDeploymentTargets(QTextStream &t) t << "\t-echo Deploying changed files..." << endl; for (int i=0; i '%s'\n", qPrintable(item.absoluteFilePath()), qPrintable(destInfo.absoluteFilePath())); + fprintf(stderr, "Error: Could not copy '%s' -> '%s'\n", + qPrintable(item.absoluteFilePath()), + qPrintable(destInfo.absoluteFilePath())); } } flmExportDone = true; @@ -354,8 +356,6 @@ bool SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t t << endl; - // ### TODO: Linux emulator (platsim?) deployment - // Write post link rules if(!project->isEmpty("QMAKE_POST_LINK")) { t << "START EXTENSION qt/qmake_post_link" << endl; @@ -418,4 +418,3 @@ void SymbianSbsv2MakefileGenerator::writeBldInfMkFilePart(QTextStream& t, bool a Q_UNUSED(t); Q_UNUSED(addDeploymentExtension); } - diff --git a/qmake/generators/symbian/symmake_sbsv2.h b/qmake/generators/symbian/symmake_sbsv2.h index e55d177..caa491d 100644 --- a/qmake/generators/symbian/symmake_sbsv2.h +++ b/qmake/generators/symbian/symmake_sbsv2.h @@ -46,8 +46,8 @@ QT_BEGIN_NAMESPACE -class SymbianSbsv2MakefileGenerator : public SymbianMakefileGenerator { - +class SymbianSbsv2MakefileGenerator : public SymbianMakefileGenerator +{ protected: // Inherited from parent @@ -69,4 +69,3 @@ private: }; #endif // SYMMAKE_SBSV2_H - diff --git a/qmake/project.cpp b/qmake/project.cpp index 0a5e9a3..7c7044c 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -3339,26 +3339,24 @@ QStringList &QMakeProject::values(const QString &_var, QMap targetToUid; QString tmp = targetToUid[target]; if(!tmp.isEmpty()) { - // printf("generate_uid for %s is %s \n", qPrintable(target), qPrintable(tmp)); return tmp; } diff --git a/qmake/qmake.pri b/qmake/qmake.pri index 2304fab..f43d933 100644 --- a/qmake/qmake.pri +++ b/qmake/qmake.pri @@ -17,14 +17,14 @@ SOURCES += project.cpp property.cpp main.cpp generators/makefile.cpp \ generators/symbian/symmake.cpp \ generators/symbian/symmake_abld.cpp \ generators/symbian/symmake_sbsv2.cpp \ - generators/symbian/initprojectdeploy_symbian.cpp + generators/symbian/initprojectdeploy_symbian.cpp # MWC does not provide an implementation of popen() so fake it. win32-mwc { SOURCES += qpopen.cpp \ } - + HEADERS += project.h property.h generators/makefile.h \ generators/unix/unixmake.h meta.h option.h cachekeys.h \ generators/win32/winmakefile.h generators/projectgenerator.h \ diff --git a/qmake/qpopen.cpp b/qmake/qpopen.cpp index ebde035..7acff92 100644 --- a/qmake/qpopen.cpp +++ b/qmake/qpopen.cpp @@ -69,7 +69,6 @@ bool QPopen::init(const char *command, const char* /* mode */) // Ensure that the write handle to the child process's pipe for STDIN is not inherited. SetHandleInformation( childStdInW, HANDLE_FLAG_INHERIT, 0); - //TCHAR szCmdline[strlen(command)]=TEXT(command); TCHAR *szCmdLine = new TCHAR[strlen(command)+1]; strcpy(szCmdLine, command); @@ -126,7 +125,6 @@ int QPopen::fwrite(char* buffer, int maxBytes) return 0; } - int QPopen::fread(char* buffer, int maxBytes) { DWORD bytesRead; @@ -140,4 +138,3 @@ int QPopen::fread(char* buffer, int maxBytes) return 0; } - -- cgit v0.12 From e3b1daaadf9daff424c71ddcf642986f1bc1be8c Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Tue, 4 Aug 2009 12:20:05 +0300 Subject: Fixed some Qt coding style deviations for desktopservices demo --- demos/embedded/desktopservices/contenttab.cpp | 18 +++++++++--------- demos/embedded/desktopservices/linktab.cpp | 10 +++++----- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/demos/embedded/desktopservices/contenttab.cpp b/demos/embedded/desktopservices/contenttab.cpp index 619f5c0..e2618b0 100644 --- a/demos/embedded/desktopservices/contenttab.cpp +++ b/demos/embedded/desktopservices/contenttab.cpp @@ -55,7 +55,7 @@ // CONSTRUCTORS & DESTRUCTORS ContentTab::ContentTab(QWidget *parent) : - QListWidget(parent) + QListWidget(parent) { setDragEnabled(false); setIconSize(QSize(45, 45)); @@ -113,19 +113,19 @@ QUrl ContentTab::itemUrl(QListWidgetItem *item) void ContentTab::keyPressEvent(QKeyEvent *event) { - switch(event->key()) { + switch (event->key()) { case Qt::Key_Up: - if(currentRow() == 0) { - setCurrentRow(count()-1); + if (currentRow() == 0) { + setCurrentRow(count() - 1); } else { - setCurrentRow(currentRow()-1); + setCurrentRow(currentRow() - 1); } break; case Qt::Key_Down: - if(currentRow() == (count()-1)) { + if (currentRow() == (count() - 1)) { setCurrentRow(0); } else { - setCurrentRow(currentRow()+1); + setCurrentRow(currentRow() + 1); } break; case Qt::Key_Select: @@ -139,14 +139,14 @@ void ContentTab::keyPressEvent(QKeyEvent *event) void ContentTab::handleErrorInOpen(QListWidgetItem *item) { Q_UNUSED(item); - QMessageBox::warning( this, tr("Operation Failed"), tr("Unkown error!"), QMessageBox::Close); + QMessageBox::warning(this, tr("Operation Failed"), tr("Unkown error!"), QMessageBox::Close); } // NEW SLOTS void ContentTab::openItem(QListWidgetItem *item) { bool ret = QDesktopServices::openUrl(itemUrl(item)); - if(!ret) + if (!ret) handleErrorInOpen(item); } diff --git a/demos/embedded/desktopservices/linktab.cpp b/demos/embedded/desktopservices/linktab.cpp index 32411fe..67dbccf 100644 --- a/demos/embedded/desktopservices/linktab.cpp +++ b/demos/embedded/desktopservices/linktab.cpp @@ -50,7 +50,7 @@ #include "linktab.h" LinkTab::LinkTab(QWidget *parent) : - ContentTab(parent) + ContentTab(parent) { } @@ -66,9 +66,9 @@ void LinkTab::populateListWidget() QUrl LinkTab::itemUrl(QListWidgetItem *item) { - if(m_WebItem == item) { + if (m_WebItem == item) { return QUrl(tr("http://www.qtsoftware.com")); - } else if(m_MailToItem == item) { + } else if (m_MailToItem == item) { return QUrl(tr("mailto:qts60-feedback@trolltech.com?subject=QtS60 feedback&body=Hello")); } else { // We should never endup here @@ -78,8 +78,8 @@ QUrl LinkTab::itemUrl(QListWidgetItem *item) } void LinkTab::handleErrorInOpen(QListWidgetItem *item) { - if(m_MailToItem == item) { - QMessageBox::warning( this, tr("Operation Failed"), tr("Please check that you have\ne-mail account defined."), QMessageBox::Close); + if (m_MailToItem == item) { + QMessageBox::warning(this, tr("Operation Failed"), tr("Please check that you have\ne-mail account defined."), QMessageBox::Close); } else { ContentTab::handleErrorInOpen(item); } -- cgit v0.12 From fbe7f34f46de3e0732489c0043f89cc5aa535ecb Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Tue, 4 Aug 2009 12:33:55 +0300 Subject: Trailing whitespace and tab/space fixes for src/corelib --- src/corelib/arch/symbian/qatomic_symbian.cpp | 7 +++---- src/corelib/global/qglobal.cpp | 12 ++++++------ src/corelib/global/qglobal.h | 4 ++-- src/corelib/io/qdir.cpp | 2 +- src/corelib/io/qtemporaryfile.cpp | 2 +- src/corelib/kernel/qeventdispatcher_symbian.cpp | 5 ++--- src/corelib/kernel/qsystemsemaphore_symbian.cpp | 4 ++-- src/corelib/kernel/qvariant.cpp | 18 +++++++++--------- src/corelib/plugin/qpluginloader.cpp | 4 ++-- src/corelib/thread/qthread.cpp | 2 +- src/corelib/thread/qthread_p.h | 2 +- src/corelib/thread/qthread_unix.cpp | 16 ++++++++-------- src/corelib/tools/qhash.h | 10 +++++----- src/corelib/tools/qmap.h | 6 +++--- 14 files changed, 46 insertions(+), 48 deletions(-) diff --git a/src/corelib/arch/symbian/qatomic_symbian.cpp b/src/corelib/arch/symbian/qatomic_symbian.cpp index 9bec0f5..a228696 100644 --- a/src/corelib/arch/symbian/qatomic_symbian.cpp +++ b/src/corelib/arch/symbian/qatomic_symbian.cpp @@ -62,9 +62,9 @@ struct SPrintExitInfo TInt processHandleCount=0; TInt threadHandleCount=0; RThread().HandleCount(processHandleCount,threadHandleCount); - RDebug::Print(_L("%S exiting with %d allocated cells, %d handles"), - &fullName, - cells - initCells, + RDebug::Print(_L("%S exiting with %d allocated cells, %d handles"), + &fullName, + cells - initCells, (processHandleCount + threadHandleCount) - (initProcessHandleCount + initThreadHandleCount)); } TInt initCells; @@ -107,4 +107,3 @@ __declspec(dllexport) __asm int QBasicAtomicInt::fetchAndStoreOrdered(int newVal QT_END_NAMESPACE #endif // Q_CC_RVCT - diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 818e555..21cbd12 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -1914,7 +1914,7 @@ QSysInfo::SymVersion QSysInfo::symbianVersion() \relates Users Q_CHECK_PTR on \a pointer, then returns \a pointer. - + This can be used as an inline version of Q_CHECK_PTR. */ @@ -2115,8 +2115,8 @@ QString qt_error_string(int errorCode) warnings, critical and fatal error messages. The Qt library (debug mode) contains hundreds of warning messages that are printed when internal errors (usually invalid function arguments) - occur. Qt built in release mode also contains such warnings unless - QT_NO_WARNING_OUTPUT and/or QT_NO_DEBUG_OUTPUT have been set during + occur. Qt built in release mode also contains such warnings unless + QT_NO_WARNING_OUTPUT and/or QT_NO_DEBUG_OUTPUT have been set during compilation. If you implement your own message handler, you get total control of these messages. @@ -2516,7 +2516,7 @@ Q_GLOBAL_STATIC(SeedStorage, randTLS) // Thread Local Storage for seed value */ void qsrand(uint seed) { -#if defined(Q_OS_UNIX) && !defined(QT_NO_THREAD) && !defined(Q_OS_SYMBIAN) +#if defined(Q_OS_UNIX) && !defined(QT_NO_THREAD) && !defined(Q_OS_SYMBIAN) SeedStorageType *pseed = randTLS()->localData(); if (!pseed) randTLS()->setLocalData(pseed = new SeedStorageType); @@ -3179,7 +3179,7 @@ bool QInternal::callFunction(InternalFunction func, void **args) Compares the floating point value \a p1 and \a p2 and returns \c true if they are considered equal, otherwise \c false. - Note that comparing values where either \a p1 or \a p2 is 0.0 will not work. + Note that comparing values where either \a p1 or \a p2 is 0.0 will not work. The solution to this is to compare against values greater than or equal to 1.0. \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 46 @@ -3416,7 +3416,7 @@ int qt_exception2SymbianError(const std::exception& aThrow) err = KErrUnderflow; qWarning("translation from std exception \"%s\" to %d", aThrow.what(), err); } - + return err; } #endif diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 257e3db..3493f13 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -915,9 +915,9 @@ QT_END_INCLUDE_NAMESPACE */ #ifndef QT_LINUXBASE /* the LSB defines TRUE and FALSE for us */ -/* Symbian OS defines TRUE = 1 and FALSE = 0, +/* Symbian OS defines TRUE = 1 and FALSE = 0, redefine to built-in booleans to make autotests work properly */ -#ifdef Q_OS_SYMBIAN +#ifdef Q_OS_SYMBIAN #undef TRUE #undef FALSE #endif diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index 9787566..836fa44 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -1824,7 +1824,7 @@ QChar QDir::separator() { #if defined (Q_FS_FAT) || defined(Q_WS_WIN) || defined(Q_OS_SYMBIAN) return QLatin1Char('\\'); -#elif defined(Q_OS_UNIX) +#elif defined(Q_OS_UNIX) return QLatin1Char('/'); #elif defined (Q_OS_MAC) return QLatin1Char(':'); diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index f7120e1..cd8d36d 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -517,7 +517,7 @@ QTemporaryFile::QTemporaryFile() #ifdef Q_OS_SYMBIAN //Just for verify that folder really exist on hardware fileEngine()->mkdir( QDir::tempPath(), true ); -#endif +#endif } /*! diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp index 3293d47..e876843 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian.cpp +++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp @@ -652,7 +652,7 @@ bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags fla QT_TRY { Q_D(QAbstractEventDispatcher); - + // It is safe if this counter overflows. The main importance is that each // iteration count is different from the last. m_iterationCount++; @@ -959,7 +959,7 @@ bool QEventDispatcherSymbian::unregisterTimers ( QObject * object ) { if (m_timerList.isEmpty()) return false; - + bool unregistered = false; for (QHash::iterator i = m_timerList.begin(); i != m_timerList.end(); ) { if ((*i)->receiver == object) { @@ -1002,4 +1002,3 @@ void CQtActiveScheduler::Error(TInt aError) const } QT_END_NAMESPACE - diff --git a/src/corelib/kernel/qsystemsemaphore_symbian.cpp b/src/corelib/kernel/qsystemsemaphore_symbian.cpp index 8179046..1516841 100644 --- a/src/corelib/kernel/qsystemsemaphore_symbian.cpp +++ b/src/corelib/kernel/qsystemsemaphore_symbian.cpp @@ -47,7 +47,7 @@ #include #include QT_BEGIN_NAMESPACE - + #ifndef QT_NO_SYSTEMSEMAPHORE QSystemSemaphorePrivate::QSystemSemaphorePrivate() : @@ -65,7 +65,7 @@ void QSystemSemaphorePrivate::setErrorString(const QString &function, int err) errorString = QCoreApplication::tr("%1: already exists", "QSystemSemaphore").arg(function); error = QSystemSemaphore::AlreadyExists; break; - case KErrNotFound: + case KErrNotFound: errorString = QCoreApplication::tr("%1: doesn't exists", "QSystemSemaphore").arg(function); error = QSystemSemaphore::NotFound; break; diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index 2b57d2f..dd3468d 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -156,7 +156,7 @@ static void construct(QVariant::Private *x, const void *copy) x->data.b = copy ? *static_cast(copy) : false; break; case QVariant::Double: -#if defined(Q_CC_RVCT) +#if defined(Q_CC_RVCT) // Using trinary operator with 64bit constants crashes when ran on Symbian device if (copy){ x->data.d = *static_cast(copy); @@ -165,13 +165,13 @@ static void construct(QVariant::Private *x, const void *copy) } #else x->data.d = copy ? *static_cast(copy) : 0.0; -#endif +#endif break; case QMetaType::Float: x->data.f = copy ? *static_cast(copy) : 0.0f; break; case QVariant::LongLong: -#if defined(Q_CC_RVCT) +#if defined(Q_CC_RVCT) // Using trinary operator with 64bit constants crashes when ran on Symbian device if (copy){ x->data.ll = *static_cast(copy); @@ -180,10 +180,10 @@ static void construct(QVariant::Private *x, const void *copy) } #else x->data.ll = copy ? *static_cast(copy) : Q_INT64_C(0); -#endif +#endif break; case QVariant::ULongLong: -#if defined(Q_CC_RVCT) +#if defined(Q_CC_RVCT) // Using trinary operator with 64bit constants crashes when ran on Symbian device if (copy){ x->data.ull = *static_cast(copy); @@ -192,7 +192,7 @@ static void construct(QVariant::Private *x, const void *copy) } #else x->data.ull = copy ? *static_cast(copy) : Q_UINT64_C(0); -#endif +#endif break; case QVariant::Invalid: case QVariant::UserType: @@ -618,7 +618,7 @@ static bool convert(const QVariant::Private *d, QVariant::Type t, void *result, ok = &dummy; switch (uint(t)) { - case QVariant::Url: + case QVariant::Url: switch (d->type) { case QVariant::String: *static_cast(result) = QUrl(*v_cast(d)); @@ -1214,8 +1214,8 @@ const QVariant::Handler *QVariant::handler = &qt_kernel_variant_handler; and versatile, but may prove less memory and speed efficient than storing specific types in standard data structures. - QVariant also supports the notion of null values, where you can - have a defined type with no value set. However, note that QVariant + QVariant also supports the notion of null values, where you can + have a defined type with no value set. However, note that QVariant types can only be cast when they have had a value set. \snippet doc/src/snippets/code/src_corelib_kernel_qvariant.cpp 1 diff --git a/src/corelib/plugin/qpluginloader.cpp b/src/corelib/plugin/qpluginloader.cpp index 5364190..d7692b0 100644 --- a/src/corelib/plugin/qpluginloader.cpp +++ b/src/corelib/plugin/qpluginloader.cpp @@ -311,7 +311,7 @@ void QPluginLoader::setFileName(const QString &fileName) QFileInfoList driveList(QDir::drives()); foreach(const QFileInfo& drive, driveList) { QString testFilePath(drive.absolutePath() + stubPath); - testFilePath = QDir::cleanPath(testFilePath); + testFilePath = QDir::cleanPath(testFilePath); if (QFile::exists(testFilePath)) { fn = testFilePath; break; @@ -319,7 +319,7 @@ void QPluginLoader::setFileName(const QString &fileName) } } } - + #else QString fn = QFileInfo(fileName).canonicalFilePath(); #endif diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp index fac50ee..a4a57ce 100644 --- a/src/corelib/thread/qthread.cpp +++ b/src/corelib/thread/qthread.cpp @@ -183,7 +183,7 @@ QThreadPrivate::QThreadPrivate(QThreadData *d) id = 0; waiters = 0; #endif -#if defined (Q_WS_WIN) || defined (Q_OS_SYMBIAN) +#if defined (Q_WS_WIN) || defined (Q_OS_SYMBIAN) terminationEnabled = true; terminatePending = false; #endif diff --git a/src/corelib/thread/qthread_p.h b/src/corelib/thread/qthread_p.h index 51de0be..752796b 100644 --- a/src/corelib/thread/qthread_p.h +++ b/src/corelib/thread/qthread_p.h @@ -152,7 +152,7 @@ public: static void finish(void *, bool lockAnyway=true); #endif // Q_OS_WIN32 -#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) || defined (Q_OS_SYMBIAN) +#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) || defined (Q_OS_SYMBIAN) bool terminationEnabled, terminatePending; # endif QThreadData *data; diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp index 881b889..cabf823 100644 --- a/src/corelib/thread/qthread_unix.cpp +++ b/src/corelib/thread/qthread_unix.cpp @@ -178,7 +178,7 @@ void QThreadPrivate::createEventDispatcher(QThreadData *data) else #endif #ifdef Q_OS_SYMBIAN - data->eventDispatcher = new QEventDispatcherSymbian; + data->eventDispatcher = new QEventDispatcherSymbian; #else data->eventDispatcher = new QEventDispatcherUNIX; #endif @@ -193,7 +193,7 @@ void *QThreadPrivate::start(void *arg) pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL); pthread_cleanup_push(QThreadPrivate::finish, arg); #endif - + QThread *thr = reinterpret_cast(arg); QThreadData *data = QThreadData::get2(thr); @@ -226,7 +226,7 @@ void *QThreadPrivate::start(void *arg) #ifndef Q_OS_SYMBIAN pthread_cleanup_pop(1); #else - QThreadPrivate::finish(arg); + QThreadPrivate::finish(arg); #endif return 0; @@ -266,7 +266,7 @@ void QThreadPrivate::finish(void *arg) d->thread_id = 0; #ifdef Q_OS_SYMBIAN if (closeNativeHandle) - d->data->symbian_thread_handle.Close(); + d->data->symbian_thread_handle.Close(); #endif d->thread_done.wakeAll(); #ifdef Q_OS_SYMBIAN @@ -325,7 +325,7 @@ int QThread::idealThreadCount() #elif defined(Q_OS_INTEGRITY) // ### TODO - how to get the amound of CPUs on INTEGRITY? #elif defined(Q_OS_SYMBIAN) - // ### TODO - Get the number of cores from HAL? when multicore architectures (SMP) are supported + // ### TODO - Get the number of cores from HAL? when multicore architectures (SMP) are supported cores = 1; #else // the rest: Linux, Solaris, AIX, Tru64 @@ -545,10 +545,10 @@ void QThread::terminate() d->terminatePending = true; return; } - + d->terminated = true; QThreadPrivate::finish(this, false, false); - d->data->symbian_thread_handle.Terminate(KErrNone); + d->data->symbian_thread_handle.Terminate(KErrNone); d->data->symbian_thread_handle.Close(); #endif @@ -592,7 +592,7 @@ void QThread::setTerminationEnabled(bool enabled) d->terminated = true; QThreadPrivate::finish(thr, false); locker.unlock(); // don't leave the mutex locked! - pthread_exit(NULL); + pthread_exit(NULL); } #endif } diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h index fc6a1e3a..a57fec7 100644 --- a/src/corelib/tools/qhash.h +++ b/src/corelib/tools/qhash.h @@ -150,10 +150,10 @@ struct Q_CORE_EXPORT QHashData }; inline void QHashData::mightGrow() // ### Qt 5: eliminate -{ +{ if (size >= numBuckets) rehash(numBits + 1); -} +} inline bool QHashData::willGrow() { @@ -992,12 +992,12 @@ Q_INLINE_TEMPLATE int QMultiHash::remove(const Key &key, const T &value) typename QHash::iterator end(QHash::end()); while (i != end && i.key() == key) { if (i.value() == value) { -#if defined(Q_CC_RVCT) - // RVCT has problems with scoping, apparently. +#if defined(Q_CC_RVCT) + // RVCT has problems with scoping, apparently. i = QHash::erase(i); #else i = erase(i); -#endif +#endif ++n; } else { ++i; diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h index be80e75..70a2896 100644 --- a/src/corelib/tools/qmap.h +++ b/src/corelib/tools/qmap.h @@ -1019,12 +1019,12 @@ Q_INLINE_TEMPLATE int QMultiMap::remove(const Key &key, const T &value) typename QMap::iterator end(QMap::end()); while (i != end && !qMapLessThanKey(key, i.key())) { if (i.value() == value) { -#if defined(Q_CC_RVCT) - // RVCT has problems with scoping, apparently. +#if defined(Q_CC_RVCT) + // RVCT has problems with scoping, apparently. i = QMap::erase(i); #else i = erase(i); -#endif +#endif ++n; } else { ++i; -- cgit v0.12 From 7ff5fd86376714aa4de5dae7e8ef7576d69b5feb Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Tue, 4 Aug 2009 12:47:00 +0300 Subject: Applied Qt coding conventions for s60main --- src/s60main/qts60main.cpp | 12 +++++------ src/s60main/qts60main_mcrt0.cpp | 28 ++++++++++++------------ src/s60main/qts60mainapplication.cpp | 16 +++++++------- src/s60main/qts60mainappui.cpp | 37 ++++++++++++++++--------------- src/s60main/qts60maindocument.cpp | 42 ++++++++++++++++++------------------ 5 files changed, 67 insertions(+), 68 deletions(-) diff --git a/src/s60main/qts60main.cpp b/src/s60main/qts60main.cpp index d7daf4a..c228c0d 100644 --- a/src/s60main/qts60main.cpp +++ b/src/s60main/qts60main.cpp @@ -48,16 +48,16 @@ * factory function to create the QtS60Main application class */ LOCAL_C CApaApplication* NewApplication() - { - return new CQtS60MainApplication; - } +{ + return new CQtS60MainApplication; +} /** * A normal Symbian OS executable provides an E32Main() function which is * called by the operating system to start the program. */ GLDEF_C TInt E32Main() - { - return EikStart::RunApplication( NewApplication ); - } +{ + return EikStart::RunApplication(NewApplication); +} diff --git a/src/s60main/qts60main_mcrt0.cpp b/src/s60main/qts60main_mcrt0.cpp index 8631989..f591c89 100644 --- a/src/s60main/qts60main_mcrt0.cpp +++ b/src/s60main/qts60main_mcrt0.cpp @@ -51,13 +51,13 @@ #ifdef __ARMCC__ __asm int CallMain(int argc, char *argv[], char *envp[]) { - import main - code32 - b main + import main + code32 + b main } #define CALLMAIN(argc, argv, envp) CallMain(argc, argv, envp) #else -extern "C" int main (int argc, char *argv[], char *envp[]); +extern "C" int main(int argc, char *argv[], char *envp[]); #define CALLMAIN(argc, argv, envp) main(argc, argv, envp) #endif @@ -67,21 +67,21 @@ extern "C" GLDEF_C int __GccGlueInit() return 0; } -extern "C" IMPORT_C void exit (int ret); +extern "C" IMPORT_C void exit(int ret); GLDEF_C TInt QtMainWrapper() { - int argc=0; - char **argv=0; - char **envp=0; + int argc = 0; + char **argv = 0; + char **envp = 0; // get args & environment - __crt0(argc,argv,envp); + __crt0(argc, argv, envp); CleanupArrayDelete::PushL(argv); CleanupArrayDelete::PushL(envp); //Call user(application)'s main - int ret = 0; - QT_TRYCATCH_LEAVING( ret = CALLMAIN(argc, argv, envp); ); - CleanupStack::PopAndDestroy(2,argv); + int ret = 0; + QT_TRYCATCH_LEAVING(ret = CALLMAIN(argc, argv, envp);); + CleanupStack::PopAndDestroy(2, argv); return ret; } @@ -89,10 +89,10 @@ GLDEF_C TInt QtMainWrapper() #ifdef __GCC32__ /* stub function inserted into main() by GCC */ -extern "C" void __gccmain (void) {} +extern "C" void __gccmain(void) {} /* Default GCC entrypoint */ -extern "C" TInt _mainCRTStartup (void) +extern "C" TInt _mainCRTStartup(void) { extern TInt _E32Startup(); return _E32Startup(); diff --git a/src/s60main/qts60mainapplication.cpp b/src/s60main/qts60mainapplication.cpp index 2fada3d..ed7ae22 100644 --- a/src/s60main/qts60mainapplication.cpp +++ b/src/s60main/qts60mainapplication.cpp @@ -49,7 +49,7 @@ // ============================ MEMBER FUNCTIONS =============================== -_LIT( KQtWrapperResourceFile,"\\resource\\apps\\s60main.rsc" ); +_LIT(KQtWrapperResourceFile, "\\resource\\apps\\s60main.rsc"); // ----------------------------------------------------------------------------- // CQtS60MainApplication::CreateDocumentL() @@ -57,10 +57,10 @@ _LIT( KQtWrapperResourceFile,"\\resource\\apps\\s60main.rsc" ); // ----------------------------------------------------------------------------- // CApaDocument* CQtS60MainApplication::CreateDocumentL() - { +{ // Create an QtS60Main document, and return a pointer to it - return (static_cast( CQtS60MainDocument::NewL( *this ) ) ); - } + return (static_cast(CQtS60MainDocument::NewL(*this))); +} // ----------------------------------------------------------------------------- // CQtS60MainApplication::AppDllUid() @@ -68,10 +68,10 @@ CApaDocument* CQtS60MainApplication::CreateDocumentL() // ----------------------------------------------------------------------------- // TUid CQtS60MainApplication::AppDllUid() const - { +{ // Return the UID for the QtS60Main application return ProcessUid(); - } +} // ----------------------------------------------------------------------------- // CQtS60MainApplication::ResourceFileName() @@ -79,13 +79,13 @@ TUid CQtS60MainApplication::AppDllUid() const // ----------------------------------------------------------------------------- // TFileName CQtS60MainApplication::ResourceFileName() const - { +{ TFindFile finder(iCoeEnv->FsSession()); TInt err = finder.FindByDir(KQtWrapperResourceFile, KNullDesC); if (err == KErrNone) return finder.File(); return KNullDesC(); - } +} // End of File diff --git a/src/s60main/qts60mainappui.cpp b/src/s60main/qts60mainappui.cpp index ef54417..ea6c3d4 100644 --- a/src/s60main/qts60mainappui.cpp +++ b/src/s60main/qts60mainappui.cpp @@ -67,7 +67,7 @@ void CQtS60MainAppUi::ConstructL() // objects can still exist in static data at that point. Instead we will print relevant information // so that comparative checks may be made for memory leaks, using ~SPrintExitInfo in corelib. iEikonEnv->DisableExitChecks(ETrue); - + // Initialise app UI with standard value. // ENoAppResourceFile and ENonStandardResourceFile makes UI to work without // resource files in most SDKs. S60 3rd FP1 public seems to require resource file @@ -76,11 +76,11 @@ void CQtS60MainAppUi::ConstructL() CEikButtonGroupContainer* nativeContainer = Cba(); nativeContainer->SetCommandSetL(R_AVKON_SOFTKEYS_EMPTY_WITH_IDS); - + // Create async callback to call Qt main, // this is required to give S60 app FW to finish starting correctly - TCallBack callBack( OpenCMainStaticCallBack, this ); - iAsyncCallBack = new(ELeave) CAsyncCallBack( callBack, CActive::EPriorityIdle ); + TCallBack callBack(OpenCMainStaticCallBack, this); + iAsyncCallBack = new(ELeave) CAsyncCallBack(callBack, CActive::EPriorityIdle); iAsyncCallBack->Call(); } @@ -109,7 +109,7 @@ CQtS60MainAppUi::~CQtS60MainAppUi() // Takes care of command handling. // ----------------------------------------------------------------------------- // -void CQtS60MainAppUi::HandleCommandL( TInt aCommand ) +void CQtS60MainAppUi::HandleCommandL(TInt aCommand) { if (qApp) qApp->symbianHandleCommand(aCommand); @@ -123,7 +123,7 @@ void CQtS60MainAppUi::HandleCommandL( TInt aCommand ) void CQtS60MainAppUi::HandleResourceChangeL(TInt aType) { CAknAppUi::HandleResourceChangeL(aType); - + if (qApp) qApp->symbianResourceChange(aType); } @@ -157,9 +157,9 @@ void CQtS60MainAppUi::HandleStatusPaneSizeChange() // Called asynchronously from ConstructL() - passes call to nan static method // ----------------------------------------------------------------------------- // -TInt CQtS60MainAppUi::OpenCMainStaticCallBack( TAny* aObject ) +TInt CQtS60MainAppUi::OpenCMainStaticCallBack(TAny* aObject) { - CQtS60MainAppUi* myObj = static_cast( aObject ); + CQtS60MainAppUi* myObj = static_cast(aObject); myObj->OpenCMainCallBack(); return 0; } @@ -186,30 +186,29 @@ void CQtS60MainAppUi::DynInitMenuBarL(TInt, CEikMenuBar *) void CQtS60MainAppUi::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane *aMenuPane) { - if (aResourceId == R_QT_WRAPPERAPP_MENU){ + if (aResourceId == R_QT_WRAPPERAPP_MENU) { if (aMenuPane->NumberOfItemsInPane() <= 1) qt_symbian_show_toplevel(aMenuPane); - - } - else if( aResourceId != R_AVKON_MENUPANE_FEP_DEFAULT && aResourceId != R_AVKON_MENUPANE_EDITTEXT_DEFAULT && aResourceId != R_AVKON_MENUPANE_LANGUAGE_DEFAULT ){ + + } else if (aResourceId != R_AVKON_MENUPANE_FEP_DEFAULT && aResourceId != R_AVKON_MENUPANE_EDITTEXT_DEFAULT && aResourceId != R_AVKON_MENUPANE_LANGUAGE_DEFAULT) { qt_symbian_show_submenu(aMenuPane, aResourceId); } } -void CQtS60MainAppUi::RestoreMenuL(CCoeControl* aMenuWindow,TInt aMenuId,TMenuType aMenuType) +void CQtS60MainAppUi::RestoreMenuL(CCoeControl* aMenuWindow, TInt aMenuId, TMenuType aMenuType) { - if ((aMenuId==R_QT_WRAPPERAPP_MENUBAR) || (aMenuId == R_AVKON_MENUPANE_FEP_DEFAULT)) { + if ((aMenuId == R_QT_WRAPPERAPP_MENUBAR) || (aMenuId == R_AVKON_MENUPANE_FEP_DEFAULT)) { TResourceReader reader; - iCoeEnv->CreateResourceReaderLC(reader,aMenuId); + iCoeEnv->CreateResourceReaderLC(reader, aMenuId); aMenuWindow->ConstructFromResourceL(reader); CleanupStack::PopAndDestroy(); } - if (aMenuType==EMenuPane) - DynInitMenuPaneL(aMenuId,(CEikMenuPane*)aMenuWindow); + if (aMenuType == EMenuPane) + DynInitMenuPaneL(aMenuId, (CEikMenuPane*)aMenuWindow); else - DynInitMenuBarL(aMenuId,(CEikMenuBar*)aMenuWindow); - } + DynInitMenuBarL(aMenuId, (CEikMenuBar*)aMenuWindow); +} // End of File diff --git a/src/s60main/qts60maindocument.cpp b/src/s60main/qts60maindocument.cpp index eb7ea42..cdbb01d 100644 --- a/src/s60main/qts60maindocument.cpp +++ b/src/s60main/qts60maindocument.cpp @@ -51,25 +51,25 @@ // Two-phased constructor. // ----------------------------------------------------------------------------- // -CQtS60MainDocument* CQtS60MainDocument::NewL( CEikApplication& aApp ) - { - CQtS60MainDocument* self = NewLC( aApp ); - CleanupStack::Pop( self ); +CQtS60MainDocument* CQtS60MainDocument::NewL(CEikApplication& aApp) +{ + CQtS60MainDocument* self = NewLC(aApp); + CleanupStack::Pop(self); return self; - } +} // ----------------------------------------------------------------------------- // CQtS60MainDocument::NewLC() // Two-phased constructor. // ----------------------------------------------------------------------------- // -CQtS60MainDocument* CQtS60MainDocument::NewLC( CEikApplication& aApp ) - { - CQtS60MainDocument* self = new ( ELeave ) CQtS60MainDocument( aApp ); - CleanupStack::PushL( self ); +CQtS60MainDocument* CQtS60MainDocument::NewLC(CEikApplication& aApp) +{ + CQtS60MainDocument* self = new(ELeave) CQtS60MainDocument(aApp); + CleanupStack::PushL(self); self->ConstructL(); return self; - } +} // ----------------------------------------------------------------------------- // CQtS60MainDocument::ConstructL() @@ -77,20 +77,20 @@ CQtS60MainDocument* CQtS60MainDocument::NewLC( CEikApplication& aApp ) // ----------------------------------------------------------------------------- // void CQtS60MainDocument::ConstructL() - { +{ // No implementation required - } +} // ----------------------------------------------------------------------------- // CQtS60MainDocument::CQtS60MainDocument() // C++ default constructor can NOT contain any code, that might leave. // ----------------------------------------------------------------------------- // -CQtS60MainDocument::CQtS60MainDocument( CEikApplication& aApp ) - : CAknDocument( aApp ) - { +CQtS60MainDocument::CQtS60MainDocument(CEikApplication& aApp) + : CAknDocument(aApp) +{ // No implementation required - } +} // --------------------------------------------------------------------------- // CQtS60MainDocument::~CQtS60MainDocument() @@ -98,9 +98,9 @@ CQtS60MainDocument::CQtS60MainDocument( CEikApplication& aApp ) // --------------------------------------------------------------------------- // CQtS60MainDocument::~CQtS60MainDocument() - { +{ // No implementation required - } +} // --------------------------------------------------------------------------- // CQtS60MainDocument::CreateAppUiL() @@ -108,11 +108,11 @@ CQtS60MainDocument::~CQtS60MainDocument() // --------------------------------------------------------------------------- // CEikAppUi* CQtS60MainDocument::CreateAppUiL() - { +{ // Create the application user interface, and return a pointer to it; // the framework takes ownership of this object - return ( static_cast ( new ( ELeave )CQtS60MainAppUi ) ); - } + return (static_cast (new(ELeave)CQtS60MainAppUi)); +} // End of File -- cgit v0.12 From cbc8be3013cfbe1f192d69c228701cd253e5aabd Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Tue, 4 Aug 2009 12:58:36 +0300 Subject: Trailing whitespace and tab/space fixes for src/plugins --- src/plugins/qpluginbase.pri | 2 +- src/plugins/s60/5_0/5_0.pro | 2 +- src/plugins/s60/bwins/qts60pluginu.def | 1 - src/plugins/s60/eabi/qts60pluginu.def | 1 - src/plugins/s60/s60pluginbase.pri | 2 +- src/plugins/s60/src/qdesktopservices_3_1.cpp | 1 - src/plugins/s60/src/qdesktopservices_3_2.cpp | 1 - src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pro | 1 - 8 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/plugins/qpluginbase.pri b/src/plugins/qpluginbase.pri index b14f839..10563c1 100644 --- a/src/plugins/qpluginbase.pri +++ b/src/plugins/qpluginbase.pri @@ -16,6 +16,6 @@ wince*:LIBS += $$QMAKE_LIBS_GUI symbian: { TARGET.EPOCALLOWDLLDATA=1 - TARGET.CAPABILITY = All -Tcb + TARGET.CAPABILITY = All -Tcb load(armcc_warnings) } diff --git a/src/plugins/s60/5_0/5_0.pro b/src/plugins/s60/5_0/5_0.pro index 878a466..d7c3cb2 100644 --- a/src/plugins/s60/5_0/5_0.pro +++ b/src/plugins/s60/5_0/5_0.pro @@ -8,7 +8,7 @@ contains(S60_VERSION, 3.1) { } else { SOURCES += ../src/qlocale_3_2.cpp \ ../src/qdesktopservices_3_2.cpp - LIBS += -ldirectorylocalizer + LIBS += -ldirectorylocalizer INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE } diff --git a/src/plugins/s60/bwins/qts60pluginu.def b/src/plugins/s60/bwins/qts60pluginu.def index 549f71f..a082262 100644 --- a/src/plugins/s60/bwins/qts60pluginu.def +++ b/src/plugins/s60/bwins/qts60pluginu.def @@ -4,4 +4,3 @@ EXPORTS ?defaultGetLongDateFormatSpec@@YA?AVTPtrC16@@AAVTExtendedLocale@@@Z @ 3 NONAME ; class TPtrC16 defaultGetLongDateFormatSpec(class TExtendedLocale &) ?defaultGetShortDateFormatSpec@@YA?AVTPtrC16@@AAVTExtendedLocale@@@Z @ 4 NONAME ; class TPtrC16 defaultGetShortDateFormatSpec(class TExtendedLocale &) ?localizedDirectoryName@@YA?AVQString@@AAV1@@Z @ 5 NONAME ; class QString localizedDirectoryName(class QString &) - diff --git a/src/plugins/s60/eabi/qts60pluginu.def b/src/plugins/s60/eabi/qts60pluginu.def index a433a5d..d768436 100644 --- a/src/plugins/s60/eabi/qts60pluginu.def +++ b/src/plugins/s60/eabi/qts60pluginu.def @@ -4,4 +4,3 @@ EXPORTS _Z28defaultGetLongDateFormatSpecR15TExtendedLocale @ 3 NONAME _Z29defaultGetShortDateFormatSpecR15TExtendedLocale @ 4 NONAME _Z22localizedDirectoryNameR7QString @ 5 NONAME - diff --git a/src/plugins/s60/s60pluginbase.pri b/src/plugins/s60/s60pluginbase.pri index 62100f9..0e11c7e 100644 --- a/src/plugins/s60/s60pluginbase.pri +++ b/src/plugins/s60/s60pluginbase.pri @@ -1,4 +1,4 @@ -# Note: These version based 'plugins' are not an actual Qt plugins, +# Note: These version based 'plugins' are not an actual Qt plugins, # they are just regular runtime loaded libraries include(../../qpluginbase.pri) diff --git a/src/plugins/s60/src/qdesktopservices_3_1.cpp b/src/plugins/s60/src/qdesktopservices_3_1.cpp index 0551a74..0f8e6a6 100644 --- a/src/plugins/s60/src/qdesktopservices_3_1.cpp +++ b/src/plugins/s60/src/qdesktopservices_3_1.cpp @@ -47,4 +47,3 @@ EXPORT_C QString localizedDirectoryName(QString&) qWarning("QDesktopServices::displayName() not implemented for this platform version"); return QString(); } - diff --git a/src/plugins/s60/src/qdesktopservices_3_2.cpp b/src/plugins/s60/src/qdesktopservices_3_2.cpp index f08799b..3708436 100644 --- a/src/plugins/s60/src/qdesktopservices_3_2.cpp +++ b/src/plugins/s60/src/qdesktopservices_3_2.cpp @@ -77,4 +77,3 @@ EXPORT_C QString localizedDirectoryName(QString& /* rawPath */) return QString(); } #endif - diff --git a/src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pro b/src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pro index 0574341..4734144 100644 --- a/src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pro +++ b/src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pro @@ -3,4 +3,3 @@ TEMPLATE = subdirs # We just want to extract the zip file containing sqlite binaries for Symbian BLD_INF_RULES.prj_exports += ":zip SQLite3_v9.2.zip" - -- cgit v0.12 From fb6a79b85dd80c43308308f720a26f23e0997a31 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Tue, 4 Aug 2009 13:08:12 +0300 Subject: Trailing whitespace and tab/space fixes for src/gui --- src/gui/image/qpixmap.cpp | 1 - src/gui/kernel/kernel.pri | 12 +- src/gui/kernel/qaction.cpp | 2 +- src/gui/kernel/qapplication_s60.cpp | 32 +++-- src/gui/kernel/qclipboard_s60.cpp | 14 +-- src/gui/kernel/qdnd_s60.cpp | 12 +- src/gui/kernel/qsound_s60.cpp | 40 +++--- src/gui/kernel/qt_s60_p.h | 6 +- src/gui/kernel/qwidget.cpp | 24 ++-- src/gui/kernel/qwidget_s60.cpp | 56 ++++----- src/gui/painting/painting.pri | 4 +- src/gui/painting/qblendfunctions_armv6_rvct.s | 93 +++++++------- src/gui/painting/qcolormap_s60.cpp | 1 - src/gui/painting/qdrawhelper_armv6_rvct.inc | 170 +++++++++++++------------- src/gui/painting/qdrawhelper_armv6_rvct.s | 55 ++++----- src/gui/painting/qwindowsurface_s60_p.h | 2 +- src/gui/styles/qs60style.cpp | 6 +- src/gui/styles/qs60style_p.h | 2 +- src/gui/styles/qs60style_s60.cpp | 4 +- src/gui/text/qfontdatabase_s60.cpp | 4 +- src/gui/util/qdesktopservices.cpp | 4 +- src/gui/util/qdesktopservices_s60.cpp | 94 +++++++------- src/gui/widgets/qmenu_symbian.cpp | 10 +- 23 files changed, 321 insertions(+), 327 deletions(-) diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index c9478cb..a6c2883 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -1915,7 +1915,6 @@ int QPixmap::defaultDepth() #elif defined(Q_OS_SYMBIAN) return S60->screenDepth; #endif - } typedef void (*_qt_pixmap_cleanup_hook_64)(qint64); diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index a8d09b0..8b46dc6 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -114,7 +114,7 @@ symbian { kernel/qclipboard_s60.cpp\ kernel/qdnd_s60.cpp \ kernel/qsound_s60.cpp - + HEADERS += \ kernel/qt_s60_p.h \ kernel/qeventdispatcher_s60_p.h @@ -198,7 +198,7 @@ embedded { qcocoaview_mac_p.h \ qcocoaapplication_mac_p.h \ qcocoaapplicationdelegate_mac_p.h \ - qmultitouch_mac_p.h + qmultitouch_mac_p.h OBJECTIVE_SOURCES += \ kernel/qcursor_mac.mm \ @@ -216,7 +216,7 @@ embedded { kernel/qt_cocoa_helpers_mac.mm \ kernel/qdesktopwidget_mac.mm \ kernel/qeventdispatcher_mac.mm \ - kernel/qcocoawindowcustomthemeframe_mac.mm \ + kernel/qcocoawindowcustomthemeframe_mac.mm \ kernel/qmultitouch_mac.mm \ HEADERS += \ @@ -225,10 +225,10 @@ embedded { kernel/qcocoaapplicationdelegate_mac_p.h \ kernel/qeventdispatcher_mac_p.h - MENU_NIB.files = mac/qt_menu.nib - MENU_NIB.path = Resources + MENU_NIB.files = mac/qt_menu.nib + MENU_NIB.path = Resources MENU_NIB.version = Versions - QMAKE_BUNDLE_DATA += MENU_NIB + QMAKE_BUNDLE_DATA += MENU_NIB RESOURCES += mac/macresources.qrc LIBS += -framework AppKit diff --git a/src/gui/kernel/qaction.cpp b/src/gui/kernel/qaction.cpp index fe40ea8..07c40c7 100644 --- a/src/gui/kernel/qaction.cpp +++ b/src/gui/kernel/qaction.cpp @@ -1368,7 +1368,7 @@ QAction::MenuRole QAction::menuRole() const This indicates what softkey action this action is. Usually used on mobile platforms to map QActions to hardware keys. - + The softkey role can be changed any time. */ void QAction::setSoftKeyRole(SoftKeyRole softKeyRole) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 7836238..c831dad 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -124,7 +124,7 @@ private: QS60Beep::~QS60Beep() { - delete iToneUtil; + delete iToneUtil; } QS60Beep* QS60Beep::NewL(TInt aFrequency, TTimeIntervalMicroSeconds aDuration) @@ -153,7 +153,7 @@ void QS60Beep::Play() iState=EBeepPrepared; } } - + iToneUtil->Play(); iState=EBeepPlaying; } @@ -295,7 +295,7 @@ void QLongTapTimer::PointerEventL(const TPointerEvent& event) Cancel(); m_event = event; if (event.iType == TPointerEvent::EButton1Down) - { + { m_pressedCoordinates = QPoint(event.iPosition.iX,event.iPosition.iY); // must be same as KLongTapDelay in aknlongtapdetector.h After(800000); @@ -366,7 +366,7 @@ void QSymbianControl::HandlePointerEventL(const TPointerEvent& pEvent) } if (type == QMouseEvent::None) return; - + // store events for later sending/saving QWidget *alienWidget; typedef QPair Event; @@ -375,7 +375,7 @@ void QSymbianControl::HandlePointerEventL(const TPointerEvent& pEvent) QPoint widgetPos = QPoint(pEvent.iPosition.iX, pEvent.iPosition.iY); TPoint controlScreenPos = PositionRelativeToScreen(); QPoint globalPos = QPoint(controlScreenPos.iX, controlScreenPos.iY) + widgetPos; - + if (type == QEvent::MouseButtonPress || type == QEvent::MouseButtonDblClick) { // get the button press target @@ -406,7 +406,7 @@ void QSymbianControl::HandlePointerEventL(const TPointerEvent& pEvent) events.append(Event(S60->lastPointerEventTarget,mEventLeave)); } QMouseEvent mEventEnter(QEvent::Enter, alienWidget->mapFromGlobal(globalPos), globalPos, - button, QApplicationPrivate::mouse_buttons, mapToQtModifiers(pEvent.iModifiers)); + button, QApplicationPrivate::mouse_buttons, mapToQtModifiers(pEvent.iModifiers)); events.append(Event(alienWidget,mEventEnter)); } @@ -672,14 +672,14 @@ void QSymbianControl::HandleResourceChange(int resourceType) { switch (resourceType) { case KInternalStatusPaneChange: - qwidget->d_func()->setWindowIcon_sys(true); - break; + qwidget->d_func()->setWindowIcon_sys(true); + break; case KUidValueCoeFontChangeEvent: // font change event break; #ifdef Q_WS_S60 case KEikDynamicLayoutVariantSwitch: - { + { if (qwidget->isFullScreen()) { SetExtentToWholeScreen(); } else if (qwidget->isMaximized()) { @@ -944,10 +944,10 @@ void QApplication::beep() QS60Beep* beep=NULL; TRAPD(err, beep=QS60Beep::NewL(frequency, duration)); if(!err) { - beep->Play(); + beep->Play(); } delete beep; - beep=NULL; + beep=NULL; } int QApplication::s60ProcessEvent(TWsEvent *event) @@ -1081,8 +1081,8 @@ void QApplication::symbianResourceChange(int type) case KEikDynamicLayoutVariantSwitch: { if (S60) - S60->updateScreenSize(); - + S60->updateScreenSize(); + #ifndef QT_NO_STYLE_S60 QS60Style *s60Style = 0; @@ -1096,7 +1096,7 @@ void QApplication::symbianResourceChange(int type) if (s60Style) s60Style->handleDynamicLayoutVariantSwitch(); -#endif +#endif } break; @@ -1104,7 +1104,7 @@ void QApplication::symbianResourceChange(int type) case KAknsMessageSkinChange: if (QS60Style *s60Style = qobject_cast(QApplication::style())) s60Style->handleSkinChange(); - break; + break; #endif #endif // Q_WS_S60 default: @@ -1175,5 +1175,3 @@ void QSessionManager::cancel() } #endif //QT_NO_SESSIONMANAGER QT_END_NAMESPACE - - diff --git a/src/gui/kernel/qclipboard_s60.cpp b/src/gui/kernel/qclipboard_s60.cpp index 27b4fdb..5536438 100644 --- a/src/gui/kernel/qclipboard_s60.cpp +++ b/src/gui/kernel/qclipboard_s60.cpp @@ -76,10 +76,10 @@ public: QMimeData* source() { return src; } bool connected() - { return connection; } + { return connection; } void clear(); RFs fsSession(); - + private: QMimeData* src; @@ -134,7 +134,7 @@ static QClipboardData *clipboardData() delete internalCbData; internalCbData = 0; } - else + else { qAddPostRoutine(cleanupClipboardData); } @@ -161,7 +161,7 @@ void writeToStreamLX(const QMimeData* aData, RWriteStream& aStream) aStream << TCardinality(ba.size()); aStream.WriteL(reinterpret_cast(ba.constData()),ba.size()); CleanupStack::PopAndDestroy(stringData); - } + } } void readFromStreamLX(QMimeData* aData,RReadStream& aStream) @@ -169,7 +169,7 @@ void readFromStreamLX(QMimeData* aData,RReadStream& aStream) // This function both leaves and throws exceptions. There must be no destructor // dependencies between cleanup styles, and no cleanup stack dependencies on stacked objects. TCardinality mimeTypeCount; - aStream >> mimeTypeCount; + aStream >> mimeTypeCount; for (int i = 0; i< mimeTypeCount;i++) { // mime type @@ -220,7 +220,7 @@ const QMimeData* QClipboard::mimeData(Mode mode) const if (err != KErrNone){ qDebug()<< "clipboard is empty/err: " << err; } - + } return 0; } @@ -249,7 +249,7 @@ void QClipboard::setMimeData(QMimeData* src, Mode mode) qDebug()<< "clipboard write err :" << err; } } - emitChanged(QClipboard::Clipboard); + emitChanged(QClipboard::Clipboard); } bool QClipboard::supportsMode(Mode mode) const diff --git a/src/gui/kernel/qdnd_s60.cpp b/src/gui/kernel/qdnd_s60.cpp index 07b196e..c7656b0 100644 --- a/src/gui/kernel/qdnd_s60.cpp +++ b/src/gui/kernel/qdnd_s60.cpp @@ -94,8 +94,8 @@ class QShapedPixmapWidget public: QShapedPixmapWidget(RWsSession aWsSession,RWindowTreeNode* aNode) { - sprite = RWsSprite(aWsSession); - cursorSprite.iBitmap = 0; + sprite = RWsSprite(aWsSession); + cursorSprite.iBitmap = 0; cursorSprite.iMaskBitmap = 0; cursorSprite.iInvertMask = EFalse; cursorSprite.iOffset = TPoint(0,0); @@ -127,7 +127,7 @@ public: //### heaplock centralized. QImage temp = pm.toImage(); QSize size = pm.size(); - temp.bits(); + temp.bits(); CFbsBitmap *curbm = q_check_ptr(new CFbsBitmap()); // CBase derived object needs check on new curbm->Create(TSize(size.width(),size.height()),EColor16MA); curbm->LockHeap(ETrue); @@ -188,7 +188,7 @@ bool QDragManager::eventFilter(QObject *o, QEvent *e) switch(e->type()) { case QEvent::MouseButtonPress: { - } + } case QEvent::MouseMove: { if (!object) { //#### this should not happen @@ -211,7 +211,7 @@ bool QDragManager::eventFilter(QObject *o, QEvent *e) if (!cw) return true; TPoint windowPos = cw->effectiveWinId()->PositionRelativeToScreen(); - qt_symbian_dnd_deco->sprite.SetPosition(TPoint(me->globalX()- windowPos.iX,me->globalY()- windowPos.iY)); + qt_symbian_dnd_deco->sprite.SetPosition(TPoint(me->globalX()- windowPos.iX,me->globalY()- windowPos.iY)); while (cw && !cw->acceptDrops() && !cw->isWindow()) cw = cw->parentWidget(); @@ -318,7 +318,7 @@ Qt::DropAction QDragManager::drag(QDrag *o) object->d_func()->target = 0; TPoint windowPos = source()->effectiveWinId()->PositionRelativeToScreen(); qt_symbian_dnd_deco->sprite.SetPosition(TPoint(QCursor::pos().x()- windowPos.iX ,QCursor::pos().y() - windowPos.iY)); - + QPoint hotspot = drag_object->hotSpot(); qt_symbian_dnd_deco->cursorSprite.iOffset = TPoint(- hotspot.x(),- hotspot.y()); qt_symbian_dnd_deco->sprite.UpdateMember(0,qt_symbian_dnd_deco->cursorSprite); diff --git a/src/gui/kernel/qsound_s60.cpp b/src/gui/kernel/qsound_s60.cpp index c9eedf5..75458ec 100644 --- a/src/gui/kernel/qsound_s60.cpp +++ b/src/gui/kernel/qsound_s60.cpp @@ -65,22 +65,22 @@ public: void play(); void stop(); - + inline QSound* sound() const { return m_sound; } - + public: // from MMdaAudioPlayerCallback void MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration); - void MapcPlayComplete(TInt aError); + void MapcPlayComplete(TInt aError); private: QSound *m_sound; - QAuServerS60 *m_server; + QAuServerS60 *m_server; bool m_prepared; - bool m_playCalled; - CMdaAudioPlayerUtility* m_playUtility; + bool m_playCalled; + CMdaAudioPlayerUtility* m_playUtility; }; - + class QAuServerS60 : public QAuServer { public: @@ -103,11 +103,11 @@ public: } bool okay() { return true; } - + protected: - void playCompleted(QAuBucketS60* bucket, int error) + void playCompleted(QAuBucketS60* bucket, int error) { - QSound *sound = bucket->sound(); + QSound *sound = bucket->sound(); if(!error) { // We need to handle repeats by ourselves, since with Symbian API we don't // know how many loops have been played when user asks it @@ -119,14 +119,14 @@ protected: // in order that QSound::isFinished will return true; while(decLoop(sound)) {} } - } + } protected: QAuBucketS60* bucket( QSound *s ) { return (QAuBucketS60*)QAuServer::bucket( s ); } - + friend class QAuBucketS60; }; @@ -160,32 +160,32 @@ void QAuBucketS60::play() { if(m_prepared) { // OpenFileL call is completed we can start playing immediately - m_playUtility->Play(); + m_playUtility->Play(); } else { m_playCalled = true; } - + } void QAuBucketS60::stop() { m_playCalled = false; - m_playUtility->Stop(); + m_playUtility->Stop(); } void QAuBucketS60::MapcPlayComplete(TInt aError) { m_server->playCompleted(this, aError); } - -void QAuBucketS60::MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& /*aDuration*/) + +void QAuBucketS60::MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& /*aDuration*/) { if(aError) { m_server->playCompleted(this, aError); } else { - m_prepared = true; + m_prepared = true; if(m_playCalled){ - play(); + play(); } } } @@ -196,7 +196,7 @@ QAuBucketS60::~QAuBucketS60() m_playUtility->Stop(); m_playUtility->Close(); } - + delete m_playUtility; } diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index 802a2f7..f6dd2e1 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -73,10 +73,10 @@ #include // CAknContextPane #include // CEikStatusPane #endif - + QT_BEGIN_NAMESPACE -// Application internal HandleResourceChangeL events, +// Application internal HandleResourceChangeL events, // system evens seems to start with 0x10 const TInt KInternalStatusPaneChange = 0x50000000; @@ -115,7 +115,7 @@ QS60Data* qGlobalS60Data(); class QAbstractLongTapObserver { public: - virtual void HandleLongTapEventL( const TPoint& aPenEventLocation, + virtual void HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& aPenEventScreenLocation ) = 0; }; class QLongTapTimer; diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index bfcb02b..bca0e9d 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -896,22 +896,22 @@ void QWidget::setAutoFillBackground(bool enabled) \endlist \sa QEvent, QPainter, QGridLayout, QBoxLayout - + \section1 SoftKeys \since 4.6 \preliminary - Softkeys API is a platform independent way of mapping actions to (hardware)keys + Softkeys API is a platform independent way of mapping actions to (hardware)keys and toolbars provided by the underlying platform. - - There are three major use cases supported. First one is a mobile device + + There are three major use cases supported. First one is a mobile device with keypad navigation and no touch ui. Second use case is a mobile - device with touch ui. Third use case is desktop. For now the softkey API is + device with touch ui. Third use case is desktop. For now the softkey API is only implemented for Series60. - - QActions are set to widget(s) via softkey API. Actions in focused widget are + + QActions are set to widget(s) via softkey API. Actions in focused widget are mapped to native toolbar or hardware keys. Even though the API allows to set - any amount of widgets there might be physical restrictions to amount of + any amount of widgets there might be physical restrictions to amount of softkeys that can be used by the device. \o Series60: For series60 menu button is automatically mapped to left @@ -919,7 +919,7 @@ void QWidget::setAutoFillBackground(bool enabled) \sa softKeys() \sa setSoftKey() - + */ QWidgetMapper *QWidgetPrivate::mapper = 0; // widget with wid @@ -5768,7 +5768,7 @@ void QWidget::setFocus(Qt::FocusReason reason) if (!isEnabled()) return; - + QWidget *f = this; while (f->d_func()->extra && f->d_func()->extra->focus_proxy) f = f->d_func()->extra->focus_proxy; @@ -11698,7 +11698,7 @@ void QWidget::clearMask() /*! \preliminary \since 4.6 - + Returns the (possibly empty) list of this widget's softkeys. Returned list cannot be changed. Softkeys should be added and removed via method called setSoftKeys @@ -11719,7 +11719,7 @@ const QList& QWidget::softKeys() const /*! \preliminary \since 4.6 - + Sets the softkey \a softkey to this widget's list of softkeys, Setting 0 as softkey will clear all the existing softkeys set to the widget diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index b206517..ddd2f4c 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -313,14 +313,14 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de QSymbianControl *control= q_check_ptr(new QSymbianControl(q)); QT_TRAP_THROWING(control->ConstructL(true,desktop)); if (!desktop) { - TInt stackingFlags; - if ((q->windowType() & Qt::Popup) == Qt::Popup) { - stackingFlags = ECoeStackFlagRefusesAllKeys | ECoeStackFlagRefusesFocus; - } else { - stackingFlags = ECoeStackFlagStandard; - } - control->ControlEnv()->AppUi()->AddToStackL(control, ECoeStackPriorityDefault, stackingFlags); - + TInt stackingFlags; + if ((q->windowType() & Qt::Popup) == Qt::Popup) { + stackingFlags = ECoeStackFlagRefusesAllKeys | ECoeStackFlagRefusesFocus; + } else { + stackingFlags = ECoeStackFlagStandard; + } + control->ControlEnv()->AppUi()->AddToStackL(control, ECoeStackPriorityDefault, stackingFlags); + QTLWExtra *topExtra = topData(); topExtra->rwindow = control->DrawableWindow(); // Request mouse move events. @@ -349,7 +349,7 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de } else if (q->testAttribute(Qt::WA_NativeWindow) || paintOnScreen()) { // create native child widget QSymbianControl *control = new QSymbianControl(q); QT_TRAP_THROWING(control->ConstructL(!parentWidget)); - + TInt stackingFlags; if ((q->windowType() & Qt::Popup) == Qt::Popup) { stackingFlags = ECoeStackFlagRefusesAllKeys | ECoeStackFlagRefusesFocus; @@ -357,7 +357,7 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de stackingFlags = ECoeStackFlagStandard; } control->ControlEnv()->AppUi()->AddToStackL(control, ECoeStackPriorityDefault, stackingFlags); - + setWinId(control); WId parentw = parentWidget->effectiveWinId(); QT_TRAP_THROWING(control->SetContainerWindowL(*parentw)); @@ -395,12 +395,12 @@ void QWidgetPrivate::show_sys() WId id = q->internalWinId(); if (!extra->topextra->activated) { - QT_TRAP_THROWING(id->ActivateL()); + QT_TRAP_THROWING(id->ActivateL()); extra->topextra->activated = 1; } id->MakeVisible(true); id->SetFocus(true); - + // Force setting of the icon after window is made visible, // this is needed even WA_SetWindowIcon is not set, as in that case we need // to reset to the application level window icon @@ -555,7 +555,7 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f) if (wasCreated && old_winid) { old_winid->MakeVisible(false); if(old_winid->IsFocused()) // Avoid unnecessary calls to FocusChanged() - old_winid->SetFocus(false); + old_winid->SetFocus(false); old_winid->SetParent(0); } @@ -621,7 +621,7 @@ void QWidgetPrivate::s60UpdateIsOpaque() CFbsBitmap* qt_pixmapToNativeBitmap(QPixmap pixmap, bool invert) { - CFbsBitmap* fbsBitmap = q_check_ptr(new CFbsBitmap); // CBase derived object needs check on new + CFbsBitmap* fbsBitmap = q_check_ptr(new CFbsBitmap); // CBase derived object needs check on new TSize size(pixmap.size().width(), pixmap.size().height()); TDisplayMode mode(EColor16MU); @@ -632,7 +632,7 @@ CFbsBitmap* qt_pixmapToNativeBitmap(QPixmap pixmap, bool invert) // Will fix later on when native pixmap is implemented switch(pixmap.depth()) { case 1: - mode = EGray2; + mode = EGray2; break; case 4: mode = EColor16; @@ -662,7 +662,7 @@ CFbsBitmap* qt_pixmapToNativeBitmap(QPixmap pixmap, bool invert) QImage image = pixmap.toImage(); if(invert) - image.invertPixels(); + image.invertPixels(); int height = pixmap.size().height(); for(int i=0;ititlePane(); + CAknTitlePane* titlePane = S60->titlePane(); if (found && titlePane) { // We have title pane with valid metrics - // The API to get title_pane graphics size is not public -> assume square space based + // The API to get title_pane graphics size is not public -> assume square space based // on titlebar font height. CAknBitmap would be optimum, wihtout setting the size, since // then title pane would automatically scale the bitmap. Unfortunately it is not public API const CFont * font = AknLayoutUtils::FontFromId(EAknLogicalFontTitleFont); TSize iconSize(font->HeightInPixels(), font->HeightInPixels()); - + QIcon icon = q->windowIcon(); if (!icon.isNull()) { // Valid icon -> set it as an title pane small picture @@ -750,7 +750,7 @@ void QWidgetPrivate::setWindowIcon_sys(bool forceReset) } } } - + #else Q_UNUSED(forceReset) #endif @@ -764,10 +764,10 @@ void QWidgetPrivate::setWindowTitle_sys(const QString &caption) Q_ASSERT(q->testAttribute(Qt::WA_WState_Created)); CAknTitlePane* titlePane = S60->titlePane(); if(titlePane) { - if(caption.isEmpty()) - titlePane->SetTextToDefaultL(); - else - QT_TRAP_THROWING(titlePane->SetTextL(qt_QString2TPtrC(caption))); + if(caption.isEmpty()) + titlePane->SetTextToDefaultL(); + else + QT_TRAP_THROWING(titlePane->SetTextL(qt_QString2TPtrC(caption))); } } #else @@ -1044,7 +1044,7 @@ void QWidget::setWindowState(Qt::WindowStates newstate) if (isVisible()) { WId id = effectiveWinId(); if(id->IsFocused()) // Avoid unnecessary calls to FocusChanged() - id->SetFocus(false); + id->SetFocus(false); id->MakeVisible(false); } } else { @@ -1052,7 +1052,7 @@ void QWidget::setWindowState(Qt::WindowStates newstate) WId id = effectiveWinId(); id->MakeVisible(true); if(!id->IsFocused()) // Avoid unnecessary calls to FocusChanged() - id->SetFocus(true); + id->SetFocus(true); } const QRect normalGeometry = geometry(); const QRect r = top->normalGeometry; @@ -1115,10 +1115,10 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows) // the next visible window will get keyboard focus WId wid = CEikonEnv::Static()->AppUi()->TopFocusedControl(); if (wid) { - QWidget *widget = QWidget::find(wid); + QWidget *widget = QWidget::find(wid); QApplication::setActiveWindow(widget); // Reset global window title for focusing window - widget->d_func()->setWindowTitle_sys(widget->windowTitle()); + widget->d_func()->setWindowTitle_sys(widget->windowTitle()); } } diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index d153215..1f52422 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -233,7 +233,7 @@ contains(QMAKE_MAC_XARCH, no) { win32-g++|!win32:!*-icc* { mmx { - mmx_compiler.commands = $$QMAKE_CXX -c -Winline + mmx_compiler.commands = $$QMAKE_CXX -c -Winline mac { mmx_compiler.commands += -Xarch_i386 -mmmx @@ -375,7 +375,7 @@ symbian { "SOURCE qblendfunctions_armv6_rvct.s" \ "SOURCE qdrawhelper_armv6_rvct.s" \ "$${LITERAL_HASH}endif" - + MMP_RULES += armccIfdefBlock QMAKE_CXXFLAGS.ARMCC *= -O3 } diff --git a/src/gui/painting/qblendfunctions_armv6_rvct.s b/src/gui/painting/qblendfunctions_armv6_rvct.s index 312bd07..64d5aa5 100644 --- a/src/gui/painting/qblendfunctions_armv6_rvct.s +++ b/src/gui/painting/qblendfunctions_armv6_rvct.s @@ -54,13 +54,13 @@ ARM PRESERVE8 - INCLUDE qdrawhelper_armv6_rvct.inc + INCLUDE qdrawhelper_armv6_rvct.inc ;----------------------------------------------------------------------------- ; qt_blend_rgb32_on_rgb32_arm -; -; @brief +; +; @brief ; ; @param dest Destination pixels (r0) ; @param dbpl Destination bytes per line (r1) @@ -69,25 +69,25 @@ ; @param w Width (s0 -> r4) ; @param h Height (s1 -> r5) ; @param const_alpha Constant alpha (s2 -> r6) -; +; ;--------------------------------------------------------------------------- qt_blend_rgb32_on_rgb32_armv6 Function stmfd sp!, {r4-r12, r14} - + ; read arguments off the stack add r8, sp, #10 * 4 ldmia r8, {r9-r11} - + ; Reorganize registers - + mov r4, r10 mov r5, r1 mov r6, r3 - + mov r1, r2 mov r2, r9 mov r3, r11 - + ; Now we have registers ; @param dest Destination pixels (r0) ; @param src Source pixels (r1) @@ -96,53 +96,53 @@ qt_blend_rgb32_on_rgb32_armv6 Function ; @param h Height (r4) ; @param dbpl Destination bytes per line (r5) ; @param sbpl Source bytes per line (r6) - + cmp r3, #256 ; test if we have fully opaque constant alpha value bne rgb32_blend_const_alpha ; branch if not - + rgb32_blend_loop subs r4, r4, #1 bmi rgb32_blend_exit ; while(h--) - -rgb321 PixCpySafe r0, r1, r2 + +rgb321 PixCpySafe r0, r1, r2 add r0, r0, r5 ; dest = dest + dbpl - add r1, r1, r6 ; src = src + sbpl + add r1, r1, r6 ; src = src + sbpl + + b rgb32_blend_loop + - b rgb32_blend_loop - - rgb32_blend_const_alpha ;ldr r14, =ComponentHalf ; load 0x800080 to r14 mov r14, #0x800000 add r14, r14, #0x80 - + sub r3, r3, #1 ; const_alpha -= 1; rgb32_blend_loop_const_alpha subs r4, r4, #1 bmi rgb32_blend_exit ; while(h--) - + rgb322 BlendRowSafe PixelSourceOverConstAlpha add r0, r0, r5 ; dest = dest + dbpl - add r1, r1, r6 ; src = src + sbpl + add r1, r1, r6 ; src = src + sbpl b rgb32_blend_loop_const_alpha - -rgb32_blend_exit - + +rgb32_blend_exit + ldmfd sp!, {r4-r12, pc} ; pop and return - - - + + + ;----------------------------------------------------------------------------- ; qt_blend_argb32_on_argb32_arm -; -; @brief +; +; @brief ; ; @param dest Destination pixels (r0) ; @param dbpl Destination bytes per line (r1) @@ -151,25 +151,25 @@ rgb32_blend_exit ; @param w Width (s0 -> r4) ; @param h Height (s1 -> r5) ; @param const_alpha Constant alpha (s2 -> r6) -; +; ;--------------------------------------------------------------------------- qt_blend_argb32_on_argb32_armv6 Function stmfd sp!, {r4-r12, r14} - + ; read arguments off the stack add r8, sp, #10 * 4 ldmia r8, {r9-r11} - + ; Reorganize registers - + mov r4, r10 mov r5, r1 mov r6, r3 - + mov r1, r2 mov r2, r9 mov r3, r11 - + ; Now we have registers ; @param dest Destination pixels (r0) ; @param src Source pixels (r1) @@ -178,14 +178,14 @@ qt_blend_argb32_on_argb32_armv6 Function ; @param h Height (r4) ; @param dbpl Destination bytes per line (r5) ; @param sbpl Source bytes per line (r6) - + ;ldr r14, =ComponentHalf ; load 0x800080 to r14 mov r14, #0x800000 add r14, r14, #0x80 - + cmp r3, #256 ; test if we have fully opaque constant alpha value bne argb32_blend_const_alpha ; branch if not - + argb32_blend_loop subs r4, r4, #1 @@ -194,10 +194,10 @@ argb32_blend_loop argb321 BlendRowSafe PixelSourceOver add r0, r0, r5 ; dest = dest + dbpl - add r1, r1, r6 ; src = src + sbpl + add r1, r1, r6 ; src = src + sbpl b argb32_blend_loop - + argb32_blend_const_alpha sub r3, r3, #1 ; const_alpha -= 1; @@ -206,18 +206,17 @@ argb32_blend_loop_const_alpha subs r4, r4, #1 bmi argb32_blend_exit ; while(h--) - + argb322 BlendRowSafe PixelSourceOverConstAlpha add r0, r0, r5 ; dest = dest + dbpl - add r1, r1, r6 ; src = src + sbpl + add r1, r1, r6 ; src = src + sbpl b argb32_blend_loop_const_alpha - -argb32_blend_exit - + +argb32_blend_exit + ldmfd sp!, {r4-r12, pc} ; pop and return - - + + END ; File end - diff --git a/src/gui/painting/qcolormap_s60.cpp b/src/gui/painting/qcolormap_s60.cpp index 1b58598..29d340f 100644 --- a/src/gui/painting/qcolormap_s60.cpp +++ b/src/gui/painting/qcolormap_s60.cpp @@ -105,4 +105,3 @@ QColormap &QColormap::operator=(const QColormap &colormap) { qAtomicAssign(d, colormap.d); return *this; } QT_END_NAMESPACE - diff --git a/src/gui/painting/qdrawhelper_armv6_rvct.inc b/src/gui/painting/qdrawhelper_armv6_rvct.inc index b3e0605..1cb316a 100644 --- a/src/gui/painting/qdrawhelper_armv6_rvct.inc +++ b/src/gui/painting/qdrawhelper_armv6_rvct.inc @@ -52,10 +52,10 @@ ;----------------------------------------------------------------------------- ; Globals. -; Earch marcro expects that caller has loaded 0x800080 to r14. +; Earch marcro expects that caller has loaded 0x800080 to r14. ;----------------------------------------------------------------------------- -ComponentHalf EQU 0x800080 +ComponentHalf EQU 0x800080 ;----------------------------------------------------------------------------- ; ARM assembly implementations of accelerated graphics operations. @@ -65,7 +65,7 @@ ComponentHalf EQU 0x800080 ; - r0 = Target buffer pointer ; - r1 = Source buffer pointer ; - r2 = Length of the buffer to blend -; - r3 = Constant alpha for source buffer +; - r3 = Constant alpha for source buffer ; ;----------------------------------------------------------------------------- @@ -78,8 +78,8 @@ $func Function CODE32 $func MEND - - + + ;----------------------------------------------------------------------------- ; Armv6 boosted implementation of BYTE_MUL(...) function found in qdrawhelper_p.h. ; @@ -98,29 +98,29 @@ $func ; uint r8 = (x & 0xff00ff) * a + 0x800080 uxtb16 r8, $x ; r8 = r8 & 0x00FF00FF mla r8, r8, $a, r14 - + ; x = ((r >> 8) & 0xff00ff) * a + 0x800080 uxtb16 $x, $x, ror #8 mla $x, $x, $a, r14 - + ; r8 = (r8 + ((r8 >> 8) & 0xff00ff) ) >> 8 ; r8 &= 0xff00ff uxtab16 r8, r8, r8, ror #8 uxtb16 r8, r8, ror #8 - + ; x = x + ((x >>8) & 0xff00ff) uxtab16 $x, $x, $x, ror #8 - + ; x &= 0xff00ff00 ; x |= r8 uxtb16 $x, $x, ror #8 orr $dst, r8, $x, lsl #8 - + MEND - + ;----------------------------------------------------------------------------- -; Armv6 boosted implementation of INTERPOLATE_PIXEL_255(...) function found in +; Armv6 boosted implementation of INTERPOLATE_PIXEL_255(...) function found in ; qdrawhelper_p.h. ; ; @param dst Destination register where to store the result @@ -129,7 +129,7 @@ $func ; @param y Second value to multiply ; @param b Multiplicator byte for second value ; @param r14 Component half 0x800080 -; +; ; ; @note Trashes x, r8, r14 ;----------------------------------------------------------------------------- @@ -143,40 +143,40 @@ $func ; uint r8 = (((x & 0xff00ff) * a) + 0x800080) uxtb16 r8, $x ; r8 = r8 & 0x00FF00FF mla r8, r8, $a, r14 - + ; x = ((((x >> 8) & 0xff00ff) * a) + 0x800080) uxtb16 $x, $x, ror #8 mla $x, $x, $a, r14 - + ; Now we are trashing r14 to free it for other purposes - + ; uint r14 = (y & 0xff00ff) * b uxtb16 r14, $y ; r14 = y & 0x00FF00FF mul r14, r14, $b - + ; r8 = r8 + r14 add r8, r8, r14 - + ; r8 = (r8 + ((r8 >> 8) & 0xff00ff) ) >> 8 ; r8 &= 0xff00ff uxtab16 r8, r8, r8, ror #8 uxtb16 r8, r8, ror #8 - + ; r14 = ((y >> 8) & 0xff00ff) * b uxtb16 r14, $y, ror #8 ; r14 = ((y >> 8) & 0xFF00FF) mul r14, r14, $b - + ; x = x + r14 add $x, $x, r14 - + ; x = x + ((x >>8) & 0xff00ff) uxtab16 $x, $x, $x, ror #8 - + ; x &= 0xff00ff00 ; x |= r8 uxtb16 $x, $x, ror #8 orr $dst, r8, $x, lsl #8 - + MEND ;----------------------------------------------------------------------------- @@ -184,19 +184,19 @@ $func ;----------------------------------------------------------------------------- MACRO $label Blend4Pixels $BlendPixel - - ; Blend first 4 pixels - + + ; Blend first 4 pixels + ldmia r1!, {r4-r7} ldm r0, {r9-r12} - + b4p1_$label $BlendPixel r9, r4, r3 b4p2_$label $BlendPixel r10, r5, r3 b4p3_$label $BlendPixel r11, r6, r3 b4p4_$label $BlendPixel r12, r7, r3 - + stmia r0!, {r9-r12} - + MEND ;----------------------------------------------------------------------------- @@ -204,43 +204,43 @@ b4p4_$label $BlendPixel r12, r7, r3 ;----------------------------------------------------------------------------- MACRO $label Blend8Pixels $BlendPixel - + b8p1_$label Blend4Pixels $BlendPixel -b8p2_$label Blend4Pixels $BlendPixel - +b8p2_$label Blend4Pixels $BlendPixel + MEND - + ;----------------------------------------------------------------------------- ; ;----------------------------------------------------------------------------- MACRO $label Blend16Pixels $BlendPixel - + b16p1_$label Blend8Pixels $BlendPixel -b16p2_$label Blend8Pixels $BlendPixel - +b16p2_$label Blend8Pixels $BlendPixel + MEND - + ;----------------------------------------------------------------------------- ; ;----------------------------------------------------------------------------- MACRO $label Blend32Pixels $BlendPixel - + b32p1_$label Blend16Pixels $BlendPixel -b32p2_$label Blend16Pixels $BlendPixel - +b32p2_$label Blend16Pixels $BlendPixel + MEND ;----------------------------------------------------------------------------- -; A macro for source over compositing one row of pixels and saving the results +; A macro for source over compositing one row of pixels and saving the results ; to destination buffer. ; ; @param dest Destination buffer (r0) ; @param src Source buffer (r1) ; @param length Length (r2) ; @param const_alpha Constant alpha (r3) -; @param r14 Component Half (0x800080) (r14) +; @param r14 Component Half (0x800080) (r14) ; ; @note Advances r0, r1 ; @note Trashes r2, r4-r12 @@ -260,73 +260,73 @@ brp1_$label Blend32Pixels $BlendPixel b bloop_$label b_remaining_$label - + ; Remaining 31 pixels - + addmi r2, r2, #32 ; Blend 16 pixels tst r2, #16 beq b_remaining8_$label - + brp2_$label Blend16Pixels $BlendPixel - -b_remaining8_$label - + +b_remaining8_$label + ; Blend 8 pixels tst r2, #8 beq b_remaining4_$label - -brp3_$label Blend8Pixels $BlendPixel - -b_remaining4_$label - + +brp3_$label Blend8Pixels $BlendPixel + +b_remaining4_$label + ; Blend 4 pixels tst r2, #4 beq b_remaining3_$label - -brp4_$label Blend4Pixels $BlendPixel + +brp4_$label Blend4Pixels $BlendPixel b_remaining3_$label ; Remaining 3 pixels - + tst r2, #2 beq b_last_$label - + ldmia r1!, {r4-r5} ldm r0, {r9-r10} - + brp5_$label $BlendPixel r9, r4, r3 brp6_$label $BlendPixel r10, r5, r3 - + stmia r0!, {r9-r10} b_last_$label - + tst r2, #1 beq bexit_$label - + ldr r4, [r1] ldr r9, [r0] bpl_$label $BlendPixel r9, r4, r3 - + str r9, [r0] bexit_$label MEND - + ;----------------------------------------------------------------------------- -; A macro for source over compositing one row of pixels and saving the results +; A macro for source over compositing one row of pixels and saving the results ; to destination buffer. Restores all registers. ; ; @param dest Destination buffer (r0) ; @param src Source buffer (r1) ; @param length Length (r2) ; @param const_alpha Constant alpha (r3) -; @param r14 Component Half (0x800080) (r14) +; @param r14 Component Half (0x800080) (r14) ; ; @note Advances r0, r1 ; @note Trashes r2, r4-r12 @@ -336,16 +336,16 @@ $label BlendRowSafe $BlendPixel stmfd sp!, {r0-r6} ; Preserves registers only up to r6 -brs_$label BlendRow $BlendPixel +brs_$label BlendRow $BlendPixel ldmfd sp!, {r0-r6} - MEND - + MEND + ;----------------------------------------------------------------------------- -; Pix Copy. -; NOTE! Cache line size of ARM1136JF-S and ARM1136J-S is 32 bytes (8 pixels). +; Pix Copy. +; NOTE! Cache line size of ARM1136JF-S and ARM1136J-S is 32 bytes (8 pixels). ; ; @param dst Destination pixels (r0) ; @param src Source pixels (r1) @@ -369,7 +369,7 @@ pcpy_loop_$label pcpy_remaining_$label ; Copy up to 7 remaining pixels - + ; Copy 4 pixels tst $len, #4 ldmneia $src!, {r3-r6} @@ -384,9 +384,9 @@ pcpy_remaining_$label strne r3, [$dst] MEND - + ;----------------------------------------------------------------------------- -; General Pix Copy. Maximum 8 pixels at time. Restores all registers. +; General Pix Copy. Maximum 8 pixels at time. Restores all registers. ; ; @param dst Destination pixels (r0) ; @param src Source pixels (r1) @@ -402,10 +402,10 @@ $label PixCpySafe $dst, $src, $len pcs_$label PixCpy $dst, $src, $len ldmfd sp!, {r0-r6} ; pop - + MEND - - + + ;----------------------------------------------------------------------------- ; A macro for source over compositing one pixel and saving the result to ; dst register. @@ -422,7 +422,7 @@ $label PixelSourceOver $dst, $src, $const_alpha ; Negate src and extract alpha mvn $const_alpha, $src ; bitwise not - uxtb $const_alpha, $const_alpha, ror #24 ; r3 = ((r3 & 0xFF000000) >> 24); + uxtb $const_alpha, $const_alpha, ror #24 ; r3 = ((r3 & 0xFF000000) >> 24); ;cmp $const_alpha, #255 ; test for full transparency ( negated ) ;beq exit_$label @@ -430,12 +430,12 @@ $label PixelSourceOver $dst, $src, $const_alpha moveq $dst, $src beq exit_$label - ByteMul $dst, $dst, $const_alpha + ByteMul $dst, $dst, $const_alpha add $dst, $src, $dst - + exit_$label MEND - + ;----------------------------------------------------------------------------- ; A macro for source over compositing one pixel and saving the result to ; dst register. @@ -457,7 +457,7 @@ $label PixelSourceOverConstAlpha $dst, $src, $const_alpha ; Negate src and extract alpha mvn $const_alpha, $src ; bitwise not - uxtb $const_alpha, $const_alpha, ror #24 ; r3 = ((r3 & 0xFF000000) >> 24); + uxtb $const_alpha, $const_alpha, ror #24 ; r3 = ((r3 & 0xFF000000) >> 24); ByteMul $dst, $dst, $const_alpha @@ -466,8 +466,8 @@ $label PixelSourceOverConstAlpha $dst, $src, $const_alpha ; recover alpha ldmfd sp!, {$const_alpha} - MEND - + MEND + ;----------------------------------------------------------------------------- ; A macro for source over compositing one pixel and saving the result to ; a register. @@ -491,6 +491,6 @@ $label PixelSourceConstAlpha $dst, $src, $const_alpha ; recover r2 and r14 ldmfd sp!, {r2, r14} - MEND - + MEND + END ; File end diff --git a/src/gui/painting/qdrawhelper_armv6_rvct.s b/src/gui/painting/qdrawhelper_armv6_rvct.s index 3ffe48b..dd29f80 100644 --- a/src/gui/painting/qdrawhelper_armv6_rvct.s +++ b/src/gui/painting/qdrawhelper_armv6_rvct.s @@ -52,22 +52,22 @@ ARM PRESERVE8 - + INCLUDE qdrawhelper_armv6_rvct.inc - + ;----------------------------------------------------------------------------- ; qt_memfill32_armv6 -; +; ; @brief Not yet in use! ; ; @param dest Destination buffer (r0) ; @param value Value (r1) ; @param count Count (r2) -; +; ;--------------------------------------------------------------------------- qt_memfill32_armv6 Function stmfd sp!, {r4-r12, r14} - + mov r3, r1 mov r4, r1 mov r5, r1 @@ -75,7 +75,7 @@ qt_memfill32_armv6 Function mov r7, r1 mov r8, r1 mov r9, r1 - + mfill_loop ; Fill 32 pixels per loop iteration subs r2, r2, #32 @@ -88,16 +88,16 @@ mfill_loop mfill_remaining ; Fill up to 31 remaining pixels - + ; Fill 16 pixels tst r2, #16 stmneia r0!, {r1, r3, r4, r5, r6, r7, r8, r9} stmneia r0!, {r1, r3, r4, r5, r6, r7, r8, r9} - + ; Fill 8 pixels tst r2, #8 stmneia r0!, {r1, r3, r4, r5, r6, r7, r8, r9} - + ; Fill 4 pixels tst r2, #4 stmneia r0!, {r1, r3, r4, r5} @@ -109,31 +109,31 @@ mfill_remaining ; Fill last one tst r2, #1 strne r1, [r0] - + ldmfd sp!, {r4-r12, pc} ; pop and return - + ;----------------------------------------------------------------------------- ; comp_func_Source_arm -; -; @brief +; +; @brief ; ; @param dest Destination buffer (r0) ; @param src Source buffer (r1) ; @param length Length (r2) ; @param const_alpha Constant alpha (r3) -; +; ;--------------------------------------------------------------------------- comp_func_Source_armv6 Function stmfd sp!, {r4-r12, r14} - + cmp r3, #255 ; if(r3 == 255) bne src2 ; branch if not - + src1 PixCpy r0, r1, r2 ldmfd sp!, {r4-r12, pc} ; pop and return -src2 +src2 ;ldr r14, =ComponentHalf ; load 0x800080 to r14 mov r14, #0x800000 add r14, r14, #0x80 @@ -144,35 +144,34 @@ src22 BlendRow PixelSourceConstAlpha ;----------------------------------------------------------------------------- ; comp_func_SourceOver_arm -; -; @brief +; +; @brief ; ; @param dest Destination buffer (r0) ; @param src Source buffer (r1) ; @param length Length (r2) ; @param const_alpha Constant alpha (r3) -; +; ;--------------------------------------------------------------------------- comp_func_SourceOver_armv6 Function stmfd sp!, {r4-r12, r14} - + ;ldr r14, =ComponentHalf ; load 0x800080 to r14 mov r14, #0x800000 add r14, r14, #0x80 - + cmp r3, #255 ; if(r3 == 255) bne srcovr2 ; branch if not - + srcovr1 BlendRow PixelSourceOver - + ldmfd sp!, {r4-r12, pc} ; pop and return srcovr2 - + srcovr22 BlendRow PixelSourceOverConstAlpha ldmfd sp!, {r4-r12, pc} ; pop and return - - END ; File end - + + END ; File end diff --git a/src/gui/painting/qwindowsurface_s60_p.h b/src/gui/painting/qwindowsurface_s60_p.h index 40a866d..6a31ced 100644 --- a/src/gui/painting/qwindowsurface_s60_p.h +++ b/src/gui/painting/qwindowsurface_s60_p.h @@ -81,7 +81,7 @@ public: static void unlockBitmapHeap(); CFbsBitmap *symbianBitmap() const; - + private: void updatePaintDeviceOnBitmap(); diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 888a6ed..0277d2f 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -280,7 +280,7 @@ void QS60StylePrivate::drawSkinElement(SkinElements element, QPainter *painter, break; case SE_Editor: drawFrame(SF_Editor, painter, rect, flags | SF_PointNorth); - break; + break; default: break; } @@ -796,12 +796,12 @@ void QS60StylePrivate::setThemePaletteHash(QPalette *palette) const s60Color(QS60StyleEnums::CL_QsnTextColors, 24, 0)); QApplication::setPalette(widgetPalette, "QTextEdit"); widgetPalette = *palette; - + widgetPalette.setColor(QPalette::All, QPalette::HighlightedText, s60Color(QS60StyleEnums::CL_QsnTextColors, 24, 0)); QApplication::setPalette(widgetPalette, "QComboBox"); widgetPalette = *palette; - + widgetPalette.setColor(QPalette::WindowText, mainAreaTextColor); widgetPalette.setColor(QPalette::Button, QApplication::palette().color(QPalette::Button)); widgetPalette.setColor(QPalette::Dark, mainAreaTextColor.darker()); diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h index 2eb40de..4bf8143 100644 --- a/src/gui/styles/qs60style_p.h +++ b/src/gui/styles/qs60style_p.h @@ -270,7 +270,7 @@ public: SP_QsnFrButtonSideBInactive, SP_QsnFrButtonSideLInactive, SP_QsnFrButtonSideRInactive, - SP_QsnFrButtonCenterInactive, + SP_QsnFrButtonCenterInactive, SP_QsnFrNotepadCornerTl, SP_QsnFrNotepadCornerTr, SP_QsnFrNotepadCornerBl, diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index 81ee8b1..f304d14 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -80,7 +80,7 @@ enum TSupportRelease { ES60_5_1 = 0x0008, ES60_5_2 = 0x0010, // Add all new releases here - ES60_AllReleases = ES60_3_1 | ES60_3_2 | ES60_5_0 | ES60_5_1 | ES60_5_2 + ES60_AllReleases = ES60_3_1 | ES60_3_2 | ES60_5_0 | ES60_5_1 | ES60_5_2 }; typedef struct { @@ -317,7 +317,7 @@ const partMapEntry QS60StyleModeSpecifics::m_partMap[] = { /* SP_QsnFrButtonSideBInactive */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b6}, /* SP_QsnFrButtonSideLInactive */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b7}, /* SP_QsnFrButtonSideRInactive */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b8}, - /* SP_QsnFrButtonCenterInactive */ {KAknsIIDQsnFrButtonTbCenter, EDrawIcon, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b9}, + /* SP_QsnFrButtonCenterInactive */ {KAknsIIDQsnFrButtonTbCenter, EDrawIcon, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b9}, /* SP_QsnFrNotepadCornerTl */ {KAknsIIDQsnFrNotepadContCornerTl, ENoDraw, ES60_AllReleases, -1,-1}, /* SP_QsnFrNotepadCornerTr */ {KAknsIIDQsnFrNotepadContCornerTr, ENoDraw, ES60_AllReleases, -1,-1}, diff --git a/src/gui/text/qfontdatabase_s60.cpp b/src/gui/text/qfontdatabase_s60.cpp index 6838d17..8176009 100644 --- a/src/gui/text/qfontdatabase_s60.cpp +++ b/src/gui/text/qfontdatabase_s60.cpp @@ -69,7 +69,7 @@ QFileInfoList alternativeFilePaths(const QString &path, const QStringList &nameF const QString zDriveString("Z:/"); driveStrings.removeAll(zDriveString); driveStrings.prepend(zDriveString); - + QStringList uniqueFileNameList; for (int i = driveStrings.count() - 1; i >= 0; --i) { const QDir dirOnDrive(driveStrings.at(i) + path); @@ -393,7 +393,7 @@ void QFontDatabase::load(const QFontPrivate *d, int script) { QFontEngine *fe = 0; QFontDef req = d->request; - + if (!d->engineData) { const QFontCache::Key key(cleanedFontDef(req), script); getEngineData(d, key); diff --git a/src/gui/util/qdesktopservices.cpp b/src/gui/util/qdesktopservices.cpp index eb2d92e..18a0a73 100644 --- a/src/gui/util/qdesktopservices.cpp +++ b/src/gui/util/qdesktopservices.cpp @@ -287,10 +287,10 @@ void QDesktopServices::unsetUrlHandler(const QString &scheme) \note The storage location returned can be a directory that does not exist; i.e., it may need to be created by the system or the user. - + \note On Symbian OS, DataLocation and ApplicationsLocation always point to appropriate folder on same drive with executable. FontsLocation always points to folder on ROM drive. - Rest of the standard locations point to folder on same drive with executable, except + Rest of the standard locations point to folder on same drive with executable, except that if executable is in ROM the folder from C drive is returned. \note On Mac OS X, DataLocation does not include QCoreApplication::organizationName. diff --git a/src/gui/util/qdesktopservices_s60.cpp b/src/gui/util/qdesktopservices_s60.cpp index 567b4ee..565dd6e 100644 --- a/src/gui/util/qdesktopservices_s60.cpp +++ b/src/gui/util/qdesktopservices_s60.cpp @@ -113,9 +113,9 @@ static void handleMailtoSchemeLX(const QUrl &url) QStringList bccs = bcc.split(",", QString::SkipEmptyParts); - RSendAs sendAs; - User::LeaveIfError(sendAs.Connect()); - QAutoClose sendAsCleanup(sendAs); + RSendAs sendAs; + User::LeaveIfError(sendAs.Connect()); + QAutoClose sendAsCleanup(sendAs); CSendAsAccounts* accounts = CSendAsAccounts::NewL(); @@ -124,43 +124,43 @@ static void handleMailtoSchemeLX(const QUrl &url) TInt count = accounts->Count(); CleanupStack::PopAndDestroy(accounts); - if(!count) { + if(!count) { // TODO: we should try to create account if count == 0 // CSendUi would provide account creation service for us, but it requires ridicilous // capabilities: LocalServices NetworkServices ReadDeviceData ReadUserData WriteDeviceData WriteUserData - User::Leave(KErrNotSupported); - } else { - RSendAsMessage sendAsMessage; + User::Leave(KErrNotSupported); + } else { + RSendAsMessage sendAsMessage; sendAsMessage.CreateL(sendAs, KUidMsgTypeSMTP); QAutoClose sendAsMessageCleanup(sendAsMessage); - - + + // Subject sendAsMessage.SetSubjectL(qt_QString2TPtrC(subject)); - + // Body sendAsMessage.SetBodyTextL(qt_QString2TPtrC(body)); - + // To foreach(QString item, recipients) sendAsMessage.AddRecipientL(qt_QString2TPtrC(item), RSendAsMessage::ESendAsRecipientTo ); - + foreach(QString item, tos) sendAsMessage.AddRecipientL(qt_QString2TPtrC(item), RSendAsMessage::ESendAsRecipientTo ); - + // Cc foreach(QString item, ccs) sendAsMessage.AddRecipientL(qt_QString2TPtrC(item), RSendAsMessage::ESendAsRecipientCc ); - + // Bcc foreach(QString item, bccs) sendAsMessage.AddRecipientL(qt_QString2TPtrC(item), RSendAsMessage::ESendAsRecipientBcc ); - + // send the message sendAsMessage.LaunchEditorAndCloseL(); // sendAsMessage is already closed sendAsMessageCleanup.Forget(); - } + } } static bool handleMailtoScheme(const QUrl &url) @@ -172,9 +172,9 @@ static bool handleMailtoScheme(const QUrl &url) static void handleOtherSchemesL(const TDesC& aUrl) { // Other schemes are at the moment passed to WEB browser - HBufC* buf16 = HBufC::NewLC( aUrl.Length() + KBrowserPrefix.iTypeLength ); - buf16->Des().Copy( KBrowserPrefix ); // Prefix used to launch correct browser view - buf16->Des().Append( aUrl ); + HBufC* buf16 = HBufC::NewLC( aUrl.Length() + KBrowserPrefix.iTypeLength ); + buf16->Des().Copy( KBrowserPrefix ); // Prefix used to launch correct browser view + buf16->Des().Append( aUrl ); TApaTaskList taskList( CEikonEnv::Static()->WsSession() ); TApaTask task = taskList.FindApp( KUidBrowser ); @@ -189,12 +189,12 @@ static void handleOtherSchemesL(const TDesC& aUrl) else { // Start a new browser instance - RApaLsSession appArcSession; - User::LeaveIfError( appArcSession.Connect() ); - CleanupClosePushL( appArcSession ); - TThreadId id; + RApaLsSession appArcSession; + User::LeaveIfError( appArcSession.Connect() ); + CleanupClosePushL( appArcSession ); + TThreadId id; appArcSession.StartDocument( *buf16, KUidBrowser , id ); - CleanupStack::PopAndDestroy(); // appArcSession + CleanupStack::PopAndDestroy(); // appArcSession } CleanupStack::PopAndDestroy( buf16 ); @@ -255,8 +255,8 @@ static void openDocumentL(const TDesC& aUrl) { #ifndef USE_DOCUMENTHANDLER // Start app associated to file MIME type by using RApaLsSession - // Apparc base method cannot be used to open app in embedded mode, - // but seems to be most stable way at the moment + // Apparc base method cannot be used to open app in embedded mode, + // but seems to be most stable way at the moment RApaLsSession appArcSession; User::LeaveIfError( appArcSession.Connect() ); CleanupClosePushL( appArcSession ); @@ -264,25 +264,25 @@ static void openDocumentL(const TDesC& aUrl) // ESwitchFiles means do not start another instance // Leaves if file does not exist, leave is trapped in openDocument and false returned to user. User::LeaveIfError( appArcSession.StartDocument( aUrl, id, - RApaLsSession::ESwitchFiles ) ); // ELaunchNewApp + RApaLsSession::ESwitchFiles ) ); // ELaunchNewApp CleanupStack::PopAndDestroy(); // appArcSession #else // This is an alternative way to launch app associated to MIME type - // CDocumentHandler would support opening apps in embedded mode, - // but our Qt application window group seems to always get switched on top of embedded one - // -> Cannot use menus etc of embedded app -> used - - CDocumentHandler* docHandler = CDocumentHandler::NewLC(); - TDataType temp; - //Standalone file opening fails for some file-types at least in S60 3.1 emulator - //For example .txt file fails with KErrAlreadyInUse and music files with KERN-EXEC 0 - //Workaround is to use OpenFileEmbeddedL - //docHandler->OpenFileL(aUrl, temp); - - // Opening file with CDocumentHandler will leave if file does not exist - // Leave is trapped in openDocument and false returned to user. - docHandler->OpenFileEmbeddedL(aUrl, temp); - CleanupStack::PopAndDestroy(docHandler); + // CDocumentHandler would support opening apps in embedded mode, + // but our Qt application window group seems to always get switched on top of embedded one + // -> Cannot use menus etc of embedded app -> used + + CDocumentHandler* docHandler = CDocumentHandler::NewLC(); + TDataType temp; + //Standalone file opening fails for some file-types at least in S60 3.1 emulator + //For example .txt file fails with KErrAlreadyInUse and music files with KERN-EXEC 0 + //Workaround is to use OpenFileEmbeddedL + //docHandler->OpenFileL(aUrl, temp); + + // Opening file with CDocumentHandler will leave if file does not exist + // Leave is trapped in openDocument and false returned to user. + docHandler->OpenFileEmbeddedL(aUrl, temp); + CleanupStack::PopAndDestroy(docHandler); #endif } @@ -295,8 +295,8 @@ static void openDocumentL(const TDesC& aUrl) // wide range of schemes and is extensible by plugins static bool handleUrl(const QUrl &url) { - if (!url.isValid()) - return false; + if (!url.isValid()) + return false; QString urlString(url.toString()); TPtrC urlPtr(qt_QString2TPtrC(urlString)); @@ -313,12 +313,12 @@ static void handleUrlL(const TDesC& aUrl) } static bool launchWebBrowser(const QUrl &url) { - return handleUrl(url); + return handleUrl(url); } static bool openDocument(const QUrl &file) { - return handleUrl(url); + return handleUrl(url); } #endif @@ -391,7 +391,7 @@ QString QDesktopServices::storageLocation(StandardLocation type) //return QDir::homePath(); break; break; case DataLocation: - CEikonEnv::Static()->FsSession().PrivatePath( path ); + CEikonEnv::Static()->FsSession().PrivatePath( path ); // TODO: Should we actually return phone mem if data is on ROM? path.Insert( 0, exeDrive().Name() ); break; diff --git a/src/gui/widgets/qmenu_symbian.cpp b/src/gui/widgets/qmenu_symbian.cpp index 5207cc6..1b21b71 100644 --- a/src/gui/widgets/qmenu_symbian.cpp +++ b/src/gui/widgets/qmenu_symbian.cpp @@ -87,7 +87,7 @@ bool menuExists() { QWidget *w = qApp->activeWindow(); QMenuBarPrivate *mb = menubars()->value(w); - if ((!mb) && !menubars()->count()) + if ((!mb) && !menubars()->count()) return false; return true; } @@ -196,7 +196,7 @@ static void qt_symbian_insert_action(QSymbianMenuAction* action, QListaction->isEnabled()){ menuItem->menuItemData.iFlags += EEikMenuItemDimmed; } - + if (action->action->isCheckable()) { if (action->action->isChecked()) menuItem->menuItemData.iFlags += EEikMenuItemCheckBox | EEikMenuItemSymbolOn; @@ -244,7 +244,7 @@ Q_GUI_EXPORT void qt_symbian_show_toplevel( CEikMenuPane* menuPane) return; rebuildMenu(); for (int i = 0; i < symbianMenus.count(); ++i) - QT_TRAP_THROWING(menuPane->AddMenuItemL(symbianMenus.at(i)->menuItemData)); + QT_TRAP_THROWING(menuPane->AddMenuItemL(symbianMenus.at(i)->menuItemData)); } Q_GUI_EXPORT void qt_symbian_show_submenu( CEikMenuPane* menuPane, int id) @@ -252,7 +252,7 @@ Q_GUI_EXPORT void qt_symbian_show_submenu( CEikMenuPane* menuPane, int id) SymbianMenuItem* menu = qt_symbian_find_menu(id, symbianMenus); if (menu) { for (int i = 0; i < menu->children.count(); ++i) - QT_TRAP_THROWING(menuPane->AddMenuItemL(menu->children.at(i)->menuItemData)); + QT_TRAP_THROWING(menuPane->AddMenuItemL(menu->children.at(i)->menuItemData)); } } @@ -262,7 +262,7 @@ void QMenuBarPrivate::symbianCommands(int command) QContextMenuEvent* event = new QContextMenuEvent(QContextMenuEvent::Keyboard, QPoint(0,0)); QCoreApplication::postEvent(widgetWithContextMenu, event); } - + int size = nativeMenuBars.size(); for (int i = 0; i < nativeMenuBars.size(); ++i) { SymbianMenuItem* menu = qt_symbian_find_menu_item(command, symbianMenus); -- cgit v0.12 From ad8216fef69b31ebb61912d1d2d9c7041cbe5118 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Tue, 4 Aug 2009 13:25:30 +0300 Subject: Blank line, trailing whitespace etc fixes for s60main --- src/s60main/qts60main.cpp | 1 - src/s60main/qts60mainapplication.cpp | 1 - src/s60main/qts60mainapplication.h | 1 - src/s60main/qts60mainappui.cpp | 1 - src/s60main/qts60mainappui.h | 3 +-- src/s60main/qts60maindocument.cpp | 1 - src/s60main/qts60maindocument.h | 1 - src/s60main/s60main.pro | 14 +++++++------- src/s60main/s60main.rss | 1 - 9 files changed, 8 insertions(+), 16 deletions(-) diff --git a/src/s60main/qts60main.cpp b/src/s60main/qts60main.cpp index c228c0d..67c20b7 100644 --- a/src/s60main/qts60main.cpp +++ b/src/s60main/qts60main.cpp @@ -60,4 +60,3 @@ GLDEF_C TInt E32Main() { return EikStart::RunApplication(NewApplication); } - diff --git a/src/s60main/qts60mainapplication.cpp b/src/s60main/qts60mainapplication.cpp index ed7ae22..9ad7f68 100644 --- a/src/s60main/qts60mainapplication.cpp +++ b/src/s60main/qts60mainapplication.cpp @@ -89,4 +89,3 @@ TFileName CQtS60MainApplication::ResourceFileName() const // End of File - diff --git a/src/s60main/qts60mainapplication.h b/src/s60main/qts60mainapplication.h index 70b6909..e178936 100644 --- a/src/s60main/qts60mainapplication.h +++ b/src/s60main/qts60mainapplication.h @@ -91,4 +91,3 @@ class CQtS60MainApplication : public CAknApplication #endif // __QtS60MainAPPLICATION_H__ // End of File - diff --git a/src/s60main/qts60mainappui.cpp b/src/s60main/qts60mainappui.cpp index ea6c3d4..ede96cb 100644 --- a/src/s60main/qts60mainappui.cpp +++ b/src/s60main/qts60mainappui.cpp @@ -211,4 +211,3 @@ void CQtS60MainAppUi::RestoreMenuL(CCoeControl* aMenuWindow, TInt aMenuId, TMenu } // End of File - diff --git a/src/s60main/qts60mainappui.h b/src/s60main/qts60mainappui.h index 6bdeb2e..cec0d98 100644 --- a/src/s60main/qts60mainappui.h +++ b/src/s60main/qts60mainappui.h @@ -96,7 +96,7 @@ class CQtS60MainAppUi : public CAknAppUi * @param aType event type. */ void HandleResourceChangeL(TInt aType); - + /** * HandleStatusPaneSizeChange. * Called by the framework when the application status pane @@ -133,4 +133,3 @@ class CQtS60MainAppUi : public CAknAppUi #endif // __QtS60MainAPPUI_H__ // End of File - diff --git a/src/s60main/qts60maindocument.cpp b/src/s60main/qts60maindocument.cpp index cdbb01d..77d5cc8 100644 --- a/src/s60main/qts60maindocument.cpp +++ b/src/s60main/qts60maindocument.cpp @@ -115,4 +115,3 @@ CEikAppUi* CQtS60MainDocument::CreateAppUiL() } // End of File - diff --git a/src/s60main/qts60maindocument.h b/src/s60main/qts60maindocument.h index a95e620..77c5aa7 100644 --- a/src/s60main/qts60maindocument.h +++ b/src/s60main/qts60maindocument.h @@ -120,4 +120,3 @@ class CQtS60MainDocument : public CAknDocument #endif // __QTS60MAINDOCUMENT_H__ // End of File - diff --git a/src/s60main/s60main.pro b/src/s60main/s60main.pro index f74943f..57c9949 100644 --- a/src/s60main/s60main.pro +++ b/src/s60main/s60main.pro @@ -9,7 +9,7 @@ CONFIG -= qt shared symbian { # Note: UID only needed for ensuring that no filename generation conflicts occur - TARGET.UID3 = 0x2001E61F + TARGET.UID3 = 0x2001E61F CONFIG += png zlib CONFIG -= jpeg INCLUDEPATH += tmp $$QMAKE_INCDIR_QT/QtCore $$MW_LAYER_SYSTEMINCLUDE @@ -21,8 +21,8 @@ symbian { HEADERS = qts60mainapplication.h \ qts60mainappui.h \ qts60maindocument.h - - # This block serves the minimalistic resource file for S60 3.1 platforms. + + # This block serves the minimalistic resource file for S60 3.1 platforms. # Note there is no way to ifdef S60 version in mmp file, that is why the resource # file is always compiled for WINSCW minimalAppResource31 = \ @@ -30,23 +30,23 @@ symbian { "HEADER" \ "TARGETPATH resource\apps" \ "END" - MMP_RULES += minimalAppResource31 + MMP_RULES += minimalAppResource31 # s60main needs to be built in ARM mode for GCCE to work. MMP_RULES+="ALWAYS_BUILD_AS_ARM" # staticlib should not have any lib depencies in s60 # This seems not to work, some hard coded libs are still added as dependency - LIBS = + LIBS = } else { error("$$_FILE_ is intended only for Symbian!") } symbian-abld: { # abld build commands generated resources after the static library is built, and - # we have dependency to resource from static lib -> resources need to be generated + # we have dependency to resource from static lib -> resources need to be generated # explicitly before library - rsgFix2.commands = "-$(DEL_FILE) $(EPOCROOT)Epoc32\Data\z\resource\apps\s60main.rsc >NUL 2>&1" + rsgFix2.commands = "-$(DEL_FILE) $(EPOCROOT)Epoc32\Data\z\resource\apps\s60main.rsc >NUL 2>&1" rsgFix.commands = "-$(ABLD) resource $(PLATFORM) $(CFG) 2>NUL" QMAKE_EXTRA_TARGETS += rsgFix rsgFix2 PRE_TARGETDEPS += rsgFix rsgFix2 diff --git a/src/s60main/s60main.rss b/src/s60main/s60main.rss index 6e8004c..11c68a3 100644 --- a/src/s60main/s60main.rss +++ b/src/s60main/s60main.rss @@ -83,4 +83,3 @@ RESOURCE MENU_PANE r_qt_wrapperapp_menu { } // End of File - -- cgit v0.12 From e6bb00250b321b149dd80259dc4f479088d5949b Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Tue, 4 Aug 2009 13:27:26 +0300 Subject: 'Trailing whitespace' fixes from s60installs --- src/s60installs/qt.iby | 2 +- src/s60installs/qt_libs.pro | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/s60installs/qt.iby b/src/s60installs/qt.iby index 8a0e03c..dc9ec43 100644 --- a/src/s60installs/qt.iby +++ b/src/s60installs/qt.iby @@ -5,7 +5,7 @@ // Dependancies for more than one module #include -#include // QtCore, QtGui, QtNetwork, QtOpenGL, QSvgIconEngine, +#include // QtCore, QtGui, QtNetwork, QtOpenGL, QSvgIconEngine, #include // QtGui, QtOpenGL #include // for std C++ support diff --git a/src/s60installs/qt_libs.pro b/src/s60installs/qt_libs.pro index 369a74e..cb03a05 100644 --- a/src/s60installs/qt_libs.pro +++ b/src/s60installs/qt_libs.pro @@ -9,10 +9,10 @@ symbian: { TARGET.UID3 = 0x2001E61C VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION} - qtresources.sources = $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/s60main.rsc + qtresources.sources = $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/s60main.rsc qtresources.path = $$APP_RESOURCE_DIR - qtlibraries.sources = \ + qtlibraries.sources = \ QtCore.dll \ QtXml.dll \ QtGui.dll \ @@ -23,21 +23,21 @@ symbian: { qts60plugin_3_1.dll \ qts60plugin_3_2.dll \ qts60plugin_5_0.dll - + # TODO: This should be conditional in PKG file, see commented code below # However we don't yet have such mechanism in place contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { - contains(CONFIG, system-sqlite): qtlibraries.sources += sqlite3.dll - } - + contains(CONFIG, system-sqlite): qtlibraries.sources += sqlite3.dll + } + #; EXISTS statement does not resolve !. Lets check the most common drives #IF NOT EXISTS("c:\sys\bin\sqlite3.dll") AND NOT EXISTS("e:\sys\bin\sqlite3.dll") AND NOT EXISTS("z:\sys\bin\sqlite3.dll") #"\Epoc32\release\armv5\UREL\sqlite3.dll"-"!:\sys\bin\sqlite3.dll" - #ENDIF + #ENDIF qtlibraries.path = /sys/bin - + vendorinfo = \ "; Localised Vendor name" \ "%{\"Nokia, Qt Software\"}" \ @@ -45,8 +45,8 @@ symbian: { "; Unique Vendor name" \ ":\"Nokia, Qt Software\"" \ " " - - + + qtlibraries.pkg_prerules = vendorinfo qtlibraries.pkg_prerules += "; Dependencies of Qt libraries" qtlibraries.pkg_prerules += "(0x20013851), 1, 5, 1, {\"PIPS Installer\"}" @@ -56,7 +56,7 @@ symbian: { contains(CONFIG, stl) { qtlibraries.pkg_prerules += "(0x2000F866), 1, 0, 0, {\"Standard C++ Library Common\"}" } - + !contains(QT_CONFIG, no-jpeg): imageformats_plugins.sources += qjpeg.dll !contains(QT_CONFIG, no-gif): imageformats_plugins.sources += qgif.dll !contains(QT_CONFIG, no-mng): imageformats_plugins.sources += qmng.dll @@ -66,10 +66,10 @@ symbian: { codecs_plugins.sources = qcncodecs.dll qjpcodecs.dll qtwcodecs.dll qkrcodecs.dll codecs_plugins.path = $$QT_PLUGINS_BASE_DIR/codecs - + DEPLOYMENT += qtresources qtlibraries imageformats_plugins codecs_plugins graphicssystems_plugins - contains(QT_CONFIG, svg): { + contains(QT_CONFIG, svg): { qtlibraries.sources += QtSvg.dll imageformats_plugins.sources += qsvg.dll iconengines_plugins.sources = qsvgicon.dll @@ -79,7 +79,7 @@ symbian: { contains(QT_CONFIG, phonon): { qtlibraries.sources += Phonon.dll - } + } graphicssystems_plugins.path = $$QT_PLUGINS_BASE_DIR/graphicssystems contains(QT_CONFIG, openvg) { -- cgit v0.12