FOSSredder 0.5.0
Loading...
Searching...
No Matches
CloseWorkflow.h
Go to the documentation of this file.
1
5
6#pragma once
7
8#include <functional>
9
10#include <QString>
11
12class QCloseEvent;
13
14namespace ui::window {
15
20public:
26 bool allowImmediateClose(QCloseEvent* event);
27
33 void requestClose(QCloseEvent* event,
34 const std::function<void()>& requestSave);
35
43 bool
44 handleStorageOperationSucceeded(const QString& operation,
45 const QString& saveOperation,
46 const std::function<void()>& closeWindow);
47
54 bool handleStorageOperationFailed(const QString& operation,
55 const QString& saveOperation);
56
57private:
58 bool pendingCloseAfterSave_ = false;
59 bool allowImmediateClose_ = false;
60};
61
62} // namespace ui::window
Coordinates close requests that may need a pending workspace save.
void requestClose(QCloseEvent *event, const std::function< void()> &requestSave)
Defers closing and invokes the supplied save request.
bool allowImmediateClose(QCloseEvent *event)
Accepts a close event when a deferred close is already authorized.
bool handleStorageOperationSucceeded(const QString &operation, const QString &saveOperation, const std::function< void()> &closeWindow)
Completes a deferred close after the matching save succeeded.
bool handleStorageOperationFailed(const QString &operation, const QString &saveOperation)
Cancels a deferred close after the matching save failed.