Cleanup cmake, metadata
This commit is contained in:
261
CMakeLists.txt
261
CMakeLists.txt
@@ -1,263 +1,44 @@
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 3.1)
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
|
||||
project(NeoChat VERSION 0.0.90)
|
||||
project(neoChat VERSION 0.0.90)
|
||||
|
||||
set(REQUIRED_KF5_VERSION "5.57.0")
|
||||
find_package(ECM ${REQUIRED_KF5_VERSION} REQUIRED NO_MODULE)
|
||||
set(KF5_MIN_VERSION "5.75.0")
|
||||
set(QT_MIN_VERSION "5.15.0")
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${ECM_MODULE_PATH})
|
||||
find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
|
||||
|
||||
include(KDEClangFormat)
|
||||
|
||||
set(IDENTIFIER "org.kde.neochat")
|
||||
set(COPYRIGHT "Copyright © 2018-2019 bhat@encom.eu.org, 2020 KDE Community")
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
set(LINUX 1)
|
||||
endif(UNIX AND NOT APPLE)
|
||||
|
||||
include(CheckCXXCompilerFlag)
|
||||
if (NOT WIN32)
|
||||
include(GNUInstallDirs)
|
||||
include(cmake/ECMInstallIcons.cmake)
|
||||
endif(NOT WIN32)
|
||||
|
||||
# Find includes in corresponding build directories
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
# Instruct CMake to run moc automatically when needed.
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
|
||||
# Set a default build type if none was specified
|
||||
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||
message(STATUS "Setting build type to 'Debug' as none was specified")
|
||||
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build" FORCE)
|
||||
# Set the possible values of build type for cmake-gui
|
||||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release"
|
||||
"MinSizeRel" "RelWithDebInfo")
|
||||
endif()
|
||||
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
# Setup command line parameters for the compiler and linker
|
||||
foreach (FLAG "" all pedantic extra no-unused-parameter)
|
||||
CHECK_CXX_COMPILER_FLAG("-W${FLAG}" WARN_${FLAG}_SUPPORTED)
|
||||
if ( WARN_${FLAG}_SUPPORTED AND NOT CMAKE_CXX_FLAGS MATCHES "(^| )-W?${FLAG}($| )")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W${FLAG}")
|
||||
endif ()
|
||||
endforeach ()
|
||||
|
||||
# Find the libraries
|
||||
find_package(Qt5 5.12 REQUIRED Widgets Network Quick Qml Gui Svg Multimedia QuickControls2)
|
||||
if(LINUX)
|
||||
find_package(Qt5DBus REQUIRED)
|
||||
endif(LINUX)
|
||||
if (APPLE)
|
||||
find_package(Qt5MacExtras REQUIRED)
|
||||
endif(APPLE)
|
||||
# Qt5_Prefix is only used to show Qt path in message()
|
||||
# Qt5_BinDir is where all the binary tools for Qt are
|
||||
if (QT_QMAKE_EXECUTABLE)
|
||||
get_filename_component(Qt5_BinDir "${QT_QMAKE_EXECUTABLE}" DIRECTORY)
|
||||
get_filename_component(Qt5_Prefix "${Qt5_BinDir}/.." ABSOLUTE)
|
||||
else()
|
||||
get_filename_component(Qt5_BinDir "${Qt5_DIR}/../../../bin" ABSOLUTE)
|
||||
get_filename_component(Qt5_Prefix "${Qt5_DIR}/../../../.." ABSOLUTE)
|
||||
endif()
|
||||
|
||||
# prevent error "You must build your code with position independent code if Qt was built with..
|
||||
if (Qt5_POSITION_INDEPENDENT_CODE)
|
||||
SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
endif()
|
||||
|
||||
set(QML_IMPORT_PATH ${CMAKE_SOURCE_DIR}/qml ${CMAKE_SOURCE_DIR}/imports CACHE string "" FORCE)
|
||||
|
||||
if(WIN32)
|
||||
enable_language(RC)
|
||||
include(CMakeDetermineRCCompiler)
|
||||
endif()
|
||||
|
||||
if ((NOT DEFINED USE_INTREE_LIBQMC OR USE_INTREE_LIBQMC)
|
||||
AND EXISTS ${PROJECT_SOURCE_DIR}/include/libQuotient/lib/util.h)
|
||||
add_subdirectory(include/libQuotient EXCLUDE_FROM_ALL)
|
||||
include_directories(include/libQuotient)
|
||||
if (NOT DEFINED USE_INTREE_LIBQMC)
|
||||
set (USE_INTREE_LIBQMC 1)
|
||||
endif ()
|
||||
endif ()
|
||||
if (NOT USE_INTREE_LIBQMC)
|
||||
find_package(Quotient 0.6 REQUIRED)
|
||||
if (NOT Quotient_FOUND)
|
||||
message( WARNING "libQuotient not found; configuration will most likely fail.")
|
||||
endif ()
|
||||
endif ()
|
||||
include(FeatureSummary)
|
||||
include(ECMSetupVersion)
|
||||
include(KDEInstallDirs)
|
||||
include(KDEClangFormat)
|
||||
include(KDECMakeSettings)
|
||||
include(KDECompilerSettings NO_POLICY_SCOPE)
|
||||
|
||||
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Widgets Core Quick Gui QuickControls2 Multimedia)
|
||||
find_package(KF5 ${REQUIRED_KF5_VERSION} REQUIRED
|
||||
Kirigami2
|
||||
ItemModels
|
||||
I18n
|
||||
)
|
||||
|
||||
find_package(Qt5Keychain REQUIRED)
|
||||
find_package(Quotient 0.7 REQUIRED)
|
||||
|
||||
find_package(Qt5Keychain REQUIRED)
|
||||
find_package(cmark REQUIRED)
|
||||
|
||||
message( STATUS )
|
||||
message( STATUS "=============================================================================" )
|
||||
message( STATUS " Spectral Build Information" )
|
||||
message( STATUS "=============================================================================" )
|
||||
if (CMAKE_BUILD_TYPE)
|
||||
message( STATUS "Build type: ${CMAKE_BUILD_TYPE}")
|
||||
endif(CMAKE_BUILD_TYPE)
|
||||
message( STATUS "Spectral install prefix: ${CMAKE_INSTALL_PREFIX}" )
|
||||
# Get Git info if possible
|
||||
find_package(Git)
|
||||
if(GIT_FOUND)
|
||||
execute_process(COMMAND
|
||||
"${GIT_EXECUTABLE}" rev-parse -q HEAD
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE GIT_SHA1
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
message( STATUS "Git SHA1: ${GIT_SHA1}")
|
||||
endif()
|
||||
message( STATUS "Using compiler: ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}" )
|
||||
message( STATUS "Using Qt ${Qt5_VERSION} at ${Qt5_Prefix}" )
|
||||
if (USE_INTREE_LIBQMC)
|
||||
message( STATUS "Using in-tree libQuotient")
|
||||
if (GIT_FOUND)
|
||||
execute_process(COMMAND
|
||||
"${GIT_EXECUTABLE}" rev-parse -q HEAD
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/libQuotient
|
||||
OUTPUT_VARIABLE LIB_GIT_SHA1
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
message( STATUS " Library git SHA1: ${LIB_GIT_SHA1}")
|
||||
endif (GIT_FOUND)
|
||||
else ()
|
||||
message( STATUS "Using libQuotient ${Quotient_VERSION} at ${Quotient_DIR}")
|
||||
endif ()
|
||||
|
||||
message( STATUS "=============================================================================" )
|
||||
message( STATUS )
|
||||
install(PROGRAMS org.kde.neochat.desktop DESTINATION ${KDE_INSTALL_APPDIR})
|
||||
install(FILES org.kde.neochat.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR})
|
||||
#install(FILES neochat.svg DESTINATION ${KDE_INSTALL_FULL_ICONDIR}/hicolor/scalable/apps)
|
||||
|
||||
# Set up source files
|
||||
set(spectral_SRCS
|
||||
src/notifications/manager.h
|
||||
src/accountlistmodel.h
|
||||
src/controller.h
|
||||
src/emojimodel.h
|
||||
src/imageclipboard.h
|
||||
src/matriximageprovider.h
|
||||
src/messageeventmodel.h
|
||||
src/roomlistmodel.h
|
||||
src/spectralroom.h
|
||||
src/spectraluser.h
|
||||
src/trayicon.h
|
||||
src/userlistmodel.h
|
||||
src/publicroomlistmodel.h
|
||||
src/userdirectorylistmodel.h
|
||||
src/utils.h
|
||||
src/accountlistmodel.cpp
|
||||
src/controller.cpp
|
||||
src/emojimodel.cpp
|
||||
src/imageclipboard.cpp
|
||||
src/matriximageprovider.cpp
|
||||
src/messageeventmodel.cpp
|
||||
src/roomlistmodel.cpp
|
||||
src/spectralroom.cpp
|
||||
src/spectraluser.cpp
|
||||
src/trayicon.cpp
|
||||
src/userlistmodel.cpp
|
||||
src/publicroomlistmodel.cpp
|
||||
src/userdirectorylistmodel.cpp
|
||||
src/utils.cpp
|
||||
src/main.cpp
|
||||
)
|
||||
add_subdirectory(src)
|
||||
|
||||
if (APPLE)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework Foundation -framework Cocoa")
|
||||
set(spectral_SRCS ${spectral_SRCS} src/notifications/managermac.mm)
|
||||
elseif (WIN32)
|
||||
set(spectral_SRCS ${spectral_SRCS} src/notifications/managerwin.cpp src/notifications/wintoastlib.cpp)
|
||||
else ()
|
||||
set(spectral_SRCS ${spectral_SRCS} src/notifications/managerlinux.cpp)
|
||||
endif ()
|
||||
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
|
||||
|
||||
set(spectral_QRC
|
||||
res.qrc
|
||||
)
|
||||
|
||||
QT5_ADD_RESOURCES(spectral_QRC_SRC ${spectral_QRC})
|
||||
set_property(SOURCE qrc_resources.cpp PROPERTY SKIP_AUTOMOC ON)
|
||||
|
||||
if(WIN32)
|
||||
set(spectral_WINRC spectral_win32.rc)
|
||||
set_property(SOURCE spectral_win32.rc APPEND PROPERTY
|
||||
OBJECT_DEPENDS ${PROJECT_SOURCE_DIR}/icons/icon.ico
|
||||
)
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
set(MACOSX_BUNDLE_GUI_IDENTIFIER ${IDENTIFIER})
|
||||
set(MACOSX_BUNDLE_BUNDLE_NAME ${PROJECT_NAME})
|
||||
|
||||
set(MACOSX_BUNDLE_COPYRIGHT ${COPYRIGHT})
|
||||
|
||||
set(MACOSX_BUNDLE_SHORT_VERSION_STRING ${spectral_VERSION})
|
||||
set(MACOSX_BUNDLE_BUNDLE_VERSION ${spectral_VERSION})
|
||||
|
||||
set(ICON_NAME "icon.icns")
|
||||
set(${PROJECT_NAME}_MAC_ICON "${PROJECT_SOURCE_DIR}/icons/${ICON_NAME}")
|
||||
set(MACOSX_BUNDLE_ICON_FILE ${ICON_NAME})
|
||||
set_property(SOURCE "${${PROJECT_NAME}_MAC_ICON}" PROPERTY
|
||||
MACOSX_PACKAGE_LOCATION Resources)
|
||||
endif(APPLE)
|
||||
|
||||
# Windows, this is a GUI executable; OSX, make a bundle
|
||||
add_executable(${PROJECT_NAME} WIN32 MACOSX_BUNDLE
|
||||
${spectral_SRCS} ${spectral_QRC_SRC}
|
||||
${spectral_WINRC} ${${PROJECT_NAME}_MAC_ICON})
|
||||
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
Qt5::Widgets Qt5::Quick Qt5::Qml Qt5::Gui Qt5::Network Qt5::Svg Qt5::QuickControls2
|
||||
KF5::Kirigami2
|
||||
Quotient
|
||||
cmark::cmark
|
||||
${QTKEYCHAIN_LIBRARIES}
|
||||
)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE
|
||||
GIT_SHA1="${GIT_SHA1}" LIB_GIT_SHA1="${LIB_GIT_SHA1}")
|
||||
|
||||
if (APPLE)
|
||||
target_link_libraries(${PROJECT_NAME} Qt5::MacExtras)
|
||||
elseif(LINUX)
|
||||
target_link_libraries(${PROJECT_NAME} Qt5::DBus)
|
||||
endif()
|
||||
|
||||
# macOS specific config for bundling
|
||||
set_property(TARGET ${PROJECT_NAME} PROPERTY
|
||||
MACOSX_BUNDLE_INFO_PLIST "${PROJECT_SOURCE_DIR}/macOS/Info.plist.in")
|
||||
|
||||
# Installation
|
||||
|
||||
if (NOT CMAKE_INSTALL_BINDIR)
|
||||
set(CMAKE_INSTALL_BINDIR ".")
|
||||
endif()
|
||||
|
||||
install(TARGETS ${PROJECT_NAME}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
if(LINUX)
|
||||
install(FILES linux/${IDENTIFIER}.desktop
|
||||
DESTINATION ${CMAKE_INSTALL_DATADIR}/applications
|
||||
)
|
||||
install(FILES linux/${IDENTIFIER}.appdata.xml
|
||||
DESTINATION ${CMAKE_INSTALL_DATADIR}/metainfo
|
||||
)
|
||||
file(GLOB spectral_icons icons/hicolor/*-apps-org.kde.neochat.png)
|
||||
ecm_install_icons(ICONS ${spectral_icons}
|
||||
DESTINATION ${CMAKE_INSTALL_DATADIR}/icons
|
||||
)
|
||||
endif(LINUX)
|
||||
|
||||
# add clang-format target for all our real source files
|
||||
file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES *.cpp *.h)
|
||||
file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES src/*.cpp src/*.h)
|
||||
kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES})
|
||||
|
||||
@@ -1,134 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<component type="desktop">
|
||||
<id>org.eu.encom.spectral</id>
|
||||
<provides>
|
||||
<binary>spectral</binary>
|
||||
</provides>
|
||||
<name>Spectral</name>
|
||||
<name xml:lang="ca">Spectral</name>
|
||||
<name xml:lang="ca-valencia">Spectral</name>
|
||||
<name xml:lang="es">Spectral</name>
|
||||
<name xml:lang="fr">Spectral</name>
|
||||
<name xml:lang="nl">Spectral</name>
|
||||
<name xml:lang="nn">Spectral</name>
|
||||
<name xml:lang="pt">Spectral</name>
|
||||
<name xml:lang="sv">Spectral</name>
|
||||
<name xml:lang="uk">Spectral</name>
|
||||
<name xml:lang="x-test">xxSpectralxx</name>
|
||||
<summary>IM client for the Matrix protocol</summary>
|
||||
<summary xml:lang="ca">Client de MI per al protocol Matrix</summary>
|
||||
<summary xml:lang="ca-valencia">Client de MI per al protocol Matrix</summary>
|
||||
<summary xml:lang="es">Cliente de MI para el protocolo Matrix</summary>
|
||||
<summary xml:lang="fr">Client « IM » pour le protocole « Matrix »</summary>
|
||||
<summary xml:lang="nl">IM-client voor het Matrix-protocol</summary>
|
||||
<summary xml:lang="nn">Lynmeldingsklient for Matrix-protokollen</summary>
|
||||
<summary xml:lang="pt">Cliente de MI para o protocolo Matrix</summary>
|
||||
<summary xml:lang="sv">Direktmeddelandeklient för protokollet Matrix</summary>
|
||||
<summary xml:lang="uk">Клієнт служби миттєвого обміну повідомленнями для протоколу Matrix</summary>
|
||||
<summary xml:lang="x-test">xxIM client for the Matrix protocolxx</summary>
|
||||
<description>
|
||||
<p>
|
||||
Spectral is a glossy, cross-platform client for Matrix, the decentralized communication protocol for instant messaging.
|
||||
</p>
|
||||
<p xml:lang="ca">L'Spectral és un client multiplataforma brillant per al Matrix, el protocol descentralitzat de comunicacions per a missatgeria instantània.</p>
|
||||
<p xml:lang="ca-valencia">L'Spectral és un client multiplataforma brillant per al Matrix, el protocol descentralitzat de comunicacions per a missatgeria instantània.</p>
|
||||
<p xml:lang="es">Spectral es un brillante cliente multiplataforma para Matrix, el protocolo de comunicación descentralizado de mensajería instantánea.</p>
|
||||
<p xml:lang="fr">Spectral est un client multi-plate-forme et brillant pour Matrix, le protocole décentralisé de communications pour la messagerie instantanée.</p>
|
||||
<p xml:lang="nl">Spectral is een glossy, cross-platform client voor Matrix, het gedecentraliseerde communicatieprotocol voor instant messaging.</p>
|
||||
<p xml:lang="nn">Spectral er ein lekker multiplattform-klient for Matrix, den desentraliserte lynmeldingsprotokollen.</p>
|
||||
<p xml:lang="pt">O Spectral é um cliente bonito e multi-plataforma para a Matrix, o protocolo de comunicações descentralizado de mensagens instantâneas.</p>
|
||||
<p xml:lang="sv">Spectral är en glansig klient för Matrix, det decentraliserade kommunikationsprotokollet för direktmeddelanden, för flera plattformar.</p>
|
||||
<p xml:lang="uk">Spectral — блискучий клієнт Matrix для багатьох платформ. Matrix є децентралізованим протоколом обміну даними для миттєвого обміну повідомленнями.</p>
|
||||
<p xml:lang="x-test">xxSpectral is a glossy, cross-platform client for Matrix, the decentralized communication protocol for instant messaging.xx</p>
|
||||
</description>
|
||||
<url type="homepage">https://gitlab.com/spectral-im/spectral/</url>
|
||||
<url type="bugtracker">https://gitlab.com/spectral-im/spectral/issues/</url>
|
||||
<url type="help">https://spectral.im/docs/</url>
|
||||
<categories>
|
||||
<category>Matrix</category>
|
||||
<category>Internet</category>
|
||||
</categories>
|
||||
<developer_name>Black Hat</developer_name>
|
||||
<developer_name xml:lang="ca">Black Hat</developer_name>
|
||||
<developer_name xml:lang="ca-valencia">Black Hat</developer_name>
|
||||
<developer_name xml:lang="es">Black Hat</developer_name>
|
||||
<developer_name xml:lang="fr">Hacker éthique</developer_name>
|
||||
<developer_name xml:lang="nl">Black Hat</developer_name>
|
||||
<developer_name xml:lang="nn">Black Hat</developer_name>
|
||||
<developer_name xml:lang="pt">Chapéu Preto</developer_name>
|
||||
<developer_name xml:lang="sv">Svart hatt</developer_name>
|
||||
<developer_name xml:lang="uk">Black Hat</developer_name>
|
||||
<developer_name xml:lang="x-test">xxBlack Hatxx</developer_name>
|
||||
<metadata_license>CC0-1.0</metadata_license>
|
||||
<project_license>GPL-3.0</project_license>
|
||||
<screenshots>
|
||||
<screenshot type="default">
|
||||
<caption>Overview</caption>
|
||||
<caption xml:lang="ca">Vista general</caption>
|
||||
<caption xml:lang="ca-valencia">Vista general</caption>
|
||||
<caption xml:lang="es">Resumen</caption>
|
||||
<caption xml:lang="fr">Aperçu</caption>
|
||||
<caption xml:lang="nl">Overzicht</caption>
|
||||
<caption xml:lang="nn">Oversikt</caption>
|
||||
<caption xml:lang="pt">Introdução</caption>
|
||||
<caption xml:lang="sv">Översikt</caption>
|
||||
<caption xml:lang="uk">Огляд</caption>
|
||||
<caption xml:lang="x-test">xxOverviewxx</caption>
|
||||
<image>https://gitlab.com/spectral-im/spectral/raw/master/screenshots/1.png</image>
|
||||
</screenshot>
|
||||
<screenshot>
|
||||
<caption>Room Timeline</caption>
|
||||
<caption xml:lang="ca">Línia de temps de les sales</caption>
|
||||
<caption xml:lang="ca-valencia">Línia de temps de les sales</caption>
|
||||
<caption xml:lang="es">Cronología de la sala</caption>
|
||||
<caption xml:lang="fr">Frise chronologique pour Room</caption>
|
||||
<caption xml:lang="nl">Tijdlijn van room</caption>
|
||||
<caption xml:lang="nn">Rom-tidslinje</caption>
|
||||
<caption xml:lang="pt">Cronologia da Sala</caption>
|
||||
<caption xml:lang="sv">Tidslinje för rum</caption>
|
||||
<caption xml:lang="uk">Шкала часу кімнати</caption>
|
||||
<caption xml:lang="x-test">xxRoom Timelinexx</caption>
|
||||
<image>https://gitlab.com/spectral-im/spectral/raw/master/screenshots/2.png</image>
|
||||
</screenshot>
|
||||
<screenshot>
|
||||
<caption>Room Config</caption>
|
||||
<caption xml:lang="ca">Configuració de les sales</caption>
|
||||
<caption xml:lang="ca-valencia">Configuració de les sales</caption>
|
||||
<caption xml:lang="es">Configuración de la sala</caption>
|
||||
<caption xml:lang="fr">Configuration de « Room »</caption>
|
||||
<caption xml:lang="nl">Configuratie van room</caption>
|
||||
<caption xml:lang="nn">Romoppsett</caption>
|
||||
<caption xml:lang="pt">Configuração da Sala</caption>
|
||||
<caption xml:lang="sv">Inställning av rum</caption>
|
||||
<caption xml:lang="uk">Налаштовування кімнати</caption>
|
||||
<caption xml:lang="x-test">xxRoom Configxx</caption>
|
||||
<image>https://gitlab.com/spectral-im/spectral/raw/master/screenshots/3.png</image>
|
||||
</screenshot>
|
||||
<screenshot>
|
||||
<caption>Settings</caption>
|
||||
<caption xml:lang="ca">Arranjament</caption>
|
||||
<caption xml:lang="ca-valencia">Arranjament</caption>
|
||||
<caption xml:lang="es">Preferencias</caption>
|
||||
<caption xml:lang="fr">Configuration</caption>
|
||||
<caption xml:lang="nl">Instellingen</caption>
|
||||
<caption xml:lang="nn">Innstillingar</caption>
|
||||
<caption xml:lang="pt">Configuração</caption>
|
||||
<caption xml:lang="sv">Inställningar</caption>
|
||||
<caption xml:lang="uk">Параметри</caption>
|
||||
<caption xml:lang="x-test">xxSettingsxx</caption>
|
||||
<image>https://gitlab.com/spectral-im/spectral/raw/master/screenshots/4.png</image>
|
||||
</screenshot>
|
||||
</screenshots>
|
||||
<content_rating type="oars-1.0">
|
||||
<content_attribute id="social-chat">intense</content_attribute>
|
||||
<content_attribute id="social-audio">intense</content_attribute>
|
||||
</content_rating>
|
||||
<releases>
|
||||
<release version="648" date="2019-05-22"/>
|
||||
<release version="643" date="2019-05-22"/>
|
||||
<release version="603" date="2019-05-01"/>
|
||||
<release version="464" date="2018-10-24"/>
|
||||
<release version="462" date="2018-10-24"/>
|
||||
<release version="436" date="2018-10-20"/>
|
||||
</releases>
|
||||
</component>
|
||||
@@ -1,39 +0,0 @@
|
||||
[Desktop Entry]
|
||||
Name=Spectral
|
||||
Name[ca]=Spectral
|
||||
Name[ca@valencia]=Spectral
|
||||
Name[es]=Spectral
|
||||
Name[fr]=Spectral
|
||||
Name[nl]=Spectral
|
||||
Name[nn]=Spectral
|
||||
Name[pt]=Spectral
|
||||
Name[sv]=Spectral
|
||||
Name[uk]=Spectral
|
||||
Name[x-test]=xxSpectralxx
|
||||
GenericName=Matrix Client
|
||||
GenericName[ca]=Client del Matrix
|
||||
GenericName[ca@valencia]=Client del Matrix
|
||||
GenericName[es]=Cliente para Matrix
|
||||
GenericName[fr]=Client « Matrix »
|
||||
GenericName[nl]=Matrix-client
|
||||
GenericName[nn]=Matrix-klient
|
||||
GenericName[pt]=Cliente de Matrix
|
||||
GenericName[sv]=Matrix-klient
|
||||
GenericName[uk]=Клієнт Matrix
|
||||
GenericName[x-test]=xxMatrix Clientxx
|
||||
Comment=IM client for the Matrix protocol
|
||||
Comment[ca]=Client de MI per al protocol Matrix
|
||||
Comment[ca@valencia]=Client de MI per al protocol Matrix
|
||||
Comment[es]=Cliente de MI para el protocolo Matrix
|
||||
Comment[fr]=Client « IM » pour le protocole « Matrix »
|
||||
Comment[nl]=IM-client voor het Matrix-protocol
|
||||
Comment[nn]=Lynmeldingsklient for Matrix-protokollen
|
||||
Comment[pt]=Cliente de MI para o protocolo Matrix
|
||||
Comment[sv]=Direktmeddelandeklient för protokollet Matrix
|
||||
Comment[uk]=Клієнт служби миттєвого обміну повідомленнями для протоколу Matrix
|
||||
Comment[x-test]=xxIM client for the Matrix protocolxx
|
||||
Exec=spectral
|
||||
Terminal=false
|
||||
Icon=org.eu.encom.spectral
|
||||
Type=Application
|
||||
Categories=Network;InstantMessaging;
|
||||
21
org.kde.neochat.appdata.xml
Normal file
21
org.kde.neochat.appdata.xml
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<component type="desktop">
|
||||
<id>org.kde.neochat</id>
|
||||
<provides>
|
||||
<binary>neochat</binary>
|
||||
</provides>
|
||||
<name>Neochat</name>
|
||||
<summary>IM client for the Matrix protocol</summary>
|
||||
<description>
|
||||
<p>A client for matrix, the decentralized communication protocol.</p>
|
||||
</description>
|
||||
<url type="homepage">https://kde.org</url>
|
||||
<url type="bugtracker">https://bugs.kde.org</url>
|
||||
<categories>
|
||||
<category>Matrix</category>
|
||||
<category>Internet</category>
|
||||
</categories>
|
||||
<developer_name>The KDE Community</developer_name>
|
||||
<metadata_license>CC0-1.0</metadata_license>
|
||||
<project_license>GPL-3.0</project_license>
|
||||
</component>
|
||||
9
org.kde.neochat.desktop
Normal file
9
org.kde.neochat.desktop
Normal file
@@ -0,0 +1,9 @@
|
||||
[Desktop Entry]
|
||||
Name=Neochat
|
||||
GenericName=Matrix Client
|
||||
Comment=Client for the Matrix protocol
|
||||
Exec=neochat
|
||||
Terminal=false
|
||||
Icon=org.kde.neochat
|
||||
Type=Application
|
||||
Categories=Network;InstantMessaging;
|
||||
25
src/CMakeLists.txt
Normal file
25
src/CMakeLists.txt
Normal file
@@ -0,0 +1,25 @@
|
||||
set(neochat_SRCS
|
||||
accountlistmodel.cpp
|
||||
controller.cpp
|
||||
emojimodel.cpp
|
||||
imageclipboard.cpp
|
||||
matriximageprovider.cpp
|
||||
messageeventmodel.cpp
|
||||
roomlistmodel.cpp
|
||||
spectralroom.cpp
|
||||
spectraluser.cpp
|
||||
trayicon.cpp
|
||||
userlistmodel.cpp
|
||||
publicroomlistmodel.cpp
|
||||
userdirectorylistmodel.cpp
|
||||
utils.cpp
|
||||
main.cpp
|
||||
manager.cpp
|
||||
../res.qrc
|
||||
)
|
||||
|
||||
add_executable(neochat ${neochat_SRCS})
|
||||
|
||||
target_link_libraries(neochat Qt5::Widgets Qt5::Quick Qt5::Qml Qt5::Gui Qt5::Network Qt5::QuickControls2 KF5::Kirigami2 Quotient cmark::cmark ${QTKEYCHAIN_LIBRARIES})
|
||||
|
||||
install(TARGETS neochat ${KF5_INSTALL_TARGETS_DEFAULT_ARGS})
|
||||
@@ -15,7 +15,6 @@
|
||||
|
||||
#include "connection.h"
|
||||
#include "csapi/list_public_rooms.h"
|
||||
#include "notifications/manager.h"
|
||||
#include "room.h"
|
||||
#include "settings.h"
|
||||
#include "user.h"
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include "imageclipboard.h"
|
||||
#include "matriximageprovider.h"
|
||||
#include "messageeventmodel.h"
|
||||
#include "notifications/manager.h"
|
||||
#include "manager.h"
|
||||
#include "publicroomlistmodel.h"
|
||||
#include "room.h"
|
||||
#include "roomlistmodel.h"
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
#include "manager.h"
|
||||
|
||||
#include <Foundation/Foundation.h>
|
||||
#include <QtMac>
|
||||
#include <QPixmap>
|
||||
|
||||
@interface NSUserNotification (CFIPrivate)
|
||||
- (void)set_identityImage:(NSImage*)image;
|
||||
@end
|
||||
|
||||
NotificationsManager::NotificationsManager(QObject* parent) : QObject(parent) {}
|
||||
|
||||
void NotificationsManager::postNotification(const QString& roomId,
|
||||
const QString& eventId,
|
||||
const QString& roomName,
|
||||
const QString& senderName,
|
||||
const QString& text,
|
||||
const QImage& icon) {
|
||||
Q_UNUSED(roomId);
|
||||
Q_UNUSED(eventId);
|
||||
Q_UNUSED(icon);
|
||||
|
||||
NSUserNotification* notif = [[NSUserNotification alloc] init];
|
||||
|
||||
notif.title = roomName.toNSString();
|
||||
notif.subtitle = QString("%1 sent a message").arg(senderName).toNSString();
|
||||
notif.informativeText = text.toNSString();
|
||||
notif.soundName = NSUserNotificationDefaultSoundName;
|
||||
notif.contentImage = QtMac::toNSImage(QPixmap::fromImage(icon));
|
||||
|
||||
[[NSUserNotificationCenter defaultUserNotificationCenter]
|
||||
deliverNotification:notif];
|
||||
[notif autorelease];
|
||||
}
|
||||
|
||||
// unused
|
||||
void NotificationsManager::actionInvoked(uint, QString) {}
|
||||
|
||||
void NotificationsManager::notificationClosed(uint, uint) {}
|
||||
@@ -1,93 +0,0 @@
|
||||
#include "manager.h"
|
||||
#include "wintoastlib.h"
|
||||
|
||||
#include <QDir>
|
||||
|
||||
using namespace WinToastLib;
|
||||
|
||||
class CustomHandler : public IWinToastHandler
|
||||
{
|
||||
public:
|
||||
CustomHandler(uint id, NotificationsManager *parent)
|
||||
: notificationID(id)
|
||||
, notificationsManager(parent)
|
||||
{
|
||||
}
|
||||
void toastActivated()
|
||||
{
|
||||
notificationsManager->actionInvoked(notificationID, "");
|
||||
}
|
||||
void toastActivated(int)
|
||||
{
|
||||
notificationsManager->actionInvoked(notificationID, "");
|
||||
}
|
||||
void toastFailed()
|
||||
{
|
||||
std::wcout << L"Error showing current toast" << std::endl;
|
||||
}
|
||||
void toastDismissed(WinToastDismissalReason)
|
||||
{
|
||||
notificationsManager->notificationClosed(notificationID, 0);
|
||||
}
|
||||
|
||||
private:
|
||||
uint notificationID;
|
||||
NotificationsManager *notificationsManager;
|
||||
};
|
||||
|
||||
namespace
|
||||
{
|
||||
bool isInitialized = false;
|
||||
uint count = 0;
|
||||
|
||||
void init()
|
||||
{
|
||||
isInitialized = true;
|
||||
|
||||
WinToast::instance()->setAppName(L"Spectral");
|
||||
WinToast::instance()->setAppUserModelId(WinToast::configureAUMI(L"Spectral", L"Spectral"));
|
||||
if (!WinToast::instance()->initialize())
|
||||
std::wcout << "Your system in not compatible with toast notifications\n";
|
||||
}
|
||||
} // namespace
|
||||
|
||||
NotificationsManager::NotificationsManager(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
}
|
||||
|
||||
void NotificationsManager::postNotification(const QString &room_id, const QString &event_id, const QString &room_name, const QString &sender, const QString &text, const QImage &icon)
|
||||
{
|
||||
Q_UNUSED(room_id)
|
||||
Q_UNUSED(event_id)
|
||||
Q_UNUSED(icon)
|
||||
|
||||
if (!isInitialized)
|
||||
init();
|
||||
|
||||
auto templ = WinToastTemplate(WinToastTemplate::ImageAndText02);
|
||||
if (room_name != sender)
|
||||
templ.setTextField(QString("%1 - %2").arg(sender).arg(room_name).toStdWString(), WinToastTemplate::FirstLine);
|
||||
else
|
||||
templ.setTextField(QString("%1").arg(sender).toStdWString(), WinToastTemplate::FirstLine);
|
||||
templ.setTextField(QString("%1").arg(text).toStdWString(), WinToastTemplate::SecondLine);
|
||||
|
||||
count++;
|
||||
CustomHandler *customHandler = new CustomHandler(count, this);
|
||||
notificationIds[count] = roomEventId {room_id, event_id};
|
||||
|
||||
WinToast::instance()->showToast(templ, customHandler);
|
||||
}
|
||||
|
||||
void NotificationsManager::actionInvoked(uint id, QString action)
|
||||
{
|
||||
if (notificationIds.contains(id)) {
|
||||
roomEventId idEntry = notificationIds[id];
|
||||
emit notificationClicked(idEntry.roomId, idEntry.eventId);
|
||||
}
|
||||
}
|
||||
|
||||
void NotificationsManager::notificationClosed(uint id, uint reason)
|
||||
{
|
||||
notificationIds.remove(id);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,156 +0,0 @@
|
||||
#ifndef WINTOASTLIB_H
|
||||
#define WINTOASTLIB_H
|
||||
#include <Psapi.h>
|
||||
#include <ShObjIdl.h>
|
||||
#include <ShlObj.h>
|
||||
#include <WinUser.h>
|
||||
#include <Windows.h>
|
||||
#include <functiondiscoverykeys.h>
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
#include <propvarutil.h>
|
||||
#include <roapi.h>
|
||||
#include <sdkddkver.h>
|
||||
#include <string.h>
|
||||
#include <strsafe.h>
|
||||
#include <vector>
|
||||
#include <windows.ui.notifications.h>
|
||||
#include <winstring.h>
|
||||
#include <wrl/event.h>
|
||||
#include <wrl/implements.h>
|
||||
using namespace Microsoft::WRL;
|
||||
using namespace ABI::Windows::Data::Xml::Dom;
|
||||
using namespace ABI::Windows::Foundation;
|
||||
using namespace ABI::Windows::UI::Notifications;
|
||||
using namespace Windows::Foundation;
|
||||
|
||||
#define DEFAULT_SHELL_LINKS_PATH L"\\Microsoft\\Windows\\Start Menu\\Programs\\"
|
||||
#define DEFAULT_LINK_FORMAT L".lnk"
|
||||
namespace WinToastLib
|
||||
{
|
||||
class IWinToastHandler
|
||||
{
|
||||
public:
|
||||
enum WinToastDismissalReason {
|
||||
UserCanceled = ToastDismissalReason::ToastDismissalReason_UserCanceled,
|
||||
ApplicationHidden = ToastDismissalReason::ToastDismissalReason_ApplicationHidden,
|
||||
TimedOut = ToastDismissalReason::ToastDismissalReason_TimedOut
|
||||
};
|
||||
virtual ~IWinToastHandler()
|
||||
{
|
||||
}
|
||||
virtual void toastActivated() = 0;
|
||||
virtual void toastActivated(int actionIndex) = 0;
|
||||
virtual void toastDismissed(WinToastDismissalReason state) = 0;
|
||||
virtual void toastFailed() = 0;
|
||||
};
|
||||
|
||||
class WinToastTemplate
|
||||
{
|
||||
public:
|
||||
enum Duration { System, Short, Long };
|
||||
enum AudioOption { Default = 0, Silent = 1, Loop = 2 };
|
||||
enum TextField { FirstLine = 0, SecondLine, ThirdLine };
|
||||
enum WinToastTemplateType {
|
||||
ImageAndText01 = ToastTemplateType::ToastTemplateType_ToastImageAndText01,
|
||||
ImageAndText02 = ToastTemplateType::ToastTemplateType_ToastImageAndText02,
|
||||
ImageAndText03 = ToastTemplateType::ToastTemplateType_ToastImageAndText03,
|
||||
ImageAndText04 = ToastTemplateType::ToastTemplateType_ToastImageAndText04,
|
||||
Text01 = ToastTemplateType::ToastTemplateType_ToastText01,
|
||||
Text02 = ToastTemplateType::ToastTemplateType_ToastText02,
|
||||
Text03 = ToastTemplateType::ToastTemplateType_ToastText03,
|
||||
Text04 = ToastTemplateType::ToastTemplateType_ToastText04,
|
||||
WinToastTemplateTypeCount
|
||||
};
|
||||
|
||||
WinToastTemplate(_In_ WinToastTemplateType type = WinToastTemplateType::ImageAndText02);
|
||||
~WinToastTemplate();
|
||||
|
||||
void setTextField(_In_ const std::wstring &txt, _In_ TextField pos);
|
||||
void setImagePath(_In_ const std::wstring &imgPath);
|
||||
void setAudioPath(_In_ const std::wstring &audioPath);
|
||||
void setAttributionText(_In_ const std::wstring &attributionText);
|
||||
void addAction(_In_ const std::wstring &label);
|
||||
void setAudioOption(_In_ WinToastTemplate::AudioOption audioOption);
|
||||
void setDuration(_In_ Duration duration);
|
||||
void setExpiration(_In_ INT64 millisecondsFromNow);
|
||||
std::size_t textFieldsCount() const;
|
||||
std::size_t actionsCount() const;
|
||||
bool hasImage() const;
|
||||
const std::vector<std::wstring> &textFields() const;
|
||||
const std::wstring &textField(_In_ TextField pos) const;
|
||||
const std::wstring &actionLabel(_In_ int pos) const;
|
||||
const std::wstring &imagePath() const;
|
||||
const std::wstring &audioPath() const;
|
||||
const std::wstring &attributionText() const;
|
||||
INT64 expiration() const;
|
||||
WinToastTemplateType type() const;
|
||||
WinToastTemplate::AudioOption audioOption() const;
|
||||
Duration duration() const;
|
||||
|
||||
private:
|
||||
std::vector<std::wstring> _textFields;
|
||||
std::vector<std::wstring> _actions;
|
||||
std::wstring _imagePath = L"";
|
||||
std::wstring _audioPath = L"";
|
||||
std::wstring _attributionText = L"";
|
||||
INT64 _expiration = 0;
|
||||
AudioOption _audioOption = WinToastTemplate::AudioOption::Default;
|
||||
WinToastTemplateType _type = WinToastTemplateType::Text01;
|
||||
Duration _duration = Duration::System;
|
||||
};
|
||||
|
||||
class WinToast
|
||||
{
|
||||
public:
|
||||
enum WinToastError { NoError = 0, NotInitialized, SystemNotSupported, ShellLinkNotCreated, InvalidAppUserModelID, InvalidParameters, InvalidHandler, NotDisplayed, UnknownError };
|
||||
|
||||
enum ShortcutResult {
|
||||
SHORTCUT_UNCHANGED = 0,
|
||||
SHORTCUT_WAS_CHANGED = 1,
|
||||
SHORTCUT_WAS_CREATED = 2,
|
||||
|
||||
SHORTCUT_MISSING_PARAMETERS = -1,
|
||||
SHORTCUT_INCOMPATIBLE_OS = -2,
|
||||
SHORTCUT_COM_INIT_FAILURE = -3,
|
||||
SHORTCUT_CREATE_FAILED = -4
|
||||
};
|
||||
|
||||
WinToast(void);
|
||||
virtual ~WinToast();
|
||||
static WinToast *instance();
|
||||
static bool isCompatible();
|
||||
static bool isSupportingModernFeatures();
|
||||
static std::wstring configureAUMI(_In_ const std::wstring &companyName, _In_ const std::wstring &productName, _In_ const std::wstring &subProduct = std::wstring(), _In_ const std::wstring &versionInformation = std::wstring());
|
||||
virtual bool initialize(_Out_ WinToastError *error = nullptr);
|
||||
virtual bool isInitialized() const;
|
||||
virtual bool hideToast(_In_ INT64 id);
|
||||
virtual INT64 showToast(_In_ const WinToastTemplate &toast, _In_ IWinToastHandler *handler, _Out_ WinToastError *error = nullptr);
|
||||
virtual void clear();
|
||||
virtual enum ShortcutResult createShortcut();
|
||||
|
||||
const std::wstring &appName() const;
|
||||
const std::wstring &appUserModelId() const;
|
||||
void setAppUserModelId(_In_ const std::wstring &appName);
|
||||
void setAppName(_In_ const std::wstring &appName);
|
||||
|
||||
protected:
|
||||
bool _isInitialized;
|
||||
bool _hasCoInitialized;
|
||||
std::wstring _appName;
|
||||
std::wstring _aumi;
|
||||
std::map<INT64, ComPtr<IToastNotification>> _buffer;
|
||||
|
||||
HRESULT validateShellLinkHelper(_Out_ bool &wasChanged);
|
||||
HRESULT createShellLinkHelper();
|
||||
HRESULT setImageFieldHelper(_In_ IXmlDocument *xml, _In_ const std::wstring &path);
|
||||
HRESULT setAudioFieldHelper(_In_ IXmlDocument *xml, _In_ const std::wstring &path, _In_opt_ WinToastTemplate::AudioOption option = WinToastTemplate::AudioOption::Default);
|
||||
HRESULT setTextFieldHelper(_In_ IXmlDocument *xml, _In_ const std::wstring &text, _In_ int pos);
|
||||
HRESULT setAttributionTextFieldHelper(_In_ IXmlDocument *xml, _In_ const std::wstring &text);
|
||||
HRESULT addActionHelper(_In_ IXmlDocument *xml, _In_ const std::wstring &action, _In_ const std::wstring &arguments);
|
||||
HRESULT addDurationHelper(_In_ IXmlDocument *xml, _In_ const std::wstring &duration);
|
||||
ComPtr<IToastNotifier> notifier(_In_ bool *succeded) const;
|
||||
void setError(_Out_ WinToastError *error, _In_ WinToastError value);
|
||||
};
|
||||
}
|
||||
#endif // WINTOASTLIB_H
|
||||
Reference in New Issue
Block a user