6
* $Id: configdlg.cpp,v 1.20 2001/05/31 03:58:54 jsinger Exp $
8
* Copyright (C) 1997 Bernd Johannes Wuebben
9
* wuebben@math.cornell.edu
12
* This library is free software; you can redistribute it and/or
13
* modify it under the terms of the GNU Library General Public
14
* License as published by the Free Software Foundation; either
15
* version 2 of the License, or (at your option) any later version.
17
* This library is distributed in the hope that it will be useful,
18
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20
* Library General Public License for more details.
22
* You should have received a copy of the GNU Library General Public
23
* License along with this program; if not, write to the Free
24
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29
#include <qpushbutton.h>
31
#include <qgroupbox.h>
32
#include <qcheckbox.h>
41
#include <kiconloader.h>
44
//#include <kcolorbtn.h>
46
#include "configdlg.h"
49
#include "midiapplication.h"
51
//QFont default_font("Helvetica", 12);
53
extern const char * whatsthis_image[];
55
ConfigDlg::ConfigDlg(QWidget *parent, struct configstruct *data, const char *name)
56
: QDialog(parent, name, TRUE)
58
setCaption("kmidi configuration");
59
setMinimumSize(300, 200);
61
configdata.background_color = black;
62
configdata.led_color = green;
63
configdata.tooltips = true;
64
configdata.max_patch_megs = 60;
67
configdata.background_color = data->background_color;
68
configdata.led_color = data->led_color;
69
configdata.tooltips = data->tooltips;
70
configdata.max_patch_megs = data->max_patch_megs;
75
* add a tabctrl widget
78
test = new KTabCtl(this, "test");
79
connect(test, SIGNAL(tabSelected(int)), this, SLOT(tabChanged(int)));
82
tl = new QVBoxLayout(this, 5);
83
bbox = new KButtonBox(this);
84
ok = bbox->addButton("OK");
86
cancel = bbox->addButton("Cancel");
87
cancel->setDefault(TRUE);
89
connect(ok, SIGNAL(clicked()), this, SLOT(accept()));
90
connect(cancel, SIGNAL(clicked()), this, SLOT(reject()));
92
helpbutton = bbox->addButton("Help");
93
connect(helpbutton, SIGNAL(clicked()), this, SLOT(help()));
94
QPixmap p( whatsthis_image );
95
helpbutton->setPixmap( p );
97
//helpmenu = new KHelpMenu(this, "kmidi plays midi files");
98
what = new QWhatsThis(this);
101
QWidget *w = new QWidget(test, "_page1");
103
//box = new QGroupBox(w, "box");
104
//box->setGeometry(10,10,320,260);
105
configsize = QSize( 320+20, 260+80 );
107
QString str = i18n("The led color is used in<br>\nthe panel and meter.");
108
label1 = new QLabel(w);
109
label1->setGeometry(60,25,135,25);
110
label1->setText(i18n("LED Color:"));
111
what->add(label1, str);
113
button1 = new KColorButton(configdata.led_color, w);
114
button1->setGeometry(205,25,100,45);
115
connect(button1,SIGNAL(changed( const QColor & )),this,SLOT(set_led_color( const QColor & )));
116
what->add(button1, str);
118
str = i18n("This color is for<br>\nthe panel and meter backgrounds.");
119
label2 = new QLabel(w);
120
label2->setGeometry(60,85,135,25);
121
label2->setText(i18n("Background Color:"));
122
what->add(label2, str);
124
button2 = new KColorButton(configdata.background_color, w);
125
button2->setGeometry(205,85,100,45);
126
connect(button2,SIGNAL(changed( const QColor & )),this,SLOT(set_background_color( const QColor & )));
127
what->add(button2, str);
129
ttcheckbox = new QCheckBox(i18n("Show Tool Tips"), w, "tooltipscheckbox");
130
ttcheckbox->setGeometry(30,150,135,25);
131
ttcheckbox->setFixedSize( ttcheckbox->sizeHint() );
132
ttcheckbox->setChecked(configdata.tooltips);
133
connect(ttcheckbox,SIGNAL(clicked()),this,SLOT(ttclicked()));
134
what->add(ttcheckbox, i18n("Provide brief descriptions<br>\n"
135
"when cursor is left over a<br>\n"
136
"object on the screen"));
138
str = i18n("Try to stop KMidi from<br>\nusing up too much of your RAM.");
139
label3 = new QLabel(w);
140
label3->setGeometry(60,200,135,25);
141
label3->setText("Patch Mem Max:");
142
what->add(label3, str);
143
meg = new KIntNumInput(configdata.max_patch_megs, w, 10, "hex_with_slider" );
144
meg->setRange(0, 255);
145
meg->setSpecialValueText("no limit");
147
connect(meg,SIGNAL(valueChanged(int)),this,SLOT(megChanged(int)));
151
test->addTab(w, "Configure");
155
w = new QWidget(test, "_page2");
156
about = new KAboutWidget(w, "_about");
157
QPixmap pm = UserIcon("kmidilogo");
159
about->setCaption(i18n("About KMidi"));
160
about->setVersion(i18n(KMIDIVERSION));
162
("Bernd Johannes Wuebben", "wuebben@kde.org", QString::null, i18n("Initial developer."));
163
// ----- set the application maintainer:
164
about->setMaintainer("Greg Lee", // name
165
"lee@hawaii.edu", // email address
166
QString::null, // URL
167
i18n("lyrics, IW patches, current maintainer.")); // description
168
// ----- add some contributors:
169
about->addContributor("Tuukka Toivonen",
170
"toivonen@clinet.fi",
171
"http://www.cgs.fi/~tt/discontinued.html",
172
i18n("TiMidity sound, patch loader, interface design, ..."));
173
about->addContributor("Takashi Iwai", "iwai@dragon.mm.t.u-tokyo.ac.jp",
174
"http://bahamut.mm.t.u-tokyo.ac.jp/~iwai/midi.html",
175
i18n("soundfonts, window communication"));
176
about->addContributor("Nicolas Witczak", "witczak@geocities.fr",
177
"http://www.geocities.com/SiliconValley/Lab/6307/",
178
i18n("effects: reverb, chorus, phaser, celeste"));
179
about->addContributor("Masanao Izumo", "mo@goice.co.jp",
180
"http://www.goice.co.jp/member/mo/timidity/",
181
i18n("mod wheel, portamento ..."));
182
about->addContributor("see the timidity.1 man page", "for authors of",
184
i18n("drivers, interfaces, configure scripts"));
186
connect(about, SIGNAL( sendEmail(const QString& , const QString& ) ),
187
this, SLOT ( sendEmailSlot(const QString& , const QString& ) ) );
188
connect(about, SIGNAL( openURL(const QString& ) ),
189
this, SLOT ( openURLSlot(const QString& ) ) );
191
// ----- contents of the dialog have changed, adapt sizes:
193
aboutsize = QSize( about->width() + 30, about->height() + 80 );
194
w->resize(width(), height());
195
test->addTab(w, "About");
200
w = new QWidget(test, "_page3");
201
patches = new KAboutWidget(w, "_patches");
202
QPixmap km = BarIcon("kmidi");
203
patches->setLogo(km);
204
//patches->setCaption(i18n("Patchsets"));
205
patches->setVersion(i18n("Where to get sets of patches."));
206
patches->setAuthor("Thomas Hammer", QString::null,
207
"http://metalab.unc.edu/thammer/HammerSound/",
208
i18n("links to many sf2 soundfonts"));
209
patches->setMaintainer("Eric A. Welsh",
210
"mailto:ewelsh@gpc.ibc.wustl.edu",
211
"http://www.stardate.bc.ca/gus_patches.htm",
212
i18n("GUS patches -- unrar needed to decompress."));
213
patches->addContributor("Chaos", "mailto:chaos@soback.kornet.nm.kr",
214
"http://taeback.kornet.nm.kr/~chaos/soundfont/",
215
"A very moderately sized soundfont (12 megs).");
216
patches->addContributor("Personal Copy v4.0.0", QString::null,
217
"http://www.personalcopy.com/sfarkfonts.htm",
218
"A very good large soundfont (38 megs).");
219
patches->addContributor("Msdos sfark decompressor.", QString::null,
220
"http://www.melodymachine.com/",
221
i18n("You may need this msdos-only tool."));
223
connect(patches, SIGNAL( sendEmail(const QString& , const QString& ) ),
224
this, SLOT ( sendEmailSlot(const QString& , const QString& ) ) );
225
connect(patches, SIGNAL( openURL(const QString& ) ),
226
this, SLOT ( openURLSlot(const QString& ) ) );
229
patchessize = QSize( patches->width() + 30, patches->height() + 80 );
230
w->resize(width(), height());
231
test->addTab(w, "Patchsets");
234
//------------------------
235
test->resize(configsize);
237
tl->addWidget(test,1);
239
tl->addWidget(bbox,0);
247
void ConfigDlg::sendEmailSlot(const QString& , const QString& email)
249
thisapp->invokeMailer( email, QString::null );
252
void ConfigDlg::openURLSlot(const QString& url)
254
thisapp->invokeBrowser( url );
257
void ConfigDlg::resizeEvent( QResizeEvent * )
259
test->resize(width(), height());
260
about->setGeometry(10, 10, pages[1]->width() - 20, pages[1]->height() - 20);
263
void ConfigDlg::tabChanged(int newpage)
265
//printf("tab number %d selected\n", newpage);
268
if (newpage == 1) resize(aboutsize);
269
else if (newpage == 2) resize(patchessize);
270
else resize(configsize);
274
void ConfigDlg::okbutton() {
278
void ConfigDlg::ttclicked(){
280
if(ttcheckbox->isChecked())
281
configdata.tooltips = TRUE;
283
configdata.tooltips = FALSE;
286
void ConfigDlg::help(){
289
// thisapp->invokeHTMLHelp("","");
291
//the damn thing won't go away
292
// (helpmenu->menu())->move( QCursor::pos() );
293
// (helpmenu->menu())->show();
294
// helpmenu->aboutApp();
295
QWhatsThis::enterWhatsThisMode();
298
void ConfigDlg::cancelbutton() {
302
void ConfigDlg::set_led_color( const QColor &newColor ) {
304
//KColorDialog::getColor(configdata.led_color);
305
configdata.led_color = newColor;
306
//qframe1->setBackgroundColor(configdata.led_color);
311
void ConfigDlg::set_background_color( const QColor &newColor ) {
313
//KColorDialog::getColor(configdata.background_color);
314
configdata.background_color = newColor;
315
//qframe2->setBackgroundColor(configdata.background_color);
319
void ConfigDlg::megChanged( int newMegs ) {
320
configdata.max_patch_megs = newMegs;
323
struct configstruct * ConfigDlg::getData(){
329
#include "configdlg.moc"