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
|
|
@ -6,6 +6,7 @@
|
|||
#include "QueryExplainModel.h"
|
||||
#include "stopwatch.h"
|
||||
#include "tuplesresultwidget.h"
|
||||
#include "SqlDocument.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <memory>
|
||||
|
|
@ -34,12 +35,9 @@ class PgDatabaseCatalog;
|
|||
class QueryTool : public ManagedPage {
|
||||
Q_OBJECT
|
||||
public:
|
||||
QueryTool(IDatabaseWindow *context, QWidget *parent = nullptr);
|
||||
QueryTool(IDatabaseWindow *context, std::shared_ptr<SqlDocument> document, QWidget *parent = nullptr);
|
||||
~QueryTool() override;
|
||||
|
||||
void newdoc();
|
||||
bool load(const QString &filename);
|
||||
|
||||
void explain(bool analyze);
|
||||
|
||||
bool CanClose(bool prompt_user);
|
||||
|
|
@ -47,12 +45,12 @@ public:
|
|||
void generateCode();
|
||||
void exportDataToFilename(const QString &filename);
|
||||
|
||||
QString fileName() const { return m_fileName; }
|
||||
bool isChanged() const { return m_queryTextChanged; }
|
||||
bool isNew() const { return m_new; }
|
||||
QString fileName() const { return m_document->fileName(); }
|
||||
std::shared_ptr<SqlDocument> document() const { return m_document; }
|
||||
void focusEditor();
|
||||
|
||||
QString title() const;
|
||||
void updateTitle();
|
||||
|
||||
|
||||
public slots:
|
||||
|
|
@ -74,15 +72,12 @@ private:
|
|||
using ResultTabContainer = std::vector<TuplesResultWidget*>;
|
||||
IDatabaseWindow *m_context;
|
||||
Ui::QueryTab *ui;
|
||||
SqlSyntaxHighlighter* highlighter;
|
||||
std::shared_ptr<SqlDocument> m_document;
|
||||
ConnectionConfig m_config;
|
||||
StopWatch m_stopwatch;
|
||||
|
||||
QueryParamListController *m_queryParamListController = nullptr;
|
||||
|
||||
bool m_new = true;
|
||||
QString m_fileName; ///< use setFileName function to set
|
||||
bool m_queryTextChanged = false;
|
||||
|
||||
std::shared_ptr<PgDatabaseCatalog> m_catalog;
|
||||
ASyncDBConnection m_dbConnection;
|
||||
|
|
@ -90,11 +85,6 @@ private:
|
|||
std::unique_ptr<QueryExplainModel> explainModel;
|
||||
ResultTabContainer resultList;
|
||||
|
||||
void setFileName(const QString &filename);
|
||||
bool continueWithoutSavingWarning();
|
||||
bool saveSqlTo(const QString &filename);
|
||||
QString promptUserForSaveSqlFilename();
|
||||
|
||||
void addLog(QString s);
|
||||
|
||||
QString getCommand() const;
|
||||
|
|
@ -102,15 +92,12 @@ private:
|
|||
|
||||
void clearResult();
|
||||
void markError(const Pgsql::ErrorDetails &details);
|
||||
void updateTitle();
|
||||
void setQueryTextChanged(bool queryTextChanged);
|
||||
|
||||
private slots:
|
||||
|
||||
void explain_ready(ExplainRoot::SPtr explain);
|
||||
void query_ready(std::shared_ptr<Pgsql::Result>, qint64 elapsedms);
|
||||
|
||||
void queryTextChanged();
|
||||
void connectionStateChanged();
|
||||
void receiveNotice(Pgsql::ErrorDetails notice);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue