From e2de64d6f1beb9e492daf5b886e19933c1fa41dd Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdemultimedia@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kioslave/audiocd/kcmaudiocd/Makefile.am | 17 + kioslave/audiocd/kcmaudiocd/audiocd.desktop | 182 ++++++++ kioslave/audiocd/kcmaudiocd/audiocdconfig.ui | 628 +++++++++++++++++++++++++++ kioslave/audiocd/kcmaudiocd/kcmaudiocd.cpp | 267 ++++++++++++ kioslave/audiocd/kcmaudiocd/kcmaudiocd.h | 65 +++ 5 files changed, 1159 insertions(+) create mode 100644 kioslave/audiocd/kcmaudiocd/Makefile.am create mode 100644 kioslave/audiocd/kcmaudiocd/audiocd.desktop create mode 100644 kioslave/audiocd/kcmaudiocd/audiocdconfig.ui create mode 100644 kioslave/audiocd/kcmaudiocd/kcmaudiocd.cpp create mode 100644 kioslave/audiocd/kcmaudiocd/kcmaudiocd.h (limited to 'kioslave/audiocd/kcmaudiocd') diff --git a/kioslave/audiocd/kcmaudiocd/Makefile.am b/kioslave/audiocd/kcmaudiocd/Makefile.am new file mode 100644 index 00000000..962c3fa0 --- /dev/null +++ b/kioslave/audiocd/kcmaudiocd/Makefile.am @@ -0,0 +1,17 @@ +kde_module_LTLIBRARIES = kcm_audiocd.la + +kcm_audiocd_la_SOURCES = audiocdconfig.ui kcmaudiocd.cpp + +kcm_audiocd_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module +kcm_audiocd_la_LIBADD = ../plugins/libaudiocdplugins.la $(LIB_KDEUI) + +INCLUDES = -I$(srcdir)/../plugins -I$(top_srcdir)/libkcddb $(all_includes) + +kcm_audiocd_la_METASOURCES = AUTO + +messages: rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/kcmaudiocd.pot + +xdg_apps_DATA = audiocd.desktop + +audiocdconfig.cpp: audiocdconfig.h diff --git a/kioslave/audiocd/kcmaudiocd/audiocd.desktop b/kioslave/audiocd/kcmaudiocd/audiocd.desktop new file mode 100644 index 00000000..5a9df9a5 --- /dev/null +++ b/kioslave/audiocd/kcmaudiocd/audiocd.desktop @@ -0,0 +1,182 @@ +[Desktop Entry] +Exec=kcmshell audiocd +Icon=cdaudio_unmount +Type=Application + +X-KDE-ModuleType=Library +X-KDE-Library=audiocd + +Name=Audio CDs +Name[af]=Audio Cds +Name[ar]=أقراص مدمجة صوتية +Name[bg]=Аудио диск +Name[bn]=অডিও সিডি +Name[br]=CD klevet +Name[bs]=Audio CDi +Name[ca]=CD d'àudio +Name[cs]=Zvuková CD +Name[cy]=CDau Sain +Name[da]=Lyd-cd'er +Name[de]=Audio-CDs +Name[el]=CD μουσικής +Name[eo]=Son-KDoj +Name[es]=CDs audio +Name[et]=Audioplaadid +Name[eu]=Audio CD-ak +Name[fa]=دیسکهای فشردۀ صوتی +Name[fi]=Ääni-CD:t +Name[fr]=CD audio +Name[ga]=Dlúthdhioscaí Fuaime +Name[he]=תקליטורי שמע +Name[hi]=ऑडीयो सीडी +Name[hr]=Audio CD-i +Name[hu]=Hang-CD-böngésző +Name[is]=Tónlistardiskaflakkari +Name[it]=CD Audio +Name[ja]=オーディオ CD +Name[kk]=Аудио CD +Name[km]=ស៊ីឌី​អ៉ូឌីយ៉ូ +Name[ko]=오디오 CD +Name[lt]=Audio kompaktai +Name[mk]=Аудио ЦД-а +Name[nb]=Lyd-CD-er +Name[nds]=Klang-CDs +Name[ne]=अडियो सीडी +Name[nl]=Audio-cd's +Name[nn]=Lyd-CD-ar +Name[pa]=ਆਡੀਓ CD +Name[pl]=Przeglądarka audio CD +Name[pt]=CDs de Áudio +Name[pt_BR]=CDs de Áudio +Name[ro]=CD-uri audio +Name[ru]=Аудио CD +Name[se]=Jietna-CD:at +Name[sk]=Zvukové CD +Name[sl]=Avdio CD-ji +Name[sr]=Аудио CD-ови +Name[sr@Latn]=Audio CD-ovi +Name[sv]=Ljud-cd +Name[ta]=கேட்பொலி குறுந்தகடுகள் +Name[tg]=Дискҳои Фишурдаи Садо +Name[th]=ซีดีบันทึกเสียง +Name[tr]=Müzik CD +Name[uk]=Аудіо-КД +Name[uz]=Audio kompakt-disklar +Name[uz@cyrillic]=Аудио компакт-дисклар +Name[ven]=CD ino thetsheleswa +Name[xh]=CDs Zokuvakalayo +Name[zh_CN]=音频 CD +Name[zh_HK]=音樂 CD +Name[zh_TW]=音樂光碟 +Name[zu]=Ama-CD Okuzwakalayo +Comment=Audiocd IO Slave Configuration +Comment[af]=Klank cd Io Slaaf Opstelling +Comment[az]=Name=Audiosd IO Kölələri Quraşdırması +Comment[bg]=Настройване на аудио диска +Comment[bn]=অডিও-সিডি আই/ও স্লেভ কনফিগারেশন +Comment[br]=Kefluniadur Sklav IO Audiocd +Comment[bs]=Podešavanje Audiocd IO Slave +Comment[ca]=Configuració de l'E/S esclava dels CD àudio +Comment[cs]=Nastavení IO klienta pro zvuková CD +Comment[cy]=Gosodiad Gwas IO ar gyfer CDau Sain +Comment[da]=Lyd-cd IO-slave-indstilling +Comment[de]=Einrichtung des Ein-/Ausgabemoduls für Audio-CDs +Comment[el]=Ρύθμιση Audiocd IO Slave +Comment[eo]=Agordo por la muzikdiska sklavo +Comment[es]=Configuración del esclavo de E/S de audiocd +Comment[et]=Audio CD IO mooduli seadistamine +Comment[eu]=Audiocd IO mendekoaren konfigurazioa +Comment[fa]=پیکربندی پی‌رو IO دیسک فشردۀ صوتی +Comment[fi]=Audiocd-siirräntätyöskentelijän asetukset +Comment[fr]=Configuration du module pour CD audio +Comment[gl]=Configuración do escravo IO de audiocd +Comment[he]=שינוי הגדרות פרוטוקול תקליטורי השמע +Comment[hi]=ऑडियो-सीडी आई-ओ स्लेव कॉन्फ़िगरेशन +Comment[hr]=Postava Audiocd IO poslužnika +Comment[hu]=Az audiocd KDE-protokoll beállításai +Comment[is]=Stillingar Audiocd I/O þrælsins +Comment[it]=Configurazione dell'IO Slave per i CD Audio +Comment[ja]=オーディオ CD IO スレーブの設定 +Comment[kk]=AudioCD IO Slave баптауы +Comment[km]=ការ​កំណត់​រចនាសម្ព័ន្ធ IO Slave របស់​ស៊ីឌី​អូឌីយ៉ូ +Comment[ko]=오디오 CD IO 슬레이브 설정 +Comment[lt]=Audio kompakto IO vergo derinimas +Comment[ms]=Penyelarasan Hamba IO Audiocd +Comment[mt]=Konfigurazzjoni tal-iskjav IO AudioCD +Comment[nb]=Oppsett av lyd-CD IO-slave +Comment[nds]=Instellen för dat In-/Utgaavmoduul för Klang-CDs +Comment[ne]=Audiocd IO स्लेभ कन्फिगरेसन +Comment[nl]=AudioCD IO slave instellen +Comment[nn]=Oppsett av IU-slave for lyd-CD +Comment[pa]=ਆਡੀਓ ਸੀਡੀ IO ਸਲੇਵ ਸੰਰਚਨਾ +Comment[pl]=Konfiguracja procedury we/wy dla audio CD +Comment[pt]=Configuração do IO Slave de CDs-Áudio +Comment[pt_BR]=Configuração do Áudio CD Escravo +Comment[ro]=Configurează dispozitivul I/O pentru CD audio +Comment[ru]=Настройка протокола AudioCD +Comment[se]=Heivet SO-šláva jietna-CD:aid várás +Comment[sk]=Nastavenie IO klienta pre zvukové CD +Comment[sl]=Nastavitve Audiocd podrejeni V/I +Comment[sr]=Подешавање Audiocd IO Slave-а +Comment[sr@Latn]=Podešavanje Audiocd IO Slave-a +Comment[sv]=Anpassa I/O-slav för ljud-cd +Comment[ta]=ஒலிக் குறுந்தகடு உள்-வெளி அடிமை வடிவமைப்பு +Comment[tg]=Танзими Фармонбари Ворид/Хориҷи Дискҳои Фишурдаи Садо +Comment[th]=ปรับแต่ง Audiocd IO Slave +Comment[tr]=Müzik CD Yapılandırması +Comment[uk]=Налаштування підлеглого В/В "Audiocd" +Comment[ven]=Nzudzanyo Audiocd IO Slave +Comment[xh]=Video-DVD IO Slave Uqwalaselo +Comment[zh_CN]=音频 CD 输入输出从属模块配置 +Comment[zh_HK]=音樂 CD IO Slave 設定 +Comment[zh_TW]=音樂光碟 IO Slave 組態 +Comment[zu]=Inhlanganiselo ye-Audiocd IO Slave +Keywords=Audio CD,CD,Ogg,Vorbis,Encoding,CDDA,Bitrate +Keywords[bg]=аудио, диск, компактдиск, КД, кодек, музика, Audio CD, CD, Ogg, Vorbis, Encoding, CDDA, Bitrate +Keywords[br]=CD klevet,CD,Ogg,Vorbis,Kodadur,CDDA,Feur +Keywords[ca]=Àudio CD,CD,Ogg,Vorbis,Codificació,CDDA,Taxa de bits +Keywords[cs]=Zvukové CD,CD,Ogg,Vorbis,Kódování,CDDA,Bitrate,CDDB +Keywords[cy]=CD Sain,CD,crynoddisg,Ogg,Vorbis,Amgodio,CDDA,Cyfradd Ddidau +Keywords[da]=Lyd-cd,CD,Ogg,Vorbis,Indkodning,CDDA,Bitrate +Keywords[de]=Audio CD,CD,Ogg,Vorbis,Encoding,CDDA,Bitrate,MP3 +Keywords[el]=CD μουσικής,CD,Ogg,Vorbis,Κωδικοποίηση,CDDA,Ρυθμός bit +Keywords[es]=CD de audio,CD,Ogg,Vorbis,Codificación,CDDA,Ratio de bits +Keywords[et]=audio,CD,Ogg,Vorbis,kodeering,CDDA,bitikiirus +Keywords[eu]=Audio CD,CD,Ogg,Vorbis,Kdeketa,CDDA,bit-maiztasuna +Keywords[fa]=دیسک فشرده، دیسک فشرده، Ogg، Vorbis، کدبندی، CDDA، میزان ارسال بیت صوتی +Keywords[fi]=Ääni-CD,CD,Ogg,Vorbis,Koodaus,CDDA,Bittinopeus +Keywords[fr]=CD audio,CD,Ogg,Vorbis,Encodage,CDDA,débit +Keywords[ga]=CD Fuaime,CD,Ogg,Vorbis,Ionchódú,CDDA,Ráta Giotán +Keywords[gl]=Audio CD,CD,Ogg,Vorbis,Codificación,CDDA,Razón de Bits +Keywords[hi]=ऑडियो सीडी,सीडी,ऑग,वॉर्बिस,एनकोडिंग,सीडीडीए,बिटरेट +Keywords[hu]=hang-CD,CD,Ogg,Vorbis,kódolás,CDDA,bitráta +Keywords[it]=CD Audio,CD,Ogg,Vorbis,Codifica,CDDA,Bitrate +Keywords[ja]=オーディオ CD,CD,Ogg,Vorbis,エンコーディング,CDDA,ビットレート +Keywords[km]=ស៊ីឌី​អូឌីយ៉ូ,ស៊ីឌី,Ogg,Vorbis,អ៊ិនកូដ,CDDA,អត្រាប៊ីត +Keywords[ko]=오디오 CD,CD,Ogg,인코딩,CDDA +Keywords[lt]=Audio CD,CD,Ogg,Vorbis,Encoding,CDDA,Bitrate,įkodavimas +Keywords[mk]=Аудио CD,CD,Ogg,Vorbis,Кодирање,CDDA,Брзина во битови +Keywords[nb]=Audio CD,CD,Ogg,Vorbis,Koding,CDDA,Bitrate +Keywords[nds]=Audio-CD,Klang-CD,CD,Ogg,Vorbis,Koderen,CDDA,Bitrate +Keywords[ne]=अडियो सीडी,सीडी,अग,भर्बिस,सङ्केतन,सीडीडीए,बिटरेट +Keywords[nl]=Audio-cd,cd,Ogg,Vorbis,Encoding,CDDA,Bitrate +Keywords[nn]=lyd-CD,CD,Ogg,Vorbis,koding,CDDA,bitrate +Keywords[pa]=ਆਡੀਓ CD,CD,Ogg,Vorbis,ਇਕੋਡਿੰਗ,CDDA,ਬਿੱਟਰੇਟ +Keywords[pl]=Audio CD,CD,Ogg,Vorbis,Encoding,CDDA,Bitrate, Kodowanie +Keywords[pt]=CD de Áudio,CD,Ogg,Vorbis,Codificação,CDDA,Taxa de Bits +Keywords[pt_BR]=CD de Áudio,CD,Ogg,Vorbis,Codificação,CDDA,Bitrate +Keywords[ro]=CD audio,ogg,vorbis,codare,CDDA,rată de bit +Keywords[ru]=Audio CD,CD,Ogg,Vorbis,Encoding,CDDA,Bitrate,битрейт +Keywords[sk]=zvukové CD,CD,Ogg,Vorbis,kódovanie,CDDA,bitová frekvencia +Keywords[sl]=Avdio CD,CD,Ogg,Vorbis,kodiranje,CDDA,bitna hitrost +Keywords[sr]=Audio CD,CD,Ogg,Vorbis,Encoding,CDDA,Bitrate, Аудио CD, кодирање,битрата +Keywords[sr@Latn]=Audio CD,CD,Ogg,Vorbis,Encoding,CDDA,Bitrate, Audio CD, kodiranje,bitrata +Keywords[sv]=ljud-cd,cd,Ogg,Vorbis,kodning,CDDA,bithastighet +Keywords[ta]=கேட்பொலி குறுந்தகடு,குறுந்தகடு,ஓஜிஜி,வோர்பிஸ்,குறியிடுதல்,சிடிடேஏ,பிட் மதிப்பு +Keywords[tg]=Диски Фишурдаи Садо,Диски Фишурда,Ogg,Vorbis,Рамзигузор,CDDA,Bitrate +Keywords[th]=ซีดีบันทึกเสียง, ซีดี,Ogg,Vorbis,เข้ารหัส,CDDA,บิตเรต +Keywords[tr]=Ses CD,CD,Ogg,Vorbis,Kodlama,CDDA,Bitrate +Keywords[uk]=Аудіо-КД,КД,Ogg,Vorbis,кодування,CDDA,частота вибірки +Keywords[zh_CN]=音频 CD,CD,Ogg,Vorbis,编码,CDDA,Bitrate + +Categories=Qt;KDE;Settings;X-KDE-settings-sound; diff --git a/kioslave/audiocd/kcmaudiocd/audiocdconfig.ui b/kioslave/audiocd/kcmaudiocd/audiocdconfig.ui new file mode 100644 index 00000000..a742a4cc --- /dev/null +++ b/kioslave/audiocd/kcmaudiocd/audiocdconfig.ui @@ -0,0 +1,628 @@ + +AudiocdConfig + + + AudiocdConfig + + + + 0 + 0 + 640 + 563 + + + + + + + + + unnamed + + + 0 + + + 0 + + + + tabWidget + + + + 5 + 5 + 0 + 0 + + + + + + + + + tab + + + &General + + + + unnamed + + + + Spacer5 + + + Vertical + + + Expanding + + + + 20 + 210 + + + + + + encoderPriority + + + Encoder Priority + + + + unnamed + + + + niceLevel + + + -19 + + + 19 + + + 5 + + + Horizontal + + + NoMarks + + + + + textLabel2 + + + Highest + + + + + textLabel3 + + + Lowest + + + AlignVCenter|AlignRight + + + + + textLabel4 + + + Normal + + + AlignCenter + + + + + + + cd_device_string + + + false + + + /dev/cdrom + + + Specify a location for the drive you want to use. Normally, this is a file inside the /dev folder representing your CD or DVD drive. + + + + + cd_specify_device + + + &Specify CD device: + + + Check this to specify a CD device different from the one which is detected automatically + + + + + ec_enable_check + + + Use &error correction when reading the CD + + + true + + + If you uncheck this option, the slave will not try to use error correction which can be useful for reading damaged CDs. However, this feature can be problematic in some cases, so you can switch it off here. + + + + + ec_skip_check + + + &Skip on errors + + + false + + + + + spacer4_2 + + + Horizontal + + + Fixed + + + + 20 + 20 + + + + + + + + tab + + + &Names + + + + unnamed + + + + fileNameGroupBox + + + File Name (without extension) + + + + unnamed + + + + textLabel1_2 + + + The following macros will be expanded: + + + + + layout7 + + + + unnamed + + + + textLabel13 + + + Genre + + + + + textLabel7 + + + Track Number + + + + + textLabel2_3 + + + %{title} + + + + + textLabel11 + + + Year + + + + + textLabel3_3 + + + Track Title + + + + + textLabel9 + + + Album Artist + + + + + textLabel10 + + + %{year} + + + + + textLabel6 + + + %{albumtitle} + + + + + textLabel5 + + + Album Title + + + + + textLabel12 + + + %{genre} + + + + + textLabel8 + + + %{albumartist} + + + + + textLabel4_2 + + + %{number} + + + + + + + fileNameLineEdit + + + + + + + groupBox2 + + + Name Regular Expression Replacement + + + + unnamed + + + + textLabel2_2 + + + Selection: + + + + + textLabel1 + + + Regular expression used on all file names. For example using selection " " and replace with "_" would replace all the spaces with underlines. + + + + WordBreak|AlignVCenter + + + + + inputlabel + + + Input: + + + + + outputLabel + + + Output: + + + + + exampleLabel + + + Example + + + + + exampleOutput + + + Cool artist - example audio file.wav + + + + + example + + + Cool artist - example audio file.wav + + + + + kcfg_replaceInput + + + + + kcfg_replaceOutput + + + + + textLabel3_2 + + + Replace with: + + + + + line1 + + + HLine + + + Sunken + + + Horizontal + + + + + + + spacer4 + + + Vertical + + + Expanding + + + + 21 + 16 + + + + + + fileNameGroupBox_2 + + + Album Name + + + + unnamed + + + + fileNameLabel_2 + + + The following macros will be expanded: + + + + + layout9 + + + + unnamed + + + + textLabel20 + + + Year + + + + + textLabel15 + + + %{albumartist} + + + + + textLabel16 + + + %{year} + + + + + textLabel21 + + + Genre + + + + + textLabel19 + + + Album Artist + + + + + textLabel18 + + + Album Title + + + + + textLabel17 + + + %{genre} + + + + + textLabel14 + + + %{albumtitle} + + + + + + + spacer3 + + + Vertical + + + Expanding + + + + 20 + 31 + + + + + + albumNameLineEdit + + + + + + + + + + + + ec_enable_check + toggled(bool) + ec_skip_check + setEnabled(bool) + + + cd_specify_device + toggled(bool) + cd_device_string + setEnabled(bool) + + + + tabWidget + cd_device_string + ec_enable_check + ec_skip_check + niceLevel + fileNameLineEdit + albumNameLineEdit + kcfg_replaceInput + kcfg_replaceOutput + example + + + kcmodule.h + + + toggleLowpass() + + + + klineedit.h + + diff --git a/kioslave/audiocd/kcmaudiocd/kcmaudiocd.cpp b/kioslave/audiocd/kcmaudiocd/kcmaudiocd.cpp new file mode 100644 index 00000000..7551b7ad --- /dev/null +++ b/kioslave/audiocd/kcmaudiocd/kcmaudiocd.cpp @@ -0,0 +1,267 @@ +/* + Copyright (C) 2001 Carsten Duvenhorst + + 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. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include "kcmaudiocd.moc" +#include + +KAudiocdModule::KAudiocdModule(QWidget *parent, const char *name) + : AudiocdConfig(parent, name), configChanged(false) +{ + QString foo = i18n("Report errors found on the cd."); + + setButtons(Default|Apply); + + config = new KConfig("kcmaudiocdrc"); + + QPtrList encoders; + AudioCDEncoder::findAllPlugins(0, encoders); + AudioCDEncoder *encoder; + for ( encoder = encoders.first(); encoder; encoder = encoders.next() ){ + if (encoder->init()) { + KConfigSkeleton *config = NULL; + QWidget *widget = encoder->getConfigureWidget(&config); + if(widget && config){ + tabWidget->addTab(widget, i18n("%1 Encoder").arg(encoder->type())); + KConfigDialogManager *configManager = new KConfigDialogManager(widget, config, QString(encoder->type()+" EncoderConfigManager").latin1()); + encoderSettings.append(configManager); + } + } + } + + load(); + + KConfigDialogManager *widget; + for ( widget = encoderSettings.first(); widget; widget = encoderSettings.next() ){ + connect(widget, SIGNAL(widgetModified()), this, SLOT(slotModuleChanged())); + } + + //CDDA Options + connect(cd_specify_device,SIGNAL(clicked()),this,SLOT(slotConfigChanged())); + connect(ec_enable_check,SIGNAL(clicked()),this,SLOT(slotEcEnable())); + connect(ec_skip_check,SIGNAL(clicked()),SLOT(slotConfigChanged())); + connect(cd_device_string,SIGNAL(textChanged(const QString &)),SLOT(slotConfigChanged())); + connect(niceLevel,SIGNAL(valueChanged(int)),SLOT(slotConfigChanged())); + + // File Name + connect(fileNameLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(slotConfigChanged())); + connect(albumNameLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(slotConfigChanged())); + connect( kcfg_replaceInput, SIGNAL( textChanged(const QString&) ), this, SLOT( updateExample() ) ); + connect( kcfg_replaceOutput, SIGNAL( textChanged(const QString&) ), this, SLOT( updateExample() ) ); + connect( example, SIGNAL( textChanged(const QString&) ), this, SLOT( updateExample() ) ); + connect( kcfg_replaceInput, SIGNAL( textChanged(const QString&) ), this, SLOT( slotConfigChanged() ) ); + connect( kcfg_replaceOutput, SIGNAL( textChanged(const QString&) ), this, SLOT( slotConfigChanged() ) ); + connect( example, SIGNAL( textChanged(const QString&) ), this, SLOT( slotConfigChanged() ) ); + + KAboutData *about = + new KAboutData(I18N_NOOP("kcmaudiocd"), I18N_NOOP("KDE Audio CD IO Slave"), + 0, 0, KAboutData::License_GPL, + I18N_NOOP("(c) 2000 - 2005 Audio CD developers")); + + about->addAuthor("Benjamin C. Meyer", I18N_NOOP("Current Maintainer"), "ben@meyerhome.net"); + about->addAuthor("Carsten Duvenhorst", 0, "duvenhorst@duvnet.de"); + setAboutData(about); +} + +KAudiocdModule::~KAudiocdModule() +{ + delete config; +} + +QString removeQoutes(const QString& text) +{ + QString deqoutedString=text; + QRegExp qoutedStringRegExp("^\".*\"$"); + if (qoutedStringRegExp.exactMatch(text)) + { + deqoutedString=text.mid(1, text.length()-2); + } + return deqoutedString; +} + +bool needsQoutes(const QString& text) +{ + QRegExp spaceAtTheBeginning("^\\s+.*$"); + QRegExp spaceAtTheEnd("^.*\\s+$"); + return (spaceAtTheBeginning.exactMatch(text) || spaceAtTheEnd.exactMatch(text)); + + +} + +void KAudiocdModule::updateExample() +{ + QString text = example->text(); + QString deqoutedReplaceInput=removeQoutes(kcfg_replaceInput->text()); + QString deqoutedReplaceOutput=removeQoutes(kcfg_replaceOutput->text()); + + text.replace( QRegExp(deqoutedReplaceInput), deqoutedReplaceOutput ); + exampleOutput->setText(text); +} + +void KAudiocdModule::defaults() { + load( false ); +} + +void KAudiocdModule::save() { + if (!configChanged ) return; + + { + KConfigGroupSaver saver(config, "CDDA"); + + // autosearch is the name of the config option, which has the + // reverse sense of the current text of the configuration option, + // which is specify the device. Therefore, invert the value on write. + // + config->writeEntry("autosearch", !(cd_specify_device->isChecked()) ); + config->writeEntry("device",cd_device_string->text()); + config->writeEntry("disable_paranoia",!(ec_enable_check->isChecked())); + config->writeEntry("never_skip",!(ec_skip_check->isChecked())); + config->writeEntry("niceLevel", niceLevel->value()); + } + + { + KConfigGroupSaver saver(config, "FileName"); + config->writeEntry("file_name_template", fileNameLineEdit->text()); + config->writeEntry("album_name_template", albumNameLineEdit->text()); + config->writeEntry("regexp_example", example->text()); + // save qouted if required + QString replaceInput=kcfg_replaceInput->text(); + QString replaceOutput=kcfg_replaceOutput->text(); + if (needsQoutes(replaceInput)) + { + replaceInput=QString("\"")+replaceInput+QString("\""); + } + if (needsQoutes(replaceOutput)) + { + replaceOutput=QString("\"")+replaceOutput+QString("\""); + } + config->writeEntry("regexp_search", replaceInput); + config->writeEntry("regexp_replace", replaceOutput); + } + + KConfigDialogManager *widget; + for ( widget = encoderSettings.first(); widget; widget = encoderSettings.next() ){ + widget->updateSettings(); + } + + config->sync(); + + configChanged = false; + +} + +void KAudiocdModule::load() { + load( false ); +} + +void KAudiocdModule::load(bool useDefaults) { + + config->setReadDefaults( useDefaults ); + + { + KConfigGroupSaver saver(config, "CDDA"); + + + // Specify <=> not autosearch, as explained above in ::save() + cd_specify_device->setChecked( !(config->readBoolEntry("autosearch",true)) ); + cd_device_string->setText(config->readEntry("device","/dev/cdrom")); + ec_enable_check->setChecked(!(config->readBoolEntry("disable_paranoia",false))); + ec_skip_check->setChecked(!(config->readBoolEntry("never_skip",true))); + niceLevel->setValue(config->readNumEntry("niceLevel", 0)); + } + + { + KConfigGroupSaver saver(config, "FileName"); + fileNameLineEdit->setText(config->readEntry("file_name_template", "%{albumartist} - %{number} - %{title}")); + albumNameLineEdit->setText(config->readEntry("album_name_template", "%{albumartist} - %{albumtitle}")); + kcfg_replaceInput->setText(config->readEntry("regexp_search")); + kcfg_replaceOutput->setText(config->readEntry("regexp_replace")); + example->setText(config->readEntry("example", i18n("Cool artist - example audio file.wav"))); + } + + KConfigDialogManager *widget; + for ( widget = encoderSettings.first(); widget; widget = encoderSettings.next() ){ + widget->updateWidgets(); + } + + emit changed( useDefaults ); +} + +void KAudiocdModule::slotModuleChanged() { + KConfigDialogManager *widget; + for ( widget = encoderSettings.first(); widget; widget = encoderSettings.next() ){ + if(widget->hasChanged()){ + slotConfigChanged(); + break; + } + } +} + +void KAudiocdModule::slotConfigChanged() { + configChanged = true; + emit changed(true); +} + +/* +# slot for the error correction settings +*/ +void KAudiocdModule::slotEcEnable() { + if (!(ec_skip_check->isChecked())) { + ec_skip_check->setChecked(true); + } else { + if (ec_skip_check->isEnabled()) { + ec_skip_check->setChecked(false); + } + } + + slotConfigChanged(); +} + +QString KAudiocdModule::quickHelp() const +{ + return i18n("

