diff --git a/resources/icons.qrc b/resources/icons.qrc index d41ed2ca0eed472ec82a355550cd9ae52c54b829..49309d8d3c936c0e827c4e9c055922db1477c788 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 a7e1498aae94b831a3e6c25a6e09f66424d7cac9..9fce446c19d827e3b4230cb837b0d474768e5b47 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 54b733b14504c287687aba57e2dcabaafec11a4c..879655390d9ce271b422e1036902d821f20975d9 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); + } }); // 在线获取安装包