diff --git a/3rdparty/QtExtKeySequenceEdit.cpp b/3rdparty/QtExtKeySequenceEdit.cpp index 02bb80c..1ef1586 100644 --- a/3rdparty/QtExtKeySequenceEdit.cpp +++ b/3rdparty/QtExtKeySequenceEdit.cpp @@ -14,9 +14,9 @@ void QtExtKeySequenceEdit::keyPressEvent(QKeyEvent *pEvent) { if (keySeq.count() <= 0) { return; } - int key = keySeq[0]; + auto key = keySeq[0].key(); if (key == Qt::Key_Backspace || key == Qt::Key_Delete) { - key = 0; + key = static_cast(0); } setKeySequence(key); } diff --git a/3rdparty/ZxingQtReader.hpp b/3rdparty/ZxingQtReader.hpp index cbd41b7..e062b97 100644 --- a/3rdparty/ZxingQtReader.hpp +++ b/3rdparty/ZxingQtReader.hpp @@ -67,7 +67,7 @@ using ZXing::BarcodeFormat; using ZXing::ContentType; #endif -using ZXing::DecodeHints; +typedef ZXing::ReaderOptions DecodeHints; using ZXing::Binarizer; using ZXing::BarcodeFormats; @@ -451,4 +451,4 @@ inline void registerQmlAndMetaTypes() } // namespace ZXingQt -#endif // QT_QML_LIB \ No newline at end of file +#endif // QT_QML_LIB diff --git a/CMakeLists.txt b/CMakeLists.txt index f0f3bc5..1f90fea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,6 +12,8 @@ if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND WIN32) endif () find_package(Qt6 REQUIRED COMPONENTS Widgets Network LinguistTools) +find_package(absl REQUIRED) + if (NKR_CROSS) set_property(TARGET Qt6::moc PROPERTY IMPORTED_LOCATION /usr/bin/moc) @@ -267,4 +269,8 @@ target_link_libraries(nekoray PRIVATE ${PLATFORM_LIBRARIES} ) +# Link the Abseil libraries +target_link_libraries(nekoray PRIVATE absl::base absl::strings) + + qt_finalize_executable(nekoray) diff --git a/cmake/myproto.cmake b/cmake/myproto.cmake index 43832bc..a106740 100644 --- a/cmake/myproto.cmake +++ b/cmake/myproto.cmake @@ -1,4 +1,4 @@ -find_package(Protobuf CONFIG REQUIRED) +find_package(Protobuf REQUIRED) set(PROTO_FILES core/server/gen/libcore.proto diff --git a/include/ui/utils/MyTableWidget.h b/include/ui/utils/MyTableWidget.h index ff86256..9d03563 100644 --- a/include/ui/utils/MyTableWidget.h +++ b/include/ui/utils/MyTableWidget.h @@ -90,7 +90,7 @@ protected: int row_src, row_dst; row_src = this->currentRow(); // 原行号 可加if auto id_src = row2Id[row_src]; // id_src - QTableWidgetItem *item = this->itemAt(event->pos()); // 获取落点的item + QTableWidgetItem *item = this->itemAt(event->position().toPoint()); // 获取落点的item if (item != nullptr) { // 判断是否为空 row_dst = item->row(); // 不为空 获取其行号 diff --git a/src/api/gRPC.cpp b/src/api/gRPC.cpp index 4970f37..a88cf7e 100644 --- a/src/api/gRPC.cpp +++ b/src/api/gRPC.cpp @@ -352,6 +352,7 @@ namespace NekoGui_rpc { } } } + return ""; } QString Client::SetSystemProxy(bool *rpcOK, bool enable) { diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp index c5c5d02..144bab8 100644 --- a/src/ui/mainwindow.cpp +++ b/src/ui/mainwindow.cpp @@ -2093,4 +2093,4 @@ void MainWindow::DownloadAssets(const QString &geoipUrl, const QString &geositeU }); } MW_show_log(tr("Geo Asset update completed!")); -} \ No newline at end of file +} diff --git a/src/ui/mainwindow_grpc.cpp b/src/ui/mainwindow_grpc.cpp index bd7b602..b45b98a 100644 --- a/src/ui/mainwindow_grpc.cpp +++ b/src/ui/mainwindow_grpc.cpp @@ -258,10 +258,21 @@ void MainWindow::neko_start(int _id) { if (!error.isEmpty()) { if (error.contains("configure tun interface")) { runOnUiThread([=] { - auto r = QMessageBox::information(this, tr("Tun device misbehaving"), - tr("If you have trouble starting VPN, you can force reset nekobox_core process here and then try starting the profile again. The error is %1").arg(error), - tr("Reset"), tr("Cancel"), "", - 1, 1); + + QMessageBox msg( + QMessageBox::Information, + tr("Tun device misbehaving"), + tr("If you have trouble starting VPN, you can force reset nekobox_core process here and then try starting the profile again. The error is %1").arg(error), + QMessageBox::NoButton, + this + ); + msg.addButton(tr("Reset"), QMessageBox::ActionRole); + auto cancel = msg.addButton(tr("Cancel"), QMessageBox::ActionRole); + + msg.setDefaultButton(cancel); + msg.setEscapeButton(cancel); + + int r = msg.exec(); if (r == 0) { GetMainWindow()->StopVPNProcess(); } @@ -552,4 +563,4 @@ void MainWindow::CheckUpdate() { QDesktopServices::openUrl(QUrl(response.release_url().c_str())); } }); -} \ No newline at end of file +} diff --git a/src/ui/setting/dialog_basic_settings.cpp b/src/ui/setting/dialog_basic_settings.cpp index d64cf60..ccf809f 100644 --- a/src/ui/setting/dialog_basic_settings.cpp +++ b/src/ui/setting/dialog_basic_settings.cpp @@ -150,7 +150,7 @@ DialogBasicSettings::DialogBasicSettings(QWidget *parent) ui->ntp_server->setText(NekoGui::dataStore->ntp_server_address); ui->ntp_port->setText(Int2String(NekoGui::dataStore->ntp_server_port)); ui->ntp_interval->setCurrentText(NekoGui::dataStore->ntp_interval); - connect(ui->ntp_enable, &QCheckBox::stateChanged, this, [=](const bool &state) { + connect(ui->ntp_enable, &QCheckBox::checkStateChanged, this, [=](const bool &state) { ui->ntp_server->setEnabled(state); ui->ntp_port->setEnabled(state); ui->ntp_interval->setEnabled(state); @@ -251,8 +251,24 @@ void DialogBasicSettings::accept() { void DialogBasicSettings::on_set_custom_icon_clicked() { auto title = ui->set_custom_icon->text(); QString user_icon_path = "./" + software_name.toLower() + ".png"; - auto c = QMessageBox::question(this, title, tr("Please select a PNG file."), - tr("Select"), tr("Reset"), tr("Cancel"), 2, 2); + + QMessageBox msg( + QMessageBox::Question, + title, + tr("Please select a PNG file."), + QMessageBox::NoButton, + this + ); + + msg.addButton(tr("Select"), QMessageBox::ActionRole); + msg.addButton(tr("Reset"), QMessageBox::ActionRole); + auto cancel = msg.addButton(tr("Cancel"), QMessageBox::ActionRole); + + msg.setDefaultButton(cancel); + msg.setEscapeButton(cancel); + + + auto c = msg.exec(); if (c == 0) { auto fn = QFileDialog::getOpenFileName(this, QObject::tr("Select"), QDir::currentPath(), "*.png", nullptr, QFileDialog::Option::ReadOnly); diff --git a/src/ui/setting/dialog_manage_routes.cpp b/src/ui/setting/dialog_manage_routes.cpp index 7221299..ec0dbb8 100644 --- a/src/ui/setting/dialog_manage_routes.cpp +++ b/src/ui/setting/dialog_manage_routes.cpp @@ -87,12 +87,12 @@ DialogManageRoutes::DialogManageRoutes(QWidget *parent) : QDialog(parent), ui(ne ui->remote_dns_strategy->addItems(qsValue); ui->enable_fakeip->setChecked(NekoGui::dataStore->fake_dns); // - connect(ui->use_dns_object, &QCheckBox::stateChanged, this, [=](int state) { + connect(ui->use_dns_object, &QCheckBox::checkStateChanged, this, [=](int state) { auto useDNSObject = state == Qt::Checked; ui->simple_dns_box->setDisabled(useDNSObject); ui->dns_object->setDisabled(!useDNSObject); }); - ui->use_dns_object->stateChanged(Qt::Unchecked); // uncheck to uncheck + ui->use_dns_object->checkStateChanged(Qt::Unchecked); // uncheck to uncheck connect(ui->dns_document, &QPushButton::clicked, this, [=] { MessageBoxInfo("DNS", dnsHelpDocumentUrl); }); @@ -313,4 +313,4 @@ void DialogManageRoutes::on_delete_route_clicked() { currentRoute = chainList[0]; } reloadProfileItems(); -} \ No newline at end of file +} diff --git a/src/ui/setting/dialog_vpn_settings.cpp b/src/ui/setting/dialog_vpn_settings.cpp index cab3078..0349a4b 100644 --- a/src/ui/setting/dialog_vpn_settings.cpp +++ b/src/ui/setting/dialog_vpn_settings.cpp @@ -44,12 +44,24 @@ void DialogVPNSettings::accept() { } void DialogVPNSettings::on_troubleshooting_clicked() { - auto r = QMessageBox::information(this, tr("Troubleshooting"), - tr("If you have trouble starting VPN, you can force reset nekobox_core process here.\n\n" - "If still not working, see documentation for more information.\n" - "https://matsuridayo.github.io/n-configuration/#vpn-tun"), - tr("Reset"), tr("Cancel"), "", - 1, 1); + + + QMessageBox msg( + QMessageBox::Information, + tr("Troubleshooting"), + tr("If you have trouble starting VPN, you can force reset nekobox_core process here.\n\n" + "If still not working, see documentation for more information.\n" + "https://matsuridayo.github.io/n-configuration/#vpn-tun"), + QMessageBox::NoButton, + this + ); + msg.addButton(tr("Reset"), QMessageBox::ActionRole); + auto cancel = msg.addButton(tr("Cancel"), QMessageBox::ActionRole); + + msg.setDefaultButton(cancel); + msg.setEscapeButton(cancel); + + auto r = msg.exec(); if (r == 0) { GetMainWindow()->StopVPNProcess(); }