修改: src/pages/applistpage.cpp

修改:     tool/ss-feedback/sender-d
This commit is contained in:
shenmo 2024-03-22 02:11:32 +08:00
parent 6768058358
commit eaa335cc04
2 changed files with 108 additions and 114 deletions
src/pages
tool/ss-feedback

@ -1,114 +1,105 @@
#include "applistpage.h" #include "applistpage.h"
#include "ui_applistpage.h" #include "ui_applistpage.h"
#define BUILD_URL(theme, arch) \
api->getServerUrl() + SparkAPI::getArchDir() + "/#/flamescion/" + (type.isEmpty() ? "?" : "applist?type=" + type + "&") + theme + "&arch=" + arch
AppListPage::AppListPage(QWidget *parent) : QWidget(parent),
ui(new Ui::AppListPage) AppListPage::AppListPage(QWidget *parent) : QWidget(parent),
{ ui(new Ui::AppListPage)
ui->setupUi(this); {
ui->webEngineView->page()->setBackgroundColor(Qt::transparent); ui->setupUi(this);
} ui->webEngineView->page()->setBackgroundColor(Qt::transparent);
void AppListPage::setTheme(bool dark) }
{ void AppListPage::setTheme(bool dark)
isDark = dark; {
if (dark) isDark = dark;
{ if (dark)
this->setStyleSheet("#frame{background-color: #252525;border-radius:14px;border:1px solid rgb(64, 64, 64);}"); {
} this->setStyleSheet("#frame{background-color: #252525;border-radius:14px;border:1px solid rgb(64, 64, 64);}");
else }
{ else
// 亮色模式 {
this->setStyleSheet("#frame{background-color: #ffffff;border-radius:14px;border:1px solid rgb(229,229,229);}"); // 亮色模式
} this->setStyleSheet("#frame{background-color: #ffffff;border-radius:14px;border:1px solid rgb(229,229,229);}");
if (isSearch) }
{ if (isSearch)
getSearchList(nowType); {
} getSearchList(nowType);
else }
{ else
getAppList(nowType); {
} getAppList(nowType);
} }
void AppListPage::getAppList(QString type) }
{ void AppListPage::getAppList(QString type)
isSearch = false; {
nowType = type; isSearch = false;
SparkAPI *api = new SparkAPI(this); nowType = type;
QString url; SparkAPI *api = new SparkAPI(this);
QString theme; QString url;
if (isDark) QString theme;
{ if (isDark)
theme = "theme=dark"; {
} theme = "theme=dark";
else }
{ else
theme = "theme=light"; {
} theme = "theme=light";
if (type == "") }
{
url = api->getServerUrl() + SparkAPI::getArchDir() + "/#/flamescion/?" + theme + "&" + "arch=x86"; #ifdef __aarch64__
#ifdef __aarch64__ url = BUILD_URL(theme, "aarch64");
url = api->getServerUrl() + SparkAPI::getArchDir() + "/#/flamescion/?" + theme + "&" + "arch=aarch64"; #elif __loongarch__
#elif __loongarch__ url = BUILD_URL(theme, "loong64");
url = api->getServerUrl() + SparkAPI::getArchDir() + "/#/flamescion/?" + theme + "&" + "arch=loong64"; #else
#endif url = BUILD_URL(theme, "x86");
} #endif
else
{ ui->webEngineView->setUrl(url);
url = api->getServerUrl() + SparkAPI::getArchDir() + "/#/flamescion/applist?type=" + type + "&" + theme + "&" + "arch=x86"; delete api;
#ifdef __aarch64__ }
url = api->getServerUrl() + SparkAPI::getArchDir() + "/#/flamescion/applist?type=" + type + "&" + theme + "&" + "arch=aarch64";
#elif __loongarch__ void AppListPage::getSearchList(const QString &keyword)
url = api->getServerUrl() + SparkAPI::getArchDir() + "/#/flamescion/applist?type=" + type + "&" + theme + "&" + "arch=loong64"; {
#endif isSearch = true;
} nowType = keyword;
SparkAPI *api = new SparkAPI(this);
ui->webEngineView->setUrl(url); QString url;
delete api; QString theme;
} if (isDark)
{
void AppListPage::getSearchList(const QString &keyword) theme = "theme=dark";
{ }
isSearch = true; else
nowType = keyword; {
SparkAPI *api = new SparkAPI(this); theme = "theme=light";
QString url; }
QString theme;
if (isDark) url = api->getServerUrl() + SparkAPI::getArchDir() + "/#/flamescion/search?keywords=" + QUrl::toPercentEncoding(keyword) + "&" + theme + "&" + "arch=x86";
{ #ifdef __aarch64__
theme = "theme=dark"; url = api->getServerUrl() + SparkAPI::getArchDir() + "/#/flamescion/search?keywords=" + QUrl::toPercentEncoding(keyword) + "&" + theme + "&" + "arch=aarch64";
} #elif __loongarch__
else url = api->getServerUrl() + SparkAPI::getArchDir() + "/#/flamescion/search?keywords=" + QUrl::toPercentEncoding(keyword) + "&" + theme + "&" + "arch=loong64";
{ #endif
theme = "theme=light"; ui->webEngineView->setUrl(url);
} delete api;
}
url = api->getServerUrl() + SparkAPI::getArchDir() + "/#/flamescion/search?keywords=" + QUrl::toPercentEncoding(keyword) + "&" + theme + "&" + "arch=x86";
#ifdef __aarch64__ AppListPage::~AppListPage()
url = api->getServerUrl() + SparkAPI::getArchDir() + "/#/flamescion/search?keywords=" + QUrl::toPercentEncoding(keyword) + "&" + theme + "&" + "arch=aarch64"; {
#elif __loongarch__ delete ui;
url = api->getServerUrl() + SparkAPI::getArchDir() + "/#/flamescion/search?keywords=" + QUrl::toPercentEncoding(keyword) + "&" + theme + "&" + "arch=loong64"; }
#endif
ui->webEngineView->setUrl(url); void AppListPage::on_webEngineView_urlChanged(const QUrl &arg1)
delete api; {
} if (arg1.path().right(8) == "app.json")
{
AppListPage::~AppListPage() QString url = arg1.toString();
{ url = url.mid(url.indexOf("/" + SparkAPI::getArchDir() + "/"));
delete ui; url = "spk:/" + url;
} url = url.mid(0, url.indexOf("/app.json"));
qDebug() << "程序跳转链接地址:" << url;
void AppListPage::on_webEngineView_urlChanged(const QUrl &arg1) ui->webEngineView->back();
{ emit clicked(url);
if (arg1.path().right(8) == "app.json") }
{ }
QString url = arg1.toString();
url = url.mid(url.indexOf("/" + SparkAPI::getArchDir() + "/"));
url = "spk:/" + url;
url = url.mid(0, url.indexOf("/app.json"));
qDebug() << "程序跳转链接地址:" << url;
ui->webEngineView->back();
emit clicked(url);
}
}

@ -9,6 +9,9 @@ case `arch` in
aarch64) aarch64)
STORE_URL="aarch64-store" STORE_URL="aarch64-store"
;; ;;
loongarch64)
STORE_URL="loong64-store"
;;
esac esac
if [ -z $1 ] || [ "$2" != "HD70642" ];then if [ -z $1 ] || [ "$2" != "HD70642" ];then