3
// Copyright (C) 2001 Neil Stevens <multivac@fcmail.com>
5
// Permission is hereby granted, free of charge, to any person obtaining a copy
6
// of this software and associated documentation files (the "Software"), to deal
7
// in the Software without restriction, including without limitation the rights
8
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
// copies of the Software, and to permit persons to whom the Software is
10
// furnished to do so, subject to the following conditions:
12
// The above copyright notice and this permission notice shall be included in
13
// all copies or substantial portions of the Software.
15
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
// THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
19
// AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
// Except as contained in this notice, the name(s) of the author(s) shall not be
23
// used in advertising or otherwise to promote the sale, use or other dealings
24
// in this Software without prior written authorization from the author(s).
26
#include <kcolorbutton.h>
32
#include <qcheckbox.h>
33
#include <qbuttongroup.h>
39
#include <noatunapp.h>
40
#include <pluginloader.h>
45
TronModule::TronModule(QObject *_parent)
46
: CModule(i18n("Tron Playlist"), i18n("Configure The Playlist"), _parent)
48
highlightFGColor = new KColorButton(this);
49
highlightBGColor = new KColorButton(this);
51
QHBoxLayout *highlightFGColorLayout = new QHBoxLayout(0, 0, KDialog::spacingHint());
52
highlightFGColorLayout->addWidget( new QLabel(i18n("Current Track Text Color"), this) );
53
highlightFGColorLayout->addWidget( highlightFGColor );
55
QHBoxLayout *highlightBGColorLayout = new QHBoxLayout(0, 0, KDialog::spacingHint());
56
highlightBGColorLayout->addWidget( new QLabel(i18n("Current Track Background Color"), this) );
57
highlightBGColorLayout->addWidget( highlightBGColor );
59
columnButtons = new QButtonGroup(2, Horizontal, i18n("Columns"), this);
60
(void)new QCheckBox(i18n("Title"), columnButtons);
61
(void)new QCheckBox(i18n("Length"), columnButtons);
62
(void)new QCheckBox(i18n("Artist"), columnButtons);
63
(void)new QCheckBox(i18n("Album"), columnButtons);
64
(void)new QCheckBox(i18n("Date"), columnButtons);
65
(void)new QCheckBox(i18n("Comment"), columnButtons);
67
QVBoxLayout *layout = new QVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint());
68
layout->addLayout(highlightFGColorLayout);
69
layout->addLayout(highlightBGColorLayout);
70
layout->addWidget(columnButtons);
74
void TronModule::save(void)
77
for(int i = 0; i < 6; i++)
79
if(static_cast<QCheckBox *>(columnButtons->find(i))->isChecked())
83
KConfig &config = *(KGlobal::config());
84
config.setGroup("tron");
85
config.writeEntry("highlightFGColor", highlightFGColor->color());
86
config.writeEntry("highlightBGColor", highlightBGColor->color());
87
config.writeEntry("columns", columns);
90
Tron *tron = Tron::tronical;
93
tron->setColors(highlightFGColor->color(), highlightBGColor->color());
94
tron->setColumns(columns);
98
void TronModule::reopen(void)
100
KConfig &config = *(KGlobal::config());
101
config.setGroup("tron");
102
QColor solaris(255, 255, 255), mustDie(64, 64, 192);
103
highlightFGColor->setColor(config.readColorEntry("highlightFGColor", &solaris));
104
highlightBGColor->setColor(config.readColorEntry("highlightBGColor", &mustDie));
106
int columns = config.readLongNumEntry("columns", 63);
107
for(int i = 0; i < 6; i++)
109
if(columns & (1 << i))
110
static_cast<QCheckBox *>(columnButtons->find(i))->setChecked(true);
112
static_cast<QCheckBox *>(columnButtons->find(i))->setChecked(false);
116
#include "cmodule.moc"