diff --git a/CMakeLists.txt b/CMakeLists.txt index 8518091..12d8fd8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,11 +2,14 @@ cmake_minimum_required(VERSION 3.0) project(squawk) set(CMAKE_INCLUDE_CURRENT_DIR ON) +set(CMAKE_CXX_STANDARD 11) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOUIC ON) set(CMAKE_AUTORCC ON) +include(GNUInstallDirs) + find_package(Qt5Widgets CONFIG REQUIRED) find_package(Qt5LinguistTools) @@ -30,7 +33,12 @@ target_link_libraries(squawk Qt5::Widgets) add_subdirectory(ui) add_subdirectory(core) -add_subdirectory(external/qxmpp) + +option(SYSTEM_QXMPP "Use system qxmpp lib" OFF) + +if(NOT SYSTEM_QXMPP) + add_subdirectory(external/qxmpp) +endif() target_link_libraries(squawk squawkUI) target_link_libraries(squawk squawkCORE) @@ -39,5 +47,5 @@ target_link_libraries(squawk uuid) add_dependencies(${CMAKE_PROJECT_NAME} translations) # Install the executable -install(TARGETS squawk DESTINATION bin) -install(FILES ${QM_FILES} DESTINATION share/l10n) +install(TARGETS squawk DESTINATION ${CMAKE_INSTALL_BINDIR}) +install(FILES ${QM_FILES} DESTINATION ${CMAKE_INSTALL_DATADIR}/Macaw/Squawk/l10n) diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 8be08e3..efb966d 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -2,7 +2,6 @@ cmake_minimum_required(VERSION 3.0) project(squawkCORE) # Instruct CMake to run moc automatically when needed. -set (CMAKE_CXX_STANDARD 17) set(CMAKE_AUTOMOC ON) find_package(Qt5Widgets CONFIG REQUIRED) @@ -22,11 +21,15 @@ set(squawkCORE_SRC # Tell CMake to create the helloworld executable add_library(squawkCORE ${squawkCORE_SRC}) +if(SYSTEM_QXMPP) + find_package(QXmpp CONFIG REQUIRED) + get_target_property(QXMPP_INTERFACE_INCLUDE_DIRECTORIES QXmpp::QXmpp INTERFACE_INCLUDE_DIRECTORIES) + target_include_directories(squawkCORE PUBLIC ${QXMPP_INTERFACE_INCLUDE_DIRECTORIES}) +endif() + + # Use the Widgets module from Qt 5. target_link_libraries(squawkCORE Qt5::Core) target_link_libraries(squawkCORE Qt5::Network) target_link_libraries(squawkCORE qxmpp) target_link_libraries(squawkCORE lmdb) - -# Install the executable -install(TARGETS squawkCORE DESTINATION lib) diff --git a/main.cpp b/main.cpp index 2b1b53e..dac0e91 100644 --- a/main.cpp +++ b/main.cpp @@ -25,6 +25,7 @@ #include #include #include +#include int main(int argc, char *argv[]) { @@ -38,14 +39,25 @@ int main(int argc, char *argv[]) QCoreApplication::setOrganizationName("Macaw"); QCoreApplication::setOrganizationDomain("macaw.me"); QCoreApplication::setApplicationName("Squawk"); - QCoreApplication::setApplicationVersion("0.0.4"); + QCoreApplication::setApplicationVersion("0.0.5"); QTranslator qtTranslator; qtTranslator.load("qt_" + QLocale::system().name(), QLibraryInfo::location(QLibraryInfo::TranslationsPath)); app.installTranslator(&qtTranslator); QTranslator myappTranslator; - myappTranslator.load(QLocale(), QLatin1String("squawk"), "."); + QStringList shares = QStandardPaths::standardLocations(QStandardPaths::AppDataLocation); + bool found = false; + for (QString share : shares) { + found = myappTranslator.load(QLocale(), QLatin1String("squawk"), ".", share + "/l10n"); + if (found) { + break; + } + } + if (!found) { + myappTranslator.load(QLocale(), QLatin1String("squawk"), ".", QCoreApplication::applicationDirPath()); + } + app.installTranslator(&myappTranslator); QIcon icon; diff --git a/packaging/Archlinux/PKGBUILD b/packaging/Archlinux/PKGBUILD new file mode 100644 index 0000000..90e0a0c --- /dev/null +++ b/packaging/Archlinux/PKGBUILD @@ -0,0 +1,21 @@ +# Maintainer: Yury Gubich +pkgname=squawk-git +pkgver=0.0.5 +pkgrel=1 +pkgdesc="An XMPP desktop messenger, written on qt" +arch=('i686' 'x86_64') +url="https://git.macaw.me/blue/squawk" +license=('GPLv3') +depends=('qt5-base' 'qt5-svg' 'lmdb' 'qxmpp>=1.0.0' 'libutil-linux') +makedepends=('cmake') +source=("https://git.macaw.me/blue/squawk/archive/master.tar.gz") +md5sums=('SKIP') +build() { + cd "$srcdir/squawk" + cmake . -D SYSTEM_QXMPP:BOOL=True -D CMAKE_INSTALL_PREFIX=/usr -G Ninja + cmake --build . +} +package() { + cd "$srcdir/squawk" + DESTDIR="$pkgdir/" cmake --build . --target install +} diff --git a/translations/main.ts b/translations/main.ts deleted file mode 100644 index e655a2b..0000000 --- a/translations/main.ts +++ /dev/null @@ -1,283 +0,0 @@ - - - - - Account - - - - Account - - - - - - Your account login - - - - - - Server - - - - - - A server address of your account. Like 404.city or macaw.me - - - - - - Login - - - - - - Password - - - - - - Password of your account - - - - - - Name - - - - - - Just a name how would you call this account, doesn't affect anything - - - - - - Resource - - - - - - A resource name like "Home" or "Work" - - - - - - QXmpp - - - - - Accounts - - - - Accounts - - - - - - Delete - - - - - - Add - - - - - - Edit - - - - - - Change password - - - - - - Connect - - - - - JoinConference - - - - Join new conference - - - - - - JID - - - - - - Room JID - - - - - - identifier@conference.server.org - - - - - - Account - - - - - - Join on login - - - - - - If checked Squawk will try to join this conference on login - - - - - - Nick name - - - - - - Your nick name for that conference. If you leave this field empty your account name will be used as a nick name - - - - - - John - - - - - NewContact - - - - Add new contact - - - - - - Account - - - - - - An account that is going to have new contact - - - - - - JID - - - - - - Jabber id of your new contact - - - - - - name@server.dmn - - - - - - Name - - - - - - The way this new contact will be labeled in your roster (optional) - - - - - - John Smith - - - - - Squawk - - - - squawk - - - - - - Settings - - - - - - Squawk - - - - - - Accounts - - - - - - Quit - - - - - - Add contact - - - - - - Add conference - - - - diff --git a/translations/main_ru.qm b/translations/main_ru.qm deleted file mode 100644 index a0d42b2..0000000 Binary files a/translations/main_ru.qm and /dev/null differ diff --git a/translations/main_ru.qph b/translations/main_ru.qph deleted file mode 100644 index 5ae047d..0000000 --- a/translations/main_ru.qph +++ /dev/null @@ -1,22 +0,0 @@ - - - - Add contact - Добавить контакт - Opens add contact dialog - - - Add conference - Присоединиться к беседе - Opens a dialog to join conference - - - Quit - Выйти - Quits the application - - - Account - Учетная запись - - diff --git a/translations/main_ru.ts b/translations/main_ru.ts deleted file mode 100644 index c1b218a..0000000 --- a/translations/main_ru.ts +++ /dev/null @@ -1,288 +0,0 @@ - - - - - Account - - - - Account - Заголовок окна - Учетная запись - - - - - Your account login - Имя пользователя Вашей учетной записи - - - - - Server - Сервер - - - - - A server address of your account. Like 404.city or macaw.me - Адресс сервера вашей учетной записи (выглядит как 404.city или macaw.me) - - - - - Login - Имя учетной записи - - - - - Password - Пароль - - - - - Password of your account - Пароль вашей учетной записи - - - - - Name - Имя - - - - - Just a name how would you call this account, doesn't affect anything - Просто имя, то как Вы называете свою учетную запись, может быть любым - - - - - Resource - Ресурс - - - - - A resource name like "Home" or "Work" - Имя этой программы для ваших контактов, может быть "Home" или "Phone" - - - - - QXmpp - Ресурс по умолчанию - QXmpp - - - - Accounts - - - - Accounts - Учетные записи - - - - - Delete - Удалить - - - - - Add - Добавить - - - - - Edit - Редактировать - - - - - Change password - Изменить пароль - - - - - Connect - Подключить - - - - JoinConference - - - - Join new conference - Заголовок окна - Присоединиться к новой беседе - - - - - JID - JID - - - - - Room JID - Jabber-идентификатор беседы - - - - - identifier@conference.server.org - - - - - - Account - - - - - - Join on login - - - - - - If checked Squawk will try to join this conference on login - - - - - - Nick name - - - - - - Your nick name for that conference. If you leave this field empty your account name will be used as a nick name - - - - - - John - - - - - NewContact - - - - Add new contact - Заголовок окна - Добавление нового контакта - - - - - Account - Учетная запись - - - - - An account that is going to have new contact - Учетная запись для которой будет добавлен контакт - - - - - JID - JID - - - - - Jabber id of your new contact - Jabber-идентификатор нового контакта - - - - - name@server.dmn - Placeholder поля ввода JID - name@server.dmn - - - - - Name - Имя - - - - - The way this new contact will be labeled in your roster (optional) - То, как будет подписан контакт в вашем списке контактов (не обязательно) - - - - - John Smith - Иван Иванов - - - - Squawk - - - - squawk - Squawk - - - - - Settings - Настройки - - - - - Squawk - Squawk - - - - - Accounts - Учетные записи - - - - - Quit - Выйти - - - - - Add contact - Добавить контакт - - - - - Add conference - Присоединиться к беседе - - - diff --git a/ui/CMakeLists.txt b/ui/CMakeLists.txt index 3ca0148..982bb9a 100644 --- a/ui/CMakeLists.txt +++ b/ui/CMakeLists.txt @@ -43,6 +43,3 @@ add_library(squawkUI ${squawkUI_SRC}) # Use the Widgets module from Qt 5. target_link_libraries(squawkUI Qt5::Widgets) target_link_libraries(squawkUI Qt5::DBus) - -# Install the executable -install(TARGETS squawkUI DESTINATION lib) diff --git a/ui/models/room.h b/ui/models/room.h index 564a26b..71ac221 100644 --- a/ui/models/room.h +++ b/ui/models/room.h @@ -21,7 +21,7 @@ #include "item.h" #include "participant.h" -#include "../global.h" +#include "../../global.h" namespace Models { diff --git a/ui/utils/messageline.h b/ui/utils/messageline.h index 08cbaa4..3d7fb56 100644 --- a/ui/utils/messageline.h +++ b/ui/utils/messageline.h @@ -30,7 +30,7 @@ #include #include -#include "../global.h" +#include "../../global.h" #include "message.h" class MessageLine : public QWidget