mirror of
https://gitee.com/spark-store-project/spark-store
synced 2026-06-24 23:23:49 +08:00
sync with Thunder
This commit is contained in:
@@ -75,6 +75,7 @@ void AppIntoPage::openUrl(const QUrl &url)
|
||||
iconRequest.setHeader(QNetworkRequest::ContentTypeHeader, "charset='utf-8'");
|
||||
iconRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
||||
|
||||
|
||||
iconManager->get(iconRequest);
|
||||
QObject::connect(iconManager, &QNetworkAccessManager::finished, [=](QNetworkReply *reply)
|
||||
{
|
||||
@@ -96,8 +97,8 @@ void AppIntoPage::openUrl(const QUrl &url)
|
||||
QNetworkAccessManager *manager = new QNetworkAccessManager(this);
|
||||
request.setUrl(QUrl(imgUrl));
|
||||
request.setHeader(QNetworkRequest::UserAgentHeader, m_userAgent);
|
||||
request.setHeader(QNetworkRequest::ContentTypeHeader, "charset='utf-8'");
|
||||
request.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
||||
request.setHeader(QNetworkRequest::ContentTypeHeader, "charset='utf-8'");
|
||||
manager->get(request);
|
||||
QObject::connect(manager, &QNetworkAccessManager::finished, [=](QNetworkReply *reply)
|
||||
{
|
||||
@@ -617,7 +618,7 @@ void AppIntoPage::on_downloadButton_clicked()
|
||||
|
||||
void AppIntoPage::on_pushButton_3_clicked()
|
||||
{
|
||||
QtConcurrent::run([=]()
|
||||
auto future = QtConcurrent::run([=]()
|
||||
{
|
||||
ui->downloadButton->setEnabled(false);
|
||||
ui->pushButton_3->setEnabled(false);
|
||||
@@ -659,3 +660,4 @@ void AppIntoPage::on_updateButton_clicked()
|
||||
QString feedbackURL = "https://bbs.spark-app.store/";
|
||||
QProcess::startDetached("xdg-open", QStringList{feedbackURL});
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <QSettings>
|
||||
#include <QtConcurrent>
|
||||
#include <QDebug>
|
||||
#include <QMessageBox>
|
||||
|
||||
#define TMP_PATH "/tmp/spark-store"
|
||||
#define DEFAULT_SERVER_URL "https://cdn-d.spark-app.store/"
|
||||
@@ -22,6 +23,9 @@ SettingsPage::SettingsPage(QWidget *parent)
|
||||
|
||||
configCanSave = false;
|
||||
initConfig();
|
||||
|
||||
// 移除了手动连接导出日志按钮的点击信号
|
||||
// connect(ui->pushButton_exportLog, &QPushButton::clicked, this, &SettingsPage::on_pushButton_exportLog_clicked);
|
||||
}
|
||||
|
||||
void SettingsPage::setTheme(bool dark)
|
||||
@@ -32,7 +36,7 @@ void SettingsPage::setTheme(bool dark)
|
||||
}
|
||||
else
|
||||
{
|
||||
// 亮色模式
|
||||
// ���色模式
|
||||
this->setStyleSheet("#frame{background-color: #ffffff;border-radius:14px;border:1px solid rgb(229,229,229);}");
|
||||
}
|
||||
}
|
||||
@@ -98,8 +102,14 @@ void SettingsPage::initConfig()
|
||||
}
|
||||
configCanSave = true; // 防止触发保存配置信号
|
||||
|
||||
// 在现有代码后添加初始化checkBox_disableSandbox的状态
|
||||
needUncompatibleNotification = config.value("other/uncompatibleNotification", needUncompatibleNotification).toBool();
|
||||
ui->checkBox->setChecked(needUncompatibleNotification);
|
||||
|
||||
// 新增:从config.ini读取webengine/noSandbox配置并设置复选框状态
|
||||
bool disableSandbox = config.value("webengine/noSandbox", false).toBool();
|
||||
ui->checkBox_disableSandbox->setChecked(disableSandbox);
|
||||
|
||||
}
|
||||
|
||||
SettingsPage::~SettingsPage()
|
||||
@@ -109,7 +119,7 @@ SettingsPage::~SettingsPage()
|
||||
|
||||
void SettingsPage::on_pushButton_updateServer_clicked()
|
||||
{
|
||||
QtConcurrent::run([=]()
|
||||
auto future = QtConcurrent::run([=]()
|
||||
{
|
||||
ui->pushButton_updateServer->setEnabled(false);
|
||||
|
||||
@@ -134,7 +144,7 @@ void SettingsPage::on_pushButton_updateServer_clicked()
|
||||
ui->comboBox_server->setCurrentIndex(0); });
|
||||
}
|
||||
|
||||
void SettingsPage::on_comboBox_server_currentIndexChanged(const QString &arg1)
|
||||
void SettingsPage::on_comboBox_server_currentTextChanged(const QString &arg1)
|
||||
{
|
||||
SparkAPI::setServerUrl(arg1); // 服务器信息更新
|
||||
qDebug() << arg1;
|
||||
@@ -208,7 +218,7 @@ quint64 SettingsPage::dirFileSize(const QString &path)
|
||||
|
||||
void SettingsPage::on_pushButton_updateApt_clicked()
|
||||
{
|
||||
QtConcurrent::run([=]()
|
||||
auto future = QtConcurrent::run([=]()
|
||||
{
|
||||
ui->pushButton_updateApt->setEnabled(false);
|
||||
ui->label_aptserver->setText(tr("Updating, please wait..."));
|
||||
@@ -222,7 +232,7 @@ void SettingsPage::on_pushButton_updateApt_clicked()
|
||||
|
||||
void SettingsPage::on_pushButton_clear_clicked()
|
||||
{
|
||||
QtConcurrent::run([=]()
|
||||
auto future = QtConcurrent::run([=]()
|
||||
{
|
||||
ui->pushButton_clear->setEnabled(false);
|
||||
|
||||
@@ -240,7 +250,7 @@ void SettingsPage::on_pushButton_clear_clicked()
|
||||
|
||||
void SettingsPage::on_pushButton_clearWebCache_clicked()
|
||||
{
|
||||
QtConcurrent::run([=]()
|
||||
auto future = QtConcurrent::run([=]()
|
||||
{
|
||||
QString localDataLocation = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + "/QtWebEngine";
|
||||
qDebug() << localDataLocation;
|
||||
@@ -261,3 +271,37 @@ void SettingsPage::on_checkBox_clicked(bool checked)
|
||||
config.setValue("other/uncompatibleNotification", needUncompatibleNotification);
|
||||
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();
|
||||
}
|
||||
|
||||
// 修改导出日志按钮的点击事件处理函数
|
||||
void SettingsPage::on_pushButton_exportLog_clicked()
|
||||
{
|
||||
// 禁用按钮防止重复点击
|
||||
ui->pushButton_exportLog->setEnabled(false);
|
||||
|
||||
QString targetPath = QString::fromUtf8(TMP_PATH);
|
||||
bool success = Utils::exportLogs(targetPath);
|
||||
|
||||
// 显示导出结果通知
|
||||
QString message;
|
||||
if (success) {
|
||||
message = tr("Logs exported successfully to: %1").arg(targetPath);
|
||||
Utils::writeLog("INFO", "User exported logs via settings page");
|
||||
} else {
|
||||
message = tr("Failed to export logs");
|
||||
Utils::writeLog("ERROR", "User failed to export logs via settings page");
|
||||
}
|
||||
|
||||
// 只发送一次系统通知
|
||||
Utils::sendNotification("spark-store", tr("Export Logs"), message);
|
||||
|
||||
// 重新启用按钮
|
||||
ui->pushButton_exportLog->setEnabled(true);
|
||||
}
|
||||
@@ -22,7 +22,7 @@ public:
|
||||
private slots:
|
||||
void on_pushButton_updateServer_clicked();
|
||||
|
||||
void on_comboBox_server_currentIndexChanged(const QString &arg1);
|
||||
void on_comboBox_server_currentTextChanged(const QString &arg1);
|
||||
|
||||
void on_pushButton_updateApt_clicked();
|
||||
|
||||
@@ -32,6 +32,11 @@ private slots:
|
||||
|
||||
void on_checkBox_clicked(bool checked);
|
||||
|
||||
void on_checkBox_disableSandbox_clicked(bool checked);
|
||||
|
||||
// 添加导出日志按钮的槽函数声明
|
||||
void on_pushButton_exportLog_clicked();
|
||||
|
||||
public:
|
||||
static bool needUncompatibleNotification;
|
||||
|
||||
@@ -47,4 +52,4 @@ signals:
|
||||
void openUrl(QUrl spk);
|
||||
};
|
||||
|
||||
#endif // SETTINGSPAGE_H
|
||||
#endif // SETTINGSPAGE_H
|
||||
+113
-10
@@ -32,10 +32,10 @@
|
||||
<item row="0" column="0">
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
<enum>QFrame::Shape::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
<enum>QFrame::Shadow::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
@@ -59,7 +59,7 @@
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
<enum>QFrame::Shape::NoFrame</enum>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>0</number>
|
||||
@@ -71,9 +71,9 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>688</width>
|
||||
<height>940</height>
|
||||
<y>-434</y>
|
||||
<width>666</width>
|
||||
<height>1270</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_23">
|
||||
@@ -147,7 +147,7 @@
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@@ -166,7 +166,7 @@
|
||||
<item row="0" column="3">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@@ -295,7 +295,7 @@
|
||||
<item row="0" column="4">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@@ -338,6 +338,109 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_9" native="true">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>18</pointsize>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Log</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QWidget" name="widget_10" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="text">
|
||||
<string>Export Logs:/tmp/spark-store</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_exportLog">
|
||||
<property name="text">
|
||||
<string>Export</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>351</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_11" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_14">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>18</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Disable Safe Mode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_12" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_15">
|
||||
<property name="text">
|
||||
<string>Disable the webEngine sandbox feature.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_disableSandbox">
|
||||
<property name="text">
|
||||
<string>Disable</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>424</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_6" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_25">
|
||||
@@ -372,7 +475,7 @@
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
|
||||
Reference in New Issue
Block a user