1
0
forked from blue/squawk

Fix build for qt 5, removed some debug messages

This commit is contained in:
Blue 2024-12-14 18:08:50 +02:00
parent d4cec645b5
commit 321f0b03c8
Signed by untrusted user: blue
GPG Key ID: 9B203B252A63EE38
8 changed files with 57 additions and 21 deletions

View File

@ -1,5 +1,13 @@
# Changelog # 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) ## Squawk 0.2.3 (February 04, 2024)
### Bug fixes ### Bug fixes
- "Add contact" and "Join conference" menu are enabled once again (pavavno)! - "Add contact" and "Join conference" menu are enabled once again (pavavno)!

View File

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.16) 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 CMP0076 NEW)
cmake_policy(SET CMP0077 NEW) cmake_policy(SET CMP0077 NEW)

View File

@ -8,8 +8,8 @@
### Prerequisites ### Prerequisites
- QT 5.12 *(lower versions might work but it wasn't tested)* - QT 5 or 6
- CMake 3.4 or higher - CMake 3.10 or higher
- qxmpp 1.1.0 or higher - qxmpp 1.1.0 or higher
- LMDBAL (my own [library](https://git.macaw.me/blue/lmdbal) for lmdb) - LMDBAL (my own [library](https://git.macaw.me/blue/lmdbal) for lmdb)
- KDE Frameworks: kwallet (optional) - 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_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_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`) - `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 ## License

View File

@ -81,8 +81,8 @@ Core::Account::Account(
config.setDomain(p_server); config.setDomain(p_server);
config.setPassword(p_password); config.setPassword(p_password);
config.setAutoAcceptSubscriptions(true); config.setAutoAcceptSubscriptions(true);
config.setIgnoreSslErrors(true); // config.setIgnoreSslErrors(true);
//config.setAutoReconnectionEnabled(false); // config.setAutoReconnectionEnabled(false);
delay = new DelayManager::Manager(getBareJid()); delay = new DelayManager::Manager(getBareJid());
QObject::connect(delay, &DelayManager::Manager::gotInfo, this, &Account::infoReady); QObject::connect(delay, &DelayManager::Manager::gotInfo, this, &Account::infoReady);
QObject::connect(delay, &DelayManager::Manager::gotOwnInfo, this, &Account::infoReady); QObject::connect(delay, &DelayManager::Manager::gotOwnInfo, this, &Account::infoReady);

View File

@ -91,8 +91,6 @@ void Core::Squawk::stop() {
break; break;
} }
qDebug() << "Saving password for" << acc->getName() << password;
settings.setValue("name", acc->getName()); settings.setValue("name", acc->getName());
settings.setValue("server", acc->getServer()); settings.setValue("server", acc->getServer());
settings.setValue("login", acc->getLogin()); settings.setValue("login", acc->getLogin());

View File

@ -1,19 +1,19 @@
# Maintainer: Yury Gubich <blue@macaw.me> # Maintainer: Yury Gubich <blue@macaw.me>
pkgname=squawk pkgname=squawk
pkgver=0.2.3 pkgver=0.2.4
pkgrel=1 pkgrel=1
pkgdesc="An XMPP desktop messenger, written on pure c++ (qt)" pkgdesc="An XMPP desktop messenger, written on pure c++ (qt)"
arch=('i686' 'x86_64') arch=('i686' 'x86_64')
url="https://git.macaw.me/blue/squawk" url="https://git.macaw.me/blue/squawk"
license=('GPL3') license=('GPL3')
depends=('hicolor-icon-theme' 'desktop-file-utils' 'lmdbal' 'qxmpp-qt5') depends=('hicolor-icon-theme' 'desktop-file-utils' 'lmdbal-qt6' 'qxmpp-qt6')
makedepends=('cmake>=3.3' 'imagemagick' 'qt5-tools' 'boost') makedepends=('cmake>=3.3' 'imagemagick' 'qt6-tools' 'boost')
optdepends=('kwallet5: secure password storage (requires rebuild)' optdepends=('kwallet6: secure password storage (requires rebuild)'
'kconfig5: system themes support (requires rebuild)' 'kconfig6: system themes support (requires rebuild)'
'kconfigwidgets5: system themes support (requires rebuild)' 'kconfigwidgets6: system themes support (requires rebuild)'
'kio5: better show in folder action (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') sha256sums=('SKIP')
build() { build() {
cd "$srcdir/squawk" cd "$srcdir/squawk"

View File

@ -1,7 +1,7 @@
[Desktop Entry] [Desktop Entry]
Type=Application Type=Application
Version=1.0 Version=0.2.4
Name=Squawk Name=Squawk
GenericName=Instant Messenger GenericName=Instant Messenger
GenericName[ru]=Мгновенные сообщения GenericName[ru]=Мгновенные сообщения

View File

@ -190,7 +190,11 @@ void FeedView::updateGeometries() {
previousOffset += elementMargin; previousOffset += elementMargin;
} }
lastDate = currentDate; lastDate = currentDate;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QSize messageSize = itemDelegateForIndex(index)->sizeHint(option, index); QSize messageSize = itemDelegateForIndex(index)->sizeHint(option, index);
#else
QSize messageSize = itemDelegate(index)->sizeHint(option, index);
#endif
uint32_t offsetX(0); uint32_t offsetX(0);
if (specialDelegate) { if (specialDelegate) {
if (index.data(Models::MessageFeed::SentByMe).toBool()) if (index.data(Models::MessageFeed::SentByMe).toBool())
@ -240,7 +244,11 @@ bool FeedView::tryToCalculateGeometriesWithNoScrollbars(const QStyleOptionViewIt
previousOffset += elementMargin; previousOffset += elementMargin;
} }
lastDate = currentDate; 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) if (previousOffset + messageSize.height() + elementMargin > totalHeight)
return false; return false;
@ -333,7 +341,12 @@ void FeedView::paintEvent(QPaintEvent* event) {
stripe.setWidth(viewportRect.width()); stripe.setWidth(viewportRect.width());
bool mouseOver = stripe.contains(cursor) && viewportRect.contains(cursor); bool mouseOver = stripe.contains(cursor) && viewportRect.contains(cursor);
option.state.setFlag(QStyle::State_MouseOver, mouseOver); 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) if (!lastDate.isNull() && currentDate.daysTo(lastDate) > 0)
drawDateDevider(option.rect.bottom(), lastDate, painter); drawDateDevider(option.rect.bottom(), lastDate, painter);
@ -393,8 +406,12 @@ void FeedView::setAnchorHovered(Shared::Hover type) {
void FeedView::mouseMoveEvent(QMouseEvent* event) { void FeedView::mouseMoveEvent(QMouseEvent* event) {
if (!isVisible()) if (!isVisible())
return; 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) { if (mousePressed) {
QPoint distance = dragStartPoint - dragEndPoint; QPoint distance = dragStartPoint - dragEndPoint;
if (distance.manhattanLength() > 5) if (distance.manhattanLength() > 5)
@ -437,7 +454,11 @@ void FeedView::mousePressEvent(QMouseEvent* event) {
mousePressed = event->button() == Qt::LeftButton; mousePressed = event->button() == Qt::LeftButton;
if (mousePressed) { 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) { if (specialDelegate && specialModel) {
MessageDelegate* del = static_cast<MessageDelegate*>(itemDelegate()); MessageDelegate* del = static_cast<MessageDelegate*>(itemDelegate());
QString lastSelectedId = del->clearSelection(); QString lastSelectedId = del->clearSelection();
@ -455,7 +476,11 @@ void FeedView::mouseDoubleClickEvent(QMouseEvent* event) {
QAbstractItemView::mouseDoubleClickEvent(event); QAbstractItemView::mouseDoubleClickEvent(event);
mousePressed = event->button() == Qt::LeftButton; mousePressed = event->button() == Qt::LeftButton;
if (mousePressed) { 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) { if (specialDelegate && specialModel) {
MessageDelegate* del = static_cast<MessageDelegate*>(itemDelegate()); MessageDelegate* del = static_cast<MessageDelegate*>(itemDelegate());
QString lastSelectedId = del->clearSelection(); QString lastSelectedId = del->clearSelection();
@ -483,7 +508,11 @@ void FeedView::mouseReleaseEvent(QMouseEvent* event) {
if (mousePressed) { if (mousePressed) {
if (!dragging && specialDelegate) { if (!dragging && specialDelegate) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QPoint point = event->position().toPoint(); QPoint point = event->position().toPoint();
#else
QPoint point = event->localPos().toPoint();
#endif
QModelIndex index = indexAt(point); QModelIndex index = indexAt(point);
if (index.isValid()) { if (index.isValid()) {
QRect rect = visualRect(index); QRect rect = visualRect(index);