feat: Ported to CMake, rename i18n files, and other minor adjustments

Ported to CMake, rename i18n files, and other minor adjustments
This commit is contained in:
Barry 2021-06-16 16:18:27 +08:00 committed by GitHub
commit 250ec338c9
35 changed files with 731 additions and 108 deletions

21
CMakeLists.txt Executable file
View file

@ -0,0 +1,21 @@
cmake_minimum_required(VERSION 3.19 FATAL_ERROR)
# Read version numbers from file
file (STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/QtScrcpy/version STRING_VERSION)
message(STATUS "QtScrcpy Version ${STRING_VERSION}")
project(QtScrcpy
VERSION ${STRING_VERSION}
LANGUAGES C CXX
)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
enable_language(OBJCXX)
endif()
# Split version numbers
string(REPLACE "." ";" VERSION_LIST ${STRING_VERSION})
list(GET VERSION_LIST 0 VERSION_MAJOR)
list(GET VERSION_LIST 1 VERSION_MINOR)
list(GET VERSION_LIST 2 VERSION_PATCH)
add_subdirectory(QtScrcpy)

255
QtScrcpy/CMakeLists.txt Executable file
View file

@ -0,0 +1,255 @@
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# ***********************************************************
# Qt Package finding
# ***********************************************************
find_package(QT NAMES Qt6 Qt5 COMPONENTS Widgets Network LinguistTools REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets Network LinguistTools REQUIRED)
# ***********************************************************
# Cross-platform settings
# ***********************************************************
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# ffmpeg cannot be compiled natively by MSVC version < 12.0 (2013)
if(MSVC_VERSION LESS 1800)
message(FATAL_ERROR "[QtScrCpy] FATAL ERROR: MSVC version is older than 12.0 (2013).")
endif()
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /utf-8")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /utf-8")
endif()
# ******************** Microsoft Windows ********************
if(WIN32)
message(STATUS "[QtScrCpy] Make for Microsoft Windows.")
# 通过rc的方式的话VERSION变量rc中获取不到,定义为宏方便rc中使用
# Define macros for .rc file
add_compile_definitions(
VERSION_MAJOR=${VERSION_MAJOR}
VERSION_MINOR=${VERSION_MINOR}
VERSION_PATCH=${VERSION_PATCH}
VERSION_RC_STR=\\\"${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}\\\"
)
if(CMAKE_SIZEOF_VOID_P EQUAL 8) # Compiler is 64-bit
message(STATUS "[QtScrCpy] 64-bit compiler detected.")
set(QS_DLL_PATH "${PROJECT_SOURCE_DIR}/third_party/ffmpeg/lib/x64")
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) # Compiler is 32-bit
message(STATUS "[QtScrCpy] 32-bit compiler detected.")
set(QS_DLL_PATH "${PROJECT_SOURCE_DIR}/third_party/ffmpeg/lib/x86")
endif()
link_directories(${QS_DLL_PATH})
# 构建完成后复制DLL依赖库
# Copy DLL dependencies after building
file(GLOB QS_DLL_FILES "${QS_DLL_PATH}/*.dll")
foreach(QS_DLL_FILE ${QS_DLL_FILES})
add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD COMMAND
${CMAKE_COMMAND} -E copy_if_different
"${QS_DLL_FILE}" "${PROJECT_BINARY_DIR}"
)
endforeach()
set(QS_EXTERNAL_LIBS_FFMPEG
avformat
avcodec
avutil
swscale
)
set(RC_FILE "${CMAKE_CURRENT_SOURCE_DIR}/res/QtScrCpy.rc")
# ******************** Unix-like OSs ********************
elseif(UNIX)
set(QS_LIB_PATH "${PROJECT_SOURCE_DIR}/third_party/ffmpeg/lib")
link_directories(${QS_LIB_PATH})
# ==================== macOS ====================
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
message(STATUS "[QtScrCpy] Make for macOS.")
# QS_MAC_RESOURCES: esource file list stored in Contents/MacOS
file(GLOB QS_MAC_RESOURCES "${PROJECT_SOURCE_DIR}/third_party/ffmpeg/lib/*.dylib)")
list(APPEND QS_MAC_RESOURCES
"${PROJECT_SOURCE_DIR}/third_party/scrcpy-server"
"${PROJECT_SOURCE_DIR}/adb/mac/adb"
)
# QS_MAC_CONFIG: Config file stored in Contents/MacOS/config
set(QS_MAC_CONFIG "${PROJECT_SOURCE_DIR}/config/config.ini")
# Icon file stored in Contents/Resources
set(QS_MAC_ICON_NAME "QtScrCpy.icns")
set(QS_MAC_ICON_PATH "${CMAKE_CURRENT_SOURCE_DIR}/res/${QS_MAC_ICON_NAME}")
set_source_files_properties(${QS_MAC_RESOURCES} PROPERTIES
MACOSX_PACKAGE_LOCATION "MacOS"
)
set_source_files_properties(${QS_MAC_CONFIG} PROPERTIES
MACOSX_PACKAGE_LOCATION "MacOS/config"
)
set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES
# The base plist template file
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/res/Info_Mac.plist"
# The elements to be overwritten
MACOSX_BUNDLE_ICON_FILE "${QS_MAC_ICON_NAME}"
MACOSX_BUNDLE_BUNDLE_VERSION "${STRING_VERSION}"
MACOSX_BUNDLE_SHORT_VERSION_STRING "${STRING_VERSION}"
MACOSX_BUNDLE_LONG_VERSION_STRING "${STRING_VERSION}"
# Copy file(s) to Contents/Resources
RESOURCE "${QS_MAC_ICON_PATH}"
)
set(QS_EXTERNAL_LIBS_FFMPEG
avformat.58
avcodec.58
avutil.56
swscale.5
)
# ========== Non-Mac Unix-like OS (Linux, BSD, etc.) ==========
else()
find_package(Threads REQUIRED)
message(STATUS "[QtScrCpy] Make for non-Apple Unix-like OS.")
set(INSTALLED_FFMPEG_FOUND false)
find_package(PkgConfig)
if(PkgConfig_FOUND)
pkg_check_modules(FFmpeg ffmpeg>=4)
if(FFmpeg_FOUND)
set(INSTALLED_FFMPEG_FOUND true)
message(STATUS "[QtScrCpy] Development files of FFmpeg ${FFmpeg_VERSION} were detected in your OS and will be used.")
target_link_options(${CMAKE_PROJECT_NAME} "${FFmpeg_LIBRARIES}")
target_compile_options(${CMAKE_PROJECT_NAME} "${FFmpeg_CFLAGS}")
endif()
endif()
if(NOT INSTALLED_FFMPEG_FOUND)
message(STATUS "[QtScrCpy] Development files of FFmpeg were not detected in your OS. Files within third_party/ffmpeg/ will be used.")
set(QS_EXTERNAL_LIBS_FFMPEG
avformat
avcodec
avutil
swscale
Threads::Threads
)
endif()
endif()
endif()
set(QS_SUBDIRECTORIES_MAIN
adb
common
device
devicemanage
fontawesome
uibase
util
)
set(QS_TS_FILES
${CMAKE_CURRENT_SOURCE_DIR}/res/i18n/zh_CN.ts
${CMAKE_CURRENT_SOURCE_DIR}/res/i18n/en_US.ts
)
set(QS_SOURCES_MAIN
dialog.cpp
dialog.h
dialog.ui
${QS_TS_FILES}
)
set(QS_QRC_MAIN "${CMAKE_CURRENT_SOURCE_DIR}/res/res.qrc")
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
if(WIN32)
qt_add_executable(${CMAKE_PROJECT_NAME} WIN32 MANUAL_FINALIZATION
main.cpp
${QS_SOURCES_MAIN}
${QS_QRC_MAIN}
)
elseif(UNIX)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
qt_add_executable(${CMAKE_PROJECT_NAME} MACOSX_BUNDLE MANUAL_FINALIZATION
main.cpp
${QS_SOURCES_MAIN}
${QS_MAC_RESOURCES}
${QS_MAC_CONFIG}
${QS_QRC_MAIN}
)
else()
qt_add_executable(${CMAKE_PROJECT_NAME} MANUAL_FINALIZATION
main.cpp
${QS_SOURCES_MAIN}
${QS_QRC_MAIN}
)
endif()
endif()
qt_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${QS_TS_FILES})
else()
if(WIN32)
add_executable(${CMAKE_PROJECT_NAME} WIN32
main.cpp
${QS_SOURCES_MAIN}
${QS_QRC_MAIN}
)
elseif(UNIX)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
add_executable(${CMAKE_PROJECT_NAME} MACOSX_BUNDLE
main.cpp
${QS_SOURCES_MAIN}
${QS_MAC_RESOURCES}
${QS_MAC_CONFIG}
${QS_QRC_MAIN}
)
else()
add_executable(${CMAKE_PROJECT_NAME}
main.cpp
${QS_SOURCES_MAIN}
${QS_QRC_MAIN}
)
endif()
endif()
qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${QS_TS_FILES})
endif()
target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
foreach(QS_SUBDIRECTORY_MAIN ${QS_SUBDIRECTORIES_MAIN})
add_subdirectory(${QS_SUBDIRECTORY_MAIN})
endforeach()
target_link_libraries(${CMAKE_PROJECT_NAME} PUBLIC
adb
devicemanage
)
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE
Qt${QT_VERSION_MAJOR}::Widgets
Qt${QT_VERSION_MAJOR}::Network
device
stream
ui
util
)
if(QT_VERSION_MAJOR EQUAL 6)
qt_finalize_executable(${CMAKE_PROJECT_NAME})
endif()

