summaryrefslogtreecommitdiffstats
path: root/kompare/libdialogpages/diffsettings.cpp
blob: 582fb106f631c9d511356d225542ae5e81126511 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/***************************************************************************
				diffsettings.cpp  -  description
				-------------------
	begin			: Sun Mar 4 2001
	copyright		: (C) 2001-2004 Otto Bruggeman
	email			: otto.bruggeman@home.nl
****************************************************************************/

/***************************************************************************
**
**   This program is free software; you can redistribute it and/or modify
**   it under the terms of the GNU General Public License as published by
**   the Free Software Foundation; either version 2 of the License, or
**   (at your option) any later version.
**
****************************************************************************/

#include <tdeconfig.h>

#include "diffsettings.h"

DiffSettings::DiffSettings( TQWidget* parent )
	: SettingsBase( parent ),
	m_linesOfContext( 0 ),
	m_format( Kompare::Unified ),
	m_largeFiles( false ),
	m_ignoreWhiteSpace( false ),
	m_ignoreAllWhiteSpace( false ),
	m_ignoreEmptyLines( false ),
	m_ignoreChangesDueToTabExpansion( false ),
	m_createSmallerDiff( false ),
	m_ignoreChangesInCase( false ),
	m_showCFunctionChange( false ),
	m_convertTabsToSpaces( false ),
	m_ignoreRegExp( false ),
	m_recursive( false ),
	m_newFiles( false ),
	m_excludeFilePattern( false ),
	m_excludeFilesFile( false )
{
}

DiffSettings::~DiffSettings()
{
}

void DiffSettings::loadSettings( TDEConfig* config )
{
	TDEConfigGroup group( config, "Diff Options" );
	m_diffProgram                    = group.readEntry    ( "DiffProgram", "" );
	m_linesOfContext                 = group.readNumEntry ( "LinesOfContext", 3 );
	m_largeFiles                     = group.readBoolEntry( "LargeFiles", true );
	m_ignoreWhiteSpace               = group.readBoolEntry( "IgnoreWhiteSpace", false );
	m_ignoreAllWhiteSpace            = group.readBoolEntry( "IgnoreAllWhiteSpace", false );
	m_ignoreEmptyLines               = group.readBoolEntry( "IgnoreEmptyLines", false );
	m_ignoreChangesDueToTabExpansion = group.readBoolEntry( "IgnoreChangesDueToTabExpansion", false );
	m_ignoreChangesInCase            = group.readBoolEntry( "IgnoreChangesInCase", false );
	m_ignoreRegExp                   = group.readBoolEntry( "IgnoreRegExp", false );
	m_ignoreRegExpText               = group.readEntry    ( "IgnoreRegExpText", "" );
	m_ignoreRegExpTextHistory        = group.readListEntry( "IgnoreRegExpTextHistory" );
	m_createSmallerDiff              = group.readBoolEntry( "CreateSmallerDiff", true );
	m_convertTabsToSpaces            = group.readBoolEntry( "ConvertTabsToSpaces", false );
	m_showCFunctionChange            = group.readBoolEntry( "ShowCFunctionChange", false );
	m_recursive                      = group.readBoolEntry( "CompareRecursively", true );
	m_newFiles                       = group.readBoolEntry( "NewFiles", true );

	m_format = static_cast<Kompare::Format>( group.readNumEntry( "Format", Kompare::Unified ) );

	TDEConfigGroup group2 ( config, "Exclude File Options" );
	m_excludeFilePattern             = group2.readBoolEntry( "Pattern", false );
	m_excludeFilePatternList         = group2.readListEntry( "PatternList" );
	m_excludeFilesFile               = group2.readBoolEntry( "File", false );
	m_excludeFilesFileURL            = group2.readEntry    ( "FileURL", "" );
	m_excludeFilesFileHistoryList    = group2.readListEntry( "FileHistoryList" );
}

void DiffSettings::saveSettings( TDEConfig* config )
{
	TDEConfigGroup group( config, "Diff Options" );
	group.writeEntry( "DiffProgram",                    m_diffProgram );
	group.writeEntry( "LinesOfContext",                 m_linesOfContext );
	group.writeEntry( "Format",                         m_format );
	group.writeEntry( "LargeFiles",                     m_largeFiles );
	group.writeEntry( "IgnoreWhiteSpace",               m_ignoreWhiteSpace );
	group.writeEntry( "IgnoreAllWhiteSpace",            m_ignoreAllWhiteSpace );
	group.writeEntry( "IgnoreEmptyLines",               m_ignoreEmptyLines );
	group.writeEntry( "IgnoreChangesInCase",            m_ignoreChangesInCase );
	group.writeEntry( "IgnoreChangesDueToTabExpansion", m_ignoreChangesDueToTabExpansion );
	group.writeEntry( "IgnoreRegExp",                   m_ignoreRegExp );
	group.writeEntry( "IgnoreRegExpText",               m_ignoreRegExpText );
	group.writeEntry( "IgnoreRegExpTextHistory",        m_ignoreRegExpTextHistory );
	group.writeEntry( "CreateSmallerDiff",              m_createSmallerDiff );
	group.writeEntry( "ConvertTabsToSpaces",            m_convertTabsToSpaces );
	group.writeEntry( "ShowCFunctionChange",            m_showCFunctionChange );
	group.writeEntry( "CompareRecursively",             m_recursive );
	group.writeEntry( "NewFiles",                       m_newFiles );
	group.setDirty( true );

	TDEConfigGroup group2( config, "Exclude File Options" );
	group2.writeEntry( "Pattern",            m_excludeFilePattern );
	group2.writeEntry( "PatternList",        m_excludeFilePatternList );
	group2.writeEntry( "File",               m_excludeFilesFile );
	group2.writeEntry( "FileURL",            m_excludeFilesFileURL );
	group2.writeEntry( "FileHistoryList",    m_excludeFilesFileHistoryList );
	group2.setDirty( true );
}

#include "diffsettings.moc"