Pith - whittle
whittle/src/ui/DiffTableModel.h [1.5 kb]
Modified: 20:17:02 158 026 (24 Aug 026)
5 Days Ago
#pragma once
#include "model/FileRecord.h"
#include <QAbstractTableModel>
#include <QHash>
#include <QList>
#include <QSet>

namespace whittle {

class DiffTableModel : public QAbstractTableModel {
    Q_OBJECT
public:
    enum Column { Name = 0, Size, Modified, TimeDiff, ColumnCount };

    explicit DiffTableModel(bool checkable, QObject* parent = nullptr);

    void setRows(QList<FileRecord> rows, QHash<QString, FileRecord> peer);

    QSet<QString> checkedPaths() const { return m_checked; }
    void setAllChecked(bool on);

    const FileRecord* recordAt(int row) const;

    int missingCount() const;

    void removeRecord(const QString& relPath);
    void removeEntry(const QString& relPath);

    void setSkipped(const QSet<QString>& relPaths);

    int rowCount(const QModelIndex& = {}) const override;
    int columnCount(const QModelIndex& = {}) const override;
    QVariant data(const QModelIndex&, int role) const override;
    QVariant headerData(int, Qt::Orientation, int) const override;
    Qt::ItemFlags flags(const QModelIndex&) const override;
    bool setData(const QModelIndex&, const QVariant&, int role) override;
    void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override;

private:
    void applySort();

    bool m_checkable;
    QList<FileRecord> m_rows;
    QHash<QString, FileRecord> m_peer;
    QSet<QString> m_checked;
    QSet<QString> m_skipped;
    int m_sortColumn = Name;
    Qt::SortOrder m_sortOrder = Qt::AscendingOrder;
};

} 
Updates
Stave - Android 158.026
Kerf - Android 157.026
Kiln - Android 157.026
Wedge - Android 156.026
Whittle - Linux 155.026

Menu
Calendar
Project Tin (024/029)
Miter
RSS Feed
User Avatar
@vgmlr
=SUM(parts)
0.00229
260,539 (+953)