| 
									
										
										
										
											2012-10-02 09:12:39 +02:00
										 |  |  | /****************************************************************************
 | 
					
						
							| 
									
										
										
										
											2011-02-22 12:08:19 +01:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2015-01-14 18:07:15 +01:00
										 |  |  | ** Copyright (C) 2015 The Qt Company Ltd. | 
					
						
							|  |  |  | ** Contact: http://www.qt.io/licensing
 | 
					
						
							| 
									
										
										
										
											2011-02-22 12:08:19 +01:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2012-10-02 09:12:39 +02:00
										 |  |  | ** This file is part of Qt Creator. | 
					
						
							| 
									
										
										
										
											2011-02-22 12:08:19 +01:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2012-10-02 09:12:39 +02:00
										 |  |  | ** Commercial License Usage | 
					
						
							|  |  |  | ** Licensees holding valid commercial Qt licenses may use this file in | 
					
						
							|  |  |  | ** accordance with the commercial license agreement provided with the | 
					
						
							|  |  |  | ** Software or, alternatively, in accordance with the terms contained in | 
					
						
							| 
									
										
										
										
											2015-01-14 18:07:15 +01:00
										 |  |  | ** a written agreement between you and The Qt Company.  For licensing terms and | 
					
						
							|  |  |  | ** conditions see http://www.qt.io/terms-conditions.  For further information
 | 
					
						
							| 
									
										
										
										
											2014-10-01 13:21:18 +02:00
										 |  |  | ** use the contact form at http://www.qt.io/contact-us.
 | 
					
						
							| 
									
										
										
										
											2011-02-22 12:08:19 +01:00
										 |  |  | ** | 
					
						
							|  |  |  | ** GNU Lesser General Public License Usage | 
					
						
							| 
									
										
										
										
											2012-10-02 09:12:39 +02:00
										 |  |  | ** Alternatively, this file may be used under the terms of the GNU Lesser | 
					
						
							| 
									
										
										
										
											2014-10-01 13:21:18 +02:00
										 |  |  | ** General Public License version 2.1 or version 3 as published by the Free | 
					
						
							|  |  |  | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and | 
					
						
							|  |  |  | ** LICENSE.LGPLv3 included in the packaging of this file.  Please review the | 
					
						
							|  |  |  | ** following information to ensure the GNU Lesser General Public License | 
					
						
							|  |  |  | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
 | 
					
						
							|  |  |  | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
 | 
					
						
							| 
									
										
										
										
											2012-10-02 09:12:39 +02:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2015-01-14 18:07:15 +01:00
										 |  |  | ** In addition, as a special exception, The Qt Company gives you certain additional | 
					
						
							|  |  |  | ** rights.  These rights are described in The Qt Company LGPL Exception | 
					
						
							| 
									
										
										
										
											2011-02-22 12:08:19 +01:00
										 |  |  | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | 
					
						
							|  |  |  | ** | 
					
						
							| 
									
										
										
										
											2012-10-02 09:12:39 +02:00
										 |  |  | ****************************************************************************/ | 
					
						
							| 
									
										
										
										
											2011-02-22 12:08:19 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-11-30 21:32:52 +01:00
										 |  |  | #include "imagecontainer.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-07-31 16:45:21 +02:00
										 |  |  | #include "sharedmemory.h"
 | 
					
						
							| 
									
										
										
										
											2012-08-30 17:10:42 +02:00
										 |  |  | #include <QCache>
 | 
					
						
							| 
									
										
										
										
											2013-07-16 17:00:07 +02:00
										 |  |  | #include <QDebug>
 | 
					
						
							| 
									
										
										
										
											2012-08-30 17:10:42 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-20 14:25:01 +02:00
										 |  |  | #include <cstring>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-11 15:11:34 +02:00
										 |  |  | #define QTC_ASSERT_STRINGIFY_HELPER(x) #x
 | 
					
						
							|  |  |  | #define QTC_ASSERT_STRINGIFY(x) QTC_ASSERT_STRINGIFY_HELPER(x)
 | 
					
						
							|  |  |  | #define QTC_ASSERT_STRING(cond) qDebug("SOFT ASSERT: \"" cond"\" in file " __FILE__ ", line " QTC_ASSERT_STRINGIFY(__LINE__))
 | 
					
						
							|  |  |  | #define QTC_ASSERT(cond, action) if (cond) {} else { QTC_ASSERT_STRING(#cond); action; } do {} while (0)
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-11-30 21:32:52 +01:00
										 |  |  | namespace QmlDesigner { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-08-05 14:00:21 +02:00
										 |  |  | // using cache as a container which deletes sharedmemory pointers at process exit
 | 
					
						
							|  |  |  | typedef QCache<qint32, SharedMemory> GlobalSharedMemoryContainer; | 
					
						
							|  |  |  | Q_GLOBAL_STATIC_WITH_ARGS(GlobalSharedMemoryContainer, globalSharedMemoryContainer, (10000)) | 
					
						
							| 
									
										
										
										
											2012-08-30 17:10:42 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-11-30 21:32:52 +01:00
										 |  |  | ImageContainer::ImageContainer() | 
					
						
							| 
									
										
										
										
											2012-09-11 15:11:34 +02:00
										 |  |  |     : m_instanceId(-1), | 
					
						
							|  |  |  |       m_keyNumber(-2) | 
					
						
							| 
									
										
										
										
											2010-11-30 21:32:52 +01:00
										 |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-11 15:11:34 +02:00
										 |  |  | ImageContainer::ImageContainer(qint32 instanceId, const QImage &image, qint32 keyNumber) | 
					
						
							| 
									
										
										
										
											2012-08-30 17:10:42 +02:00
										 |  |  |     :  m_image(image), | 
					
						
							| 
									
										
										
										
											2012-09-11 15:11:34 +02:00
										 |  |  |        m_instanceId(instanceId), | 
					
						
							|  |  |  |        m_keyNumber(keyNumber) | 
					
						
							| 
									
										
										
										
											2010-11-30 21:32:52 +01:00
										 |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | qint32 ImageContainer::instanceId() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return m_instanceId; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QImage ImageContainer::image() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return m_image; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-11 15:11:34 +02:00
										 |  |  | qint32 ImageContainer::keyNumber() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return m_keyNumber; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void ImageContainer::setImage(const QImage &image) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     QTC_ASSERT(m_image.isNull(), /**/); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     m_image = image; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void ImageContainer::removeSharedMemorys(const QVector<qint32> &keyNumberVector) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     foreach (qint32 keyNumber, keyNumberVector) { | 
					
						
							| 
									
										
										
										
											2014-08-05 14:00:21 +02:00
										 |  |  |         SharedMemory *sharedMemory = globalSharedMemoryContainer()->take(keyNumber); | 
					
						
							| 
									
										
										
										
											2012-09-11 15:11:34 +02:00
										 |  |  |         delete sharedMemory; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static const QLatin1String imageKeyTemplateString("Image-%1"); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-07-31 16:45:21 +02:00
										 |  |  | static SharedMemory *createSharedMemory(qint32 key, int byteCount) | 
					
						
							| 
									
										
										
										
											2012-08-30 17:10:42 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2014-08-05 14:00:21 +02:00
										 |  |  |     SharedMemory *sharedMemory = (*globalSharedMemoryContainer())[key]; | 
					
						
							| 
									
										
										
										
											2014-07-31 16:45:21 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     if (sharedMemory == 0) { | 
					
						
							|  |  |  |         sharedMemory = new SharedMemory(QString(imageKeyTemplateString).arg(key)); | 
					
						
							|  |  |  |         bool sharedMemoryIsCreated = sharedMemory->create(byteCount); | 
					
						
							|  |  |  |         if (sharedMemoryIsCreated) { | 
					
						
							| 
									
										
										
										
											2014-08-05 14:00:21 +02:00
										 |  |  |             globalSharedMemoryContainer()->insert(key, sharedMemory); | 
					
						
							| 
									
										
										
										
											2014-07-31 16:45:21 +02:00
										 |  |  |         } else { | 
					
						
							|  |  |  |             delete sharedMemory; | 
					
						
							|  |  |  |             sharedMemory = 0; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } else { | 
					
						
							|  |  |  |         bool sharedMemoryIsAttached = sharedMemory->isAttached(); | 
					
						
							|  |  |  |         if (!sharedMemoryIsAttached) | 
					
						
							|  |  |  |             sharedMemoryIsAttached = sharedMemory->attach(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         bool sharedMemorySizeIsSmallerThanByteCount = sharedMemory->size() < byteCount; | 
					
						
							|  |  |  |         bool sharedMemorySizeIsDoubleBiggerThanByteCount = sharedMemory->size() > (byteCount * 2); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if (!sharedMemoryIsAttached) { | 
					
						
							|  |  |  |             sharedMemory->create(byteCount); | 
					
						
							|  |  |  |         } else if (sharedMemorySizeIsSmallerThanByteCount || sharedMemorySizeIsDoubleBiggerThanByteCount) { | 
					
						
							|  |  |  |             sharedMemory->detach(); | 
					
						
							|  |  |  |             sharedMemory->create(byteCount); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if (!sharedMemory->isAttached()) { | 
					
						
							| 
									
										
										
										
											2014-08-05 14:00:21 +02:00
										 |  |  |             globalSharedMemoryContainer()->remove(key); | 
					
						
							| 
									
										
										
										
											2014-07-31 16:45:21 +02:00
										 |  |  |             sharedMemory = 0; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2012-08-30 17:10:42 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-07-31 16:45:21 +02:00
										 |  |  |     return sharedMemory; | 
					
						
							| 
									
										
										
										
											2012-08-30 17:10:42 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-07-31 16:45:21 +02:00
										 |  |  | static void writeSharedMemory(SharedMemory *sharedMemory, const QImage &image) | 
					
						
							| 
									
										
										
										
											2010-11-30 21:32:52 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2012-09-11 15:11:34 +02:00
										 |  |  |     sharedMemory->lock(); | 
					
						
							| 
									
										
										
										
											2010-11-30 21:32:52 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-11 15:11:34 +02:00
										 |  |  |     qint32 headerData[5]; | 
					
						
							|  |  |  |     headerData[0] = image.byteCount(); | 
					
						
							|  |  |  |     headerData[1] = image.bytesPerLine(); | 
					
						
							|  |  |  |     headerData[2] = image.size().width(); | 
					
						
							|  |  |  |     headerData[3] = image.size().height(); | 
					
						
							|  |  |  |     headerData[4] = image.format(); | 
					
						
							| 
									
										
										
										
											2010-11-30 21:32:52 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-20 14:25:01 +02:00
										 |  |  |     std::memcpy(sharedMemory->data(), headerData, 20); | 
					
						
							|  |  |  |     std::memcpy(reinterpret_cast<char*>(sharedMemory->data()) + 20, image.constBits(), image.byteCount()); | 
					
						
							| 
									
										
										
										
											2012-09-11 15:11:34 +02:00
										 |  |  |     sharedMemory->unlock(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void writeStream(QDataStream &out, const QImage &image) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2010-11-30 21:32:52 +01:00
										 |  |  |     out << qint32(image.bytesPerLine()); | 
					
						
							|  |  |  |     out << image.size(); | 
					
						
							|  |  |  |     out << qint32(image.format()); | 
					
						
							|  |  |  |     out << qint32(image.byteCount()); | 
					
						
							| 
									
										
										
										
											2012-09-11 15:11:34 +02:00
										 |  |  |     out.writeRawData(reinterpret_cast<const char*>(image.constBits()), image.byteCount()); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2012-08-30 17:10:42 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-11 15:11:34 +02:00
										 |  |  | QDataStream &operator<<(QDataStream &out, const ImageContainer &container) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     const int extraDataSize =  20; | 
					
						
							| 
									
										
										
										
											2012-09-11 17:25:27 +02:00
										 |  |  |     static const bool dontUseSharedMemory = !qgetenv("DESIGNER_DONT_USE_SHARED_MEMORY").isEmpty(); | 
					
						
							| 
									
										
										
										
											2012-08-30 17:10:42 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-11 15:11:34 +02:00
										 |  |  |     out << container.instanceId(); | 
					
						
							|  |  |  |     out << container.keyNumber(); | 
					
						
							| 
									
										
										
										
											2012-08-30 17:10:42 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-11 15:11:34 +02:00
										 |  |  |     const QImage image = container.image(); | 
					
						
							| 
									
										
										
										
											2012-08-30 17:10:42 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-11 17:25:27 +02:00
										 |  |  |     if (dontUseSharedMemory) { | 
					
						
							|  |  |  |         out << qint32(0); | 
					
						
							| 
									
										
										
										
											2012-09-11 15:11:34 +02:00
										 |  |  |         writeStream(out, image); | 
					
						
							| 
									
										
										
										
											2012-09-11 17:25:27 +02:00
										 |  |  |     } else { | 
					
						
							| 
									
										
										
										
											2014-07-31 16:45:21 +02:00
										 |  |  |         SharedMemory *sharedMemory = createSharedMemory(container.keyNumber(), image.byteCount() + extraDataSize); | 
					
						
							| 
									
										
										
										
											2012-09-11 17:25:27 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |         out << qint32(sharedMemory != 0); // send if shared memory is used
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if (sharedMemory) | 
					
						
							|  |  |  |             writeSharedMemory(sharedMemory, image); | 
					
						
							|  |  |  |         else | 
					
						
							|  |  |  |             writeStream(out, image); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2010-11-30 21:32:52 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     return out; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-11 15:11:34 +02:00
										 |  |  | static void readSharedMemory(qint32 key, ImageContainer &container) | 
					
						
							| 
									
										
										
										
											2012-08-30 17:10:42 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2014-07-31 16:45:21 +02:00
										 |  |  |     SharedMemory sharedMemory(QString(imageKeyTemplateString).arg(key)); | 
					
						
							| 
									
										
										
										
											2012-09-11 15:11:34 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-08-30 17:10:42 +02:00
										 |  |  |     bool canAttach = sharedMemory.attach(QSharedMemory::ReadOnly); | 
					
						
							| 
									
										
										
										
											2012-09-11 15:11:34 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     if (canAttach && sharedMemory.size() >= 20) | 
					
						
							| 
									
										
										
										
											2012-08-30 17:10:42 +02:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2012-09-05 19:55:06 +02:00
										 |  |  |         sharedMemory.lock(); | 
					
						
							| 
									
										
										
										
											2012-09-11 15:11:34 +02:00
										 |  |  |         qint32 headerData[5]; | 
					
						
							| 
									
										
										
										
											2012-09-20 14:25:01 +02:00
										 |  |  |         std::memcpy(headerData, sharedMemory.constData(), 20); | 
					
						
							| 
									
										
										
										
											2012-09-11 15:11:34 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |         qint32 byteCount = headerData[0]; | 
					
						
							|  |  |  | //        qint32 bytesPerLine = headerData[1];
 | 
					
						
							|  |  |  |         qint32 imageWidth = headerData[2]; | 
					
						
							|  |  |  |         qint32 imageHeight = headerData[3]; | 
					
						
							|  |  |  |         qint32 imageFormat = headerData[4]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         QImage image = QImage(imageWidth, imageHeight, QImage::Format(imageFormat)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-20 14:25:01 +02:00
										 |  |  |         std::memcpy(image.bits(), reinterpret_cast<const qint32*>(sharedMemory.constData()) + 5, byteCount); | 
					
						
							| 
									
										
										
										
											2012-09-11 15:11:34 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |         container.setImage(image); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-05 19:55:06 +02:00
										 |  |  |         sharedMemory.unlock(); | 
					
						
							| 
									
										
										
										
											2014-07-31 16:45:21 +02:00
										 |  |  |         sharedMemory.detach(); | 
					
						
							| 
									
										
										
										
											2012-08-30 17:10:42 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-11 15:11:34 +02:00
										 |  |  | static void readStream(QDataStream &in, ImageContainer &container) | 
					
						
							| 
									
										
										
										
											2010-11-30 21:32:52 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2012-09-11 15:11:34 +02:00
										 |  |  |     qint32 byteCount; | 
					
						
							| 
									
										
										
										
											2010-11-30 21:32:52 +01:00
										 |  |  |     qint32 bytesPerLine; | 
					
						
							|  |  |  |     QSize imageSize; | 
					
						
							| 
									
										
										
										
											2012-09-11 15:11:34 +02:00
										 |  |  |     qint32 imageFormat; | 
					
						
							| 
									
										
										
										
											2010-11-30 21:32:52 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     in >> bytesPerLine; | 
					
						
							|  |  |  |     in >> imageSize; | 
					
						
							| 
									
										
										
										
											2012-09-11 15:11:34 +02:00
										 |  |  |     in >> imageFormat; | 
					
						
							|  |  |  |     in >> byteCount; | 
					
						
							| 
									
										
										
										
											2010-11-30 21:32:52 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-11 15:11:34 +02:00
										 |  |  |     QImage image = QImage(imageSize, QImage::Format(imageFormat)); | 
					
						
							| 
									
										
										
										
											2012-08-30 17:10:42 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-11 15:11:34 +02:00
										 |  |  |     in.readRawData(reinterpret_cast<char*>(image.bits()), byteCount); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     container.setImage(image); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QDataStream &operator>>(QDataStream &in, ImageContainer &container) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     qint32 sharedMemoryIsUsed; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     in >> container.m_instanceId; | 
					
						
							|  |  |  |     in >> container.m_keyNumber; | 
					
						
							|  |  |  |     in >> sharedMemoryIsUsed; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (sharedMemoryIsUsed) { | 
					
						
							|  |  |  |         readSharedMemory(container.keyNumber(), container); | 
					
						
							|  |  |  |     } else | 
					
						
							|  |  |  |         readStream(in, container); | 
					
						
							| 
									
										
										
										
											2010-11-30 21:32:52 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     return in; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-07-04 17:06:31 +02:00
										 |  |  | bool operator ==(const ImageContainer &first, const ImageContainer &second) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return first.m_instanceId == second.m_instanceId | 
					
						
							|  |  |  |             && first.m_image == second.m_image; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool operator <(const ImageContainer &first, const ImageContainer &second) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return first.m_instanceId < second.m_instanceId; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-07-16 17:00:07 +02:00
										 |  |  | QDebug operator <<(QDebug debug, const ImageContainer &container) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return debug.nospace() << "ImageContainer(" | 
					
						
							|  |  |  |                            << "instanceId: " << container.instanceId() << ", " | 
					
						
							|  |  |  |                            << "size: " << container.image().size() << ")"; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-11-30 21:32:52 +01:00
										 |  |  | } // namespace QmlDesigner
 |