summaryrefslogtreecommitdiffstats
path: root/kicker-applets/mediacontrol/configfrontend.cpp
blob: ba206c8298890a3a0c8e449864abe5d60efc8336 (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
/***************************************************************************
                 provides access to mediacontrol configuration file
                             -------------------
    begin                : forgot :/
    copyright            : (C) 2000-2002 by Stefan Gehn
    email                : metz {AT} gehn {DOT} net

    code-skeleton taken from knewsticker which is
    Copyright (c) Frerich Raabe <raabe@kde.org>
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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 "configfrontend.h"
// #include <kdebug.h>

ConfigFrontend::ConfigFrontend() : QObject(0, 0)
{
	_config = new KConfig(QString::null, true, false);
	_ownConfig = true;
}

ConfigFrontend::~ConfigFrontend()
{
    if (_ownConfig)
    {
        delete _config;
    }
}

ConfigFrontend::ConfigFrontend(KConfig *config) : QObject(0, 0)
{
	_config = config;
	_config->setGroup("MediaControl");
	_ownConfig = false;
}

// ====================================================================================

uint ConfigFrontend::mouseWheelSpeed() const
{
	return _config->readNumEntry("Mouse wheel speed", 5);
}

void ConfigFrontend::setMouseWheelSpeed(const uint mouseWheelSpeed)
{
	_config->writeEntry("Mouse wheel speed", mouseWheelSpeed);
	_config->sync();
}

// ====================================================================================

QString ConfigFrontend::player() const
{
	return _config->readPathEntry("Player", "Noatun");
}

void ConfigFrontend::setPlayer(const QString &player)
{
	_config->writePathEntry("Player", player);
	_config->sync();
}

// ====================================================================================

QString ConfigFrontend::theme() const
{
	return _config->readEntry("Theme", "default");
}

void ConfigFrontend::setTheme(const QString &theme)
{
	_config->writeEntry("Theme", theme);
	_config->sync();
}

// ====================================================================================

bool ConfigFrontend::useCustomTheme() const
{
	return _config->readBoolEntry("UseCustomTheme", false);
}

void ConfigFrontend::setUseCustomTheme(const bool use)
{
	_config->writeEntry("UseCustomTheme", use);
	_config->sync();
}

// ====================================================================================

#include "configfrontend.moc"