View file

@ -48,10 +48,6 @@ HEADERS += \
FORMS += \
dialog.ui
# 试用检查
# DEFINES += TRIAL_EXPIRE_CHECK
DEFINES += TRIAL_TIMES=10
# 子工程
include ($$PWD/common/common.pri)
include ($$PWD/adb/adb.pri)

11
QtScrcpy/adb/CMakeLists.txt Executable file
View file

@ -0,0 +1,11 @@
set(QS_SOURCES_ADB
adbprocess.h
adbprocess.cpp
)
add_library(adb ${QS_SOURCES_ADB})
target_include_directories(adb PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(adb PRIVATE
Qt${QT_VERSION_MAJOR}::Widgets
util
)

6
QtScrcpy/common/CMakeLists.txt Executable file
View file

@ -0,0 +1,6 @@
set(QS_SOURCES_COMMON
qscrcpyevent.h
)
add_library(common INTERFACE ${QS_SOURCES_COMMON})
target_include_directories(common INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})

40
QtScrcpy/device/CMakeLists.txt Executable file
View file

@ -0,0 +1,40 @@
set(QS_SUBDIRECTORIES_DEVICE
android
controller
decoder
filehandler
recorder
render
server
stream
ui
)
set(QS_SOURCES_DEVICE
device.h
device.cpp
)
add_library(device ${QS_SOURCES_DEVICE})
target_include_directories(device PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
foreach(QS_SUBDIRECTORY_DEVICE ${QS_SUBDIRECTORIES_DEVICE})
add_subdirectory (${QS_SUBDIRECTORY_DEVICE})
endforeach()
target_link_libraries(device INTERFACE inputconvert)
target_link_libraries(device PRIVATE
Qt${QT_VERSION_MAJOR}::Widgets
# device (self)
controller
decoder
filehandler
recorder
server
stream
ui
util
mousetap
)

View file

@ -0,0 +1,7 @@
set(QS_SOURCES_DEVICE_ANDROID
input.h
keycodes.h
)
add_library(android INTERFACE ${QS_SOURCES_DEVICE_ANDROID})
target_include_directories(android INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})

