summaryrefslogtreecommitdiffstats
path: root/src/kvilib/file
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2023-08-24 21:28:39 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2023-08-31 10:03:10 +0900
commit030a2248f3630fd0404df98beffc78b5b5ca4c31 (patch)
tree75d55e7e177ca48e69d59f74181ce37841ecd51b /src/kvilib/file
parent17118265cf93b35b0b68e450ea5f43046c1d81c3 (diff)
downloadkvirc-030a2248f3630fd0404df98beffc78b5b5ca4c31.tar.gz
kvirc-030a2248f3630fd0404df98beffc78b5b5ca4c31.zip
Drop USE_QT4 code
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'src/kvilib/file')
-rw-r--r--src/kvilib/file/kvi_file.cpp10
-rw-r--r--src/kvilib/file/kvi_file.h21
-rw-r--r--src/kvilib/file/kvi_fileutils.cpp16
-rw-r--r--src/kvilib/file/kvi_packagefile.cpp44
4 files changed, 1 insertions, 90 deletions
diff --git a/src/kvilib/file/kvi_file.cpp b/src/kvilib/file/kvi_file.cpp
index 227a4997..d904540a 100644
--- a/src/kvilib/file/kvi_file.cpp
+++ b/src/kvilib/file/kvi_file.cpp
@@ -45,20 +45,12 @@ KviFile::~KviFile()
bool KviFile::openForReading()
{
-#ifdef COMPILE_USE_QT4
- return open(TQFile::ReadOnly);
-#else
return open(IO_ReadOnly);
-#endif
}
bool KviFile::openForWriting(bool bAppend)
{
-#ifdef COMPILE_USE_QT4
- return open(TQFile::WriteOnly | (bAppend ? TQFile::Append : TQFile::Truncate));
-#else
return open(IO_WriteOnly | (bAppend ? IO_Append : IO_Truncate));
-#endif
}
@@ -77,7 +69,6 @@ bool KviFile::load(TQByteArray &bData)
return true;
}
-#ifndef COMPILE_USE_QT4
bool KviFile::save(const KviTQCString &szData)
{
@@ -95,7 +86,6 @@ bool KviFile::load(KviTQCString &szData)
return true;
}
-#endif
bool KviFile::save(const TQString &szData)
diff --git a/src/kvilib/file/kvi_file.h b/src/kvilib/file/kvi_file.h
index 7cce041f..11cc85be 100644
--- a/src/kvilib/file/kvi_file.h
+++ b/src/kvilib/file/kvi_file.h
@@ -36,15 +36,7 @@
#include <tqfile.h>
#include <time.h>
-#ifdef COMPILE_USE_QT4
- #define kvi_file_offset_t qlonglong
-#else
-#ifdef USE_QT4
- #define kvi_file_offset_t qint64
-#else // USE_QT4
- #define kvi_file_offset_t TQFile::Offset
-#endif // USE_QT4
-#endif
+#define kvi_file_offset_t TQFile::Offset
class KVILIB_API KviFile : public TQFile, public KviHeapObject
@@ -58,20 +50,12 @@ public:
bool openForReading();
bool openForWriting(bool bAppend = false);
-#ifndef COMPILE_USE_QT4
- // Functions present in TQt 4.x but not TQt 3.x
bool putChar(char c){ return putch(c) != -1; };
bool ungetChar(char c){ return ungetch(c) != -1; };
bool getChar(char * c){ *c = getch(); return *c != -1; };
bool seek(kvi_file_offset_t o){ return at(o); };
kvi_file_offset_t pos(){ return at(); };
-#endif
-#ifdef COMPILE_USE_QT4
- // Missing functions in TQt 4.x
- quint64 writeBlock(const char * data,quint64 uLen){ return write(data,uLen); };
- quint64 readBlock(char * data,quint64 uLen){ return read(data,uLen); };
-#endif
// This stuff loads and saves LITTLE ENDIAN DATA!
bool save(kvi_u64_t t);
@@ -101,11 +85,8 @@ public:
bool save(const KviStr &szData);
bool load(KviStr &szData);
-#ifndef COMPILE_USE_QT4
- // Under TQt 4.x these collide with TQByteArray
bool save(const KviTQCString &szData);
bool load(KviTQCString &szData);
-#endif
bool save(const TQByteArray &bData);
bool load(TQByteArray &bData);
diff --git a/src/kvilib/file/kvi_fileutils.cpp b/src/kvilib/file/kvi_fileutils.cpp
index 8e81f861..9bea5c96 100644
--- a/src/kvilib/file/kvi_fileutils.cpp
+++ b/src/kvilib/file/kvi_fileutils.cpp
@@ -105,11 +105,7 @@ namespace KviFileUtils
TQString createdDir;
#ifdef COMPILE_ON_WINDOWS
-#ifdef COMPILE_USE_QT4
- int idx = dir.indexOf(':');
-#else
int idx = dir.find(':');
-#endif
if(idx == 1)
{
createdDir = dir.left(2);
@@ -213,20 +209,12 @@ namespace KviFileUtils
{
#ifdef COMPILE_ON_WINDOWS
szPath.replace('/',"\\");
-#ifdef COMPILE_USE_QT4
- szPath.replace("\\\\","\\");
-#else
while(szPath.find("\\\\") != -1)szPath.replace("\\\\","\\");
-#endif
// FIXME: Use the default drive here ?
if(szPath.startsWith("\\"))szPath.prepend("C:");
#else
szPath.replace('\\',"/");
-#ifdef COMPILE_USE_QT4
- szPath.replace("//","/");
-#else
while(KviTQString::find(szPath,"//") != -1)szPath.replace("//","/");
-#endif
// deal with windows paths
if((szPath.length() > 2) && (szPath.at(0) != TQChar('/')))
{
@@ -235,12 +223,8 @@ namespace KviFileUtils
szPath.remove(0,2);
}
}
-#ifdef COMPILE_USE_QT4
- szPath=TQDir::cleanPath(szPath);
-#else
szPath=TQDir::cleanDirPath(szPath);
#endif
-#endif
}
diff --git a/src/kvilib/file/kvi_packagefile.cpp b/src/kvilib/file/kvi_packagefile.cpp
index 31f69438..2c1ad469 100644
--- a/src/kvilib/file/kvi_packagefile.cpp
+++ b/src/kvilib/file/kvi_packagefile.cpp
@@ -128,11 +128,7 @@ KviPackageIOEngine::~KviPackageIOEngine()
bool KviPackageIOEngine::updateProgress(int iProgress,const TQString &szLabel)
{
if(!m_pProgressDialog)return true;
-#ifdef COMPILE_USE_QT4
- m_pProgressDialog->setValue(iProgress);
-#else
m_pProgressDialog->setProgress(iProgress);
-#endif
m_pProgressDialogLabel->setText(szLabel);
tqApp->processEvents();
if(m_pProgressDialog->wasCanceled())
@@ -145,14 +141,8 @@ bool KviPackageIOEngine::updateProgress(int iProgress,const TQString &szLabel)
void KviPackageIOEngine::showProgressDialog(const TQString &szCaption,int iTotalSteps)
{
-#ifdef COMPILE_USE_QT4
- m_pProgressDialog = new TQProgressDialog(TQString(""),__tr2qs("Cancel"),0,iTotalSteps,0);
- m_pProgressDialog->setModal(true);
- m_pProgressDialog->setWindowTitle(szCaption);
-#else
m_pProgressDialog = new TQProgressDialog(TQString(""),__tr2qs("Cancel"),iTotalSteps,0,"",true);
m_pProgressDialog->setCaption(szCaption);
-#endif
m_pProgressDialogLabel = new TQLabel(m_pProgressDialog);
m_pProgressDialogLabel->setMaximumSize(500,300);
m_pProgressDialog->setLabel(m_pProgressDialogLabel);
@@ -234,67 +224,35 @@ bool KviPackageWriter::addFileInternal(const TQFileInfo * fi,const TQString &szL
bool KviPackageWriter::addDirectory(const TQString &szLocalDirectoryName,const TQString &szTargetDirectoryPrefix,kvi_u32_t uAddFileFlags)
{
TQDir d(szLocalDirectoryName);
-#ifdef COMPILE_USE_QT4
- TQDir::Filters iFlags;
-#else
int iFlags;
-#endif
iFlags = TQDir::Files | TQDir::Readable;
if(!(uAddFileFlags & FollowSymLinks))
iFlags |= TQDir::NoSymLinks;
- // QT4SUX: Because the TQDir::entryInfoList() breaks really a lot of code by returning an object that behaves in a _totally_ different way.. it's also much slower
-
-#ifdef COMPILE_USE_QT4
- int j;
- TQFileInfoList sl = d.entryInfoList(iFlags);
- for(j=0;j<sl.size();j++)
- {
-#else
const TQFileInfoList * sl = d.entryInfoList(iFlags);
if(!sl)return false;
TQFileInfoListIterator it(*sl);
while(TQFileInfo * fi = it.current())
{
-#endif
TQString szSFileName = szLocalDirectoryName;
KviTQString::ensureLastCharIs(szSFileName,TQChar(KVI_PATH_SEPARATOR_CHAR));
-#ifdef COMPILE_USE_QT4
- TQFileInfo slowCopy = sl.at(j);
- szSFileName += slowCopy.fileName();
-#else
szSFileName += fi->fileName();
-#endif
TQString szDFileName = szTargetDirectoryPrefix;
KviTQString::ensureLastCharIs(szDFileName,TQChar(KVI_PATH_SEPARATOR_CHAR));
-#ifdef COMPILE_USE_QT4
- szDFileName += slowCopy.fileName();
- if(!addFileInternal(&slowCopy,szSFileName,szDFileName,uAddFileFlags))
- return false;
-#else
szDFileName += fi->fileName();
if(!addFileInternal(fi,szSFileName,szDFileName,uAddFileFlags))
return false;
-#endif
-#ifndef COMPILE_USE_QT4
++it;
-#endif
}
iFlags = TQDir::Dirs | TQDir::Readable;
if(!(uAddFileFlags & FollowSymLinks))
iFlags |= TQDir::NoSymLinks;
sl = d.entryInfoList(iFlags);
-#ifdef COMPILE_USE_QT4
- for(j=0;j<sl.size();j++)
- {
- TQString szDir = sl.at(j).fileName();
-#else
if(!sl)return false;
TQFileInfoListIterator it2(*sl);
while(TQFileInfo * fi2 = it2.current())
{
TQString szDir = fi2->fileName();
-#endif
if(!KviTQString::equalCS(szDir,"..") && !KviTQString::equalCS(szDir,"."))
{
TQString szSDirName = szLocalDirectoryName;
@@ -306,9 +264,7 @@ bool KviPackageWriter::addDirectory(const TQString &szLocalDirectoryName,const T
if(!addDirectory(szSDirName,szDDirName,uAddFileFlags))
return false;
}
-#ifndef COMPILE_USE_QT4
++it2;
-#endif
}
return true;