summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/src/snippets/code/src_gui_image_qpixmapcache.cpp2
-rw-r--r--qmake/project.cpp2
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp11
-rw-r--r--src/gui/graphicsview/qgraphicsitem_p.h6
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp31
-rw-r--r--src/gui/image/image.pri1
-rw-r--r--src/gui/image/qpixmapcache.cpp365
-rw-r--r--src/gui/image/qpixmapcache.h27
-rw-r--r--src/gui/image/qpixmapcache_p.h92
-rw-r--r--tests/auto/qpixmapcache/tst_qpixmapcache.cpp258
-rw-r--r--tests/benchmarks/qgraphicsview/tst_qgraphicsview.cpp1
-rw-r--r--tests/benchmarks/qpixmapcache/qpixmapcache.pro6
-rw-r--r--tests/benchmarks/qpixmapcache/tst_qpixmapcache.cpp226
-rw-r--r--translations/assistant_ja.ts395
14 files changed, 1139 insertions, 284 deletions
diff --git a/doc/src/snippets/code/src_gui_image_qpixmapcache.cpp b/doc/src/snippets/code/src_gui_image_qpixmapcache.cpp
index c4b6353..2a04f64 100644
--- a/doc/src/snippets/code/src_gui_image_qpixmapcache.cpp
+++ b/doc/src/snippets/code/src_gui_image_qpixmapcache.cpp
@@ -13,7 +13,7 @@ painter->drawPixmap(0, 0, p);
//! [1]
QPixmap pm;
-if (!QPixmapCache::find("my_big_image", pm)) {
+if (!QPixmapCache::find("my_big_image", &pm)) {
pm.load("bigimage.png");
QPixmapCache::insert("my_big_image", pm);
}
diff --git a/qmake/project.cpp b/qmake/project.cpp
index 00bb2f0..8ae0fe2 100644
--- a/qmake/project.cpp
+++ b/qmake/project.cpp
@@ -2412,7 +2412,7 @@ QMakeProject::doProjectTest(QString func, QList<QStringList> args_list, QMap<QSt
if(ok) { // do integer compare
int lhs_int = lhs.toInt(&ok);
if(ok) {
- if(func == "greaterThan")
+ if(func_t == T_GREATERTHAN)
return lhs_int > rhs_int;
return lhs_int < rhs_int;
}
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index ec08aaf..72b832a 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -978,6 +978,7 @@ void QGraphicsItemPrivate::initStyleOption(QStyleOptionGraphicsItem *option, con
void QGraphicsItemCache::purge()
{
QPixmapCache::remove(key);
+ key = QPixmapCache::Key();
QMutableMapIterator<QPaintDevice *, DeviceData> it(deviceData);
while (it.hasNext()) {
DeviceData &data = it.next().value();
@@ -1426,12 +1427,6 @@ void QGraphicsItem::setCacheMode(CacheMode mode, const QSize &logicalCacheSize)
cache->purge();
if (mode == ItemCoordinateCache) {
- if (cache->key.isEmpty()) {
- // Generate new simple pixmap cache key.
- QString tmp;
- tmp.sprintf("qgv-%p", this);
- cache->key = tmp;
- }
if (lastMode == mode && cache->fixedSize == logicalCacheSize)
noVisualChange = true;
cache->fixedSize = logicalCacheSize;
@@ -4205,7 +4200,7 @@ void QGraphicsItem::scroll(qreal dx, qreal dy, const QRectF &rect)
&& (d->cacheMode == ItemCoordinateCache && !c->fixedSize.isValid());
if (scrollCache) {
QPixmap pix;
- if (QPixmapCache::find(c->key, pix)) {
+ if (QPixmapCache::find(c->key, &pix)) {
// Adjust with 2 pixel margin. Notice the loss of precision
// when converting to QRect.
int adjust = 2;
@@ -4214,7 +4209,7 @@ void QGraphicsItem::scroll(qreal dx, qreal dy, const QRectF &rect)
_q_scrollPixmap(&pix, irect, dx, dy);
- QPixmapCache::insert(c->key, pix);
+ QPixmapCache::replace(c->key, pix);
// Translate the existing expose.
foreach (QRectF exposedRect, c->exposed)
diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h
index 82a48fb..820ef04 100644
--- a/src/gui/graphicsview/qgraphicsitem_p.h
+++ b/src/gui/graphicsview/qgraphicsitem_p.h
@@ -54,6 +54,7 @@
//
#include "qgraphicsitem.h"
+#include "qpixmapcache.h"
#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW
@@ -69,13 +70,14 @@ public:
// ItemCoordinateCache only
QRect boundingRect;
QSize fixedSize;
- QString key;
+ QPixmapCache::Key key;
// DeviceCoordinateCache only
struct DeviceData {
+ DeviceData() {}
QTransform lastTransform;
QPoint cacheIndent;
- QString key;
+ QPixmapCache::Key key;
};
QMap<QPaintDevice *, DeviceData> deviceData;
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 7318fa5..1fbda85 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -4743,8 +4743,9 @@ void QGraphicsScenePrivate::drawItemHelper(QGraphicsItem *item, QPainter *painte
return;
// Fetch the off-screen transparent buffer and exposed area info.
- QString pixmapKey;
+ QPixmapCache::Key pixmapKey;
QPixmap pix;
+ bool pixmapFound;
QGraphicsItemCache *itemCache = itemd->extraItemCache();
if (cacheMode == QGraphicsItem::ItemCoordinateCache) {
if (itemCache->boundingRect != brect.toRect()) {
@@ -4754,17 +4755,14 @@ void QGraphicsScenePrivate::drawItemHelper(QGraphicsItem *item, QPainter *painte
}
pixmapKey = itemCache->key;
} else {
- if ((pixmapKey = itemCache->deviceData.value(widget).key).isEmpty()) {
- pixmapKey.sprintf("qgv-%p-%p", item, widget);
- QGraphicsItemCache::DeviceData data;
- data.key = pixmapKey;
- itemCache->deviceData.insert(widget, data);
- }
+ pixmapKey = itemCache->deviceData.value(widget).key;
}
// Find pixmap in cache.
if (!itemCache->allExposed)
- QPixmapCache::find(pixmapKey, pix);
+ pixmapFound = QPixmapCache::find(pixmapKey, &pix);
+ else
+ pixmapFound = false;
// Render using item coordinate cache mode.
if (cacheMode == QGraphicsItem::ItemCoordinateCache) {
@@ -4817,8 +4815,12 @@ void QGraphicsScenePrivate::drawItemHelper(QGraphicsItem *item, QPainter *painte
_q_paintIntoCache(&pix, item, pixmapExposed, itemToPixmap, painter->renderHints(),
&cacheOption, painterStateProtection);
- // Reinsert this pixmap into the cache.
- QPixmapCache::insert(pixmapKey, pix);
+ if (!pixmapFound) {
+ // insert this pixmap into the cache.
+ itemCache->key = QPixmapCache::insert(pix);
+ } else {
+ QPixmapCache::replace(pixmapKey, pix);
+ }
// Reset expose data.
itemCache->allExposed = false;
@@ -4985,8 +4987,13 @@ void QGraphicsScenePrivate::drawItemHelper(QGraphicsItem *item, QPainter *painte
}
if (pixModified) {
- // Reinsert this pixmap into the cache
- QPixmapCache::insert(pixmapKey, pix);
+ if (!pixmapFound) {
+ // Insert this pixmap into the cache.
+ deviceData->key = QPixmapCache::insert(pix);
+ } else {
+ //otherwise we replace the pixmap in the cache
+ QPixmapCache::replace(pixmapKey, pix);
+ }
}
// Redraw the exposed area using an untransformed painter. This
diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri
index ca52974..bf348af 100644
--- a/src/gui/image/image.pri
+++ b/src/gui/image/image.pri
@@ -22,6 +22,7 @@ HEADERS += \
image/qpixmap.h \
image/qpixmap_raster_p.h \
image/qpixmapcache.h \
+ image/qpixmapcache_p.h \
image/qpixmapdata_p.h \
image/qpixmapdatafactory_p.h \
image/qpixmapfilter_p.h
diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp
index 4916489..810ce65 100644
--- a/src/gui/image/qpixmapcache.cpp
+++ b/src/gui/image/qpixmapcache.cpp
@@ -40,13 +40,9 @@
****************************************************************************/
#include "qpixmapcache.h"
-#include "qcache.h"
#include "qobject.h"
#include "qdebug.h"
-
-#include "qpaintengine.h"
-#include <private/qimage_p.h>
-#include <private/qpixmap_raster_p.h>
+#include "qpixmapcache_p.h"
QT_BEGIN_NAMESPACE
@@ -68,15 +64,17 @@ QT_BEGIN_NAMESPACE
access the global pixmap cache. It creates an internal QCache
object for caching the pixmaps.
- The cache associates a pixmap with a string (key). If two pixmaps
- are inserted into the cache using equal keys, then the last pixmap
- will hide the first pixmap. The QHash and QCache classes do
+ The cache associates a pixmap with a string as a key or with a QPixmapCache::Key.
+ The QPixmapCache::Key is faster than using strings as key.
+ If two pixmaps are inserted into the cache using equal keys, then the
+ last pixmap will hide the first pixmap. The QHash and QCache classes do
exactly the same.
The cache becomes full when the total size of all pixmaps in the
- cache exceeds cacheLimit(). The initial cache limit is 1024 KB (1
- MB); it is changed with setCacheLimit(). A pixmap takes roughly
- (\e{width} * \e{height} * \e{depth})/8 bytes of memory.
+ cache exceeds cacheLimit(). The initial cache limit is
+ 2048 KB(2 MB) for Embedded, 10240 KB (10
+ MB) for Desktops; it is changed with setCacheLimit().
+ A pixmap takes roughly (\e{width} * \e{height} * \e{depth})/8 bytes of memory.
The \e{Qt Quarterly} article
\l{http://doc.trolltech.com/qq/qq12-qpixmapcache.html}{Optimizing
@@ -92,52 +90,117 @@ static int cache_limit = 2048; // 2048 KB cache limit for embedded
static int cache_limit = 10240; // 10 MB cache limit for desktop
#endif
-// XXX: hw: is this a general concept we need to abstract?
-class QDetachedPixmap : public QPixmap
+/*!
+ Constructs an empty Key object.
+*/
+QPixmapCache::Key::Key() : d(0)
{
-public:
- QDetachedPixmap(const QPixmap &pix) : QPixmap(pix)
- {
- if (data && data->classId() == QPixmapData::RasterClass) {
- QRasterPixmapData *d = static_cast<QRasterPixmapData*>(data);
- if (!d->image.isNull() && d->image.d->paintEngine
- && !d->image.d->paintEngine->isActive())
- {
- delete d->image.d->paintEngine;
- d->image.d->paintEngine = 0;
- }
- }
+}
+
+/*!
+ \internal
+ Constructs a copy of \a other.
+*/
+QPixmapCache::Key::Key(const Key &other)
+{
+ if (other.d)
+ ++(other.d->ref);
+ d = other.d;
+}
+
+/*!
+ Destructor; called immediately before the object is deleted.
+*/
+QPixmapCache::Key::~Key()
+{
+ if (d && --(d->ref) == 0)
+ delete d;
+}
+
+/*!
+ \internal
+
+ Returns true if this key is the same as the given \a key.
+*/
+bool QPixmapCache::Key::operator ==(const Key &key) const
+{
+ return (d == key.d);
+}
+
+/*!
+ \internal
+*/
+QPixmapCache::Key &QPixmapCache::Key::operator =(const Key &other)
+{
+ if (d != other.d) {
+ if (other.d)
+ ++(other.d->ref);
+ if (d && --(d->ref) == 0)
+ delete d;
+ d = other.d;
}
-};
+ return *this;
+}
-class QPMCache : public QObject, public QCache<qint64, QDetachedPixmap>
+class QPMCache : public QObject, public QCache<QPixmapCache::Key, QDetachedPixmap>
{
Q_OBJECT
public:
- QPMCache()
- : QObject(0),
- QCache<qint64, QDetachedPixmap>(cache_limit * 1024),
- theid(0), ps(0), t(false) { }
- ~QPMCache() { }
+ QPMCache();
+ ~QPMCache();
void timerEvent(QTimerEvent *);
bool insert(const QString& key, const QPixmap &pixmap, int cost);
+ QPixmapCache::Key insert(const QPixmap &pixmap, int cost);
+ bool replace(const QPixmapCache::Key &key, const QPixmap &pixmap, int cost);
bool remove(const QString &key);
+ bool remove(const QPixmapCache::Key &key);
+
+ void resizeKeyArray(int size);
+ QPixmapCache::Key createKey();
+ void releaseKey(const QPixmapCache::Key &key);
+ void clear();
QPixmap *object(const QString &key) const;
+ QPixmap *object(const QPixmapCache::Key &key) const;
+
+ static inline QPixmapCache::KeyData *get(const QPixmapCache::Key &key)
+ {return key.d;}
+
+ static QPixmapCache::KeyData* getKeyData(QPixmapCache::Key *key);
private:
- QHash<QString, qint64> cacheKeys;
+ int *keyArray;
int theid;
int ps;
+ int keyArraySize;
+ int freeKey;
+ QHash<QString, QPixmapCache::Key> cacheKeys;
bool t;
};
+
QT_BEGIN_INCLUDE_NAMESPACE
#include "qpixmapcache.moc"
QT_END_INCLUDE_NAMESPACE
+static uint qHash(const QPixmapCache::Key &k)
+{
+ return qHash(QPMCache::get(k)->key);
+}
+
+QPMCache::QPMCache()
+ : QObject(0),
+ QCache<QPixmapCache::Key, QDetachedPixmap>(cache_limit * 1024),
+ keyArray(0), theid(0), ps(0), keyArraySize(0), freeKey(0), t(false)
+{
+}
+QPMCache::~QPMCache()
+{
+ free(keyArray);
+}
+
/*
- This is supposed to cut the cache size down by about 80-90% in a
+ This is supposed to cut the cache size down by about 25% in a
minute once the application becomes idle, to let any inserted pixmap
remain in the cache for some time before it becomes a candidate for
cleaning-up, and to not cut down the size of the cache while the
@@ -146,23 +209,28 @@ QT_END_INCLUDE_NAMESPACE
When the last pixmap has been deleted from the cache, kill the
timer so Qt won't keep the CPU from going into sleep mode.
*/
-
void QPMCache::timerEvent(QTimerEvent *)
{
int mc = maxCost();
bool nt = totalCost() == ps;
+ QList<QPixmapCache::Key> keys = QCache<QPixmapCache::Key, QDetachedPixmap>::keys();
setMaxCost(nt ? totalCost() * 3 / 4 : totalCost() -1);
setMaxCost(mc);
ps = totalCost();
- QHash<QString, qint64>::iterator it = cacheKeys.begin();
+ QHash<QString, QPixmapCache::Key>::iterator it = cacheKeys.begin();
while (it != cacheKeys.end()) {
if (!contains(it.value())) {
+ releaseKey(it.value());
it = cacheKeys.erase(it);
} else {
++it;
}
}
+ for (int i = 0; i < keys.size(); ++i) {
+ if (!contains(keys.at(i)))
+ releaseKey(keys.at(i));
+ }
if (!size()) {
killTimer(theid);
@@ -176,38 +244,154 @@ void QPMCache::timerEvent(QTimerEvent *)
QPixmap *QPMCache::object(const QString &key) const
{
- return QCache<qint64, QDetachedPixmap>::object(cacheKeys.value(key, -1));
+ QPixmapCache::Key cacheKey = cacheKeys.value(key);
+ if (!cacheKey.d || !cacheKey.d->isValid) {
+ const_cast<QPMCache *>(this)->cacheKeys.remove(key);
+ return 0;
+ }
+ QPixmap *ptr = QCache<QPixmapCache::Key, QDetachedPixmap>::object(cacheKey);
+ //We didn't find the pixmap in the cache, the key is not valid anymore
+ if (!ptr) {
+ const_cast<QPMCache *>(this)->cacheKeys.remove(key);
+ const_cast<QPMCache *>(this)->releaseKey(cacheKey);
+ }
+ return ptr;
}
+QPixmap *QPMCache::object(const QPixmapCache::Key &key) const
+{
+ Q_ASSERT(key.d->isValid);
+ QPixmap *ptr = QCache<QPixmapCache::Key, QDetachedPixmap>::object(key);
+ //We didn't find the pixmap in the cache, the key is not valid anymore
+ if (!ptr)
+ const_cast<QPMCache *>(this)->releaseKey(key);
+ return ptr;
+}
bool QPMCache::insert(const QString& key, const QPixmap &pixmap, int cost)
{
- qint64 cacheKey = pixmap.cacheKey();
- if (QCache<qint64, QDetachedPixmap>::object(cacheKey)) {
+ QPixmapCache::Key cacheKey;
+ QPixmapCache::Key oldCacheKey = cacheKeys.value(key);
+ //If for the same key we add already a pixmap we should delete it
+ if (oldCacheKey.d) {
+ QCache<QPixmapCache::Key, QDetachedPixmap>::remove(oldCacheKey);
+ cacheKey = oldCacheKey;
+ } else {
+ cacheKey = createKey();
+ }
+
+ bool success = QCache<QPixmapCache::Key, QDetachedPixmap>::insert(cacheKey, new QDetachedPixmap(pixmap), cost);
+ if (success) {
cacheKeys.insert(key, cacheKey);
- return true;
+ if (!theid) {
+ theid = startTimer(30000);
+ t = false;
+ }
+ } else {
+ //Insertion failed we released the new allocated key
+ releaseKey(cacheKey);
}
- qint64 oldCacheKey = cacheKeys.value(key, -1);
- //If for the same key we add already a pixmap we should delete it
- if (oldCacheKey != -1)
- QCache<qint64, QDetachedPixmap>::remove(oldCacheKey);
+ return success;
+}
- bool success = QCache<qint64, QDetachedPixmap>::insert(cacheKey, new QDetachedPixmap(pixmap), cost);
+QPixmapCache::Key QPMCache::insert(const QPixmap &pixmap, int cost)
+{
+ QPixmapCache::Key cacheKey = createKey();
+ bool success = QCache<QPixmapCache::Key, QDetachedPixmap>::insert(cacheKey, new QDetachedPixmap(pixmap), cost);
if (success) {
- cacheKeys.insert(key, cacheKey);
if (!theid) {
theid = startTimer(30000);
t = false;
}
+ } else {
+ //Insertion failed we released the key and return an invalid one
+ releaseKey(cacheKey);
+ }
+ return cacheKey;
+}
+
+bool QPMCache::replace(const QPixmapCache::Key &key, const QPixmap &pixmap, int cost)
+{
+ Q_ASSERT(key.d->isValid);
+ //If for the same key we add already a pixmap we should delete it
+ QCache<QPixmapCache::Key, QDetachedPixmap>::remove(key);
+
+ bool success = QCache<QPixmapCache::Key, QDetachedPixmap>::insert(key, new QDetachedPixmap(pixmap), cost);
+ if (success && !theid) {
+ theid = startTimer(30000);
+ t = false;
}
return success;
}
bool QPMCache::remove(const QString &key)
{
- qint64 cacheKey = cacheKeys.value(key, -1);
+ QPixmapCache::Key cacheKey = cacheKeys.value(key);
+ //The key was not in the cache
+ if (!cacheKey.d)
+ return false;
cacheKeys.remove(key);
- return QCache<qint64, QDetachedPixmap>::remove(cacheKey);
+ releaseKey(cacheKey);
+ return QCache<QPixmapCache::Key, QDetachedPixmap>::remove(cacheKey);
+}
+
+bool QPMCache::remove(const QPixmapCache::Key &key)
+{
+ releaseKey(key);
+ return QCache<QPixmapCache::Key, QDetachedPixmap>::remove(key);
+}
+
+void QPMCache::resizeKeyArray(int size)
+{
+ if (size <= keyArraySize || size == 0)
+ return;
+ keyArray = reinterpret_cast<int *>(realloc(keyArray, size * sizeof(int)));
+ for (int i = keyArraySize; i != size; ++i)
+ keyArray[i] = i + 1;
+ keyArraySize = size;
+}
+
+QPixmapCache::Key QPMCache::createKey()
+{
+ if (freeKey == keyArraySize)
+ resizeKeyArray(keyArraySize ? keyArraySize << 1 : 2);
+ int id = freeKey;
+ freeKey = keyArray[id];
+ QPixmapCache::Key key;
+ QPixmapCache::KeyData *d = QPMCache::getKeyData(&key);
+ d->key = ++id;
+ return key;
+}
+
+void QPMCache::releaseKey(const QPixmapCache::Key &key)
+{
+ if (key.d->key > keyArraySize || key.d->key <= 0)
+ return;
+ key.d->key--;
+ keyArray[key.d->key] = freeKey;
+ freeKey = key.d->key;
+ key.d->isValid = false;
+ key.d->key = 0;
+}
+
+void QPMCache::clear()
+{
+ free(keyArray);
+ keyArray = 0;
+ freeKey = 0;
+ keyArraySize = 0;
+ //Mark all keys as invalid
+ QList<QPixmapCache::Key> keys = QCache<QPixmapCache::Key, QDetachedPixmap>::keys();
+ for (int i = 0; i < keys.size(); ++i)
+ keys.at(i).d->isValid = false;
+ QCache<QPixmapCache::Key, QDetachedPixmap>::clear();
+}
+
+QPixmapCache::KeyData* QPMCache::getKeyData(QPixmapCache::Key *key)
+{
+ if (!key->d)
+ key->d = new QPixmapCache::KeyData;
+ return key->d;
}
Q_GLOBAL_STATIC(QPMCache, pm_cache)
@@ -222,7 +406,7 @@ Q_GLOBAL_STATIC(QPMCache, pm_cache)
\warning If valid, you should copy the pixmap immediately (this is
fast). Subsequent insertions into the cache could cause the
pointer to become invalid. For this reason, we recommend you use
- find(const QString&, QPixmap&) instead.
+ bool find(const QString&, QPixmap*) instead.
Example:
\snippet doc/src/snippets/code/src_gui_image_qpixmapcache.cpp 0
@@ -235,6 +419,17 @@ QPixmap *QPixmapCache::find(const QString &key)
/*!
+ \obsolete
+
+ Use bool find(const QString&, QPixmap*) instead.
+*/
+
+bool QPixmapCache::find(const QString &key, QPixmap& pixmap)
+{
+ return find(key, &pixmap);
+}
+
+/*!
Looks for a cached pixmap associated with the \a key in the cache.
If the pixmap is found, the function sets \a pm to that pixmap and
returns true; otherwise it leaves \a pm alone and returns false.
@@ -243,14 +438,31 @@ QPixmap *QPixmapCache::find(const QString &key)
\snippet doc/src/snippets/code/src_gui_image_qpixmapcache.cpp 1
*/
-bool QPixmapCache::find(const QString &key, QPixmap& pm)
+bool QPixmapCache::find(const QString &key, QPixmap* pixmap)
{
QPixmap *ptr = pm_cache()->object(key);
- if (ptr)
- pm = *ptr;
+ if (ptr && pixmap)
+ *pixmap = *ptr;
return ptr != 0;
}
+/*!
+ Looks for a cached pixmap associated with the \a key in the cache.
+ If the pixmap is found, the function sets \a pm to that pixmap and
+ returns true; otherwise it leaves \a pm alone and returns false. If
+ the pixmap is not found, it means that the \a key is not valid anymore,
+ so it will be released for the next insertion.
+*/
+bool QPixmapCache::find(const Key &key, QPixmap* pixmap)
+{
+ //The key is not valid anymore, a flush happened before probably
+ if (!key.d || !key.d->isValid)
+ return false;
+ QPixmap *ptr = pm_cache()->object(key);
+ if (ptr && pixmap)
+ *pixmap = *ptr;
+ return ptr != 0;
+}
/*!
Inserts a copy of the pixmap \a pm associated with the \a key into
@@ -272,9 +484,43 @@ bool QPixmapCache::find(const QString &key, QPixmap& pm)
\sa setCacheLimit()
*/
-bool QPixmapCache::insert(const QString &key, const QPixmap &pm)
+bool QPixmapCache::insert(const QString &key, const QPixmap &pixmap)
+{
+ return pm_cache()->insert(key, pixmap, pixmap.width() * pixmap.height() * pixmap.depth() / 8);
+}
+
+/*!
+ Inserts a copy of the pixmap \a pm into
+ the cache and return you the key. The key is always greater than 0.
+ If the key is equals 0 then the insertion failed.
+
+ When a pixmap is inserted and the cache is about to exceed its
+ limit, it removes pixmaps until there is enough room for the
+ pixmap to be inserted.
+
+ The oldest pixmaps (least recently accessed in the cache) are
+ deleted when more space is needed.
+
+ \sa setCacheLimit(), replace()
+*/
+QPixmapCache::Key QPixmapCache::insert(const QPixmap &pixmap)
+{
+ return pm_cache()->insert(pixmap, pixmap.width() * pixmap.height() * pixmap.depth() / 8);
+}
+
+/*!
+ Replace the pixmap associated to the \a key into
+ the cache. It return true if the pixmap \a pm has been correctly
+ inserted into the cache false otherwise.
+
+ \sa setCacheLimit(), insert()
+*/
+bool QPixmapCache::replace(const Key &key, const QPixmap &pixmap)
{
- return pm_cache()->insert(key, pm, pm.width() * pm.height() * pm.depth() / 8);
+ //The key is not valid anymore, a flush happened before probably
+ if (!key.d || !key.d->isValid)
+ return false;
+ return pm_cache()->replace(key, pixmap, pixmap.width() * pixmap.height() * pixmap.depth() / 8);
}
/*!
@@ -314,6 +560,17 @@ void QPixmapCache::remove(const QString &key)
pm_cache()->remove(key);
}
+/*!
+ Removes the pixmap associated with \a key from the cache and release
+ the key for a future insertion.
+*/
+void QPixmapCache::remove(const Key &key)
+{
+ //The key is not valid anymore, a flush happened before probably
+ if (!key.d || !key.d->isValid)
+ return;
+ pm_cache()->remove(key);
+}
/*!
Removes all pixmaps from the cache.
diff --git a/src/gui/image/qpixmapcache.h b/src/gui/image/qpixmapcache.h
index 2750a88..ae64310 100644
--- a/src/gui/image/qpixmapcache.h
+++ b/src/gui/image/qpixmapcache.h
@@ -53,12 +53,35 @@ QT_MODULE(Gui)
class Q_GUI_EXPORT QPixmapCache
{
public:
+ class KeyData;
+ class Key
+ {
+ public:
+ Key();
+ Key(const Key &other);
+ ~Key();
+ bool operator ==(const Key &key) const;
+ inline bool operator !=(const Key &key) const
+ { return !operator==(key); }
+ Key &operator =(const Key &other);
+
+ private:
+ KeyData *d;
+ friend class QPMCache;
+ friend class QPixmapCache;
+ };
+
static int cacheLimit();
static void setCacheLimit(int);
static QPixmap *find(const QString &key);
- static bool find(const QString &key, QPixmap&);
- static bool insert(const QString &key, const QPixmap&);
+ static bool find(const QString &key, QPixmap &pixmap);
+ static bool find(const QString &key, QPixmap *pixmap);
+ static bool find(const Key &key, QPixmap *pixmap);
+ static bool insert(const QString &key, const QPixmap &pixmap);
+ static Key insert(const QPixmap &pixmap);
+ static bool replace(const Key &key, const QPixmap &pixmap);
static void remove(const QString &key);
+ static void remove(const Key &key);
static void clear();
};
diff --git a/src/gui/image/qpixmapcache_p.h b/src/gui/image/qpixmapcache_p.h
new file mode 100644
index 0000000..66b30d2
--- /dev/null
+++ b/src/gui/image/qpixmapcache_p.h
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the 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 QPIXMAPCACHE_P_H
+#define QPIXMAPCACHE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. This header
+// file may change from version to version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qpixmapcache.h"
+#include "qpaintengine.h"
+#include <private/qimage_p.h>
+#include <private/qpixmap_raster_p.h>
+#include "qcache.h"
+
+class QPixmapCache::KeyData
+{
+public:
+ KeyData() : isValid(true), key(0), ref(1) {}
+ KeyData(const KeyData &other)
+ : isValid(other.isValid), key(other.key), ref(1) {}
+ ~KeyData() {}
+
+ bool isValid;
+ int key;
+ int ref;
+};
+
+// XXX: hw: is this a general concept we need to abstract?
+class QDetachedPixmap : public QPixmap
+{
+public:
+ QDetachedPixmap(const QPixmap &pix) : QPixmap(pix)
+ {
+ if (data && data->classId() == QPixmapData::RasterClass) {
+ QRasterPixmapData *d = static_cast<QRasterPixmapData*>(data);
+ if (!d->image.isNull() && d->image.d->paintEngine
+ && !d->image.d->paintEngine->isActive())
+ {
+ delete d->image.d->paintEngine;
+ d->image.d->paintEngine = 0;
+ }
+ }
+ }
+};
+
+#endif // QPIXMAPCACHE_P_H
diff --git a/tests/auto/qpixmapcache/tst_qpixmapcache.cpp b/tests/auto/qpixmapcache/tst_qpixmapcache.cpp
index 1f515ff..405ac34 100644
--- a/tests/auto/qpixmapcache/tst_qpixmapcache.cpp
+++ b/tests/auto/qpixmapcache/tst_qpixmapcache.cpp
@@ -44,9 +44,7 @@
#include <qpixmapcache.h>
-
-
-
+#include "../../../src/gui/image/qpixmapcache_p.h"
//TESTED_CLASS=
@@ -68,10 +66,21 @@ private slots:
void setCacheLimit();
void find();
void insert();
+ void replace();
void remove();
void clear();
+ void pixmapKey();
};
+static QPixmapCache::KeyData* getPrivate(QPixmapCache::Key &key)
+{
+ return (*reinterpret_cast<QPixmapCache::KeyData**>(&key));
+}
+
+static QPixmapCache::KeyData** getPrivateRef(QPixmapCache::Key &key)
+{
+ return (reinterpret_cast<QPixmapCache::KeyData**>(&key));
+}
static int originalCacheLimit;
@@ -119,6 +128,72 @@ void tst_QPixmapCache::setCacheLimit()
QVERIFY(QPixmapCache::find("P1") != 0);
delete p1;
+
+ //The int part of the API
+ p1 = new QPixmap(2, 3);
+ QPixmapCache::Key key = QPixmapCache::insert(*p1);
+ QVERIFY(QPixmapCache::find(key, p1) != 0);
+ delete p1;
+
+ QPixmapCache::setCacheLimit(0);
+ QVERIFY(QPixmapCache::find(key, p1) == 0);
+
+ p1 = new QPixmap(2, 3);
+ QPixmapCache::setCacheLimit(1000);
+ QPixmapCache::replace(key, *p1);
+ QVERIFY(QPixmapCache::find(key, p1) == 0);
+
+ delete p1;
+
+ //Let check if keys are released when the pixmap cache is
+ //full or has been flushed.
+ QPixmapCache::clear();
+ p1 = new QPixmap(2, 3);
+ key = QPixmapCache::insert(*p1);
+ QVERIFY(QPixmapCache::find(key, p1) != 0);
+ QPixmapCache::setCacheLimit(0);
+ QVERIFY(QPixmapCache::find(key, p1) == 0);
+ QPixmapCache::setCacheLimit(1000);
+ key = QPixmapCache::insert(*p1);
+ QCOMPARE(getPrivate(key)->isValid, true);
+ QCOMPARE(getPrivate(key)->key, 1);
+
+ delete p1;
+
+ //Let check if removing old entries doesn't let you get
+ // wrong pixmaps
+ QPixmapCache::clear();
+ QPixmap p2;
+ p1 = new QPixmap(2, 3);
+ key = QPixmapCache::insert(*p1);
+ QVERIFY(QPixmapCache::find(key, &p2) != 0);
+ //we flush the cache
+ QPixmapCache::setCacheLimit(0);
+ QPixmapCache::setCacheLimit(1000);
+ QPixmapCache::Key key2 = QPixmapCache::insert(*p1);
+ QCOMPARE(getPrivate(key2)->key, 2);
+ QVERIFY(QPixmapCache::find(key, &p2) == 0);
+ QVERIFY(QPixmapCache::find(key2, &p2) != 0);
+ QCOMPARE(p2, *p1);
+
+ delete p1;
+
+ //Here we simulate the flushing when the app is idle
+ /*QPixmapCache::clear();
+ QPixmapCache::setCacheLimit(originalCacheLimit);
+ p1 = new QPixmap(300, 300);
+ key = QPixmapCache::insert(*p1);
+ QCOMPARE(getPrivate(key)->key, 1);
+ key2 = QPixmapCache::insert(*p1);
+ key2 = QPixmapCache::insert(*p1);
+ QPixmapCache::Key key3 = QPixmapCache::insert(*p1);
+ QTest::qWait(32000);
+ key2 = QPixmapCache::insert(*p1);
+ QCOMPARE(getPrivate(key2)->key, 1);
+ //This old key is not valid anymore after the flush
+ QCOMPARE(getPrivate(key)->isValid, false);
+ QVERIFY(QPixmapCache::find(key, &p2) == 0);
+ delete p1;*/
}
void tst_QPixmapCache::find()
@@ -137,6 +212,28 @@ void tst_QPixmapCache::find()
QPixmap *p3 = QPixmapCache::find("P1");
QVERIFY(p3);
QCOMPARE(p1, *p3);
+
+ //The int part of the API
+ QPixmapCache::Key key = QPixmapCache::insert(p1);
+
+ QVERIFY(QPixmapCache::find(key, &p2));
+ QCOMPARE(p2.width(), 10);
+ QCOMPARE(p2.height(), 10);
+ QCOMPARE(p1, p2);
+
+ QPixmapCache::clear();
+
+ key = QPixmapCache::insert(p1);
+
+ //The int part of the API
+ // make sure it doesn't explode
+ QList<QPixmapCache::Key> keys;
+ for (int i = 0; i < 40000; ++i)
+ QPixmapCache::insert(p1);
+
+ //at that time the first key has been erase because no more place in the cache
+ QVERIFY(QPixmapCache::find(key, &p1) == 0);
+ QCOMPARE(getPrivate(key)->isValid, false);
}
void tst_QPixmapCache::insert()
@@ -152,18 +249,22 @@ void tst_QPixmapCache::insert()
QPixmapCache::insert("0", p1);
// ditto
- for (int j = 0; j < 20000; ++j)
+ for (int j = 0; j < 40000; ++j)
QPixmapCache::insert(QString::number(j), p1);
int num = 0;
- for (int k = 0; k < 20000; ++k) {
+ for (int k = 0; k < 40000; ++k) {
if (QPixmapCache::find(QString::number(k)))
++num;
}
+ if (QPixmapCache::find("0"))
+ ++num;
+
int estimatedNum = (1024 * QPixmapCache::cacheLimit())
/ ((p1.width() * p1.height() * p1.depth()) / 8);
- QVERIFY(estimatedNum - 1 <= num <= estimatedNum + 1);
+
+ QVERIFY(num <= estimatedNum);
QPixmap p3;
QPixmapCache::insert("null", p3);
@@ -176,6 +277,50 @@ void tst_QPixmapCache::insert()
QPixmapCache::insert("custom", c2);
//We have deleted the old pixmap in the cache for the same key
QVERIFY(c1.isDetached());
+
+ //The int part of the API
+ // make sure it doesn't explode
+ QList<QPixmapCache::Key> keys;
+ for (int i = 0; i < 40000; ++i)
+ keys.append(QPixmapCache::insert(p1));
+
+ num = 0;
+ for (int k = 0; k < 40000; ++k) {
+ if (QPixmapCache::find(keys.at(k), &p2))
+ ++num;
+ }
+
+ estimatedNum = (1024 * QPixmapCache::cacheLimit())
+ / ((p1.width() * p1.height() * p1.depth()) / 8);
+ QVERIFY(num <= estimatedNum);
+ QPixmapCache::insert(p3);
+
+}
+
+void tst_QPixmapCache::replace()
+{
+ //The int part of the API
+ QPixmap p1(10, 10);
+ p1.fill(Qt::red);
+
+ QPixmap p2(10, 10);
+ p2.fill(Qt::yellow);
+
+ QPixmapCache::Key key = QPixmapCache::insert(p1);
+
+ QPixmap p3;
+ QVERIFY(QPixmapCache::find(key, &p3) == 1);
+
+ QPixmapCache::replace(key,p2);
+
+ QVERIFY(QPixmapCache::find(key, &p3) == 1);
+
+ QCOMPARE(p3.width(), 10);
+ QCOMPARE(p3.height(), 10);
+ QCOMPARE(p3, p2);
+
+ //Broken keys
+ QCOMPARE(QPixmapCache::replace(QPixmapCache::Key(), p2), false);
}
void tst_QPixmapCache::remove()
@@ -198,6 +343,40 @@ void tst_QPixmapCache::remove()
QPixmapCache::remove("green");
QVERIFY(QPixmapCache::find("green") == 0);
+
+ //The int part of the API
+ QPixmapCache::clear();
+ p1.fill(Qt::red);
+ QPixmapCache::Key key = QPixmapCache::insert(p1);
+ p1.fill(Qt::yellow);
+
+ QVERIFY(QPixmapCache::find(key, &p2));
+ QVERIFY(p1.toImage() != p2.toImage());
+ QVERIFY(p1.toImage() == p1.toImage()); // sanity check
+
+ QPixmapCache::remove(key);
+ QVERIFY(QPixmapCache::find(key, &p1) == 0);
+
+ //Broken key
+ QPixmapCache::remove(QPixmapCache::Key());
+ QVERIFY(QPixmapCache::find(QPixmapCache::Key(), &p1) == 0);
+
+ //Test if keys are release
+ QPixmapCache::clear();
+ key = QPixmapCache::insert(p1);
+ QCOMPARE(getPrivate(key)->key, 1);
+ QPixmapCache::remove(key);
+ key = QPixmapCache::insert(p1);
+ QCOMPARE(getPrivate(key)->key, 1);
+
+ //We mix both part of the API
+ QPixmapCache::clear();
+ p1.fill(Qt::red);
+ QPixmapCache::insert("red", p1);
+ key = QPixmapCache::insert(p1);
+ QPixmapCache::remove(key);
+ QVERIFY(QPixmapCache::find(key, &p1) == 0);
+ QVERIFY(QPixmapCache::find("red") != 0);
}
void tst_QPixmapCache::clear()
@@ -205,12 +384,11 @@ void tst_QPixmapCache::clear()
QPixmap p1(10, 10);
p1.fill(Qt::red);
- for (int i = 0; i < 20000; ++i) {
+ for (int i = 0; i < 20000; ++i)
QVERIFY(QPixmapCache::find("x" + QString::number(i)) == 0);
- }
- for (int j = 0; j < 20000; ++j) {
+
+ for (int j = 0; j < 20000; ++j)
QPixmapCache::insert(QString::number(j), p1);
- }
int num = 0;
for (int k = 0; k < 20000; ++k) {
@@ -221,10 +399,68 @@ void tst_QPixmapCache::clear()
QPixmapCache::clear();
- for (int k = 0; k < 20000; ++k) {
+ for (int k = 0; k < 20000; ++k)
QVERIFY(QPixmapCache::find(QString::number(k)) == 0);
+
+ //The int part of the API
+ QPixmap p2(10, 10);
+ p2.fill(Qt::red);
+
+ QList<QPixmapCache::Key> keys;
+ for (int k = 0; k < 20000; ++k)
+ keys.append(QPixmapCache::insert(p2));
+
+ QPixmapCache::clear();
+
+ for (int k = 0; k < 20000; ++k) {
+ QVERIFY(QPixmapCache::find(keys.at(k), &p1) == 0);
+ QCOMPARE(getPrivate(keys[k])->isValid, false);
}
}
+void tst_QPixmapCache::pixmapKey()
+{
+ QPixmapCache::Key key;
+ //Default constructed keys have no d pointer unless
+ //we use them
+ QVERIFY(!getPrivate(key));
+ //Let's put a d pointer
+ QPixmapCache::KeyData** keyd = getPrivateRef(key);
+ *keyd = new QPixmapCache::KeyData;
+ QCOMPARE(getPrivate(key)->ref, 1);
+ QPixmapCache::Key key2;
+ //Let's put a d pointer
+ QPixmapCache::KeyData** key2d = getPrivateRef(key2);
+ *key2d = new QPixmapCache::KeyData;
+ QCOMPARE(getPrivate(key2)->ref, 1);
+ key = key2;
+ QCOMPARE(getPrivate(key2)->ref, 2);
+ QCOMPARE(getPrivate(key)->ref, 2);
+ QPixmapCache::Key key3;
+ //Let's put a d pointer
+ QPixmapCache::KeyData** key3d = getPrivateRef(key3);
+ *key3d = new QPixmapCache::KeyData;
+ QPixmapCache::Key key4 = key3;
+ QCOMPARE(getPrivate(key3)->ref, 2);
+ QCOMPARE(getPrivate(key4)->ref, 2);
+ key4 = key;
+ QCOMPARE(getPrivate(key4)->ref, 3);
+ QCOMPARE(getPrivate(key3)->ref, 1);
+ QPixmapCache::Key key5(key3);
+ QCOMPARE(getPrivate(key3)->ref, 2);
+ QCOMPARE(getPrivate(key5)->ref, 2);
+
+ //let test default constructed keys
+ QPixmapCache::Key key6;
+ QVERIFY(!getPrivate(key6));
+ QPixmapCache::Key key7;
+ QVERIFY(!getPrivate(key7));
+ key6 = key7;
+ QVERIFY(!getPrivate(key6));
+ QVERIFY(!getPrivate(key7));
+ QPixmapCache::Key key8(key7);
+ QVERIFY(!getPrivate(key8));
+}
+
QTEST_MAIN(tst_QPixmapCache)
#include "tst_qpixmapcache.moc"
diff --git a/tests/benchmarks/qgraphicsview/tst_qgraphicsview.cpp b/tests/benchmarks/qgraphicsview/tst_qgraphicsview.cpp
index a293de4..a06e033 100644
--- a/tests/benchmarks/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/benchmarks/qgraphicsview/tst_qgraphicsview.cpp
@@ -705,7 +705,6 @@ public:
QGraphicsPixmapItem::paint(painter,option,widget);
//We just want to wait, and we don't want to process the event loop with qWait
QTest::qSleep(3);
-
}
protected:
void advance(int i)
diff --git a/tests/benchmarks/qpixmapcache/qpixmapcache.pro b/tests/benchmarks/qpixmapcache/qpixmapcache.pro
new file mode 100644
index 0000000..e0d7543
--- /dev/null
+++ b/tests/benchmarks/qpixmapcache/qpixmapcache.pro
@@ -0,0 +1,6 @@
+load(qttest_p4)
+TEMPLATE = app
+TARGET = tst_qpixmapcache
+TEMPLATE = app
+# Input
+SOURCES += tst_qpixmapcache.cpp
diff --git a/tests/benchmarks/qpixmapcache/tst_qpixmapcache.cpp b/tests/benchmarks/qpixmapcache/tst_qpixmapcache.cpp
new file mode 100644
index 0000000..f3c1134
--- /dev/null
+++ b/tests/benchmarks/qpixmapcache/tst_qpixmapcache.cpp
@@ -0,0 +1,226 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite 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 <qtest.h>
+#include <QPixmapCache>
+//TESTED_FILES=
+
+class tst_QPixmapCache : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QPixmapCache();
+ virtual ~tst_QPixmapCache();
+
+public slots:
+ void init();
+ void cleanup();
+
+private slots:
+ void insert_data();
+ void insert();
+ void find_data();
+ void find();
+ void styleUseCaseComplexKey();
+ void styleUseCaseComplexKey_data();
+};
+
+tst_QPixmapCache::tst_QPixmapCache()
+{
+}
+
+tst_QPixmapCache::~tst_QPixmapCache()
+{
+}
+
+void tst_QPixmapCache::init()
+{
+}
+
+void tst_QPixmapCache::cleanup()
+{
+}
+
+void tst_QPixmapCache::insert_data()
+{
+ QTest::addColumn<bool>("cacheType");
+ QTest::newRow("QPixmapCache") << true;
+ QTest::newRow("QPixmapCache (int API)") << false;
+}
+
+QList<QPixmapCache::Key> keys;
+
+void tst_QPixmapCache::insert()
+{
+ QFETCH(bool, cacheType);
+ QPixmap p;
+ if (cacheType) {
+ QBENCHMARK {
+ for (int i = 0 ; i <= 10000 ; i++)
+ {
+ QString tmp;
+ tmp.sprintf("my-key-%d", i);
+ QPixmapCache::insert(tmp, p);
+ }
+ }
+ } else {
+ QBENCHMARK {
+ for (int i = 0 ; i <= 10000 ; i++)
+ keys.append(QPixmapCache::insert(p));
+ }
+ }
+}
+
+void tst_QPixmapCache::find_data()
+{
+ QTest::addColumn<bool>("cacheType");
+ QTest::newRow("QPixmapCache") << true;
+ QTest::newRow("QPixmapCache (int API)") << false;
+}
+
+void tst_QPixmapCache::find()
+{
+ QFETCH(bool, cacheType);
+ QPixmap p;
+ if (cacheType) {
+ QBENCHMARK {
+ QString tmp;
+ for (int i = 0 ; i <= 10000 ; i++)
+ {
+ tmp.sprintf("my-key-%d", i);
+ QPixmapCache::find(tmp, p);
+ }
+ }
+ } else {
+ QBENCHMARK {
+ for (int i = 0 ; i <= 10000 ; i++)
+ QPixmapCache::find(keys.at(i), &p);
+ }
+ }
+
+}
+
+void tst_QPixmapCache::styleUseCaseComplexKey_data()
+{
+ QTest::addColumn<bool>("cacheType");
+ QTest::newRow("QPixmapCache") << true;
+ QTest::newRow("QPixmapCache (int API)") << false;
+}
+
+struct styleStruct {
+ QString key;
+ uint state;
+ uint direction;
+ uint complex;
+ uint palette;
+ int width;
+ int height;
+ bool operator==(const styleStruct &str) const
+ {
+ return str.key == key && str.state == state && str.direction == direction
+ && str.complex == complex && str.palette == palette && str.width == width
+ && str.height == height;
+ }
+};
+
+uint qHash(const styleStruct &myStruct)
+{
+ return qHash(myStruct.state);
+}
+
+void tst_QPixmapCache::styleUseCaseComplexKey()
+{
+ QFETCH(bool, cacheType);
+ QPixmap p;
+ if (cacheType) {
+ QBENCHMARK {
+ for (int i = 0 ; i <= 10000 ; i++)
+ {
+ QString tmp;
+ tmp.sprintf("%s-%d-%d-%d-%d-%d-%d", QString("my-progressbar-%1").arg(i).toLatin1().constData(), 5, 3, 0, 358, 100, 200);
+ QPixmapCache::insert(tmp, p);
+ }
+
+ for (int i = 0 ; i <= 10000 ; i++)
+ {
+ QString tmp;
+ tmp.sprintf("%s-%d-%d-%d-%d-%d-%d", QString("my-progressbar-%1").arg(i).toLatin1().constData(), 5, 3, 0, 358, 100, 200);
+ QPixmapCache::find(tmp, p);
+ }
+ }
+ } else {
+ QHash<styleStruct, QPixmapCache::Key> hash;
+ QBENCHMARK {
+ for (int i = 0 ; i <= 10000 ; i++)
+ {
+ styleStruct myStruct;
+ myStruct.key = QString("my-progressbar-%1").arg(i);
+ myStruct.key = 5;
+ myStruct.key = 4;
+ myStruct.key = 3;
+ myStruct.palette = 358;
+ myStruct.width = 100;
+ myStruct.key = 200;
+ QPixmapCache::Key key = QPixmapCache::insert(p);
+ hash.insert(myStruct, key);
+ }
+ for (int i = 0 ; i <= 10000 ; i++)
+ {
+ styleStruct myStruct;
+ myStruct.key = QString("my-progressbar-%1").arg(i);
+ myStruct.key = 5;
+ myStruct.key = 4;
+ myStruct.key = 3;
+ myStruct.palette = 358;
+ myStruct.width = 100;
+ myStruct.key = 200;
+ QPixmapCache::Key key = hash.value(myStruct);
+ QPixmapCache::find(key, &p);
+ }
+ }
+ }
+
+}
+
+
+QTEST_MAIN(tst_QPixmapCache)
+#include "tst_qpixmapcache.moc"
diff --git a/translations/assistant_ja.ts b/translations/assistant_ja.ts
index 1853155..5e4d2c9 100644
--- a/translations/assistant_ja.ts
+++ b/translations/assistant_ja.ts
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
-<TS version="2.0">
+<TS version="2.0" language="ja_JP">
<context>
<name>AboutDialog</name>
<message>
<location filename="../tools/assistant/tools/assistant/aboutdialog.cpp" line="+110"/>
<source>&amp;Close</source>
- <translation type="unfinished"></translation>
+ <translation>閉じる(&amp;C)</translation>
</message>
</context>
<context>
@@ -14,18 +14,19 @@
<message>
<location line="-14"/>
<source>Warning</source>
- <translation type="unfinished"></translation>
+ <translation>警告</translation>
</message>
<message>
<location line="+1"/>
<source>Unable to launch external application.
</source>
- <translation type="unfinished"></translation>
+ <translation>外部アプリケーションを起動できません。
+</translation>
</message>
<message>
<location line="+1"/>
<source>OK</source>
- <translation type="unfinished"></translation>
+ <translation>OK</translation>
</message>
</context>
<context>
@@ -37,42 +38,42 @@
<location line="+24"/>
<location line="+32"/>
<source>Bookmarks</source>
- <translation type="unfinished"></translation>
+ <translation>ブックマーク</translation>
</message>
<message>
<location filename="../tools/assistant/tools/assistant/bookmarkdialog.ui"/>
<source>Add Bookmark</source>
- <translation type="unfinished"></translation>
+ <translation>ブックマークの追加</translation>
</message>
<message>
<location/>
<source>Bookmark:</source>
- <translation type="unfinished"></translation>
+ <translation>ブックマーク:</translation>
</message>
<message>
<location/>
<source>Add in Folder:</source>
- <translation type="unfinished"></translation>
+ <translation>追加先フォルダ:</translation>
</message>
<message>
<location/>
<source>+</source>
- <translation type="unfinished"></translation>
+ <translation>+</translation>
</message>
<message>
<location/>
<source>New Folder</source>
- <translation type="unfinished"></translation>
+ <translation>新しいフォルダ</translation>
</message>
<message>
<location filename="../tools/assistant/tools/assistant/bookmarkmanager.cpp" line="-69"/>
<source>Delete Folder</source>
- <translation type="unfinished"></translation>
+ <translation>フォルダを削除</translation>
</message>
<message>
<location line="+1"/>
<source>Rename Folder</source>
- <translation type="unfinished"></translation>
+ <translation>フォルダの名前変更</translation>
</message>
</context>
<context>
@@ -80,23 +81,23 @@
<message>
<location line="+450"/>
<source>Bookmarks</source>
- <translation type="unfinished"></translation>
+ <translation>ブックマーク</translation>
</message>
<message>
<location line="+36"/>
<source>Remove</source>
- <translation type="unfinished"></translation>
+ <translation>削除</translation>
</message>
<message>
<location line="+1"/>
<source>You are going to delete a Folder, this will also&lt;br&gt;remove it&apos;s content. Are you sure to continue?</source>
- <translation type="unfinished"></translation>
+ <translation>フォルダを削除すると中身も削除されますが、続けてよろしいですか?</translation>
</message>
<message>
<location line="+109"/>
<location line="+9"/>
<source>New Folder</source>
- <translation type="unfinished"></translation>
+ <translation>新しいフォルダ</translation>
</message>
</context>
<context>
@@ -104,47 +105,47 @@
<message>
<location line="-391"/>
<source>Filter:</source>
- <translation type="unfinished"></translation>
+ <translation>フィルタ:</translation>
</message>
<message>
<location line="+32"/>
<source>Remove</source>
- <translation type="unfinished"></translation>
+ <translation>削除</translation>
</message>
<message>
<location line="-78"/>
<source>Delete Folder</source>
- <translation type="unfinished"></translation>
+ <translation>フォルダを削除</translation>
</message>
<message>
<location line="+1"/>
<source>Rename Folder</source>
- <translation type="unfinished"></translation>
+ <translation>フォルダの名前変更</translation>
</message>
<message>
<location line="+2"/>
<source>Show Bookmark</source>
- <translation type="unfinished"></translation>
+ <translation>ブックマークを開く</translation>
</message>
<message>
<location line="+1"/>
<source>Show Bookmark in New Tab</source>
- <translation type="unfinished"></translation>
+ <translation>ブックマークを新しいタブで開く</translation>
</message>
<message>
<location line="+3"/>
<source>Delete Bookmark</source>
- <translation type="unfinished"></translation>
+ <translation>ブックマークを削除</translation>
</message>
<message>
<location line="+1"/>
<source>Rename Bookmark</source>
- <translation type="unfinished"></translation>
+ <translation>ブックマークの名前変更</translation>
</message>
<message>
<location line="+61"/>
<source>Add</source>
- <translation type="unfinished"></translation>
+ <translation>追加</translation>
</message>
</context>
<context>
@@ -152,48 +153,48 @@
<message>
<location filename="../tools/assistant/tools/assistant/centralwidget.cpp" line="+195"/>
<source>Add new page</source>
- <translation type="unfinished"></translation>
+ <translation>新しいページの追加</translation>
</message>
<message>
<location line="+9"/>
<source>Close current page</source>
- <translation type="unfinished"></translation>
+ <translation>現在のページを閉じる</translation>
</message>
<message>
<location line="+265"/>
<source>Print Document</source>
- <translation type="unfinished"></translation>
+ <translation>ドキュメントを印刷</translation>
</message>
<message>
<location line="+147"/>
<location line="+2"/>
<source>unknown</source>
- <translation type="unfinished"></translation>
+ <translation>不明</translation>
</message>
<message>
<location line="+96"/>
<source>Add New Page</source>
- <translation type="unfinished"></translation>
+ <translation>新しいページの追加</translation>
</message>
<message>
<location line="+1"/>
<source>Close This Page</source>
- <translation type="unfinished"></translation>
+ <translation>このページを閉じる</translation>
</message>
<message>
<location line="+1"/>
<source>Close Other Pages</source>
- <translation type="unfinished"></translation>
+ <translation>他のページを閉じる</translation>
</message>
<message>
<location line="+2"/>
<source>Add Bookmark for this Page...</source>
- <translation type="unfinished"></translation>
+ <translation>このページをブックマークに追加...</translation>
</message>
<message>
<location line="+257"/>
<source>Search</source>
- <translation type="unfinished"></translation>
+ <translation>検索</translation>
</message>
</context>
<context>
@@ -201,12 +202,12 @@
<message>
<location filename="../tools/assistant/tools/assistant/contentwindow.cpp" line="+155"/>
<source>Open Link</source>
- <translation type="unfinished"></translation>
+ <translation>リンクを開く</translation>
</message>
<message>
<location line="+1"/>
<source>Open Link in New Tab</source>
- <translation type="unfinished"></translation>
+ <translation>リンクを新しいタブで開く</translation>
</message>
</context>
<context>
@@ -214,12 +215,12 @@
<message>
<location filename="../tools/assistant/tools/assistant/filternamedialog.ui"/>
<source>Add Filter Name</source>
- <translation type="unfinished"></translation>
+ <translation>フィルタ名を追加</translation>
</message>
<message>
<location/>
<source>Filter Name:</source>
- <translation type="unfinished"></translation>
+ <translation>フィルタ名:</translation>
</message>
</context>
<context>
@@ -227,27 +228,27 @@
<message>
<location filename="../tools/assistant/tools/assistant/centralwidget.cpp" line="-863"/>
<source>Previous</source>
- <translation type="unfinished"></translation>
+ <translation>戻る</translation>
</message>
<message>
<location line="+7"/>
<source>Next</source>
- <translation type="unfinished"></translation>
+ <translation>進む</translation>
</message>
<message>
<location line="+5"/>
<source>Case Sensitive</source>
- <translation type="unfinished"></translation>
+ <translation>大文字/小文字を区別する</translation>
</message>
<message>
<location line="+3"/>
<source>Whole words</source>
- <translation type="unfinished"></translation>
+ <translation>単語単位で検索する</translation>
</message>
<message>
<location line="+12"/>
<source>&lt;img src=&quot;:/trolltech/assistant/images/wrap.png&quot;&gt;&amp;nbsp;Search wrapped</source>
- <translation type="unfinished"></translation>
+ <translation>&lt;img src=&quot;:/trolltech/assistant/images/wrap.png&quot;&gt;&amp;nbsp;見つからなければ先頭から検索する</translation>
</message>
</context>
<context>
@@ -255,27 +256,27 @@
<message>
<location filename="../tools/shared/fontpanel/fontpanel.cpp" line="+63"/>
<source>Font</source>
- <translation type="unfinished"></translation>
+ <translation>フォント</translation>
</message>
<message>
<location line="+11"/>
<source>&amp;Writing system</source>
- <translation type="unfinished"></translation>
+ <translation>文字セット(&amp;W)</translation>
</message>
<message>
<location line="+3"/>
<source>&amp;Family</source>
- <translation type="unfinished"></translation>
+ <translation>フォント名(&amp;F)</translation>
</message>
<message>
<location line="+4"/>
<source>&amp;Style</source>
- <translation type="unfinished"></translation>
+ <translation>スタイル(&amp;S)</translation>
</message>
<message>
<location line="+4"/>
<source>&amp;Point size</source>
- <translation type="unfinished"></translation>
+ <translation>サイズ(&amp;P)</translation>
</message>
</context>
<context>
@@ -283,38 +284,39 @@
<message>
<location filename="../tools/assistant/tools/assistant/helpviewer.cpp" line="+481"/>
<source>Help</source>
- <translation type="unfinished"></translation>
+ <translation>ヘルプ</translation>
</message>
<message>
<location line="+1"/>
<source>OK</source>
- <translation type="unfinished"></translation>
+ <translation>OK</translation>
</message>
<message>
<location line="-62"/>
<source>&lt;title&gt;Error 404...&lt;/title&gt;&lt;div align=&quot;center&quot;&gt;&lt;br&gt;&lt;br&gt;&lt;h1&gt;The page could not be found&lt;/h1&gt;&lt;br&gt;&lt;h3&gt;&apos;%1&apos;&lt;/h3&gt;&lt;/div&gt;</source>
- <translation type="unfinished"></translation>
+ <translation>&lt;title&gt;Error 404...&lt;/title&gt;&lt;div align=&quot;center&quot;&gt;&lt;br&gt;&lt;br&gt;&lt;h1&gt;ページが見つかりませんでした&lt;/h1&gt;&lt;br&gt;&lt;h3&gt;&apos;%1&apos;&lt;/h3&gt;&lt;/div&gt;</translation>
</message>
<message>
<location line="+125"/>
<source>Copy &amp;Link Location</source>
- <translation type="unfinished"></translation>
+ <translation>リンクのURLをコピー(&amp;L)</translation>
</message>
<message>
<location line="+3"/>
<source>Open Link in New Tab Ctrl+LMB</source>
- <translation type="unfinished"></translation>
+ <translation>リンクを新しいタブで開く Ctrl+LMB</translation>
</message>
<message>
<location line="-267"/>
<source>Open Link in New Tab</source>
- <translation type="unfinished"></translation>
+ <translation>リンクを新しいタブで開く</translation>
</message>
<message>
<location line="+201"/>
<source>Unable to launch external application.
</source>
- <translation type="unfinished"></translation>
+ <translation>外部アプリケーションを起動できません。
+</translation>
</message>
</context>
<context>
@@ -322,17 +324,17 @@
<message>
<location filename="../tools/assistant/tools/assistant/indexwindow.cpp" line="+66"/>
<source>&amp;Look for:</source>
- <translation type="unfinished"></translation>
+ <translation>検索文字列(&amp;L):</translation>
</message>
<message>
<location line="+68"/>
<source>Open Link</source>
- <translation type="unfinished"></translation>
+ <translation>リンクを開く</translation>
</message>
<message>
<location line="+1"/>
<source>Open Link in New Tab</source>
- <translation type="unfinished"></translation>
+ <translation>リンクを新しいタブで開く</translation>
</message>
</context>
<context>
@@ -341,97 +343,98 @@
<location filename="../tools/assistant/tools/assistant/installdialog.cpp" line="+75"/>
<location filename="../tools/assistant/tools/assistant/installdialog.ui"/>
<source>Install Documentation</source>
- <translation type="unfinished"></translation>
+ <translation>ドキュメントのインストール</translation>
</message>
<message>
<location line="+30"/>
<source>Downloading documentation info...</source>
- <translation type="unfinished"></translation>
+ <translation>ドキュメント情報をダウンロード中...</translation>
</message>
<message>
<location line="+48"/>
<source>Download canceled.</source>
- <translation type="unfinished"></translation>
+ <translation>ダウンロードを中止しました。</translation>
</message>
<message>
<location line="+26"/>
<location line="+78"/>
<location line="+27"/>
<source>Done.</source>
- <translation type="unfinished"></translation>
+ <translation>完了.</translation>
</message>
<message>
<location line="-90"/>
<source>The file %1 already exists. Do you want to overwrite it?</source>
- <translation type="unfinished"></translation>
+ <translation>%1 は既に存在します。上書きしますか?</translation>
</message>
<message>
<location line="+11"/>
<source>Unable to save the file %1: %2.</source>
- <translation type="unfinished"></translation>
+ <translation>ファイルを保存できません。%1: %2.</translation>
</message>
<message>
<location line="+8"/>
<source>Downloading %1...</source>
- <translation type="unfinished"></translation>
+ <translation>%1 をダウンロード中...</translation>
</message>
<message>
<location line="+19"/>
<location line="+42"/>
<location line="+38"/>
<source>Download failed: %1.</source>
- <translation type="unfinished"></translation>
+ <translation>ダウンロード失敗: %1.</translation>
</message>
<message>
<location line="-70"/>
<source>Documentation info file is corrupt!</source>
- <translation type="unfinished"></translation>
+ <translation>ドキュメント情報ファイルが不正です!</translation>
</message>
<message>
<location line="+37"/>
<source>Download failed: Downloaded file is corrupted.</source>
- <translation type="unfinished"></translation>
+ <translation>ダウンロード失敗: ダウンロードしたファイルが不正です。</translation>
</message>
<message>
<location line="+2"/>
<source>Installing documentation %1...</source>
- <translation type="unfinished"></translation>
+ <translation>%1 のドキュメントをインストール中...</translation>
</message>
<message>
<location line="+22"/>
<source>Error while installing documentation:
%1</source>
- <translation type="unfinished"></translation>
+ <translation>ドキュメントのインストール中にエラーが発生しました:
+%1 </translation>
</message>
<message>
<location filename="../tools/assistant/tools/assistant/installdialog.ui"/>
<source>Available Documentation:</source>
- <translation type="unfinished"></translation>
+ <translation>使用可能なドキュメント:</translation>
</message>
<message>
<location/>
<source>Install</source>
- <translation type="unfinished"></translation>
+ <translation>インストール</translation>
</message>
<message>
<location/>
<source>Cancel</source>
- <translation type="unfinished"></translation>
+ <translation>キャンセル</translation>
</message>
<message>
<location/>
<source>Close</source>
- <translation type="unfinished"></translation>
+ <translation>閉じる</translation>
</message>
<message>
<location/>
<source>Installation Path:</source>
- <translation type="unfinished"></translation>
+ <translation>インストール先のパス:</translation>
</message>
<message>
<location/>
<source>...</source>
- <translation type="unfinished"></translation>
+ <translation>...</translation>
</message>
</context>
<context>
@@ -440,298 +443,298 @@
<location filename="../tools/assistant/tools/assistant/mainwindow.cpp" line="+108"/>
<location line="+350"/>
<source>Index</source>
- <translation type="unfinished"></translation>
+ <translation>インデックス</translation>
</message>
<message>
<location line="-344"/>
<location line="+342"/>
<source>Contents</source>
- <translation type="unfinished"></translation>
+ <translation>コンテンツ</translation>
</message>
<message>
<location line="-337"/>
<location line="+341"/>
<source>Bookmarks</source>
- <translation type="unfinished"></translation>
+ <translation>ブックマーク</translation>
</message>
<message>
<location line="-329"/>
<location line="+331"/>
<source>Search</source>
- <translation type="unfinished"></translation>
+ <translation>検索</translation>
</message>
<message>
<location line="-319"/>
<location line="+192"/>
<location line="+470"/>
<source>Qt Assistant</source>
- <translation type="unfinished"></translation>
+ <translation>Qt Assistant</translation>
</message>
<message>
<location line="-501"/>
<location line="+4"/>
<source>Unfiltered</source>
- <translation type="unfinished"></translation>
+ <translation>フィルタなし</translation>
</message>
<message>
<location line="+84"/>
<source>Page Set&amp;up...</source>
- <translation type="unfinished"></translation>
+ <translation>ページ設定(&amp;U)...</translation>
</message>
<message>
<location line="+2"/>
<source>Print Preview...</source>
- <translation type="unfinished"></translation>
+ <translation>印刷プレビュー...</translation>
</message>
<message>
<location line="+3"/>
<source>&amp;Print...</source>
- <translation type="unfinished"></translation>
+ <translation>印刷(&amp;P)...</translation>
</message>
<message>
<location line="+6"/>
<source>New &amp;Tab</source>
- <translation type="unfinished"></translation>
+ <translation>新しいタブ(&amp;T)</translation>
</message>
<message>
<location line="+3"/>
<source>&amp;Close Tab</source>
- <translation type="unfinished"></translation>
+ <translation>タブを閉じる(&amp;C)</translation>
</message>
<message>
<location line="+4"/>
<source>&amp;Quit</source>
- <translation type="unfinished"></translation>
+ <translation>終了(&amp;Q)</translation>
</message>
<message>
<location line="+1"/>
<source>CTRL+Q</source>
- <translation type="unfinished"></translation>
+ <translation>CTRL+Q</translation>
</message>
<message>
<location line="+4"/>
<source>&amp;Copy selected Text</source>
- <translation type="unfinished"></translation>
+ <translation>選択中の文字をコピー(&amp;C)</translation>
</message>
<message>
<location line="+6"/>
<source>&amp;Find in Text...</source>
- <translation type="unfinished"></translation>
+ <translation>検索(&amp;F)...</translation>
</message>
<message>
<location line="+5"/>
<source>Find &amp;Next</source>
- <translation type="unfinished"></translation>
+ <translation>次を検索(&amp;N)</translation>
</message>
<message>
<location line="+4"/>
<source>Find &amp;Previous</source>
- <translation type="unfinished"></translation>
+ <translation>前を検索(&amp;P)</translation>
</message>
<message>
<location line="+5"/>
<source>Preferences...</source>
- <translation type="unfinished"></translation>
+ <translation>設定...</translation>
</message>
<message>
<location line="+4"/>
<source>Zoom &amp;in</source>
- <translation type="unfinished"></translation>
+ <translation>拡大(&amp;I)</translation>
</message>
<message>
<location line="+5"/>
<source>Zoom &amp;out</source>
- <translation type="unfinished"></translation>
+ <translation>縮小(&amp;O)</translation>
</message>
<message>
<location line="+5"/>
<source>Normal &amp;Size</source>
- <translation type="unfinished"></translation>
+ <translation>普通の大きさ(&amp;S)</translation>
</message>
<message>
<location line="+3"/>
<source>Ctrl+0</source>
- <translation type="unfinished"></translation>
+ <translation>Ctrl+0</translation>
</message>
<message>
<location line="+5"/>
<source>ALT+C</source>
- <translation type="unfinished"></translation>
+ <translation>ALT+C</translation>
</message>
<message>
<location line="+2"/>
<source>ALT+I</source>
- <translation type="unfinished"></translation>
+ <translation>ALT+I</translation>
</message>
<message>
<location line="+4"/>
<source>ALT+S</source>
- <translation type="unfinished"></translation>
+ <translation>ALT+S</translation>
</message>
<message>
<location line="+3"/>
<source>&amp;Home</source>
- <translation type="unfinished"></translation>
+ <translation>ホーム(&amp;H)</translation>
</message>
<message>
<location line="+1"/>
<source>Ctrl+Home</source>
- <translation type="unfinished"></translation>
+ <translation>Ctrl+Home</translation>
</message>
<message>
<location line="+3"/>
<source>&amp;Back</source>
- <translation type="unfinished"></translation>
+ <translation>戻る(&amp;B)</translation>
</message>
<message>
<location line="+5"/>
<source>&amp;Forward</source>
- <translation type="unfinished"></translation>
+ <translation>進む(&amp;F)</translation>
</message>
<message>
<location line="+5"/>
<source>Sync with Table of Contents</source>
- <translation type="unfinished"></translation>
+ <translation>内容と目次を同期する</translation>
</message>
<message>
<location line="+6"/>
<source>Next Page</source>
- <translation type="unfinished"></translation>
+ <translation>次のページ</translation>
</message>
<message>
<location line="+1"/>
<source>Ctrl+Alt+Right</source>
- <translation type="unfinished"></translation>
+ <translation>Ctrl+Alt+Right</translation>
</message>
<message>
<location line="+3"/>
<source>Previous Page</source>
- <translation type="unfinished"></translation>
+ <translation>前のページ</translation>
</message>
<message>
<location line="+1"/>
<source>Ctrl+Alt+Left</source>
- <translation type="unfinished"></translation>
+ <translation>Ctrl+Alt+Left</translation>
</message>
<message>
<location line="+4"/>
<source>Add Bookmark...</source>
- <translation type="unfinished"></translation>
+ <translation>ブックマークの追加...</translation>
</message>
<message>
<location line="+4"/>
<source>About...</source>
- <translation type="unfinished"></translation>
+ <translation>Qt Assistant について...</translation>
</message>
<message>
<location line="+3"/>
<source>Navigation Toolbar</source>
- <translation type="unfinished"></translation>
+ <translation>ナビゲーション ツールバー</translation>
</message>
<message>
<location line="+74"/>
<source>Toolbars</source>
- <translation type="unfinished"></translation>
+ <translation>ツールバー</translation>
</message>
<message>
<location line="+15"/>
<source>Filter Toolbar</source>
- <translation type="unfinished"></translation>
+ <translation>フィルター ツールバー</translation>
</message>
<message>
<location line="+2"/>
<source>Filtered by:</source>
- <translation type="unfinished"></translation>
+ <translation>フィルタ条件:</translation>
</message>
<message>
<location line="+23"/>
<source>Address Toolbar</source>
- <translation type="unfinished"></translation>
+ <translation>アドレス ツールバー</translation>
</message>
<message>
<location line="+4"/>
<source>Address:</source>
- <translation type="unfinished"></translation>
+ <translation>アドレス:</translation>
</message>
<message>
<location line="+110"/>
<source>Could not find the associated content item.</source>
- <translation type="unfinished"></translation>
+ <translation>関連付いた内容が見つかりません。</translation>
</message>
<message>
<location line="+81"/>
<source>About %1</source>
- <translation type="unfinished"></translation>
+ <translation>%1 について</translation>
</message>
<message>
<location line="+115"/>
<source>Updating search index</source>
- <translation type="unfinished"></translation>
+ <translation>検索インデックスを更新中</translation>
</message>
<message>
<location line="-597"/>
<source>Looking for Qt Documentation...</source>
- <translation type="unfinished"></translation>
+ <translation>Qt ドキュメントを探しています...</translation>
</message>
<message>
<location line="+195"/>
<source>&amp;Window</source>
- <translation type="unfinished"></translation>
+ <translation>ウィンドウ(&amp;W)</translation>
</message>
<message>
<location line="+3"/>
<source>Minimize</source>
- <translation type="unfinished"></translation>
+ <translation>最小化</translation>
</message>
<message>
<location line="+1"/>
<source>Ctrl+M</source>
- <translation type="unfinished"></translation>
+ <translation>Ctrl+M</translation>
</message>
<message>
<location line="-2"/>
<source>Zoom</source>
- <translation type="unfinished"></translation>
+ <translation>ズーム</translation>
</message>
<message>
<location line="-136"/>
<source>&amp;File</source>
- <translation type="unfinished"></translation>
+ <translation>ファイル(&amp;F)</translation>
</message>
<message>
<location line="+24"/>
<source>&amp;Edit</source>
- <translation type="unfinished"></translation>
+ <translation>編集(&amp;E)</translation>
</message>
<message>
<location line="+24"/>
<source>&amp;View</source>
- <translation type="unfinished"></translation>
+ <translation>表示(&amp;V)</translation>
</message>
<message>
<location line="+27"/>
<source>&amp;Go</source>
- <translation type="unfinished"></translation>
+ <translation>ジャンプ(&amp;G)</translation>
</message>
<message>
<location line="+29"/>
<source>&amp;Bookmarks</source>
- <translation type="unfinished"></translation>
+ <translation>ブックマーク(&amp;B)</translation>
</message>
<message>
<location line="+4"/>
<source>&amp;Help</source>
- <translation type="unfinished"></translation>
+ <translation>ヘルプ(&amp;H)</translation>
</message>
<message>
<location line="-37"/>
<source>ALT+O</source>
- <translation type="unfinished"></translation>
+ <translation>ALT+O</translation>
</message>
<message>
<location line="+35"/>
<source>CTRL+D</source>
- <translation type="unfinished"></translation>
+ <translation>CTRL+D</translation>
</message>
</context>
<context>
@@ -741,47 +744,47 @@
<location line="+7"/>
<location line="+6"/>
<source>Add Documentation</source>
- <translation type="unfinished"></translation>
+ <translation>ドキュメントの追加</translation>
</message>
<message>
<location line="-13"/>
<source>Qt Compressed Help Files (*.qch)</source>
- <translation type="unfinished"></translation>
+ <translation>圧縮済み Qt ヘルプファイル (*.qch)</translation>
</message>
<message>
<location line="+8"/>
<source>The specified file is not a valid Qt Help File!</source>
- <translation type="unfinished"></translation>
+ <translation>指定されたファイルは有効な Qt ヘルプ ファイルではありません!</translation>
</message>
<message>
<location line="+6"/>
<source>The namespace %1 is already registered!</source>
- <translation type="unfinished"></translation>
+ <translation>ネームスペース %1 は既に登録済みです!</translation>
</message>
<message>
<location line="+23"/>
<source>Remove Documentation</source>
- <translation type="unfinished"></translation>
+ <translation>ドキュメントの除去</translation>
</message>
<message>
<location line="+1"/>
<source>Some documents currently opened in Assistant reference the documentation you are attempting to remove. Removing the documentation will close those documents.</source>
- <translation type="unfinished"></translation>
+ <translation>除去しようとしているいくつかのドキュメントは Assistant 上で参照されています。除去すると、これらのドキュメントは閉じられます。</translation>
</message>
<message>
<location line="+2"/>
<source>Cancel</source>
- <translation type="unfinished"></translation>
+ <translation>キャンセル</translation>
</message>
<message>
<location line="+1"/>
<source>OK</source>
- <translation type="unfinished"></translation>
+ <translation>OK</translation>
</message>
<message>
<location line="+86"/>
<source>Use custom settings</source>
- <translation type="unfinished"></translation>
+ <translation>独自設定を使用する</translation>
</message>
</context>
<context>
@@ -789,92 +792,92 @@
<message>
<location filename="../tools/assistant/tools/assistant/preferencesdialog.ui"/>
<source>Preferences</source>
- <translation type="unfinished"></translation>
+ <translation>設定</translation>
</message>
<message>
<location/>
<source>Fonts</source>
- <translation type="unfinished"></translation>
+ <translation>フォント</translation>
</message>
<message>
<location/>
<source>Font settings:</source>
- <translation type="unfinished"></translation>
+ <translation>フォント設定:</translation>
</message>
<message>
<location/>
<source>Browser</source>
- <translation type="unfinished"></translation>
+ <translation>ブラウザー</translation>
</message>
<message>
<location/>
<source>Application</source>
- <translation type="unfinished"></translation>
+ <translation>アプリケーション</translation>
</message>
<message>
<location/>
<source>Filters</source>
- <translation type="unfinished"></translation>
+ <translation>フィルタ</translation>
</message>
<message>
<location/>
<source>Filter:</source>
- <translation type="unfinished"></translation>
+ <translation>フィルタ:</translation>
</message>
<message>
<location/>
<source>Attributes:</source>
- <translation type="unfinished"></translation>
+ <translation>属性:</translation>
</message>
<message>
<location/>
<source>1</source>
- <translation type="unfinished"></translation>
+ <translation>1</translation>
</message>
<message>
<location/>
<source>Add</source>
- <translation type="unfinished"></translation>
+ <translation>追加</translation>
</message>
<message>
<location/>
<source>Remove</source>
- <translation type="unfinished"></translation>
+ <translation>削除</translation>
</message>
<message>
<location/>
<source>Documentation</source>
- <translation type="unfinished"></translation>
+ <translation>ドキュメント</translation>
</message>
<message>
<location/>
<source>Registered Documentation:</source>
- <translation type="unfinished"></translation>
+ <translation>登録済みドキュメント:</translation>
</message>
<message>
<location/>
<source>Add...</source>
- <translation type="unfinished"></translation>
+ <translation>追加...</translation>
</message>
<message>
<location/>
<source>Options</source>
- <translation type="unfinished"></translation>
+ <translation>オプション</translation>
</message>
<message>
<location/>
<source>Current Page</source>
- <translation type="unfinished"></translation>
+ <translation>現在のページ</translation>
</message>
<message>
<location/>
<source>Restore to default</source>
- <translation type="unfinished"></translation>
+ <translation>デフォルト設定に戻す</translation>
</message>
<message>
<location/>
<source>Homepage</source>
- <translation type="unfinished"></translation>
+ <translation>ホームページ</translation>
</message>
</context>
<context>
@@ -882,64 +885,64 @@
<message>
<location filename="../tools/assistant/tools/assistant/cmdlineparser.cpp" line="+110"/>
<source>The specified collection file does not exist!</source>
- <translation type="unfinished"></translation>
+ <translation>指定されたコレクションファイルは存在しません!</translation>
</message>
<message>
<location line="+4"/>
<source>Missing collection file!</source>
- <translation type="unfinished"></translation>
+ <translation>コレクションファイルが見つかりません!</translation>
</message>
<message>
<location line="+9"/>
<source>Invalid URL!</source>
- <translation type="unfinished"></translation>
+ <translation>不正なURLです!</translation>
</message>
<message>
<location line="+4"/>
<source>Missing URL!</source>
- <translation type="unfinished"></translation>
+ <translation>URLが見つかりません!</translation>
</message>
<message>
<location line="+17"/>
<location line="+19"/>
<location line="+19"/>
<source>Unknown widget: %1</source>
- <translation type="unfinished"></translation>
+ <translation>不明なウィジェット: %1</translation>
</message>
<message>
<location line="-34"/>
<location line="+19"/>
<location line="+19"/>
<source>Missing widget!</source>
- <translation type="unfinished"></translation>
+ <translation>ウィジェットが見つかりません!</translation>
</message>
<message>
<location line="+7"/>
<location line="+12"/>
<source>The specified Qt help file does not exist!</source>
- <translation type="unfinished"></translation>
+ <translation>指定された Qt ヘルプ ファイルが存在しません!</translation>
</message>
<message>
<location line="-7"/>
<location line="+12"/>
<source>Missing help file!</source>
- <translation type="unfinished"></translation>
+ <translation>ヘルプファイルが見つかりません!</translation>
</message>
<message>
<location line="+7"/>
<source>Missing filter argument!</source>
- <translation type="unfinished"></translation>
+ <translation>フィルタ引数が不足しています!</translation>
</message>
<message>
<location line="+10"/>
<source>Unknown option: %1</source>
- <translation type="unfinished"></translation>
+ <translation>不明なオプション: %1</translation>
</message>
<message>
<location line="+30"/>
<location line="+2"/>
<source>Qt Assistant</source>
- <translation type="unfinished"></translation>
+ <translation>Qt Assistant</translation>
</message>
<message>
<location filename="../tools/assistant/tools/assistant/main.cpp" line="+190"/>
@@ -948,12 +951,16 @@
Reason:
%2</source>
- <translation type="unfinished"></translation>
+ <translation>ドキュメントファイルを登録できませんでした。
+%1
+
+原因:
+%2</translation>
</message>
<message>
<location line="+4"/>
<source>Documentation successfully registered.</source>
- <translation type="unfinished"></translation>
+ <translation>ドキュメントの登録に成功しました。</translation>
</message>
<message>
<location line="+11"/>
@@ -962,28 +969,32 @@ Reason:
Reason:
%2</source>
- <translation type="unfinished"></translation>
+ <translation>ドキュメントファイルを解除できませんでした。
+%1
+
+原因:
+%2</translation>
</message>
<message>
<location line="-3"/>
<source>Documentation successfully unregistered.</source>
- <translation type="unfinished"></translation>
+ <translation>ドキュメントの解放に成功しました。</translation>
</message>
<message>
<location line="+18"/>
<source>Cannot load sqlite database driver!</source>
- <translation type="unfinished"></translation>
+ <translation>SQLite データベース ドライバーをロードできません!</translation>
</message>
<message>
<location line="+9"/>
<source>The specified collection file could not be read!</source>
- <translation type="unfinished"></translation>
+ <translation>指定されたコレクションファイルは読み込めません!</translation>
</message>
<message>
<location filename="../tools/assistant/tools/assistant/bookmarkmanager.cpp" line="+167"/>
<location line="+1"/>
<source>Bookmark</source>
- <translation type="unfinished"></translation>
+ <translation>ブックマーク</translation>
</message>
</context>
<context>
@@ -991,12 +1002,12 @@ Reason:
<message>
<location filename="../tools/assistant/tools/assistant/remotecontrol.cpp" line="+157"/>
<source>Debugging Remote Control</source>
- <translation type="unfinished"></translation>
+ <translation>リモート コントロールをデバッグ中</translation>
</message>
<message>
<location line="+1"/>
<source>Received Command: %1 %2</source>
- <translation type="unfinished"></translation>
+ <translation>受信したコマンド: %1 %2</translation>
</message>
</context>
<context>
@@ -1004,28 +1015,28 @@ Reason:
<message>
<location filename="../tools/assistant/tools/assistant/searchwidget.cpp" line="+193"/>
<source>&amp;Copy</source>
- <translation type="unfinished"></translation>
+ <translation>コピー(&amp;C)</translation>
</message>
<message>
<location line="+4"/>
<source>Copy &amp;Link Location</source>
- <translation type="unfinished"></translation>
+ <translation>リンクのURLをコピー(&amp;L)</translation>
</message>
<message>
<location line="+3"/>
<location line="+36"/>
<source>Open Link in New Tab</source>
- <translation type="unfinished"></translation>
+ <translation>リンクを新しいタブで開く</translation>
</message>
<message>
<location line="-29"/>
<source>Select All</source>
- <translation type="unfinished"></translation>
+ <translation>すべてを選択</translation>
</message>
<message>
<location line="+28"/>
<source>Open Link</source>
- <translation type="unfinished"></translation>
+ <translation>リンクを開く</translation>
</message>
</context>
<context>
@@ -1033,27 +1044,27 @@ Reason:
<message>
<location filename="../tools/assistant/tools/assistant/topicchooser.cpp" line="+54"/>
<source>Choose a topic for &lt;b&gt;%1&lt;/b&gt;:</source>
- <translation type="unfinished"></translation>
+ <translation>&lt;b&gt;%1&lt;/b&gt; の検索先トピックを選択してください:</translation>
</message>
<message>
<location filename="../tools/assistant/tools/assistant/topicchooser.ui"/>
<source>Choose Topic</source>
- <translation type="unfinished"></translation>
+ <translation>トピックを選択</translation>
</message>
<message>
<location/>
<source>&amp;Topics</source>
- <translation type="unfinished"></translation>
+ <translation>トピック(&amp;T)</translation>
</message>
<message>
<location/>
<source>&amp;Display</source>
- <translation type="unfinished"></translation>
+ <translation>表示(&amp;D)</translation>
</message>
<message>
<location/>
<source>&amp;Close</source>
- <translation type="unfinished"></translation>
+ <translation>閉じる(&amp;C)</translation>
</message>
</context>
</TS>