Removed unnecessary code

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
(cherry picked from commit 8ccbd4fc02)
r14.1.x
Michele Calgaro 1 year ago
parent f4a39d2fde
commit c6acfabe32
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -229,9 +229,7 @@ def moduleChecks(maindir):
tryModule(maindir,"tqtnetwork", "tqsocket.h", "TQSocket()")
tryModule(maindir,"tqttable", "tqtable.h", "TQTable()")
tryModule(maindir,"tqtxml", "tqdom.h", "TQDomImplementation()")
if config.tqt_version >= 0x030000:
tryModule(maindir,"tqtsql", "tqsql.h", "TQSql()")
tryModule(maindir,"tqtsql", "tqsql.h", "TQSql()")
# We need a different Makefile for the tqtgl module.
config.patches["@TEST_OPENGL@"] = "opengl"
@ -244,22 +242,21 @@ def moduleChecks(maindir):
config.create_makefile("tqttest.pro")
# Check for the tqui library.
if config.tqt_version >= 0x030000:
if sys.platform == "win32":
tquilib = r"$(TQTDIR)\lib\tqui.lib"
else:
tquilib = "-ltqui"
if sys.platform == "win32":
tquilib = r"$(TQTDIR)\lib\tqui.lib"
else:
tquilib = "-ltqui"
config.patches["@PYTQT_TQUI_LIB@"] = tquilib
config.patches["@PYTQT_TQUI_LIB@"] = tquilib
config.patches["@TEST_TQUI_LIB@"] = tquilib
config.create_makefile("tqttest.pro")
config.patches["@TEST_TQUI_LIB@"] = tquilib
config.create_makefile("tqttest.pro")
tryModule(maindir,"tqtui", "tqwidgetfactory.h", "TQWidgetFactory()")
tryModule(maindir,"tqtui", "tqwidgetfactory.h", "TQWidgetFactory()")
# Put things back.
config.patches["@TEST_TQUI_LIB@"] = ""
config.create_makefile("tqttest.pro")
# Put things back.
config.patches["@TEST_TQUI_LIB@"] = ""
config.create_makefile("tqttest.pro")
# Check for the TQScintilla library.
if sciVersion >= 0:
@ -327,7 +324,7 @@ int main(int argc,char **argv)
fprintf(fp,"-x TQt_THREAD_SUPPORT\\n");
#endif
#if (defined(Q_OS_WIN32) || defined(Q_OS_WIN64)) && TQT_VERSION >= 0x030000
#if (defined(Q_OS_WIN32) || defined(Q_OS_WIN64))
if (tqWinVersion() != TQt::WV_XP)
fprintf(fp,"-x TQt_STYLE_WINDOWSXP\\n");
#endif
@ -525,11 +522,6 @@ def main(argv):
if config.tqt_version == 0:
sip_tqt_config.error("SIP-TQt has been built with TQt support disabled.\n")
# Early versions of TQt for the Mac didn't include everything. Rather than
# maintain these in the future we just mandate a later version.
if sys.platform == "darwin" and config.tqt_version < 0x030100:
sip_tqt_config.error("PyTQt for MacOS/X requires TQt v3.1.0 or later.\n")
# Check the installation directory is valid and add it as a patch.
if not os.access(modDir,os.F_OK):
sip_tqt_config.error("The %s PyTQt destination directory does not seem to exist. Use the -d argument to set the correct directory." % (modDir))
@ -576,24 +568,21 @@ def main(argv):
# Link in the tqassistantclient library for TQt v3.1+.
tqaclib = ""
if config.tqt_version >= 0x030100:
if sys.platform == "win32":
tqaclib = r"$(TQTDIR)\lib\tqassistantclient.lib"
else:
tqaclib = "-ltqassistantclient"
if sys.platform == "win32":
tqaclib = r"$(TQTDIR)\lib\tqassistantclient.lib"
else:
tqaclib = "-ltqassistantclient"
config.patches["@PYTQT_TQASSISTANTCLIENT_LIB@"] = tqaclib
# Check for TQScintilla.
if config.tqt_version >= 0x030000:
checkTQScintilla()
checkTQScintilla()
# Create a build directory that we can compile test programs.
maindir = mkTempBuildDir()
# Check what additional modules to build.
if config.tqt_version >= 0x020000:
moduleChecks(maindir)
moduleChecks(maindir)
# Work out the platform and TQt version tags to pass to SIP-TQt to generate the
# code we need.
@ -685,22 +674,20 @@ def main(argv):
# See which version of pyuic to build.
config.patches["@PYTQT_BINDIR@"] = sip_tqt_config.escape(binDir)
if config.tqt_version >= 0x030000:
sip_tqt_config.inform("Creating Makefile for pytquic3.")
subdirs.append("pytquic3")
olddir = sip_tqt_config.push_dir("pytquic3")
sip_tqt_config.inform("Creating Makefile for pytquic3.")
subdirs.append("pytquic3")
olddir = sip_tqt_config.push_dir("pytquic3")
config.create_makefile("pytquic.pro", [])
sip_tqt_config.pop_dir(olddir)
# Build pylupdate if TQt v3.0 or later.
if config.tqt_version >= 0x030000:
sip_tqt_config.inform("Creating Makefile for pytqlupdate3.")
subdirs.append("pytqlupdate3")
olddir = sip_tqt_config.push_dir("pytqlupdate3")
# Build pylupdate.
sip_tqt_config.inform("Creating Makefile for pytqlupdate3.")
subdirs.append("pytqlupdate3")
olddir = sip_tqt_config.push_dir("pytqlupdate3")
config.create_makefile("pytqlupdate.pro", [])
sip_tqt_config.pop_dir(olddir)
config.create_makefile("pytqlupdate.pro", [])
sip_tqt_config.pop_dir(olddir)
# Generate the top-level Makefile.
sip_tqt_config.inform("Creating top level Makefile.")

