src/ and include/ are what is left: the controller the screens delegate to, its workers and its data model (core/), and the window and entry point that hold them together (app/). With those moved, src/ and include/ are empty and go away — a header is now always next to its source, in a folder named after what it does.
35 lines
856 B
C++
35 lines
856 B
C++
#pragma once
|
|
|
|
#include <QObject>
|
|
#include <QAbstractListModel>
|
|
#include <QVariant>
|
|
#include <vector>
|
|
#include "package-manager.h"
|
|
|
|
class PackageModel : public QAbstractListModel {
|
|
Q_OBJECT
|
|
public:
|
|
enum Roles {
|
|
NameRole = Qt::UserRole + 1,
|
|
VersionRole,
|
|
DescriptionRole,
|
|
RepositoryRole,
|
|
InstalledRole,
|
|
SizeRole,
|
|
UpdateAvailableRole
|
|
};
|
|
|
|
explicit PackageModel(QObject* parent = nullptr);
|
|
|
|
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
|
|
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
|
|
QHash<int, QByteArray> roleNames() const override;
|
|
|
|
void setPackages(const std::vector<PackageInfo>& packages);
|
|
void clear();
|
|
PackageInfo getPackage(int row) const;
|
|
|
|
private:
|
|
std::vector<PackageInfo> m_packages;
|
|
};
|