mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-10-09 11:52:21 +08:00
feat: 多架构编译支持
This commit is contained in:
parent
efba72002a
commit
1954196ba1
src
@ -5,6 +5,11 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
QString SparkAPI::serverUrl = "";
|
QString SparkAPI::serverUrl = "";
|
||||||
|
#ifdef __x86_64__
|
||||||
|
QString SparkAPI::serverUrlDir = "store";
|
||||||
|
#elif __aarch64__
|
||||||
|
QString SparkAPI::serverUrlDir = "aarch64-store";
|
||||||
|
#endif
|
||||||
|
|
||||||
SparkAPI::SparkAPI(QObject *parent) : QObject(parent)
|
SparkAPI::SparkAPI(QObject *parent) : QObject(parent)
|
||||||
{
|
{
|
||||||
@ -54,7 +59,7 @@ void SparkAPI::getRAW(QUrl url)
|
|||||||
|
|
||||||
void SparkAPI::getAppList(QString type)
|
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)
|
void SparkAPI::getSearchList(QString keyword)
|
||||||
@ -64,12 +69,17 @@ void SparkAPI::getSearchList(QString keyword)
|
|||||||
|
|
||||||
void SparkAPI::getAppInfo(QUrl spk)
|
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)
|
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()
|
QString SparkAPI::getServerUrl()
|
||||||
|
@ -25,6 +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();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void finished(QJsonArray);
|
void finished(QJsonArray);
|
||||||
@ -33,6 +34,7 @@ signals:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
static QString serverUrl;
|
static QString serverUrl;
|
||||||
|
static QString serverUrlDir;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SPARKAPI_H
|
#endif // SPARKAPI_H
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#include "applistpage.h"
|
#include "applistpage.h"
|
||||||
#include "ui_applistpage.h"
|
#include "ui_applistpage.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
AppListPage::AppListPage(QWidget *parent) : QWidget(parent),
|
AppListPage::AppListPage(QWidget *parent) : QWidget(parent),
|
||||||
ui(new Ui::AppListPage)
|
ui(new Ui::AppListPage)
|
||||||
{
|
{
|
||||||
@ -37,19 +39,31 @@ void AppListPage::getAppList(QString type)
|
|||||||
QString theme;
|
QString theme;
|
||||||
if (isDark)
|
if (isDark)
|
||||||
{
|
{
|
||||||
|
theme = "theme=dark";
|
||||||
|
#ifdef __aarch64__
|
||||||
theme = "dark";
|
theme = "dark";
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
theme = "theme=light";
|
||||||
|
#ifdef __aarch64__
|
||||||
theme = "";
|
theme = "";
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
if (type == "")
|
if (type == "")
|
||||||
{
|
{
|
||||||
|
url = api->getServerUrl() + "store/#/flamescion/?" + theme;
|
||||||
|
#ifdef __aarch64__
|
||||||
url = api->getServerUrl() + "aarch64-store/#/"+ theme;
|
url = api->getServerUrl() + "aarch64-store/#/"+ theme;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
url = api->getServerUrl() + "store/#/flamescion/applist?type=" + type + "&" + theme;
|
||||||
|
#ifdef __aarch64__
|
||||||
url = api->getServerUrl() + "aarch64-store/#/"+ theme + type;
|
url = api->getServerUrl() + "aarch64-store/#/"+ theme + type;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->webEngineView->setUrl(url);
|
ui->webEngineView->setUrl(url);
|
||||||
@ -83,14 +97,16 @@ 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("/aarch64-store/"));
|
url = url.mid(url.indexOf("/" + api->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;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user