Show UnsavedDocumentsDialog when closing window or quitting application
so user can save and or discard docs more efficiently.
This commit is contained in:
parent
b97adced4c
commit
784ad68758
16 changed files with 544 additions and 164 deletions
27
pglab/querytool/SqlDocumentRegistry.h
Normal file
27
pglab/querytool/SqlDocumentRegistry.h
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#ifndef SQLDOCUMENTREGISTRY_H
|
||||
#define SQLDOCUMENTREGISTRY_H
|
||||
|
||||
#include <QList>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
class SqlDocument;
|
||||
|
||||
/** Keeps track of all SQL documents that are still in use, without
|
||||
* extending their lifetime. A document lives as long as at least one
|
||||
* query tool holds a shared pointer to it.
|
||||
*/
|
||||
class SqlDocumentRegistry {
|
||||
public:
|
||||
void add(const std::shared_ptr<SqlDocument> &document);
|
||||
|
||||
/// All documents that are still alive.
|
||||
QList<std::shared_ptr<SqlDocument>> documents() const;
|
||||
/// All documents that are alive and have unsaved changes.
|
||||
QList<std::shared_ptr<SqlDocument>> modifiedDocuments() const;
|
||||
|
||||
private:
|
||||
std::vector<std::weak_ptr<SqlDocument>> m_documents;
|
||||
};
|
||||
|
||||
#endif // SQLDOCUMENTREGISTRY_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue