From 80a531af864e496c687d8999efd182557ddaad89 Mon Sep 17 00:00:00 2001 From: Jozef Mlich Date: Sat, 8 Jul 2023 16:29:30 +0000 Subject: [PATCH 1/3] use lupdate and lrelease from QT_INSTALL_BINS --- fingerterm.pro | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fingerterm.pro b/fingerterm.pro index 915aff1..3007d49 100644 --- a/fingerterm.pro +++ b/fingerterm.pro @@ -92,7 +92,10 @@ desktopfile.files = $${TARGET}.desktop TS_FILE = $$OUT_PWD/fingerterm.ts EE_QM = $$OUT_PWD/fingerterm_eng_en.qm -ts.commands += lupdate $$PWD -ts $$TS_FILE +LUPDATE = $$[QT_INSTALL_BINS]/lupdate +LRELEASE = $$[QT_INSTALL_BINS]/lrelease + +ts.commands += $${LUPDATE} $$PWD -ts $$TS_FILE ts.CONFIG += no_check_exist ts.output = $$TS_FILE ts.input = . @@ -102,7 +105,7 @@ ts_install.path = /usr/share/translations/source ts_install.CONFIG += no_check_exist # should add -markuntranslated "-" when proper translations are in place (or for testing) -engineering_english.commands += lrelease -idbased $$TS_FILE -qm $$EE_QM +engineering_english.commands += $${LRELEASE} -idbased $$TS_FILE -qm $$EE_QM engineering_english.CONFIG += no_check_exist engineering_english.depends = ts engineering_english.input = $$TS_FILE From 2254bbe7b5344e01e508c5fb91e7ac85f857d40c Mon Sep 17 00:00:00 2001 From: Jozef Mlich Date: Mon, 31 Jul 2023 18:43:26 +0000 Subject: [PATCH 2/3] Qt6 compatibility --- fingerterm.pro | 2 ++ keyloader.cpp | 4 ++++ main.cpp | 2 ++ terminal.cpp | 8 ++++---- textrender.cpp | 4 ++++ 5 files changed, 16 insertions(+), 4 deletions(-) diff --git a/fingerterm.pro b/fingerterm.pro index 3007d49..8a79613 100644 --- a/fingerterm.pro +++ b/fingerterm.pro @@ -1,5 +1,7 @@ QT = core gui qml quick +greaterThan(QT_MAJOR_VERSION,5) QT += core5compat + CONFIG += link_pkgconfig enable-feedback { diff --git a/keyloader.cpp b/keyloader.cpp index fc04e58..3124d9a 100644 --- a/keyloader.cpp +++ b/keyloader.cpp @@ -99,7 +99,11 @@ bool KeyLoader::loadLayoutInternal(QIODevice &from) line.replace("\\x5D", "]"); line.replace("\\x5C", "\\"); +#if QT_VERSION < 0x051500 QStringList parts = line.split(",", QString::KeepEmptyParts); +#else + QStringList parts = line.split(",", Qt::KeepEmptyParts); +#endif if(parts.count()>=2) { bool ok = true; key.label = parts.at(0); diff --git a/main.cpp b/main.cpp index cd13a69..e1cdb43 100644 --- a/main.cpp +++ b/main.cpp @@ -97,6 +97,7 @@ int main(int argc, char *argv[]) app.installTranslator(engineeringEnglish.data()); app.installTranslator(translator.data()); +#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) QScreen* sc = app.primaryScreen(); if(sc){ QFlags mask = Qt::PrimaryOrientation @@ -109,6 +110,7 @@ int main(int argc, char *argv[]) } sc->setOrientationUpdateMask(mask); } +#endif qmlRegisterType("FingerTerm", 1, 0, "TextRender"); qmlRegisterUncreatableType("FingerTerm", 1, 0, "Util", "Util is created by app"); diff --git a/terminal.cpp b/terminal.cpp index 754ea2e..c3869b1 100644 --- a/terminal.cpp +++ b/terminal.cpp @@ -325,7 +325,7 @@ void Terminal::keyPress(int key, int modifiers, const QString& text) if (asciiVal >= 0x41 && asciiVal <= 0x5f) { // Turn uppercase characters into their control code equivalent - toWrite.append(asciiVal - 0x40); + toWrite.append((char)(asciiVal - 0x40)); } else { qWarning() << "Ctrl+" << c << " does not translate into a control code"; } @@ -1312,7 +1312,7 @@ const QStringList Terminal::grabURLsFromBuffer() for (int i=0; ifontFamily(), sUtil->fontSize()); +#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) iFont.setStyleHint(QFont::Monospace, QFont::StyleStrategy(QFont::PreferDefault | QFont::ForceIntegerMetrics)); +#else + iFont.setStyleHint(QFont::Monospace, QFont::StyleStrategy(QFont::PreferDefault)); +#endif iFont.setBold(false); QFontMetrics fontMetrics(iFont); iFontHeight = fontMetrics.height(); From a57edc9609945def90f016177cd64b3a1d1fc921 Mon Sep 17 00:00:00 2001 From: Jozef Mlich Date: Mon, 31 Jul 2023 19:02:04 +0000 Subject: [PATCH 3/3] Changes needed for qt6 --- qml/MenuFingerterm.qml | 10 +++++----- terminal.cpp | 5 +++++ terminal.h | 1 + 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/qml/MenuFingerterm.qml b/qml/MenuFingerterm.qml index 1baa05c..1b290d8 100644 --- a/qml/MenuFingerterm.qml +++ b/qml/MenuFingerterm.qml @@ -18,7 +18,7 @@ */ import QtQuick 2.0 -import QtQuick.XmlListModel 2.0 +import QtQml.XmlListModel import FingerTerm 1.0 Item { @@ -62,12 +62,12 @@ Item { XmlListModel { id: xmlModel - xml: term.getUserMenuXml() + source: term.getUserMenuXmlPath() query: "/userMenu/item" - XmlRole { name: "title"; query: "title/string()" } - XmlRole { name: "command"; query: "command/string()" } - XmlRole { name: "disableOn"; query: "disableOn/string()" } + XmlListModelRole { name: "title"; elementName: "title" } + XmlListModelRole { name: "command"; elementName: "command" } + XmlListModelRole { name: "disableOn"; elementName: "disableOn" } } Component { diff --git a/terminal.cpp b/terminal.cpp index c3869b1..758ea84 100644 --- a/terminal.cpp +++ b/terminal.cpp @@ -1355,6 +1355,11 @@ const QStringList Terminal::grabURLsFromBuffer() return ret; } +QString Terminal::getUserMenuXmlPath() +{ + return iUtil->configPath()+"/menu.xml"; +} + QString Terminal::getUserMenuXml() { if(!iUtil) diff --git a/terminal.h b/terminal.h index c470b58..c6417dc 100644 --- a/terminal.h +++ b/terminal.h @@ -118,6 +118,7 @@ class Terminal : public QObject Q_INVOKABLE const QStringList grabURLsFromBuffer(); Q_INVOKABLE QString getUserMenuXml(); + Q_INVOKABLE QString getUserMenuXmlPath(); void scrollBackBufferFwd(int lines); void scrollBackBufferBack(int lines);