Add a checkbox for 'auto-determine spaces or tabs from the previous line'

Merge-request: 1766
Reviewed-by: Thorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com>
This commit is contained in:
Roopesh Chander
2009-10-04 00:26:21 +05:30
committed by Thorbjørn Lindeijer
parent 2a58049e6a
commit ea13309b9a
3 changed files with 101 additions and 47 deletions

View File

@@ -36,6 +36,7 @@
#include <QtGui/QTextDocument>
static const char *spacesForTabsKey = "SpacesForTabs";
static const char *autoSpacesForTabsKey = "AutoSpacesForTabs";
static const char *smartBackspaceKey = "SmartBackspace";
static const char *autoIndentKey = "AutoIndent";
static const char *tabSizeKey = "TabSize";
@@ -65,6 +66,7 @@ void TabSettings::toSettings(const QString &category, QSettings *s) const
group.insert(0, category);
s->beginGroup(group);
s->setValue(QLatin1String(spacesForTabsKey), m_spacesForTabs);
s->setValue(QLatin1String(autoSpacesForTabsKey), m_autoSpacesForTabs);
s->setValue(QLatin1String(autoIndentKey), m_autoIndent);
s->setValue(QLatin1String(smartBackspaceKey), m_smartBackspace);
s->setValue(QLatin1String(tabSizeKey), m_tabSize);
@@ -84,6 +86,7 @@ void TabSettings::fromSettings(const QString &category, const QSettings *s)
*this = TabSettings(); // Assign defaults
m_spacesForTabs = s->value(group + QLatin1String(spacesForTabsKey), m_spacesForTabs).toBool();
m_autoSpacesForTabs = s->value(group + QLatin1String(autoSpacesForTabsKey), m_autoSpacesForTabs).toBool();
m_autoIndent = s->value(group + QLatin1String(autoIndentKey), m_autoIndent).toBool();
m_smartBackspace = s->value(group + QLatin1String(smartBackspaceKey), m_smartBackspace).toBool();
m_tabSize = s->value(group + QLatin1String(tabSizeKey), m_tabSize).toInt();
@@ -316,6 +319,7 @@ void TabSettings::reindentLine(QTextBlock block, int delta) const
bool TabSettings::equals(const TabSettings &ts) const
{
return m_spacesForTabs == ts.m_spacesForTabs
&& m_autoSpacesForTabs == ts.m_autoSpacesForTabs
&& m_autoIndent == ts.m_autoIndent
&& m_smartBackspace == ts.m_smartBackspace
&& m_tabSize == ts.m_tabSize