upadte:完成勾选沙箱开关功能

This commit is contained in:
2025-09-20 23:14:47 +08:00
parent c8dc09ef7e
commit 3114d3b23d
2 changed files with 17 additions and 1 deletions

View File

@@ -98,8 +98,14 @@ void SettingsPage::initConfig()
} }
configCanSave = true; //  防止触发保存配置信号 configCanSave = true; //  防止触发保存配置信号
// 在现有代码后添加初始化checkBox_disableSandbox的状态
needUncompatibleNotification = config.value("other/uncompatibleNotification", needUncompatibleNotification).toBool(); needUncompatibleNotification = config.value("other/uncompatibleNotification", needUncompatibleNotification).toBool();
ui->checkBox->setChecked(needUncompatibleNotification); ui->checkBox->setChecked(needUncompatibleNotification);
// 新增从config.ini读取webengine/noSandbox配置并设置复选框状态
bool disableSandbox = config.value("webengine/noSandbox", false).toBool();
ui->checkBox_disableSandbox->setChecked(disableSandbox);
} }
SettingsPage::~SettingsPage() SettingsPage::~SettingsPage()
@@ -261,3 +267,11 @@ void SettingsPage::on_checkBox_clicked(bool checked)
config.setValue("other/uncompatibleNotification", needUncompatibleNotification); config.setValue("other/uncompatibleNotification", needUncompatibleNotification);
config.sync(); config.sync();
} }
// 添加checkBox_disableSandbox的点击事件处理函数
void SettingsPage::on_checkBox_disableSandbox_clicked(bool checked)
{
QSettings config(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/config.ini", QSettings::IniFormat);
config.setValue("webengine/noSandbox", checked);
config.sync();
}

View File

@@ -32,6 +32,8 @@ private slots:
void on_checkBox_clicked(bool checked); void on_checkBox_clicked(bool checked);
void on_checkBox_disableSandbox_clicked(bool checked);
public: public:
static bool needUncompatibleNotification; static bool needUncompatibleNotification;
@@ -47,4 +49,4 @@ signals:
void openUrl(QUrl spk); void openUrl(QUrl spk);
}; };
#endif // SETTINGSPAGE_H #endif // SETTINGSPAGE_H