From 0b5f751104664fb1d624910ed930ab1b05a7cc4f Mon Sep 17 00:00:00 2001 From: Anthony Bilinski Date: Sun, 15 Mar 2020 01:26:52 -0700 Subject: [PATCH 1/4] fix(core): message when peer changes group name boolean inversion in getGroupPeerName caused it to always return empty string Fix #6001 --- src/core/core.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/core.cpp b/src/core/core.cpp index 98807887a..3f90859e4 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -1183,7 +1183,7 @@ QString Core::getGroupPeerName(int groupId, int peerId) const QMutexLocker ml{&coreLoopLock}; // from tox.h: "If peer_number == UINT32_MAX, then author is unknown (e.g. initial joining the conference)." - if (peerId != std::numeric_limits::max()) { + if (peerId == std::numeric_limits::max()) { return {}; } From f2fa601073373ae2ef9fba7952aed415af3ccee0 Mon Sep 17 00:00:00 2001 From: sudden6 Date: Sun, 1 Mar 2020 03:12:40 +0100 Subject: [PATCH 2/4] fix(chatlog): fix stick to bottom behavior This commit fixes the behavior when a message is received while the chatlog is scrolled to the bottom. With this change, the chatlog will stick to the bottom when it is scrolled all the way down. If it is somewhere in the middle (e.g. for search) the chatlog will not change its position. --- src/chatlog/chatlog.cpp | 28 ++++++++++++++-------------- src/chatlog/chatlog.h | 2 +- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/chatlog/chatlog.cpp b/src/chatlog/chatlog.cpp index a5cac0d94..e73699f1a 100644 --- a/src/chatlog/chatlog.cpp +++ b/src/chatlog/chatlog.cpp @@ -407,10 +407,9 @@ void ChatLog::insertChatlineAtBottom(const QList& newLines) layout(lines.last()->getRow(), lines.size(), useableWidth()); - if (visibleLines.size() > 1) { - startResizeWorker(visibleLines[1]); - } else { - startResizeWorker(); + // redo layout only when scrolled down + if(stickToBottom()) { + startResizeWorker(true); } } @@ -463,9 +462,9 @@ void ChatLog::insertChatlinesOnTop(const QList& newLines) // redo layout if (visibleLines.size() > 1) { - startResizeWorker(visibleLines[1]); + startResizeWorker(stickToBottom(), visibleLines[1]); } else { - startResizeWorker(); + startResizeWorker(stickToBottom()); } } @@ -481,7 +480,7 @@ void ChatLog::scrollToBottom() verticalScrollBar()->setValue(verticalScrollBar()->maximum()); } -void ChatLog::startResizeWorker(ChatLine::Ptr anchorLine) +void ChatLog::startResizeWorker(bool stick, ChatLine::Ptr anchorLine) { if (lines.empty()) { isScroll = true; @@ -491,11 +490,11 @@ void ChatLog::startResizeWorker(ChatLine::Ptr anchorLine) // (re)start the worker if (!workerTimer->isActive()) { // these values must not be reevaluated while the worker is running - if (anchorLine) { - workerAnchorLine = anchorLine; - workerStb = false; + workerStb = stick; + if (stick) { + workerAnchorLine = ChatLine::Ptr(); } else { - workerStb = stickToBottom(); + workerAnchorLine = anchorLine; } } @@ -765,7 +764,7 @@ int ChatLog::getNumRemove() const void ChatLog::forceRelayout() { - startResizeWorker(); + startResizeWorker(stickToBottom()); } void ChatLog::checkVisibility(bool causedWheelEvent) @@ -834,7 +833,7 @@ void ChatLog::resizeEvent(QResizeEvent* ev) bool stb = stickToBottom(); if (ev->size().width() != ev->oldSize().width()) { - startResizeWorker(); + startResizeWorker(stb); stb = false; // let the resize worker handle it } @@ -901,8 +900,9 @@ QRectF ChatLog::calculateSceneRect() const { qreal bottom = (lines.empty() ? 0.0 : lines.last()->sceneBoundingRect().bottom()); - if (typingNotification.get() != nullptr) + if (typingNotification.get() != nullptr) { bottom += typingNotification->sceneBoundingRect().height() + lineSpacing; + } return QRectF(-margins.left(), -margins.top(), useableWidth(), bottom + margins.bottom() + margins.top()); diff --git a/src/chatlog/chatlog.h b/src/chatlog/chatlog.h index f48ef0c33..ffc82d977 100644 --- a/src/chatlog/chatlog.h +++ b/src/chatlog/chatlog.h @@ -105,7 +105,7 @@ protected: void updateSceneRect(); void checkVisibility(bool causedWheelEvent = false); void scrollToBottom(); - void startResizeWorker(ChatLine::Ptr anchorLine = nullptr); + void startResizeWorker(bool stick, ChatLine::Ptr anchorLine = nullptr); virtual void mouseDoubleClickEvent(QMouseEvent* ev) final override; virtual void mousePressEvent(QMouseEvent* ev) final override; From 55b1f6af255c3322b9b4a2b89e7d8d7a6cf27fed Mon Sep 17 00:00:00 2001 From: sudden6 Date: Sat, 14 Mar 2020 16:15:15 +0100 Subject: [PATCH 3/4] fix(flatpak): workaround unstable flathub downloads works around https://github.com/flathub/flathub/issues/845 (cherry picked from commit 69677831aba0763f5c8fdc1847db3e868e25c983) --- flatpak/build.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/flatpak/build.sh b/flatpak/build.sh index 211b265c8..321817f91 100755 --- a/flatpak/build.sh +++ b/flatpak/build.sh @@ -46,6 +46,15 @@ cd "$FP_BUILD_DIR" # Add 'https://flathub.org' remote: flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo +## Workaround for Flathub download issues: https://github.com/flathub/flathub/issues/845 +# Pre download org.kde.Sdk because it fails often +for i in {1..5} +do + echo "Download try $i" + flatpak --system install flathub -y org.kde.Sdk/x86_64/5.12 | true +done +## Workaround end + # Build the qTox flatpak flatpak-builder --disable-rofiles-fuse --install-deps-from=flathub --force-clean --repo=tox-repo qTox-flatpak "$QTOX_BUILD_DIR"/flatpak/io.github.qtox.qTox.json From 71b5c50ac6c24bea6995ad3093a28376365aaab4 Mon Sep 17 00:00:00 2001 From: sudden6 Date: Sat, 14 Mar 2020 13:55:24 +0100 Subject: [PATCH 4/4] chore(flatpak): reduce difference to Flathub build (cherry picked from commit 58ee2feea8a8c1a35ec5f834ecc959568d822376) --- flatpak/build-flatpak.sh | 4 +- flatpak/build.sh | 10 +-- flatpak/io.github.qtox.qTox.json | 102 ++++++++++++------------------- 3 files changed, 43 insertions(+), 73 deletions(-) diff --git a/flatpak/build-flatpak.sh b/flatpak/build-flatpak.sh index f583efd28..46b9bde6a 100755 --- a/flatpak/build-flatpak.sh +++ b/flatpak/build-flatpak.sh @@ -35,13 +35,13 @@ then docker run --rm --privileged -it \ -v $PWD:/qtox \ -v $PWD/output:/output \ - debian:stretch-slim \ + debian:buster-slim \ /bin/bash else docker run --rm --privileged \ -v $PWD:/qtox \ -v $PWD/output:/output \ - debian:stretch-slim \ + debian:buster-slim \ /bin/bash -c "/qtox/flatpak/build.sh" fi diff --git a/flatpak/build.sh b/flatpak/build.sh index 321817f91..38169a452 100755 --- a/flatpak/build.sh +++ b/flatpak/build.sh @@ -21,15 +21,9 @@ readonly PATCH_DIR="flatpak/patches" # use multiple cores when building export MAKEFLAGS="-j$(nproc)" -# add backports repo, needed for a recent enough flatpak -echo "deb http://ftp.debian.org/debian stretch-backports main" > /etc/apt/sources.list.d/stretch-backports.list - # Get packages apt-get update -apt-get install $APT_FLAGS ca-certificates git elfutils wget xz-utils patch bzip2 librsvg2-2 librsvg2-common - -# install recent flatpak packages -apt-get install $APT_FLAGS -t stretch-backports flatpak flatpak-builder +apt-get install $APT_FLAGS ca-certificates git elfutils wget xz-utils patch bzip2 librsvg2-2 librsvg2-common flatpak flatpak-builder # create build directory mkdir -p "$BUILD_DIR" @@ -51,7 +45,7 @@ flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flat for i in {1..5} do echo "Download try $i" - flatpak --system install flathub -y org.kde.Sdk/x86_64/5.12 | true + flatpak --system install flathub -y org.kde.Sdk/x86_64/5.12 || true done ## Workaround end diff --git a/flatpak/io.github.qtox.qTox.json b/flatpak/io.github.qtox.qTox.json index fdcb71a82..a6ae5c838 100644 --- a/flatpak/io.github.qtox.qTox.json +++ b/flatpak/io.github.qtox.qTox.json @@ -2,7 +2,7 @@ "app-id": "io.github.qtox.qTox", "runtime": "org.kde.Platform", "sdk": "org.kde.Sdk", - "runtime-version": "5.11", + "runtime-version": "5.12", "command": "qtox", "rename-icon": "qtox", "finish-args": [ @@ -11,6 +11,7 @@ "--socket=wayland", "--socket=x11", "--share=ipc", + "--talk-name=org.kde.StatusNotifierWatcher", "--filesystem=xdg-desktop", "--filesystem=xdg-documents", "--filesystem=xdg-download", @@ -20,91 +21,60 @@ "--filesystem=/media", "--device=all" ], - "build-options": { - "cflags": "-O3 -DSQLITE_HAS_CODEC", - "cxxflags": "-O3" + "add-extensions": { + "org.freedesktop.Platform.ffmpeg-full": { + "directory": "lib/ffmpeg", + "version": "18.08", + "add-ld-path": "." + } }, "cleanup": [ "/include", "/lib/pkgconfig", - "/share/man" + "/share/man", + "*.la", + "*.a" ], "modules": [ { - "name": "libv4l2", - "config-opts": - [ - "--disable-libdvbv5", - "--disable-v4l-utils", - "--disable-qv4l2" - ], - "sources": - [ - { - "type": "archive", - "url": "https://linuxtv.org/downloads/v4l-utils/v4l-utils-1.14.2.tar.bz2", - "sha256" : "e6b962c4b1253cf852c31da13fd6b5bb7cbe5aa9e182881aec55123bae680692" - } - ] - }, - { - "name": "ffmpeg", - "config-opts": [ - "--disable-everything", - "--enable-gpl", - "--disable-debug", - "--enable-optimizations", - "--enable-shared", - "--disable-programs", - "--disable-protocols", - "--disable-doc", - "--disable-avfilter", - "--disable-avresample", - "--disable-filters", - "--disable-iconv", - "--disable-network", - "--disable-postproc", - "--enable-libv4l2", - "--enable-indev=v4l2", - "--enable-libxcb", - "--enable-indev=xcbgrab", - "--enable-demuxer=h264", - "--enable-demuxer=mjpeg", - "--enable-parser=h264", - "--enable-parser=mjpeg", - "--enable-decoder=h264", - "--enable-decoder=mjpeg", - "--enable-decoder=rawvideo" + "name": "tcl", + "subdir": "unix", + "build-options": { + "no-debuginfo": true + }, + "cleanup": [ + "/bin", + "/lib", + "/man" ], "sources": [ { "type": "archive", - "url": "https://ffmpeg.org/releases/ffmpeg-4.0.1.tar.bz2", - "sha256" : "7ee591b1e7fb66f055fa514fbd5d98e092ddb3dbe37d2e50ea5c16ab51c21670" + "url": "https://downloads.sourceforge.net/project/tcl/Tcl/8.6.10/tcl8.6.10-src.tar.gz", + "sha256": "5196dbf6638e3df8d5c87b5815c8c2b758496eb6f0e41446596c9a4e638d87ed" } ] }, { "name": "sqlcipher", - "rm-configure": true, + "cleanup": [ + "/bin" + ], "config-opts": [ "--enable-tempstore=yes", "--disable-tcl" ], + "build-options": { + "cflags": "-DSQLITE_HAS_CODEC", + "ldflags": "-lcrypto" + }, "sources": [ { "type": "git", "url": "https://github.com/sqlcipher/sqlcipher", - "tag": "v3.4.2", - "commit": "c6f709fca81c910ba133aaf6330c28e01ccfe5f8", + "tag": "v4.3.0", + "commit": "ece66fdcbb6b43876d25e8e6308991a097fa8661", "disable-fsckobjects" : true - }, - { - "type": "script", - "dest-filename": "autogen.sh", - "commands": [ - "AUTOMAKE=\"automake --foreign\" autoreconf -vfi" - ] } ] }, @@ -126,13 +96,19 @@ { "type": "git", "url": "https://github.com/jedisct1/libsodium", - "tag": "1.0.16", - "commit": "675149b9b8b66ff44152553fb3ebf9858128363d" + "tag": "1.0.18", + "commit": "4f5e89fa84ce1d178a6765b8b46f2b6f91216677" } ] }, { + /* Reminder: this is included in KDE 5.13 */ "name": "libqrencode", + "buildsystem": "cmake-ninja", + "config-opts": [ + "-DWITH_TOOLS=NO", + "-DBUILD_SHARED_LIBS=ON" + ], "sources": [ { "type": "git",