Updates to build on Ubuntu 18.04 LTS (…)

- replace `add_compile_definitions` (added in CMake ≥3.12) with
`add_definitions` in `CMakeLists.txt`

    * hat tip to: https://stackoverflow.com/a/61250302/785213

- add #ifdef's to support Qt 5.9.5 for Ubuntu 18.04 by replacing QString
`.front()` and `.back()` methods with `.at(0)` and `.at(s.size() - 1)`

    * hat tip to: https://github.com/pawelsalawa/sqlitestudio/commit/90ca398

- add #ifdef's to replace `QFontMetrics` `.horizontalAdvance()` method
with `.width()` to support Qt 5.9.5 on Ubuntu 18.04

    * hat tip to: https://github.com/Sigil-Ebook/Sigil/commit/a32f890

- closes #107
This commit is contained in:
Kevin Ernst
2022-10-07 00:15:12 -04:00
parent fa4515a0fb
commit 379d094191
9 changed files with 163 additions and 66 deletions
+38 -2
View File
@@ -17,44 +17,76 @@ void SeerGdbLogWidget::processText (const QString& text) {
// Remove leading "~"
// ~"For help, type "help".
// "
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
if (text.front() == '~') {
#else
if (text.at(0) == '~') {
#endif
str = text.mid(1);
// Remove leading """
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
if (str.front() == '"') {
#else
if (str.at(0) == '"') {
#endif
str = str.mid(1);
}
// Remove trailing """
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
if (str.back() == '"') {
#else
if (str.at(str.size() - 1) == '"') {
#endif
str.chop(1);
}
// Remove trailing "\n"
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
if (str.back() == '\n') {
#else
if (str.at(str.size() - 1) == '\n') {
#endif
str.chop(1);
}
// Remove leading "&"
// &"p name
// "
}else if (text.front() == '&') {
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
} else if (text.front() == '&') {
#else
} else if (text.at(0) == '&') {
#endif
str = text.mid(1);
// Remove leading """
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
if (str.front() == '"') {
#else
if (str.at(0) == '"') {
#endif
str = str.mid(1);
}
// Remove trailing """
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
if (str.back() == '"') {
#else
if (str.at(str.size() - 1) == '"') {
#endif
str.chop(1);
}
// Remove trailing "\n"
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
if (str.back() == '\n') {
#else
if (str.at(str.size() - 1) == '\n') {
#endif
str.chop(1);
}
@@ -68,7 +100,11 @@ void SeerGdbLogWidget::processText (const QString& text) {
str = Seer::filterEscapes(str);
// Remove trailing "\n"
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
while (str.back() == '\n') {
#else
while (str.at(str.size() - 1) == '\n') {
#endif
str.chop(1);
break;
}