fileUpload #30

Manually merged
blue merged 7 commits from fileUpload into master 2019-11-16 18:03:48 +00:00
7 changed files with 80 additions and 35 deletions
Showing only changes of commit ae3a1c97e3 - Show all commits

View File

@ -14,6 +14,15 @@ include_directories(.)
find_package(Qt5Widgets CONFIG REQUIRED) find_package(Qt5Widgets CONFIG REQUIRED)
find_package(Qt5LinguistTools) 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 set(squawk_SRC
main.cpp main.cpp
global.cpp global.cpp

View File

@ -8,22 +8,52 @@ A compact XMPP desktop messenger
- uuid _(usually included in some other package, for example it's ***libutil-linux*** in archlinux)_ - uuid _(usually included in some other package, for example it's ***libutil-linux*** in archlinux)_
- lmdb - lmdb
- CMake 3.0 or higher - 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 ### 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 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 $ git clone --recurse-submodules https://git.macaw.me/blue/squawk
cd build $ cd squawk
cmake .. $ mkdir build
cmake --build . $ cd build
$ cmake .. -D SYSTEM_QXMPP=False
$ cmake --build .
``` ```
## License ## License

View File

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

View File

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

View File

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

View File

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

View File

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