forked from blue/squawk
Merge branch 'build-refactor' into maybe-omemo
This commit is contained in:
commit
f94c3dac14
156
CMakeLists.txt
156
CMakeLists.txt
@ -1,7 +1,8 @@
|
||||
cmake_minimum_required(VERSION 3.4)
|
||||
project(squawk)
|
||||
project(squawk VERSION 0.1.6 LANGUAGES CXX)
|
||||
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
cmake_policy(SET CMP0076 NEW)
|
||||
cmake_policy(SET CMP0079 NEW)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
@ -9,66 +10,21 @@ set(CMAKE_AUTOUIC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
include_directories(.)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
|
||||
|
||||
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
|
||||
exception.cpp
|
||||
signalcatcher.cpp
|
||||
shared/global.cpp
|
||||
shared/utils.cpp
|
||||
shared/message.cpp
|
||||
shared/vcard.cpp
|
||||
shared/icons.cpp
|
||||
shared/messageinfo.cpp
|
||||
)
|
||||
|
||||
set(squawk_HEAD
|
||||
exception.h
|
||||
signalcatcher.h
|
||||
shared.h
|
||||
shared/enums.h
|
||||
shared/message.h
|
||||
shared/global.h
|
||||
shared/utils.h
|
||||
shared/vcard.h
|
||||
shared/icons.h
|
||||
shared/messageinfo.h
|
||||
)
|
||||
|
||||
configure_file(resources/images/logo.svg squawk.svg COPYONLY)
|
||||
execute_process(COMMAND convert -background none -size 48x48 squawk.svg squawk48.png WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
execute_process(COMMAND convert -background none -size 64x64 squawk.svg squawk64.png WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
execute_process(COMMAND convert -background none -size 128x128 squawk.svg squawk128.png WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
execute_process(COMMAND convert -background none -size 256x256 squawk.svg squawk256.png WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
configure_file(packaging/squawk.desktop squawk.desktop COPYONLY)
|
||||
|
||||
set(TS_FILES
|
||||
translations/squawk.ru.ts
|
||||
)
|
||||
qt5_add_translation(QM_FILES ${TS_FILES})
|
||||
add_custom_target(translations ALL DEPENDS ${QM_FILES})
|
||||
|
||||
qt5_add_resources(RCC resources/resources.qrc)
|
||||
add_executable(squawk)
|
||||
target_include_directories(squawk PRIVATE ${CMAKE_SOURCE_DIR})
|
||||
|
||||
option(SYSTEM_QXMPP "Use system qxmpp lib" ON)
|
||||
option(SYSTEM_SIGNAL "Use system signal-protocol-c lib" OFF)
|
||||
option(SYSTEM_SIGNAL "Use system signal-protocol-c lib" ON)
|
||||
option(WITH_KWALLET "Build KWallet support module" ON)
|
||||
option(WITH_KIO "Build KIO support module" ON)
|
||||
|
||||
# Dependencies
|
||||
## Qt
|
||||
find_package(Qt5 COMPONENTS Widgets DBus Gui Xml Network Core REQUIRED)
|
||||
|
||||
## QXmpp
|
||||
if (SYSTEM_QXMPP)
|
||||
find_package(QXmpp CONFIG)
|
||||
|
||||
@ -80,31 +36,18 @@ if (SYSTEM_QXMPP)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# TODO: detect if libsignal-protocol-c exists and set SYSTEM_SIGNAL?
|
||||
|
||||
if (NOT SYSTEM_QXMPP)
|
||||
target_link_libraries(squawk PRIVATE qxmpp)
|
||||
add_subdirectory(external/qxmpp)
|
||||
else ()
|
||||
target_link_libraries(squawk PRIVATE QXmpp::QXmpp)
|
||||
endif ()
|
||||
|
||||
if (NOT SYSTEM_SIGNAL)
|
||||
add_subdirectory(external/signal-protocol-c)
|
||||
endif ()
|
||||
|
||||
if (WITH_KWALLET)
|
||||
find_package(KF5Wallet CONFIG)
|
||||
|
||||
if (NOT KF5Wallet_FOUND)
|
||||
set(WITH_KWALLET OFF)
|
||||
message("KWallet package wasn't found, KWallet support module wouldn't be built")
|
||||
else()
|
||||
add_definitions(-DWITH_KWALLET)
|
||||
message("Building with support of KWallet")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_executable(squawk ${squawk_SRC} ${squawk_HEAD} ${RCC})
|
||||
target_link_libraries(squawk Qt5::Widgets)
|
||||
|
||||
## KIO
|
||||
if (WITH_KIO)
|
||||
find_package(KF5KIO CONFIG)
|
||||
|
||||
@ -112,33 +55,58 @@ if (WITH_KIO)
|
||||
set(WITH_KIO OFF)
|
||||
message("KIO package wasn't found, KIO support modules wouldn't be built")
|
||||
else ()
|
||||
add_definitions(-DWITH_KIO)
|
||||
target_compile_definitions(squawk PRIVATE WITH_KIO)
|
||||
message("Building with support of KIO")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
add_subdirectory(ui)
|
||||
## KWallet
|
||||
if (WITH_KWALLET)
|
||||
find_package(KF5Wallet CONFIG)
|
||||
|
||||
if (NOT KF5Wallet_FOUND)
|
||||
set(WITH_KWALLET OFF)
|
||||
message("KWallet package wasn't found, KWallet support module wouldn't be built")
|
||||
else ()
|
||||
target_compile_definitions(squawk PRIVATE WITH_KWALLET)
|
||||
message("Building with support of KWallet")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
## Signal (TODO)
|
||||
# find_package(Signal REQUIRED)
|
||||
|
||||
## LMDB
|
||||
find_package(LMDB REQUIRED)
|
||||
|
||||
# Linking
|
||||
target_link_libraries(squawk PRIVATE Qt5::Core Qt5::Widgets Qt5::DBus Qt5::Network Qt5::Gui Qt5::Xml)
|
||||
target_link_libraries(squawk PRIVATE lmdb)
|
||||
target_link_libraries(squawk PRIVATE simpleCrypt)
|
||||
target_link_libraries(squawk PRIVATE uuid)
|
||||
|
||||
# Build type
|
||||
if (NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE Debug)
|
||||
endif ()
|
||||
|
||||
message("Build type: ${CMAKE_BUILD_TYPE}")
|
||||
|
||||
target_compile_options(squawk PRIVATE
|
||||
"-Wall;-Wextra"
|
||||
"$<$<CONFIG:DEBUG>:-g>"
|
||||
"$<$<CONFIG:RELEASE>:-O3>"
|
||||
)
|
||||
|
||||
add_subdirectory(core)
|
||||
add_subdirectory(plugins)
|
||||
add_subdirectory(qomemo)
|
||||
|
||||
add_subdirectory(external/simpleCrypt)
|
||||
|
||||
target_link_libraries(squawk squawkUI)
|
||||
target_link_libraries(squawk squawkCORE)
|
||||
target_link_libraries(squawk uuid)
|
||||
target_link_libraries(squawk signal-protocol-c)
|
||||
|
||||
|
||||
|
||||
add_dependencies(${CMAKE_PROJECT_NAME} translations)
|
||||
add_subdirectory(packaging)
|
||||
add_subdirectory(plugins)
|
||||
add_subdirectory(resources)
|
||||
add_subdirectory(shared)
|
||||
add_subdirectory(translations)
|
||||
add_subdirectory(ui)
|
||||
add_subdirectory(qomemo)
|
||||
|
||||
# Install the executable
|
||||
install(TARGETS squawk DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
install(FILES ${QM_FILES} DESTINATION ${CMAKE_INSTALL_DATADIR}/squawk/l10n)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/squawk.svg DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/squawk48.png DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/48x48/apps RENAME squawk.png)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/squawk64.png DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/64x64/apps RENAME squawk.png)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/squawk128.png DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/128x128/apps RENAME squawk.png)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/squawk256.png DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/256x256/apps RENAME squawk.png)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/squawk.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
|
||||
|
15
cmake/FindSignal.cmake
Normal file
15
cmake/FindSignal.cmake
Normal file
@ -0,0 +1,15 @@
|
||||
find_path(Signal_INCLUDE_DIR NAMES signal/signal_protocol.h)
|
||||
find_library(Signal_LIBRARY signal-protocol-c)
|
||||
mark_as_advanced(Signal_INCLUDE_DIR Signal_LIBRARY)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Signal REQUIRED_VARS Signal_LIBRARY Signal_INCLUDE_DIR)
|
||||
|
||||
if (Signal_FOUND AND NOT TARGET Signal::Signal)
|
||||
add_library(Signal::Signal UNKNOWN IMPORTED)
|
||||
set_target_properties(Signal::Signal PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||
IMPORTED_LOCATION "${Signal_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${Signal_INCLUDE_DIR}"
|
||||
)
|
||||
endif ()
|
@ -1,49 +1,27 @@
|
||||
cmake_minimum_required(VERSION 3.3)
|
||||
project(squawkCORE)
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
|
||||
find_package(Qt5Core CONFIG REQUIRED)
|
||||
find_package(Qt5Gui CONFIG REQUIRED)
|
||||
find_package(Qt5Network CONFIG REQUIRED)
|
||||
find_package(Qt5Xml CONFIG REQUIRED)
|
||||
find_package(LMDB REQUIRED)
|
||||
|
||||
set(squawkCORE_SRC
|
||||
squawk.cpp
|
||||
target_sources(squawk PRIVATE
|
||||
account.cpp
|
||||
archive.cpp
|
||||
rosteritem.cpp
|
||||
contact.cpp
|
||||
conference.cpp
|
||||
urlstorage.cpp
|
||||
networkaccess.cpp
|
||||
account.h
|
||||
adapterFuctions.cpp
|
||||
handlers/messagehandler.cpp
|
||||
handlers/rosterhandler.cpp
|
||||
archive.cpp
|
||||
archive.h
|
||||
conference.cpp
|
||||
conference.h
|
||||
contact.cpp
|
||||
contact.h
|
||||
main.cpp
|
||||
networkaccess.cpp
|
||||
networkaccess.h
|
||||
rosteritem.cpp
|
||||
rosteritem.h
|
||||
signalcatcher.cpp
|
||||
signalcatcher.h
|
||||
squawk.cpp
|
||||
squawk.h
|
||||
storage.cpp
|
||||
storage.h
|
||||
urlstorage.cpp
|
||||
urlstorage.h
|
||||
)
|
||||
|
||||
add_subdirectory(handlers)
|
||||
add_subdirectory(passwordStorageEngines)
|
||||
|
||||
# Tell CMake to create the helloworld executable
|
||||
add_library(squawkCORE STATIC ${squawkCORE_SRC})
|
||||
|
||||
|
||||
if(SYSTEM_QXMPP)
|
||||
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 Qt5::Gui)
|
||||
target_link_libraries(squawkCORE Qt5::Xml)
|
||||
target_link_libraries(squawkCORE qxmpp)
|
||||
target_link_libraries(squawkCORE lmdb)
|
||||
target_link_libraries(squawkCORE simpleCrypt)
|
||||
if (WITH_KWALLET)
|
||||
target_link_libraries(squawkCORE kwalletPSE)
|
||||
endif()
|
||||
|
@ -43,7 +43,7 @@
|
||||
#include <QXmppVCardManager.h>
|
||||
#include <QXmppMessageReceiptManager.h>
|
||||
|
||||
#include "shared.h"
|
||||
#include "shared/shared.h"
|
||||
#include "contact.h"
|
||||
#include "conference.h"
|
||||
#include "networkaccess.h"
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <QMimeType>
|
||||
|
||||
#include "shared/message.h"
|
||||
#include "exception.h"
|
||||
#include "shared/exception.h"
|
||||
#include <lmdb.h>
|
||||
#include <list>
|
||||
|
||||
|
6
core/handlers/CMakeLists.txt
Normal file
6
core/handlers/CMakeLists.txt
Normal file
@ -0,0 +1,6 @@
|
||||
target_sources(squawk PRIVATE
|
||||
messagehandler.cpp
|
||||
messagehandler.h
|
||||
rosterhandler.cpp
|
||||
rosterhandler.h
|
||||
)
|
@ -16,18 +16,18 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ui/squawk.h"
|
||||
#include "core/squawk.h"
|
||||
#include "../shared/global.h"
|
||||
#include "../shared/messageinfo.h"
|
||||
#include "../ui/squawk.h"
|
||||
#include "signalcatcher.h"
|
||||
#include "shared/global.h"
|
||||
#include "shared/messageinfo.h"
|
||||
#include <QtWidgets/QApplication>
|
||||
#include <QtCore/QThread>
|
||||
#include <QtCore/QObject>
|
||||
#include <QSettings>
|
||||
#include <QTranslator>
|
||||
#include "squawk.h"
|
||||
#include <QLibraryInfo>
|
||||
#include <QSettings>
|
||||
#include <QStandardPaths>
|
||||
#include <QTranslator>
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QThread>
|
||||
#include <QtWidgets/QApplication>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
@ -1,37 +1,9 @@
|
||||
cmake_minimum_required(VERSION 3.3)
|
||||
project(pse)
|
||||
|
||||
if (WITH_KWALLET)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
|
||||
find_package(Qt5Core CONFIG REQUIRED)
|
||||
find_package(Qt5Gui CONFIG REQUIRED)
|
||||
|
||||
get_target_property(KWALLET_INTERFACE_INCLUDE_DIRECTORIES KF5::Wallet INTERFACE_INCLUDE_DIRECTORIES)
|
||||
get_target_property(Qt5GUI_INTERFACE_INCLUDE_DIRECTORIES Qt5::Gui INTERFACE_INCLUDE_DIRECTORIES)
|
||||
|
||||
set(kwalletPSE_SRC
|
||||
kwallet.cpp
|
||||
)
|
||||
|
||||
add_library(kwalletPSE STATIC ${kwalletPSE_SRC})
|
||||
|
||||
target_include_directories(kwalletPSE PUBLIC ${KWALLET_INTERFACE_INCLUDE_DIRECTORIES})
|
||||
target_include_directories(kwalletPSE PUBLIC ${Qt5GUI_INTERFACE_INCLUDE_DIRECTORIES})
|
||||
|
||||
target_link_libraries(kwalletPSE Qt5::Core)
|
||||
|
||||
set(kwalletW_SRC
|
||||
target_sources(squawk PRIVATE
|
||||
wrappers/kwallet.cpp
|
||||
kwallet.cpp
|
||||
kwallet.h
|
||||
)
|
||||
|
||||
add_library(kwalletWrapper SHARED ${kwalletW_SRC})
|
||||
|
||||
target_include_directories(kwalletWrapper PUBLIC ${KWALLET_INTERFACE_INCLUDE_DIRECTORIES})
|
||||
target_include_directories(kwalletWrapper PUBLIC ${Qt5GUI_INTERFACE_INCLUDE_DIRECTORIES})
|
||||
|
||||
target_link_libraries(kwalletWrapper KF5::Wallet)
|
||||
target_link_libraries(kwalletWrapper Qt5::Core)
|
||||
|
||||
install(TARGETS kwalletWrapper DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
target_link_libraries(squawk PRIVATE KF5::Wallet)
|
||||
endif ()
|
||||
|
12
external/simpleCrypt/CMakeLists.txt
vendored
12
external/simpleCrypt/CMakeLists.txt
vendored
@ -1,16 +1,10 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
project(simplecrypt)
|
||||
project(simplecrypt LANGUAGES CXX)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
|
||||
find_package(Qt5Core CONFIG REQUIRED)
|
||||
find_package(Qt5 COMPONENTS Core REQUIRED)
|
||||
|
||||
set(simplecrypt_SRC
|
||||
simplecrypt.cpp
|
||||
)
|
||||
add_library(simpleCrypt STATIC simplecrypt.cpp simplecrypt.h)
|
||||
|
||||
# Tell CMake to create the helloworld executable
|
||||
add_library(simpleCrypt STATIC ${simplecrypt_SRC})
|
||||
|
||||
# Use the Widgets module from Qt 5.
|
||||
target_link_libraries(simpleCrypt Qt5::Core)
|
||||
|
3
packaging/CMakeLists.txt
Normal file
3
packaging/CMakeLists.txt
Normal file
@ -0,0 +1,3 @@
|
||||
configure_file(squawk.desktop squawk.desktop COPYONLY)
|
||||
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/squawk.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
|
@ -1,26 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.3)
|
||||
project(plugins)
|
||||
|
||||
if (WITH_KIO)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
|
||||
find_package(Qt5Core CONFIG REQUIRED)
|
||||
|
||||
set(openFileManagerWindowJob_SRC
|
||||
openfilemanagerwindowjob.cpp
|
||||
)
|
||||
|
||||
add_library(openFileManagerWindowJob SHARED ${openFileManagerWindowJob_SRC})
|
||||
|
||||
get_target_property(Qt5CORE_INTERFACE_INCLUDE_DIRECTORIES Qt5::Core INTERFACE_INCLUDE_DIRECTORIES)
|
||||
get_target_property(KIO_WIDGETS_INTERFACE_INCLUDE_DIRECTORIES KF5::KIOWidgets INTERFACE_INCLUDE_DIRECTORIES)
|
||||
get_target_property(CORE_ADDONS_INTERFACE_INCLUDE_DIRECTORIES KF5::CoreAddons INTERFACE_INCLUDE_DIRECTORIES)
|
||||
target_include_directories(openFileManagerWindowJob PUBLIC ${KIO_WIDGETS_INTERFACE_INCLUDE_DIRECTORIES})
|
||||
target_include_directories(openFileManagerWindowJob PUBLIC ${CORE_ADDONS_INTERFACE_INCLUDE_DIRECTORIES})
|
||||
target_include_directories(openFileManagerWindowJob PUBLIC ${Qt5CORE_INTERFACE_INCLUDE_DIRECTORIES})
|
||||
|
||||
target_link_libraries(openFileManagerWindowJob KF5::KIOWidgets)
|
||||
target_link_libraries(openFileManagerWindowJob Qt5::Core)
|
||||
|
||||
install(TARGETS openFileManagerWindowJob DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
target_sources(squawk PRIVATE openfilemanagerwindowjob.cpp)
|
||||
target_link_libraries(squawk PRIVATE KF5::KIOWidgets)
|
||||
endif ()
|
||||
|
14
resources/CMakeLists.txt
Normal file
14
resources/CMakeLists.txt
Normal file
@ -0,0 +1,14 @@
|
||||
target_sources(squawk PRIVATE resources.qrc)
|
||||
|
||||
configure_file(images/logo.svg squawk.svg COPYONLY)
|
||||
|
||||
execute_process(COMMAND convert -background none -size 48x48 squawk.svg squawk48.png WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
execute_process(COMMAND convert -background none -size 64x64 squawk.svg squawk64.png WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
execute_process(COMMAND convert -background none -size 128x128 squawk.svg squawk128.png WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
execute_process(COMMAND convert -background none -size 256x256 squawk.svg squawk256.png WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/squawk.svg DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/squawk48.png DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/48x48/apps RENAME squawk.png)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/squawk64.png DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/64x64/apps RENAME squawk.png)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/squawk128.png DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/128x128/apps RENAME squawk.png)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/squawk256.png DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/256x256/apps RENAME squawk.png)
|
19
shared/CMakeLists.txt
Normal file
19
shared/CMakeLists.txt
Normal file
@ -0,0 +1,19 @@
|
||||
target_sources(squawk PRIVATE
|
||||
enums.h
|
||||
global.cpp
|
||||
global.h
|
||||
exception.cpp
|
||||
exception.h
|
||||
icons.cpp
|
||||
icons.h
|
||||
message.cpp
|
||||
message.h
|
||||
messageinfo.cpp
|
||||
messageinfo.h
|
||||
order.h
|
||||
shared.h
|
||||
utils.cpp
|
||||
utils.h
|
||||
vcard.cpp
|
||||
vcard.h
|
||||
)
|
@ -112,6 +112,8 @@ Shared::Global::Global():
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static const QSize defaultIconFileInfoHeight(50, 50);
|
||||
Shared::Global::FileInfo Shared::Global::getFileInfo(const QString& path)
|
||||
{
|
||||
std::map<QString, FileInfo>::const_iterator itr = instance->fileCache.find(path);
|
||||
@ -131,6 +133,8 @@ Shared::Global::FileInfo Shared::Global::getFileInfo(const QString& path)
|
||||
p = FileInfo::Preview::picture;
|
||||
QImage img(path);
|
||||
size = img.size();
|
||||
} else {
|
||||
size = defaultIconFileInfoHeight;
|
||||
}
|
||||
|
||||
itr = instance->fileCache.insert(std::make_pair(path, FileInfo({info.fileName(), size, type, p}))).first;
|
||||
|
@ -19,12 +19,12 @@
|
||||
#ifndef SHARED_H
|
||||
#define SHARED_H
|
||||
|
||||
#include "shared/enums.h"
|
||||
#include "shared/utils.h"
|
||||
#include "shared/icons.h"
|
||||
#include "shared/message.h"
|
||||
#include "shared/vcard.h"
|
||||
#include "shared/global.h"
|
||||
#include "shared/messageinfo.h"
|
||||
#include "enums.h"
|
||||
#include "global.h"
|
||||
#include "icons.h"
|
||||
#include "message.h"
|
||||
#include "messageinfo.h"
|
||||
#include "utils.h"
|
||||
#include "vcard.h"
|
||||
|
||||
#endif // SHARED_H
|
8
translations/CMakeLists.txt
Normal file
8
translations/CMakeLists.txt
Normal file
@ -0,0 +1,8 @@
|
||||
find_package(Qt5LinguistTools)
|
||||
|
||||
set(TS_FILES squawk.ru.ts)
|
||||
qt5_add_translation(QM_FILES ${TS_FILES})
|
||||
add_custom_target(translations ALL DEPENDS ${QM_FILES})
|
||||
install(FILES ${QM_FILES} DESTINATION ${CMAKE_INSTALL_DATADIR}/squawk/l10n)
|
||||
|
||||
add_dependencies(${CMAKE_PROJECT_NAME} translations)
|
@ -1,45 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.3)
|
||||
project(squawkUI)
|
||||
|
||||
# Instruct CMake to run moc automatically when needed.
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
# Instruct CMake to create code from Qt designer ui files
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
|
||||
# Find the QtWidgets library
|
||||
find_package(Qt5 CONFIG REQUIRED COMPONENTS Widgets DBus Core)
|
||||
find_package(Boost 1.36.0 REQUIRED)
|
||||
if(Boost_FOUND)
|
||||
include_directories(${Boost_INCLUDE_DIRS})
|
||||
endif()
|
||||
target_sources(squawk PRIVATE squawk.cpp squawk.h squawk.ui)
|
||||
|
||||
add_subdirectory(models)
|
||||
add_subdirectory(utils)
|
||||
add_subdirectory(widgets)
|
||||
|
||||
set(squawkUI_SRC
|
||||
squawk.cpp
|
||||
squawk.h
|
||||
squawk.ui
|
||||
models/accounts.cpp
|
||||
models/roster.cpp
|
||||
models/item.cpp
|
||||
models/account.cpp
|
||||
models/contact.cpp
|
||||
models/presence.cpp
|
||||
models/group.cpp
|
||||
models/room.cpp
|
||||
models/abstractparticipant.cpp
|
||||
models/participant.cpp
|
||||
models/reference.cpp
|
||||
models/messagefeed.cpp
|
||||
models/element.cpp
|
||||
)
|
||||
|
||||
# Tell CMake to create the helloworld executable
|
||||
add_library(squawkUI STATIC ${squawkUI_SRC})
|
||||
|
||||
# Use the Widgets module from Qt 5.
|
||||
target_link_libraries(squawkUI squawkWidgets)
|
||||
target_link_libraries(squawkUI squawkUIUtils)
|
||||
target_link_libraries(squawkUI Qt5::Widgets)
|
||||
target_link_libraries(squawkUI Qt5::DBus)
|
||||
|
28
ui/models/CMakeLists.txt
Normal file
28
ui/models/CMakeLists.txt
Normal file
@ -0,0 +1,28 @@
|
||||
target_sources(squawk PRIVATE
|
||||
abstractparticipant.cpp
|
||||
abstractparticipant.h
|
||||
account.cpp
|
||||
account.h
|
||||
accounts.cpp
|
||||
accounts.h
|
||||
contact.cpp
|
||||
contact.h
|
||||
element.cpp
|
||||
element.h
|
||||
group.cpp
|
||||
group.h
|
||||
item.cpp
|
||||
item.h
|
||||
messagefeed.cpp
|
||||
messagefeed.h
|
||||
participant.cpp
|
||||
participant.h
|
||||
presence.cpp
|
||||
presence.h
|
||||
reference.cpp
|
||||
reference.h
|
||||
room.cpp
|
||||
room.h
|
||||
roster.cpp
|
||||
roster.h
|
||||
)
|
@ -532,21 +532,24 @@ QModelIndex Models::MessageFeed::modelIndexById(const QString& id) const
|
||||
|
||||
QModelIndex Models::MessageFeed::modelIndexByTime(const QString& id, const QDateTime& time) const
|
||||
{
|
||||
if (indexByTime.size() > 0) {
|
||||
StorageByTime::const_iterator tItr = indexByTime.upper_bound(time);
|
||||
StorageByTime::const_iterator tBeg = indexByTime.begin();
|
||||
StorageByTime::const_iterator tEnd = indexByTime.end();
|
||||
bool found = false;
|
||||
while (tItr != tBeg) {
|
||||
if (id == (*tItr)->getId()) {
|
||||
if (tItr != tEnd && id == (*tItr)->getId()) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
--tItr;
|
||||
}
|
||||
|
||||
if (found || id == (*tItr)->getId()) {
|
||||
if (found && tItr != tEnd && id == (*tItr)->getId()) {
|
||||
int position = indexByTime.rank(tItr);
|
||||
return createIndex(position, 0, *tItr);
|
||||
}
|
||||
}
|
||||
|
||||
return QModelIndex();
|
||||
}
|
||||
|
@ -39,7 +39,7 @@
|
||||
#include "models/roster.h"
|
||||
#include "widgets/vcard/vcard.h"
|
||||
|
||||
#include "shared.h"
|
||||
#include "shared/shared.h"
|
||||
|
||||
namespace Ui {
|
||||
class Squawk;
|
||||
|
@ -1,32 +1,26 @@
|
||||
cmake_minimum_required(VERSION 3.3)
|
||||
project(squawkUIUtils)
|
||||
|
||||
# Instruct CMake to run moc automatically when needed.
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
# Instruct CMake to create code from Qt designer ui files
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
|
||||
# Find the QtWidgets library
|
||||
find_package(Qt5 CONFIG REQUIRED COMPONENTS Widgets Core)
|
||||
|
||||
set(squawkUIUtils_SRC
|
||||
# messageline.cpp
|
||||
# message.cpp
|
||||
resizer.cpp
|
||||
# image.cpp
|
||||
flowlayout.cpp
|
||||
target_sources(squawk PRIVATE
|
||||
badge.cpp
|
||||
progress.cpp
|
||||
badge.h
|
||||
comboboxdelegate.cpp
|
||||
feedview.cpp
|
||||
messagedelegate.cpp
|
||||
comboboxdelegate.h
|
||||
exponentialblur.cpp
|
||||
exponentialblur.h
|
||||
feedview.cpp
|
||||
feedview.h
|
||||
flowlayout.cpp
|
||||
flowlayout.h
|
||||
image.cpp
|
||||
image.h
|
||||
message.cpp
|
||||
message.h
|
||||
messagedelegate.cpp
|
||||
messagedelegate.h
|
||||
messageline.cpp
|
||||
messageline.h
|
||||
progress.cpp
|
||||
progress.h
|
||||
resizer.cpp
|
||||
resizer.h
|
||||
shadowoverlay.cpp
|
||||
shadowoverlay.h
|
||||
)
|
||||
|
||||
# Tell CMake to create the helloworld executable
|
||||
add_library(squawkUIUtils STATIC ${squawkUIUtils_SRC})
|
||||
|
||||
# Use the Widgets module from Qt 5.
|
||||
target_link_libraries(squawkUIUtils squawkWidgets)
|
||||
target_link_libraries(squawkUIUtils Qt5::Widgets)
|
||||
|
@ -307,7 +307,6 @@ void MessageDelegate::paintBar(QProgressBar* bar, QPainter* painter, bool sentBy
|
||||
void MessageDelegate::paintPreview(const Models::FeedItem& data, QPainter* painter, QStyleOptionViewItem& option) const
|
||||
{
|
||||
Shared::Global::FileInfo info = Shared::Global::getFileInfo(data.attach.localPath);
|
||||
if (info.preview == Shared::Global::FileInfo::Preview::picture) {
|
||||
QSize size = constrainAttachSize(info.size, option.rect.size());
|
||||
|
||||
QPoint start;
|
||||
@ -317,16 +316,40 @@ void MessageDelegate::paintPreview(const Models::FeedItem& data, QPainter* paint
|
||||
} else {
|
||||
start = option.rect.topLeft();
|
||||
}
|
||||
QRect rect(start, size);
|
||||
switch (info.preview) {
|
||||
case Shared::Global::FileInfo::Preview::picture: {
|
||||
QImage img(data.attach.localPath);
|
||||
if (img.isNull()) {
|
||||
emit invalidPath(data.id);
|
||||
} else {
|
||||
painter->drawImage(QRect(start, size), img);
|
||||
painter->drawImage(rect, img);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default: {
|
||||
QIcon icon = QIcon::fromTheme(info.mime.iconName());
|
||||
|
||||
painter->save();
|
||||
|
||||
painter->setFont(bodyFont);
|
||||
int labelWidth = option.rect.width() - size.width() - margin;
|
||||
QString elidedName = bodyMetrics.elidedText(info.name, Qt::ElideMiddle, labelWidth);
|
||||
QSize nameSize = bodyMetrics.boundingRect(QRect(start, QSize(labelWidth, 0)), 0, elidedName).size();
|
||||
if (data.sentByMe) {
|
||||
start.rx() -= nameSize.width() + margin;
|
||||
}
|
||||
painter->drawPixmap({start, size}, icon.pixmap(info.size));
|
||||
start.rx() += size.width() + margin;
|
||||
start.ry() += nameSize.height() + (size.height() - nameSize.height()) / 2;
|
||||
painter->drawText(start, elidedName);
|
||||
|
||||
painter->restore();
|
||||
}
|
||||
}
|
||||
|
||||
option.rect.adjust(0, size.height() + textMargin, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
QPushButton * MessageDelegate::getButton(const Models::FeedItem& data) const
|
||||
{
|
||||
|
@ -1,31 +1,23 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
project(squawkWidgets)
|
||||
|
||||
# Instruct CMake to run moc automatically when needed.
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
# Instruct CMake to create code from Qt designer ui files
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
|
||||
# Find the QtWidgets library
|
||||
find_package(Qt5Widgets CONFIG REQUIRED COMPONENTS Widgets Core)
|
||||
|
||||
add_subdirectory(vcard)
|
||||
|
||||
set(squawkWidgets_SRC
|
||||
conversation.cpp
|
||||
chat.cpp
|
||||
room.cpp
|
||||
newcontact.cpp
|
||||
accounts.cpp
|
||||
target_sources(squawk PRIVATE
|
||||
account.cpp
|
||||
account.h
|
||||
account.ui
|
||||
accounts.cpp
|
||||
accounts.h
|
||||
accounts.ui
|
||||
chat.cpp
|
||||
chat.h
|
||||
conversation.cpp
|
||||
conversation.h
|
||||
conversation.ui
|
||||
joinconference.cpp
|
||||
joinconference.h
|
||||
joinconference.ui
|
||||
newcontact.cpp
|
||||
newcontact.h
|
||||
newcontact.ui
|
||||
room.cpp
|
||||
room.h
|
||||
)
|
||||
|
||||
add_library(squawkWidgets STATIC ${squawkWidgets_SRC})
|
||||
|
||||
# Use the Widgets module from Qt 5.
|
||||
target_link_libraries(squawkWidgets vCardUI)
|
||||
target_link_libraries(squawkWidgets squawkUIUtils)
|
||||
target_link_libraries(squawkWidgets Qt5::Widgets)
|
||||
|
||||
qt5_use_modules(squawkWidgets Core Widgets)
|
||||
add_subdirectory(vcard)
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include <QDesktopServices>
|
||||
|
||||
#include "shared/message.h"
|
||||
#include "order.h"
|
||||
#include "shared/order.h"
|
||||
#include "ui/models/account.h"
|
||||
#include "ui/models/roster.h"
|
||||
#include "ui/utils/flowlayout.h"
|
||||
|
@ -1,22 +1,9 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
project(vCardUI)
|
||||
|
||||
# Instruct CMake to run moc automatically when needed.
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
# Instruct CMake to create code from Qt designer ui files
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
|
||||
# Find the QtWidgets library
|
||||
find_package(Qt5Widgets CONFIG REQUIRED)
|
||||
|
||||
set(vCardUI_SRC
|
||||
vcard.cpp
|
||||
target_sources(squawk PRIVATE
|
||||
emailsmodel.cpp
|
||||
emailsmodel.h
|
||||
phonesmodel.cpp
|
||||
phonesmodel.h
|
||||
vcard.cpp
|
||||
vcard.h
|
||||
vcard.ui
|
||||
)
|
||||
|
||||
# Tell CMake to create the helloworld executable
|
||||
add_library(vCardUI STATIC ${vCardUI_SRC})
|
||||
|
||||
# Use the Widgets module from Qt 5.
|
||||
target_link_libraries(vCardUI Qt5::Widgets)
|
||||
|
Loading…
Reference in New Issue
Block a user