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: blue
GPG Key ID: 9B203B252A63EE38
8 changed files with 57 additions and 21 deletions

View File

@ -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)!

View File

@ -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)

View File

@ -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

View File

@ -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);

View File

@ -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());

View File

@ -1,19 +1,19 @@
# Maintainer: Yury Gubich <blue@macaw.me>
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"

View File

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

View File

@ -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<MessageDelegate*>(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<MessageDelegate*>(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);