mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-12-13 12:22:05 +08:00
加入应用列表的翻页功能
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QScrollArea>
|
||||
#include <QList>
|
||||
#include <QtWidgets>
|
||||
#include "spkresource.h"
|
||||
#include "spkappitem.h"
|
||||
#include "page/spkpagebase.h"
|
||||
@@ -19,20 +18,40 @@ 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 SetCurrentCategory(int categoryId) { mCategoryId = categoryId; }
|
||||
|
||||
private:
|
||||
void DisablePageSwitchers();
|
||||
|
||||
public:
|
||||
|
||||
private:
|
||||
QVBoxLayout *mMainLay;
|
||||
QHBoxLayout *mPageSwitchLay;
|
||||
QPushButton *mBtnPgUp, *mBtnPgDown, *mBtnGotoPage;
|
||||
QLineEdit *mPageInput;
|
||||
QScrollArea *mAppsArea;
|
||||
QLabel *mPageIndicator;
|
||||
QWidget *mAppsWidget, *mPageSwitchWidget;
|
||||
SpkStretchLayout *mItemLay;
|
||||
QList<SpkAppItem *> mAppItemList;
|
||||
|
||||
QIntValidator *mPageValidator;
|
||||
|
||||
int mCategoryId, mCurrentPage;
|
||||
|
||||
signals:
|
||||
void ApplicationClicked(QString name, QString pkgName);
|
||||
void SwitchListPage(int categoryId, int page);
|
||||
|
||||
public slots:
|
||||
void ResourceAcquisitionFinished(int id, ResourceResult result);
|
||||
void Activated();
|
||||
|
||||
private slots:
|
||||
void PageUp();
|
||||
void PageDown();
|
||||
void GotoPage();
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QScrollArea>
|
||||
#include <QtWidgets>
|
||||
#include <spkresource.h>
|
||||
|
||||
class SpkPageBase : public QScrollArea
|
||||
class SpkPageBase : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
@@ -99,7 +99,7 @@ namespace SpkUi
|
||||
}
|
||||
mLastSelectedItem = item;
|
||||
if(item->data(column, RoleItemIsCategory).toBool())
|
||||
emit SwitchToCategory(item->data(column, RoleItemCategoryPageId).toInt());
|
||||
emit SwitchToCategory(item->data(column, RoleItemCategoryPageId).toInt(), 0);
|
||||
else
|
||||
emit SwitchToPage(item->data(column, RoleItemCategoryPageId).toInt());
|
||||
}
|
||||
@@ -117,7 +117,7 @@ namespace SpkUi
|
||||
}
|
||||
|
||||
signals:
|
||||
void SwitchToCategory(int aCategoryId);
|
||||
void SwitchToCategory(int aCategoryId, int aPage);
|
||||
void SwitchToPage(int aPageId);
|
||||
};
|
||||
|
||||
@@ -179,7 +179,7 @@ class SpkMainWindow : public SpkWindow
|
||||
|
||||
void CategoryDataReceived();
|
||||
|
||||
void EnterCategoryList(int id);
|
||||
void EnterCategoryList(int aCategoryId, int aPage);
|
||||
void CategoryListDataReceived();
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user