feat(frontend): Add app description.

Description: 为未安装应用添加应用描述栏

Log: 为未安装应用添加应用描述栏
This commit is contained in:
zhangjiaping 2021-03-10 15:04:53 +08:00
parent f6367f2fba
commit c3a80a7614
3 changed files with 13 additions and 9 deletions

View File

@ -163,7 +163,7 @@ void AppMatch::getAllDesktopFilePath(QString path){
if(!m_filePathList.contains(filePathStr)){ if(!m_filePathList.contains(filePathStr)){
NameString appname; NameString appname;
appname.app_name = QString::fromLocal8Bit(name); appname.app_name = QString::fromLocal8Bit(name);
m_installAppMap.insert(appname,applist<<filePathStr<<QString::fromLocal8Bit(icon)<<""); m_installAppMap.insert(appname,applist<<filePathStr<<QString::fromLocal8Bit(icon)<<""<<"");
applist.clear(); applist.clear();
} }
// m_filePathList.append(filePathStr); // m_filePathList.append(filePathStr);
@ -327,7 +327,7 @@ void AppMatch::parseSoftWareCenterReturn(QList<QMap<QString,QString>> list,QMap<
appdiscription=list.at(i).value("discription"); appdiscription=list.at(i).value("discription");
appicon=list.at(i).value("icon"); appicon=list.at(i).value("icon");
name.app_name = appname; name.app_name = appname;
pkgname.isEmpty() ? softwarereturn.insert(name,applist<<""<<appicon<<appdiscription) : softwarereturn.insert(name,applist<<""<<appicon<<pkgname); pkgname.isEmpty() ? softwarereturn.insert(name,applist<<""<<appicon<<appdiscription) : softwarereturn.insert(name,applist<<""<<appicon<<pkgname<<appdiscription);
applist.clear(); applist.clear();
} }
} }

View File

@ -131,7 +131,7 @@ void SearchDetailView::setWebWidget(const QString& keyword)
m_webView->settings()->setAttribute(QWebEngineSettings::PluginsEnabled, true); m_webView->settings()->setAttribute(QWebEngineSettings::PluginsEnabled, true);
m_webView->setAttribute(Qt::WA_DeleteOnClose); m_webView->setAttribute(Qt::WA_DeleteOnClose);
m_webView->move(0, 0); m_webView->move(0, 0);
m_webView->setFixedSize(360, 522); m_webView->setFixedSize(378, 522);
connect(m_webView,&QWebEngineView::loadFinished, this, [ = ](){ connect(m_webView,&QWebEngineView::loadFinished, this, [ = ](){
m_reload = true; m_reload = true;
@ -173,7 +173,7 @@ void SearchDetailView::setWebWidget(const QString& keyword)
m_webView->show(); m_webView->show();
} }
void SearchDetailView::setAppWidget(const QString &appname, const QString &path, const QString &iconpath) void SearchDetailView::setAppWidget(const QString &appname, const QString &path, const QString &iconpath, const QString &description)
{ {
m_type = SearchListView::ResType::App; m_type = SearchListView::ResType::App;
m_path = path; m_path = path;
@ -190,6 +190,12 @@ void SearchDetailView::setAppWidget(const QString &appname, const QString &path,
if (path.isEmpty() || path == "") { if (path.isEmpty() || path == "") {
icon = QIcon(iconpath); icon = QIcon(iconpath);
m_optionView->setupOptions(m_type, false); m_optionView->setupOptions(m_type, false);
//未安装应用有一个label显示软件描述
if (description != "" && !description.isEmpty()) {
m_detailFrame->show();
m_contentLabel->show();
m_contentLabel->setText(QString(tr("Introduction: %1")).arg(description));
}
} else { } else {
m_optionView->setupOptions(m_type, true); m_optionView->setupOptions(m_type, true);
if (QIcon::fromTheme(iconpath).isNull()) { if (QIcon::fromTheme(iconpath).isNull()) {
@ -437,7 +443,7 @@ void SearchDetailView::initUI()
m_layout->setContentsMargins(16, 60, 16, 24); m_layout->setContentsMargins(16, 60, 16, 24);
this->setObjectName("detailView"); this->setObjectName("detailView");
this->setStyleSheet("QWidget#detailView{background:transparent;}"); this->setStyleSheet("QWidget#detailView{background:transparent;}");
this->setFixedWidth(360); this->setFixedWidth(378);
//图标和名称、分割线区域 //图标和名称、分割线区域
m_iconLabel = new QLabel(this); m_iconLabel = new QLabel(this);
@ -562,9 +568,7 @@ bool SearchDetailView::addPanelShortcut(const QString& path) {
* @return * @return
*/ */
bool SearchDetailView::openPathAction(const QString& path) { bool SearchDetailView::openPathAction(const QString& path) {
QProcess process; return QDesktopServices::openUrl(QUrl::fromLocalFile(path.left(path.lastIndexOf("/"))));
process.startDetached(QString("xdg-open %1").arg(path.left(path.lastIndexOf("/"))));
return true;
} }
/** /**

View File

@ -44,7 +44,7 @@ public:
int getType(); int getType();
bool isContent = false; bool isContent = false;
void setWebWidget(const QString&); void setWebWidget(const QString&);
void setAppWidget(const QString &name, const QString &path, const QString &icon); void setAppWidget(const QString &name, const QString &path, const QString &icon, const QString &description);
void closeWebWidget(); void closeWebWidget();
protected: protected: