|
@@ -56,12 +56,19 @@ void HomeView::initWidgets()
|
|
|
m_search->setPlaceholderText("输入项目名搜索");
|
|
|
m_search->setMinimumWidth(300);
|
|
|
|
|
|
- m_filter = new PushButton("筛选", NEWFLICON(QFDIcon, Filter), this);
|
|
|
- m_filter->setToolTip("筛选项目");
|
|
|
+ m_filter = new PushButton("搜索 / 刷新", NEWFLICON(QFDIcon, Filter), this);
|
|
|
+ m_filter->setToolTip("搜索 / 刷新项目列表");
|
|
|
|
|
|
m_projListWidget = new ProjectListWidget(this);
|
|
|
|
|
|
m_createProjWidget = new CreateProjWidget(this);
|
|
|
+
|
|
|
+ m_totalLab = new QLabel("共123条, 每页20条", this);
|
|
|
+ m_pageLab = new QLabel("第1/12页", this);
|
|
|
+ m_previous = new PushButton("上一页", this);
|
|
|
+ m_next = new PushButton("下一页", this);
|
|
|
+ m_first = new PushButton("首页", this);
|
|
|
+ m_final = new PushButton("末页", this);
|
|
|
}
|
|
|
|
|
|
void HomeView::initLayout()
|
|
@@ -73,6 +80,8 @@ void HomeView::initLayout()
|
|
|
m_topLayout = new QHBoxLayout();
|
|
|
m_layout->addLayout(m_topLayout);
|
|
|
m_layout->addWidget(m_projListWidget);
|
|
|
+ m_pageLayout = new QHBoxLayout();
|
|
|
+ m_layout->addLayout(m_pageLayout);
|
|
|
|
|
|
// 顶部布局
|
|
|
m_topLayout->addWidget(m_title);
|
|
@@ -82,12 +91,22 @@ void HomeView::initLayout()
|
|
|
m_topLayout->addWidget(m_search, 0, Qt::AlignLeft);
|
|
|
m_topLayout->addStretch();
|
|
|
m_topLayout->addWidget(m_filter);
|
|
|
+
|
|
|
+ m_pageLayout->addWidget(m_totalLab);
|
|
|
+ m_pageLayout->addStretch();
|
|
|
+ m_pageLayout->addWidget(m_first);
|
|
|
+ m_pageLayout->addWidget(m_previous);
|
|
|
+ m_pageLayout->addWidget(m_pageLab);
|
|
|
+ m_pageLayout->addWidget(m_next);
|
|
|
+ m_pageLayout->addWidget(m_final);
|
|
|
+ m_pageLayout->addStretch();
|
|
|
}
|
|
|
|
|
|
void HomeView::connectSignalsAndSlots()
|
|
|
{
|
|
|
connect(m_create, &PushButton::clicked, this, &HomeView::slotCreateProjClicked);
|
|
|
connect(m_search, &LineEdit::textChanged, this, &HomeView::slotSearchTextChanged);
|
|
|
+ connect(m_filter, &PushButton::clicked, this, &HomeView::slotFilterClicked);
|
|
|
connect(m_createProjWidget, &CreateProjWidget::signalConfirm, this, &HomeView::slotProjInfoConfirmed);
|
|
|
connect(m_projListWidget, &ProjectListWidget::sigOpen, this, &HomeView::slotOpenProject);
|
|
|
connect(m_projListWidget, &ProjectListWidget::sigInfo, this, &HomeView::slotProjectInfo);
|
|
@@ -105,14 +124,19 @@ void HomeView::loadProjects()
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- m_projListWidget->setProjects(searchResult());
|
|
|
+ m_projListWidget->setProjects(filterResult());
|
|
|
}
|
|
|
|
|
|
-QList<ProjectInfo *> HomeView::searchResult() const
|
|
|
+QList<ProjectInfo *> HomeView::filterResult() const
|
|
|
{
|
|
|
QList<ProjectInfo *> list;
|
|
|
for (ProjectInfo *proj : m_projList) {
|
|
|
- if (proj->projectName.contains(m_search->text())) {
|
|
|
+ bool search = proj->projectName.contains(m_search->text());
|
|
|
+ QList<ProjectManager::EvalType> types = ProjectManager::evalTypeList(*proj);
|
|
|
+ bool typeValid = types.contains(ProjectManager::Requirements)
|
|
|
+ | types.contains(ProjectManager::SchemeOptimization)
|
|
|
+ | types.contains(ProjectManager::OverallEfficiency);
|
|
|
+ if (search && typeValid) {
|
|
|
list.append(proj);
|
|
|
}
|
|
|
}
|
|
@@ -130,7 +154,12 @@ void HomeView::slotCreateProjClicked()
|
|
|
|
|
|
void HomeView::slotSearchTextChanged()
|
|
|
{
|
|
|
- m_projListWidget->setProjects(searchResult());
|
|
|
+ m_projListWidget->setProjects(filterResult());
|
|
|
+}
|
|
|
+
|
|
|
+void HomeView::slotFilterClicked()
|
|
|
+{
|
|
|
+ qDebug() << __FUNCTION__ << __LINE__ << endl;
|
|
|
}
|
|
|
|
|
|
/// @todo 修改或者新建项目后, 列表移到该条目
|