refactor: 大规模调整项目目录结构,将ChatClient和ChatServer整合为Monorepo结构,并分为两个独立文件夹:chatclient/ 和 chatserver/。更新了ChatClient的CMakeLists.txt配置以适配新结构。
@ -1,66 +1,3 @@
|
|||||||
cmake_minimum_required(VERSION 3.16)
|
cmake_minimum_required(VERSION 3.1.3)
|
||||||
|
project(ChatClient)
|
||||||
project(ClientChat VERSION 0.1 LANGUAGES CXX)
|
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/ChatClient)
|
||||||
|
|
||||||
set(CMAKE_AUTOUIC ON)
|
|
||||||
set(CMAKE_AUTOMOC ON)
|
|
||||||
set(CMAKE_AUTORCC ON)
|
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
||||||
|
|
||||||
# 查找模块
|
|
||||||
find_package(Qt6 COMPONENTS
|
|
||||||
Core
|
|
||||||
Protobuf
|
|
||||||
Widgets
|
|
||||||
Network
|
|
||||||
WebSockets
|
|
||||||
Multimedia
|
|
||||||
QUIET)
|
|
||||||
|
|
||||||
set(QT_VERSION_MAJOR 6)
|
|
||||||
|
|
||||||
# proto文件
|
|
||||||
file(GLOB PB_FILES
|
|
||||||
proto/*.proto
|
|
||||||
)
|
|
||||||
|
|
||||||
# 源文件
|
|
||||||
file(GLOB PROJECT_SOURCES
|
|
||||||
model/*.h model/*.cpp
|
|
||||||
network/*.h network/*.cpp
|
|
||||||
*.h *.cpp
|
|
||||||
*.ui
|
|
||||||
*.qrc
|
|
||||||
)
|
|
||||||
|
|
||||||
if(ANDROID)
|
|
||||||
# Android 平台:附加 Android 可部署资源
|
|
||||||
qt_add_executable(ClientChat
|
|
||||||
MANUAL_FINALIZATION
|
|
||||||
${PROJECT_SOURCES}
|
|
||||||
)
|
|
||||||
|
|
||||||
# 指定自定义的 Android 部署目录
|
|
||||||
# set_property(TARGET ClientChat APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
|
|
||||||
else()
|
|
||||||
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
|
|
||||||
|
|
||||||
qt_add_executable(ClientChat
|
|
||||||
MANUAL_FINALIZATION
|
|
||||||
${PROJECT_SOURCES}
|
|
||||||
)
|
|
||||||
|
|
||||||
qt_add_protobuf(ClientChat PROTO_FILES ${PB_FILES})
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# 链接动态库
|
|
||||||
target_link_libraries(ClientChat PRIVATE
|
|
||||||
Qt6::Core
|
|
||||||
Qt${QT_VERSION_MAJOR}::Widgets
|
|
||||||
Qt6::Network
|
|
||||||
Qt6::WebSockets
|
|
||||||
Qt6::Multimedia
|
|
||||||
)
|
|
||||||
|
|||||||
@ -1,22 +0,0 @@
|
|||||||
{
|
|
||||||
"version": 3,
|
|
||||||
"configurePresets": [
|
|
||||||
{
|
|
||||||
"hidden": true,
|
|
||||||
"name": "Qt",
|
|
||||||
"cacheVariables": {
|
|
||||||
"CMAKE_PREFIX_PATH": "$env{QTDIR}"
|
|
||||||
},
|
|
||||||
"vendor": {
|
|
||||||
"qt-project.org/Qt": {
|
|
||||||
"checksum": "wVa86FgEkvdCTVp1/nxvrkaemJc="
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"vendor": {
|
|
||||||
"qt-project.org/Presets": {
|
|
||||||
"checksum": "67SmY24ZeVbebyKD0fGfIzb/bGI="
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,76 +0,0 @@
|
|||||||
{
|
|
||||||
"version": 3,
|
|
||||||
"configurePresets": [
|
|
||||||
{
|
|
||||||
"name": "Qt-Debug",
|
|
||||||
"inherits": "Qt-Default",
|
|
||||||
"binaryDir": "${sourceDir}/out/build/debug",
|
|
||||||
"cacheVariables": {
|
|
||||||
"CMAKE_BUILD_TYPE": "Debug",
|
|
||||||
"CMAKE_CXX_FLAGS": "-DQT_QML_DEBUG"
|
|
||||||
},
|
|
||||||
"environment": {
|
|
||||||
"QML_DEBUG_ARGS": "-qmljsdebugger=file:{74e0e0b6-0fbf-4a0d-93e9-c8349734743b},block"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Qt-Release",
|
|
||||||
"inherits": "Qt-Default",
|
|
||||||
"binaryDir": "${sourceDir}/out/build/release",
|
|
||||||
"cacheVariables": {
|
|
||||||
"CMAKE_BUILD_TYPE": "Release"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"hidden": true,
|
|
||||||
"name": "Qt-Default",
|
|
||||||
"inherits": "6.9.0",
|
|
||||||
"vendor": {
|
|
||||||
"qt-project.org/Default": {
|
|
||||||
"checksum": "ogzyvXATpX3FyMqBErb6IpyYPKI="
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"hidden": true,
|
|
||||||
"name": "5.14.0",
|
|
||||||
"inherits": "Qt",
|
|
||||||
"environment": {
|
|
||||||
"QTDIR": "E:/Qt/Qt5.14.0/5.14.0/msvc2017_64"
|
|
||||||
},
|
|
||||||
"architecture": {
|
|
||||||
"strategy": "external",
|
|
||||||
"value": "x64"
|
|
||||||
},
|
|
||||||
"generator": "Ninja",
|
|
||||||
"vendor": {
|
|
||||||
"qt-project.org/Version": {
|
|
||||||
"checksum": "3cWOu5Lvdo5oEp6qU2AAXDl3CO8="
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"hidden": true,
|
|
||||||
"name": "6.9.0",
|
|
||||||
"inherits": "Qt",
|
|
||||||
"environment": {
|
|
||||||
"QTDIR": "E:/Qt/Qt6.9.0/6.9.0/msvc2022_64"
|
|
||||||
},
|
|
||||||
"architecture": {
|
|
||||||
"strategy": "external",
|
|
||||||
"value": "x64"
|
|
||||||
},
|
|
||||||
"generator": "Ninja",
|
|
||||||
"vendor": {
|
|
||||||
"qt-project.org/Version": {
|
|
||||||
"checksum": "5GMO6/002JUUngppM/iaIHJADvk="
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"vendor": {
|
|
||||||
"qt-project.org/Presets": {
|
|
||||||
"checksum": "Dlc1I+gqV2Q029C9SawBnzSygCA="
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
141
ChatClient/CMakeLists.txt
Normal file
@ -0,0 +1,141 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
|
||||||
|
project(ClientChat VERSION 0.1 LANGUAGES CXX)
|
||||||
|
|
||||||
|
set(CMAKE_AUTOUIC ON)
|
||||||
|
set(CMAKE_AUTOMOC ON)
|
||||||
|
set(CMAKE_AUTORCC ON)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
|
# 查找模块
|
||||||
|
find_package(Qt6 COMPONENTS
|
||||||
|
Core
|
||||||
|
Protobuf
|
||||||
|
Widgets
|
||||||
|
Network
|
||||||
|
WebSockets
|
||||||
|
Multimedia
|
||||||
|
QUIET)
|
||||||
|
|
||||||
|
set(QT_VERSION_MAJOR 6)
|
||||||
|
|
||||||
|
# 设置 UI 文件的搜索路径
|
||||||
|
set(CMAKE_AUTOUIC_SEARCH_PATHS ${CMAKE_CURRENT_SOURCE_DIR}/ui)
|
||||||
|
|
||||||
|
# proto文件
|
||||||
|
file(GLOB PB_FILES
|
||||||
|
proto/*.proto
|
||||||
|
)
|
||||||
|
|
||||||
|
# 源文件
|
||||||
|
# file(GLOB PROJECT_SOURCES
|
||||||
|
# include/model/*.h src/model/*.cpp
|
||||||
|
# include/network/*.h src/network/*.cpp
|
||||||
|
# include/*.h src/*.cpp
|
||||||
|
# ui/*.ui
|
||||||
|
# resource/qrc/*.qrc
|
||||||
|
# )
|
||||||
|
|
||||||
|
# 显式列出源文件
|
||||||
|
set(PROJECT_SOURCES
|
||||||
|
src/model/datacenter.cpp
|
||||||
|
src/network/netclient.cpp
|
||||||
|
src/addfrienddialog.cpp
|
||||||
|
src/choosefrienddialog.cpp
|
||||||
|
src/groupsessiondetailwidget.cpp
|
||||||
|
src/historymessagewidget.cpp
|
||||||
|
src/loginwidget.cpp
|
||||||
|
src/main.cpp
|
||||||
|
src/mainwidget.cpp
|
||||||
|
src/messageeditarea.cpp
|
||||||
|
src/messageshowarea.cpp
|
||||||
|
src/phoneloginwidget.cpp
|
||||||
|
src/selfinfowidget.cpp
|
||||||
|
src/sessiondetailwidget.cpp
|
||||||
|
src/sessionfriendarea.cpp
|
||||||
|
src/soundrecorder.cpp
|
||||||
|
src/toast.cpp
|
||||||
|
src/userinfowidget.cpp
|
||||||
|
src/verifycodewidget.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
# 显式列出头文件
|
||||||
|
set(PROJECT_HEADERS
|
||||||
|
include/model/data.h
|
||||||
|
include/model/datacenter.h
|
||||||
|
include/network/netclient.h
|
||||||
|
include/addfrienddialog.h
|
||||||
|
include/choosefrienddialog.h
|
||||||
|
include/debug.h
|
||||||
|
include/groupsessiondetailwidget.h
|
||||||
|
include/historymessagewidget.h
|
||||||
|
include/loginwidget.h
|
||||||
|
include/mainwidget.h
|
||||||
|
include/messageeditarea.h
|
||||||
|
include/messageshowarea.h
|
||||||
|
include/phoneloginwidget.h
|
||||||
|
include/selfinfowidget.h
|
||||||
|
include/sessiondetailwidget.h
|
||||||
|
include/sessionfriendarea.h
|
||||||
|
include/soundrecorder.h
|
||||||
|
include/toast.h
|
||||||
|
include/userinfowidget.h
|
||||||
|
include/verifycodewidget.h
|
||||||
|
)
|
||||||
|
|
||||||
|
# 显式列出 UI 文件
|
||||||
|
set(PROJECT_FORMS
|
||||||
|
ui/mainwidget.ui
|
||||||
|
)
|
||||||
|
|
||||||
|
# 显式列出资源文件
|
||||||
|
set(PROJECT_RESOURCES
|
||||||
|
resource.qrc
|
||||||
|
)
|
||||||
|
|
||||||
|
if(ANDROID)
|
||||||
|
# Android 平台:附加 Android 可部署资源
|
||||||
|
qt_add_executable(ClientChat
|
||||||
|
MANUAL_FINALIZATION
|
||||||
|
# ${PROJECT_SOURCES}
|
||||||
|
${PROJECT_SOURCES}
|
||||||
|
${PROJECT_HEADERS}
|
||||||
|
${PROJECT_FORMS}
|
||||||
|
${PROJECT_RESOURCES}
|
||||||
|
)
|
||||||
|
|
||||||
|
# 指定自定义的 Android 部署目录
|
||||||
|
# set_property(TARGET ClientChat APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
|
||||||
|
else()
|
||||||
|
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
|
||||||
|
|
||||||
|
qt_add_executable(ClientChat
|
||||||
|
MANUAL_FINALIZATION
|
||||||
|
# ${PROJECT_SOURCES}
|
||||||
|
${PROJECT_SOURCES}
|
||||||
|
${PROJECT_HEADERS}
|
||||||
|
${PROJECT_FORMS}
|
||||||
|
${PROJECT_RESOURCES}
|
||||||
|
)
|
||||||
|
|
||||||
|
qt_add_protobuf(ClientChat PROTO_FILES ${PB_FILES})
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# 添加包含目录
|
||||||
|
target_include_directories(ClientChat PRIVATE
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/include/model
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/include/network
|
||||||
|
)
|
||||||
|
|
||||||
|
# 链接动态库
|
||||||
|
target_link_libraries(ClientChat PRIVATE
|
||||||
|
Qt6::Core
|
||||||
|
Qt${QT_VERSION_MAJOR}::Widgets
|
||||||
|
Qt6::Network
|
||||||
|
Qt6::WebSockets
|
||||||
|
Qt6::Multimedia
|
||||||
|
)
|
||||||
@ -3,14 +3,12 @@
|
|||||||
|
|
||||||
#define TEST_UI 0
|
#define TEST_UI 0
|
||||||
|
|
||||||
#define TEST_GROUP_SESSION_DETAIL 1
|
#define TEST_GROUP_SESSION_DETAIL 0
|
||||||
|
|
||||||
#define TEST_SKIP_LOGIN 0
|
#define TEST_SKIP_LOGIN 0
|
||||||
|
|
||||||
#define TEST_NETWORK 0
|
#define TEST_NETWORK 0
|
||||||
|
|
||||||
#define TEST_GROUP_SESSION_DETAIL 0
|
|
||||||
|
|
||||||
#define DEPOLY 1
|
#define DEPOLY 1
|
||||||
|
|
||||||
#endif // DEBUG_H
|
#endif // DEBUG_H
|
||||||
@ -4,6 +4,7 @@
|
|||||||
<file>resource/image/apply_inactive.png</file>
|
<file>resource/image/apply_inactive.png</file>
|
||||||
<file>resource/image/checked.png</file>
|
<file>resource/image/checked.png</file>
|
||||||
<file>resource/image/cross.png</file>
|
<file>resource/image/cross.png</file>
|
||||||
|
<file>resource/image/defaultAv.png</file>
|
||||||
<file>resource/image/defaultAvatar.png</file>
|
<file>resource/image/defaultAvatar.png</file>
|
||||||
<file>resource/image/file.png</file>
|
<file>resource/image/file.png</file>
|
||||||
<file>resource/image/friend_active.png</file>
|
<file>resource/image/friend_active.png</file>
|
||||||
@ -21,6 +22,5 @@
|
|||||||
<file>resource/image/sound_active.png</file>
|
<file>resource/image/sound_active.png</file>
|
||||||
<file>resource/image/submit.png</file>
|
<file>resource/image/submit.png</file>
|
||||||
<file>resource/image/unchecked.png</file>
|
<file>resource/image/unchecked.png</file>
|
||||||
<file>resource/image/defaultAv.png</file>
|
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 238 KiB After Width: | Height: | Size: 238 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 140 KiB After Width: | Height: | Size: 140 KiB |
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |