summaryrefslogtreecommitdiffstats
path: root/juk/covermanager.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-11 06:00:15 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-11 06:00:15 +0000
commitb1057f437bf65300831a0ccb45b920787c6b318d (patch)
treef8a73db06ca1180d0da0ba6dfbe786197b4f4bc3 /juk/covermanager.cpp
parent4ddfca384ced9ad654213aef9dc2c3973720b980 (diff)
downloadtdemultimedia-b1057f437bf65300831a0ccb45b920787c6b318d.tar.gz
tdemultimedia-b1057f437bf65300831a0ccb45b920787c6b318d.zip
TQt4 port kdemultimedia
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdemultimedia@1236079 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'juk/covermanager.cpp')
-rw-r--r--juk/covermanager.cpp60
1 files changed, 30 insertions, 30 deletions
diff --git a/juk/covermanager.cpp b/juk/covermanager.cpp
index f7530daa..811f904f 100644
--- a/juk/covermanager.cpp
+++ b/juk/covermanager.cpp
@@ -42,13 +42,13 @@ typedef TQDict<coverKey> TrackLookupMap;
static KStaticDeleter<CoverManagerPrivate> sd;
const char *CoverDrag::mimetype = "application/x-juk-coverid";
-// Caches the QPixmaps for the covers so that the covers are not all kept in
+// Caches the TQPixmaps for the covers so that the covers are not all kept in
// memory for no reason.
typedef TQCache<TQPixmap> CoverPixmapCache;
CoverManagerPrivate *CoverManager::m_data = 0;
-// Used to save and load CoverData from a QDataStream
+// Used to save and load CoverData from a TQDataStream
TQDataStream &operator<<(TQDataStream &out, const CoverData &data);
TQDataStream &operator>>(TQDataStream &in, CoverData &data);
@@ -156,20 +156,20 @@ void CoverManagerPrivate::saveCovers() const
TQDataStream out(&file);
// Write out the version and count
- out << Q_UINT32(0) << Q_UINT32(covers.count());
+ out << TQ_UINT32(0) << TQ_UINT32(covers.count());
// Write out the data
for(CoverDataMap::ConstIterator it = covers.begin(); it != covers.end(); ++it) {
- out << Q_UINT32(it.key());
+ out << TQ_UINT32(it.key());
out << *it.data();
}
// Now write out the track mapping.
- out << Q_UINT32(tracks.count());
+ out << TQ_UINT32(tracks.count());
TQDictIterator<coverKey> trackMapIt(tracks);
while(trackMapIt.current()) {
- out << trackMapIt.currentKey() << Q_UINT32(*trackMapIt.current());
+ out << trackMapIt.currentKey() << TQ_UINT32(*trackMapIt.current());
++trackMapIt;
}
}
@@ -186,7 +186,7 @@ void CoverManagerPrivate::loadCovers()
}
TQDataStream in(&file);
- Q_UINT32 count, version;
+ TQ_UINT32 count, version;
// First thing we'll read in will be the version.
// Only version 0 is defined for now.
@@ -200,9 +200,9 @@ void CoverManagerPrivate::loadCovers()
// Read in the count next, then the data.
in >> count;
- for(Q_UINT32 i = 0; i < count; ++i) {
- // Read the id, and 3 QStrings for every 1 of the count.
- Q_UINT32 id;
+ for(TQ_UINT32 i = 0; i < count; ++i) {
+ // Read the id, and 3 TQStrings for every 1 of the count.
+ TQ_UINT32 id;
CoverDataPtr data(new CoverData);
in >> id;
@@ -213,9 +213,9 @@ void CoverManagerPrivate::loadCovers()
}
in >> count;
- for(Q_UINT32 i = 0; i < count; ++i) {
+ for(TQ_UINT32 i = 0; i < count; ++i) {
TQString path;
- Q_UINT32 id;
+ TQ_UINT32 id;
in >> path >> id;
@@ -223,7 +223,7 @@ void CoverManagerPrivate::loadCovers()
// don't do so again. Possible due to a coding error during 3.5
// development.
- if(!tracks.find(path)) {
+ if(!tracks.tqfind(path)) {
++covers[(coverKey) id]->refCount; // Another track using this.
tracks.insert(path, new coverKey(id));
}
@@ -242,7 +242,7 @@ coverKey CoverManagerPrivate::nextId() const
// Start from 1...
coverKey key = 1;
- while(covers.contains(key))
+ while(covers.tqcontains(key))
++key;
return key;
@@ -269,13 +269,13 @@ const char *CoverDrag::format(int i) const
return 0;
}
-TQByteArray CoverDrag::encodedData(const char *mimetype) const
+TQByteArray CoverDrag::tqencodedData(const char *mimetype) const
{
if(qstrcmp(CoverDrag::mimetype, mimetype) == 0) {
TQByteArray data;
TQDataStream ds(data, IO_WriteOnly);
- ds << Q_UINT32(m_id);
+ ds << TQ_UINT32(m_id);
return data;
}
else if(qstrcmp(mimetype, "image/png") == 0) {
@@ -303,9 +303,9 @@ bool CoverDrag::decode(const TQMimeSource *e, coverKey &id)
if(!canDecode(e))
return false;
- TQByteArray data = e->encodedData(mimetype);
+ TQByteArray data = e->tqencodedData(mimetype);
TQDataStream ds(data, IO_ReadOnly);
- Q_UINT32 i;
+ TQ_UINT32 i;
ds >> i;
id = (coverKey) i;
@@ -371,7 +371,7 @@ TQPixmap CoverManager::coverFromData(const CoverData &coverData, Size size)
if(size == Thumbnail) {
// Convert to image for smoothScale()
TQImage image = pix->convertToImage();
- pix->convertFromImage(image.smoothScale(80, 80, TQImage::ScaleMin));
+ pix->convertFromImage(image.smoothScale(80, 80, TQ_ScaleMin));
}
TQPixmap returnValue = *pix; // Save it early.
@@ -395,7 +395,7 @@ coverKey CoverManager::addCover(const TQPixmap &large, const TQString &artist, c
// Save it to file first!
- TQString ext = TQString("/coverdb/coverID-%1.png").arg(id);
+ TQString ext = TQString("/coverdb/coverID-%1.png").tqarg(id);
coverData->path = KGlobal::dirs()->saveLocation("appdata") + ext;
kdDebug() << "Saving pixmap to " << coverData->path << endl;
@@ -413,8 +413,8 @@ coverKey CoverManager::addCover(const TQPixmap &large, const TQString &artist, c
data()->covers[id] = coverData;
// Make sure the new cover isn't inadvertently cached.
- data()->pixmapCache.remove(TQString("f%1").arg(coverData->path));
- data()->pixmapCache.remove(TQString("t%1").arg(coverData->path));
+ data()->pixmapCache.remove(TQString("f%1").tqarg(coverData->path));
+ data()->pixmapCache.remove(TQString("t%1").tqarg(coverData->path));
return id;
}
@@ -426,7 +426,7 @@ coverKey CoverManager::addCover(const TQString &path, const TQString &artist, co
bool CoverManager::hasCover(coverKey id)
{
- return data()->covers.contains(id);
+ return data()->covers.tqcontains(id);
}
bool CoverManager::removeCover(coverKey id)
@@ -436,8 +436,8 @@ bool CoverManager::removeCover(coverKey id)
// Remove cover from cache.
CoverDataPtr coverData = coverInfo(id);
- data()->pixmapCache.remove(TQString("f%1").arg(coverData->path));
- data()->pixmapCache.remove(TQString("t%1").arg(coverData->path));
+ data()->pixmapCache.remove(TQString("f%1").tqarg(coverData->path));
+ data()->pixmapCache.remove(TQString("t%1").tqarg(coverData->path));
// Remove references to files that had that track ID.
TQDictIterator<coverKey> it(data()->tracks);
@@ -462,8 +462,8 @@ bool CoverManager::replaceCover(coverKey id, const TQPixmap &large)
CoverDataPtr coverData = coverInfo(id);
// Empty old pixmaps from cache.
- data()->pixmapCache.remove(TQString("%1%2").arg("t", coverData->path));
- data()->pixmapCache.remove(TQString("%1%2").arg("f", coverData->path));
+ data()->pixmapCache.remove(TQString("%1%2").tqarg("t", coverData->path));
+ data()->pixmapCache.remove(TQString("%1%2").tqarg("f", coverData->path));
large.save(coverData->path, "PNG");
return true;
@@ -504,7 +504,7 @@ TQValueList<coverKey> CoverManager::keys()
void CoverManager::setIdForTrack(const TQString &path, coverKey id)
{
- coverKey *oldId = data()->tracks.find(path);
+ coverKey *oldId = data()->tracks.tqfind(path);
if(oldId && (id == *oldId))
return; // We're already done.
@@ -526,7 +526,7 @@ void CoverManager::setIdForTrack(const TQString &path, coverKey id)
coverKey CoverManager::idForTrack(const TQString &path)
{
- coverKey *coverPtr = data()->tracks.find(path);
+ coverKey *coverPtr = data()->tracks.tqfind(path);
if(!coverPtr)
return NoMatch;
@@ -536,7 +536,7 @@ coverKey CoverManager::idForTrack(const TQString &path)
CoverDataPtr CoverManager::coverInfo(coverKey id)
{
- if(data()->covers.contains(id))
+ if(data()->covers.tqcontains(id))
return data()->covers[id];
return CoverDataPtr(0);