Add cell symbol limit preference

This commit is contained in:
Vladislav Tronko
2016-09-03 21:09:26 +03:00
parent b56a26ccf9
commit 11bff0ded8
3 changed files with 40 additions and 2 deletions

View File

@@ -88,6 +88,7 @@ void PreferencesDialog::loadSettings()
loadColorSetting(ui->fr_bin_fg, "bin_fg");
loadColorSetting(ui->fr_bin_bg, "bin_bg");
ui->spinSymbolLimit->setValue(getSettingsValue("databrowser", "symbol_limit").toInt());
ui->txtNull->setText(getSettingsValue("databrowser", "null_text").toString());
ui->editFilterEscape->setText(getSettingsValue("databrowser", "filter_escape").toString());
ui->spinFilterDelay->setValue(getSettingsValue("databrowser", "filter_delay").toInt());
@@ -147,6 +148,7 @@ void PreferencesDialog::saveSettings()
saveColorSetting(ui->fr_reg_bg, "reg_bg");
saveColorSetting(ui->fr_bin_fg, "bin_fg");
saveColorSetting(ui->fr_bin_bg, "bin_bg");
setSettingsValue("databrowser", "symbol_limit", ui->spinSymbolLimit->value());
setSettingsValue("databrowser", "null_text", ui->txtNull->text());
setSettingsValue("databrowser", "filter_escape", ui->editFilterEscape->text());
setSettingsValue("databrowser", "filter_delay", ui->spinFilterDelay->value());
@@ -300,6 +302,8 @@ QVariant PreferencesDialog::getSettingsDefaultValue(const QString& group, const
return QFont().defaultFamily();
if(name == "fontsize")
return 10;
if(name == "symbol_limit")
return 5000;
if(name == "null_text")
return "NULL";
if(name == "filter_escape")

View File

@@ -339,6 +339,38 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_5">
<property name="title">
<string>Content</string>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<widget class="QLabel" name="label_symbol_limit">
<property name="text">
<string>Symbol limit in cell</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="spinSymbolLimit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>1000</number>
</property>
<property name="maximum">
<number>20000</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">

View File

@@ -224,8 +224,10 @@ QVariant SqliteTableModel::data(const QModelIndex &index, int role) const
return PreferencesDialog::getSettingsValue("databrowser", "null_text").toString();
else if(role == Qt::DisplayRole && isBinary(index))
return "BLOB";
else
return decode(m_data.at(index.row()).at(index.column()));
else {
int limit = PreferencesDialog::getSettingsValue("databrowser", "symbol_limit").toInt();
return decode(m_data.at(index.row()).at(index.column()).left(limit));
}
} else if(role == Qt::FontRole) {
QFont font;
if(m_data.at(index.row()).at(index.column()).isNull() || isBinary(index))