mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-07-08 06:35:58 +08:00
实现分类加载失败可重新加载的UI
This commit is contained in:
parent
f655d0d94d
commit
ae987f9542
@ -27,6 +27,12 @@ void SpkUi::SpkPageHome::SetupUi()
|
||||
|
||||
ui->lblVersion->setText(ui->lblVersion->text().arg(GitVer::DescribeTags()));
|
||||
|
||||
ui->lblNewAnnouncement->setVisible(false);
|
||||
|
||||
ui->widReloadCategory->setVisible(false);
|
||||
ui->widReloadCategory->setAttribute(Qt::WA_StyledBackground);
|
||||
ui->lblCategoryErrIcon->setPixmap(QIcon::fromTheme("dialog-error").pixmap(QSize(32, 32)));
|
||||
|
||||
connect(ui->lblAuthor, &QLabel::linkActivated,
|
||||
this, &SpkPageHome::LinkActivated);
|
||||
connect(ui->btnFeedback, &QPushButton::clicked,
|
||||
@ -35,5 +41,4 @@ void SpkUi::SpkPageHome::SetupUi()
|
||||
[&](){ LinkActivated("https://spark.deepinos.org.cn/"); });
|
||||
connect(ui->btnAbout, &QPushButton::clicked,
|
||||
[&](){ SpkAbout::Show(); });
|
||||
ui->lblNewAnnouncement->setVisible(false);
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>648</width>
|
||||
<height>468</height>
|
||||
<height>554</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -220,6 +220,71 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widReloadCategory" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="lblCategoryErrIcon">
|
||||
<property name="text">
|
||||
<string>{error-icon}</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblCategoryErr">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Category loading failed. Click the button to retry.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnReloadCategory">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Reload</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
|
@ -99,9 +99,10 @@ void SpkMainWindow::CategoryDataReceived()
|
||||
{
|
||||
sErr(tr("Failed to load categories! Type=%1 Code=%2").arg(retval.type()).arg(verify));
|
||||
sNotify(tr("Cannot load categories! Type: %1 Code: %2").arg(retval.type()).arg(verify));
|
||||
// TODO: Switch to an error page
|
||||
ui->PageHome->ui->widReloadCategory->setVisible(true);
|
||||
return;
|
||||
}
|
||||
ui->PageHome->ui->widReloadCategory->setVisible(false);
|
||||
PopulateCategories(retval.toArray());
|
||||
}
|
||||
|
||||
@ -364,6 +365,8 @@ void SpkMainWindow::Initialize()
|
||||
}
|
||||
connect(ui->PageAppDetails, &SpkUi::SpkPageAppDetails::RequestDownload,
|
||||
ui->PageDownloads, &SpkUi::SpkPageDownloads::AddDownloadTask);
|
||||
connect(ui->PageHome->ui->btnReloadCategory, &QPushButton::clicked,
|
||||
this, &SpkMainWindow::RefreshCategoryData);
|
||||
|
||||
// Register themed button icons
|
||||
// mThemedUiIconReferences.append({ ui->BtnSettings, "settings" });
|
||||
|
@ -237,6 +237,12 @@ SpkAppItem::hover
|
||||
{
|
||||
}
|
||||
|
||||
#widReloadCategory
|
||||
{
|
||||
background-color: #FFA329;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
#styAppItmTitle
|
||||
{
|
||||
font-weight: 500;
|
||||
|
Loading…
x
Reference in New Issue
Block a user