format: 代码格式化

This commit is contained in:
2022-12-23 12:13:48 +08:00
parent 89a3ab0b4c
commit fd4fdbe970
20 changed files with 473 additions and 469 deletions

View File

@@ -30,7 +30,6 @@ void DownloadController::setFilename(QString filename)
this->filename = filename;
}
bool checkMeatlink(QString metaUrl)
{
QFile metaStatus("/tmp/spark-store/metaStatus.txt");

View File

@@ -1,13 +1,12 @@
#include "image_show.h"
#include <QHBoxLayout>
#include <QScreen> // Qt5 不再建议使用 QDesktopWidget
#include <QScreen> // Qt5 不再建议使用 QDesktopWidget
#include <QGuiApplication>
image_show::image_show(QWidget *parent) :
QWidget(parent),
m_dialog(new big_image),
m_label(new QLabel)
image_show::image_show(QWidget *parent) : QWidget(parent),
m_dialog(new big_image),
m_label(new QLabel)
{
QHBoxLayout *layout = new QHBoxLayout;
layout->addWidget(m_label);
@@ -27,7 +26,7 @@ void image_show::setImage(QPixmap image)
desktop_w = QGuiApplication::primaryScreen()->geometry().width();
desktop_h = QGuiApplication::primaryScreen()->geometry().height();
if(screen0.width() > (desktop_w - 20) || screen0.height() > (desktop_h - 20))
if (screen0.width() > (desktop_w - 20) || screen0.height() > (desktop_h - 20))
{
re_screen1 = screen0.scaled(QSize(desktop_w - 20, desktop_h - 20), Qt::KeepAspectRatio, Qt::SmoothTransformation);
m_image = QPixmap::fromImage(re_screen1);
@@ -48,7 +47,7 @@ void image_show::mousePressEvent(QMouseEvent *)
// 识别主屏幕尺寸并设置 widget 大小
m_dialog->setFixedSize(desktop_w, desktop_h);
m_dialog->move(0,0);
m_dialog->move(0, 0);
}
image_show::~image_show()
{

View File

@@ -7,7 +7,7 @@ QString SparkAPI::serverUrl = "";
SparkAPI::SparkAPI(QObject *parent) : QObject(parent)
{
QSettings readConfig(QDir::homePath() + "/.config/spark-store/config.ini", QSettings::IniFormat);
if(!readConfig.value("server/choose").toString().isEmpty() && readConfig.value("server/updated").toString() == "TRUE")
if (!readConfig.value("server/choose").toString().isEmpty() && readConfig.value("server/updated").toString() == "TRUE")
{
SparkAPI::setServerUrl(readConfig.value("server/choose").toString());
}
@@ -15,9 +15,10 @@ SparkAPI::SparkAPI(QObject *parent) : QObject(parent)
void SparkAPI::get(QUrl url)
{
QNetworkRequest request;
HttpRequest *httprequest=new HttpRequest;
request.setUrl(QUrl(url.toString().replace("+","%2B")));
connect(httprequest,&HttpRequest::finished,[=](QString data){
HttpRequest *httprequest = new HttpRequest;
request.setUrl(QUrl(url.toString().replace("+", "%2B")));
connect(httprequest, &HttpRequest::finished, [=](QString data)
{
QByteArray arr = data.toUtf8();
//解析Json
QJsonParseError error;
@@ -30,36 +31,35 @@ void SparkAPI::get(QUrl url)
emit finishedObject(doc);
}
httprequest->deleteLater();
});
httprequest->deleteLater(); });
httprequest->getRequest(request);
}
void SparkAPI::getRAW(QUrl url)
{
QNetworkRequest request;
HttpRequest *httprequest=new HttpRequest;
request.setUrl(QUrl(url.toString().replace("+","%2B")));
connect(httprequest,&HttpRequest::finished,[=](QString data){
HttpRequest *httprequest = new HttpRequest;
request.setUrl(QUrl(url.toString().replace("+", "%2B")));
connect(httprequest, &HttpRequest::finished, [=](QString data)
{
emit finishedRAW(data);
httprequest->deleteLater();
});
httprequest->deleteLater(); });
httprequest->getRequest(request);
}
void SparkAPI::getAppList(QString type)
{
get(QUrl(getServerUrl()+"store/"+type+"/applist.json"));
get(QUrl(getServerUrl() + "store/" + type + "/applist.json"));
}
void SparkAPI::getSearchList(QString keyword)
{
get(QUrl("https://search.deepinos.org.cn/appinfo/search?keyword="+keyword));
get(QUrl("https://search.deepinos.org.cn/appinfo/search?keyword=" + keyword));
}
void SparkAPI::getAppInfo(QUrl spk)
{
get(QUrl(getServerUrl()+"store"+spk.path().replace("+","%2B") + "/app.json"));
get(QUrl(getServerUrl() + "store" + spk.path().replace("+", "%2B") + "/app.json"));
}
void SparkAPI::getAppDownloadTimes(QUrl spk)
{
getRAW(QUrl(getServerUrl()+"store"+spk.path().replace("+","%2B") + "/download-times.txt"));
getRAW(QUrl(getServerUrl() + "store" + spk.path().replace("+", "%2B") + "/download-times.txt"));
}
QString SparkAPI::getServerUrl()
{