View file

@ -0,0 +1,26 @@
SET(QS_SUBDIRECTORIES_DEVICE_CONTROLLER
inputconvert
receiver
)
SET(QS_SOURCES_DEVICE_CONTROLLER
controller.h
controller.cpp
)
add_library(controller ${QS_SOURCES_DEVICE_CONTROLLER})
target_include_directories(controller PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
foreach(QS_SUBDIRECTORY_DEVICE_CONTROLLER ${QS_SUBDIRECTORIES_DEVICE_CONTROLLER})
add_subdirectory (${QS_SUBDIRECTORY_DEVICE_CONTROLLER})
endforeach()
target_link_libraries(controller PUBLIC
inputconvert
)
target_link_libraries(controller PRIVATE
Qt${QT_VERSION_MAJOR}::Widgets
receiver
server
)

View file

@ -0,0 +1,39 @@
SET(QS_SUBDIRECTORIES_DEVICE_CONTROLLER_INPUTCONVERT
keymap
)
set(QS_SOURCES_DEVICE_CONTROLLER_INPUTCONVERT
controlmsg.h
controlmsg.cpp
inputconvertbase.h
inputconvertbase.cpp
inputconvertgame.h
inputconvertgame.cpp
inputconvertnormal.h
inputconvertnormal.cpp
)
add_library(inputconvert ${QS_SOURCES_DEVICE_CONTROLLER_INPUTCONVERT})
target_include_directories(inputconvert PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
foreach(QS_SUBDIRECTORY_DEVICE_CONTROLLER_INPUTCONVERT ${QS_SUBDIRECTORIES_DEVICE_CONTROLLER_INPUTCONVERT})
add_subdirectory (${QS_SUBDIRECTORY_DEVICE_CONTROLLER_INPUTCONVERT})
endforeach()
target_link_libraries(inputconvert PUBLIC
common
# controller
android
)
target_link_libraries(inputconvert INTERFACE
# controller
# inputconvert (self)
keymap
)
target_link_libraries(inputconvert PRIVATE
Qt${QT_VERSION_MAJOR}::Widgets
controller
util
)

View file

@ -0,0 +1,8 @@
set(QS_SOURCES_DEVICE_CONTROLLER_INPUTCONVERT_KEYMAP
keymap.h
keymap.cpp
)
add_library(keymap ${QS_SOURCES_DEVICE_CONTROLLER_INPUTCONVERT_KEYMAP})
target_include_directories(keymap PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(keymap PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)

View file

@ -0,0 +1,14 @@
SET(QS_SOURCES_DEVICE_CONTROLLER_RECEIVER
devicemsg.h
devicemsg.cpp
receiver.h
receiver.cpp
)
add_library(receiver ${QS_SOURCES_DEVICE_CONTROLLER_RECEIVER})
target_include_directories(receiver PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(receiver PRIVATE
Qt${QT_VERSION_MAJOR}::Widgets
Qt${QT_VERSION_MAJOR}::Network
util
)

View file

@ -0,0 +1,21 @@
set(QS_SOURCES_DEVICE_DECODER
avframeconvert.h
avframeconvert.cpp
decoder.h
decoder.cpp
fpscounter.h
fpscounter.cpp
videobuffer.h
videobuffer.cpp
)
add_library(decoder ${QS_SOURCES_DEVICE_DECODER})
target_include_directories(decoder PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
"${PROJECT_SOURCE_DIR}/third_party/ffmpeg/include"
)
target_link_libraries(decoder PUBLIC ${QS_EXTERNAL_LIBS_FFMPEG})
target_link_libraries(decoder PRIVATE
Qt${QT_VERSION_MAJOR}::Widgets
util
)

View file

@ -0,0 +1,9 @@
set(QS_SOURCES_DEVICE_FILEHANDLER
filehandler.h
filehandler.cpp
)
add_library(filehandler ${QS_SOURCES_DEVICE_FILEHANDLER})
target_include_directories(filehandler PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(filehandler PUBLIC adb)
target_link_libraries(filehandler PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)

View file

@ -0,0 +1,14 @@
set(QS_SOURCES_DEVICE_RECORDER
recorder.h
recorder.cpp
)
add_library(recorder ${QS_SOURCES_DEVICE_RECORDER})
target_include_directories(recorder PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
"${PROJECT_SOURCE_DIR}/third_party/ffmpeg/include"
)
target_link_libraries(recorder PRIVATE
Qt${QT_VERSION_MAJOR}::Widgets
util
)

View file

@ -0,0 +1,8 @@
set(QS_SOURCES_DEVICE_RENDER
qyuvopenglwidget.h
qyuvopenglwidget.cpp
)
add_library(render ${QS_SOURCES_DEVICE_RENDER})
target_include_directories(render PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(render PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)

View file

@ -0,0 +1,20 @@
set(QS_SOURCES_DEVICE_SERVER
server.h
server.cpp
tcpserver.h
tcpserver.cpp
videosocket.h
videosocket.cpp
)
add_library(server ${QS_SOURCES_DEVICE_SERVER})
target_include_directories(server PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(server PUBLIC
Qt${QT_VERSION_MAJOR}::Network
adb
)
target_link_libraries(server PRIVATE
Qt${QT_VERSION_MAJOR}::Widgets
common
util
)

View file

@ -0,0 +1,20 @@
set(QS_SOURCES_DEVICE_STREAM
stream.h
stream.cpp
)
add_library(stream ${QS_SOURCES_DEVICE_STREAM})
target_include_directories(stream PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
"${PROJECT_SOURCE_DIR}/third_party/ffmpeg/include"
)
target_link_libraries(stream PUBLIC ${QS_EXTERNAL_LIBS_FFMPEG})
target_link_libraries(stream PRIVATE
Qt${QT_VERSION_MAJOR}::Widgets
#controller
decoder
recorder
server
util
)

View file

@ -0,0 +1,23 @@
set(QS_SOURCES_DEVICE_UI
toolform.h
toolform.cpp
toolform.ui
videoform.h
videoform.cpp
videoform.ui
)
add_library(ui ${QS_SOURCES_DEVICE_UI})
target_include_directories(ui PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(ui PRIVATE "${PROJECT_SOURCE_DIR}/third_party/ffmpeg/include")
target_link_libraries(ui PUBLIC
device
uibase
)
target_link_libraries(ui PRIVATE
Qt${QT_VERSION_MAJOR}::Widgets
controller
render
fontawesome
util
)

View file

@ -367,16 +367,6 @@ QRect VideoForm::getScreenRect()
return screenRect;
}
bool VideoForm::checkTrialExpire()
{
static int trialTimes = 0;
if (++trialTimes > TRIAL_TIMES) {
QMessageBox::warning(this, "QtScrcpy", QStringLiteral("试用已结束,购买正式版本请联系作者"), QMessageBox::Ok);
return true;
}
return false;
}
void VideoForm::updateStyleSheet(bool vertical)
{
if (vertical) {
@ -534,12 +524,6 @@ void VideoForm::setDevice(Device *device)
void VideoForm::mousePressEvent(QMouseEvent *event)
{
#ifdef TRIAL_EXPIRE_CHECK
if (checkTrialExpire()) {
return;
}
#endif
if (event->button() == Qt::MiddleButton) {
if (m_device && !m_device->isCurrentCustomKeymap()) {
emit m_device->postGoHome();

View file

@ -45,7 +45,6 @@ private:
void moveCenter();
void installShortcut();
QRect getScreenRect();
bool checkTrialExpire();
protected:
void mousePressEvent(QMouseEvent *event);

View file

@ -0,0 +1,13 @@
set(QS_SOURCES_DEVICEMANAGE
devicemanage.h
devicemanage.cpp
)
add_library(devicemanage ${QS_SOURCES_DEVICEMANAGE})
target_include_directories(devicemanage PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(devicemanage PUBLIC device)
target_link_libraries(devicemanage PRIVATE
Qt${QT_VERSION_MAJOR}::Widgets
server
ui
)

View file

@ -0,0 +1,8 @@
set(QS_SOURCES_FONTAWESOME
iconhelper.h
iconhelper.cpp
)
add_library(fontawesome ${QS_SOURCES_FONTAWESOME})
target_include_directories(fontawesome PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(fontawesome PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)

View file

@ -135,11 +135,11 @@ void installTranslator()
QString languagePath = ":/i18n/";
switch (language) {
case QLocale::Chinese:
languagePath += "QtScrcpy_zh.qm";
languagePath += "zh_CN.qm";
break;
case QLocale::English:
default:
languagePath += "QtScrcpy_en.qm";
languagePath += "en_US.qm";
}
translator.load(languagePath);

View file

@ -49,48 +49,48 @@
<context>
<name>Dialog</name>
<message>
<location filename="../../dialog.ui" line="562"/>
<location filename="../../dialog.ui" line="574"/>
<source>Wireless</source>
<translation>Wireless</translation>
</message>
<message>
<location filename="../../dialog.ui" line="646"/>
<location filename="../../dialog.ui" line="658"/>
<source>wireless connect</source>
<translation>wireless connect</translation>
</message>
<message>
<location filename="../../dialog.ui" line="662"/>
<location filename="../../dialog.ui" line="674"/>
<source>wireless disconnect</source>
<translation>wireless disconnect</translation>
</message>
<message>
<location filename="../../dialog.ui" line="89"/>
<location filename="../../dialog.ui" line="101"/>
<source>Start Config</source>
<translation>Start Config</translation>
</message>
<message>
<location filename="../../dialog.ui" line="225"/>
<location filename="../../dialog.ui" line="237"/>
<source>record save path:</source>
<translation>record save path:</translation>
</message>
<message>
<location filename="../../dialog.ui" line="242"/>
<location filename="../../dialog.ui" line="254"/>
<location filename="../../dialog.cpp" line="449"/>
<source>select path</source>
<translation>select path</translation>
</message>
<message>
<location filename="../../dialog.ui" line="156"/>
<location filename="../../dialog.ui" line="168"/>
<source>record format</source>
<translation>record format:</translation>
</message>
<message>
<location filename="../../dialog.ui" line="380"/>
<location filename="../../dialog.ui" line="392"/>
<source>record screen</source>
<translation>record screen</translation>
</message>
<message>
<location filename="../../dialog.ui" line="325"/>
<location filename="../../dialog.ui" line="337"/>
<source>frameless</source>
<translation>frameless</translation>
</message>
@ -124,59 +124,59 @@
<translation>Double click to connect:</translation>
</message>
<message>
<location filename="../../dialog.ui" line="184"/>
<location filename="../../dialog.ui" line="196"/>
<source>lock orientation:</source>
<translation>lock orientation:</translation>
</message>
<message>
<location filename="../../dialog.ui" line="387"/>
<location filename="../../dialog.ui" line="399"/>
<source>show fps</source>
<translation>show fps</translation>
</message>
<message>
<location filename="../../dialog.ui" line="394"/>
<location filename="../../dialog.ui" line="406"/>
<source>stay awake</source>
<translation>stay awake</translation>
</message>
<message>
<location filename="../../dialog.ui" line="421"/>
<location filename="../../dialog.ui" line="433"/>
<source>device name:</source>
<translatorcomment>device name:</translatorcomment>
<translation>device name:</translation>
</message>
<message>
<location filename="../../dialog.ui" line="438"/>
<location filename="../../dialog.ui" line="450"/>
<source>update name</source>
<translatorcomment>update name</translatorcomment>
<translation>update name</translation>
</message>
<message>
<location filename="../../dialog.ui" line="519"/>
<location filename="../../dialog.ui" line="531"/>
<source>stop all server</source>
<translation>stop all server</translation>
</message>
<message>
<location filename="../../dialog.ui" line="696"/>
<location filename="../../dialog.ui" line="708"/>
<source>adb command:</source>
<translation>adb command:</translation>
</message>
<message>
<location filename="../../dialog.ui" line="732"/>
<location filename="../../dialog.ui" line="744"/>
<source>terminate</source>
<translation>terminate</translation>
</message>
<message>
<location filename="../../dialog.ui" line="719"/>
<location filename="../../dialog.ui" line="731"/>
<source>execute</source>
<translation>execute</translation>
</message>
<message>
<location filename="../../dialog.ui" line="745"/>
<location filename="../../dialog.ui" line="757"/>
<source>clear</source>
<translation>clear</translation>
</message>
<message>
<location filename="../../dialog.ui" line="370"/>
<location filename="../../dialog.ui" line="382"/>
<source>reverse connection</source>
<translation>reverse connection</translation>
</message>
@ -185,57 +185,57 @@
<translation type="vanished">auto enable</translation>
</message>
<message>
<location filename="../../dialog.ui" line="354"/>
<location filename="../../dialog.ui" line="366"/>
<source>background record</source>
<translation>background record</translation>
</message>
<message>
<location filename="../../dialog.ui" line="318"/>
<location filename="../../dialog.ui" line="330"/>
<source>screen-off</source>
<translation>screen-off</translation>
</message>
<message>
<location filename="../../dialog.ui" line="287"/>
<location filename="../../dialog.ui" line="299"/>
<source>apply</source>
<translation>apply</translation>
</message>
<message>
<location filename="../../dialog.ui" line="142"/>
<location filename="../../dialog.ui" line="154"/>
<source>max size:</source>
<translation>max size:</translation>
</message>
<message>
<location filename="../../dialog.ui" line="338"/>
<location filename="../../dialog.ui" line="350"/>
<source>always on top</source>
<translation>always on top</translation>
</message>
<message>
<location filename="../../dialog.ui" line="280"/>
<location filename="../../dialog.ui" line="292"/>
<source>refresh script</source>
<translation>refresh script</translation>
</message>
<message>
<location filename="../../dialog.ui" line="536"/>
<location filename="../../dialog.ui" line="548"/>
<source>get device IP</source>
<translation>get device IP</translation>
</message>
<message>
<location filename="../../dialog.ui" line="407"/>
<location filename="../../dialog.ui" line="419"/>
<source>USB line</source>
<translation>USB line</translation>
</message>
<message>
<location filename="../../dialog.ui" line="491"/>
<location filename="../../dialog.ui" line="503"/>
<source>stop server</source>
<translation>stop server</translation>
</message>
<message>
<location filename="../../dialog.ui" line="481"/>
<location filename="../../dialog.ui" line="493"/>
<source>start server</source>
<translation>start server</translation>
</message>
<message>
<location filename="../../dialog.ui" line="471"/>
<location filename="../../dialog.ui" line="483"/>
<source>device serial:</source>
<translation>device serial:</translation>
</message>
@ -244,17 +244,17 @@
<translation type="vanished">Config</translation>
</message>
<message>
<location filename="../../dialog.ui" line="125"/>
<location filename="../../dialog.ui" line="137"/>
<source>bit rate:</source>
<translation>bit rate:</translation>
</message>
<message>
<location filename="../../dialog.ui" line="546"/>
<location filename="../../dialog.ui" line="558"/>
<source>start adbd</source>
<translation>start adbd</translation>
</message>
<message>
<location filename="../../dialog.ui" line="526"/>
<location filename="../../dialog.ui" line="538"/>
<source>refresh devices</source>
<translation>refresh devices</translation>
</message>
@ -362,7 +362,7 @@ You can download it at the following address:</source>
<translation type="vanished">This software is completely open source and free.\nStrictly used for illegal purposes, or at your own risk.\nYou can download it at the following address:</translation>
</message>
<message>
<location filename="../../main.cpp" line="109"/>
<location filename="../../main.cpp" line="113"/>
<source>This software is completely open source and free. Strictly used for illegal purposes, or at your own risk. You can download it at the following address:</source>
<translation>This software is completely open source and free. Strictly used for illegal purposes, or at your own risk. You can download it at the following address:</translation>
</message>
@ -458,7 +458,7 @@ You can download it at the following address:</source>
<translation type="vanished">file transfer failed</translation>
</message>
<message>
<location filename="../../device/ui/videoform.cpp" line="749"/>
<location filename="../../device/ui/videoform.cpp" line="733"/>
<source>file does not exist</source>
<translation>file does not exist</translation>
</message>

View file

@ -49,48 +49,48 @@
<context>
<name>Dialog</name>
<message>
<location filename="../../dialog.ui" line="562"/>
<location filename="../../dialog.ui" line="574"/>
<source>Wireless</source>
<translation>线</translation>
</message>
<message>
<location filename="../../dialog.ui" line="646"/>
<location filename="../../dialog.ui" line="658"/>
<source>wireless connect</source>
<translation>线</translation>
</message>
<message>
<location filename="../../dialog.ui" line="662"/>
<location filename="../../dialog.ui" line="674"/>
<source>wireless disconnect</source>
<translation>线</translation>
</message>
<message>
<location filename="../../dialog.ui" line="89"/>
<location filename="../../dialog.ui" line="101"/>
<source>Start Config</source>
<translation></translation>
</message>
<message>
<location filename="../../dialog.ui" line="225"/>
<location filename="../../dialog.ui" line="237"/>
<source>record save path:</source>
<translation></translation>
</message>
<message>
<location filename="../../dialog.ui" line="242"/>
<location filename="../../dialog.ui" line="254"/>
<location filename="../../dialog.cpp" line="449"/>
<source>select path</source>
<translation></translation>
</message>
<message>
<location filename="../../dialog.ui" line="156"/>
<location filename="../../dialog.ui" line="168"/>
<source>record format</source>
<translation></translation>
</message>
<message>
<location filename="../../dialog.ui" line="380"/>
<location filename="../../dialog.ui" line="392"/>
<source>record screen</source>
<translation></translation>
</message>
<message>
<location filename="../../dialog.ui" line="325"/>
<location filename="../../dialog.ui" line="337"/>
<source>frameless</source>
<translation></translation>
</message>
@ -124,59 +124,59 @@
<translation></translation>
</message>
<message>
<location filename="../../dialog.ui" line="184"/>
<location filename="../../dialog.ui" line="196"/>
<source>lock orientation:</source>
<translation></translation>
</message>
<message>
<location filename="../../dialog.ui" line="387"/>
<location filename="../../dialog.ui" line="399"/>
<source>show fps</source>
<translation>fps</translation>
</message>
<message>
<location filename="../../dialog.ui" line="394"/>
<location filename="../../dialog.ui" line="406"/>
<source>stay awake</source>
<translation></translation>
</message>
<message>
<location filename="../../dialog.ui" line="421"/>
<location filename="../../dialog.ui" line="433"/>
<source>device name:</source>
<translatorcomment>:</translatorcomment>
<translation>:</translation>
</message>
<message>
<location filename="../../dialog.ui" line="438"/>
<location filename="../../dialog.ui" line="450"/>
<source>update name</source>
<translatorcomment></translatorcomment>
<translation></translation>
</message>
<message>
<location filename="../../dialog.ui" line="519"/>
<location filename="../../dialog.ui" line="531"/>
<source>stop all server</source>
<translation></translation>
</message>
<message>
<location filename="../../dialog.ui" line="696"/>
<location filename="../../dialog.ui" line="708"/>
<source>adb command:</source>
<translation>adb命令</translation>
</message>
<message>
<location filename="../../dialog.ui" line="732"/>
<location filename="../../dialog.ui" line="744"/>
<source>terminate</source>
<translation></translation>
</message>
<message>
<location filename="../../dialog.ui" line="719"/>
<location filename="../../dialog.ui" line="731"/>
<source>execute</source>
<translation></translation>
</message>
<message>
<location filename="../../dialog.ui" line="745"/>
<location filename="../../dialog.ui" line="757"/>
<source>clear</source>
<translation></translation>
</message>
<message>
<location filename="../../dialog.ui" line="370"/>
<location filename="../../dialog.ui" line="382"/>
<source>reverse connection</source>
<translation></translation>
</message>
@ -185,57 +185,57 @@
<translation type="vanished"></translation>
</message>
<message>
<location filename="../../dialog.ui" line="354"/>
<location filename="../../dialog.ui" line="366"/>
<source>background record</source>
<translation></translation>
</message>
<message>
<location filename="../../dialog.ui" line="318"/>
<location filename="../../dialog.ui" line="330"/>
<source>screen-off</source>
<translation></translation>
</message>
<message>
<location filename="../../dialog.ui" line="287"/>
<location filename="../../dialog.ui" line="299"/>
<source>apply</source>
<translation></translation>
</message>
<message>
<location filename="../../dialog.ui" line="142"/>
<location filename="../../dialog.ui" line="154"/>
<source>max size:</source>
<translation></translation>
</message>
<message>
<location filename="../../dialog.ui" line="338"/>
<location filename="../../dialog.ui" line="350"/>
<source>always on top</source>
<translation></translation>
</message>
<message>
<location filename="../../dialog.ui" line="280"/>
<location filename="../../dialog.ui" line="292"/>
<source>refresh script</source>
<translation></translation>
</message>
<message>
<location filename="../../dialog.ui" line="536"/>
<location filename="../../dialog.ui" line="548"/>
<source>get device IP</source>
<translation>IP</translation>
</message>
<message>
<location filename="../../dialog.ui" line="407"/>
<location filename="../../dialog.ui" line="419"/>
<source>USB line</source>
<translation>USB线</translation>
</message>
<message>
<location filename="../../dialog.ui" line="491"/>
<location filename="../../dialog.ui" line="503"/>
<source>stop server</source>
<translation></translation>
</message>
<message>
<location filename="../../dialog.ui" line="481"/>
<location filename="../../dialog.ui" line="493"/>
<source>start server</source>
<translation></translation>
</message>
<message>
<location filename="../../dialog.ui" line="471"/>
<location filename="../../dialog.ui" line="483"/>
<source>device serial:</source>
<translation></translation>
</message>
@ -244,17 +244,17 @@
<translation type="vanished"></translation>
</message>
<message>
<location filename="../../dialog.ui" line="125"/>
<location filename="../../dialog.ui" line="137"/>
<source>bit rate:</source>
<translation></translation>
</message>
<message>
<location filename="../../dialog.ui" line="546"/>
<location filename="../../dialog.ui" line="558"/>
<source>start adbd</source>
<translation>adbd</translation>
</message>
<message>
<location filename="../../dialog.ui" line="526"/>
<location filename="../../dialog.ui" line="538"/>
<source>refresh devices</source>
<translation></translation>
</message>
@ -362,7 +362,7 @@ You can download it at the following address:</source>
<translation type="vanished">.\n严禁用于非法用途.\n你可以在下面地址下载:</translation>
</message>
<message>
<location filename="../../main.cpp" line="109"/>
<location filename="../../main.cpp" line="113"/>
<source>This software is completely open source and free. Strictly used for illegal purposes, or at your own risk. You can download it at the following address:</source>
<translation>:</translation>
</message>
@ -458,7 +458,7 @@ You can download it at the following address:</source>
<translation type="vanished"></translation>
</message>
<message>
<location filename="../../device/ui/videoform.cpp" line="749"/>
<location filename="../../device/ui/videoform.cpp" line="733"/>
<source>file does not exist</source>
<translation></translation>
</message>

View file

@ -22,8 +22,8 @@
<file>qss/psblack/radiobutton_checked_disable.png</file>
<file>qss/psblack/radiobutton_unchecked.png</file>
<file>qss/psblack/radiobutton_unchecked_disable.png</file>
<file>i18n/QtScrcpy_en.qm</file>
<file>i18n/QtScrcpy_zh.qm</file>
<file>i18n/en_US.qm</file>
<file>i18n/zh_CN.qm</file>
<file>image/tray/logo.png</file>
</qresource>
</RCC>

10
QtScrcpy/uibase/CMakeLists.txt Executable file
View file

@ -0,0 +1,10 @@
set(QS_SOURCES_UIBASE
keepratiowidget.h
keepratiowidget.cpp
magneticwidget.h
magneticwidget.cpp
)
add_library(uibase ${QS_SOURCES_UIBASE})
target_include_directories(uibase PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(uibase PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)

21
QtScrcpy/util/CMakeLists.txt Executable file
View file

@ -0,0 +1,21 @@
set(QS_SUBDIRECTORIES_UTIL
mousetap
)
set(QS_SOURCES_UTIL
bufferutil.h
bufferutil.cpp
compat.h
config.h
config.cpp
)
add_library(util ${QS_SOURCES_UTIL})
target_include_directories(util PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
foreach(QS_SUBDIRECTORY_UTIL ${QS_SUBDIRECTORIES_UTIL})
add_subdirectory (${QS_SUBDIRECTORY_UTIL})
endforeach()
target_link_libraries(util PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)

View file

@ -0,0 +1,50 @@
set(QS_SOURCES_UTIL_MOUSETAP
mousetap.h
mousetap.cpp
)
# Microsoft Windows
if(WIN32)
list(APPEND QS_SOURCES_UTIL_MOUSETAP
winmousetap.h
winmousetap.cpp
)
set(QS_EXTERNAL_LIBS_UTIL_MOUSETAP User32)
elseif(UNIX)
# macOS
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
find_library(APPKIT AppKit REQUIRED)
set(QS_EXTERNAL_LIBS_UTIL_MOUSETAP ${APPKIT})
list(APPEND QS_SOURCES_UTIL_MOUSETAP
cocoamousetap.h
cocoamousetap.mm
)
target_compile_options(mousetap "-mmacosx-version-min=10.6")
# Linux, BSD, etc.
else()
find_package(QT NAMES Qt6 Qt5 COMPONENTS X11Extras REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS X11Extras REQUIRED)
set(QS_EXTERNAL_LIBS_UTIL_MOUSETAP
Qt${QT_VERSION_MAJOR}::X11Extras
xcb
)
list(APPEND QS_SOURCES_UTIL_MOUSETAP
xmousetap.h
xmousetap.cpp
)
endif()
endif()
add_library(mousetap ${QS_SOURCES_UTIL_MOUSETAP})
target_link_libraries(mousetap PRIVATE
Qt${QT_VERSION_MAJOR}::Widgets
${QS_EXTERNAL_LIBS_UTIL_MOUSETAP})

View file

@ -1 +1 @@
0.0.0
1.6.0

View file

@ -72,7 +72,7 @@ cross-platform|self implemented|provided by Qt
language|C|C++
style|sync|async
keymap|no custom keymap|support custom keymap
build|meson+gradle|Qt Creator
build|meson+gradle|qmake or CMake
- It's very easy to customize your GUI with Qt
- Asynchronous programming of Qt-based signal slot mechanism improves performance
@ -246,9 +246,9 @@ There are several reasons listed as below according to importance (high to low).
All the dependencies are provided and it is easy to compile.
### PC client
1. Set up the Qt development environment on the target platform (Qt == 5.15.2, vs == 2019 (mingw not supported))
1. Set up the Qt development environment on the target platform (Qt == 5.15.2, VS == 2019, MinGW not supported)
2. Clone the project
3. Open the project root directory all.pro with QtCreator
3. Open the project root directory `all.pro` or `CMakeLists.txt` with QtCreator
4. Compile and run
### Android (If you do not have special requirements, you can directly use the built-in scrcpy-server.jar)
@ -310,4 +310,4 @@ Support this project with your organization. Your logo will show up here with a
<a href="https://opencollective.com/QtScrcpy/organization/6/website"><img src="https://opencollective.com/QtScrcpy/organization/6/avatar.svg"></a>
<a href="https://opencollective.com/QtScrcpy/organization/7/website"><img src="https://opencollective.com/QtScrcpy/organization/7/avatar.svg"></a>
<a href="https://opencollective.com/QtScrcpy/organization/8/website"><img src="https://opencollective.com/QtScrcpy/organization/8/avatar.svg"></a>
<a href="https://opencollective.com/QtScrcpy/organization/9/website"><img src="https://opencollective.com/QtScrcpy/organization/9/avatar.svg"></a>
<a href="https://opencollective.com/QtScrcpy/organization/9/website"><img src="https://opencollective.com/QtScrcpy/organization/9/avatar.svg"></a>

View file

@ -69,7 +69,7 @@ QtScrcpy可以通过USB(或通过TCP/IP)连接Android设备并进行显示和
编程语言|C|C++
编程方式|同步|异步
按键映射|不支持自定义|支持自定义按键映射
编译方式|meson+gradle|Qt Creator
编译方式|meson+gradle|qmake or CMake
- 使用Qt可以非常容易的定制自己的界面
- 基于Qt的信号槽机制的异步编程提高性能
@ -243,9 +243,9 @@ Mac OS平台你可以直接使用我编译好的可执行程序:
尽量提供了所有依赖资源,方便傻瓜式编译。
### PC端
1. 目标平台上搭建Qt开发环境(Qt == 5.15.2, vs == 2019 (**不支持mingw**))
1. 目标平台上搭建Qt开发环境(Qt == 5.15.2, VS == 2019 (**不支持MinGW**))
2. 克隆该项目
3. 使用QtCreator打开项目根目录all.pro
3. 使用QtCreator打开项目根目录`all.pro`或`CMakeLists.txt`
4. 编译,运行即可
### Android端 没有修改需求的话直接使用自带的scrcpy-server即可
@ -276,4 +276,4 @@ Mac OS平台你可以直接使用我编译好的可执行程序:
[Barry的CSDN](https://blog.csdn.net/rankun1)
一枚普通的程序员工作中主要使用C++进行桌面客户端开发一毕业在山东做过一年多钢铁仿真教育软件后来转战上海先后从事安防在线教育相关领域工作对音视频比较熟悉对音视频领域如语音通话直播教育视频会议等相关解决方案有所了解。同时具有androidlinux服务器等开发经验。
一枚普通的程序员工作中主要使用C++进行桌面客户端开发一毕业在山东做过一年多钢铁仿真教育软件后来转战上海先后从事安防在线教育相关领域工作对音视频比较熟悉对音视频领域如语音通话直播教育视频会议等相关解决方案有所了解。同时具有androidlinux服务器等开发经验。

View file

@ -3,5 +3,5 @@ SUBDIRS = QtScrcpy
# 多语言翻译文件
TRANSLATIONS = \
$$PWD/QtScrcpy/res/i18n/QtScrcpy_zh.ts \
$$PWD/QtScrcpy/res/i18n/QtScrcpy_en.ts
$$PWD/QtScrcpy/res/i18n/zh_CN.ts \
$$PWD/QtScrcpy/res/i18n/en_US.ts