From 0d026ad343ac45c140cc5ba5cbba99e67a1564c7 Mon Sep 17 00:00:00 2001 From: blue Date: Mon, 7 Oct 2019 18:35:55 +0300 Subject: [PATCH] an attempt to make a first Archlinux package --- CMakeLists.txt | 14 +- core/CMakeLists.txt | 11 +- main.cpp | 16 +- packaging/Archlinux/PKGBUILD | 21 +++ translations/main.ts | 283 ---------------------------------- translations/main_ru.qm | Bin 4639 -> 0 bytes translations/main_ru.qph | 22 --- translations/main_ru.ts | 288 ----------------------------------- ui/CMakeLists.txt | 3 - ui/models/room.h | 2 +- ui/utils/messageline.h | 2 +- 11 files changed, 55 insertions(+), 607 deletions(-) create mode 100644 packaging/Archlinux/PKGBUILD delete mode 100644 translations/main.ts delete mode 100644 translations/main_ru.qm delete mode 100644 translations/main_ru.qph delete mode 100644 translations/main_ru.ts 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 a0d42b229563a937aff4e0cacdef85ebc9de354d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4639 zcmbVP-ESL35FeAZ<0ffR(i95fV+kK^QLvmeY274E>?F`M2`OzVD3vODvCr`l`!2OF zHTee+LOdW451=B%Hv+^%5fW0xSAiF*@&W>h3W*8?LINrz9(dv7H@o)T#daW|$hq6y z+1;7>&HQF=`0dQrPcEH$;`|NQym$QBcfKAY3LPif_X1J4n`riPqUHznv+WHMX9Q6s zOyMoRVE#0PCkKd{q<(IElERN*z2gG)?r@1(pP{*9e-d4Gf$sio33A`iv4JB*8;{Zt zze6s3h%Uu4L~Wta=A$?-dN6e5({B;cxzNbAk8%FRrqd@5W8X>9@$5FDmaoJEm#)J8 zv*Puh7qS2I@TpU0iNsL&mA5YtZQ2vLZ+Zgf{1|!T7OZ!SG(VN^f<348Gm_NL)?>|D zKHL1+&!1wy6+Qm_Z_wk5=&Rp;hx_i>@X`k#V*a9jw*R%^-KQUeUbNxMF6b3~t))Bk z5zc?2#hiwG_*CoOpI~R?!Pc{O7*bPhFP-0l{jF_hLM7-WIu1V{BWi!McQ+V-gb!rF^2bEF^!cOlGII;TvilyVxY*qc$>vl#?JV1Fh)sD^Y=W9eT%8grT#~|D zQuL|+ag4R<1Iom4v5!@R`r72(Fk%#HrIcFRAv+BRz+{}5P^JvBnNYc(;`qfVO%}Pd z5-_Gf24)Q^W0eiv;TbfPk|ncv(kx0NlYwa^>15>!43vh}KPG3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LLyN!hBy9(6GP^M7 z2hi(OTeul6B!SPKvBNo2mJO6e?%xCM(ghRgoHyptl4K;Ri^}<;Q*zGIku7C z(a1B`A!!Zug_W#H+YDxH&%qu1?U<}&X{MkmWUcdp8M@ByFrtgT>RV##D6W1n@e67@ zC#Fv&Y-R9R8OZu-3%Lpi&&JluLDhr_p3=hKaJmwE^5WpK?&5-io#I+x$aROm`}Y8O zzuSq - - - 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