Make number of rows to prefetch when doing lazy population configuarable

Add a new option to the settings dialog to allow changing the number of
rows to get at a time.
This commit is contained in:
Martin Kleusberg
2013-04-24 20:25:36 +02:00
parent 3d5d7fabe0
commit 7799ef1865
3 changed files with 31 additions and 4 deletions

View File

@@ -43,6 +43,7 @@ void PreferencesDialog::loadSettings()
ui->encodingComboBox->setCurrentIndex(ui->encodingComboBox->findText(getSettingsValue("db", "defaultencoding").toString(), Qt::MatchFixedString));
ui->locationEdit->setText(getSettingsValue("db", "defaultlocation").toString());
ui->foreignKeysCheckBox->setChecked(getSettingsValue("db", "foreignkeys").toBool());
ui->spinPrefetchSize->setValue(getSettingsValue("db", "prefetchsize").toInt());
for(int i=0;i<ui->treeSyntaxHighlighting->topLevelItemCount();i++)
{
@@ -63,6 +64,7 @@ void PreferencesDialog::saveSettings()
setSettingsValue("db", "defaultencoding", ui->encodingComboBox->currentText());
setSettingsValue("db", "defaultlocation", ui->locationEdit->text());
setSettingsValue("db", "foreignkeys", ui->foreignKeysCheckBox->isChecked());
setSettingsValue("db", "prefetchsize", ui->spinPrefetchSize->value());
for(int i=0;i<ui->treeSyntaxHighlighting->topLevelItemCount();i++)
{
@@ -120,6 +122,10 @@ QVariant PreferencesDialog::getSettingsDefaultValue(const QString& group, const
if(group == "db" && name == "foreignkeys")
return true;
// db/prefetchsize?
if(group == "db" && name == "prefetchsize")
return 50000;
// MainWindow/geometry?
if(group == "MainWindow" && name == "geometry")
return "";

View File

@@ -102,6 +102,26 @@
</item>
</layout>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>&amp;Prefetch block size</string>
</property>
<property name="buddy">
<cstring>spinPrefetchSize</cstring>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QSpinBox" name="spinPrefetchSize">
<property name="minimum">
<number>255</number>
</property>
<property name="maximum">
<number>1000000</number>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
@@ -271,6 +291,7 @@
<tabstop>foreignKeysCheckBox</tabstop>
<tabstop>locationEdit</tabstop>
<tabstop>setLocationButton</tabstop>
<tabstop>spinPrefetchSize</tabstop>
<tabstop>treeSyntaxHighlighting</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
@@ -331,8 +352,8 @@
<slot>showColourDialog(QTreeWidgetItem*,int)</slot>
<hints>
<hint type="sourcelabel">
<x>223</x>
<y>92</y>
<x>103</x>
<y>53</y>
</hint>
<hint type="destinationlabel">
<x>395</x>

View File

@@ -1,6 +1,6 @@
#include "sqlitetablemodel.h"
#include "sqlitedb.h"
#include "PreferencesDialog.h"
#include <QDebug>
SqliteTableModel::SqliteTableModel(QObject* parent, DBBrowserDB* db)
@@ -9,7 +9,7 @@ SqliteTableModel::SqliteTableModel(QObject* parent, DBBrowserDB* db)
, m_rowCount(0)
, m_iSortColumn(0)
, m_sSortOrder("ASC")
, m_chunkSize(50000)
, m_chunkSize(PreferencesDialog::getSettingsValue("db", "prefetchsize").toInt())
, m_valid(false)
{
}