From 321f0b03c8200fa166371f5df78d6641b10e7654 Mon Sep 17 00:00:00 2001 From: blue Date: Sat, 14 Dec 2024 18:08:50 +0200 Subject: [PATCH] Fix build for qt 5, removed some debug messages --- CHANGELOG.md | 8 ++++++ CMakeLists.txt | 2 +- README.md | 5 ++-- core/account.cpp | 4 +-- core/squawk.cpp | 2 -- packaging/Archlinux/PKGBUILD | 16 ++++++------ packaging/squawk.desktop | 2 +- ui/widgets/messageline/feedview.cpp | 39 +++++++++++++++++++++++++---- 8 files changed, 57 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ca1542..6599bb5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## Squawk 0.2.4 (UNRELEASED) +### Bug fixes +- messages to the mucs get sent once again + +### Improvements +- it's possible to build against Qt 6 now +- got rid of deprecated SimpleCrypt library + ## Squawk 0.2.3 (February 04, 2024) ### Bug fixes - "Add contact" and "Join conference" menu are enabled once again (pavavno)! diff --git a/CMakeLists.txt b/CMakeLists.txt index a62c800..4eb833a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.16) -project(squawk VERSION 0.2.3 LANGUAGES CXX) +project(squawk VERSION 0.2.4 LANGUAGES CXX) cmake_policy(SET CMP0076 NEW) cmake_policy(SET CMP0077 NEW) diff --git a/README.md b/README.md index 655304f..08bf735 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,8 @@ ### Prerequisites -- QT 5.12 *(lower versions might work but it wasn't tested)* -- CMake 3.4 or higher +- QT 5 or 6 +- CMake 3.10 or higher - qxmpp 1.1.0 or higher - LMDBAL (my own [library](https://git.macaw.me/blue/lmdbal) for lmdb) - KDE Frameworks: kwallet (optional) @@ -108,6 +108,7 @@ Here is the list of keys you can pass to configuration phase of `cmake ..`: - `WITH_KIO` - `True` builds the `KIO` capability module if `KIO` is installed and if not goes to `False`. `False` disables `KIO` support (default is `True`) - `WITH_KCONFIG` - `True` builds the `KConfig` and `KConfigWidgets` capability module if such packages are installed and if not goes to `False`. `False` disables `KConfig` and `KConfigWidgets` support (default is `True`) - `WITH_OMEMO` - `True` builds the OMEMO encryption, requires `qxmpp` of version >= 1.5.0 built with OMEMO support. `False` disables OMEMO support (default is `False`) +- `QT_VERSION_MAJOR` - `6` builds against Qt 6, `5` builds against Qt 6, corresponding version of lmdbal and qxmpp should be installed. By default it picks your system default Qt ## License diff --git a/core/account.cpp b/core/account.cpp index 6143fa6..e3d14e1 100644 --- a/core/account.cpp +++ b/core/account.cpp @@ -81,8 +81,8 @@ Core::Account::Account( config.setDomain(p_server); config.setPassword(p_password); config.setAutoAcceptSubscriptions(true); - config.setIgnoreSslErrors(true); - //config.setAutoReconnectionEnabled(false); + // config.setIgnoreSslErrors(true); + // config.setAutoReconnectionEnabled(false); delay = new DelayManager::Manager(getBareJid()); QObject::connect(delay, &DelayManager::Manager::gotInfo, this, &Account::infoReady); QObject::connect(delay, &DelayManager::Manager::gotOwnInfo, this, &Account::infoReady); diff --git a/core/squawk.cpp b/core/squawk.cpp index 1851eb3..7f04d9a 100644 --- a/core/squawk.cpp +++ b/core/squawk.cpp @@ -91,8 +91,6 @@ void Core::Squawk::stop() { break; } - qDebug() << "Saving password for" << acc->getName() << password; - settings.setValue("name", acc->getName()); settings.setValue("server", acc->getServer()); settings.setValue("login", acc->getLogin()); diff --git a/packaging/Archlinux/PKGBUILD b/packaging/Archlinux/PKGBUILD index 29ed800..86f2abf 100644 --- a/packaging/Archlinux/PKGBUILD +++ b/packaging/Archlinux/PKGBUILD @@ -1,19 +1,19 @@ # Maintainer: Yury Gubich pkgname=squawk -pkgver=0.2.3 +pkgver=0.2.4 pkgrel=1 pkgdesc="An XMPP desktop messenger, written on pure c++ (qt)" arch=('i686' 'x86_64') url="https://git.macaw.me/blue/squawk" license=('GPL3') -depends=('hicolor-icon-theme' 'desktop-file-utils' 'lmdbal' 'qxmpp-qt5') -makedepends=('cmake>=3.3' 'imagemagick' 'qt5-tools' 'boost') -optdepends=('kwallet5: secure password storage (requires rebuild)' - 'kconfig5: system themes support (requires rebuild)' - 'kconfigwidgets5: system themes support (requires rebuild)' - 'kio5: better show in folder action (requires rebuild)') +depends=('hicolor-icon-theme' 'desktop-file-utils' 'lmdbal-qt6' 'qxmpp-qt6') +makedepends=('cmake>=3.3' 'imagemagick' 'qt6-tools' 'boost') +optdepends=('kwallet6: secure password storage (requires rebuild)' + 'kconfig6: system themes support (requires rebuild)' + 'kconfigwidgets6: system themes support (requires rebuild)' + 'kio6: better show in folder action (requires rebuild)') -source=("$pkgname-$pkgver.tar.gz::https://git.macaw.me/blue/$pkgname/archive/$pkgver.tar.gz") +source=("$pkgname-$pkgver-$pkgrel.tar.gz::https://git.macaw.me/blue/$pkgname/archive/$pkgver.tar.gz") sha256sums=('SKIP') build() { cd "$srcdir/squawk" diff --git a/packaging/squawk.desktop b/packaging/squawk.desktop index ba0f13c..c64f9ab 100644 --- a/packaging/squawk.desktop +++ b/packaging/squawk.desktop @@ -1,7 +1,7 @@ [Desktop Entry] Type=Application -Version=1.0 +Version=0.2.4 Name=Squawk GenericName=Instant Messenger GenericName[ru]=Мгновенные сообщения diff --git a/ui/widgets/messageline/feedview.cpp b/ui/widgets/messageline/feedview.cpp index 3c56d84..29ec9c6 100644 --- a/ui/widgets/messageline/feedview.cpp +++ b/ui/widgets/messageline/feedview.cpp @@ -190,7 +190,11 @@ void FeedView::updateGeometries() { previousOffset += elementMargin; } lastDate = currentDate; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) QSize messageSize = itemDelegateForIndex(index)->sizeHint(option, index); +#else + QSize messageSize = itemDelegate(index)->sizeHint(option, index); +#endif uint32_t offsetX(0); if (specialDelegate) { if (index.data(Models::MessageFeed::SentByMe).toBool()) @@ -240,7 +244,11 @@ bool FeedView::tryToCalculateGeometriesWithNoScrollbars(const QStyleOptionViewIt previousOffset += elementMargin; } lastDate = currentDate; - QSize messageSize = itemDelegateForIndex(index)->sizeHint(option, index); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QSize messageSize = itemDelegateForIndex(index)->sizeHint(option, index); +#else + QSize messageSize = itemDelegate(index)->sizeHint(option, index); +#endif if (previousOffset + messageSize.height() + elementMargin > totalHeight) return false; @@ -333,7 +341,12 @@ void FeedView::paintEvent(QPaintEvent* event) { stripe.setWidth(viewportRect.width()); bool mouseOver = stripe.contains(cursor) && viewportRect.contains(cursor); option.state.setFlag(QStyle::State_MouseOver, mouseOver); - itemDelegateForIndex(index)->paint(&painter, option, index); + +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + itemDelegateForIndex(index)->paint(&painter, option, index); +#else + itemDelegate(index)->paint(&painter, option, index); +#endif if (!lastDate.isNull() && currentDate.daysTo(lastDate) > 0) drawDateDevider(option.rect.bottom(), lastDate, painter); @@ -393,8 +406,12 @@ void FeedView::setAnchorHovered(Shared::Hover type) { void FeedView::mouseMoveEvent(QMouseEvent* event) { if (!isVisible()) return; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + dragEndPoint = event->position().toPoint(); +#else + dragEndPoint = event->localPos().toPoint(); +#endif - dragEndPoint = event->position().toPoint(); if (mousePressed) { QPoint distance = dragStartPoint - dragEndPoint; if (distance.manhattanLength() > 5) @@ -437,7 +454,11 @@ void FeedView::mousePressEvent(QMouseEvent* event) { mousePressed = event->button() == Qt::LeftButton; if (mousePressed) { - dragStartPoint = event->position().toPoint(); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + dragStartPoint = event->position().toPoint(); +#else + dragStartPoint = event->localPos().toPoint(); +#endif if (specialDelegate && specialModel) { MessageDelegate* del = static_cast(itemDelegate()); QString lastSelectedId = del->clearSelection(); @@ -455,7 +476,11 @@ void FeedView::mouseDoubleClickEvent(QMouseEvent* event) { QAbstractItemView::mouseDoubleClickEvent(event); mousePressed = event->button() == Qt::LeftButton; if (mousePressed) { - dragStartPoint = event->position().toPoint(); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + dragStartPoint = event->position().toPoint(); +#else + dragStartPoint = event->localPos().toPoint(); +#endif if (specialDelegate && specialModel) { MessageDelegate* del = static_cast(itemDelegate()); QString lastSelectedId = del->clearSelection(); @@ -483,7 +508,11 @@ void FeedView::mouseReleaseEvent(QMouseEvent* event) { if (mousePressed) { if (!dragging && specialDelegate) { +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) QPoint point = event->position().toPoint(); +#else + QPoint point = event->localPos().toPoint(); +#endif QModelIndex index = indexAt(point); if (index.isValid()) { QRect rect = visualRect(index);