diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml deleted file mode 100644 index 7f6fbbc..0000000 --- a/.github/workflows/macos.yml +++ /dev/null @@ -1,124 +0,0 @@ -name: MacOS -on: - push: - paths: - - 'QtScrcpy/**' - - '!QtScrcpy/res/**' - - '.github/workflows/**' - pull_request: - paths: - - 'QtScrcpy/**' - - '!QtScrcpy/res/**' -jobs: - build: - name: Build - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [macos-latest] - qt_ver: [5.12.6] - qt_arch: [clang_64] - env: - targetName: QtScrcpy - steps: - - name: Cache Qt - id: MacosCacheQt - uses: actions/cache@v1 - with: - path: ../Qt/${{matrix.qt_ver}}/${{matrix.qt_arch}} - key: ${{ runner.os }}-Qt/${{matrix.qt_ver}}/${{matrix.qt_arch}} - - name: Setup Qt - if: steps.MacosCacheQt.outputs.cache-hit == 'true' - shell: pwsh - env: - QtPath: ../Qt/${{matrix.qt_ver}}/${{matrix.qt_arch}} - run: | - $qt_Path=${env:QtPath} - echo "::set-env name=Qt5_Dir::$qt_Path" - echo "::add-path::$qt_Path/bin" - - name: Install Qt - if: steps.MacosCacheQt.outputs.cache-hit != 'true' - uses: jurplel/install-qt-action@v2.0.0 - with: - version: ${{ matrix.qt_ver }} - - - uses: actions/checkout@v1 - with: - fetch-depth: 1 - - name: Build MacOS - run: | - export ENV_QT_CLANG=$(pwd)/${{env.Qt5_Dir}} - ci/mac/build_for_mac.sh release - - name: Publish - if: startsWith(github.event.ref, 'refs/tags/') - run: | - export ENV_QT_CLANG=$(pwd)/${{env.Qt5_Dir}} - ci/mac/publish_for_mac.sh ../build - # tag 打包 - - name: Package - id: package - if: startsWith(github.event.ref, 'refs/tags/') - shell: pwsh - env: - ref: ${{ github.event.ref }} - run: | - [string]$tag = ${env:ref}.Substring(${env:ref}.LastIndexOf('/') + 1) - [string]$name = 'QtScrcpy-mac-x64-' + ${tag} - # 打包zip - Compress-Archive -Path ci\build\QtScrcpy.app ci\build\${name}.zip - # 记录环境变量packageName给后续step - echo "::set-env name=packageName::$name" - # 打印环境变量packageName - Write-Host 'packageName:'${env:packageName} - # 查询Release - - name: Query Release - if: startsWith(github.event.ref, 'refs/tags/') - shell: pwsh - env: - githubFullName: ${{ github.event.repository.full_name }} - ref: ${{ github.event.ref }} - run: | - [string]$tag = ${env:ref}.Substring(${env:ref}.LastIndexOf('/') + 1) - [string]$url = 'https://api.github.com/repos/' + ${env:githubFullName} + '/releases/tags/' + ${tag} - $response={} - try { - $response = Invoke-RestMethod -Uri $url -Method Get - } catch { - Write-Host "StatusCode:" $_.Exception.Response.StatusCode.value__ - Write-Host "StatusDescription:" $_.Exception.Response.StatusDescription - # 没查到 - return 1 - } - [string]$latestUpUrl = $response.upload_url - Write-Host 'latestUpUrl:'$latestUpUrl - if ($latestUpUrl.Length -eq 0) { - # 没查到 - return 1 - } - # 获取上传url - - name: Get Release Url - if: startsWith(github.event.ref, 'refs/tags/') - shell: pwsh - env: - githubFullName: ${{ github.event.repository.full_name }} - ref: ${{ github.event.ref }} - run: | - [string]$tag = ${env:ref}.Substring(${env:ref}.LastIndexOf('/') + 1) - [string]$url = 'https://api.github.com/repos/' + ${env:githubFullName} + '/releases/tags/' + ${tag} - $response = Invoke-RestMethod -Uri $url -Method Get - [string]$latestUpUrl = $response.upload_url - Write-Host 'latestUpUrl:'$latestUpUrl - echo "::set-env name=uploadUrl::$latestUpUrl" - Write-Host 'env uploadUrl:'${env:uploadUrl} - # tag 上传Release - - name: Upload Release - id: uploadRelease - if: startsWith(github.event.ref, 'refs/tags/') - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - uses: actions/upload-release-asset@v1.0.1 - with: - upload_url: ${{ env.uploadUrl }} - asset_path: ci\build\${{ steps.package.env.packageName }}.zip - asset_name: ${{ steps.package.env.packageName }}.zip - asset_content_type: application/zip \ No newline at end of file diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml deleted file mode 100644 index f5f491a..0000000 --- a/.github/workflows/windows.yml +++ /dev/null @@ -1,149 +0,0 @@ -name: Windows -on: - # push代码时触发workflow - push: - paths: - - 'QtScrcpy/**' - - '!QtScrcpy/res/**' - - '.github/workflows/**' - # pull_request时触发workflow - pull_request: - paths: - - 'QtScrcpy/**' - - '!QtScrcpy/res/**' -jobs: - build: - name: Build - # 运行平台, windows-latest目前是windows server 2019,选择2016是2016安装的是vs2017 - # https://github.com/actions/virtual-environments/blob/master/images/win/Windows2019-Readme.md - # https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners - runs-on: windows-2016 - strategy: - # 矩阵配置 - matrix: - qt_ver: [5.12.6] - qt_target: [desktop] - # mingw用不了 - # qt_arch: [win64_msvc2017_64, win32_msvc2017, win32_mingw53,win32_mingw73] - qt_arch: [win64_msvc2017_64, win32_msvc2017] - # 额外设置msvc_arch - include: - - qt_arch: win64_msvc2017_64 - msvc_arch: x64 - qt_arch_install: msvc2017_64 - - qt_arch: win32_msvc2017 - msvc_arch: x86 - qt_arch_install: msvc2017 - env: - targetName: QtScrcpy.exe - # 步骤 - steps: - - name: Cache Qt - id: WindowsCacheQt - uses: actions/cache@v1 - with: - path: ../../Qt5/${{matrix.qt_ver}}/${{matrix.qt_arch_install}} - key: ${{ runner.os }}-Qt5.12.6/${{matrix.qt_ver}}/${{matrix.qt_arch}} - - name: Setup Qt - if: steps.WindowsCacheQt.outputs.cache-hit == 'true' - shell: pwsh - env: - QtPath: ../../Qt5/${{matrix.qt_ver}}/${{matrix.qt_arch_install}} - run: | - $qt_Path=${env:QtPath} - echo "::set-env name=Qt5_Dir::$qt_Path" - echo "::add-path::$qt_Path/bin" - # 安装Qt - - name: Install Qt - if: steps.WindowsCacheQt.outputs.cache-hit != 'true' - # 使用外部action。这个action专门用来安装Qt - uses: jurplel/install-qt-action@v2.0.0 - with: - # Version of Qt to install - version: ${{ matrix.qt_ver }} - # Target platform for build - target: ${{ matrix.qt_target }} - # Architecture for Windows/Android - arch: ${{ matrix.qt_arch }} - # 拉取代码 - - uses: actions/checkout@v1 - with: - fetch-depth: 1 - # 编译msvc - - name: Build MSVC - shell: cmd - env: - ENV_VCVARSALL: 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat' - ENV_QT_PATH: 'd:\a\Qt5\5.12.6' - run: | - call "ci\win\build_for_win.bat" release ${{ matrix.msvc_arch }} - # tag 打包 - - name: Package - if: startsWith(github.event.ref, 'refs/tags/') - env: - publish_dir: QtScrcpy-win-${{matrix.msvc_arch}} - ref: ${{ github.event.ref }} - shell: pwsh - run: | - [string]$tag = ${env:ref}.Substring(${env:ref}.LastIndexOf('/') + 1) - [string]$full_publish_dir = ${env:publish_dir} + '-' + ${tag} - cmd.exe /c ci\win\publish_for_win.bat ${{matrix.msvc_arch}} ..\build\$full_publish_dir - # 打包zip - Compress-Archive -Path ci\build\$full_publish_dir ci\build\${full_publish_dir}.zip - # 记录环境变量packageName给后续step - $name = $full_publish_dir - echo "::set-env name=packageName::$name" - # 打印环境变量packageName - Write-Host 'packageName:'${env:packageName} - # 查询Release - - name: Query Release - if: startsWith(github.event.ref, 'refs/tags/') - shell: pwsh - env: - githubFullName: ${{ github.event.repository.full_name }} - ref: ${{ github.event.ref }} - run: | - [string]$tag = ${env:ref}.Substring(${env:ref}.LastIndexOf('/') + 1) - [string]$url = 'https://api.github.com/repos/' + ${env:githubFullName} + '/releases/tags/' + ${tag} - $response={} - try { - $response = Invoke-RestMethod -Uri $url -Method Get - } catch { - Write-Host "StatusCode:" $_.Exception.Response.StatusCode.value__ - Write-Host "StatusDescription:" $_.Exception.Response.StatusDescription - # 没查到 - return 1 - } - [string]$latestUpUrl = $response.upload_url - Write-Host 'latestUpUrl:'$latestUpUrl - if ($latestUpUrl.Length -eq 0) { - # 没查到 - return 1 - } - # 获取上传url - - name: Get Release Url - if: startsWith(github.event.ref, 'refs/tags/') - shell: pwsh - env: - githubFullName: ${{ github.event.repository.full_name }} - ref: ${{ github.event.ref }} - run: | - [string]$tag = ${env:ref}.Substring(${env:ref}.LastIndexOf('/') + 1) - [string]$url = 'https://api.github.com/repos/' + ${env:githubFullName} + '/releases/tags/' + ${tag} - $response = Invoke-RestMethod -Uri $url -Method Get - [string]$latestUpUrl = $response.upload_url - Write-Host 'latestUpUrl:'$latestUpUrl - echo "::set-env name=uploadUrl::$latestUpUrl" - Write-Host 'env uploadUrl:'${env:uploadUrl} - # tag 上传Release - - name: Upload Release - id: uploadRelease - if: startsWith(github.event.ref, 'refs/tags/') - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - uses: actions/upload-release-asset@v1.0.1 - with: - upload_url: ${{ env.uploadUrl }} - asset_path: ci\build\${{ env.packageName }}.zip - asset_name: ${{ env.packageName }}.zip - asset_content_type: application/zip \ No newline at end of file diff --git a/.gitignore b/.gitignore index a089ed3..8627497 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,3 @@ /build/ build-* *.DS_Store -userdata.ini diff --git a/QtScrcpy/QtScrcpy.pro b/QtScrcpy/QtScrcpy.pro index f4ed3f7..45d6e52 100644 --- a/QtScrcpy/QtScrcpy.pro +++ b/QtScrcpy/QtScrcpy.pro @@ -153,7 +153,7 @@ macos { QMAKE_BUNDLE_DATA += APP_FFMPEG APP_CONFIG.files = $$files($$PWD/../config/config.ini) - APP_CONFIG.path = Contents/MacOS/config + APP_CONFIG.path = Contents/MacOS QMAKE_BUNDLE_DATA += APP_CONFIG # mac application icon diff --git a/QtScrcpy/dialog.cpp b/QtScrcpy/dialog.cpp index a84f32f..d8ff7b4 100644 --- a/QtScrcpy/dialog.cpp +++ b/QtScrcpy/dialog.cpp @@ -83,7 +83,7 @@ void Dialog::initUI() ui->bitRateBox->addItem("6000000"); ui->bitRateBox->addItem("8000000"); ui->bitRateBox->addItem("10000000"); - ui->bitRateBox->setCurrentIndex(Config::getInstance().getBitRateIndex()); + ui->bitRateBox->setCurrentIndex(2); ui->maxSizeBox->addItem("640"); ui->maxSizeBox->addItem("720"); @@ -91,14 +91,13 @@ void Dialog::initUI() ui->maxSizeBox->addItem("1280"); ui->maxSizeBox->addItem("1920"); ui->maxSizeBox->addItem(tr("original")); - ui->maxSizeBox->setCurrentIndex(Config::getInstance().getMaxSizeIndex()); + ui->maxSizeBox->setCurrentIndex(2); ui->formatBox->addItem("mp4"); ui->formatBox->addItem("mkv"); - ui->formatBox->setCurrentIndex(Config::getInstance().getRecordFormatIndex()); ui->recordPathEdt->setText(Config::getInstance().getRecordPath()); - } +} void Dialog::execAdbCmd() { @@ -359,18 +358,3 @@ void Dialog::on_recordScreenCheck_clicked(bool checked) ui->recordScreenCheck->setChecked(false); } } - -void Dialog::on_bitRateBox_activated(int index) -{ - Config::getInstance().setBitRateIndex(index); -} - -void Dialog::on_maxSizeBox_activated(int index) -{ - Config::getInstance().setMaxSizeIndex(index); -} - -void Dialog::on_formatBox_activated(int index) -{ - Config::getInstance().setRecordFormatIndex(index); -} diff --git a/QtScrcpy/dialog.h b/QtScrcpy/dialog.h index a55361f..d04645e 100644 --- a/QtScrcpy/dialog.h +++ b/QtScrcpy/dialog.h @@ -56,12 +56,6 @@ private slots: void on_recordScreenCheck_clicked(bool checked); - void on_bitRateBox_activated(int index); - - void on_maxSizeBox_activated(int index); - - void on_formatBox_activated(int index); - private: bool checkAdbRun(); void initUI(); diff --git a/QtScrcpy/main.cpp b/QtScrcpy/main.cpp index 405d632..643eaaf 100644 --- a/QtScrcpy/main.cpp +++ b/QtScrcpy/main.cpp @@ -45,13 +45,13 @@ int main(int argc, char *argv[]) qputenv("QTSCRCPY_ADB_PATH", "../../../../third_party/adb/win/adb.exe"); qputenv("QTSCRCPY_SERVER_PATH", "../../../../third_party/scrcpy-server"); qputenv("QTSCRCPY_KEYMAP_PATH", "../../../../keymap"); - qputenv("QTSCRCPY_CONFIG_PATH", "../../../../config"); + qputenv("QTSCRCPY_CONFIG_PATH", "../../../../config/config.ini"); #endif #ifdef Q_OS_LINUX qputenv("QTSCRCPY_ADB_PATH", "../../../third_party/adb/linux/adb"); qputenv("QTSCRCPY_SERVER_PATH", "../../../third_party/scrcpy-server"); - qputenv("QTSCRCPY_CONFIG_PATH", "../../../config"); + qputenv("QTSCRCPY_CONFIG_PATH", "../../../config/config.ini"); #endif //加载样式表 @@ -77,7 +77,6 @@ int main(int argc, char *argv[]) g_mainDlg->setWindowTitle(Config::getInstance().getTitle()); g_mainDlg->show(); - qInfo(QObject::tr("This software is completely open source and free, you can download it at the following address:").toUtf8()); qInfo(QString("QtScrcpy %1 ").arg(QCoreApplication::applicationVersion()).toUtf8()); int ret = a.exec(); diff --git a/QtScrcpy/res/i18n/QtScrcpy_en.qm b/QtScrcpy/res/i18n/QtScrcpy_en.qm index d6717b1..918a702 100644 Binary files a/QtScrcpy/res/i18n/QtScrcpy_en.qm and b/QtScrcpy/res/i18n/QtScrcpy_en.qm differ diff --git a/QtScrcpy/res/i18n/QtScrcpy_en.ts b/QtScrcpy/res/i18n/QtScrcpy_en.ts index f158eee..7bec570 100644 --- a/QtScrcpy/res/i18n/QtScrcpy_en.ts +++ b/QtScrcpy/res/i18n/QtScrcpy_en.ts @@ -75,7 +75,7 @@ - + select path select path @@ -203,14 +203,6 @@ original - - 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, you can download it at the following address: - - ToolForm diff --git a/QtScrcpy/res/i18n/QtScrcpy_zh.qm b/QtScrcpy/res/i18n/QtScrcpy_zh.qm index 3552ab7..fbcaca1 100644 Binary files a/QtScrcpy/res/i18n/QtScrcpy_zh.qm and b/QtScrcpy/res/i18n/QtScrcpy_zh.qm differ diff --git a/QtScrcpy/res/i18n/QtScrcpy_zh.ts b/QtScrcpy/res/i18n/QtScrcpy_zh.ts index 5001248..1a33d36 100644 --- a/QtScrcpy/res/i18n/QtScrcpy_zh.ts +++ b/QtScrcpy/res/i18n/QtScrcpy_zh.ts @@ -75,7 +75,7 @@ - + select path 选择路径 @@ -203,14 +203,6 @@ 原始 - - QObject - - - This software is completely open source and free, you can download it at the following address: - 本软件完全开源免费,你可以在下面的地址下载: - - ToolForm diff --git a/QtScrcpy/util/config.cpp b/QtScrcpy/util/config.cpp index 9050461..e5fb9de 100644 --- a/QtScrcpy/util/config.cpp +++ b/QtScrcpy/util/config.cpp @@ -6,10 +6,12 @@ #define GROUP_COMMON "common" -// config #define COMMON_TITLE_KEY "WindowTitle" #define COMMON_TITLE_DEF QCoreApplication::applicationName() +#define COMMON_RECORD_KEY "RecordPath" +#define COMMON_RECORD_DEF "" + #define COMMON_PUSHFILE_KEY "PushFilePath" #define COMMON_PUSHFILE_DEF "/sdcard/" @@ -31,30 +33,12 @@ #define COMMON_RENDER_EXPIRED_FRAMES_KEY "RenderExpiredFrames" #define COMMON_RENDER_EXPIRED_FRAMES_DEF 0 -// user data -#define COMMON_RECORD_KEY "RecordPath" -#define COMMON_RECORD_DEF "" - -#define COMMON_BITRATE_INDEX_KEY "BitRateIndex" -#define COMMON_BITRATE_INDEX_DEF 2 - -#define COMMON_MAX_SIZE_INDEX_KEY "MaxSizeIndex" -#define COMMON_MAX_SIZE_INDEX_DEF 2 - -#define COMMON_RECORD_FORMAT_INDEX_KEY "RecordFormatIndex" -#define COMMON_RECORD_FORMAT_INDEX_DEF 0 - -// 最大尺寸 录制格式 - QString Config::s_configPath = ""; Config::Config(QObject *parent) : QObject(parent) { - m_settings = new QSettings(getConfigPath() + "/config.ini", QSettings::IniFormat); + m_settings = new QSettings(getConfigPath(), QSettings::IniFormat); m_settings->setIniCodec("UTF-8"); - - m_userData = new QSettings(getConfigPath() + "/userdata.ini", QSettings::IniFormat); - m_userData->setIniCodec("UTF-8"); } Config &Config::getInstance() @@ -68,8 +52,8 @@ const QString& Config::getConfigPath() if (s_configPath.isEmpty()) { s_configPath = QString::fromLocal8Bit(qgetenv("QTSCRCPY_CONFIG_PATH")); QFileInfo fileInfo(s_configPath); - if (s_configPath.isEmpty() || !fileInfo.isDir()) { - s_configPath = QCoreApplication::applicationDirPath() + "/config"; + if (s_configPath.isEmpty() || !fileInfo.isFile()) { + s_configPath = QCoreApplication::applicationDirPath() + "/config/config.ini"; } } return s_configPath; @@ -78,65 +62,17 @@ const QString& Config::getConfigPath() QString Config::getRecordPath() { QString record; - m_userData->beginGroup(GROUP_COMMON); - record = m_userData->value(COMMON_RECORD_KEY, COMMON_RECORD_DEF).toString(); - m_userData->endGroup(); + m_settings->beginGroup(GROUP_COMMON); + record = m_settings->value(COMMON_RECORD_KEY, COMMON_RECORD_DEF).toString(); + m_settings->endGroup(); return record; } void Config::setRecordPath(const QString &path) { - m_userData->beginGroup(GROUP_COMMON); - m_userData->setValue(COMMON_RECORD_KEY, path); - m_userData->endGroup(); -} - -int Config::getBitRateIndex() -{ - int bitRateIndex; - m_userData->beginGroup(GROUP_COMMON); - bitRateIndex = m_userData->value(COMMON_BITRATE_INDEX_KEY, COMMON_BITRATE_INDEX_DEF).toInt(); - m_userData->endGroup(); - return bitRateIndex; -} - -void Config::setBitRateIndex(int bitRateIndex) -{ - m_userData->beginGroup(GROUP_COMMON); - m_userData->setValue(COMMON_BITRATE_INDEX_KEY, bitRateIndex); - m_userData->endGroup(); -} - -int Config::getMaxSizeIndex() -{ - int maxSizeIndex; - m_userData->beginGroup(GROUP_COMMON); - maxSizeIndex = m_userData->value(COMMON_MAX_SIZE_INDEX_KEY, COMMON_MAX_SIZE_INDEX_DEF).toInt(); - m_userData->endGroup(); - return maxSizeIndex; -} - -void Config::setMaxSizeIndex(int maxSizeIndex) -{ - m_userData->beginGroup(GROUP_COMMON); - m_userData->setValue(COMMON_MAX_SIZE_INDEX_KEY, maxSizeIndex); - m_userData->endGroup(); -} - -int Config::getRecordFormatIndex() -{ - int recordFormatIndex; - m_userData->beginGroup(GROUP_COMMON); - recordFormatIndex = m_userData->value(COMMON_RECORD_FORMAT_INDEX_KEY, COMMON_RECORD_FORMAT_INDEX_DEF).toInt(); - m_userData->endGroup(); - return recordFormatIndex; -} - -void Config::setRecordFormatIndex(int recordFormatIndex) -{ - m_userData->beginGroup(GROUP_COMMON); - m_userData->setValue(COMMON_RECORD_FORMAT_INDEX_KEY, recordFormatIndex); - m_userData->endGroup(); + m_settings->beginGroup(GROUP_COMMON); + m_settings->setValue(COMMON_RECORD_KEY, path); + m_settings->endGroup(); } QString Config::getServerVersion() diff --git a/QtScrcpy/util/config.h b/QtScrcpy/util/config.h index 9e91841..9d8514c 100644 --- a/QtScrcpy/util/config.h +++ b/QtScrcpy/util/config.h @@ -10,8 +10,9 @@ class Config : public QObject Q_OBJECT public: static Config& getInstance(); - // config QString getTitle(); + QString getRecordPath(); + void setRecordPath(const QString& path); QString getServerVersion(); int getMaxFps(); int getDesktopOpenGL(); @@ -20,16 +21,6 @@ public: QString getPushFilePath(); QString getServerPath(); - // user data - QString getRecordPath(); - void setRecordPath(const QString& path); - int getBitRateIndex(); - void setBitRateIndex(int bitRateIndex); - int getMaxSizeIndex(); - void setMaxSizeIndex(int maxSizeIndex); - int getRecordFormatIndex(); - void setRecordFormatIndex(int recordFormatIndex); - private: explicit Config(QObject *parent = nullptr); const QString& getConfigPath(); @@ -37,7 +28,6 @@ private: private: static QString s_configPath; QPointer m_settings; - QPointer m_userData; }; #endif // CONFIG_H diff --git a/build_for_win.bat b/build_for_win.bat new file mode 100644 index 0000000..bb60e7a --- /dev/null +++ b/build_for_win.bat @@ -0,0 +1,98 @@ +@echo off +set vcvarsall="D:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvarsall.bat" +set qt_msvc_path="D:\Qt\Qt5.12.5\5.12.5\" + +:: ȡű· +set script_path=%~dp0 +:: űĿ¼,ΪӰűִеijĹĿ¼ +set old_cd=%cd% +cd /d %~dp0 + +:: +set debug_mode="false" +set cpu_mode=x86 + +echo= +echo= +echo --------------------------------------------------------------- +echo [debug/release x86/x64] +echo --------------------------------------------------------------- + +:: /iԴСд +if /i "%1"=="debug" ( + set debug_mode="true" +) +if /i "%1"=="release" ( + set debug_mode="false" +) + +if /i "%2"=="x86" ( + set cpu_mode=x86 +) +if /i "%2"=="x64" ( + set cpu_mode=x64 +) + +:: ʾ +echo ǰģʽΪdebug %debug_mode% %cpu_mode% + +:: +if /i %cpu_mode% == x86 ( + set qt_msvc_path=%qt_msvc_path%msvc2017\bin +) else ( + set qt_msvc_path=%qt_msvc_path%msvc2017_64\bin +) + +set build_path=%script_path%build +set PATH=%qt_msvc_path%;%PATH% + +:: עvc +if /i %cpu_mode% == x86 ( + call %vcvarsall% %cpu_mode% +) else ( + call %vcvarsall% %cpu_mode% +) + +if not %errorlevel%==0 ( + echo "vcvarsall not find" + goto return +) + +echo= +echo= +echo --------------------------------------------------------------- +echo ʼqmake +echo --------------------------------------------------------------- + +if exist %build_path% ( + rmdir /q /s %build_path% +) +md %build_path% +cd %build_path% + +set qmake_params=-spec win32-msvc + +if /i %debug_mode% == "true" ( + set qmake_params=%qmake_params% "CONFIG+=debug" "CONFIG+=qml_debug" +) else ( + set qmake_params=%qmake_params% "CONFIG+=qtquickcompiler" +) + +:: qmake ../all.pro -spec win32-msvc "CONFIG+=debug" "CONFIG+=qml_debug" +qmake ../all.pro %qmake_params% + +nmake + +if not %errorlevel%==0 ( + echo "qmake build failed" + goto return +) + +echo= +echo= +echo --------------------------------------------------------------- +echo ɣ +echo --------------------------------------------------------------- + +:return +cd %old_cd% \ No newline at end of file diff --git a/ci/mac/build_for_mac.sh b/ci/mac/build_for_mac.sh deleted file mode 100755 index 41ab2f6..0000000 --- a/ci/mac/build_for_mac.sh +++ /dev/null @@ -1,91 +0,0 @@ - -echo -echo -echo --------------------------------------------------------------- -echo check ENV -echo --------------------------------------------------------------- - -# 从环境变量获取必要参数 -# 例如 /Users/barry/Qt5.12.5/5.12.5 -echo ENV_QT_CLANG $ENV_QT_CLANG - -# 获取绝对路径,保证其他目录执行此脚本依然正确 -{ -cd $(dirname "$0") -script_path=$(pwd) -cd - -} &> /dev/null # disable output -# 设置当前目录,cd的目录影响接下来执行程序的工作目录 -old_cd=$(pwd) -cd $(dirname "$0") - -# 启动参数声明 -build_mode=debug - -echo -echo -echo --------------------------------------------------------------- -echo check build param[debug/release] -echo --------------------------------------------------------------- - -# 编译参数检查 -build_mode=$(echo $1 | tr '[:upper:]' '[:lower:]') -if [[ $build_mode != "release" && $build_mode != "debug" ]]; then - echo "error: unkonow build mode -- $1" - exit 1 -fi - -# 提示 -echo current build mode: $build_mode - -# 环境变量设置 -export PATH=$PATH:$ENV_QT_CLANG/bin - -echo -echo -echo --------------------------------------------------------------- -echo begin qmake build -echo --------------------------------------------------------------- - -# 删除输出目录 -output_path=$script_path../../output/mac/$build_mode -if [ -d "$output_path" ]; then - rm -rf $output_path -fi -# 删除临时目录 -temp_path=$script_path/../temp -if [ -d "$temp_path" ]; then - rm -rf $temp_path -fi -mkdir $temp_path -cd $temp_path - -qmake_params="-spec macx-clang" -if [ $build_mode == "debug" ]; then - qmake_params="$qmake_params CONFIG+=debug CONFIG+=x86_64 CONFIG+=qml_debug" -else - qmake_params="$qmake_params CONFIG+=x86_64 CONFIG+=qtquickcompiler" -fi - -# qmake ../../all.pro -spec macx-clang CONFIG+=debug CONFIG+=x86_64 CONFIG+=qml_debug -qmake ../../all.pro $qmake_params -if [ $? -ne 0 ] ;then - echo "qmake failed" - exit 1 -fi - -make -j8 -if [ $? -ne 0 ] ;then - echo "make failed" - exit 1 -fi - -echo -echo -echo --------------------------------------------------------------- -echo finish!!! -echo --------------------------------------------------------------- - -# 恢复当前目录 -cd $old_cd -exit 0 \ No newline at end of file diff --git a/ci/mac/publish_for_mac.sh b/ci/mac/publish_for_mac.sh deleted file mode 100755 index 1d76173..0000000 --- a/ci/mac/publish_for_mac.sh +++ /dev/null @@ -1,85 +0,0 @@ -echo -echo -echo --------------------------------------------------------------- -echo check ENV -echo --------------------------------------------------------------- - -# 从环境变量获取必要参数 -# 例如 /Users/barry/Qt5.12.5/5.12.5 -echo ENV_QT_CLANG $ENV_QT_CLANG - -# 获取绝对路径,保证其他目录执行此脚本依然正确 -{ -cd $(dirname "$0") -script_path=$(pwd) -cd - -} &> /dev/null # disable output -# 设置当前目录,cd的目录影响接下来执行程序的工作目录 -old_cd=$(pwd) -cd $(dirname "$0") - -# 启动参数声明 -publish_dir=$1 - -# 提示 -echo current publish dir: $publish_dir - -# 环境变量设置 -keymap_path=$script_path/../../keymap -# config_path=$script_path/../../config - -publish_path=$script_path/$publish_dir -release_path=$script_path/../../output/mac/release - -export PATH=$PATH:$ENV_QT_CLANG/bin - -if [ -d "$publish_path" ]; then - rm -rf $publish_path -fi - -# 复制要发布的包 -cp -r $release_path $publish_path -cp -r $keymap_path $publish_path/QtScrcpy.app/Contents/MacOS -# cp -r $config_path $publish_path/QtScrcpy.app/Contents/MacOS - -# 添加qt依赖包 -macdeployqt $publish_path/QtScrcpy.app - -# 删除多余qt依赖包 - -# PlugIns -rm -rf $publish_path/QtScrcpy.app/Contents/PlugIns/iconengines -# 截图功能需要libqjpeg.dylib -rm -f $publish_path/QtScrcpy.app/Contents/PlugIns/imageformats/libqgif.dylib -rm -f $publish_path/QtScrcpy.app/Contents/PlugIns/imageformats/libqicns.dylib -rm -f $publish_path/QtScrcpy.app/Contents/PlugIns/imageformats/libqico.dylib -# rm -f $publish_path/QtScrcpy.app/Contents/PlugIns/imageformats/libqjpeg.dylib -rm -f $publish_path/QtScrcpy.app/Contents/PlugIns/imageformats/libqmacheif.dylib -rm -f $publish_path/QtScrcpy.app/Contents/PlugIns/imageformats/libqmacjp2.dylib -rm -f $publish_path/QtScrcpy.app/Contents/PlugIns/imageformats/libqtga.dylib -rm -f $publish_path/QtScrcpy.app/Contents/PlugIns/imageformats/libqtiff.dylib -rm -f $publish_path/QtScrcpy.app/Contents/PlugIns/imageformats/libqwbmp.dylib -rm -f $publish_path/QtScrcpy.app/Contents/PlugIns/imageformats/libqwebp.dylib -rm -rf $publish_path/QtScrcpy.app/Contents/PlugIns/virtualkeyboard -rm -rf $publish_path/QtScrcpy.app/Contents/PlugIns/printsupport -rm -rf $publish_path/QtScrcpy.app/Contents/PlugIns/platforminputcontexts -rm -rf $publish_path/QtScrcpy.app/Contents/PlugIns/iconengines -rm -rf $publish_path/QtScrcpy.app/Contents/PlugIns/bearer - -# Frameworks -rm -rf $publish_path/QtScrcpy.app/Contents/Frameworks/QtVirtualKeyboard.framework -rm -rf $publish_path/Contents/Frameworks/QtSvg.framework - -# qml -rm -rf $publish_path/QtScrcpy.app/Contents/Frameworks/QtQml.framework -rm -rf $publish_path/QtScrcpy.app/Contents/Frameworks/QtQuick.framework - -echo -echo -echo --------------------------------------------------------------- -echo finish!!! -echo --------------------------------------------------------------- - -# 恢复当前目录 -cd $old_cd -exit 0 \ No newline at end of file diff --git a/ci/win/build_for_win.bat b/ci/win/build_for_win.bat deleted file mode 100644 index edf2258..0000000 --- a/ci/win/build_for_win.bat +++ /dev/null @@ -1,129 +0,0 @@ -@echo off - -echo= -echo= -echo --------------------------------------------------------------- -echo check ENV -echo --------------------------------------------------------------- - -:: 从环境变量获取必要参数 -:: example: D:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvarsall.bat -set vcvarsall="%ENV_VCVARSALL%" -:: example: D:\Qt\Qt5.12.5\5.12.5 -set qt_msvc_path="%ENV_QT_PATH%" - -echo ENV_VCVARSALL %ENV_VCVARSALL% -echo ENV_QT_PATH %ENV_QT_PATH% - -:: 获取脚本绝对路径 -set script_path=%~dp0 -:: 进入脚本所在目录,因为这会影响脚本中执行的程序的工作目录 -set old_cd=%cd% -cd /d %~dp0 - -:: 启动参数声明 -set cpu_mode=x86 -set build_mode=debug -set errno=1 - -echo= -echo= -echo --------------------------------------------------------------- -echo check build param[debug/release x86/x64] -echo --------------------------------------------------------------- - -:: 编译参数检查 /i忽略大小写 -if /i "%1"=="debug" ( - set build_mode=debug - goto build_mode_ok -) -if /i "%1"=="release" ( - set build_mode=release - goto build_mode_ok -) -echo error: unkonow build mode -- %1 -goto return -:build_mode_ok - -if /i "%2"=="x86" ( - set cpu_mode=x86 -) -if /i "%2"=="x64" ( - set cpu_mode=x64 -) - -:: 提示 -echo current build mode: %build_mode% %cpu_mode% - -:: 环境变量设置 -if /i %cpu_mode% == x86 ( - set qt_msvc_path=%qt_msvc_path%\msvc2017\bin -) else ( - set qt_msvc_path=%qt_msvc_path%\msvc2017_64\bin -) -set PATH=%qt_msvc_path%;%PATH% - -:: 注册vc环境 -if /i %cpu_mode% == x86 ( - call %vcvarsall% %cpu_mode% -) else ( - call %vcvarsall% %cpu_mode% -) - -if not %errorlevel%==0 ( - echo "vcvarsall not find" - goto return -) - -echo= -echo= -echo --------------------------------------------------------------- -echo begin qmake build -echo --------------------------------------------------------------- - -:: 删除输出目录 -set output_path=%script_path%..\..\output\win\%cpu_mode%\%build_mode% -if exist %output_path% ( - rmdir /q /s %output_path% -) -:: 删除临时目录 -set temp_path=%script_path%..\temp -if exist %temp_path% ( - rmdir /q /s %temp_path% -) -md %temp_path% -cd %temp_path% - -set qmake_params=-spec win32-msvc -if /i %build_mode% == debug ( - set qmake_params=%qmake_params% "CONFIG+=debug" "CONFIG+=qml_debug" -) else ( - set qmake_params=%qmake_params% "CONFIG+=qtquickcompiler" -) - -:: qmake ../../all.pro -spec win32-msvc "CONFIG+=debug" "CONFIG+=qml_debug" -qmake ../../all.pro %qmake_params% -if not %errorlevel%==0 ( - echo "qmake failed" - goto return -) - -:: nmake -:: jom是qt的多进程nmake工具 -..\win\jom -j8 -if not %errorlevel%==0 ( - echo "nmake failed" - goto return -) - -echo= -echo= -echo --------------------------------------------------------------- -echo finish!!! -echo --------------------------------------------------------------- - -set errno=0 - -:return -cd %old_cd% -exit /B %errno% \ No newline at end of file diff --git a/ci/win/jom.exe b/ci/win/jom.exe deleted file mode 100755 index 2506b4e..0000000 Binary files a/ci/win/jom.exe and /dev/null differ diff --git a/ci/win/publish_for_win.bat b/ci/win/publish_for_win.bat deleted file mode 100644 index 2cb836c..0000000 --- a/ci/win/publish_for_win.bat +++ /dev/null @@ -1,99 +0,0 @@ -@echo off - -echo= -echo= -echo --------------------------------------------------------------- -echo check ENV -echo --------------------------------------------------------------- - -:: 从环境变量获取必要参数 -:: 例如 d:\a\QtScrcpy\Qt\5.12.7 -set qt_msvc_path="%ENV_QT_PATH%" - -echo ENV_QT_PATH %ENV_QT_PATH% - -:: 获取脚本绝对路径 -set script_path=%~dp0 -:: 进入脚本所在目录,因为这会影响脚本中执行的程序的工作目录 -set old_cd=%cd% -cd /d %~dp0 - -:: 启动参数声明 -set cpu_mode=x86 -set publish_dir=%2 -set errno=1 - -if /i "%1"=="x86" ( - set cpu_mode=x86 -) -if /i "%1"=="x64" ( - set cpu_mode=x64 -) - -:: 提示 -echo current build mode: %cpu_mode% -echo current publish dir: %publish_dir% - -:: 环境变量设置 -set adb_path=%script_path%..\..\third_party\adb\win\*.* -set jar_path=%script_path%..\..\third_party\scrcpy-server -set keymap_path=%script_path%..\..\keymap -set config_path=%script_path%..\..\config - -if /i %cpu_mode% == x86 ( - set publish_path=%script_path%%publish_dir%\ - set release_path=%script_path%..\..\output\win\x86\release - set qt_msvc_path=%qt_msvc_path%\msvc2017\bin -) else ( - set publish_path=%script_path%%publish_dir%\ - set release_path=%script_path%..\..\output\win\x64\release - set qt_msvc_path=%qt_msvc_path%\msvc2017_64\bin -) -set PATH=%qt_msvc_path%;%PATH% - -if exist %publish_path% ( - rmdir /s/q %publish_path% -) - -:: 复制要发布的包 -xcopy %release_path% %publish_path% /E /Y -xcopy %adb_path% %publish_path% /Y -xcopy %jar_path% %publish_path% /Y -xcopy %keymap_path% %publish_path%keymap\ /E /Y -xcopy %config_path% %publish_path%config\ /E /Y - -:: 添加qt依赖包 -windeployqt %publish_path%\QtScrcpy.exe - -:: 删除多余qt依赖包 -rmdir /s/q %publish_path%\iconengines -rmdir /s/q %publish_path%\translations - -:: 截图功能需要qjpeg.dll -del %publish_path%\imageformats\qgif.dll -del %publish_path%\imageformats\qicns.dll -del %publish_path%\imageformats\qico.dll -::del %publish_path%\imageformats\qjpeg.dll -del %publish_path%\imageformats\qsvg.dll -del %publish_path%\imageformats\qtga.dll -del %publish_path%\imageformats\qtiff.dll -del %publish_path%\imageformats\qwbmp.dll -del %publish_path%\imageformats\qwebp.dll - -if /i %cpu_mode% == x86 ( - del %publish_path%\vc_redist.x86.exe -) else ( - del %publish_path%\vc_redist.x64.exe -) - -echo= -echo= -echo --------------------------------------------------------------- -echo finish!!! -echo --------------------------------------------------------------- - -set errno=0 - -:return -cd %old_cd% -exit /B %errno% \ No newline at end of file diff --git a/docs/TODO.md b/docs/TODO.md index 471fc47..e79f9d1 100644 --- a/docs/TODO.md +++ b/docs/TODO.md @@ -7,14 +7,12 @@ - text转换 https://github.com/Genymobile/scrcpy/commit/c916af0984f72a60301d13fa8ef9a85112f54202?tdsourcetag=s_pctim_aiomsg ## 中优先级 -- mac自动打包脚本 +- 自动打包脚本 - 脚本 - 群控 - 竖屏全屏不拉伸画面 - 软解 - opengles 3.0 -- github action -- 打包版本截图无效? ## 高优先级 - linux打包以及版本号 diff --git a/publish_for_win.bat b/publish_for_win.bat new file mode 100644 index 0000000..8a37888 --- /dev/null +++ b/publish_for_win.bat @@ -0,0 +1,68 @@ +@echo off +set qt_msvc_path="D:\Qt\Qt5.12.4\5.12.4\" + +:: ȡű· +set script_path=%~dp0 +:: űĿ¼,ΪӰűִеijĹĿ¼ +set old_cd=%cd% +cd /d %~dp0 + +:: +set cpu_mode=x86 +if /i "%1"=="x86" ( + set cpu_mode=x86 +) +if /i "%1"=="x64" ( + set cpu_mode=x64 +) + +:: + +set adb_path=%script_path%third_party\adb\win\*.* +set jar_path=%script_path%third_party\scrcpy-server +set keymap_path=%script_path%keymap +set config_path=%script_path%config + +if /i %cpu_mode% == x86 ( + set publish_path=%script_path%QtScrcpy-win32\ + set release_path=%script_path%output\win\x86\release + set qt_msvc_path=%qt_msvc_path%msvc2017\bin +) else ( + set publish_path=%script_path%QtScrcpy-win64\ + set release_path=%script_path%output\win\x64\release + set qt_msvc_path=%qt_msvc_path%msvc2017_64\bin +) +set PATH=%qt_msvc_path%;%PATH% + +if exist %publish_path% ( + rmdir /s/q %publish_path% +) + +:: Ҫİ +xcopy %release_path% %publish_path% /E /Y +xcopy %adb_path% %publish_path% /Y +xcopy %jar_path% %publish_path% /Y +xcopy %keymap_path% %publish_path%keymap\ /E /Y +xcopy %config_path% %publish_path%config\ /E /Y + +:: qt +windeployqt %publish_path%\QtScrcpy.exe + +:: ɾqt +rmdir /s/q %publish_path%\iconengines +rmdir /s/q %publish_path%\imageformats +rmdir /s/q %publish_path%\translations +if /i %cpu_mode% == x86 ( + del %publish_path%\vc_redist.x86.exe +) else ( + del %publish_path%\vc_redist.x64.exe +) + +echo= +echo= +echo --------------------------------------------------------------- +echo ɣ +echo --------------------------------------------------------------- + +:return +cd %old_cd% \ No newline at end of file