geopro/src/app/ProjectListDialog.hpp

46 lines
1.1 KiB
C++

#pragma once
#include <QDialog>
#include <QPointer>
#include "repo/IAsyncProjectRepository.hpp"
class QLineEdit;
class QComboBox;
class QTableWidget;
class QLabel;
class QPushButton;
namespace geopro::data { class NavRequest; }
namespace geopro::app {
// 项目列表弹窗:名称/类型过滤 + 分页表格;点项目名 → 切换项目并关闭。
class ProjectListDialog : public QDialog {
Q_OBJECT
public:
explicit ProjectListDialog(data::IAsyncProjectRepository& repo, QWidget* parent = nullptr);
~ProjectListDialog() override;
signals:
void projectChosen(const QString& projectId, const QString& projectName);
private:
void query();
void fillTypeFilter();
data::IAsyncProjectRepository& repo_;
QPointer<data::NavRequest> typesReq_;
QPointer<data::NavRequest> queryReq_;
QLineEdit* nameEdit_ = nullptr;
QComboBox* typeCombo_ = nullptr;
QTableWidget* table_ = nullptr;
QLabel* pageLabel_ = nullptr;
QPushButton* prevBtn_ = nullptr;
QPushButton* nextBtn_ = nullptr;
int pageNo_ = 1;
int pageSize_ = 20;
int total_ = 0;
};
} // namespace geopro::app