mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-09-08 04:12:21 +08:00
添加应用详情页下载量显示
This commit is contained in:
parent
8a54dd92a3
commit
333a1168d4
@ -30,6 +30,17 @@ void SparkAPI::get(QUrl url)
|
||||
});
|
||||
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){
|
||||
emit finishedRAW(data);
|
||||
httprequest->deleteLater();
|
||||
});
|
||||
httprequest->getRequest(request);
|
||||
}
|
||||
void SparkAPI::getAppList(QString type)
|
||||
{
|
||||
get(QUrl(getServerUrl()+"store/"+type+"/applist.json"));
|
||||
@ -42,6 +53,10 @@ void SparkAPI::getAppInfo(QUrl spk)
|
||||
{
|
||||
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"));
|
||||
}
|
||||
QString SparkAPI::getServerUrl()
|
||||
{
|
||||
return SparkAPI::serverUrl;
|
||||
|
@ -13,8 +13,10 @@ public:
|
||||
static QString getServerUrl();
|
||||
static QString getImgServerUrl();
|
||||
static void setServerUrl(QString url);
|
||||
void getAppDownloadTimes(QUrl spk);
|
||||
void getSearchList(QString keyword);
|
||||
void get(QUrl url);
|
||||
void getRAW(QUrl url);
|
||||
void getAppList(QString type);
|
||||
void getAppInfo(QUrl spk);
|
||||
explicit SparkAPI(QObject *parent = nullptr);
|
||||
@ -24,6 +26,7 @@ private:
|
||||
|
||||
signals:
|
||||
void finished(QJsonArray);
|
||||
void finishedRAW(QString);
|
||||
void finishedObject(QJsonObject);
|
||||
|
||||
public slots:
|
||||
|
@ -9,6 +9,12 @@ AppIntoPage::AppIntoPage(QWidget *parent) :
|
||||
ui->listWidget->setMovement(QListView::Static);
|
||||
ui->listWidget->setMaximumHeight(200);
|
||||
ui->listWidget->setFlow(QListView::TopToBottom);
|
||||
api1=new SparkAPI(this);
|
||||
connect(api1,&SparkAPI::finishedRAW,[=](QString download_times){
|
||||
download_times.remove(QRegExp("\\n"));
|
||||
ui->download_times->setText(download_times);
|
||||
qDebug()<<"Download Times:"+download_times;
|
||||
});
|
||||
clear();
|
||||
}
|
||||
|
||||
@ -179,6 +185,7 @@ void AppIntoPage::openUrl(QUrl url)
|
||||
api->deleteLater();
|
||||
});
|
||||
api->getAppInfo(url);
|
||||
api1->getAppDownloadTimes(url);
|
||||
}
|
||||
|
||||
void AppIntoPage::isDownloading()
|
||||
|
@ -35,6 +35,7 @@ private slots:
|
||||
void on_updateButton_clicked();
|
||||
|
||||
private:
|
||||
SparkAPI *api1;
|
||||
QJsonObject info;
|
||||
QPixmap iconpixmap;
|
||||
QUrl spk;
|
||||
|
@ -302,7 +302,65 @@
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_12">
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="download_times">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>14</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Download Times</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_9">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
|
Loading…
x
Reference in New Issue
Block a user