diff options
-rw-r--r-- | mkspecs/common/symbian/symbian-mmp.conf | 15 | ||||
-rw-r--r-- | src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h | 4 | ||||
-rw-r--r-- | src/3rdparty/webkit/JavaScriptCore/wtf/Threading.h | 4 | ||||
-rw-r--r-- | src/gui/image/qimagereader.cpp | 2 | ||||
-rw-r--r-- | src/gui/itemviews/qabstractitemview.cpp | 2 | ||||
-rw-r--r-- | src/opengl/qgl.cpp | 11 | ||||
-rw-r--r-- | src/src.pro | 3 | ||||
-rw-r--r-- | tests/auto/qlistwidget/tst_qlistwidget.cpp | 31 | ||||
-rw-r--r-- | tools/runonphone/main.cpp | 48 | ||||
-rw-r--r-- | tools/runonphone/runonphone.pro | 3 | ||||
-rw-r--r-- | tools/runonphone/serenum_stub.cpp | 2 | ||||
-rw-r--r-- | tools/runonphone/serenum_unix.cpp | 71 | ||||
-rw-r--r-- | tools/runonphone/trksignalhandler.cpp | 30 |
13 files changed, 168 insertions, 58 deletions
diff --git a/mkspecs/common/symbian/symbian-mmp.conf b/mkspecs/common/symbian/symbian-mmp.conf index e54e878..507b60c 100644 --- a/mkspecs/common/symbian/symbian-mmp.conf +++ b/mkspecs/common/symbian/symbian-mmp.conf @@ -2,17 +2,18 @@ # qmake configuration for symbian-* # +include(symbian.conf) + contains(QMAKE_HOST.os, "Windows") { - QMAKE_MOC = $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}moc.exe - QMAKE_UIC = $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}uic.exe - QMAKE_IDC = $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}idc.exe + QMAKE_MOC = $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}moc.exe + QMAKE_UIC = $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}uic.exe + QMAKE_IDC = $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}idc.exe } else { - QMAKE_MOC = $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}moc - QMAKE_UIC = $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}uic - QMAKE_IDC = $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}idc + QMAKE_MOC = $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}moc + QMAKE_UIC = $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}uic + QMAKE_IDC = $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}idc } -include(symbian.conf) load(symbian/add_mmp_rules) symbian-abld { diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h index 1599562..5fb7fe3 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h @@ -75,7 +75,7 @@ #include <libkern/OSAtomic.h> #elif OS(ANDROID) #include <cutils/atomic.h> -#elif COMPILER(GCC) +#elif COMPILER(GCC) && !PLATFORM(SYMBIAN) #if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) #include <ext/atomicity.h> #else @@ -239,7 +239,7 @@ inline int atomicDecrement(int volatile* addend) { return OSAtomicDecrement32Bar inline int atomicIncrement(int volatile* addend) { return android_atomic_inc(addend); } inline int atomicDecrement(int volatile* addend) { return android_atomic_dec(addend); } -#elif COMPILER(GCC) && !CPU(SPARC64) // sizeof(_Atomic_word) != sizeof(int) on sparc64 gcc +#elif COMPILER(GCC) && !PLATFORM(SPARC64) && !PLATFORM(SYMBIAN) // sizeof(_Atomic_word) != sizeof(int) on sparc64 gcc #define WTF_USE_LOCKFREE_THREADSAFESHARED 1 inline int atomicIncrement(int volatile* addend) { return __gnu_cxx::__exchange_and_add(addend, 1) + 1; } diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.h index 71c9402..52a24f6 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.h @@ -73,7 +73,7 @@ #include <windows.h> #elif PLATFORM(DARWIN) #include <libkern/OSAtomic.h> -#elif COMPILER(GCC) +#elif COMPILER(GCC) && !PLATFORM(SYMBIAN) #if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) #include <ext/atomicity.h> #else @@ -232,7 +232,7 @@ inline int atomicDecrement(int volatile* addend) { return InterlockedDecrement(r inline int atomicIncrement(int volatile* addend) { return OSAtomicIncrement32Barrier(const_cast<int*>(addend)); } inline int atomicDecrement(int volatile* addend) { return OSAtomicDecrement32Barrier(const_cast<int*>(addend)); } -#elif COMPILER(GCC) && !PLATFORM(SPARC64) // sizeof(_Atomic_word) != sizeof(int) on sparc64 gcc +#elif COMPILER(GCC) && !PLATFORM(SPARC64) && !PLATFORM(SYMBIAN) // sizeof(_Atomic_word) != sizeof(int) on sparc64 gcc #define WTF_USE_LOCKFREE_THREADSAFESHARED 1 inline int atomicIncrement(int volatile* addend) { return __gnu_cxx::__exchange_and_add(addend, 1) + 1; } diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp index 9320cfc..27f9627 100644 --- a/src/gui/image/qimagereader.cpp +++ b/src/gui/image/qimagereader.cpp @@ -503,7 +503,7 @@ QImageReaderPrivate::~QImageReaderPrivate() bool QImageReaderPrivate::initHandler() { // check some preconditions - if (!device || (!deleteDevice && !device->isOpen())) { + if (!device || (!deleteDevice && !device->isOpen() && !device->open(QIODevice::ReadOnly))) { imageReaderError = QImageReader::DeviceError; errorString = QLatin1String(QT_TRANSLATE_NOOP(QImageReader, "Invalid device")); return false; diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index fc53ea3..7a1ea10 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -2091,7 +2091,7 @@ void QAbstractItemView::focusInEvent(QFocusEvent *event) bool autoScroll = d->autoScroll; d->autoScroll = false; QModelIndex index = moveCursor(MoveNext, Qt::NoModifier); // first visible index - if (index.isValid() && d->isIndexEnabled(index)) + if (index.isValid() && d->isIndexEnabled(index) && event->reason() != Qt::MouseFocusReason) selectionModel()->setCurrentIndex(index, QItemSelectionModel::NoUpdate); d->autoScroll = autoScroll; } diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 5908f14..7aba25a 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -2453,8 +2453,15 @@ QGLTexture *QGLContextPrivate::bindTexture(const QPixmap &pixmap, GLenum target, } #endif - if (!texture) - texture = bindTexture(pixmap.toImage(), target, format, key, options); + if (!texture) { + QImage image = pixmap.toImage(); + // If the system depth is 16 and the pixmap doesn't have an alpha channel + // then we convert it to RGB16 in the hope that it gets uploaded as a 16 + // bit texture which is much faster to access than a 32-bit one. + if (pixmap.depth() == 16 && !image.hasAlphaChannel() ) + image = image.convertToFormat(QImage::Format_RGB16); + texture = bindTexture(image, target, format, key, options); + } // NOTE: bindTexture(const QImage&, GLenum, GLint, const qint64, bool) should never return null Q_ASSERT(texture); diff --git a/src/src.pro b/src/src.pro index 0033942..c2ed59d 100644 --- a/src/src.pro +++ b/src/src.pro @@ -109,7 +109,8 @@ src_declarative.target = sub-declarative src_tools_idc.depends = src_corelib # target defined in tools.pro src_tools_uic3.depends = src_qt3support src_xml # target defined in tools.pro src_phonon.depends = src_gui - src_multimedia.depends = src_gui src_opengl + src_multimedia.depends = src_gui + contains(QT_CONFIG, opengl):src_multimedia.depends += src_opengl src_tools_activeqt.depends = src_tools_idc src_gui src_declarative.depends = src_xml src_gui src_script src_network src_svg src_plugins.depends = src_gui src_sql src_svg src_multimedia diff --git a/tests/auto/qlistwidget/tst_qlistwidget.cpp b/tests/auto/qlistwidget/tst_qlistwidget.cpp index b3f1e1e..eb3fb6b 100644 --- a/tests/auto/qlistwidget/tst_qlistwidget.cpp +++ b/tests/auto/qlistwidget/tst_qlistwidget.cpp @@ -132,6 +132,7 @@ private slots: void task199503_crashWhenCleared(); void task217070_scrollbarsAdjusted(); void task258949_keypressHangup(); + void QTBUG8086_currentItemChangedOnClick(); protected slots: @@ -1609,5 +1610,35 @@ void tst_QListWidget::task258949_keypressHangup() QCOMPARE(lw.currentIndex(), lw.model()->index(0,0)); } +void tst_QListWidget::QTBUG8086_currentItemChangedOnClick() +{ + qRegisterMetaType<QListWidgetItem*>("QListWidgetItem*"); + QWidget win; + QHBoxLayout layout(&win); + QListWidget list; + for (int i = 0 ; i < 4; ++i) + new QListWidgetItem(QString::number(i), &list); + + layout.addWidget(&list); + + QLineEdit edit; + layout.addWidget(&edit); + + edit.setFocus(); + win.show(); + + QSignalSpy spy(&list, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*))); + + QTest::qWaitForWindowShown(&win); + + QCOMPARE(spy.count(), 0); + + QTest::mouseClick(list.viewport(), Qt::LeftButton, 0, list.visualItemRect(list.item(2)).center()); + + QCOMPARE(spy.count(), 1); + +} + + QTEST_MAIN(tst_QListWidget) #include "tst_qlistwidget.moc" diff --git a/tools/runonphone/main.cpp b/tools/runonphone/main.cpp index 1a5cdee..af08777 100644 --- a/tools/runonphone/main.cpp +++ b/tools/runonphone/main.cpp @@ -44,9 +44,9 @@ #include <QStringList> #include <QScopedPointer> #include <QTimer> -#include "trkutils.h" -#include "trkdevice.h" -#include "launcher.h" +#include "symbianutils/trkutils.h" +#include "symbianutils/trkdevice.h" +#include "symbianutils/launcher.h" #include "trksignalhandler.h" #include "serenum.h" @@ -133,28 +133,28 @@ int main(int argc, char *argv[]) return 1; } - if(serialPortName.isEmpty()) { - if(loglevel > 0) + if (serialPortName.isEmpty()) { + if (loglevel > 0) outstream << "Detecting serial ports" << endl; - QList <SerialPortId> ports = enumerateSerialPorts(); - foreach(SerialPortId id, ports) { - if(loglevel > 0) + foreach (const SerialPortId &id, enumerateSerialPorts()) { + if (loglevel > 0) outstream << "Port Name: " << id.portName << ", " << "Friendly Name:" << id.friendlyName << endl; - if(serialPortName.isEmpty()) { - if(!id.friendlyName.isEmpty() && - serialPortFriendlyName.isEmpty() && - (id.friendlyName.contains("symbian", Qt::CaseInsensitive) || - id.friendlyName.contains("s60", Qt::CaseInsensitive) || - id.friendlyName.contains("nokia", Qt::CaseInsensitive))) - serialPortName = id.portName; - else if (!id.friendlyName.isEmpty() && - !serialPortFriendlyName.isEmpty() && - id.friendlyName.contains(serialPortFriendlyName)) - serialPortName = id.portName; + if (!id.friendlyName.isEmpty() + && serialPortFriendlyName.isEmpty() + && (id.friendlyName.contains("symbian", Qt::CaseInsensitive) + || id.friendlyName.contains("s60", Qt::CaseInsensitive) + || id.friendlyName.contains("nokia", Qt::CaseInsensitive))) { + serialPortName = id.portName; + break; + } else if (!id.friendlyName.isEmpty() + && !serialPortFriendlyName.isEmpty() + && id.friendlyName.contains(serialPortFriendlyName)) { + serialPortName = id.portName; + break; } } - if(serialPortName.isEmpty()) { + if (serialPortName.isEmpty()) { errstream << "No phone found, ensure USB cable is connected or specify manually with -p" << endl; return 1; } @@ -162,7 +162,7 @@ int main(int argc, char *argv[]) QScopedPointer<trk::Launcher> launcher; - if(sisFile.isEmpty()) { + if (sisFile.isEmpty()) { launcher.reset(new trk::Launcher(trk::Launcher::ActionCopyRun)); launcher->setCopyFileName(exeFile, QString("c:\\sys\\bin\\") + exeFile); errstream << "System TRK required to copy EXE, use --sis if using Application TRK" << endl; @@ -172,14 +172,14 @@ int main(int argc, char *argv[]) launcher->setCopyFileName(sisFile, "c:\\data\\testtemp.sis"); launcher->setInstallFileName("c:\\data\\testtemp.sis"); } - if(loglevel > 0) + if (loglevel > 0) outstream << "Connecting to target via " << serialPortName << endl; launcher->setTrkServerName(serialPortName); launcher->setFileName(QString("c:\\sys\\bin\\") + exeFile); launcher->setCommandLineArgs(cmdLine); - if(loglevel > 1) + if (loglevel > 1) launcher->setVerbose(1); TrkSignalHandler handler; @@ -212,7 +212,7 @@ int main(int argc, char *argv[]) } QString errorMessage; - if(!launcher->startServer(&errorMessage)) { + if (!launcher->startServer(&errorMessage)) { errstream << errorMessage << endl; return 1; } diff --git a/tools/runonphone/runonphone.pro b/tools/runonphone/runonphone.pro index 7bed3e5..0c63723 100644 --- a/tools/runonphone/runonphone.pro +++ b/tools/runonphone/runonphone.pro @@ -22,7 +22,10 @@ windows { } else:unix:!symbian { SOURCES += serenum_unix.cpp + LIBS += -lusb } else { SOURCES += serenum_stub.cpp } + + diff --git a/tools/runonphone/serenum_stub.cpp b/tools/runonphone/serenum_stub.cpp index f39765e..6f0e1ef 100644 --- a/tools/runonphone/serenum_stub.cpp +++ b/tools/runonphone/serenum_stub.cpp @@ -47,7 +47,7 @@ QList<SerialPortId> enumerateSerialPorts() { QList<SerialPortId> list; - qWarning() << "enumerateSerialPorts not implemented" << endl; + qWarning() << "enumerateSerialPorts not implemented"; return list; } diff --git a/tools/runonphone/serenum_unix.cpp b/tools/runonphone/serenum_unix.cpp index ca6c437..b6f0293 100644 --- a/tools/runonphone/serenum_unix.cpp +++ b/tools/runonphone/serenum_unix.cpp @@ -46,13 +46,80 @@ #include <QFileInfo> #include <QDir> +#include <usb.h> + QList<SerialPortId> enumerateSerialPorts() { + QList<QString> eligableInterfaces; QList<SerialPortId> list; + + usb_init(); + usb_find_busses(); + usb_find_devices(); + + for (struct usb_bus *bus = usb_get_busses(); bus; bus = bus->next) { + for (struct usb_device *device = bus->devices; device; device = device->next) { + for (int n = 0; n < device->descriptor.bNumConfigurations; ++n) { + struct usb_config_descriptor &usbConfig =device->config[n]; + QList<int> usableInterfaces; + for (int m = 0; m < usbConfig.bNumInterfaces; ++m) { + for (int o = 0; o < usbConfig.interface[m].num_altsetting; ++o) { + struct usb_interface_descriptor &descriptor = usbConfig.interface[m].altsetting[o]; + if (descriptor.bInterfaceClass != 2 // "Communication" + || descriptor.bInterfaceSubClass != 2 // Abstract (modem) + || descriptor.bInterfaceProtocol != 255) // Vendor Specific + continue; + + unsigned char *buf = descriptor.extra; + unsigned int size = descriptor.extralen; + while (size >= 2 * sizeof(u_int8_t)) { + // for Communication devices there is a slave interface for the actual + // data transmission. + // the extra info stores that as a index for the interface + if (buf[0] >= 5 && buf[1] == 36 && buf[2] == 6) { // CDC Union + for (int i = 4; i < buf[0]; i++) + usableInterfaces.append((int) buf[i]); + } + size -= buf[0]; + buf += buf[0]; + } + } + } + + // second loop to find the actual data interface. + foreach (int i, usableInterfaces) { + for (int m = 0; m < usbConfig.bNumInterfaces; ++m) { + for (int o = 0; o < usbConfig.interface[m].num_altsetting; ++o) { + struct usb_interface_descriptor &descriptor = usbConfig.interface[m].altsetting[o]; + if (descriptor.bInterfaceNumber != i) + continue; + if (descriptor.bInterfaceClass == 10) { // "CDC Data" + // qDebug() << " found the data port" + // << "bus:" << bus->dirname + // << "device" << device->filename + // << "interface" << descriptor.bInterfaceNumber; + eligableInterfaces << QString("if%1").arg(QString::number(i), 2, QChar('0')); // fix! + } + } + } + } + } + } + } + QDir dir("/dev/serial/by-id/"); - QFileInfoList ports(dir.entryInfoList()); - foreach(QFileInfo info, ports) { + foreach (const QFileInfo &info, dir.entryInfoList()) { if (!info.isDir()) { + bool usable = eligableInterfaces.isEmpty(); + foreach (const QString &iface, eligableInterfaces) { + if (info.fileName().contains(iface)) { + usable = true; + break; + } + } + if (!usable) + continue; + SerialPortId id; id.friendlyName = info.fileName(); id.portName = info.canonicalFilePath(); diff --git a/tools/runonphone/trksignalhandler.cpp b/tools/runonphone/trksignalhandler.cpp index 4fa79f1..9fe2035 100644 --- a/tools/runonphone/trksignalhandler.cpp +++ b/tools/runonphone/trksignalhandler.cpp @@ -58,13 +58,13 @@ private: void TrkSignalHandler::copyingStarted() { - if(d->loglevel > 0) + if (d->loglevel > 0) d->out << "Copying..." << endl; } void TrkSignalHandler::canNotConnect(const QString &errorMessage) { - d->err << "Cannot Connect - " << errorMessage << endl; + d->err << "Cannot connect - " << errorMessage << endl; } void TrkSignalHandler::canNotCreateFile(const QString &filename, const QString &errorMessage) @@ -84,7 +84,7 @@ void TrkSignalHandler::canNotCloseFile(const QString &filename, const QString &e void TrkSignalHandler::installingStarted() { - if(d->loglevel > 0) + if (d->loglevel > 0) d->out << "Installing..." << endl; } @@ -95,19 +95,19 @@ void TrkSignalHandler::canNotInstall(const QString &packageFilename, const QStri void TrkSignalHandler::installingFinished() { - if(d->loglevel > 0) + if (d->loglevel > 0) d->out << "Installing finished" << endl; } void TrkSignalHandler::startingApplication() { - if(d->loglevel > 0) + if (d->loglevel > 0) d->out << "Starting app..." << endl; } void TrkSignalHandler::applicationRunning(uint pid) { - if(d->loglevel > 0) + if (d->loglevel > 0) d->out << "Running..." << endl; } @@ -118,7 +118,7 @@ void TrkSignalHandler::canNotRun(const QString &errorMessage) void TrkSignalHandler::finished() { - if(d->loglevel > 0) + if (d->loglevel > 0) d->out << "Done." << endl; QCoreApplication::quit(); } @@ -130,17 +130,17 @@ void TrkSignalHandler::applicationOutputReceived(const QString &output) void TrkSignalHandler::copyProgress(int percent) { - if(d->loglevel > 0) { + if (d->loglevel > 0) { d->out << percent << "% "; d->out.flush(); - if(percent==100) + if (percent==100) d->out << endl; } } void TrkSignalHandler::stateChanged(int state) { - if(d->loglevel > 1) + if (d->loglevel > 1) d->out << "State" << state << endl; } @@ -164,10 +164,10 @@ void TrkSignalHandler::timeout() emit terminate(); } -TrkSignalHandlerPrivate::TrkSignalHandlerPrivate() : - out(stdout), - err(stderr), - loglevel(0) +TrkSignalHandlerPrivate::TrkSignalHandlerPrivate() + : out(stdout), + err(stderr), + loglevel(0) { } @@ -179,8 +179,8 @@ TrkSignalHandlerPrivate::~TrkSignalHandlerPrivate() } TrkSignalHandler::TrkSignalHandler() + : d(new TrkSignalHandlerPrivate()) { - d = new TrkSignalHandlerPrivate(); } TrkSignalHandler::~TrkSignalHandler() |