Add Fedora Tools settings module
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "packageutils.h"
|
||||
|
||||
#include <QAbstractListModel>
|
||||
#include <QSet>
|
||||
|
||||
struct Tool
|
||||
{
|
||||
QString packageName;
|
||||
QString version;
|
||||
QString availableVersion;
|
||||
QString architecture;
|
||||
QString summary;
|
||||
bool installed = false;
|
||||
bool available = false;
|
||||
bool updateAvailable = false;
|
||||
};
|
||||
|
||||
class ToolModel : public QAbstractListModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum Role {
|
||||
PackageNameRole = Qt::UserRole + 1,
|
||||
VersionRole,
|
||||
AvailableVersionRole,
|
||||
ArchitectureRole,
|
||||
SummaryRole,
|
||||
InstalledRole,
|
||||
AvailableRole,
|
||||
UpdateAvailableRole,
|
||||
ConfigurableRole,
|
||||
};
|
||||
|
||||
explicit ToolModel(QObject *parent = nullptr);
|
||||
|
||||
int rowCount(const QModelIndex &parent = {}) const override;
|
||||
QVariant data(const QModelIndex &index, int role) const override;
|
||||
QHash<int, QByteArray> roleNames() const override;
|
||||
|
||||
void setPackages(const QList<PackageRecord> &installed,
|
||||
const QList<PackageRecord> &available,
|
||||
const QSet<QString> &updates = {});
|
||||
bool mayInstall(const QString &packageName) const;
|
||||
|
||||
private:
|
||||
QList<Tool> m_tools;
|
||||
};
|
||||
Reference in New Issue
Block a user