forked from blue/squawk
[Fix] Merge branch 'feat/adapt_win_osx' into upstream_messageFeed
This commit is contained in:
commit
923afe2420
@ -12,7 +12,13 @@ set(CMAKE_AUTORCC ON)
|
||||
include(GNUInstallDirs)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
|
||||
|
||||
add_executable(squawk)
|
||||
set(WIN32_FLAG "")
|
||||
if (WIN32)
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||
set(WIN32_FLAG WIN32)
|
||||
endif()
|
||||
endif(WIN32)
|
||||
add_executable(squawk ${WIN32_FLAG})
|
||||
target_include_directories(squawk PRIVATE ${CMAKE_SOURCE_DIR})
|
||||
|
||||
option(SYSTEM_QXMPP "Use system qxmpp lib" ON)
|
||||
@ -97,11 +103,13 @@ endif ()
|
||||
|
||||
message("Build type: ${CMAKE_BUILD_TYPE}")
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
target_compile_options(squawk PRIVATE
|
||||
"-Wall;-Wextra"
|
||||
"$<$<CONFIG:DEBUG>:-g>"
|
||||
"$<$<CONFIG:RELEASE>:-O3>"
|
||||
)
|
||||
endif(CMAKE_COMPILER_IS_GNUCXX)
|
||||
|
||||
add_subdirectory(core)
|
||||
add_subdirectory(external/simpleCrypt)
|
||||
@ -114,3 +122,5 @@ add_subdirectory(ui)
|
||||
|
||||
# Install the executable
|
||||
install(TARGETS squawk DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
|
||||
target_sources(squawk PRIVATE ${SQUAWK_WIN_RC} ${APP_ICON_MACOSX})
|
||||
|
@ -9,7 +9,6 @@
|
||||
### Prerequisites
|
||||
|
||||
- QT 5.12 *(lower versions might work but it wasn't tested)*
|
||||
- uuid _(usually included in some other package, for example it's ***libutil-linux*** in archlinux)_
|
||||
- lmdb
|
||||
- CMake 3.0 or higher
|
||||
- qxmpp 1.1.0 or higher
|
||||
@ -45,7 +44,7 @@ $ git clone https://git.macaw.me/blue/squawk
|
||||
$ cd squawk
|
||||
$ mkdir build
|
||||
$ cd build
|
||||
$ cmake ..
|
||||
$ cmake .. [-DLMDB_DIR:PATH=/path/to/lmdb]
|
||||
$ cmake --build .
|
||||
```
|
||||
|
||||
@ -58,7 +57,7 @@ $ git clone --recurse-submodules https://git.macaw.me/blue/squawk
|
||||
$ cd squawk
|
||||
$ mkdir build
|
||||
$ cd build
|
||||
$ cmake .. -D SYSTEM_QXMPP=False
|
||||
$ cmake .. -D SYSTEM_QXMPP=False [-DLMDB_DIR:PATH=/path/to/lmdb]
|
||||
$ cmake --build .
|
||||
```
|
||||
|
||||
|
@ -25,10 +25,15 @@ find_path(LMDB_ROOT_DIR
|
||||
)
|
||||
|
||||
find_library(LMDB_LIBRARIES
|
||||
NAMES lmdb
|
||||
NAMES liblmdb.a liblmdb.so liblmdb.so.a liblmdb.dll.a # We want lmdb to be static, if possible
|
||||
HINTS ${LMDB_ROOT_DIR}/lib
|
||||
)
|
||||
|
||||
add_library(lmdb UNKNOWN IMPORTED)
|
||||
set_target_properties(lmdb PROPERTIES
|
||||
IMPORTED_LOCATION ${LMDB_LIBRARIES}
|
||||
)
|
||||
|
||||
find_path(LMDB_INCLUDE_DIRS
|
||||
NAMES lmdb.h
|
||||
HINTS ${LMDB_ROOT_DIR}/include
|
||||
|
@ -1,3 +1,8 @@
|
||||
set(SIGNALCATCHER_SOURCE signalcatcher.cpp)
|
||||
if(WIN32)
|
||||
set(SIGNALCATCHER_SOURCE signalcatcher_win32.cpp)
|
||||
endif(WIN32)
|
||||
|
||||
target_sources(squawk PRIVATE
|
||||
account.cpp
|
||||
account.h
|
||||
@ -13,7 +18,7 @@ target_sources(squawk PRIVATE
|
||||
networkaccess.h
|
||||
rosteritem.cpp
|
||||
rosteritem.h
|
||||
signalcatcher.cpp
|
||||
${SIGNALCATCHER_SOURCE}
|
||||
signalcatcher.h
|
||||
squawk.cpp
|
||||
squawk.h
|
||||
|
42
core/signalcatcher_win32.cpp
Normal file
42
core/signalcatcher_win32.cpp
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Squawk messenger.
|
||||
* Copyright (C) 2021 Shunf4 <shun1048576@gmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "signalcatcher.h"
|
||||
#include <unistd.h>
|
||||
|
||||
SignalCatcher::SignalCatcher(QCoreApplication *p_app, QObject *parent):
|
||||
QObject(parent),
|
||||
app(p_app)
|
||||
{
|
||||
}
|
||||
|
||||
SignalCatcher::~SignalCatcher()
|
||||
{}
|
||||
|
||||
void SignalCatcher::handleSigInt()
|
||||
{
|
||||
}
|
||||
|
||||
void SignalCatcher::intSignalHandler(int unused)
|
||||
{
|
||||
}
|
||||
|
||||
int SignalCatcher::setup_unix_signal_handlers()
|
||||
{
|
||||
return 0;
|
||||
}
|
@ -1,11 +1,41 @@
|
||||
target_sources(squawk PRIVATE resources.qrc)
|
||||
|
||||
configure_file(images/logo.svg squawk.svg COPYONLY)
|
||||
configure_file(squawk.rc squawk.rc 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})
|
||||
if(WIN32)
|
||||
set(CONVERT_BIN magick convert)
|
||||
else(WIN32)
|
||||
set(CONVERT_BIN convert)
|
||||
endif(WIN32)
|
||||
execute_process(COMMAND ${CONVERT_BIN} -background none -size 48x48 squawk.svg squawk48.png WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
execute_process(COMMAND ${CONVERT_BIN} -background none -size 64x64 squawk.svg squawk64.png WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
execute_process(COMMAND ${CONVERT_BIN} -background none -size 128x128 squawk.svg squawk128.png WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
execute_process(COMMAND ${CONVERT_BIN} -background none -size 256x256 squawk.svg squawk256.png WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
if (WIN32)
|
||||
execute_process(COMMAND ${CONVERT_BIN} squawk48.png squawk64.png squawk256.png squawk.ico WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
set(SQUAWK_WIN_RC "${CMAKE_CURRENT_BINARY_DIR}/squawk.rc" PARENT_SCOPE)
|
||||
endif(WIN32)
|
||||
|
||||
if (APPLE)
|
||||
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/icns.iconset")
|
||||
execute_process(COMMAND convert -background none -size 16x16 squawk.svg icns.iconset/icon_16x16.png WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
execute_process(COMMAND convert -background none -resize !32x32 squawk.svg "icns.iconset/icon_16x16@2x.png" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
execute_process(COMMAND convert -background none -resize !32x32 squawk.svg "icns.iconset/icon_32x32.png" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
execute_process(COMMAND convert -background none -resize !64x64 squawk.svg "icns.iconset/icon_32x32@2x.png" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
execute_process(COMMAND convert -background none -resize !128x128 squawk.svg "icns.iconset/icon_128x128.png" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
execute_process(COMMAND convert -background none -resize !256x256 squawk.svg "icns.iconset/icon_128x128@2x.png" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
execute_process(COMMAND convert -background none -resize !256x256 squawk.svg "icns.iconset/icon_256x256.png" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
execute_process(COMMAND convert -background none -resize !512x512 squawk.svg "icns.iconset/icon_256x256@2x.png" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
execute_process(COMMAND convert -background none -resize !512x512 squawk.svg "icns.iconset/icon_512x512.png" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
execute_process(COMMAND convert -background none -resize !1024x1024 squawk.svg "icns.iconset/icon_512x512@2x.png" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
execute_process(COMMAND iconutil -c icns "icns.iconset" -o "squawk.icns" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
set(MACOSX_BUNDLE_ICON_FILE squawk.icns PARENT_SCOPE)
|
||||
set(APP_ICON_MACOSX ${CMAKE_CURRENT_BINARY_DIR}/squawk.icns PARENT_SCOPE)
|
||||
set_source_files_properties(${APP_ICON_MACOSX} PROPERTIES
|
||||
MACOSX_PACKAGE_LOCATION "Resources")
|
||||
endif (APPLE)
|
||||
|
||||
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)
|
||||
|
1
resources/squawk.rc
Normal file
1
resources/squawk.rc
Normal file
@ -0,0 +1 @@
|
||||
IDI_ICON1 ICON "squawk.ico"
|
@ -17,15 +17,11 @@
|
||||
*/
|
||||
|
||||
#include "utils.h"
|
||||
#include <QUuid>
|
||||
|
||||
QString Shared::generateUUID()
|
||||
{
|
||||
uuid_t uuid;
|
||||
uuid_generate(uuid);
|
||||
|
||||
char uuid_str[36];
|
||||
uuid_unparse_lower(uuid, uuid_str);
|
||||
return uuid_str;
|
||||
return QUuid::createUuid().toString();
|
||||
}
|
||||
|
||||
|
||||
|
@ -24,9 +24,8 @@
|
||||
#include <QColor>
|
||||
#include <QRegularExpression>
|
||||
|
||||
//#include "KIO/OpenFileManagerWindowJob"
|
||||
// #include "KIO/OpenFileManagerWindowJob"
|
||||
|
||||
#include <uuid/uuid.h>
|
||||
#include <vector>
|
||||
|
||||
namespace Shared {
|
||||
|
42
signalcatcher_win32.cpp
Normal file
42
signalcatcher_win32.cpp
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Squawk messenger.
|
||||
* Copyright (C) 2021 Shunf4 <shun1048576@gmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "signalcatcher.h"
|
||||
#include <unistd.h>
|
||||
|
||||
SignalCatcher::SignalCatcher(QCoreApplication *p_app, QObject *parent):
|
||||
QObject(parent),
|
||||
app(p_app)
|
||||
{
|
||||
}
|
||||
|
||||
SignalCatcher::~SignalCatcher()
|
||||
{}
|
||||
|
||||
void SignalCatcher::handleSigInt()
|
||||
{
|
||||
}
|
||||
|
||||
void SignalCatcher::intSignalHandler(int unused)
|
||||
{
|
||||
}
|
||||
|
||||
int SignalCatcher::setup_unix_signal_handlers()
|
||||
{
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user