diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 89285cf..8db603e 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -20,9 +20,10 @@ jobs: qt_ver: [6.2.2, 6.6.0] qt_arch: [clang_64] env: - targetName: PolyChat # 在 Qt pro 文件中的 TARGET - QtApplicationName: App + AppTargetName: PolyChat + # .app 所处编译文件夹的路径 + QtAppDirName: App steps: # macos 11.0 默认环境变了,要指定 - name: prepare env @@ -61,30 +62,30 @@ jobs: - name: Build on macOS run: | ls - cd ./${QtApplicationName} + cd ./${QtAppDirName} qmake make # 打包 - name: Package on MacOS run: | - cd ./${QtApplicationName} - # mv ./${QtApplicationName}/${QtApplicationName}.app . + cd ./${QtAppDirName} + # mv ./${QtAppDirName}/${AppTargetName}.app . echo '------------------' ls # 拷贝依赖 pro文件里的名称: - macdeployqt ${QtApplicationName}.app -qmldir=. -verbose=1 -dmg + macdeployqt ${AppTargetName}.app -qmldir=. -verbose=1 -dmg # 上传artifacts - uses: actions/upload-artifact@v2 with: - name: ${{ env.targetName }}_${{ matrix.os }}_${{matrix.qt_ver}}.zip - path: ${{ env.QtApplicationName }}/${{ env.QtApplicationName }}.app + name: ${{ env.AppTargetName }}_${{ matrix.os }}_${{matrix.qt_ver}}.zip + path: ${{ env.QtAppDirName }}/${{ env.AppTargetName }}.app # tag 上传Release - name: Upload Release if: startsWith(github.event.ref, 'refs/tags/') uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ${{ env.QtApplicationName }}/${{ env.QtApplicationName }}.dmg - asset_name: ${{ env.targetName }}_${{ matrix.os }}_${{ matrix.qt_ver }}.dmg + file: ${{ env.QtAppDirName }}/${{ env.AppTargetName }}.dmg + asset_name: ${{ env.AppTargetName }}_${{ matrix.os }}_${{ matrix.qt_ver }}.dmg tag: ${{ github.ref }} overwrite: true diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 4b2920a..7e76d34 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -36,7 +36,7 @@ jobs: env: targetName: PolyChat # 在 Qt pro 文件中的 - QtApplicationName: App.exe + QtApplicationName: PolyChat.exe # 步骤 steps: # 安装Qt diff --git a/App/App.pro b/App/App.pro index e9af1a6..f712f5c 100644 --- a/App/App.pro +++ b/App/App.pro @@ -44,6 +44,8 @@ qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target +TARGET = PolyChat + RESOURCES += \ resource.qrc diff --git a/App/uil_chatboxwidget.cpp b/App/uil_chatboxwidget.cpp index 42b9640..e73f4f6 100644 --- a/App/uil_chatboxwidget.cpp +++ b/App/uil_chatboxwidget.cpp @@ -23,7 +23,9 @@ ChatBoxWidget::ChatBoxWidget(QWidget* parent, QString name, qint16 port) ui->setupUi(this); this->setAttribute(Qt::WA_DeleteOnClose); this->setWindowIcon(QIcon(":/icon/icons/user-group.png")); - this->setWindowTitle(QString(tr("Chat %1 on port %2")).arg(name).arg(port)); // 注意:这里 .arg() 必须链式调用 不可以 .arg(name, port) 否则无法正常渲染。这是因为 如果想 .arg(name, port) 单次调用的话,必须保证参数类型一样,而这里是一个 QString 一个 qint16 类型,而链式调用就不存在这个问题 + + //this->setWindowTitle(QString(tr("Chat %1 on port %2")).arg(name).arg(port)); // 注意:这里 .arg() 必须链式调用 不可以 .arg(name, port) 否则无法正常渲染。这是因为 如果想 .arg(name, port) 单次调用的话,必须保证参数类型一样,而这里是一个 QString 一个 qint16 类型,而链式调用就不存在这个问题 + this->setWindowTitle(QString(tr("Chat %1 on port %2")).arg(name, QString::number(port))); /* 对所有窗口的同样地址广播 8888 (告诉 ChatList 本窗口存在) */