summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorJason Barron <jbarron@trolltech.com>2009-06-25 13:49:53 (GMT)
committerJason Barron <jbarron@trolltech.com>2009-06-25 13:49:53 (GMT)
commitdb8f05e257019694f5e8076845626008f2adc3dd (patch)
tree05d3959403cf15ac5f702091439e028af01f343b /src/plugins
parent8aafaa65a1d16f8b982279f5aceedf1e281ddb5a (diff)
parent796a5a2c7d8c91a46ac761dde18b7da2ec6c177b (diff)
downloadQt-db8f05e257019694f5e8076845626008f2adc3dd.zip
Qt-db8f05e257019694f5e8076845626008f2adc3dd.tar.gz
Qt-db8f05e257019694f5e8076845626008f2adc3dd.tar.bz2
Merge commit 'qt/master-stable' into 4.6-stable
Bring Qt 4.6 into the Qt-S60 repo. Conflicts: configure.exe mkspecs/features/qttest_p4.prf qmake/generators/makefile.cpp src/corelib/io/qdir.cpp src/corelib/io/qprocess.h src/corelib/kernel/qcoreevent.h src/corelib/kernel/qobject.cpp src/corelib/kernel/qsharedmemory_unix.cpp src/corelib/thread/qthread_p.h src/corelib/tools/qvector.h src/gui/dialogs/qdialog.cpp src/gui/dialogs/qfiledialog.cpp src/gui/dialogs/qfiledialog_p.h src/gui/dialogs/qmessagebox.cpp src/gui/graphicsview/qgraphicsitem.cpp src/gui/graphicsview/qgraphicsview.cpp src/gui/image/qpixmapcache.cpp src/gui/kernel/qapplication.cpp src/gui/kernel/qapplication_p.h src/gui/kernel/qwidget.cpp src/gui/kernel/qwidget_p.h src/gui/painting/qdrawhelper.cpp src/gui/painting/qpaintengine_raster.cpp src/gui/text/qfontengine_qpf.cpp src/gui/widgets/qmenubar.cpp src/network/socket/qlocalserver.cpp src/testlib/qtestcase.cpp src/testlib/testlib.pro tests/auto/qimagereader/tst_qimagereader.cpp tests/auto/qitemdelegate/tst_qitemdelegate.cpp tests/auto/qnetworkreply/tst_qnetworkreply.cpp tests/auto/qpixmap/qpixmap.pro
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/accessible/widgets/rangecontrols.cpp2
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp4
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp7
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp23
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.h4
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp17
-rw-r--r--src/plugins/gfxdrivers/hybrid/hybridscreen.cpp4
-rw-r--r--src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp2
-rw-r--r--src/plugins/gfxdrivers/vnc/qscreenvnc_qws.cpp4
-rw-r--r--src/plugins/imageformats/ico/qicohandler.cpp331
-rw-r--r--src/plugins/imageformats/jpeg/qjpeghandler.cpp3
-rw-r--r--src/plugins/imageformats/svg/qsvgiohandler.cpp35
-rw-r--r--src/plugins/imageformats/tiff/qtiffhandler.cpp332
-rw-r--r--src/plugins/kbddrivers/kbddrivers.pro3
-rw-r--r--src/plugins/kbddrivers/linuxinput/linuxinput.pro14
-rw-r--r--src/plugins/kbddrivers/linuxinput/main.cpp (renamed from src/plugins/kbddrivers/usb/main.cpp)22
-rw-r--r--src/plugins/kbddrivers/linuxis/README1
-rw-r--r--src/plugins/kbddrivers/linuxis/linuxis.pro11
-rw-r--r--src/plugins/kbddrivers/linuxis/linuxiskbddriverplugin.cpp87
-rw-r--r--src/plugins/kbddrivers/linuxis/linuxiskbddriverplugin.h58
-rw-r--r--src/plugins/kbddrivers/linuxis/linuxiskbdhandler.cpp171
-rw-r--r--src/plugins/kbddrivers/linuxis/linuxiskbdhandler.h80
-rw-r--r--src/plugins/kbddrivers/usb/usb.pro14
-rw-r--r--src/plugins/sqldrivers/odbc/odbc.pro8
24 files changed, 537 insertions, 700 deletions
diff --git a/src/plugins/accessible/widgets/rangecontrols.cpp b/src/plugins/accessible/widgets/rangecontrols.cpp
index 9297d6e..6d8c184 100644
--- a/src/plugins/accessible/widgets/rangecontrols.cpp
+++ b/src/plugins/accessible/widgets/rangecontrols.cpp
@@ -799,7 +799,7 @@ int QAccessibleSlider::defaultAction(int /*child*/) const
/*! \internal */
QString QAccessibleSlider::actionText(int /*action*/, Text /*t*/, int /*child*/) const
{
- return QString(QLatin1String(""));
+ return QLatin1String("");
}
QAccessibleAbstractSlider::QAccessibleAbstractSlider(QWidget *w, Role r)
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
index 2fb533a..5be4d47 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
@@ -532,7 +532,9 @@ void QDirectFBPaintEngine::drawImage(const QRectF &r, const QImage &image,
d->prepareForBlit(QDirectFBScreen::hasAlpha(imgSurface));
d->blit(r, imgSurface, sr);
if (release) {
+#if (Q_DIRECTFB_VERSION >= 0x010000)
imgSurface->ReleaseSource(imgSurface);
+#endif
imgSurface->Release(imgSurface);
}
#endif
@@ -897,7 +899,9 @@ void QDirectFBPaintEnginePrivate::end()
{
lockedMemory = 0;
dfbDevice = 0;
+#if (Q_DIRECTFB_VERSION >= 0x010000)
surface->ReleaseSource(surface);
+#endif
surface->SetClip(surface, NULL);
surface = 0;
}
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
index 18754f5..8184073 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
@@ -225,7 +225,9 @@ void QDirectFBPixmapData::copy(const QPixmapData *data, const QRect &rect)
const DFBRectangle blitRect = { rect.x(), rect.y(),
rect.width(), rect.height() };
DFBResult result = dfbSurface->Blit(dfbSurface, src, &blitRect, 0, 0);
+#if (Q_DIRECTFB_VERSION >= 0x010000)
dfbSurface->ReleaseSource(dfbSurface);
+#endif
if (result != DFB_OK) {
DirectFBError("QDirectFBPixmapData::copy()", result);
invalidate();
@@ -316,8 +318,9 @@ QPixmap QDirectFBPixmapData::transformed(const QTransform &transform,
const DFBRectangle destRect = { 0, 0, size.width(), size.height() };
data->dfbSurface->StretchBlit(data->dfbSurface, dfbSurface, 0, &destRect);
+#if (Q_DIRECTFB_VERSION >= 0x010000)
data->dfbSurface->ReleaseSource(data->dfbSurface);
-
+#endif
return QPixmap(data);
}
@@ -336,7 +339,9 @@ QImage QDirectFBPixmapData::toImage() const
imgSurface->SetBlittingFlags(imgSurface, DSBLIT_NOFX);
}
imgSurface->Blit(imgSurface, dfbSurface, 0, 0, 0);
+#if (Q_DIRECTFB_VERSION >= 0x010000)
imgSurface->ReleaseSource(imgSurface);
+#endif
imgSurface->Release(imgSurface);
return ret;
}
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
index 9e35a66..f694ed9 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
@@ -196,7 +196,9 @@ IDirectFBSurface *QDirectFBScreen::copyDFBSurface(IDirectFBSurface *src,
surface->SetBlittingFlags(surface, flags);
surface->Blit(surface, src, 0, 0, 0);
+#if (Q_DIRECTFB_VERSION >= 0x010000)
surface->ReleaseSource(surface);
+#endif
return surface;
}
@@ -317,7 +319,9 @@ IDirectFBSurface *QDirectFBScreen::copyToDFBSurface(const QImage &img,
DFBResult result = dfbSurface->Blit(dfbSurface, imgSurface, 0, 0, 0);
if (result != DFB_OK)
DirectFBError("QDirectFBScreen::copyToDFBSurface()", result);
+#if (Q_DIRECTFB_VERSION >= 0x010000)
dfbSurface->ReleaseSource(dfbSurface);
+#endif
imgSurface->Release(imgSurface);
#else // QT_NO_DIRECTFB_PREALLOCATED
Q_ASSERT(image.format() == pixmapFormat);
@@ -388,10 +392,12 @@ DFBSurfacePixelFormat QDirectFBScreen::getSurfacePixelFormat(QImage::Format form
#endif
case QImage::Format_RGB16:
return DSPF_RGB16;
+#if (Q_DIRECTFB_VERSION >= 0x010000)
case QImage::Format_ARGB6666_Premultiplied:
return DSPF_ARGB6666;
case QImage::Format_RGB666:
return DSPF_RGB18;
+#endif
case QImage::Format_RGB32:
return DSPF_RGB32;
case QImage::Format_ARGB32_Premultiplied:
@@ -423,10 +429,12 @@ QImage::Format QDirectFBScreen::getImageFormat(IDirectFBSurface *surface)
return QImage::Format_RGB555;
case DSPF_RGB16:
return QImage::Format_RGB16;
+#if (Q_DIRECTFB_VERSION >= 0x010000)
case DSPF_ARGB6666:
return QImage::Format_ARGB6666_Premultiplied;
case DSPF_RGB18:
return QImage::Format_RGB666;
+#endif
case DSPF_RGB32:
return QImage::Format_RGB32;
case DSPF_ARGB: {
@@ -778,9 +786,13 @@ static const FlagDescription blitDescriptions[] = {
{ " DSBLIT_DST_PREMULTIPLY", DSBLIT_DST_PREMULTIPLY },
{ " DSBLIT_DEMULTIPLY", DSBLIT_DEMULTIPLY },
{ " DSBLIT_DEINTERLACE", DSBLIT_DEINTERLACE },
+#if (Q_DIRECTFB_VERSION >= 0x000923)
{ " DSBLIT_SRC_PREMULTCOLOR", DSBLIT_SRC_PREMULTCOLOR },
{ " DSBLIT_XOR", DSBLIT_XOR },
+#endif
+#if (Q_DIRECTFB_VERSION >= 0x010000)
{ " DSBLIT_INDEX_TRANSLATION", DSBLIT_INDEX_TRANSLATION },
+#endif
{ 0, 0 }
};
@@ -798,6 +810,7 @@ static const FlagDescription drawDescriptions[] = {
+#if (Q_DIRECTFB_VERSION >= 0x000923)
static const QByteArray flagDescriptions(uint mask, const FlagDescription *flags)
{
#ifdef QT_NO_DEBUG
@@ -818,9 +831,6 @@ static const QByteArray flagDescriptions(uint mask, const FlagDescription *flags
return (QLatin1Char(' ') + list.join(QLatin1String("|"))).toLatin1();
#endif
}
-
-
-
static void printDirectFBInfo(IDirectFB *fb, IDirectFBSurface *primarySurface)
{
DFBResult result;
@@ -845,6 +855,7 @@ static void printDirectFBInfo(IDirectFB *fb, IDirectFBSurface *primarySurface)
dev.drawing_flags, ::flagDescriptions(dev.drawing_flags, drawDescriptions).constData(),
(dev.video_memory >> 10));
}
+#endif
static inline bool setIntOption(const QStringList &arguments, const QString &variable, int *value)
{
@@ -1039,8 +1050,10 @@ bool QDirectFBScreen::connect(const QString &displaySpec)
setGraphicsSystem(d_ptr);
+#if (Q_DIRECTFB_VERSION >= 0x000923)
if (displayArgs.contains(QLatin1String("debug"), Qt::CaseInsensitive))
printDirectFBInfo(d_ptr->dfb, d_ptr->dfbSurface);
+#endif
return true;
}
@@ -1223,7 +1236,9 @@ void QDirectFBScreen::compose(const QRegion &region)
blit(surface->image(), offset, r);
}
}
+#if (Q_DIRECTFB_VERSION >= 0x010000)
d_ptr->dfbSurface->ReleaseSource(d_ptr->dfbSurface);
+#endif
}
// Normally, when using DirectFB to compose the windows (I.e. when
@@ -1271,7 +1286,9 @@ void QDirectFBScreen::blit(const QImage &img, const QPoint &topLeft,
return;
}
blit(src, topLeft, reg);
+#if (Q_DIRECTFB_VERSION >= 0x010000)
d_ptr->dfbSurface->ReleaseSource(d_ptr->dfbSurface);
+#endif
src->Release(src);
}
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
index 84199a2..c105590 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
@@ -177,11 +177,15 @@ inline bool QDirectFBScreen::hasAlpha(DFBSurfacePixelFormat format)
case DSPF_A1:
case DSPF_ARGB2554:
case DSPF_ARGB4444:
+#if (Q_DIRECTFB_VERSION >= 0x000923)
case DSPF_AYUV:
+#endif
+#if (Q_DIRECTFB_VERSION >= 0x010000)
case DSPF_A4:
case DSPF_ARGB1666:
case DSPF_ARGB6666:
case DSPF_LUT2:
+#endif
return true;
default:
return false;
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
index 330eb88..442f8dd 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
@@ -188,14 +188,25 @@ void QDirectFBWindowSurface::setGeometry(const QRect &rect, const QRegion &mask)
if (!dfbWindow)
createWindow();
- if (isResize && isMove)
+#if (Q_DIRECTFB_VERSION >= 0x010000)
+ if (isResize && isMove) {
result = dfbWindow->SetBounds(dfbWindow, rect.x(), rect.y(),
rect.width(), rect.height());
- else if (isResize)
+ } else if (isResize) {
result = dfbWindow->Resize(dfbWindow,
rect.width(), rect.height());
- else if (isMove)
+ } else if (isMove) {
result = dfbWindow->MoveTo(dfbWindow, rect.x(), rect.y());
+ }
+#else
+ if (isResize) {
+ result = dfbWindow->Resize(dfbWindow,
+ rect.width(), rect.height());
+ }
+ if (isMove) {
+ result = dfbWindow->MoveTo(dfbWindow, rect.x(), rect.y());
+ }
+#endif
#endif
}
diff --git a/src/plugins/gfxdrivers/hybrid/hybridscreen.cpp b/src/plugins/gfxdrivers/hybrid/hybridscreen.cpp
index 3a40b4c..da61a22 100644
--- a/src/plugins/gfxdrivers/hybrid/hybridscreen.cpp
+++ b/src/plugins/gfxdrivers/hybrid/hybridscreen.cpp
@@ -103,11 +103,11 @@ bool HybridScreen::connect(const QString &displaySpec)
{
QString dspec = displaySpec;
if (dspec.startsWith(QLatin1String("hybrid:"), Qt::CaseInsensitive))
- dspec = dspec.mid(QString(QLatin1String("hybrid:")).size());
+ dspec = dspec.mid(QString::fromLatin1("hybrid:").size());
else if (dspec.compare(QLatin1String("hybrid"), Qt::CaseInsensitive) == 0)
dspec = QString();
- const QString displayIdSpec = QString(QLatin1String(" :%1")).arg(displayId);
+ const QString displayIdSpec = QString::fromLatin1(" :%1").arg(displayId);
if (dspec.endsWith(displayIdSpec))
dspec = dspec.left(dspec.size() - displayIdSpec.size());
diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp
index b0ffbf1..65efdbc 100644
--- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp
+++ b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp
@@ -104,7 +104,7 @@ bool PvrEglScreen::connect(const QString &displaySpec)
break;
case PVR2D_ARGB8888:
d = 32;
- setPixelFormat(QImage::Format_ARGB32);
+ setPixelFormat(QImage::Format_ARGB32_Premultiplied);
break;
default:
pvrQwsDisplayClose();
diff --git a/src/plugins/gfxdrivers/vnc/qscreenvnc_qws.cpp b/src/plugins/gfxdrivers/vnc/qscreenvnc_qws.cpp
index b7f03ba..8be3672 100644
--- a/src/plugins/gfxdrivers/vnc/qscreenvnc_qws.cpp
+++ b/src/plugins/gfxdrivers/vnc/qscreenvnc_qws.cpp
@@ -2100,11 +2100,11 @@ bool QVNCScreen::connect(const QString &displaySpec)
{
QString dspec = displaySpec;
if (dspec.startsWith(QLatin1String("vnc:"), Qt::CaseInsensitive))
- dspec = dspec.mid(QString(QLatin1String("vnc:")).size());
+ dspec = dspec.mid(QString::fromLatin1("vnc:").size());
else if (dspec.compare(QLatin1String("vnc"), Qt::CaseInsensitive) == 0)
dspec = QString();
- const QString displayIdSpec = QString(QLatin1String(" :%1")).arg(displayId);
+ const QString displayIdSpec = QString::fromLatin1(" :%1").arg(displayId);
if (dspec.endsWith(displayIdSpec))
dspec = dspec.left(dspec.size() - displayIdSpec.size());
diff --git a/src/plugins/imageformats/ico/qicohandler.cpp b/src/plugins/imageformats/ico/qicohandler.cpp
index 299190b..da5ae15 100644
--- a/src/plugins/imageformats/ico/qicohandler.cpp
+++ b/src/plugins/imageformats/ico/qicohandler.cpp
@@ -57,38 +57,38 @@
// in an ICO file.
typedef struct
{
- quint8 bWidth; // Width of the image
- quint8 bHeight; // Height of the image (times 2)
- quint8 bColorCount; // Number of colors in image (0 if >=8bpp) [ not ture ]
- quint8 bReserved; // Reserved
- quint16 wPlanes; // Color Planes
- quint16 wBitCount; // Bits per pixel
- quint32 dwBytesInRes; // how many bytes in this resource?
- quint32 dwImageOffset; // where in the file is this image
+ quint8 bWidth; // Width of the image
+ quint8 bHeight; // Height of the image (times 2)
+ quint8 bColorCount; // Number of colors in image (0 if >=8bpp) [ not ture ]
+ quint8 bReserved; // Reserved
+ quint16 wPlanes; // Color Planes
+ quint16 wBitCount; // Bits per pixel
+ quint32 dwBytesInRes; // how many bytes in this resource?
+ quint32 dwImageOffset; // where in the file is this image
} ICONDIRENTRY, *LPICONDIRENTRY;
#define ICONDIRENTRY_SIZE 16
typedef struct
{
- quint16 idReserved; // Reserved
- quint16 idType; // resource type (1 for icons)
- quint16 idCount; // how many images?
- ICONDIRENTRY idEntries[1]; // the entries for each image
+ quint16 idReserved; // Reserved
+ quint16 idType; // resource type (1 for icons)
+ quint16 idCount; // how many images?
+ ICONDIRENTRY idEntries[1]; // the entries for each image
} ICONDIR, *LPICONDIR;
#define ICONDIR_SIZE 6 // Exclude the idEntries field
-typedef struct { // BMP information header
- quint32 biSize; // size of this struct
- quint32 biWidth; // pixmap width
- quint32 biHeight; // pixmap height
- quint16 biPlanes; // should be 1
- quint16 biBitCount; // number of bits per pixel
- quint32 biCompression; // compression method
- quint32 biSizeImage; // size of image
- quint32 biXPelsPerMeter; // horizontal resolution
- quint32 biYPelsPerMeter; // vertical resolution
- quint32 biClrUsed; // number of colors used
- quint32 biClrImportant; // number of important colors
+typedef struct { // BMP information header
+ quint32 biSize; // size of this struct
+ quint32 biWidth; // pixmap width
+ quint32 biHeight; // pixmap height (specifies the combined height of the XOR and AND masks)
+ quint16 biPlanes; // should be 1
+ quint16 biBitCount; // number of bits per pixel
+ quint32 biCompression; // compression method
+ quint32 biSizeImage; // size of image
+ quint32 biXPelsPerMeter; // horizontal resolution
+ quint32 biYPelsPerMeter; // vertical resolution
+ quint32 biClrUsed; // number of colors used
+ quint32 biClrImportant; // number of important colors
} BMP_INFOHDR ,*LPBMP_INFOHDR;
#define BMP_INFOHDR_SIZE 40
@@ -108,7 +108,7 @@ private:
bool readHeader();
bool readIconEntry(int index, ICONDIRENTRY * iconEntry);
- bool readBMPHeader(ICONDIRENTRY & iconEntry, BMP_INFOHDR * header);
+ bool readBMPHeader(quint32 imageOffset, BMP_INFOHDR * header);
void findColorInfo(QImage & image);
void readColorTable(QImage & image);
@@ -254,7 +254,7 @@ ICOReader::ICOReader(QIODevice * iodevice)
int ICOReader::count()
{
if (readHeader())
- return iconDir.idCount;
+ return iconDir.idCount;
return 0;
}
@@ -268,17 +268,17 @@ bool ICOReader::canRead(QIODevice *iodev)
if (readIconDir(iodev, &ikonDir)) {
qint64 readBytes = ICONDIR_SIZE;
if (readIconDirEntry(iodev, &ikonDir.idEntries[0])) {
- readBytes += ICONDIRENTRY_SIZE;
- // ICO format does not have a magic identifier, so we read 6 different values, which will hopefully be enough to identify the file.
- if ( ikonDir.idReserved == 0
- && ikonDir.idType == 1
- && ikonDir.idEntries[0].bReserved == 0
- && ikonDir.idEntries[0].wPlanes <= 1
- && ikonDir.idEntries[0].wBitCount <= 32 // Bits per pixel
- && ikonDir.idEntries[0].dwBytesInRes >= 40 // Must be over 40, since sizeof (infoheader) == 40
- ) {
- isProbablyICO = true;
- }
+ readBytes += ICONDIRENTRY_SIZE;
+ // ICO format does not have a magic identifier, so we read 6 different values, which will hopefully be enough to identify the file.
+ if ( ikonDir.idReserved == 0
+ && ikonDir.idType == 1
+ && ikonDir.idEntries[0].bReserved == 0
+ && ikonDir.idEntries[0].wPlanes <= 1
+ && ikonDir.idEntries[0].wBitCount <= 32 // Bits per pixel
+ && ikonDir.idEntries[0].dwBytesInRes >= 40 // Must be over 40, since sizeof (infoheader) == 40
+ ) {
+ isProbablyICO = true;
+ }
if (iodev->isSequential()) {
// Our structs might be padded due to alignment, so we need to fetch each member before we ungetChar() !
@@ -323,8 +323,7 @@ bool ICOReader::canRead(QIODevice *iodev)
iodev->ungetChar((tmp >> 8) & 0xff);
iodev->ungetChar(tmp & 0xff);
}
-
- }
+ }
if (!iodev->isSequential()) iodev->seek(oldPos);
}
@@ -334,21 +333,21 @@ bool ICOReader::canRead(QIODevice *iodev)
bool ICOReader::readHeader()
{
if (iod && !headerRead) {
- startpos = iod->pos();
- if (readIconDir(iod, &iconDir)) {
- if (iconDir.idReserved == 0 || iconDir.idType == 1)
- headerRead = true;
- }
+ startpos = iod->pos();
+ if (readIconDir(iod, &iconDir)) {
+ if (iconDir.idReserved == 0 || iconDir.idType == 1)
+ headerRead = true;
+ }
}
return headerRead;
}
-bool ICOReader::readIconEntry(int index, ICONDIRENTRY * iconEntry)
+bool ICOReader::readIconEntry(int index, ICONDIRENTRY *iconEntry)
{
if (iod) {
- if (iod->seek(startpos + ICONDIR_SIZE + (index * ICONDIRENTRY_SIZE))) {
- return readIconDirEntry(iod, iconEntry);
+ if (iod->seek(startpos + ICONDIR_SIZE + (index * ICONDIRENTRY_SIZE))) {
+ return readIconDirEntry(iod, iconEntry);
}
}
return false;
@@ -356,49 +355,24 @@ bool ICOReader::readIconEntry(int index, ICONDIRENTRY * iconEntry)
-bool ICOReader::readBMPHeader(ICONDIRENTRY & iconEntry, BMP_INFOHDR * header)
+bool ICOReader::readBMPHeader(quint32 imageOffset, BMP_INFOHDR * header)
{
- memset(&icoAttrib, 0, sizeof(IcoAttrib));
if (iod) {
- if (iod->seek(startpos + iconEntry.dwImageOffset)) {
- if (readBMPInfoHeader(iod, header)) {
-
- icoAttrib.nbits = header->biBitCount ? header->biBitCount : iconEntry.wBitCount;
- icoAttrib.h = header->biHeight / 2; // this height is always double the iconEntry height (for the mask)
- icoAttrib.w = header->biWidth;
-
- switch (icoAttrib.nbits) {
- case 32:
- case 24:
- case 16:
- icoAttrib.depth = 32;
- break;
- case 8:
- case 4:
- icoAttrib.depth = 8;
- break;
- default:
- icoAttrib.depth = 1;
- }
-
- if ( icoAttrib.depth == 32 ) // there's no colormap
- icoAttrib.ncolors = 0;
- else // # colors used
- icoAttrib.ncolors = header->biClrUsed ? header->biClrUsed : 1 << icoAttrib.nbits;
- //qDebug() << "Bits:" << icoAttrib.nbits << "Depth:" << icoAttrib.depth << "Ncols:" << icoAttrib.ncolors;
- return TRUE;
- }
- }
+ if (iod->seek(startpos + imageOffset)) {
+ if (readBMPInfoHeader(iod, header)) {
+ return TRUE;
+ }
+ }
}
return FALSE;
}
void ICOReader::findColorInfo(QImage & image)
{
- if (icoAttrib.ncolors > 0) { // set color table
- readColorTable(image);
+ if (icoAttrib.ncolors > 0) { // set color table
+ readColorTable(image);
} else if (icoAttrib.nbits == 16) { // don't support RGB values for 15/16 bpp
- image = QImage();
+ image = QImage();
}
}
@@ -406,29 +380,29 @@ void ICOReader::readColorTable(QImage & image)
{
if (iod) {
image.setNumColors(icoAttrib.ncolors);
- uchar rgb[4];
- for (int i=0; i<icoAttrib.ncolors; i++) {
- if (iod->read((char*)rgb, 4) != 4) {
- image = QImage();
- break;
- }
- image.setColor(i, qRgb(rgb[2],rgb[1],rgb[0]));
- }
+ uchar rgb[4];
+ for (int i=0; i<icoAttrib.ncolors; i++) {
+ if (iod->read((char*)rgb, 4) != 4) {
+ image = QImage();
+ break;
+ }
+ image.setColor(i, qRgb(rgb[2],rgb[1],rgb[0]));
+ }
} else {
- image = QImage();
+ image = QImage();
}
}
void ICOReader::readBMP(QImage & image)
{
- if (icoAttrib.nbits == 1) { // 1 bit BMP image
- read1BitBMP(image);
- } else if (icoAttrib.nbits == 4) { // 4 bit BMP image
- read4BitBMP(image);
+ if (icoAttrib.nbits == 1) { // 1 bit BMP image
+ read1BitBMP(image);
+ } else if (icoAttrib.nbits == 4) { // 4 bit BMP image
+ read4BitBMP(image);
} else if (icoAttrib.nbits == 8) {
- read8BitBMP(image);
+ read8BitBMP(image);
} else if (icoAttrib.nbits == 16 || icoAttrib.nbits == 24 || icoAttrib.nbits == 32 ) { // 16,24,32 bit BMP image
- read16_24_32BMP(image);
+ read16_24_32BMP(image);
}
}
@@ -442,17 +416,17 @@ void ICOReader::read1BitBMP(QImage & image)
{
if (iod) {
- int h = image.height();
- int bpl = image.bytesPerLine();
+ int h = image.height();
+ int bpl = image.bytesPerLine();
- while (--h >= 0) {
- if (iod->read((char*)image.scanLine(h),bpl) != bpl) {
- image = QImage();
- break;
- }
- }
+ while (--h >= 0) {
+ if (iod->read((char*)image.scanLine(h),bpl) != bpl) {
+ image = QImage();
+ break;
+ }
+ }
} else {
- image = QImage();
+ image = QImage();
}
}
@@ -460,30 +434,30 @@ void ICOReader::read4BitBMP(QImage & image)
{
if (iod) {
- int h = icoAttrib.h;
- int buflen = ((icoAttrib.w+7)/8)*4;
- uchar *buf = new uchar[buflen];
- Q_CHECK_PTR(buf);
-
- while (--h >= 0) {
- if (iod->read((char*)buf,buflen) != buflen) {
- image = QImage();
- break;
- }
- register uchar *p = image.scanLine(h);
- uchar *b = buf;
- for (int i=0; i<icoAttrib.w/2; i++) { // convert nibbles to bytes
- *p++ = *b >> 4;
- *p++ = *b++ & 0x0f;
- }
- if (icoAttrib.w & 1) // the last nibble
- *p = *b >> 4;
- }
-
- delete [] buf;
+ int h = icoAttrib.h;
+ int buflen = ((icoAttrib.w+7)/8)*4;
+ uchar *buf = new uchar[buflen];
+ Q_CHECK_PTR(buf);
+
+ while (--h >= 0) {
+ if (iod->read((char*)buf,buflen) != buflen) {
+ image = QImage();
+ break;
+ }
+ register uchar *p = image.scanLine(h);
+ uchar *b = buf;
+ for (int i=0; i<icoAttrib.w/2; i++) { // convert nibbles to bytes
+ *p++ = *b >> 4;
+ *p++ = *b++ & 0x0f;
+ }
+ if (icoAttrib.w & 1) // the last nibble
+ *p = *b >> 4;
+ }
+
+ delete [] buf;
} else {
- image = QImage();
+ image = QImage();
}
}
@@ -491,52 +465,51 @@ void ICOReader::read8BitBMP(QImage & image)
{
if (iod) {
- int h = icoAttrib.h;
- int bpl = image.bytesPerLine();
+ int h = icoAttrib.h;
+ int bpl = image.bytesPerLine();
- while (--h >= 0) {
- if (iod->read((char *)image.scanLine(h), bpl) != bpl) {
- image = QImage();
- break;
- }
- }
+ while (--h >= 0) {
+ if (iod->read((char *)image.scanLine(h), bpl) != bpl) {
+ image = QImage();
+ break;
+ }
+ }
} else {
- image = QImage();
+ image = QImage();
}
}
void ICOReader::read16_24_32BMP(QImage & image)
{
if (iod) {
-
- int h = icoAttrib.h;
- register QRgb *p;
- QRgb *end;
- uchar *buf = new uchar[image.bytesPerLine()];
- int bpl = ((icoAttrib.w*icoAttrib.nbits+31)/32)*4;
- uchar *b;
-
- while (--h >= 0) {
- p = (QRgb *)image.scanLine(h);
- end = p + icoAttrib.w;
- if (iod->read((char *)buf, bpl) != bpl) {
- image = QImage();
- break;
- }
- b = buf;
- while (p < end) {
+ int h = icoAttrib.h;
+ register QRgb *p;
+ QRgb *end;
+ uchar *buf = new uchar[image.bytesPerLine()];
+ int bpl = ((icoAttrib.w*icoAttrib.nbits+31)/32)*4;
+ uchar *b;
+
+ while (--h >= 0) {
+ p = (QRgb *)image.scanLine(h);
+ end = p + icoAttrib.w;
+ if (iod->read((char *)buf, bpl) != bpl) {
+ image = QImage();
+ break;
+ }
+ b = buf;
+ while (p < end) {
if (icoAttrib.nbits == 24)
*p++ = qRgb(*(b+2), *(b+1), *b);
else if (icoAttrib.nbits == 32)
*p++ = qRgba(*(b+2), *(b+1), *b, *(b+3));
- b += icoAttrib.nbits/8;
- }
- }
+ b += icoAttrib.nbits/8;
+ }
+ }
- delete[] buf;
+ delete[] buf;
} else {
- image = QImage();
+ image = QImage();
}
}
@@ -550,7 +523,28 @@ QImage ICOReader::iconAt(int index)
if (readIconEntry(index, &iconEntry)) {
BMP_INFOHDR header;
- if (readBMPHeader(iconEntry, &header)) {
+ if (readBMPHeader(iconEntry.dwImageOffset, &header)) {
+ icoAttrib.nbits = header.biBitCount ? header.biBitCount : iconEntry.wBitCount;
+
+ switch (icoAttrib.nbits) {
+ case 32:
+ case 24:
+ case 16:
+ icoAttrib.depth = 32;
+ break;
+ case 8:
+ case 4:
+ icoAttrib.depth = 8;
+ break;
+ default:
+ icoAttrib.depth = 1;
+ }
+ if (icoAttrib.depth == 32) // there's no colormap
+ icoAttrib.ncolors = 0;
+ else // # colors used
+ icoAttrib.ncolors = header.biClrUsed ? header.biClrUsed : 1 << icoAttrib.nbits;
+ icoAttrib.w = iconEntry.bWidth;
+ icoAttrib.h = iconEntry.bHeight;
QImage::Format format = QImage::Format_ARGB32;
if (icoAttrib.nbits == 24)
@@ -605,8 +599,8 @@ QList<QImage> ICOReader::read(QIODevice * device)
QList<QImage> images;
ICOReader reader(device);
- for (int i=0; i<reader.count(); i++)
- images += reader.iconAt(i);
+ for (int i = 0; i < reader.count(); i++)
+ images += reader.iconAt(i);
return images;
}
@@ -659,8 +653,8 @@ bool ICOReader::write(QIODevice * device, const QList<QImage> & images)
}
maskImage = maskImage.convertToFormat(QImage::Format_Mono);
- int nbits = 32;
- int bpl_bmp = ((image.width()*nbits+31)/32)*4;
+ int nbits = 32;
+ int bpl_bmp = ((image.width()*nbits+31)/32)*4;
entries[i].bColorCount = 0;
entries[i].bReserved = 0;
@@ -670,7 +664,7 @@ bool ICOReader::write(QIODevice * device, const QList<QImage> & images)
entries[i].dwBytesInRes = BMP_INFOHDR_SIZE + (bpl_bmp * image.height())
+ (maskImage.bytesPerLine() * maskImage.height());
entries[i].wPlanes = 1;
- if (i==0)
+ if (i == 0)
entries[i].dwImageOffset = origOffset + ICONDIR_SIZE
+ (id.idCount * ICONDIRENTRY_SIZE);
else
@@ -695,7 +689,7 @@ bool ICOReader::write(QIODevice * device, const QList<QImage> & images)
uchar *b;
memset( buf, 0, bpl_bmp );
int y;
- for (y=image.height()-1; y>=0; y--) { // write the image bits
+ for (y = image.height() - 1; y >= 0; y--) { // write the image bits
// 32 bits
QRgb *p = (QRgb *)image.scanLine(y);
QRgb *end = p + image.width();
@@ -717,13 +711,10 @@ bool ICOReader::write(QIODevice * device, const QList<QImage> & images)
maskImage.invertPixels(); // seems as though it needs this
// NOTE! !! The mask is only flipped vertically - not horizontally !!
- for (y=maskImage.height()-1; y>=0; y--)
+ for (y = maskImage.height() - 1; y >= 0; y--)
buffer.write((char*)maskImage.scanLine(y), maskImage.bytesPerLine());
-
}
-
-
if (writeIconDir(device, id)) {
int i;
bool bOK = true;
@@ -731,7 +722,7 @@ bool ICOReader::write(QIODevice * device, const QList<QImage> & images)
bOK = writeIconDirEntry(device, entries[i]);
}
if (bOK) {
- for (i=0; i<id.idCount && bOK; i++) {
+ for (i = 0; i < id.idCount && bOK; i++) {
bOK = writeBMPInfoHeader(device, bmpHeaders[i]);
bOK &= (device->write(imageData[i]) == (int) imageData[i].size());
}
diff --git a/src/plugins/imageformats/jpeg/qjpeghandler.cpp b/src/plugins/imageformats/jpeg/qjpeghandler.cpp
index 6d0bc1f..088ef97 100644
--- a/src/plugins/imageformats/jpeg/qjpeghandler.cpp
+++ b/src/plugins/imageformats/jpeg/qjpeghandler.cpp
@@ -781,7 +781,8 @@ static bool read_jpeg_image(QIODevice *device, QImage *outImage,
#ifndef QT_NO_IMAGE_SMOOTHSCALE
// If high quality not required, shrink image during decompression
- if (scaledSize.isValid() && quality < HIGH_QUALITY_THRESHOLD && !params.contains(QLatin1String("GetHeaderInformation")) ) {
+ if (scaledSize.isValid() && !scaledSize.isEmpty() && quality < HIGH_QUALITY_THRESHOLD
+ && !params.contains(QLatin1String("GetHeaderInformation")) ) {
cinfo.scale_denom = qMin(cinfo.image_width / scaledSize.width(),
cinfo.image_width / scaledSize.height());
if (cinfo.scale_denom < 2) {
diff --git a/src/plugins/imageformats/svg/qsvgiohandler.cpp b/src/plugins/imageformats/svg/qsvgiohandler.cpp
index 41b247b..405a760 100644
--- a/src/plugins/imageformats/svg/qsvgiohandler.cpp
+++ b/src/plugins/imageformats/svg/qsvgiohandler.cpp
@@ -64,6 +64,7 @@ public:
}
bool load(QIODevice *device);
+ static bool findSvgTag(QIODevice *device);
QSvgRenderer *r;
QSize defaultSize;
@@ -86,6 +87,33 @@ bool QSvgIOHandlerPrivate::load(QIODevice *device)
return loaded;
}
+bool QSvgIOHandlerPrivate::findSvgTag(QIODevice *device)
+{
+ qint64 pos = device->pos();
+ device->seek(0);
+ char buffer[256];
+ const char svg_tag[] = "<svg";
+
+ while (1) {
+ int size = device->read(buffer, 256);
+ for (int i=0; i<size - 5; ++i) {
+ if (!memcmp(buffer + i, svg_tag, 4)) {
+ if (buffer[i+4] == ' ' || buffer[i+4] == '\t'
+ || buffer[i+4] == '\n' || buffer[i+4] == '\r')
+ {
+ device->seek(pos);
+ return true;
+ }
+ }
+ }
+ if (device->atEnd())
+ break;
+ device->seek(device->pos()-4);
+ }
+ device->seek(pos);
+ return false;
+}
+
QSvgIOHandler::QSvgIOHandler()
: d(new QSvgIOHandlerPrivate())
{
@@ -101,9 +129,7 @@ QSvgIOHandler::~QSvgIOHandler()
bool QSvgIOHandler::canRead() const
{
- QByteArray contents = device()->peek(80);
-
- return contents.contains("<svg");
+ return QSvgIOHandlerPrivate::findSvgTag(device());
}
@@ -182,8 +208,7 @@ bool QSvgIOHandler::supportsOption(ImageOption option) const
bool QSvgIOHandler::canRead(QIODevice *device)
{
- QByteArray contents = device->peek(80);
- return contents.contains("<svg");
+ return QSvgIOHandlerPrivate::findSvgTag(device);
}
QT_END_NAMESPACE
diff --git a/src/plugins/imageformats/tiff/qtiffhandler.cpp b/src/plugins/imageformats/tiff/qtiffhandler.cpp
index 518e6d1..791aeaa 100644
--- a/src/plugins/imageformats/tiff/qtiffhandler.cpp
+++ b/src/plugins/imageformats/tiff/qtiffhandler.cpp
@@ -131,58 +131,138 @@ bool QTiffHandler::read(QImage *image)
if (!canRead())
return false;
- TIFF *tiff = TIFFClientOpen("foo",
- "r",
- this,
- qtiffReadProc,
- qtiffWriteProc,
- qtiffSeekProc,
- qtiffCloseProc,
- qtiffSizeProc,
- qtiffMapProc,
- qtiffUnmapProc);
-
- if (tiff) {
- uint32 width = 0;
- uint32 height = 0;
- TIFFGetField(tiff, TIFFTAG_IMAGEWIDTH, &width);
- TIFFGetField(tiff, TIFFTAG_IMAGELENGTH, &height);
- if (image->size() != QSize(width, height) || image->format() != QImage::Format_ARGB32)
- *image = QImage(width, height, QImage::Format_ARGB32);
+ TIFF *const tiff = TIFFClientOpen("foo",
+ "r",
+ this,
+ qtiffReadProc,
+ qtiffWriteProc,
+ qtiffSeekProc,
+ qtiffCloseProc,
+ qtiffSizeProc,
+ qtiffMapProc,
+ qtiffUnmapProc);
+
+ if (!tiff) {
+ return false;
+ }
+ uint32 width;
+ uint32 height;
+ uint16 photometric;
+ if (!TIFFGetField(tiff, TIFFTAG_IMAGEWIDTH, &width)
+ || !TIFFGetField(tiff, TIFFTAG_IMAGELENGTH, &height)
+ || !TIFFGetField(tiff, TIFFTAG_PHOTOMETRIC, &photometric)) {
+ TIFFClose(tiff);
+ return false;
+ }
+
+ if (photometric == PHOTOMETRIC_MINISBLACK || photometric == PHOTOMETRIC_MINISWHITE) {
+ if (image->size() != QSize(width, height) || image->format() != QImage::Format_Mono)
+ *image = QImage(width, height, QImage::Format_Mono);
+ QVector<QRgb> colortable(2);
+ if (photometric == PHOTOMETRIC_MINISBLACK) {
+ colortable[0] = 0xff000000;
+ colortable[1] = 0xffffffff;
+ } else {
+ colortable[0] = 0xffffffff;
+ colortable[1] = 0xff000000;
+ }
+ image->setColorTable(colortable);
+
if (!image->isNull()) {
- if (TIFFReadRGBAImageOriented(tiff, width, height, reinterpret_cast<uint32 *>(image->bits()), ORIENTATION_TOPLEFT, 0)) {
- uint16 resUnit = RESUNIT_NONE;
- float resX = 0;
- float resY = 0;
- TIFFGetField(tiff, TIFFTAG_RESOLUTIONUNIT, &resUnit);
- TIFFGetField(tiff, TIFFTAG_XRESOLUTION, &resX);
- TIFFGetField(tiff, TIFFTAG_YRESOLUTION, &resY);
- switch(resUnit) {
- case RESUNIT_CENTIMETER:
- image->setDotsPerMeterX(qRound(resX * 100));
- image->setDotsPerMeterY(qRound(resY * 100));
- break;
- case RESUNIT_INCH:
- image->setDotsPerMeterX(qRound(resX * (100 / 2.54)));
- image->setDotsPerMeterY(qRound(resY * (100 / 2.54)));
- break;
- default:
- // do nothing as defaults have already
- // been set within the QImage class
- break;
+ for (uint32 y=0; y<height; ++y) {
+ if (TIFFReadScanline(tiff, image->scanLine(y), y, 0) < 0) {
+ TIFFClose(tiff);
+ return false;
+ }
+ }
+ }
+ } else {
+ uint16 bitPerSample;
+ if (!TIFFGetField(tiff, TIFFTAG_BITSPERSAMPLE, &bitPerSample)) {
+ TIFFClose(tiff);
+ return false;
+ }
+ if (photometric == PHOTOMETRIC_PALETTE && bitPerSample == 8) {
+ if (image->size() != QSize(width, height) || image->format() != QImage::Format_Indexed8)
+ *image = QImage(width, height, QImage::Format_Indexed8);
+ if (!image->isNull()) {
+ // create the color table
+ const uint16 tableSize = 256;
+ uint16 *redTable = static_cast<uint16 *>(qMalloc(tableSize * sizeof(uint16)));
+ uint16 *greenTable = static_cast<uint16 *>(qMalloc(tableSize * sizeof(uint16)));
+ uint16 *blueTable = static_cast<uint16 *>(qMalloc(tableSize * sizeof(uint16)));
+ if (!redTable || !greenTable || !blueTable) {
+ TIFFClose(tiff);
+ return false;
+ }
+ if (!TIFFGetField(tiff, TIFFTAG_COLORMAP, &redTable, &greenTable, &blueTable)) {
+ TIFFClose(tiff);
+ return false;
+ }
+
+ QVector<QRgb> qtColorTable(tableSize);
+ for (int i = 0; i<tableSize ;++i) {
+ const int red = redTable[i] / 257;
+ const int green = greenTable[i] / 257;
+ const int blue = blueTable[i] / 257;
+ qtColorTable[i] = qRgb(red, green, blue);
+
+ }
+
+ image->setColorTable(qtColorTable);
+ for (uint32 y=0; y<height; ++y) {
+ if (TIFFReadScanline(tiff, image->scanLine(y), y, 0) < 0) {
+ TIFFClose(tiff);
+ return false;
+ }
+ }
+
+ // free redTable, greenTable and greenTable done by libtiff
+ }
+ } else {
+ if (image->size() != QSize(width, height) || image->format() != QImage::Format_ARGB32)
+ *image = QImage(width, height, QImage::Format_ARGB32);
+ if (!image->isNull()) {
+ if (TIFFReadRGBAImageOriented(tiff, width, height, reinterpret_cast<uint32 *>(image->bits()), ORIENTATION_TOPLEFT, 0)) {
+ for (uint32 y=0; y<height; ++y)
+ convert32BitOrder(image->scanLine(y), width);
+ } else {
+ TIFFClose(tiff);
+ return false;
}
- for (uint32 y=0; y<height; ++y)
- convert32BitOrder(image->scanLine(y), width);
- } else {
- *image = QImage();
}
}
- TIFFClose(tiff);
}
- if (image->isNull())
+ if (image->isNull()) {
+ TIFFClose(tiff);
return false;
+ }
+ float resX = 0;
+ float resY = 0;
+ uint16 resUnit = RESUNIT_NONE;
+ if (TIFFGetField(tiff, TIFFTAG_RESOLUTIONUNIT, &resUnit)
+ && TIFFGetField(tiff, TIFFTAG_XRESOLUTION, &resX)
+ && TIFFGetField(tiff, TIFFTAG_YRESOLUTION, &resY)) {
+
+ switch(resUnit) {
+ case RESUNIT_CENTIMETER:
+ image->setDotsPerMeterX(qRound(resX * 100));
+ image->setDotsPerMeterY(qRound(resY * 100));
+ break;
+ case RESUNIT_INCH:
+ image->setDotsPerMeterX(qRound(resX * (100 / 2.54)));
+ image->setDotsPerMeterY(qRound(resY * (100 / 2.54)));
+ break;
+ default:
+ // do nothing as defaults have already
+ // been set within the QImage class
+ break;
+ }
+ }
+
+ TIFFClose(tiff);
return true;
}
@@ -191,33 +271,148 @@ bool QTiffHandler::write(const QImage &image)
if (!device()->isWritable())
return false;
- TIFF *tiff = TIFFClientOpen("foo",
- "w",
- this,
- qtiffReadProc,
- qtiffWriteProc,
- qtiffSeekProc,
- qtiffCloseProc,
- qtiffSizeProc,
- qtiffMapProc,
- qtiffUnmapProc);
-
- if (tiff) {
- int width = image.width();
- int height = image.height();
- int depth = 32;
-
- if (!TIFFSetField(tiff, TIFFTAG_IMAGEWIDTH, width)
- || !TIFFSetField(tiff, TIFFTAG_IMAGELENGTH, height)
- || !TIFFSetField(tiff, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB)
- || !TIFFSetField(tiff, TIFFTAG_COMPRESSION, compression == NoCompression ? COMPRESSION_NONE : COMPRESSION_LZW)
- || !TIFFSetField(tiff, TIFFTAG_SAMPLESPERPIXEL, depth/8)
- || !TIFFSetField(tiff, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG)
- || !TIFFSetField(tiff, TIFFTAG_BITSPERSAMPLE, 8)) {
+ TIFF *const tiff = TIFFClientOpen("foo",
+ "w",
+ this,
+ qtiffReadProc,
+ qtiffWriteProc,
+ qtiffSeekProc,
+ qtiffCloseProc,
+ qtiffSizeProc,
+ qtiffMapProc,
+ qtiffUnmapProc);
+ if (!tiff)
+ return false;
+
+ const int width = image.width();
+ const int height = image.height();
+
+ if (!TIFFSetField(tiff, TIFFTAG_IMAGEWIDTH, width)
+ || !TIFFSetField(tiff, TIFFTAG_IMAGELENGTH, height)
+ || !TIFFSetField(tiff, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG)) {
+ TIFFClose(tiff);
+ return false;
+ }
+
+ // set the resolution
+ bool resolutionSet = false;
+ const int dotPerMeterX = image.dotsPerMeterX();
+ const int dotPerMeterY = image.dotsPerMeterY();
+ if ((dotPerMeterX % 100) == 0
+ && (dotPerMeterY % 100) == 0) {
+ resolutionSet = TIFFSetField(tiff, TIFFTAG_RESOLUTIONUNIT, RESUNIT_CENTIMETER)
+ && TIFFSetField(tiff, TIFFTAG_XRESOLUTION, dotPerMeterX/100.0)
+ && TIFFSetField(tiff, TIFFTAG_YRESOLUTION, dotPerMeterY/100.0);
+ } else {
+ resolutionSet = TIFFSetField(tiff, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH)
+ && TIFFSetField(tiff, TIFFTAG_XRESOLUTION, static_cast<float>(image.logicalDpiX()))
+ && TIFFSetField(tiff, TIFFTAG_YRESOLUTION, static_cast<float>(image.logicalDpiY()));
+ }
+ if (!resolutionSet) {
+ TIFFClose(tiff);
+ return false;
+ }
+
+ // configure image depth
+ const QImage::Format format = image.format();
+ if (format == QImage::Format_Mono || format == QImage::Format_MonoLSB) {
+ uint16 photometric = PHOTOMETRIC_MINISBLACK;
+ if (image.colorTable().at(0) == 0xffffffff)
+ photometric = PHOTOMETRIC_MINISWHITE;
+ if (!TIFFSetField(tiff, TIFFTAG_PHOTOMETRIC, photometric)
+ || !TIFFSetField(tiff, TIFFTAG_COMPRESSION, compression == NoCompression ? COMPRESSION_NONE : COMPRESSION_CCITTRLE)) {
TIFFClose(tiff);
return false;
}
+ // try to do the conversion in chunks no greater than 16 MB
+ int chunks = (width * height / (1024 * 1024 * 16)) + 1;
+ int chunkHeight = qMax(height / chunks, 1);
+
+ int y = 0;
+ while (y < height) {
+ QImage chunk = image.copy(0, y, width, qMin(chunkHeight, height - y)).convertToFormat(QImage::Format_Mono);
+
+ int chunkStart = y;
+ int chunkEnd = y + chunk.height();
+ while (y < chunkEnd) {
+ if (TIFFWriteScanline(tiff, reinterpret_cast<uint32 *>(chunk.scanLine(y - chunkStart)), y) != 1) {
+ TIFFClose(tiff);
+ return false;
+ }
+ ++y;
+ }
+ }
+ TIFFClose(tiff);
+ } else if (format == QImage::Format_Indexed8) {
+ if (!TIFFSetField(tiff, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_PALETTE)
+ || !TIFFSetField(tiff, TIFFTAG_COMPRESSION, compression == NoCompression ? COMPRESSION_NONE : COMPRESSION_PACKBITS)
+ || !TIFFSetField(tiff, TIFFTAG_BITSPERSAMPLE, 8)) {
+ TIFFClose(tiff);
+ return false;
+ }
+ //// write the color table
+ // allocate the color tables
+ uint16 *redTable = static_cast<uint16 *>(qMalloc(256 * sizeof(uint16)));
+ uint16 *greenTable = static_cast<uint16 *>(qMalloc(256 * sizeof(uint16)));
+ uint16 *blueTable = static_cast<uint16 *>(qMalloc(256 * sizeof(uint16)));
+ if (!redTable || !greenTable || !blueTable) {
+ TIFFClose(tiff);
+ return false;
+ }
+
+ // set the color table
+ const QVector<QRgb> colorTable = image.colorTable();
+
+ const int tableSize = colorTable.size();
+ Q_ASSERT(tableSize <= 256);
+ for (int i = 0; i<tableSize; ++i) {
+ const QRgb color = colorTable.at(i);
+ redTable[i] = qRed(color) * 257;
+ greenTable[i] = qGreen(color) * 257;
+ blueTable[i] = qBlue(color) * 257;
+ }
+
+ const bool setColorTableSuccess = TIFFSetField(tiff, TIFFTAG_COLORMAP, redTable, greenTable, blueTable);
+
+ qFree(redTable);
+ qFree(greenTable);
+ qFree(blueTable);
+
+ if (!setColorTableSuccess) {
+ TIFFClose(tiff);
+ return false;
+ }
+
+ //// write the data
+ // try to do the conversion in chunks no greater than 16 MB
+ int chunks = (width * height/ (1024 * 1024 * 16)) + 1;
+ int chunkHeight = qMax(height / chunks, 1);
+
+ int y = 0;
+ while (y < height) {
+ QImage chunk = image.copy(0, y, width, qMin(chunkHeight, height - y));
+
+ int chunkStart = y;
+ int chunkEnd = y + chunk.height();
+ while (y < chunkEnd) {
+ if (TIFFWriteScanline(tiff, reinterpret_cast<uint32 *>(chunk.scanLine(y - chunkStart)), y) != 1) {
+ TIFFClose(tiff);
+ return false;
+ }
+ ++y;
+ }
+ }
+ TIFFClose(tiff);
+
+ } else {
+ if (!TIFFSetField(tiff, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB)
+ || !TIFFSetField(tiff, TIFFTAG_COMPRESSION, compression == NoCompression ? COMPRESSION_NONE : COMPRESSION_LZW)
+ || !TIFFSetField(tiff, TIFFTAG_SAMPLESPERPIXEL, 4)
+ || !TIFFSetField(tiff, TIFFTAG_BITSPERSAMPLE, 8)) {
+ TIFFClose(tiff);
+ return false;
+ }
// try to do the ARGB32 conversion in chunks no greater than 16 MB
int chunks = (width * height * 4 / (1024 * 1024 * 16)) + 1;
int chunkHeight = qMax(height / chunks, 1);
@@ -242,9 +437,8 @@ bool QTiffHandler::write(const QImage &image)
}
}
TIFFClose(tiff);
- } else {
- return false;
}
+
return true;
}
diff --git a/src/plugins/kbddrivers/kbddrivers.pro b/src/plugins/kbddrivers/kbddrivers.pro
index 6605972..a34b780 100644
--- a/src/plugins/kbddrivers/kbddrivers.pro
+++ b/src/plugins/kbddrivers/kbddrivers.pro
@@ -1,6 +1,5 @@
TEMPLATE = subdirs
-contains(kbd-plugins, usb): SUBDIRS += usb
+contains(kbd-plugins, linuxinput): SUBDIRS += linuxinput
contains(kbd-plugins, sl5000): SUBDIRS += sl5000
contains(kbd-plugins, vr41xx): SUBDIRS += vr41xx
contains(kbd-plugins, yopy): SUBDIRS += yopy
-contains(kbd-plugins, linuxis): SUBDIRS += linuxis
diff --git a/src/plugins/kbddrivers/linuxinput/linuxinput.pro b/src/plugins/kbddrivers/linuxinput/linuxinput.pro
new file mode 100644
index 0000000..862a220
--- /dev/null
+++ b/src/plugins/kbddrivers/linuxinput/linuxinput.pro
@@ -0,0 +1,14 @@
+TARGET = qlinuxinputkbddriver
+include(../../qpluginbase.pri)
+
+QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/kbddrivers
+target.path = $$[QT_INSTALL_PLUGINS]/kbddrivers
+INSTALLS += target
+
+DEFINES += QT_QWS_KBD_LINUXINPUT
+
+HEADERS = $$QT_SOURCE_TREE/src/gui/embedded/qkbdlinuxinput_qws.h
+
+SOURCES = main.cpp \
+ $$QT_SOURCE_TREE/src/gui/embedded/qkbdlinuxinput_qws.cpp
+
diff --git a/src/plugins/kbddrivers/usb/main.cpp b/src/plugins/kbddrivers/linuxinput/main.cpp
index 1d6ab89..45d06c4 100644
--- a/src/plugins/kbddrivers/usb/main.cpp
+++ b/src/plugins/kbddrivers/linuxinput/main.cpp
@@ -40,38 +40,38 @@
****************************************************************************/
#include <qkbddriverplugin_qws.h>
-#include <qkbdusb_qws.h>
+#include <qkbdlinuxinput_qws.h>
QT_BEGIN_NAMESPACE
-class QUsbKbdDriver : public QKbdDriverPlugin
+class QLinuxInputKbdDriver : public QKbdDriverPlugin
{
public:
- QUsbKbdDriver();
+ QLinuxInputKbdDriver();
QStringList keys() const;
QWSKeyboardHandler* create(const QString &driver, const QString &device);
};
-QUsbKbdDriver::QUsbKbdDriver()
+QLinuxInputKbdDriver::QLinuxInputKbdDriver()
: QKbdDriverPlugin()
{
}
-QStringList QUsbKbdDriver::keys() const
+QStringList QLinuxInputKbdDriver::keys() const
{
- return (QStringList() << QLatin1String("Usb"));
+ return (QStringList() << QLatin1String("LinuxInput"));
}
-QWSKeyboardHandler* QUsbKbdDriver::create(const QString &driver,
- const QString &device)
+QWSKeyboardHandler* QLinuxInputKbdDriver::create(const QString &driver,
+ const QString &device)
{
Q_UNUSED(device);
- if (driver.compare(QLatin1String("Usb"), Qt::CaseInsensitive))
+ if (driver.compare(QLatin1String("LinuxInput"), Qt::CaseInsensitive))
return 0;
- return new QWSUsbKeyboardHandler(driver);
+ return new QWSLinuxInputKeyboardHandler(driver, device);
}
-Q_EXPORT_PLUGIN2(qwsusbkbddriver, QUsbKbdDriver)
+Q_EXPORT_PLUGIN2(qwslinuxinputkbddriver, QLinuxInputKbdDriver)
QT_END_NAMESPACE
diff --git a/src/plugins/kbddrivers/linuxis/README b/src/plugins/kbddrivers/linuxis/README
deleted file mode 100644
index 37a9a89..0000000
--- a/src/plugins/kbddrivers/linuxis/README
+++ /dev/null
@@ -1 +0,0 @@
-This is a keypad/only keyboard driver based on the Linux input subsystem.
diff --git a/src/plugins/kbddrivers/linuxis/linuxis.pro b/src/plugins/kbddrivers/linuxis/linuxis.pro
deleted file mode 100644
index 5e652b5..0000000
--- a/src/plugins/kbddrivers/linuxis/linuxis.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-TARGET = linuxiskbdhandler
-include(../../qpluginbase.pri)
-
-QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/kbddrivers
-target.path = $$[QT_INSTALL_PLUGINS]/kbddrivers
-INSTALLS += target
-
-CONFIG+=no_tr
-
-HEADERS = linuxiskbddriverplugin.h linuxiskbdhandler.h
-SOURCES = linuxiskbddriverplugin.cpp linuxiskbdhandler.cpp
diff --git a/src/plugins/kbddrivers/linuxis/linuxiskbddriverplugin.cpp b/src/plugins/kbddrivers/linuxis/linuxiskbddriverplugin.cpp
deleted file mode 100644
index 79cd298..0000000
--- a/src/plugins/kbddrivers/linuxis/linuxiskbddriverplugin.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "linuxiskbddriverplugin.h"
-#include "linuxiskbdhandler.h"
-
-#include <qdebug.h>
-#if 1
-#define qLog(x) qDebug()
-#else
-#define qLog(x) while (0) qDebug()
-#endif
-
-LinuxInputSubsystemKbdDriverPlugin::LinuxInputSubsystemKbdDriverPlugin( QObject *parent )
- : QKbdDriverPlugin( parent )
-{
-}
-
-LinuxInputSubsystemKbdDriverPlugin::~LinuxInputSubsystemKbdDriverPlugin()
-{
-}
-
-QWSKeyboardHandler* LinuxInputSubsystemKbdDriverPlugin::create(const QString &driver, const QString &device)
-{
- if (device.isEmpty()) {
- return create( driver );
- }
- if( driver.toLower() == "linuxis" || driver.toLower() == "linuxiskbdhandler" ) {
- qLog(Input) << "Before call LinuxInputSubsystemKbdHandler(" << device << ")";
- return new LinuxInputSubsystemKbdHandler(device);
- }
- return 0;
-}
-
-QWSKeyboardHandler* LinuxInputSubsystemKbdDriverPlugin::create( const QString &driver)
-{
- if( driver.toLower() == "linuxis" || driver.toLower() == "linuxiskbdhandler" ) {
- qLog(Input) << "Before call LinuxInputSubsystemKbdHandler()";
- return new LinuxInputSubsystemKbdHandler();
- }
- return 0;
-}
-
-QStringList LinuxInputSubsystemKbdDriverPlugin::keys() const
-{
- return QStringList() << "linuxis" << "linuxiskbdhandler";
-}
-
-Q_EXPORT_PLUGIN2(qwslinuxiskbdhandler, LinuxInputSubsystemKbdDriverPlugin)
diff --git a/src/plugins/kbddrivers/linuxis/linuxiskbddriverplugin.h b/src/plugins/kbddrivers/linuxis/linuxiskbddriverplugin.h
deleted file mode 100644
index b5f599f..0000000
--- a/src/plugins/kbddrivers/linuxis/linuxiskbddriverplugin.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef LINUXISKBDDRIVERPLUGIN_H
-#define LINUXISKBDDRIVERPLUGIN_H
-
-#include <QtGui/QWSKeyboardHandlerFactoryInterface>
-
-class LinuxInputSubsystemKbdDriverPlugin : public QKbdDriverPlugin {
- Q_OBJECT
-public:
- LinuxInputSubsystemKbdDriverPlugin( QObject *parent = 0 );
- ~LinuxInputSubsystemKbdDriverPlugin();
-
- QWSKeyboardHandler* create(const QString& driver, const QString& device);
- QWSKeyboardHandler* create(const QString& driver);
- QStringList keys()const;
-};
-
-#endif // LINUXISKBDDRIVERPLUGIN_H
diff --git a/src/plugins/kbddrivers/linuxis/linuxiskbdhandler.cpp b/src/plugins/kbddrivers/linuxis/linuxiskbdhandler.cpp
deleted file mode 100644
index 99b98b7..0000000
--- a/src/plugins/kbddrivers/linuxis/linuxiskbdhandler.cpp
+++ /dev/null
@@ -1,171 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "linuxiskbdhandler.h"
-
-#include <QSocketNotifier>
-
-#include <stdlib.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-
-#include <linux/input.h>
-#include <linux/kd.h>
-
-#include <qdebug.h>
-#if 1
-#define qLog(x) qDebug()
-#else
-#define qLog(x) while (0) qDebug()
-#endif
-
-struct LinuxInputSubsystemKbdHandler::keytable_s LinuxInputSubsystemKbdHandler::keytable[] = {
- { KEY_PAGEDOWN, 0xffff, Qt::Key_Context1 },
- { KEY_END, 0xffff, Qt::Key_Back },
- { KEY_RIGHTCTRL, 0xffff, Qt::Key_Home },
- { KEY_SPACE, 0xffff, Qt::Key_Menu },
- { KEY_ENTER, 0xffff, Qt::Key_Select },
- { KEY_UP, 0xffff, Qt::Key_Up },
- { KEY_LEFT, 0xffff, Qt::Key_Left },
- { KEY_RIGHT, 0xffff, Qt::Key_Right },
- { KEY_DOWN, 0xffff, Qt::Key_Down },
- { KEY_POWER, 0xffff, Qt::Key_Call },
- { KEY_BACKSPACE, 0xffff, Qt::Key_Backspace },
- { KEY_F1, 0xffff, Qt::Key_Hangup },
- { KEY_KP1, '1', Qt::Key_1 },
- { KEY_KP2, '2', Qt::Key_2 },
- { KEY_KP3, '3', Qt::Key_3 },
- { KEY_KP4, '4', Qt::Key_4 },
- { KEY_KP5, '5', Qt::Key_5 },
- { KEY_KP6, '6', Qt::Key_6 },
- { KEY_KP7, '7', Qt::Key_7 },
- { KEY_KP8, '8', Qt::Key_8 },
- { KEY_KP9, '9', Qt::Key_9 },
- { KEY_KP0, '0', Qt::Key_0 },
- { KEY_APOSTROPHE, '*', Qt::Key_Asterisk },
- { KEY_3, '#', Qt::Key_NumberSign },
- { KEY_F2, 0xffff, Qt::Key_F2 },
- { KEY_F3, 0xffff, Qt::Key_F3 },
- { KEY_F4, 0xffff, Qt::Key_F4 },
- { KEY_F5, 0xffff, Qt::Key_F5 },
- { KEY_F6, 0xffff, Qt::Key_F6 },
- { KEY_F7, 0xffff, Qt::Key_VolumeUp },
- { KEY_F8, 0xffff, Qt::Key_VolumeDown },
- { KEY_F9, 0xffff, Qt::Key_F9 },
- { 0, 0, Qt::Key_unknown },
-};
-
-struct LinuxInputSubsystemKbdHandler::keymap_s LinuxInputSubsystemKbdHandler::keymap[KEY_MAX];
-
-LinuxInputSubsystemKbdHandler::LinuxInputSubsystemKbdHandler(const QString &device)
-{
- qLog(Input) << "Loaded LinuxInputSubsystem keypad plugin!";
- setObjectName( "LinuxInputSubsystem Keypad Handler" );
- kbdFD = ::open(device.toLocal8Bit().constData(), O_RDONLY, 0);
- if (kbdFD >= 0) {
- qLog(Input) << "Opened" << device << "as keypad input";
-#if 0
- struct kbd_repeat kbdrep;
- kbdrep.delay = 500; /* ms */
- kbdrep.period = 250; /* ms */
- ioctl(kbdFD, KDKBDREP, &kbdrep);
-#endif
- m_notify = new QSocketNotifier( kbdFD, QSocketNotifier::Read, this );
- connect( m_notify, SIGNAL(activated(int)), this, SLOT(readKbdData()));
- } else {
- qWarning("Cannot open '%s' for keypad (%s)",
- device.toLocal8Bit().constData(), strerror(errno));
- return;
- }
- shift = false;
-
- initmap();
-}
-
-LinuxInputSubsystemKbdHandler::~LinuxInputSubsystemKbdHandler()
-{
-}
-
-void LinuxInputSubsystemKbdHandler::initmap()
-{
- for (int i = 0; i < KEY_MAX; i++) {
- keymap[i].unicode = 0xffff;
- keymap[i].keycode = Qt::Key_unknown;
- }
- for (int i = 0; keytable[i].unicode; i++) {
- int idx = keytable[i].code;
- keymap[idx].unicode = keytable[i].unicode;
- keymap[idx].keycode = keytable[i].keycode;
- }
-}
-
-void LinuxInputSubsystemKbdHandler::readKbdData()
-{
- struct input_event *ie;
- struct input_event iebuf[32];
-
- uint n = ::read(kbdFD, iebuf, sizeof(iebuf));
-
- bool pressed;
- bool autorepeat;
- int modifiers = 0;
- int unicode, keycode;
-
- n /= sizeof(struct input_event);
- ie = iebuf;
- for (uint i = 0; i < n; i++) {
-
- pressed = ie->value != 0;
- autorepeat = ie->value == 2;
- qLog() << "keyEvent" << hex << ie->type << ie->code << ie->value;
- unicode = keymap[ie->code].unicode;
- keycode = keymap[ie->code].keycode;
-
- processKeyEvent(unicode, keycode, (Qt::KeyboardModifiers)modifiers,
- pressed, autorepeat);
-
- ie++;
- }
-
-}
-
diff --git a/src/plugins/kbddrivers/linuxis/linuxiskbdhandler.h b/src/plugins/kbddrivers/linuxis/linuxiskbdhandler.h
deleted file mode 100644
index 3211309..0000000
--- a/src/plugins/kbddrivers/linuxis/linuxiskbdhandler.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef LINUXISKBDHANDLER_H
-#define LINUXISKBDHANDLER_H
-
-#include <QObject>
-#include <QWSKeyboardHandler>
-
-class QSocketNotifier;
-class LinuxInputSubsystemKbdHandler : public QObject, public QWSKeyboardHandler {
- Q_OBJECT
-public:
- LinuxInputSubsystemKbdHandler(const QString &device = QString("/dev/input/event0"));
- ~LinuxInputSubsystemKbdHandler();
-
- struct keytable_s {
- int code;
- int unicode;
- int keycode;
- };
-
- struct keymap_s {
- int unicode;
- int keycode;
- };
-
-private:
- void initmap();
-
- QSocketNotifier *m_notify;
- int kbdFD;
- bool shift;
-
- static struct keytable_s keytable[];
- static struct keymap_s keymap[];
-
-private Q_SLOTS:
- void readKbdData();
-};
-
-#endif // LINUXISKBDHANDLER_H
diff --git a/src/plugins/kbddrivers/usb/usb.pro b/src/plugins/kbddrivers/usb/usb.pro
deleted file mode 100644
index 4187255..0000000
--- a/src/plugins/kbddrivers/usb/usb.pro
+++ /dev/null
@@ -1,14 +0,0 @@
-TARGET = qusbkbddriver
-include(../../qpluginbase.pri)
-
-QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/kbddrivers
-target.path = $$[QT_INSTALL_PLUGINS]/kbddrivers
-INSTALLS += target
-
-DEFINES += QT_QWS_KBD_USB
-
-HEADERS = $$QT_SOURCE_TREE/src/gui/embedded/qkbdusb_qws.h
-
-SOURCES = main.cpp \
- $$QT_SOURCE_TREE/src/gui/embedded/qkbdusb_qws.cpp
-
diff --git a/src/plugins/sqldrivers/odbc/odbc.pro b/src/plugins/sqldrivers/odbc/odbc.pro
index 0835ce1..3de8ab2 100644
--- a/src/plugins/sqldrivers/odbc/odbc.pro
+++ b/src/plugins/sqldrivers/odbc/odbc.pro
@@ -4,15 +4,9 @@ HEADERS = ../../../sql/drivers/odbc/qsql_odbc.h
SOURCES = main.cpp \
../../../sql/drivers/odbc/qsql_odbc.cpp
-mac {
- !contains( LIBS, .*odbc.* ) {
- LIBS *= -liodbc
- }
-}
-
unix {
!contains( LIBS, .*odbc.* ) {
- LIBS *= -lodbc
+ LIBS *= $$QT_LFLAGS_ODBC
}
}