app/core/ProfileLease.h
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include <QString> | ||
| 4 | #include <memory> | ||
| 5 | |||
| 6 | class QLockFile; | ||
| 7 | |||
| 8 | // Both frontend entrypoints acquire this before loading accounts or databases. | ||
| 9 | // Keep the lease alive until the session and all profile workers are destroyed. | ||
| 10 | class ProfileLease final { | ||
| 11 | public: | ||
| 12 | ProfileLease(); | ||
| 13 | ~ProfileLease(); | ||
| 14 | bool acquire(const QString &directory); | ||
| 15 | 11 | QString directory() const { return m_directory; } | |
| 16 | 6 | QString error() const { return m_error; } | |
| 17 | static QString defaultDirectory(); | ||
| 18 | |||
| 19 | private: | ||
| 20 | std::unique_ptr<QLockFile> m_lock; | ||
| 21 | QString m_directory; | ||
| 22 | QString m_error; | ||
| 23 | }; | ||
| 24 |