From e436cb2516fca0b0a8cc01c90b4d96ebcb39bb30 Mon Sep 17 00:00:00 2001 From: mgrojo Date: Sat, 23 Feb 2019 21:21:25 +0100 Subject: [PATCH] Move query in results panel of Execute SQL to the bottom This gives precedence to the results of the query. It also removes the comment characters that only made sense in the SQL User log. The text is splitted so the texts are only translated once. The output of a multi-query execution is also improved, because the results and line are constant while the query part is quickly changing. After the execution of a multi-query text, the final text is not separated by a blank line so the result message is visible in the second. For users wanting more space in the editor and query table, the results panel is now collapsible, since the SQL Log can be used instead. See issues #1709 and #1670. --- src/MainWindow.cpp | 7 ++++--- src/SqlExecutionArea.cpp | 2 ++ src/SqlExecutionArea.ui | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index bd049f09..72ae84b8 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -1470,9 +1470,10 @@ void MainWindow::executeQuery() // Log the query and the result message. // The query takes the last placeholder as it may itself contain the sequence '%' + number. QString query = editor->text(from_position, to_position); - QString log_message = tr("-- At line %1:\n%3\n-- Result: %2").arg(execute_from_line+1).arg(status_message).arg(query.trimmed()); + QString log_message = QString("-- " + tr("At line %1:") + "\n%3\n-- " + tr("Result: %2")).arg(execute_from_line+1).arg(status_message).arg(query.trimmed()); db.logSQL(log_message, kLogMsg_User); + log_message = QString(tr("Result: %2") + "\n" + tr("At line %1:") + "\n%3").arg(execute_from_line+1).arg(status_message).arg(query.trimmed()); // Update the execution area sqlWidget->finishExecution(log_message, ok); }; @@ -1550,9 +1551,9 @@ void MainWindow::executeQuery() // Show Done message if(sqlWidget->inErrorState()) - sqlWidget->getStatusEdit()->setPlainText(tr("Execution finished with errors.") + "\n\n" + sqlWidget->getStatusEdit()->toPlainText()); + sqlWidget->getStatusEdit()->setPlainText(tr("Execution finished with errors.") + "\n" + sqlWidget->getStatusEdit()->toPlainText()); else - sqlWidget->getStatusEdit()->setPlainText(tr("Execution finished without errors.") + "\n\n" + sqlWidget->getStatusEdit()->toPlainText()); + sqlWidget->getStatusEdit()->setPlainText(tr("Execution finished without errors.") + "\n" + sqlWidget->getStatusEdit()->toPlainText()); }); // Add an hourglass icon to the current tab to indicate that there's a running execution in there. diff --git a/src/SqlExecutionArea.cpp b/src/SqlExecutionArea.cpp index 0a3ed7c7..a97101f7 100644 --- a/src/SqlExecutionArea.cpp +++ b/src/SqlExecutionArea.cpp @@ -37,6 +37,8 @@ SqlExecutionArea::SqlExecutionArea(DBBrowserDB& _db, QWidget* parent) : connect(ui->findLineEdit, SIGNAL(returnPressed()), this, SLOT(findNext())); connect(ui->hideFindButton, SIGNAL(clicked()), this, SLOT(hideFindFrame())); + // Set collapsible the editErrors panel + ui->splitter_2->setCollapsible(1, true); // Load settings reloadSettings(); } diff --git a/src/SqlExecutionArea.ui b/src/SqlExecutionArea.ui index 1435c1ee..97878e02 100644 --- a/src/SqlExecutionArea.ui +++ b/src/SqlExecutionArea.ui @@ -229,7 +229,7 @@ false - Results of the last executed statements + <html><head/><body><p>Results of the last executed statements.</p><p>You may want to collapse this panel and use the <span style=" font-style:italic;">SQL Log</span> dock with <span style=" font-style:italic;">User</span> selection instead.</p></body></html> This field shows the results and status codes of the last executed statements.