DatabaseWindow now provides some functionality to its child components through the IDatabaseWindow interface.
This way children do not need to include the full header to get access to some utility functions for changing the titles and icons of tabpages (and in fact do not need to know that there are tabs, could be something else)
This commit is contained in:
parent
6d4df99100
commit
1a2ec6a224
6 changed files with 84 additions and 135 deletions
|
|
@ -10,6 +10,8 @@
|
|||
#include <QWidget>
|
||||
#include <memory>
|
||||
|
||||
class IDatabaseWindow;
|
||||
|
||||
namespace Ui {
|
||||
class QueryTab;
|
||||
}
|
||||
|
|
@ -33,7 +35,7 @@ class PgDatabaseCatalog;
|
|||
class QueryTool : public QWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
QueryTool(std::shared_ptr<OpenDatabase> open_database, QWidget *parent = nullptr);
|
||||
QueryTool(IDatabaseWindow *context, QWidget *parent = nullptr);
|
||||
~QueryTool() override;
|
||||
|
||||
void newdoc();
|
||||
|
|
@ -51,8 +53,6 @@ public:
|
|||
bool isNew() const { return m_new; }
|
||||
void focusEditor();
|
||||
|
||||
QList<QAction *> actions();
|
||||
|
||||
public slots:
|
||||
void execute();
|
||||
/// Save the document under its current name, a file save dialog will be shown if this is a new document
|
||||
|
|
@ -69,22 +69,12 @@ public slots:
|
|||
private:
|
||||
|
||||
using ResultTabContainer = std::vector<TuplesResultWidget*>;
|
||||
|
||||
IDatabaseWindow *m_context;
|
||||
Ui::QueryTab *ui;
|
||||
SqlSyntaxHighlighter* highlighter;
|
||||
ConnectionConfig m_config;
|
||||
StopWatch m_stopwatch;
|
||||
|
||||
QAction *m_saveSqlAction = nullptr;
|
||||
QAction *m_saveSqlAsAction = nullptr;
|
||||
QAction *m_saveCopyOfSqlAsAction = nullptr;
|
||||
QAction *m_exportDataAction = nullptr;
|
||||
QAction *m_copyQueryAsCStringAction = nullptr;
|
||||
QAction *m_copyQueryAsRawCppStringAction = nullptr;
|
||||
QAction *m_executeAction = nullptr;
|
||||
QAction *m_explainAction = nullptr;
|
||||
QAction *m_analyzeAction = nullptr;
|
||||
|
||||
QueryParamListController *m_queryParamListController = nullptr;
|
||||
|
||||
bool m_new = true;
|
||||
|
|
@ -102,18 +92,13 @@ private:
|
|||
bool saveSqlTo(const QString &filename);
|
||||
QString promptUserForSaveSqlFilename();
|
||||
|
||||
|
||||
|
||||
void addLog(QString s);
|
||||
|
||||
QString getCommand() const;
|
||||
std::string getCommandUtf8() const;
|
||||
|
||||
//QTabWidget *getTabWidget();
|
||||
//void setTabCaption(const QString &caption, const QString &tooltip);
|
||||
void clearResult();
|
||||
void markError(const Pgsql::ErrorDetails &details);
|
||||
void initActions();
|
||||
|
||||
private slots:
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue