Added support for QT6

Be warned, support for QT6 remain untested. Fixed up build.py
to be forgiving if some lib files are missing. Removed the use
of QRegExp since it has been deprecated.
This commit is contained in:
Maurice ONeal 2021-03-07 17:43:16 -05:00
parent 2d1eef3700
commit d268fcb2ee
7 changed files with 41 additions and 24 deletions

View File

@ -109,20 +109,26 @@ def verbose_copy(src, dst):
print("cpy: " + src + " --> " + dst) print("cpy: " + src + " --> " + dst)
if os.path.isdir(src): if os.path.isdir(src):
files = os.listdir(src) if os.path.exists(dst) and os.path.isdir(dst):
shutil.rmtree(dst)
for file in files: try:
tree_src = src + os.path.sep + file # ignore errors thrown by shutil.copytree()
tree_dst = dst + os.path.sep + file # it's likely not actually failing to copy
# the directory but still throws errors if
# it fails to apply the same file stats as
# the source. this type of errors can be
# ignored.
shutil.copytree(src, dst)
if os.path.isdir(tree_src): except:
if not os.path.exists(tree_dst): pass
os.makedirs(tree_dst)
verbose_copy(tree_src, tree_dst) elif os.path.exists(src):
shutil.copyfile(src, dst)
else: else:
shutil.copyfile(src, dst) print("wrn: " + src + " does not exists. skipping.")
def linux_build_app_dir(app_ver, app_name, app_target, qt_bin): def linux_build_app_dir(app_ver, app_name, app_target, qt_bin):
if not os.path.exists("app_dir/linux/platforms"): if not os.path.exists("app_dir/linux/platforms"):
@ -169,10 +175,14 @@ def linux_build_app_dir(app_ver, app_name, app_target, qt_bin):
if "/usr/lib/x86_64-linux-gnu/qt5/bin" == qt_bin: if "/usr/lib/x86_64-linux-gnu/qt5/bin" == qt_bin:
verbose_copy(qt_bin + "/../../libQt5DBus.so.5", "app_dir/linux/lib/libQt5DBus.so.5") verbose_copy(qt_bin + "/../../libQt5DBus.so.5", "app_dir/linux/lib/libQt5DBus.so.5")
verbose_copy(qt_bin + "/../../libQt5XcbQpa.so.5", "app_dir/linux/lib/libQt5XcbQpa.so.5") verbose_copy(qt_bin + "/../../libQt5XcbQpa.so.5", "app_dir/linux/lib/libQt5XcbQpa.so.5")
verbose_copy(qt_bin + "/../../libQt6DBus.so.6", "app_dir/linux/lib/libQt6DBus.so.6")
verbose_copy(qt_bin + "/../../libQt6XcbQpa.so.6", "app_dir/linux/lib/libQt6XcbQpa.so.6")
else: else:
verbose_copy(qt_bin + "/../lib/libQt5DBus.so.5", "app_dir/linux/lib/libQt5DBus.so.5") verbose_copy(qt_bin + "/../lib/libQt5DBus.so.5", "app_dir/linux/lib/libQt5DBus.so.5")
verbose_copy(qt_bin + "/../lib/libQt5XcbQpa.so.5", "app_dir/linux/lib/libQt5XcbQpa.so.5") verbose_copy(qt_bin + "/../lib/libQt5XcbQpa.so.5", "app_dir/linux/lib/libQt5XcbQpa.so.5")
verbose_copy(qt_bin + "/../lib/libQt6DBus.so.6", "app_dir/linux/lib/libQt6DBus.so.6")
verbose_copy(qt_bin + "/../lib/libQt6XcbQpa.so.6", "app_dir/linux/lib/libQt5XcbQpa.so.6")
verbose_copy("templates/linux_run_script.sh", "app_dir/linux/" + app_target + ".sh") verbose_copy("templates/linux_run_script.sh", "app_dir/linux/" + app_target + ".sh")
verbose_copy("templates/linux_uninstall.sh", "app_dir/linux/uninstall.sh") verbose_copy("templates/linux_uninstall.sh", "app_dir/linux/uninstall.sh")
@ -253,6 +263,14 @@ def main():
else: else:
cd() cd()
if platform.system() == "Linux":
if os.path.exists("build/linux"):
shutil.rmtree("build/linux")
elif platform.system() == "Windows":
if os.path.exists("build/windows"):
shutil.rmtree("build/windows")
result = subprocess.run([qt_bin + os.sep + "qmake", "-config", "release"]) result = subprocess.run([qt_bin + os.sep + "qmake", "-config", "release"])
if result.returncode == 0: if result.returncode == 0:

