mirror of
https://gitee.com/spark-store-project/spark-store
synced 2026-03-25 23:09:44 +08:00
Merge branch 'Reason' of https://gitee.com/deepin-community-store/spark-store into Reason
This commit is contained in:
25
src/main.cpp
25
src/main.cpp
@@ -43,8 +43,33 @@ int main(int argc, char *argv[])
|
|||||||
// 浏览器开启 GPU 支持
|
// 浏览器开启 GPU 支持
|
||||||
#ifdef __sw_64__
|
#ifdef __sw_64__
|
||||||
qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--no-sandbox");
|
qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--no-sandbox");
|
||||||
|
#elif __aarch64__
|
||||||
|
if (!Utils::isWayland()) {
|
||||||
|
QString env = QString::fromUtf8(qgetenv("QTWEBENGINE_CHROMIUM_FLAGS"));
|
||||||
|
env = env.trimmed();
|
||||||
|
/**
|
||||||
|
* NOTE: 参考帮助手册代码,对于部分ARM CPU 设备,
|
||||||
|
* --disable-gpu 保证 X11 环境下网页正常显示
|
||||||
|
* --single-process 避免 X11 环境下 QtWebEngine 崩溃(可选)
|
||||||
|
*/
|
||||||
|
env += " --disable-gpu";
|
||||||
|
qputenv("QTWEBENGINE_CHROMIUM_FLAGS", env.trimmed().toUtf8());
|
||||||
|
|
||||||
|
QSurfaceFormat format;
|
||||||
|
format.setRenderableType(QSurfaceFormat::OpenGLES);
|
||||||
|
QSurfaceFormat::setDefaultFormat(format);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NOTE: https://zhuanlan.zhihu.com/p/550285855
|
||||||
|
* 避免 X11 环境下从 QtWebEngine 后退回到 QWidget 时黑屏闪烁
|
||||||
|
*/
|
||||||
|
qputenv("QMLSCENE_DEVICE", "softwarecontext");
|
||||||
|
DApplication::setAttribute(Qt::AA_UseSoftwareOpenGL);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FIXME: 对于麒麟 CPU 设备,调用 QtWebEngine 会导致客户端崩溃;
|
* FIXME: 对于麒麟 CPU 设备,调用 QtWebEngine 会导致客户端崩溃;
|
||||||
* 暂时不对 CPU 进行判断,对 wayland 环境下统一处理
|
* 暂时不对 CPU 进行判断,对 wayland 环境下统一处理
|
||||||
|
|||||||
@@ -238,5 +238,5 @@ void DownloadItem::slotAsyncInstall(int t)
|
|||||||
|
|
||||||
ui->widget_spinner->hide();
|
ui->widget_spinner->hide();
|
||||||
DownloadItem::isInstall = false;
|
DownloadItem::isInstall = false;
|
||||||
emit finished();
|
emit finished(error == 0 && !haveError && !notRoot);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ private slots:
|
|||||||
void slotAsyncInstall(int t);
|
void slotAsyncInstall(int t);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void finished();
|
void finished(bool success);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DOWNLOADITEM_H
|
#endif // DOWNLOADITEM_H
|
||||||
|
|||||||
@@ -91,10 +91,14 @@ DownloadItem* DownloadListWidget::addItem(QString name, QString fileName, QStrin
|
|||||||
{
|
{
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
urList.append(downloadurl);
|
urList.append(downloadurl);
|
||||||
allDownload += 1;
|
allDownload += 1;
|
||||||
toDownload += 1;
|
toDownload += 1;
|
||||||
|
|
||||||
DownloadItem *di = new DownloadItem;
|
DownloadItem *di = new DownloadItem;
|
||||||
|
connect(di, &DownloadItem::finished, this, &DownloadListWidget::slotInstallFinished, Qt::QueuedConnection);
|
||||||
|
|
||||||
dlist << downloadurl;
|
dlist << downloadurl;
|
||||||
downloaditemlist << di;
|
downloaditemlist << di;
|
||||||
di->setName(name);
|
di->setName(name);
|
||||||
@@ -167,22 +171,9 @@ void DownloadListWidget::httpFinished() // 完成下载
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
toDownload -= 1; // 安装完以后减少待安装数目
|
|
||||||
qDebug() << "Download: 还没有下载的数目:" << toDownload;
|
|
||||||
|
|
||||||
if (toDownload == 0)
|
|
||||||
{
|
|
||||||
Application *app = qobject_cast<Application *>(qApp);
|
|
||||||
MainWindow *mainWindow = app->mainWindow();
|
|
||||||
if (mainWindow->isCloseWindowAnimation() == true)
|
|
||||||
{
|
|
||||||
qDebug() << "Download: 后台安装结束,退出程序";
|
|
||||||
qApp->quit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
downloaditemlist[nowDownload - 1]->free = true;
|
downloaditemlist[nowDownload - 1]->free = true;
|
||||||
emit downloadFinished();
|
emit downloadFinished();
|
||||||
|
|
||||||
if (nowDownload < allDownload)
|
if (nowDownload < allDownload)
|
||||||
{
|
{
|
||||||
// 如果有排队则下载下一个
|
// 如果有排队则下载下一个
|
||||||
@@ -241,3 +232,23 @@ void DownloadListWidget::on_pushButton_clicked()
|
|||||||
{
|
{
|
||||||
QDesktopServices::openUrl(QUrl("file:///tmp/spark-store", QUrl::TolerantMode));
|
QDesktopServices::openUrl(QUrl("file:///tmp/spark-store", QUrl::TolerantMode));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DownloadListWidget::slotInstallFinished(bool success)
|
||||||
|
{
|
||||||
|
// NOTE: 仅在安装成功后判断是否需要退出后台
|
||||||
|
if (success) {
|
||||||
|
toDownload -= 1; // 安装完以后减少待安装数目
|
||||||
|
qDebug() << "Download: 还没有下载的数目:" << toDownload;
|
||||||
|
|
||||||
|
if (toDownload == 0)
|
||||||
|
{
|
||||||
|
Application *app = qobject_cast<Application *>(qApp);
|
||||||
|
MainWindow *mainWindow = app->mainWindow();
|
||||||
|
if (mainWindow->isCloseWindowAnimation() == true)
|
||||||
|
{
|
||||||
|
qDebug() << "Download: 后台安装结束,退出程序";
|
||||||
|
qApp->quit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ signals:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_pushButton_clicked();
|
void on_pushButton_clicked();
|
||||||
|
void slotInstallFinished(bool success);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DOWNLOADLISTWIDGET_H
|
#endif // DOWNLOADLISTWIDGET_H
|
||||||
|
|||||||
Reference in New Issue
Block a user