diff --git a/QtScrcpy/CMakeLists.txt b/QtScrcpy/CMakeLists.txt index 41ea0d5..dab412e 100755 --- a/QtScrcpy/CMakeLists.txt +++ b/QtScrcpy/CMakeLists.txt @@ -20,7 +20,7 @@ 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).") + message(FATAL_ERROR "[QtScrcpy] FATAL ERROR: MSVC version is older than 12.0 (2013).") endif() SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /utf-8") @@ -30,7 +30,8 @@ endif() # ******************** Microsoft Windows ******************** if(WIN32) - message(STATUS "[QtScrCpy] Make for Microsoft Windows.") + message(STATUS "[QtScrcpy] Make for Microsoft Windows.") + # 通过rc的方式的话,VERSION变量rc中获取不到,定义为宏方便rc中使用 # Define macros for .rc file add_compile_definitions( @@ -41,11 +42,21 @@ if(WIN32) ) if(CMAKE_SIZEOF_VOID_P EQUAL 8) # Compiler is 64-bit - message(STATUS "[QtScrCpy] 64-bit compiler detected.") + message(STATUS "[QtScrcpy] 64-bit compiler detected.") set(QS_DLL_PATH "${PROJECT_SOURCE_DIR}/third_party/ffmpeg/lib/x64") + if(CMAKE_BUILD_TYPE STREQUAL "Debug") + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/output/win/x64/debug") + else() + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/output/win/x64/release") + endif() elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) # Compiler is 32-bit - message(STATUS "[QtScrCpy] 32-bit compiler detected.") + message(STATUS "[QtScrcpy] 32-bit compiler detected.") set(QS_DLL_PATH "${PROJECT_SOURCE_DIR}/third_party/ffmpeg/lib/x86") + if(CMAKE_BUILD_TYPE STREQUAL "Debug") + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/output/win/x86/debug") + else() + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/output/win/x86/release") + endif() endif() link_directories(${QS_DLL_PATH}) @@ -67,7 +78,7 @@ if(WIN32) swscale ) - set(RC_FILE "${CMAKE_CURRENT_SOURCE_DIR}/res/QtScrCpy.rc") + set(RC_FILE "${CMAKE_CURRENT_SOURCE_DIR}/res/QtScrcpy.rc") # ******************** Unix-like OSs ******************** elseif(UNIX) @@ -76,10 +87,16 @@ elseif(UNIX) # ==================== macOS ==================== if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - message(STATUS "[QtScrCpy] Make for macOS.") + message(STATUS "[QtScrcpy] Make for macOS.") + + if(CMAKE_BUILD_TYPE STREQUAL "Debug") + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/output/mac/debug") + else() + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/output/mac/release") + endif() # QS_MAC_RESOURCES: esource file list stored in Contents/MacOS - file(GLOB QS_MAC_RESOURCES "${PROJECT_SOURCE_DIR}/third_party/ffmpeg/lib/*.dylib)") + 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" @@ -89,7 +106,7 @@ elseif(UNIX) 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_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 @@ -121,9 +138,15 @@ elseif(UNIX) # ========== Non-Mac Unix-like OS (Linux, BSD, etc.) ========== else() + if(CMAKE_BUILD_TYPE STREQUAL "Debug") + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/output/linux/debug") + else() + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/output/linux/release") + endif() + find_package(Threads REQUIRED) - message(STATUS "[QtScrCpy] Make for non-Apple Unix-like OS.") + message(STATUS "[QtScrcpy] Make for non-Apple Unix-like OS.") set(INSTALLED_FFMPEG_FOUND false) find_package(PkgConfig) @@ -131,14 +154,14 @@ elseif(UNIX) 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.") + 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.") + 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 @@ -150,20 +173,11 @@ elseif(UNIX) 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_source_files_properties(${QS_TS_FILES} PROPERTIES OUTPUT_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/res/i18n") set(QS_SOURCES_MAIN dialog.cpp @@ -174,7 +188,9 @@ set(QS_SOURCES_MAIN set(QS_QRC_MAIN "${CMAKE_CURRENT_SOURCE_DIR}/res/res.qrc") -if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) +if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) # Qt version 6 + qt_create_translation(QS_QM_FILES ${CMAKE_CURRENT_SOURCE_DIR} ${QS_TS_FILES}) + if(WIN32) qt_add_executable(${CMAKE_PROJECT_NAME} WIN32 MANUAL_FINALIZATION main.cpp @@ -199,9 +215,9 @@ if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) endif() endif() - qt_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${QS_TS_FILES}) +else() # Qt version 5 + qt5_create_translation(QS_QM_FILES ${CMAKE_CURRENT_SOURCE_DIR} ${QS_TS_FILES}) -else() if(WIN32) add_executable(${CMAKE_PROJECT_NAME} WIN32 main.cpp @@ -225,12 +241,20 @@ else() ) 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}) +set(QS_SUBDIRECTORIES_MAIN + adb + common + device + devicemanage + fontawesome + uibase + util +) foreach(QS_SUBDIRECTORY_MAIN ${QS_SUBDIRECTORIES_MAIN}) add_subdirectory(${QS_SUBDIRECTORY_MAIN}) endforeach() diff --git a/QtScrcpy/main.cpp b/QtScrcpy/main.cpp index 4a3f582..21e9dc2 100644 --- a/QtScrcpy/main.cpp +++ b/QtScrcpy/main.cpp @@ -108,13 +108,9 @@ int main(int argc, char *argv[]) g_mainDlg->setWindowTitle(Config::getInstance().getTitle()); g_mainDlg->show(); - qInfo( - "%s", - QObject::tr("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:") - .toUtf8() - .data()); - qInfo() << QString("QtScrcpy %1 ").arg(QCoreApplication::applicationVersion()).toUtf8(); + qInfo() << QObject::tr("This software is completely open source and free. Use it at your own risk. You can download it at the " + "following address:"); + qInfo() << QString("QtScrcpy %1 ").arg(QCoreApplication::applicationVersion()); int ret = a.exec(); diff --git a/QtScrcpy/res/i18n/en_US.qm b/QtScrcpy/res/i18n/en_US.qm index 32fa730..b0be366 100644 Binary files a/QtScrcpy/res/i18n/en_US.qm and b/QtScrcpy/res/i18n/en_US.qm differ diff --git a/QtScrcpy/res/i18n/en_US.ts b/QtScrcpy/res/i18n/en_US.ts index a1f7210..c84b132 100644 --- a/QtScrcpy/res/i18n/en_US.ts +++ b/QtScrcpy/res/i18n/en_US.ts @@ -16,22 +16,18 @@ file transfer failed - install apk install apk - file transfer file transfer - wait current %1 to complete wait current %1 to complete - %1 complete, save in %2 %1 complete, save in %2 @@ -41,7 +37,6 @@ %1 complete\n save in %2 - %1 failed %1 failed @@ -49,134 +44,108 @@ Dialog - Wireless Wireless - wireless connect wireless connect - wireless disconnect wireless disconnect - Start Config Start Config - record save path: record save path: - - select path select path - record format: record format: - record screen record screen - frameless frameless - Use Simple Mode Use Simple Mode Use Simple Mode - Simple Mode Simple Mode Simple Mode - WIFI Connect WIFI Connect WIFI Connect - USB Connect USB Connect USB Connect - Double click to connect: Double click to connect: - lock orientation: lock orientation: - show fps show fps - stay awake stay awake - device name: device name: device name: - update name update name update name - stop all server stop all server - adb command: adb command: - terminate terminate - execute execute - clear clear - reverse connection reverse connection @@ -185,57 +154,46 @@ auto enable - background record background record - screen-off screen-off - apply apply - max size: max size: - always on top always on top - refresh script refresh script - get device IP get device IP - USB line USB line - stop server stop server - start server start server - device serial: device serial: @@ -244,80 +202,66 @@ Config - bit rate: bit rate: - start adbd start adbd - refresh devices refresh devices - show show show - quit quit quit - original original - no lock no lock - warning Warning Warning - Quit or set tray? Quit or set tray? Quit or set tray? - Quit Quit Quit - Set tray Set tray Set tray - Cancel Cancel Cancel - Notice Notice Notice - Hidden here! Hidden here! Hidden here! @@ -326,17 +270,14 @@ InputConvertGame - current keymap mode: %1 - custom - normal @@ -344,7 +285,6 @@ KeyMap - Script updated, current keymap mode:normal, Press ~ key to switch keymap mode @@ -362,25 +302,25 @@ You can download it at the following address: 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: - 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: - 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: + 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: + + + This software is completely open source and free. Use it at your own risk. You can download it at the following address: + ToolForm - Tool Tool - full screen full screen - expand notify expand notify @@ -393,52 +333,42 @@ You can download it at the following address: turn on - touch switch touch switch - close screen close screen - power power - volume up volume up - volume down volume down - app switch app switch - menu menu - home home - return return - screen shot screen shot @@ -458,7 +388,6 @@ You can download it at the following address: file transfer failed - file does not exist file does not exist diff --git a/QtScrcpy/res/i18n/zh_CN.qm b/QtScrcpy/res/i18n/zh_CN.qm index e8b1e21..a4c5948 100644 Binary files a/QtScrcpy/res/i18n/zh_CN.qm and b/QtScrcpy/res/i18n/zh_CN.qm differ diff --git a/QtScrcpy/res/i18n/zh_CN.ts b/QtScrcpy/res/i18n/zh_CN.ts index 03d4256..0c67d3a 100644 --- a/QtScrcpy/res/i18n/zh_CN.ts +++ b/QtScrcpy/res/i18n/zh_CN.ts @@ -16,22 +16,18 @@ 文件传输失败 - install apk 安装apk - file transfer 文件传输 - wait current %1 to complete 等待当前%1完成 - %1 complete, save in %2 %1完成,保存在%2 @@ -41,7 +37,6 @@ %1完成\n 保存在 %2 - %1 failed %1 失败 @@ -49,134 +44,108 @@ Dialog - Wireless 无线 - wireless connect 无线连接 - wireless disconnect 无线断开 - Start Config 启动配置 - record save path: 录像保存路径: - - select path 选择路径 - record format: 录制格式: - record screen 录制屏幕 - frameless 无边框 - Use Simple Mode 启用精简模式 启用精简模式 - Simple Mode 精简模式 精简模式 - WIFI Connect 一键WIFI连接 一键WIFI连接 - USB Connect 一键USB连接 一键USB连接 - Double click to connect: 双击连接: - lock orientation: 锁定方向: - show fps 显示fps - stay awake 保持唤醒 - device name: 设备名称: 设备名称: - update name 更新设置名称 更新设置名称 - stop all server 停止所有服务 - adb command: adb命令: - terminate 终止 - execute 执行 - clear 清理 - reverse connection 反向连接 @@ -185,57 +154,46 @@ 自动启用脚本 - background record 后台录制 - screen-off 自动息屏 - apply 应用脚本 - max size: 最大尺寸: - always on top 窗口置顶 - refresh script 刷新脚本 - get device IP 获取设备IP - USB line USB线 - stop server 停止服务 - start server 启动服务 - device serial: 设备序列号: @@ -244,80 +202,66 @@ 配置 - bit rate: 比特率: - start adbd 启动adbd - refresh devices 刷新设备列表 - show 显示 显示 - quit 退出 退出 - original 原始 - no lock 不锁定 - warning 警告 警告 - Quit or set tray? 退出还是最小化到托盘? 退出还是最小化到托盘? - Quit 退出 退出 - Set tray 最小化到系统托盘 最小化到系统托盘 - Cancel 取消 取消 - Notice 提示 提示 - Hidden here! 安卓录屏程序隐藏在这! 安卓录屏程序隐藏在这! @@ -326,17 +270,14 @@ InputConvertGame - current keymap mode: %1 - custom - normal @@ -344,7 +285,6 @@ KeyMap - Script updated, current keymap mode:normal, Press ~ key to switch keymap mode @@ -352,35 +292,21 @@ QObject - This software is completely open source and free, you can download it at the following address: - 本软件完全开源免费,你可以在下面的地址下载: - - - 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: - 本软件完全开源免费.\n严禁用于非法用途,否则后果自负.\n你可以在下面地址下载: - - - - 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: - 本软件完全开源免费,严禁用于非法用途,否则后果自负,你可以在下面地址下载: + This software is completely open source and free. Use it at your own risk. You can download it at the following address: + 本软件完全开源免费,作者不对使用该软件产生的一切后果负责。你可以在以下地址下载: ToolForm - Tool 工具 - full screen 全屏 - expand notify 下拉通知 @@ -393,52 +319,42 @@ You can download it at the following address: 解锁 - touch switch 触摸显示开关 - close screen 关闭屏幕 - power 电源 - volume up 音量加 - volume down 音量减 - app switch 切换应用 - menu 菜单 - home 主界面 - return 返回 - screen shot 截图 @@ -458,7 +374,6 @@ You can download it at the following address: 文件传输失败 - file does not exist 文件不存在