mirror of
https://github.com/clementine-player/Clementine
synced 2025-01-10 17:13:39 +01:00
console: Refactor console dialog to use tabs
This commit is contained in:
parent
a4e8d57de0
commit
e3fa03e101
@ -12,21 +12,21 @@
|
||||
Console::Console(Application* app, QWidget* parent)
|
||||
: QDialog(parent), app_(app) {
|
||||
ui_.setupUi(this);
|
||||
connect(ui_.run, SIGNAL(clicked()), SLOT(RunQuery()));
|
||||
connect(ui_.database_run, SIGNAL(clicked()), SLOT(RunQuery()));
|
||||
|
||||
QFont font("Monospace");
|
||||
font.setStyleHint(QFont::TypeWriter);
|
||||
|
||||
ui_.output->setFont(font);
|
||||
ui_.query->setFont(font);
|
||||
ui_.database_output->setFont(font);
|
||||
ui_.database_query->setFont(font);
|
||||
}
|
||||
|
||||
void Console::RunQuery() {
|
||||
QSqlDatabase db = app_->database()->Connect();
|
||||
QSqlQuery query = db.exec(ui_.query->text());
|
||||
ui_.query->clear();
|
||||
QSqlQuery query = db.exec(ui_.database_query->text());
|
||||
ui_.database_query->clear();
|
||||
|
||||
ui_.output->append("<b>> " + query.executedQuery() + "</b>");
|
||||
ui_.database_output->append("<b>> " + query.executedQuery() + "</b>");
|
||||
|
||||
query.next();
|
||||
|
||||
@ -37,11 +37,11 @@ void Console::RunQuery() {
|
||||
values.append(record.value(i).toString());
|
||||
}
|
||||
|
||||
ui_.output->append(values.join("|"));
|
||||
ui_.database_output->append(values.join("|"));
|
||||
|
||||
query.next();
|
||||
}
|
||||
|
||||
ui_.output->verticalScrollBar()->setValue(
|
||||
ui_.output->verticalScrollBar()->maximum());
|
||||
ui_.database_output->verticalScrollBar()->setValue(
|
||||
ui_.database_output->verticalScrollBar()->maximum());
|
||||
}
|
||||
|
@ -13,35 +13,45 @@
|
||||
<property name="windowTitle">
|
||||
<string>Console</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QTextBrowser" name="output"/>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="database_tab">
|
||||
<attribute name="title">
|
||||
<string>Database</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="query"/>
|
||||
<widget class="QTextBrowser" name="database_output"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="run">
|
||||
<property name="text">
|
||||
<string>Run</string>
|
||||
<widget class="QGroupBox" name="database_command_group">
|
||||
<property name="title">
|
||||
<string>Command</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="database_query"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="database_run">
|
||||
<property name="text">
|
||||
<string>Run</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>query</tabstop>
|
||||
<tabstop>run</tabstop>
|
||||
<tabstop>output</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
Loading…
Reference in New Issue
Block a user