mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 02:50:46 -06:00
Add default field type preference
- resolves sqlitebrowser/sqlitebrowser#650
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "EditTableDialog.h"
|
||||
#include "PreferencesDialog.h"
|
||||
#include "ui_EditTableDialog.h"
|
||||
#include "sqlitetablemodel.h"
|
||||
#include "sqlitedb.h"
|
||||
@@ -453,6 +454,14 @@ void EditTableDialog::addField()
|
||||
typeBox->setProperty("column", tbitem->text(kName));
|
||||
typeBox->setEditable(true);
|
||||
typeBox->addItems(sqlb::Field::Datatypes);
|
||||
|
||||
int defaultFieldTypeIndex = PreferencesDialog::getSettingsValue("db", "defaultfieldtype").toInt();
|
||||
|
||||
if (defaultFieldTypeIndex < sqlb::Field::Datatypes.count())
|
||||
{
|
||||
typeBox->setCurrentIndex(defaultFieldTypeIndex);
|
||||
}
|
||||
|
||||
ui->treeWidget->setItemWidget(tbitem, kType, typeBox);
|
||||
connect(typeBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateTypes()));
|
||||
//connect(typeBox, SIGNAL(editTextChanged(QString)), this, SLOT(updateTypes()));
|
||||
|
||||
@@ -65,6 +65,15 @@ void PreferencesDialog::loadSettings()
|
||||
ui->spinPrefetchSize->setValue(getSettingsValue("db", "prefetchsize").toInt());
|
||||
ui->editDatabaseDefaultSqlText->setText(getSettingsValue("db", "defaultsqltext").toString());
|
||||
|
||||
ui->defaultFieldTypeComboBox->addItems(sqlb::Field::Datatypes);
|
||||
|
||||
int defaultFieldTypeIndex = getSettingsValue("db", "defaultfieldtype").toInt();
|
||||
|
||||
if (defaultFieldTypeIndex < sqlb::Field::Datatypes.count())
|
||||
{
|
||||
ui->defaultFieldTypeComboBox->setCurrentIndex(defaultFieldTypeIndex);
|
||||
}
|
||||
|
||||
ui->comboDataBrowserFont->setCurrentIndex(ui->comboEditorFont->findText(getSettingsValue("databrowser", "font").toString()));
|
||||
ui->spinDataBrowserFontSize->setValue(getSettingsValue("databrowser", "fontsize").toInt());
|
||||
loadColorSetting(ui->fr_null_fg, "null_fg");
|
||||
@@ -115,6 +124,8 @@ void PreferencesDialog::saveSettings()
|
||||
setSettingsValue("db", "prefetchsize", ui->spinPrefetchSize->value());
|
||||
setSettingsValue("db", "defaultsqltext", ui->editDatabaseDefaultSqlText->text());
|
||||
|
||||
setSettingsValue("db", "defaultfieldtype", ui->defaultFieldTypeComboBox->currentIndex());
|
||||
|
||||
setSettingsValue("checkversion", "enabled", ui->checkUpdates->isChecked());
|
||||
|
||||
setSettingsValue("databrowser", "font", ui->comboDataBrowserFont->currentText());
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>590</width>
|
||||
<height>532</height>
|
||||
<height>555</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -232,7 +232,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<item row="5" column="1">
|
||||
<widget class="QPushButton" name="buttonDatabaseAdvanced">
|
||||
<property name="text">
|
||||
<string>Advanced</string>
|
||||
@@ -246,7 +246,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<item row="7" column="1">
|
||||
<widget class="SqlTextEdit" name="editDatabaseDefaultSqlText">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@@ -262,7 +262,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="labelDatabaseDefaultSqlText">
|
||||
<property name="text">
|
||||
<string>SQL to execute after opening database</string>
|
||||
@@ -272,7 +272,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<item row="8" column="1">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@@ -285,6 +285,16 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QComboBox" name="defaultFieldTypeComboBox"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="defaultFieldTypeLabel">
|
||||
<property name="text">
|
||||
<string>Default field type</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_5">
|
||||
|
||||
Reference in New Issue
Block a user