@ -207,14 +207,13 @@ class ConfigurePyTQt3(ConfigureBase):
check_module("tqtxml", "tqdom.h", "TQDomImplementation()")
check_module("tqtgl", "tqgl.h", "TQGLWidget()", opengl=1)
if tqt_version >= 0x030000:
check_module("tqtui", "tqwidgetfactory.h", "TQWidgetFactory()", lib="tqui")
check_module("tqtui", "tqwidgetfactory.h", "TQWidgetFactory()", lib="tqui")
if tqt_edition in ("enterprise", "free"):
check_module("tqtsql", "tqsql.h", "TQSql()")
if tqt_edition in ("enterprise", "free"):
check_module("tqtsql", "tqsql.h", "TQSql()")
if sys.platform == "win32" and sipcfg.sip_version >= 0x040200:
check_module("tqtaxcontainer", "tqaxobject.h", "TQAxObject()", lib="tqaxcontainer")
if sys.platform == "win32" and sipcfg.sip_version >= 0x040200:
check_module("tqtaxcontainer", "tqaxobject.h", "TQAxObject()", lib="tqaxcontainer")
if tqsci_version:
check_module("tqtext", "tqextscintillabase.h", "TQextScintillaBase()", define=tqsci_define, include_dir=opt_tqsciincdir, lib_dir=opt_tqscilibdir, lib="tqscintilla")
@ -224,16 +223,15 @@ class ConfigurePyTQt3(ConfigureBase):
tqtmod_lib = None
if tqt_version >= 0x030100:
sip_tqt_config.inform("Checking to see if the TQAssistantClient class is available...")
sip_tqt_config.inform("Checking to see if the TQAssistantClient class is available...")
if check_class("tqassistantclient.h", "TQAssistantClient(\"foo\")", lib="tqassistantclient"):
if check_class("tqassistantclient.h", "TQAssistantClient(\"foo\")", lib="tqassistantclient"):
tqtmod_lib = "tqassistantclient"
else:
if check_class("ntqassistantclient.h", "TQAssistantClient(\"foo\")", lib="tqassistantclient"):
tqtmod_lib = "tqassistantclient"
else:
if check_class("ntqassistantclient.h", "TQAssistantClient(\"foo\")", lib="tqassistantclient"):
tqtmod_lib = "tqassistantclient"
else:
disabled_classes.append("TQAssistantClient")
disabled_classes.append("TQAssistantClient")
return tqtmod_lib
@ -290,77 +288,74 @@ class ConfigurePyTQt3(ConfigureBase):
def tools(self):
tool_dirs = []
if tqt_version >= 0x030000:
# The Professional Edition needs special handling.
prof = (tqt_edition == "professional")
# The Professional Edition needs special handling.
prof = (tqt_edition == "professional")
sip_tqt_config.inform("Creating pytquic Makefile...")
sip_tqt_config.inform("Creating pytquic Makefile...")
if prof or "tqtxml" not in pytqt_modules:
buildfile= "pytquic-prof.sbf"
if prof or "tqtxml" not in pytqt_modules:
buildfile= "pytquic-prof.sbf"
for xml in ("tqdom.cpp", "tqxml.cpp"):
shutil.copyfile(tqt_dir + "/src/xml/" + xml, "pytquic3/" + xml)
else:
buildfile= "pytquic.sbf"
for xml in ("tqdom.cpp", "tqxml.cpp"):
shutil.copyfile(tqt_dir + "/src/xml/" + xml, "pytquic3/" + xml)
else:
buildfile= "pytquic.sbf"
makefile = sip_tqt_config.ProgramMakefile(
configuration=sipcfg,
build_file=os.path.join(src_dir, "pytquic3", buildfile),
dir="pytquic3",
install_dir=opt_pytqtbindir,
console=1,
tqt=1,
warnings=1
)
makefile = sip_tqt_config.ProgramMakefile(
configuration=sipcfg,
build_file=os.path.join(src_dir, "pytquic3", buildfile),
dir="pytquic3",
install_dir=opt_pytqtbindir,
console=1,
tqt=1,
warnings=1
)
makefile.extra_defines.append("UIC")
makefile.extra_defines.append("TQT_INTERNAL_XML")
makefile.extra_defines.append("UIC")
makefile.extra_defines.append("TQT_INTERNAL_XML")
if prof or "tqtxml" not in pytqt_modules:
makefile.extra_defines.append("TQT_MODULE_XML")
if prof or "tqtxml" not in pytqt_modules:
makefile.extra_defines.append("TQT_MODULE_XML")
if tqt_version < 0x030100:
makefile.extra_include_dirs.append(tqt_dir + "/src/3rdparty/zlib")
makefile.extra_include_dirs.append(os.path.join(src_dir, "pytquic3"))
if not os.access("pytquic3", os.F_OK):
os.mkdir("pytquic3")
makefile.extra_include_dirs.append(os.path.join(src_dir, "pytquic3"))
if not os.access("pytquic3", os.F_OK):
os.mkdir("pytquic3")
makefile.generate()
tool_dirs.append("pytquic3")
makefile.generate()
tool_dirs.append("pytquic3")
sip_tqt_config.inform("Creating pytqlupdate Makefile...")
sip_tqt_config.inform("Creating pytqlupdate Makefile...")
if prof or "tqtxml" not in pytqt_modules:
buildfile= "pytqlupdate-prof.sbf"
if prof or "tqtxml" not in pytqt_modules:
buildfile= "pytqlupdate-prof.sbf"
shutil.copyfile(tqt_dir + "/src/xml/tqxml.cpp", "pytqlupdate3/tqxml.cpp")
else:
buildfile= "pytqlupdate.sbf"
shutil.copyfile(tqt_dir + "/src/xml/tqxml.cpp", "pytqlupdate3/tqxml.cpp")
else:
buildfile= "pytqlupdate.sbf"
makefile = sip_tqt_config.ProgramMakefile(
configuration=sipcfg,
build_file=os.path.join(src_dir, "pytqlupdate3", buildfile),
dir="pytqlupdate3",
install_dir=opt_pytqtbindir,
console=1,
tqt=1,
warnings=1
)
makefile = sip_tqt_config.ProgramMakefile(
configuration=sipcfg,
build_file=os.path.join(src_dir, "pytqlupdate3", buildfile),
dir="pytqlupdate3",
install_dir=opt_pytqtbindir,
console=1,
tqt=1,
warnings=1
)
makefile.extra_defines.append("TQT_INTERNAL_XML")
makefile.extra_defines.append("TQT_INTERNAL_XML")
if prof or "tqtxml" not in pytqt_modules:
makefile.extra_defines.append("TQT_MODULE_XML")
if prof or "tqtxml" not in pytqt_modules:
makefile.extra_defines.append("TQT_MODULE_XML")
makefile.extra_include_dirs.append(os.path.join(src_dir, "pytqlupdate3"))
makefile.extra_include_dirs.append(os.path.join(src_dir, "pytqlupdate3"))
if not os.access("pytqlupdate3", os.F_OK):
os.mkdir("pytqlupdate3")
if not os.access("pytqlupdate3", os.F_OK):
os.mkdir("pytqlupdate3")
makefile.generate()
tool_dirs.append("pytqlupdate3")
makefile.generate()
tool_dirs.append("pytqlupdate3")
return tool_dirs
@ -386,11 +381,8 @@ def inform_user():
sip_tqt_config.inform("The TQt header files are in %s." % tqt_incdir)
sip_tqt_config.inform("The %s TQt library is in %s." % (opt_tqtlib, tqt_libdir))
if tqt_version >= 0x020000:
sip_tqt_config.inform("pyuic will be installed in %s." % opt_pytqtbindir)
if tqt_version >= 0x030000:
sip_tqt_config.inform("pylupdate will be installed in %s." % opt_pytqtbindir)
sip_tqt_config.inform("pyuic will be installed in %s." % opt_pytqtbindir)
sip_tqt_config.inform("pylupdate will be installed in %s." % opt_pytqtbindir)
if opt_vendorcheck:
sip_tqt_config.inform("PyTQt will only be usable with signed interpreters.")
@ -414,8 +406,8 @@ def create_config(module, template, macros):
"pytqt_mod_dir": opt_pytqtmoddir,
"pytqt_sip_dir": opt_pytqtsipdir,
"pytqt_modules": pytqt_modules,
"pytqt_tqt_sip_flags": tqt_sip_flags,
"tqt_version": tqt_version,
"pytqt_tqt_sip_flags": tqt_sip_flags,
"tqt_version": tqt_version,
"tqt_edition": tqt_edition,
"tqt_winconfig": tqt_winconfig,
"tqt_framework": 0,
@ -700,7 +692,7 @@ int main(int argc,char **argv)
fprintf(fp,"-x TQt_THREAD_SUPPORT\\n");
#endif
#if !defined(Q_WS_WIN) || TQT_VERSION < 0x030000 || defined(TQT_NO_STYLE_WINDOWSXP)
#if !defined(Q_WS_WIN) || defined(TQT_NO_STYLE_WINDOWSXP)
fprintf(fp,"-x TQt_STYLE_WINDOWSXP\\n");
#endif
@ -1112,56 +1104,37 @@ def check_tqt_installation(macros):
tqt_version, ignore = sip_tqt_config.read_version(tqglobal, "TQt", "TQT_VERSION")
# Early versions of TQt for the Mac didn't include everything. Rather than
# maintain these in the future we just mandate a later version.
if sys.platform == "darwin" and tqt_version < 0x030100:
sip_tqt_config.error("PyTQt for MacOS/X requires TQt v3.1.0 or later.")
# The way SIP-TQt v4.2 and later handle connections between signals and Python
# slots only works with TQt v3 and later. Therefore TQt v2 and earlier needs
# SIP-TQt v3.
if tqt_version < 0x030000:
sip_tqt_config.error("TQt v2.x and earlier require SIP-TQt v3.x.")
if tqt_version >= 0x040000:
sip_tqt_config.error("TQt v4.x requires PyTQt v5.x.")
# Try and work out which edition it is.
global tqt_edition
if tqt_version >= 0x030000:
if opt_tqconfigdir:
tqconfigdir = opt_tqconfigdir
else:
tqconfigdir = tqt_incdir
if opt_tqconfigdir:
tqconfigdir = opt_tqconfigdir
else:
tqconfigdir = tqt_incdir
tqconfig = os.path.join(tqconfigdir, "tqconfig.h")
tqconfig = os.path.join(tqconfigdir, "tqconfig.h")
if not os.access(tqconfig,os.F_OK):
tqconfig = os.path.join(tqconfigdir, "ntqconfig.h")
if not os.access(tqconfig,os.F_OK):
tqconfig = os.path.join(tqconfigdir, "ntqconfig.h")
if not os.access(tqconfig,os.F_OK):
sip_tqt_config.error("tqconfig.h or ntqconfig.h could not be found in %s." % tqconfigdir)
if not os.access(tqconfig,os.F_OK):
sip_tqt_config.error("tqconfig.h or ntqconfig.h could not be found in %s." % tqconfigdir)
f = open(tqconfig)
l = f.readline()
f = open(tqconfig)
l = f.readline()
while l:
wl = l.split()
if len(wl) == 3 and wl[0] == "#define" and wl[1] == "QT_PRODUCT_LICENSE":
tqt_edition = wl[2][4:-1]
break
while l:
wl = l.split()
if len(wl) == 3 and wl[0] == "#define" and wl[1] == "QT_PRODUCT_LICENSE":
tqt_edition = wl[2][4:-1]
break
l = f.readline()
l = f.readline()
f.close()
f.close()
if not tqt_edition:
sip_tqt_config.error("The TQt edition could not be determined by parsing %s." % tqconfig)
elif tqt_version == 0x020300 and sys.platform == "win32":
# See if we have the TQt v2 non-commercial version.
if os.access(os.path.join(tqt_libdir, "tqt-mt230nc.lib"), os.F_OK):
tqt_edition = "non-commercial"
if not tqt_edition:
sip_tqt_config.error("The TQt edition could not be determined by parsing %s." % tqconfig)
if sys.platform == "win32":
# Work out how TQt was built on Windows.

@ -4,11 +4,6 @@ import os, sys, string
from PyTQt.tqt import *
if TQT_VERSION < 0x030100:
print("This example requires TQt v3.1.0 or later.")
sys.exit(1)
FALSE = 0
TRUE = 1

@ -44,9 +44,6 @@
static const char MagicComment[] = "TRANSLATOR ";
static TQMap<TQCString, int> needs_Q_OBJECT;
static TQMap<TQCString, int> lacks_Q_OBJECT;
/*
The first part of this source file is the python tokenizer. We skip
most of python; the only tokens that interest us are defined here.

@ -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

@ -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
}

@ -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
}
}

@ -143,9 +143,7 @@ private:
uint stdsetdef : 1;
uint externPixmaps : 1;
#if TQT_VERSION >= 0x030300
TQString uiFileVersion;
#endif
TQString nameOfClass;
TQStringList namespaces;
TQString bareNameOfClass;

Loading…
Cancel
Save