summaryrefslogtreecommitdiffstats
path: root/parts/fileview/vcscolorsconfigwidget.cpp
blob: 117955d57bd0e569ceb5512f7f3bc016ddbbe886 (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
109
//
// C++ Implementation:
//
// Description:
//
//
// Author: KDevelop Authors <kdevelop-devel@kdevelop.org>, (C) 2003
//
// Copyright: See COPYING file that comes with this distribution
//
//

#include <kcolorcombo.h>

#include "vcscolorsconfigwidget.h"
#include "fileviewpart.h"

///////////////////////////////////////////////////////////////////////////////
// struct VCSColors
///////////////////////////////////////////////////////////////////////////////

VCSColors::VCSColors()
{
}

///////////////////////////////////////////////////////////////////////////////

VCSColors::VCSColors( const VCSColors &others )
{
    *this = others;
}

///////////////////////////////////////////////////////////////////////////////

VCSColors &VCSColors::operator=( const VCSColors &others )
{
    added = others.added;
    conflict = others.conflict;
    modified = others.modified;
    sticky = others.sticky;
    needsPatch = others.needsPatch;
    needsCheckout = others.needsCheckout;
    unknown = others.unknown;
    updated = others.updated;
    defaultColor = others.defaultColor;
    return *this;
}

///////////////////////////////////////////////////////////////////////////////
// class VCSColorsConfigWidget
///////////////////////////////////////////////////////////////////////////////

VCSColorsConfigWidget::VCSColorsConfigWidget(FileViewPart *part, const VCSColors &vcsColors,
    TQWidget* tqparent, const char* name, WFlags fl)
    : VCSColorsConfigWidgetBase( tqparent, name, fl ), m_part( part )
{
    setColors( vcsColors );
}

///////////////////////////////////////////////////////////////////////////////

VCSColorsConfigWidget::~VCSColorsConfigWidget()
{
}

///////////////////////////////////////////////////////////////////////////////

void VCSColorsConfigWidget::getColors( VCSColors &vcsColors ) const
{
    vcsColors.added = fileAddedColorCombo->color();
    vcsColors.conflict = fileConflictColorCombo->color();
    vcsColors.modified = fileModifiedColorCombo->color();
    vcsColors.sticky = fileStickyColorCombo->color();
    vcsColors.needsPatch = fileNeedsPatchColorCombo->color();
    vcsColors.needsCheckout = fileNeedsCheckoutColorCombo->color();
    vcsColors.unknown = fileUnknownColorCombo->color();
    vcsColors.updated = fileUpdatedColorCombo->color();
    vcsColors.defaultColor = defaultColorCombo->color();
}

///////////////////////////////////////////////////////////////////////////////

void VCSColorsConfigWidget::setColors( const VCSColors &vcsColors )
{
    fileAddedColorCombo->setColor( vcsColors.added );
    fileConflictColorCombo->setColor( vcsColors.conflict );
    fileModifiedColorCombo->setColor( vcsColors.modified );
    fileStickyColorCombo->setColor( vcsColors.sticky );
    fileNeedsPatchColorCombo->setColor( vcsColors.needsPatch );
    fileNeedsCheckoutColorCombo->setColor( vcsColors.needsCheckout );
    fileUnknownColorCombo->setColor( vcsColors.unknown );
    fileUpdatedColorCombo->setColor( vcsColors.updated );
    defaultColorCombo->setColor( vcsColors.defaultColor );
}

/*$SPECIALIZATION$*/

///////////////////////////////////////////////////////////////////////////////

void VCSColorsConfigWidget::slotAccept()
{
    VCSColors selectedColors;
    getColors( selectedColors );

    m_part->vcsColors = selectedColors;
}

#include "vcscolorsconfigwidget.moc"