megamove
This commit is contained in:
parent
c2e201f813
commit
f51105bde0
114 changed files with 92 additions and 0 deletions
108
src/querytab.h
Normal file
108
src/querytab.h
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
#ifndef QUERYTAB_H
|
||||
#define QUERYTAB_H
|
||||
|
||||
#include "asyncdbconnection.h"
|
||||
#include "ParamListModel.h"
|
||||
#include "ParamTypeDelegate.h"
|
||||
#include "queryresultmodel.h"
|
||||
#include "queryexplainmodel.h"
|
||||
#include "stopwatch.h"
|
||||
#include "tuplesresultwidget.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <memory>
|
||||
|
||||
namespace Ui {
|
||||
class QueryTab;
|
||||
}
|
||||
|
||||
class QTabWidget;
|
||||
class MainWindow;
|
||||
class SqlSyntaxHighlighter;
|
||||
class ExplainRoot;
|
||||
class QueryResultModel;
|
||||
class QueryExplainModel;
|
||||
class PgTypeContainer;
|
||||
|
||||
|
||||
class QueryTab : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QueryTab(MainWindow *win, QWidget *parent = 0);
|
||||
~QueryTab();
|
||||
|
||||
void setConfig(const ConnectionConfig &config);
|
||||
|
||||
void newdoc();
|
||||
// void open();
|
||||
bool load(const QString &filename);
|
||||
void save();
|
||||
void saveAs();
|
||||
void saveCopyAs();
|
||||
|
||||
void execute();
|
||||
void explain(bool analyze);
|
||||
void cancel();
|
||||
|
||||
bool canClose();
|
||||
|
||||
void copyQueryAsCString();
|
||||
void exportData(const QString &filename);
|
||||
private:
|
||||
|
||||
// struct ResultTab {
|
||||
// public:
|
||||
// std::shared_ptr<QueryResultModel> resultModel;
|
||||
// std::shared_ptr<TuplesResultWidget> tuplesResult;
|
||||
//// ResultTab(std::shared_ptr<QueryResultModel> rm, Ui::TuplesResult *tr)
|
||||
//// : resultModel(rm), tuplesResult(tr)
|
||||
//// {}
|
||||
// };
|
||||
using ResultTabContainer = std::vector<TuplesResultWidget*>;
|
||||
|
||||
Ui::QueryTab *ui;
|
||||
MainWindow *m_win;
|
||||
SqlSyntaxHighlighter* highlighter;
|
||||
ConnectionConfig m_config;
|
||||
StopWatch m_stopwatch;
|
||||
ParamListModel m_paramList;
|
||||
ParamTypeDelegate m_typeDelegate;
|
||||
|
||||
QString m_fileName; ///< use setFileName function to set
|
||||
bool m_queryTextChanged = false;
|
||||
|
||||
void setFileName(const QString &filename);
|
||||
bool continueWithoutSavingWarning();
|
||||
bool saveSqlTo(const QString &filename);
|
||||
QString promptUserForSaveSqlFilename();
|
||||
|
||||
|
||||
|
||||
|
||||
ASyncDBConnection m_dbConnection;
|
||||
|
||||
std::unique_ptr<QueryExplainModel> explainModel;
|
||||
ResultTabContainer resultList;
|
||||
|
||||
void addLog(QString s);
|
||||
|
||||
std::string getCommand() const;
|
||||
void explain_ready(ExplainRoot::SPtr explain);
|
||||
void query_ready(std::shared_ptr<Pgsql::Result> dbres, qint64 elapsedms);
|
||||
|
||||
QTabWidget *getTabWidget();
|
||||
void setTabCaption(const QString &caption, const QString &tooltip);
|
||||
void clearResult();
|
||||
|
||||
private slots:
|
||||
|
||||
void queryTextChanged();
|
||||
void connectionStateChanged(ASyncDBConnection::State state);
|
||||
void receiveNotice(Pgsql::ErrorDetails notice);
|
||||
|
||||
void startConnect();
|
||||
};
|
||||
|
||||
#endif // QUERYTAB_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue