The querytab now shows the elapsed time of the query using the new stopwatch class.

The old elapsedtime code from the mainwindow has been removed.
This commit is contained in:
Eelke Klein 2017-01-22 08:50:41 +01:00
parent 7f379f3b80
commit 6e852f466f
7 changed files with 232 additions and 163 deletions

View file

@ -2,8 +2,9 @@
#define QUERYTAB_H
#include "asyncdbconnection.h"
#include "QueryResultModel.h"
#include "QueryExplainModel.h"
#include "queryresultmodel.h"
#include "queryexplainmodel.h"
#include "stopwatch.h"
#include <QWidget>
#include <memory>
@ -29,7 +30,9 @@ public:
void setConfig(const ConnectionConfig &config);
void open();
void newdoc();
// void open();
bool load(const QString &filename);
void save();
void saveAs();
void saveCopyAs();
@ -37,18 +40,21 @@ public:
void execute();
void explainAnalyze();
void cancel();
bool canClose();
private:
Ui::QueryTab *ui;
MainWindow *m_win;
std::unique_ptr<SqlHighlighter> highlighter;
ConnectionConfig m_config;
StopWatch m_stopwatch;
QString m_fileName; ///< use setFileName function to set
bool m_queryTextChanged = false;
void setFileName(const QString &filename);
bool continueWithoutSavingWarning();
void saveSqlTo(const QString &filename);
bool saveSqlTo(const QString &filename);
QString promptUserForSaveSqlFilename();
@ -61,6 +67,9 @@ private:
std::string getCommand() const;
void explain_ready(ExplainRoot::SPtr explain);
void query_ready(std::shared_ptr<Pgsql::Result> dbres);
void setTabCaption(const QString &caption);
void clearResult();
private slots:
void queryTextChanged();