summaryrefslogtreecommitdiffstats
path: root/kwordquiz/src/prefcardappearance.cpp
blob: e2e08f2ad734c4b4a28b456fe430361de2380018 (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
//
// C++ Implementation:
//
// Description: KWordQuiz flashcard appearance preferences
//
//
// Author: Peter Hedlund <[email protected]>, (C) 2004
//
// Copyright: See COPYING file that comes with this distribution
//
//
#include <tqwidgetstack.h>
#include <tqlabel.h>

#include <kfontrequester.h>
#include <kcolorbutton.h>
#include <klocale.h>

#include "prefcardappearance.h"

PrefCardAppearance::PrefCardAppearance(TQWidget *parent, const char *name)
 : PrefCardAppearanceBase(parent, name)
{
  widgetStack->raiseWidget(frontStackPage);
}


PrefCardAppearance::~PrefCardAppearance()
{
}

void PrefCardAppearance::slotFlipButtonClicked( )
{
  if (widgetStack->visibleWidget() == frontStackPage)
    widgetStack->raiseWidget(backStackPage);
  else
    widgetStack->raiseWidget(frontStackPage);
}

void PrefCardAppearance::slotFontChanged(const TQFont & font)
{
  textLabel->setFont(font);
}

void PrefCardAppearance::slotTextColorChanged( const TQColor & color)
{
  textLabel->setPaletteForegroundColor(color);
}

void PrefCardAppearance::slotCardColorChanged( const TQColor & color)
{
  cardFrame->setPaletteBackgroundColor(color);
  titleLabel->setPaletteBackgroundColor(color);
  textLabel->setPaletteBackgroundColor(color);
  line->setPaletteBackgroundColor(color);
}

void PrefCardAppearance::slotFrameColorChanged( const TQColor & color)
{
  cardFrame->setPaletteForegroundColor(color);
  line->setPaletteForegroundColor(color);
}

void PrefCardAppearance::slotAboutToShowWidget(TQWidget * widget)
{
  if (widget == backStackPage)
  {
    titleLabel->setText(i18n("Back of the flashcard", "Back"));
    titleLabel->setPaletteBackgroundColor(kcfg_BackCardColor->color());
    textLabel->setText(i18n("Answer"));
    textLabel->setFont(kcfg_BackFont->font());
    textLabel->setPaletteForegroundColor(kcfg_BackTextColor->color());
    textLabel->setPaletteBackgroundColor(kcfg_BackCardColor->color());
    cardFrame->setPaletteBackgroundColor(kcfg_BackCardColor->color());
    cardFrame->setPaletteForegroundColor(kcfg_BackFrameColor->color());
    line->setPaletteForegroundColor(kcfg_BackFrameColor->color());
    line->setPaletteBackgroundColor(kcfg_BackCardColor->color());
  }
  else
  {
    titleLabel->setText(i18n("Front"));
    titleLabel->setPaletteBackgroundColor(kcfg_FrontCardColor->color());
    textLabel->setText(i18n("Question"));
    textLabel->setFont(kcfg_FrontFont->font());
    textLabel->setPaletteForegroundColor(kcfg_FrontTextColor->color());
    textLabel->setPaletteBackgroundColor(kcfg_FrontCardColor->color());
    cardFrame->setPaletteBackgroundColor(kcfg_FrontCardColor->color());
    cardFrame->setPaletteForegroundColor(kcfg_FrontFrameColor->color());
    line->setPaletteForegroundColor(kcfg_FrontFrameColor->color());
    line->setPaletteBackgroundColor(kcfg_FrontCardColor->color());
  }
}


#include "prefcardappearance.moc"