From 3b216d1aa495bd5b047f8640d5ba91f9abe2ae37 Mon Sep 17 00:00:00 2001
From: keke <243768648@qq.com>
Date: Thu, 9 Mar 2023 11:17:51 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=9E=E8=A3=85=E8=B7=B3=E8=BD=AC?=
=?UTF-8?q?=E5=88=B0=E6=98=9F=E7=81=AB=E5=BA=94=E7=94=A8=E5=95=86=E5=BA=97?=
=?UTF-8?q?=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Issue: https://gitee.com/ct243768648/ccc-app-manager/issues/I6BWIG
---
resources/icons.qrc | 2 ++
src/appmanagermodel.cpp | 7 +++++--
src/appmanagerwidget.cpp | 36 +++++++++++++++++++++---------------
3 files changed, 28 insertions(+), 17 deletions(-)
diff --git a/resources/icons.qrc b/resources/icons.qrc
index d41ed2c..49309d8 100644
--- a/resources/icons.qrc
+++ b/resources/icons.qrc
@@ -7,5 +7,7 @@
icons/rotate_48px.svg
icons/chevron-down_48px.svg
icons/chevron-up_48px.svg
+ icons/distributor-logo-deepin_64px.svg
+ icons/spark-store_64px.svg
diff --git a/src/appmanagermodel.cpp b/src/appmanagermodel.cpp
index a7e1498..9fce446 100644
--- a/src/appmanagermodel.cpp
+++ b/src/appmanagermodel.cpp
@@ -90,8 +90,11 @@ void AppManagerModel::openStoreAppDetailPage(const QString &pkgName)
void AppManagerModel::openSpkStoreAppDetailPage(const QString &pkgName)
{
- Q_UNUSED(pkgName);
- popupNormalSysNotify("shenmo", "因为无法获取分类信息,暂时没有实现这个功能");
+ QProcess proc;
+ proc.startDetached("spark-store", {QString("spk://search/%1").arg(pkgName)});
+ proc.waitForStarted();
+ proc.waitForFinished();
+ proc.close();
}
QString AppManagerModel::getDownloadDirPath() const
diff --git a/src/appmanagerwidget.cpp b/src/appmanagerwidget.cpp
index 54b733b..8796553 100644
--- a/src/appmanagerwidget.cpp
+++ b/src/appmanagerwidget.cpp
@@ -290,8 +290,20 @@ AppManagerWidget::AppManagerWidget(AppManagerModel *model, QWidget *parent)
firstLineBottomLayout->addWidget(uninstallBtn);
firstLineBottomLayout->addSpacing(10);
- QPushButton *gotoAppStoreBtn = new QPushButton("在深度应用商店中查看", this);
- gotoAppStoreBtn->setMaximumWidth(170);
+ // 跳转到应用商店菜单
+ QAction *gotoDeepinAppStoreAction = new QAction("深度", this);
+ gotoDeepinAppStoreAction->setIcon(QIcon::fromTheme("distributor-logo-deepin"));
+ gotoDeepinAppStoreAction->setCheckable(false);
+ QAction *gotoSparkAppStoreAction = new QAction("星火", this);
+ gotoSparkAppStoreAction->setIcon(QIcon::fromTheme("spark-store"));
+ gotoSparkAppStoreAction->setCheckable(false);
+ QMenu *gotoAppStoreBtnMenu = new QMenu(this);
+ gotoAppStoreBtnMenu->addAction(gotoDeepinAppStoreAction);
+ gotoAppStoreBtnMenu->addAction(gotoSparkAppStoreAction);
+ // 跳转到应用商店按钮
+ QPushButton *gotoAppStoreBtn = new QPushButton("在应用商店中查看", this);
+ gotoAppStoreBtn->setMenu(gotoAppStoreBtnMenu);
+ gotoAppStoreBtn->setMaximumWidth(190);
firstLineBottomLayout->addWidget(gotoAppStoreBtn);
firstLineBottomLayout->addSpacing(10);
@@ -305,12 +317,6 @@ AppManagerWidget::AppManagerWidget(AppManagerModel *model, QWidget *parent)
firstLineBottomLayout->addWidget(getPkgFromLocalBtn);
firstLineBottomLayout->addSpacing(10);
- firstLineBottomLayout->addSpacing(10);
- QPushButton *gotoSpkAppStoreBtn = new QPushButton("在星火应用商店中查看", this);
- gotoSpkAppStoreBtn->setMaximumWidth(170);
- firstLineBottomLayout->addWidget(gotoSpkAppStoreBtn);
- firstLineBottomLayout->addSpacing(10);
-
// 左置顶
firstLineBottomLayout->addStretch(1);
@@ -401,13 +407,13 @@ AppManagerWidget::AppManagerWidget(AppManagerModel *model, QWidget *parent)
this->m_model->notifyThreadUninstallPkg(m_showingAppInfo.pkgName);
});
- // 跳转到深度商店
- connect(gotoAppStoreBtn, &QPushButton::clicked, this, [this](bool) {
- this->m_model->openStoreAppDetailPage(m_showingAppInfo.pkgName);
- });
- //跳转到星火商店
- connect(gotoSpkAppStoreBtn, &QPushButton::clicked, this, [this](bool) {
- this->m_model->openSpkStoreAppDetailPage(m_showingAppInfo.pkgName);
+ // 跳转到应用商店
+ connect(gotoAppStoreBtnMenu, &QMenu::triggered, this, [gotoDeepinAppStoreAction, gotoSparkAppStoreAction, this](QAction *action) {
+ if (action == gotoDeepinAppStoreAction) {
+ this->m_model->openStoreAppDetailPage(m_showingAppInfo.pkgName);
+ } else if (action == gotoSparkAppStoreAction) {
+ this->m_model->openSpkStoreAppDetailPage(m_showingAppInfo.pkgName);
+ }
});
// 在线获取安装包
--
Gitee