This commit is contained in:
u 2025-03-23 14:31:51 +03:00 committed by Mahdi
parent 87304b74f9
commit 1e017b337a
11 changed files with 70 additions and 24 deletions

View File

@ -14,9 +14,9 @@ void QtExtKeySequenceEdit::keyPressEvent(QKeyEvent *pEvent) {
if (keySeq.count() <= 0) { if (keySeq.count() <= 0) {
return; return;
} }
int key = keySeq[0]; auto key = keySeq[0].key();
if (key == Qt::Key_Backspace || key == Qt::Key_Delete) { if (key == Qt::Key_Backspace || key == Qt::Key_Delete) {
key = 0; key = static_cast<Qt::Key>(0);
} }
setKeySequence(key); setKeySequence(key);
} }

View File

@ -67,7 +67,7 @@ using ZXing::BarcodeFormat;
using ZXing::ContentType; using ZXing::ContentType;
#endif #endif
using ZXing::DecodeHints; typedef ZXing::ReaderOptions DecodeHints;
using ZXing::Binarizer; using ZXing::Binarizer;
using ZXing::BarcodeFormats; using ZXing::BarcodeFormats;

View File

@ -12,6 +12,8 @@ if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND WIN32)
endif () endif ()
find_package(Qt6 REQUIRED COMPONENTS Widgets Network LinguistTools) find_package(Qt6 REQUIRED COMPONENTS Widgets Network LinguistTools)
find_package(absl REQUIRED)
if (NKR_CROSS) if (NKR_CROSS)
set_property(TARGET Qt6::moc PROPERTY IMPORTED_LOCATION /usr/bin/moc) set_property(TARGET Qt6::moc PROPERTY IMPORTED_LOCATION /usr/bin/moc)
@ -267,4 +269,8 @@ target_link_libraries(nekoray PRIVATE
${PLATFORM_LIBRARIES} ${PLATFORM_LIBRARIES}
) )
# Link the Abseil libraries
target_link_libraries(nekoray PRIVATE absl::base absl::strings)
qt_finalize_executable(nekoray) qt_finalize_executable(nekoray)

View File

@ -1,4 +1,4 @@
find_package(Protobuf CONFIG REQUIRED) find_package(Protobuf REQUIRED)
set(PROTO_FILES set(PROTO_FILES
core/server/gen/libcore.proto core/server/gen/libcore.proto

View File

@ -90,7 +90,7 @@ protected:
int row_src, row_dst; int row_src, row_dst;
row_src = this->currentRow(); // 原行号 可加if row_src = this->currentRow(); // 原行号 可加if
auto id_src = row2Id[row_src]; // id_src 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) { if (item != nullptr) {
// 判断是否为空 // 判断是否为空
row_dst = item->row(); // 不为空 获取其行号 row_dst = item->row(); // 不为空 获取其行号

View File

@ -352,6 +352,7 @@ namespace NekoGui_rpc {
} }
} }
} }
return "";
} }
QString Client::SetSystemProxy(bool *rpcOK, bool enable) { QString Client::SetSystemProxy(bool *rpcOK, bool enable) {

View File

@ -258,10 +258,21 @@ void MainWindow::neko_start(int _id) {
if (!error.isEmpty()) { if (!error.isEmpty()) {
if (error.contains("configure tun interface")) { if (error.contains("configure tun interface")) {
runOnUiThread([=] { runOnUiThread([=] {
auto r = QMessageBox::information(this, tr("Tun device misbehaving"),
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), 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"), "", QMessageBox::NoButton,
1, 1); 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) { if (r == 0) {
GetMainWindow()->StopVPNProcess(); GetMainWindow()->StopVPNProcess();
} }

View File

@ -150,7 +150,7 @@ DialogBasicSettings::DialogBasicSettings(QWidget *parent)
ui->ntp_server->setText(NekoGui::dataStore->ntp_server_address); ui->ntp_server->setText(NekoGui::dataStore->ntp_server_address);
ui->ntp_port->setText(Int2String(NekoGui::dataStore->ntp_server_port)); ui->ntp_port->setText(Int2String(NekoGui::dataStore->ntp_server_port));
ui->ntp_interval->setCurrentText(NekoGui::dataStore->ntp_interval); 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_server->setEnabled(state);
ui->ntp_port->setEnabled(state); ui->ntp_port->setEnabled(state);
ui->ntp_interval->setEnabled(state); ui->ntp_interval->setEnabled(state);
@ -251,8 +251,24 @@ void DialogBasicSettings::accept() {
void DialogBasicSettings::on_set_custom_icon_clicked() { void DialogBasicSettings::on_set_custom_icon_clicked() {
auto title = ui->set_custom_icon->text(); auto title = ui->set_custom_icon->text();
QString user_icon_path = "./" + software_name.toLower() + ".png"; 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) { if (c == 0) {
auto fn = QFileDialog::getOpenFileName(this, QObject::tr("Select"), QDir::currentPath(), auto fn = QFileDialog::getOpenFileName(this, QObject::tr("Select"), QDir::currentPath(),
"*.png", nullptr, QFileDialog::Option::ReadOnly); "*.png", nullptr, QFileDialog::Option::ReadOnly);

View File

@ -87,12 +87,12 @@ DialogManageRoutes::DialogManageRoutes(QWidget *parent) : QDialog(parent), ui(ne
ui->remote_dns_strategy->addItems(qsValue); ui->remote_dns_strategy->addItems(qsValue);
ui->enable_fakeip->setChecked(NekoGui::dataStore->fake_dns); 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; auto useDNSObject = state == Qt::Checked;
ui->simple_dns_box->setDisabled(useDNSObject); ui->simple_dns_box->setDisabled(useDNSObject);
ui->dns_object->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, [=] { connect(ui->dns_document, &QPushButton::clicked, this, [=] {
MessageBoxInfo("DNS", dnsHelpDocumentUrl); MessageBoxInfo("DNS", dnsHelpDocumentUrl);
}); });

View File

@ -44,12 +44,24 @@ void DialogVPNSettings::accept() {
} }
void DialogVPNSettings::on_troubleshooting_clicked() { void DialogVPNSettings::on_troubleshooting_clicked() {
auto r = QMessageBox::information(this, tr("Troubleshooting"),
QMessageBox msg(
QMessageBox::Information,
tr("Troubleshooting"),
tr("If you have trouble starting VPN, you can force reset nekobox_core process here.\n\n" 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" "If still not working, see documentation for more information.\n"
"https://matsuridayo.github.io/n-configuration/#vpn-tun"), "https://matsuridayo.github.io/n-configuration/#vpn-tun"),
tr("Reset"), tr("Cancel"), "", QMessageBox::NoButton,
1, 1); 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) { if (r == 0) {
GetMainWindow()->StopVPNProcess(); GetMainWindow()->StopVPNProcess();
} }