View File

@ -94,6 +94,8 @@ For Linux you need the following packages to successfully build/install:
``` ```
qtbase5-dev qtbase5-dev
libssl-dev libssl-dev
libgl1-mesa-dev
libxcb1-dev
gcc gcc
make make
python3 python3

View File

@ -111,12 +111,12 @@ void SaveBookmark::dataIn(const QString &argsLine)
{ {
if (activeHook()) if (activeHook())
{ {
if (QRegExp("y", Qt::CaseInsensitive).exactMatch(argsLine)) if ("y" == argsLine.toLower())
{ {
run(baseName, baseArgs); run(baseName, baseArgs);
term(); term();
} }
else if (QRegExp("n", Qt::CaseInsensitive).exactMatch(argsLine)) else if ("n" == argsLine.toLower())
{ {
term(); term();
} }

View File

@ -350,7 +350,7 @@ QString getParam(const QString &key, const QStringList &args)
QString ret; QString ret;
int pos = args.indexOf(QRegExp(key, Qt::CaseInsensitive)); int pos = args.indexOf(QRegularExpression(key, QRegularExpression::CaseInsensitiveOption));
if (pos != -1) if (pos != -1)
{ {

View File

@ -50,7 +50,6 @@
#include <QTextBlockFormat> #include <QTextBlockFormat>
#include <QComboBox> #include <QComboBox>
#include <QDebug> #include <QDebug>
#include <QTextCodec>
#include <QCoreApplication> #include <QCoreApplication>
#include <QStringList> #include <QStringList>
#include <QHostAddress> #include <QHostAddress>
@ -59,8 +58,7 @@
#include <QJsonDocument> #include <QJsonDocument>
#include <QSslSocket> #include <QSslSocket>
#include <QFile> #include <QFile>
#include <QFile> #include <QRegularExpression>
#include <QRegExp>
#include <QFileInfo> #include <QFileInfo>
#include <QMutex> #include <QMutex>
#include <QProgressBar> #include <QProgressBar>
@ -75,7 +73,7 @@
#define CONFIG_FILENAME "config_v3.json" #define CONFIG_FILENAME "config_v3.json"
#define APP_NAME "Cmdr" #define APP_NAME "Cmdr"
#define APP_TARGET "cmdr" #define APP_TARGET "cmdr"
#define APP_VERSION "3.4" #define APP_VERSION "3.5"
enum TypeID : quint8 enum TypeID : quint8
{ {

View File

@ -259,8 +259,8 @@ void Genfile::setGenfileType(quint8 typeId)
QByteArray Genfile::autoFill(const QByteArray &data) QByteArray Genfile::autoFill(const QByteArray &data)
{ {
QStringList args = parseArgs(data, -1); auto args = parseArgs(data, -1);
int ind = args.indexOf(QRegExp("-len", Qt::CaseInsensitive)); auto ind = args.indexOf(QRegularExpression("-len", QRegularExpression::CaseInsensitiveOption));
if (ind == -1) if (ind == -1)
{ {
@ -374,7 +374,7 @@ void Genfile::dataIn(const QByteArray &data)
{ {
auto ans = QString(data); auto ans = QString(data);
if (QRegExp("y", Qt::CaseInsensitive).exactMatch(ans)) if ("y" == ans.toLower())
{ {
emit unsetUserIO(GEN_HOOK); emit unsetUserIO(GEN_HOOK);
@ -382,7 +382,7 @@ void Genfile::dataIn(const QByteArray &data)
setupForWriting(); setupForWriting();
} }
else if (QRegExp("n", Qt::CaseInsensitive).exactMatch(ans)) else if ("n" == ans.toLower())
{ {
finished(); finished();
} }

View File

@ -26,7 +26,6 @@
#include <QFile> #include <QFile>
#include <QAbstractSocket> #include <QAbstractSocket>
#include <QCoreApplication> #include <QCoreApplication>
#include <QTextCodec>
#include <QTextStream> #include <QTextStream>
#include <QXmlStreamWriter> #include <QXmlStreamWriter>
#include <QSsl> #include <QSsl>