OmaPhoto 1.0.0: the Linux port of Compositor
A layered image editor for Linux and Omarchy, ported from Compositor (github.com/robbietilton/Compositor), whose Swift source is its specification. It reads and writes Compositor's .comp projects. Packages for Ubuntu, Fedora and Arch come from the release workflow; scripts/install/ holds one install script per distribution family, and flake.nix serves NixOS. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
commit
c864304695
564 files changed
+100804
No files matched your search
@@ -0,0 +1,55 @@
|
||||
#pragma once
|
||||
#include "Document/EditorSession+Model.h"
|
||||
#include <QString>
|
||||
#include <QUuid>
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
|
||||
// Snapshots share image data; layer edits copy no pixels.
|
||||
class DocumentHistory {
|
||||
public:
|
||||
struct Snapshot {
|
||||
std::optional<CanvasDocument> document;
|
||||
std::optional<QUuid> activeLayerID;
|
||||
QUuid revision;
|
||||
};
|
||||
|
||||
const int entryLimit;
|
||||
const qint64 retainedByteLimit;
|
||||
|
||||
explicit DocumentHistory(int entryLimit = 100, qint64 retainedByteLimit = 256LL * 1024 * 1024);
|
||||
|
||||
bool canUndo() const { return m_depth == 0 && !m_past.empty(); }
|
||||
bool canRedo() const { return m_depth == 0 && !m_future.empty(); }
|
||||
QString undoName() const { return m_past.empty() ? QString() : m_past.back().name; }
|
||||
QString redoName() const { return m_future.empty() ? QString() : m_future.back().name; }
|
||||
bool isModified() const { return m_revision != m_savedRevision; }
|
||||
int undoCount() const { return int(m_past.size()); }
|
||||
void markSaved() { m_savedRevision = m_revision; }
|
||||
void reset();
|
||||
// Takes the steps a staged copy of this history recorded.
|
||||
void adopt(DocumentHistory &&staged) noexcept;
|
||||
|
||||
void begin(const QString &name, const std::optional<CanvasDocument> &document, std::optional<QUuid> selection);
|
||||
void end(const std::optional<CanvasDocument> &document, std::optional<QUuid> selection);
|
||||
std::optional<Snapshot> undo();
|
||||
std::optional<Snapshot> redo();
|
||||
qint64 retainedBytes(const std::optional<CanvasDocument> ¤t) const;
|
||||
|
||||
private:
|
||||
struct Entry {
|
||||
QString name;
|
||||
Snapshot before;
|
||||
Snapshot after;
|
||||
};
|
||||
|
||||
void trim(const std::optional<CanvasDocument> ¤t);
|
||||
|
||||
std::vector<Entry> m_past;
|
||||
std::vector<Entry> m_future;
|
||||
QUuid m_revision = QUuid::createUuid();
|
||||
QUuid m_savedRevision = m_revision;
|
||||
std::optional<Snapshot> m_pending;
|
||||
QString m_pendingName = QStringLiteral("Edit");
|
||||
int m_depth = 0;
|
||||
};
|
||||
Reference in new issue
Block a user