mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-12-14 21:02:04 +08:00
upadte:完成勾选沙箱开关功能
This commit is contained in:
@@ -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();
|
||||||
|
}
|
||||||
@@ -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
|
||||||
Reference in New Issue
Block a user