summaryrefslogtreecommitdiffstats
path: root/pytquic3
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2023-08-01 18:23:10 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2023-08-01 22:34:55 +0900
commit8ccbd4fc0219267d2d8b00e7191b1d92de834569 (patch)
treefcf9541ad97d54e1060e196ba9ca52258fcc5b45 /pytquic3
parentaa6764916ff2706bc094a8858691f9b0a98f395c (diff)
downloadpytqt-8ccbd4fc0219267d2d8b00e7191b1d92de834569.tar.gz
pytqt-8ccbd4fc0219267d2d8b00e7191b1d92de834569.zip
Removed unnecessary code
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'pytquic3')
-rw-r--r--pytquic3/embed.cpp2
-rw-r--r--pytquic3/form.cpp58
-rw-r--r--pytquic3/uic.cpp15
-rw-r--r--pytquic3/uic.h2
4 files changed, 1 insertions, 76 deletions
diff --git a/pytquic3/embed.cpp b/pytquic3/embed.cpp
index afb28d0..a24f282 100644
--- a/pytquic3/embed.cpp
+++ b/pytquic3/embed.cpp
@@ -32,7 +32,7 @@
// on embedded, we do not compress image data. Rationale: by mapping
// the ready-only data directly into memory we are both faster and
// more memory efficient
-#if (TQT_VERSION < 0x030100 || defined(Q_WS_QWS)) && !defined(TQT_NO_IMAGE_COLLECTION_COMPRESSION)
+#if defined(Q_WS_QWS) && !defined(TQT_NO_IMAGE_COLLECTION_COMPRESSION)
#define TQT_NO_IMAGE_COLLECTION_COMPRESSION
#endif
diff --git a/pytquic3/form.cpp b/pytquic3/form.cpp
index e5912f1..0d1255a 100644
--- a/pytquic3/form.cpp
+++ b/pytquic3/form.cpp
@@ -30,13 +30,8 @@
#define NO_STATIC_COLORS
#include <globaldefs.h>
-#if TQT_VERSION < 0x030100
-#include <zlib.h>
-#endif
-
static TQByteArray unzipXPM( TQString data, ulong& length )
{
-#if TQT_VERSION >= 0x030100
const int lengthOffset = 4;
int baSize = data.length() / 2 + lengthOffset;
uchar *ba = new uchar[ baSize ];
@@ -64,41 +59,6 @@ static TQByteArray unzipXPM( TQString data, ulong& length )
TQByteArray baunzip = tqUncompress( ba, baSize );
delete[] ba;
return baunzip;
-#else
- uchar *ba = new uchar[ data.length() / 2 ];
- for ( int i = 0; i < (int)data.length() / 2; ++i ) {
- char h = data[ 2 * i ].latin1();
- char l = data[ 2 * i + 1 ].latin1();
- uchar r = 0;
- if ( h <= '9' )
- r += h - '0';
- else
- r += h - 'a' + 10;
- r = r << 4;
- if ( l <= '9' )
- r += l - '0';
- else
- r += l - 'a' + 10;
- ba[ i ] = r;
- }
- // I'm not sure this makes sense. Why couldn't the compressed data be
- // less than 20% of the original data? Maybe it's enough to trust the
- // `length' passed as an argument. Quoting the zlib header:
- // Upon entry, destLen is the total size of the destination
- // buffer, which must be large enough to hold the entire
- // uncompressed data. (The size of the uncompressed data must
- // have been saved previously by the compressor and transmitted
- // to the decompressor by some mechanism outside the scope of
- // this compression library.)
- // Which is the role of `length'. On the other hand this could prevent
- // crashes in some cases of slightly corrupt UIC files.
- if ( length < data.length() * 5 )
- length = data.length() * 5;
- TQByteArray baunzip( length );
- ::uncompress( (uchar*) baunzip.data(), &length, ba, data.length()/2 );
- delete[] ba;
- return baunzip;
-#endif
}
@@ -395,25 +355,7 @@ void Uic::createFormImpl( const TQDomElement &e )
}
out << endl;
} else if ( externPixmaps ) {
-#if TQT_VERSION >= 0x030100
pixmapLoaderFunction = "TQPixmap.fromMimeSource";
-#else
- out << indent << "def uic_load_pixmap_" << objName << "(name):" << endl;
- ++indent;
- out << indent << "pix = TQPixmap()" << endl;
- out << indent << "m = TQMimeSourceFactory.defaultFactory().data(name)" << endl;
- out << endl;
- out << indent << "if m:" << endl;
- ++indent;
- out << indent << "TQImageDrag.decode(m,pix)" << endl;
- --indent;
- out << endl;
- out << indent << "return pix" << endl;
- --indent;
- out << endl;
- out << endl;
- pixmapLoaderFunction = "uic_load_pixmap_" + objName;
-#endif
}
diff --git a/pytquic3/uic.cpp b/pytquic3/uic.cpp
index f5d5a2b..d5d89dc 100644
--- a/pytquic3/uic.cpp
+++ b/pytquic3/uic.cpp
@@ -80,7 +80,6 @@ bool Uic::toBool( const TQString& s )
TQString Uic::fixString( const TQString &str, bool encode )
{
-#if TQT_VERSION >= 0x030100
TQString s;
if ( !encode ) {
s = str;
@@ -105,12 +104,6 @@ TQString Uic::fixString( const TQString &str, bool encode )
}
}
}
-#else
- TQString s( str );
- s.replace( TQRegExp( "\\\\" ), "\\\\" );
- s.replace( TQRegExp( "\"" ), "\\\"" );
- s.replace( TQRegExp( "\r?\n" ), "\\n\"\n\"" );
-#endif
return "\"" + s + "\"";
}
@@ -182,9 +175,7 @@ Uic::Uic( const TQString &fn, const char *outputFn, TQTextStream &outStream,
pixmapLoaderFunction = getPixmapLoaderFunction( doc.firstChild().toElement() );
nameOfClass = getFormClassName( doc.firstChild().toElement() );
-#if TQT_VERSION >= 0x030300
uiFileVersion = doc.firstChild().toElement().attribute("version");
-#endif
stdsetdef = toBool( doc.firstChild().toElement().attribute("stdsetdef") );
if ( doc.firstChild().isNull() || doc.firstChild().firstChild().isNull() )
@@ -402,10 +393,8 @@ void Uic::createActionImpl( const TQDomElement &n, const TQString &parent )
else
continue;
bool subActionsDone = FALSE;
-#if TQT_VERSION >= 0x030300
bool hasMenuText = FALSE;
TQString actionText;
-#endif
for ( TQDomElement n2 = ae.firstChild().toElement(); !n2.isNull(); n2 = n2.nextSibling().toElement() ) {
if ( n2.tagName() == "property" ) {
bool stdset = stdsetdef;
@@ -424,12 +413,10 @@ void Uic::createActionImpl( const TQDomElement &n, const TQString &parent )
else
call += "setProperty(\"" + prop + "\",TQVariant(" + value + "))";
-#if TQT_VERSION >= 0x030300
if (prop == "menuText")
hasMenuText = TRUE;
else if (prop == "text")
actionText = value;
-#endif
if ( n2.firstChild().toElement().tagName() == "string" ) {
trout << trindent << call << endl;
@@ -441,11 +428,9 @@ void Uic::createActionImpl( const TQDomElement &n, const TQString &parent )
subActionsDone = TRUE;
}
}
-#if TQT_VERSION >= 0x030300
// workaround for loading pre-3.3 files expecting bogus TQAction behavior
if (!hasMenuText && !actionText.isEmpty() && uiFileVersion < "3.3")
trout << indent << "self." << objName << ".setMenuText(" << actionText << ")" << endl;
-#endif
}
}
diff --git a/pytquic3/uic.h b/pytquic3/uic.h
index 1cda66b..6bf9232 100644
--- a/pytquic3/uic.h
+++ b/pytquic3/uic.h
@@ -143,9 +143,7 @@ private:
uint stdsetdef : 1;
uint externPixmaps : 1;
-#if TQT_VERSION >= 0x030300
TQString uiFileVersion;
-#endif
TQString nameOfClass;
TQStringList namespaces;
TQString bareNameOfClass;