mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-07-15 18:12:21 +08:00
feat: 多架构编译支持
This commit is contained in:
parent
efba72002a
commit
1954196ba1
src
@ -5,6 +5,11 @@
|
||||
#include <QDebug>
|
||||
|
||||
QString SparkAPI::serverUrl = "";
|
||||
#ifdef __x86_64__
|
||||
QString SparkAPI::serverUrlDir = "store";
|
||||
#elif __aarch64__
|
||||
QString SparkAPI::serverUrlDir = "aarch64-store";
|
||||
#endif
|
||||
|
||||
SparkAPI::SparkAPI(QObject *parent) : QObject(parent)
|
||||
{
|
||||
@ -54,7 +59,7 @@ void SparkAPI::getRAW(QUrl url)
|
||||
|
||||
void SparkAPI::getAppList(QString type)
|
||||
{
|
||||
get(QUrl(getServerUrl() + "aarch64-store/" + type + "/applist.json"));
|
||||
get(QUrl(getServerUrl() + SparkAPI::serverUrlDir + "/" + type + "/applist.json"));
|
||||
}
|
||||
|
||||
void SparkAPI::getSearchList(QString keyword)
|
||||
@ -64,12 +69,17 @@ void SparkAPI::getSearchList(QString keyword)
|
||||
|
||||
void SparkAPI::getAppInfo(QUrl spk)
|
||||
{
|
||||
get(QUrl(getServerUrl() + "aarch64-store" + spk.path().replace("+", "%2B") + "/app.json"));
|
||||
get(QUrl(getServerUrl() + SparkAPI::serverUrlDir + spk.path().replace("+", "%2B") + "/app.json"));
|
||||
}
|
||||
|
||||
QString SparkAPI::getArchDir()
|
||||
{
|
||||
return SparkAPI::serverUrlDir;
|
||||
}
|
||||
|
||||
void SparkAPI::getAppDownloadTimes(QUrl spk)
|
||||
{
|
||||
getRAW(QUrl(getServerUrl() + "aarch64-store" + spk.path().replace("+", "%2B") + "/download-times.txt"));
|
||||
getRAW(QUrl(getServerUrl() + SparkAPI::serverUrlDir + spk.path().replace("+", "%2B") + "/download-times.txt"));
|
||||
}
|
||||
|
||||
QString SparkAPI::getServerUrl()
|
||||
|
@ -25,6 +25,7 @@ public:
|
||||
void getRAW(QUrl url);
|
||||
void getAppList(QString type);
|
||||
void getAppInfo(QUrl spk);
|
||||
QString getArchDir();
|
||||
|
||||
signals:
|
||||
void finished(QJsonArray);
|
||||
@ -33,6 +34,7 @@ signals:
|
||||
|
||||
private:
|
||||
static QString serverUrl;
|
||||
static QString serverUrlDir;
|
||||
};
|
||||
|
||||
#endif // SPARKAPI_H
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include "applistpage.h"
|
||||
#include "ui_applistpage.h"
|
||||
|
||||
|
||||
|
||||
AppListPage::AppListPage(QWidget *parent) : QWidget(parent),
|
||||
ui(new Ui::AppListPage)
|
||||
{
|
||||
@ -37,19 +39,31 @@ void AppListPage::getAppList(QString type)
|
||||
QString theme;
|
||||
if (isDark)
|
||||
{
|
||||
theme = "theme=dark";
|
||||
#ifdef __aarch64__
|
||||
theme = "dark";
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
theme = "theme=light";
|
||||
#ifdef __aarch64__
|
||||
theme = "";
|
||||
#endif
|
||||
}
|
||||
if (type == "")
|
||||
{
|
||||
url = api->getServerUrl() + "store/#/flamescion/?" + theme;
|
||||
#ifdef __aarch64__
|
||||
url = api->getServerUrl() + "aarch64-store/#/"+ theme;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
url = api->getServerUrl() + "store/#/flamescion/applist?type=" + type + "&" + theme;
|
||||
#ifdef __aarch64__
|
||||
url = api->getServerUrl() + "aarch64-store/#/"+ theme + type;
|
||||
#endif
|
||||
}
|
||||
|
||||
ui->webEngineView->setUrl(url);
|
||||
@ -83,14 +97,16 @@ AppListPage::~AppListPage()
|
||||
|
||||
void AppListPage::on_webEngineView_urlChanged(const QUrl &arg1)
|
||||
{
|
||||
SparkAPI *api = new SparkAPI(this);
|
||||
if (arg1.path().right(8) == "app.json")
|
||||
{
|
||||
QString url = arg1.toString();
|
||||
url = url.mid(url.indexOf("/aarch64-store/"));
|
||||
url = url.mid(url.indexOf("/" + api->getArchDir() + "/"));
|
||||
url = "spk:/" + url;
|
||||
url = url.mid(0, url.indexOf("/app.json"));
|
||||
qDebug() << "程序跳转链接地址:" << url;
|
||||
ui->webEngineView->back();
|
||||
emit clicked(url);
|
||||
}
|
||||
delete api;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user