mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-12-13 12:22:05 +08:00
加入应用列表的搜索功能
This commit is contained in:
@@ -18,7 +18,7 @@ namespace SpkUi
|
||||
void AddApplicationEntry(QString name, QString pkgName, QString description, QString iconUrl,
|
||||
int appId);
|
||||
void ClearAll();
|
||||
void SetPageStatus(int total, int current, int itemCount);
|
||||
void SetPageStatus(int total, int current, int itemCount, QString &keyword);
|
||||
void SetCurrentCategory(int categoryId) { mCategoryId = categoryId; }
|
||||
|
||||
private:
|
||||
@@ -40,10 +40,12 @@ namespace SpkUi
|
||||
QIntValidator *mPageValidator;
|
||||
|
||||
int mCategoryId, mCurrentPage;
|
||||
QString mKeyword;
|
||||
|
||||
signals:
|
||||
void ApplicationClicked(QString name, QString pkgName);
|
||||
void SwitchListPage(int categoryId, int page);
|
||||
void SwitchSearchPage(QString keyword, int page);
|
||||
|
||||
public slots:
|
||||
void ResourceAcquisitionFinished(int id, ResourceResult result);
|
||||
|
||||
19
inc/spkfocuslineedit.h
Normal file
19
inc/spkfocuslineedit.h
Normal file
@@ -0,0 +1,19 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QtWidgets/QLineEdit>
|
||||
|
||||
class SpkFocusLineEdit final : public QLineEdit
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit SpkFocusLineEdit(QWidget *parent = nullptr) : QLineEdit(parent) {}
|
||||
|
||||
protected:
|
||||
void focusInEvent(QFocusEvent *e) override { emit focusGained(); }
|
||||
void focusOutEvent(QFocusEvent *e) override { emit focusLost(); }
|
||||
|
||||
signals:
|
||||
void focusGained();
|
||||
void focusLost();
|
||||
};
|
||||
@@ -12,8 +12,10 @@
|
||||
#include <QJsonObject>
|
||||
#include "spksidebartree.h" // In place of #include <QTreeWidget>
|
||||
#include <QPointer>
|
||||
#include "inc/page/spkpageuitest.h"
|
||||
#include "inc/page/spkpageapplist.h"
|
||||
#include <QTimeLine>
|
||||
#include "spkfocuslineedit.h"
|
||||
#include "page/spkpageuitest.h"
|
||||
#include "page/spkpageapplist.h"
|
||||
|
||||
class QNetworkReply;
|
||||
|
||||
@@ -146,6 +148,11 @@ namespace SpkUi
|
||||
|
||||
QTreeWidgetItem *CategoryParentItem;
|
||||
|
||||
// Title bar search bar
|
||||
SpkFocusLineEdit *SearchEdit;
|
||||
QAction *ActClearSearchBar, *ActSearchIcon;
|
||||
QTimeLine *SearchBarAnim;
|
||||
|
||||
//Pages
|
||||
SpkPageUiTest *PageQssTest;
|
||||
SpkPageAppList *PageAppList;
|
||||
@@ -178,10 +185,13 @@ class SpkMainWindow : public SpkWindow
|
||||
void SwitchToPage(SpkUi::SpkStackedPages page);
|
||||
|
||||
void CategoryDataReceived();
|
||||
|
||||
// Enter a category (and switch pages)
|
||||
void EnterCategoryList(int aCategoryId, int aPage);
|
||||
void CategoryListDataReceived();
|
||||
// Search a keyword (and switch pages)
|
||||
void SearchKeyword(QString aKeyword, int aPage);
|
||||
void SearchDataReceived();
|
||||
|
||||
private:
|
||||
void PopulateAppList(QJsonObject appData);
|
||||
void PopulateAppList(QJsonObject appData, QString &&keyword);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user