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 zcmcE7ks@*G{hX<16=n7(EZlq7iGhJJfq}t&2?GPG5(9(Z6$S?OHVDnLj)7%23j+fi zD+8pUZZm{^DPUk= ze!viG8o|K88^!Sa2MYrOYY@YGy%Yup9!5stsCNtu9D$7DbGI@uFq~$zQ$NbU!2XbV zQ(*`L19KS*|3Y;J2CiEy74Ib(7-j@Gt`d%R>mw_n&j$+(`@!3=EvtMUFBsaIEH1Vm!jYz(18M)%ytp1M3`a z+c*Ch7}(ml59P5kFmQVDEITX8z`(-IvzxJ)fkA+UKV-2U0|Vb?{?iARGcYiI%w%8? zn9R(;z|h4a!D7SW&!E8K%i_dh$70E#z+%thz+%T@%;Laez+%H2RWVg=S~#Gu2Vz+%H<$704}%HqVJz+%Ya&Emx3!=S*R z#Nfe@&ydTI%Amxcz+%B-&0+x-4PeM%$Y;m{iF1HF$i~3Hpz5ellvx{vpcI~8l&!?hz`(%nn4FwnnpeUI^2!7j0TvS$2NqKnM;1p0 z1r|pZQx*pnBQR;epuhrgx+&O;&MfXAC$iW=y==~6z+%s0!Qu#ZmIjLvi#Llg$jdAy zEEZs|Sb@CBpuk|lV8CF)pvRERkjYTOP>JN3T!uu3WQIhBat1xHM>XLdvUXG`PAw`+ zEmBBKNhwM#E>_4-Q>e@@EmBB?xL;4f2joQ)0~5XE%#uowCvy{%6U+5-Q!%_L!=em# z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+&Mq5BrzG%rZqvTd>}=k1vp}1Io22)Rj3Vd1GvNa9aB;M&9nR)4;f-?h@ z6rg1cF2~|3C(%9SK|*FHE+}Qa5|ffrixe_b;7u+9ZWV)-(+mnQ7O24k4-76)sjU#4 zn^}^9EnaXoJkk9+fklbM4&2-Z<$q9dj-0tH_@P)SQAe;e0@KHUpyD;}nvSs!*O-sZauHzas?~ zJUizkCZ*=2rYL0QLGpZ2esM`^k%C5kK}lwQUSf_Wwvdry$YV$Z_plt$vTX`OE<+wX zfcZgvM+aywP00n))kBG_@sjP=PjSrMD5k(2em&nE{Amw@s zP!kS4+TaFpLk)su7-UnpKz%qCOHfS=SI-hy3Tee5D->dpWibHPDB#QuY7N0Pa0I88 ylw{_mgB!-kns|^KU~uJ773dzqp|}{_d_q>-!N9=4E6Dg)ll#926U$#6E@1$5<3`5- 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