Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: QT6 adaptation #75

Merged
merged 1 commit into from
Jan 10, 2025
Merged

feat: QT6 adaptation #75

merged 1 commit into from
Jan 10, 2025

Conversation

pengfeixx
Copy link

QT6 adaptation

Log: QT6 adaptation

@pengfeixx pengfeixx closed this Jan 9, 2025
@pengfeixx pengfeixx reopened this Jan 9, 2025
@pengfeixx pengfeixx force-pushed the qt6 branch 3 times, most recently from 6166d15 to 9d90eb8 Compare January 9, 2025 12:58
@pengfeixx pengfeixx closed this Jan 10, 2025
@pengfeixx pengfeixx reopened this Jan 10, 2025
@deepin-ci-robot
Copy link

deepin pr auto review

代码审查意见:

  1. CMakeLists.txt文件中,find_package函数的调用应该检查返回值,以确保包正确找到并加载。例如:

    find_package(Qt${QT_VERSION_MAJOR} COMPONENTS ${QT} REQUIRED)
    if(NOT Qt${QT_VERSION_MAJOR}_FOUND)
        message(FATAL_ERROR "Qt${QT_VERSION_MAJOR} not found")
    endif()
  2. src/src/aria2/aria2rpcinterface.cpp文件中,QProcess的启动参数应该使用QStringList而不是字符串拼接,以提高代码的可读性和安全性。例如:

    QStringList opt;
    opt << "--enable-rpc=true" << "--rpc-secret=" + getToken() << "--rpc-listen-port=" + this->m_rpcPort;
    // 继续添加其他参数
    QProcess proc;
    proc.setProgram(m_basePath + m_aria2cCmd);
    proc.setArguments(opt);
    proc.startDetached();
  3. src/src/ui/createTask/createtaskwidget.cpp文件中,QElapsedTimerQTime的使用应该统一,避免在同一个项目中混用。建议选择一种并保持一致。

  4. src/src/ui/createTask/createtaskwidget.cpp文件中,QRegularExpression的使用应该检查Qt版本,以确保兼容性。例如:

    #if QT_VERSION_MAJOR > 5
    QRegularExpression regx("[^\\\\/\':\\*\\?\"<>|#%?]+");
    #else
    QRegExp regx("[^\\\\/\':\\*\\?\"<>|#%?]+");
    #endif
  5. src/src/ui/settings/diagnostictool.cpp文件中,使用std::random_devicestd::mt19937生成随机数是更好的选择,因为它比qrand()更随机。但是,请注意,std::random_device可能需要较长时间来初始化,因此可能需要考虑性能影响。

  6. src/src/ui/settings/diagnostictool.cpp文件中,QTimer::singleShot的参数应该使用std::uniform_int_distribution生成的随机数,而不是硬编码的值。

  7. src/src/ui/settings/settings.cppsrc/src/ui/settings/settingswidget.cpp文件中,DApplicationHelper的使用应该检查Qt版本,以确保兼容性。例如:

    #if QT_VERSION_MAJOR <= 5
    DApplicationHelper::instance()->setThemeType(DGuiApplicationHelper::DarkType);
    #else
    DGuiApplicationHelper::instance()->setThemeType(DGuiApplicationHelper::DarkType);
    #endif
  8. src/src/ui/settings/timeEdit.cpp文件中,QRegExpValidatorQRegularExpressionValidator的使用应该检查Qt版本,以确保兼容性。例如:

    #if QT_VERSION_MAJOR > 5
    QRegularExpressionValidator *validator = new QRegularExpressionValidator(rx, this);
    #else
    QRegExpValidator *validator = new QRegExpValidator(rx, this);
    #endif
  9. tests/ui/mainFrame/ut_mainframe.cpptests/ui/settings/ut_settings.cpp文件中,QModelIndex的使用应该检查是否为有效索引,以避免潜在的运行时错误。

  10. translate_generation.sh脚本中,lrelease命令应该检查返回值,以确保翻译文件正确生成。例如:

    /usr/lib/qt6/bin/lrelease "${ts}"
    if [ $? -ne 0 ]; then
        echo "lrelease failed for ${ts}"
        exit 1
    fi

以上是针对代码审查意见的详细说明,希望能够对你有所帮助。

QT6 adaptation

Log: QT6 adaptation
Copy link
Contributor

@myk1343 myk1343 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: myk1343, pengfeixx, rb-union

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@pengfeixx pengfeixx merged commit 4eb9347 into linuxdeepin:develop/qt6.8 Jan 10, 2025
17 checks passed
@pengfeixx pengfeixx deleted the qt6 branch January 10, 2025 02:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants