summaryrefslogtreecommitdiffstats
path: root/src/kvilib/ext/kvi_mediatype.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/kvilib/ext/kvi_mediatype.cpp')
-rw-r--r--src/kvilib/ext/kvi_mediatype.cpp48
1 files changed, 22 insertions, 26 deletions
diff --git a/src/kvilib/ext/kvi_mediatype.cpp b/src/kvilib/ext/kvi_mediatype.cpp
index 87c7926d..36cc6dfc 100644
--- a/src/kvilib/ext/kvi_mediatype.cpp
+++ b/src/kvilib/ext/kvi_mediatype.cpp
@@ -36,8 +36,8 @@
#include "kvi_settings.h"
-#include <qregexp.h>
-#include <qdir.h>
+#include <tqregexp.h>
+#include <tqdir.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -98,13 +98,13 @@ KviMediaType * KviMediaManager::findMediaTypeByIanaType(const char * ianaType)
return 0;
}
-KviMediaType * KviMediaManager::findMediaTypeByFileMask(const char * filemask)
+KviMediaType * KviMediaManager::findMediaTypeByFileMask(const char * filetqmask)
{
__range_valid(locked());
for(KviMediaType * mt = m_pMediaTypeList->first();mt;mt = m_pMediaTypeList->next())
{
// FIXME: #warning "Should this be case sensitive ?"
- if(kvi_strEqualCI(mt->szFileMask.ptr(),filemask))return mt;
+ if(kvi_strEqualCI(mt->szFileMask.ptr(),filetqmask))return mt;
}
return 0;
@@ -129,7 +129,7 @@ void KviMediaManager::insertMediaType(KviMediaType * m)
int iWildCount = m->szFileMask.occurences('*');
int iNonWildCount = m->szFileMask.len() - iWildCount;
- // The masks with no wildcards go first in the list
+ // The tqmasks with no wildcards go first in the list
// then we insert the ones with more non-wild chars
int index = 0;
@@ -137,7 +137,7 @@ void KviMediaManager::insertMediaType(KviMediaType * m)
{
if(iWildCount)
{
- // the new mask has wildcards... if the current one has none, skip it
+ // the new tqmask has wildcards... if the current one has none, skip it
int iWildCountExisting = mt->szFileMask.occurences('*');
if(iWildCountExisting)
{
@@ -164,15 +164,15 @@ void KviMediaManager::insertMediaType(KviMediaType * m)
}
} // else the current has no wildcards...skip
} else {
- // the new mask has no wildcards....
- if(mt->szFileMask.contains('*'))
+ // the new tqmask has no wildcards....
+ if(mt->szFileMask.tqcontains('*'))
{
// current one has wildcards...insert
m_pMediaTypeList->insert(index,m);
return;
}
// the current one has no wildcards...
- // the longer masks go first....
+ // the longer tqmasks go first....
if(mt->szFileMask.len() < m->szFileMask.len())
{
// the current one is shorter than the new one...insert
@@ -185,10 +185,10 @@ void KviMediaManager::insertMediaType(KviMediaType * m)
m_pMediaTypeList->append(m);
/*
- // the masks with no wildcards go first
- // longer masks go first
+ // the tqmasks with no wildcards go first
+ // longer tqmasks go first
- bool bHasWildcards = m->szFileMask.contains('*');
+ bool bHasWildcards = m->szFileMask.tqcontains('*');
int index = 0;
for(KviMediaType * mt = m_pMediaTypeList->first();mt;mt = m_pMediaTypeList->next())
{
@@ -207,7 +207,7 @@ void KviMediaManager::insertMediaType(KviMediaType * m)
}
}
} else {
- if(mt->szFileMask.contains('*'))
+ if(mt->szFileMask.tqcontains('*'))
{
m_pMediaTypeList->insert(index,m);
return;
@@ -235,16 +235,16 @@ void KviMediaManager::insertMediaType(KviMediaType * m)
KviMediaType * KviMediaManager::findMediaType(const char * filename,bool bCheckMagic)
{
- // FIXME: This should be ported at least to QString....
+ // FIXME: This should be ported at least to TQString....
__range_valid(locked());
KviStr szFullPath = filename;
if(!kvi_isAbsolutePath(szFullPath.ptr()))
{
#ifdef COMPILE_USE_QT4
- KviStr tmp = QDir::currentPath();
+ KviStr tmp = TQDir::currentPath();
#else
- KviStr tmp = QDir::currentDirPath();
+ KviStr tmp = TQDir::currentDirPath();
#endif
tmp.ensureLastCharIs('/');
szFullPath.prepend(tmp);
@@ -382,7 +382,7 @@ KviMediaType * KviMediaManager::findMediaTypeForRegularFile(const char * szFullP
if(bCheckMagic)
{
- QString szTmp=QString::fromUtf8(szFullPath);
+ TQString szTmp=TQString::fromUtf8(szFullPath);
KviFile f(szTmp);
if(f.openForReading())
{
@@ -403,17 +403,13 @@ KviMediaType * KviMediaManager::findMediaTypeForRegularFile(const char * szFullP
{
if(len && m->szMagicBytes.hasData())
{
- QRegExp re(m->szMagicBytes.ptr());
+ TQRegExp re(m->szMagicBytes.ptr());
// It looks like they can't decide the name for this function :D
// ... well, maybe the latest choice is the best one.
#ifdef COMPILE_USE_QT4
if(re.indexIn(buffer) > -1)return m; // matched!
#else
- #if QT_VERSION >= 300
if(re.search(buffer) > -1)return m; // matched!
- #else
- if(re.find(buffer,0) > -1)return m; // matched!
- #endif
#endif
// else magic failed...not a match
} else return m; // matched! (no magic check)
@@ -437,7 +433,7 @@ KviMediaType * KviMediaManager::findMediaTypeForRegularFile(const char * szFullP
typedef struct _KviDefaultMediaType
{
- const char * filemask;
+ const char * filetqmask;
const char * magicbytes;
const char * ianatype;
const char * description;
@@ -493,12 +489,12 @@ void KviMediaManager::load(const char * filename)
insertMediaType(m);
}
- for(int u = 0;g_defMediaTypes[u].filemask;u++)
+ for(int u = 0;g_defMediaTypes[u].filetqmask;u++)
{
- if(!findMediaTypeByFileMask(g_defMediaTypes[u].filemask))
+ if(!findMediaTypeByFileMask(g_defMediaTypes[u].filetqmask))
{
KviMediaType * m = new KviMediaType;
- m->szFileMask = g_defMediaTypes[u].filemask;
+ m->szFileMask = g_defMediaTypes[u].filetqmask;
m->szMagicBytes = g_defMediaTypes[u].magicbytes;
m->szIanaType = g_defMediaTypes[u].ianatype;
m->szDescription = g_defMediaTypes[u].description;