Miscellaneous changes. Including a copy action.

This commit is contained in:
Eelke Klein 2017-02-04 11:55:49 +01:00
parent 242f5464df
commit 4a2c6cc396
19 changed files with 147 additions and 43 deletions

View file

@ -15,6 +15,7 @@
#include <querytab.h>
#include "util.h"
#include "MasterController.h"
#include "OpenDatabase.h"
namespace pg = Pgsql;
@ -25,8 +26,9 @@ MainWindow::MainWindow(MasterController *master, QWidget *parent)
, m_masterController(master)
{
ui->setupUi(this);
ui->tabWidget->setDocumentMode(true);
//ui->tabWidget->setTabsClosable(true);
}
@ -55,6 +57,10 @@ QueryTab *MainWindow::GetActiveQueryTab()
void MainWindow::setConfig(const ConnectionConfig &config)
{
m_config = config;
auto res = OpenDatabase::createOpenDatabase(config);
if (res.valid()) {
m_database = res.get();
}
QString title = "pglab - ";
title += m_config.name().c_str();
setWindowTitle(title);
@ -140,7 +146,8 @@ void MainWindow::on_actionAbout_triggered()
" INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS "
"FOR A PARTICULAR PURPOSE.\n"
"\n"
"This program is dynamically linked with Qt 5.7 Copyright (C) 2016 The Qt Company Ltd. https://www.qt.io/licensing/. \n"
"This program is dynamically linked with Qt 5.8 Copyright (C) 2016 "
"The Qt Company Ltd. https://www.qt.io/licensing/. \n"
"\n"
"Icons by fatcow http://www.fatcow.com/free-icons provided under Creative Commons "
"attribution 3.0 license\n"
@ -252,3 +259,15 @@ void MainWindow::on_actionShow_connection_manager_triggered()
{
m_masterController->showConnectionManager();
}
void MainWindow::on_actionCopy_triggered()
{
// What should be copied?
QWidget *w = QApplication::focusWidget();
QTableView *tv = dynamic_cast<QTableView*>(w);
if (tv) {
copySelectionToClipboard(tv);
}
//this->ui->
}