From 0c722dbea62a8d3ddd0d89bc8f8ef1a8beab2005 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 16 Jun 2024 01:10:26 +0330 Subject: [PATCH] revert ubuntu Qt version --- .github/workflows/build-qv2ray-cmake.yml | 26 ++++++++++++++++-------- CMakeLists.txt | 12 +++++------ ui/dialog_manage_routes.cpp | 10 +++++---- ui/dialog_manage_routes.h | 2 ++ ui/widget/RouteItem.cpp | 8 ++++++-- 5 files changed, 37 insertions(+), 21 deletions(-) diff --git a/.github/workflows/build-qv2ray-cmake.yml b/.github/workflows/build-qv2ray-cmake.yml index 2e6de66..be22c1b 100644 --- a/.github/workflows/build-qv2ray-cmake.yml +++ b/.github/workflows/build-qv2ray-cmake.yml @@ -63,9 +63,9 @@ jobs: - platform: windows-2022 arch: x64 qt_version: "6.5" - - platform: ubuntu-22.04 + - platform: ubuntu-20.04 arch: x64 - qt_version: "6.5" + qt_version: "5.12" - platform: macos-13 arch: amd64 qt_version: "6.5" @@ -130,6 +130,15 @@ jobs: shell: bash if: steps.cache-deps.outputs.cache-hit != 'true' run: ./libs/build_deps_all.sh + - name: Build Dependencies (Docker) + shell: bash + if: steps.cache-deps.outputs.cache-hit != 'true' && matrix.platform == 'ubuntu-20.04' + run: | + docker run --rm \ + -v $PWD:/nekoray \ + -w /nekoray \ + ghcr.io/matsuridayo/debian10-qt5:20230131 \ + bash -c "./libs/build_deps_all.sh" # ========================================================================================================= Generate MakeFile and Build - name: Windows - Generate MakeFile and Build shell: bash @@ -148,14 +157,13 @@ jobs: ./libs/deploy_windows64.sh - name: Linux - Generate MakeFile and Build shell: bash - if: matrix.platform == 'ubuntu-22.04' + if: matrix.platform == 'ubuntu-20.04' run: | - mkdir build - pushd build - cmake -GNinja -DQT_VERSION_MAJOR=6 -DCMAKE_BUILD_TYPE=Release .. - ninja - popd - ./libs/deploy_linux64.sh + docker run --rm \ + -v $PWD:/nekoray \ + -w /nekoray \ + ghcr.io/matsuridayo/debian10-qt5:20230131 \ + bash -c "mkdir build && pushd build && cmake -GNinja -DCMAKE_BUILD_TYPE=Release .. && ninja && popd &&./libs/deploy_linux64.sh" - name: macOS - Generate MakeFile and Build shell: bash if: matrix.platform == 'macos-13' || matrix.platform == 'macos-14' diff --git a/CMakeLists.txt b/CMakeLists.txt index 83e2b68..6c1bd05 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,16 +17,16 @@ endif () # Find Qt if (NOT QT_VERSION_MAJOR) - set(QT_VERSION_MAJOR 6) + set(QT_VERSION_MAJOR 5) endif () find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets Network Svg LinguistTools) if (NKR_CROSS) - set_property(TARGET Qt6::moc PROPERTY IMPORTED_LOCATION /usr/bin/moc) - set_property(TARGET Qt6::uic PROPERTY IMPORTED_LOCATION /usr/bin/uic) - set_property(TARGET Qt6::rcc PROPERTY IMPORTED_LOCATION /usr/bin/rcc) - set_property(TARGET Qt6::lrelease PROPERTY IMPORTED_LOCATION /usr/bin/lrelease) - set_property(TARGET Qt6::lupdate PROPERTY IMPORTED_LOCATION /usr/bin/lupdate) + set_property(TARGET Qt5::moc PROPERTY IMPORTED_LOCATION /usr/bin/moc) + set_property(TARGET Qt5::uic PROPERTY IMPORTED_LOCATION /usr/bin/uic) + set_property(TARGET Qt5::rcc PROPERTY IMPORTED_LOCATION /usr/bin/rcc) + set_property(TARGET Qt5::lrelease PROPERTY IMPORTED_LOCATION /usr/bin/lrelease) + set_property(TARGET Qt5::lupdate PROPERTY IMPORTED_LOCATION /usr/bin/lupdate) endif () #### Platform Variables #### diff --git a/ui/dialog_manage_routes.cpp b/ui/dialog_manage_routes.cpp index bee4387..8741905 100644 --- a/ui/dialog_manage_routes.cpp +++ b/ui/dialog_manage_routes.cpp @@ -95,14 +95,12 @@ DialogManageRoutes::DialogManageRoutes(QWidget *parent) : QDialog(parent), ui(ne ui->dns_final_out->setCurrentText(NekoGui::dataStore->routing->dns_final_out); reloadProfileItems(); - connect(ui->route_prof, &QComboBox::currentIndexChanged, this, [=](const int& idx) { - currentRouteProfileID = chainList[idx]->id; - }); - connect(ui->route_profiles, &QListWidget::itemDoubleClicked, this, [=](const QListWidgetItem* item){ on_edit_route_clicked(); }); + connect(ui->route_prof, SIGNAL(currentIndexChanged(int)), this, SLOT(updateCurrentRouteProfile(int))); + deleteShortcut = new QShortcut(QKeySequence(Qt::Key_Delete), this); connect(deleteShortcut, &QShortcut::activated, this, [=]{ @@ -112,6 +110,10 @@ DialogManageRoutes::DialogManageRoutes(QWidget *parent) : QDialog(parent), ui(ne ADD_ASTERISK(this) } +void DialogManageRoutes::updateCurrentRouteProfile(int idx) { + currentRouteProfileID = chainList[idx]->id; +} + DialogManageRoutes::~DialogManageRoutes() { delete ui; } diff --git a/ui/dialog_manage_routes.h b/ui/dialog_manage_routes.h index adb0562..29a8c2d 100644 --- a/ui/dialog_manage_routes.h +++ b/ui/dialog_manage_routes.h @@ -36,6 +36,8 @@ private: public slots: void accept() override; + void updateCurrentRouteProfile(int idx); + void on_new_route_clicked(); void on_edit_route_clicked(); diff --git a/ui/widget/RouteItem.cpp b/ui/widget/RouteItem.cpp index 4565d23..e176c66 100644 --- a/ui/widget/RouteItem.cpp +++ b/ui/widget/RouteItem.cpp @@ -316,14 +316,18 @@ void RouteItem::on_new_route_item_clicked() { void RouteItem::on_moveup_route_item_clicked() { if (currentIndex == -1 || currentIndex == 0) return; - chain->Rules.swapItemsAt(currentIndex, currentIndex-1); + auto curr = chain->Rules[currentIndex]; + chain->Rules[currentIndex] = chain->Rules[currentIndex-1]; + chain->Rules[currentIndex-1] = curr; currentIndex--; updateRouteItemsView(); } void RouteItem::on_movedown_route_item_clicked() { if (currentIndex == -1 || currentIndex == chain->Rules.size() - 1) return; - chain->Rules.swapItemsAt(currentIndex, currentIndex+1); + auto curr = chain->Rules[currentIndex]; + chain->Rules[currentIndex] = chain->Rules[currentIndex+1]; + chain->Rules[currentIndex+1] = curr; currentIndex++; updateRouteItemsView(); }