1 /***************************************************************************
6 * begin : Tue Jan 29 2002
7 * copyright : (C) 2002 by Patrick Charbonnier
8 * : Based On Caitoo v.0.7.3 (c) 1998 - 2000, Matej Koss
9 * email : pch@freeshell.org
11 ****************************************************************************/
13 /***************************************************************************
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 ***************************************************************************/
28 #include <qcheckbox.h>
29 #include <qradiobutton.h>
30 #include <qpushbutton.h>
36 #include <kcombobox.h>
37 #include <kaudioplayer.h>
38 #include <kurlrequesterdlg.h>
39 #include <kfontrequester.h>
42 #include <kio/netaccess.h>
43 #include <kfiledialog.h>
45 #include "kmainwidget.h"
46 #include "dlgSystem.h"
48 #include <qbuttongroup.h>
52 DlgSystem::DlgSystem(QWidget
* parent
)
53 : DlgSystemBase(parent
)
60 void DlgSystem::setupSound()
65 int id
= cmb_sounds
->currentItem();
70 s
= i18n("Sound file name for action 'added':");
74 s
= i18n("Sound file name for action 'started':");
78 s
= i18n("Sound file name for action 'finished':");
82 s
= i18n("Sound file name for action 'finished-all':");
86 KURLRequesterDlg
*box
= new KURLRequesterDlg(t
, s
, this, "kurl_sound");
87 KFileDialog
*pDlg
= box
->fileDialog();
88 pDlg
->setFilter(i18n("*.wav|WAV Files\n*|All Files"));
89 int result
= box
->exec();
90 sDebug
<< "Result= " << result
<< endl
;
92 if (result
== QDialog::Rejected
)
94 sDebug
<< "Cancelled" << endl
;
99 s
= box
->selectedURL().url(); // text();
102 sDebug
<< "Selected audio files: " << s
<< endl
;
105 sDebugOut
<< "empty selection" << endl
;
124 soundFinishedAll
= s
;
132 void DlgSystem::testSound()
134 sDebug
<< ">>>>Entering" << endl
;
138 switch (cmb_sounds
->currentItem())
141 soundFile
= soundAdded
;
144 soundFile
= soundStarted
;
147 soundFile
= soundFinished
;
150 soundFile
= soundFinishedAll
;
154 sDebug
<< "File to play " << soundFile
<< endl
;
155 // KAudioPlayer::play(soundFile);
156 // KAudioPlayer::play( "/home/pch/pop.wav");
158 if (KIO::NetAccess::download(KURL( soundFile
), tmpFile
))
160 sDebug
<< "Temp file to play is " << tmpFile
<< endl
;
161 KAudioPlayer::play(tmpFile
);
162 KIO::NetAccess::removeTempFile(tmpFile
);
166 sDebug
<< "<<<<Leaving" << endl
;
170 void DlgSystem::setData()
172 cb_useSound
->setChecked(ksettings
.b_useSound
);
173 cmb_sounds
->setEnabled(ksettings
.b_useSound
);
174 pb_changesound
->setEnabled(ksettings
.b_useSound
);
175 pb_testsound
->setEnabled(ksettings
.b_useSound
);
177 soundAdded
= ksettings
.audioAdded
;
178 soundStarted
= ksettings
.audioStarted
;
179 soundFinished
= ksettings
.audioFinished
;
180 soundFinishedAll
= ksettings
.audioFinishedAll
;
182 cb_useAnimation
->setChecked(ksettings
.b_useAnimation
);
184 le_font
->setFont(ksettings
.listViewFont
);
188 void DlgSystem::applyData()
190 if (cb_useSound
->isChecked() != ksettings
.b_useSound
)
192 kmain
->slotToggleSound();
197 if (KIO::NetAccess::download(KURL( soundAdded
), tmpFile
))
198 ksettings
.audioAdded
= tmpFile
;
199 if (KIO::NetAccess::download(KURL( soundStarted
), tmpFile
))
200 ksettings
.audioStarted
= tmpFile
;
201 if (KIO::NetAccess::download(KURL( soundFinished
), tmpFile
))
202 ksettings
.audioFinished
= tmpFile
;
203 if (KIO::NetAccess::download(KURL( soundFinishedAll
), tmpFile
))
204 ksettings
.audioFinishedAll
= tmpFile
;
206 if (cb_useAnimation
->isChecked() != ksettings
.b_useAnimation
)
208 kmain
->slotToggleAnimation();
211 ksettings
.listViewFont
= le_font
->font();
212 kmain
->setListFont();
215 void DlgSystem::slotChanged()
217 emit
configChanged();
220 #include "dlgSystem.moc"