8#include "diffsettings.h"
12#include <KConfigGroup>
19DiffSettings::DiffSettings()
23 , m_ignoreWhiteSpace(false)
24 , m_ignoreAllWhiteSpace(false)
25 , m_ignoreEmptyLines(false)
26 , m_ignoreChangesDueToTabExpansion(false)
27 , m_createSmallerDiff(false)
28 , m_ignoreChangesInCase(false)
29 , m_showCFunctionChange(false)
30 , m_convertTabsToSpaces(false)
31 , m_ignoreRegExp(false)
34 , m_excludeFilePattern(false)
35 , m_excludeFilesFile(false)
39DiffSettings::~DiffSettings() =
default;
41void DiffSettings::loadSettings(
KConfig *config)
43 KConfigGroup group(config, QStringLiteral(
"Diff Options"));
45 m_diffProgram = group.readEntry(
"DiffProgram",
QString());
46 m_linesOfContext = group.readEntry(
"LinesOfContext", 3);
47 m_largeFiles = group.readEntry(
"LargeFiles",
true);
48 m_ignoreWhiteSpace = group.readEntry(
"IgnoreWhiteSpace",
false);
49 m_ignoreAllWhiteSpace = group.readEntry(
"IgnoreAllWhiteSpace",
false);
50 m_ignoreEmptyLines = group.readEntry(
"IgnoreEmptyLines",
false);
51 m_ignoreChangesDueToTabExpansion = group.readEntry(
"IgnoreChangesDueToTabExpansion",
false);
52 m_ignoreChangesInCase = group.readEntry(
"IgnoreChangesInCase",
false);
53 m_ignoreRegExp = group.readEntry(
"IgnoreRegExp",
false);
54 m_ignoreRegExpText = group.readEntry(
"IgnoreRegExpText",
QString());
55 m_ignoreRegExpTextHistory = group.readEntry(
"IgnoreRegExpTextHistory",
QStringList());
56 m_createSmallerDiff = group.readEntry(
"CreateSmallerDiff",
true);
57 m_convertTabsToSpaces = group.readEntry(
"ConvertTabsToSpaces",
false);
58 m_showCFunctionChange = group.readEntry(
"ShowCFunctionChange",
false);
59 m_recursive = group.readEntry(
"CompareRecursively",
true);
60 m_newFiles = group.readEntry(
"NewFiles",
true);
63 m_format =
static_cast<Format
>(group.readEntry(
"Format",
static_cast<int>(Unified)));
65 KConfigGroup group2(config, QStringLiteral(
"Exclude File Options"));
67 m_excludeFilePattern = group2.readEntry(
"Pattern",
false);
68 m_excludeFilePatternList = group2.readEntry(
"PatternList",
QStringList());
69 m_excludeFilesFile = group2.readEntry(
"File",
false);
70 m_excludeFilesFileURL = group2.readEntry(
"FileURL",
QString());
71 m_excludeFilesFileHistoryList = group2.readEntry(
"FileHistoryList",
QStringList());
75void DiffSettings::saveSettings(
KConfig *config)
77 KConfigGroup group(config, QStringLiteral(
"Diff Options"));
79 group.writeEntry(
"DiffProgram", m_diffProgram);
80 group.writeEntry(
"LinesOfContext", m_linesOfContext);
81 group.writeEntry(
"Format", (
int)m_format);
82 group.writeEntry(
"LargeFiles", m_largeFiles);
83 group.writeEntry(
"IgnoreWhiteSpace", m_ignoreWhiteSpace);
84 group.writeEntry(
"IgnoreAllWhiteSpace", m_ignoreAllWhiteSpace);
85 group.writeEntry(
"IgnoreEmptyLines", m_ignoreEmptyLines);
86 group.writeEntry(
"IgnoreChangesInCase", m_ignoreChangesInCase);
87 group.writeEntry(
"IgnoreChangesDueToTabExpansion", m_ignoreChangesDueToTabExpansion);
88 group.writeEntry(
"IgnoreRegExp", m_ignoreRegExp);
89 group.writeEntry(
"IgnoreRegExpText", m_ignoreRegExpText);
90 group.writeEntry(
"IgnoreRegExpTextHistory", m_ignoreRegExpTextHistory);
91 group.writeEntry(
"CreateSmallerDiff", m_createSmallerDiff);
92 group.writeEntry(
"ConvertTabsToSpaces", m_convertTabsToSpaces);
93 group.writeEntry(
"ShowCFunctionChange", m_showCFunctionChange);
94 group.writeEntry(
"CompareRecursively", m_recursive);
95 group.writeEntry(
"NewFiles", m_newFiles);
98 KConfigGroup group2(config, QStringLiteral(
"Exclude File Options"));
100 group2.writeEntry(
"Pattern", m_excludeFilePattern);
101 group2.writeEntry(
"PatternList", m_excludeFilePatternList);
102 group2.writeEntry(
"File", m_excludeFilesFile);
103 group2.writeEntry(
"FileURL", m_excludeFilesFileURL);
104 group2.writeEntry(
"FileHistoryList", m_excludeFilesFileHistoryList);