summaryrefslogtreecommitdiffstats
path: root/noatun/modules/voiceprint/prefs.cpp
blob: 4899868098b9cf2e945b50f5af3c6549d3592fe3 (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
#include "prefs.h"
#include "voiceprint.h"

#include <klocale.h>
#include <kglobal.h>
#include <qlabel.h>
#include <qlayout.h>
#include <kcolorbutton.h>
#include <kconfig.h>

Prefs::Prefs(QObject* parent)
	: CModule(i18n("Voiceprint"), i18n("Options for the Voiceprint Visualization"), "xapp", parent)
{
	QVBoxLayout	*king=new QVBoxLayout(this);
	QHBoxLayout *minor;

	QLabel *label;
	mForeground=new KColorButton(this);
	label=new QLabel(mForeground, i18n("&Foreground color:"), this);
	minor=new QHBoxLayout(king);
	minor->addWidget(label);
	minor->addWidget(mForeground);

	mBackground=new KColorButton(this);
	label=new QLabel(mBackground, i18n("&Background color:"), this);
	minor=new QHBoxLayout(king);
	minor->addWidget(label);
	minor->addWidget(mBackground);
	
	mLine=new KColorButton(this);
	label=new QLabel(mForeground, i18n("&Sweep color:"), this);
	minor=new QHBoxLayout(king);
	minor->addWidget(label);
	minor->addWidget(mLine);

	king->addStretch();
}

void Prefs::reopen()
{
	KConfig *config=KGlobal::config();
	config->setGroup("VoicePrint");
        QColor black(0, 0, 0);
        QColor blue(0, 0, 222);
	mBackground->setColor(config->readColorEntry("Background", &black));
	mForeground->setColor(config->readColorEntry("Foreground", &blue));
	mLine->setColor(config->readColorEntry("Line", &black));
}

void Prefs::save()
{
	KConfig *config=KGlobal::config();
	config->setGroup("VoicePrint");
	config->writeEntry("Background", mBackground->color());
	config->writeEntry("Foreground", mForeground->color());
	config->writeEntry("Line", mLine->color());

	config->sync();

	VoicePrint *l=VoicePrint::voicePrint;
	if (l)
		l->setColors(mBackground->color(), mForeground->color(), mLine->color());

}

#include "prefs.moc"