Audio CDs

The Audio CD IO-Slave enables you to easily" + " create wav, MP3 or Ogg Vorbis files from your audio CD-ROMs or DVDs." + " The slave is invoked by typing \"audiocd:/\" in Konqueror's location" + " bar. In this module, you can configure" + " encoding, and device settings. Note that MP3 and Ogg" + " Vorbis encoding are only available if KDE was built with a recent" + " version of the LAME or Ogg Vorbis libraries."); +} + +extern "C" +{ + KCModule *create_audiocd(QWidget *parent, const char */*name*/) + { + return new KAudiocdModule(parent, "kcmaudiocd"); + } + +} diff --git a/kioslave/audiocd/kcmaudiocd/kcmaudiocd.h b/kioslave/audiocd/kcmaudiocd/kcmaudiocd.h new file mode 100644 index 00000000..7c322839 --- /dev/null +++ b/kioslave/audiocd/kcmaudiocd/kcmaudiocd.h @@ -0,0 +1,65 @@ +/* + + Copyright (C) 2001 Carsten Duvenhorst + + 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. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + Permission is also granted to link this program with the Qt + library, treating Qt like a library that normally accompanies the + operating system kernel, whether or not that is in fact the case. + +*/ + + +#ifndef KAUDIOCDCONFIG_H +#define KAUDIOCDCONFIG_H + +class KConfigDialogManager; + +#include "audiocdconfig.h" +class KAudiocdModule : public AudiocdConfig +{ + Q_OBJECT + +public: + + KAudiocdModule(QWidget *parent=0, const char *name=0); + ~KAudiocdModule(); + + QString quickHelp() const; + +public slots: + void defaults(); + void save(); + void load(); + void load(bool useDefaults); + +private slots: + void updateExample(); + void slotConfigChanged(); + void slotEcEnable(); + void slotModuleChanged(); + +private: + KConfig *config; + bool configChanged; + + int getBitrateIndex(int value); + + QPtrList encoderSettings; +}; + +#endif // KAUDIOCDCONFIG_H + -- cgit v1.2.1