Browse Source

uploading message destruction bug, optimisations for release warnings for debug, packaging, readme

pull/30/head
Blue 2 years ago
parent
commit
ae3a1c97e3
  1. 9
      CMakeLists.txt
  2. 46
      README.md
  3. 2
      main.cpp
  4. 8
      packaging/Archlinux/PKGBUILD
  5. 1
      ui/utils/message.cpp
  6. 43
      ui/utils/messageline.cpp
  7. 4
      ui/utils/messageline.h

9
CMakeLists.txt

@ -14,6 +14,15 @@ include_directories(.)
find_package(Qt5Widgets CONFIG REQUIRED)
find_package(Qt5LinguistTools)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug)
endif()
set(CMAKE_CXX_FLAGS_DEBUG "-g -Wall -Wextra")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
message("Build type: ${CMAKE_BUILD_TYPE}")
set(squawk_SRC
main.cpp
global.cpp

46
README.md

@ -8,22 +8,52 @@ A compact XMPP desktop messenger
- uuid _(usually included in some other package, for example it's ***libutil-linux*** in archlinux)_
- lmdb
- CMake 3.0 or higher
- qxmpp 1.1.0 or higher
### Getting
The easiest way to get the Squawk is to install it from AUR (if you use Archlinux like distribution)
Here is the [link](https://aur.archlinux.org/packages/squawk/) for the AUR package
You can also install it from console if you use some AUR wrapper. Here what it's going to look like with *pacaur*
```
$ pacaur -S squawk
```
### Building
You can also clone the repo and build it from source
Squawk requires Qt with SSL enabled. It uses CMake as build system.
Squawk uses upstream version of QXmpp library so first we need to pull it
There are two ways to build, it depends whether you have qxmpp installed in your system
#### Building with system qxmpp
Here is what you do
```
git submodule update --init --recursive
$ git clone https://git.macaw.me/blue/squawk
$ cd squawk
$ mkdir build
$ cd build
$ cmake ..
$ cmake --build .
```
Then create a folder for the build, go there and build the project using CMake
#### Building with bundled qxmpp
Here is what you do
```
mkdir build
cd build
cmake ..
cmake --build .
$ git clone --recurse-submodules https://git.macaw.me/blue/squawk
$ cd squawk
$ mkdir build
$ cd build
$ cmake .. -D SYSTEM_QXMPP=False
$ cmake --build .
```
## License

2
main.cpp

@ -39,7 +39,7 @@ int main(int argc, char *argv[])
QApplication::setApplicationName("squawk");
QApplication::setApplicationDisplayName("Squawk");
QApplication::setApplicationVersion("0.0.5");
QApplication::setApplicationVersion("0.1.1");
QTranslator qtTranslator;
qtTranslator.load("qt_" + QLocale::system().name(), QLibraryInfo::location(QLibraryInfo::TranslationsPath));

8
packaging/Archlinux/PKGBUILD

@ -1,18 +1,18 @@
# Maintainer: Yury Gubich <blue@macaw.me>
pkgname=squawk
pkgver=0.0.5
pkgver=0.1.1
pkgrel=1
pkgdesc="An XMPP desktop messenger, written on qt"
arch=('i686' 'x86_64')
url="https://git.macaw.me/blue/squawk"
license=('GPL3')
depends=('hicolor-icon-theme' 'desktop-file-utils' 'lmdb' 'qxmpp>=1.0.0')
depends=('hicolor-icon-theme' 'desktop-file-utils' 'lmdb' 'qxmpp>=1.1.0')
makedepends=('cmake>=3.3' 'imagemagick' 'qt5-tools')
source=("$pkgname-$pkgver.tar.gz")
sha256sums=('12bfc517574387257a82143d8970ec0d8d434ccd32f7ac400355ed5fa18192ab')
sha256sums=('d0448f2fdb321e31a40c08b77adc951bafe8d1c271f70d6ffc80fb17cef670cf')
build() {
cd "$srcdir/squawk"
cmake . -D CMAKE_INSTALL_PREFIX=/usr
cmake . -D CMAKE_INSTALL_PREFIX=/usr -D CMAKE_BUILD_TYPE=Release
cmake --build . -j $nproc
}
package() {

1
ui/utils/message.cpp

@ -92,6 +92,7 @@ Message::~Message()
if (!commentAdded) {
delete fileComment;
}
delete body;
}
QString Message::getId() const

43
ui/utils/messageline.cpp

@ -47,7 +47,7 @@ MessageLine::~MessageLine()
}
}
MessageLine::Position MessageLine::message(const Shared::Message& msg)
MessageLine::Position MessageLine::message(const Shared::Message& msg, bool forceOutgoing)
{
QString id = msg.getId();
Index::iterator itr = messageIndex.find(id);
@ -59,27 +59,32 @@ MessageLine::Position MessageLine::message(const Shared::Message& msg)
QString sender;
bool outgoing;
if (room) {
if (msg.getFromResource() == myName) {
sender = myName;
outgoing = true;
} else {
sender = msg.getFromResource();
outgoing = false;
}
if (forceOutgoing) {
sender = myName;
outgoing = true;
} else {
if (msg.getOutgoing()) {
sender = myName;
outgoing = true;
if (room) {
if (msg.getFromResource() == myName) {
sender = myName;
outgoing = true;
} else {
sender = msg.getFromResource();
outgoing = false;
}
} else {
QString jid = msg.getFromJid();
std::map<QString, QString>::iterator itr = palNames.find(jid);
if (itr != palNames.end()) {
sender = itr->second;
if (msg.getOutgoing()) {
sender = myName;
outgoing = true;
} else {
sender = jid;
QString jid = msg.getFromJid();
std::map<QString, QString>::iterator itr = palNames.find(jid);
if (itr != palNames.end()) {
sender = itr->second;
} else {
sender = jid;
}
outgoing = false;
}
outgoing = false;
}
}
@ -328,7 +333,7 @@ void MessageLine::fileError(const QString& messageId, const QString& error)
void MessageLine::appendMessageWithUpload(const Shared::Message& msg, const QString& path)
{
message(msg);
message(msg, true);
QString id = msg.getId();
Message* ui = messageIndex.find(id)->second;
connect(ui, &Message::buttonClicked, this, &MessageLine::onUpload); //this is in case of retry;

4
ui/utils/messageline.h

@ -43,7 +43,7 @@ public:
MessageLine(bool p_room, QWidget* parent = 0);
~MessageLine();
Position message(const Shared::Message& msg);
Position message(const Shared::Message& msg, bool forceOutgoing = false);
void setMyName(const QString& name);
void setPalName(const QString& jid, const QString& name);
QString firstMessageId() const;
@ -52,7 +52,7 @@ public:
void responseLocalFile(const QString& messageId, const QString& path);
void fileError(const QString& messageId, const QString& error);
void fileProgress(const QString& messageId, qreal progress);
void appendMessageWithUpload(const Shared::Message& message, const QString& path);
void appendMessageWithUpload(const Shared::Message& msg, const QString& path);
void removeMessage(const QString& messageId);
signals:

Loading…
Cancel
Save