fix: 修复在x86下的编译问题

This commit is contained in:
uniartisan 2023-03-05 23:42:07 +08:00
parent 795a6ca709
commit 84cc4a9208
3 changed files with 10 additions and 12 deletions

View File

@ -25,7 +25,7 @@ public:
void getRAW(QUrl url); void getRAW(QUrl url);
void getAppList(QString type); void getAppList(QString type);
void getAppInfo(QUrl spk); void getAppInfo(QUrl spk);
QString getArchDir(); static QString getArchDir();
signals: signals:
void finished(QJsonArray); void finished(QJsonArray);

View File

@ -55,8 +55,8 @@ void AppIntoPage::openUrl(const QUrl &url)
// 获取图标 // 获取图标
QNetworkRequest request; QNetworkRequest request;
QNetworkAccessManager *manager = new QNetworkAccessManager(this); QNetworkAccessManager *manager = new QNetworkAccessManager(this);
qDebug() << api->getImgServerUrl() + "aarch64-store" + url.path() + "/icon.png"; qDebug() << api->getImgServerUrl() + SparkAPI::getArchDir() + url.path() + "/icon.png";
request.setUrl(QUrl(api->getImgServerUrl() + "aarch64-store" + url.path() + "/icon.png")); request.setUrl(QUrl(api->getImgServerUrl() + SparkAPI::getArchDir() + url.path() + "/icon.png"));
request.setRawHeader("User-Agent", "Mozilla/5.0"); request.setRawHeader("User-Agent", "Mozilla/5.0");
request.setRawHeader("Content-Type", "charset='utf-8'"); request.setRawHeader("Content-Type", "charset='utf-8'");
manager->get(request); manager->get(request);
@ -175,7 +175,7 @@ void AppIntoPage::openUrl(const QUrl &url)
ui->downloadButton->show(); ui->downloadButton->show();
} }
isDownloading(SparkAPI::getServerUrl() + "aarch64-store" + spk.path() + "/" + info["Filename"].toString()); isDownloading(SparkAPI::getServerUrl() + SparkAPI::getArchDir() + spk.path() + "/" + info["Filename"].toString());
} }
api1->disconnect(); api1->disconnect();
@ -267,7 +267,7 @@ void AppIntoPage::setDownloadWidget(DownloadListWidget *w)
dw = w; dw = w;
connect(w, &DownloadListWidget::downloadFinished, [=]() connect(w, &DownloadListWidget::downloadFinished, [=]()
{ isDownloading(SparkAPI::getServerUrl() + "aarch64-store" + spk.path() + "/" + info["Filename"].toString()); }); { isDownloading(SparkAPI::getServerUrl() + SparkAPI::getArchDir() + spk.path() + "/" + info["Filename"].toString()); });
} }
void AppIntoPage::initUI() void AppIntoPage::initUI()
@ -375,7 +375,7 @@ void AppIntoPage::setAppinfoTags(const QStringList &tagList)
void AppIntoPage::on_downloadButton_clicked() void AppIntoPage::on_downloadButton_clicked()
{ {
QString downloadUrl = SparkAPI::getServerUrl() + "aarch64-store" + spk.path() + "/" + info["Filename"].toString(); QString downloadUrl = SparkAPI::getServerUrl() + SparkAPI::getArchDir() + spk.path() + "/" + info["Filename"].toString();
if (ui->downloadButton->text() == tr("Install")) if (ui->downloadButton->text() == tr("Install"))
{ {
DownloadItem *item = dw->getDIList()[dw->getUrlList().lastIndexOf(downloadUrl)]; DownloadItem *item = dw->getDIList()[dw->getUrlList().lastIndexOf(downloadUrl)];

View File

@ -53,14 +53,14 @@ void AppListPage::getAppList(QString type)
} }
if (type == "") if (type == "")
{ {
url = api->getServerUrl() + api->getArchDir() + "/#/flamescion/?" + theme; url = api->getServerUrl() + SparkAPI::getArchDir() + "/#/flamescion/?" + theme;
#ifdef __aarch64__ #ifdef __aarch64__
url = api->getServerUrl() + "aarch64-store/#/"+ theme; url = api->getServerUrl() + "aarch64-store/#/"+ theme;
#endif #endif
} }
else else
{ {
url = api->getServerUrl() + api->getArchDir() + "/#/flamescion/applist?type=" + type + "&" + theme; url = api->getServerUrl() + SparkAPI::getArchDir() + "/#/flamescion/applist?type=" + type + "&" + theme;
#ifdef __aarch64__ #ifdef __aarch64__
url = api->getServerUrl() + "aarch64-store/#/"+ theme + type; url = api->getServerUrl() + "aarch64-store/#/"+ theme + type;
#endif #endif
@ -85,7 +85,7 @@ void AppListPage::getSearchList(const QString &keyword)
{ {
theme = "theme=light"; theme = "theme=light";
} }
url = api->getServerUrl() + api->getArchDir() + "/#/flamescion/search?keywords=" + QUrl::toPercentEncoding(keyword) + "&" + theme; url = api->getServerUrl() + SparkAPI::getArchDir() + "/#/flamescion/search?keywords=" + QUrl::toPercentEncoding(keyword) + "&" + theme;
ui->webEngineView->setUrl(url); ui->webEngineView->setUrl(url);
delete api; delete api;
} }
@ -97,16 +97,14 @@ AppListPage::~AppListPage()
void AppListPage::on_webEngineView_urlChanged(const QUrl &arg1) void AppListPage::on_webEngineView_urlChanged(const QUrl &arg1)
{ {
SparkAPI *api = new SparkAPI(this);
if (arg1.path().right(8) == "app.json") if (arg1.path().right(8) == "app.json")
{ {
QString url = arg1.toString(); QString url = arg1.toString();
url = url.mid(url.indexOf("/" + api->getArchDir() + "/")); url = url.mid(url.indexOf("/" + SparkAPI::getArchDir() + "/"));
url = "spk:/" + url; url = "spk:/" + url;
url = url.mid(0, url.indexOf("/app.json")); url = url.mid(0, url.indexOf("/app.json"));
qDebug() << "程序跳转链接地址:" << url; qDebug() << "程序跳转链接地址:" << url;
ui->webEngineView->back(); ui->webEngineView->back();
emit clicked(url); emit clicked(url);
} }
delete api;
} }