~ubuntu-branches/ubuntu/breezy/kdemultimedia/breezy

« back to all changes in this revision

Viewing changes to noatun/noatun/modules/tron/cmodule.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2005-03-24 04:48:58 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 sarge)
  • Revision ID: james.westby@ubuntu.com-20050324044858-8ff88o9jxej6ii3d
Tags: 4:3.4.0-0ubuntu3
Add kubuntu_02_hide_arts_menu_entries.diff to hide artsbuilder and artscontrol k-menu entries

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// cmodule.cpp
2
 
//
3
 
// Copyright (C) 2001 Neil Stevens <multivac@fcmail.com>
4
 
//
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:
11
 
// 
12
 
// The above copyright notice and this permission notice shall be included in
13
 
// all copies or substantial portions of the Software.
14
 
// 
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.
21
 
// 
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).
25
 
 
26
 
#include <kcolorbutton.h>
27
 
#include <kconfig.h>
28
 
#include <kdialog.h>
29
 
#include <kglobal.h>
30
 
#include <klocale.h>
31
 
#include <qcolor.h>
32
 
#include <qcheckbox.h>
33
 
#include <qbuttongroup.h>
34
 
#include <qhbox.h>
35
 
#include <qlabel.h>
36
 
#include <qlayout.h>
37
 
#include <qvbox.h>
38
 
 
39
 
#include <noatunapp.h>
40
 
#include <pluginloader.h>
41
 
 
42
 
#include "cmodule.h"
43
 
#include "tron.h"
44
 
 
45
 
TronModule::TronModule(QObject *_parent)
46
 
        : CModule(i18n("Tron Playlist"), i18n("Configure The Playlist"), _parent)
47
 
{
48
 
        highlightFGColor = new KColorButton(this);
49
 
        highlightBGColor = new KColorButton(this);
50
 
 
51
 
        QHBoxLayout *highlightFGColorLayout = new QHBoxLayout(0, 0, KDialog::spacingHint());
52
 
        highlightFGColorLayout->addWidget( new QLabel(i18n("Current Track Text Color"), this) );
53
 
        highlightFGColorLayout->addWidget( highlightFGColor );
54
 
 
55
 
        QHBoxLayout *highlightBGColorLayout = new QHBoxLayout(0, 0, KDialog::spacingHint());
56
 
        highlightBGColorLayout->addWidget( new QLabel(i18n("Current Track Background Color"), this) );
57
 
        highlightBGColorLayout->addWidget( highlightBGColor );
58
 
 
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);
66
 
 
67
 
        QVBoxLayout *layout = new QVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint());
68
 
        layout->addLayout(highlightFGColorLayout);
69
 
        layout->addLayout(highlightBGColorLayout);
70
 
        layout->addWidget(columnButtons);
71
 
        layout->addStretch();
72
 
}
73
 
 
74
 
void TronModule::save(void)
75
 
{
76
 
        int columns = 0;
77
 
        for(int i = 0; i < 6; i++)
78
 
        {
79
 
                if(static_cast<QCheckBox *>(columnButtons->find(i))->isChecked())
80
 
                        columns |= 1 << i;
81
 
        }
82
 
 
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);
88
 
        config.sync();
89
 
 
90
 
        Tron *tron = Tron::tronical;
91
 
        if(tron)
92
 
        {
93
 
                tron->setColors(highlightFGColor->color(), highlightBGColor->color());
94
 
                tron->setColumns(columns);
95
 
        }
96
 
}
97
 
 
98
 
void TronModule::reopen(void)
99
 
{
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));
105
 
 
106
 
        int columns = config.readLongNumEntry("columns", 63);
107
 
        for(int i = 0; i < 6; i++)
108
 
        {
109
 
                if(columns & (1 << i))
110
 
                        static_cast<QCheckBox *>(columnButtons->find(i))->setChecked(true);
111
 
                else
112
 
                        static_cast<QCheckBox *>(columnButtons->find(i))->setChecked(false);
113
 
        }
114
 
}
115
 
 
116
 
#include "cmodule.moc"